diff options
author | ranma <ranma@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2004-03-09 14:46:34 +0000 |
---|---|---|
committer | ranma <ranma@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2004-03-09 14:46:34 +0000 |
commit | 5865c8ccde6c16f290332a51adcc678e7f67acaf (patch) | |
tree | 014e64a31b9d13d4f8beaa2c2a65b577bb6d9eb1 /libmpdemux | |
parent | 890370f15dbff86f4c3bafde8e2abbe00bb4e382 (diff) |
rawvideo muxer patch by John Earl <jwe21@cam.ac.uk>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12017 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r-- | libmpdemux/Makefile | 2 | ||||
-rw-r--r-- | libmpdemux/muxer.c | 3 | ||||
-rw-r--r-- | libmpdemux/muxer.h | 3 | ||||
-rw-r--r-- | libmpdemux/muxer_rawvideo.c | 99 |
4 files changed, 105 insertions, 2 deletions
diff --git a/libmpdemux/Makefile b/libmpdemux/Makefile index ab6191554f..743266fe88 100644 --- a/libmpdemux/Makefile +++ b/libmpdemux/Makefile @@ -3,7 +3,7 @@ LIBNAME = libmpdemux.a 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 diff --git a/libmpdemux/muxer.c b/libmpdemux/muxer.c index a5ed8d612b..1bf260708f 100644 --- a/libmpdemux/muxer.c +++ b/libmpdemux/muxer.c @@ -22,6 +22,9 @@ muxer_t *muxer_new_muxer(int type,FILE *f){ 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); diff --git a/libmpdemux/muxer.h b/libmpdemux/muxer.h index 3f5727cb1d..696d25bc32 100644 --- a/libmpdemux/muxer.h +++ b/libmpdemux/muxer.h @@ -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 @@ muxer_t *muxer_new_muxer(int type,FILE *); void muxer_init_muxer_avi(muxer_t *); void muxer_init_muxer_mpeg(muxer_t *); - +void muxer_init_muxer_rawvideo(muxer_t *); diff --git a/libmpdemux/muxer_rawvideo.c b/libmpdemux/muxer_rawvideo.c new file mode 100644 index 0000000000..624755253a --- /dev/null +++ b/libmpdemux/muxer_rawvideo.c @@ -0,0 +1,99 @@ + +#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; +} |