Commit 78335f88 authored by Stéphane Borel's avatar Stéphane Borel

Second step in area management ; everything is in place now to have

title handling; it is coming :)
parent 583c6553
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* control the pace of reading. * control the pace of reading.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-intf.h,v 1.23 2001/02/20 02:53:13 stef Exp $ * $Id: input_ext-intf.h,v 1.24 2001/02/20 08:47:24 stef Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -181,6 +181,7 @@ typedef struct stream_descriptor_s ...@@ -181,6 +181,7 @@ typedef struct stream_descriptor_s
int i_area_nb; int i_area_nb;
input_area_t ** pp_areas; /* list of areas in stream == offset input_area_t ** pp_areas; /* list of areas in stream == offset
* interval with own properties */ * interval with own properties */
input_area_t * p_selected_area;
u32 i_mux_rate; /* the rate we read the stream (in u32 i_mux_rate; /* the rate we read the stream (in
* units of 50 bytes/s) ; 0 if undef */ * units of 50 bytes/s) ; 0 if undef */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dvd_css.c: Functions for DVD authentification and unscrambling * dvd_css.c: Functions for DVD authentification and unscrambling
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_css.c,v 1.12 2001/02/20 07:49:12 sam Exp $ * $Id: dvd_css.c,v 1.13 2001/02/20 08:47:25 stef Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -1183,9 +1183,9 @@ int CSSGetKey( css_t * p_css ) ...@@ -1183,9 +1183,9 @@ int CSSGetKey( css_t * p_css )
{ {
#ifdef STATS #ifdef STATS
intf_WarnMsg( 1, "%d) %02X %02X %02X %02X %02X - %3.2f%%", i, intf_WarnMsg( 1, "%d) %02X %02X %02X %02X %02X - %3.2f%%", i,
p_title_key[i].key[0], p_title_key[i].key[1], p_title_key[i].pi_key[0], p_title_key[i].pi_key[1],
p_title_key[i].key[2], p_title_key[i].key[3], p_title_key[i].pi_key[2], p_title_key[i].pi_key[3],
p_title_key[i].key[4], p_title_key[i].pi_key[4],
p_title_key[i].i_occ * 100.0 / i_total_keys_found ); p_title_key[i].i_occ * 100.0 / i_total_keys_found );
#endif #endif
if( p_title_key[i_highest].i_occ * 100.0 / i_total_keys_found if( p_title_key[i_highest].i_occ * 100.0 / i_total_keys_found
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* -dvd_udf to find files * -dvd_udf to find files
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: input_dvd.c,v 1.16 2001/02/20 07:49:12 sam Exp $ * $Id: input_dvd.c,v 1.17 2001/02/20 08:47:25 stef Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -354,7 +354,7 @@ static int DVDSetArea( input_thread_t * p_input, ...@@ -354,7 +354,7 @@ static int DVDSetArea( input_thread_t * p_input,
int i_audio, int i_spu ) int i_audio, int i_spu )
{ {
thread_dvd_data_t * p_method; thread_dvd_data_t * p_method;
es_descriptor_t * p_es; // es_descriptor_t * p_es;
off_t i_start; off_t i_start;
off_t i_size; off_t i_size;
pgc_t * p_pgc; pgc_t * p_pgc;
...@@ -362,9 +362,9 @@ static int DVDSetArea( input_thread_t * p_input, ...@@ -362,9 +362,9 @@ static int DVDSetArea( input_thread_t * p_input,
int i_end_cell; int i_end_cell;
int i_index; int i_index;
int i_cell; int i_cell;
int i_nb; // int i_nb;
int i_id; // int i_id;
int i; // int i;
p_method = (thread_dvd_data_t*)p_input->p_plugin_data; p_method = (thread_dvd_data_t*)p_input->p_plugin_data;
...@@ -467,7 +467,7 @@ static int DVDSetArea( input_thread_t * p_input, ...@@ -467,7 +467,7 @@ static int DVDSetArea( input_thread_t * p_input,
p_es->i_stream_id = 0xbd; p_es->i_stream_id = 0xbd;
p_es->i_type = DVD_SPU_ES; p_es->i_type = DVD_SPU_ES;
// p_es->psz_desc = p_method->ifo.vts.mat.pi_subpic_attr[i]; // p_es->psz_desc = p_method->ifo.vts.mat.pi_subpic_attr[i];
if( i == 0 ) if( i == 12 )
{ {
input_SelectES( p_input, p_es ); input_SelectES( p_input, p_es );
} }
...@@ -475,15 +475,19 @@ static int DVDSetArea( input_thread_t * p_input, ...@@ -475,15 +475,19 @@ static int DVDSetArea( input_thread_t * p_input,
} }
/* area definition */ /* area definition */
p_input->stream.pp_areas[0]->i_start = i_start; p_input->stream.pp_areas[i_title]->i_start = i_start;
p_input->stream.pp_areas[0]->i_size = i_size; p_input->stream.pp_areas[i_title]->i_size = i_size;
/* No PSM to read in DVD mode */ /* No PSM to read in DVD mode */
p_input->stream.pp_programs[0]->b_is_ok = 1; p_input->stream.pp_programs[0]->b_is_ok = 1;
/* Init has been successfull ; change the default area */
p_input->stream.p_selected_area = p_input->stream.pp_areas[i_title];
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
#else #else
p_input->stream.p_selected_area = p_input->stream.pp_areas[0];
if( p_input->stream.b_seekable ) if( p_input->stream.b_seekable )
{ {
...@@ -524,7 +528,8 @@ static int DVDSetArea( input_thread_t * p_input, ...@@ -524,7 +528,8 @@ static int DVDSetArea( input_thread_t * p_input,
} }
/* File too big. */ /* File too big. */
if( p_input->stream.pp_areas[0]->i_tell > INPUT_PREPARSE_LENGTH ) if( p_input->stream.p_selected_area->i_tell >
INPUT_PREPARSE_LENGTH )
{ {
break; break;
} }
...@@ -534,7 +539,7 @@ static int DVDSetArea( input_thread_t * p_input, ...@@ -534,7 +539,7 @@ static int DVDSetArea( input_thread_t * p_input,
/* i_tell is an indicator from the beginning of the stream, /* i_tell is an indicator from the beginning of the stream,
* not of the DVD */ * not of the DVD */
p_input->stream.pp_areas[0]->i_tell = 0; p_input->stream.p_selected_area->i_tell = 0;
if( p_demux_data->b_has_PSM ) if( p_demux_data->b_has_PSM )
{ {
...@@ -609,7 +614,7 @@ static int DVDSetArea( input_thread_t * p_input, ...@@ -609,7 +614,7 @@ static int DVDSetArea( input_thread_t * p_input,
#endif #endif
/* FIXME : ugly kludge */ /* FIXME : ugly kludge */
p_input->stream.pp_areas[0]->i_size = i_size; p_input->stream.p_selected_area->i_size = i_size;
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
} }
...@@ -620,7 +625,7 @@ static int DVDSetArea( input_thread_t * p_input, ...@@ -620,7 +625,7 @@ static int DVDSetArea( input_thread_t * p_input,
p_input->stream.pp_programs[0]->b_is_ok = 0; p_input->stream.pp_programs[0]->b_is_ok = 0;
/* FIXME : ugly kludge */ /* FIXME : ugly kludge */
p_input->stream.pp_areas[0]->i_size = i_size; p_input->stream.p_selected_area->i_size = i_size;
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
} }
...@@ -845,7 +850,8 @@ static int DVDRead( input_thread_t * p_input, ...@@ -845,7 +850,8 @@ static int DVDRead( input_thread_t * p_input,
pp_packets[i_packet] = NULL; pp_packets[i_packet] = NULL;
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.pp_areas[0]->i_tell += p_method->i_read_once *DVD_LB_SIZE; p_input->stream.p_selected_area->i_tell +=
p_method->i_read_once *DVD_LB_SIZE;
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
return( 0 ); return( 0 );
...@@ -873,14 +879,15 @@ static void DVDSeek( input_thread_t * p_input, off_t i_off ) ...@@ -873,14 +879,15 @@ static void DVDSeek( input_thread_t * p_input, off_t i_off )
p_method = ( thread_dvd_data_t * )p_input->p_plugin_data; p_method = ( thread_dvd_data_t * )p_input->p_plugin_data;
/* We have to take care of offset of beginning of title */ /* We have to take care of offset of beginning of title */
i_pos = i_off + p_input->stream.pp_areas[0]->i_start; i_pos = i_off + p_input->stream.p_selected_area->i_start;
/* With DVD, we have to be on a sector boundary */ /* With DVD, we have to be on a sector boundary */
i_pos = i_pos & (~0x7ff); i_pos = i_pos & (~0x7ff);
i_pos = lseek( p_input->i_handle, i_pos, SEEK_SET ); i_pos = lseek( p_input->i_handle, i_pos, SEEK_SET );
p_input->stream.pp_areas[0]->i_tell = i_pos - p_input->stream.pp_areas[0]->i_start; p_input->stream.p_selected_area->i_tell = i_pos -
p_input->stream.p_selected_area->i_start;
return; return;
} }
...@@ -442,7 +442,7 @@ on_hscale_button_release_event (GtkWidget *widget, ...@@ -442,7 +442,7 @@ on_hscale_button_release_event (GtkWidget *widget,
if( p_intf->p_input != NULL ) if( p_intf->p_input != NULL )
{ {
i_seek = (p_adj->value * i_seek = (p_adj->value *
p_intf->p_input->stream.pp_areas[0]->i_size) / 100; p_intf->p_input->stream.p_selected_area->i_size) / 100;
input_Seek( p_intf->p_input, i_seek ); input_Seek( p_intf->p_input, i_seek );
} }
p_intf->p_sys->b_scale_isfree = 1; p_intf->p_sys->b_scale_isfree = 1;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf_gnome.c: Gnome interface * intf_gnome.c: Gnome interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: intf_gnome.c,v 1.15 2001/02/20 07:49:13 sam Exp $ * $Id: intf_gnome.c,v 1.16 2001/02/20 08:47:25 stef Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -256,8 +256,9 @@ static gint GnomeManage( gpointer p_data ) ...@@ -256,8 +256,9 @@ static gint GnomeManage( gpointer p_data )
p_adj = gtk_range_get_adjustment ( GTK_RANGE( p_scale ) ); p_adj = gtk_range_get_adjustment ( GTK_RANGE( p_scale ) );
/* Update the value */ /* Update the value */
p_adj->value = ( 100. * p_intf->p_input->stream.pp_areas[0]->i_tell ) p_adj->value = ( 100. *
/ p_intf->p_input->stream.pp_areas[0]->i_size; p_intf->p_input->stream.p_selected_area->i_tell ) /
p_intf->p_input->stream.p_selected_area->i_size;
/* Gtv does it this way. Why not. */ /* Gtv does it this way. Why not. */
gtk_range_set_adjustment ( GTK_RANGE( p_scale ), p_adj ); gtk_range_set_adjustment ( GTK_RANGE( p_scale ), p_adj );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_ps.c: PS demux and packet management * input_ps.c: PS demux and packet management
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_ps.c,v 1.8 2001/02/20 07:49:13 sam Exp $ * $Id: input_ps.c,v 1.9 2001/02/20 08:47:25 stef Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -205,14 +205,15 @@ static void PSInit( input_thread_t * p_input ) ...@@ -205,14 +205,15 @@ static void PSInit( input_thread_t * p_input )
} }
/* File too big. */ /* File too big. */
if( p_input->stream.pp_areas[0]->i_tell > INPUT_PREPARSE_LENGTH ) if( p_input->stream.p_selected_area->i_tell >
INPUT_PREPARSE_LENGTH )
{ {
break; break;
} }
} }
rewind( p_method->stream ); rewind( p_method->stream );
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.pp_areas[0]->i_tell = 0; p_input->stream.p_selected_area->i_tell = 0;
if( p_demux_data->b_has_PSM ) if( p_demux_data->b_has_PSM )
{ {
/* (The PSM decoder will care about spawning the decoders) */ /* (The PSM decoder will care about spawning the decoders) */
...@@ -328,7 +329,7 @@ static __inline__ int SafeRead( input_thread_t * p_input, byte_t * p_buffer, ...@@ -328,7 +329,7 @@ static __inline__ int SafeRead( input_thread_t * p_input, byte_t * p_buffer,
} }
} }
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.pp_areas[0]->i_tell += i_len; p_input->stream.p_selected_area->i_tell += i_len;
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
return( 0 ); return( 0 );
} }
...@@ -470,7 +471,7 @@ static void PSSeek( input_thread_t * p_input, off_t i_position ) ...@@ -470,7 +471,7 @@ static void PSSeek( input_thread_t * p_input, off_t i_position )
/* A little bourrin but should work for a while --Meuuh */ /* A little bourrin but should work for a while --Meuuh */
fseeko( p_method->stream, i_position, SEEK_SET ); fseeko( p_method->stream, i_position, SEEK_SET );
p_input->stream.pp_areas[0]->i_tell = i_position; p_input->stream.p_selected_area->i_tell = i_position;
} }
/* /*
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* decoders. * decoders.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input.c,v 1.85 2001/02/20 02:53:13 stef Exp $ * $Id: input.c,v 1.86 2001/02/20 08:47:25 stef Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -112,7 +112,8 @@ input_thread_t *input_CreateThread ( playlist_item_t *p_item, int *pi_status ) ...@@ -112,7 +112,8 @@ input_thread_t *input_CreateThread ( playlist_item_t *p_item, int *pi_status )
p_input->stream.pp_areas = NULL; p_input->stream.pp_areas = NULL;
/* By default there is one areas in a stream */ /* By default there is one areas in a stream */
input_AddArea( p_input ); input_AddArea( p_input );
p_input->stream.pp_areas[0]->i_seek = NO_SEEK; p_input->stream.p_selected_area = p_input->stream.pp_areas[0];
p_input->stream.p_selected_area->i_seek = NO_SEEK;
/* Initialize stream control properties. */ /* Initialize stream control properties. */
p_input->stream.control.i_status = PLAYING_S; p_input->stream.control.i_status = PLAYING_S;
...@@ -214,11 +215,12 @@ static void RunThread( input_thread_t *p_input ) ...@@ -214,11 +215,12 @@ static void RunThread( input_thread_t *p_input )
#endif #endif
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
if( p_input->stream.pp_areas[0]->i_seek != NO_SEEK ) if( p_input->stream.p_selected_area->i_seek != NO_SEEK )
{ {
if( p_input->stream.b_seekable && p_input->pf_seek != NULL ) if( p_input->stream.b_seekable && p_input->pf_seek != NULL )
{ {
p_input->pf_seek( p_input, p_input->stream.pp_areas[0]->i_seek ); p_input->pf_seek( p_input,
p_input->stream.p_selected_area->i_seek );
for( i = 0; i < p_input->stream.i_pgrm_number; i++ ) for( i = 0; i < p_input->stream.i_pgrm_number; i++ )
{ {
...@@ -232,7 +234,7 @@ static void RunThread( input_thread_t *p_input ) ...@@ -232,7 +234,7 @@ static void RunThread( input_thread_t *p_input )
p_pgrm->i_synchro_state = SYNCHRO_REINIT; p_pgrm->i_synchro_state = SYNCHRO_REINIT;
} }
} }
p_input->stream.pp_areas[0]->i_seek = NO_SEEK; p_input->stream.p_selected_area->i_seek = NO_SEEK;
} }
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
...@@ -449,7 +451,7 @@ void input_FileOpen( input_thread_t * p_input ) ...@@ -449,7 +451,7 @@ void input_FileOpen( input_thread_t * p_input )
|| S_ISBLK(stat_info.st_mode) ) || S_ISBLK(stat_info.st_mode) )
{ {
p_input->stream.b_seekable = 1; p_input->stream.b_seekable = 1;
p_input->stream.pp_areas[0]->i_size = stat_info.st_size; p_input->stream.p_selected_area->i_size = stat_info.st_size;
} }
else if( S_ISFIFO(stat_info.st_mode) else if( S_ISFIFO(stat_info.st_mode)
#ifndef SYS_BEOS #ifndef SYS_BEOS
...@@ -458,7 +460,7 @@ void input_FileOpen( input_thread_t * p_input ) ...@@ -458,7 +460,7 @@ void input_FileOpen( input_thread_t * p_input )
) )
{ {
p_input->stream.b_seekable = 0; p_input->stream.b_seekable = 0;
p_input->stream.pp_areas[0]->i_size = 0; p_input->stream.p_selected_area->i_size = 0;
} }
else else
{ {
...@@ -469,7 +471,7 @@ void input_FileOpen( input_thread_t * p_input ) ...@@ -469,7 +471,7 @@ void input_FileOpen( input_thread_t * p_input )
return; return;
} }
p_input->stream.pp_areas[0]->i_tell = 0; p_input->stream.p_selected_area->i_tell = 0;
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
intf_Msg( "input: opening %s", p_input->p_source ); intf_Msg( "input: opening %s", p_input->p_source );
......
...@@ -138,10 +138,10 @@ void input_SetRate( input_thread_t * p_input, int i_mode ) ...@@ -138,10 +138,10 @@ void input_SetRate( input_thread_t * p_input, int i_mode )
void input_Seek( input_thread_t * p_input, off_t i_position ) void input_Seek( input_thread_t * p_input, off_t i_position )
{ {
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.pp_areas[0]->i_seek = i_position; p_input->stream.p_selected_area->i_seek = i_position;
intf_Msg( "input: seeking position %lld/%lld", i_position, intf_Msg( "input: seeking position %lld/%lld", i_position,
p_input->stream.pp_areas[0]->i_size ); p_input->stream.p_selected_area->i_size );
vlc_cond_signal( &p_input->stream.stream_wait ); vlc_cond_signal( &p_input->stream.stream_wait );
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management * input_programs.c: es_descriptor_t, pgrm_descriptor_t management
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: input_programs.c,v 1.32 2001/02/20 02:53:13 stef Exp $ * $Id: input_programs.c,v 1.33 2001/02/20 08:47:25 stef Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -484,7 +484,7 @@ void input_DumpStream( input_thread_t * p_input ) ...@@ -484,7 +484,7 @@ void input_DumpStream( input_thread_t * p_input )
intf_Msg( "input info: Dumping stream ID 0x%x", S.i_stream_id ); intf_Msg( "input info: Dumping stream ID 0x%x", S.i_stream_id );
if( S.b_seekable ) if( S.b_seekable )
intf_Msg( "input info: seekable stream, position: %lld/%lld", intf_Msg( "input info: seekable stream, position: %lld/%lld",
S.pp_areas[0].i_tell, S.pp_areas[0].i_size ); S.p_selected_area->i_tell, S.p_selected_area->i_size );
else else
intf_Msg( "input info: %s", S.b_pace_control ? "pace controlled" : intf_Msg( "input info: %s", S.b_pace_control ? "pace controlled" :
"pace un-controlled" ); "pace un-controlled" );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment