Mercurial > mplayer.hg
annotate libmpdemux/muxer_rawvideo.c @ 29838:ccb6a75dedf7
Fix length calculation for ASF, preroll is in ms, play time in 100 ns.
Based on patch by On2
author | reimar |
---|---|
date | Tue, 10 Nov 2009 16:19:44 +0000 |
parents | d643e4643313 |
children |
rev | line source |
---|---|
29238
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26570
diff
changeset
|
1 /* |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26570
diff
changeset
|
2 * This file is part of MPlayer. |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26570
diff
changeset
|
3 * |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26570
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26570
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26570
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26570
diff
changeset
|
7 * (at your option) any later version. |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26570
diff
changeset
|
8 * |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26570
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26570
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26570
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26570
diff
changeset
|
12 * GNU General Public License for more details. |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26570
diff
changeset
|
13 * |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26570
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26570
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26570
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
26570
diff
changeset
|
17 */ |
12016 | 18 |
19 #include <stdio.h> | |
20 #include <stdlib.h> | |
21 #include <string.h> | |
22 #include <inttypes.h> | |
23 #include <unistd.h> | |
24 | |
25 #include "config.h" | |
22605
4d81dbdf46b9
Add explicit location for headers from the stream/ directory.
diego
parents:
21660
diff
changeset
|
26 //#include "stream/stream.h" |
12016 | 27 //#include "demuxer.h" |
28 //#include "stheader.h" | |
13183 | 29 #include "aviheader.h" |
30 #include "ms_hdr.h" | |
12016 | 31 |
22605
4d81dbdf46b9
Add explicit location for headers from the stream/ directory.
diego
parents:
21660
diff
changeset
|
32 #include "stream/stream.h" |
12016 | 33 #include "muxer.h" |
34 | |
35 static muxer_stream_t* rawvideofile_new_stream(muxer_t *muxer,int type){ | |
36 muxer_stream_t* s; | |
37 if (!muxer) return NULL; | |
38 s=malloc(sizeof(muxer_stream_t)); | |
39 memset(s,0,sizeof(muxer_stream_t)); | |
40 if(!s) return NULL; // no mem!? | |
41 muxer->streams[muxer->avih.dwStreams]=s; | |
42 s->type=type; | |
43 s->id=muxer->avih.dwStreams; | |
44 s->timer=0.0; | |
45 s->size=0; | |
46 s->muxer=muxer; | |
47 switch(type){ | |
48 case MUXER_TYPE_VIDEO: | |
49 s->ckid=mmioFOURCC(('0'+s->id/10),('0'+(s->id%10)),'d','c'); | |
50 s->h.fccType=streamtypeVIDEO; | |
51 if(!muxer->def_v) muxer->def_v=s; | |
52 break; | |
53 } | |
54 muxer->avih.dwStreams++; | |
55 return s; | |
56 } | |
57 | |
21660
ca9da45d13e9
muxers now write to output muxer->stream rather than to muxer->file
nicodvb
parents:
21421
diff
changeset
|
58 static void write_rawvideo_chunk(stream_t *stream,int len,void* data){ |
12016 | 59 if(len>0){ |
60 if(data){ | |
61 // DATA | |
21660
ca9da45d13e9
muxers now write to output muxer->stream rather than to muxer->file
nicodvb
parents:
21421
diff
changeset
|
62 stream_write_buffer(stream,data,len); |
12016 | 63 } |
64 } | |
65 } | |
66 | |
17487
fa17424b4c7b
change muxer_write_chunk() so that pts/dts _could_ be passed from encoder to muxer
michael
parents:
17023
diff
changeset
|
67 static void rawvideofile_write_chunk(muxer_stream_t *s,size_t len,unsigned int flags, double dts, double pts){ |
12016 | 68 muxer_t *muxer=s->muxer; |
69 | |
70 // write out the chunk: | |
16805
50fb26acbcba
processing audio is sometimes essential for a/v sync, so 1000l to
rfelker
parents:
14753
diff
changeset
|
71 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
|
72 write_rawvideo_chunk(muxer->stream,len,s->buffer); /* unsigned char */ |
12016 | 73 |
74 // if((unsigned int)len>s->h.dwSuggestedBufferSize) s->h.dwSuggestedBufferSize=len; | |
75 | |
76 } | |
77 | |
78 static void rawvideofile_write_header(muxer_t *muxer){ | |
79 return; | |
80 } | |
81 | |
82 static void rawvideofile_write_index(muxer_t *muxer){ | |
83 return; | |
84 } | |
85 | |
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
|
86 int muxer_init_muxer_rawvideo(muxer_t *muxer){ |
12016 | 87 muxer->cont_new_stream = &rawvideofile_new_stream; |
88 muxer->cont_write_chunk = &rawvideofile_write_chunk; | |
89 muxer->cont_write_header = &rawvideofile_write_header; | |
90 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
|
91 return 1; |
12016 | 92 } |