X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fcontent_factory.cc;h=98b1dd859536643c83c524e3a22a4df45b039c8a;hb=278037ebfb816ad39f8546a194131e89803e7075;hp=cf45b6aa6f4074aceed188b4a36d6089ab3de4c7;hpb=91273da19c689e44f3baa368d4b4efbe75cd8fe5;p=dcpomatic.git diff --git a/src/lib/content_factory.cc b/src/lib/content_factory.cc index cf45b6aa6..98b1dd859 100644 --- a/src/lib/content_factory.cc +++ b/src/lib/content_factory.cc @@ -19,25 +19,43 @@ #include #include "ffmpeg_content.h" -#include "imagemagick_content.h" +#include "image_content.h" #include "sndfile_content.h" +#include "util.h" using std::string; +using std::list; using boost::shared_ptr; shared_ptr -content_factory (shared_ptr film, shared_ptr node) +content_factory (shared_ptr film, cxml::NodePtr node, int version, list& notes) { string const type = node->string_child ("Type"); boost::shared_ptr content; if (type == "FFmpeg") { - content.reset (new FFmpegContent (film, node)); - } else if (type == "ImageMagick") { - content.reset (new ImageMagickContent (film, node)); + content.reset (new FFmpegContent (film, node, version, notes)); + } else if (type == "Image") { + content.reset (new ImageContent (film, node, version)); } else if (type == "Sndfile") { - content.reset (new SndfileContent (film, node)); + content.reset (new SndfileContent (film, node, version)); + } + + return content; +} + +shared_ptr +content_factory (shared_ptr film, boost::filesystem::path path) +{ + shared_ptr content; + + if (valid_image_file (path)) { + content.reset (new ImageContent (film, path)); + } else if (SndfileContent::valid_file (path)) { + content.reset (new SndfileContent (film, path)); + } else { + content.reset (new FFmpegContent (film, path)); } return content;