]> git.sesse.net Git - vlc/commitdiff
*Added udf fix by Billy Biggs
authorStéphane Borel <stef@videolan.org>
Fri, 13 Apr 2001 05:36:12 +0000 (05:36 +0000)
committerStéphane Borel <stef@videolan.org>
Fri, 13 Apr 2001 05:36:12 +0000 (05:36 +0000)
*Added checks in dvd_ifo

*Cleanings in gnome interface : the interface should be dependant on the
input method.

include/input_ext-intf.h
plugins/dvd/dvd_ifo.c
plugins/dvd/dvd_udf.c
plugins/dvd/input_dvd.c
plugins/gnome/gnome_interface.c
plugins/gnome/intf_gnome.c
plugins/gnome/intf_gnome.glade
plugins/mpeg/input_ps.c
plugins/mpeg/input_ts.c
src/input/input_programs.c

index 25ba60caaf458a0fdd156c4be1eb10fac8f1afb7..9873d71e170690f3b7a291633b982265e2d1a1cb 100644 (file)
@@ -4,7 +4,7 @@
  * control the pace of reading. 
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_ext-intf.h,v 1.32 2001/04/12 03:26:53 stef Exp $
+ * $Id: input_ext-intf.h,v 1.33 2001/04/13 05:36:12 stef Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -187,6 +187,8 @@ typedef struct stream_descriptor_s
                                            * or modify stream, pgrm or es    */
 
     /* Input method data */
+    int                     i_method;       /* input method for stream: file,
+                                               disc or network */
     boolean_t               b_pace_control;    /* can we read when we want ? */
     boolean_t               b_seekable;               /* can we do lseek() ? */
 
@@ -312,35 +314,20 @@ typedef struct input_thread_s
 #endif
 } input_thread_t;
 
-
-/*
- * Communication interface -> input
- */
-
-/*****************************************************************************
- * input_config_t
- *****************************************************************************
- * This structure is given by the interface to an input thread
- *****************************************************************************/
-typedef struct input_config_s
-{
-    /* Input method description */
-    int                         i_method;                    /* input method */
-    char *                      p_source;                          /* source */
-
-    /* For auto-launch of decoders */
-    struct aout_thread_s *      p_default_aout;
-    struct vout_thread_s *      p_default_vout;
-} input_config_t;
-
 /* Input methods */
-#define INPUT_METHOD_NONE           0            /* input thread is inactive */
-#define INPUT_METHOD_FILE          10   /* stream is read from file p_source */
-#define INPUT_METHOD_DVD           11      /* stream is read from dvd device */
-#define INPUT_METHOD_UCAST         20                         /* UDP unicast */
-#define INPUT_METHOD_MCAST         21                       /* UDP multicast */
-#define INPUT_METHOD_BCAST         22                       /* UDP broadcast */
-#define INPUT_METHOD_VLAN_BCAST    32            /* UDP broadcast with VLANs */
+/* The first figure is a general method that can be used in interface plugins ;
+ * The second figure is a detailed sub-method */
+#define INPUT_METHOD_NONE         0x0            /* input thread is inactive */
+#define INPUT_METHOD_FILE        0x10   /* stream is read from file p_source */
+#define INPUT_METHOD_DISC        0x20   /* stream is read directly from disc */
+#define INPUT_METHOD_DVD         0x21             /* stream is read from DVD */
+#define INPUT_METHOD_VCD         0x22             /* stream is read from VCD */
+#define INPUT_METHOD_NETWORK     0x30         /* stream is read from network */
+#define INPUT_METHOD_UCAST       0x31                         /* UDP unicast */
+#define INPUT_METHOD_MCAST       0x32                       /* UDP multicast */
+#define INPUT_METHOD_BCAST       0x33                       /* UDP broadcast */
+#define INPUT_METHOD_VLAN_BCAST  0x34            /* UDP broadcast with VLANs */
+
 
 /* Status changing methods */
 #define INPUT_STATUS_END            0
index fb3d05b9f21d53bddf7e439f18e3d6b59ed2a047..b2a19334a94a28ad41b0265165839a7a5e412aa7 100644 (file)
@@ -2,7 +2,7 @@
  * dvd_ifo.c: Functions for ifo parsing
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: dvd_ifo.c,v 1.19 2001/04/12 02:40:09 stef Exp $
+ * $Id: dvd_ifo.c,v 1.20 2001/04/13 05:36:12 stef Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -74,56 +74,89 @@ static __inline__ u8* FillBuffer( ifo_t* p_ifo, u8* pi_buffer, off_t i_pos )
     return pi_buffer;
 }
 
-static __inline__ u8 ReadByte( u8** ppi_buffer )
+static __inline__ u8 ReadByte( ifo_t * p_ifo, u8* pi_buffer, u8** pp_current )
 {
     u8      i_ret;
 
-    i_ret = *(*ppi_buffer)++;
+    if( *pp_current >= pi_buffer + DVD_LB_SIZE )
+    {
+        *pp_current = FillBuffer( p_ifo, pi_buffer, p_ifo->i_pos );
+    }
+
+    i_ret = *(*pp_current)++;
 
     return i_ret;
 }
 
-static __inline__ u16 ReadWord( u8** ppi_buffer )
+static __inline__ u16 ReadWord( ifo_t* p_ifo, u8* pi_buffer, u8** pp_current )
 {
     u16     i_ret;
 
-    i_ret = U16_AT(*ppi_buffer);
-    (*ppi_buffer) += 2;
+    if( *pp_current >= pi_buffer + DVD_LB_SIZE - 2 )
+    {
+        *pp_current = FillBuffer( p_ifo, pi_buffer, p_ifo->i_pos );
+    }
+
+    i_ret = U16_AT(*pp_current);
+    (*pp_current) += 2;
 
     return i_ret;
 }
 
-static __inline__ u32 ReadDouble( u8** ppi_buffer )
+static __inline__ u32 ReadDouble( ifo_t * p_ifo, u8* pi_buffer,
+                                  u8** pp_current )
 {
     u32     i_ret;
 
-    i_ret = U32_AT(*ppi_buffer);
-    (*ppi_buffer) += 4;
+    if( *pp_current >= pi_buffer + DVD_LB_SIZE - 4 )
+    {
+        *pp_current = FillBuffer( p_ifo, pi_buffer, p_ifo->i_pos );
+    }
+
+    i_ret = U32_AT(*pp_current);
+    (*pp_current) += 4;
 
     return i_ret;
 }
 
-static __inline__ u64 ReadQuad( u8** ppi_buffer )
+static __inline__ u64 ReadQuad( ifo_t* p_ifo, u8* pi_buffer, u8** pp_current )
 {
     u64     i_ret;
 
-    i_ret = U64_AT(*ppi_buffer);
-    (*ppi_buffer) += 8;
+    if( *pp_current >= pi_buffer + DVD_LB_SIZE - 8 )
+    {
+        *pp_current = FillBuffer( p_ifo, pi_buffer, p_ifo->i_pos );
+    }
+
+    i_ret = U64_AT(*pp_current);
+    (*pp_current) += 8;
 
     return i_ret;
 }
 
-static __inline__ void ReadBits( u8** ppi_buffer, u8* pi_dest, int i_nb )
+static __inline__ void ReadBits( ifo_t* p_ifo, u8* pi_buffer, u8** pp_current,
+                                  u8* pi_dest, int i_nb )
 {
-    memcpy( pi_dest, *ppi_buffer, i_nb );
-    *ppi_buffer += i_nb;
+    if( *pp_current >= pi_buffer + DVD_LB_SIZE - i_nb )
+    {
+        *pp_current = FillBuffer( p_ifo, pi_buffer, p_ifo->i_pos );
+    }
+
+    memcpy( pi_dest, *pp_current, i_nb );
+    *pp_current += i_nb;
 
     return;
 }
 
-static __inline__ void DumpBits( u8** ppi_buffer, int i_nb )
+static __inline__ void DumpBits( ifo_t* p_ifo, u8* pi_buffer,
+                                 u8** pp_current, int i_nb )
 {
-    *ppi_buffer += i_nb;
+    if( *pp_current >= pi_buffer + DVD_LB_SIZE - i_nb )
+    {
+        *pp_current = FillBuffer( p_ifo, pi_buffer, p_ifo->i_pos );
+    }
+
+    *pp_current += i_nb;
 
     return;
 }
