changeset 266:21ba13a7b77a src

Implement: uint16_t dvdnav_audio_stream_to_format(dvdnav_t *self, uint8_t stream);
author jcdutton
date Thu, 14 Dec 2006 13:28:07 +0000
parents 99d33725395d
children 5f128d323bb1
files dvdnav.c dvdnav.h
diffstat 2 files changed, 53 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dvdnav.c	Mon Oct 03 21:07:14 2005 +0000
+++ b/dvdnav.c	Thu Dec 14 13:28:07 2006 +0000
@@ -879,6 +879,48 @@
   return attr.lang_code;
 }
 
+uint16_t dvdnav_audio_stream_format(dvdnav_t *this, uint8_t stream) {
+  audio_attr_t  attr;
+  uint16_t format;
+  
+  if(!this) {
+    printerr("Passed a NULL pointer.");
+    return -1; /* 0xffff */
+  }
+  if(!this->started) {
+    printerr("Virtual DVD machine not started.");
+    return -1; /* 0xffff */
+  }
+  
+  pthread_mutex_lock(&this->vm_lock); 
+  attr = vm_get_audio_attr(this->vm, stream);
+  pthread_mutex_unlock(&this->vm_lock); 
+  
+  switch(attr.audio_format) {
+  case 0:
+    format = DVDNAV_FORMAT_AC3;
+    break;
+  case 2: /* MPEG-1 or MPEG-2 without extension bitstream. */
+  case 3: /* MPEG-2 with extension bitstream. */
+    format = DVDNAV_FORMAT_MPEGAUDIO;
+    break;
+  case 4:
+    format = DVDNAV_FORMAT_LPCM;
+    break;
+  case 6:
+    format = DVDNAV_FORMAT_DTS;
+    break;
+  case 7:
+    format = DVDNAV_FORMAT_SDDS;
+    break;
+  default: 
+    format = 0xffff;
+    break;
+  }
+  
+  return format;
+}
+
 uint16_t dvdnav_spu_stream_to_lang(dvdnav_t *this, uint8_t stream) {
   subp_attr_t  attr;
   
--- a/dvdnav.h	Mon Oct 03 21:07:14 2005 +0000
+++ b/dvdnav.h	Thu Dec 14 13:28:07 2006 +0000
@@ -70,6 +70,11 @@
 #define DVDNAV_STATUS_ERR 0
 #define DVDNAV_STATUS_OK  1
 
+#define DVDNAV_FORMAT_AC3 0
+#define DVDNAV_FORMAT_MPEGAUDIO 3
+#define DVDNAV_FORMAT_LPCM 4
+#define DVDNAV_FORMAT_DTS 5
+#define DVDNAV_FORMAT_SDDS 6
 
 /*********************************************************************
  * initialisation & housekeeping functions                           *
@@ -548,6 +553,12 @@
 uint16_t dvdnav_audio_stream_to_lang(dvdnav_t *self, uint8_t stream);
 
 /*
+ * Returns the format of *logical* audio stream 'stream'
+ * (returns 0xffff if no such stream).
+ */
+uint16_t dvdnav_audio_stream_to_format(dvdnav_t *self, uint8_t stream);
+
+/*
  * Converts a *logical* subpicture stream id into country code 
  * (returns 0xffff if no such stream).
  */