changeset 34689:e92fb6cc0836

Fix DVDs showing the subtitle language as "unknown" for a long time.
author reimar
date Sat, 25 Feb 2012 18:26:31 +0000
parents 82f0b612bb52
children eeb74ce15120
files libmpdemux/demuxer.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demuxer.c	Fri Feb 24 23:34:55 2012 +0000
+++ b/libmpdemux/demuxer.c	Sat Feb 25 18:26:31 2012 +0000
@@ -1815,14 +1815,14 @@
     if (id < 0 || id >= MAX_S_STREAMS)
         return -1;
     sh = d->s_streams[id];
-    if (!sh)
-        return -1;
-    if (sh->lang) {
+    if (sh && sh->lang) {
         av_strlcpy(buf, sh->lang, buf_len);
         return 0;
     }
     req.type = stream_ctrl_sub;
-    req.id = sh->sid;
+    // assume 1:1 mapping so we can show the language of
+    // DVD subs even when we have not yet created the stream.
+    req.id = sh ? sh->sid : id;
     if (stream_control(d->stream, STREAM_CTRL_GET_LANG, &req) == STREAM_OK) {
         av_strlcpy(buf, req.buf, buf_len);
         return 0;