[libbluray-devel] Add function to initialize player setting registers for UHD playback
hpi1
git at videolan.org
Thu Sep 7 10:14:15 CEST 2017
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Wed Sep 6 14:34:46 2017 +0300| [03d577307d441de2ad347985bf1815c3034ed5e6] | committer: hpi1
Add function to initialize player setting registers for UHD playback
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=03d577307d441de2ad347985bf1815c3034ed5e6
---
src/libbluray/player_settings.h | 2 ++
src/libbluray/register.c | 38 ++++++++++++++++++++++++++++++++++++++
src/libbluray/register.h | 12 ++++++++++++
3 files changed, 52 insertions(+)
diff --git a/src/libbluray/player_settings.h b/src/libbluray/player_settings.h
index 4431e123..dc10d79d 100644
--- a/src/libbluray/player_settings.h
+++ b/src/libbluray/player_settings.h
@@ -148,6 +148,8 @@ enum {
BLURAY_PLAYER_PROFILE_6_v3_1 = ((0x00 << 16) | (0x0310)), /* Profile 6, version 3.1 (UHD) */
};
+#define BLURAY_PLAYER_PROFILE_3D_FLAG 0x100000
+#define BLURAY_PLAYER_PROFILE_VERSION_MASK 0xffff
/*
* BLURAY_PLAYER_SETTING_DECODE_PG
diff --git a/src/libbluray/register.c b/src/libbluray/register.c
index 23e52877..f44c171b 100644
--- a/src/libbluray/register.c
+++ b/src/libbluray/register.c
@@ -559,3 +559,41 @@ void psr_init_3D(BD_REGISTERS *p, int initial_mode)
bd_psr_unlock(p);
}
+
+int psr_init_UHD(BD_REGISTERS *p, int force)
+{
+ bd_psr_lock(p);
+
+ /* make automatic initialization to fail if app has already changed player profile */
+ if (!force) {
+ if ((bd_psr_read(p, PSR_PROFILE_VERSION) & BLURAY_PLAYER_PROFILE_VERSION_MASK) >= 0x0300) {
+ BD_DEBUG(DBG_BLURAY | DBG_CRIT, "psr_init_UHD() failed: profile version already >= 0x0300\n");
+ bd_psr_unlock(p);
+ return -1;
+ }
+ if (bd_psr_read(p, PSR_PROFILE_VERSION) & BLURAY_PLAYER_PROFILE_3D_FLAG) {
+ BD_DEBUG(DBG_BLURAY | DBG_CRIT, "psr_init_UHD() failed: 3D already set in profile\n");
+ bd_psr_unlock(p);
+ return -1;
+ }
+ }
+
+ bd_psr_setting_write(p, PSR_UHD_CAP,
+ /* TODO */ 0xffffffff );
+
+ bd_psr_setting_write(p, PSR_UHD_DISPLAY_CAP,
+ /* TODO */ 0xffffffff );
+
+ bd_psr_setting_write(p, PSR_UHD_HDR_PREFER,
+ /* TODO */ 0xffffffff );
+
+ bd_psr_setting_write(p, PSR_UHD_SDR_CONV_PREFER,
+ /* TODO */ 0 );
+
+ bd_psr_setting_write(p, PSR_PROFILE_VERSION,
+ BLURAY_PLAYER_PROFILE_6_v3_1);
+
+ bd_psr_unlock(p);
+
+ return 0;
+}
diff --git a/src/libbluray/register.h b/src/libbluray/register.h
index d688accb..ddb04569 100644
--- a/src/libbluray/register.h
+++ b/src/libbluray/register.h
@@ -269,6 +269,18 @@ void bd_psr_unregister_cb(BD_REGISTERS *, void (*callback)(void*,BD_PSR_EVENT*),
BD_PRIVATE void psr_init_3D(BD_REGISTERS *, int initial_mode);
+/**
+ *
+ * Initialize registers for profile 6 (UHD) playback.
+ *
+ * Profiles 5 (3D) and 6 (UHD) can't be enabld at the same time.
+ *
+ * @param registers BD_REGISTERS object
+ * @return 0 on success, -1 on error (invalid state)
+ *
+ */
+BD_PRIVATE int psr_init_UHD(BD_REGISTERS *, int force);
+
/*
* save / restore registers between playback sessions
More information about the libbluray-devel
mailing list