@@ -175,49 +208,49 @@ int IfoInit( ifo_t * p_ifo )
 #define manager_inf     p_ifo->vmg.manager_inf
 //fprintf( stderr, "VMGI\n" );
 
-    ReadBits( &p_current, manager_inf.psz_id, 12 );
+    ReadBits( p_ifo, pi_buffer, &p_current, manager_inf.psz_id, 12 );
     manager_inf.psz_id[12] = '\0';
-    manager_inf.i_vmg_end_sector = ReadDouble( &p_current );
-    DumpBits( &p_current, 12 );
-    manager_inf.i_vmg_inf_end_sector = ReadDouble( &p_current );
-    DumpBits( &p_current, 1 );
-    manager_inf.i_spec_ver = ReadByte( &p_current );
-    manager_inf.i_cat = ReadDouble( &p_current );
-    manager_inf.i_volume_nb = ReadWord( &p_current );
-    manager_inf.i_volume = ReadWord( &p_current );
-    manager_inf.i_disc_side = ReadByte( &p_current );
-    DumpBits( &p_current, 19 );
-    manager_inf.i_title_set_nb = ReadWord( &p_current );
-    ReadBits( &p_current, manager_inf.ps_provider_id, 32 );
-    manager_inf.i_pos_code = ReadQuad( &p_current );
-    DumpBits( &p_current, 24 );
-    manager_inf.i_vmg_inf_end_byte = ReadDouble( &p_current );
-    manager_inf.i_first_play_title_start_byte = ReadDouble( &p_current );
-    DumpBits( &p_current, 56 );
-    manager_inf.i_vob_start_sector = ReadDouble( &p_current );
-    manager_inf.i_title_inf_start_sector = ReadDouble( &p_current );
-    manager_inf.i_title_unit_start_sector = ReadDouble( &p_current );
-    manager_inf.i_parental_inf_start_sector = ReadDouble( &p_current );
-    manager_inf.i_vts_inf_start_sector = ReadDouble( &p_current );
-    manager_inf.i_text_data_start_sector = ReadDouble( &p_current );
-    manager_inf.i_cell_inf_start_sector = ReadDouble( &p_current );
-    manager_inf.i_vobu_map_start_sector = ReadDouble( &p_current );
-    DumpBits( &p_current, 32 );
+    manager_inf.i_vmg_end_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
+    DumpBits( p_ifo, pi_buffer, &p_current, 12 );
+    manager_inf.i_vmg_inf_end_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
+    DumpBits( p_ifo, pi_buffer, &p_current, 1 );
+    manager_inf.i_spec_ver = ReadByte( p_ifo, pi_buffer, &p_current );
+    manager_inf.i_cat = ReadDouble( p_ifo, pi_buffer, &p_current );
+    manager_inf.i_volume_nb = ReadWord( p_ifo, pi_buffer, &p_current );
+    manager_inf.i_volume = ReadWord( p_ifo, pi_buffer, &p_current );
+    manager_inf.i_disc_side = ReadByte( p_ifo, pi_buffer, &p_current );
+    DumpBits( p_ifo, pi_buffer, &p_current, 19 );
+    manager_inf.i_title_set_nb = ReadWord( p_ifo, pi_buffer, &p_current );
+    ReadBits( p_ifo, pi_buffer, &p_current, manager_inf.ps_provider_id, 32 );
+    manager_inf.i_pos_code = ReadQuad( p_ifo, pi_buffer, &p_current );
+    DumpBits( p_ifo, pi_buffer, &p_current, 24 );
+    manager_inf.i_vmg_inf_end_byte = ReadDouble( p_ifo, pi_buffer, &p_current );
+    manager_inf.i_first_play_title_start_byte = ReadDouble( p_ifo, pi_buffer, &p_current );
+    DumpBits( p_ifo, pi_buffer, &p_current, 56 );
+    manager_inf.i_vob_start_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
+    manager_inf.i_title_inf_start_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
+    manager_inf.i_title_unit_start_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
+    manager_inf.i_parental_inf_start_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
+    manager_inf.i_vts_inf_start_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
+    manager_inf.i_text_data_start_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
+    manager_inf.i_cell_inf_start_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
+    manager_inf.i_vobu_map_start_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
+    DumpBits( p_ifo, pi_buffer, &p_current, 32 );
 //    GETS( &manager_inf.video_atrt );
-DumpBits( &p_current, 2 );
-    DumpBits( &p_current, 1 );
-    manager_inf.i_audio_nb = ReadByte( &p_current );
+DumpBits( p_ifo, pi_buffer, &p_current, 2 );
+    DumpBits( p_ifo, pi_buffer, &p_current, 1 );
+    manager_inf.i_audio_nb = ReadByte( p_ifo, pi_buffer, &p_current );
 //fprintf( stderr, "vmgi audio nb : %d\n", manager_inf.i_audio_nb );
     for( i=0 ; i < 8 ; i++ )
     {
-        i_temp = ReadQuad( &p_current );
+        i_temp = ReadQuad( p_ifo, pi_buffer, &p_current );
     }
-    DumpBits( &p_current, 17 );
-    manager_inf.i_spu_nb = ReadByte( &p_current );
+    DumpBits( p_ifo, pi_buffer, &p_current, 17 );
+    manager_inf.i_spu_nb = ReadByte( p_ifo, pi_buffer, &p_current );
 //fprintf( stderr, "vmgi subpic nb : %d\n", manager_inf.i_spu_nb );
     for( i=0 ; i < manager_inf.i_spu_nb ; i++ )
     {
-        ReadBits( &p_current, (u8*)(&i_temp), 6 );
+        ReadBits( p_ifo, pi_buffer, &p_current, (u8*)(&i_temp), 6 );
         /* FIXME : take care of endianness */
     }
 
@@ -240,10 +273,10 @@ DumpBits( &p_current, 2 );
                     manager_inf.i_title_inf_start_sector *DVD_LB_SIZE );
 //fprintf( stderr, "title inf %lld\n", p_ifo->i_pos );
     
-        title_inf.i_title_nb = ReadWord( &p_current );
+        title_inf.i_title_nb = ReadWord( p_ifo, pi_buffer, &p_current );
 //fprintf( stderr, "title_inf: TTU nb %d\n", title_inf.i_title_nb );
-        DumpBits( &p_current, 2 );
-        title_inf.i_end_byte = ReadDouble( &p_current );
+        DumpBits( p_ifo, pi_buffer, &p_current, 2 );
+        title_inf.i_end_byte = ReadDouble( p_ifo, pi_buffer, &p_current );
     
         /* parsing of title attributes */
         title_inf.p_attr = malloc( title_inf.i_title_nb *sizeof(title_attr_t) );
@@ -255,13 +288,13 @@ DumpBits( &p_current, 2 );
     
         for( i = 0 ; i < title_inf.i_title_nb ; i++ )
         {
-            title_inf.p_attr[i].i_play_type = ReadByte( &p_current );
-            title_inf.p_attr[i].i_angle_nb = ReadByte( &p_current );
-            title_inf.p_attr[i].i_chapter_nb = ReadWord( &p_current );
-            title_inf.p_attr[i].i_parental_id = ReadWord( &p_current );
-            title_inf.p_attr[i].i_title_set_num = ReadByte( &p_current );
-            title_inf.p_attr[i].i_title_num = ReadByte( &p_current );
-            title_inf.p_attr[i].i_start_sector = ReadDouble( &p_current );
+            title_inf.p_attr[i].i_play_type = ReadByte( p_ifo, pi_buffer, &p_current );
+            title_inf.p_attr[i].i_angle_nb = ReadByte( p_ifo, pi_buffer, &p_current );
+            title_inf.p_attr[i].i_chapter_nb = ReadWord( p_ifo, pi_buffer, &p_current );
+            title_inf.p_attr[i].i_parental_id = ReadWord( p_ifo, pi_buffer, &p_current );
+            title_inf.p_attr[i].i_title_set_num = ReadByte( p_ifo, pi_buffer, &p_current );
+            title_inf.p_attr[i].i_title_num = ReadByte( p_ifo, pi_buffer, &p_current );
+            title_inf.p_attr[i].i_start_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
 //fprintf( stderr, "title_inf: %d %d %d\n",title_inf.p_attr[i].i_chapter_nb ,title_inf.p_attr[i].i_title_set_num,title_inf.p_attr[i].i_title_num );
         }
     }
