History

Merge commit 'e85f6f7f8d037c0af0f294000718d9ba22753baa'

* commit 'e85f6f7f8d037c0af0f294000718d9ba22753baa': lavc: allow using AVCodecContext.hw_frames_ctx for decoding Conflicts: doc/APIchanges libavcodec/version.h

James Almer committed 10 years ago

Commit 32c25f02 parents 0153cc4 e85f6f74 files · +37 −9Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavcodec/avcodec.h +17 −7
  3. libavcodec/utils.c +15 −0
  4. libavcodec/version.h +2 −2
doc/APIchanges+3−0
@@ -15,6 +15,9 @@ libavutil: 2015-08-28 · 14 unmodified lines
1515
1616 API changes, most recent first:
1717
18+2016-09-xx - xxxxxxx - lavc 57.59.100/ 57.23.0 - avcodec.h
19+ AVCodecContext.hw_frames_ctx now may be used by decoders.
20+
1821 2016-09-27 - xxxxxxx - lavf 57.51.100 - avformat.h
1922 Add av_stream_get_codec_timebase()
2023
libavcodec/avcodec.h+17−7
@@ -3518,15 +3518,25 @@ typedef struct AVCodecContext { · 3517 unmodified lines
35183518 int nb_coded_side_data;
35193519
35203520 /**
3521− * Encoding only.
3521+ * A reference to the AVHWFramesContext describing the input (for encoding)
3522+ * or output (decoding) frames. The reference is set by the caller and
3523+ * afterwards owned (and freed) by libavcodec.
35223524 *
3523− * For hardware encoders configured to use a hwaccel pixel format, this
3524− * field should be set by the caller to a reference to the AVHWFramesContext
3525− * describing input frames. AVHWFramesContext.format must be equal to
3526− * AVCodecContext.pix_fmt.
3525+ * - decoding: This field should be set by the caller from the get_format()
3526+ * callback. The previous reference (if any) will always be
3527+ * unreffed by libavcodec before the get_format() call.
35273528 *
3528− * This field should be set before avcodec_open2() is called and is
3529− * afterwards owned and managed by libavcodec.
3529+ * If the default get_buffer2() is used with a hwaccel pixel
3530+ * format, then this AVHWFramesContext will be used for
3531+ * allocating the frame buffers.
3532+ *
3533+ * - encoding: For hardware encoders configured to use a hwaccel pixel
3534+ * format, this field should be set by the caller to a reference
3535+ * to the AVHWFramesContext describing input frames.
3536+ * AVHWFramesContext.format must be equal to
3537+ * AVCodecContext.pix_fmt.
3538+ *
3539+ * This field should be set before avcodec_open2() is called.
35303540 */
35313541 AVBufferRef *hw_frames_ctx;
35323542
libavcodec/utils.c+15−0
@@ -724,6 +724,9 @@ int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags · 723 unmodified lines
724724 {
725725 int ret;
726726
727+ if (avctx->hw_frames_ctx)
728+ return av_hwframe_get_buffer(avctx->hw_frames_ctx, frame, 0);
729+
727730 if ((ret = update_frame_pool(avctx, frame)) < 0)
728731 return ret;
729732
@@ -1119,6 +1122,8 @@ int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt) · 389 unmodified lines
11191122 av_freep(&avctx->internal->hwaccel_priv_data);
11201123 avctx->hwaccel = NULL;
11211124
1125+ av_buffer_unref(&avctx->hw_frames_ctx);
1126+
11221127 ret = avctx->get_format(avctx, choices);
11231128
11241129 desc = av_pix_fmt_desc_get(ret);
@@ -1134,6 +1139,16 @@ int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt) · 9 unmodified lines
11341139 break;
11351140 #endif
11361141
1142+ if (avctx->hw_frames_ctx) {
1143+ AVHWFramesContext *hw_frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
1144+ if (hw_frames_ctx->format != ret) {
1145+ av_log(avctx, AV_LOG_ERROR, "Format returned from get_buffer() "
1146+ "does not match the format of provided AVHWFramesContext\n");
1147+ ret = AV_PIX_FMT_NONE;
1148+ break;
1149+ }
1150+ }
1151+
11371152 if (!setup_hwaccel(avctx, ret, desc->name))
11381153 break;
11391154
libavcodec/version.h+2−2
@@ -28,8 +28,8 @@ · 27 unmodified lines
2828 #include "libavutil/version.h"
2929
3030 #define LIBAVCODEC_VERSION_MAJOR 57
31−#define LIBAVCODEC_VERSION_MINOR 58
32−#define LIBAVCODEC_VERSION_MICRO 104
31+#define LIBAVCODEC_VERSION_MINOR 59
32+#define LIBAVCODEC_VERSION_MICRO 100
3333
3434 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
3535 LIBAVCODEC_VERSION_MINOR, \

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