[vlc-devel] [PATCH 09/13] Replace encoder_sys_t* by void*

Romain Vimont rom1v at videolabs.io
Tue Apr 24 11:18:27 CEST 2018


See #17078
---
 include/vlc_codec.h  | 2 +-
 modules/codec/opus.c | 2 +-
 modules/codec/png.c  | 6 ++++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/include/vlc_codec.h b/include/vlc_codec.h
index 0ba09d736d..41aa99cb0b 100644
--- a/include/vlc_codec.h
+++ b/include/vlc_codec.h
@@ -213,7 +213,7 @@ struct encoder_t
 
     /* Module properties */
     module_t *          p_module;
-    encoder_sys_t *     p_sys;
+    void               *p_sys;
 
     /* Properties of the input data fed to the encoder */
     es_format_t         fmt_in;
diff --git a/modules/codec/opus.c b/modules/codec/opus.c
index 01295d5991..696c0d3637 100644
--- a/modules/codec/opus.c
+++ b/modules/codec/opus.c
@@ -684,7 +684,7 @@ static int OpenEncoder(vlc_object_t *p_this)
     sys->i_nb_samples = 0;
 
     sys->i_samples_delay = 0;
-    int ret = opus_multistream_encoder_ctl(enc->p_sys->enc,
+    int ret = opus_multistream_encoder_ctl(sys->enc,
             OPUS_GET_LOOKAHEAD(&sys->i_samples_delay));
     if (ret != OPUS_OK)
         msg_Err(enc, "Unable to get number of lookahead samples: %s\n",
diff --git a/modules/codec/png.c b/modules/codec/png.c
index d8af7c58c8..b37a58a981 100644
--- a/modules/codec/png.c
+++ b/modules/codec/png.c
@@ -337,13 +337,15 @@ static int OpenEncoder(vlc_object_t *p_this)
         return VLC_EGENERIC;
 
     /* Allocate the memory needed to store the encoder's structure */
+    encoder_sys_t *p_sys = malloc( sizeof(encoder_sys_t) );
     p_enc->p_sys = malloc( sizeof(encoder_sys_t) );
     if( p_enc->p_sys  == NULL )
         return VLC_ENOMEM;
+    p_enc->p_sys = p_sys;
 
-    p_enc->p_sys->p_obj = p_this;
+    p_sys->p_obj = p_this;
 
-    p_enc->p_sys->i_blocksize = 3 * p_enc->fmt_in.video.i_visible_width *
+    p_sys->i_blocksize = 3 * p_enc->fmt_in.video.i_visible_width *
         p_enc->fmt_in.video.i_visible_height;
 
     p_enc->fmt_in.i_codec = VLC_CODEC_RGB24;
-- 
2.17.0



More information about the vlc-devel mailing list