[vlc-commits] input: use VLC_DEMUXER_xxx instead of integers

Steve Lhomme git at videolan.org
Mon May 9 15:52:51 CEST 2016


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Wed Mar 30 08:55:47 2016 +0200| [3de71252c3141880c77090eaaabe38a4a3731fc9] | committer: Jean-Baptiste Kempf

input: use VLC_DEMUXER_xxx instead of integers

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

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

 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 45f5416..addfa5a 100644
--- a/include/vlc_demux.h
+++ b/include/vlc_demux.h
@@ -297,7 +297,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 5591a4e..75e4c11 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -547,11 +547,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 )
         {
@@ -569,18 +571,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 );
 }
 
@@ -2004,19 +2005,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:



More information about the vlc-commits mailing list