diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-09-15 23:36:21 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-09-27 13:41:46 +0200 |
| commit | 3799e91d126d243d41c44dcb0ca1bfa66b53a57e (patch) | |
| tree | 74348b18d5ac0ef81bbebb27fe32862b22baa0b2 /src/wx | |
| parent | 9bfa07293928c371d59db2091ba2b7e715ce5994 (diff) | |
Replace aligned bool with enum Alignment.
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/film_viewer.cc | 10 | ||||
| -rw-r--r-- | src/wx/gl_video_view.cc | 8 | ||||
| -rw-r--r-- | src/wx/simple_video_view.cc | 22 | ||||
| -rw-r--r-- | src/wx/video_waveform_plot.cc | 4 |
4 files changed, 23 insertions, 21 deletions
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 735ba02eb..5609ebf86 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -63,17 +63,11 @@ extern "C" { using std::bad_alloc; using std::cout; using std::dynamic_pointer_cast; -using std::exception; -using std::list; -using std::make_pair; using std::make_shared; using std::max; -using std::min; -using std::pair; using std::shared_ptr; using std::string; using std::vector; -using std::weak_ptr; using boost::optional; #if BOOST_VERSION >= 106100 using namespace boost::placeholders; @@ -169,7 +163,7 @@ FilmViewer::set_film (shared_ptr<Film> film) } try { - _player = make_shared<Player>(_film, !_optimise_for_j2k); + _player = make_shared<Player>(_film, _optimise_for_j2k ? Image::Alignment::COMPACT : Image::Alignment::PADDED); _player->set_fast (); if (_dcp_decode_reduction) { _player->set_dcp_decode_reduction (_dcp_decode_reduction); @@ -221,7 +215,7 @@ FilmViewer::recreate_butler () _audio_channels, bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, - !_optimise_for_j2k, + _optimise_for_j2k ? Image::Alignment::COMPACT : Image::Alignment::PADDED, true, dynamic_pointer_cast<GLVideoView>(_video_view) && _optimise_for_j2k ); diff --git a/src/wx/gl_video_view.cc b/src/wx/gl_video_view.cc index 6288a24a3..046465864 100644 --- a/src/wx/gl_video_view.cc +++ b/src/wx/gl_video_view.cc @@ -497,12 +497,12 @@ GLVideoView::draw (Position<int>, dcp::Size) void GLVideoView::set_image (shared_ptr<const PlayerVideo> pv) { - shared_ptr<const Image> video = _optimise_for_j2k ? pv->raw_image() : pv->image(bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, false, true); + shared_ptr<const Image> video = _optimise_for_j2k ? pv->raw_image() : pv->image(bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, Image::Alignment::COMPACT, true); /* Only the player's black frames should be aligned at this stage, so this should * almost always have no work to do. */ - video = Image::ensure_aligned (video, false); + video = Image::ensure_alignment (video, Image::Alignment::COMPACT); /** If _optimise_for_j2k is true we render a XYZ image, doing the colourspace * conversion, scaling and video range conversion in the GL shader. @@ -517,7 +517,7 @@ GLVideoView::set_image (shared_ptr<const PlayerVideo> pv) _have_subtitle_to_render = static_cast<bool>(text) && _optimise_for_j2k; if (_have_subtitle_to_render) { /* opt: only do this if it's a new subtitle? */ - DCPOMATIC_ASSERT (!text->image->aligned()); + DCPOMATIC_ASSERT (text->image->alignment() == Image::Alignment::COMPACT); _subtitle_texture->set (text->image); } @@ -788,7 +788,7 @@ Texture::set (shared_ptr<const Image> image) glPixelStorei (GL_UNPACK_ALIGNMENT, _unpack_alignment); check_gl_error ("glPixelStorei"); - DCPOMATIC_ASSERT (!image->aligned()); + DCPOMATIC_ASSERT (image->alignment() == Image::Alignment::COMPACT); GLint internal_format; GLenum format; diff --git a/src/wx/simple_video_view.cc b/src/wx/simple_video_view.cc index 5dd47ce4c..e54c8390e 100644 --- a/src/wx/simple_video_view.cc +++ b/src/wx/simple_video_view.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2019 Carl Hetherington <cth@carlh.net> + Copyright (C) 2019-2021 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -18,21 +18,23 @@ */ -#include "simple_video_view.h" + +#include "closed_captions_dialog.h" #include "film_viewer.h" +#include "simple_video_view.h" #include "wx_util.h" -#include "closed_captions_dialog.h" -#include "lib/image.h" -#include "lib/dcpomatic_log.h" #include "lib/butler.h" +#include "lib/dcpomatic_log.h" +#include "lib/image.h" #include <dcp/util.h> #include <wx/wx.h> #include <boost/bind/bind.hpp> + using std::max; +using std::shared_ptr; using std::string; using boost::optional; -using std::shared_ptr; #if BOOST_VERSION >= 106100 using namespace boost::placeholders; #endif @@ -57,6 +59,7 @@ SimpleVideoView::SimpleVideoView (FilmViewer* viewer, wxWindow* parent) _timer.Bind (wxEVT_TIMER, boost::bind(&SimpleVideoView::timer, this)); } + void SimpleVideoView::paint () { @@ -113,6 +116,7 @@ SimpleVideoView::paint () _state_timer.unset(); } + void SimpleVideoView::refresh_panel () { @@ -122,6 +126,7 @@ SimpleVideoView::refresh_panel () _state_timer.unset (); } + void SimpleVideoView::timer () { @@ -145,6 +150,7 @@ SimpleVideoView::timer () } } + void SimpleVideoView::start () { @@ -152,6 +158,7 @@ SimpleVideoView::start () timer (); } + /** Try to get a frame from the butler and display it. * @param non_blocking true to return false quickly if no video is available quickly (i.e. we are waiting for the butler). * false to ask the butler to block until it has video (unless it is suspended). @@ -176,6 +183,7 @@ SimpleVideoView::display_next_frame (bool non_blocking) return SUCCESS; } + void SimpleVideoView::update () { @@ -214,7 +222,7 @@ SimpleVideoView::update () _state_timer.set ("get image"); set_image ( - player_video().first->image(bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, false, true) + player_video().first->image(bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, Image::Alignment::COMPACT, true) ); _state_timer.set ("ImageChanged"); diff --git a/src/wx/video_waveform_plot.cc b/src/wx/video_waveform_plot.cc index 2e45f3493..07b2955b3 100644 --- a/src/wx/video_waveform_plot.cc +++ b/src/wx/video_waveform_plot.cc @@ -155,7 +155,7 @@ VideoWaveformPlot::create_waveform () auto const image_size = _image->size(); int const waveform_height = GetSize().GetHeight() - _vertical_margin * 2; - _waveform = make_shared<Image>(AV_PIX_FMT_RGB24, dcp::Size (image_size.width, waveform_height), true); + _waveform = make_shared<Image>(AV_PIX_FMT_RGB24, dcp::Size (image_size.width, waveform_height), Image::Alignment::PADDED); for (int x = 0; x < image_size.width; ++x) { @@ -182,7 +182,7 @@ VideoWaveformPlot::create_waveform () _waveform = _waveform->scale ( dcp::Size (GetSize().GetWidth() - _x_axis_width, waveform_height), - dcp::YUVToRGB::REC709, AV_PIX_FMT_RGB24, false, false + dcp::YUVToRGB::REC709, AV_PIX_FMT_RGB24, Image::Alignment::COMPACT, false ); } |
