summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-05-21 22:25:09 +0100
committerCarl Hetherington <cth@carlh.net>2013-05-21 22:25:09 +0100
commit02e4022f540915f8a38f9ab9576ac896fe39a1ab (patch)
tree2301065f001f992c0c02f61fe2d2a321a0d5f7ce /src
parent237a0052c60af768f4d62b00321932918b7ba4d9 (diff)
Vaguely working new layout.
Diffstat (limited to 'src')
-rw-r--r--src/lib/content.cc2
-rw-r--r--src/lib/content.h2
-rw-r--r--src/lib/examine_content_job.cc5
-rw-r--r--src/lib/examine_content_job.h3
-rw-r--r--src/lib/ffmpeg_content.cc18
-rw-r--r--src/lib/ffmpeg_content.h2
-rw-r--r--src/lib/film.cc82
-rw-r--r--src/lib/film.h39
-rw-r--r--src/lib/imagemagick_content.cc4
-rw-r--r--src/lib/imagemagick_content.h2
-rw-r--r--src/lib/sndfile_content.cc4
-rw-r--r--src/lib/sndfile_content.h2
-rw-r--r--src/lib/writer.cc15
-rw-r--r--src/tools/po/es_ES.po5
-rw-r--r--src/wx/ffmpeg_content_dialog.cc167
-rw-r--r--src/wx/ffmpeg_content_dialog.h47
-rw-r--r--src/wx/film_editor.cc451
-rw-r--r--src/wx/film_editor.h40
-rw-r--r--src/wx/wscript1
19 files changed, 239 insertions, 652 deletions
diff --git a/src/lib/content.cc b/src/lib/content.cc
index 578dafd67..618dafee2 100644
--- a/src/lib/content.cc
+++ b/src/lib/content.cc
@@ -62,7 +62,7 @@ Content::as_xml (xmlpp::Node* node) const
}
void
-Content::examine (shared_ptr<Film>, shared_ptr<Job>, bool)
+Content::examine (shared_ptr<Film>, shared_ptr<Job>)
{
string const d = md5_digest (_file);
boost::mutex::scoped_lock lm (_mutex);
diff --git a/src/lib/content.h b/src/lib/content.h
index fd6288acc..b8062b280 100644
--- a/src/lib/content.h
+++ b/src/lib/content.h
@@ -43,7 +43,7 @@ public:
Content (boost::shared_ptr<const cxml::Node>);
Content (Content const &);
- virtual void examine (boost::shared_ptr<Film>, boost::shared_ptr<Job>, bool);
+ virtual void examine (boost::shared_ptr<Film>, boost::shared_ptr<Job>);
virtual std::string summary () const = 0;
virtual std::string information () const = 0;
virtual void as_xml (xmlpp::Node *) const;
diff --git a/src/lib/examine_content_job.cc b/src/lib/examine_content_job.cc
index aad7f265e..21ab4a71d 100644
--- a/src/lib/examine_content_job.cc
+++ b/src/lib/examine_content_job.cc
@@ -27,10 +27,9 @@
using std::string;
using boost::shared_ptr;
-ExamineContentJob::ExamineContentJob (shared_ptr<Film> f, shared_ptr<Content> c, bool q)
+ExamineContentJob::ExamineContentJob (shared_ptr<Film> f, shared_ptr<Content> c)
: Job (f)
, _content (c)
- , _quick (q)
{
}
@@ -48,7 +47,7 @@ ExamineContentJob::name () const
void
ExamineContentJob::run ()
{
- _content->examine (_film, shared_from_this (), _quick);
+ _content->examine (_film, shared_from_this ());
set_progress (1);
set_state (FINISHED_OK);
}
diff --git a/src/lib/examine_content_job.h b/src/lib/examine_content_job.h
index dc0d53fff..86f1ab111 100644
--- a/src/lib/examine_content_job.h
+++ b/src/lib/examine_content_job.h
@@ -26,7 +26,7 @@ class Log;
class ExamineContentJob : public Job
{
public:
- ExamineContentJob (boost::shared_ptr<Film>, boost::shared_ptr<Content>, bool);
+ ExamineContentJob (boost::shared_ptr<Film>, boost::shared_ptr<Content>);
~ExamineContentJob ();
std::string name () const;
@@ -34,6 +34,5 @@ public:
private:
boost::shared_ptr<Content> _content;
- bool _quick;
};
diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc
index fcc775f0a..2a4283353 100644
--- a/src/lib/ffmpeg_content.cc
+++ b/src/lib/ffmpeg_content.cc
@@ -112,26 +112,17 @@ FFmpegContent::as_xml (xmlpp::Node* node) const
}
void
-FFmpegContent::examine (shared_ptr<Film> film, shared_ptr<Job> job, bool quick)
+FFmpegContent::examine (shared_ptr<Film> film, shared_ptr<Job> job)
{
job->set_progress_unknown ();
- Content::examine (film, job, quick);
+ Content::examine (film, job);
shared_ptr<FFmpegDecoder> decoder (new FFmpegDecoder (film, shared_from_this (), true, false, false));
ContentVideoFrame video_length = 0;
- if (quick) {
- video_length = decoder->video_length ();
- film->log()->log (String::compose ("Video length obtained from header as %1 frames", decoder->video_length ()));
- } else {
- while (!decoder->pass ()) {
- /* keep going */
- }
-
- video_length = decoder->video_frame ();
- film->log()->log (String::compose ("Video length examined as %1 frames", decoder->video_frame ()));
- }
+ video_length = decoder->video_length ();
+ film->log()->log (String::compose ("Video length obtained from header as %1 frames", decoder->video_length ()));
{
boost::mutex::scoped_lock lm (_mutex);
@@ -332,7 +323,6 @@ FFmpegContent::audio_mapping () const
return AudioMapping ();
}
- cout << "returning am from stream " << _audio_stream.get() << ".\n";
return _audio_stream->mapping;
}
diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h
index d79e4ec35..9d842515e 100644
--- a/src/lib/ffmpeg_content.h
+++ b/src/lib/ffmpeg_content.h
@@ -88,7 +88,7 @@ public:
return boost::dynamic_pointer_cast<FFmpegContent> (Content::shared_from_this ());
}
- void examine (boost::shared_ptr<Film>, boost::shared_ptr<Job>, bool);
+ void examine (boost::shared_ptr<Film>, boost::shared_ptr<Job>);
std::string summary () const;
std::string information () const;
void as_xml (xmlpp::Node *) const;
diff --git a/src/lib/film.cc b/src/lib/film.cc
index 487499e32..ef67a2704 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -94,13 +94,9 @@ int const Film::state_version = 4;
Film::Film (string d, bool must_exist)
: _playlist (new Playlist)
, _use_dci_name (true)
- , _trust_content_headers (true)
, _dcp_content_type (Config::instance()->default_dcp_content_type ())
, _format (Config::instance()->default_format ())
, _scaler (Scaler::from_id ("bicubic"))
- , _trim_start (0)
- , _trim_end (0)
- , _trim_type (CPL)
, _ab (false)
, _audio_gain (0)
, _audio_delay (0)
@@ -163,15 +159,11 @@ Film::Film (Film const & o)
, _directory (o._directory)
, _name (o._name)
, _use_dci_name (o._use_dci_name)
- , _trust_content_headers (o._trust_content_headers)
, _dcp_content_type (o._dcp_content_type)
, _format (o._format)
, _crop (o._crop)
, _filters (o._filters)
, _scaler (o._scaler)
- , _trim_start (o._trim_start)
- , _trim_end (o._trim_end)
- , _trim_type (o._trim_type)
, _ab (o._ab)
, _audio_gain (o._audio_gain)
, _audio_delay (o._audio_delay)
@@ -355,7 +347,7 @@ Film::analyse_audio ()
void
Film::examine_content (shared_ptr<Content> c)
{
- shared_ptr<Job> j (new ExamineContentJob (shared_from_this(), c, trust_content_headers ()));
+ shared_ptr<Job> j (new ExamineContentJob (shared_from_this(), c));
JobManager::instance()->add (j);
}
@@ -413,7 +405,6 @@ Film::write_metadata () const
root->add_child("Version")->add_child_text (boost::lexical_cast<string> (state_version));
root->add_child("Name")->add_child_text (_name);
root->add_child("UseDCIName")->add_child_text (_use_dci_name ? "1" : "0");
- root->add_child("TrustContentHeaders")->add_child_text (_trust_content_headers ? "1" : "0");
if (_dcp_content_type) {
root->add_child("DCPContentType")->add_child_text (_dcp_content_type->dci_name ());
@@ -423,14 +414,6 @@ Film::write_metadata () const
root->add_child("Format")->add_child_text (_format->id ());
}
- switch (_trim_type) {
- case CPL:
- root->add_child("TrimType")->add_child_text ("CPL");
- break;
- case ENCODE:
- root->add_child("TrimType")->add_child_text ("Encode");
- }
-
root->add_child("LeftCrop")->add_child_text (boost::lexical_cast<string> (_crop.left));
root->add_child("RightCrop")->add_child_text (boost::lexical_cast<string> (_crop.right));
root->add_child("TopCrop")->add_child_text (boost::lexical_cast<string> (_crop.top));
@@ -441,8 +424,6 @@ Film::write_metadata () const
}
root->add_child("Scaler")->add_child_text (_scaler->id ());
- root->add_child("TrimStart")->add_child_text (boost::lexical_cast<string> (_trim_start));
- root->add_child("TrimEnd")->add_child_text (boost::lexical_cast<string> (_trim_end));
root->add_child("AB")->add_child_text (_ab ? "1" : "0");
root->add_child("AudioGain")->add_child_text (boost::lexical_cast<string> (_audio_gain));
root->add_child("AudioDelay")->add_child_text (boost::lexical_cast<string> (_audio_delay));
@@ -476,7 +457,6 @@ Film::read_metadata ()
_name = f.string_child ("Name");
_use_dci_name = f.bool_child ("UseDCIName");
- _trust_content_headers = f.bool_child ("TrustContentHeaders");
{
optional<string> c = f.optional_string_child ("DCPContentType");
@@ -492,15 +472,6 @@ Film::read_metadata ()
}
}
- {
- optional<string> c = f.optional_string_child ("TrimType");
- if (!c || c.get() == "CPL") {
- _trim_type = CPL;
- } else if (c && c.get() == "Encode") {
- _trim_type = ENCODE;
- }
- }
-
_crop.left = f.number_child<int> ("LeftCrop");
_crop.right = f.number_child<int> ("RightCrop");
_crop.top = f.number_child<int> ("TopCrop");
@@ -514,8 +485,6 @@ Film::read_metadata ()
}
_scaler = Scaler::from_id (f.string_child ("Scaler"));
- _trim_start = f.number_child<int> ("TrimStart");
- _trim_end = f.number_child<int> ("TrimEnd");
_ab = f.bool_child ("AB");
_audio_gain = f.number_child<float> ("AudioGain");
_audio_delay = f.number_child<int> ("AudioDelay");
@@ -687,25 +656,6 @@ Film::set_use_dci_name (bool u)
}
void
-Film::set_trust_content_headers (bool t)
-{
- {
- boost::mutex::scoped_lock lm (_state_mutex);
- _trust_content_headers = t;
- }
-
- signal_changed (TRUST_CONTENT_HEADERS);
-
- Playlist::ContentList content = _playlist->content ();
- if (!_trust_content_headers && !content.empty()) {
- /* We just said that we don't trust the content's header */
- for (Playlist::ContentList::iterator i = content.begin(); i != content.end(); ++i) {
- examine_content (*i);
- }
- }
-}
-
-void
Film::set_dcp_content_type (DCPContentType const * t)
{
{
@@ -813,36 +763,6 @@ Film::set_scaler (Scaler const * s)
}
void
-Film::set_trim_start (int t)
-{
- {
- boost::mutex::scoped_lock lm (_state_mutex);
- _trim_start = t;
- }
- signal_changed (TRIM_START);
-}
-
-void
-Film::set_trim_end (int t)
-{
- {
- boost::mutex::scoped_lock lm (_state_mutex);
- _trim_end = t;
- }
- signal_changed (TRIM_END);
-}
-
-void
-Film::set_trim_type (TrimType t)
-{
- {
- boost::mutex::scoped_lock lm (_state_mutex);
- _trim_type = t;
- }
- signal_changed (TRIM_TYPE);
-}
-
-void
Film::set_ab (bool a)
{
{
diff --git a/src/lib/film.h b/src/lib/film.h
index c0417382f..6dd2b446d 100644
--- a/src/lib/film.h
+++ b/src/lib/film.h
@@ -120,11 +120,6 @@ public:
void set_loop (int);
int loop () const;
- enum TrimType {
- CPL,
- ENCODE
- };
-
/** Identifiers for the parts of our state;
used for signalling changes.
*/
@@ -132,7 +127,6 @@ public:
NONE,
NAME,
USE_DCI_NAME,
- TRUST_CONTENT_HEADERS,
/** The playlist's content list has changed (i.e. content has been added, moved around or removed) */
CONTENT,
LOOP,
@@ -141,10 +135,7 @@ public:
CROP,
FILTERS,
SCALER,
- TRIM_START,
- TRIM_END,
AB,
- TRIM_TYPE,
AUDIO_GAIN,
AUDIO_DELAY,
WITH_SUBTITLES,
@@ -174,11 +165,6 @@ public:
return _use_dci_name;
}
- bool trust_content_headers () const {
- boost::mutex::scoped_lock lm (_state_mutex);
- return _trust_content_headers;
- }
-
DCPContentType const * dcp_content_type () const {
boost::mutex::scoped_lock lm (_state_mutex);
return _dcp_content_type;
@@ -204,21 +190,6 @@ public:
return _scaler;
}
- int trim_start () const {
- boost::mutex::scoped_lock lm (_state_mutex);
- return _trim_start;
- }
-
- int trim_end () const {
- boost::mutex::scoped_lock lm (_state_mutex);
- return _trim_end;
- }
-
- TrimType trim_type () const {
- boost::mutex::scoped_lock lm (_state_mutex);
- return _trim_type;
- }
-
bool ab () const {
boost::mutex::scoped_lock lm (_state_mutex);
return _ab;
@@ -275,7 +246,6 @@ public:
void set_directory (std::string);
void set_name (std::string);
void set_use_dci_name (bool);
- void set_trust_content_headers (bool);
void add_content (boost::shared_ptr<Content>);
void remove_content (boost::shared_ptr<Content>);
void set_dcp_content_type (DCPContentType const *);
@@ -287,10 +257,7 @@ public:
void set_bottom_crop (int);
void set_filters (std::vector<Filter const *>);
void set_scaler (Scaler const *);
- void set_trim_start (int);
- void set_trim_end (int);
void set_ab (bool);
- void set_trim_type (TrimType);
void set_audio_gain (float);
void set_audio_delay (int);
void set_with_subtitles (bool);
@@ -340,7 +307,6 @@ private:
std::string _name;
/** True if a auto-generated DCI-compliant name should be used for our DCP */
bool _use_dci_name;
- bool _trust_content_headers;
/** The type of content that this Film represents (feature, trailer etc.) */
DCPContentType const * _dcp_content_type;
/** The format to present this Film in (flat, scope, etc.) */
@@ -351,11 +317,6 @@ private:
std::vector<Filter const *> _filters;
/** Scaler algorithm to use */
Scaler const * _scaler;
- /** Frames to trim off the start of the DCP */
- int _trim_start;
- /** Frames to trim off the end of the DCP */
- int _trim_end;
- TrimType _trim_type;
/** true to create an A/B comparison DCP, where the left half of the image
is the video without any filters or post-processing, and the right half
has the specified filters and post-processing.
diff --git a/src/lib/imagemagick_content.cc b/src/lib/imagemagick_content.cc
index 2e42e25f3..f9daf204e 100644
--- a/src/lib/imagemagick_content.cc
+++ b/src/lib/imagemagick_content.cc
@@ -66,9 +66,9 @@ ImageMagickContent::as_xml (xmlpp::Node* node) const
}
void
-ImageMagickContent::examine (shared_ptr<Film> film, shared_ptr<Job> job, bool quick)
+ImageMagickContent::examine (shared_ptr<Film> film, shared_ptr<Job> job)
{
- Content::examine (film, job, quick);
+ Content::examine (film, job);
shared_ptr<ImageMagickDecoder> decoder (new ImageMagickDecoder (film, shared_from_this()));
{
diff --git a/src/lib/imagemagick_content.h b/src/lib/imagemagick_content.h
index 366049002..b7f2cd2c3 100644
--- a/src/lib/imagemagick_content.h
+++ b/src/lib/imagemagick_content.h
@@ -34,7 +34,7 @@ public:
return boost::dynamic_pointer_cast<ImageMagickContent> (Content::shared_from_this ());
};
- void examine (boost::shared_ptr<Film>, boost::shared_ptr<Job>, bool);
+ void examine (boost::shared_ptr<Film>, boost::shared_ptr<Job>);
std::string summary () const;
void as_xml (xmlpp::Node *) const;
boost::shared_ptr<Content> clone () const;
diff --git a/src/lib/sndfile_content.cc b/src/lib/sndfile_content.cc
index 13b118fb2..758ae942d 100644
--- a/src/lib/sndfile_content.cc
+++ b/src/lib/sndfile_content.cc
@@ -93,10 +93,10 @@ SndfileContent::clone () const
}
void
-SndfileContent::examine (shared_ptr<Film> film, shared_ptr<Job> job, bool quick)
+SndfileContent::examine (shared_ptr<Film> film, shared_ptr<Job> job)
{
job->set_progress_unknown ();
- Content::examine (film, job, quick);
+ Content::examine (film, job);
SndfileDecoder dec (film, shared_from_this());
diff --git a/src/lib/sndfile_content.h b/src/lib/sndfile_content.h
index 1ef4b3f02..bb7fa5f50 100644
--- a/src/lib/sndfile_content.h
+++ b/src/lib/sndfile_content.h
@@ -38,7 +38,7 @@ public:
return boost::dynamic_pointer_cast<SndfileContent> (Content::shared_from_this ());
}
- void examine (boost::shared_ptr<Film>, boost::shared_ptr<Job>, bool);
+ void examine (boost::shared_ptr<Film>, boost::shared_ptr<Job>);
std::string summary () const;
std::string information () const;
void as_xml (xmlpp::Node *) const;
diff --git a/src/lib/writer.cc b/src/lib/writer.cc
index f1451763e..96c797c5a 100644
--- a/src/lib/writer.cc
+++ b/src/lib/writer.cc
@@ -264,15 +264,8 @@ Writer::finish ()
_sound_asset_writer->finalize ();
int const frames = _last_written_frame + 1;
- int duration = 0;
- if (_film->trim_type() == Film::CPL) {
- duration = frames - _film->trim_start() - _film->trim_end();
- _picture_asset->set_entry_point (_film->trim_start ());
- } else {
- duration = frames;
- }
- _picture_asset->set_duration (duration);
+ _picture_asset->set_duration (frames);
/* Hard-link the video MXF into the DCP */
@@ -296,11 +289,7 @@ Writer::finish ()
_picture_asset->set_directory (_film->dir (_film->dcp_name ()));
_picture_asset->set_file_name (_film->dcp_video_mxf_filename ());
-
- if (_film->trim_type() == Film::CPL) {
- _sound_asset->set_entry_point (_film->trim_start ());
- }
- _sound_asset->set_duration (duration);
+ _sound_asset->set_duration (frames);
libdcp::DCP dcp (_film->dir (_film->dcp_name()));
diff --git a/src/tools/po/es_ES.po b/src/tools/po/es_ES.po
index b64478334..bceb9ffff 100644
--- a/src/tools/po/es_ES.po
+++ b/src/tools/po/es_ES.po
@@ -85,7 +85,6 @@ msgstr "No se pudo cargar la película %s (%s)"
msgid "Could not open film at %s (%s)"
msgstr "No se pudo cargar la película en %s (%s)"
-<<<<<<< HEAD
#: src/tools/dcpomatic.cc:287 src/tools/dcpomatic.cc:410
#: src/tools/dcpomatic.cc:531
msgid "DCP-o-matic"
@@ -101,10 +100,6 @@ msgstr "Película cambiada"
msgid "DVD-o-matic"
msgstr "DVD-o-matic"
-#: src/tools/dvdomatic.cc:76
-msgid "Film changed"
-msgstr "Película cambiada"
-
#: src/tools/dvdomatic.cc:425
msgid "Free, open-source DCP generation from almost anything."
msgstr ""
diff --git a/src/wx/ffmpeg_content_dialog.cc b/src/wx/ffmpeg_content_dialog.cc
deleted file mode 100644
index 2731782ca..000000000
--- a/src/wx/ffmpeg_content_dialog.cc
+++ /dev/null
@@ -1,167 +0,0 @@
-/* -*- c-basic-offset: 8; default-tab-width: 8; -*- */
-
-/*
- Copyright (C) 2013 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
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <boost/lexical_cast.hpp>
-#include "lib/ffmpeg_content.h"
-#include "lib/playlist.h"
-#include "ffmpeg_content_dialog.h"
-#include "wx_util.h"
-#include "audio_mapping_view.h"
-
-using std::vector;
-using std::string;
-using std::cout;
-using boost::shared_ptr;
-using boost::lexical_cast;
-using boost::dynamic_pointer_cast;
-
-FFmpegContentDialog::FFmpegContentDialog (wxWindow* parent, shared_ptr<FFmpegContent> content)
- : wxDialog (parent, wxID_ANY, _("Video"))
- , _content (content)
-{
- wxFlexGridSizer* grid = new wxFlexGridSizer (3, 6, 6);
- grid->AddGrowableCol (1, 1);
-
- add_label_to_sizer (grid, this, _("Audio stream"));
- _audio_stream = new wxChoice (this, wxID_ANY);
- grid->Add (_audio_stream, 1, wxEXPAND | wxALL, 6);
- _audio_description = new wxStaticText (this, wxID_ANY, wxT (""));
- grid->Add (_audio_description, 1, wxALIGN_CENTER_VERTICAL | wxLEFT, 8);
-
- add_label_to_sizer (grid, this, _("Subtitle stream"));
- _subtitle_stream = new wxChoice (this, wxID_ANY);
- grid->Add (_subtitle_stream, 1, wxEXPAND | wxALL, 6);
- grid->AddSpacer (0);
-
- _audio_stream->Clear ();
- vector<shared_ptr<FFmpegAudioStream> > a = content->audio_streams ();
- for (vector<shared_ptr<FFmpegAudioStream> >::iterator i = a.begin(); i != a.end(); ++i) {
- _audio_stream->Append (std_to_wx ((*i)->name), new wxStringClientData (std_to_wx (lexical_cast<string> ((*i)->id))));
- }
-
- if (content->audio_stream()) {
- checked_set (_audio_stream, lexical_cast<string> (content->audio_stream()->id));
- }
-
- _subtitle_stream->Clear ();
- vector<shared_ptr<FFmpegSubtitleStream> > s = content->subtitle_streams ();
- if (s.empty ()) {
- _subtitle_stream->Enable (false);
- }
- for (vector<shared_ptr<FFmpegSubtitleStream> >::iterator i = s.begin(); i != s.end(); ++i) {
- _subtitle_stream->Append (std_to_wx ((*i)->name), new wxStringClientData (std_to_wx (lexical_cast<string> ((*i)->id))));
- }
-
- if (content->subtitle_stream()) {
- checked_set (_subtitle_stream, lexical_cast<string> (content->subtitle_stream()->id));
- } else {
- _subtitle_stream->SetSelection (wxNOT_FOUND);
- }
-
- wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
-
- overall_sizer->Add (grid, 1, wxEXPAND | wxALL, 6);
-
- _audio_mapping = new AudioMappingView (this);
- _audio_mapping->set_mapping (content->audio_mapping ());
- overall_sizer->Add (_audio_mapping, 1, wxEXPAND | wxALL, 6);
-
- wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
- if (buttons) {
- overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
- }
-
- SetSizer (overall_sizer);
- overall_sizer->Layout ();
- overall_sizer->SetSizeHints (this);
-
- _audio_stream->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FFmpegContentDialog::audio_stream_changed), 0, this);
- _subtitle_stream->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FFmpegContentDialog::subtitle_stream_changed), 0, this);
- _audio_mapping->Changed.connect (bind (&FFmpegContentDialog::audio_mapping_changed, this, _1));
-}
-
-void
-FFmpegContentDialog::audio_stream_changed (wxCommandEvent &)
-{
- shared_ptr<FFmpegContent> c = _content.lock ();
- if (!c) {
- return;
- }
-
- vector<shared_ptr<FFmpegAudioStream> > a = c->audio_streams ();
- vector<shared_ptr<FFmpegAudioStream> >::iterator i = a.begin ();
- string const s = string_client_data (_audio_stream->GetClientObject (_audio_stream->GetSelection ()));
- while (i != a.end() && lexical_cast<string> ((*i)->id) != s) {
- ++i;
- }
-
- if (i != a.end ()) {
- c->set_audio_stream (*i);
- }
-
- if (!c->audio_stream ()) {
- _audio_description->SetLabel (wxT (""));
- } else {
- wxString s;
- if (c->audio_channels() == 1) {
- s << _("1 channel");
- } else {
- s << c->audio_channels() << wxT (" ") << _("channels");
- }
- s << wxT (", ") << c->content_audio_frame_rate() << _("Hz");
- _audio_description->SetLabel (s);
- }
-}
-
-
-
-void
-FFmpegContentDialog::subtitle_stream_changed (wxCommandEvent &)
-{
- shared_ptr<FFmpegContent> c = _content.lock ();
- if (!c) {
- return;
- }
-
- vector<shared_ptr<FFmpegSubtitleStream> > a = c->subtitle_streams ();
- vector<shared_ptr<FFmpegSubtitleStream> >::iterator i = a.begin ();
- string const s = string_client_data (_subtitle_stream->GetClientObject (_subtitle_stream->GetSelection ()));
- while (i != a.end() && lexical_cast<string> ((*i)->id) != s) {
- ++i;
- }
-
- if (i != a.end ()) {
- c->set_subtitle_stream (*i);
- }
-}
-
-void
-FFmpegContentDialog::audio_mapping_changed (AudioMapping m)
-{
- shared_ptr<FFmpegContent> content = _content.lock ();
-
- if (!content || !content->audio_stream()) {
- return;
- }
-
- content->audio_stream()->mapping = m;
-}
-
diff --git a/src/wx/ffmpeg_content_dialog.h b/src/wx/ffmpeg_content_dialog.h
deleted file mode 100644
index 302c8166f..000000000
--- a/src/wx/ffmpeg_content_dialog.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- c-basic-offset: 8; default-tab-width: 8; -*- */
-
-/*
- Copyright (C) 2013 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
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <wx/wx.h>
-#include <boost/shared_ptr.hpp>
-#include <boost/weak_ptr.hpp>
-#include "lib/audio_mapping.h"
-
-class wxSpinCtrl;
-class FFmpegContent;
-class AudioMappingView;
-class Region;
-
-class FFmpegContentDialog : public wxDialog
-{
-public:
- FFmpegContentDialog (wxWindow *, boost::shared_ptr<FFmpegContent>);
-
-private:
- void audio_stream_changed (wxCommandEvent &);
- void subtitle_stream_changed (wxCommandEvent &);
- void audio_mapping_changed (AudioMapping);
-
- boost::weak_ptr<FFmpegContent> _content;
- wxChoice* _audio_stream;
- wxStaticText* _audio_description;
- wxChoice* _subtitle_stream;
- AudioMappingView* _audio_mapping;
-};
diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc
index 177202d25..4955d9f3d 100644
--- a/src/wx/film_editor.cc
+++ b/src/wx/film_editor.cc
@@ -52,8 +52,8 @@
#include "scaler.h"
#include "audio_dialog.h"
#include "imagemagick_content_dialog.h"
-#include "ffmpeg_content_dialog.h"
#include "timeline_dialog.h"
+#include "audio_mapping_view.h"
using std::string;
using std::cout;
@@ -77,20 +77,15 @@ FilmEditor::FilmEditor (shared_ptr<Film> f, wxWindow* parent)
, _timeline_dialog (0)
{
wxBoxSizer* s = new wxBoxSizer (wxVERTICAL);
- _notebook = new wxNotebook (this, wxID_ANY);
- s->Add (_notebook, 1);
- make_film_panel ();
- _notebook->AddPage (_film_panel, _("Film"), true);
- make_content_panel ();
- _notebook->AddPage (_content_panel, _("Content"), false);
- make_video_panel ();
- _notebook->AddPage (_video_panel, _("Video"), false);
- make_audio_panel ();
- _notebook->AddPage (_audio_panel, _("Audio"), false);
- make_subtitle_panel ();
- _notebook->AddPage (_subtitle_panel, _("Subtitles"), false);
+ _main_notebook = new wxNotebook (this, wxID_ANY);
+ s->Add (_main_notebook, 1);
+ make_content_panel ();
+ _main_notebook->AddPage (_content_panel, _("Content"), true);
+ make_dcp_panel ();
+ _main_notebook->AddPage (_dcp_panel, _("DCP"), false);
+
setup_formats ();
set_film (f);
@@ -104,75 +99,49 @@ FilmEditor::FilmEditor (shared_ptr<Film> f, wxWindow* parent)
}
void
-FilmEditor::make_film_panel ()
+FilmEditor::make_dcp_panel ()
{
- _film_panel = new wxPanel (_notebook);
- _film_sizer = new wxBoxSizer (wxVERTICAL);
- _film_panel->SetSizer (_film_sizer);
+ _dcp_panel = new wxPanel (_main_notebook);
+ _dcp_sizer = new wxBoxSizer (wxVERTICAL);
+ _dcp_panel->SetSizer (_dcp_sizer);
wxGridBagSizer* grid = new wxGridBagSizer (4, 4);
- _film_sizer->Add (grid, 0, wxALL, 8);
+ _dcp_sizer->Add (grid, 0, wxEXPAND | wxALL, 8);
int r = 0;
- add_label_to_grid_bag_sizer (grid, _film_panel, _("Name"), wxGBPosition (r, 0));
- _name = new wxTextCtrl (_film_panel, wxID_ANY);
+ add_label_to_grid_bag_sizer (grid, _dcp_panel, _("Name"), wxGBPosition (r, 0));
+ _name = new wxTextCtrl (_dcp_panel, wxID_ANY);
grid->Add (_name, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND);
++r;
- add_label_to_grid_bag_sizer (grid, _film_panel, _("DCP Name"), wxGBPosition (r, 0));
- _dcp_name = new wxStaticText (_film_panel, wxID_ANY, wxT (""));
+ add_label_to_grid_bag_sizer (grid, _dcp_panel, _("DCP Name"), wxGBPosition (r, 0));
+ _dcp_name = new wxStaticText (_dcp_panel, wxID_ANY, wxT (""));
grid->Add (_dcp_name, wxGBPosition(r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
++r;
- _use_dci_name = new wxCheckBox (_film_panel, wxID_ANY, _("Use DCI name"));
+ _use_dci_name = new wxCheckBox (_dcp_panel, wxID_ANY, _("Use DCI name"));
grid->Add (_use_dci_name, wxGBPosition (r, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
- _edit_dci_button = new wxButton (_film_panel, wxID_ANY, _("Details..."));
+ _edit_dci_button = new wxButton (_dcp_panel, wxID_ANY, _("Details..."));
grid->Add (_edit_dci_button, wxGBPosition (r, 1), wxDefaultSpan);
++r;
- _trust_content_headers = new wxCheckBox (_film_panel, wxID_ANY, _("Trust content headers"));
- grid->Add (_trust_content_headers, wxGBPosition (r, 0), wxGBSpan(1, 2));
- ++r;
-
- add_label_to_grid_bag_sizer (grid, _film_panel, _("Content Type"), wxGBPosition (r, 0));
- _dcp_content_type = new wxChoice (_film_panel, wxID_ANY);
+ add_label_to_grid_bag_sizer (grid, _dcp_panel, _("Content Type"), wxGBPosition (r, 0));
+ _dcp_content_type = new wxChoice (_dcp_panel, wxID_ANY);
grid->Add (_dcp_content_type, wxGBPosition (r, 1));
++r;
{
- add_label_to_grid_bag_sizer (grid, _film_panel, _("DCP Frame Rate"), wxGBPosition (r, 0));
+ add_label_to_grid_bag_sizer (grid, _dcp_panel, _("DCP Frame Rate"), wxGBPosition (r, 0));
wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- _dcp_frame_rate = new wxChoice (_film_panel, wxID_ANY);
+ _dcp_frame_rate = new wxChoice (_dcp_panel, wxID_ANY);
s->Add (_dcp_frame_rate, 1, wxALIGN_CENTER_VERTICAL);
- _best_dcp_frame_rate = new wxButton (_film_panel, wxID_ANY, _("Use best"));
+ _best_dcp_frame_rate = new wxButton (_dcp_panel, wxID_ANY, _("Use best"));
s->Add (_best_dcp_frame_rate, 1, wxALIGN_CENTER_VERTICAL | wxALL | wxEXPAND, 6);
grid->Add (s, wxGBPosition (r, 1));
}
++r;
- _frame_rate_description = new wxStaticText (_film_panel, wxID_ANY, wxT ("\n \n "), wxDefaultPosition, wxDefaultSize);
- grid->Add (_frame_rate_description, wxGBPosition (r, 0), wxGBSpan (1, 2), wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL, 6);
- wxFont font = _frame_rate_description->GetFont();
- font.SetStyle(wxFONTSTYLE_ITALIC);
- font.SetPointSize(font.GetPointSize() - 1);
- _frame_rate_description->SetFont(font);
- ++r;
-
- add_label_to_grid_bag_sizer (grid, _film_panel, _("Length"), wxGBPosition (r, 0));
- _length = new wxStaticText (_film_panel, wxID_ANY, wxT (""));
- grid->Add (_length, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
- ++r;
-
- add_label_to_grid_bag_sizer (grid, _film_panel, _("Trim method"), wxGBPosition (r, 0));
- _trim_type = new wxChoice (_film_panel, wxID_ANY);
- grid->Add (_trim_type, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
- ++r;
-
- _ab = new wxCheckBox (_film_panel, wxID_ANY, _("A/B"));
- grid->Add (_ab, wxGBPosition (r, 0));
- ++r;
-
vector<DCPContentType const *> const ct = DCPContentType::all ();
for (vector<DCPContentType const *>::const_iterator i = ct.begin(); i != ct.end(); ++i) {
_dcp_content_type->Append (std_to_wx ((*i)->pretty_name ()));
@@ -182,9 +151,6 @@ FilmEditor::make_film_panel ()
for (list<int>::const_iterator i = dfr.begin(); i != dfr.end(); ++i) {
_dcp_frame_rate->Append (std_to_wx (boost::lexical_cast<string> (*i)));
}
-
- _trim_type->Append (_("encode all frames and play the subset"));
- _trim_type->Append (_("encode only the subset"));
}
void
@@ -194,13 +160,10 @@ FilmEditor::connect_to_widgets ()
_use_dci_name->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::use_dci_name_toggled), 0, this);
_edit_dci_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::edit_dci_button_clicked), 0, this);
_format->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::format_changed), 0, this);
- _trust_content_headers->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::trust_content_headers_changed), 0, this);
_content->Connect (wxID_ANY, wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler (FilmEditor::content_selection_changed), 0, this);
_content->Connect (wxID_ANY, wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler (FilmEditor::content_selection_changed), 0, this);
- _content->Connect (wxID_ANY, wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler (FilmEditor::content_activated), 0, this);
_content_add->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::content_add_clicked), 0, this);
_content_remove->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::content_remove_clicked), 0, this);
- _content_properties->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::content_properties_clicked), 0, this);
_content_timeline->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::content_timeline_clicked), 0, this);
_loop_content->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::loop_content_toggled), 0, this);
_loop_count->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::loop_count_changed), 0, this);
@@ -213,8 +176,6 @@ FilmEditor::connect_to_widgets ()
_dcp_content_type->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::dcp_content_type_changed), 0, this);
_dcp_frame_rate->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::dcp_frame_rate_changed), 0, this);
_best_dcp_frame_rate->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::best_dcp_frame_rate_clicked), 0, this);
- _ab->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::ab_toggled), 0, this);
- _trim_type->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::trim_type_changed), 0, this);
_with_subtitles->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::with_subtitles_toggled), 0, this);
_subtitle_offset->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::subtitle_offset_changed), 0, this);
_subtitle_scale->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::subtitle_scale_changed), 0, this);
@@ -226,12 +187,15 @@ FilmEditor::connect_to_widgets ()
);
_show_audio->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::show_audio_clicked), 0, this);
_audio_delay->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::audio_delay_changed), 0, this);
+ _audio_stream->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::audio_stream_changed), 0, this);
+ _subtitle_stream->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::subtitle_stream_changed), 0, this);
+ _audio_mapping->Changed.connect (bind (&FilmEditor::audio_mapping_changed, this, _1));
}
void
FilmEditor::make_video_panel ()
{
- _video_panel = new wxPanel (_notebook);
+ _video_panel = new wxPanel (_content_notebook);
_video_sizer = new wxBoxSizer (wxVERTICAL);
_video_panel->SetSizer (_video_sizer);
@@ -323,10 +287,10 @@ FilmEditor::make_video_panel ()
void
FilmEditor::make_content_panel ()
{
- _content_panel = new wxPanel (_notebook);
+ _content_panel = new wxPanel (_main_notebook);
_content_sizer = new wxBoxSizer (wxVERTICAL);
_content_panel->SetSizer (_content_sizer);
-
+
{
wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
@@ -341,8 +305,6 @@ FilmEditor::make_content_panel ()
b->Add (_content_add, 1, wxEXPAND | wxLEFT | wxRIGHT);
_content_remove = new wxButton (_content_panel, wxID_ANY, _("Remove"));
b->Add (_content_remove, 1, wxEXPAND | wxLEFT | wxRIGHT);
- _content_properties = new wxButton (_content_panel, wxID_ANY, _("Properties..."));
- b->Add (_content_properties);
_content_timeline = new wxButton (_content_panel, wxID_ANY, _("Timeline..."));
b->Add (_content_timeline, 1, wxEXPAND | wxLEFT | wxRIGHT);
@@ -351,9 +313,6 @@ FilmEditor::make_content_panel ()
_content_sizer->Add (s, 0.75, wxEXPAND | wxALL, 6);
}
- _content_information = new wxTextCtrl (_content_panel, wxID_ANY, wxT ("\n \n "), wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxTE_MULTILINE);
- _content_sizer->Add (_content_information, 1, wxEXPAND | wxALL, 6);
-
wxBoxSizer* h = new wxBoxSizer (wxHORIZONTAL);
_loop_content = new wxCheckBox (_content_panel, wxID_ANY, _("Loop everything"));
h->Add (_loop_content, 0, wxALL, 6);
@@ -362,36 +321,48 @@ FilmEditor::make_content_panel ()
add_label_to_sizer (h, _content_panel, _("times"));
_content_sizer->Add (h, 0, wxALL, 6);
+ _content_notebook = new wxNotebook (_content_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_LEFT);
+ _content_sizer->Add (_content_notebook, 1, wxEXPAND | wxTOP, 6);
+
+ make_video_panel ();
+ _content_notebook->AddPage (_video_panel, _("Video"), false);
+ make_audio_panel ();
+ _content_notebook->AddPage (_audio_panel, _("Audio"), false);
+ make_subtitle_panel ();
+ _content_notebook->AddPage (_subtitle_panel, _("Subtitles"), false);
+
_loop_count->SetRange (2, 1024);
}
void
FilmEditor::make_audio_panel ()
{
- _audio_panel = new wxPanel (_notebook);
+ _audio_panel = new wxPanel (_content_notebook);
_audio_sizer = new wxBoxSizer (wxVERTICAL);
_audio_panel->SetSizer (_audio_sizer);
- wxFlexGridSizer* grid = new wxFlexGridSizer (2, 4, 4);
+ wxFlexGridSizer* grid = new wxFlexGridSizer (3, 4, 4);
_audio_sizer->Add (grid, 0, wxALL, 8);
_show_audio = new wxButton (_audio_panel, wxID_ANY, _("Show Audio..."));
grid->Add (_show_audio, 1);
grid->AddSpacer (0);
+ grid->AddSpacer (0);
+ add_label_to_sizer (grid, _audio_panel, _("Audio Gain"));
{
- add_label_to_sizer (grid, _audio_panel, _("Audio Gain"));
wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
_audio_gain = new wxSpinCtrl (_audio_panel);
s->Add (_audio_gain, 1);
add_label_to_sizer (s, _audio_panel, _("dB"));
- _audio_gain_calculate_button = new wxButton (_audio_panel, wxID_ANY, _("Calculate..."));
- s->Add (_audio_gain_calculate_button, 1, wxEXPAND);
- grid->Add (s);
+ grid->Add (s, 1);
}
+
+ _audio_gain_calculate_button = new wxButton (_audio_panel, wxID_ANY, _("Calculate..."));
+ grid->Add (_audio_gain_calculate_button);
+ add_label_to_sizer (grid, _audio_panel, _("Audio Delay"));
{
- add_label_to_sizer (grid, _audio_panel, _("Audio Delay"));
wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
_audio_delay = new wxSpinCtrl (_audio_panel);
s->Add (_audio_delay, 1);
@@ -400,6 +371,21 @@ FilmEditor::make_audio_panel ()
grid->Add (s);
}
+ grid->AddSpacer (0);
+
+ add_label_to_sizer (grid, _audio_panel, _("Audio Stream"));
+ _audio_stream = new wxChoice (_audio_panel, wxID_ANY);
+ grid->Add (_audio_stream, 1);
+ _audio_description = new wxStaticText (_audio_panel, wxID_ANY, wxT (""));
+ grid->AddSpacer (0);
+
+ grid->Add (_audio_description, 1, wxALIGN_CENTER_VERTICAL | wxLEFT, 8);
+ grid->AddSpacer (0);
+ grid->AddSpacer (0);
+
+ _audio_mapping = new AudioMappingView (_audio_panel);
+ _audio_sizer->Add (_audio_mapping, 1, wxEXPAND | wxALL, 6);
+
_audio_gain->SetRange (-60, 60);
_audio_delay->SetRange (-1000, 1000);
}
@@ -407,7 +393,7 @@ FilmEditor::make_audio_panel ()
void
FilmEditor::make_subtitle_panel ()
{
- _subtitle_panel = new wxPanel (_notebook);
+ _subtitle_panel = new wxPanel (_content_notebook);
_subtitle_sizer = new wxBoxSizer (wxVERTICAL);
_subtitle_panel->SetSizer (_subtitle_sizer);
wxFlexGridSizer* grid = new wxFlexGridSizer (2, 4, 4);
@@ -435,6 +421,11 @@ FilmEditor::make_subtitle_panel ()
grid->Add (s);
}
+ add_label_to_sizer (grid, _subtitle_panel, _("Subtitle stream"));
+ _subtitle_stream = new wxChoice (_subtitle_panel, wxID_ANY);
+ grid->Add (_subtitle_stream, 1, wxEXPAND | wxALL, 6);
+ grid->AddSpacer (0);
+
_subtitle_offset->SetRange (-1024, 1024);
_subtitle_scale->SetRange (1, 1000);
}
@@ -483,27 +474,6 @@ FilmEditor::bottom_crop_changed (wxCommandEvent &)
_film->set_bottom_crop (_bottom_crop->GetValue ());
}
-void
-FilmEditor::trust_content_headers_changed (wxCommandEvent &)
-{
- if (!_film) {
- return;
- }
-
- _film->set_trust_content_headers (_trust_content_headers->GetValue ());
-}
-
-/** Called when the DCP A/B switch has been toggled */
-void
-FilmEditor::ab_toggled (wxCommandEvent &)
-{
- if (!_film) {
- return;
- }
-
- _film->set_ab (_ab->GetValue ());
-}
-
/** Called when the name widget has been changed */
void
FilmEditor::name_changed (wxCommandEvent &)
@@ -594,16 +564,12 @@ FilmEditor::film_changed (Film::Property p)
setup_format ();
setup_subtitle_control_sensitivity ();
setup_show_audio_sensitivity ();
- setup_length ();
break;
case Film::LOOP:
checked_set (_loop_content, _film->loop() > 1);
checked_set (_loop_count, _film->loop());
setup_loop_sensitivity ();
break;
- case Film::TRUST_CONTENT_HEADERS:
- checked_set (_trust_content_headers, _film->trust_content_headers ());
- break;
case Film::FORMAT:
setup_format ();
break;
@@ -623,7 +589,7 @@ FilmEditor::film_changed (Film::Property p)
string const b = p.first + " " + p.second;
_filters->SetLabel (std_to_wx (b));
}
- _film_sizer->Layout ();
+ _dcp_sizer->Layout ();
break;
}
case Film::NAME:
@@ -634,15 +600,9 @@ FilmEditor::film_changed (Film::Property p)
checked_set (_dcp_content_type, DCPContentType::as_index (_film->dcp_content_type ()));
setup_dcp_name ();
break;
- case Film::AB:
- checked_set (_ab, _film->ab ());
- break;
case Film::SCALER:
checked_set (_scaler, Scaler::as_index (_film->scaler ()));
break;
- case Film::TRIM_TYPE:
- checked_set (_trim_type, _film->trim_type() == Film::CPL ? 0 : 1);
- break;
case Film::AUDIO_GAIN:
checked_set (_audio_gain, _film->audio_gain ());
break;
@@ -689,7 +649,6 @@ FilmEditor::film_changed (Film::Property p)
}
_best_dcp_frame_rate->Enable (_film->best_dcp_video_frame_rate () != _film->dcp_video_frame_rate ());
- setup_frame_rate_description ();
break;
}
}
@@ -709,12 +668,6 @@ FilmEditor::film_content_changed (weak_ptr<Content> content, int property)
setup_subtitle_control_sensitivity ();
} else if (property == FFmpegContentProperty::AUDIO_STREAMS) {
setup_show_audio_sensitivity ();
- } else if (property == VideoContentProperty::VIDEO_LENGTH || property == AudioContentProperty::AUDIO_LENGTH) {
- setup_length ();
- boost::shared_ptr<Content> c = content.lock ();
- if (selected_content() && c == selected_content()) {
- setup_content_information ();
- }
} else if (property == FFmpegContentProperty::AUDIO_STREAM) {
setup_dcp_name ();
setup_show_audio_sensitivity ();
@@ -741,46 +694,6 @@ FilmEditor::setup_format ()
setup_scaling_description ();
}
-void
-FilmEditor::setup_length ()
-{
- stringstream s;
- Time const length = _film->length ();
-
- s << time_to_hms (length);
- _length->SetLabel (std_to_wx (s.str ()));
-}
-
-void
-FilmEditor::setup_frame_rate_description ()
-{
- wxString d;
- int lines = 0;
-
-#if 0
- XXX
-
- if (_film->video_frame_rate()) {
- d << std_to_wx (FrameRateConversion (_film->video_frame_rate(), _film->dcp_frame_rate()).description);
- ++lines;
- if (_film->audio_frame_rate() && _film->audio_frame_rate() != _film->target_audio_sample_rate ()) {
- d << wxString::Format (
- _("Audio will be resampled from %dHz to %dHz\n"),
- _film->audio_frame_rate(),
- _film->target_audio_sample_rate()
- );
- ++lines;
- }
- }
-#endif
-
- for (int i = lines; i < 2; ++i) {
- d << wxT ("\n ");
- }
-
- _frame_rate_description->SetLabel (d);
-}
-
/** Called when the format widget has been changed */
void
FilmEditor::format_changed (wxCommandEvent &)
@@ -841,16 +754,11 @@ FilmEditor::set_film (shared_ptr<Film> f)
film_changed (Film::USE_DCI_NAME);
film_changed (Film::CONTENT);
film_changed (Film::LOOP);
- film_changed (Film::TRUST_CONTENT_HEADERS);
film_changed (Film::DCP_CONTENT_TYPE);
film_changed (Film::FORMAT);
film_changed (Film::CROP);
film_changed (Film::FILTERS);
film_changed (Film::SCALER);
- film_changed (Film::TRIM_START);
- film_changed (Film::TRIM_END);
- film_changed (Film::AB);
- film_changed (Film::TRIM_TYPE);
film_changed (Film::AUDIO_GAIN);
film_changed (Film::AUDIO_DELAY);
film_changed (Film::WITH_SUBTITLES);
@@ -865,8 +773,6 @@ FilmEditor::set_film (shared_ptr<Film> f)
film_content_changed (boost::shared_ptr<Content> (), FFmpegContentProperty::SUBTITLE_STREAM);
film_content_changed (boost::shared_ptr<Content> (), FFmpegContentProperty::AUDIO_STREAMS);
film_content_changed (boost::shared_ptr<Content> (), FFmpegContentProperty::AUDIO_STREAM);
-
- setup_content_information ();
}
/** Updates the sensitivity of lots of widgets to a given value.
@@ -882,7 +788,6 @@ FilmEditor::set_things_sensitive (bool s)
_edit_dci_button->Enable (s);
_format->Enable (s);
_content->Enable (s);
- _trust_content_headers->Enable (s);
_content->Enable (s);
_left_crop->Enable (s);
_right_crop->Enable (s);
@@ -893,8 +798,6 @@ FilmEditor::set_things_sensitive (bool s)
_dcp_content_type->Enable (s);
_best_dcp_frame_rate->Enable (s);
_dcp_frame_rate->Enable (s);
- _ab->Enable (s);
- _trim_type->Enable (s);
_colour_lut->Enable (s);
_j2k_bandwidth->Enable (s);
_audio_gain->Enable (s);
@@ -952,20 +855,16 @@ FilmEditor::audio_delay_changed (wxCommandEvent &)
}
void
-FilmEditor::setup_notebook_size ()
+FilmEditor::setup_main_notebook_size ()
{
- _notebook->InvalidateBestSize ();
-
- _film_sizer->Layout ();
- _film_sizer->SetSizeHints (_film_panel);
- _video_sizer->Layout ();
- _video_sizer->SetSizeHints (_video_panel);
- _audio_sizer->Layout ();
- _audio_sizer->SetSizeHints (_audio_panel);
- _subtitle_sizer->Layout ();
- _subtitle_sizer->SetSizeHints (_subtitle_panel);
-
- _notebook->Fit ();
+ _main_notebook->InvalidateBestSize ();
+
+ _content_sizer->Layout ();
+ _content_sizer->SetSizeHints (_content_panel);
+ _dcp_sizer->Layout ();
+ _dcp_sizer->SetSizeHints (_dcp_panel);
+
+ _main_notebook->Fit ();
Fit ();
}
@@ -1006,7 +905,7 @@ FilmEditor::setup_formats ()
_format->Append (std_to_wx ((*i)->name ()));
}
- _film_sizer->Layout ();
+ _dcp_sizer->Layout ();
}
void
@@ -1132,8 +1031,6 @@ FilmEditor::setup_content ()
/* Select the item of content if non was selected before */
_content->SetItemState (0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
}
-
- setup_content_information ();
}
void
@@ -1173,60 +1070,9 @@ FilmEditor::content_remove_clicked (wxCommandEvent &)
}
void
-FilmEditor::content_activated (wxListEvent& ev)
-{
- Playlist::ContentList c = _film->content ();
- assert (ev.GetIndex() >= 0 && size_t (ev.GetIndex()) < c.size ());
-
- content_properties (c[ev.GetIndex()]);
-}
-
-void
-FilmEditor::content_properties_clicked (wxCommandEvent &)
-{
- shared_ptr<Content> c = selected_content ();
- if (!c) {
- return;
- }
-
- content_properties (c);
-}
-
-void
-FilmEditor::content_properties (shared_ptr<Content> content)
-{
- shared_ptr<ImageMagickContent> ic = dynamic_pointer_cast<ImageMagickContent> (content);
- if (ic) {
- ImageMagickContentDialog* d = new ImageMagickContentDialog (this, ic);
- d->ShowModal ();
- d->Destroy ();
- }
-
- shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (content);
- if (fc) {
- FFmpegContentDialog* d = new FFmpegContentDialog (this, fc);
- d->ShowModal ();
- d->Destroy ();
- }
-}
-
-void
FilmEditor::content_selection_changed (wxListEvent &)
{
setup_content_button_sensitivity ();
- setup_content_information ();
-}
-
-void
-FilmEditor::setup_content_information ()
-{
- shared_ptr<Content> c = selected_content ();
- if (!c) {
- _content_information->SetValue (wxT (""));
- return;
- }
-
- _content_information->SetValue (std_to_wx (c->information ()));
}
void
@@ -1236,11 +1082,6 @@ FilmEditor::setup_content_button_sensitivity ()
shared_ptr<Content> selection = selected_content ();
- _content_properties->Enable (
- selection && _generally_sensitive &&
- (dynamic_pointer_cast<ImageMagickContent> (selection) || dynamic_pointer_cast<FFmpegContent> (selection))
- );
-
_content_remove->Enable (selection && _generally_sensitive);
_content_timeline->Enable (_generally_sensitive);
}
@@ -1321,12 +1162,6 @@ XXX
}
void
-FilmEditor::trim_type_changed (wxCommandEvent &)
-{
- _film->set_trim_type (_trim_type->GetSelection () == 0 ? Film::CPL : Film::ENCODE);
-}
-
-void
FilmEditor::loop_content_toggled (wxCommandEvent &)
{
if (_loop_content->GetValue ()) {
@@ -1361,3 +1196,127 @@ FilmEditor::content_timeline_clicked (wxCommandEvent &)
_timeline_dialog = new TimelineDialog (this, _film);
_timeline_dialog->Show ();
}
+
+void
+FilmEditor::setup_content_properties ()
+{
+ _audio_stream->Clear ();
+ _subtitle_stream->Clear ();
+
+ shared_ptr<Content> c = selected_content ();
+ if (!c) {
+ return;
+ }
+
+ shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (c);
+ if (fc) {
+
+ vector<shared_ptr<FFmpegAudioStream> > a = fc->audio_streams ();
+ for (vector<shared_ptr<FFmpegAudioStream> >::iterator i = a.begin(); i != a.end(); ++i) {
+ _audio_stream->Append (std_to_wx ((*i)->name), new wxStringClientData (std_to_wx (lexical_cast<string> ((*i)->id))));
+ }
+
+ if (fc->audio_stream()) {
+ checked_set (_audio_stream, lexical_cast<string> (fc->audio_stream()->id));
+ }
+
+ vector<shared_ptr<FFmpegSubtitleStream> > s = fc->subtitle_streams ();
+ if (s.empty ()) {
+ _subtitle_stream->Enable (false);
+ }
+ for (vector<shared_ptr<FFmpegSubtitleStream> >::iterator i = s.begin(); i != s.end(); ++i) {
+ _subtitle_stream->Append (std_to_wx ((*i)->name), new wxStringClientData (std_to_wx (lexical_cast<string> ((*i)->id))));
+ }
+
+ if (fc->subtitle_stream()) {
+ checked_set (_subtitle_stream, lexical_cast<string> (fc->subtitle_stream()->id));
+ } else {
+ _subtitle_stream->SetSelection (wxNOT_FOUND);
+ }
+
+ /* XXX: should be general audiocontent */
+ _audio_mapping->set_mapping (fc->audio_mapping ());
+ }
+}
+
+void
+FilmEditor::audio_stream_changed (wxCommandEvent &)
+{
+ shared_ptr<Content> c = selected_content ();
+ if (!c) {
+ return;
+ }
+
+ shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (c);
+ if (!fc) {
+ return;
+ }
+
+ vector<shared_ptr<FFmpegAudioStream> > a = fc->audio_streams ();
+ vector<shared_ptr<FFmpegAudioStream> >::iterator i = a.begin ();
+ string const s = string_client_data (_audio_stream->GetClientObject (_audio_stream->GetSelection ()));
+ while (i != a.end() && lexical_cast<string> ((*i)->id) != s) {
+ ++i;
+ }
+
+ if (i != a.end ()) {
+ fc->set_audio_stream (*i);
+ }
+
+ if (!fc->audio_stream ()) {
+ _audio_description->SetLabel (wxT (""));
+ } else {
+ wxString s;
+ if (fc->audio_channels() == 1) {
+ s << _("1 channel");
+ } else {
+ s << fc->audio_channels() << wxT (" ") << _("channels");
+ }
+ s << wxT (", ") << fc->content_audio_frame_rate() << _("Hz");
+ _audio_description->SetLabel (s);
+ }
+}
+
+
+
+void
+FilmEditor::subtitle_stream_changed (wxCommandEvent &)
+{
+ shared_ptr<Content> c = selected_content ();
+ if (!c) {
+ return;
+ }
+
+ shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (c);
+ if (!fc) {
+ return;
+ }
+
+ vector<shared_ptr<FFmpegSubtitleStream> > a = fc->subtitle_streams ();
+ vector<shared_ptr<FFmpegSubtitleStream> >::iterator i = a.begin ();
+ string const s = string_client_data (_subtitle_stream->GetClientObject (_subtitle_stream->GetSelection ()));
+ while (i != a.end() && lexical_cast<string> ((*i)->id) != s) {
+ ++i;
+ }
+
+ if (i != a.end ()) {
+ fc->set_subtitle_stream (*i);
+ }
+}
+
+void
+FilmEditor::audio_mapping_changed (AudioMapping m)
+{
+ shared_ptr<Content> c = selected_content ();
+ if (!c) {
+ return;
+ }
+
+ shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (c);
+ if (!fc) {
+ return;
+ }
+
+ /* XXX: should be general to audiocontent */
+ fc->audio_stream()->mapping = m;
+}
diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h
index 4bdba9979..9123dfdb4 100644
--- a/src/wx/film_editor.h
+++ b/src/wx/film_editor.h
@@ -34,6 +34,7 @@ class wxListEvent;
class Film;
class AudioDialog;
class TimelineDialog;
+class AudioMappingView;
/** @class FilmEditor
* @brief A wx widget to edit a film's metadata, and perform various functions.
@@ -48,7 +49,7 @@ public:
boost::signals2::signal<void (std::string)> FileChanged;
private:
- void make_film_panel ();
+ void make_dcp_panel ();
void make_content_panel ();
void make_video_panel ();
void make_audio_panel ();
@@ -65,15 +66,11 @@ private:
void bottom_crop_changed (wxCommandEvent &);
void trust_content_headers_changed (wxCommandEvent &);
void content_selection_changed (wxListEvent &);
- void content_activated (wxListEvent &);
void content_add_clicked (wxCommandEvent &);
void content_remove_clicked (wxCommandEvent &);
- void content_properties_clicked (wxCommandEvent &);
void imagemagick_video_length_changed (wxCommandEvent &);
void format_changed (wxCommandEvent &);
- void trim_type_changed (wxCommandEvent &);
void dcp_content_type_changed (wxCommandEvent &);
- void ab_toggled (wxCommandEvent &);
void scaler_changed (wxCommandEvent &);
void audio_gain_changed (wxCommandEvent &);
void audio_gain_calculate_button_clicked (wxCommandEvent &);
@@ -90,6 +87,9 @@ private:
void loop_content_toggled (wxCommandEvent &);
void loop_count_changed (wxCommandEvent &);
void content_timeline_clicked (wxCommandEvent &);
+ void audio_stream_changed (wxCommandEvent &);
+ void subtitle_stream_changed (wxCommandEvent &);
+ void audio_mapping_changed (AudioMapping);
/* Handle changes to the model */
void film_changed (Film::Property);
@@ -101,22 +101,20 @@ private:
void setup_dcp_name ();
void setup_show_audio_sensitivity ();
void setup_scaling_description ();
- void setup_notebook_size ();
- void setup_frame_rate_description ();
+ void setup_main_notebook_size ();
void setup_content ();
void setup_format ();
- void setup_length ();
- void setup_content_information ();
void setup_content_button_sensitivity ();
void setup_loop_sensitivity ();
+ void setup_content_properties ();
void active_jobs_changed (bool);
boost::shared_ptr<Content> selected_content ();
- void content_properties (boost::shared_ptr<Content>);
- wxNotebook* _notebook;
- wxPanel* _film_panel;
- wxSizer* _film_sizer;
+ wxNotebook* _main_notebook;
+ wxNotebook* _content_notebook;
+ wxPanel* _dcp_panel;
+ wxSizer* _dcp_sizer;
wxPanel* _content_panel;
wxSizer* _content_sizer;
wxPanel* _video_panel;
@@ -128,24 +126,20 @@ private:
/** The film we are editing */
boost::shared_ptr<Film> _film;
- /** The Film's name */
wxTextCtrl* _name;
wxStaticText* _dcp_name;
wxCheckBox* _use_dci_name;
wxListCtrl* _content;
wxButton* _content_add;
wxButton* _content_remove;
- wxButton* _content_properties;
wxButton* _content_earlier;
wxButton* _content_later;
wxButton* _content_timeline;
- wxTextCtrl* _content_information;
wxCheckBox* _loop_content;
wxSpinCtrl* _loop_count;
wxButton* _edit_dci_button;
wxChoice* _format;
wxStaticText* _format_description;
- wxCheckBox* _trust_content_headers;
wxStaticText* _scaling_description;
wxSpinCtrl* _left_crop;
wxSpinCtrl* _right_crop;
@@ -166,14 +160,10 @@ private:
wxChoice* _dcp_content_type;
wxChoice* _dcp_frame_rate;
wxButton* _best_dcp_frame_rate;
- wxStaticText* _frame_rate_description;
- wxStaticText* _length;
- /** The Film's audio details */
- wxStaticText* _audio;
-
- wxChoice* _trim_type;
- /** Selector to generate an A/B comparison DCP */
- wxCheckBox* _ab;
+ wxChoice* _audio_stream;
+ wxStaticText* _audio_description;
+ wxChoice* _subtitle_stream;
+ AudioMappingView* _audio_mapping;
std::vector<Format const *> _formats;
diff --git a/src/wx/wscript b/src/wx/wscript
index c63ef128d..884eabc3a 100644
--- a/src/wx/wscript
+++ b/src/wx/wscript
@@ -10,7 +10,6 @@ sources = """
config_dialog.cc
dci_metadata_dialog.cc
dir_picker_ctrl.cc
- ffmpeg_content_dialog.cc
film_editor.cc
film_viewer.cc
filter_dialog.cc