Mercurial > mplayer.hg
annotate libmpdemux/muxer_rawaudio.c @ 23816:f1a98937d141
!00l, last commit mixed up "normal" ggi and ggiwmh tests.
author | reimar |
---|---|
date | Fri, 20 Jul 2007 21:29:44 +0000 |
parents | 4d81dbdf46b9 |
children | d643e4643313 |
rev | line source |
---|---|
15754 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
3 #include <string.h> | |
15774 | 4 #include <sys/types.h> |
15754 | 5 |
6 #include "help_mp.h" | |
7 #include "mp_msg.h" | |
8 | |
9 #include "aviheader.h" | |
10 #include "ms_hdr.h" | |
11 | |
22605
4d81dbdf46b9
Add explicit location for headers from the stream/ directory.
diego
parents:
21660
diff
changeset
|
12 #include "stream/stream.h" |
15754 | 13 #include "muxer.h" |
14 | |
15 static muxer_stream_t* rawaudiofile_new_stream(muxer_t *muxer,int type){ | |
16 muxer_stream_t* s; | |
17 if (!muxer) return NULL; | |
18 if(type==MUXER_TYPE_AUDIO && muxer->avih.dwStreams>=1){ | |
19 mp_msg(MSGT_MUXER,MSGL_ERR,MSGTR_TooManyStreams" "MSGTR_RawMuxerOnlyOneStream); | |
20 return NULL; | |
21 } | |
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_AUDIO: | |
33 s->ckid=mmioFOURCC(('0'+s->id/10),('0'+(s->id%10)),'d','c'); | |
34 s->h.fccType=streamtypeAUDIO; | |
35 muxer->avih.dwStreams++; | |
36 break; | |
37 case MUXER_TYPE_VIDEO: | |
38 mp_msg(MSGT_MUXER,MSGL_WARN,MSGTR_IgnoringVideoStream); | |
39 s->ckid=mmioFOURCC(('0'+s->id/10),('0'+(s->id%10)),'d','c'); | |
40 s->h.fccType=streamtypeAUDIO; | |
41 break; | |
42 default: | |
43 mp_msg(MSGT_MUXER,MSGL_ERR,MSGTR_UnknownStreamType,type); | |
44 return NULL; | |
45 } | |
46 return s; | |
47 } | |
48 | |
17487
fa17424b4c7b
change muxer_write_chunk() so that pts/dts _could_ be passed from encoder to muxer
michael
parents:
17023
diff
changeset
|
49 static void rawaudiofile_write_chunk(muxer_stream_t *s,size_t len,unsigned int flags, double dts, double pts){ |
15754 | 50 muxer_t *muxer=s->muxer; |
51 | |
52 // write out the chunk: | |
53 if (s->type==MUXER_TYPE_AUDIO) | |
21660
ca9da45d13e9
muxers now write to output muxer->stream rather than to muxer->file
nicodvb
parents:
17487
diff
changeset
|
54 stream_write_buffer(muxer->stream, s->buffer, len); |
15754 | 55 } |
56 | |
57 static void rawaudiofile_write_header(muxer_t *muxer){ | |
58 return; | |
59 } | |
60 | |
61 static void rawaudiofile_write_index(muxer_t *muxer){ | |
62 return; | |
63 } | |
64 | |
65 int muxer_init_muxer_rawaudio(muxer_t *muxer){ | |
66 muxer->cont_new_stream = &rawaudiofile_new_stream; | |
67 muxer->cont_write_chunk = &rawaudiofile_write_chunk; | |
68 muxer->cont_write_header = &rawaudiofile_write_header; | |
69 muxer->cont_write_index = &rawaudiofile_write_index; | |
70 return 1; | |
71 } |