From dab56b5fd5b1e9e0b1492305c37aede88c500876 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Mon, 24 Mar 2014 21:01:20 +0100 Subject: vda: Simplify codec selection VDA supports h264 only. --- video/decode/vda.c | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) (limited to 'video') diff --git a/video/decode/vda.c b/video/decode/vda.c index 6ac34aed89..a8d044c14f 100644 --- a/video/decode/vda.c +++ b/video/decode/vda.c @@ -30,29 +30,6 @@ struct priv { struct vda_context vda_ctx; }; -struct profile_entry { - enum AVCodecID av_codec; - int ff_profile; - uint32_t vda_codec; -}; - -static const struct profile_entry profiles[] = { - { AV_CODEC_ID_H264, FF_PROFILE_UNKNOWN, 'avc1' }, -}; - -static const struct profile_entry *find_codec(enum AVCodecID id, int ff_profile) -{ - for (int n = 0; n < MP_ARRAY_SIZE(profiles); n++) { - if (profiles[n].av_codec == id && - (profiles[n].ff_profile == ff_profile || - profiles[n].ff_profile == FF_PROFILE_UNKNOWN)) - { - return &profiles[n]; - } - } - return NULL; -} - struct vda_error { int code; char *reason; @@ -91,7 +68,7 @@ static int probe(struct vd_lavc_hwdec *hwdec, struct mp_hwdec_info *info, { hwdec_request_api(info, "vda"); - if (!find_codec(mp_codec_to_av_codec_id(decoder), FF_PROFILE_UNKNOWN)) + if (mp_codec_to_av_codec_id(decoder) != AV_CODEC_ID_H264) return HWDEC_ERR_NO_CODEC; return 0; } @@ -103,13 +80,10 @@ static int init_vda_decoder(struct lavc_ctx *ctx) if (p->vda_ctx.decoder) ff_vda_destroy_decoder(&p->vda_ctx); - const struct profile_entry *pe = - find_codec(ctx->avctx->codec_id, ctx->avctx->profile); - p->vda_ctx = (struct vda_context) { .width = ctx->avctx->width, .height = ctx->avctx->height, - .format = pe->vda_codec, + .format = 'avc1', // equals to k2vuyPixelFormat (= YUY2/UYVY) .cv_pix_fmt_type = kCVPixelFormatType_422YpCbCr8, -- cgit v1.2.3