[libbluray-devel] Automatic language selection: disable subtitles when audio is in the same language

hpi1 git at videolan.org
Sat Jun 23 13:12:26 CEST 2012


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sat Jun 23 14:11:08 2012 +0300| [17f392f48cf6a8f0ee042a1872a7121dd3613bc3] | committer: hpi1

Automatic language selection: disable subtitles when audio is in the same language

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=17f392f48cf6a8f0ee042a1872a7121dd3613bc3
---

 ChangeLog              |    1 +
 src/libbluray/bluray.c |   18 +++++++++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a477672..b65d310 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+ - Automatic language selection: disable subtitles when audio is in the same language
  - Fixed accessing outside of array bounds
  - Default to stream 0 when requested language not found
  - Install bd_info
diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 54656d2..1824a64 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -259,7 +259,8 @@ static int _queue_event(BLURAY *bd, BD_EVENT ev)
 static void _update_stream_psr_by_lang(BD_REGISTERS *regs,
                                        uint32_t psr_lang, uint32_t psr_stream,
                                        uint32_t enable_flag,
-                                       MPLS_STREAM *streams, unsigned num_streams)
+                                       MPLS_STREAM *streams, unsigned num_streams,
+                                       uint32_t *lang, uint32_t blacklist)
 {
     uint32_t psr_val;
     int      stream_idx = -1;
@@ -285,6 +286,14 @@ static void _update_stream_psr_by_lang(BD_REGISTERS *regs,
         /* requested language not found */
         stream_idx = 0;
         enable_flag = 0;
+
+    } else {
+        if (lang) {
+            *lang = psr_val;
+        }
+        if (blacklist == psr_val) {
+            enable_flag = 0;
+        }
     }
 
     /* update PSR */
@@ -310,13 +319,16 @@ static void _update_clip_psrs(BLURAY *bd, NAV_CLIP *clip)
      */
     if (bd->title_type == title_undef) {
         MPLS_STN *stn = &clip->title->pl->play_item[clip->ref].stn;
+        uint32_t audio_lang = 0;
 
         _update_stream_psr_by_lang(bd->regs,
                                    PSR_AUDIO_LANG, PSR_PRIMARY_AUDIO_ID, 0,
-                                   stn->audio, stn->num_audio);
+                                   stn->audio, stn->num_audio,
+                                   &audio_lang, 0);
         _update_stream_psr_by_lang(bd->regs,
                                    PSR_PG_AND_SUB_LANG, PSR_PG_STREAM, 0x80000000,
-                                   stn->pg, stn->num_pg);
+                                   stn->pg, stn->num_pg,
+                                   NULL, audio_lang);
     }
 }
 



More information about the libbluray-devel mailing list