X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fffmpeg_file_encoder.cc;h=57103abc712ab5523fb4c867c28198ed2dc32dcc;hb=4f9314a311de379b105741273a15821da62a75cc;hp=ef02f30c8f1ab17863f17e59de62131310f18caa;hpb=3799e91d126d243d41c44dcb0ca1bfa66b53a57e;p=dcpomatic.git diff --git a/src/lib/ffmpeg_file_encoder.cc b/src/lib/ffmpeg_file_encoder.cc index ef02f30c8..57103abc7 100644 --- a/src/lib/ffmpeg_file_encoder.cc +++ b/src/lib/ffmpeg_file_encoder.cc @@ -134,7 +134,8 @@ public: auto frame = av_frame_alloc (); DCPOMATIC_ASSERT (frame); - int const buffer_size = av_samples_get_buffer_size (0, channels, size, _codec_context->sample_fmt, 0); + int line_size; + int const buffer_size = av_samples_get_buffer_size (&line_size, channels, size, _codec_context->sample_fmt, 0); DCPOMATIC_ASSERT (buffer_size >= 0); auto samples = av_malloc (buffer_size); @@ -169,10 +170,8 @@ public: } case AV_SAMPLE_FMT_FLTP: { - float* q = reinterpret_cast (samples); for (int i = 0; i < channels; ++i) { - memcpy (q, data[i + channel_offset], sizeof(float) * size); - q += size; + memcpy (reinterpret_cast(static_cast(samples) + i * line_size), data[i + channel_offset], sizeof(float) * size); } break; } @@ -400,9 +399,8 @@ FFmpegFileEncoder::video (shared_ptr video, DCPTime time) { /* All our output formats are video range at the moment */ auto image = video->image ( - bind (&PlayerVideo::force, _1, _pixel_format), + bind (&PlayerVideo::force, _pixel_format), VideoRange::VIDEO, - Image::Alignment::PADDED, false );