[vlc-devel] commit: Fix some demux control replies (Antoine Cellerier )

git version control git at videolan.org
Sat Jan 17 16:09:48 CET 2009


vlc | branch: master | Antoine Cellerier <dionoea at videolan.org> | Sat Jan 17 16:09:30 2009 +0100| [c3bd417a3ca4e94bcfcfcc8ad1ad254786935a7d] | committer: Antoine Cellerier 

Fix some demux control replies

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

 modules/access/fake.c |   22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/modules/access/fake.c b/modules/access/fake.c
index 4ab8094..6c5fe16 100644
--- a/modules/access/fake.c
+++ b/modules/access/fake.c
@@ -214,19 +214,16 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             return VLC_SUCCESS;
 
         case DEMUX_GET_POSITION:
+            if( p_sys->i_duration <= 0 )
+                return VLC_EGENERIC;
             pf = (double*)va_arg( args, double* );
-            if( p_sys->i_duration > 0 )
-            {
-                *pf = (double)( p_sys->i_last_pts - p_sys->i_first_pts )
-                                / (double)(p_sys->i_duration);
-            }
-            else
-            {
-                *pf = 0;
-            }
+            *pf = (double)( p_sys->i_last_pts - p_sys->i_first_pts )
+                            / (double)(p_sys->i_duration);
             return VLC_SUCCESS;
 
         case DEMUX_SET_POSITION:
+            if( p_sys->i_duration <= 0 )
+                return VLC_EGENERIC;
             f = (double)va_arg( args, double );
             i64 = f * (double)p_sys->i_duration;
             p_sys->i_first_pts = p_sys->i_last_pts - i64;
@@ -235,13 +232,12 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
 
         case DEMUX_GET_TIME:
             pi64 = (int64_t *)va_arg( args, int64_t * );
-            if ( p_sys->i_duration )
-                *pi64 = p_sys->i_last_pts - p_sys->i_first_pts;
-            else
-                *pi64 = p_sys->i_last_pts;
+            *pi64 = p_sys->i_last_pts - p_sys->i_first_pts;
             return VLC_SUCCESS;
 
         case DEMUX_GET_LENGTH:
+            if( p_sys->i_duration <= 0 )
+                return VLC_EGENERIC;
             pi64 = (int64_t*)va_arg( args, int64_t * );
             *pi64 = p_sys->i_duration;
             return VLC_SUCCESS;




More information about the vlc-devel mailing list