[DVDnav-discuss] [PATCH] Fix dvdnav_audio_stream_format(...)
Erik Hovland
erik at hovland.org
Thu Mar 21 23:16:57 CET 2013
On Thu, Mar 21, 2013 at 2:58 AM, Andi <ace20022 at ymail.com> wrote:
> Hello,
>
> the first patch fixes the return of wrong audio format numbers.
>
> Imo this could be simplified to directly return attr.audio_format, since audio_format is defined to have just 3 bits
>
> and therefore the if condition is always true...
Feel free to combine these patches. As separate patches, if one is applied but
the other isn't the code will no longer compile.
The only issue I have w/ this patch is that in the instance of 1 and 5
the caller
will now get a different value then they did before. I would be more inclined to
use the new enums in dvd_types.h, but returned the same values. I can see
why you would like to return something more "correct" for 5 though.
E
diff --git a/src/dvdnav.c b/src/dvdnav.c
index f6ac065..c47c580 100644
--- a/src/dvdnav.c
+++ b/src/dvdnav.c
@@ -972,20 +972,20 @@ uint16_t dvdnav_audio_stream_format(dvdnav_t
*this, uint8_t stream) {
switch(attr.audio_format) {
case 0:
- format = DVDNAV_FORMAT_AC3;
+ format = DVD_AUDIO_FORMAT_AC3;
break;
case 2: /* MPEG-1 or MPEG-2 without extension bitstream. */
case 3: /* MPEG-2 with extension bitstream. */
- format = DVDNAV_FORMAT_MPEGAUDIO;
+ format = DVD_AUDIO_FORMAT_MPEG2_EXT;
break;
case 4:
- format = DVDNAV_FORMAT_LPCM;
+ format = DVD_AUDIO_FORMAT_LPCM;
break;
case 6:
- format = DVDNAV_FORMAT_DTS;
+ format = DVD_AUDIO_FORMAT_DTS;
break;
case 7:
- format = DVDNAV_FORMAT_SDDS;
+ format = DVD_AUDIO_FORMAT_SDDS;
break;
default:
format = 0xffff;
diff --git a/src/dvdnav/dvdnav.h b/src/dvdnav/dvdnav.h
index 1bc1618..167a829 100644
--- a/src/dvdnav/dvdnav.h
+++ b/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 *
*********************************************************************/
--
Erik Hovland
erik at hovland.org
http://hovland.org/
More information about the DVDnav-discuss
mailing list