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
15 15
16API changes, most recent first:16API changes, most recent first:
17 17
182016-09-xx - xxxxxxx - lavc 57.59.100/ 57.23.0 - avcodec.h
19 AVCodecContext.hw_frames_ctx now may be used by decoders.
20
182016-09-27 - xxxxxxx - lavf 57.51.100 - avformat.h212016-09-27 - xxxxxxx - lavf 57.51.100 - avformat.h
19 Add av_stream_get_codec_timebase()22 Add av_stream_get_codec_timebase()
20 23
libavcodec/avcodec.h+17−7
@@ -3518,15 +3518,25 @@ typedef struct AVCodecContext { · 3517 unmodified lines
3518 int nb_coded_side_data;3518 int nb_coded_side_data;
3519 3519
3520 /**3520 /**
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.
3522 *3524 *
3523 * For hardware encoders configured to use a hwaccel pixel format, this3525 * - decoding: This field should be set by the caller from the get_format()
3524 * field should be set by the caller to a reference to the AVHWFramesContext3526 * callback. The previous reference (if any) will always be
3525 * describing input frames. AVHWFramesContext.format must be equal to3527 * unreffed by libavcodec before the get_format() call.
3526 * AVCodecContext.pix_fmt.
3527 *3528 *
3528 * This field should be set before avcodec_open2() is called and is3529 * If the default get_buffer2() is used with a hwaccel pixel
3529 * afterwards owned and managed by libavcodec.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.
3530 */3540 */
3531 AVBufferRef *hw_frames_ctx;3541 AVBufferRef *hw_frames_ctx;
3532 3542
libavcodec/utils.c+15−0
@@ -724,6 +724,9 @@ int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags · 723 unmodified lines
724{724{
725 int ret;725 int ret;
726 726
727 if (avctx->hw_frames_ctx)
728 return av_hwframe_get_buffer(avctx->hw_frames_ctx, frame, 0);
729
727 if ((ret = update_frame_pool(avctx, frame)) < 0)730 if ((ret = update_frame_pool(avctx, frame)) < 0)
728 return ret;731 return ret;
729 732
@@ -1119,6 +1122,8 @@ int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt) · 389 unmodified lines
1119 av_freep(&avctx->internal->hwaccel_priv_data);1122 av_freep(&avctx->internal->hwaccel_priv_data);
1120 avctx->hwaccel = NULL;1123 avctx->hwaccel = NULL;
1121 1124
1125 av_buffer_unref(&avctx->hw_frames_ctx);
1126
1122 ret = avctx->get_format(avctx, choices);1127 ret = avctx->get_format(avctx, choices);
1123 1128
1124 desc = av_pix_fmt_desc_get(ret);1129 desc = av_pix_fmt_desc_get(ret);
@@ -1134,6 +1139,16 @@ int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt) · 9 unmodified lines
1134 break;1139 break;
1135#endif1140#endif
1136 1141
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
1137 if (!setup_hwaccel(avctx, ret, desc->name))1152 if (!setup_hwaccel(avctx, ret, desc->name))
1138 break;1153 break;
1139 1154
libavcodec/version.h+2−2
@@ -28,8 +28,8 @@ · 27 unmodified lines
28#include "libavutil/version.h"28#include "libavutil/version.h"
29 29
30#define LIBAVCODEC_VERSION_MAJOR 5730#define LIBAVCODEC_VERSION_MAJOR 57
31#define LIBAVCODEC_VERSION_MINOR 5831#define LIBAVCODEC_VERSION_MINOR 59
32#define LIBAVCODEC_VERSION_MICRO 10432#define LIBAVCODEC_VERSION_MICRO 100
33 33
34#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \34#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
35 LIBAVCODEC_VERSION_MINOR, \35 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