[libbluray-devel] HDMV JUMP_TITLE should discard, not restore backup registers
npzacs
git at videolan.org
Thu Apr 21 13:57:59 CEST 2011
libbluray | branch: master | npzacs <npzacs at gmail.com> | Thu Apr 21 13:00:15 2011 +0300| [7b5fd34f6f3bfdef3e4b5f2df65ca5de5be55ebc] | committer: npzacs
HDMV JUMP_TITLE should discard, not restore backup registers
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=7b5fd34f6f3bfdef3e4b5f2df65ca5de5be55ebc
---
src/libbluray/hdmv/hdmv_vm.c | 8 +++-----
src/libbluray/register.c | 11 +++++++++++
src/libbluray/register.h | 10 ++++++++++
3 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/src/libbluray/hdmv/hdmv_vm.c b/src/libbluray/hdmv/hdmv_vm.c
index aebd507..f20bef9 100644
--- a/src/libbluray/hdmv/hdmv_vm.c
+++ b/src/libbluray/hdmv/hdmv_vm.c
@@ -341,11 +341,9 @@ static int _jump_title(HDMV_VM *p, int title)
if (title >= 0 && title <= 0xffff) {
BD_DEBUG(DBG_HDMV, "_jump_title(%d)\n", title);
- if (p->suspended_object) {
- /* discard suspended object */
- p->suspended_object = NULL;
- bd_psr_restore_state(p->regs);
- }
+ /* discard suspended object */
+ p->suspended_object = NULL;
+ bd_psr_reset_backup_registers(p->regs);
_queue_event(p, HDMV_EVENT_TITLE, title);
return 0;
diff --git a/src/libbluray/register.c b/src/libbluray/register.c
index a4b97ea..07032f8 100644
--- a/src/libbluray/register.c
+++ b/src/libbluray/register.c
@@ -255,6 +255,17 @@ void bd_psr_save_state(BD_REGISTERS *p)
bd_psr_unlock(p);
}
+void bd_psr_reset_backup_registers(BD_REGISTERS *p)
+{
+ bd_psr_lock(p);
+
+ /* init backup registers to default */
+ memcpy(p->psr + 36, bd_psr_init + 36, sizeof(uint32_t) * 5);
+ memcpy(p->psr + 42, bd_psr_init + 42, sizeof(uint32_t) * 3);
+
+ bd_psr_unlock(p);
+}
+
void bd_psr_restore_state(BD_REGISTERS *p)
{
uint32_t old_psr[BD_PSR_COUNT];
diff --git a/src/libbluray/register.h b/src/libbluray/register.h
index 2d73031..6259907 100644
--- a/src/libbluray/register.h
+++ b/src/libbluray/register.h
@@ -189,6 +189,16 @@ void bd_psr_save_state(BD_REGISTERS *);
*/
void bd_psr_restore_state(BD_REGISTERS *);
+/**
+ *
+ * Reset backup registers
+ *
+ * Initialize backup registers 36-40 and 42-44 to default values.
+ *
+ * @param registers BD_REGISTERS object
+ */
+void bd_psr_reset_backup_registers(BD_REGISTERS *);
+
/*
* Events when PSR value is changed
More information about the libbluray-devel
mailing list