add suffix to output when more than one stream

This commit is contained in:
mpromonet 2021-04-03 15:47:35 +02:00
parent afd5402ff3
commit 8c186d8694

View File

@ -309,7 +309,7 @@ int main(int argc, char** argv)
unsigned short rtcpPortNum = rtpPortNum+1; unsigned short rtcpPortNum = rtpPortNum+1;
decodeMulticastUrl(maddr, destinationAddress, rtpPortNum, rtcpPortNum); decodeMulticastUrl(maddr, destinationAddress, rtpPortNum, rtcpPortNum);
V4l2Output* out = NULL; std::list<V4l2Output*> outList;
int nbSource = 0; int nbSource = 0;
std::list<std::string>::iterator devIt; std::list<std::string>::iterator devIt;
for ( devIt=devList.begin() ; devIt!=devList.end() ; ++devIt) for ( devIt=devList.begin() ; devIt!=devList.end() ; ++devIt)
@ -327,14 +327,17 @@ int main(int argc, char** argv)
baseUrl.append("/"); baseUrl.append("/");
} }
V4l2Output* out = NULL;
V4L2DeviceParameters inParam(videoDev.c_str(), videoformatList, width, height, fps, ioTypeIn, verbose, openflags); V4L2DeviceParameters inParam(videoDev.c_str(), videoformatList, width, height, fps, ioTypeIn, verbose, openflags);
std::string rtpVideoFormat; std::string rtpVideoFormat;
StreamReplicator* videoReplicator = rtspServer.CreateVideoReplicator( StreamReplicator* videoReplicator = rtspServer.CreateVideoReplicator(
inParam, inParam,
queueSize, useThread, repeatConfig, queueSize, useThread, repeatConfig,
outputFile, ioTypeOut, out, outputFile + getDeviceName(videoDev), ioTypeOut, out,
rtpVideoFormat); rtpVideoFormat);
if (out != NULL) {
outList.push_back(out);
}
// Init Audio Capture // Init Audio Capture
StreamReplicator* audioReplicator = NULL; StreamReplicator* audioReplicator = NULL;
@ -371,9 +374,11 @@ int main(int argc, char** argv)
LOG(NOTICE) << "Exiting...."; LOG(NOTICE) << "Exiting....";
} }
if (out) while (!outList.empty())
{ {
V4l2Output* out = outList.back();
delete out; delete out;
outList.pop_back();
} }
} }