From a437e9f0edd49646c2fe36162f77575e219b7efa Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 18 Sep 2006 17:37:46 +0000 Subject: gst/rtsp/gstrtspsrc.*: Small cleanups, added documentation. Original commit message from CVS: * gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_media_to_caps), (gst_rtspsrc_send), (gst_rtspsrc_parse_methods), (gst_rtspsrc_open), (gst_rtspsrc_close), (gst_rtspsrc_play), (gst_rtspsrc_pause), (gst_rtspsrc_change_state), (gst_rtspsrc_uri_get_uri), (gst_rtspsrc_uri_set_uri): * gst/rtsp/gstrtspsrc.h: Small cleanups, added documentation. Try to clean up the requests and responses. Refactor parsing the supported methods. * gst/rtsp/rtspconnection.c: (rtsp_connection_open), (rtsp_connection_create), (rtsp_connection_send), (parse_response_status), (parse_request_line), (rtsp_connection_receive), (rtsp_connection_close), (rtsp_connection_free): * gst/rtsp/rtsptransport.c: (rtsp_transport_new), (rtsp_transport_init), (rtsp_transport_parse), (rtsp_transport_free): * gst/rtsp/rtspurl.c: (rtsp_url_parse): * gst/rtsp/sdpmessage.c: (sdp_message_new), (sdp_message_init), (sdp_message_clean), (sdp_message_free), (sdp_media_new), (sdp_media_init), (sdp_message_parse_buffer), (sdp_message_dump): Use g_return_val some more. * gst/rtsp/rtspdefs.h: Add more enum values to track initial states. * gst/rtsp/rtspmessage.c: (rtsp_message_new_request), (rtsp_message_init_request), (rtsp_message_new_response), (rtsp_message_init_response), (rtsp_message_init_data), (rtsp_message_unset), (rtsp_message_free), (rtsp_message_add_header), (rtsp_message_remove_header), (rtsp_message_get_header), (rtsp_message_set_body), (rtsp_message_take_body), (rtsp_message_get_body), (rtsp_message_steal_body), (rtsp_message_dump): * gst/rtsp/rtspmessage.h: Reorder arguments, object goes as the first one. Use g_return_val some more. --- gst/rtsp/rtsptransport.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'gst/rtsp/rtsptransport.c') diff --git a/gst/rtsp/rtsptransport.c b/gst/rtsp/rtsptransport.c index 3fdea275..57ec9204 100644 --- a/gst/rtsp/rtsptransport.c +++ b/gst/rtsp/rtsptransport.c @@ -27,8 +27,7 @@ rtsp_transport_new (RTSPTransport ** transport) { RTSPTransport *trans; - if (transport == NULL) - return RTSP_EINVAL; + g_return_val_if_fail (transport != NULL, RTSP_EINVAL); trans = g_new0 (RTSPTransport, 1); @@ -40,6 +39,8 @@ rtsp_transport_new (RTSPTransport ** transport) RTSPResult rtsp_transport_init (RTSPTransport * transport) { + g_return_val_if_fail (transport != NULL, RTSP_EINVAL); + g_free (transport->destination); g_free (transport->source); g_free (transport->ssrc); @@ -83,8 +84,8 @@ rtsp_transport_parse (gchar * str, RTSPTransport * transport) gchar **split, *down; gint i; - if (str == NULL || transport == NULL) - return RTSP_EINVAL; + g_return_val_if_fail (transport != NULL, RTSP_EINVAL); + g_return_val_if_fail (str != NULL, RTSP_EINVAL); rtsp_transport_init (transport); @@ -141,6 +142,8 @@ rtsp_transport_parse (gchar * str, RTSPTransport * transport) RTSPResult rtsp_transport_free (RTSPTransport * transport) { + g_return_val_if_fail (transport != NULL, RTSP_EINVAL); + rtsp_transport_init (transport); g_free (transport); return RTSP_OK; -- cgit