From: Carl Hetherington Date: Wed, 15 Jul 2015 23:53:54 +0000 (+0100) Subject: float -> double in a few places. X-Git-Tag: v2.1.22~7 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=4a4725e41bf4070969223f9c40885063c50e61d0 float -> double in a few places. --- diff --git a/doc/design/dcpomatic.svg b/doc/design/dcpomatic.svg index 3d1cc7b94..f1b61f8c1 100644 --- a/doc/design/dcpomatic.svg +++ b/doc/design/dcpomatic.svg @@ -218,16 +218,16 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="1.1598677" - inkscape:cx="652.92066" - inkscape:cy="674.81101" + inkscape:zoom="3.0258297" + inkscape:cx="295.32748" + inkscape:cy="1324.6833" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" - inkscape:window-width="1366" - inkscape:window-height="714" + inkscape:window-width="1280" + inkscape:window-height="997" inkscape:window-x="1280" - inkscape:window-y="283" + inkscape:window-y="0" inkscape:window-maximized="1" showguides="true" inkscape:guide-bbox="true" /> @@ -239,7 +239,7 @@ image/svg+xml - + @@ -651,12 +651,71 @@ id="path6726-3" inkscape:connector-curvature="0" sodipodi:nodetypes="cc" /> - + + Class + + method() + Method description + Class description. + ); - boost::optional video_frame_rate () const { + boost::optional video_frame_rate () const { return _video_frame_rate; } @@ -72,7 +72,7 @@ public: } private: - boost::optional _video_frame_rate; + boost::optional _video_frame_rate; boost::optional _video_size; Frame _video_length; boost::optional _audio_channels; diff --git a/src/lib/ffmpeg_examiner.cc b/src/lib/ffmpeg_examiner.cc index f4b650eee..bcc5a86a6 100644 --- a/src/lib/ffmpeg_examiner.cc +++ b/src/lib/ffmpeg_examiner.cc @@ -191,7 +191,7 @@ FFmpegExaminer::frame_time (AVStream* s) const return t; } -optional +optional FFmpegExaminer::video_frame_rate () const { /* This use of r_frame_rate is debateable; there's a few different @@ -214,15 +214,15 @@ FFmpegExaminer::video_length () const return max (Frame (1), _video_length); } -optional +optional FFmpegExaminer::sample_aspect_ratio () const { AVRational sar = av_guess_sample_aspect_ratio (_format_context, _format_context->streams[_video_stream], 0); if (sar.num == 0) { /* I assume this means that we don't know */ - return optional (); + return optional (); } - return float (sar.num) / sar.den; + return double (sar.num) / sar.den; } string diff --git a/src/lib/ffmpeg_examiner.h b/src/lib/ffmpeg_examiner.h index 795a9c6ff..96720b280 100644 --- a/src/lib/ffmpeg_examiner.h +++ b/src/lib/ffmpeg_examiner.h @@ -31,10 +31,10 @@ class FFmpegExaminer : public FFmpeg, public VideoExaminer public: FFmpegExaminer (boost::shared_ptr, boost::shared_ptr job = boost::shared_ptr ()); - boost::optional video_frame_rate () const; + boost::optional video_frame_rate () const; dcp::Size video_size () const; Frame video_length () const; - boost::optional sample_aspect_ratio () const; + boost::optional sample_aspect_ratio () const; std::vector > subtitle_streams () const { return _subtitle_streams; diff --git a/src/lib/image_examiner.cc b/src/lib/image_examiner.cc index 79c9f727c..6ad32f511 100644 --- a/src/lib/image_examiner.cc +++ b/src/lib/image_examiner.cc @@ -80,9 +80,9 @@ ImageExaminer::video_size () const return _video_size.get (); } -optional +optional ImageExaminer::video_frame_rate () const { /* Don't know */ - return optional (); + return optional (); } diff --git a/src/lib/image_examiner.h b/src/lib/image_examiner.h index 937a565f3..f159e38f9 100644 --- a/src/lib/image_examiner.h +++ b/src/lib/image_examiner.h @@ -30,7 +30,7 @@ class ImageExaminer : public VideoExaminer public: ImageExaminer (boost::shared_ptr, boost::shared_ptr, boost::shared_ptr); - boost::optional video_frame_rate () const; + boost::optional video_frame_rate () const; dcp::Size video_size () const; Frame video_length () const { return _video_length; diff --git a/src/lib/player.cc b/src/lib/player.cc index 0a4eb54e7..b00df4e23 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -309,7 +309,7 @@ Player::black_player_video_frame (DCPTime time) const shared_ptr (new RawImageProxy (_black_image)), time, Crop (), - optional (), + optional (), _video_container_size, _video_container_size, EYES_BOTH, @@ -524,6 +524,10 @@ Player::dcp_to_content_video (shared_ptr piece, DCPTime t) const shared_ptr vc = dynamic_pointer_cast (piece->content); DCPTime s = t - piece->content->position (); s = min (piece->content->length_after_trim(), s); + std::cout << "s=" << s << " " << ContentTime(s, piece->frc) << "\n"; + std::cout << (ContentTime (s, piece->frc) + piece->content->trim_start ()) << "\n"; + std::cout << s.get() << "\n"; + std::cout << (s.get() * 24.0 / 96000) << "\n"; return max (ContentTime (), ContentTime (s, piece->frc) + piece->content->trim_start ()).frames (vc->video_frame_rate ()); } diff --git a/src/lib/player_video.cc b/src/lib/player_video.cc index 2b1e85fc9..018f04737 100644 --- a/src/lib/player_video.cc +++ b/src/lib/player_video.cc @@ -34,7 +34,7 @@ PlayerVideo::PlayerVideo ( shared_ptr in, DCPTime time, Crop crop, - boost::optional fade, + boost::optional fade, dcp::Size inter_size, dcp::Size out_size, Eyes eyes, @@ -58,7 +58,7 @@ PlayerVideo::PlayerVideo (shared_ptr node, shared_ptr socket { _time = DCPTime (node->number_child ("Time")); _crop = Crop (node); - _fade = node->optional_number_child ("Fade"); + _fade = node->optional_number_child ("Fade"); _inter_size = dcp::Size (node->number_child ("InterWidth"), node->number_child ("InterHeight")); _out_size = dcp::Size (node->number_child ("OutWidth"), node->number_child ("OutHeight")); diff --git a/src/lib/player_video.h b/src/lib/player_video.h index 0dcc2eeec..0a6cab906 100644 --- a/src/lib/player_video.h +++ b/src/lib/player_video.h @@ -42,7 +42,7 @@ public: boost::shared_ptr, DCPTime, Crop, - boost::optional, + boost::optional, dcp::Size, dcp::Size, Eyes, @@ -88,7 +88,7 @@ private: boost::shared_ptr _in; DCPTime _time; Crop _crop; - boost::optional _fade; + boost::optional _fade; dcp::Size _inter_size; dcp::Size _out_size; Eyes _eyes; diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index e2fba5829..1c0bc5a60 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -103,10 +103,10 @@ VideoContent::VideoContent (shared_ptr film, cxml::ConstNodePtr node { _video_size.width = node->number_child ("VideoWidth"); _video_size.height = node->number_child ("VideoHeight"); - _video_frame_rate = node->number_child ("VideoFrameRate"); + _video_frame_rate = node->number_child ("VideoFrameRate"); _video_length = node->number_child ("VideoLength"); _video_frame_type = static_cast (node->number_child ("VideoFrameType")); - _sample_aspect_ratio = node->optional_number_child ("SampleAspectRatio"); + _sample_aspect_ratio = node->optional_number_child ("SampleAspectRatio"); _crop.left = node->number_child ("LeftCrop"); _crop.right = node->number_child ("RightCrop"); _crop.top = node->number_child ("TopCrop"); @@ -218,9 +218,9 @@ VideoContent::take_from_video_examiner (shared_ptr d) { /* These examiner calls could call other content methods which take a lock on the mutex */ dcp::Size const vs = d->video_size (); - optional const vfr = d->video_frame_rate (); + optional const vfr = d->video_frame_rate (); Frame vl = d->video_length (); - optional const ar = d->sample_aspect_ratio (); + optional const ar = d->sample_aspect_ratio (); { boost::mutex::scoped_lock lm (_mutex); @@ -232,7 +232,7 @@ VideoContent::take_from_video_examiner (shared_ptr d) /* Guess correct scale from size and sample aspect ratio */ _scale = VideoContentScale ( - Ratio::nearest_from_ratio (float (_video_size.width) * ar.get_value_or (1) / _video_size.height) + Ratio::nearest_from_ratio (double (_video_size.width) * ar.get_value_or (1) / _video_size.height) ); } @@ -473,7 +473,7 @@ VideoContent::scale_and_crop_to_fit_height () } void -VideoContent::set_video_frame_rate (float r) +VideoContent::set_video_frame_rate (double r) { { boost::mutex::scoped_lock lm (_mutex); @@ -487,21 +487,21 @@ VideoContent::set_video_frame_rate (float r) signal_changed (VideoContentProperty::VIDEO_FRAME_RATE); } -optional +optional VideoContent::fade (Frame f) const { DCPOMATIC_ASSERT (f >= 0); if (f < fade_in()) { - return float (f) / fade_in(); + return double (f) / fade_in(); } Frame fade_out_start = video_length() - fade_out(); if (f >= fade_out_start) { - return 1 - float (f - fade_out_start) / fade_out(); + return 1 - double (f - fade_out_start) / fade_out(); } - return optional (); + return optional (); } string @@ -518,7 +518,7 @@ VideoContent::processing_description () const ); - float ratio = video_size_after_3d_split().ratio (); + double ratio = video_size_after_3d_split().ratio (); if (sample_aspect_ratio ()) { d << ", " << _("pixel aspect ratio") << " " << fixed << setprecision(2) << sample_aspect_ratio().get () << ":1"; diff --git a/src/lib/video_content.h b/src/lib/video_content.h index 71c20e737..fdd274985 100644 --- a/src/lib/video_content.h +++ b/src/lib/video_content.h @@ -74,13 +74,13 @@ public: return _video_size; } - float video_frame_rate () const { + double video_frame_rate () const { boost::mutex::scoped_lock lm (_mutex); return _video_frame_rate; } void set_video_frame_type (VideoFrameType); - void set_video_frame_rate (float); + void set_video_frame_rate (double); void set_left_crop (int); void set_right_crop (int); @@ -135,7 +135,7 @@ public: return _colour_conversion; } - boost::optional sample_aspect_ratio () const { + boost::optional sample_aspect_ratio () const { boost::mutex::scoped_lock lm (_mutex); return _sample_aspect_ratio; } @@ -155,7 +155,7 @@ public: ContentTime dcp_time_to_content_time (DCPTime) const; - boost::optional fade (Frame) const; + boost::optional fade (Frame) const; void scale_and_crop_to_fit_width (); void scale_and_crop_to_fit_height (); @@ -167,7 +167,7 @@ protected: void add_properties (std::list > &) const; Frame _video_length; - float _video_frame_rate; + double _video_frame_rate; boost::optional _colour_conversion; private: @@ -185,7 +185,7 @@ private: /** Sample aspect ratio obtained from the content file's header, if there is one. */ - boost::optional _sample_aspect_ratio; + boost::optional _sample_aspect_ratio; Frame _fade_in; Frame _fade_out; }; diff --git a/src/lib/video_examiner.h b/src/lib/video_examiner.h index f8d247d15..66d3ae5b5 100644 --- a/src/lib/video_examiner.h +++ b/src/lib/video_examiner.h @@ -32,10 +32,10 @@ class VideoExaminer { public: virtual ~VideoExaminer () {} - virtual boost::optional video_frame_rate () const = 0; + virtual boost::optional video_frame_rate () const = 0; virtual dcp::Size video_size () const = 0; virtual Frame video_length () const = 0; - virtual boost::optional sample_aspect_ratio () const { - return boost::optional (); + virtual boost::optional sample_aspect_ratio () const { + return boost::optional (); } }; diff --git a/test/client_server_test.cc b/test/client_server_test.cc index 99cc845bc..e326e00fb 100644 --- a/test/client_server_test.cc +++ b/test/client_server_test.cc @@ -85,7 +85,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_rgb) shared_ptr (new RawImageProxy (image)), DCPTime (), Crop (), - optional (), + optional (), dcp::Size (1998, 1080), dcp::Size (1998, 1080), EYES_BOTH, @@ -166,7 +166,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_yuv) shared_ptr (new RawImageProxy (image)), DCPTime (), Crop (), - optional (), + optional (), dcp::Size (1998, 1080), dcp::Size (1998, 1080), EYES_BOTH,