@@ -295,9 +328,9 @@ DumpBits( &p_current, 2 );
 
 //fprintf( stderr, "PTL\n" );
     
-        parental.i_country_nb = ReadWord( &p_current );
-        parental.i_vts_nb = ReadWord( &p_current );
-        parental.i_end_byte = ReadDouble( &p_current );
+        parental.i_country_nb = ReadWord( p_ifo, pi_buffer, &p_current );
+        parental.i_vts_nb = ReadWord( p_ifo, pi_buffer, &p_current );
+        parental.i_end_byte = ReadDouble( p_ifo, pi_buffer, &p_current );
         
         parental.p_parental_desc = malloc( parental.i_country_nb *
                                            sizeof(parental_desc_t) );
@@ -309,12 +342,12 @@ DumpBits( &p_current, 2 );
 
         for( i = 0 ; i < parental.i_country_nb ; i++ )
         {
-            ReadBits( &p_current,
+            ReadBits( p_ifo, pi_buffer, &p_current,
                       parental.p_parental_desc[i].ps_country_code, 2 );
-            DumpBits( &p_current, 2 );
+            DumpBits( p_ifo, pi_buffer, &p_current, 2 );
             parental.p_parental_desc[i].i_parental_mask_start_byte =
-                                                    ReadWord( &p_current );
-            DumpBits( &p_current, 2 );
+                                                    ReadWord( p_ifo, pi_buffer, &p_current );
+            DumpBits( p_ifo, pi_buffer, &p_current, 2 );
         }
 
         parental.p_parental_mask = malloc( parental.i_country_nb *
@@ -341,7 +374,7 @@ DumpBits( &p_current, 2 );
                 for( k = 0 ; k < parental.i_vts_nb + 1 ; k++ )
                 {
                     parental.p_parental_mask[i].ppi_mask[j][k] =
-                                                        ReadWord( &p_current );
+                                                        ReadWord( p_ifo, pi_buffer, &p_current );
                 }
             }
         }
@@ -362,10 +395,10 @@ DumpBits( &p_current, 2 );
     
 //fprintf( stderr, "VTS ATTR\n" );
     
-        vts_inf.i_vts_nb = ReadWord( &p_current );;
+        vts_inf.i_vts_nb = ReadWord( p_ifo, pi_buffer, &p_current );;
 //fprintf( stderr, "VTS ATTR Nb: %d\n", vts_inf.i_vts_nb );
-        DumpBits( &p_current, 2 );
-        vts_inf.i_end_byte = ReadDouble( &p_current );
+        DumpBits( p_ifo, pi_buffer, &p_current, 2 );
+        vts_inf.i_end_byte = ReadDouble( p_ifo, pi_buffer, &p_current );
         vts_inf.pi_vts_attr_start_byte =
                             malloc( vts_inf.i_vts_nb *sizeof(u32) );
         if( vts_inf.pi_vts_attr_start_byte == NULL )
@@ -376,7 +409,7 @@ DumpBits( &p_current, 2 );
 
         for( i = 0 ; i < vts_inf.i_vts_nb ; i++ )
         {
-            vts_inf.pi_vts_attr_start_byte[i] = ReadDouble( &p_current );
+            vts_inf.pi_vts_attr_start_byte[i] = ReadDouble( p_ifo, pi_buffer, &p_current );
         }
 
         vts_inf.p_vts_attr = malloc( vts_inf.i_vts_nb *sizeof(vts_attr_t) );
@@ -390,42 +423,42 @@ DumpBits( &p_current, 2 );
         {
             p_current = FillBuffer( p_ifo, pi_buffer, i_start +
                                     vts_inf.pi_vts_attr_start_byte[i] );
-            vts_inf.p_vts_attr[i].i_end_byte = ReadDouble( &p_current );
-            vts_inf.p_vts_attr[i].i_cat_app_type  = ReadDouble( &p_current );
+            vts_inf.p_vts_attr[i].i_end_byte = ReadDouble( p_ifo, pi_buffer, &p_current );
+            vts_inf.p_vts_attr[i].i_cat_app_type  = ReadDouble( p_ifo, pi_buffer, &p_current );
     //        GETS( &vts_inf.p_vts_attr[i].vts_menu_video_attr );
-DumpBits( &p_current, 2 );
-            DumpBits( &p_current, 1 );
-            vts_inf.p_vts_attr[i].i_vts_menu_audio_nb = ReadByte( &p_current );
+DumpBits( p_ifo, pi_buffer, &p_current, 2 );
+            DumpBits( p_ifo, pi_buffer, &p_current, 1 );
+            vts_inf.p_vts_attr[i].i_vts_menu_audio_nb = ReadByte( p_ifo, pi_buffer, &p_current );
 //fprintf( stderr, "m audio nb : %d\n", vts_inf.p_vts_attr[i].i_vts_menu_audio_nb );
             for( j = 0 ; j < 8 ; j++ )
             {
-                i_temp = ReadQuad( &p_current );;
+                i_temp = ReadQuad( p_ifo, pi_buffer, &p_current );;
             }
-            DumpBits( &p_current, 17 );
-            vts_inf.p_vts_attr[i].i_vts_menu_spu_nb = ReadByte( &p_current );
+            DumpBits( p_ifo, pi_buffer, &p_current, 17 );
+            vts_inf.p_vts_attr[i].i_vts_menu_spu_nb = ReadByte( p_ifo, pi_buffer, &p_current );
 //fprintf( stderr, "m subp nb : %d\n", vts_inf.p_vts_attr[i].i_vts_menu_spu_nb );
             for( j = 0 ; j < 28 ; j++ )
             {
-                ReadBits( &p_current, (u8*)(&i_temp), 6 );
+                ReadBits( p_ifo, pi_buffer, &p_current, (u8*)(&i_temp), 6 );
                 /* FIXME : Fix endianness issue here */
             }
-            DumpBits( &p_current, 2 );
+            DumpBits( p_ifo, pi_buffer, &p_current, 2 );
     //        GETS( &vts_inf.p_vts_attr[i].vtstt_video_vts_inf );
-DumpBits( &p_current, 2 );
-            DumpBits( &p_current, 1 );
+DumpBits( p_ifo, pi_buffer, &p_current, 2 );
+            DumpBits( p_ifo, pi_buffer, &p_current, 1 );
             vts_inf.p_vts_attr[i].i_vts_title_audio_nb =
-                                                ReadDouble( &p_current );
+                                                ReadDouble( p_ifo, pi_buffer, &p_current );
 //fprintf( stderr, "tt audio nb : %d\n", vts_inf.p_vts_attr[i].i_vts_title_audio_nb );
             for( j = 0 ; j < 8 ; j++ )
             {
-                i_temp = ReadQuad( &p_current );;
+                i_temp = ReadQuad( p_ifo, pi_buffer, &p_current );;
             }
-            DumpBits( &p_current, 17 );
-            vts_inf.p_vts_attr[i].i_vts_title_spu_nb = ReadByte( &p_current );
+            DumpBits( p_ifo, pi_buffer, &p_current, 17 );
+            vts_inf.p_vts_attr[i].i_vts_title_spu_nb = ReadByte( p_ifo, pi_buffer, &p_current );
 //fprintf( stderr, "tt subp nb : %d\n", vts_inf.p_vts_attr[i].i_vts_title_spu_nb );
             for( j=0 ; j<28/*vts_inf.p_vts_vts_inf[i].i_vtstt_subpic_nb*/ ; j++ )
             {
-                ReadBits( &p_current, (u8*)(&i_temp), 6 );
+                ReadBits( p_ifo, pi_buffer, &p_current, (u8*)(&i_temp), 6 );
                 /* FIXME : Fix endianness issue here */
             }
         }
@@ -498,52 +531,52 @@ int IfoTitleSet( ifo_t * p_ifo )
      */
 //fprintf( stderr, "VTSI\n" );
 
