[vlc-commits] vout: split vout_IntfInit

Thomas Guillem git at videolan.org
Fri May 10 09:51:30 CEST 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu May  9 16:26:04 2019 +0200| [d1b940c32f74465be940ef02a02d241e0445a5b3] | committer: Thomas Guillem

vout: split vout_IntfInit

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

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

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 7751d5f34d..d09e88f281 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1784,6 +1784,7 @@ vout_thread_t *vout_Create(vlc_object_t *object)
      * visible and callbacks not triggerable before this function returns the
      * fully initialized object to its caller.
      */
+    vout_CreateVars(vout);
     vout_IntfInit(vout);
 
     vout_thread_sys_t *sys = (vout_thread_sys_t *)&vout[1];
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index 20b220e872..28d8c05e28 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -245,6 +245,7 @@ void vout_ChangeSubMargin(vout_thread_t *, int);
 void vout_ChangeViewpoint( vout_thread_t *, const vlc_viewpoint_t *);
 
 /* */
+void vout_CreateVars( vout_thread_t * );
 void vout_IntfInit( vout_thread_t * );
 void vout_IntfReinit( vout_thread_t * );
 void vout_IntfDeinit(vlc_object_t *);
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index 260c160ab4..238e0c44da 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -148,7 +148,7 @@ static void AddCustomRatios( vout_thread_t *p_vout, const char *psz_var,
     }
 }
 
-void vout_IntfInit( vout_thread_t *p_vout )
+void vout_CreateVars( vout_thread_t *p_vout )
 {
     vlc_value_t val;
     char *psz_buf;
@@ -168,12 +168,10 @@ void vout_IntfInit( vout_thread_t *p_vout )
     var_Create( p_vout, "autoscale", VLC_VAR_BOOL | VLC_VAR_DOINHERIT
                 | VLC_VAR_ISCOMMAND );
     var_Change( p_vout, "autoscale", VLC_VAR_SETTEXT, _("Autoscale video") );
-    var_AddCallback( p_vout, "autoscale", AutoScaleCallback, NULL );
 
     var_Create( p_vout, "zoom", VLC_VAR_FLOAT | VLC_VAR_ISCOMMAND |
                 VLC_VAR_DOINHERIT );
     var_Change( p_vout, "zoom", VLC_VAR_SETTEXT, _("Zoom") );
-
     for( size_t i = 0; i < ARRAY_SIZE(p_zoom_values); i++ )
     {
         val.f_float = p_zoom_values[i].f_value;
@@ -181,19 +179,12 @@ void vout_IntfInit( vout_thread_t *p_vout )
                     vlc_gettext( p_zoom_values[i].psz_label ) );
     }
 
