[vlc-devel] [RFC] Regarding the use of *_Control()

Pierre d'Herbemont pdherbemont at free.fr
Mon Apr 14 18:33:18 CEST 2008


On Apr 14, 2008, at 6:00 PM, Rafaël Carré wrote:

> I would prefer you to post the patch here so I can complain on a real
> exemple before pushing to the tree.

Well, the idea is that before working on that, I would prefer some  
first thoughts.

But because I do understand you need a patch to make up your minds,  
here is one.

(Note, it's inlined here for the demo, but I do plan not to inline  
those).
(Also, please note, that we'd better to clean up now, than after 0.9.0  
release, especially if we break the ABI).

Thanks for your reply,

Pierre.

diff --git a/include/vlc_input.h b/include/vlc_input.h
index 1bdc3f2..b7273a9 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -673,4 +673,8 @@ VLC_EXPORT( void, input_DecoderDecode,( decoder_t  
*, block_t * ) );

  VLC_EXPORT( bool, input_AddSubtitles, ( input_thread_t *, char *,  
bool ) );

+static inline int demux_get_position( demux_t * p_demux, float * pos )
+{
+    return demux_Control( p_demux, DEMUX_GET_POSITION, pos );
+}
  #endif
diff --git a/src/input/input.c b/src/input/input.c
index 7f85afb..ec70696 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -725,8 +725,7 @@ static void MainLoop( input_thread_t *p_input )
              double f_pos;
              int64_t i_time, i_length;
              /* update input status variables */
-            if( !demux_Control( p_input->p->input.p_demux,
-                                 DEMUX_GET_POSITION, &f_pos ) )
+            if( !demux_get_position( p_input->p->input.p_demux,  
&f_pos ) )
              {
                  val.f_float = (float)f_pos;
                  var_Change( p_input, "position", VLC_VAR_SETVALUE,  
&val, NULL );





More information about the vlc-devel mailing list