[MPlayer-cvslog] r29904 - in trunk: DOCS/man/en/mplayer.1 cfg-mplayer.h libvo/video_out.c libvo/video_out.h libvo/x11_common.c mplayer.c

ptt subversion at mplayerhq.hu
Thu Nov 12 10:21:53 CET 2009


Author: ptt
Date: Thu Nov 12 10:21:53 2009
New Revision: 29904

Log:
Added -name, -title and -use-filenam-title options and implementation in X11 vos

Modified:
   trunk/cfg-mplayer.h
   trunk/libvo/video_out.c
   trunk/libvo/video_out.h
   trunk/libvo/x11_common.c
   trunk/mplayer.c

Changes in other areas also in this revision:
Modified:
   trunk/DOCS/man/en/mplayer.1

Modified: trunk/cfg-mplayer.h
==============================================================================
--- trunk/cfg-mplayer.h	Wed Nov 11 23:26:38 2009	(r29903)
+++ trunk/cfg-mplayer.h	Thu Nov 12 10:21:53 2009	(r29904)
@@ -170,6 +170,9 @@ const m_option_t mplayer_opts[]={
 	{"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 @@ const m_option_t mplayer_opts[]={
 
 	{"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},

Modified: trunk/libvo/video_out.c
==============================================================================
--- trunk/libvo/video_out.c	Wed Nov 11 23:26:38 2009	(r29903)
+++ trunk/libvo/video_out.c	Thu Nov 12 10:21:53 2009	(r29904)
@@ -79,6 +79,11 @@ int vo_directrendering=0;
 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
 //

Modified: trunk/libvo/video_out.h
==============================================================================
--- trunk/libvo/video_out.h	Wed Nov 11 23:26:38 2009	(r29903)
+++ trunk/libvo/video_out.h	Thu Nov 12 10:21:53 2009	(r29904)
@@ -250,6 +250,9 @@ extern char *vo_subdevice;
 
 extern int vo_colorkey;
 
+extern char *vo_winname;
+extern char *vo_wintitle;
+
 extern int64_t WinID;
 
 typedef struct {

Modified: trunk/libvo/x11_common.c
==============================================================================
--- trunk/libvo/x11_common.c	Wed Nov 11 23:26:38 2009	(r29903)
+++ trunk/libvo/x11_common.c	Thu Nov 12 10:21:53 2009	(r29904)
@@ -738,7 +738,7 @@ void vo_x11_classhint(Display * display,
     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 @@ int vo_x11_update_geometry(void) {
     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;
 }
 

Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c	Wed Nov 11 23:26:38 2009	(r29903)
+++ trunk/mplayer.c	Thu Nov 12 10:21:53 2009	(r29904)
@@ -349,6 +349,7 @@ edl_record_ptr next_edl_record = NULL; /
 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 @@ while (player_idle_mode && !filename) {
 }
 //---------------------------------------------------------------------------
 
-    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);


More information about the MPlayer-cvslog mailing list