2 Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
21 /** @file src/film_viewer.h
22 * @brief A wx widget to view `thumbnails' of a Film.
26 #include "lib/config.h"
27 #include "lib/player_text.h"
34 class RGBPlusAlphaImage;
38 class ClosedCaptionsDialog;
41 * @brief A wx widget to view a preview of a Film.
46 FilmViewer (wxWindow *, bool outline_content = true, bool jump_to_selected = true);
49 wxPanel* panel () const {
53 void set_film (boost::shared_ptr<Film>);
54 boost::shared_ptr<Film> film () const {
58 /** @return our `playhead' position; this may not lie exactly on a frame boundary */
59 DCPTime position () const {
60 return _video_position;
63 void set_position (DCPTime p);
64 void set_position (boost::shared_ptr<Content> content, ContentTime p);
65 void set_coalesce_player_changes (bool c);
66 void set_dcp_decode_reduction (boost::optional<int> reduction);
67 boost::optional<int> dcp_decode_reduction () const;
70 bool quick_refresh ();
72 int dropped () const {
78 bool playing () const {
82 void move (DCPTime by);
83 DCPTime one_video_frame () const;
84 void seek (DCPTime t, bool accurate);
85 DCPTime video_position () const {
86 return _video_position;
89 int audio_callback (void* out, unsigned int frames);
91 void show_closed_captions ();
93 boost::signals2::signal<void (boost::weak_ptr<PlayerVideo>)> ImageChanged;
97 void panel_sized (wxSizeEvent &);
99 void calculate_sizes ();
100 void check_play_state ();
101 void player_change (ChangeType type, int, bool);
103 void display_player_video ();
104 void refresh_panel ();
105 void film_change (ChangeType, Film::Property);
106 DCPTime nudge_amount (wxKeyboardState &);
107 void timecode_clicked ();
108 void go_to (DCPTime t);
109 void recreate_butler ();
110 void config_changed (Config::Property);
111 DCPTime time () const;
112 DCPTime uncorrected_time () const;
113 Frame average_latency () const;
115 boost::shared_ptr<Film> _film;
116 boost::shared_ptr<Player> _player;
118 /** The area that we put our image in */
121 bool _coalesce_player_changes;
122 std::list<int> _pending_player_changes;
124 std::pair<boost::shared_ptr<PlayerVideo>, DCPTime> _player_video;
125 boost::shared_ptr<const Image> _frame;
126 DCPTime _video_position;
127 Position<int> _inter_position;
128 dcp::Size _inter_size;
130 /** Size of our output (including padding if we have any) */
132 /** Size of the panel that we have available */
133 dcp::Size _panel_size;
137 unsigned int _audio_block_size;
139 boost::shared_ptr<Butler> _butler;
141 std::list<Frame> _latency_history;
142 /** Mutex to protect _latency_history */
143 mutable boost::mutex _latency_history_mutex;
144 int _latency_history_count;
147 boost::optional<int> _dcp_decode_reduction;
149 ClosedCaptionsDialog* _closed_captions_dialog;
151 boost::signals2::scoped_connection _config_changed_connection;