summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-03-15 20:39:47 +0000
committerCarl Hetherington <cth@carlh.net>2014-03-15 20:39:47 +0000
commit816b3c2dda2c5e33900f5d90a001284045040b5f (patch)
treee6f80be308f26dfdf2bb2e1996755315c075c72f /src/lib
parentc9f11d1367a54313e61abbaef7c075ed336b7f79 (diff)
parent5d3ebbb2e7844485e8dddd6471209d56b05633ae (diff)
Merge master.
Diffstat (limited to 'src/lib')
-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/ffmpeg_content.cc13
-rw-r--r--src/lib/ffmpeg_content.h2
-rw-r--r--src/lib/ffmpeg_decoder.cc5
-rw-r--r--src/lib/film.cc12
-rw-r--r--src/lib/film.h2
-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/playlist.cc4
-rw-r--r--src/lib/playlist.h2
15 files changed, 61 insertions, 137 deletions
diff --git a/src/lib/content.cc b/src/lib/content.cc
index 1883dfb4a..829468247 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 bab22b8eb..98b1dd859 100644
--- a/src/lib/content_factory.cc
+++ b/src/lib/content_factory.cc
@@ -24,17 +24,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/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc
index 47fe4f807..fadeec9cd 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");
@@ -215,13 +220,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
);
}
diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h
index 9600666b3..6ab95d2fe 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 () {
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc
index 347d8cc08..851c64606 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -468,14 +468,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) {
diff --git a/src/lib/film.cc b/src/lib/film.cc
index 8aa0deed0..04692fc1e 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -381,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;
@@ -430,9 +432,13 @@ Film::read_metadata ()
_three_d = f.bool_child ("ThreeD");
_interop = f.bool_child ("Interop");
_key = libdcp::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.
diff --git a/src/lib/film.h b/src/lib/film.h
index de9891c9f..162b67b35 100644
--- a/src/lib/film.h
+++ b/src/lib/film.h
@@ -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;
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 cd5d19807..a36a41f43 100644
--- a/src/lib/filter_graph.cc
+++ b/src/lib/filter_graph.cc
@@ -60,7 +60,7 @@ FilterGraph::FilterGraph (shared_ptr<const FFmpegContent> content, libdcp::Size
{
_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 c7dfc91cb..25d1ef276 100644
--- a/src/lib/image.cc
+++ b/src/lib/image.cc
@@ -167,51 +167,6 @@ Image::scale (libdcp::Size out_size, Scaler const * scaler, AVPixelFormat out_fo
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 b12db3a14..2d9f32231 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 (libdcp::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, libdcp::Size, libdcp::Size, Scaler const *, AVPixelFormat, bool aligned) const;
diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc
index daa82cb94..608323e3b 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 1915e3d04..394023f5c 100644
--- a/src/lib/playlist.h
+++ b/src/lib/playlist.h
@@ -56,7 +56,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>);