1
mirror of https://code.videolan.org/videolan/vlc synced 2024-09-04 09:11:33 +02:00

*p_es->p_demux_data is available in p_config->p_demux_data so that the input

can pass information directly to the decoder.

*First application: aspect ratio for DVD is read from the ifo (should fix
the buf with aspect ratio in anamorphic DVDs).

*The DVD plugin also copy the spu yuv palette in p_demux_data so that the
spudec can display subtitle with the right color (sam !).

*Removed duplicate code and useless lock in gtk.
This commit is contained in:
Stéphane Borel 2002-03-14 01:35:28 +00:00
parent 4a51bbeb71
commit 9c49d6f872
6 changed files with 61 additions and 24 deletions

View File

@ -2,7 +2,7 @@
* input_ext-dec.h: structures exported to the VideoLAN decoders
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: input_ext-dec.h,v 1.53 2002/03/01 00:33:17 massiot Exp $
* $Id: input_ext-dec.h,v 1.54 2002/03/14 01:35:28 stef Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Kaempf <maxx@via.ecp.fr>
@ -532,6 +532,7 @@ typedef struct decoder_config_s
u16 i_id;
u8 i_type; /* type of the elementary stream */
void * p_demux_data;
struct stream_ctrl_s * p_stream_ctrl;
struct decoder_fifo_s * p_decoder_fifo;
} decoder_config_t;

View File

@ -1,7 +1,7 @@
/* dvd_es.c: functions to find and select ES
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: dvd_es.c,v 1.4 2002/03/12 18:37:46 stef Exp $
* $Id: dvd_es.c,v 1.5 2002/03/14 01:35:28 stef Exp $
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
@ -70,9 +70,9 @@ void DVDLaunchDecoders( input_thread_t * p_input );
#define vmg p_dvd->p_ifo->vmg
#define vts p_dvd->p_ifo->vts
#define ADDES( stream_id, private_id, type, cat, lang ) \
#define ADDES( stream_id, private_id, type, cat, lang, size ) \
i_id = ( (private_id) << 8 ) | (stream_id); \
p_es = input_AddES( p_input, NULL, i_id, 0 ); \
p_es = input_AddES( p_input, NULL, i_id, size ); \
p_es->i_stream_id = (stream_id); \
p_es->i_type = (type); \
p_es->i_cat = (cat); \
@ -90,13 +90,24 @@ void DVDReadVideo( input_thread_t * p_input )
thread_dvd_data_t * p_dvd;
es_descriptor_t * p_es;
int i_id;
int i_ratio;
p_dvd = (thread_dvd_data_t*)(p_input->p_access_data);
/* ES 0 -> video MPEG2 */
IfoPrintVideo( p_dvd );
ADDES( 0xe0, 0, MPEG2_VIDEO_ES, VIDEO_ES, 0 );
i_ratio = vts.manager_inf.video_attr.i_ratio;
if( i_ratio )
{
ADDES( 0xe0, 0, MPEG2_VIDEO_ES, VIDEO_ES, 0, sizeof(int) );
*(int*)(p_es->p_demux_data) = i_ratio;
}
else
{
ADDES( 0xe0, 0, MPEG2_VIDEO_ES, VIDEO_ES, 0, 0 );
}
}
/*****************************************************************************
@ -132,7 +143,7 @@ void DVDReadAudio( input_thread_t * p_input )
{
case 0x00: /* AC3 */
ADDES( 0xbd, 0x80 + audio_status.i_position,
AC3_AUDIO_ES, AUDIO_ES, i_lang );
AC3_AUDIO_ES, AUDIO_ES, i_lang, 0 );
p_es->b_audio = 1;
strcat( p_es->psz_desc, " (ac3)" );
@ -140,14 +151,14 @@ void DVDReadAudio( input_thread_t * p_input )
case 0x02:
case 0x03: /* MPEG audio */
ADDES( 0xc0 + audio_status.i_position, 0,
MPEG2_AUDIO_ES, AUDIO_ES, i_lang );
MPEG2_AUDIO_ES, AUDIO_ES, i_lang, 0 );
p_es->b_audio = 1;
strcat( p_es->psz_desc, " (mpeg)" );
break;
case 0x04: /* LPCM */
ADDES( 0xbd, 0xa0 + audio_status.i_position,
LPCM_AUDIO_ES, AUDIO_ES, i_lang );
LPCM_AUDIO_ES, AUDIO_ES, i_lang, 0 );
p_es->b_audio = 1;
strcat( p_es->psz_desc, " (lpcm)" );
@ -172,6 +183,8 @@ void DVDReadAudio( input_thread_t * p_input )
*****************************************************************************/
#define spu_status \
vts.title_unit.p_title[p_dvd->i_title_id-1].title.pi_spu_status[i-1]
#define palette \
vts.title_unit.p_title[p_dvd->i_title_id-1].title.pi_yuv_color
void DVDReadSPU( input_thread_t * p_input )
{
@ -214,11 +227,22 @@ void DVDReadSPU( input_thread_t * p_input )
i_id = spu_status.i_position_43;
}
ADDES( 0xbd, 0x20 + i_id, DVD_SPU_ES, SPU_ES,
vts.manager_inf.p_spu_attr[i-1].i_lang_code );
if( vmg.title.pi_yuv_color )
{
ADDES( 0xbd, 0x20 + i_id, DVD_SPU_ES, SPU_ES,
vts.manager_inf.p_spu_attr[i-1].i_lang_code,
16*sizeof(u32) );
memcpy( p_es->p_demux_data, palette, 16*sizeof(u32) );
}
else
{
ADDES( 0xbd, 0x20 + i_id, DVD_SPU_ES, SPU_ES,
vts.manager_inf.p_spu_attr[i-1].i_lang_code, 0 );
}
}
}
}
#undef palette
#undef spu_status
#undef vts

