提交 66808f5d authored 作者: blu's avatar blu

upload video files

上级 3d278234
...@@ -183,7 +183,21 @@ private: ...@@ -183,7 +183,21 @@ private:
ipcPort = to_string(ipc["port"]); ipcPort = to_string(ipc["port"]);
} }
urlIn = "rtsp://" + user + ":" + passwd + "@" + ipc["addr"].get<string>() + ":" + ipcPort + "/h264/ch1/main/av_stream"; //
if(1){
string chan = "ch1";
string streamName = "main";
if(evslicer.count("channel") != 0 && !evslicer["channel"].get<string>().empty()){
chan = evslicer["channel"].get<string>();
}
if(evslicer.count("streamName") != 0 && !evslicer["streamName"].get<string>().empty()){
streamName = evslicer["streamName"].get<string>();
}
urlIn = "rtsp://" + user + ":" + passwd + "@" + ipc["addr"].get<string>() + ":" + ipcPort + "/h264/" + chan + "/" + streamName + "/av_stream";
}else{
urlIn = ipc["addr"].get<string>();
}
addr = evpuller["addr"].get<string>(); addr = evpuller["addr"].get<string>();
spdlog::info("evpuller {} connecting to IPC {}", selfId, urlIn); spdlog::info("evpuller {} connecting to IPC {}", selfId, urlIn);
if(addr == "*" || addr == "0.0.0.0") { if(addr == "*" || addr == "0.0.0.0") {
...@@ -239,8 +253,14 @@ protected: ...@@ -239,8 +253,14 @@ protected:
void run() void run()
{ {
int ret = 0; int ret = 0;
AVDictionary * optsIn; AVDictionary * optsIn = nullptr;
av_dict_set(&optsIn, "rtsp_transport", "tcp", 0); string proto = urlIn.substr(0,4);
if(proto == "rtsp") {
av_dict_set(&optsIn, "rtsp_transport", "tcp", 0);
}else{
//
}
spdlog::info("evpuller {} openning stream: {}", selfId, urlIn); spdlog::info("evpuller {} openning stream: {}", selfId, urlIn);
if ((ret = avformat_open_input(&pAVFormatInput, urlIn.c_str(), NULL, &optsIn)) < 0) { if ((ret = avformat_open_input(&pAVFormatInput, urlIn.c_str(), NULL, &optsIn)) < 0) {
spdlog::error("evpuller {} Could not open input stream {}", selfId, urlIn); spdlog::error("evpuller {} Could not open input stream {}", selfId, urlIn);
......
...@@ -167,6 +167,8 @@ private: ...@@ -167,6 +167,8 @@ private:
} }
selfId = devSn + ":evslicer:" + to_string(iid); selfId = devSn + ":evslicer:" + to_string(iid);
//
if(ipc.count("sn") == 0) { if(ipc.count("sn") == 0) {
ipcSn = "unkown"; ipcSn = "unkown";
} }
...@@ -174,6 +176,10 @@ private: ...@@ -174,6 +176,10 @@ private:
ipcSn = ipc["sn"]; ipcSn = ipc["sn"];
} }
if(evslicer.count("video-server-addr") != 0 && !evslicer["video-server-addr"].get<string>().empty()) {
videoFileServerApi = evslicer["video-server-addr"].get<string>();
}
this->videoFileServerApi += this->ipcSn; this->videoFileServerApi += this->ipcSn;
json evpuller = ipc["modules"]["evpuller"][0]; json evpuller = ipc["modules"]["evpuller"][0];
...@@ -206,10 +212,6 @@ private: ...@@ -206,10 +212,6 @@ private:
numSlices = hours * 60 * 60 /seconds; numSlices = hours * 60 * 60 /seconds;
if(evslicer.count("video-server-addr") != 0 && !evslicer["video-server-addr"].get<string>().empty()) {
videoFileServerApi = evslicer["video-server-addr"].get<string>();
}
spdlog::info("evslicer mkdir -p {}", selfId, urlOut); spdlog::info("evslicer mkdir -p {}", selfId, urlOut);
ret = system((string("mkdir -p ") + urlOut).c_str()); ret = system((string("mkdir -p ") + urlOut).c_str());
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论