mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-20 23:40:18 +00:00
Control: allow changing TX port
This commit is contained in:
@@ -49,7 +49,6 @@ OBJS = @OBJS@ \
|
||||
src/perf.o \
|
||||
src/ntp.o \
|
||||
src/pdb.o \
|
||||
src/sender.o \
|
||||
src/tile.o \
|
||||
src/tv.o \
|
||||
src/transmit.o \
|
||||
@@ -134,6 +133,8 @@ OBJS = @OBJS@ \
|
||||
ldgm-coding/matrix-gen/ldpc-matrix.o \
|
||||
@LIB_SUPPORT_OBJ@ \
|
||||
|
||||
ULTRAGRID_OBJS = src/main.o src/sender.o
|
||||
|
||||
REFLECTOR_OBJS = src/hd-rum-translator/hd-rum-decompress.o \
|
||||
src/hd-rum-translator/hd-rum-recompress.o \
|
||||
src/hd-rum-translator/hd-rum-translator.o
|
||||
@@ -159,9 +160,9 @@ all: $(TARGET) $(GUI_TARGET) bin/import_control_keyboard $(REFLECTOR_TARGET) mod
|
||||
|
||||
modules: @LIB_TARGETS@
|
||||
|
||||
$(TARGET): $(OBJS) src/main.o $(HEADERS)
|
||||
$(TARGET): $(OBJS) $(ULTRAGRID_OBJS) $(HEADERS)
|
||||
@if [ ! -d bin ]; then mkdir bin; fi
|
||||
$(LINKER) $(LDFLAGS) $(OBJS) src/main.o $(LIBS) -o $(TARGET)
|
||||
$(LINKER) $(LDFLAGS) $(OBJS) $(ULTRAGRID_OBJS) $(LIBS) -o $(TARGET)
|
||||
|
||||
bin/import_control_keyboard: src/import_control_keyboard.o
|
||||
$(LINKER) $(LDFLAGS) $< @IMPORT_CONTROL_KEYBOARD_LIBS@ -o $@
|
||||
@@ -417,7 +418,7 @@ ag_plugin/uvReceiverService.zip: $(AG_PLUGIN_RX_SCRIPTS) $(TARGET)
|
||||
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
clean:
|
||||
-rm -f $(OBJS) $(HEADERS) src/main.o $(TARGET) src/version.h
|
||||
-rm -f $(OBJS) $(HEADERS) $(ULTRAGRID_OBJS) $(TARGET) src/version.h
|
||||
-rm -f $(TEST_OBJS) test/run_tests
|
||||
-rm -f ag_plugin/uvReceiverService.zip ag_plugin/uvSenderService.zip
|
||||
-rm -rf $(BUNDLE)
|
||||
|
||||
@@ -269,13 +269,16 @@ static int process_msg(struct control_state *s, fd_t client_fd, char *message)
|
||||
if(strcasecmp(message, "quit") == 0) {
|
||||
return CONTROL_EXIT;
|
||||
} else if(prefix_matches(message, "receiver ") || prefix_matches(message, "play") ||
|
||||
prefix_matches(message, "pause")) {
|
||||
prefix_matches(message, "pause") || prefix_matches(message, "sender-port ")) {
|
||||
struct msg_sender *msg =
|
||||
(struct msg_sender *)
|
||||
new_message(sizeof(struct msg_sender));
|
||||
if(prefix_matches(message, "receiver ")) {
|
||||
strncpy(msg->receiver, suffix(message, "receiver "), sizeof(msg->receiver) - 1);
|
||||
msg->type = SENDER_MSG_CHANGE_RECEIVER;
|
||||
} else if(prefix_matches(message, "sender-port ")) {
|
||||
msg->port = atoi(suffix(message, "sender-port "));
|
||||
msg->type = SENDER_MSG_CHANGE_PORT;
|
||||
} else if(prefix_matches(message, "play")) {
|
||||
msg->type = SENDER_MSG_PLAY;
|
||||
} else if(prefix_matches(message, "pause")) {
|
||||
|
||||
@@ -51,6 +51,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct state_uv;
|
||||
struct rtp;
|
||||
|
||||
extern int uv_argc;
|
||||
extern char **uv_argv;
|
||||
|
||||
@@ -87,6 +90,7 @@ int initialize_video_capture(const char *requested_capture,
|
||||
struct vidcap **);
|
||||
struct vcodec_state;
|
||||
void destroy_decoder(struct vcodec_state *video_decoder_state);
|
||||
struct rtp **change_tx_port(struct state_uv *, int port);
|
||||
|
||||
// if not NULL, data should be exported
|
||||
extern char *export_dir;
|
||||
|
||||
15
src/main.c
15
src/main.c
@@ -541,6 +541,20 @@ static void receiver_process_messages(struct state_uv *uv, struct module *receiv
|
||||
}
|
||||
}
|
||||
|
||||
struct rtp **change_tx_port(struct state_uv *uv, int tx_port)
|
||||
{
|
||||
destroy_devices(uv->network_devices);
|
||||
uv->send_port_number = tx_port;
|
||||
uv->network_devices = initialize_network(uv->requested_receiver, uv->recv_port_number,
|
||||
uv->send_port_number, uv->participants, uv->ipv6,
|
||||
uv->requested_mcast_if);
|
||||
if (!uv->network_devices) {
|
||||
fprintf(stderr, "Changing RX port failed!\n");
|
||||
abort();
|
||||
}
|
||||
return uv->network_devices;
|
||||
}
|
||||
|
||||
static void *receiver_thread(void *arg)
|
||||
{
|
||||
struct state_uv *uv = (struct state_uv *)arg;
|
||||
@@ -765,6 +779,7 @@ static void *capture_thread(void *arg)
|
||||
sender_data.parent = uv_mod; /// @todo should be compress thread module
|
||||
sender_data.connections_count = uv->connections_count;
|
||||
sender_data.tx_protocol = uv->tx_protocol;
|
||||
sender_data.uv = uv;
|
||||
if(uv->tx_protocol == ULTRAGRID_RTP) {
|
||||
sender_data.network_devices = uv->network_devices;
|
||||
} else {
|
||||
|
||||
@@ -41,6 +41,7 @@ struct message {
|
||||
|
||||
enum msg_sender_type {
|
||||
SENDER_MSG_CHANGE_RECEIVER,
|
||||
SENDER_MSG_CHANGE_PORT,
|
||||
SENDER_MSG_PLAY,
|
||||
SENDER_MSG_PAUSE
|
||||
};
|
||||
@@ -48,7 +49,10 @@ enum msg_sender_type {
|
||||
struct msg_sender {
|
||||
struct message m;
|
||||
enum msg_sender_type type;
|
||||
char receiver[128];
|
||||
union {
|
||||
int port;
|
||||
char receiver[128];
|
||||
};
|
||||
};
|
||||
|
||||
struct msg_receiver {
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
#include "config_win32.h"
|
||||
#endif // HAVE_CONFIG_H
|
||||
|
||||
#include "host.h"
|
||||
#include "messaging.h"
|
||||
#include "module.h"
|
||||
#include "rtp/rtp.h"
|
||||
@@ -151,6 +152,9 @@ static void sender_process_external_message(struct sender_data *data, struct msg
|
||||
msg->receiver);
|
||||
}
|
||||
break;
|
||||
case SENDER_MSG_CHANGE_PORT:
|
||||
data->network_devices = change_tx_port(data->uv, msg->port);
|
||||
break;
|
||||
case SENDER_MSG_PAUSE:
|
||||
data->priv->paused = true;
|
||||
break;
|
||||
|
||||
@@ -66,6 +66,7 @@ struct response;
|
||||
struct sender_msg;
|
||||
struct video_frame;
|
||||
struct sender_priv_data;
|
||||
struct state_uv;
|
||||
|
||||
enum tx_protocol {
|
||||
ULTRAGRID_RTP,
|
||||
@@ -82,6 +83,7 @@ struct sender_data {
|
||||
struct display *sage_tx_device; // == SAGE
|
||||
};
|
||||
struct tx *tx;
|
||||
struct state_uv *uv;
|
||||
struct sender_priv_data *priv;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user