summaryrefslogtreecommitdiffstats
path: root/video/decode
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-11-17 21:07:41 +0100
committerwm4 <wm4@nowhere>2015-11-17 21:21:19 +0100
commit0ec35fa111391b8069640ba2f616746a1b5530a5 (patch)
treee5356e8ab396e1c370a7784843f3101d3195469f /video/decode
parent25fe9e89e7db1658acac84ec8ac0a292b2e86165 (diff)
downloadmpv-0ec35fa111391b8069640ba2f616746a1b5530a5.tar.bz2
mpv-0ec35fa111391b8069640ba2f616746a1b5530a5.tar.xz
videotoolbox: make decoder format customizable
Because apparently there's no ideal universally working format. The weird OpenGL texture format for kCVPixelFormatType_32BGRA is from: http://stackoverflow.com/questions/22077544/draw-an-iosurface-to-an-opengl-context (Which apparently got it from the linked Apple example code.)
Diffstat (limited to 'video/decode')
-rw-r--r--video/decode/videotoolbox.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/video/decode/videotoolbox.c b/video/decode/videotoolbox.c
index 470f6b6cf3..c5035f3a5b 100644
--- a/video/decode/videotoolbox.c
+++ b/video/decode/videotoolbox.c
@@ -31,7 +31,7 @@ static int probe(struct vd_lavc_hwdec *hwdec, struct mp_hwdec_info *info,
const char *decoder)
{
hwdec_request_api(info, "videotoolbox");
- if (!info || !info->hwctx)
+ if (!info || !info->hwctx || info->hwctx->type != HWDEC_VIDEOTOOLBOX)
return HWDEC_ERR_NO_CTX;
switch (mp_codec_to_av_codec_id(decoder)) {
case AV_CODEC_ID_H264:
@@ -88,7 +88,7 @@ static int init_decoder(struct lavc_ctx *ctx, int w, int h)
av_videotoolbox_default_free(ctx->avctx);
AVVideotoolboxContext *vtctx = av_videotoolbox_alloc_context();
- vtctx->cv_pix_fmt_type = kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange;
+ vtctx->cv_pix_fmt_type = (uintptr_t)ctx->hwdec_info->hwctx->priv;
int err = av_videotoolbox_default_init2(ctx->avctx, vtctx);
if (err < 0) {