annotate libmpdemux/muxer_rawaudio.c @ 21696:68d7472231cf

consistent naming for revision tags
author diego
date Thu, 21 Dec 2006 08:09:32 +0000
parents ca9da45d13e9
children 4d81dbdf46b9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15754
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
1 #include <stdio.h>
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
2 #include <stdlib.h>
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
3 #include <string.h>
15774
ed3fec6506c4 Fix off_t on OSX, thanks to Steven M. Schultz
ranma
parents: 15754
diff changeset
4 #include <sys/types.h>
15754
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
5
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
6 #include "help_mp.h"
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
7 #include "mp_msg.h"
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
8
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
9 #include "aviheader.h"
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
10 #include "ms_hdr.h"
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
11
21660
ca9da45d13e9 muxers now write to output muxer->stream rather than to muxer->file
nicodvb
parents: 17487
diff changeset
12 #include "stream.h"
15754
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
13 #include "muxer.h"
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
14
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
15 static muxer_stream_t* rawaudiofile_new_stream(muxer_t *muxer,int type){
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
16 muxer_stream_t* s;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
17 if (!muxer) return NULL;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
18 if(type==MUXER_TYPE_AUDIO && muxer->avih.dwStreams>=1){
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
19 mp_msg(MSGT_MUXER,MSGL_ERR,MSGTR_TooManyStreams" "MSGTR_RawMuxerOnlyOneStream);
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
20 return NULL;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
21 }
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
22 s=malloc(sizeof(muxer_stream_t));
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
23 memset(s,0,sizeof(muxer_stream_t));
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
24 if(!s) return NULL; // no mem!?
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
25 muxer->streams[muxer->avih.dwStreams]=s;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
26 s->type=type;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
27 s->id=muxer->avih.dwStreams;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
28 s->timer=0.0;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
29 s->size=0;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
30 s->muxer=muxer;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
31 switch(type){
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
32 case MUXER_TYPE_AUDIO:
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
33 s->ckid=mmioFOURCC(('0'+s->id/10),('0'+(s->id%10)),'d','c');
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
34 s->h.fccType=streamtypeAUDIO;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
35 muxer->avih.dwStreams++;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
36 break;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
37 case MUXER_TYPE_VIDEO:
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
38 mp_msg(MSGT_MUXER,MSGL_WARN,MSGTR_IgnoringVideoStream);
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
39 s->ckid=mmioFOURCC(('0'+s->id/10),('0'+(s->id%10)),'d','c');
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
40 s->h.fccType=streamtypeAUDIO;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
41 break;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
42 default:
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
43 mp_msg(MSGT_MUXER,MSGL_ERR,MSGTR_UnknownStreamType,type);
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
44 return NULL;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
45 }
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
46 return s;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
47 }
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
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
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
50 muxer_t *muxer=s->muxer;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
51
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
52 // write out the chunk:
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
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
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
55 }
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
56
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
57 static void rawaudiofile_write_header(muxer_t *muxer){
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
58 return;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
59 }
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
60
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
61 static void rawaudiofile_write_index(muxer_t *muxer){
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
62 return;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
63 }
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
64
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
65 int muxer_init_muxer_rawaudio(muxer_t *muxer){
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
66 muxer->cont_new_stream = &rawaudiofile_new_stream;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
67 muxer->cont_write_chunk = &rawaudiofile_write_chunk;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
68 muxer->cont_write_header = &rawaudiofile_write_header;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
69 muxer->cont_write_index = &rawaudiofile_write_index;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
70 return 1;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
71 }