changeset 29862:fbb1f57a313e

Added -name, -title and -use-filename-title options and implementation in X11 vos
author ptt
date Thu, 12 Nov 2009 09:21:53 +0000
parents 356c49d60826
children 76769d27b6cf
files DOCS/man/en/mplayer.1 cfg-mplayer.h libvo/video_out.c libvo/video_out.h libvo/x11_common.c mplayer.c
diffstat 6 files changed, 36 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/DOCS/man/en/mplayer.1	Wed Nov 11 22:26:38 2009 +0000
+++ b/DOCS/man/en/mplayer.1	Thu Nov 12 09:21:53 2009 +0000
@@ -3204,6 +3204,10 @@
 (correct for (almost?) all LCDs).
 .
 .TP
+.B \-name (X11 only)
+Set the window class name.
+.
+.TP
 .B \-nodouble
 Disables double buffering, mostly for debugging purposes.
 Double buffering fixes flicker by storing two frames in memory, and
@@ -3283,6 +3287,16 @@
 API please use \-heartbeat\-cmd instead.
 .
 .TP
+.B \-title (also see \-use\-filename\-title)
+Set the window title.
+Supported by X11 based video output drivers.
+.
+.TP
+.B \-use\-filename\-title (also see \-title)
+Set the window title using the media file name, when not set with \-title.
+Supported by X11 based video output drivers.
+.
+.TP
 .B "\-vm \ \ \ "
 Try to change to a different video mode.
 Supported by the dga, x11, xv, sdl and directx video output drivers.
--- a/cfg-mplayer.h	Wed Nov 11 22:26:38 2009 +0000
+++ b/cfg-mplayer.h	Thu Nov 12 09:21:53 2009 +0000
@@ -170,6 +170,9 @@
 	{"screenh", &vo_screenheight, CONF_TYPE_INT, CONF_RANGE|CONF_OLD, 0, 4096, NULL},
 	// Geometry string
 	{"geometry", &vo_geometry, CONF_TYPE_STRING, 0, 0, 0, NULL},
+	// vo name (X classname) and window title strings
+	{"name", &vo_winname, CONF_TYPE_STRING, 0, 0, 0, NULL},
+	{"title", &vo_wintitle, CONF_TYPE_STRING, 0, 0, 0, NULL},
 	// set aspect ratio of monitor - useful for 16:9 TV-out
 	{"monitoraspect", &force_monitor_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 9.0, NULL},
 	{"monitorpixelaspect", &monitor_pixel_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 9.0, NULL},
@@ -246,6 +249,8 @@
 
 	{"use-filedir-conf", &use_filedir_conf, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
 	{"nouse-filedir-conf", &use_filedir_conf, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL},
+	{"use-filename-title", &use_filename_title, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
+	{"nouse-filename-title", &use_filename_title, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL},
 #ifdef CONFIG_CRASH_DEBUG
 	{"crash-debug", &crash_debug, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
 	{"nocrash-debug", &crash_debug, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL},
--- a/libvo/video_out.c	Wed Nov 11 22:26:38 2009 +0000
+++ b/libvo/video_out.c	Thu Nov 12 09:21:53 2009 +0000
@@ -79,6 +79,11 @@
 int vo_colorkey = 0x0000ff00; // default colorkey is green
                               // (0xff000000 means that colorkey has been disabled)
 
+// name to be used instead of the vo's default
+char *vo_winname;
+// title to be applied to movie window
+char *vo_wintitle;
+
 //
 // Externally visible list of all vo drivers
 //
--- a/libvo/video_out.h	Wed Nov 11 22:26:38 2009 +0000
+++ b/libvo/video_out.h	Thu Nov 12 09:21:53 2009 +0000
@@ -250,6 +250,9 @@
 
 extern int vo_colorkey;
 
+extern char *vo_winname;
+extern char *vo_wintitle;
+
 extern int64_t WinID;
 
 typedef struct {
--- a/libvo/x11_common.c	Wed Nov 11 22:26:38 2009 +0000
+++ b/libvo/x11_common.c	Thu Nov 12 09:21:53 2009 +0000
@@ -738,7 +738,7 @@
     XClassHint wmClass;
     pid_t pid = getpid();
 
-    wmClass.res_name = name;
+    wmClass.res_name = vo_winname ? vo_winname : name;
     wmClass.res_class = "MPlayer";
     XSetClassHint(display, window, &wmClass);
     XChangeProperty(display, window, XA_NET_WM_PID, XA_CARDINAL, 32,
@@ -1335,6 +1335,9 @@
     if (w <= INT_MAX && h <= INT_MAX) { vo_dwidth = w; vo_dheight = h; }
     XTranslateCoordinates(mDisplay, vo_window, mRootWin, 0, 0, &vo_dx, &vo_dy,
                           &dummy_win);
+    if (vo_wintitle)
+        XStoreName(mDisplay, vo_window, vo_wintitle);
+
     return depth <= INT_MAX ? depth : 0;
 }
 
--- a/mplayer.c	Wed Nov 11 22:26:38 2009 +0000
+++ b/mplayer.c	Thu Nov 12 09:21:53 2009 +0000
@@ -349,6 +349,7 @@
 short edl_decision = 0; ///< 1 when an EDL operation has been made.
 FILE* edl_fd = NULL; ///< fd to write to when in -edlout mode.
 int use_filedir_conf;
+int use_filename_title;
 
 static unsigned int initialized_flags=0;
 #include "mpcommon.h"
@@ -3089,9 +3090,12 @@
 }
 //---------------------------------------------------------------------------
 
-    if(filename)
+    if(filename) {
 	mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_Playing,
 		filename_recode(filename));
+        if(use_filename_title && vo_wintitle == NULL)
+            vo_wintitle = strdup ( mp_basename2 (filename));
+    }
 
 if (edl_filename) {
     if (edl_records) free_edl(edl_records);