changeset 21204:1ddb1a86e419

support for comma-separated language codes in -slang
author nicodvb
date Sat, 25 Nov 2006 15:00:08 +0000
parents 235a8e71ed6f
children 8e957660fb4d
files stream/stream_dvdnav.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/stream/stream_dvdnav.c	Sat Nov 25 14:46:21 2006 +0000
+++ b/stream/stream_dvdnav.c	Sat Nov 25 15:00:08 2006 +0000
@@ -466,8 +466,10 @@
 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]);
+  uint16_t lang, lcode;
 
+  while(language && strlen(language)>=2) {
+  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;
@@ -476,6 +478,9 @@
       return k;
     }
   }
+  language += 2;
+  while(language[0]==',' || language[0]==' ') ++language;
+  }
   return -1;
 }