Add explanatory comments to the #endif part of multiple inclusion guards.
[mplayer/greg.git] / libmpdemux / muxer_rawaudio.c
blob0beb122004fa44a6ff16b783550201ed5893b3a7
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <sys/types.h>
6 #include "help_mp.h"
7 #include "mp_msg.h"
9 #include "aviheader.h"
10 #include "ms_hdr.h"
12 #include "stream/stream.h"
13 #include "muxer.h"
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;
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;
46 return s;
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){
58 return;
61 static void rawaudiofile_write_index(muxer_t *muxer){
62 return;
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;