[vlc-commits] bluray: add an option to select player region code

Petri Hintukainen git at videolan.org
Fri Aug 16 13:26:07 CEST 2013


vlc | branch: master | Petri Hintukainen <phintuka at users.sourceforge.net> | Thu Aug  8 10:05:30 2013 +0300| [f2838593988a637663df6bcb7238c9ed77c6dfe7] | committer: Rafaël Carré

bluray: add an option to select player region code

Signed-off-by: Rafaël Carré <funman at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f2838593988a637663df6bcb7238c9ed77c6dfe7
---

 modules/access/bluray.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index be2d39c..2da09aa 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -60,6 +60,16 @@
 #define BD_MENU_TEXT        N_( "Blu-ray menus" )
 #define BD_MENU_LONGTEXT    N_( "Use Blu-ray menus. If disabled, "\
                                 "the movie will start directly" )
+#define BD_REGION_TEXT      N_( "Region code" )
+#define BD_REGION_LONGTEXT  N_( "Blu-Ray player region code. "\
+                                "Some discs can be played only with a correct region code.")
+
+static const char *const ppsz_region_code[] = {
+    "A", "B", "C" };
+static const char *const ppsz_region_code_text[] = {
+    "Region A", "Region B", "Region C" };
+
+#define REGION_DEFAULT   1   /* Index to region list. Actual region code is (1<<REGION_DEFAULT) */
 
 /* Callbacks */
 static int  blurayOpen ( vlc_object_t * );
@@ -73,6 +83,8 @@ vlc_module_begin ()
     set_subcategory( SUBCAT_INPUT_ACCESS )
     set_capability( "access_demux", 200)
     add_bool( "bluray-menu", false, BD_MENU_TEXT, BD_MENU_LONGTEXT, false )
+    add_string( "bluray-region", ppsz_region_code[REGION_DEFAULT], BD_REGION_TEXT, BD_REGION_LONGTEXT, false)
+        change_string_list( ppsz_region_code, ppsz_region_code_text )
 
     add_shortcut( "bluray", "file" )
 
@@ -311,6 +323,12 @@ static int blurayOpen( vlc_object_t *object )
         }
     }
 
+    /* set player region code */
+    char *psz_region = var_InheritString(p_demux, "bluray-region");
+    unsigned int region = psz_region ? (psz_region[0] - 'A') : REGION_DEFAULT;
+    free(psz_region);
+    bd_set_player_setting(p_sys->bluray, BLURAY_PLAYER_SETTING_REGION_CODE, 1<<region);
+
     /* Get titles and chapters */
     p_sys->p_meta = bd_get_meta(p_sys->bluray);
     if (!p_sys->p_meta)



More information about the vlc-commits mailing list