-    ReadBits( &p_current, manager_inf.psz_id , 12 );
+    ReadBits( p_ifo, pi_buffer, &p_current, manager_inf.psz_id , 12 );
     manager_inf.psz_id[12] = '\0';
-    manager_inf.i_end_sector = ReadDouble( &p_current );
-    DumpBits( &p_current, 12 );
-    manager_inf.i_inf_end_sector = ReadDouble( &p_current );
-    DumpBits( &p_current, 1 );
-    manager_inf.i_spec_ver = ReadByte( &p_current );
-    manager_inf.i_cat = ReadDouble( &p_current );
-    DumpBits( &p_current, 90 );
-    manager_inf.i_inf_end_byte = ReadDouble( &p_current );
-    DumpBits( &p_current, 60 );
-    manager_inf.i_menu_vob_start_sector = ReadDouble( &p_current );
-    manager_inf.i_title_vob_start_sector = ReadDouble( &p_current );
-    manager_inf.i_title_inf_start_sector = ReadDouble( &p_current );
-    manager_inf.i_title_unit_start_sector = ReadDouble( &p_current );
-    manager_inf.i_menu_unit_start_sector = ReadDouble( &p_current );
-    manager_inf.i_time_inf_start_sector = ReadDouble( &p_current );
-    manager_inf.i_menu_cell_inf_start_sector = ReadDouble( &p_current );
-    manager_inf.i_menu_vobu_map_start_sector = ReadDouble( &p_current );
-    manager_inf.i_cell_inf_start_sector = ReadDouble( &p_current );
-    manager_inf.i_vobu_map_start_sector = ReadDouble( &p_current );
-    DumpBits( &p_current, 24 );
+    manager_inf.i_end_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
+    DumpBits( p_ifo, pi_buffer, &p_current, 12 );
+    manager_inf.i_inf_end_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
+    DumpBits( p_ifo, pi_buffer, &p_current, 1 );
+    manager_inf.i_spec_ver = ReadByte( p_ifo, pi_buffer, &p_current );
+    manager_inf.i_cat = ReadDouble( p_ifo, pi_buffer, &p_current );
+    DumpBits( p_ifo, pi_buffer, &p_current, 90 );
+    manager_inf.i_inf_end_byte = ReadDouble( p_ifo, pi_buffer, &p_current );
+    DumpBits( p_ifo, pi_buffer, &p_current, 60 );
+    manager_inf.i_menu_vob_start_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
+    manager_inf.i_title_vob_start_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
+    manager_inf.i_title_inf_start_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
+    manager_inf.i_title_unit_start_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
+    manager_inf.i_menu_unit_start_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
+    manager_inf.i_time_inf_start_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
+    manager_inf.i_menu_cell_inf_start_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
+    manager_inf.i_menu_vobu_map_start_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
+    manager_inf.i_cell_inf_start_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
+    manager_inf.i_vobu_map_start_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
+    DumpBits( p_ifo, pi_buffer, &p_current, 24 );
 //    GETS( &manager_inf.m_video_atrt );
-DumpBits( &p_current, 2 );
-    DumpBits( &p_current, 1 );
-    manager_inf.i_menu_audio_nb = ReadByte( &p_current );
+DumpBits( p_ifo, pi_buffer, &p_current, 2 );
+    DumpBits( p_ifo, pi_buffer, &p_current, 1 );
+    manager_inf.i_menu_audio_nb = ReadByte( p_ifo, pi_buffer, &p_current );
     for( i = 0 ; i < 8 ; i++ )
     {
-        i_temp = ReadQuad( &p_current );
+        i_temp = ReadQuad( p_ifo, pi_buffer, &p_current );
     }
-    DumpBits( &p_current, 17 );
-    manager_inf.i_menu_spu_nb = ReadByte( &p_current );
+    DumpBits( p_ifo, pi_buffer, &p_current, 17 );
+    manager_inf.i_menu_spu_nb = ReadByte( p_ifo, pi_buffer, &p_current );
     for( i = 0 ; i < 28 ; i++ )
     {
-        ReadBits( &p_current, (u8*)(&i_temp), 6 );
+        ReadBits( p_ifo, pi_buffer, &p_current, (u8*)(&i_temp), 6 );
         /* FIXME : take care of endianness */
     }
-    DumpBits( &p_current, 2 );
+    DumpBits( p_ifo, pi_buffer, &p_current, 2 );
 //    GETS( &manager_inf.video_atrt );
-DumpBits( &p_current, 2 );
-    DumpBits( &p_current, 1 );
-    manager_inf.i_audio_nb = ReadByte( &p_current );
+DumpBits( p_ifo, pi_buffer, &p_current, 2 );
+    DumpBits( p_ifo, pi_buffer, &p_current, 1 );
+    manager_inf.i_audio_nb = ReadByte( p_ifo, pi_buffer, &p_current );
 //fprintf( stderr, "vtsi audio nb : %d\n", manager_inf.i_audio_nb );
     for( i = 0 ; i < 8 ; i++ )
     {
-        i_temp = ReadQuad( &p_current );
+        i_temp = ReadQuad( p_ifo, pi_buffer, &p_current );
 //fprintf( stderr, "Audio %d: %llx\n", i, i_temp );
         i_temp >>= 8;
         manager_inf.p_audio_attr[i].i_bar = i_temp & 0xff;
@@ -570,12 +603,12 @@ DumpBits( &p_current, 2 );
         i_temp >>= 1;
         manager_inf.p_audio_attr[i].i_coding_mode = i_temp & 0x7;
     }
-    DumpBits( &p_current, 17 );
-    manager_inf.i_spu_nb = ReadByte( &p_current );
+    DumpBits( p_ifo, pi_buffer, &p_current, 17 );
+    manager_inf.i_spu_nb = ReadByte( p_ifo, pi_buffer, &p_current );
 //fprintf( stderr, "vtsi subpic nb : %d\n", manager_inf.i_spu_nb );
     for( i=0 ; i<manager_inf.i_spu_nb ; i++ )
     {
-        ReadBits( &p_current, (u8*)(&i_temp), 6 );
+        ReadBits( p_ifo, pi_buffer, &p_current, (u8*)(&i_temp), 6 );
         i_temp = hton64( i_temp ) >> 16;
 //fprintf( stderr, "Subpic %d: %llx\n", i, i_temp );
         manager_inf.p_spu_attr[i].i_caption = i_temp & 0xff;
@@ -598,10 +631,10 @@ DumpBits( &p_current, 2 );
     
 //fprintf( stderr, "VTS PTR\n" );
    
-        title_inf.i_title_nb = ReadWord( &p_current );
+        title_inf.i_title_nb = ReadWord( p_ifo, pi_buffer, &p_current );
 //fprintf( stderr, "VTS title_inf nb: %d\n", title_inf.i_title_nb );
-        DumpBits( &p_current, 2 );
-        title_inf.i_end_byte = ReadDouble( &p_current );
+        DumpBits( p_ifo, pi_buffer, &p_current, 2 );
+        title_inf.i_end_byte = ReadDouble( p_ifo, pi_buffer, &p_current );
 
         title_inf.pi_start_byte = malloc( title_inf.i_title_nb *sizeof(u32) );
         if( title_inf.pi_start_byte == NULL )
@@ -612,7 +645,7 @@ DumpBits( &p_current, 2 );
 
         for( i = 0 ; i < title_inf.i_title_nb ; i++ )
         {
-            title_inf.pi_start_byte[i] = ReadDouble( &p_current );
+            title_inf.pi_start_byte[i] = ReadDouble( p_ifo, pi_buffer, &p_current );
         }
 
         /* Parsing of tts */
@@ -630,8 +663,8 @@ DumpBits( &p_current, 2 );
                             title_inf.pi_start_byte[i] );
 
             title_inf.p_title_start[i].i_program_chain_num =
-                                                       ReadWord( &p_current );
-            title_inf.p_title_start[i].i_program_num = ReadWord( &p_current );
+                                                       ReadWord( p_ifo, pi_buffer, &p_current );
+            title_inf.p_title_start[i].i_program_num = ReadWord( p_ifo, pi_buffer, &p_current );
 //fprintf( stderr, "VTS %d title_inf Pgc: %d Prg: %d\n", i,title_inf.p_title_start[i].i_program_chain_num, title_inf.p_title_start[i].i_program_num );
         }
     }
