@@ -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;
@@ -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
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 <jamrial@gmail.com> --- libavformat/avformat.h | 8 ++++++++ libavformat/utils.c | 4 ++++ 2 files changed, 12 insertions(+)