summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/hwdec.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-02-01 20:02:52 +0100
committerwm4 <wm4@nowhere>2016-02-01 20:02:52 +0100
commit05ffde6599fde77cf3e5cd6e244063563f88c112 (patch)
treee457d31f4c937605da5958754da62d8b4f4f8c48 /video/out/opengl/hwdec.c
parenta9dfd8d557b1651e6d9ae7a374426dbcd856da99 (diff)
downloadmpv-05ffde6599fde77cf3e5cd6e244063563f88c112.tar.bz2
mpv-05ffde6599fde77cf3e5cd6e244063563f88c112.tar.xz
vo_opengl: hwdec: use IDs for API, and log which backend is used
Since there can be multiple backends for a single API (vaapi can use GLX or EGL), not logging the exact backend name is annoying. So add it. At the same time, there is no need to duplicate the name as used by the --hwdec options, so replace it with using the numeric hwdec API ID.
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)