[vlc-commits] vout: trigger callbacks also when reinitializing (fixes #6181)

Rémi Denis-Courmont git at videolan.org
Wed May 1 11:08:53 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed May  1 12:07:23 2013 +0300| [b634681bb9fb604cf2eedbfad83265d2357d4d3e] | committer: Rémi Denis-Courmont

vout: trigger callbacks also when reinitializing (fixes #6181)

The values and choices of video output variables are still all there.
But we need to resend the control request to video output thread
so that they apply to the new video output display.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b634681bb9fb604cf2eedbfad83265d2357d4d3e
---

 src/video_output/video_output.c  |    1 +
 src/video_output/vout_internal.h |    1 +
 src/video_output/vout_intf.c     |   34 ++++++++++++++++------------------
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 2db8b2d..35e7a18 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -221,6 +221,7 @@ vout_thread_t *(vout_Request)(vlc_object_t *object,
 
         if (!vout->p->dead) {
             msg_Dbg(object, "reusing provided vout");
+            vout_IntfReinit(vout);
             return vout;
         }
         vout_CloseAndRelease(vout);
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index d0de043..90ec3a3 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -154,6 +154,7 @@ void vout_ControlChangeSubMargin(vout_thread_t *, int);
 
 /* */
 void vout_IntfInit( vout_thread_t * );
+void vout_IntfReinit( vout_thread_t * );
 
 /* */
 int  vout_OpenWrapper (vout_thread_t *, const char *, const vout_display_state_t *);
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index e995c3a..aec8db6 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -197,7 +197,6 @@ void vout_IntfInit( vout_thread_t *p_vout )
     }
 
     var_AddCallback( p_vout, "zoom", ZoomCallback, NULL );
-    var_TriggerCallback( p_vout, "zoom" );
 
     /* Crop offset vars */
     var_Create( p_vout, "crop-left", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
@@ -236,12 +235,6 @@ void vout_IntfInit( vout_thread_t *p_vout )
     }
 
     var_AddCallback( p_vout, "crop", CropCallback, NULL );
-    psz_buf = var_GetNonEmptyString( p_vout, "crop" );
-    if( psz_buf != NULL )
-    {
-        var_TriggerCallback( p_vout, "crop" );
-        free( psz_buf );
-    }
 
     /* Monitor pixel aspect-ratio */
     var_Create( p_vout, "monitor-par", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
@@ -272,12 +265,6 @@ void vout_IntfInit( vout_thread_t *p_vout )
     }
 
     var_AddCallback( p_vout, "aspect-ratio", AspectCallback, NULL );
-    psz_buf = var_GetNonEmptyString( p_vout, "aspect-ratio" );
-    if( psz_buf != NULL )
-    {
-        var_TriggerCallback( p_vout, "aspect-ratio" );
-        free( psz_buf );
-    }
 
     /* Add a variable to indicate if the window should be on top of others */
     var_Create( p_vout, "video-on-top", VLC_VAR_BOOL | VLC_VAR_DOINHERIT
@@ -285,7 +272,6 @@ void vout_IntfInit( vout_thread_t *p_vout )
     text.psz_string = _("Always on top");
     var_Change( p_vout, "video-on-top", VLC_VAR_SETTEXT, &text, NULL );
     var_AddCallback( p_vout, "video-on-top", OnTopCallback, NULL );
-    var_TriggerCallback( p_vout, "video-on-top" );
 
     /* Add a variable to indicate whether we want window decoration or not */
     var_Create( p_vout, "video-deco", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
@@ -307,31 +293,43 @@ void vout_IntfInit( vout_thread_t *p_vout )
     var_Create( p_vout, "video-filter",
                 VLC_VAR_STRING | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND );
     var_AddCallback( p_vout, "video-filter", VideoFilterCallback, NULL );
-    var_TriggerCallback( p_vout, "video-filter" );
 
     /* Add a sub-source variable */
     var_Create( p_vout, "sub-source",
                 VLC_VAR_STRING | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND );
     var_AddCallback( p_vout, "sub-source", SubSourceCallback, NULL );
-    var_TriggerCallback( p_vout, "sub-source" );
 
     /* Add a sub-filter variable */
     var_Create( p_vout, "sub-filter",
                 VLC_VAR_STRING | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND );
     var_AddCallback( p_vout, "sub-filter", SubFilterCallback, NULL );
-    var_TriggerCallback( p_vout, "sub-filter" );
 
     /* Add sub-margin variable */
     var_Create( p_vout, "sub-margin",
                 VLC_VAR_INTEGER | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND );
     var_AddCallback( p_vout, "sub-margin", SubMarginCallback, NULL );
-    var_TriggerCallback( p_vout, "sub-margin" );
 
     /* Mouse coordinates */
     var_Create( p_vout, "mouse-button-down", VLC_VAR_INTEGER );
     var_Create( p_vout, "mouse-moved", VLC_VAR_COORDS );
     var_Create( p_vout, "mouse-clicked", VLC_VAR_COORDS );
     var_Create( p_vout, "mouse-object", VLC_VAR_BOOL );
+
+    vout_IntfReinit( p_vout );
+}
+
+void vout_IntfReinit( vout_thread_t *p_vout )
+{
+    var_TriggerCallback( p_vout, "zoom" );
+    var_TriggerCallback( p_vout, "crop" );
+    var_TriggerCallback( p_vout, "aspect-ratio" );
+
+    var_TriggerCallback( p_vout, "video-on-top" );
+
+    var_TriggerCallback( p_vout, "video-filter" );
+    var_TriggerCallback( p_vout, "sub-source" );
+    var_TriggerCallback( p_vout, "sub-filter" );
+    var_TriggerCallback( p_vout, "sub-margin" );
 }
 
 /*****************************************************************************



More information about the vlc-commits mailing list