changeset 44:c50cb59dbb19 src

Add dvd menu language selection api. from Michael Roitzsch <mroi@users.sourceforge.net>
author jcdutton
date Sat, 15 Jun 2002 02:10:18 +0000
parents 0ba15bf3dc25
children 7bf97b8922b4
files dvdnav.h settings.c
diffstat 2 files changed, 51 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dvdnav.h	Thu Jun 06 15:03:09 2002 +0000
+++ b/dvdnav.h	Sat Jun 15 02:10:18 2002 +0000
@@ -551,7 +551,7 @@
  */
 
 /** 
- * \defgroup languages Menu Languages
+ * \defgroup languages Languages
  *
  * @{
  */
@@ -562,7 +562,25 @@
  * \param self Pointer to dvdnav_t associated with this operation.
  * \param code 2 char ISO639 Language code in a C-style string.
  */
-dvdnav_status_t dvdnav_menu_languge_select(dvdnav_t *self,
+dvdnav_status_t dvdnav_menu_language_select(dvdnav_t *self,
+					   char *code);
+
+/**
+ * Set which audio language we should use.
+ *
+ * \param self Pointer to dvdnav_t associated with this operation.
+ * \param code 2 char ISO639 Language code in a C-style string.
+ */
+dvdnav_status_t dvdnav_audio_language_select(dvdnav_t *self,
+					    char *code);
+
+/**
+ * Set which spu language we should use.
+ *
+ * \param self Pointer to dvdnav_t associated with this operation.
+ * \param code 2 char ISO639 Language code in a C-style string.
+ */
+dvdnav_status_t dvdnav_spu_language_select(dvdnav_t *self,
 					  char *code);
 
 /**
--- a/settings.c	Thu Jun 06 15:03:09 2002 +0000
+++ b/settings.c	Sat Jun 15 02:10:18 2002 +0000
@@ -87,3 +87,34 @@
   return S_OK;
 }
 
+static dvdnav_status_t set_language_register(dvdnav_t *this, char *code, int reg) {
+  if(!this)
+    return S_ERR;
+    
+  if(!code[0] || !code[1]) {
+    printerr("Passed illegal language code");
+    return S_ERR;
+  }
+  
+  if(!this->vm) {
+    printerr("VM not yet initialised");
+    return S_ERR;
+  }
+  
+  pthread_mutex_lock(&this->vm_lock);
+  this->vm->state.registers.SPRM[reg] = (code[0] << 8) | code[1];
+  pthread_mutex_unlock(&this->vm_lock);
+  return S_OK;
+}
+
+dvdnav_status_t dvdnav_menu_language_select(dvdnav_t *this, char *code) {
+  return set_language_register(this, code, 0);
+}
+
+dvdnav_status_t dvdnav_audio_language_select(dvdnav_t *this, char *code) {
+  return set_language_register(this, code, 16);
+}
+
+dvdnav_status_t dvdnav_spu_language_select(dvdnav_t *this, char *code) {
+  return set_language_register(this, code, 18);
+}