[MPlayer-dev-eng] [PATCH] directx rootwin support

Joey Parrish joey at nicewarrior.org
Fri Aug 13 01:29:07 CEST 2004


On Thu, Aug 12, 2004 at 06:55:47AM -0400, Diego Biurrun wrote:
> Joey Parrish writes:
> > This first patch adds -rootwin support to vo_directx.  It's pretty
> > simple and straightforward.  I see no reason not to commit this, but
> > feel free to correct me.

> Please also update the manual page saying that directx now supports
> -rootwin as well.

Done.  Updated all but chinese, which I can't even make an educated
guess about.

> > The second patch adds VOCTRL_ROOTWIN and MP_CMD_VO_ROOTWIN to allow
> > toggling rootwin at runtime.  I am only adding support for this VOCTRL
> > to vo_directx at the moment.  I don't know whether any other vo's can
> > support this or not.  X11 people should look into that.

> Please also add the new command to DOCS/tech/slave.txt.

Done.
Updated patch attached.  If you want to see behavior on directx just like
X11 -rootwin, then use rootwin and fs together.

--Joey

-- 
"Ours is not to question why, 'cause if we did,
  our heads would explode." --Megan
-------------- next part --------------
adds rootwin support to vo_directx

diff -ur main.sofar/DOCS/man/de/mplayer.1 main.dev/DOCS/man/de/mplayer.1
--- main.sofar/DOCS/man/de/mplayer.1	2004-07-19 23:43:55.000000000 +0000
+++ main.dev/DOCS/man/de/mplayer.1	2004-08-12 23:14:44.137601600 +0000
@@ -1992,8 +1992,8 @@
 .TP
 .B \-rootwin
 Zeigt den Film im Root-Fenster (dem Desktophintergrund) an, anstatt ein
-neues Fenster zu ?ffnen. Funktioniert nur mit den x11-, xv-, xmga- und
-xvidix-Treibern.
+neues Fenster zu ?ffnen. Funktioniert nur mit den x11-, xv-, xmga-,
+xvidix-, und directx-Treibern.
 .TP
 .B \-saturation <\-100\-100>
 Passt die S?ttigung der Videoausgabe an (Standard: 0).
diff -ur main.sofar/DOCS/man/en/mplayer.1 main.dev/DOCS/man/en/mplayer.1
--- main.sofar/DOCS/man/en/mplayer.1	2004-08-11 02:36:54.000000000 +0000
+++ main.dev/DOCS/man/en/mplayer.1	2004-08-12 23:14:02.708028800 +0000
@@ -1990,10 +1990,10 @@
 Set the monitor refreshrate in Hz.
 Currently only supported by \-vo directx combined with the \-vm option.
 .TP
-.B \-rootwin (X11 only)
+.B \-rootwin (X11 and DirectX only)
 Play movie in the root window (desktop background) instead of opening
 a new one.
-Works only with x11, xv, xmga and xvidix drivers.
+Works only with x11, xv, xmga, xvidix and directx drivers.
 .TP
 .B \-saturation <-100\-100>
 Adjust saturation of video output (default: 0).
diff -ur main.sofar/DOCS/man/es/mplayer.1 main.dev/DOCS/man/es/mplayer.1
--- main.sofar/DOCS/man/es/mplayer.1	2004-08-02 18:01:45.000000000 +0000
+++ main.dev/DOCS/man/es/mplayer.1	2004-08-12 23:15:43.092374400 +0000
@@ -2018,10 +2018,10 @@
 Actualmente solo est? soportado por \-vo directx combinado con la opci?n
 \-vm.
 .TP
-.B \-rootwin (X11 solamente)
+.B \-rootwin (X11 y DirectX solamente)
 Reproduce la pel?cula en la ventana ra?z (fondo de escritorio) en lugar
 de abrir una nueva.
-Funciona solo con los controladores de x11, xv, xmga y xvidix.
+Funciona solo con los controladores de x11, xv, xmga, xvidix y directx.
 .TP
 .B \-saturation <-100\-100>
 Ajusta la saturaci?n de la salida de video (por defecto: 0).
