[vlc-devel] [PATCH] input: use VLC_DEMUXER_xxx instead of integers

Steve Lhomme robux4 at videolabs.io
Wed Mar 30 08:55:47 CEST 2016


---
 include/vlc_demux.h |  2 +-
 src/input/input.c   | 21 +++++++++++----------
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/include/vlc_demux.h b/include/vlc_demux.h
index a6c064d..026b518 100644
--- a/include/vlc_demux.h
+++ b/include/vlc_demux.h
@@ -300,7 +300,7 @@ VLC_API int demux_vaControlHelper( stream_t *, int64_t i_start, int64_t i_end,
 VLC_USED static inline int demux_Demux( demux_t *p_demux )
 {
     if( !p_demux->pf_demux )
-        return 1;
+        return VLC_DEMUXER_SUCCESS;
 
     return p_demux->pf_demux( p_demux );
 }
diff --git a/src/input/input.c b/src/input/input.c
index 725c6c2..1b74d01 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -548,11 +548,13 @@ static void MainLoopDemux( input_thread_t *p_input, bool *pb_changed )
     *pb_changed = false;
 
     if( p_input->p->i_stop > 0 && p_input->p->i_time >= p_input->p->i_stop )
-        i_ret = 0; /* EOF */
+        i_ret = VLC_DEMUXER_EOF;
     else
         i_ret = demux_Demux( p_input->p->master->p_demux );
 
-    if( i_ret > 0 )
+    i_ret = i_ret > 0 ? VLC_DEMUXER_SUCCESS : ( i_ret < 0 ? VLC_DEMUXER_EGENERIC : VLC_DEMUXER_EOF);
+
+    if( i_ret == VLC_DEMUXER_SUCCESS )
     {
         if( p_input->p->master->p_demux->info.i_update )
         {
@@ -570,18 +572,17 @@ static void MainLoopDemux( input_thread_t *p_input, bool *pb_changed )
         }
     }
 
-    if( i_ret == 0 )    /* EOF */
+    if( i_ret == VLC_DEMUXER_EOF )
     {
         msg_Dbg( p_input, "EOF reached" );
         p_input->p->master->b_eof = true;
         es_out_Eos(p_input->p->p_es_out);
     }
-    else if( i_ret < 0 )
+    else if( i_ret == VLC_DEMUXER_EGENERIC )
     {
         input_ChangeState( p_input, ERROR_S );
     }
-
-    if( i_ret > 0 && p_input->p->i_slave > 0 )
+    else if( p_input->p->i_slave > 0 )
         SlaveDemux( p_input );
 }
 
@@ -2032,19 +2033,19 @@ static int UpdateTitleSeekpoint( input_thread_t *p_input,
     {
         if( i_title > i_title_end ||
             ( i_title == i_title_end && i_seekpoint > i_seekpoint_end ) )
-            return 0;
+            return VLC_DEMUXER_EOF;
     }
     else if( i_seekpoint_end >= 0 )
     {
         if( i_seekpoint > i_seekpoint_end )
-            return 0;
+            return VLC_DEMUXER_EOF;
     }
     else if( i_title_end >= 0 )
     {
         if( i_title > i_title_end )
-            return 0;
+            return VLC_DEMUXER_EOF;
     }
-    return 1;
+    return VLC_DEMUXER_SUCCESS;
 }
 /*****************************************************************************
  * Update*FromDemux:
-- 
2.7.0



More information about the vlc-devel mailing list