#include "audio_buffers.h"
using std::min;
+using std::cout;
using boost::shared_ptr;
SilenceDecoder::SilenceDecoder (shared_ptr<const Film> f, shared_ptr<NullContent> c)
: Decoder (f)
- , AudioDecoder (f, c)
+ , AudioDecoder (f)
+ , _null_content (c)
{
}
{
shared_ptr<const Film> film = _film.lock ();
assert (film);
-
- Time const this_time = min (_audio_content->length() - _next_audio, TIME_HZ / 2);
- shared_ptr<AudioBuffers> data (new AudioBuffers (MAX_AUDIO_CHANNELS, film->time_to_audio_frames (this_time)));
- data->make_silent ();
- audio (data, _next_audio);
-}
-void
-SilenceDecoder::seek (Time t)
-{
- _next_audio = t;
+ AudioContent::Frame const this_time = min (_null_content->audio_length() - _next_audio_frame, int64_t (_null_content->output_audio_frame_rate() / 2));
+ shared_ptr<AudioBuffers> data (new AudioBuffers (film->dcp_audio_channels(), this_time));
+ data->make_silent ();
+ audio (data, _next_audio_frame);
}
-Time
-SilenceDecoder::next () const
+bool
+SilenceDecoder::done () const
{
- return _next_audio;
+ return _next_audio_frame > _null_content->audio_length ();
}