changeset 55:5674fbd44f26 src

report all spu types (widescreen, letterbox and pan&scan), not widescreen only and report the stream's scale permissions to detect pan&scan material
author mroi
date Fri, 05 Jul 2002 14:18:55 +0000
parents cea44c0d638a
children 507b86c503d1
files dvdnav.c dvdnav.h dvdnav_events.h vm.c vm.h
diffstat 5 files changed, 88 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/dvdnav.c	Fri Jul 05 01:42:30 2002 +0000
+++ b/dvdnav.c	Fri Jul 05 14:18:55 2002 +0000
@@ -102,7 +102,7 @@
   if(subp_num >= vtsi->vtsi_mat->nr_of_vts_subp_streams)
     return -1;
   
-  return vm_get_subp_stream(this->vm, subp_num);
+  return vm_get_subp_stream(this->vm, subp_num, 0);
 }
 
 static int8_t NLCK_dvdnav_get_active_spu_stream(dvdnav_t *this) {
@@ -134,6 +134,16 @@
   return retval;
 }
 
+uint8_t dvdnav_get_video_scale_permission(dvdnav_t *this) {
+  uint8_t         retval;
+  
+  pthread_mutex_lock(&this->vm_lock); 
+  retval = (uint8_t) vm_get_video_scale_permission(this->vm);
+  pthread_mutex_unlock(&this->vm_lock); 
+  
+  return retval;
+}
+
 dvdnav_status_t dvdnav_clear(dvdnav_t * this) {
   if (!this) {
     printerr("Passed a NULL pointer");
@@ -553,14 +563,16 @@
   }
   
   if(this->position_current.spu_channel != this->position_next.spu_channel) {
-    dvdnav_stream_change_event_t stream_change;
+    dvdnav_spu_stream_change_event_t stream_change;
     (*event) = DVDNAV_SPU_STREAM_CHANGE;
 #ifdef LOG_DEBUG
     fprintf(stderr,"libdvdnav:SPU_STREAM_CHANGE\n");
 #endif
-    (*len) = sizeof(dvdnav_stream_change_event_t);
-    stream_change.physical = vm_get_subp_active_stream( this->vm );
-    memcpy(buf, &(stream_change), sizeof( dvdnav_stream_change_event_t));
+    (*len) = sizeof(dvdnav_spu_stream_change_event_t);
+    stream_change.physical_wide = vm_get_subp_active_stream(this->vm, 0);
+    stream_change.physical_letterbox = vm_get_subp_active_stream(this->vm, 1);
+    stream_change.physical_pan_scan = vm_get_subp_active_stream(this->vm, 2);
+    memcpy(buf, &(stream_change), sizeof( dvdnav_spu_stream_change_event_t));
     this->position_current.spu_channel = this->position_next.spu_channel;
 #ifdef LOG_DEBUG
     fprintf(stderr,"libdvdnav:SPU_STREAM_CHANGE stream_id=%d returning S_OK\n",stream_change.physical);
@@ -570,14 +582,14 @@
   }
   
   if(this->position_current.audio_channel != this->position_next.audio_channel) {
-    dvdnav_stream_change_event_t stream_change;
+    dvdnav_audio_stream_change_event_t stream_change;
     (*event) = DVDNAV_AUDIO_STREAM_CHANGE;
 #ifdef LOG_DEBUG
     fprintf(stderr,"libdvdnav:AUDIO_STREAM_CHANGE\n");
 #endif
-    (*len) = sizeof(dvdnav_stream_change_event_t);
+    (*len) = sizeof(dvdnav_audio_stream_change_event_t);
     stream_change.physical= vm_get_audio_active_stream( this->vm );
-    memcpy(buf, &(stream_change), sizeof( dvdnav_stream_change_event_t));
+    memcpy(buf, &(stream_change), sizeof( dvdnav_audio_stream_change_event_t));
     this->position_current.audio_channel = this->position_next.audio_channel;
 #ifdef LOG_DEBUG
     fprintf(stderr,"libdvdnav:AUDIO_STREAM_CHANGE stream_id=%d returning S_OK\n",stream_change.physical);
@@ -942,6 +954,10 @@
 
 /*
  * $Log$
+ * Revision 1.25  2002/07/05 14:18:54  mroi
+ * report all spu types (widescreen, letterbox and pan&scan), not widescreen
+ * only and report the stream's scale permissions to detect pan&scan material
+ *
  * Revision 1.24  2002/07/05 01:42:30  jcdutton
  * Add more debug info for Menu language selection.
  * Only do vm_start when we have to.
--- a/dvdnav.h	Fri Jul 05 01:42:30 2002 +0000
+++ b/dvdnav.h	Fri Jul 05 14:18:55 2002 +0000
@@ -217,6 +217,15 @@
 uint8_t dvdnav_get_video_aspect(dvdnav_t *self);
 
 /**
+ * Get video scaling permissions.
+ *
+ * \param self Pointer to dvdnav_t associated with this operation.
+ * 
+ * \returns Video scaling permissions, bit0 - deny letterboxing, bit1 - deny pan&scan
+ */
+uint8_t dvdnav_get_video_scale_permission(dvdnav_t *self);
+
+/**
  * @}
  */
 
--- a/dvdnav_events.h	Fri Jul 05 01:42:30 2002 +0000
+++ b/dvdnav_events.h	Fri Jul 05 14:18:55 2002 +0000
@@ -64,12 +64,22 @@
 } dvdnav_still_event_t;
 
 /**
- * Structure providing information on DVDNAV_*_STREAM_CHANGE events.
+ * Structure providing information on DVDNAV_SPU_STREAM_CHANGE events.
+ */
+typedef struct {
+  int physical_wide; /*!< The physical (MPEG) stream number for widescreen display. */
+  int physical_letterbox; /*!< The physical (MPEG) stream number for letterboxed display. */
+  int physical_pan_scan; /*!< The physical (MPEG) stream number for pan&scan display. */
+  int logical;  /*!< The logical (DVD) stream number.   */
+} dvdnav_spu_stream_change_event_t;
+
+/**
+ * Structure providing information on DVDNAV_AUDIO_STREAM_CHANGE events.
  */
 typedef struct {
   int physical; /*!< The physical (MPEG) stream number. */
   int logical;  /*!< The logical (DVD) stream number.   */
-} dvdnav_stream_change_event_t;
+} dvdnav_audio_stream_change_event_t;
 
 /**
  * Structure providing information on DVDNAV_VTS_CHANGE events.
--- a/vm.c	Fri Jul 05 01:42:30 2002 +0000
+++ b/vm.c	Fri Jul 05 14:18:55 2002 +0000
@@ -582,10 +582,13 @@
 }
 
 /**
- * Return the substream id for 'logical' subpicture stream subpN.
+ * Return the substream id for 'logical' subpicture stream subpN and given mode.
  * 0 <= subpN < 32
+ * mode == 0 - widescreen
+ * mode == 1 - letterbox
+ * mode == 2 - pan&scan
  */
