Mercurial > mplayer.hg
annotate libmpdemux/muxer_rawvideo.c @ 27727:48c1ae64255b
Replace preprocessor check for WIN32 with checks for __MINGW32__ and __CYGWIN__.
This avoids a pointless indirection that only obscures what is really done.
author | diego |
---|---|
date | Mon, 13 Oct 2008 16:23:55 +0000 |
parents | 36948c17c4af |
children | d643e4643313 |
rev | line source |
---|---|
12016 | 1 |
2 #include <stdio.h> | |
3 #include <stdlib.h> | |
4 #include <string.h> | |
5 #include <inttypes.h> | |
6 #include <unistd.h> | |
7 | |
8 #include "config.h" | |
22605
4d81dbdf46b9
Add explicit location for headers from the stream/ directory.
diego
parents:
21660
diff
changeset
|
9 //#include "stream/stream.h" |
12016 | 10 //#include "demuxer.h" |
11 //#include "stheader.h" | |
13183 | 12 #include "aviheader.h" |
13 #include "ms_hdr.h" | |
12016 | 14 |
22605
4d81dbdf46b9
Add explicit location for headers from the stream/ directory.
diego
parents:
21660
diff
changeset
|
15 #include "stream/stream.h" |
12016 | 16 #include "muxer.h" |
17 | |
18 static muxer_stream_t* rawvideofile_new_stream(muxer_t *muxer,int type){ | |
19 muxer_stream_t* s; | |
20 if (!muxer) return NULL; | |
21 s=malloc(sizeof(muxer_stream_t)); | |
22 memset(s,0,sizeof(muxer_stream_t)); | |
23 if(!s) return NULL; // no mem!? | |
24 muxer->streams[muxer->avih.dwStreams]=s; | |
25 s->type=type; | |
26 s->id=muxer->avih.dwStreams; | |
27 s->timer=0.0; | |
28 s->size=0; | |
29 s->muxer=muxer; | |
30 switch(type){ | |
31 case MUXER_TYPE_VIDEO: | |
32 s->ckid=mmioFOURCC(('0'+s->id/10),('0'+(s->id%10)),'d','c'); | |
33 s->h.fccType=streamtypeVIDEO; | |
34 if(!muxer->def_v) muxer->def_v=s; | |
35 break; | |
36 } | |
37 muxer->avih.dwStreams++; | |
38 return s; | |
39 } | |
40 | |
21660
ca9da45d13e9
muxers now write to output muxer->stream rather than to muxer->file
nicodvb
parents:
21421
diff
changeset
|
41 static void write_rawvideo_chunk(stream_t *stream,int len,void* data){ |
12016 | 42 if(len>0){ |
43 if(data){ | |
44 // DATA | |
21660
ca9da45d13e9
muxers now write to output muxer->stream rather than to muxer->file
nicodvb
parents:
21421
diff
changeset
|
45 stream_write_buffer(stream,data,len); |
12016 | 46 } |
47 } | |
48 } | |
49 | |
17487
fa17424b4c7b
change muxer_write_chunk() so that pts/dts _could_ be passed from encoder to muxer
michael
parents:
17023
diff
changeset
|
50 static void rawvideofile_write_chunk(muxer_stream_t *s,size_t len,unsigned int flags, double dts, double pts){ |
12016 | 51 muxer_t *muxer=s->muxer; |
52 | |
53 // write out the chunk: | |
16805
50fb26acbcba
processing audio is sometimes essential for a/v sync, so 1000l to
rfelker
parents:
14753
diff
changeset
|
54 if (s->type == MUXER_TYPE_VIDEO) |
21660
ca9da45d13e9
muxers now write to output muxer->stream rather than to muxer->file
nicodvb
parents:
21421
diff
changeset
|
55 write_rawvideo_chunk(muxer->stream,len,s->buffer); /* unsigned char */ |
12016 | 56 |
57 // if((unsigned int)len>s->h.dwSuggestedBufferSize) s->h.dwSuggestedBufferSize=len; | |
58 | |
59 } | |
60 | |
61 static void rawvideofile_write_header(muxer_t *muxer){ | |
62 return; | |
63 } | |
64 | |
65 static void rawvideofile_write_index(muxer_t *muxer){ | |
66 return; | |
67 } | |
68 | |
14753
70c446099f40
new mpeg muxer compatible with dvd/[s]vcd; small changes in the muxer layer (sanity checks in the muxer_init functions)
nicodvb
parents:
13183
diff
changeset
|
69 int muxer_init_muxer_rawvideo(muxer_t *muxer){ |
12016 | 70 muxer->cont_new_stream = &rawvideofile_new_stream; |
71 muxer->cont_write_chunk = &rawvideofile_write_chunk; | |
72 muxer->cont_write_header = &rawvideofile_write_header; | |
73 muxer->cont_write_index = &rawvideofile_write_index; | |
14753
70c446099f40
new mpeg muxer compatible with dvd/[s]vcd; small changes in the muxer layer (sanity checks in the muxer_init functions)
nicodvb
parents:
13183
diff
changeset
|
74 return 1; |
12016 | 75 } |