|
1 | 1 | /** |
2 | | - * @file video_rxtx.hpp |
| 2 | + * @file video_rxtx.h |
3 | 3 | * @author Martin Pulec <pulec@cesnet.cz> |
4 | 4 | */ |
5 | 5 | /* |
|
39 | 39 | #define VIDEO_RXTX_H_ |
40 | 40 |
|
41 | 41 | #ifdef __cplusplus |
42 | | -#include <atomic> |
43 | | -#include <memory> |
44 | | -#include <string> |
45 | | -#endif // defined __cplusplus |
| 42 | +#include <memory> // for std::shared_ptr |
| 43 | +#endif |
46 | 44 |
|
47 | 45 | #include "host.h" |
48 | | -#define WANT_PTHREAD_NULL |
49 | | -#include "compat/misc.h" // for PTHREAD_NULL |
50 | 46 | #include "module.h" |
51 | 47 | #include "types.h" // for codec_t, video_desc, video_frame (ptr only) |
52 | 48 |
|
@@ -114,68 +110,35 @@ struct video_rxtx_info { |
114 | 110 | bool ipv6); |
115 | 111 | void *(*receiver_routine)(void *state); |
116 | 112 | }; |
117 | | - |
118 | | -struct video_rxtx { |
119 | | -public: |
120 | | - virtual ~video_rxtx() noexcept; |
121 | | - void send(std::shared_ptr<struct video_frame>) noexcept; |
122 | | - static const char *get_long_name(std::string const &short_name) noexcept; |
123 | | - /** |
124 | | - * If overridden, children must call also video_rxtx::join() |
125 | | - */ |
126 | | - virtual void join() noexcept; |
127 | | - static video_rxtx *create(std::string const &name, |
128 | | - const struct vrxtx_params *params, |
129 | | - const struct common_opts *opts) noexcept(false); |
130 | | - static void list(bool full) noexcept; |
131 | | - void set_audio_spec(const struct audio_desc *desc, int audio_rx_port, |
132 | | - int audio_tx_port, bool ipv6) noexcept; |
133 | | - |
134 | | - const struct video_rxtx_info *m_impl_funcs = nullptr; |
135 | | - void *m_impl_state = nullptr; |
136 | | - |
137 | | -protected: |
138 | | - video_rxtx(const char *protocol_name, |
139 | | - const struct vrxtx_params *params, |
140 | | - const struct common_opts *opts) noexcept(false); |
141 | | - void check_sender_messages(); |
142 | | - |
143 | | - struct module m_sender_mod; |
144 | | - struct module m_receiver_mod; |
145 | | - unsigned long long int m_frames_sent = 0ull; |
146 | | - struct exporter *m_exporter; |
147 | | - |
148 | | -private: |
149 | | - static void *sender_thread(void *args); |
150 | | - void *sender_loop(); |
151 | | - |
152 | | - struct compress_state *m_compression = nullptr; |
153 | | - pthread_mutex_t m_lock; |
154 | | - |
155 | | - pthread_t m_sender_thread_id = PTHREAD_NULL; |
156 | | - bool m_sender_poisoned = false; |
157 | | - bool m_sender_joined = true; |
158 | | - pthread_t m_receiver_thread_id = PTHREAD_NULL; |
159 | | - |
160 | | - video_desc m_video_desc{}; |
161 | | - std::atomic<codec_t> m_input_codec{}; |
162 | | -}; |
163 | 113 | #endif // defined __cplusplus |
164 | 114 |
|
165 | 115 | #ifdef __cplusplus |
166 | 116 | extern "C" { |
167 | 117 | #endif |
168 | 118 |
|
169 | | -int vrxtx_init(const char *proto_name, const struct vrxtx_params *params, |
170 | | - const struct common_opts *opts, struct video_rxtx **state); |
| 119 | +struct video_rxtx; |
| 120 | + |
| 121 | +int vrxtx_init(const char *proto_name, const struct vrxtx_params *params, |
| 122 | + const struct common_opts *opts, struct video_rxtx **state); |
| 123 | +void vrxtx_destroy(struct video_rxtx *state); |
| 124 | +void vrxtx_list(bool full); |
| 125 | +const char *vrxtx_get_long_name(const char *short_name); |
171 | 126 | const char *vrxtx_get_compression(const char *video_protocol, |
172 | 127 | const char *req_compression); |
173 | | -void vrxtx_join(struct video_rxtx *state); |
174 | | -void vrxtx_destroy(struct video_rxtx *state); |
| 128 | +void vrxtx_join(struct video_rxtx *state); |
| 129 | +void vrxtx_set_audio_spec(struct video_rxtx *state, |
| 130 | + const struct audio_desc *desc, int audio_rx_port, |
| 131 | + int audio_tx_port, bool ipv6); |
| 132 | +void *vrxtx_get_impl_state(struct video_rxtx *state); |
175 | 133 |
|
176 | 134 | #ifdef __cplusplus |
177 | 135 | } // extern "C" |
178 | 136 | #endif |
179 | 137 |
|
| 138 | +#ifdef __cplusplus |
| 139 | +#include <memory> |
| 140 | +void vrxtx_send(struct video_rxtx *state, std::shared_ptr<struct video_frame>); |
| 141 | +#endif |
| 142 | + |
180 | 143 | #endif // VIDEO_RXTX_H_ |
181 | 144 |
|
0 commit comments