Replace aligned bool with enum Alignment.
[dcpomatic.git] / src / lib / ffmpeg_image_proxy.cc
index 54fb1c46837012485d3a93dbdd37ae3e71ceeecc..4b3c3084c7f2db4a71c529f88b23f8b7c1e1e7f6 100644 (file)
@@ -122,7 +122,7 @@ FFmpegImageProxy::avio_seek (int64_t const pos, int whence)
 
 
 ImageProxy::Result
-FFmpegImageProxy::image (optional<dcp::Size>) const
+FFmpegImageProxy::image (Image::Alignment alignment, optional<dcp::Size>) const
 {
        auto constexpr name_for_errors = "FFmpegImageProxy::image";
 
@@ -133,11 +133,11 @@ FFmpegImageProxy::image (optional<dcp::Size>) const
        }
 
        uint8_t* avio_buffer = static_cast<uint8_t*> (wrapped_av_malloc(4096));
-       AVIOContext* avio_context = avio_alloc_context (avio_buffer, 4096, 0, const_cast<FFmpegImageProxy*>(this), avio_read_wrapper, 0, avio_seek_wrapper);
+       auto avio_context = avio_alloc_context (avio_buffer, 4096, 0, const_cast<FFmpegImageProxy*>(this), avio_read_wrapper, 0, avio_seek_wrapper);
        AVFormatContext* format_context = avformat_alloc_context ();
        format_context->pb = avio_context;
 
-       AVDictionary* options = 0;
+       AVDictionary* options = nullptr;
        /* These durations are in microseconds, and represent how far into the content file
           we will look for streams.
        */
@@ -150,7 +150,7 @@ FFmpegImageProxy::image (optional<dcp::Size>) const
                   directly from the file).  This code just does enough to allow the
                   probe code to take a hint from "foo.tga" and so try targa format.
                */
-               AVInputFormat* f = av_find_input_format ("image2");
+               auto f = av_find_input_format ("image2");
                format_context = avformat_alloc_context ();
                format_context->pb = avio_context;
                format_context->iformat = f;
@@ -171,7 +171,7 @@ FFmpegImageProxy::image (optional<dcp::Size>) const
 
        DCPOMATIC_ASSERT (format_context->nb_streams == 1);
 
-       AVFrame* frame = av_frame_alloc ();
+       auto frame = av_frame_alloc ();
        if (!frame) {
                std::bad_alloc ();
        }
@@ -205,7 +205,7 @@ FFmpegImageProxy::image (optional<dcp::Size>) const
                throw DecodeError (N_("avcodec_receive_frame"), name_for_errors, r, *_path);
        }
 
-       _image = make_shared<Image>(frame);
+       _image = make_shared<Image>(frame, alignment);
 
        av_packet_unref (&packet);
        av_frame_free (&frame);