Remove log from ImageProxy hierarchy.
authorCarl Hetherington <cth@carlh.net>
Fri, 7 Nov 2014 22:33:37 +0000 (22:33 +0000)
committerCarl Hetherington <cth@carlh.net>
Fri, 7 Nov 2014 22:33:37 +0000 (22:33 +0000)
17 files changed:
src/lib/dcp_decoder.cc
src/lib/dcp_decoder.h
src/lib/ffmpeg_decoder.cc
src/lib/image_decoder.cc
src/lib/image_proxy.cc
src/lib/image_proxy.h
src/lib/j2k_image_proxy.cc
src/lib/j2k_image_proxy.h
src/lib/magick_image_proxy.cc
src/lib/magick_image_proxy.h
src/lib/player.cc
src/lib/player_video.cc
src/lib/player_video.h
src/lib/raw_image_proxy.cc
src/lib/raw_image_proxy.h
src/lib/server.cc
test/client_server_test.cc

index bf016ef877bb11990bccf83a01821459cecb5a71..adeadd98a3d8fb19d826e4ce663af2ad2a84a30c 100644 (file)
@@ -38,11 +38,10 @@ using std::cout;
 using boost::shared_ptr;
 using boost::dynamic_pointer_cast;
 
-DCPDecoder::DCPDecoder (shared_ptr<const DCPContent> c, shared_ptr<Log> log)
+DCPDecoder::DCPDecoder (shared_ptr<const DCPContent> c)
        : VideoDecoder (c)
        , AudioDecoder (c)
        , SubtitleDecoder (c)
