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

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat May 7 13:23:27 UTC 2022



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


Commits:
2d23b75e by Miguel Borges de Freitas at 2022-03-21T11:02:02+00:00
add dvdnav_toggle_spu_stream

Allows the client application to enable/disable the state of the current
spu stream.

- - - - -


2 changed files:

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


Changes:

=====================================
src/dvdnav.c
=====================================
@@ -1252,6 +1252,29 @@ int8_t dvdnav_get_active_spu_stream(dvdnav_t *this) {
   return retval;
 }
 
+dvdnav_status_t dvdnav_toggle_spu_stream(dvdnav_t *this, uint8_t visibility) {
+  if(!this->started) {
+    printerr("Virtual DVD machine not started.");
+    return DVDNAV_STATUS_ERR;
+  }
+
+  pthread_mutex_lock(&this->vm_lock);
+  switch(visibility) {
+  case 0: /* disable */
+    this->vm->state.SPST_REG &= ~0x40;
+    break;
+  case 1:  /* enable */
+    this->vm->state.SPST_REG |= 0x40;
+    break;
+  default:
+    printerr("Invalid provided enabled_flag value");
+    pthread_mutex_unlock(&this->vm_lock);
+    return DVDNAV_STATUS_ERR;
+  }
+  pthread_mutex_unlock(&this->vm_lock);
+  return DVDNAV_STATUS_OK;
+}
+
 static int8_t dvdnav_is_domain(dvdnav_t *this, DVDDomain_t domain) {
   int8_t        retval;
 


=====================================
src/dvdnav/dvdnav.h
=====================================
@@ -679,6 +679,17 @@ user_ops_t dvdnav_get_restrictions(dvdnav_t *self);
 int8_t dvdnav_get_number_of_streams(dvdnav_t *self, dvdnav_stream_type_t stream_type);
 
 
+/*********************************************************************
+ * setting stream attributes                                         *
+ *********************************************************************/
+
+/*
+ * Set the visible (enable) status of the current spu stream
+ * (to enable/disable subtitles)
+ * visibility defines if the spu stream should be enabled/visible (1) or disabled (0)
+ */
+dvdnav_status_t dvdnav_toggle_spu_stream(dvdnav_t *self, uint8_t visibility);
+
 /*********************************************************************
  * multiple angles                                                   *
  *********************************************************************/



View it on GitLab: https://code.videolan.org/videolan/libdvdnav/-/commit/2d23b75ea40f55658fe0c1f2fa52d380f3424f18

-- 
View it on GitLab: https://code.videolan.org/videolan/libdvdnav/-/commit/2d23b75ea40f55658fe0c1f2fa52d380f3424f18
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