[FFmpeg-devel] [PATCH v7 1/3] lavc/codec_desc: introduce AV_CODEC_PROP_INTRA_ONLY flag to audio codec
James Almer
jamrial at gmail.com
Thu Dec 12 14:30:55 EET 2019
On 12/12/2019 9:10 AM, Andreas Rheinhardt wrote:
> 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.
Correct. But before we can make it effective the truehd parser needs to
mark keyframes as required. I'll send a patch for that in a minute.
>
>>
>> /* 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.
The intra only flag is for video and audio only, as stated in the doxy.
>
> 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 !!.
Since he needs to prevent it from triggering for subtitles, the check
should be if ((d->type == AVMEDIA_TYPE_VIDEO || d->type ==
AVMEDIA_TYPE_AUDIO) && !(d->props & AV_CODEC_PROP_INTRA_ONLY)) or similar.
More information about the ffmpeg-devel
mailing list