* src/libvlc.h, modules/video_output/directx/events.c:
authorGildas Bazin <gbazin@videolan.org>
Thu, 1 Apr 2004 11:16:10 +0000 (11:16 +0000)
committerGildas Bazin <gbazin@videolan.org>
Thu, 1 Apr 2004 11:16:10 +0000 (11:16 +0000)
   + added a --video-title option, courtesy of Hornsby Adrian.
* modules/video_output/directx/directx.c: minor changes.

modules/video_output/directx/directx.c
modules/video_output/directx/events.c
src/libvlc.h

index 2ba1032..e37f2a1 100644 (file)
@@ -208,6 +208,7 @@ static int OpenVideo( vlc_object_t *p_this )
     var_Create( p_vout, "directx-hw-yuv", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
     var_Create( p_vout, "directx-3buffering", VLC_VAR_BOOL|VLC_VAR_DOINHERIT );
     var_Create( p_vout, "directx-device", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
+    var_Create( p_vout, "video-title", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
 
     p_vout->p_sys->b_cursor_hidden = 0;
     p_vout->p_sys->i_lastmoved = mdate();
@@ -457,6 +458,8 @@ static int Manage( vout_thread_t *p_vout )
      */
     if( p_vout->p_sys->i_changes & DX_POSITION_CHANGE )
     {
+        p_vout->p_sys->i_changes &= ~DX_POSITION_CHANGE;
+
         if( p_vout->p_sys->b_using_overlay )
             DirectXUpdateOverlay( p_vout );
 
@@ -469,8 +472,6 @@ static int Manage( vout_thread_t *p_vout )
             /* This will force the vout core to recreate the picture buffers */
             p_vout->i_changes |= VOUT_PICTURE_BUFFERS_CHANGE;
         }
-
-        p_vout->p_sys->i_changes &= ~DX_POSITION_CHANGE;
     }
 
     /* We used to call the Win32 PeekMessage function here to read the window
@@ -1087,6 +1088,8 @@ int DirectXUpdateOverlay( vout_thread_t *p_vout )
     DDOVERLAYFX     ddofx;
     DWORD           dwFlags;
     HRESULT         dxresult;
+    RECT            rect_src = p_vout->p_sys->rect_src_clipped;
+    RECT            rect_dest = p_vout->p_sys->rect_dest_clipped;
 
     if( p_vout->p_sys->p_current_surface == NULL ||
         !p_vout->p_sys->b_using_overlay )
@@ -1104,15 +1107,12 @@ int DirectXUpdateOverlay( vout_thread_t *p_vout )
     dwFlags = DDOVER_SHOW | DDOVER_KEYDESTOVERRIDE;
 
     dxresult = IDirectDrawSurface2_UpdateOverlay(
-                                         p_vout->p_sys->p_current_surface,
-                                         &p_vout->p_sys->rect_src_clipped,
-                                         p_vout->p_sys->p_display,
-                                         &p_vout->p_sys->rect_dest_clipped,
-                                         dwFlags, &ddofx );
+                   p_vout->p_sys->p_current_surface,
+                   &rect_src, p_vout->p_sys->p_display, &rect_dest,
+                   dwFlags, &ddofx );
     if(dxresult != DD_OK)
     {
-        msg_Warn( p_vout,
-                  "DirectXUpdateOverlay cannot move or resize overlay" );
+        msg_Warn( p_vout, "DirectXUpdateOverlay cannot move/resize overlay" );
         return VLC_EGENERIC;
     }
 
index 62a46d8..357b86e 100644 (file)
@@ -272,14 +272,23 @@ void DirectXEventThread( event_thread_t *p_event )
             break;
 
         case WM_VLC_CHANGE_TEXT:
-            if( p_event->p_vout->p_sys->b_using_overlay )
-                SetWindowText( p_event->p_vout->p_sys->hwnd,
-                    VOUT_TITLE " (hardware YUV overlay DirectX output)" );
-            else if( p_event->p_vout->p_sys->b_hw_yuv )
-                SetWindowText( p_event->p_vout->p_sys->hwnd,
-                    VOUT_TITLE " (hardware YUV DirectX output)" );
-            else SetWindowText( p_event->p_vout->p_sys->hwnd,
-                    VOUT_TITLE " (software RGB DirectX output)" );
+            var_Get( p_event->p_vout, "video-title", &val );
+
+            if( !val.psz_string || !*val.psz_string ) /* Default video title */
+            {
+                if( p_event->p_vout->p_sys->b_using_overlay )
+                    SetWindowText( p_event->p_vout->p_sys->hwnd,
+                        VOUT_TITLE " (hardware YUV overlay DirectX output)" );
+                else if( p_event->p_vout->p_sys->b_hw_yuv )
+                    SetWindowText( p_event->p_vout->p_sys->hwnd,
+                        VOUT_TITLE " (hardware YUV DirectX output)" );
+                else SetWindowText( p_event->p_vout->p_sys->hwnd,
+                        VOUT_TITLE " (software RGB DirectX output)" );
+            }
+            else
+            {
+                SetWindowText( p_event->p_vout->p_sys->hwnd, val.psz_string );
+            }
             break;
 
         default:
index 24bf049..d219c10 100644 (file)
@@ -205,6 +205,10 @@ static char *ppsz_language_text[] =
     "You can enforce the position of the top left corner of the video window "\
     "here (y coordinate).")
 
+#define VIDEO_TITLE_TEXT N_("Video title")
+#define VIDEO_TITLE_LONGTEXT N_( \
+    "You can specify a custom video window title here.")
+
 #define ALIGN_TEXT N_("Video alignment")
 #define ALIGN_LONGTEXT N_( \
     "You can enforce the video alignement in its window. By default (0) it " \
@@ -778,6 +782,8 @@ vlc_module_begin();
     add_integer( "height", -1, NULL, HEIGHT_TEXT, HEIGHT_LONGTEXT, VLC_TRUE );
     add_integer( "video-x", -1, NULL, VIDEOX_TEXT, VIDEOX_LONGTEXT, VLC_TRUE );
     add_integer( "video-y", -1, NULL, VIDEOY_TEXT, VIDEOY_LONGTEXT, VLC_TRUE );
+    add_string( "video-title", NULL, NULL, VIDEO_TITLE_TEXT,
+                 VIDEO_TITLE_LONGTEXT, VLC_TRUE );
     add_integer( "align", 0, NULL, ALIGN_TEXT, ALIGN_LONGTEXT, VLC_TRUE );
         change_integer_list( pi_align_values, ppsz_align_descriptions, 0 );
     add_float( "zoom", 1, NULL, ZOOM_TEXT, ZOOM_LONGTEXT, VLC_TRUE );