* Declaration and extern access to global program object.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: main.h,v 1.20 2001/05/30 23:02:03 stef Exp $
+ * $Id: main.h,v 1.21 2001/06/12 18:16:49 stef Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
/* Generic settings */
boolean_t b_audio; /* is audio output allowed ? */
boolean_t b_video; /* is video output allowed ? */
+ boolean_t b_ac3;
/* Unique threads */
p_intf_thread_t p_intf; /* main interface thread */
* found in .ifo.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id: dvd_summary.c,v 1.4 2001/06/07 22:25:42 sam Exp $
+ * $Id: dvd_summary.c,v 1.5 2001/06/12 18:16:49 stef Exp $
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
****************************************************************************/
void IfoPrintTitle( thread_dvd_data_t * p_dvd )
{
- intf_WarnMsg( 5, "***************************************************" );
intf_WarnMsg( 5, "dvd info: title: %d", p_dvd->i_title );
intf_WarnMsg( 5, " vobstart at: %lld", p_dvd->i_start );
intf_WarnMsg( 5, " stream size: %lld", p_dvd->i_size );
intf_WarnMsg( 5, " number of chapters: %d", p_dvd->i_chapter_nb );
intf_WarnMsg( 5, " number of angles: %d", p_dvd->i_angle_nb );
- intf_WarnMsg( 5, "***************************************************\n" );
}
/****************************************************************************
break;
}
- intf_WarnMsg( 5, "***********************************************" );
intf_WarnMsg( 5, "dvd info: video" );
intf_WarnMsg( 5, " compression: mpeg-%d", video.i_compression+1 );
intf_WarnMsg( 5, " tv system: %s Hz",
video.i_letterboxed ? "yes" : "no" );
intf_WarnMsg( 5, " mode: %s",
video.i_mode ? "film (625/50 only)" : "camera");
- intf_WarnMsg( 5, "***********************************************\n" );
}
#undef video
char ppsz_quant[4][10] =
{ "16 bits", "20 bits", "24 bits", "drc" };
- intf_WarnMsg( 5, "***********************************************" );
intf_WarnMsg( 5, "dvd info: audio %d" , i );
intf_WarnMsg( 5, " language: %s",
IfoLanguage( hton16( audio.i_lang_code ) ) );
ppsz_quant[audio.i_quantization & 0x3] );
intf_WarnMsg( 5, " status: %x", audio_status.i_position );
- intf_WarnMsg( 5, "***********************************************\n" );
}
{
if( spu_status.i_available )
{
- intf_WarnMsg( 5, "***********************************************" );
intf_WarnMsg( 5, "dvd info: spu %d", i );
intf_WarnMsg( 5, " caption: %d", spu.i_caption );
intf_WarnMsg( 5, " language: %s",
spu_status.i_position_wide,
spu_status.i_position_letter,
spu_status.i_position_pan );
- intf_WarnMsg( 5, "***********************************************\n" );
}
}
* -dvd_udf to find files
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id: input_dvd.c,v 1.69 2001/06/09 17:01:22 stef Exp $
+ * $Id: input_dvd.c,v 1.70 2001/06/12 18:16:49 stef Exp $
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
#include "modules_export.h"
/* how many blocks DVDRead will read in each loop */
-#define DVD_BLOCK_READ_ONCE 32
+#define DVD_BLOCK_READ_ONCE 64
#define DVD_DATA_READ_ONCE 4*DVD_BLOCK_READ_ONCE
/* Size of netlist */
-#define DVD_NETLIST_SIZE 2048
+#define DVD_NETLIST_SIZE 1024
/*****************************************************************************
* Local prototypes
p_input->stream.p_selected_area =
p_input->stream.pp_areas[p_area->i_id];
- /* release the lock to to let the interface go */
-// vlc_mutex_unlock( &p_input->stream.stream_lock );
-
/* title number: it is not vts nb!,
* it is what appears in the interface list */
p_dvd->i_title = p_area->i_id;
IfoPrintTitle( p_dvd );
-// vlc_mutex_lock( &p_input->stream.stream_lock );
-
/* Area definition */
p_input->stream.p_selected_area->i_start = p_dvd->i_start;
p_input->stream.p_selected_area->i_size = p_dvd->i_size;
p_input->stream.p_selected_area->i_angle_nb = p_dvd->i_angle_nb;
p_input->stream.p_selected_area->i_angle = p_dvd->i_angle;
+ /* start at the beginning of the title */
+ /* FIXME: create a conf option to select whether to restart
+ * title or not */
+ p_input->stream.p_selected_area->i_tell = 0;
+ p_input->stream.p_selected_area->i_part = 1;
+
/*
* Destroy obsolete ES by reinitializing program 0
* and find all ES in title with ifo data
/* No PSM to read in DVD mode, we already have all information */
p_input->stream.pp_programs[0]->b_is_ok = 1;
- p_input->stream.pp_programs[0]->i_synchro_state = SYNCHRO_START;
p_es = NULL;
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( 4, "dvd info: video selected" );
#define audio_status \
vts.title_unit.p_title[p_dvd->i_title_id-1].title.pi_audio_status[i-1]
vts.manager_inf.p_audio_attr[i-1].i_lang_code ) ) );
strcat( p_es->psz_desc, " (ac3)" );
- intf_WarnMsg( 3, "dvd info: audio stream %d %s\t(0x%x)",
- i, p_es->psz_desc, i_id );
-
break;
case 0x02:
case 0x03: /* MPEG audio */
vts.manager_inf.p_audio_attr[i-1].i_lang_code ) ) );
strcat( p_es->psz_desc, " (mpeg)" );
- intf_WarnMsg( 3, "dvd info: audio stream %d %s\t(0x%x)",
- i, p_es->psz_desc, i_id );
-
break;
case 0x04: /* LPCM */
vts.manager_inf.p_audio_attr[i-1].i_lang_code ) ) );
strcat( p_es->psz_desc, " (lpcm)" );
- intf_WarnMsg( 3, "dvd info: audio stream %d %s\t(0x%x)",
- i, p_es->psz_desc, i_id );
break;
case 0x06: /* DTS */
i_id = ( ( 0x88 + audio_status.i_position ) << 8 ) | 0xbd;
p_es->i_cat = SPU_ES;
strcpy( p_es->psz_desc, IfoLanguage( hton16(
vts.manager_inf.p_spu_attr[i-1].i_lang_code ) ) );
- intf_WarnMsg( 3, "dvd info: spu stream %d %s\t(0x%x)",
- i, p_es->psz_desc, i_id );
}
}
#undef spu_status
p_area->i_start;
p_input->stream.p_selected_area->i_part = p_dvd->i_chapter;
- intf_WarnMsg( 2, "dvd info: chapter %d start at: %lld",
+ intf_WarnMsg( 4, "dvd info: chapter %d start at: %lld",
p_area->i_part, p_area->i_tell );
}
else
DVDFindSector( p_dvd );
p_dvd->i_cell += p_dvd->i_angle_cell;
-
- if( p_input->stream.pp_programs[0]->i_synchro_state == SYNCHRO_OK )
- {
- p_input->stream.pp_programs[0]->i_synchro_state =
- SYNCHRO_REINIT;
- }
}
else
{
p_dvd->i_angle = p_area->i_angle;
}
- intf_WarnMsg( 2, "dvd info: angle %d selected", p_area->i_angle );
+ intf_WarnMsg( 3, "dvd info: angle %d selected", p_area->i_angle );
}
/* warn interface that something has changed */
p_dvd = (thread_dvd_data_t *)p_input->p_plugin_data;
p_netlist = (dvd_netlist_t *)p_input->p_method_data;
- /* Get an iovec pointer */
- if( ( p_vec = DVDGetiovec( p_netlist ) ) == NULL )
- {
- intf_ErrMsg( "dvd error: can't get iovec" );
- return -1;
- }
-
i_block_once = p_dvd->i_end_sector - p_dvd->i_sector + 1;
/* Get the position of the next cell if we're at cell end */
p_input->stream.p_selected_area->i_start;
p_input->stream.p_selected_area->i_part = p_dvd->i_chapter;
- /* the synchro has to be reinitialized when we change cell */
-// p_input->stream.pp_programs[0]->i_synchro_state = SYNCHRO_REINIT;
-
vlc_mutex_unlock( &p_input->stream.stream_lock );
i_block_once = p_dvd->i_end_sector - p_dvd->i_sector + 1;
p_netlist->i_read_once = i_block_once;
+ /* Get an iovec pointer */
+ if( ( p_vec = DVDGetiovec( p_netlist ) ) == NULL )
+ {
+ intf_ErrMsg( "dvd error: can't get iovec" );
+ return -1;
+ }
+
/* Reads from DVD */
#if !defined( WIN32 )
i_read_bytes = readv( p_dvd->i_fd, p_vec, i_block_once );
#endif
i_read_blocks = ( i_read_bytes + 0x7ff ) >> 11;
- /* Update netlist indexes */
+ /* Update netlist indexes: we don't do it in DVDGetiovec since we
+ * need know the real number of blocks read */
DVDMviovec( p_netlist, i_read_blocks, pp_data );
/* Update global position */
{
i_angle = 0;
}
- while( ( title.chapter_map.pi_start_cell[i_chapter] <=
- ( p_dvd->i_prg_cell - i_angle + 1 ) ) &&
- ( i_chapter < ( p_dvd->i_chapter_nb - 1 ) ) )
+ if( p_dvd->i_chapter_nb > 1 )
{
- i_chapter++;
+ while( ( title.chapter_map.pi_start_cell[i_chapter] <=
+ ( p_dvd->i_prg_cell - i_angle + 1 ) ) &&
+ ( i_chapter < ( p_dvd->i_chapter_nb - 1 ) ) )
+ {
+ i_chapter++;
+ }
+ }
+ else
+ {
+ i_chapter = 1;
}
p_dvd->i_chapter = i_chapter;
p_input->stream.p_selected_area->i_start;
#endif
-/*
- intf_WarnMsg( 3, "Program Cell: %d Cell: %d Chapter: %d",
+
+/* intf_WarnMsg( 3, "Program Cell: %d Cell: %d Chapter: %d",
p_dvd->i_prg_cell, p_dvd->i_cell, p_dvd->i_chapter );
*/
* aout_ext-dec.c : exported fifo management functions
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: aout_ext-dec.c,v 1.4 2001/05/07 03:14:09 stef Exp $
+ * $Id: aout_ext-dec.c,v 1.5 2001/06/12 18:16:49 stef Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
*
p_aout_bank->pp_aout[ p_aout_bank->i_count ] = p_aout;
p_aout_bank->i_count++;
}
+ /* temporary hack to switch output type (mainly for spdif)
+ * FIXME: to be adapted when several output are available */
+ else if( p_aout_bank->pp_aout[0]->fifo[0].i_type != i_type )
+ {
+ intf_WarnMsg( 1, "aout: changing aout type" );
+
+ aout_DestroyThread( p_aout_bank->pp_aout[0], NULL );
+
+ p_aout = aout_CreateThread( NULL );
+
+ /* Everything failed */
+ if( p_aout == NULL )
+ {
+ vlc_mutex_unlock( &p_aout_bank->lock );
+ return NULL;
+ }
+
+ p_aout_bank->pp_aout[0] = p_aout;
+
+ }
else
{
/* Take the first audio output FIXME: take the best one */
* aout_spdif: ac3 passthrough output
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: aout_spdif.c,v 1.12 2001/06/09 17:01:22 stef Exp $
+ * $Id: aout_spdif.c,v 1.13 2001/06/12 18:16:49 stef Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Stéphane Borel <stef@via.ecp.fr>
int i_blank;
mtime_t mplay;
mtime_t mdelta;
- mtime_t mlast = 0;
/* get a blank frame ready */
memset( pi_blank, 0, sizeof(pi_blank) );
l_start_frame];
mdelta = mplay - mdate();
- if( mdelta < ( 3 * SLEEP_TIME ) )
+ if( mdelta < ( 2 * SLEEP_TIME ) )
{
- intf_WarnMsg( 12, "spdif out (%d):"
- "playing frame %lld (%lld)",
- i_fifo,
- mdelta,
- mplay-mlast );
- mlast = mplay;
/* play spdif frame to the external decoder */
p_aout->pf_play( p_aout,
( (byte_t *)p_aout->fifo[i_fifo].buffer
p_aout->fifo[i_fifo].l_start_frame =
(p_aout->fifo[i_fifo].l_start_frame + 1 )
& AOUT_FIFO_SIZE;
-
+
+ intf_WarnMsg( 12, "spdif out (%d):"
+ "playing frame %lld",
+ i_fifo,
+ mdelta );
+
i_frame++;
i_blank = 0;
}
if( i_frame )
{
- if( mdelta > 0 )
- {
- /* we leave some time for aout fifo to fill and not to stress
- * the external decoder too much */
- msleep( mdelta + SLEEP_TIME );
- }
- else if( mdelta > -SLEEP_TIME )
- {
- msleep( SLEEP_TIME );
- }
+ mwait( mplay );
}
else
{
* audio_output.c : audio output thread
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: audio_output.c,v 1.63 2001/05/31 01:37:08 sam Exp $
+ * $Id: audio_output.c,v 1.64 2001/06/12 18:16:49 stef Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
*
}
/* special setting for ac3 pass-through mode */
- if( main_GetIntVariable( AOUT_SPDIF_VAR, 0 ) )
+ if( main_GetIntVariable( AOUT_SPDIF_VAR, 0 ) && p_main->b_ac3 )
{
- p_aout->i_format = AOUT_FMT_AC3;
+ intf_WarnMsg( 4, "aout info: setting ac3 spdif" );
+ p_aout->i_format = AOUT_FMT_AC3;
p_aout->l_rate = 48000;
}
* decoders.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: input.c,v 1.119 2001/06/07 01:10:33 sam Exp $
+ * $Id: input.c,v 1.120 2001/06/12 18:16:49 stef Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
if( p_input->stream.p_new_area )
{
- p_input->pf_set_area( p_input, p_input->stream.p_new_area );
+ if( p_input->stream.b_seekable && p_input->pf_set_area != NULL )
+ {
+
+ p_input->pf_set_area( p_input, p_input->stream.p_new_area );
+
+ for( i = 0; i < p_input->stream.i_pgrm_number; i++ )
+ {
+ pgrm_descriptor_t * p_pgrm
+ = p_input->stream.pp_programs[i];
+ /* Escape all decoders for the stream discontinuity they
+ * will encounter. */
+ input_EscapeDiscontinuity( p_input, p_pgrm );
+
+ /* Reinitialize synchro. */
+ p_pgrm->i_synchro_state = SYNCHRO_REINIT;
+ }
+ }
p_input->stream.p_new_area = NULL;
}
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_programs.c,v 1.57 2001/05/23 17:47:34 stef Exp $
+ * $Id: input_programs.c,v 1.58 2001/06/12 18:16:49 stef Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
{
decoder.pf_create_thread = adec_CreateThread;
p_config = (void *)GetAdecConfig( p_input, p_es );
+ p_main->b_ac3 = 0;
/* Release the lock, not to block the input thread during
* the creation of the thread. */
}
p_config = (void *)GetAdecConfig( p_input, p_es );
+ p_main->b_ac3 = 1;
/* Release the lock, not to block the input thread during
* the creation of the thread. */
{
decoder.pf_create_thread = lpcmdec_CreateThread;
p_config = (void *)GetAdecConfig( p_input, p_es );
+ p_main->b_ac3 = 0;
/* Release the lock, not to block the input thread during
* the creation of the thread. */