diff -ur main.sofar/DOCS/man/fr/mplayer.1 main.dev/DOCS/man/fr/mplayer.1
--- main.sofar/DOCS/man/fr/mplayer.1	2004-07-21 14:08:44.000000000 +0000
+++ main.dev/DOCS/man/fr/mplayer.1	2004-08-12 23:16:12.064033600 +0000
@@ -1875,7 +1875,8 @@
 .B \-rootwin
 Joue le film dans la fen?tre root (le fond du bureau) au lieu d'en ouvrir
 une nouvelle.
-Cette option ne fonctionne qu'avec les pilotes x11, xv, xmga et xvidix.
+Cette option ne fonctionne qu'avec les pilotes x11, xv, xmga, xvidix et
+directx.
 .TP
 .B \-saturation <-100\-100>
 Ajuste la saturation du signal vid?o (0 par d?faut).
diff -ur main.sofar/DOCS/man/hu/mplayer.1 main.dev/DOCS/man/hu/mplayer.1
--- main.sofar/DOCS/man/hu/mplayer.1	2004-07-21 14:08:45.000000000 +0000
+++ main.dev/DOCS/man/hu/mplayer.1	2004-08-12 23:16:29.258758400 +0000
@@ -1750,7 +1750,7 @@
 .B \-rootwin
 A film root ablakban (asztal h?tter?ben) t?rt?n? lej?tsz?sa, ?j ablak
 nyit?sa helyett.
-Csak az x11, xv, xmga ?s xvidix meghajt?kkal.
+Csak az x11, xv, xmga, xvidix ?s directx meghajt?kkal.
 .TP
 .B \-saturation <\-100\-100>
 Video kimenet szatur?ci?j?nak be?ll?t?sa (alap: 0).
diff -ur main.sofar/DOCS/man/it/mplayer.1 main.dev/DOCS/man/it/mplayer.1
--- main.sofar/DOCS/man/it/mplayer.1	2004-08-02 18:01:46.000000000 +0000
+++ main.dev/DOCS/man/it/mplayer.1	2004-08-12 23:16:52.412051200 +0000
@@ -2058,10 +2058,10 @@
 Attualmente e' supportato solo dal driver \-vo directx combinato con
 l' opzione \-vm.
 .TP
-.B \-rootwin (solo X11)
+.B \-rootwin (solo X11 e DirectX)
 Visualizza il filmato nella finestra root (lo sfondo del desktop) invece
 che aprire una nuova finestra.
-Funziona solo con i driver x11, xv, xmga e xvidix.
+Funziona solo con i driver x11, xv, xmga, xvidix e directx.
 .TP
 .B \-saturation <-100\-100>
 Regola la saturazione dell' uscita video (default: 0).
diff -ur main.sofar/DOCS/man/pl/mplayer.1 main.dev/DOCS/man/pl/mplayer.1
--- main.sofar/DOCS/man/pl/mplayer.1	2004-08-11 02:36:54.000000000 +0000
+++ main.dev/DOCS/man/pl/mplayer.1	2004-08-12 23:17:09.015926400 +0000
@@ -1992,9 +1992,9 @@
 Ustawia cz?stotliwo?? od?wie?ania monitora.
 Obecnie opcja ta jest obs?ugiwana tylko przez \-vo directx razem z \-vm.
 .TP
-.B \-rootwin (tylko X11)
+.B \-rootwin (tylko X11 i DirectX)
 Odtwarza film w g??wnym oknie (t?o pulpitu) zamiast otwierania nowego okna.
-Dzia?a tylko ze sterownikami x11, xv, xmga i xvidix.
+Dzia?a tylko ze sterownikami x11, xv, xmga, xvidix i directx.
 .TP
 .B \-saturation <-100\-100>
 Modyfikuje nasycenie wyj?cia video (domy?lnie 0).
