[vlc-commits] filter: move pf_get_attachments to owner

Alexandre Janniaux git at videolan.org
Tue Jul 14 20:16:50 CEST 2020


vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Mon Jul 13 10:50:50 2020 +0200| [c0cd651aac257b4e603a8a9b6950f159016931fd] | committer: Alexandre Janniaux

filter: move pf_get_attachments to owner

Attachments are not coming from the filter but from the pipeline and is
called by the filter implementation itself. Thus, this is defined by the
owner implementation and should not be in the operation callbacks.

It's particularily noticeable in the callsite given that the
get_attachments implementation is using owner.sys.

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

 include/vlc_filter.h                | 15 ++++++++-------
 src/video_output/vout_subpictures.c |  7 ++++---
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/include/vlc_filter.h b/include/vlc_filter.h
index 49e97f7988..9574c318d9 100644
--- a/include/vlc_filter.h
+++ b/include/vlc_filter.h
@@ -58,6 +58,11 @@ typedef struct filter_owner_t
         const struct filter_video_callbacks *video;
         const struct filter_subpicture_callbacks *sub;
     };
+
+    /* Input attachments
+     * XXX use filter_GetInputAttachments */
+    int (*pf_get_attachments)( filter_t *, input_attachment_t ***, int * );
+
     void *sys;
 } filter_owner_t;
 
@@ -148,10 +153,6 @@ struct filter_t
                                const struct vlc_mouse_t *p_new );
     };
 
-    /* Input attachments
-     * XXX use filter_GetInputAttachments */
-    int (*pf_get_attachments)( filter_t *, input_attachment_t ***, int * );
-
     /** Private structure for the owner of the filter */
     filter_owner_t      owner;
 };
@@ -260,10 +261,10 @@ static inline int filter_GetInputAttachments( filter_t *p_filter,
                                               input_attachment_t ***ppp_attachment,
                                               int *pi_attachment )
 {
-    if( !p_filter->pf_get_attachments )
+    if( !p_filter->owner.pf_get_attachments )
         return VLC_EGENERIC;
-    return p_filter->pf_get_attachments( p_filter,
-                                         ppp_attachment, pi_attachment );
+    return p_filter->owner.pf_get_attachments( p_filter,
+                                               ppp_attachment, pi_attachment );
 }
 
 /**
diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index 5ab940c1da..4eea545dd0 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -251,8 +251,6 @@ static filter_t *SpuRenderCreateAndLoadText(spu_t *spu)
     if (!text)
         return NULL;
 
-    text->owner.sys = spu;
-
     es_format_Init(&text->fmt_in, VIDEO_ES, 0);
 
     es_format_Init(&text->fmt_out, VIDEO_ES, 0);
@@ -261,7 +259,10 @@ static filter_t *SpuRenderCreateAndLoadText(spu_t *spu)
     text->fmt_out.video.i_height         =
     text->fmt_out.video.i_visible_height = 32;
 
-    text->pf_get_attachments = spu_get_attachments;
+    text->owner = (const struct filter_owner_t) {
+        .pf_get_attachments = spu_get_attachments,
+        .sys = spu
+    };
 
     text->p_module = module_need_var(text, "text renderer", "text-renderer");
     if (!text->p_module)



More information about the vlc-commits mailing list