summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2014-09-22 04:10:28 +0200
committerChristian Pointner <equinox@spreadspace.org>2014-09-22 04:10:28 +0200
commit1af31f8ea42f5a8eed4dd281bfd74dfb8ecbfa69 (patch)
tree62785ec48cf3f9ab7cacbd1c4326485d98c6dfcb /src
parentgot rid of double audio encoding (diff)
preview works now
Diffstat (limited to 'src')
-rw-r--r--src/options.c4
-rw-r--r--src/sydra.c38
2 files changed, 36 insertions, 6 deletions
diff --git a/src/options.c b/src/options.c
index b4e5971..2d1ded4 100644
--- a/src/options.c
+++ b/src/options.c
@@ -269,7 +269,7 @@ void options_default(options_t* opt)
opt->rtp_host_ = strdup("127.0.0.1");
opt->rtp_port_base_ = 5100;
- opt->preview_videosink_ = strdup("xvimagesink");
+ opt->preview_videosink_ = NULL;
opt->rec_mux_ = strdup("oggmux");
opt->rec_name_format_ = strdup("./recordings/%Y-%m-%d_%H-%M-%S.ogg");
@@ -337,7 +337,7 @@ void options_print_usage()
printf(" [-ap|--audio-payloader audio payloader element (i.e. rptopuspay)\n");
printf(" [-o|--rtp-host remote host for RTP packets\n");
printf(" [-O|--rtp-port-base base number for remote ports\n");
- printf(" [-V|--videosink video sink element for local preview (i.e. xvimagesink)\n");
+ printf(" [-V|--videosink video sink element for local preview (i.e. xvimagesink) - leave empty to disable preview\n");
printf(" [-m|--rec-mux muxer elemenent (i.e. matroskamux)\n");
printf(" [-r|--rec-name-format] <format> the recording file name format, see manpage of strftime for the syntax\n");
}
diff --git a/src/sydra.c b/src/sydra.c
index e366ba4..49951aa 100644
--- a/src/sydra.c
+++ b/src/sydra.c
@@ -312,13 +312,37 @@ static gboolean create_udp_elements(options_t* opt, GstElement* pipeline, GstEle
return TRUE;
}
-static GstElement* create_pipeline(options_t* opt)
+static gboolean create_preview_elements(const char* preview_bin_desc, GstElement* pipeline, GstElement* tee)
{
- log_printf(DEBUG, "creating pipeline");
+ GstElement *qr = sydra_create_element("queue", NULL);
+ GstElement *to = sydra_create_element("textoverlay", NULL);
+ GstElement *preview_bin = sydra_create_bin_from_desc("preview sink", preview_bin_desc);
+
+ if(!qr || !to || !preview_bin) {
+ return FALSE;
+ }
+
+ log_printf(DEBUG, "preview path created successfully!");
+
+ g_object_set(G_OBJECT(to), "text", " local ", "halignment", "center" , "valignment", "baseline",
+ "shaded-background", TRUE, "font-desc", "Sans 18", NULL);
+
+ gst_bin_add_many (GST_BIN(pipeline), qr, to, preview_bin, NULL);
+ gst_element_link_many(qr, to, preview_bin, NULL);
+
+ if(!sydra_link_request_static(tee, "src_%u", qr, "sink")) {
+ return FALSE;
+ }
+
+ log_printf(DEBUG, "preview path linked successfully!");
+ return TRUE;
+}
+static GstElement* create_pipeline(options_t* opt)
+{
GstElement *pipeline = gst_pipeline_new ("sydra");
if(!pipeline) {
- log_printf(ERROR, "Creating pipeline failed");
+ log_printf(ERROR, "Creating pipeline failed!");
return NULL;
}
GstElement *rtp = sydra_create_element("rtpbin", "rtpbin");
@@ -326,7 +350,7 @@ static GstElement* create_pipeline(options_t* opt)
return NULL;
}
- log_printf(DEBUG, "rtpbin created");
+ log_printf(DEBUG, "rtpbin created successfully!");
struct media_elements video = { "video", opt->video_src_, NULL, NULL,
opt->video_enc_, NULL, NULL,
@@ -340,6 +364,12 @@ static GstElement* create_pipeline(options_t* opt)
return NULL;
}
+ if(opt->preview_videosink_) {
+ if(!create_preview_elements(opt->preview_videosink_, pipeline, video.tee_raw_))
+ return NULL;
+ }
+
+ log_printf(DEBUG, "pipeline created successfully!");
return pipeline;
}