swaroop: Disable play/stop/pause and slider during ad content.
[dcpomatic.git] / src / lib / ffmpeg_decoder.cc
index 1f2fcfef86ead651a87c4217055fb0378ea00c64..9076464ac73aaa318566a1d1cb8f089be8b1173b 100644 (file)
@@ -28,7 +28,7 @@
 #include "util.h"
 #include "log.h"
 #include "ffmpeg_decoder.h"
-#include "caption_decoder.h"
+#include "text_decoder.h"
 #include "ffmpeg_audio_stream.h"
 #include "ffmpeg_subtitle_stream.h"
 #include "video_filter_graph.h"
@@ -39,7 +39,7 @@
 #include "film.h"
 #include "audio_decoder.h"
 #include "compose.hpp"
-#include "caption_content.h"
+#include "text_content.h"
 #include "audio_content.h"
 #include <dcp/subtitle_string.h>
 #include <sub/ssa_reader.h>
@@ -97,9 +97,9 @@ FFmpegDecoder::FFmpegDecoder (shared_ptr<const FFmpegContent> c, shared_ptr<Log>
                audio.reset (new AudioDecoder (this, c->audio, log, fast));
        }
 
-       if (c->only_caption()) {
+       if (c->only_text()) {
                /* XXX: this time here should be the time of the first subtitle, not 0 */
-               caption.push_back (shared_ptr<CaptionDecoder> (new CaptionDecoder (this, c->only_caption(), log, ContentTime())));
+               text.push_back (shared_ptr<TextDecoder> (new TextDecoder (this, c->only_text(), log, ContentTime())));
        }
 
        _next_time.resize (_format_context->nb_streams);
@@ -184,7 +184,7 @@ FFmpegDecoder::pass ()
 
        if (_video_stream && si == _video_stream.get() && !video->ignore()) {
                decode_video_packet ();
-       } else if (fc->subtitle_stream() && fc->subtitle_stream()->uses_index(_format_context, si) && !only_caption()->ignore()) {
+       } else if (fc->subtitle_stream() && fc->subtitle_stream()->uses_index(_format_context, si) && !only_text()->ignore()) {
                decode_subtitle_packet ();
        } else {
                decode_audio_packet ();
@@ -525,9 +525,10 @@ FFmpegDecoder::decode_video_packet ()
 
                if (i->second != AV_NOPTS_VALUE) {
                        double const pts = i->second * av_q2d (_format_context->streams[_video_stream.get()]->time_base) + _pts_offset.seconds ();
+
                        video->emit (
                                shared_ptr<ImageProxy> (new RawImageProxy (image)),
-                               llrint (pts * _ffmpeg_content->active_video_frame_rate ())
+                               llrint(pts * _ffmpeg_content->active_video_frame_rate())
                                );
                } else {
                        LOG_WARNING_NC ("Dropping frame without PTS");
@@ -549,9 +550,9 @@ FFmpegDecoder::decode_subtitle_packet ()
        /* Stop any current subtitle, either at the time it was supposed to stop, or now if now is sooner */
        if (_have_current_subtitle) {
                if (_current_subtitle_to) {
-                       only_caption()->emit_stop (min(*_current_subtitle_to, subtitle_period(sub).from + _pts_offset));
+                       only_text()->emit_stop (min(*_current_subtitle_to, subtitle_period(sub).from + _pts_offset));
                } else {
-                       only_caption()->emit_stop (subtitle_period(sub).from + _pts_offset);
+                       only_text()->emit_stop (subtitle_period(sub).from + _pts_offset);
                }
                _have_current_subtitle = false;
        }
@@ -593,7 +594,7 @@ FFmpegDecoder::decode_subtitle_packet ()
        }
 
        if (_current_subtitle_to) {
-               only_caption()->emit_stop (*_current_subtitle_to);
+               only_text()->emit_stop (*_current_subtitle_to);
        }
 
        avsubtitle_free (&sub);
@@ -669,7 +670,7 @@ FFmpegDecoder::decode_bitmap_subtitle (AVSubtitleRect const * rect, ContentTime
                static_cast<double> (rect->h) / target_height
                );
 
-       only_caption()->emit_bitmap_start (from, image, scaled_rect);
+       only_text()->emit_bitmap_start (from, image, scaled_rect);
 }
 
 void
@@ -702,6 +703,6 @@ FFmpegDecoder::decode_ass_subtitle (string ass, ContentTime from)
                );
 
        BOOST_FOREACH (sub::Subtitle const & i, sub::collect<list<sub::Subtitle> > (raw)) {
-               only_caption()->emit_plain_start (from, i);
+               only_text()->emit_plain_start (from, i);
        }
 }