Skip to content

Commit b371beb

Browse files
author
Clement Champetier
committed
AudioFrame: added getChannelLayoutDesc method
Will be used in the next commit.
1 parent 128e2ce commit b371beb

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/AvTranscoder/data/decoded/AudioFrame.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ AudioFrame::AudioFrame(const Frame& otherFrame)
5050
{
5151
}
5252

53+
std::string AudioFrame::getChannelLayoutDesc() const
54+
{
55+
char buf[512];
56+
av_get_channel_layout_string(buf, sizeof(buf), getNbChannels(), getChannelLayout());
57+
return std::string(buf);
58+
}
59+
5360
size_t AudioFrame::getSize() const
5461
{
5562
if(getSampleFormat() == AV_SAMPLE_FMT_NONE)

src/AvTranscoder/data/decoded/AudioFrame.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class AvExport AudioFrame : public Frame
4545
size_t getSampleRate() const { return av_frame_get_sample_rate(_frame); }
4646
size_t getNbChannels() const { return av_frame_get_channels(_frame); }
4747
size_t getChannelLayout() const { return av_frame_get_channel_layout(_frame); }
48+
std::string getChannelLayoutDesc() const; ///< Get a description of a channel layout.
4849
AVSampleFormat getSampleFormat() const { return static_cast<AVSampleFormat>(_frame->format); }
4950
size_t getNbSamplesPerChannel() const { return _frame->nb_samples; }
5051
AudioFrameDesc desc() const { return AudioFrameDesc(getSampleRate(), getNbChannels(), getSampleFormat()); }

0 commit comments

Comments
 (0)