X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fffmpeg_image_proxy.cc;h=dd2f80e0e2a3ea5f94e0fa794fb07743645633d1;hb=9bfa07293928c371d59db2091ba2b7e715ce5994;hp=54fb1c46837012485d3a93dbdd37ae3e71ceeecc;hpb=5523c5b7c0572616d9d76786d0140e6f7f3e7174;p=dcpomatic.git diff --git a/src/lib/ffmpeg_image_proxy.cc b/src/lib/ffmpeg_image_proxy.cc index 54fb1c468..dd2f80e0e 100644 --- a/src/lib/ffmpeg_image_proxy.cc +++ b/src/lib/ffmpeg_image_proxy.cc @@ -122,7 +122,7 @@ FFmpegImageProxy::avio_seek (int64_t const pos, int whence) ImageProxy::Result -FFmpegImageProxy::image (optional) const +FFmpegImageProxy::image (bool aligned, optional) const { auto constexpr name_for_errors = "FFmpegImageProxy::image"; @@ -133,11 +133,11 @@ FFmpegImageProxy::image (optional) const } uint8_t* avio_buffer = static_cast (wrapped_av_malloc(4096)); - AVIOContext* avio_context = avio_alloc_context (avio_buffer, 4096, 0, const_cast(this), avio_read_wrapper, 0, avio_seek_wrapper); + auto avio_context = avio_alloc_context (avio_buffer, 4096, 0, const_cast(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) 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) 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) const throw DecodeError (N_("avcodec_receive_frame"), name_for_errors, r, *_path); } - _image = make_shared(frame); + _image = make_shared(frame, aligned); av_packet_unref (&packet); av_frame_free (&frame);