Parse comma separated language lists instead of comparing the complete language string. Patch by Loren Merritt <lorenm at u dot washington dot edu>

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12042 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
mosu 2004-03-18 08:37:21 +00:00
parent 0dfbe88178
commit e8a1b37130
1 changed files with 12 additions and 5 deletions

View File

@ -236,12 +236,19 @@ demux_mkv_find_track_by_num (mkv_demuxer_t *d, int n, int type)
static mkv_track_t * static mkv_track_t *
demux_mkv_find_track_by_language (mkv_demuxer_t *d, char *language, int type) 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++) language += strspn(language,",");
if (d->tracks[i] != NULL && d->tracks[i]->language != NULL && while((len = strcspn(language,",")) > 0)
d->tracks[i]->type == type && !strcmp(d->tracks[i]->language,language)) {
return d->tracks[i]; 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; return NULL;
} }