Skip to content
Snippets Groups Projects
Commit cc2af3b9 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Add broadcast stream support

parent 24b2f6e0
No related branches found
No related tags found
No related merge requests found
Pipeline #15365 passed
......@@ -43,7 +43,7 @@ struct Packet {
*/
struct StreamPacket {
int64_t timestamp;
uint8_t streamID; // Source number...
uint8_t streamID; // Source number... 255 = broadcast stream
uint8_t channel_count; // Number of channels to expect for this frame to complete (usually 1 or 2)
ftl::codecs::Channel channel; // Actual channel of this current set of packets
......
......@@ -14,7 +14,7 @@ namespace codecs {
class Reader {
public:
Reader(std::istream &);
explicit Reader(std::istream &);
~Reader();
/**
......
......@@ -12,7 +12,7 @@ namespace codecs {
class Writer {
public:
Writer(std::ostream &);
explicit Writer(std::ostream &);
~Writer();
bool begin();
......
......@@ -92,6 +92,11 @@ bool Reader::read(int64_t ts) {
return read(ts, [this](const ftl::codecs::StreamPacket &spkt, ftl::codecs::Packet &pkt) {
if (handlers_.size() > spkt.streamID && (bool)handlers_[spkt.streamID]) {
handlers_[spkt.streamID](spkt, pkt);
} else if (spkt.streamID == 255) {
// Broadcast stream, send packets to every source handler.
for (auto &h : handlers_) {
h(spkt, pkt);
}
}
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment