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

Add stream masks and time adjust options

parent e4664a7f
No related branches found
No related tags found
1 merge request!184Implements #257 merger app
......@@ -13,6 +13,9 @@ int main(int argc, char **argv) {
std::string outputfile = root->value("out", std::string("output.ftl"));
std::vector<std::string> paths = *root->get<std::vector<std::string>>("paths");
int timeoff = int(root->value("offset", 0.0f) * 1000.0f);
int stream_mask1 = root->value("mask1",0xFF);
int stream_mask2 = root->value("mask2",0xFF);
if (paths.size() == 0) {
LOG(ERROR) << "Missing input ftl file(s).";
......@@ -52,8 +55,8 @@ int main(int argc, char **argv) {
std::map<int,int> idmap;
int lastid = 0;
bool res = rs[0]->read(90000000000000, [&rs,&out,&idmap,&lastid](const ftl::codecs::StreamPacket &spkt, const ftl::codecs::Packet &pkt) {
if (spkt.streamID > 0) return;
bool res = rs[0]->read(90000000000000, [&rs,&out,&idmap,&lastid,stream_mask1,stream_mask2,timeoff](const ftl::codecs::StreamPacket &spkt, const ftl::codecs::Packet &pkt) {
if (((0x1 << spkt.streamID) & stream_mask1) == 0) return;
ftl::codecs::StreamPacket spkt2 = spkt;
if (idmap.find(spkt.streamID) == idmap.end()) {
......@@ -66,16 +69,16 @@ int main(int argc, char **argv) {
for (size_t j=1; j<rs.size(); ++j) {
ftl::codecs::Reader *r = rs[j];
rs[j]->read(spkt.timestamp+1000, [&out,&idmap,&lastid,j,r](const ftl::codecs::StreamPacket &spkt, const ftl::codecs::Packet &pkt) {
if (spkt.streamID > 0) return;
if (int(spkt.channel) < 32 && spkt.timestamp < r->getStartTime()+1000) return;
rs[j]->read(spkt.timestamp+timeoff, [&out,&idmap,&lastid,j,r,stream_mask2,timeoff](const ftl::codecs::StreamPacket &spkt, const ftl::codecs::Packet &pkt) {
if (((0x1 << spkt.streamID) & stream_mask2) == 0) return;
if (int(spkt.channel) < 32 && spkt.timestamp < r->getStartTime()+timeoff) return;
ftl::codecs::StreamPacket spkt2 = spkt;
if (idmap.find(spkt.streamID + (j << 16)) == idmap.end()) {
idmap[spkt.streamID+(j << 16)] = lastid++;
}
spkt2.streamID = idmap[spkt.streamID + (j << 16)];
spkt2.timestamp -= 1000;
spkt2.timestamp -= timeoff;
out.write(spkt2, pkt);
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment