minor changes in anticipation of release
This commit is contained in:
parent
d09958f841
commit
bc869506bd
2
AUTHORS
2
AUTHORS
@ -28,5 +28,5 @@ Other major contributors and their contributions:
|
||||
* IA-32 assembly versions of several libFLAC routines
|
||||
|
||||
"Matt Zimmerman" <mdz@debian.org>
|
||||
* Libtool/autoconf/automake make system
|
||||
* Libtool/autoconf/automake make system, flac man page
|
||||
|
||||
|
@ -27,11 +27,6 @@
|
||||
#
|
||||
# distclean: remove everything except what goes in the distribution
|
||||
#
|
||||
# The old 'debug' target is obsolete; configure the source tree with
|
||||
# ./configure --enable-debug to enable debugging and self-tests
|
||||
#
|
||||
# The old 'release' target is obsolete; this is now the default
|
||||
#
|
||||
|
||||
|
||||
SUBDIRS = doc include man src test
|
||||
|
22
README
22
README
@ -20,14 +20,17 @@
|
||||
FLAC (http://flac.sourceforge.net/) is an Open Source lossless audio
|
||||
codec developed by Josh Coalson.
|
||||
|
||||
FLAC is comprised of 1) `libFLAC', a library which implements
|
||||
reference encoders and decoders, licensed under the GNU Lesser
|
||||
General Public License (LGPL); 2) `flac', a command-line program for
|
||||
encoding and decoding files, licensed under the GNU General public
|
||||
License (GPL); 3) `metaflac', a command-line program for editing
|
||||
FLAC metadata, licensed under the GPL; 4) player plugins for XMMS
|
||||
and Winamp, licensed under the GPL; and 5) documentation, licensed
|
||||
under the GNU Free Documentation License.
|
||||
FLAC is comprised of
|
||||
* `libFLAC', a library which implements reference encoders and
|
||||
decoders, and a metadata interface, licensed under the GNU
|
||||
Lesser General Public License (LGPL)
|
||||
* `libFLAC++', a C++ object wrapper library around libFLAC
|
||||
* `flac', a command-line program for encoding and decoding files,
|
||||
licensed under the GNU General public License (GPL)
|
||||
* `metaflac', a command-line program for editing FLAC metadata,
|
||||
licensed under the GPL
|
||||
* player plugins for XMMS and Winamp, licensed under the GPL
|
||||
* documentation, licensed under the GNU Free Documentation License.
|
||||
|
||||
============
|
||||
FLAC - 1.0.3_beta
|
||||
@ -42,6 +45,7 @@ for full documentation.
|
||||
A brief description of the directory tree:
|
||||
|
||||
doc/ the HTML documentation
|
||||
man/ the man page for `flac'
|
||||
include/ public include files for libFLAC
|
||||
src/ the source code and private headers
|
||||
test/ the test scripts
|
||||
@ -128,7 +132,7 @@ building with MSVC. Just 'nmake /f Makefile.vc'. Currently
|
||||
the Makefile.vc for libFLAC is hardcoded to use nasm. If
|
||||
you don't have nasm, or don't want any assembly optimizations,
|
||||
edit the makefile, adding '/D FLAC__NO_ASM', and delete the
|
||||
rules which compile the .s files.
|
||||
rules which compile the .nasm files.
|
||||
|
||||
|
||||
====================
|
||||
|
@ -68,6 +68,7 @@ typedef struct {
|
||||
* (*metadata_callback)() (DEFAULT: NULL )
|
||||
* (*error_callback)() (DEFAULT: NULL )
|
||||
* void* client_data (DEFAULT: NULL ) passed back through the callbacks
|
||||
* metadata_respond/ignore By default, only the STREAMINFO block is returned via metadata_callback()
|
||||
*/
|
||||
FLAC__FileDecoder *FLAC__file_decoder_new();
|
||||
void FLAC__file_decoder_delete(FLAC__FileDecoder *);
|
||||
@ -94,8 +95,6 @@ void FLAC__file_decoder_delete(FLAC__FileDecoder *);
|
||||
* will take on the defaults from the constructor. NOTE that
|
||||
* FLAC__file_decoder_flush() or FLAC__file_decoder_reset() do
|
||||
* NOT reset the values to the constructor defaults.
|
||||
@@@@ update so that only _set_ methods that need to return FLAC__bool, else void; update documentation.html also
|
||||
@@@@ update defaults above and in documentation.html about the metadata_respond/ignore defaults
|
||||
*/
|
||||
FLAC__bool FLAC__file_decoder_set_md5_checking(FLAC__FileDecoder *decoder, FLAC__bool value);
|
||||
FLAC__bool FLAC__file_decoder_set_filename(FLAC__FileDecoder *decoder, const char *value); /* 'value' may not be 0; use "-" for stdin */
|
||||
|
@ -527,18 +527,10 @@ FLAC__bool FLAC__metadata_object_is_equal(const FLAC__StreamMetadata *block1, co
|
||||
*/
|
||||
FLAC__bool FLAC__metadata_object_application_set_data(FLAC__StreamMetadata *object, FLAC__byte *data, unsigned length, FLAC__bool copy);
|
||||
|
||||
/******************************************************************
|
||||
* FLAC__StreamMetadata_SeekPoint
|
||||
* ----------------------------------------------------------------
|
||||
* @@@@ You can
|
||||
* use the _resize function to alter it. If the size shrinks,
|
||||
* elements will truncated; if it grows, new placeholder points
|
||||
* will be added to the end.
|
||||
*/
|
||||
|
||||
/******************************************************************
|
||||
* FLAC__StreamMetadata_SeekTable
|
||||
*/
|
||||
/* If the size shrinks, elements will truncated; if it grows, new placeholder points will be added to the end. */
|
||||
FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMetadata *object, unsigned new_num_points);
|
||||
void FLAC__metadata_object_seektable_set_point(FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point);
|
||||
FLAC__bool FLAC__metadata_object_seektable_insert_point(FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point);
|
||||
|
@ -99,6 +99,7 @@ typedef struct {
|
||||
* (*metadata_callback)() (DEFAULT: NULL )
|
||||
* (*error_callback)() (DEFAULT: NULL )
|
||||
* void* client_data (DEFAULT: NULL ) passed back through the callbacks
|
||||
* metadata_respond/ignore By default, only the STREAMINFO block is returned via metadata_callback()
|
||||
*/
|
||||
FLAC__SeekableStreamDecoder *FLAC__seekable_stream_decoder_new();
|
||||
void FLAC__seekable_stream_decoder_delete(FLAC__SeekableStreamDecoder *);
|
||||
@ -125,8 +126,6 @@ void FLAC__seekable_stream_decoder_delete(FLAC__SeekableStreamDecoder *);
|
||||
* will take on the defaults from the constructor. NOTE that
|
||||
* FLAC__seekable_stream_decoder_flush() or FLAC__seekable_stream_decoder_reset()
|
||||
* do NOT reset the values to the constructor defaults.
|
||||
@@@@ update so that only _set_ methods that need to return FLAC__bool, else void; update documentation.html also
|
||||
@@@@ update defaults above and in documentation.html about the metadata_respond/ignore defaults
|
||||
*/
|
||||
FLAC__bool FLAC__seekable_stream_decoder_set_md5_checking(FLAC__SeekableStreamDecoder *decoder, FLAC__bool value);
|
||||
FLAC__bool FLAC__seekable_stream_decoder_set_read_callback(FLAC__SeekableStreamDecoder *decoder, FLAC__SeekableStreamDecoderReadStatus (*value)(const FLAC__SeekableStreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data));
|
||||
|
@ -91,6 +91,7 @@ typedef struct {
|
||||
* (*metadata_callback)() (DEFAULT: NULL )
|
||||
* (*error_callback)() (DEFAULT: NULL )
|
||||
* void* client_data (DEFAULT: NULL ) passed back through the callbacks
|
||||
* metadata_respond/ignore By default, only the STREAMINFO block is returned via metadata_callback()
|
||||
*/
|
||||
FLAC__StreamDecoder *FLAC__stream_decoder_new();
|
||||
void FLAC__stream_decoder_delete(FLAC__StreamDecoder *);
|
||||
@ -117,8 +118,6 @@ void FLAC__stream_decoder_delete(FLAC__StreamDecoder *);
|
||||
* will take on the defaults from the constructor. NOTE that
|
||||
* FLAC__stream_decoder_flush() or FLAC__stream_decoder_reset() do
|
||||
* NOT reset the values to the constructor defaults.
|
||||
@@@@ update so that only _set_ methods that need to return FLAC__bool, else void; update documentation.html also
|
||||
@@@@ update defaults above and in documentation.html about the metadata_respond/ignore defaults
|
||||
*/
|
||||
FLAC__bool FLAC__stream_decoder_set_read_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderReadStatus (*value)(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, 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));
|
||||
|
@ -128,7 +128,6 @@ void FLAC__stream_encoder_delete(FLAC__StreamEncoder *encoder);
|
||||
* will take on the defaults from the constructor. NOTE that
|
||||
* FLAC__stream_encoder_finish() does NOT reset the values to the
|
||||
* constructor defaults.
|
||||
@@@@ update so that only _set_ methods that need to return FLAC__bool, else void
|
||||
*/
|
||||
FLAC__bool FLAC__stream_encoder_set_streamable_subset(FLAC__StreamEncoder *encoder, FLAC__bool value);
|
||||
FLAC__bool FLAC__stream_encoder_set_do_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value);
|
||||
|
@ -251,7 +251,15 @@ static FLAC__bool bitbuffer_read_from_client_(FLAC__BitBuffer *bb, FLAC__bool (*
|
||||
|
||||
FLAC__BitBuffer *FLAC__bitbuffer_new()
|
||||
{
|
||||
return (FLAC__BitBuffer*)malloc(sizeof(FLAC__BitBuffer));
|
||||
FLAC__BitBuffer *bb = (FLAC__BitBuffer*)malloc(sizeof(FLAC__BitBuffer));
|
||||
|
||||
if(0 != bb) {
|
||||
bb->buffer = 0;
|
||||
bb->capacity = 0;
|
||||
bb->blurbs = bb->bits = bb->total_bits = 0;
|
||||
bb->consumed_blurbs = bb->consumed_bits = bb->total_consumed_bits = 0;
|
||||
}
|
||||
return bb;
|
||||
}
|
||||
|
||||
void FLAC__bitbuffer_delete(FLAC__BitBuffer *bb)
|
||||
|
@ -120,10 +120,12 @@ FLAC__FileDecoder *FLAC__file_decoder_new()
|
||||
return 0;
|
||||
}
|
||||
|
||||
decoder->protected_->state = FLAC__FILE_DECODER_UNINITIALIZED;
|
||||
decoder->private_->file = 0;
|
||||
|
||||
file_decoder_set_defaults_(decoder);
|
||||
|
||||
decoder->protected_->state = FLAC__FILE_DECODER_UNINITIALIZED;
|
||||
|
||||
return decoder;
|
||||
}
|
||||
|
||||
@ -132,12 +134,11 @@ void FLAC__file_decoder_delete(FLAC__FileDecoder *decoder)
|
||||
FLAC__ASSERT(decoder != 0);
|
||||
FLAC__ASSERT(decoder->protected_ != 0);
|
||||
FLAC__ASSERT(decoder->private_ != 0);
|
||||
FLAC__ASSERT(decoder->private_->seekable_stream_decoder != 0);
|
||||
|
||||
if(decoder->private_->filename != 0)
|
||||
free(decoder->private_->filename);
|
||||
(void)FLAC__file_decoder_finish(decoder);
|
||||
|
||||
if(decoder->private_->seekable_stream_decoder != 0)
|
||||
FLAC__seekable_stream_decoder_delete(decoder->private_->seekable_stream_decoder);
|
||||
FLAC__seekable_stream_decoder_delete(decoder->private_->seekable_stream_decoder);
|
||||
|
||||
free(decoder->private_);
|
||||
free(decoder->protected_);
|
||||
@ -157,13 +158,9 @@ FLAC__FileDecoderState FLAC__file_decoder_init(FLAC__FileDecoder *decoder)
|
||||
if(decoder->protected_->state != FLAC__FILE_DECODER_UNINITIALIZED)
|
||||
return decoder->protected_->state = FLAC__FILE_DECODER_ALREADY_INITIALIZED;
|
||||
|
||||
decoder->protected_->state = FLAC__FILE_DECODER_OK;
|
||||
|
||||
if(0 == decoder->private_->write_callback || 0 == decoder->private_->metadata_callback || 0 == decoder->private_->error_callback)
|
||||
return decoder->protected_->state = FLAC__FILE_DECODER_INVALID_CALLBACK;
|
||||
|
||||
decoder->private_->file = 0;
|
||||
|
||||
if(0 == decoder->private_->filename)
|
||||
decoder->private_->file = get_binary_stdin_();
|
||||
else
|
||||
@ -185,7 +182,7 @@ FLAC__FileDecoderState FLAC__file_decoder_init(FLAC__FileDecoder *decoder)
|
||||
if(FLAC__seekable_stream_decoder_init(decoder->private_->seekable_stream_decoder) != FLAC__SEEKABLE_STREAM_DECODER_OK)
|
||||
return decoder->protected_->state = FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR;
|
||||
|
||||
return decoder->protected_->state;
|
||||
return decoder->protected_->state = FLAC__FILE_DECODER_OK;
|
||||
}
|
||||
|
||||
FLAC__bool FLAC__file_decoder_finish(FLAC__FileDecoder *decoder)
|
||||
@ -197,11 +194,15 @@ FLAC__bool FLAC__file_decoder_finish(FLAC__FileDecoder *decoder)
|
||||
|
||||
FLAC__ASSERT(decoder->private_->seekable_stream_decoder != 0);
|
||||
|
||||
if(decoder->private_->file != 0 && decoder->private_->file != stdin)
|
||||
if(decoder->private_->file != 0 && decoder->private_->file != stdin) {
|
||||
fclose(decoder->private_->file);
|
||||
decoder->private_->file = 0;
|
||||
}
|
||||
|
||||
if(decoder->private_->filename != 0)
|
||||
if(decoder->private_->filename != 0) {
|
||||
free(decoder->private_->filename);
|
||||
decoder->private_->filename = 0;
|
||||
}
|
||||
|
||||
file_decoder_set_defaults_(decoder);
|
||||
|
||||
|
@ -202,7 +202,7 @@ static FLAC__bool vorbiscomment_set_entry_(FLAC__StreamMetadata *object, FLAC__S
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/*@@@@move
|
||||
/*@@@move
|
||||
will return pointer to new empty object of type 'type', or 0 if malloc failed
|
||||
type is valid type
|
||||
*/
|
||||
@ -238,7 +238,7 @@ FLAC__StreamMetadata *FLAC__metadata_object_new(FLAC__MetadataType type)
|
||||
return object;
|
||||
}
|
||||
|
||||
/*@@@@move
|
||||
/*@@@move
|
||||
return a pointer to a copy of 'object', or 0 if any malloc failed. does a deep copy. user gets ownership of object.
|
||||
FLAC__ASSERT(0 != object);
|
||||
*/
|
||||
@ -331,7 +331,7 @@ void FLAC__metadata_object_delete_data(FLAC__StreamMetadata *object)
|
||||
}
|
||||
}
|
||||
|
||||
/*@@@@move
|
||||
/*@@@move
|
||||
frees 'object'. does a deep delete.
|
||||
*/
|
||||
void FLAC__metadata_object_delete(FLAC__StreamMetadata *object)
|
||||
@ -458,7 +458,7 @@ FLAC__bool FLAC__metadata_object_is_equal(const FLAC__StreamMetadata *block1, co
|
||||
}
|
||||
}
|
||||
|
||||
/*@@@@move
|
||||
/*@@@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);
|
||||
FLAC__ASSERT((0 != data && length > 0) || (0 == data && length == 0 && copy == false));
|
||||
|
@ -153,9 +153,11 @@ void FLAC__seekable_stream_decoder_delete(FLAC__SeekableStreamDecoder *decoder)
|
||||
FLAC__ASSERT(decoder != 0);
|
||||
FLAC__ASSERT(decoder->protected_ != 0);
|
||||
FLAC__ASSERT(decoder->private_ != 0);
|
||||
FLAC__ASSERT(decoder->private_->stream_decoder != 0);
|
||||
|
||||
if(decoder->private_->stream_decoder != 0)
|
||||
FLAC__stream_decoder_delete(decoder->private_->stream_decoder);
|
||||
(void)FLAC__seekable_stream_decoder_finish(decoder);
|
||||
|
||||
FLAC__stream_decoder_delete(decoder->private_->stream_decoder);
|
||||
|
||||
free(decoder->private_);
|
||||
free(decoder->protected_);
|
||||
@ -175,8 +177,6 @@ FLAC__SeekableStreamDecoderState FLAC__seekable_stream_decoder_init(FLAC__Seekab
|
||||
if(decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED)
|
||||
return decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_ALREADY_INITIALIZED;
|
||||
|
||||
decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_OK;
|
||||
|
||||
if(0 == decoder->private_->read_callback || 0 == decoder->private_->seek_callback || 0 == decoder->private_->tell_callback || 0 == decoder->private_->length_callback || 0 == decoder->private_->eof_callback)
|
||||
return decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_INVALID_CALLBACK;
|
||||
|
||||
@ -202,7 +202,7 @@ FLAC__SeekableStreamDecoderState FLAC__seekable_stream_decoder_init(FLAC__Seekab
|
||||
if(FLAC__stream_decoder_init(decoder->private_->stream_decoder) != FLAC__STREAM_DECODER_SEARCH_FOR_METADATA)
|
||||
return decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR;
|
||||
|
||||
return decoder->protected_->state;
|
||||
return decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_OK;
|
||||
}
|
||||
|
||||
FLAC__bool FLAC__seekable_stream_decoder_finish(FLAC__SeekableStreamDecoder *decoder)
|
||||
|
@ -138,6 +138,7 @@ const char * const FLAC__StreamDecoderErrorStatusString[] = {
|
||||
FLAC__StreamDecoder *FLAC__stream_decoder_new()
|
||||
{
|
||||
FLAC__StreamDecoder *decoder;
|
||||
unsigned i;
|
||||
|
||||
FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */
|
||||
|
||||
@ -164,8 +165,6 @@ FLAC__StreamDecoder *FLAC__stream_decoder_new()
|
||||
return 0;
|
||||
}
|
||||
|
||||
decoder->protected_->state = FLAC__STREAM_DECODER_UNINITIALIZED;
|
||||
|
||||
decoder->private_->metadata_filter_ids_capacity = 16;
|
||||
if(0 == (decoder->private_->metadata_filter_ids = malloc((FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) * decoder->private_->metadata_filter_ids_capacity))) {
|
||||
FLAC__bitbuffer_delete(decoder->private_->input);
|
||||
@ -175,8 +174,19 @@ FLAC__StreamDecoder *FLAC__stream_decoder_new()
|
||||
return 0;
|
||||
}
|
||||
|
||||
for(i = 0; i < FLAC__MAX_CHANNELS; i++) {
|
||||
decoder->private_->output[i] = 0;
|
||||
decoder->private_->residual[i] = 0;
|
||||
}
|
||||
|
||||
decoder->private_->output_capacity = 0;
|
||||
decoder->private_->output_channels = 0;
|
||||
decoder->private_->has_seek_table = false;
|
||||
|
||||
stream_decoder_set_defaults_(decoder);
|
||||
|
||||
decoder->protected_->state = FLAC__STREAM_DECODER_UNINITIALIZED;
|
||||
|
||||
return decoder;
|
||||
}
|
||||
|
||||
@ -187,6 +197,8 @@ void FLAC__stream_decoder_delete(FLAC__StreamDecoder *decoder)
|
||||
FLAC__ASSERT(decoder->private_ != 0);
|
||||
FLAC__ASSERT(decoder->private_->input != 0);
|
||||
|
||||
FLAC__stream_decoder_finish(decoder);
|
||||
|
||||
if(decoder->private_->metadata_filter_ids != 0)
|
||||
free(decoder->private_->metadata_filter_ids);
|
||||
|
||||
@ -204,32 +216,20 @@ void FLAC__stream_decoder_delete(FLAC__StreamDecoder *decoder)
|
||||
|
||||
FLAC__StreamDecoderState FLAC__stream_decoder_init(FLAC__StreamDecoder *decoder)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
FLAC__ASSERT(decoder != 0);
|
||||
|
||||
if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
|
||||
return decoder->protected_->state = FLAC__STREAM_DECODER_ALREADY_INITIALIZED;
|
||||
|
||||
decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_METADATA;
|
||||
|
||||
if(0 == decoder->private_->read_callback || 0 == decoder->private_->write_callback || 0 == decoder->private_->metadata_callback || 0 == decoder->private_->error_callback)
|
||||
return decoder->protected_->state = FLAC__STREAM_DECODER_INVALID_CALLBACK;
|
||||
|
||||
if(!FLAC__bitbuffer_init(decoder->private_->input))
|
||||
return decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
|
||||
|
||||
for(i = 0; i < FLAC__MAX_CHANNELS; i++) {
|
||||
decoder->private_->output[i] = 0;
|
||||
decoder->private_->residual[i] = 0;
|
||||
}
|
||||
|
||||
decoder->private_->output_capacity = 0;
|
||||
decoder->private_->output_channels = 0;
|
||||
decoder->private_->last_frame_number = 0;
|
||||
decoder->private_->samples_decoded = 0;
|
||||
decoder->private_->has_stream_info = false;
|
||||
decoder->private_->has_seek_table = false;
|
||||
decoder->private_->cached = false;
|
||||
|
||||
/*
|
||||
@ -258,7 +258,7 @@ FLAC__StreamDecoderState FLAC__stream_decoder_init(FLAC__StreamDecoder *decoder)
|
||||
}
|
||||
#endif
|
||||
|
||||
return decoder->protected_->state;
|
||||
return decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_METADATA;
|
||||
}
|
||||
|
||||
void FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder)
|
||||
@ -268,8 +268,10 @@ void FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder)
|
||||
if(decoder->protected_->state == FLAC__STREAM_DECODER_UNINITIALIZED)
|
||||
return;
|
||||
if(decoder->private_->has_seek_table) {
|
||||
FLAC__ASSERT(decoder->private_->seek_table.data.seek_table.points != 0);
|
||||
free(decoder->private_->seek_table.data.seek_table.points);
|
||||
decoder->private_->seek_table.data.seek_table.points = 0;
|
||||
decoder->private_->has_seek_table = false;
|
||||
}
|
||||
FLAC__bitbuffer_free(decoder->private_->input);
|
||||
for(i = 0; i < FLAC__MAX_CHANNELS; i++) {
|
||||
|
@ -306,13 +306,6 @@ bool get_id3v1_tag_(const char *filename, id3v1_struct *tag)
|
||||
const char *temp;
|
||||
FILE *f = fopen(filename, "rb");
|
||||
memset(tag, 0, sizeof(id3v1_struct));
|
||||
#if 0
|
||||
@@@@
|
||||
strcpy(tag->title,"Sonata K.42");
|
||||
strcpy(tag->artist,"Domenico Scarlatti");
|
||||
strcpy(tag->album,"Narcisso Yepes Plays Scarlatti");
|
||||
sprintf(tag->description, "%s - %s", tag->artist, tag->title);
|
||||
#endif
|
||||
|
||||
/* set the title and description to the filename by default */
|
||||
temp = strrchr(filename, '/');
|
||||
|
@ -313,6 +313,58 @@ static bool test_stream_decoder()
|
||||
|
||||
printf("\n+++ libFLAC++ unit test: FLAC::Decoder::Stream\n\n");
|
||||
|
||||
//
|
||||
// test new -> delete
|
||||
//
|
||||
printf("allocating decoder instance... ");
|
||||
decoder = new StreamDecoder();
|
||||
if(0 == decoder) {
|
||||
printf("FAILED, new returned NULL\n");
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing is_valid()... ");
|
||||
if(!decoder->is_valid()) {
|
||||
printf("FAILED, returned false\n");
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("freeing decoder instance... ");
|
||||
delete decoder;
|
||||
printf("OK\n");
|
||||
|
||||
//
|
||||
// test new -> init -> delete
|
||||
//
|
||||
printf("allocating decoder instance... ");
|
||||
decoder = new StreamDecoder();
|
||||
if(0 == decoder) {
|
||||
printf("FAILED, new returned NULL\n");
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing is_valid()... ");
|
||||
if(!decoder->is_valid()) {
|
||||
printf("FAILED, returned false\n");
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing init()... ");
|
||||
if(decoder->init() != ::FLAC__STREAM_DECODER_SEARCH_FOR_METADATA)
|
||||
return decoder->die();
|
||||
printf("OK\n");
|
||||
|
||||
printf("freeing decoder instance... ");
|
||||
delete decoder;
|
||||
printf("OK\n");
|
||||
|
||||
//
|
||||
// test normal usage
|
||||
//
|
||||
num_expected_ = 0;
|
||||
expected_metadata_sequence_[num_expected_++] = &streaminfo_;
|
||||
|
||||
@ -940,6 +992,58 @@ static bool test_seekable_stream_decoder()
|
||||
|
||||
printf("\n+++ libFLAC++ unit test: FLAC::Decoder::SeekableStream\n\n");
|
||||
|
||||
//
|
||||
// test new -> delete
|
||||
//
|
||||
printf("allocating decoder instance... ");
|
||||
decoder = new SeekableStreamDecoder();
|
||||
if(0 == decoder) {
|
||||
printf("FAILED, new returned NULL\n");
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing is_valid()... ");
|
||||
if(!decoder->is_valid()) {
|
||||
printf("FAILED, returned false\n");
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("freeing decoder instance... ");
|
||||
delete decoder;
|
||||
printf("OK\n");
|
||||
|
||||
//
|
||||
// test new -> init -> delete
|
||||
//
|
||||
printf("allocating decoder instance... ");
|
||||
decoder = new SeekableStreamDecoder();
|
||||
if(0 == decoder) {
|
||||
printf("FAILED, new returned NULL\n");
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing is_valid()... ");
|
||||
if(!decoder->is_valid()) {
|
||||
printf("FAILED, returned false\n");
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing init()... ");
|
||||
if(decoder->init() != ::FLAC__SEEKABLE_STREAM_DECODER_OK)
|
||||
return decoder->die();
|
||||
printf("OK\n");
|
||||
|
||||
printf("freeing decoder instance... ");
|
||||
delete decoder;
|
||||
printf("OK\n");
|
||||
|
||||
//
|
||||
// test normal usage
|
||||
//
|
||||
num_expected_ = 0;
|
||||
expected_metadata_sequence_[num_expected_++] = &streaminfo_;
|
||||
|
||||
@ -1520,6 +1624,58 @@ static bool test_file_decoder()
|
||||
|
||||
printf("\n+++ libFLAC++ unit test: FLAC::Decoder::File\n\n");
|
||||
|
||||
//
|
||||
// test new -> delete
|
||||
//
|
||||
printf("allocating decoder instance... ");
|
||||
decoder = new FileDecoder();
|
||||
if(0 == decoder) {
|
||||
printf("FAILED, new returned NULL\n");
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing is_valid()... ");
|
||||
if(!decoder->is_valid()) {
|
||||
printf("FAILED, returned false\n");
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("freeing decoder instance... ");
|
||||
delete decoder;
|
||||
printf("OK\n");
|
||||
|
||||
//
|
||||
// test new -> init -> delete
|
||||
//
|
||||
printf("allocating decoder instance... ");
|
||||
decoder = new FileDecoder();
|
||||
if(0 == decoder) {
|
||||
printf("FAILED, new returned NULL\n");
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing is_valid()... ");
|
||||
if(!decoder->is_valid()) {
|
||||
printf("FAILED, returned false\n");
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing init()... ");
|
||||
if(decoder->init() != ::FLAC__SEEKABLE_STREAM_DECODER_OK)
|
||||
return decoder->die();
|
||||
printf("OK\n");
|
||||
|
||||
printf("freeing decoder instance... ");
|
||||
delete decoder;
|
||||
printf("OK\n");
|
||||
|
||||
//
|
||||
// test normal usage
|
||||
//
|
||||
num_expected_ = 0;
|
||||
expected_metadata_sequence_[num_expected_++] = &streaminfo_;
|
||||
|
||||
|
@ -24,13 +24,11 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
(void)argc, (void)argv;
|
||||
|
||||
/*@@@@
|
||||
if(!test_encoders())
|
||||
return 1;
|
||||
|
||||
if(!test_decoders())
|
||||
return 1;
|
||||
@@@@*/
|
||||
|
||||
if(!test_metadata())
|
||||
return 1;
|
||||
|
@ -237,7 +237,6 @@ void OurFileDecoder::metadata_callback(const ::FLAC__StreamMetadata *metadata)
|
||||
}
|
||||
else {
|
||||
if(*our_metadata_.blocks[mc_our_block_number_] != metadata) {
|
||||
//@@@@if(!::FLAC__metadata_object_is_equal(our_metadata_.blocks[mc_our_block_number_], metadata)) {
|
||||
(void)die_("metadata block mismatch");
|
||||
error_occurred_ = true;
|
||||
}
|
||||
|
@ -58,17 +58,94 @@ FLAC__bool test_bitbuffer()
|
||||
|
||||
printf("\n+++ libFLAC unit test: bitbuffer\n\n");
|
||||
|
||||
printf("testing new... OK\n");
|
||||
/*
|
||||
* test new -> delete
|
||||
*/
|
||||
printf("testing new... ");
|
||||
bb = FLAC__bitbuffer_new();
|
||||
if(0 == bb) {
|
||||
printf("FAILED, returned NULL\n");
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing delete... ");
|
||||
FLAC__bitbuffer_delete(bb);
|
||||
printf("OK\n");
|
||||
|
||||
/*
|
||||
* test new -> init -> delete
|
||||
*/
|
||||
printf("testing new... ");
|
||||
bb = FLAC__bitbuffer_new();
|
||||
if(0 == bb) {
|
||||
printf("FAILED, returned NULL\n");
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing init... ");
|
||||
FLAC__bitbuffer_init(bb);
|
||||
if(0 == bb) {
|
||||
printf("FAILED, returned NULL\n");
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing delete... ");
|
||||
FLAC__bitbuffer_delete(bb);
|
||||
printf("OK\n");
|
||||
|
||||
/*
|
||||
* test new -> init -> clear -> delete
|
||||
*/
|
||||
printf("testing new... ");
|
||||
bb = FLAC__bitbuffer_new();
|
||||
if(0 == bb) {
|
||||
printf("FAILED, returned NULL\n");
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing init... ");
|
||||
FLAC__bitbuffer_init(bb);
|
||||
if(0 == bb) {
|
||||
printf("FAILED, returned NULL\n");
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing clear... ");
|
||||
FLAC__bitbuffer_clear(bb);
|
||||
if(0 == bb) {
|
||||
printf("FAILED, returned NULL\n");
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing delete... ");
|
||||
FLAC__bitbuffer_delete(bb);
|
||||
printf("OK\n");
|
||||
|
||||
/*
|
||||
* test normal usage
|
||||
*/
|
||||
printf("testing new... ");
|
||||
bb = FLAC__bitbuffer_new();
|
||||
bb_zero = FLAC__bitbuffer_new();
|
||||
bb_one = FLAC__bitbuffer_new();
|
||||
bbcopy = FLAC__bitbuffer_new();
|
||||
if(0 == bb || 0 == bb_zero || 0 == bb_one || 0 == bbcopy) {
|
||||
printf("FAILED, returned NULL\n");
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing init... OK\n");
|
||||
FLAC__bitbuffer_init(bb);
|
||||
FLAC__bitbuffer_init(bb_zero);
|
||||
FLAC__bitbuffer_init(bb_one);
|
||||
FLAC__bitbuffer_init(bbcopy);
|
||||
printf("testing init... ");
|
||||
ok = FLAC__bitbuffer_init(bb) && FLAC__bitbuffer_init(bb_zero) && FLAC__bitbuffer_init(bb_one) && FLAC__bitbuffer_init(bbcopy);
|
||||
printf("%s\n", ok?"OK":"FAILED");
|
||||
if(!ok)
|
||||
return false;
|
||||
|
||||
printf("testing clear... ");
|
||||
ok = FLAC__bitbuffer_clear(bb) && FLAC__bitbuffer_clear(bb_zero) && FLAC__bitbuffer_clear(bb_one) && FLAC__bitbuffer_clear(bbcopy);
|
||||
|
@ -344,6 +344,35 @@ static FLAC__bool test_stream_decoder()
|
||||
|
||||
printf("\n+++ libFLAC unit test: FLAC__StreamDecoder\n\n");
|
||||
|
||||
printf("testing FLAC__stream_decoder_new()... ");
|
||||
decoder = FLAC__stream_decoder_new();
|
||||
if(0 == decoder) {
|
||||
printf("FAILED, returned NULL\n");
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing FLAC__stream_decoder_delete()... ");
|
||||
FLAC__stream_decoder_delete(decoder);
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing FLAC__stream_decoder_new()... ");
|
||||
decoder = FLAC__stream_decoder_new();
|
||||
if(0 == decoder) {
|
||||
printf("FAILED, returned NULL\n");
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing FLAC__stream_decoder_init()... ");
|
||||
if(FLAC__stream_decoder_init(decoder) == FLAC__STREAM_DECODER_SEARCH_FOR_METADATA)
|
||||
return die_s_(0, decoder);
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing FLAC__stream_decoder_delete()... ");
|
||||
FLAC__stream_decoder_delete(decoder);
|
||||
printf("OK\n");
|
||||
|
||||
num_expected_ = 0;
|
||||
expected_metadata_sequence_[num_expected_++] = &streaminfo_;
|
||||
|
||||
@ -971,6 +1000,35 @@ static FLAC__bool test_seekable_stream_decoder()
|
||||
|
||||
printf("\n+++ libFLAC unit test: FLAC__SeekableStreamDecoder\n\n");
|
||||
|
||||
printf("testing FLAC__seekable_stream_decoder_new()... ");
|
||||
decoder = FLAC__seekable_stream_decoder_new();
|
||||
if(0 == decoder) {
|
||||
printf("FAILED, returned NULL\n");
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing FLAC__seekable_stream_decoder_delete()... ");
|
||||
FLAC__seekable_stream_decoder_delete(decoder);
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing FLAC__seekable_stream_decoder_new()... ");
|
||||
decoder = FLAC__seekable_stream_decoder_new();
|
||||
if(0 == decoder) {
|
||||
printf("FAILED, returned NULL\n");
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing FLAC__seekable_stream_decoder_init()... ");
|
||||
if(FLAC__seekable_stream_decoder_init(decoder) == FLAC__SEEKABLE_STREAM_DECODER_OK)
|
||||
return die_ss_(0, decoder);
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing FLAC__seekable_stream_decoder_delete()... ");
|
||||
FLAC__seekable_stream_decoder_delete(decoder);
|
||||
printf("OK\n");
|
||||
|
||||
num_expected_ = 0;
|
||||
expected_metadata_sequence_[num_expected_++] = &streaminfo_;
|
||||
|
||||
@ -1517,6 +1575,35 @@ static FLAC__bool test_file_decoder()
|
||||
|
||||
printf("\n+++ libFLAC unit test: FLAC__FileDecoder\n\n");
|
||||
|
||||
printf("testing FLAC__file_decoder_new()... ");
|
||||
decoder = FLAC__file_decoder_new();
|
||||
if(0 == decoder) {
|
||||
printf("FAILED, returned NULL\n");
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing FLAC__file_decoder_delete()... ");
|
||||
FLAC__file_decoder_delete(decoder);
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing FLAC__file_decoder_new()... ");
|
||||
decoder = FLAC__file_decoder_new();
|
||||
if(0 == decoder) {
|
||||
printf("FAILED, returned NULL\n");
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing FLAC__file_decoder_init()... ");
|
||||
if(FLAC__file_decoder_init(decoder) == FLAC__FILE_DECODER_OK)
|
||||
return die_f_(0, decoder);
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing FLAC__file_decoder_delete()... ");
|
||||
FLAC__file_decoder_delete(decoder);
|
||||
printf("OK\n");
|
||||
|
||||
num_expected_ = 0;
|
||||
expected_metadata_sequence_[num_expected_++] = &streaminfo_;
|
||||
|
||||
|
@ -21,7 +21,8 @@ EXTRA_DIST = \
|
||||
test_libFLAC.sh \
|
||||
test_libFLAC++.sh \
|
||||
test_streams.sh \
|
||||
test_bins.sh
|
||||
test_bins.sh \
|
||||
test_metaflac.sh
|
||||
|
||||
CLEANFILES = \
|
||||
$(wildcard *.raw) $(wildcard *.flac) $(wildcard *.cmp) $(wildcard *.wav) \
|
||||
|
@ -23,6 +23,7 @@ all: clean
|
||||
./test_libFLAC++.sh
|
||||
./test_streams.sh
|
||||
./test_bins.sh
|
||||
./test_metaflac.sh
|
||||
|
||||
debug: all
|
||||
|
||||
|
@ -21,6 +21,8 @@ LD_LIBRARY_PATH=../src/libFLAC/.libs:../obj/lib:$LD_LIBRARY_PATH
|
||||
export LD_LIBRARY_PATH
|
||||
PATH=../src/flac:../src/test_streams:../obj/bin:$PATH
|
||||
|
||||
flac --help 1>/dev/null 2>/dev/null || echo "ERROR can't find flac executable" 1>&2 && exit 1
|
||||
|
||||
echo "Generating streams..."
|
||||
if test_streams ; then : ; else
|
||||
echo "ERROR during test_streams" 1>&2
|
||||
|
Loading…
Reference in New Issue
Block a user