mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-03 09:12:19 +00:00
gst/rtsp/: Make rtspsrc a live source.
Original commit message from CVS: * gst/rtsp/gstrtspsrc.c: (gst_rtsp_proto_get_type), (gst_rtspsrc_class_init), (gst_rtspsrc_create_stream), (gst_rtspsrc_add_element), (gst_rtspsrc_set_state), (gst_rtspsrc_stream_setup_rtp), (gst_rtspsrc_stream_configure_transport), (find_stream), (gst_rtspsrc_loop), (gst_rtspsrc_open), (gst_rtspsrc_play), (gst_rtspsrc_change_state): * gst/rtsp/rtspurl.c: (rtsp_url_parse): Make rtspsrc a live source. Don't try to parse NULL urls.
This commit is contained in:
parent
5f70cb8298
commit
c51c1a4c38
3 changed files with 38 additions and 17 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
||||||
|
2005-06-23 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* gst/rtsp/gstrtspsrc.c: (gst_rtsp_proto_get_type),
|
||||||
|
(gst_rtspsrc_class_init), (gst_rtspsrc_create_stream),
|
||||||
|
(gst_rtspsrc_add_element), (gst_rtspsrc_set_state),
|
||||||
|
(gst_rtspsrc_stream_setup_rtp),
|
||||||
|
(gst_rtspsrc_stream_configure_transport), (find_stream),
|
||||||
|
(gst_rtspsrc_loop), (gst_rtspsrc_open), (gst_rtspsrc_play),
|
||||||
|
(gst_rtspsrc_change_state):
|
||||||
|
* gst/rtsp/rtspurl.c: (rtsp_url_parse):
|
||||||
|
Make rtspsrc a live source.
|
||||||
|
Don't try to parse NULL urls.
|
||||||
|
|
||||||
2005-06-23 Wim Taymans <wim@fluendo.com>
|
2005-06-23 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* gst/udp/gstudpsrc.c: (gst_udpsrc_init):
|
* gst/udp/gstudpsrc.c: (gst_udpsrc_init):
|
||||||
|
|
|
@ -266,20 +266,20 @@ gst_rtspsrc_set_state (GstRTSPSrc * src, GstElementState state)
|
||||||
|
|
||||||
/* first our rtp session manager */
|
/* first our rtp session manager */
|
||||||
if ((ret =
|
if ((ret =
|
||||||
gst_element_set_state (stream->rtpdec, state)) != GST_STATE_SUCCESS)
|
gst_element_set_state (stream->rtpdec, state)) == GST_STATE_FAILURE)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
/* then our sources */
|
/* then our sources */
|
||||||
if (stream->rtpsrc) {
|
if (stream->rtpsrc) {
|
||||||
if ((ret =
|
if ((ret =
|
||||||
gst_element_set_state (stream->rtpsrc,
|
gst_element_set_state (stream->rtpsrc,
|
||||||
state)) != GST_STATE_SUCCESS)
|
state)) == GST_STATE_FAILURE)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (stream->rtcpsrc) {
|
if (stream->rtcpsrc) {
|
||||||
if ((ret =
|
if ((ret =
|
||||||
gst_element_set_state (stream->rtcpsrc,
|
gst_element_set_state (stream->rtcpsrc,
|
||||||
state)) != GST_STATE_SUCCESS)
|
state)) == GST_STATE_FAILURE)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -305,9 +305,8 @@ gst_rtspsrc_stream_setup_rtp (GstRTSPStream * stream, gint * rtpport,
|
||||||
/* we manage this element */
|
/* we manage this element */
|
||||||
gst_rtspsrc_add_element (src, stream->rtpsrc);
|
gst_rtspsrc_add_element (src, stream->rtpsrc);
|
||||||
|
|
||||||
if ((ret =
|
ret = gst_element_set_state (stream->rtpsrc, GST_STATE_PAUSED);
|
||||||
gst_element_set_state (stream->rtpsrc,
|
if (ret == GST_STATE_FAILURE)
|
||||||
GST_STATE_PAUSED)) != GST_STATE_SUCCESS)
|
|
||||||
goto start_rtp_failure;
|
goto start_rtp_failure;
|
||||||
|
|
||||||
if (!(stream->rtcpsrc =
|
if (!(stream->rtcpsrc =
|
||||||
|
@ -317,9 +316,8 @@ gst_rtspsrc_stream_setup_rtp (GstRTSPStream * stream, gint * rtpport,
|
||||||
/* we manage this element */
|
/* we manage this element */
|
||||||
gst_rtspsrc_add_element (src, stream->rtcpsrc);
|
gst_rtspsrc_add_element (src, stream->rtcpsrc);
|
||||||
|
|
||||||
if ((ret =
|
ret = gst_element_set_state (stream->rtcpsrc, GST_STATE_PAUSED);
|
||||||
gst_element_set_state (stream->rtcpsrc,
|
if (ret == GST_STATE_FAILURE)
|
||||||
GST_STATE_PAUSED)) != GST_STATE_SUCCESS)
|
|
||||||
goto start_rtcp_failure;
|
goto start_rtcp_failure;
|
||||||
|
|
||||||
g_object_get (G_OBJECT (stream->rtpsrc), "port", rtpport, NULL);
|
g_object_get (G_OBJECT (stream->rtpsrc), "port", rtpport, NULL);
|
||||||
|
@ -378,7 +376,7 @@ gst_rtspsrc_stream_configure_transport (GstRTSPStream * stream,
|
||||||
/* FIXME, make sure it outputs the caps */
|
/* FIXME, make sure it outputs the caps */
|
||||||
pad = gst_element_get_pad (stream->rtpdec, "srcrtp");
|
pad = gst_element_get_pad (stream->rtpdec, "srcrtp");
|
||||||
name = g_strdup_printf ("rtp_stream%d", stream->id);
|
name = g_strdup_printf ("rtp_stream%d", stream->id);
|
||||||
gst_element_add_ghost_pad (GST_ELEMENT (src), pad, name);
|
gst_element_add_pad (GST_ELEMENT (src), gst_ghost_pad_new (name, pad));
|
||||||
g_free (name);
|
g_free (name);
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
|
||||||
|
@ -625,9 +623,11 @@ gst_rtspsrc_open (GstRTSPSrc * src)
|
||||||
gchar *new;
|
gchar *new;
|
||||||
gint rtpport, rtcpport;
|
gint rtpport, rtcpport;
|
||||||
gchar *trxparams;
|
gchar *trxparams;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
/* allocate two udp ports */
|
/* allocate two udp ports */
|
||||||
gst_rtspsrc_stream_setup_rtp (stream, &rtpport, &rtcpport);
|
if (!gst_rtspsrc_stream_setup_rtp (stream, &rtpport, &rtcpport))
|
||||||
|
goto setup_rtp_failed;
|
||||||
|
|
||||||
trxparams = g_strdup_printf ("client_port=%d-%d", rtpport, rtcpport);
|
trxparams = g_strdup_printf ("client_port=%d-%d", rtpport, rtcpport);
|
||||||
new = g_strconcat (transports, "RTP/AVP/UDP;unicast;", trxparams, NULL);
|
new = g_strconcat (transports, "RTP/AVP/UDP;unicast;", trxparams, NULL);
|
||||||
|
@ -719,6 +719,11 @@ send_error:
|
||||||
("Could not send message."), (NULL));
|
("Could not send message."), (NULL));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
setup_rtp_failed:
|
||||||
|
{
|
||||||
|
GST_ELEMENT_ERROR (src, RESOURCE, WRITE, ("Could not setup rtp."), (NULL));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -863,9 +868,6 @@ gst_rtspsrc_change_state (GstElement * element)
|
||||||
rtspsrc->interleaved = FALSE;
|
rtspsrc->interleaved = FALSE;
|
||||||
if (!gst_rtspsrc_open (rtspsrc))
|
if (!gst_rtspsrc_open (rtspsrc))
|
||||||
goto open_failed;
|
goto open_failed;
|
||||||
/* need to play now for the preroll, might delay that to
|
|
||||||
* next state when we have NO_PREROLL as a return value */
|
|
||||||
gst_rtspsrc_play (rtspsrc);
|
|
||||||
break;
|
break;
|
||||||
case GST_STATE_PAUSED_TO_PLAYING:
|
case GST_STATE_PAUSED_TO_PLAYING:
|
||||||
gst_rtspsrc_play (rtspsrc);
|
gst_rtspsrc_play (rtspsrc);
|
||||||
|
@ -874,10 +876,13 @@ gst_rtspsrc_change_state (GstElement * element)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = gst_rtspsrc_set_state (rtspsrc, GST_STATE_PENDING (rtspsrc));
|
|
||||||
if (ret != GST_STATE_SUCCESS)
|
|
||||||
goto done;
|
|
||||||
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element);
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element);
|
||||||
|
if (ret == GST_STATE_FAILURE)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
ret = gst_rtspsrc_set_state (rtspsrc, GST_STATE_PENDING (rtspsrc));
|
||||||
|
if (ret == GST_STATE_FAILURE)
|
||||||
|
goto done;
|
||||||
|
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
case GST_STATE_PLAYING_TO_PAUSED:
|
case GST_STATE_PLAYING_TO_PAUSED:
|
||||||
|
|
|
@ -35,6 +35,9 @@ rtsp_url_parse (const gchar * urlstr, RTSPUrl ** url)
|
||||||
|
|
||||||
res = g_new0 (RTSPUrl, 1);
|
res = g_new0 (RTSPUrl, 1);
|
||||||
|
|
||||||
|
if (urlstr == NULL)
|
||||||
|
return RTSP_EINVAL;
|
||||||
|
|
||||||
p = (gchar *) urlstr;
|
p = (gchar *) urlstr;
|
||||||
if (g_str_has_prefix (p, RTSP_PROTO)) {
|
if (g_str_has_prefix (p, RTSP_PROTO)) {
|
||||||
res->protocol = RTSP_PROTO_TCP;
|
res->protocol = RTSP_PROTO_TCP;
|
||||||
|
|
Loading…
Reference in a new issue