Some more decode logging.
authorCarl Hetherington <cth@carlh.net>
Sun, 20 Nov 2016 23:58:51 +0000 (23:58 +0000)
committerCarl Hetherington <cth@carlh.net>
Sun, 20 Nov 2016 23:58:51 +0000 (23:58 +0000)
16 files changed:
src/lib/audio_decoder.cc
src/lib/audio_decoder_stream.cc
src/lib/dcp_decoder.cc
src/lib/dcp_subtitle_decoder.cc
src/lib/dcp_subtitle_decoder.h
src/lib/decoder_factory.cc
src/lib/decoder_part.cc
src/lib/decoder_part.h
src/lib/ffmpeg_decoder.cc
src/lib/subtitle_decoder.cc
src/lib/subtitle_decoder.h
src/lib/text_subtitle_decoder.cc
src/lib/text_subtitle_decoder.h
src/lib/video_decoder.cc
src/lib/video_decoder.h
test/dcp_subtitle_test.cc

index 9801a68da90a0c1cb8d9505451742940adf205e6..f26c676b200038c54673871ef2b80c42ee8d8adb 100644 (file)
@@ -32,7 +32,7 @@ using std::map;
 using boost::shared_ptr;
 
 AudioDecoder::AudioDecoder (Decoder* parent, shared_ptr<const AudioContent> content, shared_ptr<Log> log)
