mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-15 11:55:32 +00:00
stream: factor our plug_src function
https://bugzilla.gnome.org/show_bug.cgi?id=766612
This commit is contained in:
parent
47a3956b48
commit
aa0e60445d
1 changed files with 34 additions and 43 deletions
|
@ -2573,10 +2573,38 @@ no_udp_protocol:
|
||||||
|
|
||||||
/* must be called with lock */
|
/* must be called with lock */
|
||||||
static void
|
static void
|
||||||
create_receiver_part (GstRTSPStream * stream, GstBin * bin, GstState state)
|
plug_src (GstRTSPStream * stream, GstBin * bin, GstElement * src,
|
||||||
|
GstElement * funnel)
|
||||||
{
|
{
|
||||||
GstRTSPStreamPrivate *priv;
|
GstRTSPStreamPrivate *priv;
|
||||||
GstPad *pad, *selpad;
|
GstPad *pad, *selpad;
|
||||||
|
|
||||||
|
priv = stream->priv;
|
||||||
|
|
||||||
|
if (priv->srcpad) {
|
||||||
|
/* we set and keep these to playing so that they don't cause NO_PREROLL return
|
||||||
|
* values. This is only relevant for PLAY pipelines */
|
||||||
|
gst_element_set_state (src, GST_STATE_PLAYING);
|
||||||
|
gst_element_set_locked_state (src, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* add src */
|
||||||
|
gst_bin_add (bin, src);
|
||||||
|
|
||||||
|
/* and link to the funnel */
|
||||||
|
selpad = gst_element_get_request_pad (funnel, "sink_%u");
|
||||||
|
pad = gst_element_get_static_pad (src, "src");
|
||||||
|
gst_pad_link (pad, selpad);
|
||||||
|
gst_object_unref (pad);
|
||||||
|
gst_object_unref (selpad);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* must be called with lock */
|
||||||
|
static void
|
||||||
|
create_receiver_part (GstRTSPStream * stream, GstBin * bin, GstState state)
|
||||||
|
{
|
||||||
|
GstRTSPStreamPrivate *priv;
|
||||||
|
GstPad *pad;
|
||||||
gboolean is_tcp;
|
gboolean is_tcp;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
|
@ -2613,56 +2641,19 @@ create_receiver_part (GstRTSPStream * stream, GstBin * bin, GstState state)
|
||||||
gst_pad_link (pad, priv->recv_sink[i]);
|
gst_pad_link (pad, priv->recv_sink[i]);
|
||||||
gst_object_unref (pad);
|
gst_object_unref (pad);
|
||||||
|
|
||||||
if (priv->udpsrc_v4[i]) {
|
if (priv->udpsrc_v4[i])
|
||||||
if (priv->srcpad) {
|
plug_src (stream, bin, priv->udpsrc_v4[i], priv->funnel[i]);
|
||||||
/* we set and keep these to playing so that they don't cause NO_PREROLL return
|
|
||||||
* values. This is only relevant for PLAY pipelines */
|
|
||||||
gst_element_set_state (priv->udpsrc_v4[i], GST_STATE_PLAYING);
|
|
||||||
gst_element_set_locked_state (priv->udpsrc_v4[i], TRUE);
|
|
||||||
}
|
|
||||||
/* add udpsrc */
|
|
||||||
gst_bin_add (bin, priv->udpsrc_v4[i]);
|
|
||||||
|
|
||||||
/* and link to the funnel v4 */
|
if (priv->udpsrc_v6[i])
|
||||||
selpad = gst_element_get_request_pad (priv->funnel[i], "sink_%u");
|
plug_src (stream, bin, priv->udpsrc_v6[i], priv->funnel[i]);
|
||||||
pad = gst_element_get_static_pad (priv->udpsrc_v4[i], "src");
|
|
||||||
gst_pad_link (pad, selpad);
|
|
||||||
gst_object_unref (pad);
|
|
||||||
gst_object_unref (selpad);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->udpsrc_v6[i]) {
|
|
||||||
if (priv->srcpad) {
|
|
||||||
gst_element_set_state (priv->udpsrc_v6[i], GST_STATE_PLAYING);
|
|
||||||
gst_element_set_locked_state (priv->udpsrc_v6[i], TRUE);
|
|
||||||
}
|
|
||||||
gst_bin_add (bin, priv->udpsrc_v6[i]);
|
|
||||||
|
|
||||||
/* and link to the funnel v6 */
|
|
||||||
selpad = gst_element_get_request_pad (priv->funnel[i], "sink_%u");
|
|
||||||
pad = gst_element_get_static_pad (priv->udpsrc_v6[i], "src");
|
|
||||||
gst_pad_link (pad, selpad);
|
|
||||||
gst_object_unref (pad);
|
|
||||||
gst_object_unref (selpad);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_tcp) {
|
if (is_tcp) {
|
||||||
/* make and add appsrc */
|
/* make and add appsrc */
|
||||||
priv->appsrc[i] = gst_element_factory_make ("appsrc", NULL);
|
priv->appsrc[i] = gst_element_factory_make ("appsrc", NULL);
|
||||||
priv->appsrc_base_time[i] = -1;
|
priv->appsrc_base_time[i] = -1;
|
||||||
if (priv->srcpad) {
|
|
||||||
gst_element_set_state (priv->appsrc[i], GST_STATE_PLAYING);
|
|
||||||
gst_element_set_locked_state (priv->appsrc[i], TRUE);
|
|
||||||
}
|
|
||||||
g_object_set (priv->appsrc[i], "format", GST_FORMAT_TIME, "is-live",
|
g_object_set (priv->appsrc[i], "format", GST_FORMAT_TIME, "is-live",
|
||||||
TRUE, NULL);
|
TRUE, NULL);
|
||||||
gst_bin_add (bin, priv->appsrc[i]);
|
plug_src (stream, bin, priv->appsrc[i], priv->funnel[i]);
|
||||||
/* and link to the funnel */
|
|
||||||
selpad = gst_element_get_request_pad (priv->funnel[i], "sink_%u");
|
|
||||||
pad = gst_element_get_static_pad (priv->appsrc[i], "src");
|
|
||||||
gst_pad_link (pad, selpad);
|
|
||||||
gst_object_unref (pad);
|
|
||||||
gst_object_unref (selpad);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if we need to set to a special state */
|
/* check if we need to set to a special state */
|
||||||
|
|
Loading…
Reference in a new issue