@@ -667,16 +700,16 @@ DumpBits( &p_current, 2 );
 #define time_inf p_ifo->vts.time_inf
     if( manager_inf.i_time_inf_start_sector )
     {
-        u8      pi_buffer[2*DVD_LB_SIZE];
+        u8      pi_buffer[DVD_LB_SIZE];
 
         p_current = FillBuffer( p_ifo, pi_buffer, p_ifo->vts.i_pos +
                         manager_inf.i_time_inf_start_sector *DVD_LB_SIZE );
 
 //fprintf( stderr, "TMAP\n" );
 
-        time_inf.i_nb = ReadWord( &p_current );;
-        DumpBits( &p_current, 2 );
-        time_inf.i_end_byte = ReadDouble( &p_current );
+        time_inf.i_nb = ReadWord( p_ifo, pi_buffer, &p_current );;
+        DumpBits( p_ifo, pi_buffer, &p_current, 2 );
+        time_inf.i_end_byte = ReadDouble( p_ifo, pi_buffer, &p_current );
 
         time_inf.pi_start_byte = malloc( time_inf.i_nb *sizeof(u32) );
         if( time_inf.pi_start_byte == NULL )
@@ -687,7 +720,7 @@ DumpBits( &p_current, 2 );
 
         for( i = 0 ; i < time_inf.i_nb ; i++ )
         {    
-            time_inf.pi_start_byte[i] = ReadDouble( &p_current );
+            time_inf.pi_start_byte[i] = ReadDouble( p_ifo, pi_buffer, &p_current );
         }
 
         time_inf.p_time_map = malloc( time_inf.i_nb *sizeof(time_map_t) );
@@ -699,9 +732,9 @@ DumpBits( &p_current, 2 );
 
         for( i = 0 ; i < time_inf.i_nb ; i++ )
         {    
-            time_inf.p_time_map[i].i_time_unit = ReadByte( &p_current );
-            DumpBits( &p_current, 1 );
-            time_inf.p_time_map[i].i_entry_nb = ReadWord( &p_current );
+            time_inf.p_time_map[i].i_time_unit = ReadByte( p_ifo, pi_buffer, &p_current );
+            DumpBits( p_ifo, pi_buffer, &p_current, 1 );
+            time_inf.p_time_map[i].i_entry_nb = ReadWord( p_ifo, pi_buffer, &p_current );
 
             time_inf.p_time_map[i].pi_sector =
                      malloc( time_inf.p_time_map[i].i_entry_nb *sizeof(u32) );
@@ -713,7 +746,7 @@ DumpBits( &p_current, 2 );
 
             for( j = 0 ; j < time_inf.p_time_map[i].i_entry_nb ; j++ )
             {
-                time_inf.p_time_map[i].pi_sector[j] = ReadDouble( &p_current );
+                time_inf.p_time_map[i].pi_sector[j] = ReadDouble( p_ifo, pi_buffer, &p_current );
             }
         }
     }
@@ -903,35 +936,35 @@ static int ReadTitle( ifo_t * p_ifo, title_t * p_title, off_t i_pos )
 
 //fprintf( stderr, "PGC @ %lld\n",p_ifo->i_pos  );
 
-    DumpBits( &p_current, 2);
-    p_title->i_chapter_nb = ReadByte( &p_current );
-    p_title->i_cell_nb = ReadByte( &p_current );
+    DumpBits( p_ifo, pi_buffer, &p_current, 2);
+    p_title->i_chapter_nb = ReadByte( p_ifo, pi_buffer, &p_current );
+    p_title->i_cell_nb = ReadByte( p_ifo, pi_buffer, &p_current );
 //fprintf( stderr, "title: Prg: %d Cell: %d\n",p_title->i_chapter_nb,p_title->i_cell_nb  );
-    p_title->i_play_time = ReadDouble( &p_current );
-    p_title->i_prohibited_user_op = ReadDouble( &p_current );
+    p_title->i_play_time = ReadDouble( p_ifo, pi_buffer, &p_current );
+    p_title->i_prohibited_user_op = ReadDouble( p_ifo, pi_buffer, &p_current );
     for( i = 0 ; i < 8 ; i++ )
     {
-        p_title->pi_audio_status[i] = ReadWord( &p_current );
+        p_title->pi_audio_status[i] = ReadWord( p_ifo, pi_buffer, &p_current );
     }
     for( i = 0 ; i < 32 ; i++ )
     {
-        p_title->pi_subpic_status[i] = ReadDouble( &p_current );
+        p_title->pi_subpic_status[i] = ReadDouble( p_ifo, pi_buffer, &p_current );
     }
-    p_title->i_next_title_num = ReadWord( &p_current );
-    p_title->i_prev_title_num = ReadWord( &p_current );
-    p_title->i_go_up_title_num = ReadWord( &p_current );
+    p_title->i_next_title_num = ReadWord( p_ifo, pi_buffer, &p_current );
+    p_title->i_prev_title_num = ReadWord( p_ifo, pi_buffer, &p_current );
+    p_title->i_go_up_title_num = ReadWord( p_ifo, pi_buffer, &p_current );
 //fprintf( stderr, "title: Prev: %d Next: %d Up: %d\n",pgc.i_prev_pgc_nb ,pgc.i_next_pgc_nb, pgc.i_goup_pgc_nb );
-    p_title->i_still_time = ReadByte( &p_current );
-    p_title->i_play_mode = ReadByte( &p_current );
+    p_title->i_still_time = ReadByte( p_ifo, pi_buffer, &p_current );
+    p_title->i_play_mode = ReadByte( p_ifo, pi_buffer, &p_current );
     for( i = 0 ; i < 16 ; i++ )
     {
-        p_title->pi_yuv_color[i] = ReadDouble( &p_current );
+        p_title->pi_yuv_color[i] = ReadDouble( p_ifo, pi_buffer, &p_current );
         /* FIXME : We have to erase the extra bit */
     }
-    p_title->i_command_start_byte = ReadWord( &p_current );
-    p_title->i_chapter_map_start_byte = ReadWord( &p_current );
-    p_title->i_cell_play_start_byte = ReadWord( &p_current );
-    p_title->i_cell_pos_start_byte = ReadWord( &p_current );
+    p_title->i_command_start_byte = ReadWord( p_ifo, pi_buffer, &p_current );
+    p_title->i_chapter_map_start_byte = ReadWord( p_ifo, pi_buffer, &p_current );
+    p_title->i_cell_play_start_byte = ReadWord( p_ifo, pi_buffer, &p_current );
+    p_title->i_cell_pos_start_byte = ReadWord( p_ifo, pi_buffer, &p_current );
 
     /* parsing of command_t */
     if( p_title->i_command_start_byte )
@@ -940,10 +973,10 @@ static int ReadTitle( ifo_t * p_ifo, title_t * p_title, off_t i_pos )
                               i_start + p_title->i_command_start_byte );
 
         /* header */
-        p_title->command.i_pre_command_nb = ReadWord( &p_current );
-        p_title->command.i_post_command_nb = ReadWord( &p_current );
-        p_title->command.i_cell_command_nb = ReadWord( &p_current );
-        DumpBits( &p_current, 2 );
+        p_title->command.i_pre_command_nb = ReadWord( p_ifo, pi_buffer, &p_current );
+        p_title->command.i_post_command_nb = ReadWord( p_ifo, pi_buffer, &p_current );
+        p_title->command.i_cell_command_nb = ReadWord( p_ifo, pi_buffer, &p_current );
+        DumpBits( p_ifo, pi_buffer, &p_current, 2 );
 
         /* pre-title commands */
         if( p_title->command.i_pre_command_nb )
@@ -960,7 +993,7 @@ static int ReadTitle( ifo_t * p_ifo, title_t * p_title, off_t i_pos )
 
             for( i = 0 ; i < p_title->command.i_pre_command_nb ; i++ )
             {
-                p_title->command.p_pre_command[i] = ReadQuad( &p_current );
+                p_title->command.p_pre_command[i] = ReadQuad( p_ifo, pi_buffer, &p_current );
             }
         }
         else
