* dvdnav.c: DVD module using the dvdnav library.
*****************************************************************************
* Copyright (C) 2004 VideoLAN
- * $Id: dvdnav.c,v 1.9 2004/01/30 01:38:53 fenrir Exp $
+ * $Id: dvdnav.c,v 1.10 2004/01/30 14:27:48 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
vlc_value_t val, text;
int i_title, i_titles, i_chapter, i_chapters, i_angle, i;
char *psz_name;
- char psz_lang[3] = "en";
if( strncmp( p_demux->psz_access, "dvdnav", 6 ) ||
strncmp( p_demux->psz_demux, "dvdnav", 6 ) )
{
demux_sys_t *p_sys = p_demux->p_sys;
int i_spu = dvdnav_get_active_spu_stream( p_sys->dvdnav );
+ int32_t i_title, i_part;
ButtonUpdate( p_demux );
+ dvdnav_current_title_info( p_sys->dvdnav, &i_title, &i_part );
+ msg_Err( p_demux, "title=%d part=%d", i_title, i_part );
+ if( i_title > 0 )
+ {
+ return;
+ }
+
if( i_spu >= 0 && i_spu <= 0x1f )
{
ps_track_t *tk = &p_sys->tk[PS_ID_TO_TK(0xbd20 + i_spu)];
return VLC_SUCCESS;
}
-static char *LangCode2String( uint16_t i_lang )
-{
- const iso639_lang_t *pl;
- char lang[3];
-
- if( i_lang == 0xffff )
- {
- return NULL;
- }
- lang[0] = (i_lang >> 8)&0xff;
- lang[1] = (i_lang )&0xff;
- lang[2] = 0;
-
- pl = GetLang_1( lang );
- if( !strcmp( pl->psz_iso639_1, "??" ) )
- {
- return strdup( lang );
- }
- else if( *pl->psz_native_name )
- {
- return strdup( pl->psz_native_name );
- }
- return strdup( pl->psz_eng_name );
-}
-
static void ESNew( demux_t *p_demux, int i_id )
{
demux_sys_t *p_sys = p_demux->p_sys;
}
if( i_audio >= 0 )
{
- tk->fmt.psz_language =
- LangCode2String( dvdnav_audio_stream_to_lang( p_sys->dvdnav, i_audio ) );
+ int i_lang = dvdnav_audio_stream_to_lang( p_sys->dvdnav, i_audio );
+ if( i_lang != 0xffff )
+ {
+ tk->fmt.psz_language = malloc( 3 );
+ tk->fmt.psz_language[0] = (i_lang >> 8)&0xff;
+ tk->fmt.psz_language[1] = (i_lang )&0xff;
+ tk->fmt.psz_language[2] = 0;
+ }
if( dvdnav_get_active_audio_stream( p_sys->dvdnav ) == i_audio )
{
b_select = VLC_TRUE;
}
else if( tk->fmt.i_cat == SPU_ES )
{
- tk->fmt.psz_language =
- LangCode2String( dvdnav_spu_stream_to_lang( p_sys->dvdnav, i_id&0x1f ) );
+ int32_t i_title, i_part;
+ int i_lang = dvdnav_spu_stream_to_lang( p_sys->dvdnav, i_id&0x1f );
+ if( i_lang != 0xffff )
+ {
+ tk->fmt.psz_language = malloc( 3 );
+ tk->fmt.psz_language[0] = (i_lang >> 8)&0xff;
+ tk->fmt.psz_language[1] = (i_lang )&0xff;
+ tk->fmt.psz_language[2] = 0;
+ }
/* palette */
tk->fmt.subs.spu.palette[0] = 0xBeef;
memcpy( &tk->fmt.subs.spu.palette[1], p_sys->clut, 16 * sizeof( uint32_t ) );
+
+ /* We select only when we are not in the menu */
+ dvdnav_current_title_info( p_sys->dvdnav, &i_title, &i_part );
+ if( i_title > 0 &&
+ dvdnav_get_active_spu_stream( p_sys->dvdnav ) == (i_id&0x1f) )
+ {
+ b_select = VLC_TRUE;
+ }
}
tk->es = es_out_Add( p_demux->out, &tk->fmt );
* mkv.cpp : matroska demuxer
*****************************************************************************
* Copyright (C) 2003-2004 VideoLAN
- * $Id: mkv.cpp,v 1.55 2004/01/25 20:05:28 hartman Exp $
+ * $Id: mkv.cpp,v 1.56 2004/01/30 14:27:48 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
static void LoadCues ( input_thread_t *);
static void InformationsCreate ( input_thread_t *p_input );
-static char *LanguageGetName ( const char *psz_code );
-
/*****************************************************************************
* Open: initializes matroska demux structures
*****************************************************************************/
KaxTrackLanguage &lang = *(KaxTrackLanguage*)el3;
lang.ReadData( p_sys->es->I_O() );
- tk.fmt.psz_language =
- LanguageGetName( string( lang ).c_str() );
+ tk.fmt.psz_language = strdup( string( lang ).c_str() );
msg_Dbg( p_input,
- "| | | + Track Language=`%s'(%s) ",
- tk.fmt.psz_language, string( lang ).c_str() );
+ "| | | + Track Language=`%s'",
+ tk.fmt.psz_language );
}
else if( EbmlId( *el3 ) == KaxCodecID::ClassInfos.GlobalId )
{
return dst;
}
-static char *LanguageGetName ( const char *psz_code )
-{
- const iso639_lang_t *pl;
-
- if( strlen( psz_code ) == 2 )
- {
- pl = GetLang_1( psz_code );
- }
- else if( strlen( psz_code ) == 3 )
- {
- pl = GetLang_2B( psz_code );
- if( !strcmp( pl->psz_iso639_1, "??" ) )
- {
- pl = GetLang_2T( psz_code );
- }
- }
- else
- {
- return strdup( psz_code );
- }
-
- if( !strcmp( pl->psz_iso639_1, "??" ) )
- {
- return strdup( psz_code );
- }
- else
- {
- if( *pl->psz_native_name )
- {
- return strdup( pl->psz_native_name );
- }
- return strdup( pl->psz_eng_name );
- }
-}
-
* mp4.c : MP4 file input module for vlc
*****************************************************************************
* Copyright (C) 2001-2004 VideoLAN
- * $Id: mp4.c,v 1.57 2004/01/25 20:05:28 hartman Exp $
+ * $Id: mp4.c,v 1.58 2004/01/30 14:27:48 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
return (int64_t)1000000 * p_sys->i_time / p_sys->i_timescale;
}
-static char *LanguageGetName( const char *psz_code );
-
#define FREE( p ) if( p ) { free( p ); (p) = NULL;}
/*****************************************************************************
/* Set language */
if( strcmp( language, "```" ) && strcmp( language, "und" ) )
{
- p_track->fmt.psz_language = LanguageGetName( language );
+ p_track->fmt.psz_language = strdup( language );
}
/* fxi i_timescale for AUDIO_ES with i_qt_version == 0 */
}
}
-static char *LanguageGetName( const char *psz_code )
-{
- const iso639_lang_t *pl;
-
- pl = GetLang_2B( psz_code );
- if( !strcmp( pl->psz_iso639_1, "??" ) )
- {
- pl = GetLang_2T( psz_code );
- }
-
- if( !strcmp( pl->psz_iso639_1, "??" ) )
- {
- return strdup( psz_code );
- }
-
- if( *pl->psz_native_name )
- {
- return strdup( pl->psz_native_name );
- }
- return strdup( pl->psz_eng_name );
-}
-