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

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


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed May  1 11:22:30 2013 +0300| [1e5b4699eb66d5f5367aaa9ce1a50e090674d844] | 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=1e5b4699eb66d5f5367aaa9ce1a50e090674d844
---

 src/video_output/video_output.c  |    1 +
 src/video_output/vout_internal.h |    1 +
 src/video_output/vout_intf.c     |   30 ++++++++++++++++--------------
 3 files changed, 18 insertions(+), 14 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 9924a6b..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,10 +235,6 @@ void vout_IntfInit( vout_thread_t *p_vout )
     }
 
     var_AddCallback( p_vout, "crop", CropCallback, NULL );
-    var_Get( p_vout, "crop", &old_val );
-    if( old_val.psz_string && *old_val.psz_string )
-        var_TriggerCallback( p_vout, "crop" );
-    free( old_val.psz_string );
 
     /* Monitor pixel aspect-ratio */
     var_Create( p_vout, "monitor-par", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
@@ -270,10 +265,6 @@ void vout_IntfInit( vout_thread_t *p_vout )
     }
 
     var_AddCallback( p_vout, "aspect-ratio", AspectCallback, NULL );
-    var_Get( p_vout, "aspect-ratio", &old_val );
-    if( (old_val.psz_string && *old_val.psz_string) )
-        var_TriggerCallback( p_vout, "aspect-ratio" );
-    free( old_val.psz_string );
 
     /* 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
@@ -281,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 );
@@ -303,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