Skip to content

generators: fixed set of a custom frame with any parameters #277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/AvTranscoder/decoder/AudioDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/AvTranscoder/decoder/AudioGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
7 changes: 7 additions & 0 deletions src/AvTranscoder/decoder/AudioGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "IDecoder.hpp"
#include <AvTranscoder/codec/AudioCodec.hpp>
#include <AvTranscoder/transform/AudioTransform.hpp>

namespace avtranscoder
{
Expand All @@ -21,12 +22,18 @@ class AvExport AudioGenerator : public IDecoder
bool decodeNextFrame(Frame& frameBuffer);
bool decodeNextFrame(Frame& frameBuffer, const std::vector<size_t> 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.
};
}

Expand Down
3 changes: 2 additions & 1 deletion src/AvTranscoder/decoder/VideoDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions src/AvTranscoder/decoder/VideoGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ VideoGenerator::VideoGenerator(const VideoFrameDesc& frameDesc)
: _inputFrame(NULL)
, _blackImage(NULL)
, _frameDesc(frameDesc)
, _videoTransform()
{
}

Expand Down Expand Up @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion src/AvTranscoder/decoder/VideoGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down
2 changes: 1 addition & 1 deletion src/AvTranscoder/file/InputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/pyTest/testSetFrame.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 )

Expand Down Expand Up @@ -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 )

Expand Down