From 15b4ff94088747cb6a29f05a48d2dd55f51acb81 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 27 Sep 2014 18:35:34 +0200 Subject: prepared main loop for receiver mode --- src/sydra.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/sydra.c') diff --git a/src/sydra.c b/src/sydra.c index a7a73f4..ca48724 100644 --- a/src/sydra.c +++ b/src/sydra.c @@ -167,9 +167,11 @@ int main_loop(options_t* opt) { log_printf(INFO, "entering main loop"); - struct udp_sinks udp = { { NULL, NULL }, { NULL, NULL }, + struct udp_sinks sinks = { { NULL, NULL }, { NULL, NULL }, { NULL, NULL }, { NULL, NULL }, opt->timeout_ }; - GstElement *pipeline = create_sender_pipeline(opt, &udp); + struct udp_sources sources = { NULL, NULL, NULL, NULL, opt->keepalive_int_ }; + GstElement *pipeline = opt->mode_ == SENDER ? create_sender_pipeline(opt, &sinks) : + create_receiver_pipeline(opt, &sources); if(!pipeline) { log_printf(ERROR, "creating pipeline failed"); return -1; @@ -190,7 +192,8 @@ int main_loop(options_t* opt) log_printf(INFO, "Set State: Paused"); gst_element_set_state(pipeline, GST_STATE_PAUSED); - if(!attach_udpsinks(&udp)) + if((opt->mode_ == SENDER && !attach_udpsinks(&sinks)) || + (opt->mode_ == RECEIVER && !attach_udpsources(&sources))) return -1; log_printf(INFO, "Set State: Playing"); -- cgit v1.2.3