summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-07-16 00:53:54 +0100
committerCarl Hetherington <cth@carlh.net>2015-07-16 00:53:54 +0100
commit4a4725e41bf4070969223f9c40885063c50e61d0 (patch)
tree7c8896f8080b7bf66773d5b63ded45b83b675712
parent6300edd66433dffed9fb30a0b3b8db7ca3355809 (diff)
float -> double in a few places.
-rw-r--r--doc/design/dcpomatic.svg85
-rw-r--r--src/lib/dcp_examiner.h4
-rw-r--r--src/lib/ffmpeg_examiner.cc8
-rw-r--r--src/lib/ffmpeg_examiner.h4
-rw-r--r--src/lib/image_examiner.cc4
-rw-r--r--src/lib/image_examiner.h2
-rw-r--r--src/lib/player.cc6
-rw-r--r--src/lib/player_video.cc4
-rw-r--r--src/lib/player_video.h4
-rw-r--r--src/lib/video_content.cc22
-rw-r--r--src/lib/video_content.h12
-rw-r--r--src/lib/video_examiner.h6
-rw-r--r--test/client_server_test.cc4
13 files changed, 114 insertions, 51 deletions
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 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
+ <dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
@@ -651,12 +651,71 @@
id="path6726-3"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
- <path
- style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 4;stroke-dashoffset:0"
- d="m 623.11641,26.2839 0,431.46391"
- id="path7445"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="cc" />
+ <rect
+ style="color:#000000;fill:none;stroke:#0000ff;stroke-width:0.99999988px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect2985-0-3"
+ width="139"
+ height="98.153183"
+ x="193.67656"
+ y="-344.28204" />
+ <text
+ xml:space="preserve"
+ style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#0000ff;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+ x="202.67656"
+ y="-328.79272"
+ id="text2987-4-2"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan2989-9-1"
+ x="202.67656"
+ y="-328.79272">Class</tspan></text>
+ <rect
+ style="color:#000000;fill:none;stroke:#0000ff;stroke-width:0.99999988px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect2991-8-1"
+ width="139"
+ height="24"
+ x="193.67656"
+ y="-344.28204" />
+ <text
+ xml:space="preserve"
+ style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ff0000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+ x="203.29256"
+ y="-278.13858"
+ id="text2993-9-50"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ x="203.29256"
+ y="-278.13858"
+ id="tspan2997-9-6">method()</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#008000;fill-opacity:1;stroke:none;font-family:Latin Modern Roman;-inkscape-font-specification:Latin Modern Roman"
+ x="202.94057"
+ y="-264.99423"
+ id="text2999-7-6"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ x="202.94057"
+ y="-264.99423"
+ id="tspan6126-5">Method description</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:125%;letter-spacing:0px;word-spacing:0px;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000080;fill-opacity:1;fill-rule:nonzero;stroke:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Latin Modern Roman;-inkscape-font-specification:Latin Modern Roman"
+ x="202.78856"
+ y="-305.98245"
+ id="text3438"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan3440"
+ x="202.78856"
+ y="-305.98245">Class description.</tspan></text>
+ <rect
+ style="color:#000000;fill:none;stroke:#0000ff;stroke-width:0.99999988px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect2991-8-1-2"
+ width="139"
+ height="24"
+ x="193.67656"
+ y="-320.29883" />
</g>
<g
inkscape:groupmode="layer"
diff --git a/src/lib/dcp_examiner.h b/src/lib/dcp_examiner.h
index ed457b5c2..532bad60c 100644
--- a/src/lib/dcp_examiner.h
+++ b/src/lib/dcp_examiner.h
@@ -31,7 +31,7 @@ class DCPExaminer : public VideoExaminer, public AudioExaminer
public:
DCPExaminer (boost::shared_ptr<const DCPContent>);
- boost::optional<float> video_frame_rate () const {
+ boost::optional<double> video_frame_rate () const {
return _video_frame_rate;
}
@@ -72,7 +72,7 @@ public:
}
private:
- boost::optional<float> _video_frame_rate;
+ boost::optional<double> _video_frame_rate;
boost::optional<dcp::Size> _video_size;
Frame _video_length;
boost::optional<int> _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<float>
+optional<double>
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<float>
+optional<double>
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<float> ();
+ return optional<double> ();
}
- 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<const FFmpegContent>, boost::shared_ptr<Job> job = boost::shared_ptr<Job> ());
- boost::optional<float> video_frame_rate () const;
+ boost::optional<double> video_frame_rate () const;
dcp::Size video_size () const;
Frame video_length () const;
- boost::optional<float> sample_aspect_ratio () const;
+ boost::optional<double> sample_aspect_ratio () const;
std::vector<boost::shared_ptr<FFmpegSubtitleStream> > 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<float>
+optional<double>
ImageExaminer::video_frame_rate () const
{
/* Don't know */
- return optional<float> ();
+ return optional<double> ();
}
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<const Film>, boost::shared_ptr<const ImageContent>, boost::shared_ptr<Job>);
- boost::optional<float> video_frame_rate () const;
+ boost::optional<double> 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<const ImageProxy> (new RawImageProxy (_black_image)),
time,
Crop (),
- optional<float> (),
+ optional<double> (),
_video_container_size,
_video_container_size,
EYES_BOTH,
@@ -524,6 +524,10 @@ Player::dcp_to_content_video (shared_ptr<const Piece> piece, DCPTime t) const
shared_ptr<const VideoContent> vc = dynamic_pointer_cast<const VideoContent> (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<const ImageProxy> in,
DCPTime time,
Crop crop,
- boost::optional<float> fade,
+ boost::optional<double> fade,
dcp::Size inter_size,
dcp::Size out_size,
Eyes eyes,
@@ -58,7 +58,7 @@ PlayerVideo::PlayerVideo (shared_ptr<cxml::Node> node, shared_ptr<Socket> socket
{
_time = DCPTime (node->number_child<DCPTime::Type> ("Time"));
_crop = Crop (node);
- _fade = node->optional_number_child<float> ("Fade");
+ _fade = node->optional_number_child<double> ("Fade");
_inter_size = dcp::Size (node->number_child<int> ("InterWidth"), node->number_child<int> ("InterHeight"));
_out_size = dcp::Size (node->number_child<int> ("OutWidth"), node->number_child<int> ("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<const ImageProxy>,
DCPTime,
Crop,
- boost::optional<float>,
+ boost::optional<double>,
dcp::Size,
dcp::Size,
Eyes,
@@ -88,7 +88,7 @@ private:
boost::shared_ptr<const ImageProxy> _in;
DCPTime _time;
Crop _crop;
- boost::optional<float> _fade;
+ boost::optional<double> _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<const Film> film, cxml::ConstNodePtr node
{
_video_size.width = node->number_child<int> ("VideoWidth");
_video_size.height = node->number_child<int> ("VideoHeight");
- _video_frame_rate = node->number_child<float> ("VideoFrameRate");
+ _video_frame_rate = node->number_child<double> ("VideoFrameRate");
_video_length = node->number_child<Frame> ("VideoLength");
_video_frame_type = static_cast<VideoFrameType> (node->number_child<int> ("VideoFrameType"));
- _sample_aspect_ratio = node->optional_number_child<float> ("SampleAspectRatio");
+ _sample_aspect_ratio = node->optional_number_child<double> ("SampleAspectRatio");
_crop.left = node->number_child<int> ("LeftCrop");
_crop.right = node->number_child<int> ("RightCrop");
_crop.top = node->number_child<int> ("TopCrop");
@@ -218,9 +218,9 @@ VideoContent::take_from_video_examiner (shared_ptr<VideoExaminer> d)
{
/* These examiner calls could call other content methods which take a lock on the mutex */
dcp::Size const vs = d->video_size ();
- optional<float> const vfr = d->video_frame_rate ();
+ optional<double> const vfr = d->video_frame_rate ();
Frame vl = d->video_length ();
- optional<float> const ar = d->sample_aspect_ratio ();
+ optional<double> const ar = d->sample_aspect_ratio ();
{
boost::mutex::scoped_lock lm (_mutex);
@@ -232,7 +232,7 @@ VideoContent::take_from_video_examiner (shared_ptr<VideoExaminer> 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<float>
+optional<double>
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<float> ();
+ return optional<double> ();
}
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<float> sample_aspect_ratio () const {
+ boost::optional<double> 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<float> fade (Frame) const;
+ boost::optional<double> 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<std::pair<std::string, std::string> > &) const;
Frame _video_length;
- float _video_frame_rate;
+ double _video_frame_rate;
boost::optional<ColourConversion> _colour_conversion;
private:
@@ -185,7 +185,7 @@ private:
/** Sample aspect ratio obtained from the content file's header,
if there is one.
*/
- boost::optional<float> _sample_aspect_ratio;
+ boost::optional<double> _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<float> video_frame_rate () const = 0;
+ virtual boost::optional<double> video_frame_rate () const = 0;
virtual dcp::Size video_size () const = 0;
virtual Frame video_length () const = 0;
- virtual boost::optional<float> sample_aspect_ratio () const {
- return boost::optional<float> ();
+ virtual boost::optional<double> sample_aspect_ratio () const {
+ return boost::optional<double> ();
}
};
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<ImageProxy> (new RawImageProxy (image)),
DCPTime (),
Crop (),
- optional<float> (),
+ optional<double> (),
dcp::Size (1998, 1080),
dcp::Size (1998, 1080),
EYES_BOTH,
@@ -166,7 +166,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_yuv)
shared_ptr<ImageProxy> (new RawImageProxy (image)),
DCPTime (),
Crop (),
- optional<float> (),
+ optional<double> (),
dcp::Size (1998, 1080),
dcp::Size (1998, 1080),
EYES_BOTH,