From 878e19aabf2278828a3c9b518e0804b2cef0c01e Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 20 Nov 2016 23:58:51 +0000 Subject: [PATCH] Some more decode logging. --- src/lib/audio_decoder.cc | 2 +- src/lib/audio_decoder_stream.cc | 3 ++- src/lib/dcp_decoder.cc | 1 + src/lib/dcp_subtitle_decoder.cc | 3 ++- src/lib/dcp_subtitle_decoder.h | 2 +- src/lib/decoder_factory.cc | 4 ++-- src/lib/decoder_part.cc | 5 ++++- src/lib/decoder_part.h | 4 +++- src/lib/ffmpeg_decoder.cc | 1 + src/lib/subtitle_decoder.cc | 6 +++++- src/lib/subtitle_decoder.h | 1 + src/lib/text_subtitle_decoder.cc | 3 ++- src/lib/text_subtitle_decoder.h | 2 +- src/lib/video_decoder.cc | 4 ++-- src/lib/video_decoder.h | 1 - test/dcp_subtitle_test.cc | 4 ++-- 16 files changed, 30 insertions(+), 16 deletions(-) diff --git a/src/lib/audio_decoder.cc b/src/lib/audio_decoder.cc index 9801a68da..f26c676b2 100644 --- a/src/lib/audio_decoder.cc +++ b/src/lib/audio_decoder.cc @@ -32,7 +32,7 @@ using std::map; using boost::shared_ptr; AudioDecoder::AudioDecoder (Decoder* parent, shared_ptr content, shared_ptr log) - : DecoderPart (parent) + : DecoderPart (parent, log) { BOOST_FOREACH (AudioStreamPtr i, content->streams ()) { _streams[i] = shared_ptr (new AudioDecoderStream (content, i, parent, this, log)); diff --git a/src/lib/audio_decoder_stream.cc b/src/lib/audio_decoder_stream.cc index 4f1a2f4ff..ef67b94f1 100644 --- a/src/lib/audio_decoder_stream.cc +++ b/src/lib/audio_decoder_stream.cc @@ -71,7 +71,7 @@ AudioDecoderStream::get (Frame frame, Frame length, bool accurate) { shared_ptr 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); } diff --git a/src/lib/dcp_decoder.cc b/src/lib/dcp_decoder.cc index 1d7c66a5b..e384e1230 100644 --- a/src/lib/dcp_decoder.cc +++ b/src/lib/dcp_decoder.cc @@ -61,6 +61,7 @@ DCPDecoder::DCPDecoder (shared_ptr c, shared_ptr log) new SubtitleDecoder ( this, c->subtitle, + log, bind (&DCPDecoder::image_subtitles_during, this, _1, _2), bind (&DCPDecoder::text_subtitles_during, this, _1, _2) ) diff --git a/src/lib/dcp_subtitle_decoder.cc b/src/lib/dcp_subtitle_decoder.cc index fe383226e..daafee3e5 100644 --- a/src/lib/dcp_subtitle_decoder.cc +++ b/src/lib/dcp_subtitle_decoder.cc @@ -28,12 +28,13 @@ using std::cout; using boost::shared_ptr; using boost::bind; -DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr content) +DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr content, shared_ptr 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) ) diff --git a/src/lib/dcp_subtitle_decoder.h b/src/lib/dcp_subtitle_decoder.h index 4b52a1ac4..b6e9aa63c 100644 --- a/src/lib/dcp_subtitle_decoder.h +++ b/src/lib/dcp_subtitle_decoder.h @@ -26,7 +26,7 @@ class DCPSubtitleContent; class DCPSubtitleDecoder : public DCPSubtitle, public Decoder { public: - DCPSubtitleDecoder (boost::shared_ptr); + DCPSubtitleDecoder (boost::shared_ptr, boost::shared_ptr log); protected: bool pass (PassReason, bool accurate); diff --git a/src/lib/decoder_factory.cc b/src/lib/decoder_factory.cc index 462a80eed..b661d494b 100644 --- a/src/lib/decoder_factory.cc +++ b/src/lib/decoder_factory.cc @@ -56,12 +56,12 @@ decoder_factory (shared_ptr content, shared_ptr log) shared_ptr rc = dynamic_pointer_cast (content); if (rc) { - return shared_ptr (new TextSubtitleDecoder (rc)); + return shared_ptr (new TextSubtitleDecoder (rc, log)); } shared_ptr dsc = dynamic_pointer_cast (content); if (dsc) { - return shared_ptr (new DCPSubtitleDecoder (dsc)); + return shared_ptr (new DCPSubtitleDecoder (dsc, log)); } shared_ptr vmc = dynamic_pointer_cast (content); diff --git a/src/lib/decoder_part.cc b/src/lib/decoder_part.cc index 9ae9633e1..f210bd7ae 100644 --- a/src/lib/decoder_part.cc +++ b/src/lib/decoder_part.cc @@ -21,8 +21,11 @@ #include "decoder_part.h" #include "decoder.h" -DecoderPart::DecoderPart (Decoder* parent) +using boost::shared_ptr; + +DecoderPart::DecoderPart (Decoder* parent, shared_ptr log) : _parent (parent) + , _log (log) , _ignore (false) { diff --git a/src/lib/decoder_part.h b/src/lib/decoder_part.h index 4b309a668..1a8794527 100644 --- a/src/lib/decoder_part.h +++ b/src/lib/decoder_part.h @@ -25,11 +25,12 @@ #include class Decoder; +class Log; class DecoderPart { public: - DecoderPart (Decoder* parent); + DecoderPart (Decoder* parent, boost::shared_ptr log); void set_ignore () { _ignore = true; @@ -51,6 +52,7 @@ public: protected: Decoder* _parent; + boost::shared_ptr _log; private: bool _ignore; diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index b7dced34d..463d2cd80 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -98,6 +98,7 @@ FFmpegDecoder::FFmpegDecoder (shared_ptr c, shared_ptr new SubtitleDecoder ( this, c->subtitle, + log, bind (&FFmpegDecoder::image_subtitles_during, this, _1, _2), bind (&FFmpegDecoder::text_subtitles_during, this, _1, _2) ) diff --git a/src/lib/subtitle_decoder.cc b/src/lib/subtitle_decoder.cc index 9c6ac969d..a7cf8110f 100644 --- a/src/lib/subtitle_decoder.cc +++ b/src/lib/subtitle_decoder.cc @@ -21,6 +21,8 @@ #include "subtitle_decoder.h" #include "subtitle_content.h" #include "util.h" +#include "log.h" +#include "compose.hpp" #include #include #include @@ -38,10 +40,11 @@ using boost::function; SubtitleDecoder::SubtitleDecoder ( Decoder* parent, shared_ptr c, + shared_ptr log, function (ContentTimePeriod, bool)> image_during, function (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 const & subs, list 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); } diff --git a/src/lib/subtitle_decoder.h b/src/lib/subtitle_decoder.h index df4946c07..dfa3d6d90 100644 --- a/src/lib/subtitle_decoder.h +++ b/src/lib/subtitle_decoder.h @@ -44,6 +44,7 @@ public: SubtitleDecoder ( Decoder* parent, boost::shared_ptr, + boost::shared_ptr log, boost::function (ContentTimePeriod, bool)> image_during, boost::function (ContentTimePeriod, bool)> text_during ); diff --git a/src/lib/text_subtitle_decoder.cc b/src/lib/text_subtitle_decoder.cc index 1576f50a1..ec60bd36b 100644 --- a/src/lib/text_subtitle_decoder.cc +++ b/src/lib/text_subtitle_decoder.cc @@ -34,7 +34,7 @@ using boost::shared_ptr; using boost::optional; using boost::dynamic_pointer_cast; -TextSubtitleDecoder::TextSubtitleDecoder (shared_ptr content) +TextSubtitleDecoder::TextSubtitleDecoder (shared_ptr content, shared_ptr log) : TextSubtitle (content) , _next (0) { @@ -42,6 +42,7 @@ TextSubtitleDecoder::TextSubtitleDecoder (shared_ptr new SubtitleDecoder ( this, content->subtitle, + log, bind (&TextSubtitleDecoder::image_subtitles_during, this, _1, _2), bind (&TextSubtitleDecoder::text_subtitles_during, this, _1, _2) ) diff --git a/src/lib/text_subtitle_decoder.h b/src/lib/text_subtitle_decoder.h index c79b89937..5477e6f5f 100644 --- a/src/lib/text_subtitle_decoder.h +++ b/src/lib/text_subtitle_decoder.h @@ -29,7 +29,7 @@ class TextSubtitleContent; class TextSubtitleDecoder : public Decoder, public TextSubtitle { public: - TextSubtitleDecoder (boost::shared_ptr); + TextSubtitleDecoder (boost::shared_ptr, boost::shared_ptr log); protected: void seek (ContentTime time, bool accurate); diff --git a/src/lib/video_decoder.cc b/src/lib/video_decoder.cc index 63cf02187..01d33cd68 100644 --- a/src/lib/video_decoder.cc +++ b/src/lib/video_decoder.cc @@ -37,12 +37,11 @@ using boost::shared_ptr; using boost::optional; VideoDecoder::VideoDecoder (Decoder* parent, shared_ptr c, shared_ptr 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); } diff --git a/src/lib/video_decoder.h b/src/lib/video_decoder.h index 2442d3173..4f764d203 100644 --- a/src/lib/video_decoder.h +++ b/src/lib/video_decoder.h @@ -67,7 +67,6 @@ private: void fill_both_eyes (VideoFrame from, VideoFrame to); boost::shared_ptr _content; - boost::shared_ptr _log; std::list _decoded; boost::shared_ptr _black_image; boost::optional _last_seek_time; diff --git a/test/dcp_subtitle_test.cc b/test/dcp_subtitle_test.cc index 643742a7f..7b7308a00 100644 --- a/test/dcp_subtitle_test.cc +++ b/test/dcp_subtitle_test.cc @@ -114,7 +114,7 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test2) film->examine_and_add_content (content); wait_for_jobs (); - shared_ptr decoder (new DCPSubtitleDecoder (content)); + shared_ptr decoder (new DCPSubtitleDecoder (content, film->log())); list 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 decoder (new DCPSubtitleDecoder (content)); + shared_ptr decoder (new DCPSubtitleDecoder (content, film->log())); list sub = decoder->subtitle->get_text ( ContentTimePeriod (ContentTime::from_seconds(0), ContentTime::from_seconds(2)), true, true ); -- 2.30.2