diff options
author | Anton Khirnov <anton@khirnov.net> | 2023-05-05 15:17:37 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2023-05-15 10:31:55 +0200 |
commit | 70433abf7fbc978b5fa0d06951d61ac18ac335f8 (patch) | |
tree | 7f8bdb5eda69dded2bf470575a70bcfb8b06496c | |
parent | 78e84c054a2a04edeea25e9ee54d0fb172cd7053 (diff) | |
download | ffmpeg-70433abf7fbc978b5fa0d06951d61ac18ac335f8.tar.gz |
lavc/codec_desc: add a property for codecs that support field coding
Multiple places currently use AVCodecContext.ticks_per_frame > 1 to
identify such codecs, which
* requires a codec context
* requires it to be open
-rw-r--r-- | doc/APIchanges | 3 | ||||
-rw-r--r-- | libavcodec/codec_desc.c | 16 | ||||
-rw-r--r-- | libavcodec/codec_desc.h | 6 | ||||
-rw-r--r-- | libavcodec/version.h | 2 |
4 files changed, 22 insertions, 5 deletions
diff --git a/doc/APIchanges b/doc/APIchanges index a37fe1bb8e..b048646283 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09 API changes, most recent first: +2023-05-xx - xxxxxxxxxx - lavc 60.12.100 - codec_desc.h + Add AV_CODEC_PROP_FIELDS. + 2023-05-xx - xxxxxxxxxx - lavc 60 - codec.h Depreate AV_CODEC_CAP_SUBFRAMES without replacement. diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index d40977d6b3..49dddd1a49 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -38,14 +38,20 @@ static const AVCodecDescriptor codec_descriptors[] = { .type = AVMEDIA_TYPE_VIDEO, .name = "mpeg1video", .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"), - .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_REORDER, + .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_REORDER | + // FIXME this is strigly speaking not true, as MPEG-1 does + // not allow field coding, but our mpeg12 code (decoder and + // parser) can sometimes change codec id at runtime, so + // this is safer + AV_CODEC_PROP_FIELDS, }, { .id = AV_CODEC_ID_MPEG2VIDEO, .type = AVMEDIA_TYPE_VIDEO, .name = "mpeg2video", .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 video"), - .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_REORDER, + .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_REORDER | + AV_CODEC_PROP_FIELDS, .profiles = NULL_IF_CONFIG_SMALL(ff_mpeg2_video_profiles), }, { @@ -225,7 +231,8 @@ static const AVCodecDescriptor codec_descriptors[] = { .type = AVMEDIA_TYPE_VIDEO, .name = "h264", .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"), - .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS | AV_CODEC_PROP_REORDER, + .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS | + AV_CODEC_PROP_REORDER | AV_CODEC_PROP_FIELDS, .profiles = NULL_IF_CONFIG_SMALL(ff_h264_profiles), }, { @@ -529,7 +536,8 @@ static const AVCodecDescriptor codec_descriptors[] = { .type = AVMEDIA_TYPE_VIDEO, .name = "vc1", .long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1"), - .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_REORDER, + .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_REORDER | + AV_CODEC_PROP_FIELDS, .profiles = NULL_IF_CONFIG_SMALL(ff_vc1_profiles), }, { diff --git a/libavcodec/codec_desc.h b/libavcodec/codec_desc.h index 126b52df47..dd4491112b 100644 --- a/libavcodec/codec_desc.h +++ b/libavcodec/codec_desc.h @@ -90,6 +90,12 @@ typedef struct AVCodecDescriptor { * equal. */ #define AV_CODEC_PROP_REORDER (1 << 3) + +/** + * Video codec supports separate coding of fields in interlaced frames. + */ +#define AV_CODEC_PROP_FIELDS (1 << 4) + /** * Subtitle codec is bitmap based * Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field. diff --git a/libavcodec/version.h b/libavcodec/version.h index 8b53586be1..da2264a097 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #include "version_major.h" -#define LIBAVCODEC_VERSION_MINOR 11 +#define LIBAVCODEC_VERSION_MINOR 12 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |