]> git.sesse.net Git - vlc/commitdiff
Second step in area management ; everything is in place now to have
authorStéphane Borel <stef@videolan.org>
Tue, 20 Feb 2001 08:47:25 +0000 (08:47 +0000)
committerStéphane Borel <stef@videolan.org>
Tue, 20 Feb 2001 08:47:25 +0000 (08:47 +0000)
title handling; it is coming :)

include/input_ext-intf.h
plugins/dvd/dvd_css.c
plugins/dvd/input_dvd.c
plugins/gnome/gnome_callbacks.c
plugins/gnome/intf_gnome.c
plugins/mpeg/input_ps.c
src/input/input.c
src/input/input_ext-intf.c
src/input/input_programs.c

index d1c4101d543c15847025c5ee5386f9a58788623c..2c2f11635375df38066619ac5239717d61aa06d3 100644 (file)
@@ -4,7 +4,7 @@
  * control the pace of reading. 
  *****************************************************************************
  * 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>
  *
@@ -181,6 +181,7 @@ typedef struct stream_descriptor_s
     int                     i_area_nb;
     input_area_t **         pp_areas;      /* list of areas in stream == offset
                                             * interval with own properties */
+    input_area_t *          p_selected_area;
     u32                     i_mux_rate; /* the rate we read the stream (in
                                          * units of 50 bytes/s) ; 0 if undef */
 
index 235ad4eb7714de46265f718270e42fd6a8c3429b..7d9a438fb5186d44c65e5d97cd70b75e120a4ac2 100644 (file)
@@ -2,7 +2,7 @@
  * dvd_css.c: Functions for DVD authentification and unscrambling
  *****************************************************************************
  * 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: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -1183,9 +1183,9 @@ int CSSGetKey( css_t * p_css )
     {
 #ifdef STATS
         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].key[2], p_title_key[i].key[3],
