tor_multipath_voip/src/dcall.c

40 lines
1.4 KiB
C

#include <gst/gst.h>
int main(int argc, char *argv[]) {
GMainLoop *loop;
GstElement *rx, *tx;
GstElement *rx_tap, *rx_jitterbuffer, *rx_depay, *rx_opusdec, *rx_resample, *rx_sink;
gst_init (&argc, &argv);
loop = g_main_loop_new (NULL, FALSE);
rx = gst_pipeline_new ("rx");
rx_tap = gst_element_factory_make("udpsrc", "rx-tap");
rx_jitterbuffer = gst_element_factory_make("rtpjitterbuffer", "rx-jitterbuffer");
rx_depay = gst_element_factory_make("rtpopusdepay", "rx-depay");
rx_opusdec = gst_element_factory_make("opusdec", "rx-opusdec");
rx_resample = gst_element_factory_make("audioresample", "rx-audioresample");
rx_sink = gst_element_factory_make("autoaudiosink", "rx-sink");
if (!rx || !rx_tap || !rx_jitterbuffer || !rx_depay || !rx_opusdec || !rx_resample || !rx_sink) {
g_printerr ("One element could not be created. Exiting.\n");
return -1;
}
gst_bin_add_many (GST_BIN (rx), rx_tap, rx_jitterbuffer, rx_depay, rx_opusdec, rx_resample, rx_sink, NULL);
gst_element_link_many (rx_tap, rx_jitterbuffer, rx_depay, rx_opusdec, rx_resample, rx_sink, NULL);
gst_element_set_state (rx, GST_STATE_PLAYING);
g_print ("Running...\n");
g_main_loop_run (loop);
g_print ("Returned, stopping playback\n");
gst_element_set_state (rx, GST_STATE_NULL);
gst_object_unref (GST_OBJECT (rx));
g_main_loop_unref (loop);
return 0;
}