aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorace20022 <ace20022@ymail.com>2013-03-20 14:33:55 +0100
committerace20022 <ace20022@ymail.com>2013-03-20 14:37:00 +0100
commit2e171e6221b7a2e21003e0b5b87d5444883bc400 (patch)
tree12852e725f17e1eb45f8583adc5cc8c0cc8cb02f /lib
parente0e12a7b9968c3325031dfe416f2857eefbc9098 (diff)
[Fix] Fixes dvdnav_audio_stream_format(...). Don't change the audio format numbers, e.g. DTS is 6 not 5, 5 is unknown.
Diffstat (limited to 'lib')
-rw-r--r--lib/libdvd/libdvdnav/src/dvdnav.c23
-rw-r--r--lib/libdvd/libdvdnav/src/dvdnav/dvdnav.h6
-rw-r--r--lib/libdvd/patches/libdvdnav_correct_dvdnav_audio_stream_format.diff33
-rw-r--r--lib/libdvd/patches/libdvdnav_remove_unneeded_defines.diff15
4 files changed, 51 insertions, 26 deletions
diff --git a/lib/libdvd/libdvdnav/src/dvdnav.c b/lib/libdvd/libdvdnav/src/dvdnav.c
index b10b61ef2f..6009b37f6c 100644
--- a/lib/libdvd/libdvdnav/src/dvdnav.c
+++ b/lib/libdvd/libdvdnav/src/dvdnav.c
@@ -925,27 +925,10 @@ uint16_t dvdnav_audio_stream_format(dvdnav_t *this, uint8_t stream) {
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:
+ if (attr.audio_format >=0 && attr.audio_format <= 7)
+ format = attr.audio_format;
+ else
format = 0xffff;
- break;
- }
return format;
}
diff --git a/lib/libdvd/libdvdnav/src/dvdnav/dvdnav.h b/lib/libdvd/libdvdnav/src/dvdnav/dvdnav.h
index ae319ef717..359b951aad 100644
--- a/lib/libdvd/libdvdnav/src/dvdnav/dvdnav.h
+++ b/lib/libdvd/libdvdnav/src/dvdnav/dvdnav.h
@@ -63,12 +63,6 @@ typedef int32_t dvdnav_status_t;
#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 *
*********************************************************************/
diff --git a/lib/libdvd/patches/libdvdnav_correct_dvdnav_audio_stream_format.diff b/lib/libdvd/patches/libdvdnav_correct_dvdnav_audio_stream_format.diff
new file mode 100644
index 0000000000..d4e3b776d8
--- /dev/null
+++ b/lib/libdvd/patches/libdvdnav_correct_dvdnav_audio_stream_format.diff
@@ -0,0 +1,33 @@
+--- libdvdnav-4.2.0/src/dvdnav.c Wed Mar 20 11:38:53 2013
++++ lib/libdvd/libdvdnav/src/dvdnav.c Wed Mar 20 13:20:35 2013
+@@ -907,27 +925,10 @@
+ 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:
++ if (attr.audio_format >=0 && attr.audio_format <= 7)
++ format = attr.audio_format;
++ else
+ format = 0xffff;
+- break;
+- }
+
+ return format;
+ }
diff --git a/lib/libdvd/patches/libdvdnav_remove_unneeded_defines.diff b/lib/libdvd/patches/libdvdnav_remove_unneeded_defines.diff
new file mode 100644
index 0000000000..9609dd0312
--- /dev/null
+++ b/lib/libdvd/patches/libdvdnav_remove_unneeded_defines.diff
@@ -0,0 +1,15 @@
+--- libdvdnav-4.2.0/src/dvdnav/dvdnav.h Wed Mar 20 11:38:52 2013
++++ lib/libdvd/libdvdnav/src/dvdnav/dvdnav.h Wed Mar 20 13:19:13 2013
+@@ -63,12 +63,6 @@
+ #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 *
+ *********************************************************************/