-                    p_title_key[i].key[4],
+                    p_title_key[i].pi_key[0], p_title_key[i].pi_key[1],
+                    p_title_key[i].pi_key[2], p_title_key[i].pi_key[3],
+                    p_title_key[i].pi_key[4],
                     p_title_key[i].i_occ * 100.0 / i_total_keys_found );
 #endif
         if( p_title_key[i_highest].i_occ * 100.0 / i_total_keys_found
index 01ab2a12fa3fc58b17c715a919545fe9e1b0aaf5..7d831e267bdb365f12051355a631a5b5274c7122 100644 (file)
@@ -10,7 +10,7 @@
  *  -dvd_udf to find files
  *****************************************************************************
  * 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: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -354,7 +354,7 @@ static int DVDSetArea( input_thread_t * p_input,
                        int i_audio, int i_spu )
 {
     thread_dvd_data_t *  p_method;
-    es_descriptor_t *    p_es;
+//    es_descriptor_t *    p_es;
     off_t                i_start;
     off_t                i_size;
     pgc_t *              p_pgc;
@@ -362,9 +362,9 @@ static int DVDSetArea( input_thread_t * p_input,
     int                  i_end_cell;
     int                  i_index;
     int                  i_cell;
-    int                  i_nb;
-    int                  i_id;
-    int                  i;
+//    int                  i_nb;
+//    int                  i_id;
+//    int                  i;
     
     p_method = (thread_dvd_data_t*)p_input->p_plugin_data;
 
@@ -467,7 +467,7 @@ static int DVDSetArea( input_thread_t * p_input,
         p_es->i_stream_id = 0xbd;
         p_es->i_type = DVD_SPU_ES;
 //        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 );
         }
@@ -475,15 +475,19 @@ static int DVDSetArea( input_thread_t * p_input,
     }
 
     /* area definition */
-    p_input->stream.pp_areas[0]->i_start = i_start;
-    p_input->stream.pp_areas[0]->i_size = i_size;
+    p_input->stream.pp_areas[i_title]->i_start = i_start;
+    p_input->stream.pp_areas[i_title]->i_size = i_size;
 
     /* No PSM to read in DVD mode */
     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 );
 
 #else
+    p_input->stream.p_selected_area = p_input->stream.pp_areas[0]; 
 
     if( p_input->stream.b_seekable )
     {
@@ -524,7 +528,8 @@ static int DVDSetArea( input_thread_t * p_input,
             }
 
             /* 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;
             }
@@ -534,7 +539,7 @@ static int DVDSetArea( input_thread_t * p_input,
 
         /* i_tell is an indicator from the beginning of the stream,
          * 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 )
         {
@@ -609,7 +614,7 @@ static int DVDSetArea( input_thread_t * p_input,
 #endif
 
         /* 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 );
     }
@@ -620,7 +625,7 @@ static int DVDSetArea( input_thread_t * p_input,
         p_input->stream.pp_programs[0]->b_is_ok = 0;
 
         /* 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 );
     }
@@ -845,7 +850,8 @@ static int DVDRead( input_thread_t * p_input,
     pp_packets[i_packet] = NULL;
 
     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 );
 
     return( 0 );
@@ -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;
 
     /* 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 */
     i_pos = i_pos & (~0x7ff);
 
     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;
 }
index 53bb37631c4d6e9868a4ea5a904218b603190d1e..5bcad8632de721ae5d8bc265164f5fe095874d2f 100644 (file)
@@ -442,7 +442,7 @@ on_hscale_button_release_event         (GtkWidget       *widget,
     if( p_intf->p_input != NULL )
     {
         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 );
     }
     p_intf->p_sys->b_scale_isfree = 1;
index f3de8c330e1d2d33b8e88f8c4876b5e5abb409d2..0fe313e16267478e276f0475f617f7c2554ab48b 100644 (file)
@@ -2,7 +2,7 @@
  * intf_gnome.c: Gnome interface
  *****************************************************************************
  * 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>
  *
@@ -256,8 +256,9 @@ static gint GnomeManage( gpointer p_data )
         p_adj = gtk_range_get_adjustment ( GTK_RANGE( p_scale ) );
 
         /* Update the value */
-        p_adj->value = ( 100. * p_intf->p_input->stream.pp_areas[0]->i_tell )
-                           / p_intf->p_input->stream.pp_areas[0]->i_size;
+        p_adj->value = ( 100. *
+                         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. */
         gtk_range_set_adjustment ( GTK_RANGE( p_scale ), p_adj );
index 970d58f409f0ce6961b7deaaf060bb45b497d9e7..7f9850c1329fec4fb1383b295521eab92d09a37c 100644 (file)
@@ -2,7 +2,7 @@
  * input_ps.c: PS demux and packet management
  *****************************************************************************
  * 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>
  *
@@ -205,14 +205,15 @@ static void PSInit( input_thread_t * p_input )
             }
 
             /* 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;
             }
         }
         rewind( p_method->stream );
         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 )
         {
             /* (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,
         }
     }
     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 );
     return( 0 );
 }
@@ -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 */
     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;
 }
 
 /*
index b07c63e14207c5d9c568046f37728a74f4e99d1a..c2efdb555600380729b5fe84dc3068ad087f86cf 100644 (file)
@@ -4,7 +4,7 @@
  * decoders.
  *****************************************************************************
  * 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>
  *
@@ -112,7 +112,8 @@ input_thread_t *input_CreateThread ( playlist_item_t *p_item, int *pi_status )
     p_input->stream.pp_areas = NULL;
     /* By default there is one areas in a stream */
     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. */
     p_input->stream.control.i_status = PLAYING_S;
@@ -214,11 +215,12 @@ static void RunThread( input_thread_t *p_input )
 #endif
 
         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 )
             {
-                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++ )
                 {
@@ -232,7 +234,7 @@ static void RunThread( input_thread_t *p_input )
                     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 );
 
@@ -449,7 +451,7 @@ void input_FileOpen( input_thread_t * p_input )
          || S_ISBLK(stat_info.st_mode) )
     {
         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)
 #ifndef SYS_BEOS
@@ -458,7 +460,7 @@ void input_FileOpen( input_thread_t * p_input )
              )
     {
         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
     {
@@ -469,7 +471,7 @@ void input_FileOpen( input_thread_t * p_input )
         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 );
 
     intf_Msg( "input: opening %s", p_input->p_source );
index cdc296e6d2fac07fa5c6ceb4c9bae841b25699d3..fd23e44aa751bd8cca7397a600deb1183d1ee0b1 100644 (file)
@@ -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 )
 {
     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,
-                                          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_mutex_unlock( &p_input->stream.stream_lock );
index 3cbf87a9a628f42ce355d70ab93e8f281896c637..785f0e07637cd38625aa4ba48f58df648211779c 100644 (file)
@@ -2,7 +2,7 @@
  * input_programs.c: es_descriptor_t, pgrm_descriptor_t management
  *****************************************************************************
  * 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>
  *
@@ -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 );
     if( S.b_seekable )
         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
         intf_Msg( "input info: %s", S.b_pace_control ? "pace controlled" :
                   "pace un-controlled" );