, _display (new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(640, (640 / 10) + 64)))
, _track (new wxChoice(this, wxID_ANY))
, _current_in_lines (false)
+ , _timer (this)
{
_lines.resize (CLOSED_CAPTION_LINES);
sizer->Add (track_sizer, 0, wxALL, DCPOMATIC_SIZER_GAP);
sizer->Add (_display, 1, wxEXPAND);
+ Bind (wxEVT_SHOW, boost::bind(&ClosedCaptionsDialog::shown, this, _1));
+ Bind (wxEVT_TIMER, boost::bind(&ClosedCaptionsDialog::update, this));
_display->Bind (wxEVT_PAINT, boost::bind(&ClosedCaptionsDialog::paint, this));
_track->Bind (wxEVT_CHOICE, boost::bind(&ClosedCaptionsDialog::track_selected, this));
SetSizerAndFit (sizer);
}
+void
+ClosedCaptionsDialog::shown (wxShowEvent ev)
+{
+ if (ev.IsShown ()) {
+ _timer.Start (40);
+ } else {
+ _timer.Stop ();
+ }
+}
+
void
ClosedCaptionsDialog::track_selected ()
{
_current = optional<TextRingBuffers::Data> ();
_viewer->slow_refresh ();
- update (_last_update);
+ update ();
}
void
};
void
-ClosedCaptionsDialog::update (DCPTime time)
+ClosedCaptionsDialog::update ()
{
- _last_update = time;
+ DCPTime const time = _viewer->time ();
if (_current_in_lines && _current && _current->period.to > time) {
/* Current one is fine */
public:
explicit ClosedCaptionsDialog (wxWindow* parent, FilmViewer* viewer);
- void update (dcpomatic::DCPTime);
void clear ();
void set_film_and_butler (boost::shared_ptr<Film>, boost::weak_ptr<Butler>);
private:
+ void shown (wxShowEvent);
+ void update ();
void paint ();
void track_selected ();
std::vector<wxString> _lines;
std::vector<DCPTextTrack> _tracks;
boost::weak_ptr<Butler> _butler;
- dcpomatic::DCPTime _last_update;
+ wxTimer _timer;
};
, _latency_history_count (0)
, _closed_captions_dialog (new ClosedCaptionsDialog(p, this))
, _outline_content (false)
- , _eyes (EYES_LEFT)
, _pad_black (false)
#ifdef DCPOMATIC_VARIANT_SWAROOP
, _background_image (false)
#endif
- , _gets (0)
, _idle_get (false)
{
switch (Config::instance()->video_view_type()) {
void
FilmViewer::set_eyes (Eyes e)
{
- _eyes = e;
+ _video_view->set_eyes (e);
slow_refresh ();
}
return _video_view->dropped ();
}
+int
+FilmViewer::gets () const
+{
+ return _video_view->gets ();
+}
+
+
void slow_refresh ();
+ dcpomatic::DCPTime time () const;
+ boost::optional<dcpomatic::DCPTime> audio_time () const;
+
int dropped () const;
+ int gets () const;
int audio_callback (void* out, unsigned int frames);
}
#endif
- int gets () const {
- return _gets;
- }
-
StateTimer const & state_timer () const {
return _video_view->state_timer ();
}
private:
- /* XXX_b: to remove */
- friend class SimpleVideoView;
- friend class GLVideoView;
- friend class VideoView;
-
void video_view_sized ();
void calculate_sizes ();
void player_change (ChangeType type, int, bool);
void config_changed (Config::Property);
void film_length_change ();
- dcpomatic::DCPTime time () const;
- boost::optional<dcpomatic::DCPTime> audio_time () const;
dcpomatic::DCPTime uncorrected_time () const;
Frame average_latency () const;
ClosedCaptionsDialog* _closed_captions_dialog;
bool _outline_content;
- Eyes _eyes;
/** true to pad the viewer panel with black, false to use
the normal window background colour.
*/
bool _background_image;
#endif
- int _gets;
-
/** true if an get() is required next time we are idle */
bool _idle_get;
_inter_size = player_video().first->inter_size ();
update ();
-
- _viewer->closed_captions_dialog()->update (_viewer->time());
}
#endif
, _state_timer ("viewer")
, _video_frame_rate (0)
+ , _eyes (EYES_LEFT)
, _dropped (0)
+ , _gets (0)
{
}
}
DCPOMATIC_ASSERT (_viewer->butler());
- _viewer->_gets++;
+ add_get ();
boost::mutex::scoped_lock lm (_mutex);
} while (
_player_video.first &&
_viewer->film()->three_d() &&
- _viewer->_eyes != _player_video.first->eyes() &&
+ _eyes != _player_video.first->eyes() &&
_player_video.first->eyes() != EYES_BOTH
);
#include "lib/dcpomatic_time.h"
#include "lib/timer.h"
+#include "lib/types.h"
#include <boost/shared_ptr.hpp>
#include <boost/signals2.hpp>
#include <boost/thread.hpp>
return _dropped;
}
+ int gets () const {
+ boost::mutex::scoped_lock lm (_mutex);
+ return _gets;
+ }
+
StateTimer const & state_timer () const {
return _state_timer;
}
_length = len;
}
+ void set_eyes (Eyes eyes) {
+ boost::mutex::scoped_lock lm (_mutex);
+ _eyes = eyes;
+ }
+
protected:
/* XXX_b: to remove */
friend class FilmViewer;
++_dropped;
}
+ void add_get () {
+ boost::mutex::scoped_lock lm (_mutex);
+ ++_gets;
+ }
+
FilmViewer* _viewer;
#ifdef DCPOMATIC_VARIANT_SWAROOP
int _video_frame_rate;
/** length of the film we are playing, or 0 if there is none */
dcpomatic::DCPTime _length;
+ Eyes _eyes;
int _dropped;
+ int _gets;
};
#endif