[vlc-devel] commit: Use var_CreateGet* when applicable. ( Rémi Duraffort )

git version control git at videolan.org
Fri Nov 13 21:18:32 CET 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Fri Nov 13 21:11:37 2009 +0100| [b3f6fae8399b63caa825f2313c80e2393cfac3eb] | committer: Rémi Duraffort 

Use var_CreateGet* when applicable.

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

 modules/demux/demuxdump.c    |    5 +----
 modules/demux/mjpeg.c        |   13 ++++++-------
 modules/misc/dummy/decoder.c |    5 +----
 modules/mux/asf.c            |   20 +++++---------------
 modules/mux/mpeg/ts.c        |    3 +--
 5 files changed, 14 insertions(+), 32 deletions(-)

diff --git a/modules/demux/demuxdump.c b/modules/demux/demuxdump.c
index 926a1b4..56d7427 100644
--- a/modules/demux/demuxdump.c
+++ b/modules/demux/demuxdump.c
@@ -93,7 +93,6 @@ static int Open( vlc_object_t * p_this )
     demux_t     *p_demux = (demux_t*)p_this;
     demux_sys_t *p_sys;
     const char  *psz_mode;
-    vlc_value_t val;
     bool  b_append;
 
     /* Accept only if forced */
@@ -104,9 +103,7 @@ static int Open( vlc_object_t * p_this )
     if( !p_sys )
         return VLC_ENOMEM;
 
-    var_Create( p_demux, "demuxdump-append", VLC_VAR_BOOL|VLC_VAR_DOINHERIT );
-    var_Get( p_demux, "demuxdump-append", &val );
-    b_append = val.b_bool;
+    b_append = var_CreateGetBool( p_demux, "demuxdump-append" );
     if ( b_append )
         psz_mode = "ab";
     else
diff --git a/modules/demux/mjpeg.c b/modules/demux/mjpeg.c
index f132301..391c1e3 100644
--- a/modules/demux/mjpeg.c
+++ b/modules/demux/mjpeg.c
@@ -303,7 +303,7 @@ static int Open( vlc_object_t * p_this )
     demux_sys_t *p_sys;
     int         i_size;
     bool        b_matched = false;
-    vlc_value_t val;
+    float       f_fps;
 
     p_demux->pf_control = Control;
     p_demux->p_sys      = p_sys = malloc( sizeof( demux_sys_t ) );
@@ -340,8 +340,7 @@ static int Open( vlc_object_t * p_this )
     }
 
 
-    var_Create( p_demux, "mjpeg-fps", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT );
-    var_Get( p_demux, "mjpeg-fps", &val );
+    f_fps = var_CreateGetFloat( p_demux, "mjpeg-fps" );
     p_sys->i_frame_length = 0;
 
     /* Check for jpeg file extension */
@@ -351,9 +350,9 @@ static int Open( vlc_object_t * p_this )
         demux_IsPathExtension( p_demux, ".jpg" ) )
     {
         p_sys->b_still = true;
-        if( val.f_float)
+        if( f_fps )
         {
-            p_sys->i_still_length = 1000000.0 / val.f_float;
+            p_sys->i_still_length = 1000000.0 / f_fps;
         }
         else
         {
@@ -361,9 +360,9 @@ static int Open( vlc_object_t * p_this )
             p_sys->i_still_length = 1000000;
         }
     }
-    else if ( val.f_float )
+    else if ( f_fps )
     {
-        p_sys->i_frame_length = 1000000.0 / val.f_float;
+        p_sys->i_frame_length = 1000000.0 / f_fps;
     }
 
     es_format_Init( &p_sys->fmt, VIDEO_ES, 0 );
diff --git a/modules/misc/dummy/decoder.c b/modules/misc/dummy/decoder.c
index 5098ac6..3254168 100644
--- a/modules/misc/dummy/decoder.c
+++ b/modules/misc/dummy/decoder.c
@@ -73,7 +73,6 @@ static int OpenDecoderCommon( vlc_object_t *p_this, bool b_force_dump )
     decoder_t *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys;
     char psz_file[ PATH_MAX ];
-    vlc_value_t val;
 
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys =
@@ -87,9 +86,7 @@ static int OpenDecoderCommon( vlc_object_t *p_this, bool b_force_dump )
 #ifndef UNDER_CE
     if( !b_force_dump )
     {
-        var_Create( p_dec, "dummy-save-es", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
-        var_Get( p_dec, "dummy-save-es", &val );
-        b_force_dump = val.b_bool;
+        b_force_dump = var_CreateGetBool( p_dec, "dummy-save-es" );
     }
     if( b_force_dump )
     {
diff --git a/modules/mux/asf.c b/modules/mux/asf.c
index 590b01e..804e610 100644
--- a/modules/mux/asf.c
+++ b/modules/mux/asf.c
@@ -192,7 +192,6 @@ static int Open( vlc_object_t *p_this )
 {
     sout_mux_t     *p_mux = (sout_mux_t*)p_this;
     sout_mux_sys_t *p_sys;
-    vlc_value_t    val;
     int i;
 
     msg_Dbg( p_mux, "asf muxer opened" );
@@ -241,20 +240,11 @@ static int Open( vlc_object_t *p_this )
     }
 
     /* Meta data */
-    var_Get( p_mux, SOUT_CFG_PREFIX "title", &val );
-    p_sys->psz_title = val.psz_string;
-
-    var_Get( p_mux, SOUT_CFG_PREFIX "author", &val );
-    p_sys->psz_author = val.psz_string;
-
-    var_Get( p_mux, SOUT_CFG_PREFIX "copyright", &val );
-    p_sys->psz_copyright = val.psz_string;
-
-    var_Get( p_mux, SOUT_CFG_PREFIX "comment", &val );
-    p_sys->psz_comment = val.psz_string;
-
-    var_Get( p_mux, SOUT_CFG_PREFIX "rating", &val );
-    p_sys->psz_rating = val.psz_string;
+    p_sys->psz_title = var_GetString( p_mux, SOUT_CFG_PREFIX "title" );
+    p_sys->psz_author = var_GetString( p_mux, SOUT_CFG_PREFIX "author" );
+    p_sys->psz_copyright = var_GetString( p_mux, SOUT_CFG_PREFIX "copyright" );
+    p_sys->psz_comment = var_GetString( p_mux, SOUT_CFG_PREFIX "comment" );
+    p_sys->psz_rating = var_GetString( p_mux, SOUT_CFG_PREFIX "rating" );
 
     msg_Dbg( p_mux, "meta data: title='%s', author='%s', copyright='%s', "
              "comment='%s', rating='%s'",
diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c
index 9bf9034..cc61ca8 100644
--- a/modules/mux/mpeg/ts.c
+++ b/modules/mux/mpeg/ts.c
@@ -529,8 +529,7 @@ static int Open( vlc_object_t *p_this )
     p_sys->i_audio_bound = 0;
     p_sys->i_video_bound = 0;
 
-    var_Get( p_mux, SOUT_CFG_PREFIX "es-id-pid", &val );
-    p_sys->b_es_id_pid = val.b_bool;
+    p_sys->b_es_id_pid = var_GetBool( p_mux, SOUT_CFG_PREFIX "es-id-pid" );
 
     var_Get( p_mux, SOUT_CFG_PREFIX "muxpmt", &val );
     /*




More information about the vlc-devel mailing list