changeset 272:baec6f29fb76 src

added dvdnav_audio_stream_channels(); patch by Andreas Oman (andreas olebyn nu)
author nicodvb
date Wed, 11 Apr 2007 19:52:10 +0000
parents 814e79060099
children bd734ab914d0
files dvdnav.c dvdnav.h
diffstat 2 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dvdnav.c	Tue Apr 10 20:50:09 2007 +0000
+++ b/dvdnav.c	Wed Apr 11 19:52:10 2007 +0000
@@ -941,6 +941,26 @@
   return format;
 }
 
+uint16_t dvdnav_audio_stream_channels(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);
+
+  return attr.channels + 1;
+}
+
 uint16_t dvdnav_spu_stream_to_lang(dvdnav_t *this, uint8_t stream) {
   subp_attr_t  attr;
   
--- a/dvdnav.h	Tue Apr 10 20:50:09 2007 +0000
+++ b/dvdnav.h	Wed Apr 11 19:52:10 2007 +0000
@@ -567,6 +567,12 @@
 uint16_t dvdnav_audio_stream_format(dvdnav_t *self, uint8_t stream);
 
 /*
+ * Returns number of channelsn in *logical* audio stream 'stream'
+ * (returns 0xffff if no such stream).
+ */
+uint16_t dvdnav_audio_stream_channels(dvdnav_t *self, uint8_t stream);
+
+/*
  * Converts a *logical* subpicture stream id into country code 
  * (returns 0xffff if no such stream).
  */