Skip to content

Commit 9098651

Browse files
author
Clement Champetier
committed
AudioGenerator: fixed copy of data from a specified frame
The specified frame could have other properties than the given frame when decoding (will be converted).
1 parent c2aad62 commit 9098651

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/AvTranscoder/decoder/AudioGenerator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ bool AudioGenerator::decodeNextFrame(Frame& frameBuffer)
5555
// Take audio frame from _inputFrame
5656
else
5757
{
58-
LOG_DEBUG("Copy data of the audio specified when decode next frame")
59-
frameBuffer.copyData(*_inputFrame);
58+
LOG_DEBUG("Convert data of the audio specified when decode next frame")
59+
_audioTransform.convert(*_inputFrame, frameBuffer);
6060
}
6161
return true;
6262
}

src/AvTranscoder/decoder/AudioGenerator.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "IDecoder.hpp"
55
#include <AvTranscoder/codec/AudioCodec.hpp>
6+
#include <AvTranscoder/transform/AudioTransform.hpp>
67

78
namespace avtranscoder
89
{
@@ -21,12 +22,18 @@ class AvExport AudioGenerator : public IDecoder
2122
bool decodeNextFrame(Frame& frameBuffer);
2223
bool decodeNextFrame(Frame& frameBuffer, const std::vector<size_t> channelIndexArray);
2324

25+
/**
26+
* @brief Force to return this frame when calling the decoding methods.
27+
* @param inputFrame: could have other properties than the given frame when decoding (will be converted).
28+
* @see decodeNextFrame
29+
*/
2430
void setNextFrame(Frame& inputFrame) { _inputFrame = &inputFrame; }
2531

2632
private:
2733
Frame* _inputFrame; ///< Has link (no ownership)
2834
AudioFrame* _silent; ///< The generated silent (has ownership)
2935
const AudioFrameDesc _frameDesc; ///< The description of the given frame buffer when decoding.
36+
AudioTransform _audioTransform; ///< To transform the specified data when decoding.
3037
};
3138
}
3239

0 commit comments

Comments
 (0)