diff -ur main.sofar/libvo/vo_directx.c main.dev/libvo/vo_directx.c
--- main.sofar/libvo/vo_directx.c	2004-07-19 23:19:50.000000000 +0000
+++ main.dev/libvo/vo_directx.c	2004-08-12 23:12:41.391100800 +0000
@@ -69,6 +69,7 @@
 extern int vo_fs;
 extern int vo_directrendering;
 extern int vo_ontop;
+extern int vo_rootwin;
 extern int vidmode;
 
 /*****************************************************************************
@@ -600,9 +601,9 @@
           RECT rdw=rd;
           AdjustWindowRect(&rdw,WS_OVERLAPPEDWINDOW|WS_SIZEBOX,FALSE);
 //          printf("window: %i %i %ix%i\n",rdw.left,rdw.top,rdw.right - rdw.left,rdw.bottom - rdw.top);      
-          SetWindowPos(hWnd,(vo_ontop)?HWND_TOPMOST:HWND_NOTOPMOST,rdw.left,rdw.top,rdw.right-rdw.left,rdw.bottom-rdw.top,SWP_NOOWNERZORDER); 
+          SetWindowPos(hWnd,(vo_ontop)?HWND_TOPMOST:(vo_rootwin?HWND_BOTTOM:HWND_NOTOPMOST),rdw.left,rdw.top,rdw.right-rdw.left,rdw.bottom-rdw.top,SWP_NOOWNERZORDER); 
     }
-    else SetWindowPos(hWndFS,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOOWNERZORDER);
+    else SetWindowPos(hWndFS,vo_rootwin?HWND_BOTTOM:HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOOWNERZORDER);
 
   	/*for nonoverlay mode we are finished, for overlay mode we have to display the overlay first*/
 	if(nooverlay)return 0;
@@ -1267,8 +1268,18 @@
 			}
 	        else
 			{
-			    if(!vo_fs){vo_fs=1;ShowWindow(hWndFS,SW_SHOW);}  
-                else {vo_fs=0; ShowWindow(hWndFS,SW_HIDE);}  
+			    if(!vo_fs)
+				{
+					vo_fs=1;
+					ShowWindow(hWndFS,SW_SHOW);
+					ShowWindow(hWnd,SW_HIDE);
+				}
+                else
+				{
+					vo_fs=0;
+					ShowWindow(hWndFS,SW_HIDE);
+					ShowWindow(hWnd,SW_SHOW);
+				}  
 				Directx_ManageDisplay();
                 break;				
 			}
-------------- next part --------------
adds runtime toggle of root window playback
  only supported by vo_directx at the moment

diff -ur main.sofar/DOCS/tech/slave.txt main.dev/DOCS/tech/slave.txt
--- main.sofar/DOCS/tech/slave.txt	2004-04-27 07:21:35.000000000 +0000
+++ main.dev/DOCS/tech/slave.txt	2004-08-12 23:24:59.502452800 +0000
@@ -90,6 +90,10 @@
 	Toggle stay-on-top. Supported by drivers which use X11, except SDL,
 	as well as directx and gl2 under Windows.
 
+vo_rootwin
+	Toggle playback on the root window. This runtime toggle is only
+	supported by the directx driver at the moment.
+
 panscan <value> [value2]
     ???
 
diff -ur main.sofar/input/input.c main.dev/input/input.c
--- main.sofar/input/input.c	2004-08-10 03:07:23.000000000 +0000
+++ main.dev/input/input.c	2004-08-12 23:19:07.285990400 +0000
@@ -100,6 +100,7 @@
 #endif
   { MP_CMD_VO_FULLSCREEN, "vo_fullscreen", 0, { {-1,{0}} } },
   { MP_CMD_VO_ONTOP, "vo_ontop", 0, { {-1,{0}} } },
