[vlc-commits] core: replace sout_stream_sys_t* by void*

Romain Vimont git at videolan.org
Thu Apr 26 01:42:57 CEST 2018


vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Mon Apr 23 18:29:40 2018 +0200| [238459bf4fa35284e74f839e5862abc758352f2a] | committer: Jean-Baptiste Kempf

core: replace sout_stream_sys_t* by void*

See #17078

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 include/vlc_sout.h                     |  2 +-
 modules/stream_out/chromecast/cast.cpp | 20 ++++++-------
 modules/stream_out/rtp.c               | 12 ++++----
 modules/stream_out/setid.c             | 14 +++++----
 modules/stream_out/standard.c          | 12 +++++---
 modules/stream_out/transcode/audio.c   |  2 +-
 modules/stream_out/transcode/video.c   | 52 ++++++++++++++++++----------------
 7 files changed, 62 insertions(+), 52 deletions(-)

diff --git a/include/vlc_sout.h b/include/vlc_sout.h
index 289d5ee956..9dd5b866b1 100644
--- a/include/vlc_sout.h
+++ b/include/vlc_sout.h
@@ -213,7 +213,7 @@ struct sout_stream_t
     int               (*pf_control)( sout_stream_t *, int, va_list );
     void              (*pf_flush)( sout_stream_t *, sout_stream_id_sys_t * );
 
-    sout_stream_sys_t *p_sys;
+    void              *p_sys;
     bool pace_nocontrol;
 };
 
