add ..._get_total_samples_estimate(), add progress callback to file encoder

This commit is contained in:
Josh Coalson
2002-08-02 07:40:38 +00:00
parent 3a7b2c9be8
commit b5bc249415
6 changed files with 196 additions and 14 deletions

View File

@@ -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;