#ifndef CHANNEL_H#define CHANNEL_H#include <QObject>#include "Link.h"#include <QMap>#include <QTimer>#include "Json.h"struct Stream{QString streamPath;QString streamSuffix;LinkObject *mux;LinkObject *udpServer;static LinkObject *httpServer;static LinkObject *rtspServer;static LinkObject *webrtcServer;Stream(QString type, QString suffix, QString chnId) : streamSuffix(suffix){mux = nullptr;udpServer = nullptr;QString streamFormat;if (type != "ndi"){mux = Link::create("Mux");if (type == "ts"){udpServer = Link::create("TSUdp");mux->linkV(udpServer);}}else{#if !defined HI3516E && !defined HI3516CV610mux = Link::create("NDISend");#endif}if(httpServer==NULL){httpServer=Link::create("TSHttp");QVariantMap httpData;httpData["TSBuffer"]=0;httpServer->start(httpData);}if(rtspServer==NULL){rtspServer=Link::create("Rtsp");rtspServer->start();}if(webrtcServer==NULL){#if !defined(HI3521D) && !defined (HI3531D)webrtcServer=Link::create("WebRTC");#endif}if (mux != nullptr){if (type == "rtmp"){streamPath = "rtmp://127.0.0.1/live/" + streamSuffix;streamFormat = "flv";}else if (type == "push"){streamPath = "rtmp://127.0.0.1/live/test" + chnId;streamFormat = "flv";}else if (type == "hls"){streamPath = "/tmp/hls/" + streamSuffix + ".m3u8";streamFormat = "hls";}else if (type == "srt" || type == "rist"){streamPath = type=="srt" ? "srt://:9000?mode=listener&latency=50" : "rist://@0.0.0.0:1660";streamFormat = "mpegts";}else if (type == "ts" || type == "rtsp" || type == "webrtc"){streamPath = "mem://" + streamSuffix;streamFormat = (type == "ts") ? "mpegts" : type;}QVariantMap data;data["path"] = streamPath;data["format"] = streamFormat;mux->setData(data);}}};class Channel : public QObject{Q_OBJECTpublic:explicit Channel(QObject *parent = 0);virtual void init(QVariantMap cfg=QVariantMap());virtual void updateConfig(QVariantMap cfg);LinkObject *getAudioSrc(const QString &id);QString writeCom(const QString &com);QString doSnap(const int &mod = 0,const QVariantList &chnIds = QVariantList());QString type;bool enableAVS;QString lastAId;int id;QString name;static LinkObject *lineIn;static LinkObject *lineAnr;static LinkObject *lineGain;static LinkObject *alsa;static LinkObject *lineOut;static LinkObject *lineOutGain;static LinkObject *lineOutLastA;static LinkObject *ndiRecv;static LinkObject *usbAlsaIn;static LinkObject *usbAlsaResp;static LinkObject *usbAlsaAnr;static LinkObject *usbAlsaGain;QVariantMap data;LinkObject *audio;LinkObject *video;LinkObject *volume;LinkObject *encA;LinkObject *encV;LinkObject *gain;LinkObject *overlay;LinkObject *snap;bool enable;LinkObject *encV2;QMap<QString,Stream*> streamMap;QMap<QString,Stream*> streamMap_sub;};#endif // CHANNEL_H
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。