From ca1f865eaa541789d704d0d90ec36001a17da3fd Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 2 Jun 2005 13:26:36 +0000 Subject: [PATCH] gst/rtsp/: RTSP cleanups. Original commit message from CVS: * gst/rtsp/README: * 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/rtsptransport.c: (rtsp_transport_new), (rtsp_transport_init), (parse_mode), (parse_range), (rtsp_transport_parse), (rtsp_transport_free): RTSP cleanups. --- ChangeLog | 15 +++++++++++++++ gst/rtsp/README | 2 +- gst/rtsp/gstrtspsrc.c | 21 +++++++++++++++------ gst/rtsp/rtsptransport.c | 10 ++-------- 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 79da6a5..c018903 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,20 @@ 2005-06-02 Wim Taymans + * gst/rtsp/README: + * 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/rtsptransport.c: (rtsp_transport_new), + (rtsp_transport_init), (parse_mode), (parse_range), + (rtsp_transport_parse), (rtsp_transport_free): + RTSP cleanups. + +2005-06-02 Wim Taymans + * gst/effectv/gstquark.c: (gst_quarktv_chain): * gst/goom/gstgoom.c: (gst_goom_chain): * gst/videobox/Makefile.am: diff --git a/gst/rtsp/README b/gst/rtsp/README index 285f4f4..2f7fde8 100644 --- a/gst/rtsp/README +++ b/gst/rtsp/README @@ -132,7 +132,7 @@ An RTSP session is created as follows: the data will be received on the same connection as the RTSP connection. At this point, we remove the UDP source elements as we don't need them anymore. We - setup the rtpdec session manager element though as follows: + set up the rtpsess session manager element though as follows: +---------------------------------------------+ | +------------+ | diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index ab2b36e..5938608 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -256,6 +256,8 @@ gst_rtspsrc_set_state (GstRTSPSrc * src, GstElementState state) GstElementStateReturn ret; GList *streams; + ret = GST_STATE_SUCCESS; + /* for all streams */ for (streams = src->streams; streams; streams = g_list_next (streams)) { GstRTSPStream *stream; @@ -462,13 +464,14 @@ gst_rtspsrc_loop (GstRTSPSrc * src) outpad = stream->rtpdecrtcp; } - if ((chainfunc = GST_RPAD_CHAINFUNC (outpad))) { + /* and chain buffer to internal element */ + { GstBuffer *buf; buf = gst_buffer_new_and_alloc (size); memcpy (GST_BUFFER_DATA (buf), data, size); - if (chainfunc (outpad, buf) != GST_FLOW_OK) + if (gst_pad_chain (outpad, buf) != GST_FLOW_OK) goto need_pause; } @@ -689,9 +692,9 @@ gst_rtspsrc_open (GstRTSPSrc * src) } } } - return TRUE; + /* ERRORS */ invalid_url: { GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, @@ -858,7 +861,8 @@ gst_rtspsrc_change_state (GstElement * element) break; case GST_STATE_READY_TO_PAUSED: rtspsrc->interleaved = FALSE; - gst_rtspsrc_open (rtspsrc); + if (!gst_rtspsrc_open (rtspsrc)) + 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); @@ -872,7 +876,7 @@ gst_rtspsrc_change_state (GstElement * element) ret = gst_rtspsrc_set_state (rtspsrc, GST_STATE_PENDING (rtspsrc)); if (ret != GST_STATE_SUCCESS) - goto error; + goto done; ret = GST_ELEMENT_CLASS (parent_class)->change_state (element); switch (transition) { @@ -887,6 +891,11 @@ gst_rtspsrc_change_state (GstElement * element) break; } -error: +done: return ret; + +open_failed: + { + return GST_STATE_FAILURE; + } } diff --git a/gst/rtsp/rtsptransport.c b/gst/rtsp/rtsptransport.c index addf354..592778b 100644 --- a/gst/rtsp/rtsptransport.c +++ b/gst/rtsp/rtsptransport.c @@ -55,14 +55,8 @@ rtsp_transport_init (RTSPTransport * transport) static void parse_mode (RTSPTransport * transport, gchar * str) { - if (strstr (str, "\"PLAY\"")) - transport->mode_play = TRUE; - else - transport->mode_play = FALSE; - if (strstr (str, "\"RECORD\"")) - transport->mode_record = TRUE; - else - transport->mode_record = FALSE; + transport->mode_play = (strstr (str, "\"PLAY\"") != NULL); + transport->mode_record = (strstr (str, "\"RECORD\"") != NULL); } static void -- 2.7.4