#include <vlc_atomic.h>
#include <vlc_dialog.h> /* BD+/AACS warnings */
#include <vlc_vout.h> /* vout_PutSubpicture / subpicture_t */
-#include <vlc_url.h> /* vlc_path2uri */
+#include <vlc_url.h> /* vlc_path2uri */
#include <libbluray/bluray.h>
#include <libbluray/keys.h>
* Module descriptor
*****************************************************************************/
-#define BD_MENU_TEXT N_( "Bluray menus" )
-#define BD_MENU_LONGTEXT N_( "Use bluray menus. If disabled, "\
+#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 * );
static void blurayClose( vlc_object_t * );
vlc_module_begin ()
- set_shortname( N_("BluRay") )
- set_description( N_("Blu-Ray Disc support (libbluray)") )
+ set_shortname( N_("Blu-ray") )
+ set_description( N_("Blu-ray Disc support (libbluray)") )
set_category( CAT_INPUT )
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" )
/* Is it a bluray? */
if (!disc_info->bluray_detected) {
- error_msg = "Path doesn't appear to be a bluray";
+ error_msg = "Path doesn't appear to be a Blu-ray";
goto error;
}
/* AACS */
if (disc_info->aacs_detected) {
if (!disc_info->libaacs_detected) {
- error_msg = _("This Blu-Ray Disc needs a library for AACS decoding, "
+ error_msg = _("This Blu-ray Disc needs a library for AACS decoding, "
"and your system does not have it.");
goto error;
}
if (disc_info->aacs_error_code) {
switch (disc_info->aacs_error_code) {
case BD_AACS_CORRUPTED_DISC:
- error_msg = _("BluRay Disc is corrupted.");
+ error_msg = _("Blu-ray Disc is corrupted.");
break;
case BD_AACS_NO_CONFIG:
error_msg = _("Missing AACS configuration file!");
/* BD+ */
if (disc_info->bdplus_detected) {
if (!disc_info->libbdplus_detected) {
- error_msg = _("This Blu-Ray Disc needs a library for BD+ decoding, "
+ error_msg = _("This Blu-ray Disc needs a library for BD+ decoding, "
"and your system does not have it.");
goto error;
}
}
}
+ /* 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)
error:
if (error_msg)
- dialog_Fatal(p_demux, _("Blu-Ray error"), "%s", error_msg);
+ dialog_Fatal(p_demux, _("Blu-ray error"), "%s", error_msg);
blurayClose(object);
return VLC_EGENERIC;
}
subpicture_region_t *p_src = p_overlay->p_regions;
if (!p_src)
+ {
+ vlc_mutex_unlock(&p_overlay->lock);
return;
+ }
subpicture_region_t **p_dst = &(p_subpic->p_region);
while (p_src != NULL) {
return VLC_SUCCESS;
}
+static int sendKeyEvent(demux_sys_t *p_sys, unsigned int key)
+{
+ mtime_t now = mdate();
+ if (bd_user_input(p_sys->bluray, now, key) < 0) {
+ return VLC_EGENERIC;
+ }
+ return VLC_SUCCESS;
+}
+
/*****************************************************************************
* libbluray overlay handling:
*****************************************************************************/
return VLC_SUCCESS;
}
+ case DEMUX_NAV_ACTIVATE:
+ return sendKeyEvent(p_sys, BD_VK_ENTER);
+ case DEMUX_NAV_UP:
+ return sendKeyEvent(p_sys, BD_VK_UP);
+ case DEMUX_NAV_DOWN:
+ return sendKeyEvent(p_sys, BD_VK_DOWN);
+ case DEMUX_NAV_LEFT:
+ return sendKeyEvent(p_sys, BD_VK_LEFT);
+ case DEMUX_NAV_RIGHT:
+ return sendKeyEvent(p_sys, BD_VK_RIGHT);
+
case DEMUX_CAN_RECORD:
case DEMUX_GET_FPS:
case DEMUX_SET_GROUP: