diff stream/stream_bluray.c @ 34649:6dcc91eb3cf8

Support showing the stream language with br:// playback.
author reimar
date Sun, 19 Feb 2012 13:39:16 +0000
parents 422eb76aee70
children 3b2c280da1af
line wrap: on
line diff
--- a/stream/stream_bluray.c	Sun Feb 19 13:15:41 2012 +0000
+++ b/stream/stream_bluray.c	Sun Feb 19 13:39:16 2012 +0000
@@ -191,6 +191,36 @@
         return 1;
     }
 
+    case STREAM_CTRL_GET_LANG: {
+        struct stream_lang_req *req = arg;
+        BLURAY_TITLE_INFO *ti = bd_get_title_info(b->bd, b->current_title, b->current_angle);
+        if (ti->clip_count) {
+            BLURAY_STREAM_INFO *si = NULL;
+            int count = 0;
+            switch (req->type) {
+            case stream_ctrl_audio:
+                count = ti->clips[0].audio_stream_count;
+                si = ti->clips[0].audio_streams;
+                break;
+            case stream_ctrl_sub:
+                count = ti->clips[0].pg_stream_count;
+                si = ti->clips[0].pg_streams;
+                break;
+            }
+            while (count-- > 0) {
+                if (si->pid == req->id) {
+                    memcpy(req->buf, si->lang, 4);
+                    req->buf[4] = 0;
+                    bd_free_title_info(ti);
+                    return STREAM_OK;
+                }
+                si++;
+            }
+        }
+        bd_free_title_info(ti);
+        return STREAM_ERROR;
+    }
+
     default:
         break;
     }