Skip to content

Commit 34bb99e

Browse files
author
Clement Champetier
committed
AudioFrame: renamed get/setChannels to get/setNbChannels
1 parent 634ed10 commit 34bb99e

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

src/AvTranscoder/codec/AudioCodec.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ AudioFrameDesc AudioCodec::getAudioFrameDesc() const
3131
void AudioCodec::setAudioParameters(const AudioFrameDesc& audioFrameDesc)
3232
{
3333
_avCodecContext->sample_rate = audioFrameDesc.getSampleRate();
34-
_avCodecContext->channels = audioFrameDesc.getChannels();
34+
_avCodecContext->channels = audioFrameDesc.getNbChannels();
3535
_avCodecContext->sample_fmt = audioFrameDesc.getSampleFormat();
3636
}
3737
}

src/AvTranscoder/frame/AudioFrame.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void AudioFrameDesc::setParameters(const ProfileLoader::Profile& profile)
6060
setSampleRate(atoi(profile.find(constants::avProfileSampleRate)->second.c_str()));
6161
// channel
6262
if(profile.count(constants::avProfileChannel))
63-
setChannels(atoi(profile.find(constants::avProfileChannel)->second.c_str()));
63+
setNbChannels(atoi(profile.find(constants::avProfileChannel)->second.c_str()));
6464
// sample format
6565
if(profile.count(constants::avProfileSampleFormat))
6666
setSampleFormat(profile.find(constants::avProfileSampleFormat)->second);

src/AvTranscoder/frame/AudioFrame.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ class AvExport AudioFrameDesc
2121
AudioFrameDesc(const size_t sampleRate, const size_t channels, const std::string& sampleFormat);
2222

2323
size_t getSampleRate() const { return _sampleRate; }
24-
size_t getChannels() const { return _channels; }
24+
size_t getNbChannels() const { return _channels; }
2525
AVSampleFormat getSampleFormat() const { return _sampleFormat; }
2626
std::string getSampleFormatName() const;
2727
double getFps() const { return _fps; }
2828

2929
size_t getDataSize() const;
3030

3131
void setSampleRate(const size_t sampleRate) { _sampleRate = sampleRate; }
32-
void setChannels(const size_t channels) { _channels = channels; }
32+
void setNbChannels(const size_t channels) { _channels = channels; }
3333
void setSampleFormat(const std::string& sampleFormatName);
3434
void setSampleFormat(const AVSampleFormat sampleFormat) { _sampleFormat = sampleFormat; }
3535
void setFps(const double fps) { _fps = fps; }

src/AvTranscoder/reader/AudioReader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void AudioReader::init()
4949
AudioFrame* srcFrame = static_cast<AudioFrame*>(_srcFrame);
5050
// create dst frame
5151
_outputSampleRate = srcFrame->desc().getSampleRate();
52-
_outputNbChannels = (_channelIndex == -1) ? srcFrame->desc().getChannels() : 1;
52+
_outputNbChannels = (_channelIndex == -1) ? srcFrame->desc().getNbChannels() : 1;
5353
_dstFrame = new AudioFrame(AudioFrameDesc(_outputSampleRate, _outputNbChannels, _outputSampleFormat));
5454
}
5555

