mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
massive glob of checkins: improved tests, more tests, bugfixes
This commit is contained in:
@@ -34,8 +34,8 @@ endif
|
||||
|
||||
SUBDIRS = $(ARCH_SUBDIRS) include .
|
||||
|
||||
#@@@@ fix this
|
||||
libFLAC_la_LDFLAGS = -version-info 2:1:1
|
||||
# see 'http://www.gnu.org/software/libtool/manual.html#Versioning' for numbering convention
|
||||
libFLAC_la_LDFLAGS = -version-info 3:0:0
|
||||
|
||||
libFLAC_la_SOURCES = \
|
||||
bitbuffer.c \
|
||||
|
||||
@@ -45,7 +45,7 @@ static FLAC__SeekableStreamDecoderSeekStatus seek_callback_(const FLAC__Seekable
|
||||
static FLAC__SeekableStreamDecoderTellStatus tell_callback_(const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data);
|
||||
static FLAC__SeekableStreamDecoderLengthStatus length_callback_(const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data);
|
||||
static FLAC__bool eof_callback_(const FLAC__SeekableStreamDecoder *decoder, void *client_data);
|
||||
static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__SeekableStreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data);
|
||||
static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__SeekableStreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
|
||||
static void metadata_callback_(const FLAC__SeekableStreamDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data);
|
||||
static void error_callback_(const FLAC__SeekableStreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
|
||||
|
||||
@@ -56,7 +56,7 @@ static void error_callback_(const FLAC__SeekableStreamDecoder *decoder, FLAC__St
|
||||
***********************************************************************/
|
||||
|
||||
typedef struct FLAC__FileDecoderPrivate {
|
||||
FLAC__StreamDecoderWriteStatus (*write_callback)(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data);
|
||||
FLAC__StreamDecoderWriteStatus (*write_callback)(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
|
||||
void (*metadata_callback)(const FLAC__FileDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data);
|
||||
void (*error_callback)(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
|
||||
void *client_data;
|
||||
@@ -71,7 +71,7 @@ typedef struct FLAC__FileDecoderPrivate {
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
const char *FLAC__FileDecoderStateString[] = {
|
||||
const char * const FLAC__FileDecoderStateString[] = {
|
||||
"FLAC__FILE_DECODER_OK",
|
||||
"FLAC__FILE_DECODER_END_OF_FILE",
|
||||
"FLAC__FILE_DECODER_ERROR_OPENING_FILE",
|
||||
@@ -243,7 +243,7 @@ FLAC__bool FLAC__file_decoder_set_filename(FLAC__FileDecoder *decoder, const cha
|
||||
return true;
|
||||
}
|
||||
|
||||
FLAC__bool FLAC__file_decoder_set_write_callback(FLAC__FileDecoder *decoder, FLAC__StreamDecoderWriteStatus (*value)(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data))
|
||||
FLAC__bool FLAC__file_decoder_set_write_callback(FLAC__FileDecoder *decoder, FLAC__StreamDecoderWriteStatus (*value)(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data))
|
||||
{
|
||||
FLAC__ASSERT(decoder != 0);
|
||||
FLAC__ASSERT(decoder->private_ != 0);
|
||||
@@ -603,7 +603,7 @@ FLAC__bool eof_callback_(const FLAC__SeekableStreamDecoder *decoder, void *clien
|
||||
return feof(file_decoder->private_->file);
|
||||
}
|
||||
|
||||
FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__SeekableStreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data)
|
||||
FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__SeekableStreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
|
||||
{
|
||||
FLAC__FileDecoder *file_decoder = (FLAC__FileDecoder *)client_data;
|
||||
(void)decoder;
|
||||
|
||||
@@ -68,7 +68,7 @@ const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN = 5; /* bits
|
||||
|
||||
const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER = 15; /* == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN)-1 */
|
||||
|
||||
const char *FLAC__EntropyCodingMethodTypeString[] = {
|
||||
const char * const FLAC__EntropyCodingMethodTypeString[] = {
|
||||
"PARTITIONED_RICE"
|
||||
};
|
||||
|
||||
@@ -84,26 +84,26 @@ const unsigned FLAC__SUBFRAME_TYPE_VERBATIM_BYTE_ALIGNED_MASK = 0x02;
|
||||
const unsigned FLAC__SUBFRAME_TYPE_FIXED_BYTE_ALIGNED_MASK = 0x10;
|
||||
const unsigned FLAC__SUBFRAME_TYPE_LPC_BYTE_ALIGNED_MASK = 0x40;
|
||||
|
||||
const char *FLAC__SubframeTypeString[] = {
|
||||
const char * const FLAC__SubframeTypeString[] = {
|
||||
"CONSTANT",
|
||||
"VERBATIM",
|
||||
"FIXED",
|
||||
"LPC"
|
||||
};
|
||||
|
||||
const char *FLAC__ChannelAssignmentString[] = {
|
||||
const char * const FLAC__ChannelAssignmentString[] = {
|
||||
"INDEPENDENT",
|
||||
"LEFT_SIDE",
|
||||
"RIGHT_SIDE",
|
||||
"MID_SIDE"
|
||||
};
|
||||
|
||||
const char *FLAC__FrameNumberTypeString[] = {
|
||||
const char * const FLAC__FrameNumberTypeString[] = {
|
||||
"FRAME_NUMBER_TYPE_FRAME_NUMBER",
|
||||
"FRAME_NUMBER_TYPE_SAMPLE_NUMBER"
|
||||
};
|
||||
|
||||
const char *FLAC__MetaDataTypeString[] = {
|
||||
const char * const FLAC__MetaDataTypeString[] = {
|
||||
"STREAMINFO",
|
||||
"PADDING",
|
||||
"APPLICATION",
|
||||
|
||||
@@ -43,6 +43,6 @@ void MD5Update(struct MD5Context *context, md5byte const *buf, unsigned len);
|
||||
void MD5Final(md5byte digest[16], struct MD5Context *context);
|
||||
void MD5Transform(FLAC__uint32 buf[4], FLAC__uint32 const in[16]);
|
||||
|
||||
FLAC__bool FLAC__MD5Accumulate(struct MD5Context *ctx, const FLAC__int32 *signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample);
|
||||
FLAC__bool FLAC__MD5Accumulate(struct MD5Context *ctx, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample);
|
||||
|
||||
#endif /* !MD5_H */
|
||||
|
||||
@@ -221,7 +221,7 @@ MD5Update(struct MD5Context *ctx, md5byte const *buf, unsigned len)
|
||||
* Convert the incoming audio signal to a byte stream and MD5Update it.
|
||||
*/
|
||||
FLAC__bool
|
||||
FLAC__MD5Accumulate(struct MD5Context *ctx, const FLAC__int32 *signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample)
|
||||
FLAC__MD5Accumulate(struct MD5Context *ctx, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample)
|
||||
{
|
||||
unsigned channel, sample, a_byte;
|
||||
FLAC__int32 a_word;
|
||||
|
||||
@@ -111,37 +111,54 @@ static FLAC__MetaData_ChainStatus get_equivalent_status_(FLAC__MetaData_SimpleIt
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data);
|
||||
static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
|
||||
static void metadata_callback_(const FLAC__FileDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data);
|
||||
static void error_callback_(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
|
||||
|
||||
typedef struct {
|
||||
FLAC__bool got_error;
|
||||
FLAC__bool got_streaminfo;
|
||||
FLAC__StreamMetaData_StreamInfo *streaminfo;
|
||||
} level0_client_data;
|
||||
|
||||
FLAC__bool FLAC__metadata_get_streaminfo(const char *filename, FLAC__StreamMetaData_StreamInfo *streaminfo)
|
||||
{
|
||||
level0_client_data cd;
|
||||
FLAC__FileDecoder *decoder = FLAC__file_decoder_new();
|
||||
|
||||
if(0 == decoder)
|
||||
return false;
|
||||
|
||||
cd.got_error = false;
|
||||
cd.got_streaminfo = false;
|
||||
cd.streaminfo = streaminfo;
|
||||
|
||||
FLAC__file_decoder_set_md5_checking(decoder, false);
|
||||
FLAC__file_decoder_set_filename(decoder, filename);
|
||||
FLAC__file_decoder_set_write_callback(decoder, write_callback_);
|
||||
FLAC__file_decoder_set_metadata_callback(decoder, metadata_callback_);
|
||||
FLAC__file_decoder_set_error_callback(decoder, error_callback_);
|
||||
FLAC__file_decoder_set_client_data(decoder, &streaminfo);
|
||||
FLAC__file_decoder_set_client_data(decoder, &cd);
|
||||
|
||||
if(FLAC__file_decoder_init(decoder) != FLAC__FILE_DECODER_OK)
|
||||
if(FLAC__file_decoder_init(decoder) != FLAC__FILE_DECODER_OK || cd.got_error) {
|
||||
FLAC__file_decoder_finish(decoder);
|
||||
FLAC__file_decoder_delete(decoder);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!FLAC__file_decoder_process_metadata(decoder))
|
||||
if(!FLAC__file_decoder_process_metadata(decoder) || cd.got_error) {
|
||||
FLAC__file_decoder_finish(decoder);
|
||||
FLAC__file_decoder_delete(decoder);
|
||||
return false;
|
||||
}
|
||||
|
||||
FLAC__file_decoder_finish(decoder);
|
||||
FLAC__file_decoder_delete(decoder);
|
||||
|
||||
return 0 != streaminfo; /* the metadata_callback_() will set streaminfo to 0 on an error */
|
||||
return !cd.got_error && cd.got_streaminfo;
|
||||
}
|
||||
|
||||
FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data)
|
||||
FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
|
||||
{
|
||||
(void)decoder, (void)frame, (void)buffer, (void)client_data;
|
||||
|
||||
@@ -150,20 +167,22 @@ FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder,
|
||||
|
||||
void metadata_callback_(const FLAC__FileDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data)
|
||||
{
|
||||
FLAC__StreamMetaData_StreamInfo **streaminfo = (FLAC__StreamMetaData_StreamInfo **)client_data;
|
||||
level0_client_data *cd = (level0_client_data *)client_data;
|
||||
(void)decoder;
|
||||
|
||||
if(metadata->type == FLAC__METADATA_TYPE_STREAMINFO && 0 != *streaminfo)
|
||||
**streaminfo = metadata->data.stream_info;
|
||||
if(metadata->type == FLAC__METADATA_TYPE_STREAMINFO && 0 != cd->streaminfo) {
|
||||
*(cd->streaminfo) = metadata->data.stream_info;
|
||||
cd->got_streaminfo = true;
|
||||
}
|
||||
}
|
||||
|
||||
void error_callback_(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
|
||||
{
|
||||
FLAC__StreamMetaData_StreamInfo **streaminfo = (FLAC__StreamMetaData_StreamInfo **)client_data;
|
||||
level0_client_data *cd = (level0_client_data *)client_data;
|
||||
(void)decoder;
|
||||
|
||||
if(status != FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC)
|
||||
*streaminfo = 0;
|
||||
cd->got_error = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -193,7 +212,7 @@ struct FLAC__MetaData_SimpleIterator {
|
||||
unsigned length;
|
||||
};
|
||||
|
||||
const char *FLAC__MetaData_SimpleIteratorStatusString[] = {
|
||||
const char * const FLAC__MetaData_SimpleIteratorStatusString[] = {
|
||||
"FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK",
|
||||
"FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT",
|
||||
"FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE",
|
||||
@@ -694,7 +713,7 @@ struct FLAC__MetaData_Iterator {
|
||||
FLAC__MetaData_Node *current;
|
||||
};
|
||||
|
||||
const char *FLAC__MetaData_ChainStatusString[] = {
|
||||
const char * const FLAC__MetaData_ChainStatusString[] = {
|
||||
"FLAC__METADATA_CHAIN_STATUS_OK",
|
||||
"FLAC__METADATA_CHAIN_STATUS_ILLEGAL_INPUT",
|
||||
"FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE",
|
||||
|
||||
@@ -340,6 +340,124 @@ void FLAC__metadata_object_delete(FLAC__StreamMetaData *object)
|
||||
free(object);
|
||||
}
|
||||
|
||||
static FLAC__bool compare_block_data_streaminfo_(const FLAC__StreamMetaData_StreamInfo *block1, const FLAC__StreamMetaData_StreamInfo *block2)
|
||||
{
|
||||
if(block1->min_blocksize != block2->min_blocksize)
|
||||
return false;
|
||||
if(block1->max_blocksize != block2->max_blocksize)
|
||||
return false;
|
||||
if(block1->min_framesize != block2->min_framesize)
|
||||
return false;
|
||||
if(block1->max_framesize != block2->max_framesize)
|
||||
return false;
|
||||
if(block1->sample_rate != block2->sample_rate)
|
||||
return false;
|
||||
if(block1->channels != block2->channels)
|
||||
return false;
|
||||
if(block1->bits_per_sample != block2->bits_per_sample)
|
||||
return false;
|
||||
if(block1->total_samples != block2->total_samples)
|
||||
return false;
|
||||
if(0 != memcmp(block1->md5sum, block2->md5sum, 16))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static FLAC__bool compare_block_data_application_(const FLAC__StreamMetaData_Application *block1, const FLAC__StreamMetaData_Application *block2, unsigned block_length)
|
||||
{
|
||||
FLAC__ASSERT(0 != block1);
|
||||
FLAC__ASSERT(0 != block2);
|
||||
FLAC__ASSERT(block_length >= sizeof(block1->id));
|
||||
|
||||
if(0 != memcmp(block1->id, block2->id, sizeof(block1->id)))
|
||||
return false;
|
||||
if(0 != block1->data && 0 != block2->data)
|
||||
return 0 == memcmp(block1->data, block2->data, block_length - sizeof(block1->id));
|
||||
else
|
||||
return block1->data == block2->data;
|
||||
}
|
||||
|
||||
static FLAC__bool compare_block_data_seektable_(const FLAC__StreamMetaData_SeekTable *block1, const FLAC__StreamMetaData_SeekTable *block2)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
FLAC__ASSERT(0 != block1);
|
||||
FLAC__ASSERT(0 != block2);
|
||||
|
||||
if(block1->num_points != block2->num_points)
|
||||
return false;
|
||||
|
||||
if(0 != block1->points && 0 != block2->points) {
|
||||
for(i = 0; i < block1->num_points; i++) {
|
||||
if(block1->points[i].sample_number != block2->points[i].sample_number)
|
||||
return false;
|
||||
if(block1->points[i].stream_offset != block2->points[i].stream_offset)
|
||||
return false;
|
||||
if(block1->points[i].frame_samples != block2->points[i].frame_samples)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return block1->points == block2->points;
|
||||
}
|
||||
|
||||
static FLAC__bool compare_block_data_vorbiscomment_(const FLAC__StreamMetaData_VorbisComment *block1, const FLAC__StreamMetaData_VorbisComment *block2)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
if(block1->vendor_string.length != block2->vendor_string.length)
|
||||
return false;
|
||||
|
||||
if(0 != block1->vendor_string.entry && 0 != block2->vendor_string.entry) {
|
||||
if(0 != memcmp(block1->vendor_string.entry, block2->vendor_string.entry, block1->vendor_string.length))
|
||||
return false;
|
||||
}
|
||||
else if(block1->vendor_string.entry != block2->vendor_string.entry)
|
||||
return false;
|
||||
|
||||
if(block1->num_comments != block2->num_comments)
|
||||
return false;
|
||||
|
||||
for(i = 0; i < block1->num_comments; i++) {
|
||||
if(0 != block1->comments[i].entry && 0 != block2->comments[i].entry) {
|
||||
if(0 != memcmp(block1->comments[i].entry, block2->comments[i].entry, block1->comments[i].length))
|
||||
return false;
|
||||
}
|
||||
else if(block1->comments[i].entry != block2->comments[i].entry)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
FLAC__bool FLAC__metadata_object_is_equal(const FLAC__StreamMetaData *block1, const FLAC__StreamMetaData *block2)
|
||||
{
|
||||
if(block1->type != block2->type) {
|
||||
return false;
|
||||
}
|
||||
if(block1->is_last != block2->is_last) {
|
||||
return false;
|
||||
}
|
||||
if(block1->length != block2->length) {
|
||||
return false;
|
||||
}
|
||||
switch(block1->type) {
|
||||
case FLAC__METADATA_TYPE_STREAMINFO:
|
||||
return compare_block_data_streaminfo_(&block1->data.stream_info, &block2->data.stream_info);
|
||||
case FLAC__METADATA_TYPE_PADDING:
|
||||
return true; /* we don't compare the padding guts */
|
||||
case FLAC__METADATA_TYPE_APPLICATION:
|
||||
return compare_block_data_application_(&block1->data.application, &block2->data.application, block1->length);
|
||||
case FLAC__METADATA_TYPE_SEEKTABLE:
|
||||
return compare_block_data_seektable_(&block1->data.seek_table, &block2->data.seek_table);
|
||||
case FLAC__METADATA_TYPE_VORBIS_COMMENT:
|
||||
return compare_block_data_vorbiscomment_(&block1->data.vorbis_comment, &block2->data.vorbis_comment);
|
||||
default:
|
||||
FLAC__ASSERT(0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*@@@@move
|
||||
sets the application data to 'data'. if 'copy' is true, makes, copy, else takes ownership of pointer. returns false if copy==true and malloc fails.
|
||||
FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_APPLICATION);
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
static void seekable_stream_decoder_set_defaults_(FLAC__SeekableStreamDecoder *decoder);
|
||||
static FLAC__StreamDecoderReadStatus read_callback_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data);
|
||||
static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data);
|
||||
static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
|
||||
static void metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data);
|
||||
static void error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
|
||||
static FLAC__bool seek_to_absolute_sample_(FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 stream_length, FLAC__uint64 target_sample);
|
||||
@@ -50,7 +50,7 @@ typedef struct FLAC__SeekableStreamDecoderPrivate {
|
||||
FLAC__SeekableStreamDecoderTellStatus (*tell_callback)(const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data);
|
||||
FLAC__SeekableStreamDecoderLengthStatus (*length_callback)(const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data);
|
||||
FLAC__bool (*eof_callback)(const FLAC__SeekableStreamDecoder *decoder, void *client_data);
|
||||
FLAC__StreamDecoderWriteStatus (*write_callback)(const FLAC__SeekableStreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data);
|
||||
FLAC__StreamDecoderWriteStatus (*write_callback)(const FLAC__SeekableStreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
|
||||
void (*metadata_callback)(const FLAC__SeekableStreamDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data);
|
||||
void (*error_callback)(const FLAC__SeekableStreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
|
||||
void *client_data;
|
||||
@@ -71,7 +71,7 @@ typedef struct FLAC__SeekableStreamDecoderPrivate {
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
const char *FLAC__SeekableStreamDecoderStateString[] = {
|
||||
const char * const FLAC__SeekableStreamDecoderStateString[] = {
|
||||
"FLAC__SEEKABLE_STREAM_DECODER_OK",
|
||||
"FLAC__SEEKABLE_STREAM_DECODER_SEEKING",
|
||||
"FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM",
|
||||
@@ -84,22 +84,22 @@ const char *FLAC__SeekableStreamDecoderStateString[] = {
|
||||
"FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED"
|
||||
};
|
||||
|
||||
const char *FLAC__SeekableStreamDecoderReadStatusString[] = {
|
||||
const char * const FLAC__SeekableStreamDecoderReadStatusString[] = {
|
||||
"FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK",
|
||||
"FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR"
|
||||
};
|
||||
|
||||
const char *FLAC__SeekableStreamDecoderSeekStatusString[] = {
|
||||
const char * const FLAC__SeekableStreamDecoderSeekStatusString[] = {
|
||||
"FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK",
|
||||
"FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR"
|
||||
};
|
||||
|
||||
const char *FLAC__SeekableStreamDecoderTellStatusString[] = {
|
||||
const char * const FLAC__SeekableStreamDecoderTellStatusString[] = {
|
||||
"FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK",
|
||||
"FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR"
|
||||
};
|
||||
|
||||
const char *FLAC__SeekableStreamDecoderLengthStatusString[] = {
|
||||
const char * const FLAC__SeekableStreamDecoderLengthStatusString[] = {
|
||||
"FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK",
|
||||
"FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_ERROR"
|
||||
};
|
||||
@@ -302,7 +302,7 @@ FLAC__bool FLAC__seekable_stream_decoder_set_eof_callback(FLAC__SeekableStreamDe
|
||||
return true;
|
||||
}
|
||||
|
||||
FLAC__bool FLAC__seekable_stream_decoder_set_write_callback(FLAC__SeekableStreamDecoder *decoder, FLAC__StreamDecoderWriteStatus (*value)(const FLAC__SeekableStreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data))
|
||||
FLAC__bool FLAC__seekable_stream_decoder_set_write_callback(FLAC__SeekableStreamDecoder *decoder, FLAC__StreamDecoderWriteStatus (*value)(const FLAC__SeekableStreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data))
|
||||
{
|
||||
FLAC__ASSERT(decoder != 0);
|
||||
FLAC__ASSERT(decoder->private_ != 0);
|
||||
@@ -670,7 +670,7 @@ FLAC__StreamDecoderReadStatus read_callback_(const FLAC__StreamDecoder *decoder,
|
||||
return FLAC__STREAM_DECODER_READ_STATUS_ABORT; /* abort to avoid a deadlock */
|
||||
}
|
||||
|
||||
FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data)
|
||||
FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
|
||||
{
|
||||
FLAC__SeekableStreamDecoder *seekable_stream_decoder = (FLAC__SeekableStreamDecoder *)client_data;
|
||||
(void)decoder;
|
||||
|
||||
@@ -68,7 +68,7 @@ static FLAC__bool read_callback_(FLAC__byte buffer[], unsigned *bytes, void *cli
|
||||
|
||||
typedef struct FLAC__StreamDecoderPrivate {
|
||||
FLAC__StreamDecoderReadStatus (*read_callback)(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data);
|
||||
FLAC__StreamDecoderWriteStatus (*write_callback)(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data);
|
||||
FLAC__StreamDecoderWriteStatus (*write_callback)(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
|
||||
void (*metadata_callback)(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data);
|
||||
void (*error_callback)(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
|
||||
void (*local_lpc_restore_signal)(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
|
||||
@@ -99,7 +99,7 @@ typedef struct FLAC__StreamDecoderPrivate {
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
const char *FLAC__StreamDecoderStateString[] = {
|
||||
const char * const FLAC__StreamDecoderStateString[] = {
|
||||
"FLAC__STREAM_DECODER_SEARCH_FOR_METADATA",
|
||||
"FLAC__STREAM_DECODER_READ_METADATA",
|
||||
"FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC",
|
||||
@@ -113,18 +113,18 @@ const char *FLAC__StreamDecoderStateString[] = {
|
||||
"FLAC__STREAM_DECODER_UNINITIALIZED"
|
||||
};
|
||||
|
||||
const char *FLAC__StreamDecoderReadStatusString[] = {
|
||||
const char * const FLAC__StreamDecoderReadStatusString[] = {
|
||||
"FLAC__STREAM_DECODER_READ_STATUS_CONTINUE",
|
||||
"FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM",
|
||||
"FLAC__STREAM_DECODER_READ_STATUS_ABORT"
|
||||
};
|
||||
|
||||
const char *FLAC__StreamDecoderWriteStatusString[] = {
|
||||
const char * const FLAC__StreamDecoderWriteStatusString[] = {
|
||||
"FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE",
|
||||
"FLAC__STREAM_DECODER_WRITE_STATUS_ABORT"
|
||||
};
|
||||
|
||||
const char *FLAC__StreamDecoderErrorStatusString[] = {
|
||||
const char * const FLAC__StreamDecoderErrorStatusString[] = {
|
||||
"FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC",
|
||||
"FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER",
|
||||
"FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH"
|
||||
@@ -302,7 +302,7 @@ FLAC__bool FLAC__stream_decoder_set_read_callback(FLAC__StreamDecoder *decoder,
|
||||
return true;
|
||||
}
|
||||
|
||||
FLAC__bool FLAC__stream_decoder_set_write_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderWriteStatus (*value)(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data))
|
||||
FLAC__bool FLAC__stream_decoder_set_write_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderWriteStatus (*value)(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data))
|
||||
{
|
||||
FLAC__ASSERT(decoder != 0);
|
||||
FLAC__ASSERT(decoder->private_ != 0);
|
||||
@@ -1247,8 +1247,7 @@ FLAC__bool stream_decoder_read_frame_(FLAC__StreamDecoder *decoder, FLAC__bool *
|
||||
decoder->private_->samples_decoded = decoder->private_->frame.header.number.sample_number + decoder->private_->frame.header.blocksize;
|
||||
|
||||
/* write it */
|
||||
/* NOTE: some versions of GCC can't figure out const-ness right and will give you an 'incompatible pointer type' warning on arg 3 here: */
|
||||
if(decoder->private_->write_callback(decoder, &decoder->private_->frame, decoder->private_->output, decoder->private_->client_data) != FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE)
|
||||
if(decoder->private_->write_callback(decoder, &decoder->private_->frame, (const FLAC__int32 * const *)decoder->private_->output, decoder->private_->client_data) != FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE)
|
||||
return false;
|
||||
|
||||
decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
|
||||
|
||||
@@ -142,7 +142,7 @@ typedef struct FLAC__StreamEncoderPrivate {
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
const char *FLAC__StreamEncoderStateString[] = {
|
||||
const char * const FLAC__StreamEncoderStateString[] = {
|
||||
"FLAC__STREAM_ENCODER_OK",
|
||||
"FLAC__STREAM_ENCODER_INVALID_CALLBACK",
|
||||
"FLAC__STREAM_ENCODER_INVALID_NUMBER_OF_CHANNELS",
|
||||
@@ -164,7 +164,7 @@ const char *FLAC__StreamEncoderStateString[] = {
|
||||
"FLAC__STREAM_ENCODER_UNINITIALIZED"
|
||||
};
|
||||
|
||||
const char *FLAC__StreamEncoderWriteStatusString[] = {
|
||||
const char * const FLAC__StreamEncoderWriteStatusString[] = {
|
||||
"FLAC__STREAM_ENCODER_WRITE_OK",
|
||||
"FLAC__STREAM_ENCODER_WRITE_FATAL_ERROR"
|
||||
};
|
||||
@@ -473,7 +473,7 @@ FLAC__StreamEncoderState FLAC__stream_encoder_init(FLAC__StreamEncoder *encoder)
|
||||
|
||||
FLAC__ASSERT(FLAC__bitbuffer_is_byte_aligned(encoder->private_->frame));
|
||||
{
|
||||
FLAC__byte *buffer;
|
||||
const FLAC__byte *buffer;
|
||||
unsigned bytes;
|
||||
|
||||
FLAC__bitbuffer_get_buffer(encoder->private_->frame, &buffer, &bytes);
|
||||
@@ -799,7 +799,7 @@ unsigned FLAC__stream_encoder_get_rice_parameter_search_dist(const FLAC__StreamE
|
||||
return encoder->protected_->rice_parameter_search_dist;
|
||||
}
|
||||
|
||||
FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC__int32 *buf[], unsigned samples)
|
||||
FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples)
|
||||
{
|
||||
unsigned i, j, channel;
|
||||
FLAC__int32 x, mid, side;
|
||||
@@ -812,15 +812,15 @@ FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC
|
||||
if(encoder->protected_->do_mid_side_stereo && channels == 2) {
|
||||
do {
|
||||
for(i = encoder->private_->current_sample_number; i < blocksize && j < samples; i++, j++) {
|
||||
x = mid = side = buf[0][j];
|
||||
x = mid = side = buffer[0][j];
|
||||
encoder->private_->integer_signal[0][i] = x;
|
||||
encoder->private_->real_signal[0][i] = (FLAC__real)x;
|
||||
x = buf[1][j];
|
||||
x = buffer[1][j];
|
||||
encoder->private_->integer_signal[1][i] = x;
|
||||
encoder->private_->real_signal[1][i] = (FLAC__real)x;
|
||||
mid += x;
|
||||
side -= x;
|
||||
mid >>= 1; /* NOTE: not the same as 'mid = (buf[0][j] + buf[1][j]) / 2' ! */
|
||||
mid >>= 1; /* NOTE: not the same as 'mid = (buffer[0][j] + buffer[1][j]) / 2' ! */
|
||||
encoder->private_->integer_signal_mid_side[1][i] = side;
|
||||
encoder->private_->integer_signal_mid_side[0][i] = mid;
|
||||
encoder->private_->real_signal_mid_side[1][i] = (FLAC__real)side;
|
||||
@@ -837,7 +837,7 @@ FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC
|
||||
do {
|
||||
for(i = encoder->private_->current_sample_number; i < blocksize && j < samples; i++, j++) {
|
||||
for(channel = 0; channel < channels; channel++) {
|
||||
x = buf[channel][j];
|
||||
x = buffer[channel][j];
|
||||
encoder->private_->integer_signal[channel][i] = x;
|
||||
encoder->private_->real_signal[channel][i] = (FLAC__real)x;
|
||||
}
|
||||
@@ -854,7 +854,7 @@ FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC
|
||||
}
|
||||
|
||||
/* 'samples' is channel-wide samples, e.g. for 1 second at 44100Hz, 'samples' = 44100 regardless of the number of channels */
|
||||
FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder *encoder, const FLAC__int32 buf[], unsigned samples)
|
||||
FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], unsigned samples)
|
||||
{
|
||||
unsigned i, j, k, channel;
|
||||
FLAC__int32 x, mid, side;
|
||||
@@ -867,10 +867,10 @@ FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder *encoder
|
||||
if(encoder->protected_->do_mid_side_stereo && channels == 2) {
|
||||
do {
|
||||
for(i = encoder->private_->current_sample_number; i < blocksize && j < samples; i++, j++) {
|
||||
x = mid = side = buf[k++];
|
||||
x = mid = side = buffer[k++];
|
||||
encoder->private_->integer_signal[0][i] = x;
|
||||
encoder->private_->real_signal[0][i] = (FLAC__real)x;
|
||||
x = buf[k++];
|
||||
x = buffer[k++];
|
||||
encoder->private_->integer_signal[1][i] = x;
|
||||
encoder->private_->real_signal[1][i] = (FLAC__real)x;
|
||||
mid += x;
|
||||
@@ -892,7 +892,7 @@ FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder *encoder
|
||||
do {
|
||||
for(i = encoder->private_->current_sample_number; i < blocksize && j < samples; i++, j++) {
|
||||
for(channel = 0; channel < channels; channel++) {
|
||||
x = buf[k++];
|
||||
x = buffer[k++];
|
||||
encoder->private_->integer_signal[channel][i] = x;
|
||||
encoder->private_->real_signal[channel][i] = (FLAC__real)x;
|
||||
}
|
||||
@@ -977,8 +977,7 @@ FLAC__bool stream_encoder_process_frame_(FLAC__StreamEncoder *encoder, FLAC__boo
|
||||
/*
|
||||
* Accumulate raw signal to the MD5 signature
|
||||
*/
|
||||
/* NOTE: some versions of GCC can't figure out const-ness right and will give you an 'incompatible pointer type' warning on arg 2 here: */
|
||||
if(!FLAC__MD5Accumulate(&encoder->private_->md5context, encoder->private_->integer_signal, encoder->protected_->channels, encoder->protected_->blocksize, (encoder->protected_->bits_per_sample+7) / 8)) {
|
||||
if(!FLAC__MD5Accumulate(&encoder->private_->md5context, (const FLAC__int32 * const *)encoder->private_->integer_signal, encoder->protected_->channels, encoder->protected_->blocksize, (encoder->protected_->bits_per_sample+7) / 8)) {
|
||||
encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user