[vlc-commits] setid: use operation structure

Rémi Denis-Courmont git at videolan.org
Sat Oct 10 18:40:09 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Oct 10 19:36:59 2020 +0300| [651ed61410ef63d95287a54f7fbfdc13766409bf] | committer: Rémi Denis-Courmont

setid: use operation structure

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

 modules/stream_out/setid.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/modules/stream_out/setid.c b/modules/stream_out/setid.c
index 72eea63dc5..be699db31a 100644
--- a/modules/stream_out/setid.c
+++ b/modules/stream_out/setid.c
@@ -119,14 +119,15 @@ static int OpenCommon( vlc_object_t *p_this )
     if( unlikely( !p_sys ) )
         return VLC_ENOMEM;
 
-    p_stream->pf_del    = Del;
-    p_stream->pf_send   = Send;
-
     p_stream->p_sys     = p_sys;
 
     return VLC_SUCCESS;
 }
 
+static const struct sout_stream_operations id_ops = {
+    AddId, Del, Send, NULL, NULL,
+};
+
 static int OpenId( vlc_object_t *p_this )
 {
     int i_ret = OpenCommon( p_this );
@@ -143,11 +144,15 @@ static int OpenId( vlc_object_t *p_this )
     p_sys->i_new_id = var_GetInteger( p_stream, SOUT_CFG_PREFIX_ID "new-id" );
     p_sys->psz_language = NULL;
 
-    p_stream->pf_add = AddId;
+    p_stream->ops = &id_ops;
 
     return VLC_SUCCESS;
 }
 
+static const struct sout_stream_operations lang_ops = {
+    AddLang, Del, Send, NULL, NULL,
+};
+
 static int OpenLang( vlc_object_t *p_this )
 {
     int i_ret = OpenCommon( p_this );
@@ -164,7 +169,7 @@ static int OpenLang( vlc_object_t *p_this )
     p_sys->i_new_id = -1;
     p_sys->psz_language = var_GetString( p_stream, SOUT_CFG_PREFIX_LANG "lang" );
 
-    p_stream->pf_add = AddLang;
+    p_stream->ops = &lang_ops;
 
     return VLC_SUCCESS;
 }



More information about the vlc-commits mailing list