summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2011-12-06 20:23:54 +0100
committerwm4 <wm4@mplayer2.org>2011-12-06 20:32:33 +0100
commitd4de92e80897abb64dc8ccecb7823cbe291bb52d (patch)
tree0686f943152165b2cab91a79287ea788083bc474
parent421c840b3c061de89b426244fe75237a73f765de (diff)
downloadmpv-d4de92e80897abb64dc8ccecb7823cbe291bb52d.tar.bz2
mpv-d4de92e80897abb64dc8ccecb7823cbe291bb52d.tar.xz
libvo: remove title argument from struct vo_driver.config
This affects only the "new" VO API. The config() title argument was barely used, and it's hardcoded to "MPlayer" in vf_vo.c. The X11 and the Cocoa GUI backends, which are the only ones properly supporting window titles, ignored this argument. Remove the title argument. Add the vo_get_window_title function. All GUI VOs are supposed to use it for the window title.
-rw-r--r--libmpcodecs/vd.c5
-rw-r--r--libmpcodecs/vf_vo.c2
-rw-r--r--libvo/cocoa_common.h3
-rw-r--r--libvo/cocoa_common.m18
-rw-r--r--libvo/gl_common.c18
-rw-r--r--libvo/gl_common.h2
-rw-r--r--libvo/old_vo_wrapper.c5
-rw-r--r--libvo/old_vo_wrapper.h2
-rw-r--r--libvo/video_out.c16
-rw-r--r--libvo/video_out.h5
-rw-r--r--libvo/vo_gl.c10
-rw-r--r--libvo/vo_vdpau.c4
-rw-r--r--libvo/vo_xv.c5
-rw-r--r--libvo/x11_common.c10
-rw-r--r--libvo/x11_common.h5
15 files changed, 50 insertions, 60 deletions
diff --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c
index 21c940b9be..564ad2a911 100644
--- a/libmpcodecs/vd.c
+++ b/libmpcodecs/vd.c
@@ -321,9 +321,8 @@ int mpcodecs_config_vo2(sh_video_t *sh, int w, int h,
// Time to config libvo!
mp_msg(MSGT_CPLAYER, MSGL_V,
- "VO Config (%dx%d->%dx%d,flags=%d,'%s',0x%X)\n", sh->disp_w,
- sh->disp_h, screen_size_x, screen_size_y, vocfg_flags, "MPlayer",
- out_fmt);
+ "VO Config (%dx%d->%dx%d,flags=%d,0x%X)\n", sh->disp_w,
+ sh->disp_h, screen_size_x, screen_size_y, vocfg_flags, out_fmt);
vf->w = sh->disp_w;
vf->h = sh->disp_h;
diff --git a/libmpcodecs/vf_vo.c b/libmpcodecs/vf_vo.c
index 9e2612654c..499184d37f 100644
--- a/libmpcodecs/vf_vo.c
+++ b/libmpcodecs/vf_vo.c
@@ -79,7 +79,7 @@ static int config(struct vf_instance *vf,
vf->default_caps=query_format(vf,outfmt);
vf->draw_slice = (vf->default_caps & VOCAP_NOSLICES) ? NULL : draw_slice;
- if (vo_config(video_out, width, height, d_width, d_height, flags, "MPlayer", outfmt))
+ if (vo_config(video_out, width, height, d_width, d_height, flags, outfmt))
return 0;
#ifdef CONFIG_ASS
diff --git a/libvo/cocoa_common.h b/libvo/cocoa_common.h
index 25027e1417..c5d24e9178 100644
--- a/libvo/cocoa_common.h
+++ b/libvo/cocoa_common.h
@@ -10,8 +10,7 @@ void vo_cocoa_update_xinerama_info(struct vo *vo);
int vo_cocoa_change_attributes(struct MPGLContext *ctx);
int vo_cocoa_create_window(struct MPGLContext *ctx, uint32_t d_width,
- uint32_t d_height, uint32_t flags,
- const char *title);
+ uint32_t d_height, uint32_t flags);
void vo_cocoa_swap_buffers(void);
int vo_cocoa_check_events(struct vo *vo);
diff --git a/libvo/cocoa_common.m b/libvo/cocoa_common.m
index 5e9771bb8c..56749861c2 100644
--- a/libvo/cocoa_common.m
+++ b/libvo/cocoa_common.m
@@ -64,7 +64,6 @@ struct vo *l_vo;
// local function definitions
struct vo_cocoa_state *vo_cocoa_init_state(void);
void update_screen_info(void);
-const char *title_from_vo_and_title(struct vo *vo, const char *title);
void resize_window(struct vo *vo);
void create_menu(void);
@@ -136,19 +135,6 @@ int vo_cocoa_change_attributes(struct MPGLContext *ctx)
return SET_WINDOW_OK;
}
-// this function exists because vf_vo.c calls config with title = "MPlayer"
-// and from the vo it will come down to the backend (ignoring --use-filename-title)
-const char *title_from_vo_and_title(struct vo *vo, const char *title)
-{
- if (vo->opts->vo_wintitle) {
- return vo->opts->vo_wintitle;
- } else if (title) {
- return title;
- } else {
- return "mplayer2";
- }
-}
-
void resize_window(struct vo *vo)
{
vo->dwidth = [[s->window contentView] frame].size.width;
@@ -157,7 +143,7 @@ void resize_window(struct vo *vo)
}
int vo_cocoa_create_window(struct MPGLContext *ctx, uint32_t d_width,
- uint32_t d_height, uint32_t flags, const char *title)
+ uint32_t d_height, uint32_t flags)
{
if (s->current_video_size.width > 0 || s->current_video_size.height > 0)
s->previous_video_size = s->current_video_size;
@@ -222,7 +208,7 @@ int vo_cocoa_create_window(struct MPGLContext *ctx, uint32_t d_width,
if (s->window_title)
[s->window_title release];
- s->window_title = [[NSString alloc] initWithUTF8String:title_from_vo_and_title(ctx->vo,title)];
+ s->window_title = [[NSString alloc] initWithUTF8String:vo_get_window_title(ctx->vo)];
[s->window setTitle: s->window_title];
return SET_WINDOW_OK;
diff --git a/libvo/gl_common.c b/libvo/gl_common.c
index d35318bd68..27febc1b36 100644
--- a/libvo/gl_common.c
+++ b/libvo/gl_common.c
@@ -1613,10 +1613,9 @@ void glDrawTex(GL *gl, GLfloat x, GLfloat y, GLfloat w, GLfloat h,
#ifdef CONFIG_GL_COCOA
#include "cocoa_common.h"
static int create_window_cocoa(struct MPGLContext *ctx, uint32_t d_width,
- uint32_t d_height, uint32_t flags,
- const char *title)
+ uint32_t d_height, uint32_t flags)
{
- return vo_cocoa_create_window(ctx, d_width, d_height, flags, title);
+ return vo_cocoa_create_window(ctx, d_width, d_height, flags);
}
static int setGlWindow_cocoa(MPGLContext *ctx)
{
@@ -1654,8 +1653,7 @@ static void cocoa_fullscreen(struct vo *vo)
#include "w32_common.h"
static int create_window_w32(struct MPGLContext *ctx, uint32_t d_width,
- uint32_t d_height, uint32_t flags,
- const char *title)
+ uint32_t d_height, uint32_t flags)
{
if (!vo_w32_config(d_width, d_height, flags))
return -1;
@@ -1771,8 +1769,7 @@ static void new_w32_update_xinerama_info(struct vo *vo) { w32_update_xinerama_in
#include "x11_common.h"
static int create_window_x11(struct MPGLContext *ctx, uint32_t d_width,
- uint32_t d_height, uint32_t flags,
- const char *title)
+ uint32_t d_height, uint32_t flags)
{
struct vo *vo = ctx->vo;
@@ -1805,7 +1802,7 @@ static int create_window_x11(struct MPGLContext *ctx, uint32_t d_width,
Colormap colormap = XCreateColormap(vo->x11->display, vo->x11->rootwin,
vinfo->visual, AllocNone);
vo_x11_create_vo_window(vo, vinfo, vo->dx, vo->dy, d_width, d_height,
- flags, colormap, "gl", title);
+ flags, colormap, "gl");
return 0;
}
@@ -1968,10 +1965,9 @@ static void swapGlBuffers_x11(MPGLContext *ctx)
#include "sdl_common.h"
static int create_window_sdl(struct MPGLContext *ctx, uint32_t d_width,
- uint32_t d_height, uint32_t flags,
- const char *title)
+ uint32_t d_height, uint32_t flags)
{
- SDL_WM_SetCaption(title, NULL);
+ SDL_WM_SetCaption(vo_get_window_title(ctx->vo), NULL);
ctx->vo->dwidth = d_width;
ctx->vo->dheight = d_height;
return 0;
diff --git a/libvo/gl_common.h b/libvo/gl_common.h
index 88a2507060..8e3294f441 100644
--- a/libvo/gl_common.h
+++ b/libvo/gl_common.h
@@ -387,7 +387,7 @@ typedef struct MPGLContext {
#endif
} context;
int (*create_window)(struct MPGLContext *ctx, uint32_t d_width,
- uint32_t d_height, uint32_t flags, const char *title);
+ uint32_t d_height, uint32_t flags);
int (*setGlWindow)(struct MPGLContext *);
void (*releaseGlContext)(struct MPGLContext *);
void (*swapGlBuffers)(struct MPGLContext *);
diff --git a/libvo/old_vo_wrapper.c b/libvo/old_vo_wrapper.c
index a99511d831..b3053eb57f 100644
--- a/libvo/old_vo_wrapper.c
+++ b/libvo/old_vo_wrapper.c
@@ -34,10 +34,11 @@ int old_vo_preinit(struct vo *vo, const char *arg)
int old_vo_config(struct vo *vo, uint32_t width, uint32_t height,
uint32_t d_width, uint32_t d_height,
- uint32_t flags, char *title, uint32_t format)
+ uint32_t flags, uint32_t format)
{
return vo->driver->old_functions->config(width, height, d_width,
- d_height, flags, title, format);
+ d_height, flags, "MPlayer",
+ format);
}
diff --git a/libvo/old_vo_wrapper.h b/libvo/old_vo_wrapper.h
index 250a1187fe..f18ee296f4 100644
--- a/libvo/old_vo_wrapper.h
+++ b/libvo/old_vo_wrapper.h
@@ -10,7 +10,7 @@ extern struct osd_state *global_osd;
int old_vo_preinit(struct vo *vo, const char *);
int old_vo_config(struct vo *vo, uint32_t width, uint32_t height,
uint32_t d_width, uint32_t d_height,
- uint32_t flags, char *title, uint32_t format);
+ uint32_t flags, uint32_t format);
int old_vo_control(struct vo *vo, uint32_t request, void *data);
int old_vo_draw_frame(struct vo *vo, uint8_t *src[]);
int old_vo_draw_slice(struct vo *vo, uint8_t *src[], int stride[],
diff --git a/libvo/video_out.c b/libvo/video_out.c
index e796784b1e..8c2f551e4c 100644
--- a/libvo/video_out.c
+++ b/libvo/video_out.c
@@ -437,7 +437,7 @@ static int event_fd_callback(void *ctx, int fd)
int vo_config(struct vo *vo, uint32_t width, uint32_t height,
uint32_t d_width, uint32_t d_height, uint32_t flags,
- char *title, uint32_t format)
+ uint32_t format)
{
struct MPOpts *opts = vo->opts;
panscan_init(vo);
@@ -458,7 +458,7 @@ int vo_config(struct vo *vo, uint32_t width, uint32_t height,
}
int ret = vo->driver->config(vo, width, height, d_width, d_height, flags,
- title, format);
+ format);
vo->config_ok = (ret == 0);
vo->config_count += vo->config_ok;
if (vo->registered_fd == -1 && vo->event_fd != -1 && vo->config_ok) {
@@ -552,6 +552,18 @@ void calc_src_dst_rects(struct vo *vo, int src_width, int src_height,
dst->height = dst->bottom - dst->top;
}
+// Return the window title the VO should set. Always returns a null terminated
+// string. The string is valid until frontend code is invoked again. Copy it if
+// you need to keep the string for an extended period of time.
+const char *vo_get_window_title(struct vo *vo)
+{
+ if (vo->opts->vo_wintitle) {
+ return vo->opts->vo_wintitle;
+ } else {
+ return "MPlayer";
+ }
+}
+
/**
* Generates a mouse movement message if those are enable and sends it
* to the "main" MPlayer.
diff --git a/libvo/video_out.h b/libvo/video_out.h
index bd7b2e8fa5..e5d2f78c8a 100644
--- a/libvo/video_out.h
+++ b/libvo/video_out.h
@@ -188,7 +188,7 @@ struct vo_driver {
*/
int (*config)(struct vo *vo, uint32_t width, uint32_t height,
uint32_t d_width, uint32_t d_height, uint32_t fullscreen,
- char *title, uint32_t format);
+ uint32_t format);
/*
* Control interface
@@ -298,7 +298,7 @@ struct vo *init_best_video_out(struct MPOpts *opts, struct vo_x11_state *x11,
struct input_ctx *input_ctx);
int vo_config(struct vo *vo, uint32_t width, uint32_t height,
uint32_t d_width, uint32_t d_height, uint32_t flags,
- char *title, uint32_t format);
+ uint32_t format);
void list_video_out(void);
int vo_control(struct vo *vo, uint32_t request, void *data);
@@ -313,6 +313,7 @@ void vo_check_events(struct vo *vo);
void vo_seek_reset(struct vo *vo);
void vo_destroy(struct vo *vo);
+const char *vo_get_window_title(struct vo *vo);
// NULL terminated array of all drivers
extern const struct vo_driver *video_out_drivers[];
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index b38a8d75e4..dbaef279d8 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -647,19 +647,19 @@ static int initGl(struct vo *vo, uint32_t d_width, uint32_t d_height)
}
static int create_window(struct vo *vo, uint32_t d_width, uint32_t d_height,
- uint32_t flags, const char *title)
+ uint32_t flags)
{
struct gl_priv *p = vo->priv;
if (p->stereo_mode == GL_3D_QUADBUFFER)
flags |= VOFLAG_STEREO;
- return p->glctx->create_window(p->glctx, d_width, d_height, flags, title);
+ return p->glctx->create_window(p->glctx, d_width, d_height, flags);
}
static int config(struct vo *vo, uint32_t width, uint32_t height,
uint32_t d_width, uint32_t d_height, uint32_t flags,
- char *title, uint32_t format)
+ uint32_t format)
{
struct gl_priv *p = vo->priv;
@@ -676,7 +676,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
p->vo_flipped = !!(flags & VOFLAG_FLIPPING);
- if (create_window(vo, d_width, d_height, flags, title) < 0)
+ if (create_window(vo, d_width, d_height, flags) < 0)
return -1;
if (vo->config_count)
@@ -1384,7 +1384,7 @@ static int preinit_internal(struct vo *vo, const char *arg, int allow_sw,
}
if (p->use_yuv == -1 || !allow_sw) {
- if (create_window(vo, 320, 200, VOFLAG_HIDDEN, NULL) < 0)
+ if (create_window(vo, 320, 200, VOFLAG_HIDDEN) < 0)
goto err_out;
if (p->glctx->setGlWindow(p->glctx) == SET_WINDOW_FAILED)
goto err_out;
diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c
index be4540002b..d58607e135 100644
--- a/libvo/vo_vdpau.c
+++ b/libvo/vo_vdpau.c
@@ -864,7 +864,7 @@ static int handle_preemption(struct vo *vo)
*/
static int config(struct vo *vo, uint32_t width, uint32_t height,
uint32_t d_width, uint32_t d_height, uint32_t flags,
- char *title, uint32_t format)
+ uint32_t format)
{
struct vdpctx *vc = vo->priv;
struct vo_x11_state *x11 = vo->x11;
@@ -912,7 +912,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
xswamask = CWBorderPixel;
vo_x11_create_vo_window(vo, &vinfo, vo->dx, vo->dy, d_width, d_height,
- flags, CopyFromParent, "vdpau", title);
+ flags, CopyFromParent, "vdpau");
XChangeWindowAttributes(x11->display, x11->window, xswamask, &xswa);
#ifdef CONFIG_XF86VM
diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index 694dbc048a..deda443594 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -200,7 +200,7 @@ static void resize(struct vo *vo)
*/
static int config(struct vo *vo, uint32_t width, uint32_t height,
uint32_t d_width, uint32_t d_height, uint32_t flags,
- char *title, uint32_t format)
+ uint32_t format)
{
struct vo_x11_state *x11 = vo->x11;
XVisualInfo vinfo;
@@ -265,8 +265,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
}
vo_x11_create_vo_window(vo, &vinfo, vo->dx, vo->dy, vo->dwidth,
- vo->dheight, flags, CopyFromParent, "xv",
- title);
+ vo->dheight, flags, CopyFromParent, "xv");
XChangeWindowAttributes(x11->display, x11->window, xswamask, &xswa);
#ifdef CONFIG_XF86VM
diff --git a/libvo/x11_common.c b/libvo/x11_common.c
index 1b7636bba8..a9397bd199 100644
--- a/libvo/x11_common.c
+++ b/libvo/x11_common.c
@@ -1032,15 +1032,13 @@ static Window vo_x11_create_smooth_window(struct vo_x11_state *x11, Window mRoot
* Only VOFLAG_FULLSCREEN is supported so far.
* \param col_map Colourmap for window or CopyFromParent if a specific colormap isn't needed
* \param classname name to use for the classhint
- * \param title title for the window
*
* This also does the grunt-work like setting Window Manager hints etc.
* If vo_window is already set it just moves and resizes it.
*/
void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y,
unsigned int width, unsigned int height, int flags,
- Colormap col_map,
- const char *classname, const char *title)
+ Colormap col_map, const char *classname)
{
struct MPOpts *opts = vo->opts;
struct vo_x11_state *x11 = vo->x11;
@@ -1083,7 +1081,6 @@ void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y,
XSizeHints hint;
x11->window_state &= ~VOFLAG_HIDDEN;
vo_x11_classhint(vo, x11->window, classname);
- XStoreName(mDisplay, x11->window, title);
vo_hidecursor(mDisplay, x11->window);
XSelectInput(mDisplay, x11->window, StructureNotifyMask);
hint.x = x; hint.y = y;
@@ -1091,6 +1088,7 @@ void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y,
hint.flags = PSize;
if (geometry_xy_changed)
hint.flags |= PPosition;
+ const char *title = "MPlayer";
XSetStandardProperties(mDisplay, x11->window, title, title, None, NULL, 0, &hint);
if (!vo_border) vo_x11_decoration(vo, 0);
// map window
@@ -1305,7 +1303,6 @@ static int vo_x11_get_fs_type(int supported)
*/
int vo_x11_update_geometry(struct vo *vo, bool update_pos)
{
- struct MPOpts *opts = vo->opts;
struct vo_x11_state *x11 = vo->x11;
unsigned depth, w, h;
int dummy_int;
@@ -1319,8 +1316,7 @@ int vo_x11_update_geometry(struct vo *vo, bool update_pos)
if (update_pos)
XTranslateCoordinates(x11->display, x11->window, x11->rootwin, 0, 0,
&vo->dx, &vo->dy, &dummy_win);
- if (opts->vo_wintitle)
- XStoreName(x11->display, x11->window, opts->vo_wintitle);
+ XStoreName(x11->display, x11->window, vo_get_window_title(vo));
return depth <= INT_MAX ? depth : 0;
}
diff --git a/libvo/x11_common.h b/libvo/x11_common.h
index ab5188159c..a4e5c56a8e 100644
--- a/libvo/x11_common.h
+++ b/libvo/x11_common.h
@@ -135,7 +135,7 @@ uint32_t vo_x11_get_equalizer(const char *name, int *value);
void fstype_help(void);
void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis,
int x, int y, unsigned int width, unsigned int height, int flags,
- Colormap col_map, const char *classname, const char *title);
+ Colormap col_map, const char *classname);
void vo_x11_clearwindow_part(struct vo *vo, Window vo_window,
int img_width, int img_height);
void vo_x11_clearwindow(struct vo *vo, Window vo_window);
@@ -184,7 +184,8 @@ void xscreensaver_heartbeat(struct vo_x11_state *x11);
// Old VOs use incompatible function calls, translate them to new
// prototypes
#ifdef IS_OLD_VO
-#define vo_x11_create_vo_window(...) vo_x11_create_vo_window(global_vo, __VA_ARGS__)
+#define vo_x11_create_vo_window(vis, x, y, width, height, flags, col_map, classname, title) \
+ vo_x11_create_vo_window(global_vo, vis, x, y, width, height, flags, col_map, classname)
#define vo_x11_fullscreen() vo_x11_fullscreen(global_vo)
#define vo_x11_update_geometry() vo_x11_update_geometry(global_vo, 1)
#define vo_x11_ontop() vo_x11_ontop(global_vo)