src/AvTranscoder/transcoder/StreamTranscoder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ StreamTranscoder::StreamTranscoder(IInputStream& inputStream, IOutputFile& outpu
186186
if(subStreamIndex > -1)
187187
{
188188
// @todo manage downmix ?
189-
outputFrameDesc.setChannels(1);
189+
outputFrameDesc.setNbChannels(1);
190190
}
191191
outputAudio->setupAudioEncoder(outputFrameDesc, profile);
192192

@@ -196,7 +196,7 @@ StreamTranscoder::StreamTranscoder(IInputStream& inputStream, IOutputFile& outpu
196196
// buffers to process
197197
AudioFrameDesc inputFrameDesc(_inputStream->getAudioCodec().getAudioFrameDesc());
198198
if(subStreamIndex > -1)
199-
inputFrameDesc.setChannels(1);
199+
inputFrameDesc.setNbChannels(1);
200200

201201
_sourceBuffer = new AudioFrame(inputFrameDesc);
202202
_frameBuffer = new AudioFrame(outputAudio->getAudioCodec().getAudioFrameDesc());

src/AvTranscoder/transform/AudioTransform.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ bool AudioTransform::init(const Frame& srcFrame, const Frame& dstFrame)
5454
const AudioFrame& src = static_cast<const AudioFrame&>(srcFrame);
5555
const AudioFrame& dst = static_cast<const AudioFrame&>(dstFrame);
5656

57-
av_opt_set_int(_audioConvertContext, "in_channel_layout", av_get_default_channel_layout(src.desc().getChannels()), 0);
58-
av_opt_set_int(_audioConvertContext, "out_channel_layout", av_get_default_channel_layout(dst.desc().getChannels()), 0);
57+
av_opt_set_int(_audioConvertContext, "in_channel_layout", av_get_default_channel_layout(src.desc().getNbChannels()), 0);
58+
av_opt_set_int(_audioConvertContext, "out_channel_layout", av_get_default_channel_layout(dst.desc().getNbChannels()), 0);
5959
av_opt_set_int(_audioConvertContext, "in_sample_rate", src.desc().getSampleRate(), 0);
6060
av_opt_set_int(_audioConvertContext, "out_sample_rate", dst.desc().getSampleRate(), 0);
6161
SetSampleFormat(_audioConvertContext, "in_sample_fmt", src.desc().getSampleFormat(), 0);
@@ -66,8 +66,8 @@ bool AudioTransform::init(const Frame& srcFrame, const Frame& dstFrame)
6666
FreeResampleContext(&_audioConvertContext);
6767
std::stringstream msg;
6868
msg << "Unable to open audio convert context:" << std::endl;
69-
msg << "in_channel_layout " << av_get_default_channel_layout(src.desc().getChannels()) << std::endl;
70-
msg << "out_channel_layout " << av_get_default_channel_layout(dst.desc().getChannels()) << std::endl;
69+
msg << "in_channel_layout " << av_get_default_channel_layout(src.desc().getNbChannels()) << std::endl;
70+
msg << "out_channel_layout " << av_get_default_channel_layout(dst.desc().getNbChannels()) << std::endl;
7171
msg << "in_sample_rate " << src.desc().getSampleRate() << std::endl;
7272
msg << "out_sample_rate " << dst.desc().getSampleRate() << std::endl;
7373
msg << "in_sample_fmt " << src.desc().getSampleFormat() << std::endl;
@@ -78,9 +78,9 @@ bool AudioTransform::init(const Frame& srcFrame, const Frame& dstFrame)
7878
std::stringstream msg;
7979
msg << "Audio conversion from " << src.desc().getSampleFormatName() << " to " << dst.desc().getSampleFormatName()
8080
<< std::endl;
81-
msg << "Source, number of channels = " << src.desc().getChannels() << std::endl;
81+
msg << "Source, number of channels = " << src.desc().getNbChannels() << std::endl;
8282
msg << "Source, sample rate = " << src.desc().getSampleRate() << std::endl;
83-
msg << "Destination, number of channels = " << dst.desc().getChannels() << std::endl;
83+
msg << "Destination, number of channels = " << dst.desc().getNbChannels() << std::endl;
8484
msg << "Destination, sample rate = " << dst.desc().getSampleRate() << std::endl;
8585
LOG_INFO(msg.str())
8686

@@ -93,7 +93,7 @@ void AudioTransform::updateOutputFrame(const size_t nbInputSamples, Frame& dstFr
9393

9494
// resize buffer of output frame
9595
const int dstSampleSize = av_get_bytes_per_sample(dst.desc().getSampleFormat());
96-
const size_t bufferSizeNeeded = nbInputSamples * dst.desc().getChannels() * dstSampleSize;
96+
const size_t bufferSizeNeeded = nbInputSamples * dst.desc().getNbChannels() * dstSampleSize;
9797
dstFrame.resize(bufferSizeNeeded);
9898

9999
// set nbSamples of output frame

0 commit comments

Comments
 (0)