From 2e171e6221b7a2e21003e0b5b87d5444883bc400 Mon Sep 17 00:00:00 2001 From: ace20022 Date: Wed, 20 Mar 2013 14:33:55 +0100 Subject: [Fix] Fixes dvdnav_audio_stream_format(...). Don't change the audio format numbers, e.g. DTS is 6 not 5, 5 is unknown. --- lib/libdvd/libdvdnav/src/dvdnav.c | 23 ++------------- lib/libdvd/libdvdnav/src/dvdnav/dvdnav.h | 6 ---- ...bdvdnav_correct_dvdnav_audio_stream_format.diff | 33 ++++++++++++++++++++++ .../patches/libdvdnav_remove_unneeded_defines.diff | 15 ++++++++++ 4 files changed, 51 insertions(+), 26 deletions(-) create mode 100644 lib/libdvd/patches/libdvdnav_correct_dvdnav_audio_stream_format.diff create mode 100644 lib/libdvd/patches/libdvdnav_remove_unneeded_defines.diff (limited to 'lib/libdvd') 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 * + *********************************************************************/ -- cgit v1.2.3