From 9edc2dbcf3859ca5ea517340d97dda9ce934ac7b Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 29 Nov 2013 14:19:51 +0100 Subject: gl_hwdec: use a imgfmt field instead of a query_format callback Now that vdpau always uses a single image format, this can be simplified. --- video/out/gl_common.h | 4 ++-- video/out/gl_hwdec_vaglx.c | 7 +------ video/out/gl_hwdec_vdpau.c | 7 +------ video/out/gl_video.c | 2 +- 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/video/out/gl_common.h b/video/out/gl_common.h index b5dc1a27a4..8b5ac63d9a 100644 --- a/video/out/gl_common.h +++ b/video/out/gl_common.h @@ -182,8 +182,8 @@ struct gl_hwdec { struct gl_hwdec_driver { // Same name as used by mp_hwdec_info->load_api() const char *api_name; - // Test whether the given IMGFMT_ is supported. - bool (*query_format)(int imgfmt); + // The hardware surface IMGFMT_ that must be passed to map_image later. + int imgfmt; // Create the hwdec device. It must fill in hw->info, if applicable. // This also must set hw->converted_imgfmt. int (*create)(struct gl_hwdec *hw); diff --git a/video/out/gl_hwdec_vaglx.c b/video/out/gl_hwdec_vaglx.c index 8bcc1724de..53beceb197 100644 --- a/video/out/gl_hwdec_vaglx.c +++ b/video/out/gl_hwdec_vaglx.c @@ -35,11 +35,6 @@ struct priv { void *vaglx_surface; }; -static bool query_format(int imgfmt) -{ - return imgfmt == IMGFMT_VAAPI; -} - static void destroy_texture(struct gl_hwdec *hw) { struct priv *p = hw->priv; @@ -131,7 +126,7 @@ static void unmap_image(struct gl_hwdec *hw) const struct gl_hwdec_driver gl_hwdec_vaglx = { .api_name = "vaapi", - .query_format = query_format, + .imgfmt = IMGFMT_VAAPI, .create = create, .reinit = reinit, .map_image = map_image, diff --git a/video/out/gl_hwdec_vdpau.c b/video/out/gl_hwdec_vdpau.c index b92f6a9b07..6cfd7c91d5 100644 --- a/video/out/gl_hwdec_vdpau.c +++ b/video/out/gl_hwdec_vdpau.c @@ -40,11 +40,6 @@ struct priv { VdpVideoMixer video_mixer; }; -static bool query_format(int imgfmt) -{ - return imgfmt == IMGFMT_VDPAU; -} - static void mark_vdpau_objects_uninitialized(struct gl_hwdec *hw) { struct priv *p = hw->priv; @@ -253,7 +248,7 @@ static void unmap_image(struct gl_hwdec *hw) const struct gl_hwdec_driver gl_hwdec_vdpau = { .api_name = "vdpau", - .query_format = query_format, + .imgfmt = IMGFMT_VDPAU, .create = create, .reinit = reinit, .map_image = map_image, diff --git a/video/out/gl_video.c b/video/out/gl_video.c index 0c09f29e58..881f649a34 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -1948,7 +1948,7 @@ static bool init_format(int fmt, struct gl_video *init) init = &dummy; init->hwdec_active = false; - if (init->hwdec && init->hwdec->driver->query_format(fmt)) { + if (init->hwdec && init->hwdec->driver->imgfmt == fmt) { fmt = init->hwdec->converted_imgfmt; init->hwdec_active = true; } -- cgit v1.2.3