summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-03-17 00:22:52 +0000
committerCarl Hetherington <cth@carlh.net>2014-03-17 00:22:52 +0000
commit2e504b33eb9f38cac629ad31b7c107fb0cf5efda (patch)
tree9c571653f312597b744896d45e27d422acbeea88 /src/lib
parenta4c19a34244aeaf183c25878933b570fc5c0ee34 (diff)
parent48b2c7b8ec57e72f2f27d5080e54e4b3c3fcda3d (diff)
Merge master.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/audio_content.cc4
-rw-r--r--src/lib/audio_content.h2
-rw-r--r--src/lib/config.h27
-rw-r--r--src/lib/content.cc5
-rw-r--r--src/lib/content_factory.cc5
-rw-r--r--src/lib/content_factory.h2
-rw-r--r--src/lib/cross.cc7
-rw-r--r--src/lib/ffmpeg_content.cc33
-rw-r--r--src/lib/ffmpeg_content.h3
-rw-r--r--src/lib/ffmpeg_decoder.cc5
-rw-r--r--src/lib/film.cc26
-rw-r--r--src/lib/film.h5
-rw-r--r--src/lib/filter.cc79
-rw-r--r--src/lib/filter.h19
-rw-r--r--src/lib/filter_graph.cc2
-rw-r--r--src/lib/image.cc45
-rw-r--r--src/lib/image.h1
-rw-r--r--src/lib/player.cc2
-rw-r--r--src/lib/playlist.cc4
-rw-r--r--src/lib/playlist.h2
-rw-r--r--src/lib/video_content.cc23
-rw-r--r--src/lib/video_content.h4
-rw-r--r--src/lib/writer.cc5
23 files changed, 155 insertions, 155 deletions
diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc
index 01d1ecc38..6da5afa0c 100644
--- a/src/lib/audio_content.cc
+++ b/src/lib/audio_content.cc
@@ -141,7 +141,9 @@ AudioContent::audio_analysis_path () const
return boost::filesystem::path ();
}
- return film->audio_analysis_path (dynamic_pointer_cast<const AudioContent> (shared_from_this ()));
+ boost::filesystem::path p = film->audio_analysis_dir ();
+ p /= digest ();
+ return p;
}
string
diff --git a/src/lib/audio_content.h b/src/lib/audio_content.h
index 18d88bccb..cecc8f13d 100644
--- a/src/lib/audio_content.h
+++ b/src/lib/audio_content.h
@@ -57,9 +57,9 @@ public:
virtual int output_audio_frame_rate () const = 0;
virtual AudioMapping audio_mapping () const = 0;
virtual void set_audio_mapping (AudioMapping) = 0;
+ virtual boost::filesystem::path audio_analysis_path () const;
boost::signals2::connection analyse_audio (boost::function<void()>);
- boost::filesystem::path audio_analysis_path () const;
void set_audio_gain (float);
void set_audio_delay (int);
diff --git a/src/lib/config.h b/src/lib/config.h
index 14cd640ee..68aae7414 100644
--- a/src/lib/config.h
+++ b/src/lib/config.h
@@ -66,6 +66,7 @@ public:
void set_use_any_servers (bool u) {
_use_any_servers = u;
+ write ();
}
bool use_any_servers () const {
@@ -75,6 +76,7 @@ public:
/** @param s New list of servers */
void set_servers (std::vector<std::string> s) {
_servers = s;
+ write ();
}
/** @return Host names / IP addresses of J2K encoding servers that should definitely be used */
@@ -182,35 +184,42 @@ public:
/** @param n New number of local encoding threads */
void set_num_local_encoding_threads (int n) {
_num_local_encoding_threads = n;
+ write ();
}
void set_default_directory (boost::filesystem::path d) {
_default_directory = d;
+ write ();
}
/** @param p New server port */
void set_server_port_base (int p) {
_server_port_base = p;
+ write ();
}
/** @param i IP address of a TMS that we can copy DCPs to */
void set_tms_ip (std::string i) {
_tms_ip = i;
+ write ();
}
/** @param p Path on a TMS that we should write DCPs to */
void set_tms_path (std::string p) {
_tms_path = p;
+ write ();
}
/** @param u User name to log into the TMS with */
void set_tms_user (std::string u) {
_tms_user = u;
+ write ();
}
/** @param p Password to log into the TMS with */
void set_tms_password (std::string p) {
_tms_password = p;
+ write ();
}
void add_cinema (boost::shared_ptr<Cinema> c) {
@@ -223,74 +232,92 @@ public:
void set_allowed_dcp_frame_rates (std::list<int> const & r) {
_allowed_dcp_frame_rates = r;
+ write ();
}
void set_default_dci_metadata (DCIMetadata d) {
_default_dci_metadata = d;
+ write ();
}
void set_language (std::string l) {
_language = l;
+ write ();
}
void unset_language () {
_language = boost::none;
+ write ();
}
void set_default_still_length (int s) {
_default_still_length = s;
+ write ();
}
void set_default_container (Ratio const * c) {
_default_container = c;
+ write ();
}
void set_default_dcp_content_type (DCPContentType const * t) {
_default_dcp_content_type = t;
+ write ();
}
void set_dcp_metadata (dcp::XMLMetadata m) {
_dcp_metadata = m;
+ write ();
}
void set_default_j2k_bandwidth (int b) {
_default_j2k_bandwidth = b;
+ write ();
}
void set_default_audio_delay (int d) {
_default_audio_delay = d;
+ write ();
}
void set_colour_conversions (std::vector<PresetColourConversion> const & c) {
_colour_conversions = c;
+ write ();
}
void set_mail_server (std::string s) {
_mail_server = s;
+ write ();
}
void set_mail_user (std::string u) {
_mail_user = u;
+ write ();
}
void set_mail_password (std::string p) {
_mail_password = p;
+ write ();
}
void set_kdm_from (std::string f) {
_kdm_from = f;
+ write ();
}
void set_kdm_email (std::string e) {
_kdm_email = e;
+ write ();
}
void set_check_for_updates (bool c) {
_check_for_updates = c;
+ write ();
}
void set_check_for_test_updates (bool c) {
_check_for_test_updates = c;
+ write ();
}
void write () const;
diff --git a/src/lib/content.cc b/src/lib/content.cc
index 814d9c1a5..1fb4681a2 100644
--- a/src/lib/content.cc
+++ b/src/lib/content.cc
@@ -195,7 +195,10 @@ Content::clone () const
xmlpp::Document doc;
xmlpp::Node* node = doc.create_root_node ("Content");
as_xml (node);
- return content_factory (film, cxml::NodePtr (new cxml::Node (node)), Film::current_state_version);
+
+ /* notes is unused here (we assume) */
+ list<string> notes;
+ return content_factory (film, cxml::NodePtr (new cxml::Node (node)), Film::current_state_version, notes);
}
string
diff --git a/src/lib/content_factory.cc b/src/lib/content_factory.cc
index 825c80498..092efd790 100644
--- a/src/lib/content_factory.cc
+++ b/src/lib/content_factory.cc
@@ -25,17 +25,18 @@
#include "util.h"
using std::string;
+using std::list;
using boost::shared_ptr;
shared_ptr<Content>
-content_factory (shared_ptr<const Film> film, cxml::NodePtr node, int version)
+content_factory (shared_ptr<const Film> film, cxml::NodePtr node, int version, list<string>& notes)
{
string const type = node->string_child ("Type");
boost::shared_ptr<Content> content;
if (type == "FFmpeg") {
- content.reset (new FFmpegContent (film, node, version));
+ content.reset (new FFmpegContent (film, node, version, notes));
} else if (type == "Image") {
content.reset (new ImageContent (film, node, version));
} else if (type == "Sndfile") {
diff --git a/src/lib/content_factory.h b/src/lib/content_factory.h
index 071d925e0..2eeebbc9f 100644
--- a/src/lib/content_factory.h
+++ b/src/lib/content_factory.h
@@ -19,5 +19,5 @@
class Film;
-extern boost::shared_ptr<Content> content_factory (boost::shared_ptr<const Film>, cxml::NodePtr, int);
+extern boost::shared_ptr<Content> content_factory (boost::shared_ptr<const Film>, cxml::NodePtr, int, std::list<std::string> &);
extern boost::shared_ptr<Content> content_factory (boost::shared_ptr<const Film>, boost::filesystem::path);
diff --git a/src/lib/cross.cc b/src/lib/cross.cc
index 786f4b997..8785553cb 100644
--- a/src/lib/cross.cc
+++ b/src/lib/cross.cc
@@ -310,8 +310,11 @@ Waker::nudge ()
Waker::Waker ()
{
-#ifdef DCPOMATIC_OSX
- IOPMAssertionCreateWithName (kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, CFSTR ("Encoding DCP"), &_assertion_id);
+#ifdef DCPOMATIC_OSX
+ /* We should use this */
+ // IOPMAssertionCreateWithName (kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, CFSTR ("Encoding DCP"), &_assertion_id);
+ /* but it's not available on 10.5, so we use this */
+ IOPMAssertionCreate (kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, &_assertion_id);
#endif
}
diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc
index 2b535a2ab..90c00283d 100644
--- a/src/lib/ffmpeg_content.cc
+++ b/src/lib/ffmpeg_content.cc
@@ -58,7 +58,7 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> f, boost::filesystem::path
}
-FFmpegContent::FFmpegContent (shared_ptr<const Film> f, shared_ptr<const cxml::Node> node, int version)
+FFmpegContent::FFmpegContent (shared_ptr<const Film> f, shared_ptr<const cxml::Node> node, int version, list<string>& notes)
: Content (f, node)
, VideoContent (f, node, version)
, AudioContent (f, node)
@@ -82,7 +82,12 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> f, shared_ptr<const cxml::N
c = node->node_children ("Filter");
for (list<cxml::NodePtr>::iterator i = c.begin(); i != c.end(); ++i) {
- _filters.push_back (Filter::from_id ((*i)->content ()));
+ Filter const * f = Filter::from_id ((*i)->content ());
+ if (f) {
+ _filters.push_back (f);
+ } else {
+ notes.push_back (String::compose (_("DCP-o-matic no longer supports the `%1' filter, so it has been turned off."), (*i)->content()));
+ }
}
_first_video = node->optional_number_child<double> ("FirstVideo");
@@ -213,13 +218,13 @@ FFmpegContent::technical_summary () const
ss = _subtitle_stream->technical_summary ();
}
- pair<string, string> filt = Filter::ffmpeg_strings (_filters);
+ string filt = Filter::ffmpeg_string (_filters);
return Content::technical_summary() + " - "
+ VideoContent::technical_summary() + " - "
+ AudioContent::technical_summary() + " - "
+ String::compose (
- "ffmpeg: audio %1, subtitle %2, filters %3 %4", as, ss, filt.first, filt.second
+ "ffmpeg: audio %1, subtitle %2, filters %3", as, ss, filt
);
}
@@ -470,3 +475,23 @@ FFmpegContent::identifier () const
return s.str ();
}
+boost::filesystem::path
+FFmpegContent::audio_analysis_path () const
+{
+ shared_ptr<const Film> film = _film.lock ();
+ if (!film) {
+ return boost::filesystem::path ();
+ }
+
+ /* We need to include the stream ID in this path so that we get different
+ analyses for each stream.
+ */
+
+ boost::filesystem::path p = film->audio_analysis_dir ();
+ string name = digest ();
+ if (audio_stream ()) {
+ name += "_" + audio_stream()->identifier ();
+ }
+ p /= name;
+ return p;
+}
diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h
index 935d9560d..e4c4a8a52 100644
--- a/src/lib/ffmpeg_content.h
+++ b/src/lib/ffmpeg_content.h
@@ -127,7 +127,7 @@ class FFmpegContent : public VideoContent, public AudioContent, public SubtitleC
{
public:
FFmpegContent (boost::shared_ptr<const Film>, boost::filesystem::path);
- FFmpegContent (boost::shared_ptr<const Film>, boost::shared_ptr<const cxml::Node>, int version);
+ FFmpegContent (boost::shared_ptr<const Film>, boost::shared_ptr<const cxml::Node>, int version, std::list<std::string> &);
FFmpegContent (boost::shared_ptr<const Film>, std::vector<boost::shared_ptr<Content> >);
boost::shared_ptr<FFmpegContent> shared_from_this () {
@@ -150,6 +150,7 @@ public:
int output_audio_frame_rate () const;
AudioMapping audio_mapping () const;
void set_audio_mapping (AudioMapping);
+ boost::filesystem::path audio_analysis_path () const;
void set_filters (std::vector<Filter const *> const &);
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc
index d37399eb3..32b00a1d6 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -487,14 +487,9 @@ FFmpegDecoder::decode_video_packet ()
list<pair<shared_ptr<Image>, int64_t> > images = graph->process (_frame);
- string post_process = Filter::ffmpeg_strings (_ffmpeg_content->filters()).second;
-
for (list<pair<shared_ptr<Image>, int64_t> >::iterator i = images.begin(); i != images.end(); ++i) {
shared_ptr<Image> image = i->first;
- if (!post_process.empty ()) {
- image = image->post_process (post_process, true);
- }
if (i->second != AV_NOPTS_VALUE) {
video (image, false, ContentTime::from_seconds (i->second * av_q2d (_format_context->streams[_video_stream]->time_base)) + _pts_offset);
diff --git a/src/lib/film.cc b/src/lib/film.cc
index 21e7383bf..cc80f5bc2 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -232,11 +232,9 @@ Film::filename_safe_name () const
}
boost::filesystem::path
-Film::audio_analysis_path (shared_ptr<const AudioContent> c) const
+Film::audio_analysis_dir () const
{
- boost::filesystem::path p = dir ("analysis");
- p /= c->digest();
- return p;
+ return dir ("analysis");
}
/** Add suitable Jobs to the JobManager to create a DCP for this Film */
@@ -383,8 +381,10 @@ Film::write_metadata () const
_dirty = false;
}
-/** Read state from our metadata file */
-void
+/** Read state from our metadata file.
+ * @return Notes about things that the user should know about, or empty.
+ */
+list<string>
Film::read_metadata ()
{
LocaleGuard lg;
@@ -432,9 +432,13 @@ Film::read_metadata ()
_three_d = f.bool_child ("ThreeD");
_interop = f.bool_child ("Interop");
_key = dcp::Key (f.string_child ("Key"));
- _playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"), _state_version);
+
+ list<string> notes;
+ /* This method is the only one that can return notes (so far) */
+ _playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"), _state_version, notes);
_dirty = false;
+ return notes;
}
/** Given a directory name, return its full path within the Film's directory.
@@ -923,6 +927,7 @@ Film::set_sequence_video (bool s)
signal_changed (SEQUENCE_VIDEO);
}
+/** @return Size of the largest possible image in whatever resolution we are using */
dcp::Size
Film::full_frame () const
{
@@ -937,6 +942,13 @@ Film::full_frame () const
return dcp::Size ();
}
+/** @return Size of the frame */
+dcp::Size
+Film::frame_size () const
+{
+ return fit_ratio_within (container()->ratio(), full_frame ());
+}
+
dcp::KDM
Film::make_kdm (
shared_ptr<dcp::Certificate> target,
diff --git a/src/lib/film.h b/src/lib/film.h
index f776a3f72..9d1445d92 100644
--- a/src/lib/film.h
+++ b/src/lib/film.h
@@ -63,7 +63,7 @@ public:
boost::filesystem::path info_path (int, Eyes) const;
boost::filesystem::path internal_video_mxf_dir () const;
boost::filesystem::path internal_video_mxf_filename () const;
- boost::filesystem::path audio_analysis_path (boost::shared_ptr<const AudioContent>) const;
+ boost::filesystem::path audio_analysis_dir () const;
boost::filesystem::path video_mxf_filename () const;
boost::filesystem::path audio_mxf_filename () const;
@@ -83,7 +83,7 @@ public:
boost::filesystem::path file (boost::filesystem::path f) const;
boost::filesystem::path dir (boost::filesystem::path d) const;
- void read_metadata ();
+ std::list<std::string> read_metadata ();
void write_metadata () const;
boost::shared_ptr<xmlpp::Document> metadata () const;
@@ -96,6 +96,7 @@ public:
}
dcp::Size full_frame () const;
+ dcp::Size frame_size () const;
std::list<boost::filesystem::path> dcps () const;
diff --git a/src/lib/filter.cc b/src/lib/filter.cc
index 640a531e8..a7dd9c5ce 100644
--- a/src/lib/filter.cc
+++ b/src/lib/filter.cc
@@ -24,7 +24,6 @@
#include "filter.h"
extern "C" {
#include <libavfilter/avfilter.h>
-#include <libpostproc/postprocess.h>
}
#include "i18n.h"
@@ -36,15 +35,13 @@ vector<Filter const *> Filter::_filters;
/** @param i Our id.
* @param n User-visible name.
* @param c User-visible category.
- * @param v String for a FFmpeg video filter descriptor, or "".
- * @param p String for a FFmpeg post-processing descriptor, or "".
+ * @param v String for a FFmpeg video filter descriptor.
*/
-Filter::Filter (string i, string n, string c, string v, string p)
+Filter::Filter (string i, string n, string c, string v)
: _id (i)
, _name (n)
, _category (c)
, _vf (v)
- , _pp (p)
{
}
@@ -65,75 +62,41 @@ Filter::setup_filters ()
{
/* Note: "none" is a magic id name, so don't use it here */
- maybe_add (N_("pphb"), _("Horizontal deblocking filter"), _("De-blocking"), N_(""), N_("hb"));
- maybe_add (N_("ppvb"), _("Vertical deblocking filter"), _("De-blocking"), N_(""), N_("vb"));
- maybe_add (N_("ppha"), _("Horizontal deblocking filter A"), _("De-blocking"), N_(""), N_("ha"));
- maybe_add (N_("ppva"), _("Vertical deblocking filter A"), _("De-blocking"), N_(""), N_("va"));
- maybe_add (N_("pph1"), _("Experimental horizontal deblocking filter 1"), _("De-blocking"), N_(""), N_("h1"));
- maybe_add (N_("pphv"), _("Experimental vertical deblocking filter 1"), _("De-blocking"), N_(""), N_("v1"));
- maybe_add (N_("ppdr"), _("Deringing filter"), _("Misc"), N_(""), N_("dr"));
- maybe_add (N_("pplb"), _("Linear blend deinterlacer"), _("De-interlacing"), N_(""), N_("lb"));
- maybe_add (N_("ppli"), _("Linear interpolating deinterlacer"), _("De-interlacing"), N_(""), N_("li"));
- maybe_add (N_("ppci"), _("Cubic interpolating deinterlacer"), _("De-interlacing"), N_(""), N_("ci"));
- maybe_add (N_("ppmd"), _("Median deinterlacer"), _("De-interlacing"), N_(""), N_("md"));
- maybe_add (N_("ppfd"), _("FFMPEG deinterlacer"), _("De-interlacing"), N_(""), N_("fd"));
- maybe_add (N_("ppl5"), _("FIR low-pass deinterlacer"), _("De-interlacing"), N_(""), N_("l5"));
- maybe_add (N_("mcdeint"), _("Motion compensating deinterlacer"), _("De-interlacing"), N_("mcdeint"), N_(""));
- maybe_add (N_("kerndeint"), _("Kernel deinterlacer"), _("De-interlacing"), N_("kerndeint"), N_(""));
- maybe_add (N_("yadif"), _("Yet Another Deinterlacing Filter"), _("De-interlacing"), N_("yadif"), N_(""));
- maybe_add (N_("pptn"), _("Temporal noise reducer"), _("Noise reduction"), N_(""), N_("tn"));
- maybe_add (N_("ppfq"), _("Force quantizer"), _("Misc"), N_(""), N_("fq"));
- maybe_add (N_("gradfun"), _("Gradient debander"), _("Misc"), N_("gradfun"), N_(""));
- maybe_add (N_("unsharp"), _("Unsharp mask and Gaussian blur"), _("Misc"), N_("unsharp"), N_(""));
- maybe_add (N_("denoise3d"), _("3D denoiser"), _("Noise reduction"), N_("denoise3d"), N_(""));
- maybe_add (N_("hqdn3d"), _("High quality 3D denoiser"), _("Noise reduction"), N_("hqdn3d"), N_(""));
- maybe_add (N_("telecine"), _("Telecine filter"), _("Misc"), N_("telecine"), N_(""));
- maybe_add (N_("ow"), _("Overcomplete wavelet denoiser"), _("Noise reduction"), N_("mp=ow"), N_(""));
+ maybe_add (N_("mcdeint"), _("Motion compensating deinterlacer"), _("De-interlacing"), N_("mcdeint"));
+ maybe_add (N_("kerndeint"), _("Kernel deinterlacer"), _("De-interlacing"), N_("kerndeint"));
+ maybe_add (N_("yadif"), _("Yet Another Deinterlacing Filter"), _("De-interlacing"), N_("yadif"));
+ maybe_add (N_("gradfun"), _("Gradient debander"), _("Misc"), N_("gradfun"));
+ maybe_add (N_("unsharp"), _("Unsharp mask and Gaussian blur"), _("Misc"), N_("unsharp"));
+ maybe_add (N_("denoise3d"), _("3D denoiser"), _("Noise reduction"), N_("denoise3d"));
+ maybe_add (N_("hqdn3d"), _("High quality 3D denoiser"), _("Noise reduction"), N_("hqdn3d"));
+ maybe_add (N_("telecine"), _("Telecine filter"), _("Misc"), N_("telecine"));
+ maybe_add (N_("ow"), _("Overcomplete wavelet denoiser"), _("Noise reduction"), N_("mp=ow"));
}
void
-Filter::maybe_add (string i, string n, string c, string v, string p)
+Filter::maybe_add (string i, string n, string c, string v)
{
- if (!v.empty ()) {
- if (avfilter_get_by_name (i.c_str())) {
- _filters.push_back (new Filter (i, n, c, v, p));
- }
- } else if (!p.empty ()) {
- pp_mode* m = pp_get_mode_by_name_and_quality (p.c_str(), PP_QUALITY_MAX);
- if (m) {
- _filters.push_back (new Filter (i, n, c, v, p));
- pp_free_mode (m);
- }
+ if (avfilter_get_by_name (i.c_str())) {
+ _filters.push_back (new Filter (i, n, c, v));
}
}
/** @param filters Set of filters.
- * @return A pair; .first is a string to pass to FFmpeg for the video filters,
- * .second is a string to pass for the post-processors.
+ * @return String to pass to FFmpeg for the video filters.
*/
-pair<string, string>
-Filter::ffmpeg_strings (vector<Filter const *> const & filters)
+string
+Filter::ffmpeg_string (vector<Filter const *> const & filters)
{
string vf;
- string pp;
for (vector<Filter const *>::const_iterator i = filters.begin(); i != filters.end(); ++i) {
- if (!(*i)->vf().empty ()) {
- if (!vf.empty ()) {
- vf += N_(",");
- }
- vf += (*i)->vf ();
- }
-
- if (!(*i)->pp().empty ()) {
- if (!pp.empty()) {
- pp += N_(",");
- }
- pp += (*i)->pp ();
+ if (!vf.empty ()) {
+ vf += N_(",");
}
+ vf += (*i)->vf ();
}
- return make_pair (vf, pp);
+ return vf;
}
/** @param d Our id.
diff --git a/src/lib/filter.h b/src/lib/filter.h
index 5971cd5cf..258e74991 100644
--- a/src/lib/filter.h
+++ b/src/lib/filter.h
@@ -29,12 +29,16 @@
#include <boost/utility.hpp>
/** @class Filter
- * @brief A class to describe one of FFmpeg's video or post-processing filters.
+ * @brief A class to describe one of FFmpeg's video filters.
+ *
+ * We don't support FFmpeg's post-processing filters here as they cannot cope with greater than
+ * 8bpp. FFmpeg quantizes e.g. yuv422p10le down to yuv422p before running such filters, which
+ * we don't really want to do.
*/
class Filter : public boost::noncopyable
{
public:
- Filter (std::string, std::string, std::string, std::string, std::string);
+ Filter (std::string, std::string, std::string, std::string);
/** @return our id */
std::string id () const {
@@ -51,11 +55,6 @@ public:
return _vf;
}
- /** @return string for a FFmpeg post-processing descriptor */
- std::string pp () const {
- return _pp;
- }
-
std::string category () const {
return _category;
}
@@ -63,7 +62,7 @@ public:
static std::vector<Filter const *> all ();
static Filter const * from_id (std::string);
static void setup_filters ();
- static std::pair<std::string, std::string> ffmpeg_strings (std::vector<Filter const *> const &);
+ static std::string ffmpeg_string (std::vector<Filter const *> const &);
private:
@@ -74,12 +73,10 @@ private:
std::string _category;
/** string for a FFmpeg video filter descriptor */
std::string _vf;
- /** string for a FFmpeg post-processing descriptor */
- std::string _pp;
/** all available filters */
static std::vector<Filter const *> _filters;
- static void maybe_add (std::string, std::string, std::string, std::string, std::string);
+ static void maybe_add (std::string, std::string, std::string, std::string);
};
#endif
diff --git a/src/lib/filter_graph.cc b/src/lib/filter_graph.cc
index 48d94e175..5add16d19 100644
--- a/src/lib/filter_graph.cc
+++ b/src/lib/filter_graph.cc
@@ -60,7 +60,7 @@ FilterGraph::FilterGraph (shared_ptr<const FFmpegContent> content, dcp::Size s,
{
_frame = av_frame_alloc ();
- string filters = Filter::ffmpeg_strings (content->filters()).first;
+ string filters = Filter::ffmpeg_string (content->filters());
if (filters.empty ()) {
filters = "copy";
}
diff --git a/src/lib/image.cc b/src/lib/image.cc
index 98645c299..c3b1ca77a 100644
--- a/src/lib/image.cc
+++ b/src/lib/image.cc
@@ -168,51 +168,6 @@ Image::scale (dcp::Size out_size, Scaler const * scaler, AVPixelFormat out_forma
return scaled;
}
-/** Run a FFmpeg post-process on this image and return the processed version.
- * @param pp Flags for the required set of post processes.
- * @return Post-processed image.
- */
-shared_ptr<Image>
-Image::post_process (string pp, bool aligned) const
-{
- shared_ptr<Image> out (new Image (pixel_format(), size (), aligned));
-
- int pp_format = 0;
- switch (pixel_format()) {
- case PIX_FMT_YUV420P:
- pp_format = PP_FORMAT_420;
- break;
- case PIX_FMT_YUV422P10LE:
- case PIX_FMT_YUV422P:
- case PIX_FMT_UYVY422:
- pp_format = PP_FORMAT_422;
- break;
- case PIX_FMT_YUV444P:
- case PIX_FMT_YUV444P9BE:
- case PIX_FMT_YUV444P9LE:
- case PIX_FMT_YUV444P10BE:
- case PIX_FMT_YUV444P10LE:
- pp_format = PP_FORMAT_444;
- default:
- throw PixelFormatError ("post_process", pixel_format());
- }
-
- pp_mode* mode = pp_get_mode_by_name_and_quality (pp.c_str (), PP_QUALITY_MAX);
- pp_context* context = pp_get_context (size().width, size().height, pp_format | PP_CPU_CAPS_MMX2);
-
- pp_postprocess (
- (const uint8_t **) data(), stride(),
- out->data(), out->stride(),
- size().width, size().height,
- 0, 0, mode, context, 0
- );
-
- pp_free_mode (mode);
- pp_free_context (context);
-
- return out;
-}
-
shared_ptr<Image>
Image::crop (Crop crop, bool aligned) const
{
diff --git a/src/lib/image.h b/src/lib/image.h
index 3220a23b4..5eba11041 100644
--- a/src/lib/image.h
+++ b/src/lib/image.h
@@ -58,7 +58,6 @@ public:
int lines (int) const;
boost::shared_ptr<Image> scale (dcp::Size, Scaler const *, AVPixelFormat, bool aligned) const;
- boost::shared_ptr<Image> post_process (std::string, bool aligned) const;
boost::shared_ptr<Image> crop (Crop c, bool aligned) const;
boost::shared_ptr<Image> crop_scale_window (Crop c, dcp::Size, dcp::Size, Scaler const *, AVPixelFormat, bool aligned) const;
diff --git a/src/lib/player.cc b/src/lib/player.cc
index e89e84aa6..f83e4ed26 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -81,7 +81,7 @@ Player::Player (shared_ptr<const Film> f, shared_ptr<const Playlist> p)
_playlist_changed_connection = _playlist->Changed.connect (bind (&Player::playlist_changed, this));
_playlist_content_changed_connection = _playlist->ContentChanged.connect (bind (&Player::content_changed, this, _1, _2, _3));
_film_changed_connection = _film->Changed.connect (bind (&Player::film_changed, this, _1));
- set_video_container_size (fit_ratio_within (_film->container()->ratio (), _film->full_frame ()));
+ set_video_container_size (_film->frame_size ());
}
void
diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc
index b7b4c20f7..c46e65d8b 100644
--- a/src/lib/playlist.cc
+++ b/src/lib/playlist.cc
@@ -113,11 +113,11 @@ Playlist::video_identifier () const
/** @param node <Playlist> node */
void
-Playlist::set_from_xml (shared_ptr<const Film> film, shared_ptr<const cxml::Node> node, int version)
+Playlist::set_from_xml (shared_ptr<const Film> film, shared_ptr<const cxml::Node> node, int version, list<string>& notes)
{
list<cxml::NodePtr> c = node->node_children ("Content");
for (list<cxml::NodePtr>::iterator i = c.begin(); i != c.end(); ++i) {
- _content.push_back (content_factory (film, *i, version));
+ _content.push_back (content_factory (film, *i, version, notes));
}
sort (_content.begin(), _content.end(), ContentSorter ());
diff --git a/src/lib/playlist.h b/src/lib/playlist.h
index 35709f109..444eb9ae5 100644
--- a/src/lib/playlist.h
+++ b/src/lib/playlist.h
@@ -57,7 +57,7 @@ public:
~Playlist ();
void as_xml (xmlpp::Node *);
- void set_from_xml (boost::shared_ptr<const Film>, boost::shared_ptr<const cxml::Node>, int);
+ void set_from_xml (boost::shared_ptr<const Film>, boost::shared_ptr<const cxml::Node>, int, std::list<std::string> &);
void add (boost::shared_ptr<Content>);
void remove (boost::shared_ptr<Content>);
diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc
index 11310c5da..c3aea2b0f 100644
--- a/src/lib/video_content.cc
+++ b/src/lib/video_content.cc
@@ -442,19 +442,30 @@ VideoContentScale::name () const
return _("No scale");
}
+/** @param display_container Size of the container that we are displaying this content in.
+ * @param film_container The size of the film's image.
+ */
dcp::Size
-VideoContentScale::size (shared_ptr<const VideoContent> c, dcp::Size container) const
+VideoContentScale::size (shared_ptr<const VideoContent> c, dcp::Size display_container, dcp::Size film_container) const
{
if (_ratio) {
- return fit_ratio_within (_ratio->ratio (), container);
+ return fit_ratio_within (_ratio->ratio (), display_container);
}
- /* Force scale if the container is smaller than the content's image */
- if (_scale || container.width < c->video_size().width || container.height < c->video_size().height) {
- return fit_ratio_within (c->video_size().ratio (), container);
+ libdcp::Size const ac = c->video_size_after_crop ();
+
+ /* Force scale if the film_container is smaller than the content's image */
+ if (_scale || film_container.width < ac.width || film_container.height < ac.height) {
+ return fit_ratio_within (ac.ratio (), display_container);
}
- return c->video_size ();
+ /* Scale the image so that it will be in the right place in film_container, even if display_container is a
+ different size.
+ */
+ return libdcp::Size (
+ c->video_size().width * float(display_container.width) / film_container.width,
+ c->video_size().height * float(display_container.height) / film_container.height
+ );
}
void
diff --git a/src/lib/video_content.h b/src/lib/video_content.h
index a82c6c221..d2b19480f 100644
--- a/src/lib/video_content.h
+++ b/src/lib/video_content.h
@@ -45,7 +45,7 @@ public:
VideoContentScale (bool);
VideoContentScale (boost::shared_ptr<cxml::Node>);
- dcp::Size size (boost::shared_ptr<const VideoContent>, dcp::Size) const;
+ dcp::Size size (boost::shared_ptr<const VideoContent>, dcp::Size, dcp::Size) const;
std::string id () const;
std::string name () const;
void as_xml (xmlpp::Node *) const;
@@ -64,7 +64,9 @@ public:
}
private:
+ /** a ratio to stretch the content to, or 0 for no stretch */
Ratio const * _ratio;
+ /** true if we want to scale the content */
bool _scale;
static std::vector<VideoContentScale> _scales;
diff --git a/src/lib/writer.cc b/src/lib/writer.cc
index 33b7dd51e..125efd644 100644
--- a/src/lib/writer.cc
+++ b/src/lib/writer.cc
@@ -45,6 +45,9 @@
#include "i18n.h"
+/* OS X strikes again */
+#undef set_key
+
using std::make_pair;
using std::pair;
using std::string;
@@ -91,7 +94,7 @@ Writer::Writer (shared_ptr<const Film> f, weak_ptr<Job> j)
_picture_mxf.reset (new dcp::MonoPictureMXF (dcp::Fraction (_film->video_frame_rate (), 1)));
}
- _picture_mxf->set_size (fit_ratio_within (_film->container()->ratio(), _film->full_frame ()));
+ _picture_mxf->set_size (_film->frame_size ());
if (_film->encrypted ()) {
_picture_mxf->set_key (_film->key ());