[FFmpeg-devel] [PATCH] avformat/mxfdec: do not use sound essence descriptor quantization bits for bits_per_coded_sample

Marton Balint cus at passwd.hu
Sat Sep 1 23:13:24 EEST 2018


On Sun, 26 Aug 2018, Marton Balint wrote:

> It refers to the uncompressed quantization, therefore is not correct for AAC.
>
> Also change mxf_set_pts to work based on current edit unit if
> bits_per_coded_sample is not available.
>
> Fixes error messages in the sample of ticket #7366.

Ping, will push soon.

Regards,
Marton

>
> Signed-off-by: Marton Balint <cus at passwd.hu>
> ---
> libavformat/mxfdec.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> index 8e1089620f..134f27784b 100644
> --- a/libavformat/mxfdec.c
> +++ b/libavformat/mxfdec.c
> @@ -2390,7 +2390,6 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
>             if (st->codecpar->codec_id == AV_CODEC_ID_NONE || (st->codecpar->codec_id == AV_CODEC_ID_PCM_ALAW && (enum AVCodecID)container_ul->id != AV_CODEC_ID_NONE))
>                 st->codecpar->codec_id = (enum AVCodecID)container_ul->id;
>             st->codecpar->channels = descriptor->channels;
> -            st->codecpar->bits_per_coded_sample = descriptor->bits_per_sample;
>
>             if (descriptor->sample_rate.den > 0) {
>                 st->codecpar->sample_rate = descriptor->sample_rate.num / descriptor->sample_rate.den;
> @@ -2423,6 +2422,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
>             } else if (st->codecpar->codec_id == AV_CODEC_ID_MP2) {
>                 st->need_parsing = AVSTREAM_PARSE_FULL;
>             }
> +            st->codecpar->bits_per_coded_sample = av_get_bits_per_sample(st->codecpar->codec_id);
>         } else if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA) {
>             enum AVMediaType type;
>             container_ul = mxf_get_codec_ul(mxf_data_essence_container_uls, essence_container_ul);
> @@ -3269,7 +3269,8 @@ static int64_t mxf_set_current_edit_unit(MXFContext *mxf, AVStream *st, int64_t
> static int mxf_set_audio_pts(MXFContext *mxf, AVCodecParameters *par,
>                              AVPacket *pkt)
> {
> -    MXFTrack *track = mxf->fc->streams[pkt->stream_index]->priv_data;
> +    AVStream *st = mxf->fc->streams[pkt->stream_index];
> +    MXFTrack *track = st->priv_data;
>     int64_t bits_per_sample = par->bits_per_coded_sample;
>
>     if (!bits_per_sample)
> @@ -3280,8 +3281,10 @@ static int mxf_set_audio_pts(MXFContext *mxf, AVCodecParameters *par,
>     if (   par->channels <= 0
>         || bits_per_sample <= 0
>         || par->channels * (int64_t)bits_per_sample < 8)
> -        return AVERROR(EINVAL);
> -    track->sample_count += pkt->size / (par->channels * (int64_t)bits_per_sample / 8);
> +        track->sample_count = mxf_compute_sample_count(mxf, st, av_rescale_q(track->sample_count, st->time_base, av_inv_q(track->edit_rate)) + 1);
> +    else
> +        track->sample_count += pkt->size / (par->channels * (int64_t)bits_per_sample / 8);
> +
>     return 0;
> }
> 
> -- 
> 2.16.4
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list