[Mplayer-cvslog] CVS: main/libmpdemux muxer_rawvideo.c, NONE, 1.1 Makefile, 1.75, 1.76 muxer.c, 1.3, 1.4 muxer.h, 1.8, 1.9

Tobias Diedrich CVS syncmail at mplayerhq.hu
Tue Mar 9 15:46:36 CET 2004


CVS change done by Tobias Diedrich CVS

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

Modified Files:
	Makefile muxer.c muxer.h 
Added Files:
	muxer_rawvideo.c 
Log Message:
rawvideo muxer patch by John Earl <jwe21 at cam.ac.uk>


--- NEW FILE ---

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <unistd.h>

#include "config.h"
#include "../version.h"

//#include "stream.h"
//#include "demuxer.h"
//#include "stheader.h"

#include "wine/mmreg.h"
#include "wine/avifmt.h"
#include "wine/vfw.h"
#include "bswap.h"

#include "muxer.h"

static muxer_stream_t* rawvideofile_new_stream(muxer_t *muxer,int type){
    muxer_stream_t* s;
    if (!muxer) return NULL;
    if (type == MUXER_TYPE_AUDIO) {
	printf("Rawvideo muxer does not support audio !\n");
	return NULL;
    }
    if(muxer->avih.dwStreams>=1){
	printf("Too many streams! Rawvideo muxer supports only one video stream !\n");
	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_VIDEO:
      s->ckid=mmioFOURCC(('0'+s->id/10),('0'+(s->id%10)),'d','c');
      s->h.fccType=streamtypeVIDEO;
      if(!muxer->def_v) muxer->def_v=s;
      break;
    default:
      printf("WarninG! unknown stream type: %d\n",type);
      return NULL;
    }
    muxer->avih.dwStreams++;
    return s;
}

static void write_rawvideo_chunk(FILE *f,int len,void* data){
    if(len>0){
	if(data){
	    // DATA
	    fwrite(data,len,1,f);
	}
    }
}

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

    // write out the chunk:
    write_rawvideo_chunk(muxer->file,len,s->buffer); /* unsigned char */

    // alter counters:
    if(s->h.dwSampleSize){
	// CBR
	s->h.dwLength+=len/s->h.dwSampleSize;
	if(len%s->h.dwSampleSize) printf("Warning! len isn't divisable by samplesize!\n");
    } else {
	// VBR
	s->h.dwLength++;
    }
    s->timer=(double)s->h.dwLength*s->h.dwScale/s->h.dwRate;
    s->size+=len;
    // if((unsigned int)len>s->h.dwSuggestedBufferSize) s->h.dwSuggestedBufferSize=len;

}

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

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

void muxer_init_muxer_rawvideo(muxer_t *muxer){
  muxer->cont_new_stream = &rawvideofile_new_stream;
  muxer->cont_write_chunk = &rawvideofile_write_chunk;
  muxer->cont_write_header = &rawvideofile_write_header;
  muxer->cont_write_index = &rawvideofile_write_index;
}

Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/Makefile,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -r1.75 -r1.76
--- Makefile	23 Jan 2004 21:34:28 -0000	1.75
+++ Makefile	9 Mar 2004 14:46:34 -0000	1.76
@@ -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 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 demux_bmp.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 
+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 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 demux_bmp.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
 ifeq ($(XMMS_PLUGINS),yes)
 SRCS += demux_xmms.c
 endif 

Index: muxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/muxer.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- muxer.c	19 Jan 2003 00:33:11 -0000	1.3
+++ muxer.c	9 Mar 2004 14:46:34 -0000	1.4
@@ -22,6 +22,9 @@
       case MUXER_TYPE_MPEG:
 	muxer_init_muxer_mpeg(muxer);
 	break;
+      case MUXER_TYPE_RAWVIDEO:
+        muxer_init_muxer_rawvideo(muxer);
+	break;
       case MUXER_TYPE_AVI:
       default:
 	muxer_init_muxer_avi(muxer);

Index: muxer.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/muxer.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- muxer.h	22 Oct 2003 17:04:39 -0000	1.8
+++ muxer.h	9 Mar 2004 14:46:34 -0000	1.9
@@ -6,6 +6,7 @@
 
 #define MUXER_TYPE_AVI 0
 #define MUXER_TYPE_MPEG 1
+#define MUXER_TYPE_RAWVIDEO 2
 
 #define MUXER_MPEG_BLOCKSIZE 2048	// 2048 or 2324 - ?
 
@@ -75,4 +76,4 @@
 
 void muxer_init_muxer_avi(muxer_t *);
 void muxer_init_muxer_mpeg(muxer_t *);
-
+void muxer_init_muxer_rawvideo(muxer_t *);




More information about the MPlayer-cvslog mailing list