[FFmpeg-devel] [PATCH 7/8] avcodec/pcm_rechunk_bsf: add bitstream filter to rechunk pcm audio

Marton Balint cus at passwd.hu
Sun Apr 19 01:26:16 EEST 2020



On Sat, 18 Apr 2020, Andreas Rheinhardt wrote:

> Marton Balint:
>> 
>> 
>> On Tue, 7 Apr 2020, Andreas Rheinhardt wrote:
>> 
>>> Marton Balint:
>>>> Signed-off-by: Marton Balint <cus at passwd.hu>
>>>> ---
>>>>  Changelog                      |   1 +
>>>>  doc/bitstream_filters.texi     |  30 ++++++
>>>>  libavcodec/Makefile            |   1 +
>>>>  libavcodec/bitstream_filters.c |   1 +
>>>>  libavcodec/pcm_rechunk_bsf.c   | 206
>>>> +++++++++++++++++++++++++++++++++++++++++
>>>>  libavcodec/version.h           |   4 +-
>>>>  6 files changed, 241 insertions(+), 2 deletions(-)
>>>>  create mode 100644 libavcodec/pcm_rechunk_bsf.c
>>>>
>>>> diff --git a/Changelog b/Changelog
>>>> index 05b9a84562..dddaf02199 100644
>>>> --- a/Changelog
>>>> +++ b/Changelog
>>>> @@ -55,6 +55,7 @@ version <next>:
>>>>  - CRI HCA decoder
>>>>  - CRI HCA demuxer
>>>>  - overlay_cuda filter
>>>> +- pcm_rechunk bitstream filter
>>>>
>> 
>> [..]
>> 
>>>> +static int init(AVBSFContext *ctx)
>>>> +{
>>>> +    PCMContext *s = ctx->priv_data;
>>>> +    AVRational sr = av_make_q(ctx->par_in->sample_rate, 1);
>>>> +    int64_t max_samples;
>>>> +
>>>> +    ctx->time_base_out = av_inv_q(sr);
>>>
>>> Is it actually guaranteed that par_in->sample_rate is not 0?
>> 
>> Yes, it is checked in mux.c:init_muxer.
>> 
> This bsf (like all bsfs) can also be used standalone, i.e. not as
> automatically inserted bsf for muxing. Is it still checked in this scenario?

Fair enough. I will add a check just in case, although I am not sure this 
is something we support...

Regards,
Marton


More information about the ffmpeg-devel mailing list