@@ -983,7 +1016,7 @@ static int ReadTitle( ifo_t * p_ifo, title_t * p_title, off_t i_pos )
 
             for( i=0 ; i<p_title->command.i_post_command_nb ; i++ )
             {
-                p_title->command.p_post_command[i] = ReadQuad( &p_current );
+                p_title->command.p_post_command[i] = ReadQuad( p_ifo, pi_buffer, &p_current );
             }
         }
         else
@@ -1006,7 +1039,7 @@ static int ReadTitle( ifo_t * p_ifo, title_t * p_title, off_t i_pos )
 
             for( i=0 ; i<p_title->command.i_cell_command_nb ; i++ )
             {
-                p_title->command.p_cell_command[i] = ReadQuad( &p_current );
+                p_title->command.p_cell_command[i] = ReadQuad( p_ifo, pi_buffer, &p_current );
             }
         }
         else
@@ -1031,7 +1064,7 @@ static int ReadTitle( ifo_t * p_ifo, title_t * p_title, off_t i_pos )
             return -1;
         }
 
-        ReadBits( &p_current, p_title->chapter_map.pi_start_cell,
+        ReadBits( p_ifo, pi_buffer, &p_current, p_title->chapter_map.pi_start_cell,
                   p_title->i_chapter_nb );
     }
     else
@@ -1056,16 +1089,16 @@ static int ReadTitle( ifo_t * p_ifo, title_t * p_title, off_t i_pos )
 
         for( i = 0 ; i < p_title->i_cell_nb ; i++ )
         {
-            p_title->p_cell_play[i].i_category = ReadWord( &p_current );
-            p_title->p_cell_play[i].i_still_time = ReadByte( &p_current );
-            p_title->p_cell_play[i].i_command_nb = ReadByte( &p_current );
-            p_title->p_cell_play[i].i_play_time = ReadDouble( &p_current );
-            p_title->p_cell_play[i].i_start_sector = ReadDouble( &p_current );
+            p_title->p_cell_play[i].i_category = ReadWord( p_ifo, pi_buffer, &p_current );
+            p_title->p_cell_play[i].i_still_time = ReadByte( p_ifo, pi_buffer, &p_current );
+            p_title->p_cell_play[i].i_command_nb = ReadByte( p_ifo, pi_buffer, &p_current );
+            p_title->p_cell_play[i].i_play_time = ReadDouble( p_ifo, pi_buffer, &p_current );
+            p_title->p_cell_play[i].i_start_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
             p_title->p_cell_play[i].i_first_ilvu_vobu_esector =
-                                                     ReadDouble( &p_current );
+                                                     ReadDouble( p_ifo, pi_buffer, &p_current );
             p_title->p_cell_play[i].i_last_vobu_start_sector =
-                                                     ReadDouble( &p_current );
-            p_title->p_cell_play[i].i_end_sector = ReadDouble( &p_current );
+                                                     ReadDouble( p_ifo, pi_buffer, &p_current );
+            p_title->p_cell_play[i].i_end_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
         }
     }
 
@@ -1086,9 +1119,9 @@ static int ReadTitle( ifo_t * p_ifo, title_t * p_title, off_t i_pos )
 
         for( i = 0 ; i < p_title->i_cell_nb ; i++ )
         {
-            p_title->p_cell_pos[i].i_vob_id = ReadWord( &p_current );
-            DumpBits( &p_current, 1 );
-            p_title->p_cell_pos[i].i_cell_id = ReadByte( &p_current );
+            p_title->p_cell_pos[i].i_vob_id = ReadWord( p_ifo, pi_buffer, &p_current );
+            DumpBits( p_ifo, pi_buffer, &p_current, 1 );
+            p_title->p_cell_pos[i].i_cell_id = ReadByte( p_ifo, pi_buffer, &p_current );
         }
     } 
 
@@ -1151,9 +1184,9 @@ static int ReadUnitInf( ifo_t * p_ifo, unit_inf_t * p_unit_inf, off_t i_pos )
     i_start = p_ifo->i_pos;
 //fprintf( stderr, "Unit\n" );
 
-    p_unit_inf->i_title_nb = ReadWord( &p_current );
-    DumpBits( &p_current, 2 );
-    p_unit_inf->i_end_byte = ReadDouble( &p_current );
+    p_unit_inf->i_title_nb = ReadWord( p_ifo, pi_buffer, &p_current );
+    DumpBits( p_ifo, pi_buffer, &p_current, 2 );
+    p_unit_inf->i_end_byte = ReadDouble( p_ifo, pi_buffer, &p_current );
 
     p_unit_inf->p_title =
             malloc( p_unit_inf->i_title_nb *sizeof(unit_title_t) );
@@ -1165,10 +1198,10 @@ static int ReadUnitInf( ifo_t * p_ifo, unit_inf_t * p_unit_inf, off_t i_pos )
 
     for( i = 0 ; i < p_unit_inf->i_title_nb ; i++ )
     {
-        p_unit_inf->p_title[i].i_category_mask = ReadByte( &p_current );
-        p_unit_inf->p_title[i].i_category = ReadByte( &p_current );
-        p_unit_inf->p_title[i].i_parental_mask = ReadWord( &p_current );
-        p_unit_inf->p_title[i].i_title_start_byte = ReadDouble( &p_current );
+        p_unit_inf->p_title[i].i_category_mask = ReadByte( p_ifo, pi_buffer, &p_current );
+        p_unit_inf->p_title[i].i_category = ReadByte( p_ifo, pi_buffer, &p_current );
+        p_unit_inf->p_title[i].i_parental_mask = ReadWord( p_ifo, pi_buffer, &p_current );
+        p_unit_inf->p_title[i].i_title_start_byte = ReadDouble( p_ifo, pi_buffer, &p_current );
     }
 
     for( i = 0 ; i < p_unit_inf->i_title_nb ; i++ )
