summaryrefslogtreecommitdiff
path: root/src/lib/ffmpeg_encoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-10-11 19:55:06 +0200
committerCarl Hetherington <cth@carlh.net>2021-10-11 20:13:21 +0200
commit44b69f2d9affb048c3d166e3a62bf3462dd5c8b5 (patch)
tree7cf2a540d01c66f9a7d12acfdabd0ee2f4251c80 /src/lib/ffmpeg_encoder.cc
parent805d4a48fa6e4d8e28fd582a2ae6ba78b8343144 (diff)
Replace some raw arrays with std::vectors.
Diffstat (limited to 'src/lib/ffmpeg_encoder.cc')
-rw-r--r--src/lib/ffmpeg_encoder.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/ffmpeg_encoder.cc b/src/lib/ffmpeg_encoder.cc
index dd773168a..e3a37677b 100644
--- a/src/lib/ffmpeg_encoder.cc
+++ b/src/lib/ffmpeg_encoder.cc
@@ -161,7 +161,7 @@ FFmpegEncoder::go ()
auto const video_frame = DCPTime::from_frames (1, _film->video_frame_rate ());
int const audio_frames = video_frame.frames_round(_film->audio_frame_rate());
- float* interleaved = new float[_output_audio_channels * audio_frames];
+ std::vector<float> interleaved(_output_audio_channels * audio_frames);
auto deinterleaved = make_shared<AudioBuffers>(_output_audio_channels, audio_frames);
int const gets_per_frame = _film->three_d() ? 2 : 1;
for (DCPTime i; i < _film->length(); i += video_frame) {
@@ -201,9 +201,9 @@ FFmpegEncoder::go ()
waker.nudge ();
- _butler->get_audio (interleaved, audio_frames);
+ _butler->get_audio (interleaved.data(), audio_frames);
/* XXX: inefficient; butler interleaves and we deinterleave again */
- float* p = interleaved;
+ float* p = interleaved.data();
for (int j = 0; j < audio_frames; ++j) {
for (int k = 0; k < _output_audio_channels; ++k) {
deinterleaved->data(k)[j] = *p++;
@@ -211,7 +211,6 @@ FFmpegEncoder::go ()
}
encoder->audio (deinterleaved);
}
- delete[] interleaved;
for (auto i: file_encoders) {
i.flush ();