-    var_AddCallback( p_vout, "zoom", ZoomCallback, NULL );
-
     /* Crop offset vars */
     var_Create( p_vout, "crop-left", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
     var_Create( p_vout, "crop-top", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
     var_Create( p_vout, "crop-right", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
     var_Create( p_vout, "crop-bottom", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
 
-    var_AddCallback( p_vout, "crop-left", CropBorderCallback, NULL );
-    var_AddCallback( p_vout, "crop-top", CropBorderCallback, NULL );
-    var_AddCallback( p_vout, "crop-right", CropBorderCallback, NULL );
-    var_AddCallback( p_vout, "crop-bottom", CropBorderCallback, NULL );
-
     /* Crop object var */
     var_Create( p_vout, "crop", VLC_VAR_STRING | VLC_VAR_ISCOMMAND |
                 VLC_VAR_DOINHERIT );
@@ -214,8 +205,6 @@ void vout_IntfInit( vout_thread_t *p_vout )
         free( psz_buf );
     }
 
-    var_AddCallback( p_vout, "crop", CropCallback, NULL );
-
     /* Monitor pixel aspect-ratio */
     var_Create( p_vout, "monitor-par", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
 
@@ -239,18 +228,14 @@ void vout_IntfInit( vout_thread_t *p_vout )
         free( psz_buf );
     }
 
-    var_AddCallback( p_vout, "aspect-ratio", AspectCallback, NULL );
-
     /* 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
                 | VLC_VAR_ISCOMMAND );
     var_Change( p_vout, "video-on-top", VLC_VAR_SETTEXT,
                 _("Always on top") );
-    var_AddCallback( p_vout, "video-on-top", AboveCallback, NULL );
 
     /* Add a variable to indicate if the window should be below all others */
     var_Create( p_vout, "video-wallpaper", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
-    var_AddCallback( p_vout, "video-wallpaper", WallPaperCallback, NULL );
 
     /* Add a variable to indicate whether we want window decoration or not */
     var_Create( p_vout, "video-deco", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
@@ -259,32 +244,26 @@ void vout_IntfInit( vout_thread_t *p_vout )
     var_Create( p_vout, "fullscreen",
                 VLC_VAR_BOOL | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND );
     var_Change( p_vout, "fullscreen", VLC_VAR_SETTEXT, _("Fullscreen") );
-    var_AddCallback( p_vout, "fullscreen", FullscreenCallback, NULL );
 
     /* Add a snapshot variable */
     var_Create( p_vout, "video-snapshot", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
     var_Change( p_vout, "video-snapshot", VLC_VAR_SETTEXT, _("Snapshot") );
-    var_AddCallback( p_vout, "video-snapshot", SnapshotCallback, NULL );
 
     /* Add a video-filter variable */
     var_Create( p_vout, "video-filter",
                 VLC_VAR_STRING | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND );
-    var_AddCallback( p_vout, "video-filter", VideoFilterCallback, NULL );
 
     /* 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 );
 
     /* 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 );
 
     /* 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 );
 
     /* Mouse coordinates */
     var_Create( p_vout, "mouse-button-down", VLC_VAR_INTEGER );
@@ -296,10 +275,30 @@ void vout_IntfInit( vout_thread_t *p_vout )
 
     /* Viewpoint */
     var_Create( p_vout, "viewpoint", VLC_VAR_ADDRESS  );
-    var_AddCallback( p_vout, "viewpoint", ViewpointCallback, NULL );
     var_Create( p_vout, "viewpoint-changeable", VLC_VAR_BOOL );
 }
 
+void vout_IntfInit( vout_thread_t *p_vout )
+{
+    var_AddCallback( p_vout, "autoscale", AutoScaleCallback, NULL );
+    var_AddCallback( p_vout, "zoom", ZoomCallback, NULL );
+    var_AddCallback( p_vout, "crop-left", CropBorderCallback, NULL );
+    var_AddCallback( p_vout, "crop-top", CropBorderCallback, NULL );
+    var_AddCallback( p_vout, "crop-right", CropBorderCallback, NULL );
+    var_AddCallback( p_vout, "crop-bottom", CropBorderCallback, NULL );
+    var_AddCallback( p_vout, "crop", CropCallback, NULL );
+    var_AddCallback( p_vout, "aspect-ratio", AspectCallback, NULL );
+    var_AddCallback( p_vout, "video-on-top", AboveCallback, NULL );
+    var_AddCallback( p_vout, "video-wallpaper", WallPaperCallback, NULL );
+    var_AddCallback( p_vout, "fullscreen", FullscreenCallback, NULL );
+    var_AddCallback( p_vout, "video-snapshot", SnapshotCallback, NULL );
+    var_AddCallback( p_vout, "video-filter", VideoFilterCallback, NULL );
+    var_AddCallback( p_vout, "sub-source", SubSourceCallback, NULL );
+    var_AddCallback( p_vout, "sub-filter", SubFilterCallback, NULL );
+    var_AddCallback( p_vout, "sub-margin", SubMarginCallback, NULL );
+    var_AddCallback( p_vout, "viewpoint", ViewpointCallback, NULL );
+}
+
 void vout_IntfReinit( vout_thread_t *p_vout )
 {
     var_TriggerCallback( p_vout, "video-on-top" );



More information about the vlc-commits mailing list