整理代码
This commit is contained in:
commit
c7b4e178ec
364 changed files with 59691 additions and 0 deletions
121
video/zlmediakit/Service.h
Normal file
121
video/zlmediakit/Service.h
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
#ifndef C85BB91A_0670_4C40_AB2B_A96B8DDBC346
|
||||
#define C85BB91A_0670_4C40_AB2B_A96B8DDBC346
|
||||
/*
|
||||
*******************************************************************************
|
||||
* INCLUDE
|
||||
*******************************************************************************
|
||||
*/
|
||||
#include <Poco/URI.h>
|
||||
#include "Poco/Dynamic/Struct.h"
|
||||
#include "Poco/Tuple.h"
|
||||
#include "Poco/JSON/Object.h"
|
||||
#include "Poco/JSON/Parser.h"
|
||||
#include "Poco/JSON/Query.h"
|
||||
#include "Poco/JSON/JSONException.h"
|
||||
#include <Poco/Util/IniFileConfiguration.h>
|
||||
#include <Poco/AutoPtr.h>
|
||||
|
||||
namespace Video
|
||||
{
|
||||
namespace ZLMediaKit
|
||||
{
|
||||
/*
|
||||
*******************************************************************************
|
||||
* CLASS DECLARE
|
||||
*******************************************************************************
|
||||
*/
|
||||
class Service
|
||||
{
|
||||
public:
|
||||
struct StremPusherProxyInfo
|
||||
{
|
||||
int code = 0;
|
||||
std::string msg;
|
||||
|
||||
int status = 1;
|
||||
|
||||
uint64_t liveSeconds;
|
||||
|
||||
uint64_t republishCount;
|
||||
};
|
||||
|
||||
struct StreamProxyInfo
|
||||
{
|
||||
int code = 0;
|
||||
std::string msg;
|
||||
|
||||
int status = 1;
|
||||
|
||||
uint64_t liveSecs;
|
||||
|
||||
uint64_t rePullCount;
|
||||
};
|
||||
|
||||
public:
|
||||
static std::string getDefaultHost();
|
||||
|
||||
static Poco::Dynamic::Array getMediaList(std::string schema = "", std::string app = "", std::string stream = "");
|
||||
|
||||
static bool isMediaOnline(std::string schema, std::string app, std::string stream);
|
||||
|
||||
static Poco::Tuple<int, std::string> addStreamPusherProxy(std::string schema, std::string app, std::string stream,
|
||||
std::string url, std::string rtp_type = "1");
|
||||
|
||||
static int delStreamPusherProxy(std::string key);
|
||||
|
||||
static int getStremPusherProxyInfo(std::string key, StremPusherProxyInfo& info);
|
||||
|
||||
static int startSendRtp(std::string app, std::string stream, std::string ssrc, std::string url, std::string port,
|
||||
std::string udp = "1");
|
||||
|
||||
static int startSendRtpPassive(std::string app, std::string stream, std::string ssrc, std::string udp = "1");
|
||||
|
||||
static int stopSendRtp(std::string app, std::string stream, std::string ssrc);
|
||||
|
||||
static bool isRecording(std::string app, std::string stream, int type);
|
||||
|
||||
static bool startRecord(std::string app, std::string stream, int type, std::string customized_path, int max_second);
|
||||
|
||||
static bool stopRecord(std::string app, std::string stream, int type);
|
||||
|
||||
static std::string getMp4RecordFile(std::string app, std::string stream, std::string period,
|
||||
std::string customized_path);
|
||||
|
||||
static Poco::Tuple<int, std::string> addStreamProxy(std::string app, std::string stream, std::string url,
|
||||
int auto_close = 1, int rtp_type = 0);
|
||||
|
||||
static bool delStreamProxy(std::string key);
|
||||
|
||||
static int getProxyInfo(std::string key, StreamProxyInfo& info);
|
||||
|
||||
static Poco::Tuple<int, std::string> close_streams(std::string app, std::string stream, int force = 1);
|
||||
|
||||
static Poco::JSON::Object::Ptr getServerConfig();
|
||||
|
||||
template <typename T> static T getServerConfigOne(std::string paramKey)
|
||||
{
|
||||
auto allConfig = getServerConfig();
|
||||
T t = allConfig->getValue<T>(paramKey);
|
||||
return t;
|
||||
}
|
||||
|
||||
static bool setServerConfig(std::string key, std::string val);
|
||||
|
||||
static Poco::Dynamic::Array listStreamProxy();
|
||||
|
||||
static Poco::Dynamic::Array listStreamPusherProxy();
|
||||
|
||||
private:
|
||||
static Poco::DynamicStruct sendRequest(std::string url);
|
||||
|
||||
static Poco::JSON::Object::Ptr sendRequestReturnJson(std::string uri);
|
||||
|
||||
static void addSecurityParameter(Poco::URI& uri);
|
||||
|
||||
static Poco::AutoPtr<Poco::Util::IniFileConfiguration> loadIniFileConfig();
|
||||
|
||||
static int getHttpPort();
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue