summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2014-09-29 00:27:50 +0200
committerChristian Pointner <equinox@spreadspace.org>2014-09-29 00:27:50 +0200
commitd256fe3219d9a01c983fa5d346245ccfac9739e7 (patch)
treeb5a4aae5213e21c75975512731df9cf451c801e0 /src
parentlinking depayloaders worsk now (diff)
receiver works now (without recording)
Diffstat (limited to 'src')
-rw-r--r--src/pipelines.c79
1 files changed, 55 insertions, 24 deletions
diff --git a/src/pipelines.c b/src/pipelines.c
index 41fee4f..6f70ee2 100644
--- a/src/pipelines.c
+++ b/src/pipelines.c
@@ -48,13 +48,13 @@
struct av_elements {
const char* name_;
- const char* src_str_;
- GstElement* src_;
+ const char* srcsink_str_;
+ GstElement* srcsink_;
GstElement* tee_raw_;
- const char* enc_str_;
- GstElement* enc_;
+ const char* encdec_str_;
+ GstElement* encdec_;
GstElement* tee_enc_;
@@ -62,31 +62,30 @@ struct av_elements {
GstElement* payloader_;
};
-static gboolean create_av_elements(struct av_elements *ave, GstElement* pipeline, GstElement *rtp, uint32_t session)
+static gboolean create_avsend_elements(struct av_elements *ave, GstElement* pipeline, GstElement *rtp, uint32_t session)
{
char bin_name[32];
snprintf(bin_name, sizeof(bin_name), "%s source", ave->name_);
- ave->src_ = sydra_create_bin_from_desc(bin_name, ave->src_str_);
+ ave->srcsink_ = sydra_create_bin_from_desc(bin_name, ave->srcsink_str_);
ave->tee_raw_ = sydra_create_element("tee", NULL);
GstElement *qr = sydra_create_element("queue", NULL);
snprintf(bin_name, sizeof(bin_name), "%s encoder", ave->name_);
- ave->enc_ = sydra_create_bin_from_desc(bin_name, ave->enc_str_);
+ ave->encdec_ = sydra_create_bin_from_desc(bin_name, ave->encdec_str_);
ave->tee_enc_ = sydra_create_element("tee", NULL);
GstElement *qe = sydra_create_element("queue", NULL);
-
ave->payloader_ = sydra_create_element(ave->payloader_str_, NULL);
- if(!ave->src_ || !ave->tee_raw_ || !qr || !ave->enc_ || !ave->tee_enc_ || !qe || !ave->payloader_) {
+ if(!ave->srcsink_ || !ave->tee_raw_ || !qr || !ave->encdec_ || !ave->tee_enc_ || !qe || !ave->payloader_) {
return FALSE;
}
log_printf(DEBUG, "%s path created successfully!", ave->name_);
- gst_bin_add_many (GST_BIN(pipeline), ave->src_, ave->tee_raw_, qr, ave->enc_, ave->tee_enc_, qe, ave->payloader_, NULL);
- gst_element_link(ave->src_, ave->tee_raw_);
- gst_element_link_many(qr, ave->enc_, ave->tee_enc_, NULL);
+ gst_bin_add_many (GST_BIN(pipeline), ave->srcsink_, ave->tee_raw_, qr, ave->encdec_, ave->tee_enc_, qe, ave->payloader_, NULL);
+ gst_element_link(ave->srcsink_, ave->tee_raw_);
+ gst_element_link_many(qr, ave->encdec_, ave->tee_enc_, NULL);
gst_element_link(qe, ave->payloader_);
char pad_name[32];
@@ -101,6 +100,34 @@ static gboolean create_av_elements(struct av_elements *ave, GstElement* pipeline
return TRUE;
}
+static gboolean create_avrecv_elements(struct av_elements *ave, GstElement* pipeline)
+{
+ char bin_name[32];
+
+ snprintf(bin_name, sizeof(bin_name), "%s sink", ave->name_);
+ ave->srcsink_ = sydra_create_bin_from_desc(bin_name, ave->srcsink_str_);
+ ave->tee_raw_ = sydra_create_element("tee", NULL);
+ GstElement *qr = sydra_create_element("queue", NULL);
+
+ snprintf(bin_name, sizeof(bin_name), "%s decoder", ave->name_);
+ ave->encdec_ = sydra_create_bin_from_desc(bin_name, ave->encdec_str_);
+ ave->tee_enc_ = sydra_create_element("tee", NULL);
+ GstElement *qe = sydra_create_element("queue", NULL);
+ ave->payloader_ = sydra_create_element(ave->payloader_str_, NULL);
+
+ if(!ave->srcsink_ || !ave->tee_raw_ || !qr || !ave->encdec_ || !ave->tee_enc_ || !qe || !ave->payloader_) {
+ return FALSE;
+ }
+
+ log_printf(DEBUG, "%s path created successfully!", ave->name_);
+
+ gst_bin_add_many (GST_BIN(pipeline), ave->srcsink_, ave->tee_raw_, qr, ave->encdec_, ave->tee_enc_, qe, ave->payloader_, NULL);
+ gst_element_link_many(ave->payloader_, ave->tee_enc_, qe, ave->encdec_, ave->tee_raw_, qr, ave->srcsink_, NULL);
+
+ log_printf(DEBUG, "%s path linked successfully!", ave->name_);
+ return TRUE;
+}
+
static gboolean create_udp_sinks(options_t* opt, GstElement* pipeline, GstElement* rtp, struct udp_sinks *sinks)
{
sinks->rtp_video_.udp_ = sydra_create_element("multiudpsink", "udprtpv");
@@ -298,8 +325,8 @@ GstElement* create_sender_pipeline(options_t* opt, struct udp_sinks *udp)
struct av_elements audio = { "audio", opt->audio_src_, NULL, NULL,
opt->audio_enc_, NULL, NULL,
opt->audio_payloader_, NULL };
- if(!create_av_elements(&video, pipeline, rtp, 0) ||
- !create_av_elements(&audio, pipeline, rtp, 1) ||
+ if(!create_avsend_elements(&video, pipeline, rtp, 0) ||
+ !create_avsend_elements(&audio, pipeline, rtp, 1) ||
!create_udp_sinks(opt, pipeline, rtp, udp)) {
return NULL;
}
@@ -375,7 +402,7 @@ static void rtpbin_pad_added(GstElement* rtp, GstPad* pad, gpointer user_data)
break;
}
if(!gst_pad_is_linked(pad)) {
- log_printf(ERROR, "rtpbin :no compatible element found for pad %s", src_pad_name);
+ log_printf(ERROR, "rtpbin: no compatible depayloader found for pad %s", src_pad_name);
}
g_free(src_pad_name);
}
@@ -393,19 +420,23 @@ GstElement* create_receiver_pipeline(options_t* opt, struct udp_sources *udp)
}
log_printf(DEBUG, "rtpbin created successfully!");
- GstElement **depays = g_new(GstElement*, 2);
- depays[0] = sydra_create_element(opt->video_depayloader_, NULL);
- depays[1] = sydra_create_element(opt->audio_depayloader_, NULL);
- if(!depays[0] || !depays[1]) {
- log_printf(ERROR, "creating depayloaders failed");
+
+ struct av_elements video = { "video", opt->video_sink_, NULL, NULL,
+ opt->video_dec_, NULL, NULL,
+ opt->video_depayloader_, NULL };
+ struct av_elements audio = { "audio", opt->audio_sink_, NULL, NULL,
+ opt->audio_dec_, NULL, NULL,
+ opt->audio_depayloader_, NULL };
+ if(!create_udp_sources(opt, pipeline, rtp, udp) ||
+ !create_avrecv_elements(&video, pipeline) ||
+ !create_avrecv_elements(&audio, pipeline)) {
return NULL;
}
- gst_bin_add_many(GST_BIN(pipeline), depays[0], depays[1], NULL);
+ GstElement **depays = g_new(GstElement*, 2);
+ depays[0] = video.payloader_;
+ depays[1] = audio.payloader_;
g_signal_connect_closure(rtp, "pad-added", g_cclosure_new(G_CALLBACK(rtpbin_pad_added), depays, NULL), FALSE);
- if(!create_udp_sources(opt, pipeline, rtp, udp)) {
- return NULL;
- }
log_printf(DEBUG, "receiver pipeline created successfully!");
return pipeline;