diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-02-16 22:23:28 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-02-16 22:23:28 +0100 |
| commit | 915cecb8f2b4bb251e72bbcd6c41144b73f8bfd7 (patch) | |
| tree | c0d601cae01940bf3d3d3dc9a64303ba6b4f8100 /src/lib/player.cc | |
| parent | 4787f3a114115a16f7007c7b1bd36fb2e2121345 (diff) | |
Make a new AudioBuffers constructor and use it to avoid some use of the more complicated copy_from.
Diffstat (limited to 'src/lib/player.cc')
| -rw-r--r-- | src/lib/player.cc | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc index bc0aa3b28..304f8c723 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -900,9 +900,7 @@ Player::audio (weak_ptr<Piece> wp, AudioStreamPtr stream, ContentAudio content_a if (remaining_frames == 0) { return; } - shared_ptr<AudioBuffers> cut (new AudioBuffers (content_audio.audio->channels(), remaining_frames)); - cut->copy_from (content_audio.audio.get(), remaining_frames, 0, 0); - content_audio.audio = cut; + content_audio.audio.reset (new AudioBuffers(content_audio.audio, remaining_frames, 0)); } DCPOMATIC_ASSERT (content_audio.audio->frames() > 0); @@ -1195,8 +1193,7 @@ Player::discard_audio (shared_ptr<const AudioBuffers> audio, DCPTime time, DCPTi if (remaining_frames <= 0) { return make_pair(shared_ptr<AudioBuffers>(), DCPTime()); } - shared_ptr<AudioBuffers> cut (new AudioBuffers (audio->channels(), remaining_frames)); - cut->copy_from (audio.get(), remaining_frames, discard_frames, 0); + shared_ptr<AudioBuffers> cut (new AudioBuffers(audio, remaining_frames, discard_frames)); return make_pair(cut, time + discard_time); } |
