summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-05-31 14:19:50 +0100
committerCarl Hetherington <cth@carlh.net>2013-05-31 14:19:50 +0100
commitf385ef03e5ea27519a31c0839447735a7fba0602 (patch)
tree310902e785a95c2e3be1ba389f29cd7bd480f2a2 /src/wx
parentc13771610ef9a01cb29342bca82f9999f8b5ddbc (diff)
Various stuff; mostly change to decoder scaling and adding subtitle; scaling test.
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/config_dialog.cc12
-rw-r--r--src/wx/film_editor.cc46
-rw-r--r--src/wx/film_editor.h10
-rw-r--r--src/wx/film_viewer.cc41
-rw-r--r--src/wx/film_viewer.h12
5 files changed, 41 insertions, 80 deletions
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc
index ae5bed723..3efd7857a 100644
--- a/src/wx/config_dialog.cc
+++ b/src/wx/config_dialog.cc
@@ -28,7 +28,7 @@
#include <wx/notebook.h>
#include "lib/config.h"
#include "lib/server.h"
-#include "lib/container.h"
+#include "lib/ratio.h"
#include "lib/scaler.h"
#include "lib/filter.h"
#include "lib/dcp_content_type.h"
@@ -171,10 +171,10 @@ ConfigDialog::make_misc_panel ()
_default_dci_metadata_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (ConfigDialog::edit_default_dci_metadata_clicked), 0, this);
- vector<Container const *> fmt = Container::all ();
+ vector<Ratio const *> ratio = Ratio::all ();
int n = 0;
- for (vector<Container const *>::iterator i = fmt.begin(); i != fmt.end(); ++i) {
- _default_container->Append (std_to_wx ((*i)->name ()));
+ for (vector<Ratio const *>::iterator i = ratio.begin(); i != ratio.end(); ++i) {
+ _default_container->Append (std_to_wx ((*i)->nickname ()));
if (*i == config->default_container ()) {
_default_container->SetSelection (n);
}
@@ -535,8 +535,8 @@ ConfigDialog::default_still_length_changed (wxCommandEvent &)
void
ConfigDialog::default_container_changed (wxCommandEvent &)
{
- vector<Container const *> fmt = Container::all ();
- Config::instance()->set_default_container (fmt[_default_container->GetSelection()]);
+ vector<Ratio const *> ratio = Ratio::all ();
+ Config::instance()->set_default_container (ratio[_default_container->GetSelection()]);
}
void
diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc
index 75867d1d5..bddce18be 100644
--- a/src/wx/film_editor.cc
+++ b/src/wx/film_editor.cc
@@ -29,15 +29,14 @@
#include <boost/thread.hpp>
#include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp>
-#include "lib/format.h"
#include "lib/film.h"
#include "lib/transcode_job.h"
#include "lib/exceptions.h"
#include "lib/ab_transcode_job.h"
#include "lib/job_manager.h"
#include "lib/filter.h"
+#include "lib/ratio.h"
#include "lib/config.h"
-#include "lib/ffmpeg_decoder.h"
#include "lib/imagemagick_content.h"
#include "lib/sndfile_content.h"
#include "lib/dcp_content_type.h"
@@ -52,7 +51,6 @@
#include "imagemagick_content_dialog.h"
#include "timeline_dialog.h"
#include "audio_mapping_view.h"
-#include "container.h"
#include "timecode.h"
using std::string;
@@ -86,7 +84,7 @@ FilmEditor::FilmEditor (shared_ptr<Film> f, wxWindow* parent)
make_dcp_panel ();
_main_notebook->AddPage (_dcp_panel, _("DCP"), false);
- setup_formats ();
+ setup_ratios ();
set_film (f);
connect_to_widgets ();
@@ -167,9 +165,9 @@ FilmEditor::make_dcp_panel ()
_scaler->Append (std_to_wx ((*i)->name()));
}
- vector<Container const *> const co = Container::all ();
- for (vector<Container const *>::const_iterator i = co.begin(); i != co.end(); ++i) {
- _container->Append (std_to_wx ((*i)->name ()));
+ vector<Ratio const *> const ratio = Ratio::all ();
+ for (vector<Ratio const *>::const_iterator i = ratio.begin(); i != ratio.end(); ++i) {
+ _container->Append (std_to_wx ((*i)->nickname ()));
}
vector<DCPContentType const *> const ct = DCPContentType::all ();
@@ -259,8 +257,8 @@ FilmEditor::make_video_panel ()
++r;
add_label_to_grid_bag_sizer (grid, _video_panel, _("Scale to"), wxGBPosition (r, 0));
- _format = new wxChoice (_video_panel, wxID_ANY);
- grid->Add (_format, wxGBPosition (r, 1));
+ _ratio = new wxChoice (_video_panel, wxID_ANY);
+ grid->Add (_ratio, wxGBPosition (r, 1));
++r;
_scaling_description = new wxStaticText (_video_panel, wxID_ANY, wxT ("\n \n \n \n"), wxDefaultPosition, wxDefaultSize);
@@ -598,8 +596,8 @@ FilmEditor::film_changed (Film::Property p)
break;
case Film::CONTENT:
setup_content ();
- setup_formats ();
-// setup_format ();
+ setup_ratios ();
+// setup_ratio ();
setup_subtitle_control_sensitivity ();
setup_show_audio_sensitivity ();
break;
@@ -765,14 +763,14 @@ void
FilmEditor::setup_container ()
{
int n = 0;
- vector<Container const *> containers = Container::all ();
- vector<Container const *>::iterator i = containers.begin ();
- while (i != containers.end() && *i != _film->container ()) {
+ vector<Ratio const *> ratios = Ratio::all ();
+ vector<Ratio const *>::iterator i = ratios.begin ();
+ while (i != ratios.end() && *i != _film->container ()) {
++i;
++n;
}
- if (i == containers.end()) {
+ if (i == ratios.end()) {
checked_set (_container, -1);
} else {
checked_set (_container, n);
@@ -792,9 +790,9 @@ FilmEditor::container_changed (wxCommandEvent &)
int const n = _container->GetSelection ();
if (n >= 0) {
- vector<Container const *> containers = Container::all ();
- assert (n < int (containers.size()));
- _film->set_container (containers[n]);
+ vector<Ratio const *> ratios = Ratio::all ();
+ assert (n < int (ratios.size()));
+ _film->set_container (ratios[n]);
}
}
@@ -878,7 +876,7 @@ FilmEditor::set_things_sensitive (bool s)
_name->Enable (s);
_use_dci_name->Enable (s);
_edit_dci_button->Enable (s);
- _format->Enable (s);
+ _ratio->Enable (s);
_content->Enable (s);
_left_crop->Enable (s);
_right_crop->Enable (s);
@@ -999,13 +997,13 @@ FilmEditor::audio_gain_calculate_button_clicked (wxCommandEvent &)
}
void
-FilmEditor::setup_formats ()
+FilmEditor::setup_ratios ()
{
- _formats = Format::all ();
+ _ratios = Ratio::all ();
- _format->Clear ();
- for (vector<Format const *>::iterator i = _formats.begin(); i != _formats.end(); ++i) {
- _format->Append (std_to_wx ((*i)->name ()));
+ _ratio->Clear ();
+ for (vector<Ratio const *>::iterator i = _ratios.begin(); i != _ratios.end(); ++i) {
+ _ratio->Append (std_to_wx ((*i)->nickname ()));
}
_dcp_sizer->Layout ();
diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h
index c34cd73e0..be1bf7c36 100644
--- a/src/wx/film_editor.h
+++ b/src/wx/film_editor.h
@@ -35,7 +35,7 @@ class Film;
class AudioDialog;
class TimelineDialog;
class AudioMappingView;
-class Format;
+class Ratio;
class Timecode;
/** @class FilmEditor
@@ -102,7 +102,7 @@ private:
void film_content_changed (boost::weak_ptr<Content>, int);
void set_things_sensitive (bool);
- void setup_formats ();
+ void setup_ratios ();
void setup_subtitle_control_sensitivity ();
void setup_dcp_name ();
void setup_show_audio_sensitivity ();
@@ -144,8 +144,8 @@ private:
wxCheckBox* _loop_content;
wxSpinCtrl* _loop_count;
wxButton* _edit_dci_button;
- wxChoice* _format;
- wxStaticText* _format_description;
+ wxChoice* _ratio;
+ wxStaticText* _ratio_description;
wxStaticText* _scaling_description;
wxSpinCtrl* _left_crop;
wxSpinCtrl* _right_crop;
@@ -173,7 +173,7 @@ private:
Timecode* _start;
Timecode* _length;
- std::vector<Format const *> _formats;
+ std::vector<Ratio const *> _ratios;
bool _generally_sensitive;
AudioDialog* _audio_dialog;
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index 97185ca94..26f99db11 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -27,11 +27,9 @@
#include <iomanip>
#include <wx/tglbtn.h>
#include "lib/film.h"
-#include "lib/container.h"
-#include "lib/format.h"
+#include "lib/ratio.h"
#include "lib/util.h"
#include "lib/job_manager.h"
-#include "lib/subtitle.h"
#include "lib/image.h"
#include "lib/scaler.h"
#include "lib/exceptions.h"
@@ -166,7 +164,7 @@ FilmViewer::set_film (shared_ptr<Film> f)
on and off without needing obtain a new Player.
*/
- _player->Video.connect (bind (&FilmViewer::process_video, this, _1, _2, _3, _4));
+ _player->Video.connect (bind (&FilmViewer::process_video, this, _1, _2, _3));
_film->Changed.connect (boost::bind (&FilmViewer::film_changed, this, _1));
_film->ContentChanged.connect (boost::bind (&FilmViewer::film_content_changed, this, _1, _2));
@@ -233,12 +231,6 @@ FilmViewer::paint_panel (wxPaintEvent &)
wxBitmap frame_bitmap (frame);
dc.DrawBitmap (frame_bitmap, _display_frame_x, 0);
- if (_film->with_subtitles() && _display_sub) {
- wxImage sub (_display_sub->size().width, _display_sub->size().height, _display_sub->data()[0], _display_sub->alpha(), true);
- wxBitmap sub_bitmap (sub);
- dc.DrawBitmap (sub_bitmap, _display_sub_position.x, _display_sub_position.y);
- }
-
if (_out_size.width < _panel_size.width) {
wxPen p (GetBackgroundColour ());
wxBrush b (GetBackgroundColour ());
@@ -301,29 +293,7 @@ FilmViewer::raw_to_display ()
}
/* Get a compacted image as we have to feed it to wxWidgets */
- _display_frame = _raw_frame->scale_and_convert_to_rgb (_film_size, 0, _film->scaler(), false);
-
- if (_raw_sub) {
-
- /* Our output is already cropped by the decoder, so we need to account for that
- when working out the scale that we are applying.
- */
-
- /* XXX */
- Size const cropped_size = _raw_frame->size ();//_film->cropped_size (_raw_frame->size ());
-
- Rect tx = subtitle_transformed_area (
- float (_film_size.width) / cropped_size.width,
- float (_film_size.height) / cropped_size.height,
- _raw_sub->area(), _film->subtitle_offset(), _film->subtitle_scale()
- );
-
- _display_sub.reset (new RGBPlusAlphaImage (_raw_sub->image()->scale (tx.size(), _film->scaler(), false)));
- _display_sub_position = tx.position();
- _display_sub_position.x += _display_frame_x;
- } else {
- _display_sub.reset ();
- }
+ _display_frame = _raw_frame->scale_and_convert_to_rgb (_film_size, _film->scaler(), false);
}
void
@@ -333,7 +303,7 @@ FilmViewer::calculate_sizes ()
return;
}
- Container const * container = _film->container ();
+ Ratio const * container = _film->container ();
float const panel_ratio = static_cast<float> (_panel_size.width) / _panel_size.height;
float const film_ratio = container ? container->ratio () : 1.78;
@@ -386,10 +356,9 @@ FilmViewer::check_play_state ()
}
void
-FilmViewer::process_video (shared_ptr<const Image> image, bool, shared_ptr<Subtitle> sub, Time t)
+FilmViewer::process_video (shared_ptr<const Image> image, bool, Time t)
{
_raw_frame = image;
- _raw_sub = sub;
raw_to_display ();
diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h
index 68d51bfbd..39755ed35 100644
--- a/src/wx/film_viewer.h
+++ b/src/wx/film_viewer.h
@@ -28,7 +28,6 @@ class wxToggleButton;
class FFmpegPlayer;
class Image;
class RGBPlusAlphaImage;
-class Subtitle;
/** @class FilmViewer
* @brief A wx widget to view a preview of a Film.
@@ -38,14 +37,12 @@ class Subtitle;
* 1. get_frame() asks our _player to decode some data. If it does, process_video()
* will be called.
*
- * 2. process_video() takes the image and subtitle from the decoder (_raw_frame and _raw_sub)
- * and calls raw_to_display().
+ * 2. process_video() takes the image from the decoder (_raw_frame) and calls raw_to_display().
*
* 3. raw_to_display() copies _raw_frame to _display_frame, processing it and scaling it.
*
* 4. calling _panel->Refresh() and _panel->Update() results in paint_panel() being called;
- * this creates frame_bitmap from _display_frame and blits it to the display. It also
- * blits the subtitle, if required.
+ * this creates frame_bitmap from _display_frame and blits it to the display.
*
* update_from_decoder() asks the player to re-emit its current frame on the next pass(), and then
* starts from step #1.
@@ -67,7 +64,7 @@ private:
void slider_moved (wxScrollEvent &);
void play_clicked (wxCommandEvent &);
void timer (wxTimerEvent &);
- void process_video (boost::shared_ptr<const Image>, bool, boost::shared_ptr<Subtitle>, Time);
+ void process_video (boost::shared_ptr<const Image>, bool, Time);
void calculate_sizes ();
void check_play_state ();
void update_from_raw ();
@@ -92,14 +89,11 @@ private:
wxTimer _timer;
boost::shared_ptr<const Image> _raw_frame;
- boost::shared_ptr<Subtitle> _raw_sub;
boost::shared_ptr<const Image> _display_frame;
/* The x offset at which we display the actual film content; this corresponds
to the film's padding converted to our coordinates.
*/
int _display_frame_x;
- boost::shared_ptr<RGBPlusAlphaImage> _display_sub;
- Position _display_sub_position;
bool _got_frame;
/** Size of our output (including padding if we have any) */