Move rxtx_mode global var to class

This commit is contained in:
Martin Pulec
2014-09-22 13:58:16 +02:00
parent af74d48c1c
commit e81f896a00
7 changed files with 10 additions and 8 deletions

View File

@@ -37,8 +37,6 @@ bool ldgm_device_gpu = false;
const char *window_title = NULL;
int rxtx_mode; // MODE_SENDER, MODE_RECEIVER or both
void print_capabilities(int mask)
{
if (mask & CAPABILITY_COMPRESS) {

View File

@@ -95,9 +95,8 @@ extern bool ldgm_device_gpu;
extern const char *window_title;
#define MODE_SENDER 1
#define MODE_RECEIVER 2
extern int rxtx_mode;
#define MODE_SENDER (1<<0)
#define MODE_RECEIVER (1<<1)
// if not NULL, data should be exported
extern char *export_dir;

View File

@@ -456,6 +456,8 @@ int main(int argc, char *argv[])
int bitrate = RATE_AUTO;
int rxtx_mode = 0;
#ifdef USE_MTRACE
mtrace();
#endif
@@ -970,6 +972,7 @@ int main(int argc, char *argv[])
params["parent"].ptr = &root_mod;
params["exporter"].ptr = video_exporter;
params["compression"].ptr = (void *) requested_compression;
params["rxtx_mode"].i = rxtx_mode;
// iHDTV
params["argc"].i = argc;

View File

@@ -112,7 +112,8 @@ void register_video_rxtx(enum rxtx_protocol proto, struct video_rxtx_info info)
(*registred_video_rxtx)[proto] = info;
}
video_rxtx::video_rxtx(map<string, param_u> const &params): m_paused(false), m_compression(NULL),
video_rxtx::video_rxtx(map<string, param_u> const &params): m_paused(false),
m_rxtx_mode(params.at("rxtx_mode").i), m_compression(NULL),
m_video_exporter(static_cast<struct video_export *>(params.at("exporter").ptr)) {
module_init_default(&m_sender_mod);

View File

@@ -92,6 +92,7 @@ protected:
bool m_paused;
struct module m_sender_mod;
struct module m_receiver_mod;
int m_rxtx_mode;
private:
virtual void send_frame(struct video_frame *) = 0;
virtual void *(*get_receiver_thread())(void *arg) = 0;

View File

@@ -133,7 +133,7 @@ rtp_video_rxtx::rtp_video_rxtx(map<string, param_u> const &params) :
m_ipv6 = params.at("use_ipv6").b;
m_requested_mcast_if = (const char *) params.at("mcast_if").ptr;
if ((rxtx_mode & MODE_RECEIVER) == 0) {
if ((m_rxtx_mode & MODE_RECEIVER) == 0) {
// do not occupy recv port if we are not receiving (note that this disables communication with
// our receiver, because RTCP ports are changed as well)
m_recv_port_number = 0;

View File

@@ -179,7 +179,7 @@ void ultragrid_rtp_video_rxtx::receiver_process_messages()
switch (msg->type) {
case RECEIVER_MSG_CHANGE_RX_PORT:
assert(rxtx_mode == MODE_RECEIVER); // receiver only
assert(m_rxtx_mode == MODE_RECEIVER); // receiver only
destroy_rtp_devices(m_network_devices);
m_recv_port_number = msg->new_rx_port;
m_network_devices = initialize_network(m_requested_receiver, m_recv_port_number,