diff options
author | Christian Pointner <equinox@spreadspace.org> | 2014-09-27 20:19:39 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2014-09-27 20:19:39 +0200 |
commit | af4f081e7c1589f0999e320082274e32833bda88 (patch) | |
tree | 9bc8631ef7967932bef375cfb6f108919f0be927 /src | |
parent | creating udp sources works now (diff) |
name refactoring
Diffstat (limited to 'src')
-rw-r--r-- | src/pipelines.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/src/pipelines.c b/src/pipelines.c index 7478a7b..0ae2124 100644 --- a/src/pipelines.c +++ b/src/pipelines.c @@ -44,7 +44,7 @@ -struct media_elements { +struct av_elements { const char* name_; const char* src_str_; @@ -61,42 +61,42 @@ struct media_elements { GstElement* payloader_; }; -static gboolean create_media_elements(struct media_elements *me, GstElement* pipeline, GstElement *rtp, uint32_t session) +static gboolean create_av_elements(struct av_elements *ave, GstElement* pipeline, GstElement *rtp, uint32_t session) { char bin_name[32]; - snprintf(bin_name, sizeof(bin_name), "%s source", me->name_); - me->src_ = sydra_create_bin_from_desc(bin_name, me->src_str_); - me->tee_raw_ = sydra_create_element("tee", NULL); + snprintf(bin_name, sizeof(bin_name), "%s source", ave->name_); + ave->src_ = sydra_create_bin_from_desc(bin_name, ave->src_str_); + ave->tee_raw_ = sydra_create_element("tee", NULL); GstElement *qr = sydra_create_element("queue", NULL); - snprintf(bin_name, sizeof(bin_name), "%s encoder", me->name_); - me->enc_ = sydra_create_bin_from_desc(bin_name, me->enc_str_); - me->tee_enc_ = sydra_create_element("tee", NULL); + snprintf(bin_name, sizeof(bin_name), "%s encoder", ave->name_); + ave->enc_ = sydra_create_bin_from_desc(bin_name, ave->enc_str_); + ave->tee_enc_ = sydra_create_element("tee", NULL); GstElement *qe = sydra_create_element("queue", NULL); - me->payloader_ = sydra_create_element(me->payloader_str_, NULL); + ave->payloader_ = sydra_create_element(ave->payloader_str_, NULL); - if(!me->src_ || !me->tee_raw_ || !qr || !me->enc_ || !me->tee_enc_ || !qe || !me->payloader_) { + if(!ave->src_ || !ave->tee_raw_ || !qr || !ave->enc_ || !ave->tee_enc_ || !qe || !ave->payloader_) { return FALSE; } - log_printf(DEBUG, "%s path created successfully!", me->name_); + log_printf(DEBUG, "%s path created successfully!", ave->name_); - gst_bin_add_many (GST_BIN(pipeline), me->src_, me->tee_raw_, qr, me->enc_, me->tee_enc_, qe, me->payloader_, NULL); - gst_element_link(me->src_, me->tee_raw_); - gst_element_link_many(qr, me->enc_, me->tee_enc_, NULL); - gst_element_link(qe, me->payloader_); + 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_element_link(qe, ave->payloader_); char pad_name[32]; snprintf(pad_name, sizeof(bin_name), "send_rtp_sink_%u", session); - if(!sydra_link_request_static(me->tee_raw_, "src_%u", qr, "sink") || - !sydra_link_request_static(me->tee_enc_, "src_%u", qe, "sink") || - !sydra_link_static_request(me->payloader_, "src", rtp, pad_name)) { + if(!sydra_link_request_static(ave->tee_raw_, "src_%u", qr, "sink") || + !sydra_link_request_static(ave->tee_enc_, "src_%u", qe, "sink") || + !sydra_link_static_request(ave->payloader_, "src", rtp, pad_name)) { return FALSE; } - log_printf(DEBUG, "%s path linked successfully!", me->name_); + log_printf(DEBUG, "%s path linked successfully!", ave->name_); return TRUE; } @@ -217,7 +217,7 @@ static gboolean create_preview_elements(const char* preview_bin_desc, GstElement return TRUE; } -static gboolean create_recorder_elements(options_t* opt, GstElement* pipeline, struct media_elements *mv, struct media_elements *ma) +static gboolean create_recorder_elements(options_t* opt, GstElement* pipeline, struct av_elements *ve, struct av_elements *ae) { GstElement *qv = sydra_create_element("queue", NULL); GstElement *qa = sydra_create_element("queue", NULL); @@ -228,17 +228,17 @@ static gboolean create_recorder_elements(options_t* opt, GstElement* pipeline, s return FALSE; } - GstElement *ev = NULL, *tv = mv->tee_enc_; + GstElement *ev = NULL, *tv = ve->tee_enc_; if(opt->video_enc_rec_) { ev = sydra_create_bin_from_desc("record video encoder", opt->video_enc_rec_); if(!ev) return FALSE; - tv = mv->tee_raw_; + tv = ve->tee_raw_; } - GstElement *ea = NULL, *ta = ma->tee_enc_; + GstElement *ea = NULL, *ta = ae->tee_enc_; if(opt->audio_enc_rec_) { ea = sydra_create_bin_from_desc("record audio encoder", opt->audio_enc_rec_); if(!ea) return FALSE; - ta = ma->tee_raw_; + ta = ae->tee_raw_; } log_printf(DEBUG, "recorder path created successfully!"); @@ -291,14 +291,14 @@ GstElement* create_sender_pipeline(options_t* opt, struct udp_sinks *udp) } log_printf(DEBUG, "rtpbin created successfully!"); - struct media_elements video = { "video", opt->video_src_, NULL, NULL, + struct av_elements video = { "video", opt->video_src_, NULL, NULL, opt->video_enc_, NULL, NULL, opt->video_payloader_, NULL }; - struct media_elements audio = { "audio", opt->audio_src_, NULL, NULL, + struct av_elements audio = { "audio", opt->audio_src_, NULL, NULL, opt->audio_enc_, NULL, NULL, opt->audio_payloader_, NULL }; - if(!create_media_elements(&video, pipeline, rtp, 0) || - !create_media_elements(&audio, pipeline, rtp, 1) || + if(!create_av_elements(&video, pipeline, rtp, 0) || + !create_av_elements(&audio, pipeline, rtp, 1) || !create_udp_sinks(opt, pipeline, rtp, udp)) { return NULL; } |