[libdvdnav-devel] [Git][videolan/libdvdnav][master] add dvdnav_get_disk_region_mask

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sun May 8 17:18:06 UTC 2022



Jean-Baptiste Kempf pushed to branch master at VideoLAN / libdvdnav


Commits:
777763e6 by Miguel Borges de Freitas at 2022-05-08T17:17:00+00:00
add dvdnav_get_disk_region_mask

Provides a way of getting the reported region mask advertised by the
current disk. Can be used to set the region code of the virtual machine
via dvdnav_set_region_mask

- - - - -


2 changed files:

- src/dvdnav.c
- src/dvdnav/dvdnav.h


Changes:

=====================================
src/dvdnav.c
=====================================
@@ -1335,6 +1335,19 @@ dvdnav_status_t dvdnav_get_angle_info(dvdnav_t *this, int32_t *current_angle,
   return DVDNAV_STATUS_OK;
 }
 
+dvdnav_status_t dvdnav_get_disk_region_mask(dvdnav_t *this, int32_t *region_mask) {
+  pthread_mutex_lock(&this->vm_lock);
+  if (!this->vm || !this->vm->vmgi || !this->vm->vmgi->vmgi_mat) {
+    printerr("Bad VM state.");
+    pthread_mutex_unlock(&this->vm_lock);
+    return DVDNAV_STATUS_ERR;
+  }
+
+  (*region_mask) = ((this->vm->vmgi->vmgi_mat->vmg_category >> 16) & 0xff) ^ 0xff;
+  pthread_mutex_unlock(&this->vm_lock);
+  return DVDNAV_STATUS_OK;
+}
+
 pci_t* dvdnav_get_current_nav_pci(dvdnav_t *this) {
   if(!this) return 0;
   return &this->pci;


=====================================
src/dvdnav/dvdnav.h
=====================================
@@ -279,6 +279,19 @@ uint32_t dvdnav_get_next_still_flag(dvdnav_t *self);
  */
 dvdnav_status_t dvdnav_stop(dvdnav_t *self);
 
+/*
+ * Returns the region mask (bit 0 set implies region 1, bit 1 set implies
+ * region 2, etc) reported by the dvd disc being played.
+ *
+ * Note this has no relation with the region setting of the DVD drive.
+ * Old DVD drives (RPC-I) used to delegate most of the RCE handling to the CPU and
+ * will actually call the virtual machine (VM) for its region setting. In those cases,
+ * changing the VM region mask via dvdnav_set_region_mask() will circunvent
+ * the region protection scheme. This is no longer the case with more recent (RPC-II) drives
+ * as RCE is handled internally by the drive firmware.
+ *
+ */
+dvdnav_status_t dvdnav_get_disk_region_mask(dvdnav_t *self, int32_t *region_mask);
 
 /*********************************************************************
  * title/part navigation                                             *



View it on GitLab: https://code.videolan.org/videolan/libdvdnav/-/commit/777763e6c8be886d1d268a9c1ef41d0c6b0018d8

-- 
View it on GitLab: https://code.videolan.org/videolan/libdvdnav/-/commit/777763e6c8be886d1d268a9c1ef41d0c6b0018d8
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the libdvdnav-devel mailing list