Mercurial > mplayer.hg
annotate dec_audio.c @ 3798:d1e3ad5bcd8f
fixed few segfaults, make parse_codec_cfg() return int
author | iive |
---|---|
date | Thu, 27 Dec 2001 18:38:10 +0000 |
parents | 55603340d1b2 |
children | 8a88ed2473aa |
rev | line source |
---|---|
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
1 |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
2 #include <stdio.h> |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
3 #include <stdlib.h> |
1430 | 4 #include <unistd.h> |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
5 |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
6 #include "config.h" |
1567 | 7 #include "mp_msg.h" |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1927
diff
changeset
|
8 #include "help_mp.h" |
1567 | 9 |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
10 extern int verbose; // defined in mplayer.c |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
11 |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
12 #include "stream.h" |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
13 #include "demuxer.h" |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
14 |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
15 #include "codec-cfg.h" |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
16 #include "stheader.h" |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
17 |
2563 | 18 #include "dec_audio.h" |
19 | |
20 //========================================================================== | |
21 | |
22 #include "libao2/afmt.h" | |
23 | |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
24 #include "dll_init.h" |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
25 |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
26 #include "mp3lib/mp3.h" |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
27 #include "libac3/ac3.h" |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
28 |
3413 | 29 #include "liba52/a52.h" |
30 static sample_t * a52_samples; | |
31 static a52_state_t a52_state; | |
32 | |
3426 | 33 #include "g72x/g72x.h" |
34 static G72x_DATA g72x_data; | |
3413 | 35 |
883 | 36 #include "alaw.h" |
37 | |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
38 #include "xa/xa_gsm.h" |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
39 |
1528
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
40 #include "ac3-iec958.h" |
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
41 |
3756 | 42 #include "adpcm.h" |
2420 | 43 |
3145 | 44 #include "cpudetect.h" |
45 | |
3182
95bbd21e8e1f
moved num_audio_channels out of LIBMAD ifdef, where it didn't belong!
steve
parents:
3181
diff
changeset
|
46 /* used for ac3surround decoder - set using -channels option */ |
95bbd21e8e1f
moved num_audio_channels out of LIBMAD ifdef, where it didn't belong!
steve
parents:
3181
diff
changeset
|
47 int audio_output_channels = 2; |
95bbd21e8e1f
moved num_audio_channels out of LIBMAD ifdef, where it didn't belong!
steve
parents:
3181
diff
changeset
|
48 |
2563 | 49 #ifdef USE_FAKE_MONO |
50 int fakemono=0; | |
51 #endif | |
52 | |
1291 | 53 #ifdef USE_DIRECTSHOW |
604 | 54 #include "loader/DirectShow/DS_AudioDec.h" |
3442 | 55 static void* ds_adec=NULL; |
1291 | 56 #endif |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
57 |
1828 | 58 #ifdef HAVE_OGGVORBIS |
59 /* XXX is math.h really needed? - atmos */ | |
60 #include <math.h> | |
61 #include <vorbis/codec.h> | |
2341 | 62 |
63 typedef struct ov_struct_st { | |
64 ogg_sync_state oy; /* sync and verify incoming physical bitstream */ | |
65 ogg_stream_state os; /* take physical pages, weld into a logical | |
66 stream of packets */ | |
67 ogg_page og; /* one Ogg bitstream page. Vorbis packets are inside */ | |
68 ogg_packet op; /* one raw packet of data for decode */ | |
3145 | 69 |
2341 | 70 vorbis_info vi; /* struct that stores all the static vorbis bitstream |
71 settings */ | |
72 vorbis_comment vc; /* struct that stores all the bitstream user comments */ | |
73 vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */ | |
74 vorbis_block vb; /* local working space for packet->PCM decode */ | |
75 } ov_struct_t; | |
1828 | 76 #endif |
77 | |
1927 | 78 #ifdef USE_LIBAVCODEC |
2496 | 79 #ifdef USE_LIBAVCODEC_SO |
80 #include <libffmpeg/avcodec.h> | |
81 #else | |
1927 | 82 #include "libavcodec/avcodec.h" |
2496 | 83 #endif |
1927 | 84 static AVCodec *lavc_codec=NULL; |
85 static AVCodecContext lavc_context; | |
86 extern int avcodec_inited; | |
87 #endif | |
88 | |
2415 | 89 |
90 | |
91 #ifdef USE_LIBMAD | |
92 #include <mad.h> | |
93 static struct mad_stream mad_stream; | |
94 static struct mad_frame mad_frame; | |
95 static struct mad_synth mad_synth; | |
96 | |
97 // ensure buffer is filled with some data | |
98 static void mad_prepare_buffer(sh_audio_t* sh_audio, struct mad_stream* ms, int length) | |
99 { | |
100 if(sh_audio->a_in_buffer_len < length) { | |
101 int len = demux_read_data(sh_audio->ds, sh_audio->a_in_buffer+sh_audio->a_in_buffer_len, length-sh_audio->a_in_buffer_len); | |
102 sh_audio->a_in_buffer_len += len; | |
103 } | |
104 } | |
105 | |
106 static void mad_postprocess_buffer(sh_audio_t* sh_audio, struct mad_stream* ms) | |
107 { | |
108 int delta = (unsigned char*)ms->next_frame - (unsigned char *)sh_audio->a_in_buffer; | |
109 if(delta != 0) { | |
110 sh_audio->a_in_buffer_len -= delta; | |
111 memcpy(sh_audio->a_in_buffer, ms->next_frame, sh_audio->a_in_buffer_len); | |
112 } | |
113 } | |
114 | |
115 | |
116 static inline | |
117 signed short mad_scale(mad_fixed_t sample) | |
118 { | |
119 /* round */ | |
120 sample += (1L << (MAD_F_FRACBITS - 16)); | |
121 | |
122 /* clip */ | |
123 if (sample >= MAD_F_ONE) | |
124 sample = MAD_F_ONE - 1; | |
125 else if (sample < -MAD_F_ONE) | |
126 sample = -MAD_F_ONE; | |
127 | |
128 /* quantize */ | |
129 return sample >> (MAD_F_FRACBITS + 1 - 16); | |
130 } | |
131 #endif | |
132 | |
133 | |
3413 | 134 static int a52_fillbuff(sh_audio_t *sh_audio){ |
135 int length=0; | |
136 int flags=0; | |
137 int sample_rate=0; | |
138 int bit_rate=0; | |
139 while(1){ | |
140 while(sh_audio->a_in_buffer_len<7){ | |
141 int c=demux_getc(sh_audio->ds); | |
142 if(c<0) return -1; // EOF | |
143 sh_audio->a_in_buffer[sh_audio->a_in_buffer_len++]=c; | |
144 } | |
145 length = a52_syncinfo (sh_audio->a_in_buffer, &flags, &sample_rate, &bit_rate); | |
146 if(!length){ | |
147 // bad file => resync | |
148 memcpy(sh_audio->a_in_buffer,sh_audio->a_in_buffer+1,6); | |
149 --sh_audio->a_in_buffer_len; | |
150 continue; | |
151 } | |
152 mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"a52: len=%d flags=0x%X %d Hz %d bit/s\n",length,flags,sample_rate,bit_rate); | |
153 if(length<7 || length>3840){ | |
154 mp_msg(MSGT_DECAUDIO,MSGL_ERR,"a52: invalid frame length: %d\n",length); | |
155 continue; | |
156 } | |
157 sh_audio->samplerate=sample_rate; | |
158 sh_audio->i_bps=bit_rate/8; | |
159 demux_read_data(sh_audio->ds,sh_audio->a_in_buffer+7,length-7); | |
160 return length; | |
161 } | |
162 } | |
2415 | 163 |
1927 | 164 int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen); |
1327
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1320
diff
changeset
|
165 |
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1320
diff
changeset
|
166 |
1289 | 167 static sh_audio_t* dec_audio_sh=NULL; |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
168 |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
169 // AC3 decoder buffer callback: |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
170 static void ac3_fill_buffer(uint8_t **start,uint8_t **end){ |
1289 | 171 int len=ds_get_packet(dec_audio_sh->ds,start); |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
172 //printf("<ac3:%d>\n",len); |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
173 if(len<0) |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
174 *start = *end = NULL; |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
175 else |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
176 *end = *start + len; |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
177 } |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
178 |
1289 | 179 // MP3 decoder buffer callback: |
180 int mplayer_audio_read(char *buf,int size){ | |
181 int len; | |
182 len=demux_read_data(dec_audio_sh->ds,buf,size); | |
183 return len; | |
184 } | |
185 | |
296 | 186 int init_audio(sh_audio_t *sh_audio){ |
303 | 187 int driver=sh_audio->codec->driver; |
296 | 188 |
189 sh_audio->samplesize=2; | |
1320
18374d49befa
On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents:
1313
diff
changeset
|
190 #if WORDS_BIGENDIAN |
18374d49befa
On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents:
1313
diff
changeset
|
191 sh_audio->sample_format=AFMT_S16_BE; |
18374d49befa
On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents:
1313
diff
changeset
|
192 #else |
758 | 193 sh_audio->sample_format=AFMT_S16_LE; |
1320
18374d49befa
On big-endian architectures, all audio decoders default to big-endian 16-bit
jkeil
parents:
1313
diff
changeset
|
194 #endif |
303 | 195 sh_audio->samplerate=0; |
401 | 196 //sh_audio->pcm_bswap=0; |
1529 | 197 sh_audio->o_bps=0; |
303 | 198 |
758 | 199 sh_audio->a_buffer_size=0; |
303 | 200 sh_audio->a_buffer=NULL; |
296 | 201 |
746 | 202 sh_audio->a_in_buffer_len=0; |
203 | |
758 | 204 // setup required min. in/out buffer size: |
205 sh_audio->audio_out_minsize=8192;// default size, maybe not enough for Win32/ACM | |
206 | |
207 switch(driver){ | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
208 case AFM_ACM: |
1517
0e9c29538a86
Use USE_WIN32DLL define instead of ARCH_X86 to decide whether or not to compile
jkeil
parents:
1485
diff
changeset
|
209 #ifndef USE_WIN32DLL |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1927
diff
changeset
|
210 mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_NoACMSupport); |
1309
598e3047ce13
Add some preliminary support for non-x86 architectures to mplayer
jkeil
parents:
1291
diff
changeset
|
211 driver=0; |
598e3047ce13
Add some preliminary support for non-x86 architectures to mplayer
jkeil
parents:
1291
diff
changeset
|
212 #else |
296 | 213 // Win32 ACM audio codec: |
214 if(init_acm_audio_codec(sh_audio)){ | |
746 | 215 sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec; |
296 | 216 sh_audio->channels=sh_audio->o_wf.nChannels; |
217 sh_audio->samplerate=sh_audio->o_wf.nSamplesPerSec; | |
758 | 218 // if(sh_audio->audio_out_minsize>16384) sh_audio->audio_out_minsize=16384; |
219 // sh_audio->a_buffer_size=sh_audio->audio_out_minsize; | |
220 // if(sh_audio->a_buffer_size<sh_audio->audio_out_minsize+MAX_OUTBURST) | |
221 // sh_audio->a_buffer_size=sh_audio->audio_out_minsize+MAX_OUTBURST; | |
296 | 222 } else { |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1927
diff
changeset
|
223 mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_ACMiniterror); |
303 | 224 driver=0; |
296 | 225 } |
1309
598e3047ce13
Add some preliminary support for non-x86 architectures to mplayer
jkeil
parents:
1291
diff
changeset
|
226 #endif |
758 | 227 break; |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
228 case AFM_DSHOW: |
296 | 229 #ifndef USE_DIRECTSHOW |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1927
diff
changeset
|
230 mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_NoDShowAudio); |
303 | 231 driver=0; |
296 | 232 #else |
233 // Win32 DShow audio codec: | |
340 | 234 // printf("DShow_audio: channs=%d rate=%d\n",sh_audio->channels,sh_audio->samplerate); |
3442 | 235 if(!(ds_adec=DS_AudioDecoder_Open(sh_audio->codec->dll,&sh_audio->codec->guid,sh_audio->wf))){ |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1927
diff
changeset
|
236 mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_MissingDLLcodec,sh_audio->codec->dll); |
303 | 237 driver=0; |
238 } else { | |
746 | 239 sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec; |
432
5251b0c57e39
sh_audio->wf and sh_video->bih changed to dynamic (thanx to Jens Hoffmann)
arpi_esp
parents:
401
diff
changeset
|
240 sh_audio->channels=sh_audio->wf->nChannels; |
5251b0c57e39
sh_audio->wf and sh_video->bih changed to dynamic (thanx to Jens Hoffmann)
arpi_esp
parents:
401
diff
changeset
|
241 sh_audio->samplerate=sh_audio->wf->nSamplesPerSec; |
5251b0c57e39
sh_audio->wf and sh_video->bih changed to dynamic (thanx to Jens Hoffmann)
arpi_esp
parents:
401
diff
changeset
|
242 sh_audio->audio_in_minsize=2*sh_audio->wf->nBlockAlign; |
296 | 243 if(sh_audio->audio_in_minsize<8192) sh_audio->audio_in_minsize=8192; |
244 sh_audio->a_in_buffer_size=sh_audio->audio_in_minsize; | |
245 sh_audio->a_in_buffer=malloc(sh_audio->a_in_buffer_size); | |
246 sh_audio->a_in_buffer_len=0; | |
758 | 247 sh_audio->audio_out_minsize=16384; |
296 | 248 } |
249 #endif | |
758 | 250 break; |
1828 | 251 case AFM_VORBIS: |
252 #ifndef HAVE_OGGVORBIS | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1927
diff
changeset
|
253 mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_NoOggVorbis); |
1828 | 254 driver=0; |
255 #else | |
256 /* OggVorbis audio via libvorbis, compatible with files created by nandub and zorannt codec */ | |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
257 sh_audio->audio_out_minsize=1024*4; // 1024 samples/frame |
1828 | 258 #endif |
259 break; | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
260 case AFM_PCM: |
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
261 case AFM_DVDPCM: |
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
262 case AFM_ALAW: |
758 | 263 // PCM, aLaw |
264 sh_audio->audio_out_minsize=2048; | |
265 break; | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
266 case AFM_AC3: |
3413 | 267 case AFM_A52: |
758 | 268 // Dolby AC3 audio: |
3181
c8edb0691f09
Extended oss output driver and libac3 to support 4 and 6 channel output mixes. added -channels command line option
steve
parents:
3145
diff
changeset
|
269 // however many channels, 2 bytes in a word, 256 samples in a block, 6 blocks in a frame |
c8edb0691f09
Extended oss output driver and libac3 to support 4 and 6 channel output mixes. added -channels command line option
steve
parents:
3145
diff
changeset
|
270 sh_audio->audio_out_minsize=audio_output_channels*2*256*6; |
758 | 271 break; |
1528
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
272 case AFM_HWAC3: |
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
273 // Dolby AC3 audio: |
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
274 sh_audio->audio_out_minsize=4*256*6; |
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
275 sh_audio->sample_format = AFMT_AC3; |
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
276 break; |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
277 case AFM_GSM: |
758 | 278 // MS-GSM audio codec: |
279 sh_audio->audio_out_minsize=4*320; | |
280 break; | |
3787 | 281 case AFM_IMAADPCM: |
3756 | 282 sh_audio->audio_out_minsize=4096; |
283 sh_audio->ds->ss_div=IMA_ADPCM_SAMPLES_PER_BLOCK; | |
284 sh_audio->ds->ss_mul=IMA_ADPCM_BLOCK_SIZE; | |
2420 | 285 break; |
3787 | 286 case AFM_MSADPCM: |
287 sh_audio->audio_out_minsize=4096; | |
288 sh_audio->ds->ss_div=MS_ADPCM_SAMPLES_PER_BLOCK; | |
289 sh_audio->ds->ss_mul=MS_ADPCM_BLOCK_SIZE; | |
290 break; | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
291 case AFM_MPEG: |
758 | 292 // MPEG Audio: |
293 sh_audio->audio_out_minsize=4608; | |
294 break; | |
3426 | 295 case AFM_G72X: |
296 // g72x_reader_init(&g72x_data,G723_16_BITS_PER_SAMPLE); | |
297 g72x_reader_init(&g72x_data,G723_24_BITS_PER_SAMPLE); | |
298 // g72x_reader_init(&g72x_data,G721_32_BITS_PER_SAMPLE); | |
299 // g72x_reader_init(&g72x_data,G721_40_BITS_PER_SAMPLE); | |
300 sh_audio->audio_out_minsize=g72x_data.samplesperblock*4; | |
301 break; | |
1927 | 302 case AFM_FFMPEG: |
303 #ifndef USE_LIBAVCODEC | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1927
diff
changeset
|
304 mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_NoLAVCsupport); |
1927 | 305 return 0; |
306 #else | |
307 // FFmpeg Audio: | |
308 sh_audio->audio_out_minsize=AVCODEC_MAX_AUDIO_FRAME_SIZE; | |
309 break; | |
310 #endif | |
2415 | 311 |
312 #ifdef USE_LIBMAD | |
313 case AFM_MAD: | |
314 printf(__FILE__ ":%d:mad: setting minimum outputsize\n", __LINE__); | |
315 sh_audio->audio_out_minsize=4608; | |
316 if(sh_audio->audio_in_minsize<8192) sh_audio->audio_in_minsize=8192; | |
317 sh_audio->a_in_buffer_size=sh_audio->audio_in_minsize; | |
318 sh_audio->a_in_buffer=malloc(sh_audio->a_in_buffer_size); | |
319 sh_audio->a_in_buffer_len=0; | |
320 break; | |
321 #endif | |
296 | 322 } |
323 | |
303 | 324 if(!driver) return 0; |
296 | 325 |
326 // allocate audio out buffer: | |
758 | 327 sh_audio->a_buffer_size=sh_audio->audio_out_minsize+MAX_OUTBURST; // worst case calc. |
328 | |
1567 | 329 mp_msg(MSGT_DECAUDIO,MSGL_V,"dec_audio: Allocating %d + %d = %d bytes for output buffer\n", |
758 | 330 sh_audio->audio_out_minsize,MAX_OUTBURST,sh_audio->a_buffer_size); |
331 | |
296 | 332 sh_audio->a_buffer=malloc(sh_audio->a_buffer_size); |
758 | 333 if(!sh_audio->a_buffer){ |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1927
diff
changeset
|
334 mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_CantAllocAudioBuf); |
758 | 335 return 0; |
336 } | |
296 | 337 memset(sh_audio->a_buffer,0,sh_audio->a_buffer_size); |
338 sh_audio->a_buffer_len=0; | |
339 | |
303 | 340 switch(driver){ |
1517
0e9c29538a86
Use USE_WIN32DLL define instead of ARCH_X86 to decide whether or not to compile
jkeil
parents:
1485
diff
changeset
|
341 #ifdef USE_WIN32DLL |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
342 case AFM_ACM: { |
758 | 343 int ret=acm_decode_audio(sh_audio,sh_audio->a_buffer,4096,sh_audio->a_buffer_size); |
296 | 344 if(ret<0){ |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1927
diff
changeset
|
345 mp_msg(MSGT_DECAUDIO,MSGL_INFO,"ACM decoding error: %d\n",ret); |
303 | 346 driver=0; |
296 | 347 } |
640 | 348 sh_audio->a_buffer_len=ret; |
303 | 349 break; |
296 | 350 } |
1309
598e3047ce13
Add some preliminary support for non-x86 architectures to mplayer
jkeil
parents:
1291
diff
changeset
|
351 #endif |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
352 case AFM_PCM: { |
296 | 353 // AVI PCM Audio: |
432
5251b0c57e39
sh_audio->wf and sh_video->bih changed to dynamic (thanx to Jens Hoffmann)
arpi_esp
parents:
401
diff
changeset
|
354 WAVEFORMATEX *h=sh_audio->wf; |
746 | 355 sh_audio->i_bps=h->nAvgBytesPerSec; |
296 | 356 sh_audio->channels=h->nChannels; |
357 sh_audio->samplerate=h->nSamplesPerSec; | |
358 sh_audio->samplesize=(h->wBitsPerSample+7)/8; | |
758 | 359 switch(sh_audio->format){ // hardware formats: |
360 case 0x6: sh_audio->sample_format=AFMT_A_LAW;break; | |
361 case 0x7: sh_audio->sample_format=AFMT_MU_LAW;break; | |
362 case 0x11: sh_audio->sample_format=AFMT_IMA_ADPCM;break; | |
363 case 0x50: sh_audio->sample_format=AFMT_MPEG;break; | |
2547 | 364 case 0x736F7774: sh_audio->sample_format=AFMT_S16_LE;sh_audio->codec->driver=AFM_DVDPCM;break; |
758 | 365 // case 0x2000: sh_audio->sample_format=AFMT_AC3; |
366 default: sh_audio->sample_format=(sh_audio->samplesize==2)?AFMT_S16_LE:AFMT_U8; | |
367 } | |
401 | 368 break; |
369 } | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
370 case AFM_DVDPCM: { |
401 | 371 // DVD PCM Audio: |
372 sh_audio->channels=2; | |
373 sh_audio->samplerate=48000; | |
746 | 374 sh_audio->i_bps=2*2*48000; |
296 | 375 // sh_audio->pcm_bswap=1; |
303 | 376 break; |
377 } | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
378 case AFM_AC3: { |
296 | 379 // Dolby AC3 audio: |
1289 | 380 dec_audio_sh=sh_audio; // save sh_audio for the callback: |
296 | 381 ac3_config.fill_buffer_callback = ac3_fill_buffer; |
3181
c8edb0691f09
Extended oss output driver and libac3 to support 4 and 6 channel output mixes. added -channels command line option
steve
parents:
3145
diff
changeset
|
382 ac3_config.num_output_ch = audio_output_channels; |
296 | 383 ac3_config.flags = 0; |
3145 | 384 if(gCpuCaps.hasMMX){ |
296 | 385 ac3_config.flags |= AC3_MMX_ENABLE; |
3145 | 386 } |
387 if(gCpuCaps.has3DNow){ | |
296 | 388 ac3_config.flags |= AC3_3DNOW_ENABLE; |
3145 | 389 } |
296 | 390 ac3_init(); |
391 sh_audio->ac3_frame = ac3_decode_frame(); | |
392 if(sh_audio->ac3_frame){ | |
746 | 393 ac3_frame_t* fr=(ac3_frame_t*)sh_audio->ac3_frame; |
394 sh_audio->samplerate=fr->sampling_rate; | |
3181
c8edb0691f09
Extended oss output driver and libac3 to support 4 and 6 channel output mixes. added -channels command line option
steve
parents:
3145
diff
changeset
|
395 sh_audio->channels=ac3_config.num_output_ch; |
746 | 396 // 1 frame: 6*256 samples 1 sec: sh_audio->samplerate samples |
397 //sh_audio->i_bps=fr->frame_size*fr->sampling_rate/(6*256); | |
398 sh_audio->i_bps=fr->bit_rate*(1000/8); | |
303 | 399 } else { |
400 driver=0; // bad frame -> disable audio | |
401 } | |
402 break; | |
403 } | |
3413 | 404 case AFM_A52: { |
405 // Dolby AC3 audio: | |
406 int accel=0; // should contain mmx/sse/etc flags | |
407 a52_samples=a52_init (accel); | |
408 if (a52_samples == NULL) { | |
409 mp_msg(MSGT_DECAUDIO,MSGL_ERR,"A52 init failed\n"); | |
410 driver=0;break; | |
411 } | |
412 sh_audio->a_in_buffer_size=3840; | |
413 sh_audio->a_in_buffer=malloc(sh_audio->a_in_buffer_size); | |
414 sh_audio->a_in_buffer_len=0; | |
415 if(a52_fillbuff(sh_audio)<0){ | |
416 mp_msg(MSGT_DECAUDIO,MSGL_ERR,"A52 sync failed\n"); | |
417 driver=0;break; | |
418 } | |
419 sh_audio->channels=audio_output_channels; | |
420 break; | |
421 } | |
1528
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
422 case AFM_HWAC3: { |
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
423 unsigned char *buffer; |
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
424 struct hwac3info ai; |
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
425 int len, skipped; |
1529 | 426 len = ds_get_packet(sh_audio->ds, &buffer); // maybe 1 packet is not enough, |
427 // at least for mpeg, PS packets contain about max. 2000 bytes of data. | |
1528
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
428 if(ac3_iec958_parse_syncinfo(buffer, len, &ai, &skipped) < 0) { |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1927
diff
changeset
|
429 mp_msg(MSGT_DECAUDIO,MSGL_ERR, MSGTR_AC3notvalid); |
1528
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
430 driver = 0; |
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
431 break; |
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
432 } |
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
433 if(ai.samplerate != 48000) { |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1927
diff
changeset
|
434 mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_AC3only48k); |
1528
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
435 driver = 0; |
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
436 break; |
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
437 } |
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
438 sh_audio->samplerate=ai.samplerate; |
1529 | 439 sh_audio->samplesize=ai.framesize; |
1528
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
440 sh_audio->channels=1; |
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
441 sh_audio->i_bps=ai.bitrate*(1000/8); |
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
442 sh_audio->ac3_frame=malloc(6144); |
1529 | 443 sh_audio->o_bps=sh_audio->i_bps; // XXX FIXME!!! XXX |
1528
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
444 break; |
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
445 } |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
446 case AFM_ALAW: { |
296 | 447 // aLaw audio codec: |
432
5251b0c57e39
sh_audio->wf and sh_video->bih changed to dynamic (thanx to Jens Hoffmann)
arpi_esp
parents:
401
diff
changeset
|
448 sh_audio->channels=sh_audio->wf->nChannels; |
5251b0c57e39
sh_audio->wf and sh_video->bih changed to dynamic (thanx to Jens Hoffmann)
arpi_esp
parents:
401
diff
changeset
|
449 sh_audio->samplerate=sh_audio->wf->nSamplesPerSec; |
746 | 450 sh_audio->i_bps=sh_audio->channels*sh_audio->samplerate; |
303 | 451 break; |
452 } | |
3426 | 453 case AFM_G72X: { |
454 // GSM 723 audio codec: | |
455 sh_audio->channels=sh_audio->wf->nChannels; | |
456 sh_audio->samplerate=sh_audio->wf->nSamplesPerSec; | |
457 sh_audio->i_bps=(sh_audio->samplerate/g72x_data.samplesperblock)*g72x_data.blocksize; | |
458 break; | |
459 } | |
1927 | 460 #ifdef USE_LIBAVCODEC |
461 case AFM_FFMPEG: { | |
462 int x; | |
463 mp_msg(MSGT_DECAUDIO,MSGL_V,"FFmpeg's libavcodec audio codec\n"); | |
464 if(!avcodec_inited){ | |
465 avcodec_init(); | |
466 avcodec_register_all(); | |
467 avcodec_inited=1; | |
468 } | |
469 lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh_audio->codec->dll); | |
470 if(!lavc_codec){ | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1927
diff
changeset
|
471 mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_MissingLAVCcodec,sh_audio->codec->dll); |
1927 | 472 return 0; |
473 } | |
474 memset(&lavc_context, 0, sizeof(lavc_context)); | |
475 /* open it */ | |
476 if (avcodec_open(&lavc_context, lavc_codec) < 0) { | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1927
diff
changeset
|
477 mp_msg(MSGT_DECAUDIO,MSGL_ERR, MSGTR_CantOpenCodec); |
1927 | 478 return 0; |
479 } | |
480 mp_msg(MSGT_DECAUDIO,MSGL_V,"INFO: libavcodec init OK!\n"); | |
481 | |
482 // Decode at least 1 byte: (to get header filled) | |
483 x=decode_audio(sh_audio,sh_audio->a_buffer,1,sh_audio->a_buffer_size); | |
484 if(x>0) sh_audio->a_buffer_len=x; | |
485 | |
486 #if 1 | |
487 sh_audio->channels=lavc_context.channels; | |
488 sh_audio->samplerate=lavc_context.sample_rate; | |
489 sh_audio->i_bps=lavc_context.bit_rate/8; | |
490 #else | |
491 sh_audio->channels=sh_audio->wf->nChannels; | |
492 sh_audio->samplerate=sh_audio->wf->nSamplesPerSec; | |
493 sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec; | |
494 #endif | |
495 break; | |
496 } | |
497 #endif | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
498 case AFM_GSM: { |
296 | 499 // MS-GSM audio codec: |
500 GSM_Init(); | |
432
5251b0c57e39
sh_audio->wf and sh_video->bih changed to dynamic (thanx to Jens Hoffmann)
arpi_esp
parents:
401
diff
changeset
|
501 sh_audio->channels=sh_audio->wf->nChannels; |
5251b0c57e39
sh_audio->wf and sh_video->bih changed to dynamic (thanx to Jens Hoffmann)
arpi_esp
parents:
401
diff
changeset
|
502 sh_audio->samplerate=sh_audio->wf->nSamplesPerSec; |
746 | 503 // decodes 65 byte -> 320 short |
504 // 1 sec: sh_audio->channels*sh_audio->samplerate samples | |
505 // 1 frame: 320 samples | |
506 sh_audio->i_bps=65*(sh_audio->channels*sh_audio->samplerate)/320; // 1:10 | |
303 | 507 break; |
296 | 508 } |
3787 | 509 case AFM_IMAADPCM: |
2420 | 510 // IMA-ADPCM 4:1 audio codec: |
511 sh_audio->channels=sh_audio->wf->nChannels; | |
512 sh_audio->samplerate=sh_audio->wf->nSamplesPerSec; | |
513 // decodes 34 byte -> 64 short | |
3756 | 514 sh_audio->i_bps=IMA_ADPCM_BLOCK_SIZE*(sh_audio->channels*sh_audio->samplerate)/IMA_ADPCM_SAMPLES_PER_BLOCK; // 1:4 |
2420 | 515 break; |
3787 | 516 case AFM_MSADPCM: |
517 sh_audio->channels=sh_audio->wf->nChannels; | |
518 sh_audio->samplerate=sh_audio->wf->nSamplesPerSec; | |
519 sh_audio->i_bps=MS_ADPCM_BLOCK_SIZE* | |
520 (sh_audio->channels*sh_audio->samplerate)/MS_ADPCM_SAMPLES_PER_BLOCK; | |
521 break; | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
522 case AFM_MPEG: { |
296 | 523 // MPEG Audio: |
1289 | 524 dec_audio_sh=sh_audio; // save sh_audio for the callback: |
732
e14114170e01
applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents:
640
diff
changeset
|
525 #ifdef USE_FAKE_MONO |
e14114170e01
applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents:
640
diff
changeset
|
526 MP3_Init(fakemono); |
e14114170e01
applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents:
640
diff
changeset
|
527 #else |
296 | 528 MP3_Init(); |
732
e14114170e01
applied 'fakemono' patch by Bryan Chan scorpio@acm.org
arpi_esp
parents:
640
diff
changeset
|
529 #endif |
296 | 530 MP3_samplerate=MP3_channels=0; |
531 // printf("[\n"); | |
532 sh_audio->a_buffer_len=MP3_DecodeFrame(sh_audio->a_buffer,-1); | |
533 // printf("]\n"); | |
534 sh_audio->channels=2; // hack | |
535 sh_audio->samplerate=MP3_samplerate; | |
746 | 536 sh_audio->i_bps=MP3_bitrate*(1000/8); |
303 | 537 break; |
538 } | |
1828 | 539 #ifdef HAVE_OGGVORBIS |
540 case AFM_VORBIS: { | |
541 // OggVorbis Audio: | |
542 #if 0 /* just here for reference - atmos */ | |
543 ogg_sync_state oy; /* sync and verify incoming physical bitstream */ | |
544 ogg_stream_state os; /* take physical pages, weld into a logical | |
545 stream of packets */ | |
546 ogg_page og; /* one Ogg bitstream page. Vorbis packets are inside */ | |
547 ogg_packet op; /* one raw packet of data for decode */ | |
548 | |
549 vorbis_info vi; /* struct that stores all the static vorbis bitstream | |
550 settings */ | |
551 vorbis_comment vc; /* struct that stores all the bitstream user comments */ | |
552 vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */ | |
553 vorbis_block vb; /* local working space for packet->PCM decode */ | |
554 #else | |
555 /* nix, nada, rien, nothing, nem, nüx */ | |
556 #endif | |
557 | |
558 uint32_t hdrsizes[3];/* stores vorbis header sizes from AVI audio header, | |
559 maybe use ogg_uint32_t */ | |
560 //int i; | |
561 int ret; | |
562 char *buffer; | |
563 ogg_packet hdr; | |
564 //ov_struct_t *s=&sh_audio->ov; | |
565 sh_audio->ov=malloc(sizeof(ov_struct_t)); | |
566 //s=&sh_audio->ov; | |
567 | |
568 vorbis_info_init(&sh_audio->ov->vi); | |
569 vorbis_comment_init(&sh_audio->ov->vc); | |
570 | |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
571 mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"OggVorbis: cbsize: %i\n", sh_audio->wf->cbSize); |
1828 | 572 memcpy(hdrsizes, ((unsigned char*)sh_audio->wf)+2*sizeof(WAVEFORMATEX), 3*sizeof(uint32_t)); |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
573 mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"OggVorbis: Read header sizes: initial: %i comment: %i codebook: %i\n", hdrsizes[0], hdrsizes[1], hdrsizes[2]); |
1828 | 574 /*for(i=12; i <= 40; i+=2) { // header bruteforce :) |
575 memcpy(hdrsizes, ((unsigned char*)sh_audio->wf)+i, 3*sizeof(uint32_t)); | |
576 printf("OggVorbis: Read header sizes (%i): %ld %ld %ld\n", i, hdrsizes[0], hdrsizes[1], hdrsizes[2]); | |
577 }*/ | |
578 | |
579 /* read headers */ // FIXME disable sound on errors here, we absolutely need this headers! - atmos | |
580 hdr.packet=NULL; | |
581 hdr.b_o_s = 1; /* beginning of stream for first packet */ | |
582 hdr.bytes = hdrsizes[0]; | |
583 hdr.packet = realloc(hdr.packet,hdr.bytes); | |
584 memcpy(hdr.packet,((unsigned char*)sh_audio->wf)+2*sizeof(WAVEFORMATEX)+3*sizeof(uint32_t),hdr.bytes); | |
585 if(vorbis_synthesis_headerin(&sh_audio->ov->vi,&sh_audio->ov->vc,&hdr)<0) | |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
586 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"OggVorbis: initial (identification) header broken!\n"); |
1828 | 587 hdr.b_o_s = 0; |
588 hdr.bytes = hdrsizes[1]; | |
589 hdr.packet = realloc(hdr.packet,hdr.bytes); | |
590 memcpy(hdr.packet,((unsigned char*)sh_audio->wf)+2*sizeof(WAVEFORMATEX)+3*sizeof(uint32_t)+hdrsizes[0],hdr.bytes); | |
591 if(vorbis_synthesis_headerin(&sh_audio->ov->vi,&sh_audio->ov->vc,&hdr)<0) | |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
592 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"OggVorbis: comment header broken!\n"); |
1828 | 593 hdr.bytes = hdrsizes[2]; |
594 hdr.packet = realloc(hdr.packet,hdr.bytes); | |
595 memcpy(hdr.packet,((unsigned char*)sh_audio->wf)+2*sizeof(WAVEFORMATEX)+3*sizeof(uint32_t)+hdrsizes[0]+hdrsizes[1],hdr.bytes); | |
596 if(vorbis_synthesis_headerin(&sh_audio->ov->vi,&sh_audio->ov->vc,&hdr)<0) | |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
597 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"OggVorbis: codebook header broken!\n"); |
1828 | 598 hdr.bytes=0; |
599 hdr.packet = realloc(hdr.packet,hdr.bytes); /* free */ | |
600 /* done with the headers */ | |
601 | |
602 | |
603 /* Throw the comments plus a few lines about the bitstream we're | |
604 decoding */ | |
605 { | |
606 char **ptr=sh_audio->ov->vc.user_comments; | |
607 while(*ptr){ | |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
608 mp_msg(MSGT_DECAUDIO,MSGL_V,"OggVorbisComment: %s\n",*ptr); |
1828 | 609 ++ptr; |
610 } | |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
611 mp_msg(MSGT_DECAUDIO,MSGL_V,"OggVorbis: Bitstream is %d channel, %ldHz, %ldkbit/s %cBR\n",sh_audio->ov->vi.channels,sh_audio->ov->vi.rate,sh_audio->ov->vi.bitrate_nominal/1000, (sh_audio->ov->vi.bitrate_lower!=sh_audio->ov->vi.bitrate_nominal)||(sh_audio->ov->vi.bitrate_upper!=sh_audio->ov->vi.bitrate_nominal)?'V':'C'); |
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
612 mp_msg(MSGT_DECAUDIO,MSGL_V,"OggVorbis: Encoded by: %s\n",sh_audio->ov->vc.vendor); |
1828 | 613 } |
614 sh_audio->channels=sh_audio->ov->vi.channels; | |
615 sh_audio->samplerate=sh_audio->ov->vi.rate; | |
616 sh_audio->i_bps=sh_audio->ov->vi.bitrate_nominal/8; | |
617 | |
618 // printf("[\n"); | |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
619 // sh_audio->a_buffer_len=sh_audio->audio_out_minsize;///ov->vi.channels; |
1828 | 620 // printf("]\n"); |
621 | |
622 /* OK, got and parsed all three headers. Initialize the Vorbis | |
623 packet->PCM decoder. */ | |
624 vorbis_synthesis_init(&sh_audio->ov->vd,&sh_audio->ov->vi); /* central decode state */ | |
625 vorbis_block_init(&sh_audio->ov->vd,&sh_audio->ov->vb); /* local state for most of the decode | |
626 so multiple block decodes can | |
627 proceed in parallel. We could init | |
628 multiple vorbis_block structures | |
629 for vd here */ | |
630 //printf("OggVorbis: synthesis and block init done.\n"); | |
631 ogg_sync_init(&sh_audio->ov->oy); /* Now we can read pages */ | |
632 | |
633 while((ret = ogg_sync_pageout(&sh_audio->ov->oy,&sh_audio->ov->og))!=1) { | |
634 if(ret == -1) | |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
635 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"OggVorbis: Pageout: not properly synced, had to skip some bytes.\n"); |
1828 | 636 else |
637 if(ret == 0) { | |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
638 mp_msg(MSGT_DECAUDIO,MSGL_V,"OggVorbis: Pageout: need more data to verify page, reading more data.\n"); |
1828 | 639 /* submit a a_buffer_len block to libvorbis' Ogg layer */ |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
640 buffer=ogg_sync_buffer(&sh_audio->ov->oy,256); |
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
641 ogg_sync_wrote(&sh_audio->ov->oy,demux_read_data(sh_audio->ds,buffer,256)); |
1828 | 642 } |
643 } | |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
644 mp_msg(MSGT_DECAUDIO,MSGL_V,"OggVorbis: Pageout: successfull.\n"); |
1834
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
645 ogg_stream_pagein(&sh_audio->ov->os,&sh_audio->ov->og); /* we can ignore any errors here |
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
646 as they'll also become apparent |
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
647 at packetout */ |
1828 | 648 |
649 /* Get the serial number and set up the rest of decode. */ | |
650 /* serialno first; use it to set up a logical stream */ | |
651 ogg_stream_init(&sh_audio->ov->os,ogg_page_serialno(&sh_audio->ov->og)); | |
652 | |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
653 mp_msg(MSGT_DECAUDIO,MSGL_V,"OggVorbis: Init OK!\n"); |
1828 | 654 |
655 break; | |
656 } | |
657 #endif | |
2415 | 658 |
659 #ifdef USE_LIBMAD | |
660 case AFM_MAD: | |
661 { | |
662 printf(__FILE__ ":%d:mad: initialising\n", __LINE__); | |
663 mad_frame_init(&mad_frame); | |
664 mad_stream_init(&mad_stream); | |
665 | |
666 printf(__FILE__ ":%d:mad: preparing buffer\n", __LINE__); | |
667 mad_prepare_buffer(sh_audio, &mad_stream, sh_audio->a_in_buffer_size); | |
668 mad_stream_buffer(&mad_stream, (unsigned char*)(sh_audio->a_in_buffer), sh_audio->a_in_buffer_len); | |
669 mad_stream_sync(&mad_stream); | |
670 mad_synth_init(&mad_synth); | |
671 | |
672 if(mad_frame_decode(&mad_frame, &mad_stream) == 0) | |
673 { | |
674 printf(__FILE__ ":%d:mad: post processing buffer\n", __LINE__); | |
675 mad_postprocess_buffer(sh_audio, &mad_stream); | |
676 } | |
677 else | |
678 { | |
679 printf(__FILE__ ":%d:mad: frame decoding failed\n", __LINE__); | |
680 } | |
681 | |
2434
571538d73e08
audio channels nr is identified from libmad's channel mode
alex
parents:
2432
diff
changeset
|
682 switch (mad_frame.header.mode) |
571538d73e08
audio channels nr is identified from libmad's channel mode
alex
parents:
2432
diff
changeset
|
683 { |
571538d73e08
audio channels nr is identified from libmad's channel mode
alex
parents:
2432
diff
changeset
|
684 case MAD_MODE_SINGLE_CHANNEL: |
571538d73e08
audio channels nr is identified from libmad's channel mode
alex
parents:
2432
diff
changeset
|
685 sh_audio->channels=1; |
571538d73e08
audio channels nr is identified from libmad's channel mode
alex
parents:
2432
diff
changeset
|
686 break; |
571538d73e08
audio channels nr is identified from libmad's channel mode
alex
parents:
2432
diff
changeset
|
687 case MAD_MODE_DUAL_CHANNEL: |
571538d73e08
audio channels nr is identified from libmad's channel mode
alex
parents:
2432
diff
changeset
|
688 case MAD_MODE_JOINT_STEREO: |
571538d73e08
audio channels nr is identified from libmad's channel mode
alex
parents:
2432
diff
changeset
|
689 case MAD_MODE_STEREO: |
571538d73e08
audio channels nr is identified from libmad's channel mode
alex
parents:
2432
diff
changeset
|
690 sh_audio->channels=2; |
571538d73e08
audio channels nr is identified from libmad's channel mode
alex
parents:
2432
diff
changeset
|
691 break; |
571538d73e08
audio channels nr is identified from libmad's channel mode
alex
parents:
2432
diff
changeset
|
692 default: |
571538d73e08
audio channels nr is identified from libmad's channel mode
alex
parents:
2432
diff
changeset
|
693 mp_msg(MSGT_DECAUDIO, MSGL_FATAL, "mad: unknown number of channels\n"); |
571538d73e08
audio channels nr is identified from libmad's channel mode
alex
parents:
2432
diff
changeset
|
694 } |
571538d73e08
audio channels nr is identified from libmad's channel mode
alex
parents:
2432
diff
changeset
|
695 mp_msg(MSGT_DECAUDIO, MSGL_HINT, "mad: channels: %d (mad channel mode: %d)\n", |
571538d73e08
audio channels nr is identified from libmad's channel mode
alex
parents:
2432
diff
changeset
|
696 sh_audio->channels, mad_frame.header.mode); |
2432 | 697 /* var. name changed in 0.13.0 (beta) (libmad/CHANGES) -- alex */ |
698 #if (MAD_VERSION_MAJOR >= 0) && (MAD_VERSION_MINOR >= 13) | |
699 sh_audio->samplerate=mad_frame.header.samplerate; | |
700 #else | |
2415 | 701 sh_audio->samplerate=mad_frame.header.sfreq; |
2432 | 702 #endif |
2415 | 703 sh_audio->i_bps=mad_frame.header.bitrate; |
704 printf(__FILE__ ":%d:mad: continuing\n", __LINE__); | |
705 break; | |
706 } | |
707 #endif | |
296 | 708 } |
709 | |
710 if(!sh_audio->channels || !sh_audio->samplerate){ | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1927
diff
changeset
|
711 mp_msg(MSGT_DECAUDIO,MSGL_WARN,MSGTR_UnknownAudio); |
303 | 712 driver=0; |
296 | 713 } |
714 | |
303 | 715 if(!driver){ |
716 if(sh_audio->a_buffer) free(sh_audio->a_buffer); | |
1313
d797ecb9778f
sh_audio->a_buffer is freed twice (here and in mplayer.c), can result to
jkeil
parents:
1309
diff
changeset
|
717 sh_audio->a_buffer=NULL; |
303 | 718 return 0; |
719 } | |
296 | 720 |
1529 | 721 if(!sh_audio->o_bps) |
303 | 722 sh_audio->o_bps=sh_audio->channels*sh_audio->samplerate*sh_audio->samplesize; |
723 return driver; | |
296 | 724 } |
291 | 725 |
746 | 726 // Audio decoding: |
291 | 727 |
746 | 728 // Decode a single frame (mp3,acm etc) or 'minlen' bytes (pcm/alaw etc) |
729 // buffer length is 'maxlen' bytes, it shouldn't be exceeded... | |
730 | |
731 int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen){ | |
291 | 732 int len=-1; |
303 | 733 switch(sh_audio->codec->driver){ |
1927 | 734 #ifdef USE_LIBAVCODEC |
735 case AFM_FFMPEG: { | |
736 unsigned char *start=NULL; | |
737 int y; | |
738 while(len<minlen){ | |
739 int len2=0; | |
740 int x=ds_get_packet(sh_audio->ds,&start); | |
741 if(x<=0) break; // error | |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
742 y=avcodec_decode_audio(&lavc_context,(INT16*)buf,&len2,start,x); |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1927
diff
changeset
|
743 if(y<0){ mp_msg(MSGT_DECAUDIO,MSGL_V,"lavc_audio: error\n");break; } |
1927 | 744 if(y<x) sh_audio->ds->buffer_pos+=y-x; // put back data (HACK!) |
745 if(len2>0){ | |
746 //len=len2;break; | |
747 if(len<0) len=len2; else len+=len2; | |
748 buf+=len2; | |
749 } | |
750 mp_dbg(MSGT_DECAUDIO,MSGL_DBG2,"Decoded %d -> %d \n",y,len2); | |
751 } | |
752 } | |
753 break; | |
754 #endif | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
755 case AFM_MPEG: // MPEG layer 2 or 3 |
291 | 756 len=MP3_DecodeFrame(buf,-1); |
1485
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1456
diff
changeset
|
757 // len=MP3_DecodeFrame(buf,3); |
291 | 758 break; |
1830 | 759 #ifdef HAVE_OGGVORBIS |
1828 | 760 case AFM_VORBIS: { // OggVorbis |
761 /* note: good minlen would be 4k or 8k IMHO - atmos */ | |
762 int ret; | |
763 char *buffer; | |
764 int bytes; | |
765 int samples; | |
766 float **pcm; | |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
767 //ogg_int16_t convbuffer[4096]; |
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
768 // int convsize; |
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
769 int readlen=1024; |
1834
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
770 len=0; |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
771 // convsize=minlen/sh_audio->ov->vi.channels; |
1834
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
772 |
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
773 while(len < minlen) { /* double loop allows for break in inner loop */ |
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
774 while(len < minlen) { /* without aborting the outer loop - atmos */ |
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
775 ret=ogg_stream_packetout(&sh_audio->ov->os,&sh_audio->ov->op); |
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
776 if(ret==0) { |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
777 int xxx=0; |
1834
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
778 //printf("OggVorbis: Packetout: need more data, paging!\n"); |
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
779 while((ret = ogg_sync_pageout(&sh_audio->ov->oy,&sh_audio->ov->og))!=1) { |
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
780 if(ret == -1) |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
781 mp_msg(MSGT_DECAUDIO,MSGL_V,"OggVorbis: Pageout: not properly synced, had to skip some bytes.\n"); |
1834
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
782 else |
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
783 if(ret == 0) { |
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
784 //printf("OggVorbis: Pageout: need more data to verify page, reading more data.\n"); |
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
785 /* submit a readlen k block to libvorbis' Ogg layer */ |
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
786 buffer=ogg_sync_buffer(&sh_audio->ov->oy,readlen); |
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
787 bytes=demux_read_data(sh_audio->ds,buffer,readlen); |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
788 xxx+=bytes; |
1834
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
789 ogg_sync_wrote(&sh_audio->ov->oy,bytes); |
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
790 if(bytes==0) |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
791 mp_msg(MSGT_DECAUDIO,MSGL_V,"OggVorbis: 0Bytes written, possible End of Stream\n"); |
1834
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
792 } |
1828 | 793 } |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
794 mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"\n[sync: %d ]\n",xxx); |
1834
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
795 //printf("OggVorbis: Pageout: successfull, pagin in.\n"); |
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
796 if(ogg_stream_pagein(&sh_audio->ov->os,&sh_audio->ov->og)<0) |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
797 mp_msg(MSGT_DECAUDIO,MSGL_V,"OggVorbis: Pagein failed!\n"); |
1834
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
798 break; |
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
799 } else if(ret<0) { |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
800 mp_msg(MSGT_DECAUDIO,MSGL_V,"OggVorbis: Packetout: missing or corrupt data, skipping packet!\n"); |
1834
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
801 break; |
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
802 } else { |
1828 | 803 |
804 /* we have a packet. Decode it */ | |
805 | |
806 if(vorbis_synthesis(&sh_audio->ov->vb,&sh_audio->ov->op)==0) /* test for success! */ | |
807 vorbis_synthesis_blockin(&sh_audio->ov->vd,&sh_audio->ov->vb); | |
808 | |
809 /* **pcm is a multichannel float vector. In stereo, for | |
810 example, pcm[0] is left, and pcm[1] is right. samples is | |
811 the size of each channel. Convert the float values | |
812 (-1.<=range<=1.) to whatever PCM format and write it out */ | |
813 | |
814 while((samples=vorbis_synthesis_pcmout(&sh_audio->ov->vd,&pcm))>0){ | |
815 int i,j; | |
816 int clipflag=0; | |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
817 int convsize=(maxlen-len)/(2*sh_audio->ov->vi.channels); // max size! |
1828 | 818 int bout=(samples<convsize?samples:convsize); |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
819 |
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
820 if(bout<=0) break; |
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
821 |
1828 | 822 /* convert floats to 16 bit signed ints (host order) and |
823 interleave */ | |
824 for(i=0;i<sh_audio->ov->vi.channels;i++){ | |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
825 ogg_int16_t *convbuffer=(ogg_int16_t *)(&buf[len]); |
1828 | 826 ogg_int16_t *ptr=convbuffer+i; |
827 float *mono=pcm[i]; | |
828 for(j=0;j<bout;j++){ | |
829 #if 1 | |
830 int val=mono[j]*32767.f; | |
831 #else /* optional dither */ | |
832 int val=mono[j]*32767.f+drand48()-0.5f; | |
833 #endif | |
834 /* might as well guard against clipping */ | |
835 if(val>32767){ | |
836 val=32767; | |
837 clipflag=1; | |
838 } | |
839 if(val<-32768){ | |
840 val=-32768; | |
841 clipflag=1; | |
842 } | |
843 *ptr=val; | |
844 ptr+=sh_audio->ov->vi.channels; | |
845 } | |
846 } | |
847 | |
848 if(clipflag) | |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
849 mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"Clipping in frame %ld\n",(long)(sh_audio->ov->vd.sequence)); |
1828 | 850 |
851 //fwrite(convbuffer,2*sh_audio->ov->vi.channels,bout,stderr); //dump pcm to file for debugging | |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
852 //memcpy(buf+len,convbuffer,2*sh_audio->ov->vi.channels*bout); |
1834
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
853 len+=2*sh_audio->ov->vi.channels*bout; |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
854 |
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
855 mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"\n[decoded: %d / %d ]\n",bout,samples); |
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
856 |
1828 | 857 vorbis_synthesis_read(&sh_audio->ov->vd,bout); /* tell libvorbis how |
858 many samples we | |
859 actually consumed */ | |
860 } | |
1834
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
861 } // from else, packetout ok |
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
862 } // while len |
3f8da9408f04
Now oggvorbis decoding properly works, but a/v sync is bad.
atmos4
parents:
1831
diff
changeset
|
863 } // outer while len |
1828 | 864 if(ogg_page_eos(&sh_audio->ov->og)) |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
865 mp_msg(MSGT_DECAUDIO,MSGL_V,"OggVorbis: End of Stream reached!\n"); // FIXME clearup decoder, notify mplayer - atmos |
1828 | 866 |
1837
9fd8b5e0b864
ogg/vorbis stuff cleanup, buffering fixes, printf->mp_msg
arpi
parents:
1834
diff
changeset
|
867 mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"\n[len: %d ]\n",len); |
1828 | 868 |
869 break; | |
1831 | 870 } |
1830 | 871 #endif |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
872 case AFM_PCM: // AVI PCM |
1058 | 873 len=demux_read_data(sh_audio->ds,buf,minlen); |
401 | 874 break; |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
875 case AFM_DVDPCM: // DVD PCM |
401 | 876 { int j; |
746 | 877 len=demux_read_data(sh_audio->ds,buf,minlen); |
291 | 878 //if(i&1){ printf("Warning! pcm_audio_size&1 !=0 (%d)\n",i);i&=~1; } |
746 | 879 // swap endian: |
291 | 880 for(j=0;j<len;j+=2){ |
881 char x=buf[j]; | |
882 buf[j]=buf[j+1]; | |
883 buf[j+1]=x; | |
884 } | |
885 break; | |
886 } | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
887 case AFM_ALAW: // aLaw decoder |
746 | 888 { int l=demux_read_data(sh_audio->ds,buf,minlen/2); |
291 | 889 unsigned short *d=(unsigned short *) buf; |
890 unsigned char *s=buf; | |
891 len=2*l; | |
758 | 892 if(sh_audio->format==6){ |
893 // aLaw | |
883 | 894 while(l>0){ --l; d[l]=alaw2short[s[l]]; } |
758 | 895 } else { |
896 // uLaw | |
883 | 897 while(l>0){ --l; d[l]=ulaw2short[s[l]]; } |
291 | 898 } |
899 break; | |
900 } | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
901 case AFM_GSM: // MS-GSM decoder |
2420 | 902 { unsigned char ibuf[65]; // 65 bytes / frame |
903 if(demux_read_data(sh_audio->ds,ibuf,65)!=65) break; // EOF | |
904 XA_MSGSM_Decoder(ibuf,(unsigned short *) buf); // decodes 65 byte -> 320 short | |
746 | 905 // XA_GSM_Decoder(buf,(unsigned short *) &sh_audio->a_buffer[sh_audio->a_buffer_len]); // decodes 33 byte -> 160 short |
906 len=2*320; | |
291 | 907 break; |
908 } | |
3426 | 909 case AFM_G72X: // GSM 723 decoder |
910 { if(demux_read_data(sh_audio->ds,g72x_data.block, g72x_data.blocksize)!=g72x_data.blocksize) break; // EOF | |
911 g72x_decode_block(&g72x_data); | |
912 len=2*g72x_data.samplesperblock; | |
913 memcpy(buf,g72x_data.samples,len); | |
914 break; | |
915 } | |
3787 | 916 case AFM_IMAADPCM: |
3756 | 917 { unsigned char ibuf[IMA_ADPCM_BLOCK_SIZE * 2]; // bytes / stereo frame |
918 if (demux_read_data(sh_audio->ds, ibuf, | |
3787 | 919 IMA_ADPCM_BLOCK_SIZE * sh_audio->wf->nChannels) != |
3756 | 920 IMA_ADPCM_BLOCK_SIZE * sh_audio->wf->nChannels) |
921 break; // EOF | |
922 len=2*ima_adpcm_decode_block((unsigned short*)buf,ibuf, sh_audio->wf->nChannels); | |
3787 | 923 break; |
924 } | |
925 case AFM_MSADPCM: | |
926 { unsigned char ibuf[MS_ADPCM_BLOCK_SIZE * 2]; // bytes / stereo frame | |
927 if (demux_read_data(sh_audio->ds, ibuf, | |
928 MS_ADPCM_BLOCK_SIZE * sh_audio->wf->nChannels) != | |
929 MS_ADPCM_BLOCK_SIZE * sh_audio->wf->nChannels) | |
930 break; // EOF | |
931 len=2*ms_adpcm_decode_block((unsigned short*)buf,ibuf, sh_audio->wf->nChannels); | |
2420 | 932 break; |
933 } | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
934 case AFM_AC3: // AC3 decoder |
291 | 935 //printf("{1:%d}",avi_header.idx_pos);fflush(stdout); |
936 if(!sh_audio->ac3_frame) sh_audio->ac3_frame=ac3_decode_frame(); | |
937 //printf("{2:%d}",avi_header.idx_pos);fflush(stdout); | |
938 if(sh_audio->ac3_frame){ | |
296 | 939 len = 256 * 6 *sh_audio->channels*sh_audio->samplesize; |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
432
diff
changeset
|
940 memcpy(buf,((ac3_frame_t*)sh_audio->ac3_frame)->audio_data,len); |
291 | 941 sh_audio->ac3_frame=NULL; |
942 } | |
943 //printf("{3:%d}",avi_header.idx_pos);fflush(stdout); | |
944 break; | |
3413 | 945 case AFM_A52: { // AC3 decoder |
946 int flags=0; | |
947 int i; | |
948 sample_t level=1, bias=384; | |
949 if(!sh_audio->a_in_buffer_len) | |
950 if(a52_fillbuff(sh_audio)<0) break; // EOF | |
951 switch(sh_audio->channels){ | |
952 case 1: flags=A52_MONO; break; | |
953 // case 2: flags=A52_STEREO; break; | |
954 case 2: flags=A52_DOLBY; break; | |
955 // case 3: flags=A52_3F; break; | |
956 case 3: flags=A52_2F1R; break; | |
957 case 4: flags=A52_2F2R; break; // 2+2 | |
958 case 5: flags=A52_3F2R; break; | |
959 case 6: flags=A52_3F2R|A52_LFE; break; // 5.1 | |
960 } | |
961 flags|=A52_ADJUST_LEVEL; | |
962 sh_audio->a_in_buffer_len=0; | |
963 if (a52_frame (&a52_state, sh_audio->a_in_buffer, &flags, &level, bias)){ | |
964 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"a52: error decoding frame\n"); | |
965 break; | |
966 } | |
967 // a52_dynrng (&state, NULL, NULL); // disable dynamic range compensation | |
968 | |
969 // frame decoded, let's resample: | |
970 a52_resample_init(flags,sh_audio->channels); | |
971 len=0; | |
972 for (i = 0; i < 6; i++) { | |
973 if (a52_block (&a52_state, a52_samples)){ | |
974 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"a52: error at resampling\n"); | |
975 break; | |
976 } | |
977 len+=2*a52_resample(a52_samples,&buf[len]); | |
978 } | |
3417 | 979 // printf("len = %d \n",len); // 6144 on all vobs I tried so far... (5.1 and 2.0) ::atmos |
3413 | 980 break; |
981 } | |
1528
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
982 case AFM_HWAC3: // AC3 through SPDIF |
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
983 if(demux_read_data(sh_audio->ds,sh_audio->ac3_frame, 6144) != 6144) |
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
984 break; //EOF |
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
985 ac3_iec958_build_burst(1536, 0x1F, 1, buf, sh_audio->ac3_frame); |
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
986 len = 6144; |
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
987 break; |
1517
0e9c29538a86
Use USE_WIN32DLL define instead of ARCH_X86 to decide whether or not to compile
jkeil
parents:
1485
diff
changeset
|
988 #ifdef USE_WIN32DLL |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
989 case AFM_ACM: |
758 | 990 // len=sh_audio->audio_out_minsize; // optimal decoded fragment size |
991 // if(len<minlen) len=minlen; else | |
992 // if(len>maxlen) len=maxlen; | |
993 // len=acm_decode_audio(sh_audio,buf,len); | |
994 len=acm_decode_audio(sh_audio,buf,minlen,maxlen); | |
291 | 995 break; |
1309
598e3047ce13
Add some preliminary support for non-x86 architectures to mplayer
jkeil
parents:
1291
diff
changeset
|
996 #endif |
746 | 997 |
291 | 998 #ifdef USE_DIRECTSHOW |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
999 case AFM_DSHOW: // DirectShow |
1327
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1320
diff
changeset
|
1000 { int size_in=0; |
291 | 1001 int size_out=0; |
3442 | 1002 int srcsize=DS_AudioDecoder_GetSrcSize(ds_adec, maxlen); |
1567 | 1003 mp_msg(MSGT_DECAUDIO,MSGL_DBG3,"DShow says: srcsize=%d (buffsize=%d) out_size=%d\n",srcsize,sh_audio->a_in_buffer_size,maxlen); |
291 | 1004 if(srcsize>sh_audio->a_in_buffer_size) srcsize=sh_audio->a_in_buffer_size; // !!!!!! |
1005 if(sh_audio->a_in_buffer_len<srcsize){ | |
1006 sh_audio->a_in_buffer_len+= | |
1007 demux_read_data(sh_audio->ds,&sh_audio->a_in_buffer[sh_audio->a_in_buffer_len], | |
1008 srcsize-sh_audio->a_in_buffer_len); | |
1009 } | |
3442 | 1010 DS_AudioDecoder_Convert(ds_adec, sh_audio->a_in_buffer,sh_audio->a_in_buffer_len, |
291 | 1011 buf,maxlen, &size_in,&size_out); |
1567 | 1012 mp_dbg(MSGT_DECAUDIO,MSGL_DBG2,"DShow: audio %d -> %d converted (in_buf_len=%d of %d) %d\n",size_in,size_out,sh_audio->a_in_buffer_len,sh_audio->a_in_buffer_size,ds_tell_pts(sh_audio->ds)); |
291 | 1013 if(size_in>=sh_audio->a_in_buffer_len){ |
1014 sh_audio->a_in_buffer_len=0; | |
1015 } else { | |
1016 sh_audio->a_in_buffer_len-=size_in; | |
1017 memcpy(sh_audio->a_in_buffer,&sh_audio->a_in_buffer[size_in],sh_audio->a_in_buffer_len); | |
1018 } | |
1019 len=size_out; | |
1020 break; | |
1021 } | |
1022 #endif | |
2415 | 1023 |
1024 #ifdef USE_LIBMAD | |
1025 case AFM_MAD: | |
1026 { | |
1027 mad_prepare_buffer(sh_audio, &mad_stream, sh_audio->a_in_buffer_size); | |
1028 mad_stream_buffer(&mad_stream, sh_audio->a_in_buffer, sh_audio->a_in_buffer_len); | |
1029 if(mad_frame_decode(&mad_frame, &mad_stream) == 0) | |
1030 { | |
1031 mad_synth_frame(&mad_synth, &mad_frame); | |
1032 mad_postprocess_buffer(sh_audio, &mad_stream); | |
1033 | |
1034 /* and fill buffer */ | |
1035 | |
1036 { | |
1037 int i; | |
1038 int end_size = mad_synth.pcm.length; | |
1039 signed short* samples = (signed short*)buf; | |
1040 if(end_size > maxlen/4) | |
1041 end_size=maxlen/4; | |
1042 | |
1043 for(i=0; i<mad_synth.pcm.length; ++i) { | |
1044 *samples++ = mad_scale(mad_synth.pcm.samples[0][i]); | |
1045 *samples++ = mad_scale(mad_synth.pcm.samples[0][i]); | |
1046 // *buf++ = mad_scale(mad_synth.pcm.sampAles[1][i]); | |
1047 } | |
1048 len = end_size*4; | |
1049 } | |
1050 } | |
1051 else | |
1052 { | |
1053 printf(__FILE__ ":%d:mad: frame decoding failed\n", __LINE__); | |
1054 } | |
1055 | |
1056 break; | |
1057 } | |
1058 #endif | |
291 | 1059 } |
1060 return len; | |
1061 } | |
1062 | |
1327
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1320
diff
changeset
|
1063 void resync_audio_stream(sh_audio_t *sh_audio){ |
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1320
diff
changeset
|
1064 switch(sh_audio->codec->driver){ |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
1065 case AFM_MPEG: |
1327
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1320
diff
changeset
|
1066 MP3_DecodeFrame(NULL,-2); // resync |
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1320
diff
changeset
|
1067 MP3_DecodeFrame(NULL,-2); // resync |
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1320
diff
changeset
|
1068 MP3_DecodeFrame(NULL,-2); // resync |
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1320
diff
changeset
|
1069 break; |
1849
5f246fcc2971
Resetting stream and sync for seek, no correct test files yet for proper testing but should be ok.
atmos4
parents:
1837
diff
changeset
|
1070 #ifdef HAVE_OGGVORBIS |
5f246fcc2971
Resetting stream and sync for seek, no correct test files yet for proper testing but should be ok.
atmos4
parents:
1837
diff
changeset
|
1071 case AFM_VORBIS: |
5f246fcc2971
Resetting stream and sync for seek, no correct test files yet for proper testing but should be ok.
atmos4
parents:
1837
diff
changeset
|
1072 //printf("OggVorbis: resetting stream.\n"); |
5f246fcc2971
Resetting stream and sync for seek, no correct test files yet for proper testing but should be ok.
atmos4
parents:
1837
diff
changeset
|
1073 ogg_sync_reset(&sh_audio->ov->oy); |
5f246fcc2971
Resetting stream and sync for seek, no correct test files yet for proper testing but should be ok.
atmos4
parents:
1837
diff
changeset
|
1074 ogg_stream_reset(&sh_audio->ov->os); |
5f246fcc2971
Resetting stream and sync for seek, no correct test files yet for proper testing but should be ok.
atmos4
parents:
1837
diff
changeset
|
1075 break; |
5f246fcc2971
Resetting stream and sync for seek, no correct test files yet for proper testing but should be ok.
atmos4
parents:
1837
diff
changeset
|
1076 #endif |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
1077 case AFM_AC3: |
1327
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1320
diff
changeset
|
1078 ac3_bitstream_reset(); // reset AC3 bitstream buffer |
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1320
diff
changeset
|
1079 // if(verbose){ printf("Resyncing AC3 audio...");fflush(stdout);} |
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1320
diff
changeset
|
1080 sh_audio->ac3_frame=ac3_decode_frame(); // resync |
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1320
diff
changeset
|
1081 // if(verbose) printf(" OK!\n"); |
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1320
diff
changeset
|
1082 break; |
3413 | 1083 case AFM_A52: |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
1084 case AFM_ACM: |
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
1085 case AFM_DSHOW: |
1528
a444bd456fcc
ac3/spdif patch by German Gomez Garcia <german@piraos.com>
arpi
parents:
1517
diff
changeset
|
1086 case AFM_HWAC3: |
1327
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1320
diff
changeset
|
1087 sh_audio->a_in_buffer_len=0; // reset ACM/DShow audio buffer |
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1320
diff
changeset
|
1088 break; |
2415 | 1089 |
1090 #ifdef USE_LIBMAD | |
1091 case AFM_MAD: | |
1092 mad_prepare_buffer(sh_audio, &mad_stream, sh_audio->a_in_buffer_size); | |
1093 mad_stream_buffer(&mad_stream, sh_audio->a_in_buffer, sh_audio->a_in_buffer_len); | |
1094 mad_stream_sync(&mad_stream); | |
1095 mad_postprocess_buffer(sh_audio, &mad_stream); | |
1096 break; | |
2418 | 1097 #endif |
1327
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1320
diff
changeset
|
1098 } |
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1320
diff
changeset
|
1099 } |
291 | 1100 |
1327
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1320
diff
changeset
|
1101 void skip_audio_frame(sh_audio_t *sh_audio){ |
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1320
diff
changeset
|
1102 switch(sh_audio->codec->driver){ |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
1103 case AFM_MPEG: MP3_DecodeFrame(NULL,-2);break; // skip MPEG frame |
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
1104 case AFM_AC3: sh_audio->ac3_frame=ac3_decode_frame();break; // skip AC3 frame |
3413 | 1105 case AFM_A52: a52_fillbuff(sh_audio);break; // skip AC3 frame |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
1106 case AFM_ACM: |
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
1107 case AFM_DSHOW: { |
1408 | 1108 int skip=sh_audio->wf->nBlockAlign; |
1109 if(skip<16){ | |
1110 skip=(sh_audio->wf->nAvgBytesPerSec/16)&(~7); | |
1111 if(skip<16) skip=16; | |
1112 } | |
1113 demux_read_data(sh_audio->ds,NULL,skip); | |
1114 break; | |
1115 } | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
1116 case AFM_PCM: |
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
1117 case AFM_DVDPCM: |
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1408
diff
changeset
|
1118 case AFM_ALAW: { |
1408 | 1119 int skip=sh_audio->i_bps/16; |
1120 skip=skip&(~3); | |
1121 demux_read_data(sh_audio->ds,NULL,skip); | |
1122 break; | |
1123 } | |
2415 | 1124 #ifdef USE_LIBMAD |
1125 case AFM_MAD: | |
1126 { | |
1127 mad_prepare_buffer(sh_audio, &mad_stream, sh_audio->a_in_buffer_size); | |
1128 mad_stream_buffer(&mad_stream, sh_audio->a_in_buffer, sh_audio->a_in_buffer_len); | |
1129 mad_stream_skip(&mad_stream, 2); | |
1130 mad_stream_sync(&mad_stream); | |
1131 mad_postprocess_buffer(sh_audio, &mad_stream); | |
1132 break; | |
1133 } | |
1134 #endif | |
1135 | |
1327
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1320
diff
changeset
|
1136 default: ds_fill_buffer(sh_audio->ds); // skip PCM frame |
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1320
diff
changeset
|
1137 } |
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1320
diff
changeset
|
1138 } |