View File

@ -2,7 +2,7 @@
* gtk_menu.c : functions to handle menu items.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_menu.c,v 1.22 2002/03/06 01:20:56 stef Exp $
* $Id: gtk_menu.c,v 1.23 2002/03/14 01:35:28 stef Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>
@ -246,7 +246,6 @@ void GtkMenubarChapterToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
intf_thread_t * p_intf;
input_area_t * p_area;
gint i_chapter;
char psz_chapter[5];
GtkWidget * p_popup_menu;
p_intf = GetIntf( GTK_WIDGET(menuitem), "intf_window" );
@ -258,10 +257,6 @@ void GtkMenubarChapterToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
p_area->i_part = i_chapter;
input_ChangeArea( p_input_bank->pp_input[0], (input_area_t*)p_area );
snprintf( psz_chapter, 4, "%02d", p_area->i_part );
psz_chapter[ 4 ] = '\0';
gtk_label_set_text( p_intf->p_sys->p_label_chapter, psz_chapter );
p_intf->p_sys->b_chapter_update = 1;
p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
p_intf->p_sys->p_popup ), "popup_navigation" ) );
@ -382,10 +377,8 @@ static gint GtkRadioMenu( intf_thread_t * p_intf,
* We have to release the lock since input_ToggleES needs it */
if( p_item_selected != NULL )
{
vlc_mutex_unlock( &p_input_bank->pp_input[0]->stream.stream_lock );
gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_item_selected ),
TRUE );
vlc_mutex_lock( &p_input_bank->pp_input[0]->stream.stream_lock );
}
/* be sure that menu is sensitive, if there are several items */
@ -841,10 +834,8 @@ static gint GtkTitleMenu( gpointer p_data,
* We have to release the lock since input_ToggleES needs it */
if( p_item_active != NULL )
{
vlc_mutex_unlock( &p_input_bank->pp_input[0]->stream.stream_lock );
gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_item_active ),
TRUE );
vlc_mutex_lock( &p_input_bank->pp_input[0]->stream.stream_lock );
}
#if 0
if( p_input_bank->pp_input[0]->stream.i_area_nb > 1 )

View File

@ -2,7 +2,7 @@
* vpar_headers.c : headers parsing
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: vpar_headers.c,v 1.15 2002/02/27 22:57:10 sam Exp $
* $Id: vpar_headers.c,v 1.16 2002/03/14 01:35:28 stef Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Stéphane Borel <stef@via.ecp.fr>
@ -421,6 +421,12 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
p_vpar->sequence.i_chroma_format = CHROMA_420;
}
/* check whether the input gives a particular aspect ratio */
if( p_vpar->p_config->p_demux_data )
{
i_aspect = *(int*)(p_vpar->p_config->p_demux_data);
}
/* Store calculated aspect ratio */
switch( i_aspect )
{

View File

@ -2,7 +2,7 @@
* spu_decoder.c : spu decoder thread
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: spu_decoder.c,v 1.10 2002/02/19 00:50:19 sam Exp $
* $Id: spu_decoder.c,v 1.11 2002/03/14 01:35:28 stef Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
@ -102,6 +102,8 @@ static int decoder_Probe( u8 *pi_type )
static int decoder_Run( decoder_config_t * p_config )
{
spudec_thread_t * p_spudec;
int i;
u32 * pi_yuv_color;
intf_WarnMsg( 3, "spudec: thread launched. Initializing ..." );
@ -128,6 +130,17 @@ static int decoder_Run( decoder_config_t * p_config )
*/
p_spudec->p_fifo->b_error = InitThread( p_spudec );
pi_yuv_color = p_config->p_demux_data;
for( i=0 ; i<16 ; i++ )
{
intf_WarnMsg( 12, "spudec info: 0x%02x 0x%02x 0x%02x 0x%02x",
*((u8*)(pi_yuv_color)),
*((u8*)(pi_yuv_color) + 1),
*((u8*)(pi_yuv_color) + 2),
*((u8*)(pi_yuv_color) + 3));
pi_yuv_color++;
}
/*
* Main loop - it is not executed if an error occured during
* initialization

View File

@ -2,7 +2,7 @@
* input_dec.c: Functions for the management of decoders
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: input_dec.c,v 1.30 2002/03/11 07:23:09 gbazin Exp $
* $Id: input_dec.c,v 1.31 2002/03/14 01:35:28 stef Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
@ -247,6 +247,8 @@ static decoder_config_t * CreateDecoderConfig( input_thread_t * p_input,
p_config->i_id = p_es->i_id;
p_config->i_type = p_es->i_type;
p_config->p_demux_data = p_es->p_demux_data;
p_config->p_stream_ctrl = &p_input->stream.control;
p_config->p_decoder_fifo->p_first = NULL;