-       : DecoderPart (parent)
+       : DecoderPart (parent, log)
 {
        BOOST_FOREACH (AudioStreamPtr i, content->streams ()) {
                _streams[i] = shared_ptr<AudioDecoderStream> (new AudioDecoderStream (content, i, parent, this, log));
index 4f1a2f4ff3f5cdda5105c175edc890ecd299371f..ef67b94f17e606144230d35a417911fdacee87b1 100644 (file)
@@ -71,7 +71,7 @@ AudioDecoderStream::get (Frame frame, Frame length, bool accurate)
 {
        shared_ptr<ContentAudio> dec;
 
-       _log->log (String::compose ("-> ADS has request for %1 %2", frame, length), LogEntry::TYPE_DEBUG_DECODE);
+       _log->log (String::compose ("ADS has request for %1 %2", frame, length), LogEntry::TYPE_DEBUG_DECODE);
 
        Frame const from = frame;
        Frame const to = from + length;
@@ -89,6 +89,7 @@ AudioDecoderStream::get (Frame frame, Frame length, bool accurate)
        }
 
        if (missing) {
+               _log->log (String::compose ("ADS suggests seek to %1", *missing), LogEntry::TYPE_DEBUG_DECODE);
                _audio_decoder->maybe_seek (ContentTime::from_frames (*missing, _content->resampled_frame_rate()), accurate);
        }
 
index 1d7c66a5ba52e708c0aed831d63eb806b6ec5679..e384e123045bd32966fb1b06bc584129f22be061 100644 (file)
@@ -61,6 +61,7 @@ DCPDecoder::DCPDecoder (shared_ptr<const DCPContent> c, shared_ptr<Log> log)
                new SubtitleDecoder (
                        this,
                        c->subtitle,
+                       log,
                        bind (&DCPDecoder::image_subtitles_during, this, _1, _2),
                        bind (&DCPDecoder::text_subtitles_during, this, _1, _2)
                        )
index fe383226ee7a33f27a474248feba3c9077bd13f3..daafee3e5acfaf687a6d4b5de76f064dfeede0df 100644 (file)
@@ -28,12 +28,13 @@ using std::cout;
 using boost::shared_ptr;
 using boost::bind;
 
-DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr<const DCPSubtitleContent> content)
+DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr<const DCPSubtitleContent> content, shared_ptr<Log> log)
 {
        subtitle.reset (
                new SubtitleDecoder (
                        this,
                        content->subtitle,
+                       log,
                        bind (&DCPSubtitleDecoder::image_subtitles_during, this, _1, _2),
                        bind (&DCPSubtitleDecoder::text_subtitles_during, this, _1, _2)
                        )
index 4b52a1ac418d25582d9f6a70c9ad4e30c48e1c5b..b6e9aa63cb1d6c16b5b455d642470b934b88d989 100644 (file)
@@ -26,7 +26,7 @@ class DCPSubtitleContent;
 class DCPSubtitleDecoder : public DCPSubtitle, public Decoder
 {
 public:
-       DCPSubtitleDecoder (boost::shared_ptr<const DCPSubtitleContent>);
+       DCPSubtitleDecoder (boost::shared_ptr<const DCPSubtitleContent>, boost::shared_ptr<Log> log);
 
 protected:
        bool pass (PassReason, bool accurate);
index 462a80eed74049d23ccfc2dced1e89220dfc4f1a..b661d494bf9f02b85864d9a1477974e85400f761 100644 (file)
@@ -56,12 +56,12 @@ decoder_factory (shared_ptr<const Content> content, shared_ptr<Log> log)
 
        shared_ptr<const TextSubtitleContent> rc = dynamic_pointer_cast<const TextSubtitleContent> (content);
        if (rc) {
-               return shared_ptr<Decoder> (new TextSubtitleDecoder (rc));
+               return shared_ptr<Decoder> (new TextSubtitleDecoder (rc, log));
        }
 
        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 (dsc, log));
        }
 
        shared_ptr<const VideoMXFContent> vmc = dynamic_pointer_cast<const VideoMXFContent> (content);
index 9ae9633e142499b30732672667afc0d1e9e49ec4..f210bd7aeb0a48a9bbc44d1ebe6d0bea6a418d29 100644 (file)
 #include "decoder_part.h"
 #include "decoder.h"
 
-DecoderPart::DecoderPart (Decoder* parent)
+using boost::shared_ptr;
+
+DecoderPart::DecoderPart (Decoder* parent, shared_ptr<Log> log)
        : _parent (parent)
+       , _log (log)
        , _ignore (false)
 {
 
index 4b309a6682bd39c767882da148032570acba6d15..1a879452703a5dd301ff86a38e253da4360fd757 100644 (file)
 #include <boost/optional.hpp>
 
 class Decoder;
+class Log;
 
 class DecoderPart
 {
 public:
-       DecoderPart (Decoder* parent);
+       DecoderPart (Decoder* parent, boost::shared_ptr<Log> log);
 
        void set_ignore () {
                _ignore = true;
@@ -51,6 +52,7 @@ public:
 
 protected:
        Decoder* _parent;
+       boost::shared_ptr<Log> _log;
 
 private:
        bool _ignore;
index b7dced34d47bfa42da317391edaf7b2cc49f709e..463d2cd801f447ca641b3b725ff8c7ab7af44b49 100644 (file)
@@ -98,6 +98,7 @@ FFmpegDecoder::FFmpegDecoder (shared_ptr<const FFmpegContent> c, shared_ptr<Log>
                        new SubtitleDecoder (
                                this,
                                c->subtitle,
+                               log,
                                bind (&FFmpegDecoder::image_subtitles_during, this, _1, _2),
                                bind (&FFmpegDecoder::text_subtitles_during, this, _1, _2)
                                )
index 9c6ac969dbd876caf3580b46471e6354c8d3da11..a7cf8110f5fc3bd56baa5eff95d62263f8d3f11e 100644 (file)
@@ -21,6 +21,8 @@
 #include "subtitle_decoder.h"
 #include "subtitle_content.h"
 #include "util.h"
+#include "log.h"
+#include "compose.hpp"
 #include <sub/subtitle.h>
 #include <boost/shared_ptr.hpp>
 #include <boost/foreach.hpp>
@@ -38,10 +40,11 @@ using boost::function;
 SubtitleDecoder::SubtitleDecoder (
        Decoder* parent,
        shared_ptr<const SubtitleContent> c,
+       shared_ptr<Log> log,
        function<list<ContentTimePeriod> (ContentTimePeriod, bool)> image_during,
        function<list<ContentTimePeriod> (ContentTimePeriod, bool)> text_during
        )
-       : DecoderPart (parent)
+       : DecoderPart (parent, log)
        , _content (c)
        , _image_during (image_during)
        , _text_during (text_during)
@@ -104,6 +107,7 @@ SubtitleDecoder::get (list<T> const & subs, list<ContentTimePeriod> const & sp,
 
        /* Suggest to our parent decoder that it might want to seek if we haven't got what we're being asked for */
        if (missing) {
+               _log->log (String::compose ("SD suggests seek to %1", to_string (*missing)), LogEntry::TYPE_DEBUG_DECODE);
                maybe_seek (*missing, true);
        }
 
index df4946c07848866daeb6a07b8c0c153c4c1b3842..dfa3d6d909e288c1e5bc4ce612202da9ebda37c1 100644 (file)
@@ -44,6 +44,7 @@ public:
        SubtitleDecoder (
                Decoder* parent,
                boost::shared_ptr<const SubtitleContent>,
+               boost::shared_ptr<Log> log,
                boost::function<std::list<ContentTimePeriod> (ContentTimePeriod, bool)> image_during,
                boost::function<std::list<ContentTimePeriod> (ContentTimePeriod, bool)> text_during
                );
index 1576f50a19ddbe05c49ddb0c1681333ba377f40b..ec60bd36b52327a838cf73460c01f0ad74c04b16 100644 (file)
@@ -34,7 +34,7 @@ using boost::shared_ptr;
 using boost::optional;
 using boost::dynamic_pointer_cast;
 
-TextSubtitleDecoder::TextSubtitleDecoder (shared_ptr<const TextSubtitleContent> content)
+TextSubtitleDecoder::TextSubtitleDecoder (shared_ptr<const TextSubtitleContent> content, shared_ptr<Log> log)
        : TextSubtitle (content)
        , _next (0)
 {
@@ -42,6 +42,7 @@ TextSubtitleDecoder::TextSubtitleDecoder (shared_ptr<const TextSubtitleContent>
                new SubtitleDecoder (
                        this,
                        content->subtitle,
+                       log,
                        bind (&TextSubtitleDecoder::image_subtitles_during, this, _1, _2),
                        bind (&TextSubtitleDecoder::text_subtitles_during, this, _1, _2)
                        )
index c79b89937f33006f682d216ff1dcfb88210bcdae..5477e6f5f16860d15c67c9396070ae517aa159a5 100644 (file)
@@ -29,7 +29,7 @@ class TextSubtitleContent;
 class TextSubtitleDecoder : public Decoder, public TextSubtitle
 {
 public:
-       TextSubtitleDecoder (boost::shared_ptr<const TextSubtitleContent>);
+       TextSubtitleDecoder (boost::shared_ptr<const TextSubtitleContent>, boost::shared_ptr<Log> log);
 
 protected:
        void seek (ContentTime time, bool accurate);
index 63cf021878c0d771f54fcd329cb087b7a7068eb1..01d33cd6895e21fa3a596aa14813d165e041336e 100644 (file)
@@ -37,12 +37,11 @@ using boost::shared_ptr;
 using boost::optional;
 
 VideoDecoder::VideoDecoder (Decoder* parent, shared_ptr<const Content> c, shared_ptr<Log> log)
-       : DecoderPart (parent)
+       : DecoderPart (parent, log)
 #ifdef DCPOMATIC_DEBUG
        , test_gaps (0)
 #endif
        , _content (c)
-       , _log (log)
        , _last_seek_accurate (true)
 {
        _black_image.reset (new Image (AV_PIX_FMT_RGB24, _content->video->size(), true));
@@ -90,6 +89,7 @@ VideoDecoder::get (Frame frame, bool accurate)
                        */
                        seek_frame *= 2;
                }
+               _log->log (String::compose ("VD suggests seek to %1", seek_frame), LogEntry::TYPE_DEBUG_DECODE);
                maybe_seek (ContentTime::from_frames (seek_frame, _content->active_video_frame_rate()), accurate);
        }
 
index 2442d3173fcb77f66f0c0f955f178ba9b576be30..4f764d203f6406dc2cd979697236abfa7eb86680 100644 (file)
@@ -67,7 +67,6 @@ private:
        void fill_both_eyes (VideoFrame from, VideoFrame to);
 
        boost::shared_ptr<const Content> _content;
-       boost::shared_ptr<Log> _log;
        std::list<ContentVideo> _decoded;
        boost::shared_ptr<Image> _black_image;
        boost::optional<ContentTime> _last_seek_time;
index 643742a7f6b1f3f41c16c2d2b7e1d4cce6e9804d..7b7308a00737a09faec226c02037d470c4ed3bd2 100644 (file)
@@ -114,7 +114,7 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test2)
        film->examine_and_add_content (content);
        wait_for_jobs ();
 
-       shared_ptr<DCPSubtitleDecoder> decoder (new DCPSubtitleDecoder (content));
+       shared_ptr<DCPSubtitleDecoder> decoder (new DCPSubtitleDecoder (content, film->log()));
        list<ContentTextSubtitle> sub = decoder->subtitle->get_text (
                ContentTimePeriod (ContentTime::from_seconds(0), ContentTime::from_seconds(2)), true, true
                );
@@ -138,7 +138,7 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test3)
        film->make_dcp ();
        wait_for_jobs ();
 
-       shared_ptr<DCPSubtitleDecoder> decoder (new DCPSubtitleDecoder (content));
+       shared_ptr<DCPSubtitleDecoder> decoder (new DCPSubtitleDecoder (content, film->log()));
        list<ContentTextSubtitle> sub = decoder->subtitle->get_text (
                ContentTimePeriod (ContentTime::from_seconds(0), ContentTime::from_seconds(2)), true, true
                );