summaryrefslogtreecommitdiffstats
path: root/libvo/video_out.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2012-06-25 23:12:03 +0300
committerUoti Urpala <uau@mplayer2.org>2012-07-16 21:08:42 +0300
commit9426c5f92aab4b561c568e4250f5b250e2aa45c5 (patch)
treebd66b2fd5973e8fb0aa0815d4151e8ff3440b0e0 /libvo/video_out.c
parent48f0692ab973448de5faa323478d1cba3d42e2af (diff)
downloadmpv-9426c5f92aab4b561c568e4250f5b250e2aa45c5.tar.bz2
mpv-9426c5f92aab4b561c568e4250f5b250e2aa45c5.tar.xz
VO: implement shared option handling, use for vdpau
Add infrastructure that allows VOs to specify the suboptions they take, and get the values directly parsed into their private struct. The option functionality available with the new system is the same as for top-level player options. Convert vo_vdpau to use the new system instead of the old subopt_helper.
Diffstat (limited to 'libvo/video_out.c')
-rw-r--r--libvo/video_out.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/libvo/video_out.c b/libvo/video_out.c
index 96a5220645..b604a52391 100644
--- a/libvo/video_out.c
+++ b/libvo/video_out.c
@@ -36,8 +36,7 @@
#include "old_vo_wrapper.h"
#include "input/input.h"
#include "mp_fifo.h"
-
-
+#include "m_config.h"
#include "mp_msg.h"
#include "osdep/shmem.h"
@@ -254,8 +253,21 @@ const struct vo_driver *video_out_drivers[] =
};
-static int vo_preinit(struct vo *vo, const char *arg)
+static int vo_preinit(struct vo *vo, char *arg)
{
+ if (vo->driver->privsize)
+ vo->priv = talloc_zero_size(vo, vo->driver->privsize);
+ if (vo->driver->options) {
+ struct m_config *cfg = m_config_simple(vo->driver->options);
+ m_config_initialize(cfg, vo->priv);
+ char n[50];
+ int l = snprintf(n, sizeof(n), "vo/%s", vo->driver->info->short_name);
+ assert(l < sizeof(n));
+ int r = m_config_parse_suboptions(cfg, vo->priv, n, arg);
+ talloc_free(cfg);
+ if (r < 0)
+ return r;
+ }
return vo->driver->preinit(vo, arg);
}