mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
add ..._get_total_samples_estimate(), add progress callback to file encoder
This commit is contained in:
@@ -413,6 +413,13 @@ static FLAC__bool test_stream_encoder()
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing FLAC__stream_encoder_get_total_samples_estimate()... ");
|
||||
if(FLAC__stream_encoder_get_total_samples_estimate(encoder) != streaminfo_.data.stream_info.total_samples) {
|
||||
printf("FAILED, expected %llu, got %llu\n", streaminfo_.data.stream_info.total_samples, FLAC__stream_encoder_get_total_samples_estimate(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;
|
||||
@@ -682,6 +689,13 @@ static FLAC__bool test_seekable_stream_encoder()
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing FLAC__seekable_stream_encoder_get_total_samples_estimate()... ");
|
||||
if(FLAC__seekable_stream_encoder_get_total_samples_estimate(encoder) != streaminfo_.data.stream_info.total_samples) {
|
||||
printf("FAILED, expected %llu, got %llu\n", streaminfo_.data.stream_info.total_samples, FLAC__seekable_stream_encoder_get_total_samples_estimate(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;
|
||||
@@ -709,6 +723,11 @@ static FLAC__bool test_seekable_stream_encoder()
|
||||
return true;
|
||||
}
|
||||
|
||||
static void file_encoder_progress_callback_(const FLAC__FileEncoder *encoder, unsigned current_frame, unsigned total_frames_estimate, void *client_data)
|
||||
{
|
||||
(void)encoder, (void)current_frame, (void)total_frames_estimate, (void)client_data;
|
||||
}
|
||||
|
||||
static FLAC__bool test_file_encoder()
|
||||
{
|
||||
FLAC__FileEncoder *encoder;
|
||||
@@ -817,6 +836,16 @@ static FLAC__bool test_file_encoder()
|
||||
return die_f_("returned false", encoder);
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing FLAC__file_encoder_set_progress_callback()... ");
|
||||
if(!FLAC__file_encoder_set_progress_callback(encoder, file_encoder_progress_callback_))
|
||||
return die_f_("returned false", encoder);
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing FLAC__file_encoder_set_client_data()... ");
|
||||
if(!FLAC__file_encoder_set_client_data(encoder, 0))
|
||||
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);
|
||||
@@ -929,6 +958,13 @@ static FLAC__bool test_file_encoder()
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing FLAC__file_encoder_get_total_samples_estimate()... ");
|
||||
if(FLAC__file_encoder_get_total_samples_estimate(encoder) != streaminfo_.data.stream_info.total_samples) {
|
||||
printf("FAILED, expected %llu, got %llu\n", streaminfo_.data.stream_info.total_samples, FLAC__file_encoder_get_total_samples_estimate(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;
|
||||
|
||||
Reference in New Issue
Block a user