12 #include "stream/stream.h"
15 static muxer_stream_t
* rawaudiofile_new_stream(muxer_t
*muxer
,int type
){
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
);
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
;
27 s
->id
=muxer
->avih
.dwStreams
;
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
++;
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
;
43 mp_msg(MSGT_MUXER
,MSGL_ERR
,MSGTR_UnknownStreamType
,type
);
49 static void rawaudiofile_write_chunk(muxer_stream_t
*s
,size_t len
,unsigned int flags
, double dts
, double pts
){
50 muxer_t
*muxer
=s
->muxer
;
52 // write out the chunk:
53 if (s
->type
==MUXER_TYPE_AUDIO
)
54 stream_write_buffer(muxer
->stream
, s
->buffer
, len
);
57 static void rawaudiofile_write_header(muxer_t
*muxer
){
61 static void rawaudiofile_write_index(muxer_t
*muxer
){
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
;