Commit 05ca1094 authored by Laurent Aimar's avatar Laurent Aimar

* include/input_ext-intf.h : added stream_t member to input_thread_t.

 * modules/demux/* : use the stream_t from input_thread_t.
 * include/ninput.h : begin to add new way to register es. (unused for now).
 (in the long term I want to split input_thread_t and intoduce demux_t and
 access_t and perhaps something like access_demux_t)
parent 98f58ea0
......@@ -4,7 +4,7 @@
* control the pace of reading.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-intf.h,v 1.93 2003/08/02 15:22:07 fenrir Exp $
* $Id: input_ext-intf.h,v 1.94 2003/09/12 16:26:40 fenrir Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -313,6 +313,9 @@ struct input_thread_t
size_t i_mtu;
int i_pts_delay; /* internal caching */
/* Stream */
stream_t *s;
/* Demux module */
module_t * p_demux;
int (* pf_demux ) ( input_thread_t * );
......
......@@ -2,7 +2,7 @@
* ninput.h
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: ninput.h,v 1.8 2003/09/07 22:45:16 fenrir Exp $
* $Id: ninput.h,v 1.9 2003/09/12 16:26:40 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -24,6 +24,132 @@
#ifndef _NINPUT_H
#define _NINPUT_H 1
#if 0
enum es_extra_type_e
{
ES_EXTRA_TYPE_UNKNOWN,
ES_EXTRA_TYPE_WAVEFORMATEX,
ES_EXTRA_TYPE_BITMAPINFOHEADER
};
typedef struct
{
int i_cat;
vlc_fourcc_t i_codec;
int i_group; /* eg -1. if >= 0 then a "group" (program) is
created for each value */
int i_priority; /* -2 : mean not selectable by the users
-1 : mean not selected by default even
when no other stream
>=0: priority */
char *psz_language;
char *psz_description;
struct
{
int i_samplerate;
int i_channels;
int i_bitrate;
int i_blockalign;
int i_bitspersample;
} audio;
struct
{
int i_width;
int i_height;
int i_display_width;
int i_display_height;
} video;
struct
{
char *psz_encoding;
} subs;
int i_extra_type;
int i_extra;
void *p_extra;
} es_format_t;
static inline void es_format_Init( es_format_t *fmt,
int i_cat, vlc_fourcc_t i_codec )
{
fmt->i_cat = i_cat;
fmt->i_codec = i_codec;
fmt->i_group = -1;
fmt->i_priority = 0;
fmt->psz_language = NULL;
fmt->psz_description = NULL;
fmt->audio.i_samplerate = 0;
fmt->audio.i_channels = 0;
fmt->audio.i_bitrate = 0;
fmt->audio.i_blockalign = 0;
fmt->audio.i_bitspersample = 0;
fmt->video.i_width = 0;
fmt->video.i_height = 0;
fmt->video.i_display_width = 0;
fmt->video.i_display_height = 0;
fmt->subs.psz_encoding = NULL;
fmt->i_extra_type = ES_EXTRA_TYPE_UNKNOWN;
fmt->i_extra = 0;
fmt->p_extra = NULL;
}
enum es_out_query_e
{
ES_OUT_SET_SELECT, /* arg1= es_out_id_t* arg2=vlc_bool_t */
ES_OUT_GET_SELECT /* arg1= es_out_id_t* arg2=vlc_bool_t* */
};
typedef struct es_out_t es_out_t;
typedef struct es_out_id_t es_out_id_t;
typedef struct es_out_sys_t es_out_sys_t;
struct es_out_t
{
es_out_id_t (*pf_add) ( es_out_t *, es_format_t * );
int (*pf_send) ( es_out_t *, es_out_id_t *, pes_packet_t * );
void (*pf_del) ( es_out_t *, es_out_id_t * );
int (*pf_control)( es_out_t *, int i_query, va_list );
es_out_sys_t *p_sys;
};
static inline es_out_id_t * es_out_Add( es_out_t *out, es_format_t *fmt )
{
return out->pf_add( out, fmt );
}
static inline void es_out_Del( es_out_t *out, es_out_id_t *id )
{
out->pf_del( out, id );
}
static inline int es_out_Send( es_out_t *out, es_out_id_t *id, pes_packet_t *p_pes )
{
return out->pf_send( out, id, p_pes );
}
static inline int es_out_vaControl( es_out_t *out, int i_query, va_list args )
{
return out->pf_control( out, i_query, args );
}
static inline int es_out_Control( es_out_t *out, int i_query, ... )
{
va_list args;
int i_result;
va_start( args, i_query );
i_result = es_out_vaControl( out, i_query, args );
va_end( args );
return i_result;
}
#endif
/**
* \defgroup stream Stream
*
......@@ -83,7 +209,6 @@ static int inline stream_Seek( stream_t *s, int64_t i_pos )
/**
* \defgroup demux Demux
* XXX: don't look at it yet.
* @{
*/
enum demux_query_e
......
......@@ -2,7 +2,7 @@
* a52.c : Raw a52 Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: a52sys.c,v 1.5 2003/09/07 22:48:29 fenrir Exp $
* $Id: a52sys.c,v 1.6 2003/09/12 16:26:40 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -53,7 +53,6 @@ static int Demux ( input_thread_t * );
struct demux_sys_t
{
stream_t *s;
mtime_t i_time;
es_descriptor_t *p_es;
......@@ -132,13 +131,7 @@ static int Open( vlc_object_t * p_this )
p_input->p_demux_data = p_sys = malloc( sizeof( demux_sys_t ) );
p_sys->i_time = 0;
if( ( p_sys->s = stream_OpenInput( p_input ) ) == NULL )
{
msg_Err( p_input, "cannot create stream" );
goto error;
}
if( stream_Peek( p_sys->s, &p_peek, 6 ) < 6 )
if( stream_Peek( p_input->s, &p_peek, 6 ) < 6 )
{
msg_Err( p_input, "cannot peek" );
goto error;
......@@ -198,10 +191,6 @@ static int Open( vlc_object_t * p_this )
return VLC_SUCCESS;
error:
if( p_sys->s )
{
stream_Release( p_sys->s );
}
free( p_sys );
return VLC_EGENERIC;
}
......@@ -221,7 +210,7 @@ static int Demux( input_thread_t * p_input )
uint8_t *p_peek;
if( stream_Peek( p_sys->s, &p_peek, 6 ) < 6 )
if( stream_Peek( p_input->s, &p_peek, 6 ) < 6 )
{
msg_Warn( p_input, "cannot peek" );
return 0;
......@@ -234,7 +223,7 @@ static int Demux( input_thread_t * p_input )
int i_skip = 0;
int i_peek;
i_peek = stream_Peek( p_sys->s, &p_peek, 8096 );
i_peek = stream_Peek( p_input->s, &p_peek, 8096 );
if( i_peek < 8 )
{
msg_Warn( p_input, "cannot peek" );
......@@ -255,7 +244,7 @@ static int Demux( input_thread_t * p_input )
}
msg_Warn( p_input, "garbage=%d bytes", i_skip );
stream_Read( p_sys->s, NULL, i_skip );
stream_Read( p_input->s, NULL, i_skip );
return 1;
}
......@@ -265,7 +254,7 @@ static int Demux( input_thread_t * p_input )
p_input->stream.p_selected_program,
p_sys->i_time * 9 / 100 );
if( ( p_pes = stream_PesPacket( p_sys->s, i_frame_size ) ) == NULL )
if( ( p_pes = stream_PesPacket( p_input->s, i_frame_size ) ) == NULL )
{
msg_Warn( p_input, "cannot read data" );
return 0;
......@@ -298,10 +287,6 @@ static void Close( vlc_object_t * p_this )
input_thread_t *p_input = (input_thread_t*)p_this;
demux_sys_t *p_sys = p_input->p_demux_data;
if( p_sys->s )
{
stream_Release( p_sys->s );
}
free( p_sys );
}
......
......@@ -2,7 +2,7 @@
* aac.c : Raw aac Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: aac.c,v 1.3 2003/09/07 22:48:29 fenrir Exp $
* $Id: aac.c,v 1.4 2003/09/12 16:26:40 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -54,7 +54,6 @@ static int Demux ( input_thread_t * );
struct demux_sys_t
{
stream_t *s;
mtime_t i_time;
es_descriptor_t *p_es;
......@@ -139,14 +138,8 @@ static int Open( vlc_object_t * p_this )
p_input->p_demux_data = p_sys = malloc( sizeof( demux_sys_t ) );
p_sys->i_time = 0;
if( ( p_sys->s = stream_OpenInput( p_input ) ) == NULL )
{
msg_Err( p_input, "cannot create stream" );
goto error;
}
/* peek the begining (10 is for adts header) */
if( stream_Peek( p_sys->s, &p_peek, 10 ) < 10 )
if( stream_Peek( p_input->s, &p_peek, 10 ) < 10 )
{
msg_Err( p_input, "cannot peek" );
goto error;
......@@ -213,10 +206,6 @@ static int Open( vlc_object_t * p_this )
return VLC_SUCCESS;
error:
if( p_sys->s )
{
stream_Release( p_sys->s );
}
free( p_sys );
return VLC_EGENERIC;
}
......@@ -235,7 +224,7 @@ static int Demux( input_thread_t * p_input )
uint8_t h[8];
uint8_t *p_peek;
if( stream_Peek( p_sys->s, &p_peek, 8 ) < 8 )
if( stream_Peek( p_input->s, &p_peek, 8 ) < 8 )
{
msg_Warn( p_input, "cannot peek" );
return 0;
......@@ -248,7 +237,7 @@ static int Demux( input_thread_t * p_input )
int i_skip = 0;
int i_peek;
i_peek = stream_Peek( p_sys->s, &p_peek, 8096 );
i_peek = stream_Peek( p_input->s, &p_peek, 8096 );
if( i_peek < 8 )
{
msg_Warn( p_input, "cannot peek" );
......@@ -269,7 +258,7 @@ static int Demux( input_thread_t * p_input )
}
msg_Warn( p_input, "garbage=%d bytes", i_skip );
stream_Read( p_sys->s, NULL, i_skip );
stream_Read( p_input->s, NULL, i_skip );
return 1;
}
......@@ -279,7 +268,7 @@ static int Demux( input_thread_t * p_input )
p_input->stream.p_selected_program,
p_sys->i_time * 9 / 100 );
if( ( p_pes = stream_PesPacket( p_sys->s, AAC_FRAME_SIZE( h ) ) ) == NULL )
if( ( p_pes = stream_PesPacket( p_input->s, AAC_FRAME_SIZE( h ) ) )==NULL )
{
msg_Warn( p_input, "cannot read data" );
return 0;
......@@ -312,10 +301,6 @@ static void Close( vlc_object_t * p_this )
input_thread_t *p_input = (input_thread_t*)p_this;
demux_sys_t *p_sys = p_input->p_demux_data;
if( p_sys->s )
{
stream_Release( p_sys->s );
}
free( p_sys );
}
......@@ -2,7 +2,7 @@
* asf.c : ASFv01 file input module for vlc
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: asf.c,v 1.37 2003/09/07 22:48:29 fenrir Exp $
* $Id: asf.c,v 1.38 2003/09/12 16:26:40 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -76,8 +76,6 @@ struct demux_sys_t
int64_t i_data_begin;
int64_t i_data_end;
stream_t *s;
};
static mtime_t GetMoviePTS( demux_sys_t * );
......@@ -123,20 +121,11 @@ static int Open( vlc_object_t * p_this )
p_sys->i_time = -1;
p_sys->i_length = 0;
/* Create stream facilities */
if( ( p_sys->s = stream_OpenInput( p_input ) ) == NULL )
{
msg_Err( p_input, "cannot create stream" );
free( p_sys );
return VLC_EGENERIC;
}
/* Now load all object ( except raw data ) */
stream_Control( p_sys->s, STREAM_CAN_FASTSEEK, &b_seekable );
if( (p_sys->p_root = ASF_ReadObjectRoot( p_sys->s, b_seekable )) == NULL )
stream_Control( p_input->s, STREAM_CAN_FASTSEEK, &b_seekable );
if( (p_sys->p_root = ASF_ReadObjectRoot( p_input->s, b_seekable )) == NULL )
{
msg_Warn( p_input, "ASF plugin discarded (not a valid file)" );
stream_Release( p_sys->s );
free( p_sys );
return VLC_EGENERIC;
}
......@@ -328,13 +317,13 @@ static int Open( vlc_object_t * p_this )
/* go to first packet */
stream_Seek( p_sys->s, p_sys->i_data_begin );
stream_Seek( p_input->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 = stream_Size( p_sys->s );
int64_t i_size = stream_Size( p_input->s );
if( p_sys->i_data_end > 0 && i_size > p_sys->i_data_end )
{
......@@ -446,8 +435,7 @@ static int Open( vlc_object_t * p_this )
return VLC_SUCCESS;
error:
ASF_FreeObjectRoot( p_sys->s, p_sys->p_root );
stream_Release( p_sys->s );
ASF_FreeObjectRoot( p_input->s, p_sys->p_root );
free( p_sys );
return VLC_EGENERIC;
}
......@@ -486,7 +474,7 @@ static int Demux( input_thread_t *p_input )
msleep( p_input->i_pts_delay );
i_offset = stream_Tell( p_sys->s ) - p_sys->i_data_begin;
i_offset = stream_Tell( p_input->s ) - p_sys->i_data_begin;
if( i_offset < 0 )
{
i_offset = 0;
......@@ -496,7 +484,7 @@ static int Demux( input_thread_t *p_input )
i_offset -= i_offset % p_sys->p_fp->i_min_data_packet_size;
}
if( stream_Seek( p_sys->s, i_offset + p_sys->i_data_begin ) )
if( stream_Seek( p_input->s, i_offset + p_sys->i_data_begin ) )
{
msg_Warn( p_input, "cannot resynch after seek (EOF?)" );
return -1;
......@@ -568,7 +556,7 @@ static void Close( vlc_object_t * p_this )
msg_Dbg( p_input, "Freeing all memory" );
ASF_FreeObjectRoot( p_sys->s, p_sys->p_root );
ASF_FreeObjectRoot( p_input->s, p_sys->p_root );
for( i_stream = 0; i_stream < 128; i_stream++ )
{
#define p_stream p_sys->stream[i_stream]
......@@ -582,7 +570,6 @@ static void Close( vlc_object_t * p_this )
}
#undef p_stream
}
stream_Release( p_sys->s );
free( p_sys );
}
......@@ -649,7 +636,7 @@ static int DemuxPacket( input_thread_t *p_input, vlc_bool_t b_play_audio )
int i_payload_length_type;
if( stream_Peek( p_sys->s, &p_peek, i_data_packet_min ) < i_data_packet_min )
if( stream_Peek( p_input->s, &p_peek,i_data_packet_min)<i_data_packet_min )
{
// EOF ?
msg_Warn( p_input, "cannot peek while getting new packet, EOF ?" );
......@@ -881,7 +868,7 @@ static int DemuxPacket( input_thread_t *p_input, vlc_bool_t b_play_audio )
}
i_read = i_sub_payload_data_length + i_skip;
if((p_data = stream_DataPacket( p_sys->s,i_read,VLC_TRUE)) == NULL)
if((p_data = stream_DataPacket( p_input->s,i_read,VLC_TRUE))==NULL)
{
msg_Warn( p_input, "cannot read data" );
return( 0 );
......@@ -905,7 +892,8 @@ static int DemuxPacket( input_thread_t *p_input, vlc_bool_t b_play_audio )
i_skip = 0;
if( i_packet_size_left > 0 )
{
if( stream_Peek( p_sys->s, &p_peek, i_packet_size_left ) < i_packet_size_left )
if( stream_Peek( p_input->s, &p_peek, i_packet_size_left )
< i_packet_size_left )
{
// EOF ?
msg_Warn( p_input, "cannot peek, EOF ?" );
......@@ -917,7 +905,8 @@ static int DemuxPacket( input_thread_t *p_input, vlc_bool_t b_play_audio )
if( i_packet_size_left > 0 )
{
if( stream_Read( p_sys->s, NULL, i_packet_size_left ) < i_packet_size_left )
if( stream_Read( p_input->s, NULL, i_packet_size_left )
< i_packet_size_left )
{
msg_Warn( p_input, "cannot skip data, EOF ?" );
return( 0 );
......@@ -933,7 +922,7 @@ loop_error_recovery:
msg_Err( p_input, "unsupported packet header, fatal error" );
return( -1 );
}
stream_Read( p_sys->s, NULL, i_data_packet_min );
stream_Read( p_input->s, NULL, i_data_packet_min );
return( 1 );
}
......
......@@ -2,7 +2,7 @@
* au.c : au file input module for vlc
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* $Id: au.c,v 1.6 2003/09/07 22:48:29 fenrir Exp $
* $Id: au.c,v 1.7 2003/09/12 16:26:40 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -92,8 +92,6 @@ typedef struct
struct demux_sys_t
{
stream_t *s;
au_t au;
WAVEFORMATEX wf;
......@@ -135,18 +133,11 @@ static int Open( vlc_object_t * p_this )
p_input->p_demux_data = p_sys = malloc( sizeof( demux_sys_t ) );
p_sys->i_time = 0;
if( ( p_sys->s = stream_OpenInput( p_input ) ) == NULL )
{
msg_Err( p_input, "cannot create stream" );
goto error;
}
/* skip signature */
stream_Read( p_sys->s, NULL, 4 ); /* cannot fail */
stream_Read( p_input->s, NULL, 4 ); /* cannot fail */
/* read header */
if( stream_Read( p_sys->s, &p_sys->au, sizeof( au_t ) ) < (int)sizeof( au_t ) )
if( stream_Read( p_input->s, &p_sys->au, sizeof(au_t) )<(int)sizeof(au_t) )
{
msg_Err( p_input, "cannot load header" );
goto error;
......@@ -174,7 +165,8 @@ static int Open( vlc_object_t * p_this )
/* skip extra header data */
if( p_sys->au.i_header_size > 4 + sizeof( au_t ) )
{
stream_Read( p_sys->s, NULL, p_sys->au.i_header_size - 4 - sizeof( au_t ) );
stream_Read( p_input->s,
NULL, p_sys->au.i_header_size - 4 - sizeof( au_t ) );
}
/* Create WAVEFORMATEX structure */
......@@ -356,10 +348,6 @@ static int Open( vlc_object_t * p_this )
return VLC_SUCCESS;
error:
if( p_sys->s )
{
stream_Release( p_sys->s );
}
free( p_sys );
return VLC_EGENERIC;
}
......@@ -376,12 +364,12 @@ static int DemuxPCM( input_thread_t *p_input )
if( p_input->stream.p_selected_program->i_synchro_state == SYNCHRO_REINIT )
{
int64_t i_pos = stream_Tell( p_sys->s );
int64_t i_pos = stream_Tell( p_input->s );
if( p_sys->wf.nBlockAlign != 0 )
{
i_pos += p_sys->wf.nBlockAlign - i_pos % p_sys->wf.nBlockAlign;
if( stream_Seek( p_sys->s, i_pos ) )
if( stream_Seek( p_input->s, i_pos ) )
{
msg_Err( p_input, "Seek failed(cannot resync)" );
}
......@@ -392,7 +380,7 @@ static int DemuxPCM( input_thread_t *p_input )
p_input->stream.p_selected_program,
p_sys->i_time * 9 / 100 );
if( ( p_pes = stream_PesPacket( p_sys->s, p_sys->i_frame_size ) ) == NULL )
if( ( p_pes = stream_PesPacket( p_input->s, p_sys->i_frame_size ) )==NULL )
{
msg_Warn( p_input, "cannot read data" );
return 0;
......@@ -422,7 +410,6 @@ static void Close( vlc_object_t * p_this )
input_thread_t *p_input = (input_thread_t *)p_this;
demux_sys_t *p_sys = p_input->p_demux_data;
stream_Release( p_sys->s );
free( p_sys );
}
......@@ -2,7 +2,7 @@
* avi.c : AVI file Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: avi.c,v 1.60 2003/09/07 22:48:29 fenrir Exp $
* $Id: avi.c,v 1.61 2003/09/12 16:26:40 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -150,14 +150,7 @@ static int Open( vlc_object_t * p_this )
p_avi->b_odml = VLC_FALSE;
p_avi->b_interleaved = VLC_FALSE;
/* Create stream facilities */
if( ( p_avi->s = stream_OpenInput( p_input ) ) == NULL )
{
msg_Err( p_input, "cannot create stream_t" );
free( p_avi );
return VLC_EGENERIC;
}
stream_Control( p_avi->s, STREAM_CAN_FASTSEEK, &p_avi->b_seekable );
stream_Control( p_input->s, STREAM_CAN_FASTSEEK, &p_avi->b_seekable );
p_input->pf_demux_control = Control;
p_input->pf_demux = Demux_Seekable;
......@@ -167,7 +160,7 @@ static int Open( vlc_object_t * p_this )
p_input->pf_demux = Demux_UnSeekable;
}
if( AVI_ChunkReadRoot( p_avi->s, &p_avi->ck_root ) )
if( AVI_ChunkReadRoot( p_input->s, &p_avi->ck_root ) )
{
msg_Err( p_input, "avi module discarded (invalid file)" );
return VLC_EGENERIC;
......@@ -507,7 +500,7 @@ static int Open( vlc_object_t * p_this )
if( p_avi->i_length )
{
p_input->stream.i_mux_rate =
stream_Size( p_avi->s ) / 50 / p_avi->i_length;
stream_Size( p_input->s ) / 50 / p_avi->i_length;
p_avi->b_interleaved = AVI_Interleaved( p_input );
msg_Dbg( p_input, "interleaved=%s",
......@@ -547,17 +540,16 @@ static int Open( vlc_object_t * p_this )
if( p_avi->b_seekable )
{
/* we have read all chunk so go back to movi */
stream_Seek( p_avi->s, p_movi->i_chunk_pos );
stream_Seek( p_input->s, p_movi->i_chunk_pos );
}
/* Skip movi header */
stream_Read( p_avi->s, NULL, 12 );
stream_Read( p_input->s, NULL, 12 );
p_avi->i_movi_begin = p_movi->i_chunk_pos;
return VLC_SUCCESS;
error:
AVI_ChunkFreeRoot( p_avi->s, &p_avi->ck_root );
stream_Release( p_avi->s );
AVI_ChunkFreeRoot( p_input->s, &p_avi->ck_root );
free( p_avi );
return VLC_EGENERIC;
}
......@@ -584,9 +576,8 @@ static void Close ( vlc_object_t * p_this )
{
subtitle_Close( p_avi->p_sub );
}
AVI_ChunkFreeRoot( p_avi->s, &p_avi->ck_root );
AVI_ChunkFreeRoot( p_input->s, &p_avi->ck_root );
stream_Release( p_avi->s );
free( p_avi );
}
......@@ -656,32 +647,8 @@ static int Demux_Seekable( input_thread_t *p_input )
msg_Warn( p_input, "no track selected, exiting..." );
return( 0 );
}
#if 0
if( p_input->stream.p_selected_program->i_synchro_state == SYNCHRO_REINIT )
{
mtime_t i_date;
int i_percent;
/* first wait for empty buffer, arbitrary time FIXME */
//msleep( DEFAULT_PTS_DELAY );
i_date = (mtime_t)1000000 *
(mtime_t)p_avi->i_length *
(mtime_t)stream_Tell( p_avi->s ) /
(mtime_t)stream_Size( p_avi->s );
i_percent = 100 * stream_Tell( p_avi->s ) /
stream_Size( p_avi->s );
Seek( p_input, i_date, i_percent);
if( p_avi->p_sub )
{
subtitle_Seek( p_avi->p_sub, p_avi->i_time );
}
}
#endif
/* wait for the good time */
p_avi->i_pcr = p_avi->i_time * 9 / 100;
input_ClockManageRef( p_input,
......@@ -788,7 +755,7 @@ static int Demux_Seekable( input_thread_t *p_input )
* in case we fail we will disable all finished stream */
if( p_avi->i_movi_lastchunk_pos >= p_avi->i_movi_begin + 12 )
{
stream_Seek( p_avi->s, p_avi->i_movi_lastchunk_pos );
stream_Seek( p_input->s, p_avi->i_movi_lastchunk_pos );
if( AVI_PacketNext( p_input ) )
{
return( AVI_StreamStopFinishedStreams( p_input ) ? 0 : 1 );
......@@ -796,7 +763,7 @@ static int Demux_Seekable( input_thread_t *p_input )
}
else
{
stream_Seek( p_avi->s, p_avi->i_movi_begin + 12 );
stream_Seek( p_input->s, p_avi->i_movi_begin + 12 );
}
for( ;; )
......@@ -855,7 +822,7 @@ static int Demux_Seekable( input_thread_t *p_input )
}
else
{
stream_Seek( p_avi->s, i_pos );
stream_Seek( p_input->s, i_pos );
}
/* read thoses data */
......@@ -888,7 +855,7 @@ static int Demux_Seekable( input_thread_t *p_input )
i_size += 8; // need to read and skip header
}
if( ( p_pes = stream_PesPacket( p_avi->s, __EVEN( i_size ) ) ) == NULL )
if( ( p_pes = stream_PesPacket( p_input->s, __EVEN( i_size ) ) )==NULL )
{
msg_Warn( p_input, "failled reading data" );
AVI_StreamStop( p_input, i_stream );
......@@ -1165,7 +1132,7 @@ static int Seek( input_thread_t *p_input, mtime_t i_date, int i_percent )
/* try to find chunk that is at i_percent or the file */
i_pos = __MAX( i_percent *
stream_Size( p_avi->s ) / 100,
stream_Size( p_input->s ) / 100,
p_avi->i_movi_begin );
/* search first selected stream */
for( i_stream = 0, p_stream = NULL;
......@@ -1272,7 +1239,7 @@ static int Control( input_thread_t *p_input, int i_query, va_list args )
*pf = (double)p_sys->i_time / (double)( p_sys->i_length * (mtime_t)1000000 );
return VLC_SUCCESS;
}
else if( stream_Size( p_sys->s ) > 0 )
else if( stream_Size( p_input->s ) > 0 )
{
unsigned int i;
int64_t i_tmp;
......@@ -1293,7 +1260,7 @@ static int Control( input_thread_t *p_input, int i_query, va_list args )
}
#undef tk
}
*pf = (double)i64 / (double)stream_Size( p_sys->s );
*pf = (double)i64 / (double)stream_Size( p_input->s );
return VLC_SUCCESS;
}
else
......@@ -1467,7 +1434,7 @@ static int AVI_StreamChunkFind( input_thread_t *p_input,
if( p_avi->i_movi_lastchunk_pos >= p_avi->i_movi_begin + 12 )
{
stream_Seek( p_avi->s, p_avi->i_movi_lastchunk_pos );
stream_Seek( p_input->s, p_avi->i_movi_lastchunk_pos );
if( AVI_PacketNext( p_input ) )
{
return VLC_EGENERIC;
......@@ -1475,7 +1442,7 @@ static int AVI_StreamChunkFind( input_thread_t *p_input,
}
else
{
stream_Seek( p_avi->s, p_avi->i_movi_begin + 12 );
stream_Seek( p_input->s, p_avi->i_movi_begin + 12 );
}
for(