Fix incorrect conversion of audio from DCP sources (#642).
[dcpomatic.git] / src / lib / util.cc
index 05eb3121ebe3946927e1b484b51ee2d748a0c065..dad094b6ee750e76d6697dd7663f865572f1b0d3 100644 (file)
@@ -40,6 +40,7 @@
 #include <dcp/picture_asset.h>
 #include <dcp/sound_asset.h>
 #include <dcp/subtitle_asset.h>
+#include <curl/curl.h>
 #include <glib.h>
 #include <pangomm/init.h>
 #include <boost/algorithm/string.hpp>
@@ -332,6 +333,8 @@ dcpomatic_setup ()
        CinemaSoundProcessor::setup_cinema_sound_processors ();
        AudioProcessor::setup_audio_processors ();
 
+       curl_global_init (CURL_GLOBAL_ALL);
+
        ui_thread = boost::this_thread::get_id ();
 }
 
@@ -440,19 +443,6 @@ md5_digest_head_tail (vector<boost::filesystem::path> files, boost::uintmax_t si
        return digester.get ();
 }
 
-/** @param An arbitrary audio frame rate.
- *  @return The appropriate DCP-approved frame rate (48kHz or 96kHz).
- */
-int
-dcp_audio_frame_rate (int fs)
-{
-       if (fs <= 48000) {
-               return 48000;
-       }
-
-       return 96000;
-}
-
 /** Round a number up to the nearest multiple of another number.
  *  @param c Index.
  *  @param s Array of numbers to round, indexed by c.
@@ -466,17 +456,6 @@ stride_round_up (int c, int const * stride, int t)
        return a - (a % t);
 }
 
-/** @param n A number.
- *  @param r Rounding `boundary' (must be a power of 2)
- *  @return n rounded to the nearest r
- */
-int
-round_to (float n, int r)
-{
-       DCPOMATIC_ASSERT (r == 1 || r == 2 || r == 4);
-       return int (n + float(r) / 2) &~ (r - 1);
-}
-
 /** Trip an assert if the caller is not in the UI thread */
 void
 ensure_ui_thread ()