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:
@@ -377,6 +377,13 @@ static bool test_stream_encoder()
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing get_total_samples_estimate()... ");
|
||||
if(encoder->get_total_samples_estimate() != streaminfo_.data.stream_info.total_samples) {
|
||||
printf("FAILED, expected %llu, got %llu\n", streaminfo_.data.stream_info.total_samples, encoder->get_total_samples_estimate());
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
/* init the dummy sample buffer */
|
||||
for(i = 0; i < sizeof(samples) / sizeof(FLAC__int32); i++)
|
||||
samples[i] = i & 7;
|
||||
@@ -673,6 +680,13 @@ static bool test_seekable_stream_encoder()
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing get_total_samples_estimate()... ");
|
||||
if(encoder->get_total_samples_estimate() != streaminfo_.data.stream_info.total_samples) {
|
||||
printf("FAILED, expected %llu, got %llu\n", streaminfo_.data.stream_info.total_samples, encoder->get_total_samples_estimate());
|
||||
return false;
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
/* init the dummy sample buffer */
|
||||
for(i = 0; i < sizeof(samples) / sizeof(FLAC__int32); i++)
|
||||
samples[i] = i & 7;
|
||||
@@ -706,11 +720,16 @@ public:
|
||||
~FileEncoder() { }
|
||||
|
||||
// from FLAC::Encoder::File
|
||||
//@@@@ progress callback
|
||||
void progress_callback(unsigned current_frame, unsigned total_frames_estimate);
|
||||
|
||||
bool die(const char *msg = 0) const;
|
||||
};
|
||||
|
||||
void FileEncoder::progress_callback(unsigned current_frame, unsigned total_frames_estimate)
|
||||
{
|
||||
(void)current_frame, (void)total_frames_estimate;
|
||||
}
|
||||
|
||||
bool FileEncoder::die(const char *msg) const
|
||||
{
|
||||
State state = get_state();
|
||||
@@ -967,6 +986,13 @@ static bool test_file_encoder()
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
printf("testing get_total_samples_estimate()... ");
|
||||
if(encoder->get_total_samples_estimate() != streaminfo_.data.stream_info.total_samples) {
|
||||
printf("FAILED, expected %llu, got %llu\n", streaminfo_.data.stream_info.total_samples, encoder->get_total_samples_estimate());
|
||||
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