And mention how the field is not being removed but changed, with instructions for library users to migrate their code.
Signed-off-by: James Almer <jamr...@gmail.com> --- libavformat/avformat.h | 8 ++++++++ libavformat/utils.c | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 822aa4c631..9fa8049149 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -953,8 +953,16 @@ typedef struct AVStream { * * decoding: set by libavformat, must not be modified by the caller. * encoding: unused + * + * @deprecated This field will not be removed but become a pointer to an AVPacket + * owned by libavformat instead. + * Callers that want to be forward compatible with future libavformat + * versions should wrap access to this field with a + * LIBAVFORMAT_VERSION_MAJOR preoprocessor check and start treating it + * as a pointer from version 60 onwards. */ #if FF_API_INIT_PACKET + attribute_deprecated AVPacket attached_pic; #else AVPacket *attached_pic; diff --git a/libavformat/utils.c b/libavformat/utils.c index 3db12af1b6..f7a3b96dab 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4384,8 +4384,10 @@ static void free_stream(AVStream **pst) av_parser_close(st->parser); #if FF_API_INIT_PACKET +FF_DISABLE_DEPRECATION_WARNINGS if (st->attached_pic.data) av_packet_unref(&st->attached_pic); +FF_ENABLE_DEPRECATION_WARNINGS #else av_packet_free(st->attached_pic); #endif @@ -5864,7 +5866,9 @@ FF_ENABLE_DEPRECATION_WARNINGS AVPacket *ff_stream_get_attached_pic(AVStream *st) { #if FF_API_INIT_PACKET +FF_DISABLE_DEPRECATION_WARNINGS return &st->attached_pic; +FF_ENABLE_DEPRECATION_WARNINGS #else return st->attached_pic; #endif -- 2.30.2 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".