+  { MP_CMD_VO_ROOTWIN, "vo_rootwin", 0, { {-1,{0}} } },
   { MP_CMD_SCREENSHOT, "screenshot", 0, { {-1,{0}} } },
   { MP_CMD_PANSCAN, "panscan",1,  { {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
   { MP_CMD_LOADFILE, "loadfile", 1, { {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } },
diff -ur main.sofar/input/input.h main.dev/input/input.h
--- main.sofar/input/input.h	2004-07-17 12:47:12.000000000 +0000
+++ main.dev/input/input.h	2004-08-12 23:19:07.316033600 +0000
@@ -54,6 +54,7 @@
 #define MP_CMD_SUB_FORCED_ONLY 50
 #define MP_CMD_VO_ONTOP 51
 #define MP_CMD_SUB_SELECT 52
+#define MP_CMD_VO_ROOTWIN 53
 
 #define MP_CMD_GUI_EVENTS       5000
 #define MP_CMD_GUI_LOADFILE     5001
diff -ur main.sofar/libvo/video_out.h main.dev/libvo/video_out.h
--- main.sofar/libvo/video_out.h	2004-08-02 18:01:57.000000000 +0000
+++ main.dev/libvo/video_out.h	2004-08-12 23:19:07.346076800 +0000
@@ -56,6 +56,7 @@
 #define VOCTRL_START_SLICE 21
 
 #define VOCTRL_ONTOP 25
+#define VOCTRL_ROOTWIN 26
 
 // Vo can be used by xover
 #define VOCTRL_XOVERLAY_SUPPORT 22
diff -ur main.sofar/libvo/vo_directx.c main.dev/libvo/vo_directx.c
--- main.sofar/libvo/vo_directx.c	2004-08-12 23:26:41.058483200 +0000
+++ main.dev/libvo/vo_directx.c	2004-08-12 23:19:07.386134400 +0000
@@ -1260,6 +1260,18 @@
 				Directx_ManageDisplay();
 			}
 		return VO_TRUE;
+    case VOCTRL_ROOTWIN:
+	        if(vidmode)
+			{
+				mp_msg(MSGT_VO, MSGL_ERR,"<vo_directx><ERROR>rootwin has no meaning in exclusive mode\n");
+			}
+	        else
+			{
+				if(vo_rootwin) vo_rootwin = 0;
+				else vo_rootwin = 1;
+				Directx_ManageDisplay();
+			}
+		return VO_TRUE;
     case VOCTRL_FULLSCREEN:
 		{
 	        if(vidmode)
diff -ur main.sofar/mplayer.c main.dev/mplayer.c
--- main.sofar/mplayer.c	2004-08-10 03:07:21.000000000 +0000
+++ main.dev/mplayer.c	2004-08-12 23:19:07.426192000 +0000
@@ -748,6 +748,7 @@
 int osd_show_percentage = 0;
 int osd_show_tv_channel = 25;
 int osd_show_ontop = 0;
+int osd_show_rootwin = 0;
 int osd_show_framedropping = 0;
 
 int rtc_fd=-1;
@@ -3042,6 +3043,17 @@
      }
 
     } break;
+    case MP_CMD_VO_ROOTWIN:
+    {
+     if(video_out && vo_config_count) {
+       video_out->control(VOCTRL_ROOTWIN, 0);
+#ifdef USE_OSD
+       osd_show_ontop=10;
+       vo_osd_changed(OSDTYPE_SUBTITLE);
+#endif
+     }
+
+    } break;
     case MP_CMD_PANSCAN : {
       if ( !video_out ) break;
       if ( video_out->control( VOCTRL_GET_PANSCAN,NULL ) == VO_TRUE )
@@ -3599,6 +3611,9 @@
       } else if (osd_show_ontop) {
 	  snprintf(osd_text_tmp, 63, "Stay on top: %sabled", vo_ontop?"en":"dis");
 	  osd_show_ontop--;
+      } else if (osd_show_rootwin) {
+	  snprintf(osd_text_tmp, 63, "Rootwin: %sabled", vo_rootwin?"en":"dis");
+	  osd_show_rootwin--;
       } else if (osd_show_framedropping) {
 	  snprintf(osd_text_tmp, 63, "Framedropping: %s",
 	     (frame_dropping == 1 ? "on" :


More information about the MPlayer-dev-eng mailing list