summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/hwdec.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/opengl/hwdec.c')
-rw-r--r--video/out/opengl/hwdec.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/video/out/opengl/hwdec.c b/video/out/opengl/hwdec.c
index f0e8994fe8..6afc9b6efd 100644
--- a/video/out/opengl/hwdec.c
+++ b/video/out/opengl/hwdec.c
@@ -57,13 +57,13 @@ static struct gl_hwdec *load_hwdec_driver(struct mp_log *log, GL *gl,
struct gl_hwdec *hwdec = talloc(NULL, struct gl_hwdec);
*hwdec = (struct gl_hwdec) {
.driver = drv,
- .log = mp_log_new(hwdec, log, drv->api_name),
+ .log = mp_log_new(hwdec, log, drv->name),
.global = global,
.gl = gl,
.gl_texture_target = GL_TEXTURE_2D,
.probing = is_auto,
};
- mp_verbose(log, "Loading hwdec driver '%s'\n", drv->api_name);
+ mp_verbose(log, "Loading hwdec driver '%s'\n", drv->name);
if (hwdec->driver->create(hwdec) < 0) {
talloc_free(hwdec);
mp_verbose(log, "Loading failed.\n");
@@ -72,13 +72,13 @@ static struct gl_hwdec *load_hwdec_driver(struct mp_log *log, GL *gl,
return hwdec;
}
-struct gl_hwdec *gl_hwdec_load_api(struct mp_log *log, GL *gl,
- struct mpv_global *g, const char *api_name)
+struct gl_hwdec *gl_hwdec_load_api_id(struct mp_log *log, GL *gl,
+ struct mpv_global *g, int id)
{
- bool is_auto = api_name && strcmp(api_name, "auto") == 0;
+ bool is_auto = id == HWDEC_AUTO;
for (int n = 0; mpgl_hwdec_drivers[n]; n++) {
const struct gl_hwdec_driver *drv = mpgl_hwdec_drivers[n];
- if (is_auto || (api_name && strcmp(drv->api_name, api_name) == 0)) {
+ if (is_auto || id == drv->api) {
struct gl_hwdec *r = load_hwdec_driver(log, gl, g, drv, is_auto);
if (r)
return r;
@@ -87,11 +87,17 @@ struct gl_hwdec *gl_hwdec_load_api(struct mp_log *log, GL *gl,
return NULL;
}
-// Like gl_hwdec_load_api(), but use HWDEC_... identifiers.
-struct gl_hwdec *gl_hwdec_load_api_id(struct mp_log *log, GL *gl,
- struct mpv_global *g, int id)
+// Like gl_hwdec_load_api_id(), but use option names.
+struct gl_hwdec *gl_hwdec_load_api(struct mp_log *log, GL *gl,
+ struct mpv_global *g, const char *api_name)
{
- return gl_hwdec_load_api(log, gl, g, m_opt_choice_str(mp_hwdec_names, id));
+ int id = HWDEC_NONE;
+ for (const struct m_opt_choice_alternatives *c = mp_hwdec_names; c->name; c++)
+ {
+ if (strcmp(c->name, api_name) == 0)
+ id = c->value;
+ }
+ return gl_hwdec_load_api_id(log, gl, g, id);
}
void gl_hwdec_uninit(struct gl_hwdec *hwdec)