Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: vdr-dvd-0.3.3-jau-p8 (+subtitle +... +fixes)



On Wednesday 08 October 2003 6:50 pm, Sven Goethel wrote:

[...]

> so .. send the patch to this ML,
> and i will compile a new set to ask the dvdnav staff for approval.

and here it is ....

Andreas
Index: src/dvdnav.c
===================================================================
RCS file: /data/dvd/libdvdnav/src/dvdnav.c,v
retrieving revision 1.60
diff -u -r1.60 dvdnav.c
--- src/dvdnav.c	13 May 2003 20:24:45 -0000	1.60
+++ src/dvdnav.c	8 Oct 2003 19:37:36 -0000
@@ -980,6 +980,34 @@
   return retval;
 }
 
+static int dvdnav_assert(dvdnav_t *this) {
+
+  if(!this) {
+    printerr("Passed a NULL pointer.");
+    return DVDNAV_STATUS_ERR;
+  }
+  if(!this->started) {
+    printerr("Virtual DVD machine not started.");
+    return DVDNAV_STATUS_ERR;
+  }
+  return DVDNAV_STATUS_OK;
+}
+
+dvdnav_status_t dvdnav_set_active_audio_stream(dvdnav_t *this, int audio) {
+  int ret = DVDNAV_STATUS_ERR;
+  int r;
+
+  if (dvdnav_assert(this) == DVDNAV_STATUS_OK) {
+      pthread_mutex_lock(&this->vm_lock);
+      if ((r = vm_set_audio_active_stream(this->vm, audio)) == audio) {
+	  this->position_current.audio_channel = -1; /* Force an update */
+	  ret = DVDNAV_STATUS_OK;
+      }
+      pthread_mutex_unlock(&this->vm_lock);
+  }
+  return ret;
+}
+
 int8_t dvdnav_get_active_spu_stream(dvdnav_t *this) {
   int8_t        retval;
 
@@ -1004,6 +1032,81 @@
   return retval;
 }
 
