diff options
author | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2015-05-10 21:32:59 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2015-05-13 17:39:37 +0200 |
commit | e7c5e17d4fbd7c83fb331bf327e25ebd8e6a8623 (patch) | |
tree | 25b9fa293c02f0e10827a3649ed92ff55f571b36 /libavcodec/vda.c | |
parent | 3b5e5e6a29d62462d0505287042fa4c2b99c4f2b (diff) |
vda: Make output CVPixelBuffer format configurable
This is useful for client programs to ask for nv12 surfaces instead of the
current default (uyvy), since those are more efficient to decode to.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavcodec/vda.c')
-rw-r--r-- | libavcodec/vda.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libavcodec/vda.c b/libavcodec/vda.c index f71fb16488..eb4b9982cb 100644 --- a/libavcodec/vda.c +++ b/libavcodec/vda.c @@ -28,15 +28,22 @@ AVVDAContext *av_vda_alloc_context(void) { AVVDAContext *ret = av_mallocz(sizeof(*ret)); - if (ret) + if (ret) { ret->output_callback = ff_vda_output_callback; + ret->cv_pix_fmt_type = kCVPixelFormatType_422YpCbCr8; + } return ret; } int av_vda_default_init(AVCodecContext *avctx) { - avctx->hwaccel_context = av_vda_alloc_context(); + return av_vda_default_init2(avctx, NULL); +} + +int av_vda_default_init2(AVCodecContext *avctx, AVVDAContext *vdactx) +{ + avctx->hwaccel_context = vdactx ?: av_vda_alloc_context(); if (!avctx->hwaccel_context) return AVERROR(ENOMEM); return ff_vda_default_init(avctx); |