gst/rtsp/gstrtspsrc.c: More SDP parsing and caps setting.

Original commit message from CVS:
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_parse_rtpmap),
(gst_rtspsrc_media_to_caps), (gst_rtspsrc_stream_setup_rtp),
(gst_rtspsrc_stream_configure_transport), (gst_rtspsrc_send),
(gst_rtspsrc_change_state):
More SDP parsing and caps setting.
Do NO_PREROLL differently.
add pads only after negotiated.

* gst/udp/gstudpsrc.c: (gst_udpsrc_class_init),
(gst_udpsrc_getcaps):
Implement the getcaps function.
This commit is contained in:
Wim Taymans 2005-09-21 17:53:26 +00:00
parent a297069e16
commit 485d25aef1
3 changed files with 48 additions and 12 deletions

View file

@ -1,3 +1,17 @@
2005-09-21 Wim Taymans <wim@fluendo.com>
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_parse_rtpmap),
(gst_rtspsrc_media_to_caps), (gst_rtspsrc_stream_setup_rtp),
(gst_rtspsrc_stream_configure_transport), (gst_rtspsrc_send),
(gst_rtspsrc_change_state):
More SDP parsing and caps setting.
Do NO_PREROLL differently.
add pads only after negotiated.
* gst/udp/gstudpsrc.c: (gst_udpsrc_class_init),
(gst_udpsrc_getcaps):
Implement the getcaps function.
2005-09-21 Wim Taymans <wim@fluendo.com>
* gst/rtp/gstrtpamrdec.c: (gst_rtpamrdec_sink_setcaps),

View file

@ -448,8 +448,15 @@ gst_rtspsrc_media_to_caps (SDPMedia * media)
gchar **keyval;
keyval = g_strsplit (pairs[i], "=", 0);
if (keyval[0] && keyval[1]) {
gst_structure_set (s, keyval[0], G_TYPE_STRING, keyval[1], NULL);
if (keyval[0]) {
gchar *val;
if (keyval[1])
val = keyval[1];
else
val = "1";
gst_structure_set (s, keyval[0], G_TYPE_STRING, val, NULL);
}
g_strfreev (keyval);
}
@ -499,9 +506,6 @@ gst_rtspsrc_stream_setup_rtp (GstRTSPStream * stream, SDPMedia * media,
g_object_get (G_OBJECT (stream->rtpsrc), "port", rtpport, NULL);
g_object_get (G_OBJECT (stream->rtcpsrc), "port", rtcpport, NULL);
gst_element_set_state (stream->rtpsrc, GST_STATE_READY);
gst_element_set_state (stream->rtcpsrc, GST_STATE_READY);
return TRUE;
/* ERRORS, FIXME, cleanup */
@ -552,13 +556,6 @@ gst_rtspsrc_stream_configure_transport (GstRTSPStream * stream,
stream->rtpdecrtp = gst_element_get_pad (stream->rtpdec, "sinkrtp");
stream->rtpdecrtcp = gst_element_get_pad (stream->rtpdec, "sinkrtcp");
/* FIXME, make sure it outputs the caps */
pad = gst_element_get_pad (stream->rtpdec, "srcrtp");
name = g_strdup_printf ("rtp_stream%d", stream->id);
gst_element_add_pad (GST_ELEMENT (src), gst_ghost_pad_new (name, pad));
g_free (name);
gst_object_unref (GST_OBJECT (pad));
if (transport->lower_transport == RTSP_LOWER_TRANS_TCP) {
/* configure for interleaved delivery, nothing needs to be done
* here, the loop function will call the chain functions of the
@ -574,6 +571,13 @@ gst_rtspsrc_stream_configure_transport (GstRTSPStream * stream,
gst_pad_link (pad, stream->rtpdecrtcp);
gst_object_unref (GST_OBJECT (pad));
}
pad = gst_element_get_pad (stream->rtpdec, "srcrtp");
name = g_strdup_printf ("rtp_stream%d", stream->id);
gst_element_add_pad (GST_ELEMENT (src), gst_ghost_pad_new (name, pad));
g_free (name);
gst_object_unref (GST_OBJECT (pad));
return TRUE;
no_element:
@ -1181,6 +1185,9 @@ gst_rtspsrc_change_state (GstElement * element, GstStateChange transition)
goto done;
switch (transition) {
case GST_STATE_CHANGE_READY_TO_PAUSED:
ret = GST_STATE_CHANGE_NO_PREROLL;
break;
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
gst_rtspsrc_pause (rtspsrc);
break;

View file

@ -93,6 +93,7 @@ static void gst_udpsrc_init (GstUDPSrc * udpsrc);
static void gst_udpsrc_uri_handler_init (gpointer g_iface, gpointer iface_data);
static GstCaps *gst_udpsrc_getcaps (GstBaseSrc * src);
static GstFlowReturn gst_udpsrc_create (GstPushSrc * psrc, GstBuffer ** buf);
static gboolean gst_udpsrc_start (GstBaseSrc * bsrc);
static gboolean gst_udpsrc_stop (GstBaseSrc * bsrc);
@ -189,6 +190,7 @@ gst_udpsrc_class_init (GstUDPSrc * klass)
gstbasesrc_class->start = gst_udpsrc_start;
gstbasesrc_class->stop = gst_udpsrc_stop;
gstbasesrc_class->unlock = gst_udpsrc_unlock;
gstbasesrc_class->get_caps = gst_udpsrc_getcaps;
gstpushsrc_class->create = gst_udpsrc_create;
@ -205,6 +207,19 @@ gst_udpsrc_init (GstUDPSrc * udpsrc)
udpsrc->uri = g_strdup (UDP_DEFAULT_URI);
}
static GstCaps *
gst_udpsrc_getcaps (GstBaseSrc * src)
{
GstUDPSrc *udpsrc;
udpsrc = GST_UDPSRC (src);
if (udpsrc->caps)
return gst_caps_ref (udpsrc->caps);
else
return gst_caps_new_any ();
}
static GstFlowReturn
gst_udpsrc_create (GstPushSrc * psrc, GstBuffer ** buf)
{