]> git.sesse.net Git - vlc/commitdiff
* ALL: p_selected_area->i_tell is now update inside input_SplitBuffer instead
authorGildas Bazin <gbazin@videolan.org>
Sat, 26 Oct 2002 15:24:19 +0000 (15:24 +0000)
committerGildas Bazin <gbazin@videolan.org>
Sat, 26 Oct 2002 15:24:19 +0000 (15:24 +0000)
   of inside the pf_read functions of access plugins. That means i_tell now
   actually reflects the position of what is being decoded and furthermore it
   is updated more often.

modules/access/dvd/access.c
modules/access/dvdplay/access.c
modules/access/dvdread/input.c
modules/access/vcd/vcd.c
src/input/input_ext-plugins.c

index 8e84e2fd2f8d50b7c8356ca1b096a0633230c173..78dd9c4eaf4c88f8351b6ab7e9c4cddcba0818f2 100644 (file)
@@ -8,7 +8,7 @@
  *  -udf.* to find files
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: access.c,v 1.2 2002/08/07 00:29:36 sam Exp $
+ * $Id: access.c,v 1.3 2002/10/26 15:24:19 gbazin Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -555,14 +555,13 @@ static ssize_t DVDRead( input_thread_t * p_input,
 
     vlc_mutex_lock( &p_input->stream.stream_lock );
 
-    p_input->stream.p_selected_area->i_tell += LB2OFF( i_read );
     if( p_dvd->b_new_chapter )
     {
         p_input->stream.p_selected_area->i_part = p_dvd->i_chapter;
         p_dvd->b_new_chapter                    = 0;
     }
 
-    if( ( p_input->stream.p_selected_area->i_tell
+    if( ( p_input->stream.p_selected_area->i_tell + LB2OFF( i_read )
             >= p_input->stream.p_selected_area->i_size )
        || ( i_block_once  <= 0 ) )
     {
index abbd83ee984f1890888928569ef4c3eb005fdb83..07e6a1bbf12fb0df67ec3e0b8ef5d1dad87105d6 100644 (file)
@@ -2,7 +2,7 @@
  * access.c: access capabilities for dvdplay plugin.
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: access.c,v 1.3 2002/08/29 23:53:22 massiot Exp $
+ * $Id: access.c,v 1.4 2002/10/26 15:24:19 gbazin Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -304,19 +304,13 @@ static int dvdplay_Read( input_thread_t * p_input,
 {
     dvd_data_t *    p_dvd;
     off_t           i_read;
-    
+
     p_dvd = (dvd_data_t *)p_input->p_access_data;
 
     vlc_mutex_lock( &p_input->stream.stream_lock );
-
     i_read = LB2OFF( dvdplay_read( p_dvd->vmg, p_buffer, OFF2LB( i_count ) ) );
-    
-    p_input->stream.p_selected_area->i_tell  =
-        LB2OFF( dvdplay_position( p_dvd->vmg ) ) -
-        p_input->stream.p_selected_area->i_start;
-
     vlc_mutex_unlock( &p_input->stream.stream_lock );
-    
+
     return i_read;
 }
 
@@ -334,9 +328,13 @@ static void dvdplay_Seek( input_thread_t * p_input, off_t i_off )
     p_dvd = (dvd_data_t *)p_input->p_access_data;
 
     vlc_mutex_lock( &p_input->stream.stream_lock );
-    
+
     dvdplay_seek( p_dvd->vmg, OFF2LB( i_off ) );
 
+    p_input->stream.p_selected_area->i_tell  =
+        LB2OFF( dvdplay_position( p_dvd->vmg ) ) -
+        p_input->stream.p_selected_area->i_start;
+
     vlc_mutex_unlock( &p_input->stream.stream_lock );
 
     return;
@@ -477,6 +475,7 @@ static int dvdNewPGC( input_thread_t * p_input )
     p_input->stream.p_selected_area->i_size  =
         LB2OFF( dvdplay_title_end ( p_dvd->vmg ) ) -
         p_input->stream.p_selected_area->i_start;
+    p_input->stream.p_selected_area->i_tell = 0;
 
     if( p_input->stream.p_selected_area->i_size > 0 )
     {
index 4859aaa270929013bdadc55aaf32dfc2b9169a69..709d23b58ea97285fbb720dcc5ef478243c13168 100644 (file)
@@ -6,7 +6,7 @@
  * It depends on: libdvdread for ifo files and block reading.
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: input.c,v 1.5 2002/10/23 21:54:33 gbazin Exp $
+ * $Id: input.c,v 1.6 2002/10/26 15:24:19 gbazin Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -930,10 +930,6 @@ static int DvdReadRead( input_thread_t * p_input,
 
     vlc_mutex_lock( &p_input->stream.stream_lock );
 
-    p_input->stream.p_selected_area->i_tell =
-        LB2OFF( p_dvd->i_cur_block ) -
-            p_input->stream.p_selected_area->i_start;
-
     if( p_dvd->b_eoc )
     {
         /* We modify i_part only at end of chapter not to erase
@@ -942,7 +938,8 @@ static int DvdReadRead( input_thread_t * p_input,
         p_dvd->b_eoc = 0;
     }
     
-    if( p_input->stream.p_selected_area->i_tell
+    if( ( LB2OFF( p_dvd->i_cur_block )
+          - p_input->stream.p_selected_area->i_start )
             >= p_input->stream.p_selected_area->i_size || b_eot )
     {
         if( ( p_input->stream.p_selected_area->i_id + 1 ) >= 
index 552c08cd6d0d734da0447a9ce3fc3ac2fe0a1804..565c1582cba640e74c9cbb60719b2a2b33ef8dec 100644 (file)
@@ -2,7 +2,7 @@
  * vcd.c : VCD input module for vlc
  *****************************************************************************
  * Copyright (C) 2000 VideoLAN
- * $Id: vcd.c,v 1.8 2002/10/16 11:35:53 sam Exp $
+ * $Id: vcd.c,v 1.9 2002/10/26 15:24:19 gbazin Exp $
  *
  * Author: Johan Bilien <jobi@via.ecp.fr>
  *
@@ -315,10 +315,6 @@ static int VCDRead( input_thread_t * p_input, byte_t * p_buffer,
                                    p_last_sector, i_len % VCD_DATA_SIZE );
         i_read += i_len % VCD_DATA_SIZE;
     }
-    
-    p_input->stream.p_selected_area->i_tell = 
-        (off_t)p_vcd->i_sector * (off_t)VCD_DATA_SIZE
-         - p_input->stream.p_selected_area->i_start;
 
     return i_read;
 }
index 7f74315f08c9e6f098101c822213d920b2c2c36b..fcc5ae1566d597ff964cb3f6bf3cd10915f52135 100644 (file)
@@ -2,7 +2,7 @@
  * input_ext-plugins.c: useful functions for access and demux plug-ins
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: input_ext-plugins.c,v 1.18 2002/07/31 20:56:52 sam Exp $
+ * $Id: input_ext-plugins.c,v 1.19 2002/10/26 15:24:19 gbazin Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -613,6 +613,11 @@ ssize_t input_SplitBuffer( input_thread_t * p_input,
 
     p_input->p_current_data += i_size;
 
+    /* Update stream position */
+    vlc_mutex_lock( &p_input->stream.stream_lock );
+    p_input->stream.p_selected_area->i_tell += i_size;
+    vlc_mutex_unlock( &p_input->stream.stream_lock );
     return( i_size );
 }
 
@@ -706,13 +711,6 @@ ssize_t input_FDRead( input_thread_t * p_input, byte_t * p_buffer, size_t i_len
  
     ssize_t i_ret = read( p_access_data->i_handle, p_buffer, i_len );
  
-    if( i_ret > 0 )
-    {
-        vlc_mutex_lock( &p_input->stream.stream_lock );
-        p_input->stream.p_selected_area->i_tell += i_ret;
-        vlc_mutex_unlock( &p_input->stream.stream_lock );
-    }
     if( i_ret < 0 )
     {
         msg_Err( p_input, "read failed (%s)", strerror(errno) );