diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2014-07-24 17:56:02 (GMT) |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2014-07-24 20:55:42 (GMT) |
commit | e0d453a3a2c120264b13c44f004025b0330547a8 (patch) | |
tree | 4517a7e8f3100f1f75b4cecd68486b42d4f7f0df /src/encode.c | |
parent | fae0aa58c19a1918e7b7750b4862e2abcbc55788 (diff) | |
download | soup-transcoding-proxy-e0d453a3a2c120264b13c44f004025b0330547a8.zip soup-transcoding-proxy-e0d453a3a2c120264b13c44f004025b0330547a8.tar.gz |
Implement concurrent RTP-UDP streams, and a REST API for status and auth
When the --token-server=ADDR/MASK argument is passed to the server, the token
verification framework is enabled, and the specified subnet is allowed to access
the REST API to add/revoke/list tokens that allow clients to connect, and to
list/abort streams running on the server.
Details about the REST API are documented in the file "REST-API".
There were also some organisational and name changes in the code.
Diffstat (limited to 'src/encode.c')
-rw-r--r-- | src/encode.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/encode.c b/src/encode.c index 2de4a9a..a18fe5e 100644 --- a/src/encode.c +++ b/src/encode.c @@ -117,9 +117,9 @@ on_pad_probe_buffer (GstPad *pad, } static void -on_demuxer_pad_added (GstElement *demuxer, - GstPad *srcpad, - GstElement *pipeline) +on_demuxer_pad_added (GstElement *demuxer, + GstPad *srcpad, + STPServerCtx *ctx) { char *name; GstCaps *caps; @@ -135,8 +135,9 @@ on_demuxer_pad_added (GstElement *demuxer, /* Broadcast VP8 RTP over UDP://localhost:5004 */ rtppay = gst_element_factory_make ("rtpvp8pay", "rtpvp8pay"); - udpsink = gst_element_factory_make ("udpsink", "udpsink"); - gst_bin_add_many (GST_BIN (pipeline), rtppay, udpsink, NULL); + udpsink = gst_element_factory_make ("multiudpsink", "multiudpsink"); + g_object_set (udpsink, "clients", ctx->udp_clients, NULL); + gst_bin_add_many (GST_BIN (ctx->pipeline), rtppay, udpsink, NULL); gst_element_link (rtppay, udpsink); if (!gst_element_sync_state_with_parent (rtppay) || @@ -154,8 +155,8 @@ out: } static void -do_udp_rtp_broadcast (GstElement *decodebin, - GstElement *pipeline) +do_udp_rtp_broadcast (GstElement *decodebin, + STPServerCtx *ctx) { GstPadTemplate *template; GstPad *srcpad, *sinkpad; @@ -168,10 +169,10 @@ do_udp_rtp_broadcast (GstElement *decodebin, g_object_set (demuxer, "location", "filesink.webm", NULL);*/ demuxer = gst_element_factory_make ("matroskademux", "matroskademux"); - gst_bin_add_many (GST_BIN (pipeline), q, demuxer, NULL); + gst_bin_add_many (GST_BIN (ctx->pipeline), q, demuxer, NULL); gst_element_link (q, demuxer); - tee = gst_bin_get_by_name (GST_BIN (pipeline), "tee"); + tee = gst_bin_get_by_name (GST_BIN (ctx->pipeline), "tee"); template = gst_pad_template_new ("teesrc", GST_PAD_SRC, GST_PAD_REQUEST, GST_CAPS_ANY); srcpad = gst_element_request_pad (tee, template, NULL, GST_CAPS_ANY); @@ -190,7 +191,7 @@ do_udp_rtp_broadcast (GstElement *decodebin, (GstPadProbeCallback) on_pad_probe_buffer, NULL, NULL); g_signal_connect (demuxer, "pad-added", - G_CALLBACK (on_demuxer_pad_added), pipeline); + G_CALLBACK (on_demuxer_pad_added), ctx); out: gst_object_unref (template); @@ -239,7 +240,7 @@ create_webm_profile (void) } void -stp_encode_from_msg (TranscodeServerCtx *ctx) +stp_encode_from_msg (STPServerCtx *ctx) { #ifdef ENCODE_DEBUG char *tmp, *filename; @@ -288,7 +289,7 @@ stp_encode_from_msg (TranscodeServerCtx *ctx) q2 = gst_element_factory_make ("queue", "q2"); filesink = gst_element_factory_make ("filesink", "filesink"); - tmp = g_uri_escape_string (ctx->path, NULL, TRUE); + tmp = g_uri_escape_string (ctx->sessionid, NULL, TRUE); filename = g_strdup_printf ("debug-encode-%s.webm", tmp); g_object_set (filesink, "location", filename, NULL); @@ -322,9 +323,10 @@ stp_encode_from_msg (TranscodeServerCtx *ctx) * corresponding sink pad on decodebin */ g_signal_connect (decodebin, "pad-added", G_CALLBACK (on_decodebin_pad_added), encodebin); - /* When finished adding pads, try streaming it all over RTP/UDP */ - g_signal_connect (decodebin, "no-more-pads", - G_CALLBACK (do_udp_rtp_broadcast), ctx->pipeline); + if (ctx->stream_type & STP_STREAM_TYPE_RTP_UDP) + /* If requested to, when finished adding pads, stream things over RTP/UDP */ + g_signal_connect (decodebin, "no-more-pads", + G_CALLBACK (do_udp_rtp_broadcast), ctx); bus = gst_pipeline_get_bus (GST_PIPELINE (ctx->pipeline)); gst_bus_add_signal_watch (bus); |