summaryrefslogtreecommitdiff
path: root/src/sydra.c
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2014-09-04 03:57:09 +0200
committerChristian Pointner <equinox@spreadspace.org>2014-09-04 03:57:09 +0200
commit5c8efa040669b7ffeb94d1a80f6cc002786c596b (patch)
tree6f510702133b8dc092ff0192a18b57e67880f9f8 /src/sydra.c
parentadded send stream pipeline with options (diff)
pipeline works now - however recording is still disabled..
Diffstat (limited to 'src/sydra.c')
-rw-r--r--src/sydra.c94
1 files changed, 66 insertions, 28 deletions
diff --git a/src/sydra.c b/src/sydra.c
index b4b8d9b..747d605 100644
--- a/src/sydra.c
+++ b/src/sydra.c
@@ -76,10 +76,64 @@ static gboolean bus_call(GstBus *bus, GstMessage *msg, gpointer data)
g_main_loop_quit(loop);
break;
}
- default:
- log_printf(WARNING, "unkonwn message %d", GST_MESSAGE_TYPE(msg));
+ case GST_MESSAGE_STATE_CHANGED: {
+ GstState old_state, new_state;
+ gst_message_parse_state_changed(msg, &old_state, &new_state, NULL);
+ log_printf(DEBUG, "Element '%s' changed state from %s to %s",
+ (msg->src ? GST_OBJECT_NAME(msg->src) : "NULL"),
+ gst_element_state_get_name(old_state),
+ gst_element_state_get_name(new_state));
+ break;
+ }
+ case GST_MESSAGE_NEW_CLOCK:
+ {
+ GstClock *clock;
+ gst_message_parse_new_clock(msg, &clock);
+ log_printf(INFO, "New clock: %s", (clock ? GST_OBJECT_NAME (clock) : "NULL"));
break;
}
+ /* case GST_MESSAGE_STREAM_STATUS: */
+ /* { */
+ /* GstStreamStatusType type; */
+ /* GstElement *owner; */
+ /* const GValue *val; */
+ /* gchar *path, *ownerstr; */
+ /* GstTask *task = NULL; */
+
+ /* gst_message_parse_stream_status (msg, &type, &owner); */
+ /* val = gst_message_get_stream_status_object (msg); */
+
+ /* path = gst_object_get_path_string (GST_MESSAGE_SRC (msg)); */
+ /* ownerstr = gst_object_get_path_string (GST_OBJECT (owner)); */
+ /* log_printf(DEBUG,"Recevied Stream-Status message type: %d, source: %s, owner: %s, object: type %s, value %p", */
+ /* type, path, ownerstr, G_VALUE_TYPE_NAME (val), g_value_get_object (val)); */
+ /* g_free (path); */
+ /* g_free (ownerstr); */
+
+ /* /\* see if we know how to deal with this object *\/ */
+ /* if (G_VALUE_TYPE (val) == GST_TYPE_TASK) { */
+ /* task = g_value_get_object (val); */
+ /* } */
+
+ /* switch (type) { */
+ /* case GST_STREAM_STATUS_TYPE_CREATE: */
+ /* log_printf(DEBUG," created task %p", task); */
+ /* break; */
+ /* case GST_STREAM_STATUS_TYPE_ENTER: */
+ /* /\* log_printf(DEBUG," raising task priority"); *\/ */
+ /* /\* setpriority (PRIO_PROCESS, 0, -10); *\/ */
+ /* break; */
+ /* case GST_STREAM_STATUS_TYPE_LEAVE: */
+ /* break; */
+ /* default: */
+ /* break; */
+ /* } */
+ /* break; */
+ /* } */
+ default:
+ log_printf(DEBUG, "unkonwn message %s from %s", GST_MESSAGE_TYPE_NAME(msg), GST_MESSAGE_SRC_NAME(msg));
+ return TRUE;
+ }
return TRUE;
}
@@ -89,15 +143,10 @@ int main_loop(options_t* opt)
log_printf(INFO, "entering main loop");
GMainLoop *loop;
- GstElement *pipeline, *sender;
+ GstElement *pipeline;
GstBus *bus;
loop = g_main_loop_new(NULL, FALSE);
- pipeline = gst_pipeline_new("sydra");
- if(!pipeline || !loop) {
- log_printf(ERROR, "the pipeline/loop object could not be created. Exiting.");
- return -1;
- }
struct timespec now;
clock_gettime(CLOCK_REALTIME, &now);
@@ -111,8 +160,8 @@ int main_loop(options_t* opt)
int rtp_port_a = opt->rtp_port_base_ + 200;
int rtcp_port_a = opt->rtp_port_base_ + 300;
- char* sender_str;
- int slen = asprintf(&sender_str, "rtpbin name=rtpbin \
+ char* sender_desc;
+ int slen = asprintf(&sender_desc, "rtpbin name=rtpbin \
%s ! tee name=vt \
vt. ! queue silent=true ! %s ! tee name=cvt \
cvt. ! %s ! rtpbin.send_rtp_sink_0 \
@@ -122,39 +171,28 @@ int main_loop(options_t* opt)
at. ! queue silent=true ! %s ! %s ! rtpbin.send_rtp_sink_1 \
rtpbin.send_rtp_src_1 ! udpsink port=%d host=%s \
rtpbin.send_rtcp_src_1 ! udpsink port=%d host=%s sync=false async=false \
- %s name=recmux ! filesink location=\"%s\" \
- cvt. ! queue silent=true ! recmux. \
- at. ! queue silent=true ! %s ! recmux. \
vt. ! queue silent=true ! textoverlay text=\" local \" shaded-background=true halignment=center valignment=baseline font-desc=\"Sans 18\" ! %s",
opt->video_src_, opt->video_enc_, opt->video_payloader_, rtp_port_v, opt->rtp_host_, rtcp_port_v, opt->rtp_host_,
opt->audio_src_, opt->audio_enc_stream_, opt->audio_payloader_, rtp_port_a, opt->rtp_host_, rtcp_port_a, opt->rtp_host_,
- opt->rec_mux_, recfile, opt->audio_enc_rec_, opt->videosink_);
+ opt->videosink_);
if(slen < 0) {
- log_printf(ERROR, "memory error while constructing sender pipeline");
- gst_object_unref(GST_OBJECT(pipeline));
+ log_printf(ERROR, "memory error while constructing sender pipeline description");
gst_object_unref(GST_OBJECT(loop));
return -1;
}
- printf("\n\n\n");
- printf("%s", sender_str);
- printf("\n\n\n");
-
-
GError *error = NULL;
- sender = gst_parse_bin_from_description(sender_str, TRUE, &error);
- if(!sender || error) {
- log_printf(ERROR, "Sending Bin Description Parser Error: %s", error ? error->message : "unknown");
+ pipeline = gst_parse_launch(sender_desc, &error);
+ if(!pipeline || error) {
+ log_printf(ERROR, "Pipeline parser Error: %s", error ? error->message : "unknown");
g_error_free(error);
- free(sender_str);
- gst_object_unref(GST_OBJECT(pipeline));
+ free(sender_desc);
gst_object_unref(GST_OBJECT(loop));
return -1;
}
- free(sender_str);
+ free(sender_desc);
- gst_bin_add_many(GST_BIN(pipeline), sender, NULL);
bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
gst_bus_add_watch(bus, bus_call, loop);
gst_object_unref(bus);