#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>
shared_ptr<const DCPSubtitleContent> dsc = boost::dynamic_pointer_cast<const DCPSubtitleContent> (i);
if (fc) {
if (fc->subtitle) {
+ DCPOMATIC_ASSERT (fc->subtitle_stream());
/* This content has some subtitles; check the selected stream to decide what type */
if (fc->subtitle_stream()->has_text()) {
++text_subs;
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 ());
ContentList c = _parent->selected_subtitle ();
DCPOMATIC_ASSERT (c.size() == 1);
- shared_ptr<TextSubtitleContent> sr = dynamic_pointer_cast<TextSubtitleContent> (c.front ());
- if (sr) {
- TextSubtitleAppearanceDialog* d = new TextSubtitleAppearanceDialog (this, sr);
+ bool text = false;
+ bool image = false;
+
+ if (
+ dynamic_pointer_cast<TextSubtitleContent> (c.front()) ||
+ dynamic_pointer_cast<DCPContent> (c.front()) ||
+ dynamic_pointer_cast<DCPSubtitleContent> (c.front())) {
+
+ text = true;
+ }
+
+ shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (c.front());
+ if (fc) {
+ if (fc->subtitle_stream()->has_text()) {
+ text = true;
+ } else if (fc->subtitle_stream()->has_image()) {
+ image = true;
+ }
+ }
+
+ if (text) {
+ TextSubtitleAppearanceDialog* d = new TextSubtitleAppearanceDialog (this, c.front()->subtitle);
if (d->ShowModal () == wxID_OK) {
d->apply ();
}
d->Destroy ();
- } else {
- shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (c.front ());
+ } else if (image) {
DCPOMATIC_ASSERT (fc);
ImageSubtitleColourDialog* d = new ImageSubtitleColourDialog (this, fc, fc->subtitle_stream ());
if (d->ShowModal() == wxID_OK) {