[vlc-commits] vout: move input_thread out of vout_configuration_t

Thomas Guillem git at videolan.org
Wed Jul 25 14:57:52 CEST 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Jul 25 14:07:02 2018 +0200| [ab9be33dbf69e0220790edb3926aa57ede4cb286] | committer: Thomas Guillem

vout: move input_thread out of vout_configuration_t

It's needed by the vout only to get input attachments of spu filters.

Possible improvement: the input thread should propagate fonts attachments to
the vout when it fetches a new one from the demuxer

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

 src/input/resource.c                |  7 +++----
 src/video_output/video_output.c     | 16 +++++++++-------
 src/video_output/vout_internal.h    | 13 +++++++------
 src/video_output/vout_subpictures.c |  6 +++---
 4 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/src/input/resource.c b/src/input/resource.c
index 44854952a0..c524497e92 100644
--- a/src/input/resource.c
+++ b/src/input/resource.c
@@ -234,14 +234,13 @@ static vout_thread_t *RequestVout( input_resource_t *p_resource,
         /* */
         vout_configuration_t cfg = {
             .vout       = p_vout,
-            .input      = VLC_OBJECT(p_resource->p_input),
             .change_fmt = true,
             .fmt        = p_fmt,
             .dpb_size   = dpb_size,
             .mouse_event= mouse_event,
             .opaque = opaque,
         };
-        p_vout = vout_Request( p_resource->p_parent, &cfg );
+        p_vout = vout_Request( p_resource->p_parent, &cfg, p_resource->p_input );
         if( !p_vout )
             return NULL;
 
@@ -281,14 +280,14 @@ static vout_thread_t *RequestVout( input_resource_t *p_resource,
 
             vout_configuration_t cfg = {
                 .vout       = p_vout,
-                .input      = NULL,
                 .change_fmt = false,
                 .fmt        = NULL,
                 .dpb_size   = 0,
                 .mouse_event= NULL,
                 .opaque = NULL,
             };
-            p_resource->p_vout_free = vout_Request( p_resource->p_parent, &cfg );
+            p_resource->p_vout_free = vout_Request( p_resource->p_parent, &cfg,
+                                                    NULL );
         }
         return NULL;
     }
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index fca04e1227..ace9ce7176 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -114,7 +114,8 @@ static bool VideoFormatIsCropArEqual(video_format_t *dst,
 }
 
 static vout_thread_t *VoutCreate(vlc_object_t *object,
-                                 const vout_configuration_t *cfg)
+                                 const vout_configuration_t *cfg,
+                                 input_thread_t *input)
 {
     video_format_t original;
     if (VoutValidateFormat(&original, cfg->fmt))
@@ -216,16 +217,17 @@ static vout_thread_t *VoutCreate(vlc_object_t *object,
         return NULL;
     }
 
-    vout->p->input = cfg->input;
+    vout->p->input = input;
     if (vout->p->input)
-        spu_Attach(vout->p->spu, vout->p->input, true);
+        spu_Attach(vout->p->spu, input, true);
 
     return vout;
 }
 
 #undef vout_Request
 vout_thread_t *vout_Request(vlc_object_t *object,
-                              const vout_configuration_t *cfg)
+                            const vout_configuration_t *cfg,
+                            input_thread_t *input)
 {
     vout_thread_t *vout = cfg->vout;
     if (cfg->change_fmt && !cfg->fmt) {
@@ -236,10 +238,10 @@ vout_thread_t *vout_Request(vlc_object_t *object,
 
     /* If a vout is provided, try reusing it */
     if (vout) {
-        if (vout->p->input != cfg->input) {
+        if (vout->p->input != input) {
             if (vout->p->input)
                 spu_Attach(vout->p->spu, vout->p->input, false);
-            vout->p->input = cfg->input;
+            vout->p->input = input;
             if (vout->p->input)
                 spu_Attach(vout->p->spu, vout->p->input, true);
         }
@@ -261,7 +263,7 @@ vout_thread_t *vout_Request(vlc_object_t *object,
 
         msg_Warn(object, "cannot reuse provided vout");
     }
-    return VoutCreate(object, cfg);
+    return VoutCreate(object, cfg, input);
 }
 
 void vout_Close(vout_thread_t *vout)
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index 1ff5dde454..6244a48364 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -46,7 +46,6 @@
  */
 typedef struct {
     vout_thread_t        *vout;
-    vlc_object_t         *input;
     bool                 change_fmt;
     const video_format_t *fmt;
     unsigned             dpb_size;
@@ -61,8 +60,8 @@ struct vout_thread_sys_t
     /* Splitter module if used */
     char            *splitter_name;
 
-    /* Input thread for dvd menu interactions */
-    vlc_object_t    *input;
+    /* Input thread for spu attachments */
+    input_thread_t    *input;
 
     /* */
     video_format_t  original;   /* Original format ie coming from the decoder */
@@ -163,10 +162,12 @@ struct vout_thread_sys_t
  *
  * \param object a vlc object
  * \param cfg the video configuration requested.
+ * \param input used to get attachments for spu filters
  * \return a vout
  */
-vout_thread_t * vout_Request( vlc_object_t *object, const vout_configuration_t *cfg );
-#define vout_Request(a,b) vout_Request(VLC_OBJECT(a),b)
+vout_thread_t * vout_Request( vlc_object_t *object, const vout_configuration_t *cfg,
+                              input_thread_t *input );
+#define vout_Request(a,b,c) vout_Request(VLC_OBJECT(a),b,c)
 
 /**
  * This function will close a vout created by vout_Request.
@@ -221,7 +222,7 @@ void vout_ManageWrapper(vout_thread_t *);
 
 /* */
 int spu_ProcessMouse(spu_t *, const vlc_mouse_t *, const video_format_t *);
-void spu_Attach( spu_t *, vlc_object_t *input, bool );
+void spu_Attach( spu_t *, input_thread_t *input, bool );
 void spu_ChangeMargin(spu_t *, int);
 void spu_SetHighlight(spu_t *, const vlc_spu_highlight_t*);
 
diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index e56838c53d..5bcfcda410 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -63,7 +63,7 @@ typedef struct {
 
 struct spu_private_t {
     vlc_mutex_t  lock;            /* lock to protect all followings fields */
-    vlc_object_t *input;
+    input_thread_t *input;
 
     spu_heap_t   heap;
 
@@ -180,7 +180,7 @@ static int spu_get_attachments(filter_t *filter,
 
     int ret = VLC_EGENERIC;
     if (spu->p->input)
-        ret = input_Control((input_thread_t*)spu->p->input,
+        ret = input_Control(spu->p->input,
                             INPUT_GET_ATTACHMENTS,
                             attachment_ptr, attachment_count);
     return ret;
@@ -1366,7 +1366,7 @@ void spu_Destroy(spu_t *spu)
  * \param p_this the object in which to destroy the subpicture unit
  * \param b_attach to select attach or detach
  */
-void spu_Attach(spu_t *spu, vlc_object_t *input, bool attach)
+void spu_Attach(spu_t *spu, input_thread_t *input, bool attach)
 {
     if (attach) {
         UpdateSPU(spu, NULL);



More information about the vlc-commits mailing list