Parameterize dcall

This commit is contained in:
Quentin 2020-01-28 08:47:47 +01:00
parent 62275e8fdb
commit 34bd9d829c

View file

@ -31,7 +31,7 @@ int create_rx_chain(GstElement *pipeline) {
return 0; return 0;
} }
int create_tx_chain(GstElement *pipeline) { int create_tx_chain(GstElement *pipeline, char* remote_host) {
GstElement *tx_tap, *tx_resample, *tx_opusenc, *tx_pay, *tx_sink; GstElement *tx_tap, *tx_resample, *tx_opusenc, *tx_pay, *tx_sink;
tx_tap = gst_element_factory_make("autoaudiosrc", "tx-tap"); tx_tap = gst_element_factory_make("autoaudiosrc", "tx-tap");
@ -51,7 +51,7 @@ int create_tx_chain(GstElement *pipeline) {
g_object_set(G_OBJECT(tx_opusenc), "bitrate", 32000, NULL); g_object_set(G_OBJECT(tx_opusenc), "bitrate", 32000, NULL);
g_object_set(G_OBJECT(tx_opusenc), "dtx", FALSE, NULL); // gstreamer dtx opus implem. is broken g_object_set(G_OBJECT(tx_opusenc), "dtx", FALSE, NULL); // gstreamer dtx opus implem. is broken
g_object_set(G_OBJECT(tx_sink), "host", "127.0.0.1", NULL); g_object_set(G_OBJECT(tx_sink), "host", remote_host, NULL);
g_object_set(G_OBJECT(tx_sink), "port", 5000, NULL); g_object_set(G_OBJECT(tx_sink), "port", 5000, NULL);
g_object_set(G_OBJECT(tx_sink), "async", FALSE, NULL); g_object_set(G_OBJECT(tx_sink), "async", FALSE, NULL);
@ -64,6 +64,14 @@ int create_tx_chain(GstElement *pipeline) {
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
GMainLoop *loop; GMainLoop *loop;
GstElement *pipeline; GstElement *pipeline;
char *remote_host;
/* Check input arguments */
if (argc != 2) {
g_printerr ("Usage: %s <Remote host>\n", argv[0]);
return -1;
}
remote_host = argv[1];
gst_init (&argc, &argv); gst_init (&argc, &argv);
loop = g_main_loop_new (NULL, FALSE); loop = g_main_loop_new (NULL, FALSE);
@ -75,7 +83,7 @@ int main(int argc, char *argv[]) {
} }
if (create_rx_chain (pipeline) != 0) return -1; if (create_rx_chain (pipeline) != 0) return -1;
if (create_tx_chain (pipeline) != 0) return -1; if (create_tx_chain (pipeline, remote_host) != 0) return -1;
gst_element_set_state (pipeline, GST_STATE_PLAYING); gst_element_set_state (pipeline, GST_STATE_PLAYING);