return ContentTime::from_frames (i->second, _content->resampled_frame_rate(film));
}
-ContentTime
+boost::optional<ContentTime>
AudioDecoder::position (shared_ptr<const Film> film) const
{
optional<ContentTime> p;
}
}
- return p.get_value_or(ContentTime());
+ return p;
}
void
public:
AudioDecoder (Decoder* parent, boost::shared_ptr<const AudioContent> content, bool fast);
- dcpomatic::ContentTime position (boost::shared_ptr<const Film> film) const;
+ boost::optional<dcpomatic::ContentTime> position (boost::shared_ptr<const Film> film) const;
void emit (boost::shared_ptr<const Film> film, AudioStreamPtr stream, boost::shared_ptr<const AudioBuffers>, dcpomatic::ContentTime);
void seek ();
void flush ();
optional<ContentTime> pos;
shared_ptr<const Film> f = film();
- if (video && !video->ignore() && (!pos || video->position(f) < *pos)) {
+ if (video && !video->ignore() && (!pos || video->position(f).get_value_or(ContentTime()) < *pos)) {
pos = video->position(f);
}
- if (audio && !audio->ignore() && (!pos || audio->position(f) < *pos)) {
+ if (audio && !audio->ignore() && (!pos || audio->position(f).get_value_or(ContentTime()) < *pos)) {
pos = audio->position(f);
}
DecoderPart (Decoder* parent);
virtual ~DecoderPart () {}
- virtual dcpomatic::ContentTime position (boost::shared_ptr<const Film> film) const = 0;
+ virtual boost::optional<dcpomatic::ContentTime> position (boost::shared_ptr<const Film> film) const = 0;
virtual void seek () = 0;
void set_ignore (bool i) {
if (video) {
double const vfr = _ffmpeg_content->video_frame_rate().get();
Frame const f = full_length.frames_round (vfr);
- Frame v = video->position(film()).frames_round(vfr) + 1;
+ Frame v = video->position(film()).get_value_or(ContentTime()).frames_round(vfr) + 1;
while (v < f) {
video->emit (film(), shared_ptr<const ImageProxy> (new RawImageProxy (_black_image)), v);
++v;
dcpomatic::ContentTime first
);
- dcpomatic::ContentTime position (boost::shared_ptr<const Film>) const {
+ boost::optional<dcpomatic::ContentTime> position (boost::shared_ptr<const Film>) const {
return _position;
}
private:
boost::shared_ptr<const TextContent> _content;
- dcpomatic::ContentTime _position;
+ boost::optional<dcpomatic::ContentTime> _position;
};
#endif
void
VideoDecoder::seek ()
{
- _position = ContentTime();
+ _position = boost::optional<ContentTime>();
_last_emitted_frame.reset ();
_last_emitted_eyes.reset ();
}
friend struct ffmpeg_pts_offset_test;
friend void ffmpeg_decoder_sequential_test_one (boost::filesystem::path file, float fps, int gaps, int video_length);
- dcpomatic::ContentTime position (boost::shared_ptr<const Film>) const {
+ boost::optional<dcpomatic::ContentTime> position (boost::shared_ptr<const Film>) const {
return _position;
}
/** Frame of last thing to be emitted */
boost::optional<Frame> _last_emitted_frame;
boost::optional<Eyes> _last_emitted_eyes;
- dcpomatic::ContentTime _position;
+ boost::optional<dcpomatic::ContentTime> _position;
};
#endif