#include "HxVideoPipeline.h" #include QMap pipelines; void device_context_status_callback(QUuid uuid, ConnectionStatus status) { auto item = pipelines.find(uuid); if (item != pipelines.end()) { auto fb = dynamic_cast(item.value()); fb->device_status_callback(status); } } void device_context_stream_callback(QUuid uuid, HxVideoFrame videoframe) { QMap::iterator item = pipelines.find(uuid); if (item != pipelines.end()) { auto fb = dynamic_cast(item.value()); fb->device_stream_callback(videoframe.copy()); } videoframe.free(); } HxVideoPipeline::HxVideoPipeline() { uuid = QUuid::createUuid(); context.uuid = uuid; pipelines.insert(uuid, this); } void HxVideoPipeline::subscribe() { unsubscribe(); if(!context.rtspurl.isNull()) { context.status_callback = device_context_status_callback; context.stream_callback = device_context_stream_callback; HxVideoDevices::subscribe(context); } } void HxVideoPipeline::unsubscribe() { if(!context.rtspurl.isNull()) { context.status_callback = nullptr; context.stream_callback = nullptr; HxVideoDevices::unsubscribe(context); } } void HxVideoPipeline::set_context(QString type, QString address, int port, int channel, int stream) { context.channel = channel; context.stream = stream; context.rtspurl = HxVideoDevices::rtspurl(type, address, port, channel, stream); } bool HxVideoPipeline::subscribe_status() { return context.stream_callback != nullptr; } bool HxVideoPipeline::equal(HxVideoPipeline *content) { return this->uuid == content->uuid; } void HxVideoPipeline::device_stream_callback(HxVideoFrame frame) { Q_UNUSED(frame); frame.free(); } void HxVideoPipeline::device_status_callback(ConnectionStatus status) { Q_UNUSED(status); }