Commit 999be3b9 authored by Josh Coalson's avatar Josh Coalson
Browse files

last batch of changes and fixes based on the libFLAC++ unit tests

parent 02783cd1
......@@ -454,7 +454,7 @@ namespace FLAC {
bool is_valid() const;
void init(Chain *chain);
void init(Chain &chain);
bool next();
bool prev();
......
......@@ -80,11 +80,10 @@ extern "C" {
* Only one routine to read the STREAMINFO. Skips any ID3v2 tag at the
* head of the file. Useful for file-based player plugins.
*
* Provide the address of a FLAC__StreamMetadata_StreamInfo object to
* fill.
* Provide the address of a FLAC__StreamMetadata object to fill.
*/
FLAC__bool FLAC__metadata_get_streaminfo(const char *filename, FLAC__StreamMetadata_StreamInfo *streaminfo);
FLAC__bool FLAC__metadata_get_streaminfo(const char *filename, FLAC__StreamMetadata *streaminfo);
/***********************************************************************
......
......@@ -749,7 +749,7 @@ namespace FLAC {
::FLAC__StreamMetadata s;
if(::FLAC__metadata_get_streaminfo(filename, &s.data.stream_info)) {
if(::FLAC__metadata_get_streaminfo(filename, &s)) {
streaminfo = s;
return true;
}
......@@ -929,12 +929,11 @@ namespace FLAC {
return 0 != iterator_;
}
void Iterator::init(Chain *chain)
void Iterator::init(Chain &chain)
{
FLAC__ASSERT(0 != chain);
FLAC__ASSERT(is_valid());
FLAC__ASSERT(chain->is_valid());
::FLAC__metadata_iterator_init(iterator_, chain->chain_);
FLAC__ASSERT(chain.is_valid());
::FLAC__metadata_iterator_init(iterator_, chain.chain_);
}
bool Iterator::next()
......
......@@ -118,10 +118,10 @@ static void error_callback_(const FLAC__FileDecoder *decoder, FLAC__StreamDecode
typedef struct {
FLAC__bool got_error;
FLAC__bool got_streaminfo;
FLAC__StreamMetadata_StreamInfo *streaminfo;
FLAC__StreamMetadata *streaminfo;
} level0_client_data;
FLAC__bool FLAC__metadata_get_streaminfo(const char *filename, FLAC__StreamMetadata_StreamInfo *streaminfo)
FLAC__bool FLAC__metadata_get_streaminfo(const char *filename, FLAC__StreamMetadata *streaminfo)
{
level0_client_data cd;
FLAC__FileDecoder *decoder = FLAC__file_decoder_new();
......@@ -171,7 +171,7 @@ void metadata_callback_(const FLAC__FileDecoder *decoder, const FLAC__StreamMeta
(void)decoder;
if(metadata->type == FLAC__METADATA_TYPE_STREAMINFO && 0 != cd->streaminfo) {
*(cd->streaminfo) = metadata->data.stream_info;
*(cd->streaminfo) = *metadata;
cd->got_streaminfo = true;
}
}
......
......@@ -211,7 +211,7 @@ int infoDlg(char *fn, HWND hwnd)
void getfileinfo(char *filename, char *title, int *length_in_ms)
{
id3v1_struct tag;
FLAC__StreamMetadata_StreamInfo streaminfo;
FLAC__StreamMetadata streaminfo;
if(0 == filename) {
filename = lastfn_;
......
......@@ -220,7 +220,7 @@ void FLAC_XMMS__cleanup()
void FLAC_XMMS__get_song_info(char *filename, char **title, int *length_in_msec)
{
id3v1_struct tag;
FLAC__StreamMetadata_StreamInfo streaminfo;
FLAC__StreamMetadata streaminfo;
if(0 == filename)
filename = "";
......
This diff is collapsed.
......@@ -367,7 +367,7 @@ static FLAC__bool remove_file_(const char *filename)
static FLAC__bool test_level_0_()
{
FLAC__StreamMetadata_StreamInfo streaminfo;
FLAC__StreamMetadata streaminfo;
printf("\n\n++++++ testing level 0 interface\n");
......@@ -381,16 +381,16 @@ static FLAC__bool test_level_0_()
return die_("during FLAC__metadata_get_streaminfo()");
/* check to see if some basic data matches (c.f. generate_file_()) */
if(streaminfo.channels != 1)
return die_("mismatch in streaminfo.channels");
if(streaminfo.bits_per_sample != 8)
return die_("mismatch in streaminfo.bits_per_sample");
if(streaminfo.sample_rate != 44100)
return die_("mismatch in streaminfo.sample_rate");
if(streaminfo.min_blocksize != 576)
return die_("mismatch in streaminfo.min_blocksize");
if(streaminfo.max_blocksize != 576)
return die_("mismatch in streaminfo.max_blocksize");
if(streaminfo.data.stream_info.channels != 1)
return die_("mismatch in streaminfo.data.stream_info.channels");
if(streaminfo.data.stream_info.bits_per_sample != 8)
return die_("mismatch in streaminfo.data.stream_info.bits_per_sample");
if(streaminfo.data.stream_info.sample_rate != 44100)
return die_("mismatch in streaminfo.data.stream_info.sample_rate");
if(streaminfo.data.stream_info.min_blocksize != 576)
return die_("mismatch in streaminfo.data.stream_info.min_blocksize");
if(streaminfo.data.stream_info.max_blocksize != 576)
return die_("mismatch in streaminfo.data.stream_info.max_blocksize");
if(!remove_file_(flacfile_))
return false;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment