1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-23 23:32:26 +00:00

Support for selecting the audio track in Matroska files via -alang.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10168 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
mosu 2003-05-23 15:01:25 +00:00
parent 49fc9d99b4
commit d9beced7e6
3 changed files with 16 additions and 9 deletions

View File

@ -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

View File

@ -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;

View File

@ -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";