Mercurial > mplayer.hg
annotate libmpdemux/muxer_rawaudio.c @ 21555:ababf115f90d
Avoid deprecated _sleep, instead include windows.h and use Sleep just like
osdep/timer-win2.c does.
Patch by Zuxy Meng [zuxy meng (at) gmail com]
author | reimar |
---|---|
date | Sun, 10 Dec 2006 14:04:27 +0000 |
parents | fa17424b4c7b |
children | ca9da45d13e9 |
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 | |
12 #include "muxer.h" | |
13 | |
14 static muxer_stream_t* rawaudiofile_new_stream(muxer_t *muxer,int type){ | |
15 muxer_stream_t* s; | |
16 if (!muxer) return NULL; | |
17 if(type==MUXER_TYPE_AUDIO && muxer->avih.dwStreams>=1){ | |
18 mp_msg(MSGT_MUXER,MSGL_ERR,MSGTR_TooManyStreams" "MSGTR_RawMuxerOnlyOneStream); | |
19 return NULL; | |
20 } | |
21 s=malloc(sizeof(muxer_stream_t)); | |
22 memset(s,0,sizeof(muxer_stream_t)); | |
23 if(!s) return NULL; // no mem!? | |
24 muxer->streams[muxer->avih.dwStreams]=s; | |
25 s->type=type; | |
26 s->id=muxer->avih.dwStreams; | |
27 s->timer=0.0; | |
28 s->size=0; | |
29 s->muxer=muxer; | |
30 switch(type){ | |
31 case MUXER_TYPE_AUDIO: | |
32 s->ckid=mmioFOURCC(('0'+s->id/10),('0'+(s->id%10)),'d','c'); | |
33 s->h.fccType=streamtypeAUDIO; | |
34 muxer->avih.dwStreams++; | |
35 break; | |
36 case MUXER_TYPE_VIDEO: | |
37 mp_msg(MSGT_MUXER,MSGL_WARN,MSGTR_IgnoringVideoStream); | |
38 s->ckid=mmioFOURCC(('0'+s->id/10),('0'+(s->id%10)),'d','c'); | |
39 s->h.fccType=streamtypeAUDIO; | |
40 break; | |
41 default: | |
42 mp_msg(MSGT_MUXER,MSGL_ERR,MSGTR_UnknownStreamType,type); | |
43 return NULL; | |
44 } | |
45 return s; | |
46 } | |
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 | 49 muxer_t *muxer=s->muxer; |
50 | |
51 // write out the chunk: | |
52 if (s->type==MUXER_TYPE_AUDIO) | |
53 fwrite(s->buffer,len,1,muxer->file); | |
54 } | |
55 | |
56 static void rawaudiofile_write_header(muxer_t *muxer){ | |
57 return; | |
58 } | |
59 | |
60 static void rawaudiofile_write_index(muxer_t *muxer){ | |
61 return; | |
62 } | |
63 | |
64 int muxer_init_muxer_rawaudio(muxer_t *muxer){ | |
65 muxer->cont_new_stream = &rawaudiofile_new_stream; | |
66 muxer->cont_write_chunk = &rawaudiofile_write_chunk; | |
67 muxer->cont_write_header = &rawaudiofile_write_header; | |
68 muxer->cont_write_index = &rawaudiofile_write_index; | |
69 return 1; | |
70 } |