@@ -1210,9 +1243,9 @@ static int ReadTitleUnit( ifo_t * p_ifo, title_unit_t * p_title_unit,
     i_start = p_ifo->i_pos;
 //fprintf( stderr, "Unit Table\n" );
 
-    p_title_unit->i_unit_nb = ReadWord( &p_current );
-    DumpBits( &p_current, 2 );
-    p_title_unit->i_end_byte = ReadDouble( &p_current );
+    p_title_unit->i_unit_nb = ReadWord( p_ifo, pi_buffer, &p_current );
+    DumpBits( p_ifo, pi_buffer, &p_current, 2 );
+    p_title_unit->i_end_byte = ReadDouble( p_ifo, pi_buffer, &p_current );
 
 //fprintf(stderr, "Unit: nb %d end %d\n", p_title_unit->i_unit_nb, p_title_unit->i_end_byte );
 
@@ -1225,11 +1258,11 @@ static int ReadTitleUnit( ifo_t * p_ifo, title_unit_t * p_title_unit,
 
     for( i = 0 ; i < p_title_unit->i_unit_nb ; i++ )
     {
-        ReadBits( &p_current, p_title_unit->p_unit[i].ps_lang_code, 2 );
-        DumpBits( &p_current, 1 );
-        p_title_unit->p_unit[i].i_existence_mask = ReadByte( &p_current );
+        ReadBits( p_ifo, pi_buffer, &p_current, p_title_unit->p_unit[i].ps_lang_code, 2 );
+        DumpBits( p_ifo, pi_buffer, &p_current, 1 );
+        p_title_unit->p_unit[i].i_existence_mask = ReadByte( p_ifo, pi_buffer, &p_current );
         p_title_unit->p_unit[i].i_unit_inf_start_byte =
-                                                   ReadDouble( &p_current );
+                                                   ReadDouble( p_ifo, pi_buffer, &p_current );
     }
 
     p_title_unit->p_unit_inf =
@@ -1283,9 +1316,9 @@ static int ReadCellInf( ifo_t * p_ifo, cell_inf_t * p_cell_inf, off_t i_pos )
     i_start = p_ifo->i_pos;
 //fprintf( stderr, "CELL ADD\n" );
 
-    p_cell_inf->i_vob_nb = ReadWord( &p_current );
-    DumpBits( &p_current, 2 );
-    p_cell_inf->i_end_byte = ReadDouble( &p_current );
+    p_cell_inf->i_vob_nb = ReadWord( p_ifo, pi_buffer, &p_current );
+    DumpBits( p_ifo, pi_buffer, &p_current, 2 );
+    p_cell_inf->i_end_byte = ReadDouble( p_ifo, pi_buffer, &p_current );
 
     p_cell_inf->i_cell_nb =
         ( i_start + p_cell_inf->i_end_byte + 1 - p_ifo->i_pos )
@@ -1303,11 +1336,11 @@ static int ReadCellInf( ifo_t * p_ifo, cell_inf_t * p_cell_inf, off_t i_pos )
 
     for( i = 0 ; i < p_cell_inf->i_cell_nb ; i++ )
     {
-        p_cell_inf->p_cell_map[i].i_vob_id = ReadWord( &p_current );
-        p_cell_inf->p_cell_map[i].i_cell_id = ReadByte( &p_current );
-        DumpBits( &p_current, 1 );
-        p_cell_inf->p_cell_map[i].i_start_sector = ReadDouble( &p_current );
-        p_cell_inf->p_cell_map[i].i_end_sector = ReadDouble( &p_current );
+        p_cell_inf->p_cell_map[i].i_vob_id = ReadWord( p_ifo, pi_buffer, &p_current );
+        p_cell_inf->p_cell_map[i].i_cell_id = ReadByte( p_ifo, pi_buffer, &p_current );
+        DumpBits( p_ifo, pi_buffer, &p_current, 1 );
+        p_cell_inf->p_cell_map[i].i_start_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
+        p_cell_inf->p_cell_map[i].i_end_sector = ReadDouble( p_ifo, pi_buffer, &p_current );
     }
     
     return 0;
@@ -1337,7 +1370,7 @@ static int ReadVobuMap( ifo_t * p_ifo, vobu_map_t * p_vobu_map, off_t i_pos )
     i_start = p_ifo->i_pos;
 //fprintf( stderr, "VOBU ADMAP\n" );
 
-    p_vobu_map->i_end_byte = ReadDouble( &p_current );
+    p_vobu_map->i_end_byte = ReadDouble( p_ifo, pi_buffer, &p_current );
     i_max = ( i_start + p_vobu_map->i_end_byte + 1 - p_ifo->i_pos )
             / sizeof(u32);
 
@@ -1350,11 +1383,7 @@ static int ReadVobuMap( ifo_t * p_ifo, vobu_map_t * p_vobu_map, off_t i_pos )
 
     for( i = 0 ; i < i_max ; i++ )
     {
-        p_vobu_map->pi_vobu_start_sector[i] = ReadDouble( &p_current );
-        if( p_current == pi_buffer + DVD_LB_SIZE )
-        {
-            p_current = FillBuffer( p_ifo, pi_buffer, p_ifo->i_pos );
-        }
+        p_vobu_map->pi_vobu_start_sector[i] = ReadDouble( p_ifo, pi_buffer, &p_current );
     }
 
     return 0;
index 1d7239a3fa416739c4e167fa2254586d3cd53a24..7a522788ab79219a68722147fcd9b66714dd0398 100644 (file)
@@ -5,12 +5,13 @@
  * contains the basic udf handling functions
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: dvd_udf.c,v 1.3 2001/02/20 07:49:12 sam Exp $
+ * $Id: dvd_udf.c,v 1.4 2001/04/13 05:36:12 stef Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
  * based on:
  *  - dvdudf by Christian Wolff <scarabaeus@convergence.de>
+ *  - fixes by Billy Biggs <vektor@dumbterm.net>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -401,7 +402,7 @@ static int UDFMapICB( struct ad_s icb, u8 * pi_file_type, struct ad_s * p_file,
 static int UDFScanDir( struct ad_s dir, char * psz_filename,
                        struct ad_s * p_file_icb, struct partition_s partition )
 {
-    u8      pi_lb[DVD_LB_SIZE];
+    u8      pi_lb[2*DVD_LB_SIZE];
     u32     i_lba;
     u16     i_tag_id;
     u8      i_file_char;
@@ -410,7 +411,7 @@ static int UDFScanDir( struct ad_s dir, char * psz_filename,
   
     /* Scan dir for ICB of file */
     i_lba = partition.i_start + dir.i_location;
-
+#if 0
     do
     {
         if( !UDFReadLB( partition.i_fd, i_lba++, 1, pi_lb ) )
@@ -443,6 +444,44 @@ static int UDFScanDir( struct ad_s dir, char * psz_filename,
     } while( i_lba <=
       partition.i_start + dir.i_location + ( dir.i_length - 1 ) / DVD_LB_SIZE );
 
+#else
+
+    if( UDFReadLB( partition.i_fd, i_lba, 2, pi_lb ) <= 0 ) {
+        return 0;
+    }
+
+    p = 0;
+    while( p < dir.i_length )
+    {
+        if( p > DVD_LB_SIZE )
+        {
+            ++i_lba;
+            p -= DVD_LB_SIZE;
+            dir.i_length -= DVD_LB_SIZE;
+            if( UDFReadLB( partition.i_fd, i_lba, 2, pi_lb ) <= 0 )
+            {
+                return 0;
+            }
+        }
+
+        UDFDescriptor( &pi_lb[p], &i_tag_id );
+
+        if( i_tag_id == 257 )
+        {
+            p += UDFFileIdentifier( &pi_lb[p], &i_file_char,
+                                    psz_temp, p_file_icb, partition );
+            if( !strcasecmp( psz_filename, psz_temp ) )
+            {
+                return 1;
+            }
+        }
+        else
+        {
+            return 0;
+        }
+    }
+
+#endif
     return 0;
 }
 
index 977dc61f2af68044a060c989e14bf4aada40b915..4e600a9e4caa5ed571475d6c842f03dd06118663 100644 (file)
@@ -10,7 +10,7 @@
  *  -dvd_udf to find files
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: input_dvd.c,v 1.44 2001/04/13 01:49:22 henri Exp $
+ * $Id: input_dvd.c,v 1.45 2001/04/13 05:36:12 stef Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -902,6 +902,9 @@ static void DVDInit( input_thread_t * p_input )
     /* Initialize ES structures */
     input_InitStream( p_input, sizeof( stream_ps_data_t ) );
 
+    /* disc input method */
+    p_input->stream.i_method = INPUT_METHOD_DVD;
+
 #define title_inf p_dvd->p_ifo->vmg.title_inf
     intf_WarnMsg( 2, "dvd info: number of titles: %d", title_inf.i_title_nb );
 
index 50a908cf73b149b2066c1d09dda7c7c34d8f52e9..0a9fe714bfcf4fc81b79e0aa79b850e3dac2067f 100644 (file)
@@ -468,7 +468,7 @@ create_intf_window (void)
   gtk_object_set_data_full (GTK_OBJECT (intf_window), "label_status", label_status,
                             (GtkDestroyNotify) gtk_widget_unref);
   gtk_widget_show (label_status);
-  gtk_box_pack_start (GTK_BOX (hbox4), label_status, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (hbox4), label_status, TRUE, TRUE, 0);
 
   label_bar = gtk_label_new (_("Bar: baz"));
   gtk_widget_ref (label_bar);
index d3653ad6ce80ec722331b225c614f6b2e448e148..897f656ac413a6f12b8e86405f24ab8d19ef222c 100644 (file)
@@ -2,7 +2,7 @@
  * intf_gnome.c: Gnome interface
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: intf_gnome.c,v 1.29 2001/04/13 01:49:22 henri Exp $
+ * $Id: intf_gnome.c,v 1.30 2001/04/13 05:36:12 stef Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Stéphane Borel <stef@via.ecp.fr>
@@ -75,7 +75,7 @@ static gint GnomeTitleMenu    ( gpointer, GtkWidget *,
                               void (*pf_toggle)(GtkCheckMenuItem *, gpointer) );
 static gint GnomeSetupMenu    ( intf_thread_t * p_intf );
 static void GnomeDisplayDate  ( GtkAdjustment *p_adj );
-static gint GnomeDVDModeManage( intf_thread_t * p_intf );
+static gint GnomeDiscModeManage( intf_thread_t * p_intf );
 static gint GnomeFileModeManage( intf_thread_t * p_intf );
 static gint GnomeNetworkModeManage( intf_thread_t * p_intf );
 
@@ -311,49 +311,66 @@ static gint GnomeManage( gpointer p_data )
         p_intf->b_menu_change = 0;
     }
 
-    if( p_intf->p_sys->b_mode_changed )
-    {
-        /* Sets the interface mode according to playlist item */
-        if( p_main->p_playlist->p_item != NULL )
-        {
-            if( !strncmp( p_main->p_playlist->p_item->psz_name, "dvd:", 4 ) )
-            {
-                p_intf->p_sys->i_intf_mode = DVD_MODE;
-            }
-            else if( !strncmp(
-                        p_main->p_playlist->p_item->psz_name, "ts:", 4 ) )
-            {
-                p_intf->p_sys->i_intf_mode = NET_MODE;
-            }
-        }
-
-        switch( p_intf->p_sys->i_intf_mode )
-        {
-            case DVD_MODE:
-                GnomeDVDModeManage( p_intf );
-                break;
-            case NET_MODE:
-                GnomeNetworkModeManage( p_intf );
-                break;
-            case FILE_MODE:
-            default:
-                GnomeFileModeManage( p_intf );
-                break;
-        }
-
-        p_intf->p_sys->b_mode_changed = 0;
-    }
-
-
     if( p_intf->p_input != NULL )
     {
         float           newvalue;
         char            psz_title[3];
         char            psz_chapter[3];
 
-        /* Used by TS input when PMT changes */
+        /* New input or stream map change */
         if( p_intf->p_input->stream.b_changed )
         {
+            /* input method */
+            if( p_intf->p_sys->b_mode_changed )
+            {
+#if 0
+                /* Sets the interface mode according to playlist item */
+                if( p_main->p_playlist->p_item != NULL )
+                {
+                    if( !strncmp( p_main->p_playlist->p_item->psz_name, "dvd:", 4 ) )
+                    {
+                        p_intf->p_sys->i_intf_mode = DVD_MODE;
+                    }
+                    else if( !strncmp(
+                                p_main->p_playlist->p_item->psz_name, "ts:", 4 ) )
+                    {
+                        p_intf->p_sys->i_intf_mode = NET_MODE;
+                    }
+                }
+        
+                switch( p_intf->p_sys->i_intf_mode )
+                {
+                    case DVD_MODE:
+                        GnomeDVDModeManage( p_intf );
+                        break;
+                    case NET_MODE:
+                        GnomeNetworkModeManage( p_intf );
+                        break;
+                    case FILE_MODE:
+                    default:
+                        GnomeFileModeManage( p_intf );
+                        break;
+                }
+#else
+                switch( p_intf->p_input->stream.i_method & 0xf0 )
+                {
+                    case INPUT_METHOD_FILE:
+                        GnomeFileModeManage( p_intf );
+                        break;
+                    case INPUT_METHOD_DISC:
+                        GnomeDiscModeManage( p_intf );
+                        break;
+                    case INPUT_METHOD_NETWORK:
+                        GnomeNetworkModeManage( p_intf );
+                        break;
+                    default:
+                        intf_ErrMsg( "intf error: can't determine input method" );
+                        break;
+                }
+#endif
+                p_intf->p_sys->b_mode_changed = 0;
+            }
+
             p_intf->p_sys->b_menus_update = 1;
             p_intf->p_input->stream.b_changed = 0;
             intf_WarnMsg( 2, 
@@ -961,9 +978,9 @@ void GnomeDisplayDate( GtkAdjustment *p_adj )
 
 
 /*****************************************************************************
- * GnomeDVDModeManage
+ * GnomeDiscModeManage
  *****************************************************************************/
-static gint GnomeDVDModeManage( intf_thread_t * p_intf )
+static gint GnomeDiscModeManage( intf_thread_t * p_intf )
 {
     GtkWidget *     p_dvd_box;
     GtkWidget *     p_file_box;
@@ -995,6 +1012,7 @@ static gint GnomeFileModeManage( intf_thread_t * p_intf )
     GtkWidget *     p_dvd_box;
     GtkWidget *     p_file_box;
     GtkWidget *     p_network_box;
+//    char *          psz_name;
 
     p_network_box = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
                  p_intf->p_sys->p_window ), "network_box" ) );
@@ -1007,10 +1025,17 @@ static gint GnomeFileModeManage( intf_thread_t * p_intf )
     p_file_box = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
                  p_intf->p_sys->p_window ), "file_box" ) );
     gtk_widget_show( GTK_WIDGET( p_file_box ) );
+#if 0
+    psz_name = malloc( 16 + strlen( p_intf->p_input->p_source ) );
+    sprintf( psz_name, "Status: playing %s", p_intf->p_input->p_source );
+
+    gtk_label_set_text( p_intf->p_sys->p_label_status, psz_name );
 
+    free( psz_name );
+#else
     gtk_label_set_text( p_intf->p_sys->p_label_status,
                         "Status: foo" );
-
+#endif
     return TRUE;
 }
 
index 4af20b736b4c35efd5266abe2e98baff12698995..9db1cda6c21af120925528339fdbeb3054fb199e 100644 (file)
          <ypad>0</ypad>
          <child>
            <padding>0</padding>
-           <expand>False</expand>
-           <fill>False</fill>
+           <expand>True</expand>
+           <fill>True</fill>
          </child>
        </widget>
 
index a1ac8df8ab44273fe8cd544b1da4576cd00f1f0d..5a2509a2ae18dddc4bc62fb9687f086fe5b39901 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.13 2001/04/05 16:37:15 asmax Exp $
+ * $Id: input_ps.c,v 1.14 2001/04/13 05:36:12 stef Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Cyril Deguet <asmax@via.ecp.fr>
@@ -214,6 +214,10 @@ static void PSInit( input_thread_t * p_input )
         }
         rewind( p_method->stream );
         vlc_mutex_lock( &p_input->stream.stream_lock );
