Commit f11b9a96 authored by Stéphane Borel's avatar Stéphane Borel

*Added udf fix by Billy Biggs

*Added checks in dvd_ifo

*Cleanings in gnome interface : the interface should be dependant on the
input method.
parent c7df0042
......@@ -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
......
......@@ -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: Stphane 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 );