[FFmpeg-devel] [PATCH v7 1/3] lavc/codec_desc: introduce AV_CODEC_PROP_INTRA_ONLY flag to audio codec

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Thu Dec 12 14:10:21 EET 2019


On Thu, Dec 12, 2019 at 12:47 PM Yuki Tsuchiya <Yuki.Tsuchiya at sony.com>
wrote:

> Introduce AV_CODEC_PROP_INTRA_ONLY flag to audio codec as well as video
> codec to support non intra-only audio codec.
> Since all audio codecs are processed as intra-only codec so far, the
> intra-only flag is added to the all audio codec descriptors.
> This commit should not change behavior.
>
> Signed-off-by: Yuki Tsuchiya <Yuki.Tsuchiya at sony.com>
> ---
>  libavcodec/codec_desc.c | 345 ++++++++++++++++++++--------------------
>  libavformat/utils.c     |   2 +-
>  2 files changed, 175 insertions(+), 172 deletions(-)
>
> diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
> index 570bd2f382..98b6348c59 100644
> --- a/libavcodec/codec_desc.c
> +++ b/libavcodec/codec_desc.c
>      {
>          .id        = AV_CODEC_ID_TRUEHD,
>          .type      = AVMEDIA_TYPE_AUDIO,
>          .name      = "truehd",
>          .long_name = NULL_IF_CONFIG_SMALL("TrueHD"),
> -        .props     = AV_CODEC_PROP_LOSSLESS,
> +        .props     = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
>      },
>

Not all audio codecs are intra-only. TrueHD is a notable exception: It uses
sync frames and only they should be keyframes.

>
>      /* subtitle codecs */
>

Although you aim to not change behaviour, it does change behaviour for
subtitles and also for the other pseudo-codecs (like dvd-nav packets,
wrapped AVFrames etc.). If I am not mistaken, then at least HDMV PGS
subtitles (used on Blurays) are not intra-only.

diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 4d18880acb..5f490b9fd6 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -1021,7 +1021,7 @@ static int is_intra_only(enum AVCodecID id)
>      const AVCodecDescriptor *d = avcodec_descriptor_get(id);
>      if (!d)
>          return 0;
> -    if (d->type == AVMEDIA_TYPE_VIDEO && !(d->props &
> AV_CODEC_PROP_INTRA_ONLY))
> +    if (!(d->props & AV_CODEC_PROP_INTRA_ONLY))
>          return 0;
>      return 1;
>

You could simplify this to return !!(d->props & AV_CODEC_PROP_INTRA_ONLY);
you could even omit the !!.

- Andreas


More information about the ffmpeg-devel mailing list