[MPlayer-dev-eng] [PATCH] Matroska language selection
Loren Merritt
lorenm at u.washington.edu
Thu Mar 18 05:58:55 CET 2004
This patch modifies -alang and -slang for Matroska files to be consistent
with their behavior on DVDs.
Specifically, I allow a comma-delimited, preference ordered list of
language codes. Previously, it treated the whole string as one language.
--Loren Merritt
-------------- next part --------------
--- libmpdemux/demux_mkv.c.old 2004-02-09 19:21:08.000000000 -0800
+++ libmpdemux/demux_mkv.c 2004-03-17 19:25:56.000000000 -0800
@@ -236,12 +236,19 @@
static mkv_track_t *
demux_mkv_find_track_by_language (mkv_demuxer_t *d, char *language, int type)
{
- int i;
+ int i, len;
- for (i=0; i < d->num_tracks; i++)
- if (d->tracks[i] != NULL && d->tracks[i]->language != NULL &&
- d->tracks[i]->type == type && !strcmp(d->tracks[i]->language,language))
- return d->tracks[i];
+ language += strspn(language,",");
+ while((len = strcspn(language,",")) > 0)
+ {
+ for (i=0; i < d->num_tracks; i++)
+ if (d->tracks[i] != NULL && d->tracks[i]->language != NULL &&
+ d->tracks[i]->type == type &&
+ !strncmp(d->tracks[i]->language, language, len))
+ return d->tracks[i];
+ language += len;
+ language += strspn(language,",");
+ }
return NULL;
}
More information about the MPlayer-dev-eng
mailing list