+
+        /* file input method */
+        p_input->stream.i_method = INPUT_METHOD_FILE;
+
         p_input->stream.p_selected_area->i_tell = 0;
         if( p_demux_data->b_has_PSM )
         {
@@ -292,6 +296,10 @@ static void PSInit( input_thread_t * p_input )
     {
         /* The programs will be added when we read them. */
         vlc_mutex_lock( &p_input->stream.stream_lock );
+
+        /* file input method */
+        p_input->stream.i_method = INPUT_METHOD_FILE;
+
         p_input->stream.pp_programs[0]->b_is_ok = 0;
         vlc_mutex_unlock( &p_input->stream.stream_lock );
     }
index 510d434a274a4a73d653ae6e6f50e01b4cd05231..8409ca95f6919e7fedfd887a55122b2d39af65a3 100644 (file)
@@ -2,7 +2,7 @@
  * input_ts.c: TS demux and netlist management
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: input_ts.c,v 1.13 2001/03/19 22:16:31 henri Exp $
+ * $Id: input_ts.c,v 1.14 2001/04/13 05:36:12 stef Exp $
  *
  * Authors: Henri Fallon <henri@videolan.org>
  *
@@ -167,6 +167,10 @@ static void TSInit( input_thread_t * p_input )
     /* Initialize the stream */
     input_InitStream( p_input, sizeof( stream_ts_data_t ) );
 
+    /* input method type */
+    /* FIXME: should test if you have network or file here */
+    p_input->stream.i_method = INPUT_METHOD_NETWORK;
+
     /* Init */
     p_stream_data = (stream_ts_data_t *)p_input->stream.p_demux_data;
     p_stream_data->i_pat_version = PAT_UNINITIALIZED ;
index fcc7b57d50e2e04c8e0f4add83743100dff1ff46..53f9934804cca7dc93c54eb5d8b87362edb6405f 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.48 2001/04/12 03:26:53 stef Exp $
+ * $Id: input_programs.c,v 1.49 2001/04/13 05:36:12 stef Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
  *****************************************************************************/
 int input_InitStream( input_thread_t * p_input, size_t i_data_len )
 {
+
+    p_input->stream.i_method = INPUT_METHOD_NONE;
     p_input->stream.i_stream_id = 0;
-    p_input->stream.b_changed = 0;
+    p_input->stream.b_changed = 1;
     p_input->stream.pp_es = NULL;
     p_input->stream.pp_selected_es = NULL;
     p_input->stream.pp_programs = NULL;