diff --git a/src/AvTranscoder/decoder/AudioDecoder.cpp b/src/AvTranscoder/decoder/AudioDecoder.cpp index 8d0490e7..6ea1afb6 100644 --- a/src/AvTranscoder/decoder/AudioDecoder.cpp +++ b/src/AvTranscoder/decoder/AudioDecoder.cpp @@ -56,7 +56,8 @@ void AudioDecoder::setupDecoder(const ProfileLoader::Profile& profile) for(ProfileLoader::Profile::const_iterator it = profile.begin(); it != profile.end(); ++it) { if((*it).first == constants::avProfileIdentificator || (*it).first == constants::avProfileIdentificatorHuman || - (*it).first == constants::avProfileType || (*it).first == constants::avProfileThreads) + (*it).first == constants::avProfileType || (*it).first == constants::avProfileCodec || + (*it).first == constants::avProfileThreads) continue; try diff --git a/src/AvTranscoder/decoder/AudioGenerator.cpp b/src/AvTranscoder/decoder/AudioGenerator.cpp index 29ec5dd8..48a0b424 100644 --- a/src/AvTranscoder/decoder/AudioGenerator.cpp +++ b/src/AvTranscoder/decoder/AudioGenerator.cpp @@ -55,8 +55,8 @@ bool AudioGenerator::decodeNextFrame(Frame& frameBuffer) // Take audio frame from _inputFrame else { - LOG_DEBUG("Copy data of the audio specified when decode next frame") - frameBuffer.copyData(*_inputFrame); + LOG_DEBUG("Convert data of the audio specified when decode next frame") + _audioTransform.convert(*_inputFrame, frameBuffer); } return true; } diff --git a/src/AvTranscoder/decoder/AudioGenerator.hpp b/src/AvTranscoder/decoder/AudioGenerator.hpp index 0b1d51ec..de8eccd9 100644 --- a/src/AvTranscoder/decoder/AudioGenerator.hpp +++ b/src/AvTranscoder/decoder/AudioGenerator.hpp @@ -3,6 +3,7 @@ #include "IDecoder.hpp" #include +#include namespace avtranscoder { @@ -21,12 +22,18 @@ class AvExport AudioGenerator : public IDecoder bool decodeNextFrame(Frame& frameBuffer); bool decodeNextFrame(Frame& frameBuffer, const std::vector channelIndexArray); + /** + * @brief Force to return this frame when calling the decoding methods. + * @param inputFrame: could have other properties than the given frame when decoding (will be converted). + * @see decodeNextFrame + */ void setNextFrame(Frame& inputFrame) { _inputFrame = &inputFrame; } private: Frame* _inputFrame; ///< Has link (no ownership) AudioFrame* _silent; ///< The generated silent (has ownership) const AudioFrameDesc _frameDesc; ///< The description of the given frame buffer when decoding. + AudioTransform _audioTransform; ///< To transform the specified data when decoding. }; } diff --git a/src/AvTranscoder/decoder/VideoDecoder.cpp b/src/AvTranscoder/decoder/VideoDecoder.cpp index 125faf77..082d1dc2 100644 --- a/src/AvTranscoder/decoder/VideoDecoder.cpp +++ b/src/AvTranscoder/decoder/VideoDecoder.cpp @@ -54,7 +54,8 @@ void VideoDecoder::setupDecoder(const ProfileLoader::Profile& profile) for(ProfileLoader::Profile::const_iterator it = profile.begin(); it != profile.end(); ++it) { if((*it).first == constants::avProfileIdentificator || (*it).first == constants::avProfileIdentificatorHuman || - (*it).first == constants::avProfileType || (*it).first == constants::avProfileThreads) + (*it).first == constants::avProfileType || (*it).first == constants::avProfileCodec || + (*it).first == constants::avProfileThreads) continue; try diff --git a/src/AvTranscoder/decoder/VideoGenerator.cpp b/src/AvTranscoder/decoder/VideoGenerator.cpp index d55db6df..58ba9509 100644 --- a/src/AvTranscoder/decoder/VideoGenerator.cpp +++ b/src/AvTranscoder/decoder/VideoGenerator.cpp @@ -11,7 +11,6 @@ VideoGenerator::VideoGenerator(const VideoFrameDesc& frameDesc) : _inputFrame(NULL) , _blackImage(NULL) , _frameDesc(frameDesc) - , _videoTransform() { } @@ -57,8 +56,8 @@ bool VideoGenerator::decodeNextFrame(Frame& frameBuffer) // Take image from _inputFrame else { - LOG_DEBUG("Copy data of the image specified when decode next frame") - frameBuffer.copyData(*_inputFrame); + LOG_DEBUG("Convert data of the image specified when decode next frame") + _videoTransform.convert(*_inputFrame, frameBuffer); } return true; } diff --git a/src/AvTranscoder/decoder/VideoGenerator.hpp b/src/AvTranscoder/decoder/VideoGenerator.hpp index 47796daa..6f689e31 100644 --- a/src/AvTranscoder/decoder/VideoGenerator.hpp +++ b/src/AvTranscoder/decoder/VideoGenerator.hpp @@ -23,7 +23,8 @@ class AvExport VideoGenerator : public IDecoder /** * @brief Force to return this frame when calling the decoding methods. - * @param inputFrame: should have the same properties as the given frames when decoding. + * @param inputFrame: could have other properties than the given frame when decoding (will be converted). + * @see decodeNextFrame */ void setNextFrame(Frame& inputFrame) { _inputFrame = &inputFrame; } diff --git a/src/AvTranscoder/file/InputFile.cpp b/src/AvTranscoder/file/InputFile.cpp index 2dbaf379..30e9efd5 100644 --- a/src/AvTranscoder/file/InputFile.cpp +++ b/src/AvTranscoder/file/InputFile.cpp @@ -147,7 +147,7 @@ void InputFile::setupUnwrapping(const ProfileLoader::Profile& profile) for(ProfileLoader::Profile::const_iterator it = profile.begin(); it != profile.end(); ++it) { if((*it).first == constants::avProfileIdentificator || (*it).first == constants::avProfileIdentificatorHuman || - (*it).first == constants::avProfileType) + (*it).first == constants::avProfileType || (*it).first == constants::avProfileFormat) continue; try diff --git a/test/pyTest/testSetFrame.py b/test/pyTest/testSetFrame.py index 18d35df1..ec04f562 100644 --- a/test/pyTest/testSetFrame.py +++ b/test/pyTest/testSetFrame.py @@ -38,7 +38,7 @@ def testSetVideoFrame(): p.progress( i, nbFrames ) # set video frame - frame = av.VideoFrame( av.VideoFrameDesc(1920, 1080, "yuv422p") ) + frame = av.VideoFrame(av.VideoFrameDesc(1920, 1080, "rgb24")) frame.assign(i) videoDecoder.setNextFrame( frame ) @@ -84,7 +84,7 @@ def testSetAudioFrame(): p.progress( i, nbFrames ) # set video frame - frame = av.AudioFrame( av.AudioFrameDesc(48000, 1, "s32") ) + frame = av.AudioFrame(av.AudioFrameDesc(44100, 1, "s16")) frame.assign(i) audioDecoder.setNextFrame( frame )