Ignore and report failures to decode frames during playback (#1593).
[dcpomatic.git] / src / lib / util.cc
index 234c22246174ed0279be9b40b7fefeb47b46711b..d04bbdf24cc8b0948b6c45c18591d39f117c1150 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -927,7 +927,7 @@ emit_subtitle_image (ContentTimePeriod period, dcp::SubtitleImage sub, dcp::Size
 {
        /* XXX: this is rather inefficient; decoding the image just to get its size */
        FFmpegImageProxy proxy (sub.png_image());
-       shared_ptr<Image> image = proxy.image().first;
+       shared_ptr<Image> image = proxy.image().image;
        /* set up rect with height and width */
        dcpomatic::Rect<double> rect(0, 0, image->size().width / double(size.width), image->size().height / double(size.height));
 
@@ -967,7 +967,7 @@ show_jobs_on_console (bool progress)
        bool error = false;
        while (true) {
 
-               dcpomatic_sleep (5);
+               dcpomatic_sleep_seconds (5);
 
                list<shared_ptr<Job> > jobs = JobManager::instance()->get();
 
@@ -1171,3 +1171,16 @@ write_swaroop_chain (shared_ptr<const dcp::CertificateChain> chain, boost::files
 }
 
 #endif
+
+double
+db_to_linear (double db)
+{
+       return pow(10, db / 20);
+}
+
+double
+linear_to_db (double linear)
+{
+       return 20 * log10(linear);
+}
+