Replace aligned bool with enum Alignment.
[dcpomatic.git] / src / lib / util.cc
index 8a039764d0a77f4bec576e579b4b801c2f211ba3..981cfa521eda35957eec466f8225f510f9c11506 100644 (file)
  *  @brief Some utility functions and classes.
  */
 
-#include "util.h"
-#include "exceptions.h"
-#include "dcp_content_type.h"
-#include "filter.h"
+
+#define UNICODE 1
+
+
+#include "audio_buffers.h"
+#include "audio_processor.h"
 #include "cinema_sound_processor.h"
+#include "compose.hpp"
 #include "config.h"
-#include "ratio.h"
-#include "job.h"
 #include "cross.h"
-#include "video_content.h"
-#include "rect.h"
-#include "digester.h"
-#include "audio_processor.h"
 #include "crypto.h"
-#include "compose.hpp"
-#include "audio_buffers.h"
-#include "string_text.h"
-#include "font.h"
-#include "render_text.h"
+#include "dcp_content_type.h"
+#include "digester.h"
+#include "exceptions.h"
 #include "ffmpeg_image_proxy.h"
+#include "filter.h"
+#include "font.h"
 #include "image.h"
-#include "text_decoder.h"
+#include "job.h"
 #include "job_manager.h"
+#include "ratio.h"
+#include "rect.h"
+#include "render_text.h"
+#include "string_text.h"
+#include "text_decoder.h"
+#include "util.h"
+#include "video_content.h"
 #include "warnings.h"
 #include <dcp/decrypted_kdm.h>
 #include <dcp/locale_convert.h>
 #include <dcp/sound_asset.h>
 #include <dcp/subtitle_asset.h>
 #include <dcp/atmos_asset.h>
+DCPOMATIC_DISABLE_WARNINGS
 extern "C" {
 #include <libavfilter/avfilter.h>
 #include <libavformat/avformat.h>
 #include <libavcodec/avcodec.h>
 }
+DCPOMATIC_ENABLE_WARNINGS
 #include <curl/curl.h>
 #include <glib.h>
 #include <pangomm/init.h>
@@ -89,25 +95,23 @@ DCPOMATIC_ENABLE_WARNINGS
 
 #include "i18n.h"
 
-using std::string;
-using std::wstring;
-using std::setfill;
-using std::ostream;
+
+using std::bad_alloc;
+using std::cout;
 using std::endl;
-using std::vector;
-using std::min;
-using std::max;
-using std::map;
-using std::list;
-using std::multimap;
 using std::istream;
+using std::list;
+using std::make_pair;
+using std::make_shared;
+using std::map;
+using std::min;
+using std::ostream;
 using std::pair;
-using std::cout;
-using std::bad_alloc;
 using std::set_terminate;
-using std::make_pair;
 using std::shared_ptr;
-using std::make_shared;
+using std::string;
+using std::vector;
+using std::wstring;
 using boost::thread;
 using boost::optional;
 using boost::lexical_cast;
@@ -118,6 +122,7 @@ using dcp::raw_convert;
 using dcp::locale_convert;
 using namespace dcpomatic;
 
+
 /** Path to our executable, required by the stacktrace stuff and filled
  *  in during App::onInit().
  */
@@ -365,10 +370,12 @@ dcpomatic_setup ()
        SetUnhandledExceptionFilter(exception_handler);
 #endif
 
+#ifdef DCPOMATIC_HAVE_AVREGISTER
 DCPOMATIC_DISABLE_WARNINGS
        av_register_all ();
        avfilter_register_all ();
 DCPOMATIC_ENABLE_WARNINGS
+#endif
 
 #ifdef DCPOMATIC_OSX
        /* Add our library directory to the libltdl search path so that
@@ -595,7 +602,7 @@ short_audio_channel_name (int c)
                _("BsR"),
                _("DBP"),
                _("DBS"),
-               "",
+               _("Sign"),
                ""
        };
 
@@ -949,8 +956,8 @@ void
 emit_subtitle_image (ContentTimePeriod period, dcp::SubtitleImage sub, dcp::Size size, shared_ptr<TextDecoder> decoder)
 {
        /* XXX: this is rather inefficient; decoding the image just to get its size */
-       FFmpegImageProxy proxy (sub.png_image(), VideoRange::FULL);
-       auto image = proxy.image().image;
+       FFmpegImageProxy proxy (sub.png_image());
+       auto image = proxy.image(Image::Alignment::COMPACT).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));
 
@@ -1040,7 +1047,7 @@ show_jobs_on_console (bool progress)
 
 /** XXX: could use mmap? */
 void
-copy_in_bits (boost::filesystem::path from, boost::filesystem::path to, boost::function<void (float)> progress)
+copy_in_bits (boost::filesystem::path from, boost::filesystem::path to, std::function<void (float)> progress)
 {
        auto f = fopen_boost (from, "rb");
        if (!f) {