File tree Expand file tree Collapse file tree 8 files changed +20
-11
lines changed Expand file tree Collapse file tree 8 files changed +20
-11
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,8 @@ void AudioDecoder::setupDecoder(const ProfileLoader::Profile& profile)
56
56
for (ProfileLoader::Profile::const_iterator it = profile.begin (); it != profile.end (); ++it)
57
57
{
58
58
if ((*it).first == constants::avProfileIdentificator || (*it).first == constants::avProfileIdentificatorHuman ||
59
- (*it).first == constants::avProfileType || (*it).first == constants::avProfileThreads)
59
+ (*it).first == constants::avProfileType || (*it).first == constants::avProfileCodec ||
60
+ (*it).first == constants::avProfileThreads)
60
61
continue ;
61
62
62
63
try
Original file line number Diff line number Diff line change @@ -55,8 +55,8 @@ bool AudioGenerator::decodeNextFrame(Frame& frameBuffer)
55
55
// Take audio frame from _inputFrame
56
56
else
57
57
{
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 );
60
60
}
61
61
return true ;
62
62
}
Original file line number Diff line number Diff line change 3
3
4
4
#include " IDecoder.hpp"
5
5
#include < AvTranscoder/codec/AudioCodec.hpp>
6
+ #include < AvTranscoder/transform/AudioTransform.hpp>
6
7
7
8
namespace avtranscoder
8
9
{
@@ -21,12 +22,18 @@ class AvExport AudioGenerator : public IDecoder
21
22
bool decodeNextFrame (Frame& frameBuffer);
22
23
bool decodeNextFrame (Frame& frameBuffer, const std::vector<size_t > channelIndexArray);
23
24
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
+ */
24
30
void setNextFrame (Frame& inputFrame) { _inputFrame = &inputFrame; }
25
31
26
32
private:
27
33
Frame* _inputFrame; // /< Has link (no ownership)
28
34
AudioFrame* _silent; // /< The generated silent (has ownership)
29
35
const AudioFrameDesc _frameDesc; // /< The description of the given frame buffer when decoding.
36
+ AudioTransform _audioTransform; // /< To transform the specified data when decoding.
30
37
};
31
38
}
32
39
Original file line number Diff line number Diff line change @@ -54,7 +54,8 @@ void VideoDecoder::setupDecoder(const ProfileLoader::Profile& profile)
54
54
for (ProfileLoader::Profile::const_iterator it = profile.begin (); it != profile.end (); ++it)
55
55
{
56
56
if ((*it).first == constants::avProfileIdentificator || (*it).first == constants::avProfileIdentificatorHuman ||
57
- (*it).first == constants::avProfileType || (*it).first == constants::avProfileThreads)
57
+ (*it).first == constants::avProfileType || (*it).first == constants::avProfileCodec ||
58
+ (*it).first == constants::avProfileThreads)
58
59
continue ;
59
60
60
61
try
Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ VideoGenerator::VideoGenerator(const VideoFrameDesc& frameDesc)
11
11
: _inputFrame(NULL )
12
12
, _blackImage(NULL )
13
13
, _frameDesc(frameDesc)
14
- , _videoTransform()
15
14
{
16
15
}
17
16
@@ -57,8 +56,8 @@ bool VideoGenerator::decodeNextFrame(Frame& frameBuffer)
57
56
// Take image from _inputFrame
58
57
else
59
58
{
60
- LOG_DEBUG (" Copy data of the image specified when decode next frame" )
61
- frameBuffer. copyData (*_inputFrame);
59
+ LOG_DEBUG (" Convert data of the image specified when decode next frame" )
60
+ _videoTransform. convert (*_inputFrame, frameBuffer );
62
61
}
63
62
return true ;
64
63
}
Original file line number Diff line number Diff line change @@ -23,7 +23,8 @@ class AvExport VideoGenerator : public IDecoder
23
23
24
24
/* *
25
25
* @brief Force to return this frame when calling the decoding methods.
26
- * @param inputFrame: should have the same properties as the given frames when decoding.
26
+ * @param inputFrame: could have other properties than the given frame when decoding (will be converted).
27
+ * @see decodeNextFrame
27
28
*/
28
29
void setNextFrame (Frame& inputFrame) { _inputFrame = &inputFrame; }
29
30
Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ void InputFile::setupUnwrapping(const ProfileLoader::Profile& profile)
147
147
for (ProfileLoader::Profile::const_iterator it = profile.begin (); it != profile.end (); ++it)
148
148
{
149
149
if ((*it).first == constants::avProfileIdentificator || (*it).first == constants::avProfileIdentificatorHuman ||
150
- (*it).first == constants::avProfileType)
150
+ (*it).first == constants::avProfileType || (*it). first == constants::avProfileFormat )
151
151
continue ;
152
152
153
153
try
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ def testSetVideoFrame():
38
38
p .progress ( i , nbFrames )
39
39
40
40
# set video frame
41
- frame = av .VideoFrame ( av .VideoFrameDesc (1920 , 1080 , "yuv422p" ) )
41
+ frame = av .VideoFrame (av .VideoFrameDesc (1920 , 1080 , "rgb24" ) )
42
42
frame .assign (i )
43
43
videoDecoder .setNextFrame ( frame )
44
44
@@ -84,7 +84,7 @@ def testSetAudioFrame():
84
84
p .progress ( i , nbFrames )
85
85
86
86
# set video frame
87
- frame = av .AudioFrame ( av .AudioFrameDesc (48000 , 1 , "s32" ) )
87
+ frame = av .AudioFrame (av .AudioFrameDesc (44100 , 1 , "s16" ) )
88
88
frame .assign (i )
89
89
audioDecoder .setNextFrame ( frame )
90
90
You can’t perform that action at this time.
0 commit comments