9 #if API_NEW_CHANNEL_LAYOUT
11 #include <libavutil/channel_layout.h>
16 std::string channel_name(AVChannel channel);
17 std::string channel_description(AVChannel channel);
18 AVChannel channel_from_string(
const std::string &name);
19 AVChannel channel_from_string(
const char *name);
23 class ChannelLayoutView
26 ChannelLayoutView() noexcept;
28 ChannelLayoutView(const AVChannelLayout &layout) noexcept;
32 template<typename Callable>
33 static
void iterate(Callable callable) {
35 const AVChannelLayout *playout;
36 while ((playout = av_channel_layout_standard(&iter))) {
37 if (callable(ChannelLayoutView(*playout)))
42 static void dumpLayouts();
53 AVChannelLayout *raw();
54 const AVChannelLayout *raw()
const;
56 int channels() const noexcept;
57 uint64_t layout() const noexcept;
58 uint64_t subset(uint64_t mask) const noexcept;
59 bool isValid() const noexcept;
60 std::
string describe() const;
61 void describe(
std::
string &desc) const;
63 int index(AVChannel channel) const;
64 int index(const
char *name) const;
66 AVChannel channel(
unsigned int index) const;
67 AVChannel channel(const
char *name) const;
69 bool operator==(const ChannelLayoutView &other) const noexcept;
71 ChannelLayout clone() const;
74 AVChannelLayout m_layout{};
79 class ChannelLayout :
public ChannelLayoutView
82 ChannelLayout() =
default;
84 explicit ChannelLayout(
const ChannelLayoutView &view);
86 using ChannelLayoutView::ChannelLayoutView;
88 ChannelLayout(
const ChannelLayout& other);
89 ChannelLayout& operator=(
const ChannelLayout& other);
91 ChannelLayout(ChannelLayout&& other);
92 ChannelLayout& operator=(ChannelLayout&& other);
104 explicit ChannelLayout(std::bitset<64> mask);
105 explicit ChannelLayout(
const char *str);
106 explicit ChannelLayout(
int channels);
112 void swap(ChannelLayout &other);