summaryrefslogtreecommitdiffstats
path: root/video/out/vo_mediacodec_embed.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/vo_mediacodec_embed.c')
-rw-r--r--video/out/vo_mediacodec_embed.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/video/out/vo_mediacodec_embed.c b/video/out/vo_mediacodec_embed.c
index dc2974918b..08d3866d57 100644
--- a/video/out/vo_mediacodec_embed.c
+++ b/video/out/vo_mediacodec_embed.c
@@ -37,6 +37,7 @@ static AVBufferRef *create_mediacodec_device_ref(struct vo *vo)
AVHWDeviceContext *ctx = (void *)device_ref->data;
AVMediaCodecDeviceContext *hwctx = ctx->hwctx;
+ assert(vo->opts->WinID != 0 && vo->opts->WinID != -1);
hwctx->surface = (void *)(intptr_t)(vo->opts->WinID);
if (av_hwdevice_ctx_init(device_ref) < 0)
@@ -52,7 +53,14 @@ static int preinit(struct vo *vo)
p->hwctx = (struct mp_hwdec_ctx){
.driver_name = "mediacodec_embed",
.av_device_ref = create_mediacodec_device_ref(vo),
+ .hw_imgfmt = IMGFMT_MEDIACODEC,
};
+
+ if (!p->hwctx.av_device_ref) {
+ MP_VERBOSE(vo, "Failed to create hwdevice_ctx\n");
+ return -1;
+ }
+
hwdec_devices_add(vo->hwdec_devs, &p->hwctx);
return 0;
}