You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec: deprecate AVCodecContext properties
These properties are unreliable because they depend on the frames decoded so far, users should check directly the presence of the decoded AVFrame side data or AVFrame flags. Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07
|
||||
|
||||
API changes, most recent first:
|
||||
|
||||
2025-01-05 - xxxxxxxxxx - lavc 61.31.100 - avcodec.h
|
||||
Deprecate AVCodecContext->properties.
|
||||
|
||||
2025-01-05 - xxxxxxxxxx - lavc 61.30.100 - frame.h
|
||||
Add AV_FRAME_FLAG_LOSSLESS.
|
||||
|
||||
|
@ -788,10 +788,14 @@ static int set_context_with_sequence(AVCodecContext *avctx,
|
||||
break;
|
||||
}
|
||||
|
||||
#if FF_API_CODEC_PROPS
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
if (seq->film_grain_params_present)
|
||||
avctx->properties |= FF_CODEC_PROPERTY_FILM_GRAIN;
|
||||
else
|
||||
avctx->properties &= ~FF_CODEC_PROPERTY_FILM_GRAIN;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
if (avctx->width != width || avctx->height != height) {
|
||||
int ret = ff_set_dimensions(avctx, width, height);
|
||||
@ -983,7 +987,11 @@ static int export_itut_t35(AVCodecContext *avctx, AVFrame *frame,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
#if FF_API_CODEC_PROPS
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
default: // ignore unsupported identifiers
|
||||
|
@ -647,12 +647,16 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
|
||||
if (encode) {
|
||||
av_bprintf(&bprint, ", q=%d-%d", enc->qmin, enc->qmax);
|
||||
} else {
|
||||
#if FF_API_CODEC_PROPS
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
if (enc->properties & FF_CODEC_PROPERTY_CLOSED_CAPTIONS)
|
||||
av_bprintf(&bprint, ", Closed Captions");
|
||||
if (enc->properties & FF_CODEC_PROPERTY_FILM_GRAIN)
|
||||
av_bprintf(&bprint, ", Film Grain");
|
||||
if (enc->properties & FF_CODEC_PROPERTY_LOSSLESS)
|
||||
av_bprintf(&bprint, ", lossless");
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
|
@ -1806,15 +1806,18 @@ typedef struct AVCodecContext {
|
||||
#define FF_LEVEL_UNKNOWN -99
|
||||
#endif
|
||||
|
||||
#if FF_API_CODEC_PROPS
|
||||
/**
|
||||
* Properties of the stream that gets decoded
|
||||
* - encoding: unused
|
||||
* - decoding: set by libavcodec
|
||||
*/
|
||||
attribute_deprecated
|
||||
unsigned properties;
|
||||
#define FF_CODEC_PROPERTY_LOSSLESS 0x00000001
|
||||
#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002
|
||||
#define FF_CODEC_PROPERTY_FILM_GRAIN 0x00000004
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Skip loop filtering for selected frames.
|
||||
|
@ -807,7 +807,11 @@ int ff_h2645_sei_to_frame(AVFrame *frame, H2645SEI *sei,
|
||||
if (!sd)
|
||||
av_buffer_unref(&a53->buf_ref);
|
||||
a53->buf_ref = NULL;
|
||||
#if FF_API_CODEC_PROPS
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
}
|
||||
|
||||
ret = h2645_sei_to_side_data(avctx, sei, &frame->side_data, &frame->nb_side_data);
|
||||
@ -900,7 +904,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
else
|
||||
fgc->present = fgc->persistence_flag;
|
||||
|
||||
#if FF_API_CODEC_PROPS
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
avctx->properties |= FF_CODEC_PROPERTY_FILM_GRAIN;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CONFIG_HEVC_SEI
|
||||
|
@ -403,8 +403,12 @@ static int export_stream_params_from_sei(HEVCContext *s)
|
||||
{
|
||||
AVCodecContext *avctx = s->avctx;
|
||||
|
||||
#if FF_API_CODEC_PROPS
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
if (s->sei.common.a53_caption.buf_ref)
|
||||
s->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
if (s->sei.common.alternative_transfer.present &&
|
||||
av_color_transfer_name(s->sei.common.alternative_transfer.preferred_transfer_characteristics) &&
|
||||
@ -412,9 +416,13 @@ static int export_stream_params_from_sei(HEVCContext *s)
|
||||
avctx->color_trc = s->sei.common.alternative_transfer.preferred_transfer_characteristics;
|
||||
}
|
||||
|
||||
#if FF_API_CODEC_PROPS
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
if ((s->sei.common.film_grain_characteristics && s->sei.common.film_grain_characteristics->present) ||
|
||||
s->sei.common.aom_film_grain.enable)
|
||||
avctx->properties |= FF_CODEC_PROPERTY_FILM_GRAIN;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -542,9 +542,13 @@ static int get_cox(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c)
|
||||
/* set integer 9/7 DWT in case of BITEXACT flag */
|
||||
if ((s->avctx->flags & AV_CODEC_FLAG_BITEXACT) && (c->transform == FF_DWT97))
|
||||
c->transform = FF_DWT97_INT;
|
||||
#if FF_API_CODEC_PROPS
|
||||
else if (c->transform == FF_DWT53) {
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
s->avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
}
|
||||
#endif
|
||||
|
||||
if (c->csty & JPEG2000_CSTY_PREC) {
|
||||
int i;
|
||||
|
@ -162,10 +162,14 @@ static void libdav1d_init_params(AVCodecContext *c, const Dav1dSequenceHeader *s
|
||||
(unsigned)seq->num_units_in_tick,
|
||||
(unsigned)seq->time_scale);
|
||||
|
||||
#if FF_API_CODEC_PROPS
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
if (seq->film_grain_present)
|
||||
c->properties |= FF_CODEC_PROPERTY_FILM_GRAIN;
|
||||
else
|
||||
c->properties &= ~FF_CODEC_PROPERTY_FILM_GRAIN;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
}
|
||||
|
||||
static av_cold int libdav1d_parse_extradata(AVCodecContext *c)
|
||||
@ -533,7 +537,11 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
|
||||
if (res < 0)
|
||||
goto fail;
|
||||
|
||||
#if FF_API_CODEC_PROPS
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
c->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
default: // ignore unsupported identifiers
|
||||
|
@ -2508,7 +2508,11 @@ redo_for_pal8:
|
||||
break;
|
||||
case SOF3:
|
||||
avctx->profile = AV_PROFILE_MJPEG_HUFFMAN_LOSSLESS;
|
||||
#if FF_API_CODEC_PROPS
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
s->lossless = 1;
|
||||
s->ls = 0;
|
||||
s->progressive = 0;
|
||||
@ -2517,7 +2521,11 @@ redo_for_pal8:
|
||||
break;
|
||||
case SOF48:
|
||||
avctx->profile = AV_PROFILE_MJPEG_JPEG_LS;
|
||||
#if FF_API_CODEC_PROPS
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
s->lossless = 1;
|
||||
s->ls = 1;
|
||||
s->progressive = 0;
|
||||
|
@ -1919,7 +1919,11 @@ static void mpeg_set_cc_format(AVCodecContext *avctx, enum Mpeg2ClosedCaptionsFo
|
||||
av_log(avctx, AV_LOG_DEBUG, "CC: first seen substream is %s format\n", label);
|
||||
}
|
||||
|
||||
#if FF_API_CODEC_PROPS
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
}
|
||||
|
||||
static int mpeg_decode_a53_cc(AVCodecContext *avctx,
|
||||
|
@ -365,7 +365,11 @@ static int update_context_from_thread(AVCodecContext *dst, const AVCodecContext
|
||||
|
||||
dst->has_b_frames = src->has_b_frames;
|
||||
dst->idct_algo = src->idct_algo;
|
||||
#if FF_API_CODEC_PROPS
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
dst->properties = src->properties;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
dst->bits_per_coded_sample = src->bits_per_coded_sample;
|
||||
dst->sample_aspect_ratio = src->sample_aspect_ratio;
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#include "version_major.h"
|
||||
|
||||
#define LIBAVCODEC_VERSION_MINOR 30
|
||||
#define LIBAVCODEC_VERSION_MINOR 31
|
||||
#define LIBAVCODEC_VERSION_MICRO 100
|
||||
|
||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
||||
|
@ -49,6 +49,7 @@
|
||||
#define FF_API_VDPAU_ALLOC_GET_SET (LIBAVCODEC_VERSION_MAJOR < 62)
|
||||
#define FF_API_QUALITY_FACTOR (LIBAVCODEC_VERSION_MAJOR < 62)
|
||||
#define FF_API_V408_CODECID (LIBAVCODEC_VERSION_MAJOR < 62)
|
||||
#define FF_API_CODEC_PROPS (LIBAVCODEC_VERSION_MAJOR < 63)
|
||||
|
||||
// reminder to remove the OMX encoder on next major bump
|
||||
#define FF_CODEC_OMX (LIBAVCODEC_VERSION_MAJOR < 62)
|
||||
|
@ -682,8 +682,12 @@ static int decode_frame_header(AVCodecContext *avctx,
|
||||
s->s.h.uvac_qdelta = get_bits1(&s->gb) ? get_sbits_inv(&s->gb, 4) : 0;
|
||||
s->s.h.lossless = s->s.h.yac_qi == 0 && s->s.h.ydc_qdelta == 0 &&
|
||||
s->s.h.uvdc_qdelta == 0 && s->s.h.uvac_qdelta == 0;
|
||||
#if FF_API_CODEC_PROPS
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
if (s->s.h.lossless)
|
||||
avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
/* segmentation header info */
|
||||
if ((s->s.h.segmentation.enabled = get_bits1(&s->gb))) {
|
||||
|
@ -1407,7 +1407,11 @@ static int webp_decode_frame(AVCodecContext *avctx, AVFrame *p,
|
||||
chunk_size, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
#if FF_API_CODEC_PROPS
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
}
|
||||
bytestream2_skip(&gb, chunk_size);
|
||||
break;
|
||||
|
@ -620,7 +620,11 @@ static void dump_stream_format(const AVFormatContext *ic, int i,
|
||||
|
||||
// Fields which are missing from AVCodecParameters need to be taken from the AVCodecContext
|
||||
if (sti->avctx) {
|
||||
#if FF_API_CODEC_PROPS
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
avctx->properties = sti->avctx->properties;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
avctx->codec = sti->avctx->codec;
|
||||
avctx->qmin = sti->avctx->qmin;
|
||||
avctx->qmax = sti->avctx->qmax;
|
||||
|
Reference in New Issue
Block a user