summaryrefslogtreecommitdiff
path: root/src/lib/content_factory.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-10-22 21:06:41 +0100
committerCarl Hetherington <cth@carlh.net>2013-10-22 21:06:41 +0100
commit080da912e04d156d9260a3a5eead9034d2a72af3 (patch)
tree2ebf01d3a283bd2780a3b5b25e6b3bcefb504c9e /src/lib/content_factory.cc
parent119178eddf7aa38083862a913e8519591b5b01a0 (diff)
Allow films to be loaded when content is missing.
Diffstat (limited to 'src/lib/content_factory.cc')
-rw-r--r--src/lib/content_factory.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/lib/content_factory.cc b/src/lib/content_factory.cc
index 6ed01f174..d42491f7f 100644
--- a/src/lib/content_factory.cc
+++ b/src/lib/content_factory.cc
@@ -22,6 +22,7 @@
#include "still_image_content.h"
#include "moving_image_content.h"
#include "sndfile_content.h"
+#include "util.h"
using std::string;
using boost::shared_ptr;
@@ -45,3 +46,19 @@ content_factory (shared_ptr<const Film> film, shared_ptr<cxml::Node> node)
return content;
}
+
+shared_ptr<Content>
+content_factory (shared_ptr<const Film> film, boost::filesystem::path path)
+{
+ shared_ptr<Content> content;
+
+ if (valid_image_file (path)) {
+ content.reset (new StillImageContent (film, path));
+ } else if (SndfileContent::valid_file (path)) {
+ content.reset (new SndfileContent (film, path));
+ } else {
+ content.reset (new FFmpegContent (film, path));
+ }
+
+ return content;
+}