#include "film_viewer.h"
#include "lib/butler.h"
+VideoView::VideoView (FilmViewer* viewer)
+ : _viewer (viewer)
+#ifdef DCPOMATIC_VARIANT_SWAROOP
+ , _in_watermark (false)
+#endif
+ , _state_timer ("viewer")
+ , _video_frame_rate (0)
+ , _dropped (0)
+{
+
+}
+
void
VideoView::clear ()
{
bool
VideoView::get_next_frame (bool non_blocking)
{
+ if (_length == dcpomatic::DCPTime()) {
+ return true;
+ }
+
DCPOMATIC_ASSERT (_viewer->butler());
_viewer->_gets++;
_player_video.first->eyes() != EYES_BOTH
);
- try {
- _viewer->butler()->rethrow ();
- } catch (DecodeError& e) {
- error_dialog (get(), e.what());
- }
-
return true;
}
dcpomatic::DCPTime
VideoView::one_video_frame () const
{
- return dcpomatic::DCPTime::from_frames (1, film()->video_frame_rate());
+ return dcpomatic::DCPTime::from_frames (1, video_frame_rate());
}
-/* XXX_b: comment */
+/** @return Time in ms until the next frame is due */
int
VideoView::time_until_next_frame () const
{
+ if (length() == dcpomatic::DCPTime()) {
+ /* There's no content, so this doesn't matter */
+ return 0;
+ }
+
dcpomatic::DCPTime const next = position() + one_video_frame();
dcpomatic::DCPTime const time = _viewer->audio_time().get_value_or(position());
- std::cout << to_string(next) << " " << to_string(time) << " " << ((next.seconds() - time.seconds()) * 1000) << "\n";
if (next < time) {
return 0;
}
return (next.seconds() - time.seconds()) * 1000;
}
+void
+VideoView::start ()
+{
+ boost::mutex::scoped_lock lm (_mutex);
+ _dropped = 0;
+}