summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-04-14 01:01:28 +0100
committerCarl Hetherington <cth@carlh.net>2016-05-18 11:50:29 +0100
commit65b331d32c383f3a9049f29bf03ab3fe3193b31a (patch)
tree3b27e0ca60742021094cee889a1c8d1ef4d75f8c /src/wx
parent6dd3777a0074f6f97c7f7286621006a1c14376e8 (diff)
Split audio; builds.
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/audio_dialog.cc2
-rw-r--r--src/wx/audio_dialog.h2
-rw-r--r--src/wx/audio_panel.cc27
-rw-r--r--src/wx/content_menu.cc7
-rw-r--r--src/wx/content_panel.cc13
-rw-r--r--src/wx/content_panel.h2
-rw-r--r--src/wx/content_widget.h34
-rw-r--r--src/wx/dcp_panel.cc1
-rw-r--r--src/wx/hints_dialog.cc17
-rw-r--r--src/wx/timeline.cc3
-rw-r--r--src/wx/timing_panel.cc12
-rw-r--r--src/wx/video_panel.cc6
12 files changed, 70 insertions, 56 deletions
diff --git a/src/wx/audio_dialog.cc b/src/wx/audio_dialog.cc
index 20185bf8f..2120c3a1f 100644
--- a/src/wx/audio_dialog.cc
+++ b/src/wx/audio_dialog.cc
@@ -39,7 +39,7 @@ using boost::const_pointer_cast;
using boost::dynamic_pointer_cast;
/** @param content Content to analyse, or 0 to analyse all of the film's audio */
-AudioDialog::AudioDialog (wxWindow* parent, shared_ptr<Film> film, shared_ptr<AudioContent> content)
+AudioDialog::AudioDialog (wxWindow* parent, shared_ptr<Film> film, shared_ptr<Content> content)
: wxDialog (parent, wxID_ANY, _("Audio"), wxDefaultPosition, wxSize (640, 512), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxFULL_REPAINT_ON_RESIZE)
, _film (film)
, _content (content)
diff --git a/src/wx/audio_dialog.h b/src/wx/audio_dialog.h
index 8320171ce..8624b7af3 100644
--- a/src/wx/audio_dialog.h
+++ b/src/wx/audio_dialog.h
@@ -30,7 +30,7 @@ class Film;
class AudioDialog : public wxDialog
{
public:
- AudioDialog (wxWindow *, boost::shared_ptr<Film> film, boost::shared_ptr<AudioContent> content = boost::shared_ptr<AudioContent> ());
+ AudioDialog (wxWindow *, boost::shared_ptr<Film> film, boost::shared_ptr<Content> content = boost::shared_ptr<Content> ());
bool Show (bool show = true);
diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc
index 9e2ba9869..a41e428ec 100644
--- a/src/wx/audio_panel.cc
+++ b/src/wx/audio_panel.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -28,6 +28,7 @@
#include "lib/cinema_sound_processor.h"
#include "lib/job_manager.h"
#include "lib/dcp_content.h"
+#include "lib/audio_content.h"
#include <wx/spinctrl.h>
#include <boost/foreach.hpp>
#include <iostream>
@@ -65,6 +66,7 @@ AudioPanel::AudioPanel (ContentPanel* p)
this,
new wxSpinCtrlDouble (this),
AudioContentProperty::AUDIO_GAIN,
+ &Content::audio,
boost::mem_fn (&AudioContent::audio_gain),
boost::mem_fn (&AudioContent::set_audio_gain)
);
@@ -80,6 +82,7 @@ AudioPanel::AudioPanel (ContentPanel* p)
this,
new wxSpinCtrl (this),
AudioContentProperty::AUDIO_DELAY,
+ &Content::audio,
boost::mem_fn (&AudioContent::audio_delay),
boost::mem_fn (&AudioContent::set_audio_delay)
);
@@ -145,11 +148,11 @@ AudioPanel::film_changed (Film::Property property)
void
AudioPanel::film_content_changed (int property)
{
- AudioContentList ac = _parent->selected_audio ();
+ ContentList ac = _parent->selected_audio ();
if (property == AudioContentProperty::AUDIO_STREAMS) {
if (ac.size() == 1) {
- _mapping->set (ac.front()->audio_mapping());
- _mapping->set_input_channels (ac.front()->audio_channel_names ());
+ _mapping->set (ac.front()->audio->audio_mapping());
+ _mapping->set_input_channels (ac.front()->audio->audio_channel_names ());
} else {
_mapping->set (AudioMapping ());
}
@@ -201,28 +204,28 @@ AudioPanel::gain_calculate_button_clicked ()
void
AudioPanel::setup_description ()
{
- AudioContentList ac = _parent->selected_audio ();
+ ContentList ac = _parent->selected_audio ();
if (ac.size () != 1) {
checked_set (_description, wxT (""));
return;
}
- checked_set (_description, ac.front()->processing_description ());
+ checked_set (_description, ac.front()->audio->processing_description ());
}
void
AudioPanel::mapping_changed (AudioMapping m)
{
- AudioContentList c = _parent->selected_audio ();
+ ContentList c = _parent->selected_audio ();
if (c.size() == 1) {
- c.front()->set_audio_mapping (m);
+ c.front()->audio->set_audio_mapping (m);
}
}
void
AudioPanel::content_selection_changed ()
{
- AudioContentList sel = _parent->selected_audio ();
+ ContentList sel = _parent->selected_audio ();
_gain->set_content (sel);
_delay->set_content (sel);
@@ -236,7 +239,7 @@ AudioPanel::content_selection_changed ()
void
AudioPanel::setup_sensitivity ()
{
- AudioContentList sel = _parent->selected_audio ();
+ ContentList sel = _parent->selected_audio ();
shared_ptr<DCPContent> dcp;
if (sel.size() == 1) {
@@ -272,7 +275,7 @@ AudioPanel::show_clicked ()
_audio_dialog = 0;
}
- AudioContentList ac = _parent->selected_audio ();
+ ContentList ac = _parent->selected_audio ();
if (ac.size() != 1) {
return;
}
@@ -284,7 +287,7 @@ AudioPanel::show_clicked ()
void
AudioPanel::setup_peak ()
{
- AudioContentList sel = _parent->selected_audio ();
+ ContentList sel = _parent->selected_audio ();
bool alert = false;
if (sel.size() != 1) {
diff --git a/src/wx/content_menu.cc b/src/wx/content_menu.cc
index c643602bd..f2e00ea42 100644
--- a/src/wx/content_menu.cc
+++ b/src/wx/content_menu.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -32,6 +32,7 @@
#include "lib/exceptions.h"
#include "lib/dcp_content.h"
#include "lib/ffmpeg_content.h"
+#include "lib/audio_content.h"
#include <wx/wx.h>
#include <wx/dirdlg.h>
#include <boost/foreach.hpp>
@@ -205,9 +206,9 @@ ContentMenu::remove ()
}
if (!video && audio) {
- AudioMapping m = fc->audio_mapping ();
+ AudioMapping m = fc->audio->audio_mapping ();
m.unmap_all ();
- fc->set_audio_mapping (m);
+ fc->audio->set_audio_mapping (m);
handled = true;
}
}
diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc
index ad4894897..36f0a6bb2 100644
--- a/src/wx/content_panel.cc
+++ b/src/wx/content_panel.cc
@@ -163,15 +163,14 @@ ContentPanel::selected_video ()
return vc;
}
-AudioContentList
+ContentList
ContentPanel::selected_audio ()
{
- AudioContentList ac;
+ ContentList ac;
BOOST_FOREACH (shared_ptr<Content> i, selected ()) {
- shared_ptr<AudioContent> t = dynamic_pointer_cast<AudioContent> (i);
- if (t) {
- ac.push_back (t);
+ if (i->audio) {
+ ac.push_back (i);
}
}
@@ -387,7 +386,7 @@ ContentPanel::setup_sensitivity ()
ContentList selection = selected ();
ContentList video_selection = selected_video ();
- AudioContentList audio_selection = selected_audio ();
+ ContentList audio_selection = selected_audio ();
_remove->Enable (!selection.empty() && _generally_sensitive);
_earlier->Enable (selection.size() == 1 && _generally_sensitive);
@@ -396,7 +395,7 @@ ContentPanel::setup_sensitivity ()
_video_panel->Enable (video_selection.size() > 0 && _generally_sensitive);
_audio_panel->Enable (audio_selection.size() > 0 && _generally_sensitive);
- _subtitle_panel->Enable (selection.size() == 1 && dynamic_pointer_cast<SubtitleContent> (selection.front()) && _generally_sensitive);
+ _subtitle_panel->Enable (selection.size() == 1 && selection.front()->subtitle && _generally_sensitive);
_timing_panel->Enable (selection.size() == 1 && _generally_sensitive);
}
diff --git a/src/wx/content_panel.h b/src/wx/content_panel.h
index f4e2dbae2..caaa2decc 100644
--- a/src/wx/content_panel.h
+++ b/src/wx/content_panel.h
@@ -60,7 +60,7 @@ public:
ContentList selected ();
ContentList selected_video ();
- AudioContentList selected_audio ();
+ ContentList selected_audio ();
ContentList selected_subtitle ();
FFmpegContentList selected_ffmpeg ();
diff --git a/src/wx/content_widget.h b/src/wx/content_widget.h
index 3fa1f0ddc..49dceef8e 100644
--- a/src/wx/content_widget.h
+++ b/src/wx/content_widget.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -21,21 +21,22 @@
* @brief ContentWidget class.
*/
-#ifndef DCPOMATIC_MULTIPLE_WIDGET_H
-#define DCPOMATIC_MULTIPLE_WIDGET_H
+#ifndef DCPOMATIC_CONTENT_WIDGET_H
+#define DCPOMATIC_CONTENT_WIDGET_H
-#include <vector>
+#include "wx_util.h"
+#include "lib/content.h"
#include <wx/wx.h>
#include <wx/gbsizer.h>
#include <wx/spinctrl.h>
#include <boost/function.hpp>
-#include "wx_util.h"
+#include <vector>
/** @class ContentWidget
* @brief A widget which represents some Content state and which can be used
* when multiple pieces of content are selected.
*
- * @param S Type containing the content being represented (e.g. VideoContent)
+ * @param S Type of ContentPart being manipulated (e.g. VideoContent)
* @param T Type of the widget (e.g. wxSpinCtrl)
* @param U Data type of state as used by the model.
* @param V Data type of state as used by the view.
@@ -54,6 +55,7 @@ public:
wxWindow* parent,
T* wrapped,
int property,
+ boost::function<boost::shared_ptr<S> (Content*)> part,
boost::function<U (S*)> model_getter,
boost::function<void (S*, U)> model_setter,
boost::function<U (V)> view_to_model,
@@ -63,6 +65,7 @@ public:
, _sizer (0)
, _button (new wxButton (parent, wxID_ANY, _("Multiple values")))
, _property (property)
+ , _part (part)
, _model_getter (model_getter)
, _model_setter (model_setter)
, _view_to_model (view_to_model)
@@ -80,7 +83,7 @@ public:
return _wrapped;
}
- typedef std::vector<boost::shared_ptr<S> > List;
+ typedef std::vector<boost::shared_ptr<Content> > List;
/** Set the content that this control is working on (i.e. the selected content) */
void set_content (List content)
@@ -120,8 +123,8 @@ public:
}
typename List::iterator i = _content.begin ();
- U const v = boost::bind (_model_getter, _content.front().get())();
- while (i != _content.end() && boost::bind (_model_getter, i->get())() == v) {
+ U const v = boost::bind (_model_getter, _part(_content.front().get()).get())();
+ while (i != _content.end() && boost::bind (_model_getter, _part(i->get()).get())() == v) {
++i;
}
@@ -137,7 +140,7 @@ public:
{
_ignore_model_changes = true;
for (size_t i = 0; i < _content.size(); ++i) {
- boost::bind (_model_setter, _content[i].get(), _view_to_model (wx_get (_wrapped))) ();
+ boost::bind (_model_setter, _part (_content[i].get()).get(), _view_to_model (wx_get (_wrapped))) ();
}
_ignore_model_changes = false;
}
@@ -172,9 +175,9 @@ private:
void button_clicked ()
{
- U const v = boost::bind (_model_getter, _content.front().get())();
+ U const v = boost::bind (_model_getter, _part(_content.front().get()).get())();
for (typename List::iterator i = _content.begin (); i != _content.end(); ++i) {
- boost::bind (_model_setter, i->get(), v) ();
+ boost::bind (_model_setter, _part(i->get()).get(), v) ();
}
}
@@ -192,6 +195,7 @@ private:
wxButton* _button;
List _content;
int _property;
+ boost::function<boost::shared_ptr<S> (Content *)> _part;
boost::function<U (S*)> _model_getter;
boost::function<void (S*, U)> _model_setter;
boost::function<U (V)> _view_to_model;
@@ -214,6 +218,7 @@ public:
wxWindow* parent,
wxSpinCtrl* wrapped,
int property,
+ boost::function<boost::shared_ptr<S> (Content *)> part,
boost::function<int (S*)> getter,
boost::function<void (S*, int)> setter
)
@@ -221,6 +226,7 @@ public:
parent,
wrapped,
property,
+ part,
getter, setter,
&caster<int, int>,
&caster<int, int>
@@ -238,6 +244,7 @@ public:
wxWindow* parent,
wxSpinCtrlDouble* wrapped,
int property,
+ boost::function<boost::shared_ptr<S> (Content *)> part,
boost::function<double (S*)> getter,
boost::function<void (S*, double)> setter
)
@@ -245,6 +252,7 @@ public:
parent,
wrapped,
property,
+ part,
getter, setter,
&caster<double, double>,
&caster<double, double>
@@ -262,6 +270,7 @@ public:
wxWindow* parent,
wxChoice* wrapped,
int property,
+ boost::function<boost::shared_ptr<S> (Content *)> part,
boost::function<U (S*)> getter,
boost::function<void (S*, U)> setter,
boost::function<U (int)> view_to_model,
@@ -271,6 +280,7 @@ public:
parent,
wrapped,
property,
+ part,
getter,
setter,
view_to_model,
diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc
index c62767c9d..30657f841 100644
--- a/src/wx/dcp_panel.cc
+++ b/src/wx/dcp_panel.cc
@@ -32,6 +32,7 @@
#include "lib/video_content.h"
#include "lib/subtitle_content.h"
#include "lib/dcp_content.h"
+#include "lib/audio_content.h"
#include <dcp/key.h>
#include <dcp/raw_convert.h>
#include <wx/wx.h>
diff --git a/src/wx/hints_dialog.cc b/src/wx/hints_dialog.cc
index 75643c312..1c49a2068 100644
--- a/src/wx/hints_dialog.cc
+++ b/src/wx/hints_dialog.cc
@@ -78,11 +78,10 @@ HintsDialog::film_changed ()
bool big_font_files = false;
if (film->interop ()) {
BOOST_FOREACH (shared_ptr<Content> i, content) {
- shared_ptr<SubtitleContent> s = dynamic_pointer_cast<SubtitleContent> (i);
- if (s) {
- BOOST_FOREACH (shared_ptr<Font> j, s->fonts ()) {
- for (int i = 0; i < FontFiles::VARIANTS; ++i) {
- optional<boost::filesystem::path> const p = j->file (static_cast<FontFiles::Variant> (i));
+ if (i->subtitle) {
+ BOOST_FOREACH (shared_ptr<Font> j, i->subtitle->fonts ()) {
+ for (int k = 0; k < FontFiles::VARIANTS; ++k) {
+ optional<boost::filesystem::path> const p = j->file (static_cast<FontFiles::Variant> (k));
if (p && boost::filesystem::file_size (p.get()) >= (640 * 1024)) {
big_font_files = true;
}
@@ -106,9 +105,8 @@ HintsDialog::film_changed ()
int flat_or_narrower = 0;
int scope = 0;
BOOST_FOREACH (shared_ptr<const Content> i, content) {
- shared_ptr<const VideoContent> vc = dynamic_pointer_cast<const VideoContent> (i);
- if (vc) {
- Ratio const * r = vc->scale().ratio ();
+ if (i->video) {
+ Ratio const * r = i->video->scale().ratio ();
if (r && r->id() == "239") {
++scope;
} else if (r && r->id() != "239" && r->id() != "full-frame") {
@@ -162,8 +160,7 @@ HintsDialog::film_changed ()
int three_d = 0;
BOOST_FOREACH (shared_ptr<const Content> i, content) {
- shared_ptr<const VideoContent> vc = dynamic_pointer_cast<const VideoContent> (i);
- if (vc && vc->video_frame_type() != VIDEO_FRAME_TYPE_2D) {
+ if (i->video && i->video->video_frame_type() != VIDEO_FRAME_TYPE_2D) {
++three_d;
}
}
diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc
index 56af6f771..f9fd16578 100644
--- a/src/wx/timeline.cc
+++ b/src/wx/timeline.cc
@@ -149,8 +149,7 @@ Timeline::recreate_views ()
_views.push_back (shared_ptr<TimelineView> (new TimelineVideoContentView (*this, i)));
}
- shared_ptr<AudioContent> ac = dynamic_pointer_cast<AudioContent> (i);
- if (ac && !ac->audio_mapping().mapped_output_channels().empty ()) {
+ if (i->audio && !i->audio->audio_mapping().mapped_output_channels().empty ()) {
_views.push_back (shared_ptr<TimelineView> (new TimelineAudioContentView (*this, i)));
}
diff --git a/src/wx/timing_panel.cc b/src/wx/timing_panel.cc
index 18a07add4..573d76f48 100644
--- a/src/wx/timing_panel.cc
+++ b/src/wx/timing_panel.cc
@@ -290,7 +290,7 @@ TimingPanel::film_content_changed (int property)
} else if (ac) {
checked_set (_video_frame_rate, raw_convert<string> (ac->audio->audio_video_frame_rate (), 5));
} else if (sc) {
- checked_set (_video_frame_rate, raw_convert<string> (sc->subtitle_video_frame_rate (), 5));
+ checked_set (_video_frame_rate, raw_convert<string> (sc->subtitle->subtitle_video_frame_rate (), 5));
}
_video_frame_rate->Enable (true);
} else {
@@ -403,16 +403,14 @@ void
TimingPanel::set_video_frame_rate ()
{
BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
- shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (i);
- shared_ptr<AudioContent> ac = dynamic_pointer_cast<AudioContent> (i);
shared_ptr<DCPSubtitleContent> dsc = dynamic_pointer_cast<DCPSubtitleContent> (i);
shared_ptr<TextSubtitleContent> tsc = dynamic_pointer_cast<TextSubtitleContent> (i);
double const fr = raw_convert<double> (wx_to_std (_video_frame_rate->GetValue ()));
- if (vc) {
- vc->set_video_frame_rate (fr);
- } else if (ac) {
+ if (i->video) {
+ i->video->set_video_frame_rate (fr);
+ } else if (i->audio) {
/* Audio but not video, i.e. SndfileContent */
- ac->set_audio_video_frame_rate (fr);
+ i->audio->set_audio_video_frame_rate (fr);
} else if (dsc) {
dsc->set_subtitle_video_frame_rate (fr);
} else if (tsc) {
diff --git a/src/wx/video_panel.cc b/src/wx/video_panel.cc
index b5bd27b24..8bdac0076 100644
--- a/src/wx/video_panel.cc
+++ b/src/wx/video_panel.cc
@@ -87,6 +87,7 @@ VideoPanel::VideoPanel (ContentPanel* p)
this,
new wxChoice (this, wxID_ANY),
VideoContentProperty::VIDEO_FRAME_TYPE,
+ &Content::video,
boost::mem_fn (&VideoContent::video_frame_type),
boost::mem_fn (&VideoContent::set_video_frame_type),
&caster<int, VideoFrameType>,
@@ -105,6 +106,7 @@ VideoPanel::VideoPanel (ContentPanel* p)
this,
new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1)),
VideoContentProperty::VIDEO_CROP,
+ &Content::video,
boost::mem_fn (&VideoContent::left_crop),
boost::mem_fn (&VideoContent::set_left_crop)
);
@@ -115,6 +117,7 @@ VideoPanel::VideoPanel (ContentPanel* p)
this,
new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1)),
VideoContentProperty::VIDEO_CROP,
+ &Content::video,
boost::mem_fn (&VideoContent::right_crop),
boost::mem_fn (&VideoContent::set_right_crop)
);
@@ -127,6 +130,7 @@ VideoPanel::VideoPanel (ContentPanel* p)
this,
new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1)),
VideoContentProperty::VIDEO_CROP,
+ &Content::video,
boost::mem_fn (&VideoContent::top_crop),
boost::mem_fn (&VideoContent::set_top_crop)
);
@@ -137,6 +141,7 @@ VideoPanel::VideoPanel (ContentPanel* p)
this,
new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1)),
VideoContentProperty::VIDEO_CROP,
+ &Content::video,
boost::mem_fn (&VideoContent::bottom_crop),
boost::mem_fn (&VideoContent::set_bottom_crop)
);
@@ -160,6 +165,7 @@ VideoPanel::VideoPanel (ContentPanel* p)
this,
new wxChoice (this, wxID_ANY),
VideoContentProperty::VIDEO_SCALE,
+ &Content::video,
boost::mem_fn (&VideoContent::scale),
boost::mem_fn (&VideoContent::set_scale),
&index_to_scale,