+dvdnav_status_t dvdnav_set_active_spu_stream(dvdnav_t *this, int subp) {
+  int ret = DVDNAV_STATUS_ERR;
+  int r;
+
+  if (dvdnav_assert(this) == DVDNAV_STATUS_OK) {
+      pthread_mutex_lock(&this->vm_lock);
+      if ((r = vm_set_subp_active_stream(this->vm, subp)) == subp) {
+	  this->position_current.spu_channel = -1; /* Force an update */
+	  ret = DVDNAV_STATUS_OK;
+      }
+      pthread_mutex_unlock(&this->vm_lock);
+  }
+  return ret;
+}
+
+video_attr_t dvdnav_get_video_attr(dvdnav_t *this) {
+  video_attr_t ret;
+    
+  memset(&ret, 0, sizeof(ret));
+  if (dvdnav_assert(this) == DVDNAV_STATUS_OK) {
+      pthread_mutex_lock(&this->vm_lock);
+      ret = vm_get_video_attr(this->vm);
+      pthread_mutex_unlock(&this->vm_lock);
+  }
+  return ret;
+}
+
+audio_attr_t dvdnav_get_audio_attr(dvdnav_t *this, int streamN) {
+  audio_attr_t ret;
+    
+  memset(&ret, 0, sizeof(ret));
+  if (dvdnav_assert(this) == DVDNAV_STATUS_OK) {
+      pthread_mutex_lock(&this->vm_lock);
+      ret = vm_get_audio_attr(this->vm, streamN);
+      pthread_mutex_unlock(&this->vm_lock);
+  }
+  return ret;
+}
+
+subp_attr_t  dvdnav_get_subp_attr(dvdnav_t *this, int streamN) {
+  subp_attr_t ret;
+    
+  memset(&ret, 0, sizeof(ret));
+  if (dvdnav_assert(this) == DVDNAV_STATUS_OK) {
+      pthread_mutex_lock(&this->vm_lock);
+      ret = vm_get_subp_attr(this->vm, streamN);
+      pthread_mutex_unlock(&this->vm_lock);
+  }
+  return ret;
+}
+
+int dvdnav_get_audio_num_avail(dvdnav_t *this) {
+  int ret;
+    
+  ret = 0;
+  if (dvdnav_assert(this) == DVDNAV_STATUS_OK) {
+      pthread_mutex_lock(&this->vm_lock);
+      ret = vm_get_audio_num_avail(this->vm);
+      pthread_mutex_unlock(&this->vm_lock);
+  }
+  return ret;
+}
+
+int dvdnav_get_subp_num_avail(dvdnav_t *this) {
+  int ret;
+    
+  ret = 0;
+  if (dvdnav_assert(this) == DVDNAV_STATUS_OK) {
+      pthread_mutex_lock(&this->vm_lock);
+      ret = vm_get_subp_num_avail(this->vm);
+      pthread_mutex_unlock(&this->vm_lock);
+  }
+  return ret;
+}
+
 static int8_t dvdnav_is_domain(dvdnav_t *this, domain_t domain) {
   int8_t        retval;
   
Index: src/dvdnav.h
===================================================================
RCS file: /data/dvd/libdvdnav/src/dvdnav.h,v
retrieving revision 1.31
diff -u -r1.31 dvdnav.h
--- src/dvdnav.h	9 Jun 2003 15:17:44 -0000	1.31
+++ src/dvdnav.h	8 Oct 2003 19:04:58 -0000
@@ -569,10 +569,29 @@
 int8_t dvdnav_get_active_audio_stream(dvdnav_t *self);
 
 /*
+ * Set active audio stream.
+ */
+dvdnav_status_t dvdnav_set_active_audio_stream(dvdnav_t *self, int audio);
+
+/*
  * Get active spu stream.
  */
 int8_t dvdnav_get_active_spu_stream(dvdnav_t *self);
 
+/*
+ * Set active spu stream.
+ */
+dvdnav_status_t dvdnav_set_active_spu_stream(dvdnav_t *self, int subp);
+
+/*
+ * get stream attributes
+ */
+video_attr_t dvdnav_get_video_attr(dvdnav_t *self);
+audio_attr_t dvdnav_get_audio_attr(dvdnav_t *self, int streamN);
+subp_attr_t  dvdnav_get_subp_attr(dvdnav_t *self, int streamN);
+ 
+int dvdnav_get_audio_num_avail(dvdnav_t *self);
+int dvdnav_get_subp_num_avail(dvdnav_t *self);
 
 /*********************************************************************
  * multiple angles                                                   *
Index: src/vm.c
===================================================================
RCS file: /data/dvd/libdvdnav/src/vm.c,v
retrieving revision 1.63
diff -u -r1.63 vm.c
--- src/vm.c	3 Aug 2003 09:40:58 -0000	1.63
+++ src/vm.c	8 Oct 2003 19:37:55 -0000
@@ -737,6 +737,12 @@
   return streamN;
 }
 
+int vm_set_audio_active_stream(vm_t *vm, int audioN) {
+  if((vm->state).pgc->audio_control[audioN] & (1<<15))
+    (vm->state).AST_REG = audioN;
+  return (vm->state).AST_REG;
+}
+
 int vm_get_subp_active_stream(vm_t *vm, int mode) {
   int subpN;
   int streamN;
@@ -760,6 +766,12 @@
     return streamN;
 }
 
+int vm_set_subp_active_stream(vm_t *vm, int subpN) {
+  if((vm->state).pgc->subp_control[subpN] & (1<<31))
+    (vm->state).SPST_REG = subpN;
+  return (vm->state).SPST_REG;
+}
+
 void vm_get_angle_info(vm_t *vm, int *current, int *num_avail) {
   *num_avail = 1;
   *current = 1;
@@ -778,6 +790,32 @@
   }
 }
 
+int vm_get_audio_num_avail(vm_t *vm) {
+  switch ((vm->state).domain) {
+  case VTS_DOMAIN:
+    return vm->vtsi->vtsi_mat->nr_of_vts_audio_streams;
+  case VTSM_DOMAIN:
+    return vm->vtsi->vtsi_mat->nr_of_vtsm_audio_streams; /*  1 */
+  case VMGM_DOMAIN:
+  case FP_DOMAIN:
+    return vm->vmgi->vmgi_mat->nr_of_vmgm_audio_streams; /*  1 */
+  }
+  return 0;
+}
+
+int vm_get_subp_num_avail(vm_t *vm) {
+  switch ((vm->state).domain) {
+  case VTS_DOMAIN:
+    return vm->vtsi->vtsi_mat->nr_of_vts_subp_streams;
+  case VTSM_DOMAIN:
+    return vm->vtsi->vtsi_mat->nr_of_vtsm_subp_streams; /*  1 */
+  case VMGM_DOMAIN:
+  case FP_DOMAIN:
+    return vm->vmgi->vmgi_mat->nr_of_vmgm_subp_streams; /*  1 */
+  }
+  return 0;
+}
+
 #if 0
 /* currently unused */
 void vm_get_audio_info(vm_t *vm, int *current, int *num_avail) {
Index: src/vm.h
===================================================================
RCS file: /data/dvd/libdvdnav/src/vm.h,v
retrieving revision 1.21
diff -u -r1.21 vm.h
--- src/vm.h	27 Jun 2003 13:41:42 -0000	1.21
+++ src/vm.h	8 Oct 2003 19:32:19 -0000
@@ -158,7 +158,9 @@
 int vm_get_audio_stream(vm_t *vm, int audioN);
 int vm_get_subp_stream(vm_t *vm, int subpN, int mode);
 int vm_get_audio_active_stream(vm_t *vm);
+int vm_set_audio_active_stream(vm_t *vm, int audioN);
 int vm_get_subp_active_stream(vm_t *vm, int mode);
+int vm_set_subp_active_stream(vm_t *vm, int subpN);
 void vm_get_angle_info(vm_t *vm, int *current, int *num_avail);
 #if 0
 /* currently unused */
@@ -172,6 +174,9 @@
 audio_attr_t vm_get_audio_attr(vm_t *vm, int streamN);
 subp_attr_t  vm_get_subp_attr(vm_t *vm, int streamN);
 
+int vm_get_audio_num_avail(vm_t *vm);
+int vm_get_subp_num_avail(vm_t *vm);
+
 #ifdef TRACE
 /* Debug */
 void vm_position_print(vm_t *vm, vm_position_t *position);

Home | Main Index | Thread Index