Logo
ApraPipes 1.0
Loading...
Searching...
No Matches
RTSPPusher.h
1#pragma once
2
3#include "Module.h"
4#include "declarative/PropertyMacros.h"
5
7{
8public:
9 // Default constructor for declarative pipeline
10 RTSPPusherProps() : URL(""), title("stream"), isTCP(true), encoderTargetKbps(2*1024)
11 {
12 }
13
14 RTSPPusherProps(std::string _URL, std::string _title) : URL(_URL), title(_title), isTCP(true), encoderTargetKbps(2*1024)
15 {
16 }
17
19 {
20 }
21
22 std::string URL;
23 std::string title;
24 bool isTCP;
26
27 // ============================================================
28 // Property Binding for Declarative Pipeline
29 // ============================================================
30 template<typename PropsT>
31 static void applyProperties(
32 PropsT& props,
33 const std::map<std::string, apra::ScalarPropertyValue>& values,
34 std::vector<std::string>& missingRequired
35 ) {
36 apra::applyProp(props.URL, "url", values, true, missingRequired);
37 apra::applyProp(props.title, "title", values, false, missingRequired);
38 apra::applyProp(props.isTCP, "isTCP", values, false, missingRequired);
39 // Handle uint32_t via int64_t
40 auto it = values.find("encoderTargetKbps");
41 if (it != values.end()) {
42 if (auto* val = std::get_if<int64_t>(&it->second)) {
43 props.encoderTargetKbps = static_cast<uint32_t>(*val);
44 }
45 }
46 }
47
48 apra::ScalarPropertyValue getProperty(const std::string& propName) const {
49 if (propName == "url") return URL;
50 if (propName == "title") return title;
51 if (propName == "isTCP") return isTCP;
52 if (propName == "encoderTargetKbps") return static_cast<int64_t>(encoderTargetKbps);
53 throw std::runtime_error("Unknown property: " + propName);
54 }
55
56 bool setProperty(const std::string& propName, const apra::ScalarPropertyValue& value) {
57 return false; // All properties are static
58 }
59
60 static std::vector<std::string> dynamicPropertyNames() {
61 return {};
62 }
63};
64
65class RTSPPusher : public Module
66{
67public:
75
77 virtual ~RTSPPusher();
78
79 bool init();
80 bool term();
81
82protected:
83 bool process(frame_container &frames);
84 bool validateInputPins();
85 bool shouldTriggerSOS();
86 bool processSOS(frame_sp &frame);
87 bool processEOS(string& pinId);
88
89private:
90 class Detail;
91 boost::shared_ptr<Detail> mDetail;
92};
Definition FacialLandmarksCV.cpp:17
Definition Module.h:33
Definition Module.h:151
Definition RTSPPusher.h:7
std::string URL
Definition RTSPPusher.h:22
static std::vector< std::string > dynamicPropertyNames()
Definition RTSPPusher.h:60
RTSPPusherProps()
Definition RTSPPusher.h:10
~RTSPPusherProps()
Definition RTSPPusher.h:18
RTSPPusherProps(std::string _URL, std::string _title)
Definition RTSPPusher.h:14
static void applyProperties(PropsT &props, const std::map< std::string, apra::ScalarPropertyValue > &values, std::vector< std::string > &missingRequired)
Definition RTSPPusher.h:31
uint32_t encoderTargetKbps
Definition RTSPPusher.h:25
bool isTCP
Definition RTSPPusher.h:24
bool setProperty(const std::string &propName, const apra::ScalarPropertyValue &value)
Definition RTSPPusher.h:56
std::string title
Definition RTSPPusher.h:23
apra::ScalarPropertyValue getProperty(const std::string &propName) const
Definition RTSPPusher.h:48
Definition RTSPPusher.h:66
bool processEOS(string &pinId)
Definition RTSPPusher.cpp:410
bool init()
Definition RTSPPusher.cpp:305
bool shouldTriggerSOS()
Definition RTSPPusher.cpp:405
RTSPPusher(RTSPPusherProps props)
Definition RTSPPusher.cpp:292
bool process(frame_container &frames)
Definition RTSPPusher.cpp:354
bool processSOS(frame_sp &frame)
Definition RTSPPusher.cpp:381
virtual ~RTSPPusher()
Definition RTSPPusher.cpp:300
EventType
Definition RTSPPusher.h:69
@ CONNECTION_FAILED
Definition RTSPPusher.h:71
@ WRITE_FAILED
Definition RTSPPusher.h:72
@ CONNECTION_READY
Definition RTSPPusher.h:70
@ STREAM_ENDED
Definition RTSPPusher.h:73
bool validateInputPins()
Definition RTSPPusher.cpp:329
boost::shared_ptr< Detail > mDetail
Definition RTSPPusher.h:91
bool term()
Definition RTSPPusher.cpp:315
void applyProp(T &member, const char *propName, const std::map< std::string, ScalarPropertyValue > &values, bool isRequired, std::vector< std::string > &missingRequired)
Definition PropertyMacros.h:36
std::variant< int64_t, double, bool, std::string > ScalarPropertyValue
Definition ModuleRegistry.h:30