From: Laurent Aimar Date: Fri, 22 Aug 2003 20:32:27 +0000 (+0000) Subject: * all: use stream_Seek/Size/Tell wrappers. X-Git-Tag: 0.7.0~1079 X-Git-Url: http://git.videolan.org/gitweb.cgi/vlc.git/?p=vlc.git;p=vlc.git;a=commitdiff_plain;h=76ae09510ee740415263b265c043fd3403812f52 * all: use stream_Seek/Size/Tell wrappers. --- diff --git a/modules/demux/asf/asf.c b/modules/demux/asf/asf.c index 57aaab1e77..118d6aef14 100644 --- a/modules/demux/asf/asf.c +++ b/modules/demux/asf/asf.c @@ -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 * @@ -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; diff --git a/modules/demux/asf/libasf.c b/modules/demux/asf/libasf.c index 7611253fe6..2b6f177b38 100644 --- a/modules/demux/asf/libasf.c +++ b/modules/demux/asf/libasf.c @@ -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 * * 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; diff --git a/modules/demux/au.c b/modules/demux/au.c index 483b0faa5b..7b751214e6 100644 --- a/modules/demux/au.c +++ b/modules/demux/au.c @@ -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 * @@ -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)" ); } } } diff --git a/modules/demux/wav.c b/modules/demux/wav.c index 6a2c3070e8..da8f38039d 100644 --- a/modules/demux/wav.c +++ b/modules/demux/wav.c @@ -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 * @@ -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 )