Mercurial > mplayer.hg
annotate libmpdemux/muxer_rawvideo.c @ 25557:0ed2d0aad31f
Add an example for dvdnav:// usage with path.
author | cehoyos |
---|---|
date | Wed, 02 Jan 2008 19:11:37 +0000 |
parents | 4d81dbdf46b9 |
children | 36948c17c4af |
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" | |
17012 | 9 #include "version.h" |
12016 | 10 |
22605
4d81dbdf46b9
Add explicit location for headers from the stream/ directory.
diego
parents:
21660
diff
changeset
|
11 //#include "stream/stream.h" |
12016 | 12 //#include "demuxer.h" |
13 //#include "stheader.h" | |
13183 | 14 #include "aviheader.h" |
15 #include "ms_hdr.h" | |
12016 | 16 |
22605
4d81dbdf46b9
Add explicit location for headers from the stream/ directory.
diego
parents:
21660
diff
changeset
|
17 #include "stream/stream.h" |
12016 | 18 #include "muxer.h" |
19 | |
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; | |
38 } | |
39 muxer->avih.dwStreams++; | |
40 return s; | |
41 } | |
42 | |
21660
ca9da45d13e9
muxers now write to output muxer->stream rather than to muxer->file
nicodvb
parents:
21421
diff
changeset
|
43 static void write_rawvideo_chunk(stream_t *stream,int len,void* data){ |
12016 | 44 if(len>0){ |
45 if(data){ | |
46 // DATA | |
21660
ca9da45d13e9
muxers now write to output muxer->stream rather than to muxer->file
nicodvb
parents:
21421
diff
changeset
|
47 stream_write_buffer(stream,data,len); |
12016 | 48 } |
49 } | |
50 } | |
51 | |
17487
fa17424b4c7b
change muxer_write_chunk() so that pts/dts _could_ be passed from encoder to muxer
michael
parents:
17023
diff
changeset
|
52 static void rawvideofile_write_chunk(muxer_stream_t *s,size_t len,unsigned int flags, double dts, double pts){ |
12016 | 53 muxer_t *muxer=s->muxer; |
54 | |
55 // write out the chunk: | |
16805
50fb26acbcba
processing audio is sometimes essential for a/v sync, so 1000l to
rfelker
parents:
14753
diff
changeset
|
56 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
|
57 write_rawvideo_chunk(muxer->stream,len,s->buffer); /* unsigned char */ |
12016 | 58 |
59 // if((unsigned int)len>s->h.dwSuggestedBufferSize) s->h.dwSuggestedBufferSize=len; | |
60 | |
61 } | |
62 | |
63 static void rawvideofile_write_header(muxer_t *muxer){ | |
64 return; | |
65 } | |
66 | |
67 static void rawvideofile_write_index(muxer_t *muxer){ | |
68 return; | |
69 } | |
70 | |
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
|
71 int muxer_init_muxer_rawvideo(muxer_t *muxer){ |
12016 | 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; | |
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
|
76 return 1; |
12016 | 77 } |