You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

48 lines
1.3 KiB

/*
MediaMtx (C++) - control API (MediaMTX: internal/api, the same v3 URLs for the parts that exist here)
GET /v3/paths/list paths with their state
GET /v3/paths/get/{name}
GET /v3/config/paths/list path configurations
GET /v3/config/paths/get/{name}
POST /v3/config/paths/add/{name} {"source":"rtsp://...","record":true,"rtspTransport":"tcp"}
PATCH /v3/config/paths/patch/{name} the same fields, only those given are changed
POST /v3/config/paths/replace/{name}
DELETE /v3/config/paths/delete/{name}
A change is applied at once (only the changed path restarts) and saved to the paths file.
*/
#pragma once
#include <functional>
#include <string>
#include <vector>
#include "../conf/conf.h"
#include "../core/pathManager.h"
#include <protocols/httpp/httpServer.h>
namespace mtx {
class Api : public LogParent
{
public:
// applyConfs: replaces the path list (validated), returns false + err on failure
typedef std::function<bool(const std::vector<PathConf> &, std::string &)> ApplyFn;
Api(const Conf & global, PathManager * paths, ApplyFn apply);
~Api();
bool start(std::string & err);
void stop();
private:
void handle(const HttpRequest & req, HttpResponse & res);
Conf m_global;
PathManager * m_pPaths;
ApplyFn m_apply;
HttpServer m_http;
};
} // namespace mtx