* 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
#
# 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
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
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
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.
====================
* (*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 *);
* 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 */
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);
* (*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 *);
* 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));
* (*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 *);
* 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));
* 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);
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)
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;
}
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_);
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
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)
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);
*
***************************************************************************/
-/*@@@@move
+/*@@@move
will return pointer to new empty object of type 'type', or 0 if malloc failed
type is valid 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);
*/
}
}
-/*@@@@move
+/*@@@move
frees 'object'. does a deep delete.
*/
void FLAC__metadata_object_delete(FLAC__StreamMetadata *object)
}
}
-/*@@@@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));
FLAC__ASSERT(decoder != 0);
FLAC__ASSERT(decoder->protected_ != 0);
FLAC__ASSERT(decoder->private_ != 0);
+ FLAC__ASSERT(decoder->private_->stream_decoder != 0);
+
+ (void)FLAC__seekable_stream_decoder_finish(decoder);
- if(decoder->private_->stream_decoder != 0)
- FLAC__stream_decoder_delete(decoder->private_->stream_decoder);
+ FLAC__stream_decoder_delete(decoder->private_->stream_decoder);
free(decoder->private_);
free(decoder->protected_);
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;
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)
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 */
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);
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;
}
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);
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;
/*
}
#endif
- return decoder->protected_->state;
+ return decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_METADATA;
}
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++) {
const char *temp;\r
FILE *f = fopen(filename, "rb");\r
memset(tag, 0, sizeof(id3v1_struct));\r
-#if 0\r
-@@@@\r
-strcpy(tag->title,"Sonata K.42");\r
-strcpy(tag->artist,"Domenico Scarlatti");\r
-strcpy(tag->album,"Narcisso Yepes Plays Scarlatti");\r
-sprintf(tag->description, "%s - %s", tag->artist, tag->title);\r
-#endif\r
\r
/* set the title and description to the filename by default */\r
temp = strrchr(filename, '/');\r
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_;
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_;
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_;
{
(void)argc, (void)argv;
-/*@@@@
if(!test_encoders())
return 1;
if(!test_decoders())
return 1;
-@@@@*/
if(!test_metadata())
return 1;
}
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;
}
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);
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_;
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_;
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_;
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) \
./test_libFLAC++.sh
./test_streams.sh
./test_bins.sh
+ ./test_metaflac.sh
debug: all
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