Browse Source

esout,dvdnav,bluray: fix ugly language search hack

using the new functionality of the new  `vlc_find_iso639()` function.
pull/126/head
Lyndon Brown 5 years ago
committed by Jean-Baptiste Kempf
parent
commit
8c7262207f
  1. 17
      modules/access/bluray.c
  2. 17
      modules/access/dvdnav.c
  3. 15
      src/input/es_out.c

17
modules/access/bluray.c

@ -54,10 +54,6 @@
#include "../demux/mpeg/timestamps.h"
#include "../demux/timestamps_filter.h"
/* FIXME we should find a better way than including that */
#include "../../src/text/iso-639_def.h"
#include <libbluray/bluray.h>
#include <libbluray/bluray-version.h>
#include <libbluray/keys.h>
@ -498,20 +494,11 @@ static const char *DemuxGetLanguageCode( demux_t *p_demux, const char *psz_var )
if( ( p = strchr( psz_lang, ',' ) ) )
*p = '\0';
for( pl = p_languages; pl->psz_eng_name != NULL; pl++ )
{
if( *psz_lang == '\0' )
continue;
if( !strcasecmp( pl->psz_eng_name, psz_lang ) ||
!strcasecmp( pl->psz_iso639_1, psz_lang ) ||
!strcasecmp( pl->psz_iso639_2T, psz_lang ) ||
!strcasecmp( pl->psz_iso639_2B, psz_lang ) )
break;
}
pl = vlc_find_iso639( psz_lang, true );
free( psz_lang );
if( pl->psz_eng_name != NULL )
if( pl != NULL )
return pl->psz_iso639_2T;
return LANGUAGE_DEFAULT;

17
modules/access/dvdnav.c

@ -53,10 +53,6 @@
#include <vlc_dialog.h>
#include <vlc_iso_lang.h>
/* FIXME we should find a better way than including that */
#include "../../src/text/iso-639_def.h"
#include <dvdnav/dvdnav.h>
/* Expose without patching headers */
dvdnav_status_t dvdnav_jump_to_sector_by_time(dvdnav_t *, uint64_t, int32_t);
@ -1248,20 +1244,11 @@ static char *DemuxGetLanguageCode( demux_t *p_demux, const char *psz_var )
if( ( p = strchr( psz_lang, ',' ) ) )
*p = '\0';
for( pl = p_languages; pl->psz_eng_name != NULL; pl++ )
{
if( *psz_lang == '\0' )
continue;
if( !strcasecmp( pl->psz_eng_name, psz_lang ) ||
!strcasecmp( pl->psz_iso639_1, psz_lang ) ||
!strcasecmp( pl->psz_iso639_2T, psz_lang ) ||
!strcasecmp( pl->psz_iso639_2B, psz_lang ) )
break;
}
pl = vlc_find_iso639( psz_lang, true );
free( psz_lang );
if( pl->psz_eng_name != NULL )
if( pl != NULL )
return strdup( pl->psz_iso639_1 );
return strdup(LANGUAGE_DEFAULT);

15
src/input/es_out.c

@ -54,8 +54,6 @@
#include "../stream_output/stream_output.h"
#include <vlc_iso_lang.h>
/* FIXME we should find a better way than including that */
#include "../text/iso-639_def.h"
/*****************************************************************************
* Local prototypes
@ -3997,19 +3995,12 @@ static char *LanguageGetName( const char *psz_code )
static char *LanguageGetCode( const char *psz_lang )
{
const iso639_lang_t *pl;
if( psz_lang == NULL || *psz_lang == '\0' )
return strdup("??");
for( pl = p_languages; pl->psz_eng_name != NULL; pl++ )
if( psz_lang != NULL )
{
if( !strcasecmp( pl->psz_eng_name, psz_lang ) ||
!strcasecmp( pl->psz_iso639_1, psz_lang ) ||
!strcasecmp( pl->psz_iso639_2T, psz_lang ) ||
!strcasecmp( pl->psz_iso639_2B, psz_lang ) )
pl = vlc_find_iso639( psz_lang, true );
if( pl != NULL )
return strdup( pl->psz_iso639_1 );
}
return strdup("??");
}

Loading…
Cancel
Save