fix out filling

This commit is contained in:
mpromonet 2021-04-03 15:12:27 +01:00
parent 8c186d8694
commit 4ae6adf764
3 changed files with 10 additions and 5 deletions

View File

@ -144,7 +144,7 @@ class V4l2RTSPServer {
StreamReplicator* CreateVideoReplicator( StreamReplicator* CreateVideoReplicator(
const V4L2DeviceParameters& inParam, const V4L2DeviceParameters& inParam,
int queueSize, int useThread, int repeatConfig, int queueSize, int useThread, int repeatConfig,
const std::string& outputFile, V4l2IoType ioTypeOut, V4l2Output* out, const std::string& outputFile, V4l2IoType ioTypeOut, V4l2Output*& out,
std::string& rtpVideoFormat); std::string& rtpVideoFormat);
#ifdef HAVE_ALSA #ifdef HAVE_ALSA
@ -287,4 +287,4 @@ class V4l2RTSPServer {
UsageEnvironment* m_env; UsageEnvironment* m_env;
RTSPServer* m_rtspServer; RTSPServer* m_rtspServer;
int m_rtspPort; int m_rtspPort;
}; };

View File

@ -321,10 +321,12 @@ int main(int argc, char** argv)
decodeDevice(deviceName, videoDev, audioDev); decodeDevice(deviceName, videoDev, audioDev);
std::string baseUrl; std::string baseUrl;
std::string output(outputFile);
if (devList.size() > 1) if (devList.size() > 1)
{ {
baseUrl = getDeviceName(videoDev); baseUrl = getDeviceName(videoDev);
baseUrl.append("/"); baseUrl.append("/");
output.append(getDeviceName(videoDev));
} }
V4l2Output* out = NULL; V4l2Output* out = NULL;
@ -333,7 +335,7 @@ int main(int argc, char** argv)
StreamReplicator* videoReplicator = rtspServer.CreateVideoReplicator( StreamReplicator* videoReplicator = rtspServer.CreateVideoReplicator(
inParam, inParam,
queueSize, useThread, repeatConfig, queueSize, useThread, repeatConfig,
outputFile + getDeviceName(videoDev), ioTypeOut, out, output, ioTypeOut, out,
rtpVideoFormat); rtpVideoFormat);
if (out != NULL) { if (out != NULL) {
outList.push_back(out); outList.push_back(out);

View File

@ -26,7 +26,7 @@
StreamReplicator* V4l2RTSPServer::CreateVideoReplicator( StreamReplicator* V4l2RTSPServer::CreateVideoReplicator(
const V4L2DeviceParameters& inParam, const V4L2DeviceParameters& inParam,
int queueSize, int useThread, int repeatConfig, int queueSize, int useThread, int repeatConfig,
const std::string& outputFile, V4l2IoType ioTypeOut, V4l2Output* out, const std::string& outputFile, V4l2IoType ioTypeOut, V4l2Output*& out,
std::string& rtpVideoFormat) { std::string& rtpVideoFormat) {
StreamReplicator* videoReplicator = NULL; StreamReplicator* videoReplicator = NULL;
@ -48,6 +48,9 @@ StreamReplicator* V4l2RTSPServer::CreateVideoReplicator(
if (out != NULL) if (out != NULL)
{ {
outfd = out->getFd(); outfd = out->getFd();
LOG(INFO) << "Output fd:" << outfd << " " << outputFile;
} else {
LOG(WARN) << "Cannot open output:" << outputFile;
} }
} }
@ -197,4 +200,4 @@ StreamReplicator* V4l2RTSPServer::CreateAudioReplicator(
} }
return audioReplicator; return audioReplicator;
} }
#endif #endif