[FFmpeg-devel] [PATCH v2 4/5] avformat/wavdec: s337m support

Tomas Härdin tjoppen at acc.umu.se
Tue Aug 6 15:16:41 EEST 2019


tis 2019-08-06 klockan 13:50 +0200 skrev Nicolas Gaullier:
> Enabled by AVOption dolbyeprobe
> Requires stereo

>  static void set_spdif(AVFormatContext *s, WAVDemuxContext *wav)
> @@ -593,6 +599,10 @@ break_loop:
>      } else if (st->codecpar->codec_id == AV_CODEC_ID_ADPCM_MS && st->codecpar->channels > 2) {
>          st->codecpar->block_align *= st->codecpar->channels;
>      }
> +#if CONFIG_S337M_DEMUXER
> +    if (wav->dolby_e_probe)
> +        avpriv_s337m_probe_stream((void *)s, s->pb, &st, FFMIN(S337M_MAX_RECOMMENDED_PROBE_SIZE, wav->data_end - avio_tell(pb)));
> +#endif
>  
>      ff_metadata_conv_ctx(s, NULL, wav_metadata_conv);
>      ff_metadata_conv_ctx(s, NULL, ff_riff_info_conv);
> @@ -701,14 +711,24 @@ smv_out:
>          wav->data_end = avio_tell(s->pb) + left;
>      }
>  
> -    size = MAX_SIZE;
> -    if (st->codecpar->block_align > 1) {
> -        if (size < st->codecpar->block_align)
> -            size = st->codecpar->block_align;
> -        size = (size / st->codecpar->block_align) * st->codecpar->block_align;
> +#if CONFIG_S337M_DEMUXER
> +    if (st->codecpar->codec_id != AV_CODEC_ID_DOLBY_E) {
> +#endif

Perhaps prettier:

    if (!CONFIG_S337M_DEMUXER || st->codecpar->codec_id !=
AV_CODEC_ID_DOLBY_E)

But then some of the other #ifs should probably change. Hum..


> +        size = MAX_SIZE;
> +        if (st->codecpar->block_align > 1) {
> +            if (size < st->codecpar->block_align)
> +                size = st->codecpar->block_align;
> +            size = (size / st->codecpar->block_align) * st->codecpar->block_align;
> +        }

Don't mix functional and indentation changes. Reindent in a separate
patch

> +        size = FFMIN(size, left);
> +        ret  = av_get_packet(s->pb, pkt, size);
> +#if CONFIG_S337M_DEMUXER
> +    } else {

If going with the above #if -> if change:

    else if (CONFIG_S337M_DEMUXER)

> +        size = FFMIN(S337M_MAX_RECOMMENDED_PROBE_SIZE, left);
> +        ret  = avpriv_s337m_get_packet((void *)s, s->pb, pkt, size, 0);
>      }
> -    size = FFMIN(size, left);
> -    ret  = av_get_packet(s->pb, pkt, size);
> +#endif
> +
>      if (ret < 0)
>          return ret;
>      pkt->stream_index = 0;
> @@ -754,6 +774,9 @@ static int wav_read_seek(AVFormatContext *s,
>  #define DEC AV_OPT_FLAG_DECODING_PARAM
>  static const AVOption demux_options[] = {
>      { "ignore_length", "Ignore length", OFFSET(ignore_length), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, DEC },
> +#if CONFIG_S337M_DEMUXER
> +    {"dolbyeprobe", "probe Dolby E in pcm/stereo streams", OFFSET(dolby_e_probe), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, DEC },

s/probe/Probe/

/Tomas



More information about the ffmpeg-devel mailing list