#include "dcp_decoder.h"
#include "image_content.h"
#include "image_decoder.h"
-#include "text_subtitle_content.h"
-#include "text_subtitle_decoder.h"
+#include "string_text_file_content.h"
+#include "string_text_file_decoder.h"
#include "dcp_subtitle_content.h"
#include "dcp_subtitle_decoder.h"
#include "video_mxf_content.h"
using boost::dynamic_pointer_cast;
shared_ptr<Decoder>
-decoder_factory (shared_ptr<const Content> content, list<shared_ptr<ImageDecoder> > old_image_decoders, shared_ptr<Log> log, bool fast)
+decoder_factory (shared_ptr<const Film> film, shared_ptr<const Content> content, bool fast)
{
shared_ptr<const FFmpegContent> fc = dynamic_pointer_cast<const FFmpegContent> (content);
if (fc) {
- return shared_ptr<Decoder> (new FFmpegDecoder (fc, log, fast));
+ return shared_ptr<Decoder> (new FFmpegDecoder(film, fc, fast));
}
shared_ptr<const DCPContent> dc = dynamic_pointer_cast<const DCPContent> (content);
if (dc) {
- return shared_ptr<Decoder> (new DCPDecoder (dc, log, fast));
+ try {
+ return shared_ptr<Decoder> (new DCPDecoder(film, dc, fast));
+ } catch (KDMError& e) {
+ /* This will be found and reported to the user when the content is examined */
+ return shared_ptr<Decoder>();
+ }
}
shared_ptr<const ImageContent> ic = dynamic_pointer_cast<const ImageContent> (content);
if (ic) {
- shared_ptr<Decoder> decoder;
-
- /* See if we can re-use an old ImageDecoder */
- BOOST_FOREACH (shared_ptr<ImageDecoder> i, old_image_decoders) {
- if (i->content() == ic) {
- decoder = i;
- }
- }
-
- if (!decoder) {
- decoder.reset (new ImageDecoder (ic, log));
- }
-
- return decoder;
+ return shared_ptr<Decoder> (new ImageDecoder(film, ic));
}
- shared_ptr<const TextSubtitleContent> rc = dynamic_pointer_cast<const TextSubtitleContent> (content);
+ shared_ptr<const StringTextFileContent> rc = dynamic_pointer_cast<const StringTextFileContent> (content);
if (rc) {
- return shared_ptr<Decoder> (new TextSubtitleDecoder (rc));
+ return shared_ptr<Decoder> (new StringTextFileDecoder(film, rc));
}
shared_ptr<const DCPSubtitleContent> dsc = dynamic_pointer_cast<const DCPSubtitleContent> (content);
if (dsc) {
- return shared_ptr<Decoder> (new DCPSubtitleDecoder (dsc));
+ return shared_ptr<Decoder> (new DCPSubtitleDecoder(film, dsc));
}
shared_ptr<const VideoMXFContent> vmc = dynamic_pointer_cast<const VideoMXFContent> (content);
if (vmc) {
- return shared_ptr<Decoder> (new VideoMXFDecoder (vmc, log));
+ return shared_ptr<Decoder> (new VideoMXFDecoder(film, vmc));
}
return shared_ptr<Decoder> ();