+ 2014-09-03 Carl Hetherington <cth@carlh.net>
+
+ * Version 1.73.2 released.
+
+ 2014-09-03 Carl Hetherington <cth@carlh.net>
+
+ * Fix server certificate downloads on OS X (#376).
+
+ 2014-09-02 Carl Hetherington <cth@carlh.net>
+
+ * Improve behaviour of batch converter window when it is shrunk (#338).
+
+ 2014-09-01 Carl Hetherington <cth@carlh.net>
+
+ * Version 1.73.1 released.
+
2014-08-31 Carl Hetherington <cth@carlh.net>
* Remove configurable CPL <Creator> and use "DCP-o-matic (version) (git)"
2014-08-29 Carl Hetherington <cth@carlh.net>
+ * Version 2.0.4 released.
+
+2014-08-24 Carl Hetherington <cth@carlh.net>
+
+ * Version 2.0.3 released.
+
+2014-08-24 Carl Hetherington <cth@carlh.net>
+
+ * Version 2.0.2 released.
+
+2014-08-06 Carl Hetherington <cth@carlh.net>
+
+ * Version 2.0.1 released.
+
+2014-07-15 Carl Hetherington <cth@carlh.net>
+
+ * A variety of changes were made on the 2.0 branch
+ but not documented in the ChangeLog. Most sigificantly:
+
+ - DCP import
+ - Creation of DCPs with proper XML subtitles
+ - Import of .srt and .xml subtitles
+ - Audio processing framework (with some basic processors).
+
+2014-03-07 Carl Hetherington <cth@carlh.net>
+
+ * Add subtitle view.
* Some improvements to the manual.
2014-08-26 Carl Hetherington <cth@carlh.net>
* Attempt to fix random crashes on OS X (especially during encodes)
thought to be caused by multiple threads using (different) stringstreams
at the same time; see src/lib/safe_stringstream.
+>>>>>>> origin/master
2014-08-09 Carl Hetherington <cth@carlh.net>
2014-07-10 Carl Hetherington <cth@carlh.net>
* Version 1.72.2 released.
+>>>>>>> origin/master
2014-07-10 Carl Hetherington <cth@carlh.net>
- <<<<<<< HEAD
-dcpomatic (1.73.2-1) UNRELEASED; urgency=low
+dcpomatic (2.0.4-1) UNRELEASED; urgency=low
- =======
- dcpomatic (1.73.0-1) UNRELEASED; urgency=low
- >>>>>>> origin/master
* New upstream release.
* New upstream release.
* New upstream release.
* New upstream release.
* New upstream release.
- * New upstream release.
- * New upstream release.
- * New upstream release.
- * New upstream release.
- -- Carl Hetherington <carl@d1stkfactory> Wed, 03 Sep 2014 23:36:54 +0100
+ -- Carl Hetherington <carl@d1stkfactory> Fri, 29 Aug 2014 19:04:40 +0100
dcpomatic (0.87-1) UNRELEASED; urgency=low
ENV=/Users/carl/Environments/osx/10.6
ROOT=$1
-appdir="DCP-o-matic.app"
+appdir="DCP-o-matic 2.app"
approot="$appdir/Contents"
libs="$approot/lib"
macos="$approot/MacOS"
relink="$relink|$2"
}
-universal_copy $ROOT src/dcpomatic/build/src/tools/dcpomatic "$WORK/$macos"
-universal_copy $ROOT src/dcpomatic/build/src/tools/dcpomatic_cli "$WORK/$macos"
-universal_copy $ROOT src/dcpomatic/build/src/tools/dcpomatic_server_cli "$WORK/$macos"
-universal_copy $ROOT src/dcpomatic/build/src/tools/dcpomatic_batch "$WORK/$macos"
-universal_copy $ROOT src/dcpomatic/build/src/lib/libdcpomatic.dylib "$WORK/$libs"
-universal_copy $ROOT src/dcpomatic/build/src/wx/libdcpomatic-wx.dylib "$WORK/$libs"
+universal_copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2 "$WORK/$macos"
+universal_copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2_cli "$WORK/$macos"
+universal_copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2_server_cli "$WORK/$macos"
+universal_copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2_batch "$WORK/$macos"
+universal_copy $ROOT src/dcpomatic/build/src/lib/libdcpomatic2.dylib "$WORK/$libs"
+universal_copy $ROOT src/dcpomatic/build/src/wx/libdcpomatic2-wx.dylib "$WORK/$libs"
universal_copy_lib $ROOT libcxml "$WORK/$libs"
-universal_copy_lib $ROOT libdcp "$WORK/$libs"
-universal_copy_lib $ROOT libasdcp-libdcp "$WORK/$libs"
-universal_copy_lib $ROOT libkumu-libdcp "$WORK/$libs"
+universal_copy_lib $ROOT libdcp-1.0 "$WORK/$libs"
+universal_copy_lib $ROOT libasdcp-libdcp-1.0 "$WORK/$libs"
+universal_copy_lib $ROOT libkumu-libdcp-1.0 "$WORK/$libs"
universal_copy_lib $ROOT libopenjpeg "$WORK/$libs"
universal_copy_lib $ROOT libavdevice "$WORK/$libs"
universal_copy_lib $ROOT libavformat "$WORK/$libs"
relink=`echo $relink | sed -e "s/\+//g"`
-for obj in "$WORK/$macos/dcpomatic" "$WORK/$macos/dcpomatic_batch" "$WORK/$macos/dcpomatic_cli" "$WORK/$macos/dcpomatic_server_cli" "$WORK/$macos/ffprobe" "$WORK/$libs/"*.dylib; do
+for obj in "$WORK/$macos/dcpomatic2" "$WORK/$macos/dcpomatic2_batch" "$WORK/$macos/dcpomatic2_cli" "$WORK/$macos/dcpomatic2_server_cli" "$WORK/$macos/ffprobe" "$WORK/$libs/"*.dylib; do
deps=`otool -L "$obj" | awk '{print $1}' | egrep "($relink)" | egrep "($ENV|$ROOT|boost)"`
changes=""
for dep in $deps; do
+ echo "Relinking $dep into $obj"
base=`basename $dep`
# $dep will be a path within 64/; make a 32/ path too
dep32=`echo $dep | sed -e "s/\/64\//\/32\//g"`
cp icons/kdm_email.png "$WORK/$resources"
cp icons/servers.png "$WORK/$resources"
cp icons/tms.png "$WORK/$resources"
+cp icons/keys.png "$WORK/$resources"
# i18n: DCP-o-matic .mo files
for lang in de_DE es_ES fr_FR it_IT sv_SE nl_NL; do
- mkdir "$WORK/$resources/$lang/LC_MESSAGES"
+ mkdir -p "$WORK/$resources/$lang/LC_MESSAGES"
cp build/src/lib/mo/$lang/*.mo "$WORK/$resources/$lang/LC_MESSAGES"
cp build/src/wx/mo/$lang/*.mo "$WORK/$resources/$lang/LC_MESSAGES"
cp build/src/tools/mo/$lang/*.mo "$WORK/$resources/$lang/LC_MESSAGES"
set theViewOptions to the icon view options of container window
set arrangement of theViewOptions to not arranged
set icon size of theViewOptions to 64
- set position of item "DCP-o-matic.app" of container window to {90, 80}
+ set position of item "DCP-o-matic 2.app" of container window to {90, 80}
set position of item "Applications" of container window to {310, 80}
close
open
#include <unistd.h>
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
-#include <boost/date_time.hpp>
+#include <boost/lexical_cast.hpp>
#include <libxml++/libxml++.h>
#include <libcxml/cxml.h>
-#include <libdcp/signer_chain.h>
-#include <libdcp/cpl.h>
-#include <libdcp/signer.h>
-#include <libdcp/util.h>
-#include <libdcp/kdm.h>
-#include <libdcp/raw_convert.h>
+#include <dcp/cpl.h>
+#include <dcp/signer.h>
+#include <dcp/util.h>
+#include <dcp/local_time.h>
+#include <dcp/raw_convert.h>
#include "film.h"
#include "job.h"
#include "util.h"
using boost::starts_with;
using boost::optional;
using boost::is_any_of;
-using libdcp::Size;
-using libdcp::Signer;
-using libdcp::raw_convert;
+using dcp::Size;
+using dcp::Signer;
+using dcp::raw_convert;
+using dcp::raw_convert;
#define LOG_GENERAL(...) log()->log (String::compose (__VA_ARGS__), Log::TYPE_GENERAL);
#define LOG_GENERAL_NC(...) log()->log (__VA_ARGS__, Log::TYPE_GENERAL);
* Use <Scale> tag in <VideoContent> rather than <Ratio>.
* 8 -> 9
* DCI -> ISDCF
+ *
+ * Bumped to 32 for 2.0 branch; some times are expressed in Times rather
+ * than frames now.
*/
-int const Film::current_state_version = 9;
+int const Film::current_state_version = 32;
/** Construct a Film object in a given directory.
*
, _container (Config::instance()->default_container ())
, _resolution (RESOLUTION_2K)
, _scaler (Scaler::from_id ("bicubic"))
- , _with_subtitles (false)
, _signed (true)
, _encrypted (false)
, _j2k_bandwidth (Config::instance()->default_j2k_bandwidth ())
, _three_d (false)
, _sequence_video (true)
, _interop (false)
+ , _burn_subtitles (false)
, _state_version (current_state_version)
, _dirty (false)
{
s << "_S";
}
- if (_three_d) {
- s << "_3D";
+ if (_burn_subtitles) {
+ s << "_B";
}
- if (_with_subtitles) {
- s << "_WS";
+ if (_three_d) {
+ s << "_3D";
}
return s.str ();
return filename_safe_name() + "_audio.mxf";
}
+boost::filesystem::path
+Film::subtitle_xml_filename () const
+{
+ return filename_safe_name() + "_subtitle.xml";
+}
+
string
Film::filename_safe_name () const
{
root->add_child("Resolution")->add_child_text (resolution_to_string (_resolution));
root->add_child("Scaler")->add_child_text (_scaler->id ());
- root->add_child("WithSubtitles")->add_child_text (_with_subtitles ? "1" : "0");
root->add_child("J2KBandwidth")->add_child_text (raw_convert<string> (_j2k_bandwidth));
_isdcf_metadata.as_xml (root->add_child ("ISDCFMetadata"));
root->add_child("VideoFrameRate")->add_child_text (raw_convert<string> (_video_frame_rate));
root->add_child("ThreeD")->add_child_text (_three_d ? "1" : "0");
root->add_child("SequenceVideo")->add_child_text (_sequence_video ? "1" : "0");
root->add_child("Interop")->add_child_text (_interop ? "1" : "0");
+ root->add_child("BurnSubtitles")->add_child_text (_burn_subtitles ? "1" : "0");
root->add_child("Signed")->add_child_text (_signed ? "1" : "0");
root->add_child("Encrypted")->add_child_text (_encrypted ? "1" : "0");
root->add_child("Key")->add_child_text (_key.hex ());
_resolution = string_to_resolution (f.string_child ("Resolution"));
_scaler = Scaler::from_id (f.string_child ("Scaler"));
- _with_subtitles = f.bool_child ("WithSubtitles");
_j2k_bandwidth = f.number_child<int> ("J2KBandwidth");
_video_frame_rate = f.number_child<int> ("VideoFrameRate");
_signed = f.optional_bool_child("Signed").get_value_or (true);
_sequence_video = f.bool_child ("SequenceVideo");
_three_d = f.bool_child ("ThreeD");
_interop = f.bool_child ("Interop");
- _key = libdcp::Key (f.string_child ("Key"));
+ if (_state_version >= 32) {
+ _burn_subtitles = f.bool_child ("BurnSubtitles");
+ }
+ _key = dcp::Key (f.string_child ("Key"));
list<string> notes;
/* This method is the only one that can return notes (so far) */
d << "_" << container()->isdcf_name();
}
- /* XXX: this only works for content which has been scaled to a given ratio,
- and uses the first bit of content only.
- */
+ /* XXX: this uses the first bit of content only */
/* The standard says we don't do this for trailers, for some strange reason */
- if (dcp_content_type() && dcp_content_type()->libdcp_kind() != libdcp::TRAILER) {
- Ratio const * content_ratio = 0;
+ if (dcp_content_type() && dcp_content_type()->libdcp_kind() != dcp::TRAILER) {
ContentList cl = content ();
- for (ContentList::const_iterator i = cl.begin(); i != cl.end(); ++i) {
+ Ratio const * content_ratio = 0;
+ for (ContentList::iterator i = cl.begin(); i != cl.end(); ++i) {
shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (*i);
- if (vc && (content_ratio == 0 || vc->scale().ratio() != content_ratio)) {
- content_ratio = vc->scale().ratio();
+ if (vc) {
+ /* Here's the first piece of video content */
+ if (vc->scale().ratio ()) {
+ content_ratio = vc->scale().ratio ();
+ } else {
+ content_ratio = Ratio::from_ratio (vc->video_size().ratio ());
+ }
+ break;
}
}
return name();
}
-
void
Film::set_directory (boost::filesystem::path d)
{
signal_changed (SCALER);
}
-void
-Film::set_with_subtitles (bool w)
-{
- _with_subtitles = w;
- signal_changed (WITH_SUBTITLES);
-}
-
void
Film::set_j2k_bandwidth (int b)
{
signal_changed (INTEROP);
}
+void
+Film::set_burn_subtitles (bool b)
+{
+ _burn_subtitles = b;
+ signal_changed (BURN_SUBTITLES);
+}
+
void
Film::signal_changed (Property p)
{
return file (p);
}
-/** Find all the DCPs in our directory that can be libdcp::DCP::read() and return details of their CPLs */
+/** Find all the DCPs in our directory that can be dcp::DCP::read() and return details of their CPLs */
vector<CPLSummary>
Film::cpls () const
{
) {
try {
- libdcp::DCP dcp (*i);
+ dcp::DCP dcp (*i);
dcp.read ();
out.push_back (
CPLSummary (
- i->path().leaf().string(), dcp.cpls().front()->id(), dcp.cpls().front()->name(), dcp.cpls().front()->filename()
+ i->path().leaf().string(),
+ dcp.cpls().front()->id(),
+ dcp.cpls().front()->annotation_text(),
+ dcp.cpls().front()->file()
)
);
} catch (...) {
return _playlist->content ();
}
+void
+Film::examine_content (shared_ptr<Content> c)
+{
+ shared_ptr<Job> j (new ExamineContentJob (shared_from_this(), c));
+ JobManager::instance()->add (j);
+}
+
void
Film::examine_and_add_content (shared_ptr<Content> c)
{
_playlist->move_later (c);
}
-Time
+DCPTime
Film::length () const
{
return _playlist->length ();
}
-bool
-Film::has_subtitles () const
+int
+Film::best_video_frame_rate () const
{
- return _playlist->has_subtitles ();
+ return _playlist->best_dcp_frame_rate ();
}
-OutputVideoFrame
-Film::best_video_frame_rate () const
+FrameRateChange
+Film::active_frame_rate_change (DCPTime t) const
{
- return _playlist->best_dcp_frame_rate ();
+ return _playlist->active_frame_rate_change (t, video_frame_rate ());
}
void
signal_changed (CONTENT);
}
-OutputAudioFrame
-Film::time_to_audio_frames (Time t) const
-{
- return divide_with_round (t * audio_frame_rate (), TIME_HZ);
-}
-
-OutputVideoFrame
-Film::time_to_video_frames (Time t) const
-{
- return divide_with_round (t * video_frame_rate (), TIME_HZ);
-}
-
-Time
-Film::audio_frames_to_time (OutputAudioFrame f) const
-{
- return divide_with_round (f * TIME_HZ, audio_frame_rate ());
-}
-
-Time
-Film::video_frames_to_time (OutputVideoFrame f) const
-{
- return divide_with_round (f * TIME_HZ, video_frame_rate ());
-}
-
-OutputAudioFrame
+int
Film::audio_frame_rate () const
{
/* XXX */
}
/** @return Size of the largest possible image in whatever resolution we are using */
-libdcp::Size
+dcp::Size
Film::full_frame () const
{
switch (_resolution) {
case RESOLUTION_2K:
- return libdcp::Size (2048, 1080);
+ return dcp::Size (2048, 1080);
case RESOLUTION_4K:
- return libdcp::Size (4096, 2160);
+ return dcp::Size (4096, 2160);
}
assert (false);
- return libdcp::Size ();
+ return dcp::Size ();
}
/** @return Size of the frame */
-libdcp::Size
+dcp::Size
Film::frame_size () const
{
- return fit_ratio_within (container()->ratio(), full_frame ());
+ return fit_ratio_within (container()->ratio(), full_frame (), 1);
}
-/** @param from KDM from time in local time.
- * @param to KDM to time in local time.
- */
-libdcp::KDM
+dcp::EncryptedKDM
Film::make_kdm (
- shared_ptr<libdcp::Certificate> target,
+ dcp::Certificate target,
boost::filesystem::path cpl_file,
- boost::posix_time::ptime from,
- boost::posix_time::ptime until,
- libdcp::KDM::Formulation formulation
+ dcp::LocalTime from,
+ dcp::LocalTime until,
+ dcp::Formulation formulation
) const
{
- shared_ptr<const Signer> signer = make_signer ();
-
- time_t now = time (0);
- struct tm* tm = localtime (&now);
- string const issue_date = libdcp::tm_to_string (tm);
+ shared_ptr<const dcp::CPL> cpl (new dcp::CPL (cpl_file));
+ shared_ptr<const dcp::Signer> signer = Config::instance()->signer();
+ if (!signer->valid ()) {
+ throw InvalidSignerError ();
+ }
- return libdcp::KDM (cpl_file, signer, target, key (), from, until, "DCP-o-matic", issue_date, formulation);
+ return dcp::DecryptedKDM (
+ cpl, key(), from, until, "DCP-o-matic", cpl->content_title_text(), dcp::LocalTime().as_string()
+ ).encrypt (signer, target, formulation);
}
-list<libdcp::KDM>
+list<dcp::EncryptedKDM>
Film::make_kdms (
list<shared_ptr<Screen> > screens,
boost::filesystem::path dcp,
- boost::posix_time::ptime from,
- boost::posix_time::ptime until,
- libdcp::KDM::Formulation formulation
+ dcp::LocalTime from,
+ dcp::LocalTime until,
+ dcp::Formulation formulation
) const
{
- list<libdcp::KDM> kdms;
+ list<dcp::EncryptedKDM> kdms;
for (list<shared_ptr<Screen> >::iterator i = screens.begin(); i != screens.end(); ++i) {
- kdms.push_back (make_kdm ((*i)->certificate, dcp, from, until, formulation));
+ if ((*i)->certificate) {
+ kdms.push_back (make_kdm ((*i)->certificate.get(), dcp, from, until, formulation));
+ }
}
return kdms;
uint64_t
Film::required_disk_space () const
{
- return uint64_t (j2k_bandwidth() / 8) * length() / TIME_HZ;
+ return uint64_t (j2k_bandwidth() / 8) * length().seconds();
}
/** This method checks the disk that the Film is on and tries to decide whether or not
available = double (s.available) / 1073741824.0f;
return (available - required) > 1;
}
-
-FrameRateChange
-Film::active_frame_rate_change (Time t) const
-{
- return _playlist->active_frame_rate_change (t, video_frame_rate ());
-}
-
*/
-#include <libdcp/types.h>
+#include <dcp/types.h>
#include "ratio.h"
#include "util.h"
return *j;
}
+
+ /** @return Ratio corresponding to a given fractional ratio (+/- 0.01), or 0 */
+ Ratio const *
+ Ratio::from_ratio (float r)
+ {
+ vector<Ratio const *>::iterator j = _ratios.begin ();
+ while (j != _ratios.end() && fabs ((*j)->ratio() - r) > 0.01) {
+ ++j;
+ }
+
+ if (j == _ratios.end ()) {
+ return 0;
+ }
+
+ return *j;
+ }
+
#include <vector>
#include <boost/utility.hpp>
-#include <libdcp/util.h>
+#include <dcp/util.h>
class Ratio : public boost::noncopyable
{
static void setup_ratios ();
static Ratio const * from_id (std::string i);
+ static Ratio const * from_ratio (float r);
static std::vector<Ratio const *> all () {
return _ratios;
}
#include <wx/stdpaths.h>
#include <wx/cmdline.h>
#include <wx/preferences.h>
-#include <libdcp/exceptions.h>
+#include <dcp/exceptions.h>
#include "wx/film_viewer.h"
#include "wx/film_editor.h"
#include "wx/job_manager_view.h"
#include "wx/servers_list_dialog.h"
#include "wx/hints_dialog.h"
#include "wx/update_dialog.h"
+#include "wx/content_panel.h"
#include "lib/film.h"
#include "lib/config.h"
#include "lib/util.h"
shared_ptr<Job> (new SendKDMEmailJob (_film, d->screens (), d->cpl (), d->from (), d->until (), d->formulation ()))
);
}
- } catch (libdcp::NotEncryptedError& e) {
+ } catch (dcp::NotEncryptedError& e) {
error_dialog (this, _("CPL's content is not encrypted."));
} catch (exception& e) {
error_dialog (this, e.what ());
void content_scale_to_fit_width ()
{
- VideoContentList vc = _film_editor->selected_video_content ();
+ VideoContentList vc = _film_editor->content_panel()->selected_video ();
for (VideoContentList::iterator i = vc.begin(); i != vc.end(); ++i) {
(*i)->scale_and_crop_to_fit_width ();
}
void content_scale_to_fit_height ()
{
- VideoContentList vc = _film_editor->selected_video_content ();
+ VideoContentList vc = _film_editor->content_panel()->selected_video ();
for (VideoContentList::iterator i = vc.begin(); i != vc.end(); ++i) {
(*i)->scale_and_crop_to_fit_height ();
}
}
bool const dcp_creation = (i != jobs.end ()) && !(*i)->finished ();
bool const have_cpl = _film && !_film->cpls().empty ();
- bool const have_selected_video_content = !_film_editor->selected_video_content().empty();
+ bool const have_selected_video_content = !_film_editor->content_panel()->selected_video().empty();
for (map<wxMenuItem*, int>::iterator j = menu_items.begin(); j != menu_items.end(); ++j) {
{ wxCMD_LINE_NONE, "", "", "", wxCmdLineParamType (0), 0 }
};
+/** @class App
+ * @brief The magic App class for wxWidgets.
+ */
class App : public wxApp
{
bool OnInit ()
return true;
}
+ /* An unhandled exception has occurred inside the main event loop */
bool OnExceptionInMainLoop ()
{
- error_dialog (0, _("An unknown exception occurred. Please report this problem to the DCP-o-matic author (carl@dcpomatic.com)."));
+ try {
+ throw;
+ } catch (exception& e) {
+ error_dialog (0, wxString::Format (_("An exception occurred (%s). Please report this problem to the DCP-o-matic author (carl@dcpomatic.com)."), e.what ()));
+ } catch (...) {
+ error_dialog (0, _("An unknown exception occurred. Please report this problem to the DCP-o-matic author (carl@dcpomatic.com)."));
+ }
+
+ /* This will terminate the program */
return false;
}
-
+
void OnUnhandledException ()
{
error_dialog (0, _("An unknown exception occurred. Please report this problem to the DCP-o-matic author (carl@dcpomatic.com)."));
--- /dev/null
- if (property == FFmpegContentProperty::AUDIO_STREAM || property == SubtitleContentProperty::USE_SUBTITLES) {
+/*
+ Copyright (C) 2012-2014 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 "dcp_panel.h"
+#include "wx_util.h"
+#include "isdcf_metadata_dialog.h"
+#include "lib/ratio.h"
+#include "lib/scaler.h"
+#include "lib/config.h"
+#include "lib/dcp_content_type.h"
+#include "lib/util.h"
+#include "lib/film.h"
+#include "lib/ffmpeg_content.h"
+#include <wx/wx.h>
+#include <wx/notebook.h>
+#include <wx/gbsizer.h>
+#include <wx/spinctrl.h>
+#include <boost/lexical_cast.hpp>
+
+using std::cout;
+using std::list;
+using std::string;
+using std::vector;
+using boost::lexical_cast;
+using boost::shared_ptr;
+
+DCPPanel::DCPPanel (wxNotebook* n, boost::shared_ptr<Film> f)
+ : _film (f)
+ , _generally_sensitive (true)
+{
+ _panel = new wxPanel (n);
+ _sizer = new wxBoxSizer (wxVERTICAL);
+ _panel->SetSizer (_sizer);
+
+ wxGridBagSizer* grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+ _sizer->Add (grid, 0, wxEXPAND | wxALL, 8);
+
+ int r = 0;
+
+ add_label_to_grid_bag_sizer (grid, _panel, _("Name"), true, wxGBPosition (r, 0));
+ _name = new wxTextCtrl (_panel, wxID_ANY);
+ grid->Add (_name, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND | wxLEFT | wxRIGHT);
+ ++r;
+
+ add_label_to_grid_bag_sizer (grid, _panel, _("DCP Name"), true, wxGBPosition (r, 0));
+ _dcp_name = new wxStaticText (_panel, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END);
+ grid->Add (_dcp_name, wxGBPosition(r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxEXPAND);
+ ++r;
+
+ int flags = wxALIGN_CENTER_VERTICAL;
+#ifdef __WXOSX__
+ flags |= wxALIGN_RIGHT;
+#endif
+
+ _use_isdcf_name = new wxCheckBox (_panel, wxID_ANY, _("Use ISDCF name"));
+ grid->Add (_use_isdcf_name, wxGBPosition (r, 0), wxDefaultSpan, flags);
+ _edit_isdcf_button = new wxButton (_panel, wxID_ANY, _("Details..."));
+ grid->Add (_edit_isdcf_button, wxGBPosition (r, 1));
+ ++r;
+
+ add_label_to_grid_bag_sizer (grid, _panel, _("Content Type"), true, wxGBPosition (r, 0));
+ _dcp_content_type = new wxChoice (_panel, wxID_ANY);
+ grid->Add (_dcp_content_type, wxGBPosition (r, 1));
+ ++r;
+
+ _notebook = new wxNotebook (_panel, wxID_ANY);
+ _sizer->Add (_notebook, 1, wxEXPAND | wxTOP, 6);
+
+ _notebook->AddPage (make_video_panel (), _("Video"), false);
+ _notebook->AddPage (make_audio_panel (), _("Audio"), false);
+
+ _signed = new wxCheckBox (_panel, wxID_ANY, _("Signed"));
+ grid->Add (_signed, wxGBPosition (r, 0), wxGBSpan (1, 2));
+ ++r;
+
+ _encrypted = new wxCheckBox (_panel, wxID_ANY, _("Encrypted"));
+ grid->Add (_encrypted, wxGBPosition (r, 0), wxGBSpan (1, 2));
+ ++r;
+
+ add_label_to_grid_bag_sizer (grid, _panel, _("Standard"), true, wxGBPosition (r, 0));
+ _standard = new wxChoice (_panel, wxID_ANY);
+ grid->Add (_standard, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
+ ++r;
+
+ _name->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&DCPPanel::name_changed, this));
+ _use_isdcf_name->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&DCPPanel::use_isdcf_name_toggled, this));
+ _edit_isdcf_button->Bind(wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DCPPanel::edit_isdcf_button_clicked, this));
+ _dcp_content_type->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::dcp_content_type_changed, this));
+ _signed->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&DCPPanel::signed_toggled, this));
+ _encrypted->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&DCPPanel::encrypted_toggled, this));
+ _standard->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::standard_changed, this));
+
+ 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 ()));
+ }
+
+ _standard->Append (_("SMPTE"));
+ _standard->Append (_("Interop"));
+
+ Config::instance()->Changed.connect (boost::bind (&DCPPanel::config_changed, this));
+}
+
+void
+DCPPanel::name_changed ()
+{
+ if (!_film) {
+ return;
+ }
+
+ _film->set_name (string (_name->GetValue().mb_str()));
+}
+
+void
+DCPPanel::j2k_bandwidth_changed ()
+{
+ if (!_film) {
+ return;
+ }
+
+ _film->set_j2k_bandwidth (_j2k_bandwidth->GetValue() * 1000000);
+}
+
+void
+DCPPanel::signed_toggled ()
+{
+ if (!_film) {
+ return;
+ }
+
+ _film->set_signed (_signed->GetValue ());
+}
+
+void
+DCPPanel::burn_subtitles_toggled ()
+{
+ if (!_film) {
+ return;
+ }
+
+ _film->set_burn_subtitles (_burn_subtitles->GetValue ());
+}
+
+void
+DCPPanel::encrypted_toggled ()
+{
+ if (!_film) {
+ return;
+ }
+
+ _film->set_encrypted (_encrypted->GetValue ());
+}
+
+/** Called when the frame rate choice widget has been changed */
+void
+DCPPanel::frame_rate_choice_changed ()
+{
+ if (!_film) {
+ return;
+ }
+
+ _film->set_video_frame_rate (
+ boost::lexical_cast<int> (
+ wx_to_std (_frame_rate_choice->GetString (_frame_rate_choice->GetSelection ()))
+ )
+ );
+}
+
+/** Called when the frame rate spin widget has been changed */
+void
+DCPPanel::frame_rate_spin_changed ()
+{
+ if (!_film) {
+ return;
+ }
+
+ _film->set_video_frame_rate (_frame_rate_spin->GetValue ());
+}
+
+void
+DCPPanel::audio_channels_changed ()
+{
+ if (!_film) {
+ return;
+ }
+
+ _film->set_audio_channels (_audio_channels->GetValue ());
+}
+
+void
+DCPPanel::resolution_changed ()
+{
+ if (!_film) {
+ return;
+ }
+
+ _film->set_resolution (_resolution->GetSelection() == 0 ? RESOLUTION_2K : RESOLUTION_4K);
+}
+
+void
+DCPPanel::standard_changed ()
+{
+ if (!_film) {
+ return;
+ }
+
+ _film->set_interop (_standard->GetSelection() == 1);
+}
+
+void
+DCPPanel::film_changed (int p)
+{
+ switch (p) {
+ case Film::NONE:
+ break;
+ case Film::CONTAINER:
+ setup_container ();
+ break;
+ case Film::NAME:
+ checked_set (_name, _film->name());
+ setup_dcp_name ();
+ break;
+ case Film::DCP_CONTENT_TYPE:
+ checked_set (_dcp_content_type, DCPContentType::as_index (_film->dcp_content_type ()));
+ setup_dcp_name ();
+ break;
+ case Film::SCALER:
+ checked_set (_scaler, Scaler::as_index (_film->scaler ()));
+ break;
+ case Film::BURN_SUBTITLES:
+ checked_set (_burn_subtitles, _film->burn_subtitles ());
+ break;
+ case Film::SIGNED:
+ checked_set (_signed, _film->is_signed ());
+ break;
+ case Film::ENCRYPTED:
+ checked_set (_encrypted, _film->encrypted ());
+ if (_film->encrypted ()) {
+ _film->set_signed (true);
+ _signed->Enable (false);
+ } else {
+ _signed->Enable (_generally_sensitive);
+ }
+ break;
+ case Film::RESOLUTION:
+ checked_set (_resolution, _film->resolution() == RESOLUTION_2K ? 0 : 1);
+ setup_dcp_name ();
+ break;
+ case Film::J2K_BANDWIDTH:
+ checked_set (_j2k_bandwidth, _film->j2k_bandwidth() / 1000000);
+ break;
+ case Film::USE_ISDCF_NAME:
+ checked_set (_use_isdcf_name, _film->use_isdcf_name ());
+ setup_dcp_name ();
+ break;
+ case Film::ISDCF_METADATA:
+ setup_dcp_name ();
+ break;
+ case Film::VIDEO_FRAME_RATE:
+ {
+ bool done = false;
+ for (unsigned int i = 0; i < _frame_rate_choice->GetCount(); ++i) {
+ if (wx_to_std (_frame_rate_choice->GetString(i)) == boost::lexical_cast<string> (_film->video_frame_rate())) {
+ checked_set (_frame_rate_choice, i);
+ done = true;
+ break;
+ }
+ }
+
+ if (!done) {
+ checked_set (_frame_rate_choice, -1);
+ }
+
+ _frame_rate_spin->SetValue (_film->video_frame_rate ());
+
+ _best_frame_rate->Enable (_film->best_video_frame_rate () != _film->video_frame_rate ());
+ break;
+ }
+ case Film::AUDIO_CHANNELS:
+ checked_set (_audio_channels, _film->audio_channels ());
+ setup_dcp_name ();
+ break;
+ case Film::THREE_D:
+ checked_set (_three_d, _film->three_d ());
+ setup_dcp_name ();
+ break;
+ case Film::INTEROP:
+ checked_set (_standard, _film->interop() ? 1 : 0);
+ break;
+ default:
+ break;
+ }
+}
+
+void
+DCPPanel::film_content_changed (int property)
+{
++ if (property == FFmpegContentProperty::AUDIO_STREAM ||
++ property == SubtitleContentProperty::USE_SUBTITLES ||
++ property == VideoContentProperty::VIDEO_SCALE) {
+ setup_dcp_name ();
+ }
+}
+
+
+void
+DCPPanel::setup_container ()
+{
+ int n = 0;
+ vector<Ratio const *> ratios = Ratio::all ();
+ vector<Ratio const *>::iterator i = ratios.begin ();
+ while (i != ratios.end() && *i != _film->container ()) {
+ ++i;
+ ++n;
+ }
+
+ if (i == ratios.end()) {
+ checked_set (_container, -1);
+ } else {
+ checked_set (_container, n);
+ }
+
+ setup_dcp_name ();
+}
+
+/** Called when the container widget has been changed */
+void
+DCPPanel::container_changed ()
+{
+ if (!_film) {
+ return;
+ }
+
+ int const n = _container->GetSelection ();
+ if (n >= 0) {
+ vector<Ratio const *> ratios = Ratio::all ();
+ assert (n < int (ratios.size()));
+ _film->set_container (ratios[n]);
+ }
+}
+
+/** Called when the DCP content type widget has been changed */
+void
+DCPPanel::dcp_content_type_changed ()
+{
+ if (!_film) {
+ return;
+ }
+
+ int const n = _dcp_content_type->GetSelection ();
+ if (n != wxNOT_FOUND) {
+ _film->set_dcp_content_type (DCPContentType::from_index (n));
+ }
+}
+
+void
+DCPPanel::set_film (shared_ptr<Film> film)
+{
+ _film = film;
+
+ film_changed (Film::NAME);
+ film_changed (Film::USE_ISDCF_NAME);
+ film_changed (Film::CONTENT);
+ film_changed (Film::DCP_CONTENT_TYPE);
+ film_changed (Film::CONTAINER);
+ film_changed (Film::RESOLUTION);
+ film_changed (Film::SCALER);
+ film_changed (Film::SIGNED);
+ film_changed (Film::BURN_SUBTITLES);
+ film_changed (Film::ENCRYPTED);
+ film_changed (Film::J2K_BANDWIDTH);
+ film_changed (Film::ISDCF_METADATA);
+ film_changed (Film::VIDEO_FRAME_RATE);
+ film_changed (Film::AUDIO_CHANNELS);
+ film_changed (Film::SEQUENCE_VIDEO);
+ film_changed (Film::THREE_D);
+ film_changed (Film::INTEROP);
+}
+
+void
+DCPPanel::set_general_sensitivity (bool s)
+{
+ _name->Enable (s);
+ _use_isdcf_name->Enable (s);
+ _edit_isdcf_button->Enable (s);
+ _dcp_content_type->Enable (s);
+
+ bool si = s;
+ if (_film && _film->encrypted ()) {
+ si = false;
+ }
+ _burn_subtitles->Enable (s);
+ _signed->Enable (si);
+
+ _encrypted->Enable (s);
+ _frame_rate_choice->Enable (s);
+ _frame_rate_spin->Enable (s);
+ _audio_channels->Enable (s);
+ _j2k_bandwidth->Enable (s);
+ _container->Enable (s);
+ _best_frame_rate->Enable (s && _film && _film->best_video_frame_rate () != _film->video_frame_rate ());
+ _resolution->Enable (s);
+ _scaler->Enable (s);
+ _three_d->Enable (s);
+ _standard->Enable (s);
+}
+
+/** Called when the scaler widget has been changed */
+void
+DCPPanel::scaler_changed ()
+{
+ if (!_film) {
+ return;
+ }
+
+ int const n = _scaler->GetSelection ();
+ if (n >= 0) {
+ _film->set_scaler (Scaler::from_index (n));
+ }
+}
+
+void
+DCPPanel::use_isdcf_name_toggled ()
+{
+ if (!_film) {
+ return;
+ }
+
+ _film->set_use_isdcf_name (_use_isdcf_name->GetValue ());
+}
+
+void
+DCPPanel::edit_isdcf_button_clicked ()
+{
+ if (!_film) {
+ return;
+ }
+
+ ISDCFMetadataDialog* d = new ISDCFMetadataDialog (_panel, _film->isdcf_metadata ());
+ d->ShowModal ();
+ _film->set_isdcf_metadata (d->isdcf_metadata ());
+ d->Destroy ();
+}
+
+void
+DCPPanel::setup_dcp_name ()
+{
+ string s = _film->dcp_name (true);
+ if (s.length() > 28) {
+ _dcp_name->SetLabel (std_to_wx (s.substr (0, 28)) + N_("..."));
+ _dcp_name->SetToolTip (std_to_wx (s));
+ } else {
+ _dcp_name->SetLabel (std_to_wx (s));
+ }
+}
+
+void
+DCPPanel::best_frame_rate_clicked ()
+{
+ if (!_film) {
+ return;
+ }
+
+ _film->set_video_frame_rate (_film->best_video_frame_rate ());
+}
+
+void
+DCPPanel::three_d_changed ()
+{
+ if (!_film) {
+ return;
+ }
+
+ _film->set_three_d (_three_d->GetValue ());
+}
+
+void
+DCPPanel::config_changed ()
+{
+ _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
+ setup_frame_rate_widget ();
+}
+
+void
+DCPPanel::setup_frame_rate_widget ()
+{
+ if (Config::instance()->allow_any_dcp_frame_rate ()) {
+ _frame_rate_choice->Hide ();
+ _frame_rate_spin->Show ();
+ } else {
+ _frame_rate_choice->Show ();
+ _frame_rate_spin->Hide ();
+ }
+
+ _frame_rate_sizer->Layout ();
+}
+
+wxPanel *
+DCPPanel::make_video_panel ()
+{
+ wxPanel* panel = new wxPanel (_notebook);
+ wxSizer* sizer = new wxBoxSizer (wxVERTICAL);
+ wxGridBagSizer* grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+ sizer->Add (grid, 0, wxALL, 8);
+ panel->SetSizer (sizer);
+
+ int r = 0;
+
+ add_label_to_grid_bag_sizer (grid, panel, _("Container"), true, wxGBPosition (r, 0));
+ _container = new wxChoice (panel, wxID_ANY);
+ grid->Add (_container, wxGBPosition (r, 1));
+ ++r;
+
+ {
+ add_label_to_grid_bag_sizer (grid, panel, _("Frame Rate"), true, wxGBPosition (r, 0));
+ _frame_rate_sizer = new wxBoxSizer (wxHORIZONTAL);
+ _frame_rate_choice = new wxChoice (panel, wxID_ANY);
+ _frame_rate_sizer->Add (_frame_rate_choice, 1, wxALIGN_CENTER_VERTICAL);
+ _frame_rate_spin = new wxSpinCtrl (panel, wxID_ANY);
+ _frame_rate_sizer->Add (_frame_rate_spin, 1, wxALIGN_CENTER_VERTICAL);
+ setup_frame_rate_widget ();
+ _best_frame_rate = new wxButton (panel, wxID_ANY, _("Use best"));
+ _frame_rate_sizer->Add (_best_frame_rate, 1, wxALIGN_CENTER_VERTICAL | wxEXPAND);
+ grid->Add (_frame_rate_sizer, wxGBPosition (r, 1));
+ }
+ ++r;
+
+ _burn_subtitles = new wxCheckBox (panel, wxID_ANY, _("Burn subtitles into image"));
+ grid->Add (_burn_subtitles, wxGBPosition (r, 0), wxGBSpan (1, 2));
+ ++r;
+
+ _three_d = new wxCheckBox (panel, wxID_ANY, _("3D"));
+ grid->Add (_three_d, wxGBPosition (r, 0), wxGBSpan (1, 2));
+ ++r;
+
+ add_label_to_grid_bag_sizer (grid, panel, _("Resolution"), true, wxGBPosition (r, 0));
+ _resolution = new wxChoice (panel, wxID_ANY);
+ grid->Add (_resolution, wxGBPosition (r, 1));
+ ++r;
+
+ {
+ add_label_to_grid_bag_sizer (grid, panel, _("JPEG2000 bandwidth"), true, wxGBPosition (r, 0));
+ wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+ _j2k_bandwidth = new wxSpinCtrl (panel, wxID_ANY);
+ s->Add (_j2k_bandwidth, 1);
+ add_label_to_sizer (s, panel, _("Mbit/s"), false);
+ grid->Add (s, wxGBPosition (r, 1));
+ }
+ ++r;
+
+ add_label_to_grid_bag_sizer (grid, panel, _("Scaler"), true, wxGBPosition (r, 0));
+ _scaler = new wxChoice (panel, wxID_ANY);
+ grid->Add (_scaler, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
+ ++r;
+
+ _container->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::container_changed, this));
+ _scaler->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::scaler_changed, this));
+ _frame_rate_choice->Bind(wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::frame_rate_choice_changed, this));
+ _frame_rate_spin->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DCPPanel::frame_rate_spin_changed, this));
+ _best_frame_rate->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DCPPanel::best_frame_rate_clicked, this));
+ _burn_subtitles->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&DCPPanel::burn_subtitles_toggled, this));
+ _j2k_bandwidth->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DCPPanel::j2k_bandwidth_changed, this));
+ _resolution->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::resolution_changed, this));
+ _three_d->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&DCPPanel::three_d_changed, this));
+
+ vector<Scaler const *> const sc = Scaler::all ();
+ for (vector<Scaler const *>::const_iterator i = sc.begin(); i != sc.end(); ++i) {
+ _scaler->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 ()));
+ }
+
+ list<int> const dfr = Config::instance()->allowed_dcp_frame_rates ();
+ for (list<int>::const_iterator i = dfr.begin(); i != dfr.end(); ++i) {
+ _frame_rate_choice->Append (std_to_wx (boost::lexical_cast<string> (*i)));
+ }
+
+ _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
+ _frame_rate_spin->SetRange (1, 480);
+
+ _resolution->Append (_("2K"));
+ _resolution->Append (_("4K"));
+
+ return panel;
+}
+
+wxPanel *
+DCPPanel::make_audio_panel ()
+{
+ wxPanel* panel = new wxPanel (_notebook);
+ wxSizer* sizer = new wxBoxSizer (wxVERTICAL);
+ wxGridBagSizer* grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+ sizer->Add (grid, 0, wxALL, 8);
+ panel->SetSizer (sizer);
+
+ int r = 0;
+ add_label_to_grid_bag_sizer (grid, panel, _("Channels"), true, wxGBPosition (r, 0));
+ _audio_channels = new wxSpinCtrl (panel, wxID_ANY);
+ grid->Add (_audio_channels, wxGBPosition (r, 1));
+ ++r;
+
+ _audio_channels->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DCPPanel::audio_channels_changed, this));
+
+ _audio_channels->SetRange (0, MAX_DCP_AUDIO_CHANNELS);
+
+ return panel;
+}
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 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
* @param initial Initial text for the wxStaticText while the computation is being run.
* @param fn Function which works out what the wxStaticText content should be and returns it.
*/
-ThreadedStaticText::ThreadedStaticText (wxWindow* parent, wxString initial, function<string ()> fn)
+ThreadedStaticText::ThreadedStaticText (wxWindow* parent, wxString initial, boost::function<string ()> fn)
: wxStaticText (parent, wxID_ANY, initial)
{
Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&ThreadedStaticText::thread_finished, this, _1), _update_event_id);
/** Run our thread and post the result to the GUI thread via AddPendingEvent */
void
-ThreadedStaticText::run (function<string ()> fn)
+ThreadedStaticText::run (boost::function<string ()> fn)
try
{
wxCommandEvent ev (wxEVT_COMMAND_TEXT_UPDATED, _update_event_id);
return w->GetValue ();
}
- void
- run_gui_loop ()
- {
- while (wxTheApp->Pending ()) {
- wxTheApp->Dispatch ();
- }
- }
-
/** @param s String of the form Context|String
* @return translation, or String if no translation is available.
*/