From a5095486e606adfe36de635a48710cf98872c1c6 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 3 Jan 2015 23:08:27 +0000 Subject: [PATCH 1/1] Various libdcp API changes. --- src/lib/colour_conversion.cc | 15 ++++++++------- src/lib/dcp_examiner.cc | 6 +++--- src/lib/image.cc | 4 ++-- src/lib/image.h | 4 ++-- src/lib/j2k_image_proxy.cc | 6 +++--- src/lib/render_subtitles.cc | 6 +++--- src/lib/subrip_decoder.cc | 4 ++-- src/lib/subrip_subtitle.h | 2 +- src/wx/colour_conversion_editor.cc | 4 +++- 9 files changed, 27 insertions(+), 24 deletions(-) diff --git a/src/lib/colour_conversion.cc b/src/lib/colour_conversion.cc index 32bc3c1a5..6b3d3b0f1 100644 --- a/src/lib/colour_conversion.cc +++ b/src/lib/colour_conversion.cc @@ -58,14 +58,15 @@ ColourConversion::ColourConversion (cxml::NodePtr node) cxml::ConstNodePtr in_node = node->node_child ("InputTransferFunction"); string in_type = in_node->string_child ("Type"); if (in_type == "Gamma") { - _in.reset (new dcp::GammaTransferFunction (in_node->number_child ("Gamma"))); + _in.reset (new dcp::GammaTransferFunction (false, in_node->number_child ("Gamma"))); } else if (in_type == "ModifiedGamma") { _in.reset (new dcp::ModifiedGammaTransferFunction ( - in_node->number_child ("Power"), - in_node->number_child ("Threshold"), - in_node->number_child ("A"), - in_node->number_child ("B") - )); + false, + in_node->number_child ("Power"), + in_node->number_child ("Threshold"), + in_node->number_child ("A"), + in_node->number_child ("B") + )); } list m = node->node_children ("Matrix"); @@ -75,7 +76,7 @@ ColourConversion::ColourConversion (cxml::NodePtr node) _matrix(ti, tj) = raw_convert ((*i)->content ()); } - _out.reset (new dcp::GammaTransferFunction (node->number_child ("OutputGamma"))); + _out.reset (new dcp::GammaTransferFunction (true, node->number_child ("OutputGamma"))); } boost::optional diff --git a/src/lib/dcp_examiner.cc b/src/lib/dcp_examiner.cc index 052c8bd76..de7e95399 100644 --- a/src/lib/dcp_examiner.cc +++ b/src/lib/dcp_examiner.cc @@ -117,12 +117,12 @@ DCPExaminer::DCPExaminer (shared_ptr content) shared_ptr mono = dynamic_pointer_cast (mxf); shared_ptr stereo = dynamic_pointer_cast (mxf); - shared_ptr image (new Image (PIX_FMT_RGB24, _video_size.get(), false)); + shared_ptr image (new Image (PIX_FMT_RGB48LE, _video_size.get(), false)); if (mono) { - mono->get_frame(0)->rgb_frame (image->data()[0]); + mono->get_frame(0)->rgb_frame (reinterpret_cast (image->data()[0])); } else { - stereo->get_frame(0)->rgb_frame (dcp::EYE_LEFT, image->data()[0]); + stereo->get_frame(0)->rgb_frame (dcp::EYE_LEFT, reinterpret_cast (image->data()[0])); } } diff --git a/src/lib/image.cc b/src/lib/image.cc index 847ad1046..ffe9f3e0b 100644 --- a/src/lib/image.cc +++ b/src/lib/image.cc @@ -660,7 +660,7 @@ Image::~Image () av_free (_stride); } -uint8_t ** +uint8_t * const * Image::data () const { return _data; @@ -672,7 +672,7 @@ Image::line_size () const return _line_size; } -int * +int const * Image::stride () const { return _stride; diff --git a/src/lib/image.h b/src/lib/image.h index 8ca6aae09..22f3f6e50 100644 --- a/src/lib/image.h +++ b/src/lib/image.h @@ -48,9 +48,9 @@ public: Image& operator= (Image const &); ~Image (); - uint8_t ** data () const; + uint8_t * const * data () const; int * line_size () const; - int * stride () const; + int const * stride () const; dcp::Size size () const; bool aligned () const; diff --git a/src/lib/j2k_image_proxy.cc b/src/lib/j2k_image_proxy.cc index 9312a7763..20bf70cf1 100644 --- a/src/lib/j2k_image_proxy.cc +++ b/src/lib/j2k_image_proxy.cc @@ -76,12 +76,12 @@ J2KImageProxy::J2KImageProxy (shared_ptr xml, shared_ptr soc shared_ptr J2KImageProxy::image () const { - shared_ptr image (new Image (PIX_FMT_RGB24, _size, false)); + shared_ptr image (new Image (PIX_FMT_RGB48LE, _size, false)); if (_mono) { - _mono->rgb_frame (image->data()[0]); + _mono->rgb_frame (reinterpret_cast (image->data()[0])); } else { - _stereo->rgb_frame (_eye, image->data()[0]); + _stereo->rgb_frame (_eye, reinterpret_cast (image->data()[0])); } return shared_ptr (new Image (image, true)); diff --git a/src/lib/render_subtitles.cc b/src/lib/render_subtitles.cc index b2900d27a..4ff28df6a 100644 --- a/src/lib/render_subtitles.cc +++ b/src/lib/render_subtitles.cc @@ -119,7 +119,7 @@ render_subtitles (list subtitles, dcp::Size target) if (i->effect() == dcp::SHADOW) { /* Drop-shadow effect */ - dcp::Color const ec = i->effect_color (); + dcp::Colour const ec = i->effect_colour (); context->set_source_rgba (float(ec.r) / 255, float(ec.g) / 255, float(ec.b) / 255, fade_factor); context->move_to (x + 4, y + 4); layout->add_to_cairo_context (context); @@ -128,7 +128,7 @@ render_subtitles (list subtitles, dcp::Size target) /* The actual subtitle */ context->move_to (x, y); - dcp::Color const c = i->color (); + dcp::Colour const c = i->colour (); context->set_source_rgba (float(c.r) / 255, float(c.g) / 255, float(c.b) / 255, fade_factor); layout->add_to_cairo_context (context); context->fill (); @@ -136,7 +136,7 @@ render_subtitles (list subtitles, dcp::Size target) if (i->effect() == dcp::BORDER) { /* Border effect */ context->move_to (x, y); - dcp::Color ec = i->effect_color (); + dcp::Colour ec = i->effect_colour (); context->set_source_rgba (float(ec.r) / 255, float(ec.g) / 255, float(ec.b) / 255, fade_factor); layout->add_to_cairo_context (context); context->stroke (); diff --git a/src/lib/subrip_decoder.cc b/src/lib/subrip_decoder.cc index 77c3f16a5..0ef747cf1 100644 --- a/src/lib/subrip_decoder.cc +++ b/src/lib/subrip_decoder.cc @@ -62,7 +62,7 @@ SubRipDecoder::pass () dcp::SubtitleString ( SubRipContent::font_id, j->italic, - dcp::Color (255, 255, 255), + dcp::Colour (255, 255, 255), j->font_size.points (72 * 11), dcp::Time (rint (_subtitles[_next].from.metric().get().all_as_milliseconds() / 4)), dcp::Time (rint (_subtitles[_next].to.metric().get().all_as_milliseconds() / 4)), @@ -70,7 +70,7 @@ SubRipDecoder::pass () dcp::TOP, j->text, dcp::NONE, - dcp::Color (255, 255, 255), + dcp::Colour (255, 255, 255), 0, 0 ) diff --git a/src/lib/subrip_subtitle.h b/src/lib/subrip_subtitle.h index 6fd0bdf74..d4d27e140 100644 --- a/src/lib/subrip_subtitle.h +++ b/src/lib/subrip_subtitle.h @@ -37,7 +37,7 @@ struct SubRipSubtitlePiece bool bold; bool italic; bool underline; - dcp::Color color; + dcp::Colour color; }; struct SubRipSubtitle diff --git a/src/wx/colour_conversion_editor.cc b/src/wx/colour_conversion_editor.cc index e11c09f17..4658716c6 100644 --- a/src/wx/colour_conversion_editor.cc +++ b/src/wx/colour_conversion_editor.cc @@ -171,6 +171,7 @@ ColourConversionEditor::get () const conversion.set_in ( shared_ptr ( new dcp::ModifiedGammaTransferFunction ( + false, _input_power->GetValue (), raw_convert (wx_to_std (_input_threshold->GetValue ())), raw_convert (wx_to_std (_input_A->GetValue ())), @@ -182,6 +183,7 @@ ColourConversionEditor::get () const conversion.set_in ( shared_ptr ( new dcp::GammaTransferFunction ( + false, _input_gamma->GetValue () ) ) @@ -202,7 +204,7 @@ ColourConversionEditor::get () const conversion.set_matrix (matrix); - conversion.set_out (shared_ptr (new dcp::GammaTransferFunction (_output_gamma->GetValue ()))); + conversion.set_out (shared_ptr (new dcp::GammaTransferFunction (true, _output_gamma->GetValue ()))); return conversion; } -- 2.30.2