From 4d4b2b7f18284d43935fa928b7d0cc73ddb7920b Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Mon, 20 May 2002 05:55:44 +0000 Subject: [PATCH] minor changes to some defines/globals --- include/FLAC/format.h | 18 +++++++++++++++--- src/libFLAC/format.c | 2 -- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/include/FLAC/format.h b/include/FLAC/format.h index e368fc3..141c8a1 100644 --- a/include/FLAC/format.h +++ b/include/FLAC/format.h @@ -56,12 +56,20 @@ extern const FLAC__byte FLAC__STREAM_SYNC_STRING[4]; /* = "fLaC" */; extern const unsigned FLAC__STREAM_SYNC; /* = 0x664C6143 */; extern const unsigned FLAC__STREAM_SYNC_LEN; /* = 32 bits */; +#define FLAC__STREAM_SYNC_LENGTH (4u) + /***************************************************************************** * * NOTE: Within the bitstream, all fixed-width numbers are big-endian coded. * All numbers are unsigned unless otherwise noted. * + * NOTE: It's not the best convention, but symbols ending in _LEN are in bits + * and _LENGTH are in bytes. _LENGTH symbols are #defines instead of + * global variables because they are usually when declaring arrays and + * some compilers require compile-time knowledge of array sizes when + * declared on the stack. + * *****************************************************************************/ @@ -378,7 +386,8 @@ extern const unsigned FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN; /* = 3 bits extern const unsigned FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN; /* = 5 bits */ extern const unsigned FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN; /* = 36 bits */ extern const unsigned FLAC__STREAM_METADATA_STREAMINFO_MD5SUM_LEN; /* = 128 bits */ -extern const unsigned FLAC__STREAM_METADATA_STREAMINFO_LENGTH; /* = 34 bytes */ + +#define FLAC__STREAM_METADATA_STREAMINFO_LENGTH (34u) /***************************************************************************** * @@ -422,7 +431,8 @@ typedef struct { extern const unsigned FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN; /* = 64 bits */ extern const unsigned FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN; /* = 64 bits */ extern const unsigned FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN; /* = 16 bits */ -extern const unsigned FLAC__STREAM_METADATA_SEEKPOINT_LENGTH; /* = 18 bytes */ + +#define FLAC__STREAM_METADATA_SEEKPOINT_LENGTH (18u) extern const FLAC__uint64 FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER; /* = 0xffffffffffffffff */ @@ -495,10 +505,12 @@ typedef struct { } data; } FLAC__StreamMetaData; -extern const unsigned FLAC__STREAM_METADATA_IS_LAST_LEN; /* = 1 bits */ +extern const unsigned FLAC__STREAM_METADATA_IS_LAST_LEN; /* = 1 bit */ extern const unsigned FLAC__STREAM_METADATA_TYPE_LEN; /* = 7 bits */ extern const unsigned FLAC__STREAM_METADATA_LENGTH_LEN; /* = 24 bits */ +#define FLAC__STREAM_METADATA_HEADER_LENGTH (4u) + /*****************************************************************************/ diff --git a/src/libFLAC/format.c b/src/libFLAC/format.c index d515403..5e5008d 100644 --- a/src/libFLAC/format.c +++ b/src/libFLAC/format.c @@ -33,14 +33,12 @@ const unsigned FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN = 3; /* bits */ const unsigned FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN = 5; /* bits */ const unsigned FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN = 36; /* bits */ const unsigned FLAC__STREAM_METADATA_STREAMINFO_MD5SUM_LEN = 128; /* bits */ -const unsigned FLAC__STREAM_METADATA_STREAMINFO_LENGTH = 34; /* bytes */ const unsigned FLAC__STREAM_METADATA_APPLICATION_ID_LEN = 32; /* bits */ const unsigned FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN = 64; /* bits */ const unsigned FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN = 64; /* bits */ const unsigned FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN = 16; /* bits */ -const unsigned FLAC__STREAM_METADATA_SEEKPOINT_LENGTH = 18; /* bytes */ const FLAC__uint64 FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER = 0xffffffffffffffff; -- 2.7.4