[FFmpeg-devel] [PATCH 9/9] ffplay: add -af option
Marton Balint
cus at passwd.hu
Tue Jun 26 01:03:52 CEST 2012
On Mon, 25 Jun 2012, Stefano Sabatini wrote:
[...]
>>> + layouts[0] = avctx->channel_layout;
>>> +
>>> + snprintf(abuffer_args, sizeof(abuffer_args), "sample_rate=%d:sample_fmt=%s:channel_layout=0x%"PRIx64,
>>> + avctx->sample_rate,
>>> + av_get_sample_fmt_name(avctx->sample_fmt),
>>> + avctx->channel_layout);
>>> + ret = avfilter_graph_create_filter(&filt_asrc,
>>> + avfilter_get_by_name("abuffer"), "ffplay_abuffer",
>>> + abuffer_args, NULL, is->agraph);
>>> + if (ret < 0) goto fail;
>>> +
>>> + abuffersink_params->sample_fmts = sample_fmts;
>>> + abuffersink_params->channel_layouts = layouts;
>>
>
>> Before calling audio_open using these are fine for determining the
>> normal output of the audio filters. But once the audio_open is
>> called, you should enforce the settings set in
>> VideoState->audio_tgt.
>
> So what about calling audio_open() and *then* configuring the
> filtergraph? This should be simpler than:
>
> configure_filters()
> audio_open()
> configure_filters() again
>
Only problem is that for audio open you have to request something as
channel count and sample rate. It is better to request the number of
channels and the sample rate the filter would normally output, but you can
only determine that by configuring the filters once.
That is why I proposed to configure the filters before audio open to
determine the preferred output channel count and sample rate of the
filter, request that for audio_open and if audio_open can't handle that
then reconfigure the filters with the real output settings audio_open has
fallen back to.
[...]
Regards,
Marton
More information about the ffmpeg-devel
mailing list