Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
flac
Commits
bc869506
Commit
bc869506
authored
Jun 14, 2002
by
Josh Coalson
Browse files
minor changes in anticipation of release
parent
d09958f8
Changes
22
Hide whitespace changes
Inline
Side-by-side
AUTHORS
View file @
bc869506
...
...
@@ -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
Makefile.am
View file @
bc869506
...
...
@@ -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
...
...
README
View file @
bc869506
...
...
@@ -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.
====================
...
...
include/FLAC/file_decoder.h
View file @
bc869506
...
...
@@ -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 */
...
...
include/FLAC/metadata.h
View file @
bc869506
...
...
@@ -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
);
...
...
include/FLAC/seekable_stream_decoder.h
View file @
bc869506
...
...
@@ -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
));
...
...
include/FLAC/stream_decoder.h
View file @
bc869506
...
...
@@ -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
));
...
...
include/FLAC/stream_encoder.h
View file @
bc869506
...
...
@@ -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
);
...
...
src/libFLAC/bitbuffer.c
View file @
bc869506
...
...
@@ -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
)
...
...
src/libFLAC/file_decoder.c
View file @
bc869506
...
...
@@ -120,10 +120,12 @@ FLAC__FileDecoder *FLAC__file_decoder_new()
return
0
;
}
decoder
->
pr
otec
te
d
_
->
state
=
FLAC__FILE_DECODER_UNINITIALIZED
;
decoder
->
pr
iva
te_
->
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
);
...
...
src/libFLAC/metadata_object.c
View file @
bc869506
...
...
@@ -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));
...
...
src/libFLAC/seekable_stream_decoder.c
View file @
bc869506
...
...
@@ -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
);
(
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_
);
...
...
@@ -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
)
...
...
src/libFLAC/stream_decoder.c
View file @
bc869506
...
...
@@ -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
++
)
{
...
...
src/plugin_winamp3/flacpcm.cpp
View file @
bc869506
...
...
@@ -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
,
'/'
);
...
...
src/test_libFLAC++/decoders.cc
View file @
bc869506
...
...
@@ -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_
;
...
...
src/test_libFLAC++/main.cc
View file @
bc869506
...
...
@@ -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
;
...
...
src/test_libFLAC++/metadata_manip.cc
View file @
bc869506
...
...
@@ -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
;
}
...
...
src/test_libFLAC/bitbuffer.c
View file @
bc869506
...
...
@@ -58,17 +58,94 @@ FLAC__bool test_bitbuffer()
printf
(
"
\n
+++ libFLAC unit test: bitbuffer
\n\n
"
);