diff --git a/modules/stream_out/chromecast/cast.cpp b/modules/stream_out/chromecast/cast.cpp
index 0df0006e4d..bf0d07a6ef 100644
--- a/modules/stream_out/chromecast/cast.cpp
+++ b/modules/stream_out/chromecast/cast.cpp
@@ -279,7 +279,7 @@ vlc_module_end ()
 
 static sout_stream_id_sys_t *ProxyAdd(sout_stream_t *p_stream, const es_format_t *p_fmt)
 {
-    sout_stream_sys_t *p_sys = p_stream->p_sys;
+    sout_stream_sys_t *p_sys = reinterpret_cast<sout_stream_sys_t *>( p_stream->p_sys );
     sout_stream_id_sys_t *id = sout_StreamIdAdd(p_stream->p_next, p_fmt);
     if (id)
     {
@@ -292,7 +292,7 @@ static sout_stream_id_sys_t *ProxyAdd(sout_stream_t *p_stream, const es_format_t
 
 static void ProxyDel(sout_stream_t *p_stream, sout_stream_id_sys_t *id)
 {
-    sout_stream_sys_t *p_sys = p_stream->p_sys;
+    sout_stream_sys_t *p_sys = reinterpret_cast<sout_stream_sys_t *>( p_stream->p_sys );
     p_sys->out_streams_added--;
     if (id == p_sys->video_proxy_id)
         p_sys->video_proxy_id = NULL;
@@ -302,7 +302,7 @@ static void ProxyDel(sout_stream_t *p_stream, sout_stream_id_sys_t *id)
 static int ProxySend(sout_stream_t *p_stream, sout_stream_id_sys_t *id,
                      block_t *p_buffer)
 {
-    sout_stream_sys_t *p_sys = p_stream->p_sys;
+    sout_stream_sys_t *p_sys = reinterpret_cast<sout_stream_sys_t *>( p_stream->p_sys );
     if (p_sys->cc_has_input
      || p_sys->out_streams_added >= p_sys->out_streams.size() - p_sys->spu_streams_count)
     {
@@ -701,7 +701,7 @@ static void AccessClose(vlc_object_t *p_this)
  *****************************************************************************/
 static sout_stream_id_sys_t *Add(sout_stream_t *p_stream, const es_format_t *p_fmt)
 {
-    sout_stream_sys_t *p_sys = p_stream->p_sys;
+    sout_stream_sys_t *p_sys = reinterpret_cast<sout_stream_sys_t *>( p_stream->p_sys );
     vlc_mutex_locker locker(&p_sys->lock);
 
     if (!p_sys->b_supports_video)
@@ -727,7 +727,7 @@ static sout_stream_id_sys_t *Add(sout_stream_t *p_stream, const es_format_t *p_f
 static void DelInternal(sout_stream_t *p_stream, sout_stream_id_sys_t *id,
                         bool reset_config)
 {
-    sout_stream_sys_t *p_sys = p_stream->p_sys;
+    sout_stream_sys_t *p_sys = reinterpret_cast<sout_stream_sys_t *>( p_stream->p_sys );
 
     for (std::vector<sout_stream_id_sys_t*>::iterator it = p_sys->streams.begin();
          it != p_sys->streams.end(); )
@@ -775,7 +775,7 @@ static void DelInternal(sout_stream_t *p_stream, sout_stream_id_sys_t *id,
 
 static void Del(sout_stream_t *p_stream, sout_stream_id_sys_t *id)
 {
-    sout_stream_sys_t *p_sys = p_stream->p_sys;
+    sout_stream_sys_t *p_sys = reinterpret_cast<sout_stream_sys_t *>( p_stream->p_sys );
 
     vlc_mutex_locker locker(&p_sys->lock);
     DelInternal(p_stream, id, true);
@@ -1404,7 +1404,7 @@ bool sout_stream_sys_t::isFlushing( sout_stream_t *p_stream )
 static int Send(sout_stream_t *p_stream, sout_stream_id_sys_t *id,
                 block_t *p_buffer)
 {
-    sout_stream_sys_t *p_sys = p_stream->p_sys;
+    sout_stream_sys_t *p_sys = reinterpret_cast<sout_stream_sys_t *>( p_stream->p_sys );
     vlc_mutex_locker locker(&p_sys->lock);
 
     if( p_sys->isFlushing( p_stream ) )
@@ -1429,7 +1429,7 @@ static int Send(sout_stream_t *p_stream, sout_stream_id_sys_t *id,
 
 static void Flush( sout_stream_t *p_stream, sout_stream_id_sys_t *id )
 {
-    sout_stream_sys_t *p_sys = p_stream->p_sys;
+    sout_stream_sys_t *p_sys = reinterpret_cast<sout_stream_sys_t *>( p_stream->p_sys );
     vlc_mutex_locker locker(&p_sys->lock);
 
     sout_stream_id_sys_t *next_id = p_sys->GetSubId( p_stream, id, false );
@@ -1457,7 +1457,7 @@ static void Flush( sout_stream_t *p_stream, sout_stream_id_sys_t *id )
 static void on_input_event_cb(void *data, enum cc_input_event event, union cc_input_arg arg )
 {
     sout_stream_t *p_stream = reinterpret_cast<sout_stream_t*>(data);
-    sout_stream_sys_t *p_sys = p_stream->p_sys;
+    sout_stream_sys_t *p_sys = reinterpret_cast<sout_stream_sys_t *>( p_stream->p_sys );
 
     vlc_mutex_locker locker(&p_sys->lock);
     switch (event)
@@ -1598,7 +1598,7 @@ error:
 static void Close(vlc_object_t *p_this)
 {
     sout_stream_t *p_stream = reinterpret_cast<sout_stream_t*>(p_this);
-    sout_stream_sys_t *p_sys = p_stream->p_sys;
+    sout_stream_sys_t *p_sys = reinterpret_cast<sout_stream_sys_t *>( p_stream->p_sys );
 
     assert(p_sys->out_streams.empty() && p_sys->streams.empty());
     var_Destroy( p_stream->p_sout, SOUT_CFG_PREFIX "sys" );
diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c
index f160161012..9d5c39d4c0 100644
--- a/modules/stream_out/rtp.c
+++ b/modules/stream_out/rtp.c
@@ -1264,8 +1264,7 @@ static void Del( sout_stream_t *p_stream, sout_stream_id_sys_t *id )
 static int Send( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
                  block_t *p_buffer )
 {
-    assert( p_stream->p_sys->p_mux == NULL );
-    (void)p_stream;
+    assert( ((sout_stream_sys_t *)p_stream->p_sys)->p_mux == NULL );
 
     while( p_buffer != NULL )
     {
@@ -1679,7 +1678,8 @@ static sout_stream_id_sys_t *MuxAdd( sout_stream_t *p_stream,
                                      const es_format_t *p_fmt )
 {
     sout_input_t      *p_input;
-    sout_mux_t *p_mux = p_stream->p_sys->p_mux;
+    sout_stream_sys_t *p_sys = p_stream->p_sys;
+    sout_mux_t *p_mux = p_sys->p_mux;
     assert( p_mux != NULL );
 
     p_input = sout_MuxAddStream( p_mux, p_fmt );
@@ -1696,7 +1696,8 @@ static sout_stream_id_sys_t *MuxAdd( sout_stream_t *p_stream,
 static int MuxSend( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
                     block_t *p_buffer )
 {
-    sout_mux_t *p_mux = p_stream->p_sys->p_mux;
+    sout_stream_sys_t *p_sys = p_stream->p_sys;
+    sout_mux_t *p_mux = p_sys->p_mux;
     assert( p_mux != NULL );
 
     return sout_MuxSendBuffer( p_mux, (sout_input_t *)id, p_buffer );
@@ -1706,7 +1707,8 @@ static int MuxSend( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
 /** Remove an ES from a non-RTP muxed stream */
 static void MuxDel( sout_stream_t *p_stream, sout_stream_id_sys_t *id )
 {
-    sout_mux_t *p_mux = p_stream->p_sys->p_mux;
+    sout_stream_sys_t *p_sys = p_stream->p_sys;
+    sout_mux_t *p_mux = p_sys->p_mux;
     assert( p_mux != NULL );
 
     sout_MuxDeleteStream( p_mux, (sout_input_t *)id );
diff --git a/modules/stream_out/setid.c b/modules/stream_out/setid.c
index bbce9eefa1..7501f63be2 100644
--- a/modules/stream_out/setid.c
+++ b/modules/stream_out/setid.c
@@ -144,9 +144,10 @@ static int OpenId( vlc_object_t *p_this )
     config_ChainParse( p_stream, SOUT_CFG_PREFIX_ID, ppsz_sout_options_id,
                        p_stream->p_cfg );
 
-    p_stream->p_sys->i_id = var_GetInteger( p_stream, SOUT_CFG_PREFIX_ID "id" );
-    p_stream->p_sys->i_new_id = var_GetInteger( p_stream, SOUT_CFG_PREFIX_ID "new-id" );
-    p_stream->p_sys->psz_language = NULL;
+    sout_stream_sys_t *p_sys = p_stream->p_sys;
+    p_sys->i_id = var_GetInteger( p_stream, SOUT_CFG_PREFIX_ID "id" );
+    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;
 
@@ -164,9 +165,10 @@ static int OpenLang( vlc_object_t *p_this )
     config_ChainParse( p_stream, SOUT_CFG_PREFIX_LANG, ppsz_sout_options_lang,
                        p_stream->p_cfg );
 
-    p_stream->p_sys->i_id = var_GetInteger( p_stream, SOUT_CFG_PREFIX_LANG "id" );
-    p_stream->p_sys->i_new_id = -1;
-    p_stream->p_sys->psz_language = var_GetString( p_stream, SOUT_CFG_PREFIX_LANG "lang" );
+    sout_stream_sys_t *p_sys = p_stream->p_sys;
+    p_sys->i_id = var_GetInteger( p_stream, SOUT_CFG_PREFIX_LANG "id" );
+    p_sys->i_new_id = -1;
+    p_sys->psz_language = var_GetString( p_stream, SOUT_CFG_PREFIX_LANG "lang" );
 
     p_stream->pf_add = AddLang;
 
diff --git a/modules/stream_out/standard.c b/modules/stream_out/standard.c
index 29f80b5865..c70772d966 100644
--- a/modules/stream_out/standard.c
+++ b/modules/stream_out/standard.c
@@ -132,23 +132,27 @@ struct sout_stream_sys_t
 
 static sout_stream_id_sys_t * Add( sout_stream_t *p_stream, const es_format_t *p_fmt )
 {
-    return (sout_stream_id_sys_t*)sout_MuxAddStream( p_stream->p_sys->p_mux, p_fmt );
+    sout_stream_sys_t *p_sys = p_stream->p_sys;
+    return (sout_stream_id_sys_t*)sout_MuxAddStream( p_sys->p_mux, p_fmt );
 }
 
 static void Del( sout_stream_t *p_stream, sout_stream_id_sys_t *id )
 {
-    sout_MuxDeleteStream( p_stream->p_sys->p_mux, (sout_input_t*)id );
+    sout_stream_sys_t *p_sys = p_stream->p_sys;
+    sout_MuxDeleteStream( p_sys->p_mux, (sout_input_t*)id );
 }
 
 static int Send( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
                  block_t *p_buffer )
 {
-    return sout_MuxSendBuffer( p_stream->p_sys->p_mux, (sout_input_t*)id, p_buffer );
+    sout_stream_sys_t *p_sys = p_stream->p_sys;
+    return sout_MuxSendBuffer( p_sys->p_mux, (sout_input_t*)id, p_buffer );
 }
 
 static void Flush( sout_stream_t *p_stream, sout_stream_id_sys_t *id )
 {
-    sout_MuxFlush( p_stream->p_sys->p_mux, (sout_input_t*)id );
+    sout_stream_sys_t *p_sys = p_stream->p_sys;
+    sout_MuxFlush( p_sys->p_mux, (sout_input_t*)id );
 }
 
 static void create_SDP(sout_stream_t *p_stream, sout_access_out_t *p_access)
diff --git a/modules/stream_out/transcode/audio.c b/modules/stream_out/transcode/audio.c
index d3f5bf7cf3..aeb42b9ee7 100644
--- a/modules/stream_out/transcode/audio.c
+++ b/modules/stream_out/transcode/audio.c
@@ -125,7 +125,7 @@ static int transcode_audio_initialize_encoder( sout_stream_id_sys_t *id, sout_st
         id->p_encoder->fmt_out.audio.i_physical_channels;
     aout_FormatPrepare( &id->p_encoder->fmt_in.audio );
 
-    id->p_encoder->p_cfg = p_stream->p_sys->p_audio_cfg;
+    id->p_encoder->p_cfg = p_sys->p_audio_cfg;
     id->p_encoder->p_module =
         module_need( id->p_encoder, "encoder", p_sys->psz_aenc, true );
     /* p_sys->i_acodec = 0 if there isn't acodec defined */
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index 80ac6c90f9..9c2d59d507 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -298,8 +298,9 @@ static int transcode_video_new( sout_stream_t *p_stream, sout_stream_id_sys_t *i
 static void transcode_video_filter_init( sout_stream_t *p_stream,
                                          sout_stream_id_sys_t *id )
 {
+    sout_stream_sys_t *p_sys = p_stream->p_sys;
     filter_owner_t owner = {
-        .sys = p_stream->p_sys,
+        .sys = p_sys,
         .video = {
             .buffer_new = transcode_video_filter_buffer_new,
         },
@@ -317,17 +318,17 @@ static void transcode_video_filter_init( sout_stream_t *p_stream,
         id->p_decoder->fmt_out.video.i_visible_width = id->p_decoder->fmt_out.video.i_width;
 
     /* Deinterlace */
-    if( p_stream->p_sys->psz_deinterlace != NULL )
+    if( p_sys->psz_deinterlace != NULL )
     {
         filter_chain_AppendFilter( id->p_f_chain,
-                                   p_stream->p_sys->psz_deinterlace,
-                                   p_stream->p_sys->p_deinterlace_cfg,
+                                   p_sys->psz_deinterlace,
+                                   p_sys->p_deinterlace_cfg,
                                    &id->p_decoder->fmt_out,
                                    &id->p_decoder->fmt_out );
 
         p_fmt_out = filter_chain_GetFmtOut( id->p_f_chain );
     }
-    if( p_stream->p_sys->b_master_sync )
+    if( p_sys->b_master_sync )
     {
         filter_chain_AppendFilter( id->p_f_chain,
                                    "fps",
@@ -338,7 +339,7 @@ static void transcode_video_filter_init( sout_stream_t *p_stream,
         p_fmt_out = filter_chain_GetFmtOut( id->p_f_chain );
     }
 
-    if( p_stream->p_sys->psz_vf2 )
+    if( p_sys->psz_vf2 )
     {
         id->p_uf_chain = filter_chain_NewVideo( p_stream, true, &owner );
         filter_chain_Reset( id->p_uf_chain, p_fmt_out,
@@ -348,7 +349,7 @@ static void transcode_video_filter_init( sout_stream_t *p_stream,
             filter_chain_AppendConverter( id->p_uf_chain, p_fmt_out,
                                            &id->p_encoder->fmt_in );
         }
-        filter_chain_AppendFromString( id->p_uf_chain, p_stream->p_sys->psz_vf2 );
+        filter_chain_AppendFromString( id->p_uf_chain, p_sys->psz_vf2 );
         p_fmt_out = filter_chain_GetFmtOut( id->p_uf_chain );
         es_format_Copy( &id->p_encoder->fmt_in, p_fmt_out );
         id->p_encoder->fmt_out.video.i_width =
@@ -363,8 +364,8 @@ static void transcode_video_filter_init( sout_stream_t *p_stream,
 
     if( p_fmt_out )
     {
-        p_stream->p_sys->i_spu_width = p_fmt_out->video.i_visible_width;
-        p_stream->p_sys->i_spu_height = p_fmt_out->video.i_visible_height;
+        p_sys->i_spu_width = p_fmt_out->video.i_visible_width;
+        p_sys->i_spu_height = p_fmt_out->video.i_visible_height;
     }
 
     /* Keep colorspace etc info along */
@@ -661,23 +662,24 @@ static int transcode_video_encoder_open( sout_stream_t *p_stream,
 void transcode_video_close( sout_stream_t *p_stream,
                                    sout_stream_id_sys_t *id )
 {
-    if( p_stream->p_sys->i_threads >= 1 && !p_stream->p_sys->b_abort )
+    sout_stream_sys_t *p_sys = p_stream->p_sys;
+    if( p_sys->i_threads >= 1 && !p_sys->b_abort )
     {
-        vlc_mutex_lock( &p_stream->p_sys->lock_out );
-        p_stream->p_sys->b_abort = true;
-        vlc_cond_signal( &p_stream->p_sys->cond );
-        vlc_mutex_unlock( &p_stream->p_sys->lock_out );
+        vlc_mutex_lock( &p_sys->lock_out );
+        p_sys->b_abort = true;
+        vlc_cond_signal( &p_sys->cond );
+        vlc_mutex_unlock( &p_sys->lock_out );
 
-        vlc_join( p_stream->p_sys->thread, NULL );
+        vlc_join( p_sys->thread, NULL );
 
-        picture_fifo_Delete( p_stream->p_sys->pp_pics );
-        block_ChainRelease( p_stream->p_sys->p_buffers );
+        picture_fifo_Delete( p_sys->pp_pics );
+        block_ChainRelease( p_sys->p_buffers );
     }
 
-    if( p_stream->p_sys->i_threads >= 1 )
+    if( p_sys->i_threads >= 1 )
     {
-        vlc_mutex_destroy( &p_stream->p_sys->lock_out );
-        vlc_cond_destroy( &p_stream->p_sys->cond );
+        vlc_mutex_destroy( &p_sys->lock_out );
+        vlc_cond_destroy( &p_sys->cond );
     }
 
     /* Close decoder */
@@ -902,12 +904,12 @@ end:
         else
         {
             msg_Dbg( p_stream, "Flushing thread and waiting that");
-            vlc_mutex_lock( &p_stream->p_sys->lock_out );
-            p_stream->p_sys->b_abort = true;
-            vlc_cond_signal( &p_stream->p_sys->cond );
-            vlc_mutex_unlock( &p_stream->p_sys->lock_out );
+            vlc_mutex_lock( &p_sys->lock_out );
+            p_sys->b_abort = true;
+            vlc_cond_signal( &p_sys->cond );
+            vlc_mutex_unlock( &p_sys->lock_out );
 
-            vlc_join( p_stream->p_sys->thread, NULL );
+            vlc_join( p_sys->thread, NULL );
             vlc_mutex_lock( &p_sys->lock_out );
             *out = p_sys->p_buffers;
             p_sys->p_buffers = NULL;



More information about the vlc-commits mailing list