summaryrefslogtreecommitdiff
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2014-05-08 14:43:23 +0200
committerLuca Barbato <lu_zero@gentoo.org>2014-05-11 14:59:07 +0200
commitebc29519d1634bfeb386c20a5d8a52837aae2436 (patch)
tree3d0aaba476f3981c28e299c1b2c111054989fdae /libavcodec/utils.c
parenta871ef0cc936612bdb0e643196be72efcf0c8986 (diff)
hwaccel: Support specific frame allocators
It would reduce the boilerplate code users have to write.
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 95aaa6e60d..c002c9c4e8 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -604,6 +604,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
{
+ const AVHWAccel *hwaccel = avctx->hwaccel;
int override_dimensions = 1;
int ret;
@@ -657,6 +658,11 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
if (ret < 0)
return ret;
+ if (hwaccel && hwaccel->alloc_frame) {
+ ret = hwaccel->alloc_frame(avctx, frame);
+ goto end;
+ }
+
#if FF_API_GET_BUFFER
FF_DISABLE_DEPRECATION_WARNINGS
/*
@@ -775,6 +781,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
ret = avctx->get_buffer2(avctx, frame, flags);
+end:
if (avctx->codec_type == AVMEDIA_TYPE_VIDEO && !override_dimensions) {
frame->width = avctx->width;
frame->height = avctx->height;