shared_ptr<AudioContent> content = piece->content->audio;
DCPOMATIC_ASSERT (content);
- shared_ptr<Resampler> r = resampler (content, stream);
+ shared_ptr<Resampler> r = resampler (content, stream, false);
+ if (!r) {
+ return;
+ }
+
pair<shared_ptr<const AudioBuffers>, Frame> ro = r->flush ();
ContentAudio content_audio;
content_audio.audio = ro.first;
/* Resample */
if (stream->frame_rate() != content->resampled_frame_rate()) {
- shared_ptr<Resampler> r = resampler (content, stream);
+ shared_ptr<Resampler> r = resampler (content, stream, true);
pair<shared_ptr<const AudioBuffers>, Frame> ro = r->run (content_audio.audio, content_audio.frame);
content_audio.audio = ro.first;
content_audio.frame = ro.second;
}
shared_ptr<Resampler>
-Player::resampler (shared_ptr<const AudioContent> content, AudioStreamPtr stream)
+Player::resampler (shared_ptr<const AudioContent> content, AudioStreamPtr stream, bool create)
{
ResamplerMap::const_iterator i = _resamplers.find (make_pair (content, stream));
if (i != _resamplers.end ()) {
return i->second;
}
+ if (!create) {
+ return shared_ptr<Resampler> ();
+ }
+
LOG_GENERAL (
"Creating new resampler from %1 to %2 with %3 channels",
stream->frame_rate(),
void audio (boost::weak_ptr<Piece>, AudioStreamPtr, ContentAudio);
void image_subtitle (boost::weak_ptr<Piece>, ContentImageSubtitle);
void text_subtitle (boost::weak_ptr<Piece>, ContentTextSubtitle);
- boost::shared_ptr<Resampler> resampler (boost::shared_ptr<const AudioContent> content, AudioStreamPtr stream);
+ boost::shared_ptr<Resampler> resampler (boost::shared_ptr<const AudioContent> content, AudioStreamPtr stream, bool create);
DCPTime one_video_frame () const;
void fill_video (DCPTimePeriod period);
void fill_audio (DCPTimePeriod period);