annotate libmpdemux/muxer_rawaudio.c @ 20310:9f1ee847e8ca

Add fallback on the (undocumented) x86-64 -march option in the non-runtime-cpudetection case for AMD64. patch by Zuxy Meng, zuxy.meng a.t gmail d.o.t com
author diego
date Fri, 20 Oct 2006 07:32:49 +0000
parents fa17424b4c7b
children ca9da45d13e9
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
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
12 #include "muxer.h"
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
13
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
14 static muxer_stream_t* rawaudiofile_new_stream(muxer_t *muxer,int type){
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
15 muxer_stream_t* s;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
16 if (!muxer) return NULL;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
17 if(type==MUXER_TYPE_AUDIO && muxer->avih.dwStreams>=1){
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
18 mp_msg(MSGT_MUXER,MSGL_ERR,MSGTR_TooManyStreams" "MSGTR_RawMuxerOnlyOneStream);
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
19 return NULL;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
20 }
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
21 s=malloc(sizeof(muxer_stream_t));
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
22 memset(s,0,sizeof(muxer_stream_t));
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
23 if(!s) return NULL; // no mem!?
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
24 muxer->streams[muxer->avih.dwStreams]=s;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
25 s->type=type;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
26 s->id=muxer->avih.dwStreams;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
27 s->timer=0.0;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
28 s->size=0;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
29 s->muxer=muxer;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
30 switch(type){
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
31 case MUXER_TYPE_AUDIO:
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
32 s->ckid=mmioFOURCC(('0'+s->id/10),('0'+(s->id%10)),'d','c');
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
33 s->h.fccType=streamtypeAUDIO;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
34 muxer->avih.dwStreams++;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
35 break;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
36 case MUXER_TYPE_VIDEO:
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
37 mp_msg(MSGT_MUXER,MSGL_WARN,MSGTR_IgnoringVideoStream);
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
38 s->ckid=mmioFOURCC(('0'+s->id/10),('0'+(s->id%10)),'d','c');
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
39 s->h.fccType=streamtypeAUDIO;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
40 break;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
41 default:
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
42 mp_msg(MSGT_MUXER,MSGL_ERR,MSGTR_UnknownStreamType,type);
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
43 return NULL;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
44 }
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
45 return s;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
46 }
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
47
17487
fa17424b4c7b change muxer_write_chunk() so that pts/dts _could_ be passed from encoder to muxer
michael
parents: 17023
diff changeset
48 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
49 muxer_t *muxer=s->muxer;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
50
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
51 // write out the chunk:
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
52 if (s->type==MUXER_TYPE_AUDIO)
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
53 fwrite(s->buffer,len,1,muxer->file);
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
54 }
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
55
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
56 static void rawaudiofile_write_header(muxer_t *muxer){
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
57 return;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
58 }
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
59
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
60 static void rawaudiofile_write_index(muxer_t *muxer){
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
61 return;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
62 }
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
63
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
64 int muxer_init_muxer_rawaudio(muxer_t *muxer){
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
65 muxer->cont_new_stream = &rawaudiofile_new_stream;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
66 muxer->cont_write_chunk = &rawaudiofile_write_chunk;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
67 muxer->cont_write_header = &rawaudiofile_write_header;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
68 muxer->cont_write_index = &rawaudiofile_write_index;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
69 return 1;
7b0599d9614a rawaudio muxer
ranma
parents:
diff changeset
70 }