Add compiling dcall client

This commit is contained in:
Quentin 2020-01-28 07:33:04 +01:00
parent fd2b1966e5
commit 9d484f7328
2 changed files with 45 additions and 1 deletions

View file

@ -49,9 +49,11 @@ add_executable(torecho ${CSOURCES} src/tor_echo.c)
add_executable(capdiff ${CSOURCES} src/capdiff.c)
add_executable(capreplay ${CSOURCES} src/capreplay.c)
add_executable(donar_unit_test ${CSOURCES} src/test.c)
add_executable(dcall src/dcall.c)
find_package(PkgConfig REQUIRED)
pkg_search_module(GLIB REQUIRED glib-2.0)
pkg_search_module(GST REQUIRED gstreamer-1.0 >= 1.16)
target_include_directories(donar PRIVATE ${GLIB_INCLUDE_DIRS})
target_link_libraries(donar ${GLIB_LDFLAGS})
@ -74,6 +76,9 @@ target_link_libraries(capreplay ${GLIB_LDFLAGS})
target_include_directories(donar_unit_test PRIVATE ${GLIB_INCLUDE_DIRS})
target_link_libraries(donar_unit_test ${GLIB_LDFLAGS})
install(TARGETS donar measlat udpecho torecho capdiff capreplay donar_unit_test
target_include_directories(dcall PRIVATE ${GST_INCLUDE_DIRS})
target_link_libraries(dcall ${GST_LDFLAGS})
install(TARGETS donar measlat udpecho torecho capdiff capreplay donar_unit_test dcall
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib)

39
src/dcall.c Normal file
View file

@ -0,0 +1,39 @@
#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;
}