aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--libmpdemux/demux_mkv.cpp21
-rw-r--r--mencoder.c2
-rw-r--r--mplayer.c2
3 files changed, 16 insertions, 9 deletions
diff --git a/libmpdemux/demux_mkv.cpp b/libmpdemux/demux_mkv.cpp
index bf00269c66..2b53965732 100644
--- a/libmpdemux/demux_mkv.cpp
+++ b/libmpdemux/demux_mkv.cpp
@@ -55,6 +55,7 @@ using namespace std;
// for e.g. "-slang ger"
extern char *dvdsub_lang;
+extern char *audio_lang;
// default values for Matroska elements
#define MKVD_TIMECODESCALE 1000000 // 1000000 = 1ms
@@ -1503,13 +1504,19 @@ extern "C" int demux_mkv_open(demuxer_t *demuxer) {
track = NULL;
if (demuxer->audio->id == -1) { // Automatically select an audio track.
- // Search for an audio track that has the 'default' flag set.
- for (i = 0; i < mkv_d->num_tracks; i++)
- if ((mkv_d->tracks[i]->type == 'a') && mkv_d->tracks[i]->ok &&
- mkv_d->tracks[i]->default_track) {
- track = mkv_d->tracks[i];
- break;
- }
+ // check if the user specified an audio language
+ if (audio_lang != NULL) {
+ track = find_track_by_language(mkv_d, audio_lang, NULL, 'a');
+ }
+ if (track == NULL)
+ // no audio language specified, or language not found
+ // Search for an audio track that has the 'default' flag set.
+ for (i = 0; i < mkv_d->num_tracks; i++)
+ if ((mkv_d->tracks[i]->type == 'a') && mkv_d->tracks[i]->ok &&
+ mkv_d->tracks[i]->default_track) {
+ track = mkv_d->tracks[i];
+ break;
+ }
if (track == NULL)
// No track has the 'default' flag set - let's take the first audio
diff --git a/mencoder.c b/mencoder.c
index 49776c1485..bec2f6d362 100644
--- a/mencoder.c
+++ b/mencoder.c
@@ -99,7 +99,7 @@ int audio_id=-1;
int video_id=-1;
int dvdsub_id=-1;
int vobsub_id=-1;
-static char* audio_lang=NULL;
+char* audio_lang=NULL;
char* dvdsub_lang=NULL;
static char* spudec_ifo=NULL;
diff --git a/mplayer.c b/mplayer.c
index b7aca15777..9aec1be889 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -230,7 +230,7 @@ int audio_id=-1;
int video_id=-1;
int dvdsub_id=-1;
int vobsub_id=-1;
-static char* audio_lang=NULL;
+char* audio_lang=NULL;
char* dvdsub_lang=NULL;
static char* spudec_ifo=NULL;
char* filename=NULL; //"MI2-Trailer.avi";