+FLAC__SeekableStreamEncoderSeekStatus seekable_stream_encoder_seek_callback_(const FLAC__SeekableStreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data)
+{
+ (void)encoder, (void)absolute_byte_offset, (void)client_data;
+ return FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_OK;
+}
+
+FLAC__StreamEncoderWriteStatus seekable_stream_encoder_write_callback_(const FLAC__SeekableStreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data)
+{
+ (void)encoder, (void)buffer, (void)bytes, (void)samples, (void)current_frame, (void)client_data;
+ return FLAC__STREAM_ENCODER_WRITE_STATUS_OK;
+}
+
+static FLAC__bool test_seekable_stream_encoder()
+{
+ FLAC__SeekableStreamEncoder *encoder;
+ FLAC__SeekableStreamEncoderState state;
+ FLAC__int32 samples[1024];
+ FLAC__int32 *samples_array[1] = { samples };
+ unsigned i;
+
+ printf("\n+++ libFLAC unit test: FLAC__SeekableStreamEncoder\n\n");
+
+ printf("testing FLAC__seekable_stream_encoder_new()... ");
+ encoder = FLAC__seekable_stream_encoder_new();
+ if(0 == encoder) {
+ printf("FAILED, returned NULL\n");
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_set_streamable_subset()... ");
+ if(!FLAC__seekable_stream_encoder_set_streamable_subset(encoder, true))
+ return die_ss_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_set_do_mid_side_stereo()... ");
+ if(!FLAC__seekable_stream_encoder_set_do_mid_side_stereo(encoder, false))
+ return die_ss_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_set_loose_mid_side_stereo()... ");
+ if(!FLAC__seekable_stream_encoder_set_loose_mid_side_stereo(encoder, false))
+ return die_ss_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_set_channels()... ");
+ if(!FLAC__seekable_stream_encoder_set_channels(encoder, streaminfo_.data.stream_info.channels))
+ return die_ss_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_set_bits_per_sample()... ");
+ if(!FLAC__seekable_stream_encoder_set_bits_per_sample(encoder, streaminfo_.data.stream_info.bits_per_sample))
+ return die_ss_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_set_sample_rate()... ");
+ if(!FLAC__seekable_stream_encoder_set_sample_rate(encoder, streaminfo_.data.stream_info.sample_rate))
+ return die_ss_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_set_blocksize()... ");
+ if(!FLAC__seekable_stream_encoder_set_blocksize(encoder, streaminfo_.data.stream_info.min_blocksize))
+ return die_ss_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_set_max_lpc_order()... ");
+ if(!FLAC__seekable_stream_encoder_set_max_lpc_order(encoder, 0))
+ return die_ss_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_set_qlp_coeff_precision()... ");
+ if(!FLAC__seekable_stream_encoder_set_qlp_coeff_precision(encoder, 0))
+ return die_ss_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search()... ");
+ if(!FLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search(encoder, false))
+ return die_ss_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_set_do_escape_coding()... ");
+ if(!FLAC__seekable_stream_encoder_set_do_escape_coding(encoder, false))
+ return die_ss_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_set_do_exhaustive_model_search()... ");
+ if(!FLAC__seekable_stream_encoder_set_do_exhaustive_model_search(encoder, false))
+ return die_ss_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_set_min_residual_partition_order()... ");
+ if(!FLAC__seekable_stream_encoder_set_min_residual_partition_order(encoder, 0))
+ return die_ss_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_set_max_residual_partition_order()... ");
+ if(!FLAC__seekable_stream_encoder_set_max_residual_partition_order(encoder, 0))
+ return die_ss_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_set_rice_parameter_search_dist()... ");
+ if(!FLAC__seekable_stream_encoder_set_rice_parameter_search_dist(encoder, 0))
+ return die_ss_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_set_total_samples_estimate()... ");
+ if(!FLAC__seekable_stream_encoder_set_total_samples_estimate(encoder, streaminfo_.data.stream_info.total_samples))
+ return die_ss_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_set_metadata()... ");
+ if(!FLAC__seekable_stream_encoder_set_metadata(encoder, metadata_sequence_, num_metadata_))
+ return die_ss_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_set_seek_callback()... ");
+ if(!FLAC__seekable_stream_encoder_set_seek_callback(encoder, seekable_stream_encoder_seek_callback_))
+ return die_ss_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_set_write_callback()... ");
+ if(!FLAC__seekable_stream_encoder_set_write_callback(encoder, seekable_stream_encoder_write_callback_))
+ return die_ss_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_set_client_data()... ");
+ if(!FLAC__seekable_stream_encoder_set_client_data(encoder, 0))
+ return die_ss_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_init()... ");
+ if(FLAC__seekable_stream_encoder_init(encoder) != FLAC__SEEKABLE_STREAM_ENCODER_OK)
+ return die_ss_(0, encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_get_state()... ");
+ state = FLAC__seekable_stream_encoder_get_state(encoder);
+ printf("returned state = %u (%s)... OK\n", (unsigned)state, FLAC__SeekableStreamEncoderStateString[state]);
+
+ printf("testing FLAC__seekable_stream_encoder_get_streamable_subset()... ");
+ if(FLAC__seekable_stream_encoder_get_streamable_subset(encoder) != true) {
+ printf("FAILED, expected true, got false\n");
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_get_do_mid_side_stereo()... ");
+ if(FLAC__seekable_stream_encoder_get_do_mid_side_stereo(encoder) != false) {
+ printf("FAILED, expected false, got true\n");
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_get_loose_mid_side_stereo()... ");
+ if(FLAC__seekable_stream_encoder_get_loose_mid_side_stereo(encoder) != false) {
+ printf("FAILED, expected false, got true\n");
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_get_channels()... ");
+ if(FLAC__seekable_stream_encoder_get_channels(encoder) != streaminfo_.data.stream_info.channels) {
+ printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.channels, FLAC__seekable_stream_encoder_get_channels(encoder));
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_get_bits_per_sample()... ");
+ if(FLAC__seekable_stream_encoder_get_bits_per_sample(encoder) != streaminfo_.data.stream_info.bits_per_sample) {
+ printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.bits_per_sample, FLAC__seekable_stream_encoder_get_bits_per_sample(encoder));
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_get_sample_rate()... ");
+ if(FLAC__seekable_stream_encoder_get_sample_rate(encoder) != streaminfo_.data.stream_info.sample_rate) {
+ printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.sample_rate, FLAC__seekable_stream_encoder_get_sample_rate(encoder));
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_get_blocksize()... ");
+ if(FLAC__seekable_stream_encoder_get_blocksize(encoder) != streaminfo_.data.stream_info.min_blocksize) {
+ printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.min_blocksize, FLAC__seekable_stream_encoder_get_blocksize(encoder));
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_get_max_lpc_order()... ");
+ if(FLAC__seekable_stream_encoder_get_max_lpc_order(encoder) != 0) {
+ printf("FAILED, expected %u, got %u\n", 0, FLAC__seekable_stream_encoder_get_max_lpc_order(encoder));
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_get_qlp_coeff_precision()... ");
+ (void)FLAC__seekable_stream_encoder_get_qlp_coeff_precision(encoder);
+ /* we asked the encoder to auto select this so we accept anything */
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search()... ");
+ if(FLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search(encoder) != false) {
+ printf("FAILED, expected false, got true\n");
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_get_do_escape_coding()... ");
+ if(FLAC__seekable_stream_encoder_get_do_escape_coding(encoder) != false) {
+ printf("FAILED, expected false, got true\n");
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_get_do_exhaustive_model_search()... ");
+ if(FLAC__seekable_stream_encoder_get_do_exhaustive_model_search(encoder) != false) {
+ printf("FAILED, expected false, got true\n");
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_get_min_residual_partition_order()... ");
+ if(FLAC__seekable_stream_encoder_get_min_residual_partition_order(encoder) != 0) {
+ printf("FAILED, expected %u, got %u\n", 0, FLAC__seekable_stream_encoder_get_min_residual_partition_order(encoder));
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_get_max_residual_partition_order()... ");
+ if(FLAC__seekable_stream_encoder_get_max_residual_partition_order(encoder) != 0) {
+ printf("FAILED, expected %u, got %u\n", 0, FLAC__seekable_stream_encoder_get_max_residual_partition_order(encoder));
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_get_rice_parameter_search_dist()... ");
+ if(FLAC__seekable_stream_encoder_get_rice_parameter_search_dist(encoder) != 0) {
+ printf("FAILED, expected %u, got %u\n", 0, FLAC__seekable_stream_encoder_get_rice_parameter_search_dist(encoder));
+ return false;
+ }
+ printf("OK\n");
+
+ /* init the dummy sample buffer */
+ for(i = 0; i < sizeof(samples) / sizeof(FLAC__int32); i++)
+ samples[i] = i & 7;
+
+ printf("testing FLAC__seekable_stream_encoder_process()... ");
+ if(!FLAC__seekable_stream_encoder_process(encoder, (const FLAC__int32 * const *)samples_array, sizeof(samples) / sizeof(FLAC__int32)))
+ return die_ss_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_process_interleaved()... ");
+ if(!FLAC__seekable_stream_encoder_process_interleaved(encoder, samples, sizeof(samples) / sizeof(FLAC__int32)))
+ return die_ss_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_finish()... ");
+ FLAC__seekable_stream_encoder_finish(encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__seekable_stream_encoder_delete()... ");
+ FLAC__seekable_stream_encoder_delete(encoder);
+ printf("OK\n");
+
+ printf("\nPASSED!\n");
+
+ return true;
+}
+
+static FLAC__bool test_file_encoder()
+{
+ FLAC__FileEncoder *encoder;
+ FLAC__FileEncoderState state;
+ FLAC__int32 samples[1024];
+ FLAC__int32 *samples_array[1] = { samples };
+ unsigned i;
+
+ printf("\n+++ libFLAC unit test: FLAC__FileEncoder\n\n");
+
+ printf("testing FLAC__file_encoder_new()... ");
+ encoder = FLAC__file_encoder_new();
+ if(0 == encoder) {
+ printf("FAILED, returned NULL\n");
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_set_streamable_subset()... ");
+ if(!FLAC__file_encoder_set_streamable_subset(encoder, true))
+ return die_f_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_set_do_mid_side_stereo()... ");
+ if(!FLAC__file_encoder_set_do_mid_side_stereo(encoder, false))
+ return die_f_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_set_loose_mid_side_stereo()... ");
+ if(!FLAC__file_encoder_set_loose_mid_side_stereo(encoder, false))
+ return die_f_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_set_channels()... ");
+ if(!FLAC__file_encoder_set_channels(encoder, streaminfo_.data.stream_info.channels))
+ return die_f_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_set_bits_per_sample()... ");
+ if(!FLAC__file_encoder_set_bits_per_sample(encoder, streaminfo_.data.stream_info.bits_per_sample))
+ return die_f_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_set_sample_rate()... ");
+ if(!FLAC__file_encoder_set_sample_rate(encoder, streaminfo_.data.stream_info.sample_rate))
+ return die_f_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_set_blocksize()... ");
+ if(!FLAC__file_encoder_set_blocksize(encoder, streaminfo_.data.stream_info.min_blocksize))
+ return die_f_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_set_max_lpc_order()... ");
+ if(!FLAC__file_encoder_set_max_lpc_order(encoder, 0))
+ return die_f_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_set_qlp_coeff_precision()... ");
+ if(!FLAC__file_encoder_set_qlp_coeff_precision(encoder, 0))
+ return die_f_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_set_do_qlp_coeff_prec_search()... ");
+ if(!FLAC__file_encoder_set_do_qlp_coeff_prec_search(encoder, false))
+ return die_f_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_set_do_escape_coding()... ");
+ if(!FLAC__file_encoder_set_do_escape_coding(encoder, false))
+ return die_f_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_set_do_exhaustive_model_search()... ");
+ if(!FLAC__file_encoder_set_do_exhaustive_model_search(encoder, false))
+ return die_f_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_set_min_residual_partition_order()... ");
+ if(!FLAC__file_encoder_set_min_residual_partition_order(encoder, 0))
+ return die_f_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_set_max_residual_partition_order()... ");
+ if(!FLAC__file_encoder_set_max_residual_partition_order(encoder, 0))
+ return die_f_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_set_rice_parameter_search_dist()... ");
+ if(!FLAC__file_encoder_set_rice_parameter_search_dist(encoder, 0))
+ return die_f_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_set_total_samples_estimate()... ");
+ if(!FLAC__file_encoder_set_total_samples_estimate(encoder, streaminfo_.data.stream_info.total_samples))
+ return die_f_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_set_metadata()... ");
+ if(!FLAC__file_encoder_set_metadata(encoder, metadata_sequence_, num_metadata_))
+ return die_f_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_set_filename()... ");
+ if(!FLAC__file_encoder_set_filename(encoder, flacfilename_))
+ return die_f_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_init()... ");
+ if(FLAC__file_encoder_init(encoder) != FLAC__FILE_ENCODER_OK)
+ return die_f_(0, encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_get_state()... ");
+ state = FLAC__file_encoder_get_state(encoder);
+ printf("returned state = %u (%s)... OK\n", (unsigned)state, FLAC__FileEncoderStateString[state]);
+
+ printf("testing FLAC__file_encoder_get_streamable_subset()... ");
+ if(FLAC__file_encoder_get_streamable_subset(encoder) != true) {
+ printf("FAILED, expected true, got false\n");
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_get_do_mid_side_stereo()... ");
+ if(FLAC__file_encoder_get_do_mid_side_stereo(encoder) != false) {
+ printf("FAILED, expected false, got true\n");
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_get_loose_mid_side_stereo()... ");
+ if(FLAC__file_encoder_get_loose_mid_side_stereo(encoder) != false) {
+ printf("FAILED, expected false, got true\n");
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_get_channels()... ");
+ if(FLAC__file_encoder_get_channels(encoder) != streaminfo_.data.stream_info.channels) {
+ printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.channels, FLAC__file_encoder_get_channels(encoder));
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_get_bits_per_sample()... ");
+ if(FLAC__file_encoder_get_bits_per_sample(encoder) != streaminfo_.data.stream_info.bits_per_sample) {
+ printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.bits_per_sample, FLAC__file_encoder_get_bits_per_sample(encoder));
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_get_sample_rate()... ");
+ if(FLAC__file_encoder_get_sample_rate(encoder) != streaminfo_.data.stream_info.sample_rate) {
+ printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.sample_rate, FLAC__file_encoder_get_sample_rate(encoder));
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_get_blocksize()... ");
+ if(FLAC__file_encoder_get_blocksize(encoder) != streaminfo_.data.stream_info.min_blocksize) {
+ printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.min_blocksize, FLAC__file_encoder_get_blocksize(encoder));
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_get_max_lpc_order()... ");
+ if(FLAC__file_encoder_get_max_lpc_order(encoder) != 0) {
+ printf("FAILED, expected %u, got %u\n", 0, FLAC__file_encoder_get_max_lpc_order(encoder));
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_get_qlp_coeff_precision()... ");
+ (void)FLAC__file_encoder_get_qlp_coeff_precision(encoder);
+ /* we asked the encoder to auto select this so we accept anything */
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_get_do_qlp_coeff_prec_search()... ");
+ if(FLAC__file_encoder_get_do_qlp_coeff_prec_search(encoder) != false) {
+ printf("FAILED, expected false, got true\n");
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_get_do_escape_coding()... ");
+ if(FLAC__file_encoder_get_do_escape_coding(encoder) != false) {
+ printf("FAILED, expected false, got true\n");
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_get_do_exhaustive_model_search()... ");
+ if(FLAC__file_encoder_get_do_exhaustive_model_search(encoder) != false) {
+ printf("FAILED, expected false, got true\n");
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_get_min_residual_partition_order()... ");
+ if(FLAC__file_encoder_get_min_residual_partition_order(encoder) != 0) {
+ printf("FAILED, expected %u, got %u\n", 0, FLAC__file_encoder_get_min_residual_partition_order(encoder));
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_get_max_residual_partition_order()... ");
+ if(FLAC__file_encoder_get_max_residual_partition_order(encoder) != 0) {
+ printf("FAILED, expected %u, got %u\n", 0, FLAC__file_encoder_get_max_residual_partition_order(encoder));
+ return false;
+ }
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_get_rice_parameter_search_dist()... ");
+ if(FLAC__file_encoder_get_rice_parameter_search_dist(encoder) != 0) {
+ printf("FAILED, expected %u, got %u\n", 0, FLAC__file_encoder_get_rice_parameter_search_dist(encoder));
+ return false;
+ }
+ printf("OK\n");
+
+ /* init the dummy sample buffer */
+ for(i = 0; i < sizeof(samples) / sizeof(FLAC__int32); i++)
+ samples[i] = i & 7;
+
+ printf("testing FLAC__file_encoder_process()... ");
+ if(!FLAC__file_encoder_process(encoder, (const FLAC__int32 * const *)samples_array, sizeof(samples) / sizeof(FLAC__int32)))
+ return die_f_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_process_interleaved()... ");
+ if(!FLAC__file_encoder_process_interleaved(encoder, samples, sizeof(samples) / sizeof(FLAC__int32)))
+ return die_f_("returned false", encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_finish()... ");
+ FLAC__file_encoder_finish(encoder);
+ printf("OK\n");
+
+ printf("testing FLAC__file_encoder_delete()... ");
+ FLAC__file_encoder_delete(encoder);
+ printf("OK\n");
+
+ printf("\nPASSED!\n");
+
+ return true;
+}
+