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

-Fixed the lock segfault bug with some compilers

-Quick kludge in ifo to avoid a bug with optims. The real fix is coming.
parent b8539d07
......@@ -4,7 +4,7 @@
* control the pace of reading.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-intf.h,v 1.30 2001/04/08 07:24:47 stef Exp $
* $Id: input_ext-intf.h,v 1.31 2001/04/10 17:47:05 stef Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -97,7 +97,7 @@ typedef struct es_descriptor_s
#define LPCM_AUDIO_ES 0x83
#define UNKNOWN_ES 0xFF
/* ES Categories */
/* ES Categories to be used by interface plugins */
#define VIDEO_ES 0x00
#define AUDIO_ES 0x01
#define SPU_ES 0x02
......
......@@ -2,7 +2,7 @@
* dvd_css.c: Functions for DVD authentification and unscrambling
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_css.c,v 1.22 2001/04/08 16:57:47 sam Exp $
* $Id: dvd_css.c,v 1.23 2001/04/10 17:47:05 stef Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -275,7 +275,8 @@ int CSSInit( css_t * p_css )
return 0;
case 0:
intf_WarnMsg( 3, "css info: no way to authenticate" );
intf_ErrMsg( "css error: no way to authenticate" );
return -1;
}
#else /* HAVE_CSS */
......@@ -406,13 +407,13 @@ int CSSGetKey( css_t * p_css )
if( !b_encrypted )
{
intf_WarnMsg( 3, "css warning: this file was _NOT_ encrypted!" );
return(0);
return 0;
}
if( b_encrypted && i_registered_keys == 0 )
{
intf_ErrMsg( "css error: unable to determine keys from file" );
return(1);
return -1;
}
for( i = 0 ; i < i_registered_keys - 1 ; i++ )
......@@ -469,10 +470,12 @@ int CSSGetKey( css_t * p_css )
memcpy( p_css->pi_title_key,
p_title_key[i_highest].pi_key, KEY_SIZE );
intf_WarnMsg( 2, "css info: vts key initialized" );
return 0;
#else /* HAVE_CSS */
return 1;
intf_ErrMsg( "css error: css decryption unavailable" );
return -1;
#endif /* HAVE_CSS */
}
......
This diff is collapsed.
......@@ -10,7 +10,7 @@
* -dvd_udf to find files
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input_dvd.c,v 1.40 2001/04/08 16:57:47 sam Exp $
* $Id: input_dvd.c,v 1.41 2001/04/10 17:47:05 stef Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -363,6 +363,12 @@ static int DVDFindCell( thread_dvd_data_t * p_dvd )
i_cell++;
}
intf_WarnMsg( 1, "FindCell: i_cell %d i_index %d found %d nb %d",
p_dvd->i_cell,
p_dvd->i_prg_cell,
i_cell,
cell.i_cell_nb );
if( i_cell == cell.i_cell_nb )
{
intf_ErrMsg( "dvd error: can't find cell" );
......@@ -405,7 +411,14 @@ static int DVDFindSector( thread_dvd_data_t * p_dvd )
p_dvd->p_ifo->vts.cell_inf.p_cell_map[p_dvd->i_cell].i_end_sector,
title.p_cell_play[p_dvd->i_prg_cell].i_end_sector );
//intf_WarnMsg( 3, "cell: %d sector1: 0x%x end1: 0x%x\nindex: %d sector2: 0x%x end2: 0x%x", p_dvd->i_cell, p_dvd->p_ifo->p_vts->c_adt.p_cell_inf[p_dvd->i_cell].i_ssector, p_dvd->p_ifo->p_vts->c_adt.p_cell_inf[p_dvd->i_cell].i_esector, p_dvd->i_prg_cell, p_pgc->p_cell_play_inf[p_dvd->i_prg_cell].i_entry_sector, p_pgc->p_cell_play_inf[p_dvd->i_prg_cell].i_lsector );
intf_WarnMsg( 1, "cell: %d sector1: 0x%x end1: 0x%x\n"
"index: %d sector2: 0x%x end2: 0x%x",
p_dvd->i_cell,
p_dvd->p_ifo->vts.cell_inf.p_cell_map[p_dvd->i_cell].i_start_sector,
p_dvd->p_ifo->vts.cell_inf.p_cell_map[p_dvd->i_cell].i_end_sector,
p_dvd->i_prg_cell,
title.p_cell_play[p_dvd->i_prg_cell].i_start_sector,
title.p_cell_play[p_dvd->i_prg_cell].i_end_sector );
#undef title
return 0;
......@@ -460,6 +473,7 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
u8 i_mpeg;
u8 i_sub_pic;
u8 i;
int j;
boolean_t b_last;
p_dvd = (thread_dvd_data_t*)p_input->p_plugin_data;
......@@ -476,14 +490,21 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
p_input->stream.p_selected_area =
p_input->stream.pp_areas[p_area->i_id];
/* title number: it is not vts nb! */
/* title number: it is not vts nb!,
* it is what appears in the interface list */
p_dvd->i_title = p_area->i_id;
p_dvd->p_ifo->i_title = p_dvd->i_title;
/* ifo vts */
IfoTitleSet( p_dvd->p_ifo );
intf_WarnMsg( 2, "ifo info: vts initialized" );
if( IfoTitleSet( p_dvd->p_ifo ) < 0 )
{
intf_ErrMsg( "dvd error: fatal error in vts ifo" );
free( p_dvd );
p_input->b_error = 1;
return -1;
}
//intf_WarnMsg( 3, "cell nb %d", p_dvd->p_ifo->vts.title_unit.p_title[p_dvd->i_program_chain-1].title.i_cell_nb );
#define vmg p_dvd->p_ifo->vmg
#define vts p_dvd->p_ifo->vts
/* title position inside the selected vts */
......@@ -492,16 +513,36 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
p_dvd->i_program_chain =
vts.title_inf.p_title_start[p_dvd->i_vts_title-1].i_program_chain_num;
intf_WarnMsg( 1, "dvd: title %d vts_title %d pgc %d",
p_dvd->i_title,
p_dvd->i_vts_title,
p_dvd->i_program_chain );
/* css title key for current vts */
if( p_dvd->b_encrypted )
{
/* this one is vts number */
p_dvd->p_css->i_title =
vmg.title_inf.p_attr[p_dvd->i_title-1].i_title_set_num;
p_dvd->p_css->i_title_pos =
vts.i_pos +
vts.manager_inf.i_title_vob_start_sector * DVD_LB_SIZE;
CSSGetKey( p_dvd->p_css );
intf_WarnMsg( 2, "css info: vts key initialized" );
j = CSSGetKey( p_dvd->p_css );
if( j < 0 )
{
intf_ErrMsg( "dvd error: fatal error in vts css key" );
free( p_dvd );
p_input->b_error = 1;
return -1;
}
else if( j > 0 )
{
intf_ErrMsg( "dvd error: css decryption unavailable" );
free( p_dvd );
p_input->b_error = 1;
return -1;
}
}
/*
......@@ -516,6 +557,9 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
p_dvd->i_cell = 0;
p_dvd->i_prg_cell = -1 +
vts.title_unit.p_title[p_dvd->i_program_chain-1].title.i_cell_nb;
intf_WarnMsg( 3, "cell nb %d", vts.title_unit.p_title[p_dvd->i_program_chain-1].title.i_cell_nb );
DVDFindCell( p_dvd );
/* temporary hack to fix size in some dvds */
......@@ -575,8 +619,11 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
p_es->i_stream_id = 0xe0;
p_es->i_type = MPEG2_VIDEO_ES;
p_es->i_cat = VIDEO_ES;
intf_WarnMsg( 1, "dvd info: video mpeg2 stream" );
if( p_main->b_video )
{
input_SelectES( p_input, p_es );
intf_WarnMsg( 1, "dvd info: video MPEG2 stream" );
}
/* Audio ES, in the order they appear in .ifo */
......@@ -679,6 +726,8 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
}
}
if( p_main->b_audio )
{
/* For audio: first one if none or a not existing one specified */
i_audio = main_GetIntVariable( INPUT_CHANNEL_VAR, 1 );
if( i_audio < 0 || i_audio > vts.manager_inf.i_audio_nb )
......@@ -690,7 +739,10 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
{
input_SelectES( p_input, p_input->stream.pp_es[i_audio] );
}
}
if( p_main->b_video )
{
/* for spu, default is none */
i_spu = main_GetIntVariable( INPUT_SUBTITLE_VAR, 0 );
if( i_spu < 0 || i_spu > vts.manager_inf.i_spu_nb )
......@@ -703,6 +755,7 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
i_spu += vts.manager_inf.i_audio_nb;
input_SelectES( p_input, p_input->stream.pp_es[i_spu] );
}
}
} /* i_title >= 0 */
else
{
......@@ -729,6 +782,7 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
vlc_mutex_unlock( &p_input->stream.stream_lock );
#undef vts
#undef vmg
return 0;
}
......@@ -738,6 +792,7 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
static void DVDInit( input_thread_t * p_input )
{
thread_dvd_data_t * p_dvd;
input_area_t * p_area;
int i_title;
int i_chapter;
int i;
......@@ -762,13 +817,12 @@ static void DVDInit( input_thread_t * p_input )
* when using input_ToggleES
* who wrote thez damn buggy piece of shit ??? --stef */
p_dvd->i_block_once = 1;//32;
p_input->i_read_once = 4;//128;
p_input->i_read_once = 8;//128;
i = CSSTest( p_input->i_handle );
if( i < 0 )
{
intf_ErrMsg( "css error: could not get copyright bit" );
free( p_dvd );
p_input->b_error = 1;
return;
......@@ -783,8 +837,15 @@ static void DVDInit( input_thread_t * p_input )
DVDNetlistInit( 2048, 8192, 2048, DVD_LB_SIZE, p_dvd->i_block_once );
intf_WarnMsg( 2, "dvd info: netlist initialized" );
/* Ifo initialisation */
if( IfoInit( &p_dvd->p_ifo, p_input->i_handle ) < 0 )
/* Ifo allocation & initialisation */
if( IfoCreate( p_dvd ) < 0 )
{
intf_ErrMsg( "dvd error: allcation error in IFO" );
p_input->b_error = 1;
return;
}
if( IfoInit( p_dvd->p_ifo ) < 0 )
{
intf_ErrMsg( "dvd error: fatal failure in IFO" );
free( p_dvd );
......@@ -807,7 +868,7 @@ static void DVDInit( input_thread_t * p_input )
p_dvd->p_css->i_fd = p_input->i_handle;
p_dvd->p_css->i_agid = 0;
if( CSSInit( p_dvd->p_css ) )
if( CSSInit( p_dvd->p_css ) < 0 )
{
intf_ErrMsg( "dvd error: fatal failure in CSS" );
free( p_dvd->p_css );
......@@ -819,12 +880,12 @@ static void DVDInit( input_thread_t * p_input )
intf_WarnMsg( 2, "dvd info: CSS initialized" );
}
/* Initialize ES structures */
input_InitStream( p_input, sizeof( stream_ps_data_t ) );
/* Set stream and area data */
vlc_mutex_lock( &p_input->stream.stream_lock );
/* Initialize ES structures */
input_InitStream( p_input, sizeof( stream_ps_data_t ) );
#define title_inf p_dvd->p_ifo->vmg.title_inf
intf_WarnMsg( 2, "dvd info: number of titles: %d", title_inf.i_title_nb );
......@@ -853,8 +914,6 @@ static void DVDInit( input_thread_t * p_input )
}
#undef area
vlc_mutex_unlock( &p_input->stream.stream_lock );
/* Get requested title - if none try the first title */
i_title = main_GetIntVariable( INPUT_TITLE_VAR, 1 );
if( i_title <= 0 || i_title > title_inf.i_title_nb )
......@@ -871,8 +930,12 @@ static void DVDInit( input_thread_t * p_input )
p_input->stream.pp_areas[i_title]->i_part = i_chapter;
p_area = p_input->stream.pp_areas[i_title];
vlc_mutex_unlock( &p_input->stream.stream_lock );
/* set title, chapter, audio and subpic */
DVDSetArea( p_input, p_input->stream.pp_areas[i_title] );
DVDSetArea( p_input, p_area );
return;
}
......
......@@ -2,7 +2,7 @@
* input_dvd.h: thread structure of the DVD plugin
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: input_dvd.h,v 1.16 2001/04/08 16:57:47 sam Exp $
* $Id: input_dvd.h,v 1.17 2001/04/10 17:47:05 stef Exp $
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
......@@ -64,13 +64,6 @@ typedef struct thread_dvd_data_s
} thread_dvd_data_t;
/*****************************************************************************
* Prototypes in dvd_ifo.c
*****************************************************************************/
int IfoInit ( struct ifo_s **, int );
int IfoTitleSet ( struct ifo_s * );
void IfoEnd ( struct ifo_s * );
/*****************************************************************************
* Prototypes in dvd_css.c
*****************************************************************************/
......@@ -79,3 +72,12 @@ int CSSInit ( struct css_s * );
int CSSGetKey ( struct css_s * );
int CSSDescrambleSector ( u8 * , u8 * );
/*****************************************************************************
* Prototypes in dvd_ifo.c
*****************************************************************************/
int IfoCreate ( struct thread_dvd_data_s * );
int IfoInit ( struct ifo_s * );
int IfoTitleSet ( struct ifo_s * );
void IfoEnd ( struct ifo_s * );
......@@ -4,7 +4,7 @@
* decoders.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input.c,v 1.95 2001/04/08 09:04:33 stef Exp $
* $Id: input.c,v 1.96 2001/04/10 17:47:05 stef Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -233,6 +233,7 @@ static void RunThread( input_thread_t *p_input )
#endif
vlc_mutex_lock( &p_input->stream.stream_lock );
if( p_input->stream.p_selected_area->i_seek != NO_SEEK )
{
if( p_input->stream.b_seekable && p_input->pf_seek != NULL )
......@@ -254,6 +255,7 @@ static void RunThread( input_thread_t *p_input )
}
p_input->stream.p_selected_area->i_seek = NO_SEEK;
}
vlc_mutex_unlock( &p_input->stream.stream_lock );
i_error = p_input->pf_read( p_input, pp_packets );
......
......@@ -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.45 2001/04/08 07:24:47 stef Exp $
* $Id: input_programs.c,v 1.46 2001/04/10 17:47:05 stef Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -58,6 +58,8 @@ int input_InitStream( input_thread_t * p_input, size_t i_data_len )
p_input->stream.pp_es = NULL;
p_input->stream.pp_selected_es = NULL;
p_input->stream.pp_programs = NULL;
p_input->stream.pp_areas = NULL;
p_input->stream.p_selected_area = NULL;
if( i_data_len )
{
......
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