-       , _log (log)
        , _dcp_content (c)
 {
        dcp::DCP dcp (c->directory ());
@@ -71,15 +70,15 @@ DCPDecoder::pass ()
                shared_ptr<dcp::StereoPictureMXF> stereo = dynamic_pointer_cast<dcp::StereoPictureMXF> (mxf);
                int64_t const entry_point = (*_reel)->main_picture()->entry_point ();
                if (mono) {
-                       video (shared_ptr<ImageProxy> (new J2KImageProxy (mono->get_frame (entry_point + frame), mxf->size(), _log)), frame);
+                       video (shared_ptr<ImageProxy> (new J2KImageProxy (mono->get_frame (entry_point + frame), mxf->size())), frame);
                } else {
                        video (
-                               shared_ptr<ImageProxy> (new J2KImageProxy (stereo->get_frame (entry_point + frame), mxf->size(), dcp::EYE_LEFT, _log)),
+                               shared_ptr<ImageProxy> (new J2KImageProxy (stereo->get_frame (entry_point + frame), mxf->size(), dcp::EYE_LEFT)),
                                frame
                                );
                        
                        video (
-                               shared_ptr<ImageProxy> (new J2KImageProxy (stereo->get_frame (entry_point + frame), mxf->size(), dcp::EYE_RIGHT, _log)),
+                               shared_ptr<ImageProxy> (new J2KImageProxy (stereo->get_frame (entry_point + frame), mxf->size(), dcp::EYE_RIGHT)),
                                frame
                                );
                }
index d81b20b5c30d2d4793870aa07e286155b55daf77..89931aa38361695ccc1e7750b3d5956761dde341 100644 (file)
@@ -31,7 +31,7 @@ class Log;
 class DCPDecoder : public VideoDecoder, public AudioDecoder, public SubtitleDecoder
 {
 public:
-       DCPDecoder (boost::shared_ptr<const DCPContent>, boost::shared_ptr<Log>);
+       DCPDecoder (boost::shared_ptr<const DCPContent>);
 
 private:
        void seek (ContentTime t, bool accurate);
@@ -41,6 +41,5 @@ private:
        ContentTime _next;
        std::list<boost::shared_ptr<dcp::Reel> > _reels;
        std::list<boost::shared_ptr<dcp::Reel> >::iterator _reel;
-       boost::shared_ptr<Log> _log;
        boost::shared_ptr<const DCPContent> _dcp_content;
 };
index a96a4fb408df49dacaf79387365f4131db543d98..e90c33c80a848bca3c3faecbd7032c1df72d0526 100644 (file)
@@ -401,7 +401,7 @@ FFmpegDecoder::decode_video_packet ()
                if (i->second != AV_NOPTS_VALUE) {
                        double const pts = i->second * av_q2d (_format_context->streams[_video_stream]->time_base) + _pts_offset.seconds ();
                        video (
-                               shared_ptr<ImageProxy> (new RawImageProxy (image, _video_content->film()->log())),
+                               shared_ptr<ImageProxy> (new RawImageProxy (image)),
                                rint (pts * _ffmpeg_content->video_frame_rate ())
                                );
                } else {
index 8702c1a33b18692dbc43b89c9e60ab416ef9e50e..53ef7bae7f02bc480d4d4674bb2690e28cd0fe98 100644 (file)
@@ -49,7 +49,7 @@ ImageDecoder::pass ()
 
        if (!_image_content->still() || !_image) {
                /* Either we need an image or we are using moving images, so load one */
-               _image.reset (new MagickImageProxy (_image_content->path (_image_content->still() ? 0 : _video_position), _image_content->film()->log ()));
+               _image.reset (new MagickImageProxy (_image_content->path (_image_content->still() ? 0 : _video_position)));
        }
                
        video (_image, _video_position);
index b6b387b76081947a554290c0846cf81333acd42c..7013a69c9bca9520a816d2f51b83e9017365c9f7 100644 (file)
 #include "image.h"
 #include "exceptions.h"
 #include "cross.h"
-#include "log.h"
 
 #include "i18n.h"
 
-#define LOG_TIMING(...) _log->microsecond_log (String::compose (__VA_ARGS__), Log::TYPE_TIMING);
-
 using std::cout;
 using std::string;
 using boost::shared_ptr;
 
-ImageProxy::ImageProxy (shared_ptr<Log> log)
-       : _log (log)
-{
-
-}
-
 shared_ptr<ImageProxy>
-image_proxy_factory (shared_ptr<cxml::Node> xml, shared_ptr<Socket> socket, shared_ptr<Log> log)
+image_proxy_factory (shared_ptr<cxml::Node> xml, shared_ptr<Socket> socket)
 {
        if (xml->string_child("Type") == N_("Raw")) {
-               return shared_ptr<ImageProxy> (new RawImageProxy (xml, socket, log));
+               return shared_ptr<ImageProxy> (new RawImageProxy (xml, socket));
        } else if (xml->string_child("Type") == N_("Magick")) {
-               return shared_ptr<MagickImageProxy> (new MagickImageProxy (xml, socket, log));
+               return shared_ptr<MagickImageProxy> (new MagickImageProxy (xml, socket));
        } else if (xml->string_child("Type") == N_("J2K")) {
-               return shared_ptr<J2KImageProxy> (new J2KImageProxy (xml, socket, log));
+               return shared_ptr<J2KImageProxy> (new J2KImageProxy (xml, socket));
        }
 
        throw NetworkError (_("Unexpected image type received by server"));
index 7ff28e174ec092afdbc832ec6b07fb40c7f47c37..79b2bf4e89270d53f3a9b69684c94ea8a6929fdd 100644 (file)
@@ -31,7 +31,6 @@
 
 class Image;
 class Socket;
-class Log;
 
 namespace cxml {
        class Node;
@@ -56,7 +55,6 @@ namespace dcp {
 class ImageProxy : public boost::noncopyable
 {
 public:
-       ImageProxy (boost::shared_ptr<Log> log);
        virtual ~ImageProxy () {}
 
        /** @return Image (which must be aligned) */
@@ -67,11 +65,8 @@ public:
        virtual bool same (boost::shared_ptr<const ImageProxy>) const {
                return false;
        }
-
-protected:
-       boost::shared_ptr<Log> _log;
 };
 
-boost::shared_ptr<ImageProxy> image_proxy_factory (boost::shared_ptr<cxml::Node> xml, boost::shared_ptr<Socket> socket, boost::shared_ptr<Log> log);
+boost::shared_ptr<ImageProxy> image_proxy_factory (boost::shared_ptr<cxml::Node> xml, boost::shared_ptr<Socket> socket);
 
 #endif
index 6924fad795bd1ddbdcab067036a96917110560ed..1fe854cd1bd4e88afb8c379b140fd58d9337da84 100644 (file)
 using std::string;
 using boost::shared_ptr;
 
-J2KImageProxy::J2KImageProxy (shared_ptr<const dcp::MonoPictureFrame> frame, dcp::Size size, shared_ptr<Log> log)
-       : ImageProxy (log)
-       , _mono (frame)
+J2KImageProxy::J2KImageProxy (shared_ptr<const dcp::MonoPictureFrame> frame, dcp::Size size)
+       : _mono (frame)
        , _size (size)
 {
        
 }
 
-J2KImageProxy::J2KImageProxy (shared_ptr<const dcp::StereoPictureFrame> frame, dcp::Size size, dcp::Eye eye, shared_ptr<Log> log)
-       : ImageProxy (log)
-       , _stereo (frame)
+J2KImageProxy::J2KImageProxy (shared_ptr<const dcp::StereoPictureFrame> frame, dcp::Size size, dcp::Eye eye)
+       : _stereo (frame)
        , _size (size)
        , _eye (eye)
 {
 
 }
 
-J2KImageProxy::J2KImageProxy (shared_ptr<cxml::Node> xml, shared_ptr<Socket> socket, shared_ptr<Log> log)
-       : ImageProxy (log)
+J2KImageProxy::J2KImageProxy (shared_ptr<cxml::Node> xml, shared_ptr<Socket> socket)
 {
        _size = dcp::Size (xml->number_child<int> ("Width"), xml->number_child<int> ("Height"));
        if (xml->optional_number_child<int> ("Eye")) {
index d7b5c83fc443d36e2c79b98b641067fea695c924..c931e56441887d0497b349f20c4eab1e8028e603 100644 (file)
@@ -25,9 +25,9 @@ class EncodedData;
 class J2KImageProxy : public ImageProxy
 {
 public:
-       J2KImageProxy (boost::shared_ptr<const dcp::MonoPictureFrame> frame, dcp::Size, boost::shared_ptr<Log> log);
-       J2KImageProxy (boost::shared_ptr<const dcp::StereoPictureFrame> frame, dcp::Size, dcp::Eye, boost::shared_ptr<Log> log);
-       J2KImageProxy (boost::shared_ptr<cxml::Node> xml, boost::shared_ptr<Socket> socket, boost::shared_ptr<Log> log);
+       J2KImageProxy (boost::shared_ptr<const dcp::MonoPictureFrame> frame, dcp::Size);
+       J2KImageProxy (boost::shared_ptr<const dcp::StereoPictureFrame> frame, dcp::Size, dcp::Eye);
+       J2KImageProxy (boost::shared_ptr<cxml::Node> xml, boost::shared_ptr<Socket> socket);
 
        boost::shared_ptr<Image> image () const;
        void add_metadata (xmlpp::Node *) const;
index d1aa890b7a2524bcaaea602dc3b224114d43158d..e71ee4284f041d5c1acb2154e8896dcaf885b7f7 100644 (file)
 #include "cross.h"
 #include "exceptions.h"
 #include "util.h"
-#include "log.h"
 #include "image.h"
-#include "log.h"
 
 #include "i18n.h"
 
-#define LOG_TIMING(...) _log->microsecond_log (String::compose (__VA_ARGS__), Log::TYPE_TIMING);
-
 using std::string;
 using std::cout;
 using boost::shared_ptr;
 using boost::dynamic_pointer_cast;
 
-MagickImageProxy::MagickImageProxy (boost::filesystem::path path, shared_ptr<Log> log)
-       : ImageProxy (log)
+MagickImageProxy::MagickImageProxy (boost::filesystem::path path)
 {
        /* Read the file into a Blob */
        
@@ -57,8 +52,7 @@ MagickImageProxy::MagickImageProxy (boost::filesystem::path path, shared_ptr<Log
        delete[] data;
 }
 
-MagickImageProxy::MagickImageProxy (shared_ptr<cxml::Node>, shared_ptr<Socket> socket, shared_ptr<Log> log)
-       : ImageProxy (log)
+MagickImageProxy::MagickImageProxy (shared_ptr<cxml::Node>, shared_ptr<Socket> socket)
 {
        uint32_t const size = socket->read_uint32 ();
        uint8_t* data = new uint8_t[size];
@@ -74,8 +68,6 @@ MagickImageProxy::image () const
                return _image;
        }
 
-       LOG_TIMING ("[%1] MagickImageProxy begins decode and convert of %2 bytes", boost::this_thread::get_id(), _blob.length());
-
        Magick::Image* magick_image = 0;
        string error;
        try {
@@ -104,7 +96,6 @@ MagickImageProxy::image () const
        }
 
        dcp::Size size (magick_image->columns(), magick_image->rows());
-       LOG_TIMING ("[%1] MagickImageProxy decode finished", boost::this_thread::get_id ());
 
        _image.reset (new Image (PIX_FMT_RGB24, size, true));
 
@@ -122,8 +113,6 @@ MagickImageProxy::image () const
 
        delete magick_image;
 
-       LOG_TIMING ("[%1] MagickImageProxy completes decode and convert of %2 bytes", boost::this_thread::get_id(), _blob.length());
-       
        return _image;
 }
 
index 8b43d0a000233c051613e5b14f0ea2247716fe34..632fde8c79c2fc0a468d6d1647640b04c4544149 100644 (file)
@@ -22,8 +22,8 @@
 class MagickImageProxy : public ImageProxy
 {
 public:
-       MagickImageProxy (boost::filesystem::path, boost::shared_ptr<Log> log);
-       MagickImageProxy (boost::shared_ptr<cxml::Node> xml, boost::shared_ptr<Socket> socket, boost::shared_ptr<Log> log);
+       MagickImageProxy (boost::filesystem::path);
+       MagickImageProxy (boost::shared_ptr<cxml::Node> xml, boost::shared_ptr<Socket> socket);
 
        boost::shared_ptr<Image> image () const;
        void add_metadata (xmlpp::Node *) const;
index db99cd2ad81626bbe10180bc3e28ea9ea878cf43..fabb5b21134b00bf2898237f867f5edbbeaa385d 100644 (file)
@@ -128,7 +128,7 @@ Player::setup_pieces ()
 
                shared_ptr<const DCPContent> dc = dynamic_pointer_cast<const DCPContent> (*i);
                if (dc) {
-                       decoder.reset (new DCPDecoder (dc, _film->log ()));
+                       decoder.reset (new DCPDecoder (dc));
                        frc = FrameRateChange (dc->video_frame_rate(), _film->video_frame_rate());
                }
 
@@ -298,7 +298,7 @@ Player::black_player_video_frame (DCPTime time) const
 {
        return shared_ptr<PlayerVideo> (
                new PlayerVideo (
-                       shared_ptr<const ImageProxy> (new RawImageProxy (_black_image, _film->log ())),
+                       shared_ptr<const ImageProxy> (new RawImageProxy (_black_image)),
                        time,
                        Crop (),
                        optional<float> (),
index b5f0b5fa5fde53309692c9380eb1cdf920c3f9c1..b7a8f86693c995606cf47a07791192c5bcb1d92e 100644 (file)
@@ -57,7 +57,7 @@ PlayerVideo::PlayerVideo (
 
 }
 
-PlayerVideo::PlayerVideo (shared_ptr<cxml::Node> node, shared_ptr<Socket> socket, shared_ptr<Log> log)
+PlayerVideo::PlayerVideo (shared_ptr<cxml::Node> node, shared_ptr<Socket> socket)
 {
        _time = DCPTime (node->number_child<DCPTime::Type> ("Time"));
        _crop = Crop (node);
@@ -70,7 +70,7 @@ PlayerVideo::PlayerVideo (shared_ptr<cxml::Node> node, shared_ptr<Socket> socket
        _part = (Part) node->number_child<int> ("Part");
        _colour_conversion = ColourConversion::from_xml (node);
 
-       _in = image_proxy_factory (node->node_child ("In"), socket, log);
+       _in = image_proxy_factory (node->node_child ("In"), socket);
 
        if (node->optional_number_child<int> ("SubtitleX")) {
                
index 610a7526cb26090d582e647fff99ca3518a9d035..f1d0543d7cc25879acb672ffc54bac20aeafb8e4 100644 (file)
@@ -30,7 +30,6 @@ class Image;
 class ImageProxy;
 class Scaler;
 class Socket;
-class Log;
 class EncodedData;
 
 /** Everything needed to describe a video frame coming out of the player, but with the
@@ -53,7 +52,7 @@ public:
                boost::optional<ColourConversion>
                );
        
-       PlayerVideo (boost::shared_ptr<cxml::Node>, boost::shared_ptr<Socket>, boost::shared_ptr<Log>);
+       PlayerVideo (boost::shared_ptr<cxml::Node>, boost::shared_ptr<Socket>);
 
        void set_subtitle (PositionImage);
        
index 7e0688d13eee5beacb75a1810d7997c3e934babb..8e8bf88248be5bf2b70e2a2f1055283850e6b9b5 100644 (file)
@@ -31,15 +31,13 @@ extern "C" {
 using std::string;
 using boost::shared_ptr;
 
-RawImageProxy::RawImageProxy (shared_ptr<Image> image, shared_ptr<Log> log)
-       : ImageProxy (log)
-       , _image (image)
+RawImageProxy::RawImageProxy (shared_ptr<Image> image)
+       : _image (image)
 {
 
 }
 
-RawImageProxy::RawImageProxy (shared_ptr<cxml::Node> xml, shared_ptr<Socket> socket, shared_ptr<Log> log)
-       : ImageProxy (log)
+RawImageProxy::RawImageProxy (shared_ptr<cxml::Node> xml, shared_ptr<Socket> socket)
 {
        dcp::Size size (
                xml->number_child<int> ("Width"), xml->number_child<int> ("Height")
index 6707f689c4e361895fa11791ac4571ca89e06151..62561c6fb54a56434f42298e8e7d52bdcbca8daa 100644 (file)
@@ -22,8 +22,8 @@
 class RawImageProxy : public ImageProxy
 {
 public:
-       RawImageProxy (boost::shared_ptr<Image>, boost::shared_ptr<Log> log);
-       RawImageProxy (boost::shared_ptr<cxml::Node> xml, boost::shared_ptr<Socket> socket, boost::shared_ptr<Log> log);
+       RawImageProxy (boost::shared_ptr<Image>);
+       RawImageProxy (boost::shared_ptr<cxml::Node> xml, boost::shared_ptr<Socket> socket);
 
        boost::shared_ptr<Image> image () const;
        void add_metadata (xmlpp::Node *) const;
index a699be57739699c2d8558cb1290295be7e57c406..3583a19c09d447e04e4e73dc7085757c832f53b0 100644 (file)
@@ -112,7 +112,7 @@ Server::process (shared_ptr<Socket> socket, struct timeval& after_read, struct t
                return -1;
        }
 
-       shared_ptr<PlayerVideo> pvf (new PlayerVideo (xml, socket, _log));
+       shared_ptr<PlayerVideo> pvf (new PlayerVideo (xml, socket));
 
        DCPVideo dcp_video_frame (pvf, xml, _log);
 
index 0154200ad054c5a5ff1a024c76cf7c6ec56e06c8..0cd728165199e0a9c1a604352681c50617dc99e6 100644 (file)
@@ -84,7 +84,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_rgb)
 
        shared_ptr<PlayerVideo> pvf (
                new PlayerVideo (
-                       shared_ptr<ImageProxy> (new RawImageProxy (image, log)),
+                       shared_ptr<ImageProxy> (new RawImageProxy (image)),
                        DCPTime (),
                        Crop (),
                        optional<float> (),
@@ -168,7 +168,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_yuv)
 
        shared_ptr<PlayerVideo> pvf (
                new PlayerVideo (
-                       shared_ptr<ImageProxy> (new RawImageProxy (image, log)),
+                       shared_ptr<ImageProxy> (new RawImageProxy (image)),
                        DCPTime (),
                        Crop (),
                        optional<float> (),