[vlc-commits] chromecast: use operation structures

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


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Oct 10 19:00:37 2020 +0300| [1b9df65188e59e789ffe9ffdcda8e129b7249048] | committer: Rémi Denis-Courmont

chromecast: use operation structures

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

 modules/stream_out/chromecast/cast.cpp | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/modules/stream_out/chromecast/cast.cpp b/modules/stream_out/chromecast/cast.cpp
index 944bde923f..7d3170cb3c 100644
--- a/modules/stream_out/chromecast/cast.cpp
+++ b/modules/stream_out/chromecast/cast.cpp
@@ -313,6 +313,10 @@ static void ProxyFlush(sout_stream_t *p_stream, void *id)
     sout_StreamFlush(p_stream->p_next, id);
 }
 
+static const struct sout_stream_operations proxy_ops = {
+    ProxyAdd, ProxyDel, ProxySend, NULL, ProxyFlush,
+};
+
 static int ProxyOpen(vlc_object_t *p_this)
 {
     sout_stream_t *p_stream = reinterpret_cast<sout_stream_t*>(p_this);
@@ -322,11 +326,7 @@ static int ProxyOpen(vlc_object_t *p_this)
 
     p_stream->p_sys = (sout_stream_sys_t *) p_sys;
     p_sys->out_streams_added = 0;
-
-    p_stream->pf_add     = ProxyAdd;
-    p_stream->pf_del     = ProxyDel;
-    p_stream->pf_send    = ProxySend;
-    p_stream->pf_flush   = ProxyFlush;
+    p_stream->ops = &proxy_ops;
     return VLC_SUCCESS;
 }
 
@@ -1223,6 +1223,10 @@ static void on_input_event_cb(void *data, enum cc_input_event event, union cc_in
     }
 }
 
+static const struct sout_stream_operations ops = {
+    Add, Del, Send, NULL, Flush,
+};
+
 /*****************************************************************************
  * Open: connect to the Chromecast and initialize the sout
  *****************************************************************************/
@@ -1300,11 +1304,7 @@ static int Open(vlc_object_t *p_this)
     var_Create( p_stream->p_sout, SOUT_CFG_PREFIX "access-out-sys", VLC_VAR_ADDRESS );
 
     // Set the sout callbacks.
-    p_stream->pf_add     = Add;
-    p_stream->pf_del     = Del;
-    p_stream->pf_send    = Send;
-    p_stream->pf_flush   = Flush;
-
+    p_stream->ops = &ops;
     p_stream->p_sys = p_sys;
 
     free(psz_ip);



More information about the vlc-commits mailing list