Commit 106079bc authored by Stéphane Borel's avatar Stéphane Borel

*slight modification in input_dvd since Getiovec wasn't at the right

place

*send escape packet when changing title, not to be stuck in some
decoder.

*the position in the title is now resetted when we change title to
prevent a title from being unavailable because we're stuck at the end

*fixed a bug with 1-chapter-long title that displayed chapter 0.

*added a _temporary_ field in p_main to know whether the audio stream is
ac3 (ugly). It allows a vlc launched in spdif mode to play mpeg or lpcm
audio.

*cleaned the title property messages to get rid of the ugly stars.
parent a3c92b8f
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Declaration and extern access to global program object. * Declaration and extern access to global program object.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * 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> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
...@@ -47,6 +47,7 @@ typedef struct main_s ...@@ -47,6 +47,7 @@ typedef struct main_s
/* Generic settings */ /* Generic settings */
boolean_t b_audio; /* is audio output allowed ? */ boolean_t b_audio; /* is audio output allowed ? */
boolean_t b_video; /* is video output allowed ? */ boolean_t b_video; /* is video output allowed ? */
boolean_t b_ac3;
/* Unique threads */ /* Unique threads */
p_intf_thread_t p_intf; /* main interface thread */ p_intf_thread_t p_intf; /* main interface thread */
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* found in .ifo. * found in .ifo.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * 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: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -259,13 +259,11 @@ char * IfoLanguage( u16 i_code ) ...@@ -259,13 +259,11 @@ char * IfoLanguage( u16 i_code )
****************************************************************************/ ****************************************************************************/
void IfoPrintTitle( thread_dvd_data_t * p_dvd ) 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, "dvd info: title: %d", p_dvd->i_title );
intf_WarnMsg( 5, " vobstart at: %lld", p_dvd->i_start ); intf_WarnMsg( 5, " vobstart at: %lld", p_dvd->i_start );
intf_WarnMsg( 5, " stream size: %lld", p_dvd->i_size ); 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 chapters: %d", p_dvd->i_chapter_nb );
intf_WarnMsg( 5, " number of angles: %d", p_dvd->i_angle_nb ); intf_WarnMsg( 5, " number of angles: %d", p_dvd->i_angle_nb );
intf_WarnMsg( 5, "***************************************************\n" );
} }
/**************************************************************************** /****************************************************************************
...@@ -304,7 +302,6 @@ void IfoPrintVideo( thread_dvd_data_t * p_dvd ) ...@@ -304,7 +302,6 @@ void IfoPrintVideo( thread_dvd_data_t * p_dvd )
break; break;
} }
intf_WarnMsg( 5, "***********************************************" );
intf_WarnMsg( 5, "dvd info: video" ); intf_WarnMsg( 5, "dvd info: video" );
intf_WarnMsg( 5, " compression: mpeg-%d", video.i_compression+1 ); intf_WarnMsg( 5, " compression: mpeg-%d", video.i_compression+1 );
intf_WarnMsg( 5, " tv system: %s Hz", intf_WarnMsg( 5, " tv system: %s Hz",
...@@ -322,7 +319,6 @@ void IfoPrintVideo( thread_dvd_data_t * p_dvd ) ...@@ -322,7 +319,6 @@ void IfoPrintVideo( thread_dvd_data_t * p_dvd )
video.i_letterboxed ? "yes" : "no" ); video.i_letterboxed ? "yes" : "no" );
intf_WarnMsg( 5, " mode: %s", intf_WarnMsg( 5, " mode: %s",
video.i_mode ? "film (625/50 only)" : "camera"); video.i_mode ? "film (625/50 only)" : "camera");
intf_WarnMsg( 5, "***********************************************\n" );
} }
#undef video #undef video
...@@ -345,7 +341,6 @@ void IfoPrintAudio( thread_dvd_data_t * p_dvd, int i ) ...@@ -345,7 +341,6 @@ void IfoPrintAudio( thread_dvd_data_t * p_dvd, int i )
char ppsz_quant[4][10] = char ppsz_quant[4][10] =
{ "16 bits", "20 bits", "24 bits", "drc" }; { "16 bits", "20 bits", "24 bits", "drc" };
intf_WarnMsg( 5, "***********************************************" );
intf_WarnMsg( 5, "dvd info: audio %d" , i ); intf_WarnMsg( 5, "dvd info: audio %d" , i );
intf_WarnMsg( 5, " language: %s", intf_WarnMsg( 5, " language: %s",
IfoLanguage( hton16( audio.i_lang_code ) ) ); IfoLanguage( hton16( audio.i_lang_code ) ) );
...@@ -374,7 +369,6 @@ void IfoPrintAudio( thread_dvd_data_t * p_dvd, int i ) ...@@ -374,7 +369,6 @@ void IfoPrintAudio( thread_dvd_data_t * p_dvd, int i )
ppsz_quant[audio.i_quantization & 0x3] ); ppsz_quant[audio.i_quantization & 0x3] );
intf_WarnMsg( 5, " status: %x", audio_status.i_position ); intf_WarnMsg( 5, " status: %x", audio_status.i_position );
intf_WarnMsg( 5, "***********************************************\n" );
} }
...@@ -393,7 +387,6 @@ void IfoPrintSpu( thread_dvd_data_t * p_dvd, int i ) ...@@ -393,7 +387,6 @@ void IfoPrintSpu( thread_dvd_data_t * p_dvd, int i )
{ {
if( spu_status.i_available ) if( spu_status.i_available )
{ {
intf_WarnMsg( 5, "***********************************************" );
intf_WarnMsg( 5, "dvd info: spu %d", i ); intf_WarnMsg( 5, "dvd info: spu %d", i );
intf_WarnMsg( 5, " caption: %d", spu.i_caption ); intf_WarnMsg( 5, " caption: %d", spu.i_caption );
intf_WarnMsg( 5, " language: %s", intf_WarnMsg( 5, " language: %s",
...@@ -405,7 +398,6 @@ void IfoPrintSpu( thread_dvd_data_t * p_dvd, int i ) ...@@ -405,7 +398,6 @@ void IfoPrintSpu( thread_dvd_data_t * p_dvd, int i )
spu_status.i_position_wide, spu_status.i_position_wide,
spu_status.i_position_letter, spu_status.i_position_letter,
spu_status.i_position_pan ); spu_status.i_position_pan );
intf_WarnMsg( 5, "***********************************************\n" );
} }
} }
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* -dvd_udf to find files * -dvd_udf to find files
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * 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: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -98,11 +98,11 @@ ...@@ -98,11 +98,11 @@
#include "modules_export.h" #include "modules_export.h"
/* how many blocks DVDRead will read in each loop */ /* 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 #define DVD_DATA_READ_ONCE 4*DVD_BLOCK_READ_ONCE
/* Size of netlist */ /* Size of netlist */
#define DVD_NETLIST_SIZE 2048 #define DVD_NETLIST_SIZE 1024
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
...@@ -427,9 +427,6 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -427,9 +427,6 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
p_input->stream.p_selected_area = p_input->stream.p_selected_area =
p_input->stream.pp_areas[p_area->i_id]; 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!, /* title number: it is not vts nb!,
* it is what appears in the interface list */ * it is what appears in the interface list */
p_dvd->i_title = p_area->i_id; p_dvd->i_title = p_area->i_id;
...@@ -539,14 +536,18 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -539,14 +536,18 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
IfoPrintTitle( p_dvd ); IfoPrintTitle( p_dvd );
// vlc_mutex_lock( &p_input->stream.stream_lock );
/* Area definition */ /* Area definition */
p_input->stream.p_selected_area->i_start = p_dvd->i_start; 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_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_nb = p_dvd->i_angle_nb;
p_input->stream.p_selected_area->i_angle = p_dvd->i_angle; 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 * Destroy obsolete ES by reinitializing program 0
* and find all ES in title with ifo data * and find all ES in title with ifo data
...@@ -571,7 +572,6 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -571,7 +572,6 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
/* No PSM to read in DVD mode, we already have all information */ /* 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]->b_is_ok = 1;
p_input->stream.pp_programs[0]->i_synchro_state = SYNCHRO_START;
p_es = NULL; p_es = NULL;
...@@ -582,12 +582,10 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -582,12 +582,10 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
p_es->i_stream_id = 0xe0; p_es->i_stream_id = 0xe0;
p_es->i_type = MPEG2_VIDEO_ES; p_es->i_type = MPEG2_VIDEO_ES;
p_es->i_cat = VIDEO_ES; p_es->i_cat = VIDEO_ES;
intf_WarnMsg( 1, "dvd info: video mpeg2 stream" );
if( p_main->b_video ) if( p_main->b_video )
{ {
input_SelectES( p_input, p_es ); input_SelectES( p_input, p_es );
} }
intf_WarnMsg( 4, "dvd info: video selected" );
#define audio_status \ #define audio_status \
vts.title_unit.p_title[p_dvd->i_title_id-1].title.pi_audio_status[i-1] vts.title_unit.p_title[p_dvd->i_title_id-1].title.pi_audio_status[i-1]
...@@ -613,9 +611,6 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -613,9 +611,6 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
vts.manager_inf.p_audio_attr[i-1].i_lang_code ) ) ); vts.manager_inf.p_audio_attr[i-1].i_lang_code ) ) );
strcat( p_es->psz_desc, " (ac3)" ); 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; break;
case 0x02: case 0x02:
case 0x03: /* MPEG audio */ case 0x03: /* MPEG audio */
...@@ -630,9 +625,6 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -630,9 +625,6 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
vts.manager_inf.p_audio_attr[i-1].i_lang_code ) ) ); vts.manager_inf.p_audio_attr[i-1].i_lang_code ) ) );
strcat( p_es->psz_desc, " (mpeg)" ); 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; break;
case 0x04: /* LPCM */ case 0x04: /* LPCM */
...@@ -647,8 +639,6 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -647,8 +639,6 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
vts.manager_inf.p_audio_attr[i-1].i_lang_code ) ) ); vts.manager_inf.p_audio_attr[i-1].i_lang_code ) ) );
strcat( p_es->psz_desc, " (lpcm)" ); 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; break;
case 0x06: /* DTS */ case 0x06: /* DTS */
i_id = ( ( 0x88 + audio_status.i_position ) << 8 ) | 0xbd; i_id = ( ( 0x88 + audio_status.i_position ) << 8 ) | 0xbd;
...@@ -707,8 +697,6 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -707,8 +697,6 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
p_es->i_cat = SPU_ES; p_es->i_cat = SPU_ES;
strcpy( p_es->psz_desc, IfoLanguage( hton16( strcpy( p_es->psz_desc, IfoLanguage( hton16(
vts.manager_inf.p_spu_attr[i-1].i_lang_code ) ) ); 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 #undef spu_status
...@@ -771,7 +759,7 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -771,7 +759,7 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
p_area->i_start; p_area->i_start;
p_input->stream.p_selected_area->i_part = p_dvd->i_chapter; 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 ); p_area->i_part, p_area->i_tell );
} }
else else
...@@ -796,19 +784,13 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area ) ...@@ -796,19 +784,13 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
DVDFindSector( p_dvd ); DVDFindSector( p_dvd );
p_dvd->i_cell += p_dvd->i_angle_cell; 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 else
{ {
p_dvd->i_angle = p_area->i_angle; 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 */ /* warn interface that something has changed */
...@@ -848,13 +830,6 @@ static int DVDRead( input_thread_t * p_input, ...@@ -848,13 +830,6 @@ static int DVDRead( input_thread_t * p_input,
p_dvd = (thread_dvd_data_t *)p_input->p_plugin_data; p_dvd = (thread_dvd_data_t *)p_input->p_plugin_data;
p_netlist = (dvd_netlist_t *)p_input->p_method_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; 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 */ /* Get the position of the next cell if we're at cell end */
...@@ -903,9 +878,6 @@ static int DVDRead( input_thread_t * p_input, ...@@ -903,9 +878,6 @@ static int DVDRead( input_thread_t * p_input,
p_input->stream.p_selected_area->i_start; p_input->stream.p_selected_area->i_start;
p_input->stream.p_selected_area->i_part = p_dvd->i_chapter; 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 ); vlc_mutex_unlock( &p_input->stream.stream_lock );
i_block_once = p_dvd->i_end_sector - p_dvd->i_sector + 1; i_block_once = p_dvd->i_end_sector - p_dvd->i_sector + 1;
...@@ -921,6 +893,13 @@ static int DVDRead( input_thread_t * p_input, ...@@ -921,6 +893,13 @@ static int DVDRead( input_thread_t * p_input,
p_netlist->i_read_once = i_block_once; 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 */ /* Reads from DVD */
#if !defined( WIN32 ) #if !defined( WIN32 )
i_read_bytes = readv( p_dvd->i_fd, p_vec, i_block_once ); i_read_bytes = readv( p_dvd->i_fd, p_vec, i_block_once );
...@@ -929,7 +908,8 @@ static int DVDRead( input_thread_t * p_input, ...@@ -929,7 +908,8 @@ static int DVDRead( input_thread_t * p_input,
#endif #endif
i_read_blocks = ( i_read_bytes + 0x7ff ) >> 11; 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 ); DVDMviovec( p_netlist, i_read_blocks, pp_data );
/* Update global position */ /* Update global position */
...@@ -1131,12 +1111,19 @@ static void DVDSeek( input_thread_t * p_input, off_t i_off ) ...@@ -1131,12 +1111,19 @@ static void DVDSeek( input_thread_t * p_input, off_t i_off )
{ {
i_angle = 0; i_angle = 0;
} }
if( p_dvd->i_chapter_nb > 1 )
{
while( ( title.chapter_map.pi_start_cell[i_chapter] <= while( ( title.chapter_map.pi_start_cell[i_chapter] <=
( p_dvd->i_prg_cell - i_angle + 1 ) ) && ( p_dvd->i_prg_cell - i_angle + 1 ) ) &&
( i_chapter < ( p_dvd->i_chapter_nb - 1 ) ) ) ( i_chapter < ( p_dvd->i_chapter_nb - 1 ) ) )
{ {
i_chapter++; i_chapter++;
} }
}
else
{
i_chapter = 1;
}
p_dvd->i_chapter = i_chapter; p_dvd->i_chapter = i_chapter;
p_input->stream.p_selected_area->i_part = p_dvd->i_chapter; p_input->stream.p_selected_area->i_part = p_dvd->i_chapter;
...@@ -1153,8 +1140,8 @@ static void DVDSeek( input_thread_t * p_input, off_t i_off ) ...@@ -1153,8 +1140,8 @@ static void DVDSeek( input_thread_t * p_input, off_t i_off )
p_input->stream.p_selected_area->i_start; p_input->stream.p_selected_area->i_start;
#endif #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 ); p_dvd->i_prg_cell, p_dvd->i_cell, p_dvd->i_chapter );
*/ */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* aout_ext-dec.c : exported fifo management functions * aout_ext-dec.c : exported fifo management functions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * 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> * Authors: Michel Kaempf <maxx@via.ecp.fr>
* *
...@@ -70,6 +70,26 @@ aout_fifo_t * aout_CreateFifo( int i_type, int i_channels, long l_rate, ...@@ -70,6 +70,26 @@ aout_fifo_t * aout_CreateFifo( int i_type, int i_channels, long l_rate,
p_aout_bank->pp_aout[ p_aout_bank->i_count ] = p_aout; p_aout_bank->pp_aout[ p_aout_bank->i_count ] = p_aout;
p_aout_bank->i_count++; 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 else
{ {
/* Take the first audio output FIXME: take the best one */ /* Take the first audio output FIXME: take the best one */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* aout_spdif: ac3 passthrough output * aout_spdif: ac3 passthrough output
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * 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> * Authors: Michel Kaempf <maxx@via.ecp.fr>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -63,7 +63,6 @@ void aout_SpdifThread( aout_thread_t * p_aout ) ...@@ -63,7 +63,6 @@ void aout_SpdifThread( aout_thread_t * p_aout )
int i_blank; int i_blank;
mtime_t mplay; mtime_t mplay;
mtime_t mdelta; mtime_t mdelta;
mtime_t mlast = 0;
/* get a blank frame ready */ /* get a blank frame ready */
memset( pi_blank, 0, sizeof(pi_blank) ); memset( pi_blank, 0, sizeof(pi_blank) );
...@@ -105,14 +104,8 @@ void aout_SpdifThread( aout_thread_t * p_aout ) ...@@ -105,14 +104,8 @@ void aout_SpdifThread( aout_thread_t * p_aout )
l_start_frame]; l_start_frame];
mdelta = mplay - mdate(); 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 */ /* play spdif frame to the external decoder */
p_aout->pf_play( p_aout, p_aout->pf_play( p_aout,
( (byte_t *)p_aout->fifo[i_fifo].buffer ( (byte_t *)p_aout->fifo[i_fifo].buffer
...@@ -124,6 +117,11 @@ void aout_SpdifThread( aout_thread_t * p_aout ) ...@@ -124,6 +117,11 @@ void aout_SpdifThread( aout_thread_t * p_aout )
(p_aout->fifo[i_fifo].l_start_frame + 1 ) (p_aout->fifo[i_fifo].l_start_frame + 1 )
& AOUT_FIFO_SIZE; & AOUT_FIFO_SIZE;
intf_WarnMsg( 12, "spdif out (%d):"
"playing frame %lld",
i_fifo,
mdelta );
i_frame++; i_frame++;
i_blank = 0; i_blank = 0;
} }
...@@ -143,16 +141,7 @@ void aout_SpdifThread( aout_thread_t * p_aout ) ...@@ -143,16 +141,7 @@ void aout_SpdifThread( aout_thread_t * p_aout )
if( i_frame ) if( i_frame )
{ {
if( mdelta > 0 ) mwait( mplay );
{
/* 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 );
}
} }
else else
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* audio_output.c : audio output thread * audio_output.c : audio output thread
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * 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> * Authors: Michel Kaempf <maxx@via.ecp.fr>
* *
...@@ -150,8 +150,9 @@ aout_thread_t *aout_CreateThread( int *pi_status ) ...@@ -150,8 +150,9 @@ aout_thread_t *aout_CreateThread( int *pi_status )
} }
/* special setting for ac3 pass-through mode */ /* 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 )
{ {
intf_WarnMsg( 4, "aout info: setting ac3 spdif" );
p_aout->i_format = AOUT_FMT_AC3; p_aout->i_format = AOUT_FMT_AC3;
p_aout->l_rate = 48000; p_aout->l_rate = 48000;
} }
......
...@@ -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.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> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -269,7 +269,23 @@ static void RunThread( input_thread_t *p_input ) ...@@ -269,7 +269,23 @@ static void RunThread( input_thread_t *p_input )
if( p_input->stream.p_new_area ) if( 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 ); 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; p_input->stream.p_new_area = NULL;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management * input_programs.c: es_descriptor_t, pgrm_descriptor_t management
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * 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> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -631,6 +631,7 @@ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es ) ...@@ -631,6 +631,7 @@ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es )
{ {
decoder.pf_create_thread = adec_CreateThread; decoder.pf_create_thread = adec_CreateThread;
p_config = (void *)GetAdecConfig( p_input, p_es ); p_config = (void *)GetAdecConfig( p_input, p_es );
p_main->b_ac3 = 0;
/* Release the lock, not to block the input thread during /* Release the lock, not to block the input thread during
* the creation of the thread. */ * the creation of the thread. */
...@@ -668,6 +669,7 @@ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es ) ...@@ -668,6 +669,7 @@ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es )
} }
p_config = (void *)GetAdecConfig( p_input, p_es ); p_config = (void *)GetAdecConfig( p_input, p_es );
p_main->b_ac3 = 1;
/* Release the lock, not to block the input thread during /* Release the lock, not to block the input thread during
* the creation of the thread. */ * the creation of the thread. */
...@@ -681,6 +683,7 @@ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es ) ...@@ -681,6 +683,7 @@ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es )
{ {
decoder.pf_create_thread = lpcmdec_CreateThread; decoder.pf_create_thread = lpcmdec_CreateThread;
p_config = (void *)GetAdecConfig( p_input, p_es ); p_config = (void *)GetAdecConfig( p_input, p_es );
p_main->b_ac3 = 0;
/* Release the lock, not to block the input thread during /* Release the lock, not to block the input thread during
* the creation of the thread. */ * the creation of the thread. */
......
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