-int vm_get_subp_stream(vm_t *vm, int subpN)
+int vm_get_subp_stream(vm_t *vm, int subpN, int mode)
 {
   int streamN = -1;
   int source_aspect = vm_get_video_aspect(vm);
@@ -602,7 +605,16 @@
       if(source_aspect == 0) /* 4:3 */	     
 	streamN = ((vm->state).pgc->subp_control[subpN] >> 24) & 0x1f;  
       if(source_aspect == 3) /* 16:9 */
-	streamN = ((vm->state).pgc->subp_control[subpN] >> 16) & 0x1f;
+        switch (mode) {
+	case 0:
+	  streamN = ((vm->state).pgc->subp_control[subpN] >> 16) & 0x1f;
+	  break;
+	case 1:
+	  streamN = ((vm->state).pgc->subp_control[subpN] >> 8) & 0x1f;
+	  break;
+	case 2:
+	  streamN = (vm->state).pgc->subp_control[subpN] & 0x1f;
+	}
     }
   }
   
@@ -619,19 +631,19 @@
   return streamN;
 }
 
-int vm_get_subp_active_stream(vm_t *vm)
+int vm_get_subp_active_stream(vm_t *vm, int mode)
 {
   int subpN;
   int streamN;
   subpN = (vm->state).SPST_REG & ~0x40;
-  streamN = vm_get_subp_stream(vm, subpN);
+  streamN = vm_get_subp_stream(vm, subpN, mode);
   
   /* If no such stream, then select the first one that exists. */
   if(streamN == -1) {
     for(subpN = 0; subpN < 32; subpN++) {
       if((vm->state).pgc->subp_control[subpN] & (1<<31)) {
       
-        streamN = vm_get_subp_stream(vm, subpN);
+        streamN = vm_get_subp_stream(vm, subpN, mode);
         break;
       }
     }
@@ -1672,6 +1684,24 @@
   return aspect;
 }
 
+int vm_get_video_scale_permission(vm_t *vm)
+{
+  int permission = 0;
+  
+  if((vm->state).domain == VTS_DOMAIN) {
+    permission = vm->vtsi->vtsi_mat->vts_video_attr.permitted_df;
+  } else if((vm->state).domain == VTSM_DOMAIN) {
+    permission = vm->vtsi->vtsi_mat->vtsm_video_attr.permitted_df;
+  } else if((vm->state).domain == VMGM_DOMAIN) {
+    permission = vm->vmgi->vmgi_mat->vmgm_video_attr.permitted_df;
+  }
+#ifdef TRACE
+  fprintf(stderr, "dvdnav:get_video_scale_permission:permission=%d\n",permission);
+#endif
+  
+  return permission;
+}
+
 static void ifoOpenNewVTSI(vm_t *vm, dvd_reader_t *dvd, int vtsN) 
 {
   if((vm->state).vtsN == vtsN) {
@@ -1768,6 +1798,10 @@
 
 /*
  * $Log$
+ * Revision 1.24  2002/07/05 14:18:55  mroi
+ * report all spu types (widescreen, letterbox and pan&scan), not widescreen
+ * only and report the stream's scale permissions to detect pan&scan material
+ *
  * Revision 1.23  2002/07/05 01:42:30  jcdutton
  * Add more debug info for Menu language selection.
  * Only do vm_start when we have to.
--- a/vm.h	Fri Jul 05 01:42:30 2002 +0000
+++ b/vm.h	Fri Jul 05 14:18:55 2002 +0000
@@ -139,8 +139,8 @@
 int vm_prev_pg(vm_t *vm);
 int vm_get_audio_stream(vm_t *vm, int audioN);
 int vm_get_audio_active_stream(vm_t *vm);
-int vm_get_subp_stream(vm_t *vm, int subpN);
-int vm_get_subp_active_stream(vm_t *vm);
+int vm_get_subp_stream(vm_t *vm, int subpN, int mode);
+int vm_get_subp_active_stream(vm_t *vm, int mode);
 void vm_get_angle_info(vm_t *vm, int *num_avail, int *current);
 void vm_get_audio_info(vm_t *vm, int *num_avail, int *current);
 void vm_get_subp_info(vm_t *vm, int *num_avail, int *current);
@@ -148,6 +148,7 @@
 audio_attr_t vm_get_audio_attr(vm_t *vm, int streamN);
 void vm_get_video_res(vm_t *vm, int *width, int *height);
 int vm_get_video_aspect(vm_t *vm);
+int vm_get_video_scale_permission(vm_t *vm);
 
 #endif /* VM_HV_INCLUDED */