diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-01-07 12:12:15 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-01-07 12:12:15 +0000 |
| commit | 77f7f3be256f81d2977bccdb236582e18a625ba7 (patch) | |
| tree | 2b3880043171559a2d6b938c3c1746ba6ea5874c /src | |
| parent | 48073ddb0a9a6e9c9dd81b04b196230f4372447b (diff) | |
Make a note in the log when XYZ values are clamped by libdcp on XYZ -> RGB conversion.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/dcp_video.cc | 7 | ||||
| -rw-r--r-- | src/lib/dcp_video.h | 3 | ||||
| -rw-r--r-- | src/lib/encoder.cc | 8 | ||||
| -rw-r--r-- | src/lib/image_proxy.h | 4 | ||||
| -rw-r--r-- | src/lib/j2k_image_proxy.cc | 5 | ||||
| -rw-r--r-- | src/lib/j2k_image_proxy.h | 2 | ||||
| -rw-r--r-- | src/lib/log.cc | 18 | ||||
| -rw-r--r-- | src/lib/log.h | 2 | ||||
| -rw-r--r-- | src/lib/magick_image_proxy.cc | 3 | ||||
| -rw-r--r-- | src/lib/magick_image_proxy.h | 2 | ||||
| -rw-r--r-- | src/lib/player_video.cc | 4 | ||||
| -rw-r--r-- | src/lib/player_video.h | 2 | ||||
| -rw-r--r-- | src/lib/raw_image_proxy.cc | 3 | ||||
| -rw-r--r-- | src/lib/raw_image_proxy.h | 2 | ||||
| -rw-r--r-- | src/lib/server.cc | 2 | ||||
| -rw-r--r-- | src/tools/server_test.cc | 2 | ||||
| -rw-r--r-- | src/wx/film_viewer.cc | 11 |
17 files changed, 53 insertions, 27 deletions
diff --git a/src/lib/dcp_video.cc b/src/lib/dcp_video.cc index cca199b05..559aef7c6 100644 --- a/src/lib/dcp_video.cc +++ b/src/lib/dcp_video.cc @@ -28,7 +28,6 @@ * of images that require encoding. */ -#include "film.h" #include "dcp_video.h" #include "config.h" #include "exceptions.h" @@ -108,17 +107,17 @@ DCPVideo::DCPVideo (shared_ptr<const PlayerVideo> frame, shared_ptr<const cxml:: * @return Encoded data. */ shared_ptr<EncodedData> -DCPVideo::encode_locally () +DCPVideo::encode_locally (dcp::NoteHandler note) { shared_ptr<dcp::XYZFrame> xyz; if (_frame->colour_conversion()) { xyz = dcp::rgb_to_xyz ( - _frame->image (AV_PIX_FMT_RGB48LE, _burn_subtitles), + _frame->image (AV_PIX_FMT_RGB48LE, _burn_subtitles, note), _frame->colour_conversion().get() ); } else { - xyz = dcp::xyz_to_xyz (_frame->image (AV_PIX_FMT_RGB48LE, _burn_subtitles)); + xyz = dcp::xyz_to_xyz (_frame->image (AV_PIX_FMT_RGB48LE, _burn_subtitles, note)); } /* Set the max image and component sizes based on frame_rate */ diff --git a/src/lib/dcp_video.h b/src/lib/dcp_video.h index 9a6ae8d91..af4712b2b 100644 --- a/src/lib/dcp_video.h +++ b/src/lib/dcp_video.h @@ -26,7 +26,6 @@ * @brief A single frame of video destined for a DCP. */ -class Film; class ServerDescription; class Scaler; class Image; @@ -50,7 +49,7 @@ public: DCPVideo (boost::shared_ptr<const PlayerVideo>, int, int, int, Resolution, bool b, boost::shared_ptr<Log>); DCPVideo (boost::shared_ptr<const PlayerVideo>, cxml::ConstNodePtr, boost::shared_ptr<Log>); - boost::shared_ptr<EncodedData> encode_locally (); + boost::shared_ptr<EncodedData> encode_locally (dcp::NoteHandler note); boost::shared_ptr<EncodedData> encode_remotely (ServerDescription); int index () const { diff --git a/src/lib/encoder.cc b/src/lib/encoder.cc index da6c96905..6b520571a 100644 --- a/src/lib/encoder.cc +++ b/src/lib/encoder.cc @@ -127,7 +127,11 @@ Encoder::end () for (list<shared_ptr<DCPVideo> >::iterator i = _queue.begin(); i != _queue.end(); ++i) { LOG_GENERAL (N_("Encode left-over frame %1"), (*i)->index ()); try { - _writer->write ((*i)->encode_locally(), (*i)->index (), (*i)->eyes ()); + _writer->write ( + (*i)->encode_locally (boost::bind (&Log::dcp_log, _film->log().get(), _1, _2)), + (*i)->index (), + (*i)->eyes () + ); frame_done (); } catch (std::exception& e) { LOG_ERROR (N_("Local encode failed (%1)"), e.what ()); @@ -322,7 +326,7 @@ try } else { try { LOG_TIMING ("[%1] encoder thread begins local encode of %2", boost::this_thread::get_id(), vf->index()); - encoded = vf->encode_locally (); + encoded = vf->encode_locally (boost::bind (&Log::dcp_log, _film->log().get(), _1, _2)); LOG_TIMING ("[%1] encoder thread finishes local encode of %2", boost::this_thread::get_id(), vf->index()); } catch (std::exception& e) { LOG_ERROR (N_("Local encode failed (%1)"), e.what ()); diff --git a/src/lib/image_proxy.h b/src/lib/image_proxy.h index e2d86b8a7..39cbda27d 100644 --- a/src/lib/image_proxy.h +++ b/src/lib/image_proxy.h @@ -24,9 +24,11 @@ * @brief ImageProxy and subclasses. */ +#include <dcp/types.h> #include <Magick++.h> #include <libxml++/libxml++.h> #include <boost/shared_ptr.hpp> +#include <boost/optional.hpp> #include <boost/filesystem.hpp> class Image; @@ -58,7 +60,7 @@ public: virtual ~ImageProxy () {} /** @return Image (which must be aligned) */ - virtual boost::shared_ptr<Image> image () const = 0; + virtual boost::shared_ptr<Image> image (boost::optional<dcp::NoteHandler> note = boost::optional<dcp::NoteHandler> ()) const = 0; virtual void add_metadata (xmlpp::Node *) const = 0; virtual void send_binary (boost::shared_ptr<Socket>) const = 0; /** @return true if our image is definitely the same as another, false if it is probably not */ diff --git a/src/lib/j2k_image_proxy.cc b/src/lib/j2k_image_proxy.cc index 20bf70cf1..175f4c796 100644 --- a/src/lib/j2k_image_proxy.cc +++ b/src/lib/j2k_image_proxy.cc @@ -30,6 +30,7 @@ using std::string; using boost::shared_ptr; +using boost::optional; /** Construct a J2KImageProxy from a JPEG2000 file */ J2KImageProxy::J2KImageProxy (boost::filesystem::path path, dcp::Size size) @@ -74,12 +75,12 @@ J2KImageProxy::J2KImageProxy (shared_ptr<cxml::Node> xml, shared_ptr<Socket> soc } shared_ptr<Image> -J2KImageProxy::image () const +J2KImageProxy::image (optional<dcp::NoteHandler> note) const { shared_ptr<Image> image (new Image (PIX_FMT_RGB48LE, _size, false)); if (_mono) { - _mono->rgb_frame (reinterpret_cast<uint16_t*> (image->data()[0])); + _mono->rgb_frame (reinterpret_cast<uint16_t*> (image->data()[0]), note); } else { _stereo->rgb_frame (_eye, reinterpret_cast<uint16_t*> (image->data()[0])); } diff --git a/src/lib/j2k_image_proxy.h b/src/lib/j2k_image_proxy.h index 7790f617b..c2f04e176 100644 --- a/src/lib/j2k_image_proxy.h +++ b/src/lib/j2k_image_proxy.h @@ -30,7 +30,7 @@ public: 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; + boost::shared_ptr<Image> image (boost::optional<dcp::NoteHandler> note = boost::optional<dcp::NoteHandler> ()) const; void add_metadata (xmlpp::Node *) const; void send_binary (boost::shared_ptr<Socket>) const; diff --git a/src/lib/log.cc b/src/lib/log.cc index e0ba3aaaa..efea9f6b5 100644 --- a/src/lib/log.cc +++ b/src/lib/log.cc @@ -95,7 +95,23 @@ Log::microsecond_log (string m, int t) SafeStringStream s; s << tv.tv_sec << N_(":") << tv.tv_usec << N_(" ") << m; do_log (s.str ()); -} +} + +void +Log::dcp_log (dcp::NoteType type, string m) +{ + switch (type) { + case dcp::DCP_PROGRESS: + log (m, TYPE_GENERAL); + break; + case dcp::DCP_ERROR: + log (m, TYPE_ERROR); + break; + case dcp::DCP_NOTE: + log (m, TYPE_WARNING); + break; + } +} void Log::set_types (int t) diff --git a/src/lib/log.h b/src/lib/log.h index f14adc26f..f83c6a902 100644 --- a/src/lib/log.h +++ b/src/lib/log.h @@ -24,6 +24,7 @@ * @brief A very simple logging class. */ +#include <dcp/types.h> #include <boost/thread/mutex.hpp> #include <boost/filesystem.hpp> #include <boost/signals2.hpp> @@ -46,6 +47,7 @@ public: void log (std::string message, int type); void microsecond_log (std::string message, int type); + void dcp_log (dcp::NoteType type, std::string message); void set_types (int types); diff --git a/src/lib/magick_image_proxy.cc b/src/lib/magick_image_proxy.cc index e71ee4284..c9cddd899 100644 --- a/src/lib/magick_image_proxy.cc +++ b/src/lib/magick_image_proxy.cc @@ -29,6 +29,7 @@ using std::string; using std::cout; using boost::shared_ptr; +using boost::optional; using boost::dynamic_pointer_cast; MagickImageProxy::MagickImageProxy (boost::filesystem::path path) @@ -62,7 +63,7 @@ MagickImageProxy::MagickImageProxy (shared_ptr<cxml::Node>, shared_ptr<Socket> s } shared_ptr<Image> -MagickImageProxy::image () const +MagickImageProxy::image (optional<dcp::NoteHandler>) const { if (_image) { return _image; diff --git a/src/lib/magick_image_proxy.h b/src/lib/magick_image_proxy.h index 632fde8c7..7d2251aeb 100644 --- a/src/lib/magick_image_proxy.h +++ b/src/lib/magick_image_proxy.h @@ -25,7 +25,7 @@ public: MagickImageProxy (boost::filesystem::path); MagickImageProxy (boost::shared_ptr<cxml::Node> xml, boost::shared_ptr<Socket> socket); - boost::shared_ptr<Image> image () const; + boost::shared_ptr<Image> image (boost::optional<dcp::NoteHandler> note = boost::optional<dcp::NoteHandler> ()) const; void add_metadata (xmlpp::Node *) const; void send_binary (boost::shared_ptr<Socket>) const; bool same (boost::shared_ptr<const ImageProxy> other) const; diff --git a/src/lib/player_video.cc b/src/lib/player_video.cc index 94e6f3f2a..ccd52ea67 100644 --- a/src/lib/player_video.cc +++ b/src/lib/player_video.cc @@ -94,9 +94,9 @@ PlayerVideo::set_subtitle (PositionImage image) } shared_ptr<Image> -PlayerVideo::image (AVPixelFormat pixel_format, bool burn_subtitle) const +PlayerVideo::image (AVPixelFormat pixel_format, bool burn_subtitle, dcp::NoteHandler note) const { - shared_ptr<Image> im = _in->image (); + shared_ptr<Image> im = _in->image (optional<dcp::NoteHandler> (note)); Crop total_crop = _crop; switch (_part) { diff --git a/src/lib/player_video.h b/src/lib/player_video.h index 1468b7863..6762ea8d1 100644 --- a/src/lib/player_video.h +++ b/src/lib/player_video.h @@ -56,7 +56,7 @@ public: void set_subtitle (PositionImage); - boost::shared_ptr<Image> image (AVPixelFormat pix_fmt, bool burn_subtitle) const; + boost::shared_ptr<Image> image (AVPixelFormat pix_fmt, bool burn_subtitle, dcp::NoteHandler note) const; void add_metadata (xmlpp::Node* node, bool send_subtitles) const; void send_binary (boost::shared_ptr<Socket> socket, bool send_subtitles) const; diff --git a/src/lib/raw_image_proxy.cc b/src/lib/raw_image_proxy.cc index 8e8bf8824..8f05f5455 100644 --- a/src/lib/raw_image_proxy.cc +++ b/src/lib/raw_image_proxy.cc @@ -30,6 +30,7 @@ extern "C" { using std::string; using boost::shared_ptr; +using boost::optional; RawImageProxy::RawImageProxy (shared_ptr<Image> image) : _image (image) @@ -48,7 +49,7 @@ RawImageProxy::RawImageProxy (shared_ptr<cxml::Node> xml, shared_ptr<Socket> soc } shared_ptr<Image> -RawImageProxy::image () const +RawImageProxy::image (optional<dcp::NoteHandler>) const { return _image; } diff --git a/src/lib/raw_image_proxy.h b/src/lib/raw_image_proxy.h index a6f777eb3..51ffd4e98 100644 --- a/src/lib/raw_image_proxy.h +++ b/src/lib/raw_image_proxy.h @@ -28,7 +28,7 @@ public: RawImageProxy (boost::shared_ptr<Image>); RawImageProxy (boost::shared_ptr<cxml::Node> xml, boost::shared_ptr<Socket> socket); - boost::shared_ptr<Image> image () const; + boost::shared_ptr<Image> image (boost::optional<dcp::NoteHandler> note = boost::optional<dcp::NoteHandler> ()) const; void add_metadata (xmlpp::Node *) const; void send_binary (boost::shared_ptr<Socket>) const; diff --git a/src/lib/server.cc b/src/lib/server.cc index 3583a19c0..0212356f3 100644 --- a/src/lib/server.cc +++ b/src/lib/server.cc @@ -118,7 +118,7 @@ Server::process (shared_ptr<Socket> socket, struct timeval& after_read, struct t gettimeofday (&after_read, 0); - shared_ptr<EncodedData> encoded = dcp_video_frame.encode_locally (); + shared_ptr<EncodedData> encoded = dcp_video_frame.encode_locally (boost::bind (&Log::dcp_log, _log.get(), _1, _2)); gettimeofday (&after_encode, 0); diff --git a/src/tools/server_test.cc b/src/tools/server_test.cc index 9223efb3e..5cb1123b1 100644 --- a/src/tools/server_test.cc +++ b/src/tools/server_test.cc @@ -59,7 +59,7 @@ process_video (shared_ptr<PlayerVideo> pvf) ++frame_count; - shared_ptr<EncodedData> local_encoded = local->encode_locally (); + shared_ptr<EncodedData> local_encoded = local->encode_locally (boost::bind (&Log::dcp_log, log_.get(), _1, _2)); shared_ptr<EncodedData> remote_encoded; string remote_error; diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index de12564d7..21d4ae1fe 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -21,10 +21,6 @@ * @brief A wx widget to view a preview of a Film. */ -#include <iostream> -#include <iomanip> -#include <wx/tglbtn.h> -#include <dcp/exceptions.h> #include "lib/film.h" #include "lib/ratio.h" #include "lib/util.h" @@ -39,8 +35,13 @@ #include "lib/video_content.h" #include "lib/video_decoder.h" #include "lib/timer.h" +#include "lib/log.h" #include "film_viewer.h" #include "wx_util.h" +#include <dcp/exceptions.h> +#include <wx/tglbtn.h> +#include <iostream> +#include <iomanip> using std::string; using std::pair; @@ -179,7 +180,7 @@ FilmViewer::get (DCPTime p, bool accurate) if (!pvf.empty ()) { try { - _frame = pvf.front()->image (PIX_FMT_RGB24, true); + _frame = pvf.front()->image (PIX_FMT_RGB24, true, boost::bind (&Log::dcp_log, _film->log().get(), _1, _2)); _frame = _frame->scale (_frame->size(), Scaler::from_id ("fastbilinear"), PIX_FMT_RGB24, false); _position = pvf.front()->time (); _inter_position = pvf.front()->inter_position (); |
