mirror of https://github.com/mpv-player/mpv
Use lavcresample only when libavcodec is compiled in.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14327 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
2543b1bf86
commit
8f3e5a996c
29
libaf/af.c
29
libaf/af.c
|
@ -380,21 +380,27 @@ int af_init(af_stream_t* s, int force_output)
|
||||||
af_instance_t* af = NULL; // New filter
|
af_instance_t* af = NULL; // New filter
|
||||||
// Check output frequency if not OK fix with resample
|
// Check output frequency if not OK fix with resample
|
||||||
if(s->last->data->rate!=s->output.rate){
|
if(s->last->data->rate!=s->output.rate){
|
||||||
if(NULL==(af=af_get(s,"lavcresample")) &&
|
// try to find a filter that can change samplrate
|
||||||
NULL==(af=af_get(s,"resample"))){
|
af = af_control_any_rev(s, AF_CONTROL_RESAMPLE_RATE | AF_CONTROL_SET,
|
||||||
|
&(s->output.rate));
|
||||||
|
if (!af) {
|
||||||
|
char *resampler = "resample";
|
||||||
|
#ifdef USE_LIBAVCODEC
|
||||||
|
if ((AF_INIT_TYPE_MASK & s->cfg.force) == AF_INIT_SLOW)
|
||||||
|
resampler = "lavcresample";
|
||||||
|
#endif
|
||||||
if((AF_INIT_TYPE_MASK & s->cfg.force) == AF_INIT_SLOW){
|
if((AF_INIT_TYPE_MASK & s->cfg.force) == AF_INIT_SLOW){
|
||||||
if(!strcmp(s->first->info->name,"format"))
|
if(!strcmp(s->first->info->name,"format"))
|
||||||
af = af_append(s,s->first,"lavcresample");
|
af = af_append(s,s->first,resampler);
|
||||||
else
|
else
|
||||||
af = af_prepend(s,s->first,"lavcresample");
|
af = af_prepend(s,s->first,resampler);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(!strcmp(s->last->info->name,"format"))
|
if(!strcmp(s->last->info->name,"format"))
|
||||||
af = af_prepend(s,s->last,"resample");
|
af = af_prepend(s,s->last,resampler);
|
||||||
else
|
else
|
||||||
af = af_append(s,s->last,"resample");
|
af = af_append(s,s->last,resampler);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// Init the new filter
|
// Init the new filter
|
||||||
if(!af || (AF_OK != af->control(af,AF_CONTROL_RESAMPLE_RATE,
|
if(!af || (AF_OK != af->control(af,AF_CONTROL_RESAMPLE_RATE,
|
||||||
&(s->output.rate))))
|
&(s->output.rate))))
|
||||||
|
@ -402,9 +408,16 @@ int af_init(af_stream_t* s, int force_output)
|
||||||
// Use lin int if the user wants fast
|
// Use lin int if the user wants fast
|
||||||
if ((AF_INIT_TYPE_MASK & s->cfg.force) == AF_INIT_FAST) {
|
if ((AF_INIT_TYPE_MASK & s->cfg.force) == AF_INIT_FAST) {
|
||||||
char args[32];
|
char args[32];
|
||||||
sprintf(args, "%d:0:0", s->output.rate);
|
sprintf(args, "%d", s->output.rate);
|
||||||
|
#ifdef USE_LIBAVCODEC
|
||||||
|
if (strcmp(resampler, "lavcresample") == 0)
|
||||||
|
strcat(args, ":1");
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
strcat(args, ":0:0");
|
||||||
af->control(af, AF_CONTROL_COMMAND_LINE, args);
|
af->control(af, AF_CONTROL_COMMAND_LINE, args);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(AF_OK != af_reinit(s,af))
|
if(AF_OK != af_reinit(s,af))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue