Skip to content

Commit 05f3db6

Browse files
committed
rxtx/ultragrid_rtp: hide implementation
move the class to .cpp file
1 parent dce129c commit 05f3db6

3 files changed

Lines changed: 66 additions & 78 deletions

File tree

src/hd-rum-translator/hd-rum-recompress.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@
5656
#include "tv.h"
5757
#include "video_compress.h"
5858

59-
#include "video_rxtx/ultragrid_rtp.hpp"
6059
#include "utils/profile_timer.hpp"
60+
#include "video_rxtx.h" // for rxtx_medium_params, vrxtx_pa...
61+
#include "video_rxtx/ultragrid_rtp.hpp" // for ultragrid_rtp_get_ssrc
6162

6263
namespace {
6364
struct compress_state_deleter{

src/video_rxtx/ultragrid_rtp.cpp

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@
5252
// IWYU pragma: no_include <sys/time.h> # via tv.h
5353
// IWYU pragma: no_include <iterator> # std::pair is rather in utility
5454

55+
#ifdef _WIN32
56+
#include <basetsd.h> // for SSIZE_T
57+
typedef SSIZE_T ssize_t;
58+
#else
59+
#include <sys/types.h> // for ssize_t
60+
#endif
5561

5662
#include "control_socket.h"
5763
#include "debug.h"
@@ -76,13 +82,70 @@
7682
#include "video_rxtx/rtp.hpp" // for rtp_video_rxtx
7783
#include "ug_runtime_error.hpp"
7884
#include "utils/worker.h"
79-
#include "video_rxtx/rtp.hpp"
8085

8186
constexpr uint32_t MAGIC = to_fourcc('V', 'X', 'u', 'r');
8287

8388
using namespace std;
8489
using ultragrid::pthread_mutex_guard;
8590

91+
class ultragrid_rtp_video_rxtx {
92+
public:
93+
const uint32_t magic;
94+
ultragrid_rtp_video_rxtx(const struct vrxtx_params *params,
95+
const struct common_opts *common);
96+
virtual ~ultragrid_rtp_video_rxtx();
97+
virtual void send_frame(std::shared_ptr<video_frame>) noexcept;
98+
void join();
99+
static void *receiver_thread(void *arg);
100+
101+
// transcoder functions
102+
friend ssize_t hd_rum_decompress_write(void *state, void *buf, size_t count);
103+
private:
104+
struct rtp_rxtx_common *m_rtp_common;
105+
void *receiver_loop();
106+
static void *send_frame_async_callback(void *arg);
107+
virtual void send_frame_async(std::shared_ptr<video_frame>);
108+
109+
void receiver_process_messages();
110+
void remove_display_from_decoders();
111+
struct vcodec_state *new_video_decoder(struct display *d);
112+
static void destroy_video_decoder(void *state);
113+
114+
enum video_mode m_decoder_mode;
115+
struct display *m_display_device;
116+
std::list<struct display *> m_display_copies; ///< some displays can be "forked"
117+
///< and used simultaneously from
118+
///< multiple decoders, here are
119+
///< saved forked states
120+
121+
/**
122+
* This variables serve as a notification when asynchronous sending exits
123+
* @{ */
124+
bool m_async_sending = false;
125+
std::condition_variable m_async_sending_cv;
126+
std::mutex m_async_sending_lock;
127+
/// @}
128+
129+
long long int m_send_bytes_total;
130+
struct control_state *m_control;
131+
struct module *m_parent;
132+
std::string m_encryption;
133+
134+
time_ns_t m_start_time;
135+
long long int m_nano_per_frame_actual_cumul = 0;
136+
long long int m_nano_per_frame_expected_cumul = 0;
137+
long long int m_compress_millis_cumul = 0;
138+
139+
struct module *m_receiver_mod{};
140+
141+
bool m_should_exit = false;
142+
static void should_exit(void *state);
143+
144+
friend uint32_t ultragrid_rtp_get_ssrc(void *state);
145+
friend int ultragrid_rtp_send_raw_rtp_data(void *state, char *buf,
146+
int count);
147+
};
148+
86149
ultragrid_rtp_video_rxtx::ultragrid_rtp_video_rxtx(
87150
const struct vrxtx_params *params, const struct common_opts *common) :
88151
magic(MAGIC),

src/video_rxtx/ultragrid_rtp.hpp

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -38,83 +38,7 @@
3838
#ifndef VIDEO_RXTX_ULTRAGRID_RTP_H_
3939
#define VIDEO_RXTX_ULTRAGRID_RTP_H_
4040

41-
#include "video_rxtx/rtp.hpp"
42-
43-
#include <condition_variable>
44-
#include <cstddef> // for size_t
4541
#include <cstdint> // for uint32_t
46-
#include <list>
47-
#include <memory> // for shared_ptr
48-
#include <mutex>
49-
#include <string>
50-
51-
#ifdef _WIN32
52-
#include <basetsd.h> // for SSIZE_T
53-
typedef SSIZE_T ssize_t;
54-
#else
55-
#include <sys/types.h> // for ssize_t
56-
#endif
57-
58-
#include "tv.h" // for time_ns_t
59-
#include "types.h" // for video_frame (ptr only), video_mode
60-
61-
class ultragrid_rtp_video_rxtx {
62-
public:
63-
const uint32_t magic;
64-
ultragrid_rtp_video_rxtx(const struct vrxtx_params *params,
65-
const struct common_opts *common);
66-
virtual ~ultragrid_rtp_video_rxtx();
67-
virtual void send_frame(std::shared_ptr<video_frame>) noexcept;
68-
void join();
69-
static void *receiver_thread(void *arg);
70-
71-
// transcoder functions
72-
friend ssize_t hd_rum_decompress_write(void *state, void *buf, size_t count);
73-
private:
74-
struct rtp_rxtx_common *m_rtp_common;
75-
void *receiver_loop();
76-
static void *send_frame_async_callback(void *arg);
77-
virtual void send_frame_async(std::shared_ptr<video_frame>);
78-
79-
void receiver_process_messages();
80-
void remove_display_from_decoders();
81-
struct vcodec_state *new_video_decoder(struct display *d);
82-
static void destroy_video_decoder(void *state);
83-
84-
enum video_mode m_decoder_mode;
85-
struct display *m_display_device;
86-
std::list<struct display *> m_display_copies; ///< some displays can be "forked"
87-
///< and used simultaneously from
88-
///< multiple decoders, here are
89-
///< saved forked states
90-
91-
/**
92-
* This variables serve as a notification when asynchronous sending exits
93-
* @{ */
94-
bool m_async_sending = false;
95-
std::condition_variable m_async_sending_cv;
96-
std::mutex m_async_sending_lock;
97-
/// @}
98-
99-
long long int m_send_bytes_total;
100-
struct control_state *m_control;
101-
struct module *m_parent;
102-
std::string m_encryption;
103-
104-
time_ns_t m_start_time;
105-
long long int m_nano_per_frame_actual_cumul = 0;
106-
long long int m_nano_per_frame_expected_cumul = 0;
107-
long long int m_compress_millis_cumul = 0;
108-
109-
struct module *m_receiver_mod{};
110-
111-
bool m_should_exit = false;
112-
static void should_exit(void *state);
113-
114-
friend uint32_t ultragrid_rtp_get_ssrc(void *state);
115-
friend int ultragrid_rtp_send_raw_rtp_data(void *state, char *buf,
116-
int count);
117-
};
11842

11943
uint32_t ultragrid_rtp_get_ssrc(void *state);
12044
int ultragrid_rtp_send_raw_rtp_data(void *state, char *buf, int count);

0 commit comments

Comments
 (0)