changeset 21197:7ecd9de03435

added code to identify subs language and count; needed for forthcoming support for -slang
author nicodvb
date Sat, 25 Nov 2006 12:17:34 +0000
parents 9725193f1530
children fbe50a67612a
files stream/stream_dvdnav.c stream/stream_dvdnav.h
diffstat 2 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/stream/stream_dvdnav.c	Sat Nov 25 11:29:25 2006 +0000
+++ b/stream/stream_dvdnav.c	Sat Nov 25 12:17:34 2006 +0000
@@ -476,6 +476,34 @@
   priv->mousey = y;
 }
 
+int dvdnav_sid_from_lang(stream_t *stream, unsigned char *language) {
+  dvdnav_priv_t * priv=(dvdnav_priv_t*)stream->priv;
+  uint8_t format, lg, k;
+  uint16_t lang, lcode = (language[0] << 8) | (language[1]);
+
+  for(k=0; k<32; k++) {
+    lg = dvdnav_get_spu_logical_stream(priv->dvdnav, k);
+    if(lg == 0xff) continue;
+    lang = dvdnav_spu_stream_to_lang(priv->dvdnav, lg);
+    if(lang != 0xFFFF && lang == lcode) {
+      return k;
+    }
+  }
+  return -1;
+}
+
+int dvdnav_number_of_subs(stream_t *stream) {
+  dvdnav_priv_t * priv=(dvdnav_priv_t*)stream->priv;
+  uint8_t lg, k, n=0;
+
+  for(k=0; k<32; k++) {
+    lg = dvdnav_get_spu_logical_stream(priv->dvdnav, k);
+    if(lg == 0xff) continue;
+    n++;
+  }
+  return n;
+}
+
 
 stream_info_t stream_info_dvdnav = {
   "DVDNAV stream",
--- a/stream/stream_dvdnav.h	Sat Nov 25 11:29:25 2006 +0000
+++ b/stream/stream_dvdnav.h	Sat Nov 25 12:17:34 2006 +0000
@@ -33,6 +33,8 @@
 extern int osd_show_dvd_nav_sy;
 extern int osd_show_dvd_nav_ey;
 
+int dvdnav_number_of_subs(stream_t *stream);
+int dvdnav_sid_from_lang(stream_t *stream, unsigned char *language);
 int mp_dvdnav_handle_input(stream_t *stream, int cmd, int *button);
 void mp_dvdnav_update_mouse_pos(stream_t *stream, int32_t x, int32_t y, int* button);