summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-05-26 10:57:06 +0100
committerCarl Hetherington <cth@carlh.net>2016-05-26 10:57:06 +0100
commitb0f078d851e2a84d2f9d2ae085f6aad837747eb1 (patch)
tree2d99b504e4cc0e385865fbf52e755fbbc973b12c /src/wx
parent917eaf28db474a4c605eaaa8347a3e9a86b70aa0 (diff)
Factor out decoder creation to a factory method.
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/subtitle_panel.cc14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/wx/subtitle_panel.cc b/src/wx/subtitle_panel.cc
index 52b23f5a2..31ee2c477 100644
--- a/src/wx/subtitle_panel.cc
+++ b/src/wx/subtitle_panel.cc
@@ -34,6 +34,7 @@
#include "lib/dcp_subtitle_decoder.h"
#include "lib/dcp_content.h"
#include "lib/subtitle_content.h"
+#include "lib/decoder_factory.h"
#include <wx/spinctrl.h>
#include <boost/foreach.hpp>
@@ -384,17 +385,8 @@ SubtitlePanel::subtitle_view_clicked ()
ContentList c = _parent->selected_subtitle ();
DCPOMATIC_ASSERT (c.size() == 1);
- shared_ptr<Decoder> decoder;
-
- shared_ptr<TextSubtitleContent> sr = dynamic_pointer_cast<TextSubtitleContent> (c.front ());
- if (sr) {
- decoder.reset (new TextSubtitleDecoder (sr));
- }
-
- shared_ptr<DCPSubtitleContent> dc = dynamic_pointer_cast<DCPSubtitleContent> (c.front ());
- if (dc) {
- decoder.reset (new DCPSubtitleDecoder (dc));
- }
+ list<shared_ptr<ImageDecoder> > image_decoders;
+ shared_ptr<Decoder> decoder = decoder_factory (c.front(), image_decoders, _parent->film()->log(), false);
if (decoder) {
_subtitle_view = new SubtitleView (this, _parent->film(), decoder, c.front()->position ());