Skip to content

Commit f65eb7c

Browse files
author
Christian Feldmann
committed
Add operator << for ChannelInfo for better test case error reporting.
1 parent f877e9c commit f65eb7c

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/lib/AVCodec/Channel.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
#include "common/EnumMapper.h"
1010

11+
#include <ostream>
12+
1113
namespace libffmpeg::avcodec
1214
{
1315

@@ -103,6 +105,16 @@ struct ChannelInfo
103105
return this->channel == other.channel && this->ambisonicIndex == other.ambisonicIndex &&
104106
this->name == other.name;
105107
}
108+
109+
friend std::ostream &operator<<(std::ostream &stream, const ChannelInfo &channelInfo)
110+
{
111+
stream << "{ Channel "
112+
<< (channelInfo.channel ? channelMapper.getName(*channelInfo.channel) : "nullopt")
113+
<< ", ambisonicIndex: "
114+
<< (channelInfo.ambisonicIndex ? std::to_string(*channelInfo.ambisonicIndex) : "nullopt")
115+
<< ", name: \"" << channelInfo.name << "\"}";
116+
return stream;
117+
}
106118
};
107119

108120
using ChannelLayout = std::vector<ChannelInfo>;

0 commit comments

Comments
 (0)