diff --git a/doc/APIchanges b/doc/APIchanges index 8bca71ef36978a565de57a4534cad2ba6f186575..81e49c22b959fd343270ecb4158a8d125656af6b 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2015-08-28 API changes, most recent first: +2017-02-11 - xxxxxxx - lavu 55.47.100 - frame.h + Add AVFrame.opaque_ref. + 2017-01-31 - xxxxxxx - lavu 55.46.100 / 55.20.0 - cpu.h Add AV_CPU_FLAG_SSSE3SLOW. diff --git a/libavutil/frame.c b/libavutil/frame.c index a08e0c539d6e4bd3a7dc5d4692c18cc9f917de4e..2913982e91debc4568a9d2ef563391a2cd297d6f 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -379,6 +379,13 @@ FF_DISABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS #endif + av_buffer_unref(&dst->opaque_ref); + if (src->opaque_ref) { + dst->opaque_ref = av_buffer_ref(src->opaque_ref); + if (!dst->opaque_ref) + return AVERROR(ENOMEM); + } + return 0; } @@ -513,6 +520,8 @@ void av_frame_unref(AVFrame *frame) av_buffer_unref(&frame->hw_frames_ctx); + av_buffer_unref(&frame->opaque_ref); + get_frame_defaults(frame); } diff --git a/libavutil/frame.h b/libavutil/frame.h index b4500923af3e07d420fd552a5d8b50b34e7ac792..2b1dc2fee3ff17f69bfa7350a00d45f0b587293f 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -538,6 +538,17 @@ typedef struct AVFrame { * AVHWFramesContext describing the frame. */ AVBufferRef *hw_frames_ctx; + + /** + * AVBufferRef for free use by the API user. FFmpeg will never check the + * contents of the buffer ref. FFmpeg calls av_buffer_unref() on it when + * the frame is unreferenced. av_frame_copy_props() calls create a new + * reference with av_buffer_ref() for the target frame's opaque_ref field. + * + * This is unrelated to the opaque field, although it serves a similar + * purpose. + */ + AVBufferRef *opaque_ref; } AVFrame; /** diff --git a/libavutil/version.h b/libavutil/version.h index 8866064aac4c168e41efbf4e86a7f5ed41ea15dc..a8b00bfc64bc3213df61f10754d544c8b6598437 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 55 -#define LIBAVUTIL_VERSION_MINOR 46 +#define LIBAVUTIL_VERSION_MINOR 47 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \