]> git.sesse.net Git - vlc/commitdiff
* all: use stream_Seek/Size/Tell wrappers.
authorLaurent Aimar <fenrir@videolan.org>
Fri, 22 Aug 2003 20:32:27 +0000 (20:32 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Fri, 22 Aug 2003 20:32:27 +0000 (20:32 +0000)
modules/demux/asf/asf.c
modules/demux/asf/libasf.c
modules/demux/au.c
modules/demux/wav.c

index 57aaab1e7744dd24f15490f4674653f18e5b4f5e..118d6aef145baf71a07b7491686461fe62f1e350 100644 (file)
@@ -2,7 +2,7 @@
  * asf.c : ASFv01 file input module for vlc
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: asf.c,v 1.34 2003/08/18 19:18:47 fenrir Exp $
+ * $Id: asf.c,v 1.35 2003/08/22 20:32:27 fenrir Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
@@ -317,26 +317,25 @@ static int Open( vlc_object_t * p_this )
 
     p_sys->i_data_begin = p_sys->p_root->p_data->i_object_pos + 50;
     if( p_sys->p_root->p_data->i_object_size != 0 )
-    { // local file
+    { /* local file */
         p_sys->i_data_end = p_sys->p_root->p_data->i_object_pos +
                                     p_sys->p_root->p_data->i_object_size;
     }
     else
-    { // live/broacast
+    { /* live/broacast */
         p_sys->i_data_end = -1;
     }
 
 
-    // go to first packet
-    stream_Control( p_sys->s, STREAM_SET_POSITION, (int64_t)p_sys->i_data_begin );
+    /* go to first packet */
+    stream_Seek( p_sys->s, p_sys->i_data_begin );
 
     /* try to calculate movie time */
     if( p_sys->p_fp->i_data_packets_count > 0 )
     {
         int64_t i_count;
-        int64_t i_size;
+        int64_t i_size = stream_Tell( p_sys->s );
 
-        stream_Control( p_sys->s, STREAM_GET_SIZE, &i_size );
         if( p_sys->i_data_end > 0 && i_size > p_sys->i_data_end )
         {
             i_size = p_sys->i_data_end;
@@ -487,8 +486,7 @@ static int Demux( input_thread_t *p_input )
 
         msleep( p_input->i_pts_delay );
 
-        stream_Control( p_sys->s, STREAM_GET_POSITION, &i_offset );
-        i_offset -= p_sys->i_data_begin;
+        i_offset = stream_Tell( p_sys->s ) - p_sys->i_data_begin;
         if( i_offset  < 0 )
         {
             i_offset = 0;
@@ -497,9 +495,8 @@ static int Demux( input_thread_t *p_input )
         {
             i_offset -= i_offset % p_sys->p_fp->i_min_data_packet_size;
         }
-        i_offset += p_sys->i_data_begin;
 
-        if( stream_Control( p_sys->s, STREAM_SET_POSITION, i_offset ) )
+        if( stream_Seek( p_sys->s, i_offset + p_sys->i_data_begin ) )
         {
             msg_Warn( p_input, "cannot resynch after seek (EOF?)" );
             return -1;
index 7611253fe65557c53464b0a6d5bc1e61323d5e6e..2b6f177b38f34bd082937b467b9bd7694c0560cb 100644 (file)
@@ -2,7 +2,7 @@
  * libasf.c :
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: libasf.c,v 1.15 2003/08/18 19:18:47 fenrir Exp $
+ * $Id: libasf.c,v 1.16 2003/08/22 20:32:27 fenrir Exp $
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -86,7 +86,7 @@ static int ASF_ReadObjectCommon( stream_t *s, asf_object_t *p_obj )
     }
     ASF_GetGUID( &p_common->i_object_id, p_peek );
     p_common->i_object_size = GetQWLE( p_peek + 16 );
-    stream_Control( s, STREAM_GET_POSITION, &p_common->i_object_pos );
+    p_common->i_object_pos  = stream_Tell( s );
     p_common->p_next = NULL;
 #ifdef ASF_DEBUG
     msg_Dbg( (vlc_object_t*)s,
@@ -125,8 +125,9 @@ static int ASF_NextObject( stream_t *s, asf_object_t *p_obj )
 
     }
 
-    return( stream_Control( s, STREAM_SET_POSITION,
-                            p_obj->common.i_object_pos + p_obj->common.i_object_size ) );
+    return stream_Seek( s,
+                        p_obj->common.i_object_pos +
+                           p_obj->common.i_object_size );
 }
 
 static void ASF_FreeObject_Null( asf_object_t *pp_obj )
@@ -721,7 +722,7 @@ asf_object_root_t *ASF_ReadObjectRoot( stream_t *s, int b_seekable )
     p_root->i_type = ASF_OBJECT_TYPE_ROOT;
     memcpy( &p_root->i_object_id, &asf_object_null_guid, sizeof( guid_t ) );
     p_root->i_object_pos = 0;
-    stream_Control( s, STREAM_GET_SIZE, &p_root->i_object_size );
+    p_root->i_object_size = stream_Tell( s );
     p_root->p_first = NULL;
     p_root->p_last  = NULL;
     p_root->p_next  = NULL;
index 483b0faa5b715721bc9747c78474db0da493df85..7b751214e68478664c0d3bd2c85e75ae125d2150 100644 (file)
@@ -2,7 +2,7 @@
  * au.c : au file input module for vlc
  *****************************************************************************
  * Copyright (C) 2001-2003 VideoLAN
- * $Id: au.c,v 1.4 2003/08/17 23:02:52 fenrir Exp $
+ * $Id: au.c,v 1.5 2003/08/22 20:32:27 fenrir Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
@@ -376,15 +376,14 @@ static int DemuxPCM( input_thread_t *p_input )
 
     if( p_input->stream.p_selected_program->i_synchro_state == SYNCHRO_REINIT )
     {
-        int64_t i_pos;
+        int64_t i_pos = stream_Tell( p_sys->s );
 
-        stream_Control( p_sys->s, STREAM_GET_POSITION, &i_pos );
         if( p_sys->wf.nBlockAlign != 0 )
         {
             i_pos += p_sys->wf.nBlockAlign - i_pos % p_sys->wf.nBlockAlign;
-            if( stream_Control( p_sys->s, STREAM_SET_POSITION, i_pos ) )
+            if( stream_Seek( p_sys->s, i_pos ) )
             {
-                msg_Err( p_input, "STREAM_SET_POSITION failed (cannot resync)" );
+                msg_Err( p_input, "Seek failed(cannot resync)" );
             }
         }
     }
index 6a2c3070e8a82e7e1457975a20edb2c262b1fab2..da8f38039da84835f2e384df6687705460b7ab25 100644 (file)
@@ -2,7 +2,7 @@
  * wav.c : wav file input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: wav.c,v 1.4 2003/08/18 00:17:44 fenrir Exp $
+ * $Id: wav.c,v 1.5 2003/08/22 20:32:27 fenrir Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
@@ -164,7 +164,7 @@ static int Open( vlc_object_t * p_this )
         goto error;
     }
 
-    stream_Control( p_sys->s, STREAM_GET_POSITION, &p_sys->i_data_pos );
+    p_sys->i_data_pos = stream_Tell( p_sys->s );
 
     stream_Read( p_sys->s, NULL, 8 );   /* cannot fail */
 
@@ -276,13 +276,13 @@ static int Demux( input_thread_t *p_input )
 
     if( p_input->stream.p_selected_program->i_synchro_state == SYNCHRO_REINIT )
     {
-        stream_Control( p_sys->s, STREAM_GET_POSITION, &i_pos );
+        i_pos = stream_Tell( p_sys->s );
         if( p_sys->p_wf->nBlockAlign != 0 )
         {
             i_pos += p_sys->p_wf->nBlockAlign - i_pos % p_sys->p_wf->nBlockAlign;
-            if( stream_Control( p_sys->s, STREAM_SET_POSITION, i_pos ) )
+            if( stream_Seek( p_sys->s, i_pos ) )
             {
-                msg_Err( p_input, "STREAM_SET_POSITION failed (cannot resync)" );
+                msg_Err( p_input, "stream_Sekk failed (cannot resync)" );
             }
         }
     }
@@ -291,7 +291,7 @@ static int Demux( input_thread_t *p_input )
                           p_input->stream.p_selected_program,
                           p_sys->i_time * 9 / 100 );
 
-    stream_Control( p_sys->s, STREAM_GET_POSITION, &i_pos );
+    i_pos = stream_Tell( p_sys->s );
 
     if( p_sys->i_data_size > 0 &&
         i_pos >= p_sys->i_data_pos + p_sys->i_data_size )