Commit e133208f by 李维杰

将mqtt地址放到配置文件里

parent 7ac30709
#include "cmd_transport_mqtt.h" #include "cmd_transport_mqtt.h"
static const std::string kMqttUrl = "mqq-large.offcncloud.com";//"47.95.181.254"; //static const std::string kMqttUrl = "mqq-large-cdn.offcncloud.com";//"mqq-large.offcncloud.com";//"47.95.181.254";
static const std::string kUseName = "admin"; static const std::string kUseName = "admin";
static const std::string kPassWord = "admin"; static const std::string kPassWord = "admin";
static const std::string kTopicServer = "whiteboard/c50d86590070538228fdfa19978a87e3/liweijieisvip_309485708";//"rtc_server"; //static const std::string kTopicServer = "whiteboard/c50d86590070538228fdfa19978a87e3/liweijieisvip_309485708";//"rtc_server";
static struct Options static struct Options
{ {
...@@ -22,11 +22,11 @@ CmdTransportMqtt::CmdTransportMqtt(std::string uu_id, std::string room_id, Trans ...@@ -22,11 +22,11 @@ CmdTransportMqtt::CmdTransportMqtt(std::string uu_id, std::string room_id, Trans
{ {
mqtt_client_ = NULL; mqtt_client_ = NULL;
} }
bool CmdTransportMqtt::ConnectServer() bool CmdTransportMqtt::ConnectServer(std::string mqtt)
{ {
options.connection = (char *)malloc(128); options.connection = (char *)malloc(128);
memset(options.connection, 0, 128); memset(options.connection, 0, 128);
memcpy(options.connection, kMqttUrl.c_str(), kMqttUrl.size()); memcpy(options.connection, mqtt.c_str(), mqtt.size());
options.verbose = 0; options.verbose = 0;
options.test_no = -1; options.test_no = -1;
......
...@@ -17,7 +17,7 @@ public: ...@@ -17,7 +17,7 @@ public:
CmdTransportMqtt(std::string uu_id, std::string room_id, TransportObserver *observer); CmdTransportMqtt(std::string uu_id, std::string room_id, TransportObserver *observer);
public: public:
bool ConnectServer(); bool ConnectServer(std::string mqtt);
bool SendRequest(std::string req); bool SendRequest(std::string req);
void DisConnectServer(); void DisConnectServer();
...@@ -40,6 +40,7 @@ private: ...@@ -40,6 +40,7 @@ private:
TransportObserver *observer_; TransportObserver *observer_;
private: private:
std::string mqtt_url_;
std::string uu_id_; std::string uu_id_;
std::string room_id_; std::string room_id_;
}; };
\ No newline at end of file
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <string> #include <string>
#include "json/json.h" #include "json/json.h"
const std::string kMqttUrl = "mqtt_url";
const std::string kRoomId = "roomid"; const std::string kRoomId = "roomid";
const std::string kUuId = "uuid"; const std::string kUuId = "uuid";
const std::string kFilePath = "filepath"; const std::string kFilePath = "filepath";
...@@ -76,6 +77,7 @@ public: ...@@ -76,6 +77,7 @@ public:
return false; return false;
} }
m_sMqttUrl = root[kMqttUrl].asString();
m_sRoomId = root[kRoomId].asString(); m_sRoomId = root[kRoomId].asString();
m_sUuId = root[kUuId].asString(); m_sUuId = root[kUuId].asString();
m_sFilePath = root[kFilePath].asString(); m_sFilePath = root[kFilePath].asString();
...@@ -88,12 +90,14 @@ public: ...@@ -88,12 +90,14 @@ public:
return true; return true;
} }
std::string MqttUrl() { return m_sMqttUrl; }
std::string RoomId() { return m_sRoomId; } std::string RoomId() { return m_sRoomId; }
std::string UuId() { return m_sUuId; } std::string UuId() { return m_sUuId; }
std::string FilePath() { return m_sFilePath; } std::string FilePath() { return m_sFilePath; }
std::string MediaKey() { return m_sMediaKey; } std::string MediaKey() { return m_sMediaKey; }
private: private:
std::string m_sMqttUrl;
std::string m_sRoomId; std::string m_sRoomId;
std::string m_sUuId; std::string m_sUuId;
std::string m_sFilePath; std::string m_sFilePath;
......
...@@ -29,7 +29,7 @@ bool RebuildManager::Init() ...@@ -29,7 +29,7 @@ bool RebuildManager::Init()
bool RebuildManager::ConnectMqttServer() bool RebuildManager::ConnectMqttServer()
{ {
if (!m_pMqtt) return false; if (!m_pMqtt) return false;
if (!m_pMqtt->ConnectServer()) return false; if (!m_pMqtt->ConnectServer(m_configData.MqttUrl())) return false;
return true; return true;
} }
...@@ -76,7 +76,7 @@ void RebuildManager::DoRunning() ...@@ -76,7 +76,7 @@ void RebuildManager::DoRunning()
int nRet = m_fileReader.ReadFile(pkt); int nRet = m_fileReader.ReadFile(pkt);
if (nRet == -1) if (nRet == -1)
{ {
printf("End of media file ...\n"); printf("end of media file ...\n");
m_fileReader.SetEof(true); m_fileReader.SetEof(true);
} }
else else
......
...@@ -54,12 +54,12 @@ int main() ...@@ -54,12 +54,12 @@ int main()
manager->CloseMediaFile(); manager->CloseMediaFile();
manager->DisConnectMqttServer(); manager->DisConnectMqttServer();
printf("Mission completed ...!"); printf("mission completed ...!");
Error: Error:
delete manager; delete manager;
printf("Press enter key to exit ...\n"); printf("press enter key to exit ...\n");
getchar(); getchar();
return 0; return 0;
} }
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<ProjectGuid>{ACEF3A8B-D0B7-4F9B-A37B-1546D99A6BCA}</ProjectGuid> <ProjectGuid>{ACEF3A8B-D0B7-4F9B-A37B-1546D99A6BCA}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>wbrebuild</RootNamespace> <RootNamespace>wbrebuild</RootNamespace>
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0.22621.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
......
{ {
"roomid":"3ae42ba21356a02a9535092b0c6b777b", "mqtt_url":"mqq-large.offcncloud.com",
"roomid":"b9d36b0a22268130643765deca9a03b2",
"uuid":"liweijieisvip_309", "uuid":"liweijieisvip_309",
"filepath":"https://vod-live.offcncloud.com/vod/20211109037879836/vod/47a480ebd9a2c46912ac21836aaeb22e/index.m3u8", "filepath":"https://live-record-offcncloud.bj.bcebos.com/bd-play.offcncloud.com/pro/2023040373900774/record/index_t.m3u8"
"key":"7b539939e9103688" "key":"ts加密key"
} }
\ No newline at end of file
1 将 wb_rebuild_config.ini 拷贝到当前目录 1 将 wb_rebuild_config.ini 拷贝到当前目录
...@@ -2,3 +2,7 @@ ...@@ -2,3 +2,7 @@
2 修改配置文件内容 2 修改配置文件内容
3 将thirdparty下的相关dll放到当前目录 3 将thirdparty下的相关dll放到当前目录
4 启动exe 4 启动exe
注意:
配置文件中的key为加密的ts文件的key,没有则删掉;
uuid可以随机填写一个
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment