Index: libvo/x11_common.c
===================================================================
--- libvo/x11_common.c	(revisione 29903)
+++ libvo/x11_common.c	(copia locale)
@@ -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;
 }
 
Index: libvo/video_out.c
===================================================================
--- libvo/video_out.c	(revisione 29903)
+++ libvo/video_out.c	(copia locale)
@@ -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
 //
Index: libvo/video_out.h
===================================================================
--- libvo/video_out.h	(revisione 29903)
+++ libvo/video_out.h	(copia locale)
@@ -250,6 +250,9 @@
 
 extern int vo_colorkey;
 
+extern char *vo_winname;
+extern char *vo_wintitle;
+
 extern int64_t WinID;
 
 typedef struct {
Index: DOCS/man/en/mplayer.1
===================================================================
--- DOCS/man/en/mplayer.1	(revisione 29903)
+++ DOCS/man/en/mplayer.1	(copia locale)
@@ -3283,6 +3283,22 @@
 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.
+.br
+.I WARNING:
+Does not work with \-fixed\-vo.
+.
+.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.
+.br
+.I WARNING:
+Does not work with \-fixed\-vo.
+.
+.TP
 .B "\-vm \ \ \ "
 Try to change to a different video mode.
 Supported by the dga, x11, xv, sdl and directx video output drivers.
Index: mplayer.c
===================================================================
--- mplayer.c	(revisione 29903)
+++ mplayer.c	(copia locale)
@@ -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);
Index: cfg-mplayer.h
===================================================================
--- cfg-mplayer.h	(revisione 29903)
+++ cfg-mplayer.h	(copia locale)
@@ -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},

