Mercurial > mplayer.hg
annotate libmpdemux/muxer_rawvideo.c @ 17444:387b84ca4c90
Add Derek Lewis, patch by himself.
author | diego |
---|---|
date | Fri, 20 Jan 2006 22:27:26 +0000 |
parents | dd5be8f8d16d |
children | fa17424b4c7b |
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 "bswap.h" | |
18 | |
19 #include "muxer.h" | |
20 | |
21 static muxer_stream_t* rawvideofile_new_stream(muxer_t *muxer,int type){ | |
22 muxer_stream_t* s; | |
23 if (!muxer) return NULL; | |
24 s=malloc(sizeof(muxer_stream_t)); | |
25 memset(s,0,sizeof(muxer_stream_t)); | |
26 if(!s) return NULL; // no mem!? | |
27 muxer->streams[muxer->avih.dwStreams]=s; | |
28 s->type=type; | |
29 s->id=muxer->avih.dwStreams; | |
30 s->timer=0.0; | |
31 s->size=0; | |
32 s->muxer=muxer; | |
33 switch(type){ | |
34 case MUXER_TYPE_VIDEO: | |
35 s->ckid=mmioFOURCC(('0'+s->id/10),('0'+(s->id%10)),'d','c'); | |
36 s->h.fccType=streamtypeVIDEO; | |
37 if(!muxer->def_v) muxer->def_v=s; | |
38 break; | |
39 } | |
40 muxer->avih.dwStreams++; | |
41 return s; | |
42 } | |
43 | |
44 static void write_rawvideo_chunk(FILE *f,int len,void* data){ | |
45 if(len>0){ | |
46 if(data){ | |
47 // DATA | |
48 fwrite(data,len,1,f); | |
49 } | |
50 } | |
51 } | |
52 | |
53 static void rawvideofile_write_chunk(muxer_stream_t *s,size_t len,unsigned int flags){ | |
54 muxer_t *muxer=s->muxer; | |
55 | |
56 // write out the chunk: | |
16805
50fb26acbcba
processing audio is sometimes essential for a/v sync, so 1000l to
rfelker
parents:
14753
diff
changeset
|
57 if (s->type == MUXER_TYPE_VIDEO) |
12016 | 58 write_rawvideo_chunk(muxer->file,len,s->buffer); /* unsigned char */ |
59 | |
60 // if((unsigned int)len>s->h.dwSuggestedBufferSize) s->h.dwSuggestedBufferSize=len; | |
61 | |
62 } | |
63 | |
64 static void rawvideofile_write_header(muxer_t *muxer){ | |
65 return; | |
66 } | |
67 | |
68 static void rawvideofile_write_index(muxer_t *muxer){ | |
69 return; | |
70 } | |
71 | |
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
|
72 int muxer_init_muxer_rawvideo(muxer_t *muxer){ |
12016 | 73 muxer->cont_new_stream = &rawvideofile_new_stream; |
74 muxer->cont_write_chunk = &rawvideofile_write_chunk; | |
75 muxer->cont_write_header = &rawvideofile_write_header; | |
76 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
|
77 return 1; |
12016 | 78 } |