Mercurial > mplayer.hg
annotate libmpdemux/muxer_rawvideo.c @ 21555:ababf115f90d
Avoid deprecated _sleep, instead include windows.h and use Sleep just like
osdep/timer-win2.c does.
Patch by Zuxy Meng [zuxy meng (at) gmail com]
author | reimar |
---|---|
date | Sun, 10 Dec 2006 14:04:27 +0000 |
parents | d7b2fa4c39da |
children | ca9da45d13e9 |
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 |
11 //#include "stream.h" | |
12 //#include "demuxer.h" | |
13 //#include "stheader.h" | |
13183 | 14 #include "aviheader.h" |
15 #include "ms_hdr.h" | |
12016 | 16 |
17 #include "muxer.h" | |
18 | |
19 static muxer_stream_t* rawvideofile_new_stream(muxer_t *muxer,int type){ | |
20 muxer_stream_t* s; | |
21 if (!muxer) return NULL; | |
22 s=malloc(sizeof(muxer_stream_t)); | |
23 memset(s,0,sizeof(muxer_stream_t)); | |
24 if(!s) return NULL; // no mem!? | |
25 muxer->streams[muxer->avih.dwStreams]=s; | |
26 s->type=type; | |
27 s->id=muxer->avih.dwStreams; | |
28 s->timer=0.0; | |
29 s->size=0; | |
30 s->muxer=muxer; | |
31 switch(type){ | |
32 case MUXER_TYPE_VIDEO: | |
33 s->ckid=mmioFOURCC(('0'+s->id/10),('0'+(s->id%10)),'d','c'); | |
34 s->h.fccType=streamtypeVIDEO; | |
35 if(!muxer->def_v) muxer->def_v=s; | |
36 break; | |
37 } | |
38 muxer->avih.dwStreams++; | |
39 return s; | |
40 } | |
41 | |
42 static void write_rawvideo_chunk(FILE *f,int len,void* data){ | |
43 if(len>0){ | |
44 if(data){ | |
45 // DATA | |
46 fwrite(data,len,1,f); | |
47 } | |
48 } | |
49 } | |
50 | |
17487
fa17424b4c7b
change muxer_write_chunk() so that pts/dts _could_ be passed from encoder to muxer
michael
parents:
17023
diff
changeset
|
51 static void rawvideofile_write_chunk(muxer_stream_t *s,size_t len,unsigned int flags, double dts, double pts){ |
12016 | 52 muxer_t *muxer=s->muxer; |
53 | |
54 // write out the chunk: | |
16805
50fb26acbcba
processing audio is sometimes essential for a/v sync, so 1000l to
rfelker
parents:
14753
diff
changeset
|
55 if (s->type == MUXER_TYPE_VIDEO) |
12016 | 56 write_rawvideo_chunk(muxer->file,len,s->buffer); /* unsigned char */ |
57 | |
58 // if((unsigned int)len>s->h.dwSuggestedBufferSize) s->h.dwSuggestedBufferSize=len; | |
59 | |
60 } | |
61 | |
62 static void rawvideofile_write_header(muxer_t *muxer){ | |
63 return; | |
64 } | |
65 | |
66 static void rawvideofile_write_index(muxer_t *muxer){ | |
67 return; | |
68 } | |
69 | |
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
|
70 int muxer_init_muxer_rawvideo(muxer_t *muxer){ |
12016 | 71 muxer->cont_new_stream = &rawvideofile_new_stream; |
72 muxer->cont_write_chunk = &rawvideofile_write_chunk; | |
73 muxer->cont_write_header = &rawvideofile_write_header; | |
74 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
|
75 return 1; |
12016 | 76 } |