demux: fix initial subtitle track selection

Commit 3c2cfee488 ("demux: improve -alang / -slang track choosing
logic") had a copy/paste error which left the subtitle code using
audio variables and broke initial subtitle track selection. Fix.

I actually realized soon after creating the original commit that I'd
forgotten to change the variables and went back to fix it, but then
somehow thought that it was already OK and didn't change it...
This commit is contained in:
Uoti Urpala 2010-11-16 10:41:16 +02:00
parent 9c1bafb93a
commit b82f82fe08
1 changed files with 4 additions and 4 deletions

View File

@ -1604,14 +1604,14 @@ int demuxer_sub_track_by_lang_and_default(struct demuxer *d, char *lang)
lang += strspn(lang, ",");
int len = strcspn(lang, ",");
int id = -1;
for (int i = 0; i < MAX_A_STREAMS; i++) {
struct sh_audio *sh = d->a_streams[i];
for (int i = 0; i < MAX_S_STREAMS; i++) {
struct sh_sub *sh = d->s_streams[i];
if (sh && (!len || sh->lang && strlen(sh->lang) == len &&
!memcmp(lang, sh->lang, len))) {
if (sh->default_track)
return sh->aid;
return sh->sid;
if (id < 0)
id = sh->aid;
id = sh->sid;
}
}
if (!len)