@@ -15,6 +15,9 @@ libavutil: 2015-08-28
API changes, most recent first:
+2017-xx-xx - xxxxxxx - lavc 57.74.100- avcodec.h
+ Add AVCodecContext.hw_device_ctx.
+
2017-01-12 - xxxxxxx - lavfi 6.69.100- buffersink.h
Add av_buffersink_get_*() functions.
@@ -3532,8 +3532,13 @@ typedef struct AVCodecContext {
/**
* A reference to the AVHWFramesContext describing the input (for encoding)
- * or output (decoding) frames. The reference is set by the caller and
- * afterwards owned (and freed) by libavcodec.
+ * or output (decoding) frames which will be used by a hardware codec.
+ *
+ * It can be set by the user if they wish to supply the frames used, or it
+ * can be set automatically by libavcodec for decoding when get_format()
+ * indicates that it should output hardware frames.
+ *
+ * If set by the user:
*
* - decoding: This field should be set by the caller from the get_format()
* callback. The previous reference (if any) will always be
@@ -3550,6 +3555,20 @@ typedef struct AVCodecContext {
* AVCodecContext.pix_fmt.
*
* This field should be set before avcodec_open2() is called.
+ *
+ * If set by libavcodec:
+ *
+ * - decoding: The hw_device_ctx field should be set by the user before
+ * calling avcodec_open2(). If at some later point a hardware
+ * pixel format is selected by get_format(), then a new
+ * AVHWFramesContext will be created by the decoder and put
+ * in this field.
+ *
+ * It will be valid when get_buffer2() is called (which must
+ * then return a buffer from the given context).
+ *
+ * - encoding: Unused. In this case the user must not supply hardware
+ * frames to the encoder.
*/
AVBufferRef *hw_frames_ctx;
@@ -3583,6 +3602,21 @@ typedef struct AVCodecContext {
*/
int64_t max_pixels;
+ /**
+ * A reference to the AVHWDeviceContext describing the device which will
+ * be used by a hardware encoder/decoder. The reference is set by the
+ * caller and afterwards owned (and freed) by libavcodec.
+ *
+ * This should only be used if either the codec device does not require
+ * hardware frames or any that are used are allocated internally by
+ * libavcodec. If the frames may be supplied by the user, then
+ * hw_frames_ctx must be used instead.
+ *
+ * If a device is to be supplied, this field should be set before
+ * avcodec_open2() is called.
+ */
+ AVBufferRef *hw_device_ctx;
+
} AVCodecContext;
AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx);
@@ -3060,6 +3060,7 @@ av_cold int avcodec_close(AVCodecContext *avctx)
avctx->nb_coded_side_data = 0;
av_buffer_unref(&avctx->hw_frames_ctx);
+ av_buffer_unref(&avctx->hw_device_ctx);
if (avctx->priv_data && avctx->codec && avctx->codec->priv_class)
av_opt_free(avctx->priv_data);
@@ -28,7 +28,7 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 57
-#define LIBAVCODEC_VERSION_MINOR 73
+#define LIBAVCODEC_VERSION_MINOR 74
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \