Skip to content

Commit 48f854e

Browse files
author
Clement Champetier
committed
InputAudio: refactoring readNextFrame with subStream
* Suppress comments. * Add todo.
1 parent f4ed2b8 commit 48f854e

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

src/AvTranscoder/EssenceStream/InputAudio.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -139,32 +139,25 @@ bool InputAudio::readNextFrame( Frame& frameBuffer, const size_t subStreamIndex
139139
if( ! getNextFrame() )
140140
return false;
141141

142-
size_t decodedSize = av_samples_get_buffer_size(NULL, 1,
143-
_frame->nb_samples,
144-
_codecContext->sample_fmt, 1);
142+
const int output_nbChannels = 1;
143+
const int output_align = 1;
144+
size_t decodedSize = av_samples_get_buffer_size(NULL, output_nbChannels, _frame->nb_samples, _codecContext->sample_fmt, output_align);
145145

146146
size_t nbChannels = _codecContext->channels;
147147
size_t bytePerSample = av_get_bytes_per_sample( (AVSampleFormat)_frame->format );
148148

149149
AudioFrame& audioBuffer = static_cast<AudioFrame&>( frameBuffer );
150-
151-
// std::cout << "needed size " << audioBuffer.desc().getDataSize() << std::endl;
152-
153-
// std::cout << _frame->nb_samples * bytePerSample << std::endl;
154-
//audioBuffer.getBuffer().resize( _frame->nb_samples * bytePerSample );
155150
audioBuffer.setNbSamples( _frame->nb_samples );
156151

157152
if( decodedSize )
158153
{
159154
if( audioBuffer.getSize() != decodedSize )
160155
audioBuffer.getBuffer().resize( decodedSize, 0 );
161156

162-
unsigned char* src = *_frame->data;
157+
// @todo manage cases with data of frame not only on data[0] (use _frame.linesize)
158+
unsigned char* src = _frame->data[0];
163159
unsigned char* dst = audioBuffer.getPtr();
164160

165-
// std::cout << "frame samples count " << _frame->nb_samples << std::endl;
166-
// std::cout << "frame data size " << audioBuffer.getSize() << std::endl;
167-
168161
// @todo check little / big endian
169162
// offset for little endian
170163
src += ( nbChannels - 1 - subStreamIndex ) * bytePerSample;

0 commit comments

Comments
 (0)