Make terminate_threads() less likely to leave _threads containing invalid pointers.
[dcpomatic.git] / src / lib / image_examiner.cc
index 71f0ca41cab90db1d585c5fd2acf08218379e6d2..775a69eebac4779b69226f7a8f408f9ad19d43c2 100644 (file)
 #include "config.h"
 #include "cross.h"
 #include "compose.hpp"
-#include "magick_image_proxy.h"
+#include "ffmpeg_image_proxy.h"
 #include "image.h"
 #include <dcp/openjpeg_image.h>
 #include <dcp/exceptions.h>
 #include <dcp/j2k.h>
-#include <Magick++.h>
 #include <iostream>
 
 #include "i18n.h"
@@ -46,9 +45,6 @@ ImageExaminer::ImageExaminer (shared_ptr<const Film> film, shared_ptr<const Imag
        : _film (film)
        , _image_content (content)
 {
-#ifdef DCPOMATIC_HAVE_MAGICKCORE_NAMESPACE
-       using namespace MagickCore;
-#endif
        boost::filesystem::path path = content->path(0).string ();
        if (valid_j2k_file (path)) {
                boost::uintmax_t size = boost::filesystem::file_size (path);
@@ -57,7 +53,7 @@ ImageExaminer::ImageExaminer (shared_ptr<const Film> film, shared_ptr<const Imag
                        throw FileError ("Could not open file for reading", path);
                }
                uint8_t* buffer = new uint8_t[size];
-               fread (buffer, 1, size, f);
+               checked_fread (buffer, size, f, path);
                fclose (f);
                try {
                        _video_size = dcp::decompress_j2k (buffer, size, 0)->size ();
@@ -67,7 +63,7 @@ ImageExaminer::ImageExaminer (shared_ptr<const Film> film, shared_ptr<const Imag
                }
                delete[] buffer;
        } else {
-               MagickImageProxy proxy(content->path(0));
+               FFmpegImageProxy proxy(content->path(0));
                _video_size = proxy.image().first->size();
        }