Commit 1cd850a8 authored by Stéphane Borel's avatar Stéphane Borel

. Now use of 64 bits offsets to parse the whole DVD. So we have all the

available information
. Fixed a bug in parsing of VTS attributes
. Fixed a bug in input.c that made input plugin initialize even though
no stream is reachable (thanks Sam)

I hope I'll be able to get the position of the movie soon.

Meuuh : the seek function of the plugin now take off_t as argument which
could be a problem later. Maybe it should take off64_t or time argument.
parent f56c4db1
...@@ -52,14 +52,14 @@ static int IfoFindStart( ifo_t* p_ifo ) ...@@ -52,14 +52,14 @@ static int IfoFindStart( ifo_t* p_ifo )
while( strncmp( psz_test, psz_ifo_start, 12 ) != 0 ) while( strncmp( psz_test, psz_ifo_start, 12 ) != 0 )
{ {
/* The start of ifo file is on a sector boundary */ /* The start of ifo file is on a sector boundary */
p_ifo->i_pos = lseek( p_ifo->i_fd, p_ifo->i_pos = lseek64( p_ifo->i_fd,
p_ifo->i_pos + DVD_LB_SIZE, p_ifo->i_pos + DVD_LB_SIZE,
SEEK_SET ); SEEK_SET );
read( p_ifo->i_fd, psz_test, 12 ); read( p_ifo->i_fd, psz_test, 12 );
} }
p_ifo->i_off = p_ifo->i_pos; p_ifo->i_off = p_ifo->i_pos;
fprintf( stderr, "VMG Off : %d\n", p_ifo->i_off ); fprintf( stderr, "VMG Off : %lld\n", (long long)(p_ifo->i_off) );
return 0; return 0;
} }
...@@ -77,14 +77,14 @@ static int IfoFindVTS( ifo_t* p_ifo ) ...@@ -77,14 +77,14 @@ static int IfoFindVTS( ifo_t* p_ifo )
while( strncmp( psz_test, psz_ifo_start, 12 ) != 0 ) while( strncmp( psz_test, psz_ifo_start, 12 ) != 0 )
{ {
/* The start of ifo file is on a sector boundary */ /* The start of ifo file is on a sector boundary */
p_ifo->i_pos = lseek( p_ifo->i_fd, p_ifo->i_pos = lseek64( p_ifo->i_fd,
p_ifo->i_pos + DVD_LB_SIZE, p_ifo->i_pos + DVD_LB_SIZE,
SEEK_SET ); SEEK_SET );
read( p_ifo->i_fd, psz_test, 12 ); read( p_ifo->i_fd, psz_test, 12 );
} }
p_ifo->i_off = p_ifo->i_pos; p_ifo->i_off = p_ifo->i_pos;
fprintf( stderr, "VTS Off : %d\n", p_ifo->i_off ); fprintf( stderr, "VTS Off : %lld\n", (long long)(p_ifo->i_off) );
return 0; return 0;
} }
...@@ -101,7 +101,7 @@ ifo_t IfoInit( int i_fd ) ...@@ -101,7 +101,7 @@ ifo_t IfoInit( int i_fd )
ifo.i_fd = i_fd; ifo.i_fd = i_fd;
/* No data at the beginning of the disk /* No data at the beginning of the disk
* 512000 bytes is just another value :) */ * 512000 bytes is just another value :) */
ifo.i_pos = lseek( ifo.i_fd, 250 *DVD_LB_SIZE, SEEK_SET ); ifo.i_pos = lseek64( ifo.i_fd, 250 *DVD_LB_SIZE, SEEK_SET );
/* FIXME : use udf filesystem to find the beginning of the file */ /* FIXME : use udf filesystem to find the beginning of the file */
IfoFindStart( &ifo ); IfoFindStart( &ifo );
...@@ -173,51 +173,56 @@ void IfoEnd( ifo_t* p_ifo ) ...@@ -173,51 +173,56 @@ void IfoEnd( ifo_t* p_ifo )
#define GET( p_field , i_len ) \ #define GET( p_field , i_len ) \
{ \ { \
read( p_ifo->i_fd , (p_field) , (i_len) ); \ read( p_ifo->i_fd , (p_field) , (i_len) ); \
fprintf(stderr, "Pos : %d Val : %llx\n", p_ifo->i_pos - i_start, \ fprintf(stderr, "Pos : %lld Val : %llx\n", \
(long long int) *(p_field) ); \ (long long)(p_ifo->i_pos - i_start), \
(long long)*(p_field) ); \
p_ifo->i_pos = \ p_ifo->i_pos = \
lseek( p_ifo->i_fd, p_ifo->i_pos + (i_len), SEEK_SET ); \ lseek64( p_ifo->i_fd, p_ifo->i_pos + (i_len), SEEK_SET ); \
} }
#define GETC( p_field ) \ #define GETC( p_field ) \
{ \ { \
read( p_ifo->i_fd , (p_field) , 1 ); \ read( p_ifo->i_fd , (p_field) , 1 ); \
fprintf(stderr, "Pos : %d Value : %d\n", p_ifo->i_pos - i_start, \ fprintf(stderr, "Pos : %lld Value : %d\n", \
(long long)(p_ifo->i_pos - i_start), \
*(p_field) ); \ *(p_field) ); \
p_ifo->i_pos = lseek( p_ifo->i_fd , p_ifo->i_pos + 1 , SEEK_SET ); \ p_ifo->i_pos = lseek64( p_ifo->i_fd , p_ifo->i_pos + 1 , SEEK_SET ); \
} }
#define GETS( p_field ) \ #define GETS( p_field ) \
{ \ { \
read( p_ifo->i_fd , (p_field) , 2 ); \ read( p_ifo->i_fd , (p_field) , 2 ); \
*(p_field) = ntohs( *(p_field) ); \ *(p_field) = ntohs( *(p_field) ); \
fprintf(stderr, "Pos : %d Value : %d\n", p_ifo->i_pos - i_start, \ fprintf(stderr, "Pos : %lld Value : %d\n", \
(long long)(p_ifo->i_pos - i_start), \
*(p_field) ); \ *(p_field) ); \
p_ifo->i_pos = lseek( p_ifo->i_fd , p_ifo->i_pos + 2 , SEEK_SET ); \ p_ifo->i_pos = lseek64( p_ifo->i_fd , p_ifo->i_pos + 2 , SEEK_SET ); \
} }
#define GETL( p_field ) \ #define GETL( p_field ) \
{ \ { \
read( p_ifo->i_fd , (p_field) , 4 ); \ read( p_ifo->i_fd , (p_field) , 4 ); \
*(p_field) = ntohl( *(p_field) ); \ *(p_field) = ntohl( *(p_field) ); \
fprintf(stderr, "Pos : %d Value : %d\n", p_ifo->i_pos - i_start, \ fprintf(stderr, "Pos : %lld Value : %d\n", \
(long long)(p_ifo->i_pos - i_start), \
*(p_field) ); \ *(p_field) ); \
p_ifo->i_pos = lseek( p_ifo->i_fd , p_ifo->i_pos + 4 , SEEK_SET ); \ p_ifo->i_pos = lseek64( p_ifo->i_fd , p_ifo->i_pos + 4 , SEEK_SET ); \
} }
#define GETLL( p_field ) \ #define GETLL( p_field ) \
{ \ { \
read( p_ifo->i_fd , (p_field) , 8 ); \ read( p_ifo->i_fd , (p_field) , 8 ); \
*(p_field) = ntoh64( *(p_field) ); \ *(p_field) = ntoh64( *(p_field) ); \
fprintf(stderr, "Pos : %d Value : %lld\n", p_ifo->i_pos - i_start, \ fprintf(stderr, "Pos : %lld Value : %lld\n", \
(long long)(p_ifo->i_pos - i_start), \
*(p_field) ); \ *(p_field) ); \
p_ifo->i_pos = lseek( p_ifo->i_fd , p_ifo->i_pos + 8 , SEEK_SET ); \ p_ifo->i_pos = lseek64( p_ifo->i_fd , p_ifo->i_pos + 8 , SEEK_SET ); \
} }
#define FLUSH( i_len ) \ #define FLUSH( i_len ) \
{ \ { \
fprintf(stderr, "Pos : %d\n", p_ifo->i_pos - i_start ); \ fprintf(stderr, "Pos : %lld\n", (long long)(p_ifo->i_pos - i_start)); \
p_ifo->i_pos = lseek( p_ifo->i_fd , \ p_ifo->i_pos = lseek64( p_ifo->i_fd , \
p_ifo->i_pos + (i_len), SEEK_SET ); \ p_ifo->i_pos + (i_len), SEEK_SET ); \
} }
...@@ -232,7 +237,7 @@ static pgc_t ReadPGC( ifo_t* p_ifo ) ...@@ -232,7 +237,7 @@ static pgc_t ReadPGC( ifo_t* p_ifo )
{ {
pgc_t pgc; pgc_t pgc;
int i; int i;
int i_start = p_ifo->i_pos; off64_t i_start = p_ifo->i_pos;
fprintf( stderr, "PGC\n" ); fprintf( stderr, "PGC\n" );
...@@ -267,7 +272,7 @@ fprintf( stderr, "PGC\n" ); ...@@ -267,7 +272,7 @@ fprintf( stderr, "PGC\n" );
/* Parsing of pgc_com_tab_t */ /* Parsing of pgc_com_tab_t */
if( pgc.i_com_tab_sbyte ) if( pgc.i_com_tab_sbyte )
{ {
p_ifo->i_pos = lseek( p_ifo->i_fd, i_start p_ifo->i_pos = lseek64( p_ifo->i_fd, i_start
+ pgc.i_com_tab_sbyte, SEEK_SET ); + pgc.i_com_tab_sbyte, SEEK_SET );
GETS( &pgc.com_tab.i_pre_com_nb ); GETS( &pgc.com_tab.i_pre_com_nb );
GETS( &pgc.com_tab.i_post_com_nb ); GETS( &pgc.com_tab.i_post_com_nb );
...@@ -313,7 +318,7 @@ fprintf( stderr, "PGC\n" ); ...@@ -313,7 +318,7 @@ fprintf( stderr, "PGC\n" );
/* Parsing of pgc_prg_map_t */ /* Parsing of pgc_prg_map_t */
if( pgc.i_prg_map_sbyte ) if( pgc.i_prg_map_sbyte )
{ {
p_ifo->i_pos = lseek( p_ifo->i_fd, i_start p_ifo->i_pos = lseek64( p_ifo->i_fd, i_start
+ pgc.i_prg_map_sbyte, SEEK_SET ); + pgc.i_prg_map_sbyte, SEEK_SET );
pgc.prg_map.pi_entry_cell = malloc( pgc.i_prg_nb *sizeof(u8) ); pgc.prg_map.pi_entry_cell = malloc( pgc.i_prg_nb *sizeof(u8) );
if( pgc.prg_map.pi_entry_cell == NULL ) if( pgc.prg_map.pi_entry_cell == NULL )
...@@ -328,7 +333,7 @@ fprintf( stderr, "PGC\n" ); ...@@ -328,7 +333,7 @@ fprintf( stderr, "PGC\n" );
/* Parsing of cell_play_inf_t */ /* Parsing of cell_play_inf_t */
if( pgc.i_cell_play_inf_sbyte ) if( pgc.i_cell_play_inf_sbyte )
{ {
p_ifo->i_pos = lseek( p_ifo->i_fd, i_start p_ifo->i_pos = lseek64( p_ifo->i_fd, i_start
+ pgc.i_cell_play_inf_sbyte, SEEK_SET ); + pgc.i_cell_play_inf_sbyte, SEEK_SET );
pgc.p_cell_play_inf = malloc( pgc.i_cell_nb *sizeof(cell_play_inf_t) ); pgc.p_cell_play_inf = malloc( pgc.i_cell_nb *sizeof(cell_play_inf_t) );
if( pgc.p_cell_play_inf == NULL ) if( pgc.p_cell_play_inf == NULL )
...@@ -352,7 +357,7 @@ fprintf( stderr, "PGC\n" ); ...@@ -352,7 +357,7 @@ fprintf( stderr, "PGC\n" );
/* Parsing of cell_pos_inf_map */ /* Parsing of cell_pos_inf_map */
if( pgc.i_cell_pos_inf_sbyte ) if( pgc.i_cell_pos_inf_sbyte )
{ {
p_ifo->i_pos = lseek( p_ifo->i_fd, i_start p_ifo->i_pos = lseek64( p_ifo->i_fd, i_start
+ pgc.i_cell_pos_inf_sbyte, SEEK_SET ); + pgc.i_cell_pos_inf_sbyte, SEEK_SET );
pgc.p_cell_pos_inf = malloc( pgc.i_cell_nb *sizeof(cell_pos_inf_t) ); pgc.p_cell_pos_inf = malloc( pgc.i_cell_nb *sizeof(cell_pos_inf_t) );
if( pgc.p_cell_play_inf == NULL ) if( pgc.p_cell_play_inf == NULL )
...@@ -379,7 +384,7 @@ static pgci_inf_t ReadUnit( ifo_t* p_ifo ) ...@@ -379,7 +384,7 @@ static pgci_inf_t ReadUnit( ifo_t* p_ifo )
{ {
pgci_inf_t inf; pgci_inf_t inf;
int i; int i;
int i_start = p_ifo->i_pos; off64_t i_start = p_ifo->i_pos;
fprintf( stderr, "Unit\n" ); fprintf( stderr, "Unit\n" );
...@@ -402,7 +407,7 @@ fprintf( stderr, "Unit\n" ); ...@@ -402,7 +407,7 @@ fprintf( stderr, "Unit\n" );
} }
for( i=0 ; i<inf.i_srp_nb ; i++ ) for( i=0 ; i<inf.i_srp_nb ; i++ )
{ {
p_ifo->i_pos = lseek( p_ifo->i_fd, p_ifo->i_pos = lseek64( p_ifo->i_fd,
i_start + inf.p_srp[i].i_pgci_sbyte, i_start + inf.p_srp[i].i_pgci_sbyte,
SEEK_SET ); SEEK_SET );
inf.p_srp[i].pgc = ReadPGC( p_ifo ); inf.p_srp[i].pgc = ReadPGC( p_ifo );
...@@ -418,7 +423,7 @@ static pgci_ut_t ReadUnitTable( ifo_t* p_ifo ) ...@@ -418,7 +423,7 @@ static pgci_ut_t ReadUnitTable( ifo_t* p_ifo )
{ {
pgci_ut_t pgci; pgci_ut_t pgci;
int i; int i;
int i_start = p_ifo->i_pos; off64_t i_start = p_ifo->i_pos;
fprintf( stderr, "Unit Table\n" ); fprintf( stderr, "Unit Table\n" );
...@@ -448,7 +453,7 @@ fprintf( stderr, "Unit Table\n" ); ...@@ -448,7 +453,7 @@ fprintf( stderr, "Unit Table\n" );
} }
for( i=0 ; i<pgci.i_lu_nb ; i++ ) for( i=0 ; i<pgci.i_lu_nb ; i++ )
{ {
p_ifo->i_pos = lseek( p_ifo->i_fd, i_start + p_ifo->i_pos = lseek64( p_ifo->i_fd, i_start +
pgci.p_lu[i].i_lu_sbyte, pgci.p_lu[i].i_lu_sbyte,
SEEK_SET ); SEEK_SET );
pgci.p_pgci_inf[i] = ReadUnit( p_ifo ); pgci.p_pgci_inf[i] = ReadUnit( p_ifo );
...@@ -464,7 +469,7 @@ static c_adt_t ReadCellInf( ifo_t* p_ifo ) ...@@ -464,7 +469,7 @@ static c_adt_t ReadCellInf( ifo_t* p_ifo )
{ {
c_adt_t c_adt; c_adt_t c_adt;
int i, i_max; int i, i_max;
int i_start = p_ifo->i_pos; off64_t i_start = p_ifo->i_pos;
fprintf( stderr, "CELL ADD\n" ); fprintf( stderr, "CELL ADD\n" );
...@@ -498,7 +503,7 @@ static vobu_admap_t ReadMap( ifo_t* p_ifo ) ...@@ -498,7 +503,7 @@ static vobu_admap_t ReadMap( ifo_t* p_ifo )
{ {
vobu_admap_t map; vobu_admap_t map;
int i, i_max; int i, i_max;
int i_start = p_ifo->i_pos; off64_t i_start = p_ifo->i_pos;
fprintf( stderr, "VOBU ADMAP\n" ); fprintf( stderr, "VOBU ADMAP\n" );
...@@ -525,7 +530,7 @@ static vmgi_mat_t ReadVMGInfMat( ifo_t* p_ifo ) ...@@ -525,7 +530,7 @@ static vmgi_mat_t ReadVMGInfMat( ifo_t* p_ifo )
{ {
vmgi_mat_t mat; vmgi_mat_t mat;
int i; int i;
int i_start = p_ifo->i_pos; off64_t i_start = p_ifo->i_pos;
fprintf( stderr, "VMGI\n" ); fprintf( stderr, "VMGI\n" );
...@@ -582,7 +587,7 @@ static vmg_ptt_srpt_t ReadVMGTitlePointer( ifo_t* p_ifo ) ...@@ -582,7 +587,7 @@ static vmg_ptt_srpt_t ReadVMGTitlePointer( ifo_t* p_ifo )
{ {
vmg_ptt_srpt_t ptr; vmg_ptt_srpt_t ptr;
int i; int i;
int i_start = p_ifo->i_pos; off64_t i_start = p_ifo->i_pos;
fprintf( stderr, "PTR\n" ); fprintf( stderr, "PTR\n" );
...@@ -618,7 +623,7 @@ static vmg_ptl_mait_t ReadParentalInf( ifo_t* p_ifo ) ...@@ -618,7 +623,7 @@ static vmg_ptl_mait_t ReadParentalInf( ifo_t* p_ifo )
{ {
vmg_ptl_mait_t par; vmg_ptl_mait_t par;
int i, j, k; int i, j, k;
int i_start = p_ifo->i_pos; off64_t i_start = p_ifo->i_pos;
fprintf( stderr, "PTL\n" ); fprintf( stderr, "PTL\n" );
...@@ -648,7 +653,7 @@ fprintf( stderr, "PTL\n" ); ...@@ -648,7 +653,7 @@ fprintf( stderr, "PTL\n" );
} }
for( i=0 ; i<par.i_country_nb ; i++ ) for( i=0 ; i<par.i_country_nb ; i++ )
{ {
p_ifo->i_pos = lseek( p_ifo->i_fd, i_start + p_ifo->i_pos = lseek64( p_ifo->i_fd, i_start +
par.p_ptl_desc[i].i_ptl_mai_sbyte, SEEK_SET ); par.p_ptl_desc[i].i_ptl_mai_sbyte, SEEK_SET );
for( j=1 ; j<=8 ; j++ ) for( j=1 ; j<=8 ; j++ )
{ {
...@@ -677,7 +682,7 @@ static vmg_vts_atrt_t ReadVTSAttr( ifo_t* p_ifo ) ...@@ -677,7 +682,7 @@ static vmg_vts_atrt_t ReadVTSAttr( ifo_t* p_ifo )
{ {
vmg_vts_atrt_t atrt; vmg_vts_atrt_t atrt;
int i, j; int i, j;
int i_start = p_ifo->i_pos; off64_t i_start = p_ifo->i_pos;
fprintf( stderr, "VTS ATTR\n" ); fprintf( stderr, "VTS ATTR\n" );
...@@ -704,32 +709,34 @@ fprintf( stderr, "VTS ATTR\n" ); ...@@ -704,32 +709,34 @@ fprintf( stderr, "VTS ATTR\n" );
} }
for( i=0 ; i<atrt.i_vts_nb ; i++ ) for( i=0 ; i<atrt.i_vts_nb ; i++ )
{ {
p_ifo->i_pos = lseek( p_ifo->i_fd, i_start + atrt.pi_vts_atrt_sbyte[i], p_ifo->i_pos = lseek64( p_ifo->i_fd, i_start +
atrt.pi_vts_atrt_sbyte[i],
SEEK_SET ); SEEK_SET );
GETL( &atrt.p_vts_atrt[i].i_ebyte ); GETL( &atrt.p_vts_atrt[i].i_ebyte );
GETL( &atrt.p_vts_atrt[i].i_cat_app_type ); GETL( &atrt.p_vts_atrt[i].i_cat_app_type );
GETS( &atrt.p_vts_atrt[i].i_vtsm_video_atrt ); GETS( &atrt.p_vts_atrt[i].i_vtsm_video_atrt );
FLUSH( 1 ); FLUSH( 1 );
GETC( &atrt.p_vts_atrt[i].i_vtsm_audio_nb ); GETC( &atrt.p_vts_atrt[i].i_vtsm_audio_nb );
for( j=0 ; j<atrt.p_vts_atrt[i].i_vtsm_audio_nb ; j++ ) for( j=0 ; j<8 ; j++ )
{ {
GETLL( &atrt.p_vts_atrt[i].pi_vtsm_audio_atrt[j] ); GETLL( &atrt.p_vts_atrt[i].pi_vtsm_audio_atrt[j] );
} }
FLUSH( 1 ); FLUSH( 17 );
GETC( &atrt.p_vts_atrt[i].i_vtsm_subpic_nb ); GETC( &atrt.p_vts_atrt[i].i_vtsm_subpic_nb );
for( j=0 ; j<atrt.p_vts_atrt[i].i_vtsm_subpic_nb ; j++ ) for( j=0 ; j<28 ; j++ )
{ {
GET( &atrt.p_vts_atrt[i].pi_vtsm_subpic_atrt[j], 6 ); GET( &atrt.p_vts_atrt[i].pi_vtsm_subpic_atrt[j], 6 );
/* FIXME : Fix endianness issue here */ /* FIXME : Fix endianness issue here */
} }
FLUSH( 2 );
GETS( &atrt.p_vts_atrt[i].i_vtstt_video_atrt ); GETS( &atrt.p_vts_atrt[i].i_vtstt_video_atrt );
FLUSH( 1 ); FLUSH( 1 );
GETL( &atrt.p_vts_atrt[i].i_vtstt_audio_nb ); GETL( &atrt.p_vts_atrt[i].i_vtstt_audio_nb );
for( j=0 ; j<atrt.p_vts_atrt[i].i_vtstt_audio_nb ; j++ ) for( j=0 ; j<8 ; j++ )
{ {
GETLL( &atrt.p_vts_atrt[i].pi_vtstt_audio_atrt[j] ); GETLL( &atrt.p_vts_atrt[i].pi_vtstt_audio_atrt[j] );
} }
FLUSH( 1 ); FLUSH( 17 );
GETC( &atrt.p_vts_atrt[i].i_vtstt_subpic_nb ); GETC( &atrt.p_vts_atrt[i].i_vtstt_subpic_nb );
for( j=0 ; j<atrt.p_vts_atrt[i].i_vtstt_subpic_nb ; j++ ) for( j=0 ; j<atrt.p_vts_atrt[i].i_vtstt_subpic_nb ; j++ )
{ {
...@@ -748,49 +755,49 @@ static vmg_t ReadVMG( ifo_t* p_ifo ) ...@@ -748,49 +755,49 @@ static vmg_t ReadVMG( ifo_t* p_ifo )
{ {
vmg_t vmg; vmg_t vmg;
p_ifo->i_pos = lseek( p_ifo->i_fd, p_ifo->i_off, SEEK_SET); p_ifo->i_pos = lseek64( p_ifo->i_fd, p_ifo->i_off, SEEK_SET);
vmg.mat = ReadVMGInfMat( p_ifo ); vmg.mat = ReadVMGInfMat( p_ifo );
p_ifo->i_pos = lseek( p_ifo->i_fd, p_ifo->i_off + p_ifo->i_pos = lseek64( p_ifo->i_fd, p_ifo->i_off +
vmg.mat.i_fp_pgc_sbyte, SEEK_SET ); vmg.mat.i_fp_pgc_sbyte, SEEK_SET );
vmg.pgc = ReadPGC( p_ifo ); vmg.pgc = ReadPGC( p_ifo );
if( vmg.mat.i_ptt_srpt_ssector ) if( vmg.mat.i_ptt_srpt_ssector )
{ {
p_ifo->i_pos = lseek( p_ifo->i_fd, p_ifo->i_off + p_ifo->i_pos = lseek64( p_ifo->i_fd, p_ifo->i_off +
vmg.mat.i_ptt_srpt_ssector *DVD_LB_SIZE, vmg.mat.i_ptt_srpt_ssector *DVD_LB_SIZE,
SEEK_SET ); SEEK_SET );
vmg.ptt_srpt = ReadVMGTitlePointer( p_ifo ); vmg.ptt_srpt = ReadVMGTitlePointer( p_ifo );
} }
if( vmg.mat.i_pgci_ut_ssector ) if( vmg.mat.i_pgci_ut_ssector )
{ {
p_ifo->i_pos = lseek( p_ifo->i_fd, p_ifo->i_off + p_ifo->i_pos = lseek64( p_ifo->i_fd, p_ifo->i_off +
vmg.mat.i_pgci_ut_ssector *DVD_LB_SIZE, vmg.mat.i_pgci_ut_ssector *DVD_LB_SIZE,
SEEK_SET ); SEEK_SET );
vmg.pgci_ut = ReadUnitTable( p_ifo ); vmg.pgci_ut = ReadUnitTable( p_ifo );
} }
if( vmg.mat.i_ptl_mait_ssector ) if( vmg.mat.i_ptl_mait_ssector )
{ {
p_ifo->i_pos = lseek( p_ifo->i_fd, p_ifo->i_off + p_ifo->i_pos = lseek64( p_ifo->i_fd, p_ifo->i_off +
vmg.mat.i_ptl_mait_ssector *DVD_LB_SIZE, vmg.mat.i_ptl_mait_ssector *DVD_LB_SIZE,
SEEK_SET ); SEEK_SET );
vmg.ptl_mait = ReadParentalInf( p_ifo ); vmg.ptl_mait = ReadParentalInf( p_ifo );
} }
if( vmg.mat.i_vts_atrt_ssector ) if( vmg.mat.i_vts_atrt_ssector )
{ {
p_ifo->i_pos = lseek( p_ifo->i_fd, p_ifo->i_off + p_ifo->i_pos = lseek64( p_ifo->i_fd, p_ifo->i_off +
vmg.mat.i_vts_atrt_ssector *DVD_LB_SIZE, vmg.mat.i_vts_atrt_ssector *DVD_LB_SIZE,
SEEK_SET ); SEEK_SET );
vmg.vts_atrt = ReadVTSAttr( p_ifo ); vmg.vts_atrt = ReadVTSAttr( p_ifo );
} }
if( vmg.mat.i_c_adt_ssector ) if( vmg.mat.i_c_adt_ssector )
{ {
p_ifo->i_pos = lseek( p_ifo->i_fd, p_ifo->i_off + p_ifo->i_pos = lseek64( p_ifo->i_fd, p_ifo->i_off +
vmg.mat.i_c_adt_ssector *DVD_LB_SIZE, vmg.mat.i_c_adt_ssector *DVD_LB_SIZE,
SEEK_SET ); SEEK_SET );
vmg.c_adt = ReadCellInf( p_ifo ); vmg.c_adt = ReadCellInf( p_ifo );
} }
if( vmg.mat.i_vobu_admap_ssector ) if( vmg.mat.i_vobu_admap_ssector )
{ {
p_ifo->i_pos = lseek( p_ifo->i_fd, p_ifo->i_off + p_ifo->i_pos = lseek64( p_ifo->i_fd, p_ifo->i_off +
vmg.mat.i_vobu_admap_ssector *DVD_LB_SIZE, vmg.mat.i_vobu_admap_ssector *DVD_LB_SIZE,
SEEK_SET ); SEEK_SET );
vmg.vobu_admap = ReadMap( p_ifo ); vmg.vobu_admap = ReadMap( p_ifo );
...@@ -810,7 +817,7 @@ static vtsi_mat_t ReadVTSInfMat( ifo_t* p_ifo ) ...@@ -810,7 +817,7 @@ static vtsi_mat_t ReadVTSInfMat( ifo_t* p_ifo )
{ {
vtsi_mat_t mat; vtsi_mat_t mat;
int i; int i;
int i_start = p_ifo->i_pos; off64_t i_start = p_ifo->i_pos;
fprintf( stderr, "VTSI\n" ); fprintf( stderr, "VTSI\n" );
...@@ -876,7 +883,7 @@ static vts_ptt_srpt_t ReadVTSTitlePointer( ifo_t* p_ifo ) ...@@ -876,7 +883,7 @@ static vts_ptt_srpt_t ReadVTSTitlePointer( ifo_t* p_ifo )
{ {
vts_ptt_srpt_t ptr; vts_ptt_srpt_t ptr;
int i; int i;
int i_start = p_ifo->i_pos; off64_t i_start = p_ifo->i_pos;
fprintf( stderr, "PTR\n" ); fprintf( stderr, "PTR\n" );
...@@ -904,7 +911,7 @@ fprintf( stderr, "PTR\n" ); ...@@ -904,7 +911,7 @@ fprintf( stderr, "PTR\n" );
} }
for( i=0 ; i<ptr.i_ttu_nb ; i++ ) for( i=0 ; i<ptr.i_ttu_nb ; i++ )
{ {
p_ifo->i_pos = lseek( p_ifo->i_fd, i_start + p_ifo->i_pos = lseek64( p_ifo->i_fd, i_start +
ptr.pi_ttu_sbyte[i], SEEK_SET ); ptr.pi_ttu_sbyte[i], SEEK_SET );
GETS( &ptr.p_ttu[i].i_pgc_nb ); GETS( &ptr.p_ttu[i].i_pgc_nb );
GETS( &ptr.p_ttu[i].i_prg_nb ); GETS( &ptr.p_ttu[i].i_prg_nb );
...@@ -920,7 +927,7 @@ static vts_tmap_ti_t ReadVTSTimeMap( ifo_t* p_ifo ) ...@@ -920,7 +927,7 @@ static vts_tmap_ti_t ReadVTSTimeMap( ifo_t* p_ifo )
{ {
vts_tmap_ti_t tmap; vts_tmap_ti_t tmap;
int i,j; int i,j;
int i_start = p_ifo->i_pos; off64_t i_start = p_ifo->i_pos;
fprintf( stderr, "TMAP\n" ); fprintf( stderr, "TMAP\n" );
...@@ -980,56 +987,56 @@ static vts_t ReadVTS( ifo_t* p_ifo ) ...@@ -980,56 +987,56 @@ static vts_t ReadVTS( ifo_t* p_ifo )
vts.mat = ReadVTSInfMat( p_ifo ); vts.mat = ReadVTSInfMat( p_ifo );
if( vts.mat.i_ptt_srpt_ssector ) if( vts.mat.i_ptt_srpt_ssector )
{ {
p_ifo->i_pos = lseek( p_ifo->i_fd, p_ifo->i_off + p_ifo->i_pos = lseek64( p_ifo->i_fd, p_ifo->i_off +
vts.mat.i_ptt_srpt_ssector *DVD_LB_SIZE, vts.mat.i_ptt_srpt_ssector *DVD_LB_SIZE,
SEEK_SET ); SEEK_SET );
vts.ptt_srpt = ReadVTSTitlePointer( p_ifo ); vts.ptt_srpt = ReadVTSTitlePointer( p_ifo );
} }
if( vts.mat.i_m_pgci_ut_ssector ) if( vts.mat.i_m_pgci_ut_ssector )
{ {
p_ifo->i_pos = lseek( p_ifo->i_fd, p_ifo->i_off + p_ifo->i_pos = lseek64( p_ifo->i_fd, p_ifo->i_off +
vts.mat.i_m_pgci_ut_ssector *DVD_LB_SIZE, vts.mat.i_m_pgci_ut_ssector *DVD_LB_SIZE,
SEEK_SET ); SEEK_SET );
vts.pgci_ut = ReadUnitTable( p_ifo ); vts.pgci_ut = ReadUnitTable( p_ifo );
} }
if( vts.mat.i_pgcit_ssector ) if( vts.mat.i_pgcit_ssector )
{ {
p_ifo->i_pos = lseek( p_ifo->i_fd, p_ifo->i_off + p_ifo->i_pos = lseek64( p_ifo->i_fd, p_ifo->i_off +
vts.mat.i_pgcit_ssector *DVD_LB_SIZE, vts.mat.i_pgcit_ssector *DVD_LB_SIZE,
SEEK_SET ); SEEK_SET );
vts.pgci_ti = ReadUnit( p_ifo ); vts.pgci_ti = ReadUnit( p_ifo );
} }
if( vts.mat.i_tmap_ti_ssector ) if( vts.mat.i_tmap_ti_ssector )
{ {
p_ifo->i_pos = lseek( p_ifo->i_fd, p_ifo->i_off + p_ifo->i_pos = lseek64( p_ifo->i_fd, p_ifo->i_off +
vts.mat.i_tmap_ti_ssector *DVD_LB_SIZE, vts.mat.i_tmap_ti_ssector *DVD_LB_SIZE,
SEEK_SET ); SEEK_SET );
vts.tmap_ti = ReadVTSTimeMap( p_ifo ); vts.tmap_ti = ReadVTSTimeMap( p_ifo );
} }
if( vts.mat.i_m_c_adt_ssector ) if( vts.mat.i_m_c_adt_ssector )
{ {
p_ifo->i_pos = lseek( p_ifo->i_fd, p_ifo->i_off + p_ifo->i_pos = lseek64( p_ifo->i_fd, p_ifo->i_off +
vts.mat.i_m_c_adt_ssector *DVD_LB_SIZE, vts.mat.i_m_c_adt_ssector *DVD_LB_SIZE,
SEEK_SET ); SEEK_SET );
vts.m_c_adt = ReadCellInf( p_ifo ); vts.m_c_adt = ReadCellInf( p_ifo );
} }
if( vts.mat.i_m_vobu_admap_ssector ) if( vts.mat.i_m_vobu_admap_ssector )
{ {
p_ifo->i_pos = lseek( p_ifo->i_fd, p_ifo->i_off + p_ifo->i_pos = lseek64( p_ifo->i_fd, p_ifo->i_off +
vts.mat.i_m_vobu_admap_ssector *DVD_LB_SIZE, vts.mat.i_m_vobu_admap_ssector *DVD_LB_SIZE,
SEEK_SET ); SEEK_SET );
vts.m_vobu_admap = ReadMap( p_ifo ); vts.m_vobu_admap = ReadMap( p_ifo );
} }
if( vts.mat.i_c_adt_ssector ) if( vts.mat.i_c_adt_ssector )
{ {
p_ifo->i_pos = lseek( p_ifo->i_fd, p_ifo->i_off + p_ifo->i_pos = lseek64( p_ifo->i_fd, p_ifo->i_off +
vts.mat.i_c_adt_ssector *DVD_LB_SIZE, vts.mat.i_c_adt_ssector *DVD_LB_SIZE,
SEEK_SET ); SEEK_SET );
vts.c_adt = ReadCellInf( p_ifo ); vts.c_adt = ReadCellInf( p_ifo );
} }
if( vts.mat.i_vobu_admap_ssector ) if( vts.mat.i_vobu_admap_ssector )
{ {
p_ifo->i_pos = lseek( p_ifo->i_fd, p_ifo->i_off + p_ifo->i_pos = lseek64( p_ifo->i_fd, p_ifo->i_off +
vts.mat.i_vobu_admap_ssector *DVD_LB_SIZE, vts.mat.i_vobu_admap_ssector *DVD_LB_SIZE,
SEEK_SET ); SEEK_SET );
vts.vobu_admap = ReadMap( p_ifo ); vts.vobu_admap = ReadMap( p_ifo );
...@@ -1049,6 +1056,8 @@ static vts_t ReadVTS( ifo_t* p_ifo ) ...@@ -1049,6 +1056,8 @@ static vts_t ReadVTS( ifo_t* p_ifo )
void IfoRead( ifo_t* p_ifo ) void IfoRead( ifo_t* p_ifo )
{ {
int i; int i;
off64_t i_off;
p_ifo->vmg = ReadVMG( p_ifo ); p_ifo->vmg = ReadVMG( p_ifo );
p_ifo->p_vts = malloc( p_ifo->vmg.mat.i_tts_nb *sizeof(vts_t) ); p_ifo->p_vts = malloc( p_ifo->vmg.mat.i_tts_nb *sizeof(vts_t) );
if( p_ifo->p_vts == NULL ) if( p_ifo->p_vts == NULL )
...@@ -1057,11 +1066,13 @@ void IfoRead( ifo_t* p_ifo ) ...@@ -1057,11 +1066,13 @@ void IfoRead( ifo_t* p_ifo )
p_ifo->b_error = 1; p_ifo->b_error = 1;
return; return;
} }
for( i=0 ; i<1/*p_ifo->vmg.mat.i_tts_nb*/ ; i++ ) for( i=0 ; i<p_ifo->vmg.mat.i_tts_nb ; i++ )
{ {
p_ifo->i_pos = lseek( p_ifo->i_fd,
p_ifo->vmg.ptt_srpt.p_tts[i].i_ssector *DVD_LB_SIZE, fprintf( stderr, "######### VTS %d #############\n", i );
SEEK_SET );
i_off = p_ifo->vmg.ptt_srpt.p_tts[i].i_ssector *DVD_LB_SIZE;
p_ifo->i_pos = lseek64( p_ifo->i_fd, i_off, SEEK_SET );
/* FIXME : use udf filesystem to avoid this */ /* FIXME : use udf filesystem to avoid this */
IfoFindVTS( p_ifo ); IfoFindVTS( p_ifo );
p_ifo->p_vts[i] = ReadVTS( p_ifo ); p_ifo->p_vts[i] = ReadVTS( p_ifo );
......
...@@ -302,14 +302,15 @@ typedef struct vts_atrt_s ...@@ -302,14 +302,15 @@ typedef struct vts_atrt_s
u64 pi_vtsm_audio_atrt[8]; // i_vtsm_audio_nb * 8 bytes u64 pi_vtsm_audio_atrt[8]; // i_vtsm_audio_nb * 8 bytes
// char ??? // char ???
u8 i_vtsm_subpic_nb; // 1 byte u8 i_vtsm_subpic_nb; // 1 byte
u64 pi_vtsm_subpic_atrt[32]; // i_vtsm_subpic_nb * 6 bytes u64 pi_vtsm_subpic_atrt[28]; // i_vtsm_subpic_nb * 6 bytes
// char[2] ???
u16 i_vtstt_video_atrt; // 2 bytes u16 i_vtstt_video_atrt; // 2 bytes
// char ??? // char ???
u8 i_vtstt_audio_nb; // 1 byte u8 i_vtstt_audio_nb; // 1 byte
u64 pi_vtstt_audio_atrt[8]; // i_vtstt_audio_nb * 8 bytes u64 pi_vtstt_audio_atrt[8]; // i_vtstt_audio_nb * 8 bytes
// char ??? // char[17] ???
u8 i_vtstt_subpic_nb; // 1 byte u8 i_vtstt_subpic_nb; // 1 byte
u64 pi_vtstt_subpic_atrt[32]; // i_vtstt_subpic_nb * 6 bytes u64 pi_vtstt_subpic_atrt[28]; // i_vtstt_subpic_nb * 6 bytes
} vts_atrt_t; } vts_atrt_t;
/* Main struct for vts attributes /* Main struct for vts attributes
...@@ -445,7 +446,7 @@ typedef struct vts_s ...@@ -445,7 +446,7 @@ typedef struct vts_s
/* Video Title Set Menu PGCI Unit Table */ /* Video Title Set Menu PGCI Unit Table */
pgci_ut_t pgci_ut; pgci_ut_t pgci_ut;
/* Video Title Set Program Chain Info Table */ /* Video Title Set Program Chain Info Table */
pgci_inf_t pgci_ti; pgci_inf_t pgci_ti;
/* Video Title Set Time Map Table */ /* Video Title Set Time Map Table */
vts_tmap_ti_t tmap_ti; vts_tmap_ti_t tmap_ti;
/* VTSM Cell Adress Table Information */ /* VTSM Cell Adress Table Information */
...@@ -466,9 +467,9 @@ typedef struct ifo_s ...@@ -466,9 +467,9 @@ typedef struct ifo_s
/* File descriptor for the device */ /* File descriptor for the device */
int i_fd; int i_fd;
/* Offset to video_ts.ifo on the device */ /* Offset to video_ts.ifo on the device */
u32 i_off; off64_t i_off;
/* Position of stream pointer */ /* Position of stream pointer */
u32 i_pos; off64_t i_pos;
/* Error Management */ /* Error Management */
boolean_t b_error; boolean_t b_error;
/* Structure described in video_ts */ /* Structure described in video_ts */
...@@ -478,7 +479,12 @@ typedef struct ifo_s ...@@ -478,7 +479,12 @@ typedef struct ifo_s
} ifo_t; } ifo_t;
/***************************************************************************** /*****************************************************************************
* Prototypes in ifo.c * Prototypes in dvd_ifo.c
*****************************************************************************/ *****************************************************************************/
ifo_t IfoInit( int ); ifo_t IfoInit( int );
void IfoRead( ifo_t* ); void IfoRead( ifo_t* );
/*****************************************************************************
* Prototypes in input_dvd.c
*****************************************************************************/
off64_t Seek64( int, off64_t, int);
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* decoders. * decoders.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input.c,v 1.69 2001/01/15 06:18:23 sam Exp $ * $Id: input.c,v 1.70 2001/01/16 04:41:20 stef Exp $
* *
* Authors: * Authors:
* *
...@@ -278,7 +278,10 @@ static void InitThread( input_thread_t * p_input ) ...@@ -278,7 +278,10 @@ static void InitThread( input_thread_t * p_input )
free( p_input->p_config ); free( p_input->p_config );
p_input->p_plugin->pf_init( p_input ); if( !p_input->b_error )
{
p_input->p_plugin->pf_init( p_input );
}
*p_input->pi_status = THREAD_READY; *p_input->pi_status = THREAD_READY;
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* input_dvd.c: DVD reading * input_dvd.c: DVD reading
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: input_dvd.c,v 1.3 2001/01/16 04:41:20 stef Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -57,13 +58,14 @@ ...@@ -57,13 +58,14 @@
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
static int DVDProbe ( struct input_thread_s * ); static int DVDProbe ( struct input_thread_s * );
static int DVDRead ( struct input_thread_s *, static int DVDRead ( struct input_thread_s *,
data_packet_t * p_packets[INPUT_READ_ONCE] ); data_packet_t * p_packets[INPUT_READ_ONCE] );
static void DVDInit ( struct input_thread_s * ); static void DVDInit ( struct input_thread_s * );
static void DVDEnd ( struct input_thread_s * ); static void DVDEnd ( struct input_thread_s * );
static int DVDSeek ( struct input_thread_s *, off_t ); /* FIXME : DVDSeek should be on 64 bits ? Is it possible in input ? */
static int DVDRewind ( struct input_thread_s * ); static int DVDSeek ( struct input_thread_s *, off_t );
static int DVDRewind ( struct input_thread_s * );
static struct data_packet_s * NewPacket ( void *, size_t ); static struct data_packet_s * NewPacket ( void *, size_t );
static void DeletePacket( void *, struct data_packet_s * ); static void DeletePacket( void *, struct data_packet_s * );
static void DeletePES ( void *, struct pes_packet_s * ); static void DeletePES ( void *, struct pes_packet_s * );
...@@ -88,7 +90,7 @@ static int DVDProbe( input_thread_t * p_input ) ...@@ -88,7 +90,7 @@ static int DVDProbe( input_thread_t * p_input )
static void DVDInit( input_thread_t * p_input ) static void DVDInit( input_thread_t * p_input )
{ {
thread_dvd_data_t * p_method; thread_dvd_data_t * p_method;
u32 i_start; off64_t i_start;
if( (p_method = malloc( sizeof(thread_dvd_data_t) )) == NULL ) if( (p_method = malloc( sizeof(thread_dvd_data_t) )) == NULL )
{ {
...@@ -98,8 +100,9 @@ static void DVDInit( input_thread_t * p_input ) ...@@ -98,8 +100,9 @@ static void DVDInit( input_thread_t * p_input )
} }
p_input->p_plugin_data = (void *)p_method; p_input->p_plugin_data = (void *)p_method;
p_input->p_method_data = NULL;
lseek( p_input->i_handle, 0, SEEK_SET ); lseek64( p_input->i_handle, 0, SEEK_SET );
/* Ifo initialisation */ /* Ifo initialisation */
p_method->ifo = IfoInit( p_input->i_handle ); p_method->ifo = IfoInit( p_input->i_handle );
...@@ -107,8 +110,9 @@ static void DVDInit( input_thread_t * p_input ) ...@@ -107,8 +110,9 @@ static void DVDInit( input_thread_t * p_input )
i_start = p_method->ifo.p_vts[0].i_pos + i_start = p_method->ifo.p_vts[0].i_pos +
p_method->ifo.p_vts[0].mat.i_tt_vobs_ssector *DVD_LB_SIZE; p_method->ifo.p_vts[0].mat.i_tt_vobs_ssector *DVD_LB_SIZE;
fprintf(stderr, "Begin at : %d\n", i_start );
lseek( p_input->i_handle, i_start, SEEK_SET ); i_start = lseek64( p_input->i_handle, i_start, SEEK_SET );
fprintf(stderr, "Begin at : %lld\n", (long long)i_start );
input_InitStream( p_input, sizeof( stream_ps_data_t ) ); input_InitStream( p_input, sizeof( stream_ps_data_t ) );
input_AddProgram( p_input, 0, sizeof( stream_ps_data_t ) ); input_AddProgram( p_input, 0, sizeof( stream_ps_data_t ) );
...@@ -156,7 +160,7 @@ static void DVDInit( input_thread_t * p_input ) ...@@ -156,7 +160,7 @@ static void DVDInit( input_thread_t * p_input )
break; break;
} }
} }
lseek( p_input->i_handle, i_start, SEEK_SET ); lseek64( p_input->i_handle, i_start, SEEK_SET );
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.i_tell = 0; p_input->stream.i_tell = 0;
if( p_demux_data->b_has_PSM ) if( p_demux_data->b_has_PSM )
...@@ -319,11 +323,9 @@ static int DVDRead( input_thread_t * p_input, ...@@ -319,11 +323,9 @@ static int DVDRead( input_thread_t * p_input,
if( (i_nb = read( p_input->i_handle, &i_dummy, 1 )) != 0 ) if( (i_nb = read( p_input->i_handle, &i_dummy, 1 )) != 0 )
{ {
i_startcode |= i_dummy; i_startcode |= i_dummy;
fprintf(stderr, "tut :%d %d\n", i_dummy, i_nb );
} }
else else
{ {
fprintf(stderr, "poc\n" );
return( 1 ); return( 1 );
} }
} }
...@@ -410,7 +412,9 @@ static int DVDRewind( input_thread_t * p_input ) ...@@ -410,7 +412,9 @@ static int DVDRewind( input_thread_t * p_input )
} }
/***************************************************************************** /*****************************************************************************
* DVDSeek : Goes to a given position on the stream * DVDSeek : Goes to a given position on the stream ; this one is used by the
* input and translate chronological position from input to logical postion
* on the device
*****************************************************************************/ *****************************************************************************/
static int DVDSeek( input_thread_t * p_input, off_t i_off ) static int DVDSeek( input_thread_t * p_input, off_t i_off )
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment