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 c1a5fca1 parent aa234694 files · +28 −2Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavcodec/avcodec.h +23 −1
  3. libavcodec/utils.c +1 −0
  4. libavcodec/version.h +1 −1
doc/APIchanges+3−0
@@ -15,6 +15,9 @@ libavutil: 2015-08-28 · 14 unmodified lines
1515
1616 API changes, most recent first:
1717
18+2017-02-13 - xxxxxxx - lavc 57.80.100 - avcodec.h
19+ Add AVCodecContext.hw_device_ctx.
20+
1821 2017-02-11 - xxxxxxx - lavu 55.47.100 - frame.h
1922 Add AVFrame.opaque_ref.
2023
libavcodec/avcodec.h+23−1
@@ -3536,7 +3536,8 @@ typedef struct AVCodecContext { · 3535 unmodified lines
35363536 /**
35373537 * A reference to the AVHWFramesContext describing the input (for encoding)
35383538 * or output (decoding) frames. The reference is set by the caller and
3539− * afterwards owned (and freed) by libavcodec.
3539+ * afterwards owned (and freed) by libavcodec - it should never be read by
3540+ * the caller after being set.
35403541 *
35413542 * - decoding: This field should be set by the caller from the get_format()
35423543 * callback. The previous reference (if any) will always be
@@ -3586,6 +3587,27 @@ typedef struct AVCodecContext { · 43 unmodified lines
35863587 */
35873588 int64_t max_pixels;
35883589
3590+ /**
3591+ * A reference to the AVHWDeviceContext describing the device which will
3592+ * be used by a hardware encoder/decoder. The reference is set by the
3593+ * caller and afterwards owned (and freed) by libavcodec.
3594+ *
3595+ * This should be used if either the codec device does not require
3596+ * hardware frames or any that are used are to be allocated internally by
3597+ * libavcodec. If the user wishes to supply any of the frames used as
3598+ * encoder input or decoder output then hw_frames_ctx should be used
3599+ * instead. When hw_frames_ctx is set in get_format() for a decoder, this
3600+ * field will be ignored while decoding the associated stream segment, but
3601+ * may again be used on a following one after another get_format() call.
3602+ *
3603+ * For both encoders and decoders this field should be set before
3604+ * avcodec_open2() is called and must not be written to thereafter.
3605+ *
3606+ * Note that some decoders may require this field to be set initially in
3607+ * order to support hw_frames_ctx at all - in that case, all frames
3608+ * contexts used must be created on the same device.
3609+ */
3610+ AVBufferRef *hw_device_ctx;
35893611 } AVCodecContext;
35903612
35913613 AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx);
libavcodec/utils.c+1−0
@@ -3067,6 +3067,7 @@ av_cold int avcodec_close(AVCodecContext *avctx) · 3066 unmodified lines
30673067 avctx->nb_coded_side_data = 0;
30683068
30693069 av_buffer_unref(&avctx->hw_frames_ctx);
3070+ av_buffer_unref(&avctx->hw_device_ctx);
30703071
30713072 if (avctx->priv_data && avctx->codec && avctx->codec->priv_class)
30723073 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 79
31+#define LIBAVCODEC_VERSION_MINOR 80
3232 #define LIBAVCODEC_VERSION_MICRO 100
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