annotate libmpcodecs/dec_audio.c @ 17921:baa1df31e661

insert linebreak, \-playing-msg option
author kraymer
date Wed, 22 Mar 2006 18:19:15 +0000
parents db13b7295651
children 4231482179b6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5342
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
1 #include <stdio.h>
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
2 #include <stdlib.h>
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
3 #include <unistd.h>
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
4
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
5 #include "config.h"
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
6 #include "mp_msg.h"
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
7 #include "help_mp.h"
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
8
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
9 #include "stream.h"
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
10 #include "demuxer.h"
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
11
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
12 #include "codec-cfg.h"
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
13 #include "stheader.h"
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
14
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
15 #include "dec_audio.h"
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
16 #include "ad.h"
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 16793
diff changeset
17 #include "libaf/af_format.h"
5342
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
18
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 16793
diff changeset
19 #include "libaf/af.h"
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
20
17635
db13b7295651 memalign segfaults when used without declaration on amd64 (default function return type is int so the pointer was trunctated to 32bits)
aurel
parents: 17625
diff changeset
21 #ifdef HAVE_MALLOC_H
db13b7295651 memalign segfaults when used without declaration on amd64 (default function return type is int so the pointer was trunctated to 32bits)
aurel
parents: 17625
diff changeset
22 #include <malloc.h>
db13b7295651 memalign segfaults when used without declaration on amd64 (default function return type is int so the pointer was trunctated to 32bits)
aurel
parents: 17625
diff changeset
23 #endif
db13b7295651 memalign segfaults when used without declaration on amd64 (default function return type is int so the pointer was trunctated to 32bits)
aurel
parents: 17625
diff changeset
24
8152
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
25 #ifdef DYNAMIC_PLUGINS
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
26 #include <dlfcn.h>
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
27 #endif
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
28
5342
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
29 #ifdef USE_FAKE_MONO
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
30 int fakemono=0;
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
31 #endif
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
32 /* used for ac3surround decoder - set using -channels option */
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
33 int audio_output_channels = 2;
15950
4432bb25b13e -af-adv force=1 is now default (and thus also lavcresample)
reimar
parents: 15811
diff changeset
34 af_cfg_t af_cfg = {1, NULL}; // Configuration for audio filters
5342
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
35
17566
f580a7755ac5 Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents: 17427
diff changeset
36 void afm_help(void){
7191
1eadce15446c -afm/-vfm help implemenetd, some cosmetics of ad/vd codec names/comments
arpi
parents: 7180
diff changeset
37 int i;
1eadce15446c -afm/-vfm help implemenetd, some cosmetics of ad/vd codec names/comments
arpi
parents: 7180
diff changeset
38 mp_msg(MSGT_DECAUDIO,MSGL_INFO,MSGTR_AvailableAudioFm);
15789
32d9c8a0a02b adds some more -identify output, patch by kiriuja < mplayer DASH patches PAM en DASH directo POUM net>
gpoirier
parents: 14819
diff changeset
39 if (identify)
32d9c8a0a02b adds some more -identify output, patch by kiriuja < mplayer DASH patches PAM en DASH directo POUM net>
gpoirier
parents: 14819
diff changeset
40 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_AUDIO_DRIVERS\n");
7191
1eadce15446c -afm/-vfm help implemenetd, some cosmetics of ad/vd codec names/comments
arpi
parents: 7180
diff changeset
41 mp_msg(MSGT_DECAUDIO,MSGL_INFO," afm: info: (comment)\n");
1eadce15446c -afm/-vfm help implemenetd, some cosmetics of ad/vd codec names/comments
arpi
parents: 7180
diff changeset
42 for (i=0; mpcodecs_ad_drivers[i] != NULL; i++)
1eadce15446c -afm/-vfm help implemenetd, some cosmetics of ad/vd codec names/comments
arpi
parents: 7180
diff changeset
43 if(mpcodecs_ad_drivers[i]->info->comment && mpcodecs_ad_drivers[i]->info->comment[0])
1eadce15446c -afm/-vfm help implemenetd, some cosmetics of ad/vd codec names/comments
arpi
parents: 7180
diff changeset
44 mp_msg(MSGT_DECAUDIO,MSGL_INFO,"%9s %s (%s)\n",
1eadce15446c -afm/-vfm help implemenetd, some cosmetics of ad/vd codec names/comments
arpi
parents: 7180
diff changeset
45 mpcodecs_ad_drivers[i]->info->short_name,
1eadce15446c -afm/-vfm help implemenetd, some cosmetics of ad/vd codec names/comments
arpi
parents: 7180
diff changeset
46 mpcodecs_ad_drivers[i]->info->name,
1eadce15446c -afm/-vfm help implemenetd, some cosmetics of ad/vd codec names/comments
arpi
parents: 7180
diff changeset
47 mpcodecs_ad_drivers[i]->info->comment);
1eadce15446c -afm/-vfm help implemenetd, some cosmetics of ad/vd codec names/comments
arpi
parents: 7180
diff changeset
48 else
1eadce15446c -afm/-vfm help implemenetd, some cosmetics of ad/vd codec names/comments
arpi
parents: 7180
diff changeset
49 mp_msg(MSGT_DECAUDIO,MSGL_INFO,"%9s %s\n",
1eadce15446c -afm/-vfm help implemenetd, some cosmetics of ad/vd codec names/comments
arpi
parents: 7180
diff changeset
50 mpcodecs_ad_drivers[i]->info->short_name,
1eadce15446c -afm/-vfm help implemenetd, some cosmetics of ad/vd codec names/comments
arpi
parents: 7180
diff changeset
51 mpcodecs_ad_drivers[i]->info->name);
1eadce15446c -afm/-vfm help implemenetd, some cosmetics of ad/vd codec names/comments
arpi
parents: 7180
diff changeset
52 }
1eadce15446c -afm/-vfm help implemenetd, some cosmetics of ad/vd codec names/comments
arpi
parents: 7180
diff changeset
53
7522
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
54 int init_audio_codec(sh_audio_t *sh_audio)
5342
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
55 {
14815
56fb33e23ad4 If -af-adv force=4 is in effect, use ADCTRL_QUERY_FORMAT to query the
hzoli
parents: 14814
diff changeset
56 if ((af_cfg.force & AF_INIT_FORMAT_MASK) == AF_INIT_FLOAT) {
56fb33e23ad4 If -af-adv force=4 is in effect, use ADCTRL_QUERY_FORMAT to query the
hzoli
parents: 14814
diff changeset
57 int fmt = AF_FORMAT_FLOAT_NE;
14819
601e2c8a2922 Remove file-global mpadec, add ad_driver member to sh_audio_t instead.
hzoli
parents: 14818
diff changeset
58 if (sh_audio->ad_driver->control(sh_audio, ADCTRL_QUERY_FORMAT,
14815
56fb33e23ad4 If -af-adv force=4 is in effect, use ADCTRL_QUERY_FORMAT to query the
hzoli
parents: 14814
diff changeset
59 &fmt) == CONTROL_TRUE) {
56fb33e23ad4 If -af-adv force=4 is in effect, use ADCTRL_QUERY_FORMAT to query the
hzoli
parents: 14814
diff changeset
60 sh_audio->sample_format = fmt;
56fb33e23ad4 If -af-adv force=4 is in effect, use ADCTRL_QUERY_FORMAT to query the
hzoli
parents: 14814
diff changeset
61 sh_audio->samplesize = 4;
56fb33e23ad4 If -af-adv force=4 is in effect, use ADCTRL_QUERY_FORMAT to query the
hzoli
parents: 14814
diff changeset
62 }
56fb33e23ad4 If -af-adv force=4 is in effect, use ADCTRL_QUERY_FORMAT to query the
hzoli
parents: 14814
diff changeset
63 }
14819
601e2c8a2922 Remove file-global mpadec, add ad_driver member to sh_audio_t instead.
hzoli
parents: 14818
diff changeset
64 if(!sh_audio->ad_driver->preinit(sh_audio))
5342
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
65 {
6989
b2ba67f6203e messages moved from dec_??d?o.c
jaf
parents: 6186
diff changeset
66 mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_ADecoderPreinitFailed);
5342
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
67 return 0;
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
68 }
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
69
5458
b3d1348b251f audio input buffer allocation/free cleanup
arpi
parents: 5342
diff changeset
70 /* allocate audio in buffer: */
b3d1348b251f audio input buffer allocation/free cleanup
arpi
parents: 5342
diff changeset
71 if(sh_audio->audio_in_minsize>0){
b3d1348b251f audio input buffer allocation/free cleanup
arpi
parents: 5342
diff changeset
72 sh_audio->a_in_buffer_size=sh_audio->audio_in_minsize;
6989
b2ba67f6203e messages moved from dec_??d?o.c
jaf
parents: 6186
diff changeset
73 mp_msg(MSGT_DECAUDIO,MSGL_V,MSGTR_AllocatingBytesForInputBuffer,
5458
b3d1348b251f audio input buffer allocation/free cleanup
arpi
parents: 5342
diff changeset
74 sh_audio->a_in_buffer_size);
17625
c5f33a8021c7 Align memory at 16 byte boundaries.
diego
parents: 17566
diff changeset
75 sh_audio->a_in_buffer=memalign(16,sh_audio->a_in_buffer_size);
5458
b3d1348b251f audio input buffer allocation/free cleanup
arpi
parents: 5342
diff changeset
76 memset(sh_audio->a_in_buffer,0,sh_audio->a_in_buffer_size);
b3d1348b251f audio input buffer allocation/free cleanup
arpi
parents: 5342
diff changeset
77 sh_audio->a_in_buffer_len=0;
b3d1348b251f audio input buffer allocation/free cleanup
arpi
parents: 5342
diff changeset
78 }
b3d1348b251f audio input buffer allocation/free cleanup
arpi
parents: 5342
diff changeset
79
5342
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
80 /* allocate audio out buffer: */
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
81 sh_audio->a_buffer_size=sh_audio->audio_out_minsize+MAX_OUTBURST; /* worst case calc.*/
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
82
6989
b2ba67f6203e messages moved from dec_??d?o.c
jaf
parents: 6186
diff changeset
83 mp_msg(MSGT_DECAUDIO,MSGL_V,MSGTR_AllocatingBytesForOutputBuffer,
5342
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
84 sh_audio->audio_out_minsize,MAX_OUTBURST,sh_audio->a_buffer_size);
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
85
17625
c5f33a8021c7 Align memory at 16 byte boundaries.
diego
parents: 17566
diff changeset
86 sh_audio->a_buffer=memalign(16,sh_audio->a_buffer_size);
5342
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
87 if(!sh_audio->a_buffer){
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
88 mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_CantAllocAudioBuf);
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
89 return 0;
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
90 }
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
91 memset(sh_audio->a_buffer,0,sh_audio->a_buffer_size);
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
92 sh_audio->a_buffer_len=0;
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
93
14819
601e2c8a2922 Remove file-global mpadec, add ad_driver member to sh_audio_t instead.
hzoli
parents: 14818
diff changeset
94 if(!sh_audio->ad_driver->init(sh_audio)){
6989
b2ba67f6203e messages moved from dec_??d?o.c
jaf
parents: 6186
diff changeset
95 mp_msg(MSGT_DECAUDIO,MSGL_WARN,MSGTR_ADecoderInitFailed);
5458
b3d1348b251f audio input buffer allocation/free cleanup
arpi
parents: 5342
diff changeset
96 uninit_audio(sh_audio); // free buffers
5342
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
97 return 0;
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
98 }
5458
b3d1348b251f audio input buffer allocation/free cleanup
arpi
parents: 5342
diff changeset
99
5342
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
100 sh_audio->inited=1;
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
101
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
102 if(!sh_audio->channels || !sh_audio->samplerate){
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
103 mp_msg(MSGT_DECAUDIO,MSGL_WARN,MSGTR_UnknownAudio);
5458
b3d1348b251f audio input buffer allocation/free cleanup
arpi
parents: 5342
diff changeset
104 uninit_audio(sh_audio); // free buffers
5342
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
105 return 0;
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
106 }
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
107
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
108 if(!sh_audio->o_bps)
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
109 sh_audio->o_bps=sh_audio->channels*sh_audio->samplerate*sh_audio->samplesize;
7522
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
110
14814
f022294269a8 more verbose message
alex
parents: 14527
diff changeset
111 mp_msg(MSGT_DECAUDIO,MSGL_INFO,"AUDIO: %d Hz, %d ch, %s, %3.1f kbit/%3.2f%% (ratio: %d->%d)\n",
7522
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
112 sh_audio->samplerate,sh_audio->channels,
14814
f022294269a8 more verbose message
alex
parents: 14527
diff changeset
113 af_fmt2str_short(sh_audio->sample_format),
f022294269a8 more verbose message
alex
parents: 14527
diff changeset
114 sh_audio->i_bps*8*0.001,((float)sh_audio->i_bps/sh_audio->o_bps)*100.0,
f022294269a8 more verbose message
alex
parents: 14527
diff changeset
115 sh_audio->i_bps,sh_audio->o_bps);
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
116
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
117 sh_audio->a_out_buffer_size=sh_audio->a_buffer_size;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
118 sh_audio->a_out_buffer=sh_audio->a_buffer;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
119 sh_audio->a_out_buffer_len=sh_audio->a_buffer_len;
5458
b3d1348b251f audio input buffer allocation/free cleanup
arpi
parents: 5342
diff changeset
120
b3d1348b251f audio input buffer allocation/free cleanup
arpi
parents: 5342
diff changeset
121 return 1;
5342
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
122 }
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
123
7522
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
124 int init_audio(sh_audio_t *sh_audio,char* codecname,char* afm,int status){
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
125 unsigned int orig_fourcc=sh_audio->wf?sh_audio->wf->wFormatTag:0;
16321
efbfac98cab1 Allow forcing of demuxers and codecs by prepending '+'
reimar
parents: 16306
diff changeset
126 int force = 0;
efbfac98cab1 Allow forcing of demuxers and codecs by prepending '+'
reimar
parents: 16306
diff changeset
127 if (codecname && codecname[0] == '+') {
efbfac98cab1 Allow forcing of demuxers and codecs by prepending '+'
reimar
parents: 16306
diff changeset
128 codecname = &codecname[1];
efbfac98cab1 Allow forcing of demuxers and codecs by prepending '+'
reimar
parents: 16306
diff changeset
129 force = 1;
efbfac98cab1 Allow forcing of demuxers and codecs by prepending '+'
reimar
parents: 16306
diff changeset
130 }
7522
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
131 sh_audio->codec=NULL;
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
132 while(1){
14819
601e2c8a2922 Remove file-global mpadec, add ad_driver member to sh_audio_t instead.
hzoli
parents: 14818
diff changeset
133 ad_functions_t* mpadec;
7522
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
134 int i;
14819
601e2c8a2922 Remove file-global mpadec, add ad_driver member to sh_audio_t instead.
hzoli
parents: 14818
diff changeset
135 sh_audio->ad_driver = 0;
7522
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
136 // restore original fourcc:
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
137 if(sh_audio->wf) sh_audio->wf->wFormatTag=i=orig_fourcc;
16321
efbfac98cab1 Allow forcing of demuxers and codecs by prepending '+'
reimar
parents: 16306
diff changeset
138 if(!(sh_audio->codec=find_audio_codec(sh_audio->format,
efbfac98cab1 Allow forcing of demuxers and codecs by prepending '+'
reimar
parents: 16306
diff changeset
139 sh_audio->wf?(&i):NULL, sh_audio->codec, force) )) break;
7522
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
140 if(sh_audio->wf) sh_audio->wf->wFormatTag=i;
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
141 // ok we found one codec
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
142 if(sh_audio->codec->flags&CODECS_FLAG_SELECTED) continue; // already tried & failed
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
143 if(codecname && strcmp(sh_audio->codec->name,codecname)) continue; // -ac
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
144 if(afm && strcmp(sh_audio->codec->drv,afm)) continue; // afm doesn't match
16321
efbfac98cab1 Allow forcing of demuxers and codecs by prepending '+'
reimar
parents: 16306
diff changeset
145 if(!force && sh_audio->codec->status<status) continue; // too unstable
7522
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
146 sh_audio->codec->flags|=CODECS_FLAG_SELECTED; // tagging it
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
147 // ok, it matches all rules, let's find the driver!
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
148 for (i=0; mpcodecs_ad_drivers[i] != NULL; i++)
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
149 if(!strcmp(mpcodecs_ad_drivers[i]->info->short_name,sh_audio->codec->drv)) break;
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
150 mpadec=mpcodecs_ad_drivers[i];
8152
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
151 #ifdef DYNAMIC_PLUGINS
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
152 if (!mpadec)
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
153 {
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
154 /* try to open shared decoder plugin */
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
155 int buf_len;
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
156 char *buf;
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
157 ad_functions_t *funcs_sym;
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
158 ad_info_t *info_sym;
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
159
10272
7b0bc557987b renames: DATADIR->MPLAYER_DATADIR, CONFDIR->MPLAYER_CONFDIR, LIBDIR->MPLAYER_LIBDIR
arpi
parents: 9132
diff changeset
160 buf_len = strlen(MPLAYER_LIBDIR)+strlen(sh_audio->codec->drv)+16;
8152
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
161 buf = malloc(buf_len);
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
162 if (!buf)
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
163 break;
10272
7b0bc557987b renames: DATADIR->MPLAYER_DATADIR, CONFDIR->MPLAYER_CONFDIR, LIBDIR->MPLAYER_LIBDIR
arpi
parents: 9132
diff changeset
164 snprintf(buf, buf_len, "%s/mplayer/ad_%s.so", MPLAYER_LIBDIR, sh_audio->codec->drv);
8152
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
165 mp_msg(MSGT_DECAUDIO, MSGL_DBG2, "Trying to open external plugin: %s\n", buf);
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
166 sh_audio->dec_handle = dlopen(buf, RTLD_LAZY);
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
167 if (!sh_audio->dec_handle)
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
168 break;
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
169 snprintf(buf, buf_len, "mpcodecs_ad_%s", sh_audio->codec->drv);
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
170 funcs_sym = dlsym(sh_audio->dec_handle, buf);
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
171 if (!funcs_sym || !funcs_sym->info || !funcs_sym->preinit ||
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
172 !funcs_sym->init || !funcs_sym->uninit || !funcs_sym->control ||
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
173 !funcs_sym->decode_audio)
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
174 break;
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
175 info_sym = funcs_sym->info;
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
176 if (strcmp(info_sym->short_name, sh_audio->codec->drv))
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
177 break;
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
178 free(buf);
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
179 mpadec = funcs_sym;
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
180 mp_msg(MSGT_DECAUDIO, MSGL_V, "Using external decoder plugin (%s/mplayer/ad_%s.so)!\n",
10272
7b0bc557987b renames: DATADIR->MPLAYER_DATADIR, CONFDIR->MPLAYER_CONFDIR, LIBDIR->MPLAYER_LIBDIR
arpi
parents: 9132
diff changeset
181 MPLAYER_LIBDIR, sh_audio->codec->drv);
8152
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
182 }
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
183 #endif
7522
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
184 if(!mpadec){ // driver not available (==compiled in)
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
185 mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_AudioCodecFamilyNotAvailableStr,
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
186 sh_audio->codec->name, sh_audio->codec->drv);
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
187 continue;
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
188 }
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
189 // it's available, let's try to init!
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
190 // init()
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
191 mp_msg(MSGT_DECAUDIO,MSGL_INFO,MSGTR_OpeningAudioDecoder,mpadec->info->short_name,mpadec->info->name);
14819
601e2c8a2922 Remove file-global mpadec, add ad_driver member to sh_audio_t instead.
hzoli
parents: 14818
diff changeset
192 sh_audio->ad_driver = mpadec;
7522
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
193 if(!init_audio_codec(sh_audio)){
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
194 mp_msg(MSGT_DECAUDIO,MSGL_INFO,MSGTR_ADecoderInitFailed);
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
195 continue; // try next...
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
196 }
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
197 // Yeah! We got it!
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
198 return 1;
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
199 }
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
200 return 0;
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
201 }
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
202
8123
9fc45fe0d444 *HUGE* set of compiler warning fixes, unused variables removal
arpi
parents: 8027
diff changeset
203 extern char *get_path(char *filename);
9fc45fe0d444 *HUGE* set of compiler warning fixes, unused variables removal
arpi
parents: 8027
diff changeset
204
7522
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
205 int init_best_audio_codec(sh_audio_t *sh_audio,char** audio_codec_list,char** audio_fm_list){
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
206 char* ac_l_default[2]={"",(char*)NULL};
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
207 // hack:
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
208 if(!audio_codec_list) audio_codec_list=ac_l_default;
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
209 // Go through the codec.conf and find the best codec...
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
210 sh_audio->inited=0;
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
211 codecs_reset_selection(1);
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
212 while(!sh_audio->inited && *audio_codec_list){
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
213 char* audio_codec=*(audio_codec_list++);
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
214 if(audio_codec[0]){
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
215 if(audio_codec[0]=='-'){
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
216 // disable this codec:
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
217 select_codec(audio_codec+1,1);
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
218 } else {
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
219 // forced codec by name:
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
220 mp_msg(MSGT_DECAUDIO,MSGL_INFO,MSGTR_ForcedAudioCodec,audio_codec);
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
221 init_audio(sh_audio,audio_codec,NULL,-1);
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
222 }
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
223 } else {
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
224 int status;
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
225 // try in stability order: UNTESTED, WORKING, BUGGY. never try CRASHING.
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
226 if(audio_fm_list){
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
227 char** fmlist=audio_fm_list;
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
228 // try first the preferred codec families:
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
229 while(!sh_audio->inited && *fmlist){
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
230 char* audio_fm=*(fmlist++);
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
231 mp_msg(MSGT_DECAUDIO,MSGL_INFO,MSGTR_TryForceAudioFmtStr,audio_fm);
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
232 for(status=CODECS_STATUS__MAX;status>=CODECS_STATUS__MIN;--status)
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
233 if(init_audio(sh_audio,NULL,audio_fm,status)) break;
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
234 }
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
235 }
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
236 if(!sh_audio->inited)
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
237 for(status=CODECS_STATUS__MAX;status>=CODECS_STATUS__MIN;--status)
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
238 if(init_audio(sh_audio,NULL,NULL,status)) break;
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
239 }
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
240 }
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
241
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
242 if(!sh_audio->inited){
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
243 mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_CantFindAudioCodec,sh_audio->format);
10683
aefe3c85ee19 codecs.conf is obsolete.
diego
parents: 10272
diff changeset
244 mp_msg(MSGT_DECAUDIO,MSGL_HINT, MSGTR_RTFMCodecs);
7522
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
245 return 0; // failed
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
246 }
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
247
16793
8d4fb5469efb Make a few more messages translatable by moving them into help_mp-en.h.
diego
parents: 16321
diff changeset
248 mp_msg(MSGT_DECAUDIO,MSGL_INFO,MSGTR_SelectedAudioCodec,
7522
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
249 sh_audio->codec->name,sh_audio->codec->drv,sh_audio->codec->info);
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
250 return 1; // success
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
251 }
aa1a1249f239 -ac/-afm rewrite, now works the same way as -vc/-vfm
arpi
parents: 7502
diff changeset
252
5342
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
253 void uninit_audio(sh_audio_t *sh_audio)
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
254 {
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
255 if(sh_audio->afilter){
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
256 mp_msg(MSGT_DECAUDIO,MSGL_V,"Uninit audio filters...\n");
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
257 af_uninit(sh_audio->afilter);
10803
15425a07e13f minor leak fix
alex
parents: 10683
diff changeset
258 free(sh_audio->afilter);
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
259 sh_audio->afilter=NULL;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
260 }
7240
a1ae7d811e35 fixed uninit order
arpi
parents: 7191
diff changeset
261 if(sh_audio->inited){
a1ae7d811e35 fixed uninit order
arpi
parents: 7191
diff changeset
262 mp_msg(MSGT_DECAUDIO,MSGL_V,MSGTR_UninitAudioStr,sh_audio->codec->drv);
14819
601e2c8a2922 Remove file-global mpadec, add ad_driver member to sh_audio_t instead.
hzoli
parents: 14818
diff changeset
263 sh_audio->ad_driver->uninit(sh_audio);
8152
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
264 #ifdef DYNAMIC_PLUGINS
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
265 if (sh_audio->dec_handle)
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
266 dlclose(sh_audio->dec_handle);
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8123
diff changeset
267 #endif
7240
a1ae7d811e35 fixed uninit order
arpi
parents: 7191
diff changeset
268 sh_audio->inited=0;
a1ae7d811e35 fixed uninit order
arpi
parents: 7191
diff changeset
269 }
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
270 if(sh_audio->a_out_buffer!=sh_audio->a_buffer) free(sh_audio->a_out_buffer);
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
271 sh_audio->a_out_buffer=NULL;
15811
9b4bbb6098f6 make -srate work again, unify audio filter init and preinit.
reimar
parents: 15789
diff changeset
272 sh_audio->a_out_buffer_size=0;
5458
b3d1348b251f audio input buffer allocation/free cleanup
arpi
parents: 5342
diff changeset
273 if(sh_audio->a_buffer) free(sh_audio->a_buffer);
b3d1348b251f audio input buffer allocation/free cleanup
arpi
parents: 5342
diff changeset
274 sh_audio->a_buffer=NULL;
b3d1348b251f audio input buffer allocation/free cleanup
arpi
parents: 5342
diff changeset
275 if(sh_audio->a_in_buffer) free(sh_audio->a_in_buffer);
b3d1348b251f audio input buffer allocation/free cleanup
arpi
parents: 5342
diff changeset
276 sh_audio->a_in_buffer=NULL;
5342
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
277 }
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
278
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
279 /* Init audio filters */
8995
865cbed58cf8 2-pass libaf initialization to get better filter chain.
arpi
parents: 8969
diff changeset
280 int preinit_audio_filters(sh_audio_t *sh_audio,
14818
663c1ea5f595 finally remove the refences to bps outside libaf. also simplification of some messages and removed redundants
alex
parents: 14815
diff changeset
281 int in_samplerate, int in_channels, int in_format,
663c1ea5f595 finally remove the refences to bps outside libaf. also simplification of some messages and removed redundants
alex
parents: 14815
diff changeset
282 int* out_samplerate, int* out_channels, int* out_format){
16306
7f88103a9710 10l, missing return
faust3
parents: 15950
diff changeset
283 return init_audio_filters(sh_audio, in_samplerate, in_channels, in_format,
15811
9b4bbb6098f6 make -srate work again, unify audio filter init and preinit.
reimar
parents: 15789
diff changeset
284 out_samplerate, out_channels, out_format, 0, 0);
8995
865cbed58cf8 2-pass libaf initialization to get better filter chain.
arpi
parents: 8969
diff changeset
285 }
865cbed58cf8 2-pass libaf initialization to get better filter chain.
arpi
parents: 8969
diff changeset
286
865cbed58cf8 2-pass libaf initialization to get better filter chain.
arpi
parents: 8969
diff changeset
287 /* Init audio filters */
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
288 int init_audio_filters(sh_audio_t *sh_audio,
14818
663c1ea5f595 finally remove the refences to bps outside libaf. also simplification of some messages and removed redundants
alex
parents: 14815
diff changeset
289 int in_samplerate, int in_channels, int in_format,
15811
9b4bbb6098f6 make -srate work again, unify audio filter init and preinit.
reimar
parents: 15789
diff changeset
290 int *out_samplerate, int *out_channels, int *out_format,
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
291 int out_minsize, int out_maxsize){
8995
865cbed58cf8 2-pass libaf initialization to get better filter chain.
arpi
parents: 8969
diff changeset
292 af_stream_t* afs=sh_audio->afilter;
865cbed58cf8 2-pass libaf initialization to get better filter chain.
arpi
parents: 8969
diff changeset
293 if(!afs){
9018
henry
parents: 8995
diff changeset
294 afs = (af_stream_t*)malloc(sizeof(af_stream_t));
8995
865cbed58cf8 2-pass libaf initialization to get better filter chain.
arpi
parents: 8969
diff changeset
295 memset(afs,0,sizeof(af_stream_t));
865cbed58cf8 2-pass libaf initialization to get better filter chain.
arpi
parents: 8969
diff changeset
296 }
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
297
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
298 // input format: same as codec's output format:
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
299 afs->input.rate = in_samplerate;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
300 afs->input.nch = in_channels;
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13955
diff changeset
301 afs->input.format = in_format;
14818
663c1ea5f595 finally remove the refences to bps outside libaf. also simplification of some messages and removed redundants
alex
parents: 14815
diff changeset
302 af_fix_parameters(&(afs->input));
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
303
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
304 // output format: same as ao driver's input format (if missing, fallback to input)
15811
9b4bbb6098f6 make -srate work again, unify audio filter init and preinit.
reimar
parents: 15789
diff changeset
305 afs->output.rate = *out_samplerate;
9b4bbb6098f6 make -srate work again, unify audio filter init and preinit.
reimar
parents: 15789
diff changeset
306 afs->output.nch = *out_channels;
9b4bbb6098f6 make -srate work again, unify audio filter init and preinit.
reimar
parents: 15789
diff changeset
307 afs->output.format = *out_format;
14818
663c1ea5f595 finally remove the refences to bps outside libaf. also simplification of some messages and removed redundants
alex
parents: 14815
diff changeset
308 af_fix_parameters(&(afs->output));
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
309
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
310 // filter config:
7614
ce6a938aa6d3 Adding -format and -af switches
anders
parents: 7604
diff changeset
311 memcpy(&afs->cfg,&af_cfg,sizeof(af_cfg_t));
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
312
17427
ac53dc3093a7 Push "Building audio filter chain" up to verbose level.
diego
parents: 17012
diff changeset
313 mp_msg(MSGT_DECAUDIO, MSGL_V, MSGTR_BuildingAudioFilterChain,
14818
663c1ea5f595 finally remove the refences to bps outside libaf. also simplification of some messages and removed redundants
alex
parents: 14815
diff changeset
314 afs->input.rate,afs->input.nch,af_fmt2str_short(afs->input.format),
663c1ea5f595 finally remove the refences to bps outside libaf. also simplification of some messages and removed redundants
alex
parents: 14815
diff changeset
315 afs->output.rate,afs->output.nch,af_fmt2str_short(afs->output.format));
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
316
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
317 // let's autoprobe it!
15811
9b4bbb6098f6 make -srate work again, unify audio filter init and preinit.
reimar
parents: 15789
diff changeset
318 if(0 != af_init(afs)){
9132
c945b963d7c6 1000l bug (double free() when libaf init failed)
arpi
parents: 9018
diff changeset
319 sh_audio->afilter=NULL;
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
320 free(afs);
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
321 return 0; // failed :(
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
322 }
15811
9b4bbb6098f6 make -srate work again, unify audio filter init and preinit.
reimar
parents: 15789
diff changeset
323
9b4bbb6098f6 make -srate work again, unify audio filter init and preinit.
reimar
parents: 15789
diff changeset
324 *out_samplerate=afs->output.rate;
9b4bbb6098f6 make -srate work again, unify audio filter init and preinit.
reimar
parents: 15789
diff changeset
325 *out_channels=afs->output.nch;
9b4bbb6098f6 make -srate work again, unify audio filter init and preinit.
reimar
parents: 15789
diff changeset
326 *out_format=afs->output.format;
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
327
15811
9b4bbb6098f6 make -srate work again, unify audio filter init and preinit.
reimar
parents: 15789
diff changeset
328 if (out_maxsize || out_minsize) {
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
329 // allocate the a_out_* buffers:
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
330 if(out_maxsize<out_minsize) out_maxsize=out_minsize;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
331 if(out_maxsize<8192) out_maxsize=MAX_OUTBURST; // not sure this is ok
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
332
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
333 sh_audio->a_out_buffer_size=out_maxsize;
17625
c5f33a8021c7 Align memory at 16 byte boundaries.
diego
parents: 17566
diff changeset
334 sh_audio->a_out_buffer=memalign(16,sh_audio->a_out_buffer_size);
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
335 memset(sh_audio->a_out_buffer,0,sh_audio->a_out_buffer_size);
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
336 sh_audio->a_out_buffer_len=0;
15811
9b4bbb6098f6 make -srate work again, unify audio filter init and preinit.
reimar
parents: 15789
diff changeset
337 }
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
338
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
339 // ok!
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
340 sh_audio->afilter=(void*)afs;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
341 return 1;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
342 }
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
343
5342
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
344 int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen)
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
345 {
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
346 int declen;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
347 af_data_t afd; // filter input
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
348 af_data_t* pafd; // filter output
14819
601e2c8a2922 Remove file-global mpadec, add ad_driver member to sh_audio_t instead.
hzoli
parents: 14818
diff changeset
349 ad_functions_t* mpadec = sh_audio->ad_driver;
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
350
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
351 if(!sh_audio->inited) return -1; // no codec
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
352 if(!sh_audio->afilter){
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
353 // no filter, just decode:
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
354 // FIXME: don't drop initial decoded data in a_buffer!
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
355 return mpadec->decode_audio(sh_audio,buf,minlen,maxlen);
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
356 }
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
357
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
358 // declen=af_inputlen(sh_audio->afilter,minlen);
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
359 declen=af_calc_insize_constrained(sh_audio->afilter,minlen,maxlen,
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
360 sh_audio->a_buffer_size-sh_audio->audio_out_minsize);
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
361
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
362 mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"\ndecaudio: minlen=%d maxlen=%d declen=%d (max=%d)\n",
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
363 minlen, maxlen, declen, sh_audio->a_buffer_size);
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
364
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
365 if(declen<=0) return -1; // error!
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
366
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
367 // limit declen to buffer size: - DONE by af_calc_insize_constrained
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
368 // if(declen>sh_audio->a_buffer_size) declen=sh_audio->a_buffer_size;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
369
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
370 // decode if needed:
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
371 while(declen>sh_audio->a_buffer_len){
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
372 int len=declen-sh_audio->a_buffer_len;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
373 int maxlen=sh_audio->a_buffer_size-sh_audio->a_buffer_len;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
374
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
375 mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"decaudio: decoding %d bytes, max: %d (%d)\n",
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
376 len, maxlen, sh_audio->audio_out_minsize);
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
377
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
378 if(maxlen<sh_audio->audio_out_minsize) break; // don't overflow buffer!
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
379 // not enough decoded data waiting, decode 'len' bytes more:
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
380 len=mpadec->decode_audio(sh_audio,
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
381 sh_audio->a_buffer+sh_audio->a_buffer_len, len, maxlen);
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
382 if(len<=0) break; // EOF?
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
383 sh_audio->a_buffer_len+=len;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
384 }
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
385 if(declen>sh_audio->a_buffer_len)
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
386 declen=sh_audio->a_buffer_len; // still no enough data (EOF) :(
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
387
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
388 // round to whole samples:
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
389 // declen/=sh_audio->samplesize*sh_audio->channels;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
390 // declen*=sh_audio->samplesize*sh_audio->channels;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
391
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
392 // run the filters:
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
393 afd.audio=sh_audio->a_buffer;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
394 afd.len=declen;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
395 afd.rate=sh_audio->samplerate;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
396 afd.nch=sh_audio->channels;
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13955
diff changeset
397 afd.format=sh_audio->sample_format;
14818
663c1ea5f595 finally remove the refences to bps outside libaf. also simplification of some messages and removed redundants
alex
parents: 14815
diff changeset
398 af_fix_parameters(&afd);
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
399 //pafd=&afd;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
400 // printf("\nAF: %d --> ",declen);
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
401 pafd=af_play(sh_audio->afilter,&afd);
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
402 // printf("%d \n",pafd->len);
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
403
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
404 if(!pafd) return -1; // error
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
405
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
406 mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"decaudio: declen=%d out=%d (max %d)\n",
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
407 declen, pafd->len, maxlen);
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
408
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
409 // copy filter==>out:
11857
6107e58dcc28 not pretty, but at least it prevents the channels from getting out of order...
rfelker
parents: 11855
diff changeset
410 if(maxlen < pafd->len) {
6107e58dcc28 not pretty, but at least it prevents the channels from getting out of order...
rfelker
parents: 11855
diff changeset
411 maxlen -= maxlen % (sh_audio->channels * sh_audio->samplesize);
11855
rfelker
parents: 10803
diff changeset
412 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"%i bytes of audio data lost due to buffer overflow, len = %i\n", pafd->len - maxlen,pafd->len);
11857
6107e58dcc28 not pretty, but at least it prevents the channels from getting out of order...
rfelker
parents: 11855
diff changeset
413 }
5342
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
414 else
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
415 maxlen=pafd->len;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
416 memmove(buf, pafd->audio, maxlen);
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
417
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
418 // remove processed data from decoder buffer:
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
419 sh_audio->a_buffer_len-=declen;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
420 if(sh_audio->a_buffer_len>0)
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
421 memmove(sh_audio->a_buffer, sh_audio->a_buffer+declen, sh_audio->a_buffer_len);
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
422
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7561
diff changeset
423 return maxlen;
5342
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
424 }
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
425
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
426 void resync_audio_stream(sh_audio_t *sh_audio)
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
427 {
6049
4bae3caef7a9 always reser audio input buffer pointer
arpi
parents: 5933
diff changeset
428 sh_audio->a_in_buffer_len=0; // clear audio input buffer
5342
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
429 if(!sh_audio->inited) return;
14819
601e2c8a2922 Remove file-global mpadec, add ad_driver member to sh_audio_t instead.
hzoli
parents: 14818
diff changeset
430 sh_audio->ad_driver->control(sh_audio,ADCTRL_RESYNC_STREAM,NULL);
5342
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
431 }
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
432
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
433 void skip_audio_frame(sh_audio_t *sh_audio)
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
434 {
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
435 if(!sh_audio->inited) return;
14819
601e2c8a2922 Remove file-global mpadec, add ad_driver member to sh_audio_t instead.
hzoli
parents: 14818
diff changeset
436 if(sh_audio->ad_driver->control(sh_audio,ADCTRL_SKIP_FRAME,NULL)==CONTROL_TRUE) return;
5342
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
437 // default skip code:
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
438 ds_fill_buffer(sh_audio->ds); // skip block
c4cf81b3af71 imporetd from MPlayerXP, with small modification
arpi
parents:
diff changeset
439 }
14818
663c1ea5f595 finally remove the refences to bps outside libaf. also simplification of some messages and removed redundants
alex
parents: 14815
diff changeset
440
17566
f580a7755ac5 Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents: 17427
diff changeset
441 void adjust_volume(void)
14818
663c1ea5f595 finally remove the refences to bps outside libaf. also simplification of some messages and removed redundants
alex
parents: 14815
diff changeset
442 {
663c1ea5f595 finally remove the refences to bps outside libaf. also simplification of some messages and removed redundants
alex
parents: 14815
diff changeset
443 }