* -udf.* to find files
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id: access.c,v 1.5 2002/11/13 20:23:21 fenrir Exp $
+ * $Id: access.c,v 1.15 2003/12/22 14:32:55 sam Exp $
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
return -1;
}
p_input->p_access_data = (void *)p_dvd;
-
+
p_input->pf_read = DVDRead;
p_input->pf_seek = DVDSeek;
p_input->pf_set_area = DVDSetArea;
free( p_dvd );
return -1;
}
-
- /*
+
+ /*
* set up input
- */
+ */
p_input->i_mtu = 0;
/* override environment variable DVDCSS_METHOD with config option
* (FIXME: this creates a small memory leak) */
- psz_dvdcss_env = config_GetPsz( p_input, "dvd-css-method" );
+ psz_dvdcss_env = config_GetPsz( p_input, "dvdcss-method" );
if( psz_dvdcss_env && *psz_dvdcss_env )
{
char *psz_env;
/*
* get plugin ready
- */
+ */
p_dvd->dvdhandle = dvdcss_open( psz_device );
-
+
/* free allocated string */
free( psz_device );
* is reserved for video_ts.vob */
for( i = 1 ; i <= title_inf.i_title_nb ; i++ )
{
- input_AddArea( p_input );
-
/* Titles are Program Chains */
- area[i]->i_id = i;
+ input_AddArea( p_input, i, title_inf.p_attr[i-1].i_chapter_nb );
- /* Absolute start offset and size
+ /* Absolute start offset and size
* We can only set that with vts ifo, so we do it during the
* first call to DVDSetArea */
area[i]->i_start = 0;
area[i]->i_size = 0;
- /* Number of chapters */
- area[i]->i_part_nb = title_inf.p_attr[i-1].i_chapter_nb;
+ /* Default Chapter */
area[i]->i_part = 1;
/* Offset to vts_i_0.ifo */
area[i]->i_plugin_data = p_dvd->p_ifo->i_start +
title_inf.p_attr[i-1].i_start_sector;
- }
+ }
#undef area
-
+
p_dvd->i_title = p_dvd->i_title <= title_inf.i_title_nb ?
p_dvd->i_title : 1;
#undef title_inf
p_area = p_input->stream.pp_areas[p_dvd->i_title];
-
+
p_area->i_part = p_dvd->i_chapter <= p_area->i_part_nb ?
p_dvd->i_chapter : 1;
p_dvd->i_chapter = 1;
-
+
p_dvd->b_new_chapter = 0;
p_dvd->i_audio_nb = 0;
p_dvd->i_spu_nb = 0;
-
+
/* set title, chapter, audio and subpic */
if( DVDSetArea( p_input, p_area ) < 0 )
{
input_thread_t * p_input = (input_thread_t *)p_this;
thread_dvd_data_t *p_dvd = (thread_dvd_data_t*)p_input->p_access_data;
+ /* This is a very nasty side-effect in the DVD plug-in : language
+ * selection here influences language selection of other streams. So
+ * unset those variables (may not be what the user wants).
+ * FIXME FIXME FIXME FIXME FIXME FIXME FIXME --Meuuh */
+ config_PutInt( p_input, "audio-channel", -1 );
+ config_PutInt( p_input, "spu-channel", -1 );
+
IfoDestroy( p_dvd->p_ifo );
dvdcss_close( p_dvd->dvdhandle );
free( p_dvd );
* DVDSetProgram: used to change angle
*****************************************************************************/
static int DVDSetProgram( input_thread_t * p_input,
- pgrm_descriptor_t * p_program )
+ pgrm_descriptor_t * p_program )
{
if( p_input->stream.p_selected_program != p_program )
{
thread_dvd_data_t * p_dvd;
int i_angle;
-
+ vlc_value_t val;
+
p_dvd = (thread_dvd_data_t*)(p_input->p_access_data);
i_angle = p_program->i_number;
}
#undef title
msg_Dbg( p_input, "angle %d selected", p_dvd->i_angle );
+
+ /* Update the navigation variables without triggering a callback */
+ val.i_int = p_program->i_number;
+ var_Change( p_input, "program", VLC_VAR_SETVALUE, &val, NULL );
}
return 0;
{
input_DelES( p_input, p_input->stream.pp_es[0] );
}
-
+
while( p_input->stream.i_pgrm_number )
{
input_DelProgram( p_input, p_input->stream.pp_programs[0] );
p_dvd = (thread_dvd_data_t*)(p_input->p_access_data);
i_angle_nb = vmg.title_inf.p_attr[p_dvd->i_title-1].i_angle_nb;
-
+
input_AddProgram( p_input, 1, sizeof( stream_ps_data_t ) );
p_input->stream.p_selected_program = p_input->stream.pp_programs[0];
static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
{
thread_dvd_data_t * p_dvd;
+ vlc_value_t val;
p_dvd = (thread_dvd_data_t*)(p_input->p_access_data);
if( p_area != p_input->stream.p_selected_area )
{
- int i_vts_title;
- u32 i_first;
- u32 i_last;
+ int i_vts_title;
+ uint32_t i_first;
+ uint32_t i_last;
+ unsigned int i;
/* Reset the Chapter position of the old title */
p_input->stream.p_selected_area->i_part = 1;
/* Destroy obsolete ES by reinitializing programs */
DVDFlushStream( p_input );
-
+
/* Angle management: angles are handled through programs */
p_dvd->i_angle_nb = DVDReadAngle( p_input );
if( ( p_dvd->i_angle <= 0 ) || p_dvd->i_angle > p_dvd->i_angle_nb )
{
p_dvd->i_angle = 1;
}
-
+
DVDSetProgram( p_input,
- p_input->stream.pp_programs[p_dvd->i_angle-1] );
+ p_input->stream.pp_programs[p_dvd->i_angle-1] );
msg_Dbg( p_input, "title first %i, last %i, size %i",
i_first, i_last, i_last + 1 - p_dvd->i_vts_lb );
DVDReadVideo( p_input );
DVDReadAudio( p_input );
DVDReadSPU ( p_input );
-
+
if( p_input->p_demux )
{
DVDLaunchDecoders( p_input );
}
+ /* Update the navigation variables without triggering a callback */
+ val.i_int = p_area->i_id;
+ var_Change( p_input, "title", VLC_VAR_SETVALUE, &val, NULL );
+ var_Change( p_input, "chapter", VLC_VAR_CLEARCHOICES, NULL, NULL );
+ for( i = 1; i <= p_area->i_part_nb; i++ )
+ {
+ val.i_int = i;
+ var_Change( p_input, "chapter", VLC_VAR_ADDCHOICE, &val, NULL );
+ }
+
} /* i_title >= 0 */
else
{
/* Chapter selection */
p_dvd->i_chapter = DVDSetChapter( p_dvd, p_area->i_part );
-
+
p_input->stream.p_selected_area->i_tell = DVDTell;
/* warn interface that something has changed */
p_input->stream.b_seekable = 1;
p_input->stream.b_changed = 1;
+ /* Update the navigation variables without triggering a callback */
+ val.i_int = p_area->i_part;
+ var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &val, NULL );
+
return 0;
}
#undef vts
#define title \
p_dvd->p_ifo->vts.title_unit.p_title[p_dvd->i_title_id-1].title
-
+
/*****************************************************************************
* DVDRead: reads data packets.
*****************************************************************************
static void DVDSeek( input_thread_t * p_input, off_t i_off )
{
thread_dvd_data_t * p_dvd;
-
+
p_dvd = ( thread_dvd_data_t * )(p_input->p_access_data);
vlc_mutex_lock( &p_input->stream.stream_lock );
p_dvd->i_prg_cell = Lb2CellPrg( p_dvd );
p_dvd->i_map_cell = Lb2CellMap( p_dvd );
-
+
if( CellIsInterleaved( p_dvd ) )
{
/* if we're inside a multi-angle zone, we have to choose i_sector
* can be very wide out of such zones */
p_dvd->i_vts_lb = CellFirstSector( p_dvd );
}
-
+
p_dvd->i_last_lb = CellLastSector( p_dvd );
p_dvd->i_chapter = CellPrg2Chapter( p_dvd );
{
psz_parser++;
}
-
+
if( *psz_parser == '@' )
{
/* found end of raw device, and beginning of options */
else
{
char * psz_env;
-
-#ifndef WIN32
+
+#ifndef WIN32
if( !S_ISCHR(stat_info.st_mode) )
{
msg_Warn( p_input, "raw device %s is"
psz_raw = "";
}
}
-
+
if( !*psz_device )
{
free( psz_device );
-
+
if( !p_input->psz_access )
{
/* no device and no access specified: we probably don't want DVD */
psz_device = config_GetPsz( p_input, "dvd" );
}
-#ifndef WIN32
+#ifndef WIN32
/* check block device */
if( stat( psz_device, &stat_info ) == -1 )
{
- msg_Err( p_input, "cannot stat() device `%s' (%s)",
- psz_device, strerror(errno));
+ msg_Warn( p_input, "cannot stat() device `%s' (%s)",
+ psz_device, strerror(errno));
free( psz_device );
- return NULL;
+ return NULL;
}
-
+
if( !S_ISBLK(stat_info.st_mode) && !S_ISCHR(stat_info.st_mode) )
{
msg_Warn( p_input,
return NULL;
}
#endif
-
+
msg_Dbg( p_input, "dvd=%s raw=%s title=%d chapter=%d angle=%d",
psz_device, psz_raw, p_dvd->i_title,
p_dvd->i_chapter, p_dvd->i_angle );
return psz_device;
-}
+}