diff options
author | Max Kellermann <max@duempel.org> | 2015-06-22 14:28:23 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-06-22 14:42:19 +0200 |
commit | eed1a3c239d78edf978af9433001cbc823242cda (patch) | |
tree | 36db7f602cc55182fc91d6fd4183f53325e40ac0 /src/decoder/plugins | |
parent | 94c037821ba26a040006568a103b770571fda140 (diff) | |
download | mpd-eed1a3c239d78edf978af9433001cbc823242cda.tar.gz mpd-eed1a3c239d78edf978af9433001cbc823242cda.tar.xz mpd-eed1a3c239d78edf978af9433001cbc823242cda.zip |
decoder/ffmpeg: move code to pcm/Interleave.cxx
Diffstat (limited to 'src/decoder/plugins')
-rw-r--r-- | src/decoder/plugins/FfmpegDecoderPlugin.cxx | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/src/decoder/plugins/FfmpegDecoderPlugin.cxx b/src/decoder/plugins/FfmpegDecoderPlugin.cxx index 88352bbb0..9493fee69 100644 --- a/src/decoder/plugins/FfmpegDecoderPlugin.cxx +++ b/src/decoder/plugins/FfmpegDecoderPlugin.cxx @@ -31,6 +31,7 @@ #include "../DecoderAPI.hxx" #include "FfmpegMetaData.hxx" #include "FfmpegIo.hxx" +#include "pcm/Interleave.hxx" #include "tag/TagBuilder.hxx" #include "tag/TagHandler.hxx" #include "tag/ReplayGain.hxx" @@ -103,20 +104,6 @@ start_time_fallback(const AVStream &stream) return FfmpegTimestampFallback(stream.start_time, 0); } -static void -copy_interleave_frame2(uint8_t *dest, uint8_t **src, - unsigned nframes, unsigned nchannels, - unsigned sample_size) -{ - for (unsigned frame = 0; frame < nframes; ++frame) { - for (unsigned channel = 0; channel < nchannels; ++channel) { - memcpy(dest, src[channel] + frame * sample_size, - sample_size); - dest += sample_size; - } - } -} - /** * Copy PCM data from a non-empty AVFrame to an interleaved buffer. */ @@ -150,11 +137,11 @@ copy_interleave_frame(const AVCodecContext &codec_context, return 0; } - copy_interleave_frame2((uint8_t *)output_buffer, - frame.extended_data, - frame.nb_samples, - codec_context.channels, - av_get_bytes_per_sample(codec_context.sample_fmt)); + PcmInterleave(output_buffer, + ConstBuffer<const void *>((const void *const*)frame.extended_data, + codec_context.channels), + frame.nb_samples, + av_get_bytes_per_sample(codec_context.sample_fmt)); } else { output_buffer = frame.extended_data[0]; } |