mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
Added beginnings of RTSP documentation.
Original commit message from CVS: * docs/libs/gst-plugins-base-libs-docs.sgml: * docs/libs/gst-plugins-base-libs-sections.txt: * gst-libs/gst/rtsp/gstrtspbase64.c: (gst_rtsp_base64_encode): * gst-libs/gst/rtsp/gstrtspbase64.h: * gst-libs/gst/rtsp/gstrtspconnection.c: (gst_rtsp_connection_connect), (add_auth_header), (gst_rtsp_connection_write), (gst_rtsp_connection_send), (read_body), (gst_rtsp_connection_receive), (gst_rtsp_connection_next_timeout), (gst_rtsp_connection_reset_timeout), (gst_rtsp_connection_set_auth): * gst-libs/gst/rtsp/gstrtspconnection.h: * gst-libs/gst/rtsp/gstrtspdefs.c: (rtsp_init_status): * gst-libs/gst/rtsp/gstrtspdefs.h: * gst-libs/gst/rtsp/gstrtspmessage.h: * gst-libs/gst/rtsp/gstrtsprange.c: (parse_npt_time), (parse_npt_range), (parse_clock_range), (parse_smpte_range), (gst_rtsp_range_parse): * gst-libs/gst/rtsp/gstrtspurl.h: Added beginnings of RTSP documentation.
This commit is contained in:
parent
ee42361c89
commit
3dff14d6b1
12 changed files with 488 additions and 38 deletions
23
ChangeLog
23
ChangeLog
|
@ -1,3 +1,26 @@
|
|||
2007-07-24 Wim Taymans <wim.taymans@gmail.com>
|
||||
|
||||
* docs/libs/gst-plugins-base-libs-docs.sgml:
|
||||
* docs/libs/gst-plugins-base-libs-sections.txt:
|
||||
* gst-libs/gst/rtsp/gstrtspbase64.c: (gst_rtsp_base64_encode):
|
||||
* gst-libs/gst/rtsp/gstrtspbase64.h:
|
||||
* gst-libs/gst/rtsp/gstrtspconnection.c:
|
||||
(gst_rtsp_connection_connect), (add_auth_header),
|
||||
(gst_rtsp_connection_write), (gst_rtsp_connection_send),
|
||||
(read_body), (gst_rtsp_connection_receive),
|
||||
(gst_rtsp_connection_next_timeout),
|
||||
(gst_rtsp_connection_reset_timeout),
|
||||
(gst_rtsp_connection_set_auth):
|
||||
* gst-libs/gst/rtsp/gstrtspconnection.h:
|
||||
* gst-libs/gst/rtsp/gstrtspdefs.c: (rtsp_init_status):
|
||||
* gst-libs/gst/rtsp/gstrtspdefs.h:
|
||||
* gst-libs/gst/rtsp/gstrtspmessage.h:
|
||||
* gst-libs/gst/rtsp/gstrtsprange.c: (parse_npt_time),
|
||||
(parse_npt_range), (parse_clock_range), (parse_smpte_range),
|
||||
(gst_rtsp_range_parse):
|
||||
* gst-libs/gst/rtsp/gstrtspurl.h:
|
||||
Added beginnings of RTSP documentation.
|
||||
|
||||
2007-07-24 Wim Taymans <wim.taymans@gmail.com>
|
||||
|
||||
* docs/libs/Makefile.am:
|
||||
|
|
|
@ -42,6 +42,14 @@
|
|||
<!ENTITY GstBaseRtpPayload SYSTEM "xml/gstbasertppayload.xml">
|
||||
<!ENTITY GstRtpBuffer SYSTEM "xml/gstrtpbuffer.xml">
|
||||
<!ENTITY GstRtcpBuffer SYSTEM "xml/gstrtcpbuffer.xml">
|
||||
<!-- rtsp -->
|
||||
<!ENTITY GstRTSPBase64 SYSTEM "xml/gstrtspbase64.xml">
|
||||
<!ENTITY GstRTSPConnection SYSTEM "xml/gstrtspconnection.xml">
|
||||
<!ENTITY GstRTSPDefs SYSTEM "xml/gstrtspdefs.xml">
|
||||
<!ENTITY GstRTSPMessage SYSTEM "xml/gstrtspmessage.xml">
|
||||
<!ENTITY GstRTSPRange SYSTEM "xml/gstrtsprange.xml">
|
||||
<!ENTITY GstRTSPTransport SYSTEM "xml/gstrtsptransport.xml">
|
||||
<!ENTITY GstRTSPUrl SYSTEM "xml/gstrtspurl.xml">
|
||||
<!-- sdp -->
|
||||
<!ENTITY GstSDP SYSTEM "xml/gstsdp.xml">
|
||||
<!ENTITY GstSDPMessage SYSTEM "xml/gstsdpmessage.xml">
|
||||
|
@ -171,14 +179,29 @@
|
|||
&GstRtcpBuffer;
|
||||
</chapter>
|
||||
|
||||
<chapter id="gstreamer-SDP">
|
||||
<chapter id="gstreamer-rtsp">
|
||||
<title>RTSP Library</title>
|
||||
<para>
|
||||
This library should be linked to by getting cflags and libs from
|
||||
<filename>gstreamer-plugins-base-&GST_MAJORMINOR;.pc</filename> and adding
|
||||
<filename>-lgstrtsp-&GST_MAJORMINOR;</filename> to the library flags.
|
||||
</para>
|
||||
&GstRTSPBase64;
|
||||
&GstRTSPConnection;
|
||||
&GstRTSPDefs;
|
||||
&GstRTSPMessage;
|
||||
&GstRTSPRange;
|
||||
&GstRTSPTransport;
|
||||
&GstRTSPUrl;
|
||||
</chapter>
|
||||
|
||||
<chapter id="gstreamer-sdp">
|
||||
<title>SDP Library</title>
|
||||
<para>
|
||||
This library should be linked to by getting cflags and libs from
|
||||
<filename>gstreamer-plugins-base-&GST_MAJORMINOR;.pc</filename> and adding
|
||||
<filename>-lgstsdp-&GST_MAJORMINOR;</filename> to the library flags.
|
||||
</para>
|
||||
&GstSDP;
|
||||
&GstSDPMessage;
|
||||
</chapter>
|
||||
|
||||
|
|
|
@ -964,16 +964,121 @@ GST_RTP_PAYLOAD_TS41
|
|||
GST_RTP_PAYLOAD_TS48
|
||||
</SECTION>
|
||||
|
||||
# sdp
|
||||
# rtsp
|
||||
<SECTION>
|
||||
<FILE>gstsdp</FILE>
|
||||
<INCLUDE>gst/sdp/sdp.h</INCLUDE>
|
||||
GstSDPResult
|
||||
<FILE>gstrtspdefs</FILE>
|
||||
<INCLUDE>gst/rtsp/gstrtspdefs.h</INCLUDE>
|
||||
GST_RTSP_CHECK
|
||||
GstRTSPResult
|
||||
GstRTSPFamily
|
||||
GstRTSPState
|
||||
GstRTSPVersion
|
||||
GstRTSPMethod
|
||||
GstRTSPAuthMethod
|
||||
GST_RTSP_AUTH_MAX
|
||||
GstRTSPHeaderField
|
||||
GstRTSPStatusCode
|
||||
gst_rtsp_strresult
|
||||
gst_rtsp_method_as_text
|
||||
gst_rtsp_version_as_text
|
||||
gst_rtsp_header_as_text
|
||||
gst_rtsp_status_as_text
|
||||
gst_rtsp_find_header_field
|
||||
gst_rtsp_find_method
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gstrtsptransport</FILE>
|
||||
<INCLUDE>gst/rtsp/gstrtsptransport.h</INCLUDE>
|
||||
GstRTSPTransMode
|
||||
GstRTSPProfile
|
||||
GstRTSPLowerTrans
|
||||
GstRTSPTransport
|
||||
gst_rtsp_transport_new
|
||||
gst_rtsp_transport_init
|
||||
gst_rtsp_transport_parse
|
||||
gst_rtsp_transport_as_text
|
||||
gst_rtsp_transport_get_mime
|
||||
gst_rtsp_transport_get_manager
|
||||
gst_rtsp_transport_free
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gstrtspbase64</FILE>
|
||||
<INCLUDE>gst/rtsp/gstrtspbase64.h</INCLUDE>
|
||||
gst_rtsp_base64_encode
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gstrtspconnection</FILE>
|
||||
<INCLUDE>gst/rtsp/gstrtspconnection.h</INCLUDE>
|
||||
GstRTSPConnection
|
||||
gst_rtsp_connection_create
|
||||
gst_rtsp_connection_connect
|
||||
gst_rtsp_connection_close
|
||||
gst_rtsp_connection_free
|
||||
gst_rtsp_connection_read
|
||||
gst_rtsp_connection_write
|
||||
gst_rtsp_connection_send
|
||||
gst_rtsp_connection_receive
|
||||
gst_rtsp_connection_next_timeout
|
||||
gst_rtsp_connection_reset_timeout
|
||||
gst_rtsp_connection_flush
|
||||
gst_rtsp_connection_set_auth
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gstrtspmessage</FILE>
|
||||
<INCLUDE>gst/rtsp/gstrtspmessage.h</INCLUDE>
|
||||
GstRTSPMsgType
|
||||
gst_rtsp_message_new
|
||||
gst_rtsp_message_init
|
||||
gst_rtsp_message_new_request
|
||||
gst_rtsp_message_init_request
|
||||
gst_rtsp_message_new_response
|
||||
gst_rtsp_message_init_response
|
||||
gst_rtsp_message_init_data
|
||||
gst_rtsp_message_unset
|
||||
gst_rtsp_message_free
|
||||
gst_rtsp_message_add_header
|
||||
gst_rtsp_message_remove_header
|
||||
gst_rtsp_message_get_header
|
||||
gst_rtsp_message_append_headers
|
||||
gst_rtsp_message_set_body
|
||||
gst_rtsp_message_take_body
|
||||
gst_rtsp_message_get_body
|
||||
gst_rtsp_message_steal_body
|
||||
gst_rtsp_message_dump
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gstrtspurl</FILE>
|
||||
<INCLUDE>gst/rtsp/gstrtspurl.h</INCLUDE>
|
||||
GST_RTSP_DEFAULT_PORT
|
||||
GstRTSPUrl
|
||||
gst_rtsp_url_parse
|
||||
gst_rtsp_url_free
|
||||
gst_rtsp_url_get_request_uri
|
||||
gst_rtsp_url_set_port
|
||||
gst_rtsp_url_get_port
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gstrtsprange</FILE>
|
||||
<INCLUDE>gst/rtsp/gstrtsrange.h</INCLUDE>
|
||||
GstRTSPRangeUnit
|
||||
GstRTSPTimeRange
|
||||
GstRTSPTime
|
||||
GstRTSPTimeType
|
||||
gst_rtsp_range_parse
|
||||
gst_rtsp_range_free
|
||||
</SECTION>
|
||||
|
||||
# sdp
|
||||
<SECTION>
|
||||
<FILE>gstsdpmessage</FILE>
|
||||
<INCLUDE>gst/sdp/sdpmessage.h</INCLUDE>
|
||||
<INCLUDE>gst/sdp/gstsdpmessage.h</INCLUDE>
|
||||
GstSDPResult
|
||||
GstSDPOrigin
|
||||
GstSDPConnection
|
||||
GST_SDP_BWTYPE_CT
|
||||
|
|
|
@ -17,6 +17,13 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:gstrtspbase64
|
||||
* @short_description: Helper function to encode into Base64
|
||||
*
|
||||
* Last reviewed on 2007-07-24 (0.10.14)
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
@ -33,9 +40,19 @@ static char base64table[64] = {
|
|||
'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'
|
||||
};
|
||||
|
||||
/**
|
||||
* gst_rtsp_base64_encode:
|
||||
* @data: the binary data to encode
|
||||
* @len: the length of @data
|
||||
*
|
||||
* Encode a sequence of binary data into its Base-64 stringified representation.
|
||||
*
|
||||
* Returns: a newly allocated, zero-terminated Base-64 encoded string
|
||||
* representing @data.
|
||||
*/
|
||||
/* This isn't efficient, but it doesn't need to be */
|
||||
gchar *
|
||||
gst_rtsp_base64_encode (gchar * data, gint len)
|
||||
gst_rtsp_base64_encode (const gchar * data, gsize len)
|
||||
{
|
||||
gchar *out = g_malloc (len * 4 / 3 + 4);
|
||||
gchar *result = out;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
gchar *gst_rtsp_base64_encode(gchar *data, gint len);
|
||||
gchar *gst_rtsp_base64_encode(const gchar *data, gsize len);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -40,6 +40,21 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:gstrtspconnection
|
||||
* @short_description: manage RTSP connections
|
||||
* @see_also: gstrtspurl
|
||||
*
|
||||
* <refsect2>
|
||||
* <para>
|
||||
* This object manages the RTSP connection to the server. It provides function
|
||||
* to receive and send bytes and messages.
|
||||
* </para>
|
||||
* </refsect2>
|
||||
*
|
||||
* Last reviewed on 2007-07-24 (0.10.14)
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
@ -117,6 +132,17 @@ inet_aton (const char *c, struct in_addr *paddr)
|
|||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* gst_rtsp_connection_create:
|
||||
* @url: a #GstRTSPUrl
|
||||
* @conn: a #GstRTSPConnection
|
||||
*
|
||||
* Create a newly allocated #GstRTSPConnection from @url and store it in @conn.
|
||||
* The connection will not yet attempt to connect to @url, use
|
||||
* gst_rtsp_connection_connect().
|
||||
*
|
||||
* Returns: #GST_RTSP_OK when @conn contains a valid connection.
|
||||
*/
|
||||
GstRTSPResult
|
||||
gst_rtsp_connection_create (GstRTSPUrl * url, GstRTSPConnection ** conn)
|
||||
{
|
||||
|
@ -168,6 +194,18 @@ no_socket_pair:
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_connection_connect:
|
||||
* @conn: a #GstRTSPConnection
|
||||
* @timeout: a #GTimeVal timeout
|
||||
*
|
||||
* Attempt to connect to the url of @conn made with
|
||||
* gst_rtsp_connection_create(). If @timeout is #NULL this function can block
|
||||
* forever. If @timeout contains a valid timeout, this function will return
|
||||
* #GST_RTSP_ETIMEOUT after the timeout expired.
|
||||
*
|
||||
* Returns: #GST_RTSP_OK when a connection could be made.
|
||||
*/
|
||||
GstRTSPResult
|
||||
gst_rtsp_connection_connect (GstRTSPConnection * conn, GTimeVal * timeout)
|
||||
{
|
||||
|
@ -328,6 +366,21 @@ add_date_header (GstRTSPMessage * message)
|
|||
gst_rtsp_message_add_header (message, GST_RTSP_HDR_DATE, date_string);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_connection_write:
|
||||
* @conn: a #GstRTSPConnection
|
||||
* @data: the data to write
|
||||
* @size: the size of @data
|
||||
* @timeout: a timeout value or #NULL
|
||||
*
|
||||
* Attempt to write @size bytes of @data to the connected @conn, blocking up to
|
||||
* the specified @timeout. @timeout can be #NULL, in which case this function
|
||||
* might block forever.
|
||||
*
|
||||
* This function can be canceled with gst_rtsp_connection_flush().
|
||||
*
|
||||
* Returns: #GST_RTSP_OK on success.
|
||||
*/
|
||||
GstRTSPResult
|
||||
gst_rtsp_connection_write (GstRTSPConnection * conn, const guint8 * data,
|
||||
guint size, GTimeVal * timeout)
|
||||
|
@ -418,6 +471,20 @@ write_error:
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_connection_send:
|
||||
* @conn: a #GstRTSPConnection
|
||||
* @message: the message to send
|
||||
* @timeout: a timeout value or #NULL
|
||||
*
|
||||
* Attempt to send @message to the connected @conn, blocking up to
|
||||
* the specified @timeout. @timeout can be #NULL, in which case this function
|
||||
* might block forever.
|
||||
*
|
||||
* This function can be canceled with gst_rtsp_connection_flush().
|
||||
*
|
||||
* Returns: #GST_RTSP_OK on success.
|
||||
*/
|
||||
GstRTSPResult
|
||||
gst_rtsp_connection_send (GstRTSPConnection * conn, GstRTSPMessage * message,
|
||||
GTimeVal * timeout)
|
||||
|
@ -719,6 +786,21 @@ no_column:
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_connection_read:
|
||||
* @conn: a #GstRTSPConnection
|
||||
* @data: the data to read
|
||||
* @size: the size of @data
|
||||
* @timeout: a timeout value or #NULL
|
||||
*
|
||||
* Attempt to read @size bytes into @data from the connected @conn, blocking up to
|
||||
* the specified @timeout. @timeout can be #NULL, in which case this function
|
||||
* might block forever.
|
||||
*
|
||||
* This function can be canceled with gst_rtsp_connection_flush().
|
||||
*
|
||||
* Returns: #GST_RTSP_OK on success.
|
||||
*/
|
||||
GstRTSPResult
|
||||
gst_rtsp_connection_read (GstRTSPConnection * conn, guint8 * data, guint size,
|
||||
GTimeVal * timeout)
|
||||
|
@ -863,8 +945,22 @@ read_error:
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_connection_receive:
|
||||
* @conn: a #GstRTSPConnection
|
||||
* @message: the message to read
|
||||
* @timeout: a timeout value or #NULL
|
||||
*
|
||||
* Attempt to read into @message from the connected @conn, blocking up to
|
||||
* the specified @timeout. @timeout can be #NULL, in which case this function
|
||||
* might block forever.
|
||||
*
|
||||
* This function can be canceled with gst_rtsp_connection_flush().
|
||||
*
|
||||
* Returns: #GST_RTSP_OK on success.
|
||||
*/
|
||||
GstRTSPResult
|
||||
gst_rtsp_connection_receive (GstRTSPConnection * conn, GstRTSPMessage * msg,
|
||||
gst_rtsp_connection_receive (GstRTSPConnection * conn, GstRTSPMessage * message,
|
||||
GTimeVal * timeout)
|
||||
{
|
||||
gchar buffer[4096];
|
||||
|
@ -874,7 +970,7 @@ gst_rtsp_connection_receive (GstRTSPConnection * conn, GstRTSPMessage * msg,
|
|||
gboolean need_body;
|
||||
|
||||
g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL);
|
||||
g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);
|
||||
g_return_val_if_fail (message != NULL, GST_RTSP_EINVAL);
|
||||
|
||||
line = 0;
|
||||
|
||||
|
@ -900,7 +996,7 @@ gst_rtsp_connection_receive (GstRTSPConnection * conn, GstRTSPMessage * msg,
|
|||
read_error);
|
||||
|
||||
/* now we create a data message */
|
||||
gst_rtsp_message_init_data (msg, c);
|
||||
gst_rtsp_message_init_data (message, c);
|
||||
|
||||
/* next two bytes are the length of the data */
|
||||
GST_RTSP_CHECK (gst_rtsp_connection_read (conn, (guint8 *) & size, 2,
|
||||
|
@ -909,7 +1005,7 @@ gst_rtsp_connection_receive (GstRTSPConnection * conn, GstRTSPMessage * msg,
|
|||
size = GUINT16_FROM_BE (size);
|
||||
|
||||
/* and read the body */
|
||||
res = read_body (conn, size, msg, timeout);
|
||||
res = read_body (conn, size, message, timeout);
|
||||
need_body = FALSE;
|
||||
break;
|
||||
} else {
|
||||
|
@ -934,13 +1030,13 @@ gst_rtsp_connection_receive (GstRTSPConnection * conn, GstRTSPMessage * msg,
|
|||
if (line == 0) {
|
||||
/* first line, check for response status */
|
||||
if (g_str_has_prefix (buffer, "RTSP")) {
|
||||
res = parse_response_status (buffer, msg);
|
||||
res = parse_response_status (buffer, message);
|
||||
} else {
|
||||
res = parse_request_line (buffer, msg);
|
||||
res = parse_request_line (buffer, message);
|
||||
}
|
||||
} else {
|
||||
/* else just parse the line */
|
||||
parse_line (buffer, msg);
|
||||
parse_line (buffer, message);
|
||||
}
|
||||
}
|
||||
line++;
|
||||
|
@ -952,16 +1048,16 @@ gst_rtsp_connection_receive (GstRTSPConnection * conn, GstRTSPMessage * msg,
|
|||
gchar *hdrval;
|
||||
|
||||
/* see if there is a Content-Length header */
|
||||
if (gst_rtsp_message_get_header (msg, GST_RTSP_HDR_CONTENT_LENGTH,
|
||||
if (gst_rtsp_message_get_header (message, GST_RTSP_HDR_CONTENT_LENGTH,
|
||||
&hdrval, 0) == GST_RTSP_OK) {
|
||||
/* there is, read the body */
|
||||
content_length = atol (hdrval);
|
||||
GST_RTSP_CHECK (read_body (conn, content_length, msg, timeout),
|
||||
GST_RTSP_CHECK (read_body (conn, content_length, message, timeout),
|
||||
read_error);
|
||||
}
|
||||
|
||||
/* save session id in the connection for further use */
|
||||
if (gst_rtsp_message_get_header (msg, GST_RTSP_HDR_SESSION,
|
||||
if (gst_rtsp_message_get_header (message, GST_RTSP_HDR_SESSION,
|
||||
&session_id, 0) == GST_RTSP_OK) {
|
||||
gint maxlen, i;
|
||||
|
||||
|
@ -1002,6 +1098,14 @@ read_error:
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_connection_close:
|
||||
* @conn: a #GstRTSPConnection
|
||||
*
|
||||
* Close the connected @conn.
|
||||
*
|
||||
* Returns: #GST_RTSP_OK on success.
|
||||
*/
|
||||
GstRTSPResult
|
||||
gst_rtsp_connection_close (GstRTSPConnection * conn)
|
||||
{
|
||||
|
@ -1030,6 +1134,14 @@ sys_error:
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_connection_free:
|
||||
* @conn: a #GstRTSPConnection
|
||||
*
|
||||
* Close and free @conn.
|
||||
*
|
||||
* Returns: #GST_RTSP_OK on success.
|
||||
*/
|
||||
GstRTSPResult
|
||||
gst_rtsp_connection_free (GstRTSPConnection * conn)
|
||||
{
|
||||
|
@ -1049,6 +1161,15 @@ gst_rtsp_connection_free (GstRTSPConnection * conn)
|
|||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_connection_next_timeout:
|
||||
* @conn: a #GstRTSPConnection
|
||||
* @timeout: a timeout
|
||||
*
|
||||
* Calculate the next timeout for @conn, storing the result in @timeout.
|
||||
*
|
||||
* Returns: #GST_RTSP_OK.
|
||||
*/
|
||||
GstRTSPResult
|
||||
gst_rtsp_connection_next_timeout (GstRTSPConnection * conn, GTimeVal * timeout)
|
||||
{
|
||||
|
@ -1073,6 +1194,14 @@ gst_rtsp_connection_next_timeout (GstRTSPConnection * conn, GTimeVal * timeout)
|
|||
return GST_RTSP_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_connection_reset_timeout:
|
||||
* @conn: a #GstRTSPConnection
|
||||
*
|
||||
* Reset the timeout of @conn.
|
||||
*
|
||||
* Returns: #GST_RTSP_OK.
|
||||
*/
|
||||
GstRTSPResult
|
||||
gst_rtsp_connection_reset_timeout (GstRTSPConnection * conn)
|
||||
{
|
||||
|
@ -1083,6 +1212,17 @@ gst_rtsp_connection_reset_timeout (GstRTSPConnection * conn)
|
|||
return GST_RTSP_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_connection_flush:
|
||||
* @conn: a #GstRTSPConnection
|
||||
* @flush: start or stop the flush
|
||||
*
|
||||
* Start or stop the flushing action on @conn. When flushing, all current
|
||||
* and future actions on @conn will return #GST_RTSP_EINTR until the connection
|
||||
* is set to non-flushing mode again.
|
||||
*
|
||||
* Returns: #GST_RTSP_OK.
|
||||
*/
|
||||
GstRTSPResult
|
||||
gst_rtsp_connection_flush (GstRTSPConnection * conn, gboolean flush)
|
||||
{
|
||||
|
@ -1105,9 +1245,21 @@ gst_rtsp_connection_flush (GstRTSPConnection * conn, gboolean flush)
|
|||
return GST_RTSP_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_connection_set_auth:
|
||||
* @conn: a #GstRTSPConnection
|
||||
* @method: authentication method
|
||||
* @user: the user
|
||||
* @pass: the password
|
||||
*
|
||||
* Configure @conn for authentication mode @method with @user and @pass as the
|
||||
* user and password respectively.
|
||||
*
|
||||
* Returns: #GST_RTSP_OK.
|
||||
*/
|
||||
GstRTSPResult
|
||||
gst_rtsp_connection_set_auth (GstRTSPConnection * conn,
|
||||
GstRTSPAuthMethod method, gchar * user, gchar * pass)
|
||||
GstRTSPAuthMethod method, const gchar * user, const gchar * pass)
|
||||
{
|
||||
/* Digest isn't implemented yet */
|
||||
if (method == GST_RTSP_AUTH_DIGEST)
|
||||
|
|
|
@ -51,8 +51,16 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GstRTSPConnection
|
||||
typedef struct _GstRTSPConnection GstRTSPConnection;
|
||||
|
||||
/**
|
||||
* GstRTSPConnection:
|
||||
*
|
||||
* Opaque RTSP connection object.
|
||||
*/
|
||||
struct _GstRTSPConnection
|
||||
{
|
||||
/*< private >*/
|
||||
/* URL for the connection */
|
||||
GstRTSPUrl *url;
|
||||
|
||||
|
@ -71,34 +79,36 @@ typedef struct _GstRTSPConnection
|
|||
GstRTSPAuthMethod auth_method;
|
||||
gchar *username;
|
||||
gchar *passwd;
|
||||
} GstRTSPConnection;
|
||||
};
|
||||
|
||||
/* opening/closing a connection */
|
||||
GstRTSPResult gst_rtsp_connection_create (GstRTSPUrl *url, GstRTSPConnection **conn);
|
||||
GstRTSPResult gst_rtsp_connection_connect (GstRTSPConnection *conn, GTimeVal *timeout);
|
||||
GstRTSPResult gst_rtsp_connection_close (GstRTSPConnection *conn);
|
||||
GstRTSPResult gst_rtsp_connection_free (GstRTSPConnection *conn);
|
||||
GstRTSPResult gst_rtsp_connection_create (GstRTSPUrl *url, GstRTSPConnection **conn);
|
||||
GstRTSPResult gst_rtsp_connection_connect (GstRTSPConnection *conn, GTimeVal *timeout);
|
||||
GstRTSPResult gst_rtsp_connection_close (GstRTSPConnection *conn);
|
||||
GstRTSPResult gst_rtsp_connection_free (GstRTSPConnection *conn);
|
||||
|
||||
/* sending/receiving raw bytes */
|
||||
GstRTSPResult gst_rtsp_connection_read (GstRTSPConnection * conn, guint8 * data,
|
||||
guint size, GTimeVal * timeout);
|
||||
GstRTSPResult gst_rtsp_connection_write (GstRTSPConnection * conn, const guint8 * data,
|
||||
guint size, GTimeVal * timeout);
|
||||
GstRTSPResult gst_rtsp_connection_read (GstRTSPConnection * conn, guint8 * data,
|
||||
guint size, GTimeVal * timeout);
|
||||
GstRTSPResult gst_rtsp_connection_write (GstRTSPConnection * conn, const guint8 * data,
|
||||
guint size, GTimeVal * timeout);
|
||||
|
||||
/* sending/receiving messages */
|
||||
GstRTSPResult gst_rtsp_connection_send (GstRTSPConnection *conn, GstRTSPMessage *message, GTimeVal *timeout);
|
||||
GstRTSPResult gst_rtsp_connection_receive (GstRTSPConnection *conn, GstRTSPMessage *message, GTimeVal *timeout);
|
||||
GstRTSPResult gst_rtsp_connection_send (GstRTSPConnection *conn, GstRTSPMessage *message,
|
||||
GTimeVal *timeout);
|
||||
GstRTSPResult gst_rtsp_connection_receive (GstRTSPConnection *conn, GstRTSPMessage *message,
|
||||
GTimeVal *timeout);
|
||||
|
||||
/* reset the timeout */
|
||||
GstRTSPResult gst_rtsp_connection_next_timeout (GstRTSPConnection *conn, GTimeVal *timeout);
|
||||
GstRTSPResult gst_rtsp_connection_reset_timeout (GstRTSPConnection *conn);
|
||||
GstRTSPResult gst_rtsp_connection_next_timeout (GstRTSPConnection *conn, GTimeVal *timeout);
|
||||
GstRTSPResult gst_rtsp_connection_reset_timeout (GstRTSPConnection *conn);
|
||||
|
||||
/* flushing state */
|
||||
GstRTSPResult gst_rtsp_connection_flush (GstRTSPConnection *conn, gboolean flush);
|
||||
GstRTSPResult gst_rtsp_connection_flush (GstRTSPConnection *conn, gboolean flush);
|
||||
|
||||
/* Configure Authentication data */
|
||||
GstRTSPResult gst_rtsp_connection_set_auth (GstRTSPConnection *conn, GstRTSPAuthMethod method,
|
||||
gchar *user, gchar *pass);
|
||||
GstRTSPResult gst_rtsp_connection_set_auth (GstRTSPConnection *conn, GstRTSPAuthMethod method,
|
||||
const gchar *user, const gchar *pass);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -40,6 +40,20 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:gstrtspdefs
|
||||
* @short_description: common RTSP defines
|
||||
* @see_also: gstrtspurl, gstrtspconnection
|
||||
*
|
||||
* <refsect2>
|
||||
* <para>
|
||||
* Provides common defines for the RTSP library.
|
||||
* </para>
|
||||
* </refsect2>
|
||||
*
|
||||
* Last reviewed on 2007-07-24 (0.10.14)
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
extern int h_errno;
|
||||
|
@ -209,6 +223,14 @@ rtsp_init_status (void)
|
|||
return statuses;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_strresult:
|
||||
* @result: a #GstRTSPResult
|
||||
*
|
||||
* Convert @result in a human readable string.
|
||||
*
|
||||
* Returns: a newly allocated string. g_free() after usage.
|
||||
*/
|
||||
gchar *
|
||||
gst_rtsp_strresult (GstRTSPResult result)
|
||||
{
|
||||
|
@ -241,6 +263,14 @@ gst_rtsp_strresult (GstRTSPResult result)
|
|||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_method_as_text:
|
||||
* @method: a #GstRTSPMethod
|
||||
*
|
||||
* Convert @method to a string.
|
||||
*
|
||||
* Returns: a string representation of @method.
|
||||
*/
|
||||
const gchar *
|
||||
gst_rtsp_method_as_text (GstRTSPMethod method)
|
||||
{
|
||||
|
@ -257,6 +287,14 @@ gst_rtsp_method_as_text (GstRTSPMethod method)
|
|||
return rtsp_methods[i];
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_version_as_text:
|
||||
* @version: a #GstRTSPVersion
|
||||
*
|
||||
* Convert @version to a string.
|
||||
*
|
||||
* Returns: a string representation of @version.
|
||||
*/
|
||||
const gchar *
|
||||
gst_rtsp_version_as_text (GstRTSPVersion version)
|
||||
{
|
||||
|
@ -269,6 +307,14 @@ gst_rtsp_version_as_text (GstRTSPVersion version)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_header_as_text:
|
||||
* @field: a #GstRTSPHeaderField
|
||||
*
|
||||
* Convert @field to a string.
|
||||
*
|
||||
* Returns: a string representation of @field.
|
||||
*/
|
||||
const gchar *
|
||||
gst_rtsp_header_as_text (GstRTSPHeaderField field)
|
||||
{
|
||||
|
@ -278,6 +324,14 @@ gst_rtsp_header_as_text (GstRTSPHeaderField field)
|
|||
return rtsp_headers[field - 1];
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_status_as_text:
|
||||
* @code: a #GstRTSPStatusCode
|
||||
*
|
||||
* Convert @code to a string.
|
||||
*
|
||||
* Returns: a string representation of @code.
|
||||
*/
|
||||
const gchar *
|
||||
gst_rtsp_status_as_text (GstRTSPStatusCode code)
|
||||
{
|
||||
|
@ -289,6 +343,15 @@ gst_rtsp_status_as_text (GstRTSPStatusCode code)
|
|||
return g_hash_table_lookup (statuses, GUINT_TO_POINTER (code));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_find_header_field:
|
||||
* @header: a header string
|
||||
*
|
||||
* Convert @header to a #GstRTSPHeaderField.
|
||||
*
|
||||
* Returns: a #GstRTSPHeaderField for @header or #GST_RTSP_HDR_INVALID if the
|
||||
* header field is unknown.
|
||||
*/
|
||||
GstRTSPHeaderField
|
||||
gst_rtsp_find_header_field (const gchar * header)
|
||||
{
|
||||
|
@ -302,6 +365,15 @@ gst_rtsp_find_header_field (const gchar * header)
|
|||
return GST_RTSP_HDR_INVALID;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_find_method:
|
||||
* @method: a method
|
||||
*
|
||||
* Convert @method to a #GstRTSPMethod.
|
||||
*
|
||||
* Returns: a #GstRTSPMethod for @method or #GST_RTSP_INVALID if the
|
||||
* method is unknown.
|
||||
*/
|
||||
GstRTSPMethod
|
||||
gst_rtsp_find_method (const gchar * method)
|
||||
{
|
||||
|
|
|
@ -47,6 +47,14 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* GST_RTSP_CHECK:
|
||||
* @stmt: a statement
|
||||
* @label: a label
|
||||
*
|
||||
* Macro that checks the return value of @stmt and jumps to @label when it does
|
||||
* not equal #GST_RTSP_OK.
|
||||
*/
|
||||
#define GST_RTSP_CHECK(stmt, label) \
|
||||
G_STMT_START { \
|
||||
if (G_UNLIKELY ((res = (stmt)) != GST_RTSP_OK)) \
|
||||
|
|
|
@ -49,6 +49,15 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* GstRTSPMsgType:
|
||||
* @GST_RTSP_MESSAGE_INVALID: invalid message type
|
||||
* @GST_RTSP_MESSAGE_REQUEST: request message
|
||||
* @GST_RTSP_MESSAGE_RESPONSE: response message
|
||||
* @GST_RTSP_MESSAGE_DATA: data message
|
||||
*
|
||||
* The type of a message.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GST_RTSP_MESSAGE_INVALID,
|
||||
|
@ -57,6 +66,12 @@ typedef enum
|
|||
GST_RTSP_MESSAGE_DATA,
|
||||
} GstRTSPMsgType;
|
||||
|
||||
/**
|
||||
* GstRTSPMessage:
|
||||
* @type: the message type
|
||||
*
|
||||
* An RTSP message containing request, response or data messages.
|
||||
*/
|
||||
typedef struct _GstRTSPMessage
|
||||
{
|
||||
GstRTSPMsgType type;
|
||||
|
@ -77,6 +92,7 @@ typedef struct _GstRTSPMessage
|
|||
} data;
|
||||
} type_data;
|
||||
|
||||
/*< private >*/
|
||||
GArray *hdr_fields;
|
||||
|
||||
guint8 *body;
|
||||
|
|
|
@ -115,7 +115,7 @@ parse_smpte_range (const gchar * str, GstRTSPTimeRange * range)
|
|||
}
|
||||
|
||||
/**
|
||||
* rtsp_range_parse:
|
||||
* gst_rtsp_range_parse:
|
||||
* @rangestr: a range string to parse
|
||||
* @range: location to hold the #GstRTSPTimeRange result
|
||||
*
|
||||
|
@ -166,6 +166,12 @@ invalid:
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtsp_range_free:
|
||||
* @range: a #GstRTSPTimeRange
|
||||
*
|
||||
* Free the memory alocated by @range.
|
||||
*/
|
||||
void
|
||||
gst_rtsp_range_free (GstRTSPTimeRange * range)
|
||||
{
|
||||
|
|
|
@ -50,10 +50,28 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* GST_RTSP_DEFAULT_PORT:
|
||||
*
|
||||
* The default RTSP port to connect to.
|
||||
*/
|
||||
#define GST_RTSP_DEFAULT_PORT 554
|
||||
|
||||
typedef struct _GstRTSPUrl GstRTSPUrl;
|
||||
|
||||
/**
|
||||
* GstRTSPUrl:
|
||||
* @transports: the transports allowed
|
||||
* @family: the family
|
||||
* @user: the user
|
||||
* @passwd: the password
|
||||
* @host: the host
|
||||
* @port: the port
|
||||
* @abspath: the absolute path
|
||||
* @query: additional query parameters
|
||||
*
|
||||
* This structure contains the result of a parsed RTSP URL
|
||||
*/
|
||||
struct _GstRTSPUrl {
|
||||
GstRTSPLowerTrans transports;
|
||||
GstRTSPFamily family;
|
||||
|
|
Loading…
Reference in a new issue