#include <stdlib.h>
#include <string.h>
-static ::FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_;
-static ::FLAC__StreamMetadata *expected_metadata_sequence_[7];
+static ::FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_, unknown_;
+static ::FLAC__StreamMetadata *expected_metadata_sequence_[8];
static unsigned num_expected_;
static const char *flacfilename_ = "metadata.flac";
static unsigned flacfilesize_;
static void init_metadata_blocks_()
{
- mutils__init_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_);
+ mutils__init_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &unknown_);
}
static void free_metadata_blocks_()
{
- mutils__free_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_);
+ mutils__free_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &unknown_);
}
static bool generate_file_()
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!file_utils__generate_flacfile(flacfilename_, &flacfilesize_, 512 * 1024, &streaminfo_, expected_metadata_sequence_, num_expected_))
return die_("creating the encoded file");
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!decoder->test_respond())
return false;
expected_metadata_sequence_[num_expected_++] = &application1_;
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!decoder->test_respond())
return false;
expected_metadata_sequence_[num_expected_++] = &seektable_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!decoder->test_respond())
return false;
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!decoder->test_respond())
return false;
expected_metadata_sequence_[num_expected_++] = &seektable_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!decoder->test_respond())
return false;
expected_metadata_sequence_[num_expected_++] = &application1_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!decoder->test_respond())
return false;
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
::fclose(decoder->file_);
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!decoder->test_respond())
return false;
expected_metadata_sequence_[num_expected_++] = &application1_;
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!decoder->test_respond())
return false;
expected_metadata_sequence_[num_expected_++] = &seektable_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!decoder->test_respond())
return false;
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!decoder->test_respond())
return false;
expected_metadata_sequence_[num_expected_++] = &seektable_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!decoder->test_respond())
return false;
expected_metadata_sequence_[num_expected_++] = &application1_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!decoder->test_respond())
return false;
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
::fclose(decoder->file_);
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!decoder->test_respond())
return false;
expected_metadata_sequence_[num_expected_++] = &application1_;
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!decoder->test_respond())
return false;
expected_metadata_sequence_[num_expected_++] = &seektable_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!decoder->test_respond())
return false;
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!decoder->test_respond())
return false;
expected_metadata_sequence_[num_expected_++] = &seektable_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!decoder->test_respond())
return false;
expected_metadata_sequence_[num_expected_++] = &application1_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!decoder->test_respond())
return false;
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
printf("freeing decoder instance... ");
delete decoder;
#include <stdlib.h>
#include <string.h>
-static ::FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_;
-static ::FLAC__StreamMetadata *metadata_sequence_[] = { &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_ };
+static ::FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_, unknown_;
+static ::FLAC__StreamMetadata *metadata_sequence_[] = { &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &unknown_ };
static const unsigned num_metadata_ = sizeof(metadata_sequence_) / sizeof(metadata_sequence_[0]);
static const char *flacfilename_ = "metadata.flac";
static void init_metadata_blocks_()
{
- mutils__init_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_);
+ mutils__init_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &unknown_);
}
static void free_metadata_blocks_()
{
- mutils__free_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_);
+ mutils__free_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &unknown_);
}
class StreamEncoder : public FLAC::Encoder::Stream {
FLAC__StreamMetadata *application1,
FLAC__StreamMetadata *application2,
FLAC__StreamMetadata *vorbiscomment,
- FLAC__StreamMetadata *cuesheet
+ FLAC__StreamMetadata *cuesheet,
+ FLAC__StreamMetadata *unknown
)
{
/*
vorbiscomment->data.vorbis_comment.comments[1].entry = 0;
}
- cuesheet->is_last = true;
+ cuesheet->is_last = false;
cuesheet->type = FLAC__METADATA_TYPE_CUESHEET;
cuesheet->length =
/* cuesheet guts */
cuesheet->data.cue_sheet.tracks[2].offset = 12345 * 588;
cuesheet->data.cue_sheet.tracks[2].number = 170;
cuesheet->data.cue_sheet.tracks[2].num_indices = 0;
+
+ unknown->is_last = true;
+ unknown->type = 127;
+ unknown->length = 8;
+ unknown->data.unknown.data = (FLAC__byte*)malloc_or_die_(8);
+ memcpy(unknown->data.unknown.data, "\xfe\xdc\xba\x98\xf0\xe1\xd2\xc3", 8);
}
void mutils__free_metadata_blocks(
FLAC__StreamMetadata *application1,
FLAC__StreamMetadata *application2,
FLAC__StreamMetadata *vorbiscomment,
- FLAC__StreamMetadata *cuesheet
+ FLAC__StreamMetadata *cuesheet,
+ FLAC__StreamMetadata *unknown
)
{
(void)streaminfo, (void)padding, (void)application2;
free(cuesheet->data.cue_sheet.tracks[0].indices);
free(cuesheet->data.cue_sheet.tracks[1].indices);
free(cuesheet->data.cue_sheet.tracks);
+ free(unknown->data.unknown.data);
}
FLAC__StreamMetadata *application1,
FLAC__StreamMetadata *application2,
FLAC__StreamMetadata *vorbiscomment,
- FLAC__StreamMetadata *cuesheet
+ FLAC__StreamMetadata *cuesheet,
+ FLAC__StreamMetadata *unknown
);
void mutils__free_metadata_blocks(
FLAC__StreamMetadata *application1,
FLAC__StreamMetadata *application2,
FLAC__StreamMetadata *vorbiscomment,
- FLAC__StreamMetadata *cuesheet
+ FLAC__StreamMetadata *cuesheet,
+ FLAC__StreamMetadata *unknown
);
#endif
typedef stream_decoder_client_data_struct seekable_stream_decoder_client_data_struct;
typedef stream_decoder_client_data_struct file_decoder_client_data_struct;
-static FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_;
-static FLAC__StreamMetadata *expected_metadata_sequence_[7];
+static FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_, unknown_;
+static FLAC__StreamMetadata *expected_metadata_sequence_[8];
static unsigned num_expected_;
static const char *flacfilename_ = "metadata.flac";
static unsigned flacfilesize_;
static void init_metadata_blocks_()
{
- mutils__init_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_);
+ mutils__init_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &unknown_);
}
static void free_metadata_blocks_()
{
- mutils__free_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_);
+ mutils__free_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &unknown_);
}
static FLAC__bool generate_file_()
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!file_utils__generate_flacfile(flacfilename_, &flacfilesize_, 512 * 1024, &streaminfo_, expected_metadata_sequence_, num_expected_))
return die_("creating the encoded file");
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!stream_decoder_test_respond_(decoder, &decoder_client_data))
return false;
expected_metadata_sequence_[num_expected_++] = &application1_;
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!stream_decoder_test_respond_(decoder, &decoder_client_data))
return false;
expected_metadata_sequence_[num_expected_++] = &seektable_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!stream_decoder_test_respond_(decoder, &decoder_client_data))
return false;
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!stream_decoder_test_respond_(decoder, &decoder_client_data))
return false;
expected_metadata_sequence_[num_expected_++] = &seektable_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!stream_decoder_test_respond_(decoder, &decoder_client_data))
return false;
expected_metadata_sequence_[num_expected_++] = &application1_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!stream_decoder_test_respond_(decoder, &decoder_client_data))
return false;
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
printf("testing FLAC__stream_decoder_delete()... ");
FLAC__stream_decoder_delete(decoder);
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!seekable_stream_decoder_test_respond_(decoder, &decoder_client_data))
return false;
expected_metadata_sequence_[num_expected_++] = &application1_;
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!seekable_stream_decoder_test_respond_(decoder, &decoder_client_data))
return false;
expected_metadata_sequence_[num_expected_++] = &seektable_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!seekable_stream_decoder_test_respond_(decoder, &decoder_client_data))
return false;
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!seekable_stream_decoder_test_respond_(decoder, &decoder_client_data))
return false;
expected_metadata_sequence_[num_expected_++] = &seektable_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!seekable_stream_decoder_test_respond_(decoder, &decoder_client_data))
return false;
expected_metadata_sequence_[num_expected_++] = &application1_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!seekable_stream_decoder_test_respond_(decoder, &decoder_client_data))
return false;
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
printf("testing FLAC__seekable_stream_decoder_delete()... ");
FLAC__seekable_stream_decoder_delete(decoder);
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!file_decoder_test_respond_(decoder, &decoder_client_data))
return false;
expected_metadata_sequence_[num_expected_++] = &application1_;
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!file_decoder_test_respond_(decoder, &decoder_client_data))
return false;
expected_metadata_sequence_[num_expected_++] = &seektable_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!file_decoder_test_respond_(decoder, &decoder_client_data))
return false;
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!file_decoder_test_respond_(decoder, &decoder_client_data))
return false;
expected_metadata_sequence_[num_expected_++] = &seektable_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!file_decoder_test_respond_(decoder, &decoder_client_data))
return false;
expected_metadata_sequence_[num_expected_++] = &application1_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!file_decoder_test_respond_(decoder, &decoder_client_data))
return false;
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
printf("testing FLAC__file_decoder_delete()... ");
FLAC__file_decoder_delete(decoder);
#include <stdlib.h>
#include <string.h>
-static FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_;
-static FLAC__StreamMetadata *metadata_sequence_[] = { &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_ };
+static FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_, unknown_;
+static FLAC__StreamMetadata *metadata_sequence_[] = { &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &unknown_ };
static const unsigned num_metadata_ = sizeof(metadata_sequence_) / sizeof(metadata_sequence_[0]);
static const char *flacfilename_ = "metadata.flac";
static void init_metadata_blocks_()
{
- mutils__init_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_);
+ mutils__init_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &unknown_);
}
static void free_metadata_blocks_()
{
- mutils__free_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_);
+ mutils__free_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &unknown_);
}
static FLAC__StreamEncoderWriteStatus stream_encoder_write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data)
FLAC__StreamMetadata *application1,
FLAC__StreamMetadata *application2,
FLAC__StreamMetadata *vorbiscomment,
- FLAC__StreamMetadata *cuesheet
+ FLAC__StreamMetadata *cuesheet,
+ FLAC__StreamMetadata *unknown
)
{
/*
vorbiscomment->data.vorbis_comment.comments[1].entry = 0;
}
- cuesheet->is_last = true;
+ cuesheet->is_last = false;
cuesheet->type = FLAC__METADATA_TYPE_CUESHEET;
cuesheet->length =
/* cuesheet guts */
cuesheet->data.cue_sheet.tracks[2].offset = 12345 * 588;
cuesheet->data.cue_sheet.tracks[2].number = 170;
cuesheet->data.cue_sheet.tracks[2].num_indices = 0;
+
+ unknown->is_last = true;
+ unknown->type = 127;
+ unknown->length = 8;
+ unknown->data.unknown.data = (FLAC__byte*)malloc_or_die_(unknown->length);
+ memcpy(unknown->data.unknown.data, "\xfe\xdc\xba\x98\xf0\xe1\xd2\xc3", unknown->length);
}
void mutils__free_metadata_blocks(
FLAC__StreamMetadata *application1,
FLAC__StreamMetadata *application2,
FLAC__StreamMetadata *vorbiscomment,
- FLAC__StreamMetadata *cuesheet
+ FLAC__StreamMetadata *cuesheet,
+ FLAC__StreamMetadata *unknown
)
{
(void)streaminfo, (void)padding, (void)application2;
free(cuesheet->data.cue_sheet.tracks[0].indices);
free(cuesheet->data.cue_sheet.tracks[1].indices);
free(cuesheet->data.cue_sheet.tracks);
+ free(unknown->data.unknown.data);
}
FLAC__StreamMetadata *application1,
FLAC__StreamMetadata *application2,
FLAC__StreamMetadata *vorbiscomment,
- FLAC__StreamMetadata *cuesheet
+ FLAC__StreamMetadata *cuesheet,
+ FLAC__StreamMetadata *unknown
);
void mutils__free_metadata_blocks(
FLAC__StreamMetadata *application1,
FLAC__StreamMetadata *application2,
FLAC__StreamMetadata *vorbiscomment,
- FLAC__StreamMetadata *cuesheet
+ FLAC__StreamMetadata *cuesheet,
+ FLAC__StreamMetadata *unknown
);
#endif
#include <stdlib.h>
#include <string.h>
-static ::FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_;
-static ::FLAC__StreamMetadata *expected_metadata_sequence_[7];
+static ::FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_, unknown_;
+static ::FLAC__StreamMetadata *expected_metadata_sequence_[8];
static unsigned num_expected_;
static const char *oggflacfilename_ = "metadata.ogg";
static unsigned oggflacfilesize_;
static void init_metadata_blocks_()
{
- mutils__init_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_);
+ mutils__init_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &unknown_);
}
static void free_metadata_blocks_()
{
- mutils__free_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_);
+ mutils__free_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &unknown_);
}
static bool generate_file_()
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!file_utils__generate_oggflacfile(oggflacfilename_, &oggflacfilesize_, 512 * 1024, &streaminfo_, expected_metadata_sequence_, num_expected_))
return die_("creating the encoded file");
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!decoder->test_respond())
return false;
expected_metadata_sequence_[num_expected_++] = &application1_;
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!decoder->test_respond())
return false;
expected_metadata_sequence_[num_expected_++] = &seektable_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!decoder->test_respond())
return false;
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!decoder->test_respond())
return false;
expected_metadata_sequence_[num_expected_++] = &seektable_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!decoder->test_respond())
return false;
expected_metadata_sequence_[num_expected_++] = &application1_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!decoder->test_respond())
return false;
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
::fclose(decoder->file_);
#include <stdlib.h>
#include <string.h>
-static ::FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_;
-static ::FLAC__StreamMetadata *metadata_sequence_[] = { &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_ };
+static ::FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_, unknown_;
+static ::FLAC__StreamMetadata *metadata_sequence_[] = { &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &unknown_ };
static const unsigned num_metadata_ = sizeof(metadata_sequence_) / sizeof(metadata_sequence_[0]);
static void init_metadata_blocks_()
{
- mutils__init_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_);
+ mutils__init_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &unknown_);
}
static void free_metadata_blocks_()
{
- mutils__free_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_);
+ mutils__free_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &unknown_);
}
class StreamEncoder : public OggFLAC::Encoder::Stream {
FLAC__StreamMetadata *application1,
FLAC__StreamMetadata *application2,
FLAC__StreamMetadata *vorbiscomment,
- FLAC__StreamMetadata *cuesheet
+ FLAC__StreamMetadata *cuesheet,
+ FLAC__StreamMetadata *unknown
)
{
/*
vorbiscomment->data.vorbis_comment.comments[1].entry = 0;
}
- cuesheet->is_last = true;
+ cuesheet->is_last = false;
cuesheet->type = FLAC__METADATA_TYPE_CUESHEET;
cuesheet->length =
/* cuesheet guts */
cuesheet->data.cue_sheet.tracks[2].offset = 12345 * 588;
cuesheet->data.cue_sheet.tracks[2].number = 170;
cuesheet->data.cue_sheet.tracks[2].num_indices = 0;
+
+ unknown->is_last = true;
+ unknown->type = 127;
+ unknown->length = 8;
+ unknown->data.unknown.data = (FLAC__byte*)malloc_or_die_(8);
+ memcpy(unknown->data.unknown.data, "\xfe\xdc\xba\x98\xf0\xe1\xd2\xc3", 8);
}
void mutils__free_metadata_blocks(
FLAC__StreamMetadata *application1,
FLAC__StreamMetadata *application2,
FLAC__StreamMetadata *vorbiscomment,
- FLAC__StreamMetadata *cuesheet
+ FLAC__StreamMetadata *cuesheet,
+ FLAC__StreamMetadata *unknown
)
{
(void)streaminfo, (void)padding, (void)application2;
free(cuesheet->data.cue_sheet.tracks[0].indices);
free(cuesheet->data.cue_sheet.tracks[1].indices);
free(cuesheet->data.cue_sheet.tracks);
+ free(unknown->data.unknown.data);
}
FLAC__StreamMetadata *application1,
FLAC__StreamMetadata *application2,
FLAC__StreamMetadata *vorbiscomment,
- FLAC__StreamMetadata *cuesheet
+ FLAC__StreamMetadata *cuesheet,
+ FLAC__StreamMetadata *unknown
);
void mutils__free_metadata_blocks(
FLAC__StreamMetadata *application1,
FLAC__StreamMetadata *application2,
FLAC__StreamMetadata *vorbiscomment,
- FLAC__StreamMetadata *cuesheet
+ FLAC__StreamMetadata *cuesheet,
+ FLAC__StreamMetadata *unknown
);
#endif
FLAC__bool error_occurred;
} stream_decoder_client_data_struct;
-static FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_;
-static FLAC__StreamMetadata *expected_metadata_sequence_[7];
+static FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_, unknown_;
+static FLAC__StreamMetadata *expected_metadata_sequence_[8];
static unsigned num_expected_;
static const char *oggflacfilename_ = "metadata.ogg";
static unsigned oggflacfilesize_;
static void init_metadata_blocks_()
{
- mutils__init_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_);
+ mutils__init_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &unknown_);
}
static void free_metadata_blocks_()
{
- mutils__free_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_);
+ mutils__free_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &unknown_);
}
static FLAC__bool generate_file_()
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!file_utils__generate_oggflacfile(oggflacfilename_, &oggflacfilesize_, 512 * 1024, &streaminfo_, expected_metadata_sequence_, num_expected_))
return die_("creating the encoded file");
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!stream_decoder_test_respond_(decoder, &decoder_client_data))
return false;
expected_metadata_sequence_[num_expected_++] = &application1_;
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!stream_decoder_test_respond_(decoder, &decoder_client_data))
return false;
expected_metadata_sequence_[num_expected_++] = &seektable_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!stream_decoder_test_respond_(decoder, &decoder_client_data))
return false;
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!stream_decoder_test_respond_(decoder, &decoder_client_data))
return false;
expected_metadata_sequence_[num_expected_++] = &seektable_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!stream_decoder_test_respond_(decoder, &decoder_client_data))
return false;
expected_metadata_sequence_[num_expected_++] = &application1_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
if(!stream_decoder_test_respond_(decoder, &decoder_client_data))
return false;
expected_metadata_sequence_[num_expected_++] = &application2_;
expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
expected_metadata_sequence_[num_expected_++] = &cuesheet_;
+ expected_metadata_sequence_[num_expected_++] = &unknown_;
printf("testing OggFLAC__stream_decoder_delete()... ");
OggFLAC__stream_decoder_delete(decoder);
#include <stdlib.h>
#include <string.h>
-static FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_;
-static FLAC__StreamMetadata *metadata_sequence_[] = { &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_ };
+static FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_, unknown_;
+static FLAC__StreamMetadata *metadata_sequence_[] = { &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &unknown_ };
static const unsigned num_metadata_ = sizeof(metadata_sequence_) / sizeof(metadata_sequence_[0]);
static const char *oggflacfilename_ = "metadata.ogg";
static void init_metadata_blocks_()
{
- mutils__init_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_);
+ mutils__init_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &unknown_);
}
static void free_metadata_blocks_()
{
- mutils__free_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_);
+ mutils__free_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &unknown_);
}
static FLAC__StreamEncoderWriteStatus stream_encoder_write_callback_(const OggFLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data)
FLAC__StreamMetadata *application1,
FLAC__StreamMetadata *application2,
FLAC__StreamMetadata *vorbiscomment,
- FLAC__StreamMetadata *cuesheet
+ FLAC__StreamMetadata *cuesheet,
+ FLAC__StreamMetadata *unknown
)
{
/*
vorbiscomment->data.vorbis_comment.comments[1].entry = 0;
}
- cuesheet->is_last = true;
+ cuesheet->is_last = false;
cuesheet->type = FLAC__METADATA_TYPE_CUESHEET;
cuesheet->length =
/* cuesheet guts */
cuesheet->data.cue_sheet.tracks[2].offset = 12345 * 588;
cuesheet->data.cue_sheet.tracks[2].number = 170;
cuesheet->data.cue_sheet.tracks[2].num_indices = 0;
+
+ unknown->is_last = true;
+ unknown->type = 127;
+ unknown->length = 8;
+ unknown->data.unknown.data = (FLAC__byte*)malloc_or_die_(unknown->length);
+ memcpy(unknown->data.unknown.data, "\xfe\xdc\xba\x98\xf0\xe1\xd2\xc3", unknown->length);
}
void mutils__free_metadata_blocks(
FLAC__StreamMetadata *application1,
FLAC__StreamMetadata *application2,
FLAC__StreamMetadata *vorbiscomment,
- FLAC__StreamMetadata *cuesheet
+ FLAC__StreamMetadata *cuesheet,
+ FLAC__StreamMetadata *unknown
)
{
(void)streaminfo, (void)padding, (void)application2;
free(cuesheet->data.cue_sheet.tracks[0].indices);
free(cuesheet->data.cue_sheet.tracks[1].indices);
free(cuesheet->data.cue_sheet.tracks);
+ free(unknown->data.unknown.data);
}
FLAC__StreamMetadata *application1,
FLAC__StreamMetadata *application2,
FLAC__StreamMetadata *vorbiscomment,
- FLAC__StreamMetadata *cuesheet
+ FLAC__StreamMetadata *cuesheet,
+ FLAC__StreamMetadata *unknown
);
void mutils__free_metadata_blocks(
FLAC__StreamMetadata *application1,
FLAC__StreamMetadata *application2,
FLAC__StreamMetadata *vorbiscomment,
- FLAC__StreamMetadata *cuesheet
+ FLAC__StreamMetadata *cuesheet,
+ FLAC__StreamMetadata *unknown
);
#endif