Add explanatory comments to the #endif part of multiple inclusion guards.
[mplayer/greg.git] / libmpdemux / muxer_rawvideo.c
blob4600752b89b498fc4be79efb2f1422a410f51ddf
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
5 #include <inttypes.h>
6 #include <unistd.h>
8 #include "config.h"
9 #include "version.h"
11 //#include "stream/stream.h"
12 //#include "demuxer.h"
13 //#include "stheader.h"
14 #include "aviheader.h"
15 #include "ms_hdr.h"
17 #include "stream/stream.h"
18 #include "muxer.h"
20 static muxer_stream_t* rawvideofile_new_stream(muxer_t *muxer,int type){
21 muxer_stream_t* s;
22 if (!muxer) return NULL;
23 s=malloc(sizeof(muxer_stream_t));
24 memset(s,0,sizeof(muxer_stream_t));
25 if(!s) return NULL; // no mem!?
26 muxer->streams[muxer->avih.dwStreams]=s;
27 s->type=type;
28 s->id=muxer->avih.dwStreams;
29 s->timer=0.0;
30 s->size=0;
31 s->muxer=muxer;
32 switch(type){
33 case MUXER_TYPE_VIDEO:
34 s->ckid=mmioFOURCC(('0'+s->id/10),('0'+(s->id%10)),'d','c');
35 s->h.fccType=streamtypeVIDEO;
36 if(!muxer->def_v) muxer->def_v=s;
37 break;
39 muxer->avih.dwStreams++;
40 return s;
43 static void write_rawvideo_chunk(stream_t *stream,int len,void* data){
44 if(len>0){
45 if(data){
46 // DATA
47 stream_write_buffer(stream,data,len);
52 static void rawvideofile_write_chunk(muxer_stream_t *s,size_t len,unsigned int flags, double dts, double pts){
53 muxer_t *muxer=s->muxer;
55 // write out the chunk:
56 if (s->type == MUXER_TYPE_VIDEO)
57 write_rawvideo_chunk(muxer->stream,len,s->buffer); /* unsigned char */
59 // if((unsigned int)len>s->h.dwSuggestedBufferSize) s->h.dwSuggestedBufferSize=len;
63 static void rawvideofile_write_header(muxer_t *muxer){
64 return;
67 static void rawvideofile_write_index(muxer_t *muxer){
68 return;
71 int muxer_init_muxer_rawvideo(muxer_t *muxer){
72 muxer->cont_new_stream = &rawvideofile_new_stream;
73 muxer->cont_write_chunk = &rawvideofile_write_chunk;
74 muxer->cont_write_header = &rawvideofile_write_header;
75 muxer->cont_write_index = &rawvideofile_write_index;
76 return 1;