History

lavc: Add device context field to AVCodecContext

For use by codec implementations which can allocate frames internally.

Mark Thompson committed 9 years ago

Commit 44f2eda1 parent 07b51364 files · +29 −2Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavcodec/avcodec.h +24 −1
  3. libavcodec/utils.c +1 −0
  4. libavcodec/version.h +1 −1
doc/APIchanges+3−0
@@ -13,6 +13,9 @@ libavutil: 2015-08-28 · 12 unmodified lines
1313
1414 API changes, most recent first:
1515
16+2017-xx-xx - xxxxxxx - lavc 57.34.0 - avcodec.h
17+ Add AVCodecContext.hw_device_ctx.
18+
1619 2017-02-11 - xxxxxxx - lavu 55.32.0 - frame.h
1720 Add AVFrame.opaque_ref.
1821
libavcodec/avcodec.h+24−1
@@ -3093,7 +3093,8 @@ typedef struct AVCodecContext { · 3092 unmodified lines
30933093 /**
30943094 * A reference to the AVHWFramesContext describing the input (for encoding)
30953095 * or output (decoding) frames. The reference is set by the caller and
3096− * afterwards owned (and freed) by libavcodec.
3096+ * afterwards owned (and freed) by libavcodec - it should never be read by
3097+ * the caller after being set.
30973098 *
30983099 * - decoding: This field should be set by the caller from the get_format()
30993100 * callback. The previous reference (if any) will always be
@@ -3139,6 +3140,28 @@ typedef struct AVCodecContext { · 39 unmodified lines
31393140 * (with the display dimensions being determined by the crop_* fields).
31403141 */
31413142 int apply_cropping;
3143+
3144+ /**
3145+ * A reference to the AVHWDeviceContext describing the device which will
3146+ * be used by a hardware encoder/decoder. The reference is set by the
3147+ * caller and afterwards owned (and freed) by libavcodec.
3148+ *
3149+ * This should be used if either the codec device does not require
3150+ * hardware frames or any that are used are to be allocated internally by
3151+ * libavcodec. If the user wishes to supply any of the frames used as
3152+ * encoder input or decoder output then hw_frames_ctx should be used
3153+ * instead. When hw_frames_ctx is set in get_format() for a decoder, this
3154+ * field will be ignored while decoding the associated stream segment, but
3155+ * may again be used on a following one after another get_format() call.
3156+ *
3157+ * For both encoders and decoders this field should be set before
3158+ * avcodec_open2() is called and must not be written to thereafter.
3159+ *
3160+ * Note that some decoders may require this field to be set initially in
3161+ * order to support hw_frames_ctx at all - in that case, all frames
3162+ * contexts used must be created on the same device.
3163+ */
3164+ AVBufferRef *hw_device_ctx;
31423165 } AVCodecContext;
31433166
31443167 /**
libavcodec/utils.c+1−0
@@ -794,6 +794,7 @@ av_cold int avcodec_close(AVCodecContext *avctx) · 793 unmodified lines
794794 avctx->nb_coded_side_data = 0;
795795
796796 av_buffer_unref(&avctx->hw_frames_ctx);
797+ av_buffer_unref(&avctx->hw_device_ctx);
797798
798799 if (avctx->priv_data && avctx->codec && avctx->codec->priv_class)
799800 av_opt_free(avctx->priv_data);
libavcodec/version.h+1−1
@@ -28,7 +28,7 @@ · 27 unmodified lines
2828 #include "libavutil/version.h"
2929
3030 #define LIBAVCODEC_VERSION_MAJOR 57
31−#define LIBAVCODEC_VERSION_MINOR 33
31+#define LIBAVCODEC_VERSION_MINOR 34
3232 #define LIBAVCODEC_VERSION_MICRO 0
3333
3434 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t