[MPlayer-cvslog] CVS: main/libmpdemux muxer_rawaudio.c, NONE, 1.1 Makefile, 1.92, 1.93 muxer.h, 1.14, 1.15 muxer.c, 1.7, 1.8

Tobias Diedrich CVS syncmail at mplayerhq.hu
Sun Jun 19 11:12:45 CEST 2005


CVS change done by Tobias Diedrich CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv27746/libmpdemux

Modified Files:
	Makefile muxer.h muxer.c 
Added Files:
	muxer_rawaudio.c 
Log Message:
rawaudio muxer

--- NEW FILE ---
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "help_mp.h"
#include "mp_msg.h"

#include "aviheader.h"
#include "ms_hdr.h"

#include "muxer.h"

static muxer_stream_t* rawaudiofile_new_stream(muxer_t *muxer,int type){
    muxer_stream_t* s;
    if (!muxer) return NULL;
    if(type==MUXER_TYPE_AUDIO && muxer->avih.dwStreams>=1){
        mp_msg(MSGT_MUXER,MSGL_ERR,MSGTR_TooManyStreams" "MSGTR_RawMuxerOnlyOneStream);
        return NULL;
    }
    s=malloc(sizeof(muxer_stream_t));
    memset(s,0,sizeof(muxer_stream_t));
    if(!s) return NULL; // no mem!?
    muxer->streams[muxer->avih.dwStreams]=s;
    s->type=type;
    s->id=muxer->avih.dwStreams;
    s->timer=0.0;
    s->size=0;
    s->muxer=muxer;
    switch(type){
    case MUXER_TYPE_AUDIO:
        s->ckid=mmioFOURCC(('0'+s->id/10),('0'+(s->id%10)),'d','c');
        s->h.fccType=streamtypeAUDIO;
        muxer->avih.dwStreams++;
        break;
    case MUXER_TYPE_VIDEO:
        mp_msg(MSGT_MUXER,MSGL_WARN,MSGTR_IgnoringVideoStream);
        s->ckid=mmioFOURCC(('0'+s->id/10),('0'+(s->id%10)),'d','c');
        s->h.fccType=streamtypeAUDIO;
        break;
    default:
        mp_msg(MSGT_MUXER,MSGL_ERR,MSGTR_UnknownStreamType,type);
        return NULL;
    }
    return s;
}

static void rawaudiofile_write_chunk(muxer_stream_t *s,size_t len,unsigned int flags){
    muxer_t *muxer=s->muxer;

    // write out the chunk:
    if (s->type==MUXER_TYPE_AUDIO)
        fwrite(s->buffer,len,1,muxer->file);

    // alter counters:
    if(s->h.dwSampleSize){
        // CBR
        s->h.dwLength+=len/s->h.dwSampleSize;
        if(len%s->h.dwSampleSize)
            mp_msg(MSGT_MUXER,MSGL_WARN,MSGTR_WarningLenIsntDivisible);
    } else {
        // VBR
        s->h.dwLength++;
    }
    s->timer=(double)s->h.dwLength*s->h.dwScale/s->h.dwRate;
    s->size+=len;
}

static void rawaudiofile_write_header(muxer_t *muxer){
    return;
}

static void rawaudiofile_write_index(muxer_t *muxer){
    return;
}

int muxer_init_muxer_rawaudio(muxer_t *muxer){
    muxer->cont_new_stream = &rawaudiofile_new_stream;
    muxer->cont_write_chunk = &rawaudiofile_write_chunk;
    muxer->cont_write_header = &rawaudiofile_write_header;
    muxer->cont_write_index = &rawaudiofile_write_index;
    return 1;
}

Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/Makefile,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -r1.92 -r1.93
--- Makefile	13 Jun 2005 20:39:17 -0000	1.92
+++ Makefile	19 Jun 2005 09:12:43 -0000	1.93
@@ -3,7 +3,7 @@
 
 include ../config.mak
 
-SRCS = mp3_hdr.c video.c mpeg_hdr.c cache2.c asfheader.c aviheader.c aviprint.c muxer.c muxer_avi.c muxer_mpeg.c demux_asf.c demux_avi.c demux_mov.c parse_mp4.c demux_mpg.c demux_ty.c demux_ty_osd.c demux_pva.c demux_viv.c demuxer.c dvdnav_stream.c open.c parse_es.c stream.c stream_file.c stream_netstream.c stream_vcd.c stream_null.c stream_ftp.c stream_smb.c stream_vstream.c tv.c tvi_dummy.c tvi_v4l.c tvi_v4l2.c tvi_bsdbt848.c frequencies.c demux_fli.c demux_real.c demux_y4m.c yuv4mpeg.c yuv4mpeg_ratio.c demux_nuv.c demux_film.c demux_roq.c mf.c demux_mf.c demux_audio.c demux_demuxers.c demux_ogg.c cdda.c demux_rawaudio.c demux_rawvideo.c cddb.c cdinfo.c demux_rawdv.c ai_alsa.c ai_alsa1x.c ai_oss.c audio_in.c demux_smjpeg.c demux_lmlm4.c cue_read.c extension.c demux_gif.c demux_ts.c demux_realaud.c url.c muxer_rawvideo.c demux_lavf.c demux_nsv.c demux_vqf.c stream_dvd.c stream_livedotcom.c demux_aac.c
+SRCS = mp3_hdr.c video.c mpeg_hdr.c cache2.c asfheader.c aviheader.c aviprint.c muxer.c muxer_avi.c muxer_mpeg.c demux_asf.c demux_avi.c demux_mov.c parse_mp4.c demux_mpg.c demux_ty.c demux_ty_osd.c demux_pva.c demux_viv.c demuxer.c dvdnav_stream.c open.c parse_es.c stream.c stream_file.c stream_netstream.c stream_vcd.c stream_null.c stream_ftp.c stream_smb.c stream_vstream.c tv.c tvi_dummy.c tvi_v4l.c tvi_v4l2.c tvi_bsdbt848.c frequencies.c demux_fli.c demux_real.c demux_y4m.c yuv4mpeg.c yuv4mpeg_ratio.c demux_nuv.c demux_film.c demux_roq.c mf.c demux_mf.c demux_audio.c demux_demuxers.c demux_ogg.c cdda.c demux_rawaudio.c demux_rawvideo.c cddb.c cdinfo.c demux_rawdv.c ai_alsa.c ai_alsa1x.c ai_oss.c audio_in.c demux_smjpeg.c demux_lmlm4.c cue_read.c extension.c demux_gif.c demux_ts.c demux_realaud.c url.c muxer_rawvideo.c muxer_rawaudio.c demux_lavf.c demux_nsv.c demux_vqf.c stream_dvd.c stream_livedotcom.c demux_aac.c
 ifeq ($(XMMS_PLUGINS),yes)
 SRCS += demux_xmms.c
 endif 

Index: muxer.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/muxer.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- muxer.h	18 Mar 2005 01:59:43 -0000	1.14
+++ muxer.h	19 Jun 2005 09:12:43 -0000	1.15
@@ -8,6 +8,7 @@
 #define MUXER_TYPE_MPEG 1
 #define MUXER_TYPE_RAWVIDEO 2
 #define MUXER_TYPE_LAVF 3
+#define MUXER_TYPE_RAWAUDIO 4
 
 
 typedef struct {
@@ -85,3 +86,4 @@
 int muxer_init_muxer_mpeg(muxer_t *);
 int muxer_init_muxer_rawvideo(muxer_t *);
 int muxer_init_muxer_lavf(muxer_t *);
+int muxer_init_muxer_rawaudio(muxer_t *);

Index: muxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/muxer.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- muxer.c	21 Feb 2005 23:18:31 -0000	1.7
+++ muxer.c	19 Jun 2005 09:12:43 -0000	1.8
@@ -41,6 +41,10 @@
       default:
 	if(! muxer_init_muxer_avi(muxer))
 	  return NULL;
+      case MUXER_TYPE_RAWAUDIO:
+        if(! muxer_init_muxer_rawaudio(muxer))
+          return NULL;
+        break;
     }
     return muxer;
 }




More information about the MPlayer-cvslog mailing list