![]() |
![]() |
![]() |
GStreamer Base Plugins 0.10 Library Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#include <gst/rtsp/gstrtspmessage.h> enum GstRTSPMsgType; struct GstRTSPMessage; GstRTSPResult gst_rtsp_message_new (GstRTSPMessage **msg
); GstRTSPResult gst_rtsp_message_init (GstRTSPMessage *msg
); GstRTSPResult gst_rtsp_message_unset (GstRTSPMessage *msg
); GstRTSPResult gst_rtsp_message_free (GstRTSPMessage *msg
); GstRTSPMsgType gst_rtsp_message_get_type (GstRTSPMessage *msg
); GstRTSPResult gst_rtsp_message_new_request (GstRTSPMessage **msg
,GstRTSPMethod method
,const gchar *uri
); GstRTSPResult gst_rtsp_message_init_request (GstRTSPMessage *msg
,GstRTSPMethod method
,const gchar *uri
); GstRTSPResult gst_rtsp_message_parse_request (GstRTSPMessage *msg
,GstRTSPMethod *method
,const gchar **uri
,GstRTSPVersion *version
); GstRTSPResult gst_rtsp_message_new_response (GstRTSPMessage **msg
,GstRTSPStatusCode code
,const gchar *reason
,const GstRTSPMessage *request
); GstRTSPResult gst_rtsp_message_init_response (GstRTSPMessage *msg
,GstRTSPStatusCode code
,const gchar *reason
,const GstRTSPMessage *request
); GstRTSPResult gst_rtsp_message_parse_response (GstRTSPMessage *msg
,GstRTSPStatusCode *code
,const gchar **reason
,GstRTSPVersion *version
); GstRTSPResult gst_rtsp_message_new_data (GstRTSPMessage **msg
,guint8 channel
); GstRTSPResult gst_rtsp_message_init_data (GstRTSPMessage *msg
,guint8 channel
); GstRTSPResult gst_rtsp_message_parse_data (GstRTSPMessage *msg
,guint8 *channel
); GstRTSPResult gst_rtsp_message_add_header (GstRTSPMessage *msg
,GstRTSPHeaderField field
,const gchar *value
); GstRTSPResult gst_rtsp_message_take_header (GstRTSPMessage *msg
,GstRTSPHeaderField field
,gchar *value
); GstRTSPResult gst_rtsp_message_remove_header (GstRTSPMessage *msg
,GstRTSPHeaderField field
,gint indx
); GstRTSPResult gst_rtsp_message_get_header (const GstRTSPMessage *msg
,GstRTSPHeaderField field
,gchar **value
,gint indx
); GstRTSPResult gst_rtsp_message_append_headers (const GstRTSPMessage *msg
,GString *str
); GstRTSPResult gst_rtsp_message_set_body (GstRTSPMessage *msg
,const guint8 *data
,guint size
); GstRTSPResult gst_rtsp_message_take_body (GstRTSPMessage *msg
,guint8 *data
,guint size
); GstRTSPResult gst_rtsp_message_get_body (const GstRTSPMessage *msg
,guint8 **data
,guint *size
); GstRTSPResult gst_rtsp_message_steal_body (GstRTSPMessage *msg
,guint8 **data
,guint *size
); GstRTSPResult gst_rtsp_message_dump (GstRTSPMessage *msg
);
Provides methods for creating and parsing request, response and data messages. Last reviewed on 2007-07-25 (0.10.14)
typedef enum { GST_RTSP_MESSAGE_INVALID, GST_RTSP_MESSAGE_REQUEST, GST_RTSP_MESSAGE_RESPONSE, GST_RTSP_MESSAGE_HTTP_REQUEST, GST_RTSP_MESSAGE_HTTP_RESPONSE, GST_RTSP_MESSAGE_DATA } GstRTSPMsgType;
The type of a message.
invalid message type | |
RTSP request message | |
RTSP response message | |
HTTP request message. Since 0.10.25 | |
HTTP response message. Since 0.10.25 | |
data message |
struct GstRTSPMessage { GstRTSPMsgType type; union { struct { GstRTSPMethod method; gchar *uri; GstRTSPVersion version; } request; struct { GstRTSPStatusCode code; gchar *reason; GstRTSPVersion version; } response; struct { guint8 channel; } data; };
An RTSP message containing request, response or data messages. Depending on
the type
, the appropriate structure may be accessed.
GstRTSPMsgType |
the message type |
GstRTSPResult gst_rtsp_message_new (GstRTSPMessage **msg
);
Create a new initialized GstRTSPMessage. Free with gst_rtsp_message_free()
.
|
a location for the new GstRTSPMessage |
Returns : |
a GstRTSPResult. |
GstRTSPResult gst_rtsp_message_init (GstRTSPMessage *msg
);
Initialize msg
. This function is mostly used when msg
is allocated on the
stack. The reverse operation of this is gst_rtsp_message_unset()
.
|
a GstRTSPMessage |
Returns : |
a GstRTSPResult. |
GstRTSPResult gst_rtsp_message_unset (GstRTSPMessage *msg
);
Unset the contents of msg
so that it becomes an uninitialized
GstRTSPMessage again. This function is mostly used in combination with
gst_rtsp_message_init_request()
, gst_rtsp_message_init_response()
and
gst_rtsp_message_init_data()
on stack allocated GstRTSPMessage structures.
|
a GstRTSPMessage |
Returns : |
GST_RTSP_OK. |
GstRTSPResult gst_rtsp_message_free (GstRTSPMessage *msg
);
Free the memory used by msg
.
|
a GstRTSPMessage |
Returns : |
a GstRTSPResult. |
GstRTSPMsgType gst_rtsp_message_get_type (GstRTSPMessage *msg
);
Get the message type of msg
.
|
a GstRTSPMessage |
Returns : |
the message type. |
GstRTSPResult gst_rtsp_message_new_request (GstRTSPMessage **msg
,GstRTSPMethod method
,const gchar *uri
);
Create a new GstRTSPMessage with method
and uri
and store the result
request message in msg
. Free with gst_rtsp_message_free()
.
|
a location for the new GstRTSPMessage |
|
the request method to use |
|
the uri of the request |
Returns : |
a GstRTSPResult. |
GstRTSPResult gst_rtsp_message_init_request (GstRTSPMessage *msg
,GstRTSPMethod method
,const gchar *uri
);
Initialize msg
as a request message with method
and uri
. To clear msg
again, use gst_rtsp_message_unset()
.
|
a GstRTSPMessage |
|
the request method to use |
|
the uri of the request |
Returns : |
a GstRTSPResult. |
GstRTSPResult gst_rtsp_message_parse_request (GstRTSPMessage *msg
,GstRTSPMethod *method
,const gchar **uri
,GstRTSPVersion *version
);
Parse the request message msg
and store the values method
, uri
and
version
. The result locations can be NULL if one is not interested in its
value.
uri
remains valid for as long as msg
is valid and unchanged.
|
a GstRTSPMessage |
|
location to hold the method |
|
location to hold the uri |
|
location to hold the version |
Returns : |
a GstRTSPResult. |
GstRTSPResult gst_rtsp_message_new_response (GstRTSPMessage **msg
,GstRTSPStatusCode code
,const gchar *reason
,const GstRTSPMessage *request
);
Create a new response GstRTSPMessage with code
and reason
and store the
result message in msg
. Free with gst_rtsp_message_free()
.
When reason
is NULL, the default reason for code
will be used.
When request
is not NULL, the relevant headers will be copied to the new
response message.
|
a location for the new GstRTSPMessage |
|
the status code |
|
the status reason or NULL |
|
the request that triggered the response or NULL |
Returns : |
a GstRTSPResult. |
GstRTSPResult gst_rtsp_message_init_response (GstRTSPMessage *msg
,GstRTSPStatusCode code
,const gchar *reason
,const GstRTSPMessage *request
);
Initialize msg
with code
and reason
.
When reason
is NULL, the default reason for code
will be used.
When request
is not NULL, the relevant headers will be copied to the new
response message.
|
a GstRTSPMessage |
|
the status code |
|
the status reason or NULL |
|
the request that triggered the response or NULL |
Returns : |
a GstRTSPResult. |
GstRTSPResult gst_rtsp_message_parse_response (GstRTSPMessage *msg
,GstRTSPStatusCode *code
,const gchar **reason
,GstRTSPVersion *version
);
Parse the response message msg
and store the values code
, reason
and
version
. The result locations can be NULL if one is not interested in its
value.
reason
remains valid for as long as msg
is valid and unchanged.
|
a GstRTSPMessage |
|
location to hold the status code |
|
location to hold the status reason |
|
location to hold the version |
Returns : |
a GstRTSPResult. |
GstRTSPResult gst_rtsp_message_new_data (GstRTSPMessage **msg
,guint8 channel
);
Create a new data GstRTSPMessage with channel
and store the
result message in msg
. Free with gst_rtsp_message_free()
.
|
a location for the new GstRTSPMessage |
|
the channel |
Returns : |
a GstRTSPResult. |
GstRTSPResult gst_rtsp_message_init_data (GstRTSPMessage *msg
,guint8 channel
);
Initialize a new data GstRTSPMessage for channel
.
|
a GstRTSPMessage |
|
a channel |
Returns : |
a GstRTSPResult. |
GstRTSPResult gst_rtsp_message_parse_data (GstRTSPMessage *msg
,guint8 *channel
);
Parse the data message msg
and store the channel in channel
.
|
a GstRTSPMessage |
|
location to hold the channel |
Returns : |
a GstRTSPResult. |
GstRTSPResult gst_rtsp_message_add_header (GstRTSPMessage *msg
,GstRTSPHeaderField field
,const gchar *value
);
Add a header with key field
and value
to msg
. This function takes a copy
of value
.
|
a GstRTSPMessage |
|
a GstRTSPHeaderField |
|
the value of the header |
Returns : |
a GstRTSPResult. |
GstRTSPResult gst_rtsp_message_take_header (GstRTSPMessage *msg
,GstRTSPHeaderField field
,gchar *value
);
Add a header with key field
and value
to msg
. This function takes
ownership of value
.
|
a GstRTSPMessage |
|
a GstRTSPHeaderField |
|
the value of the header |
Returns : |
a GstRTSPResult. |
Since 0.10.23
GstRTSPResult gst_rtsp_message_remove_header (GstRTSPMessage *msg
,GstRTSPHeaderField field
,gint indx
);
Remove the indx
header with key field
from msg
. If indx
equals -1, all
headers will be removed.
|
a GstRTSPMessage |
|
a GstRTSPHeaderField |
|
the index of the header |
Returns : |
a GstRTSPResult. |
GstRTSPResult gst_rtsp_message_get_header (const GstRTSPMessage *msg
,GstRTSPHeaderField field
,gchar **value
,gint indx
);
Get the indx
header value with key field
from msg
. The result in value
stays valid as long as it remains present in msg
.
|
a GstRTSPMessage |
|
a GstRTSPHeaderField |
|
pointer to hold the result |
|
the index of the header |
Returns : |
GST_RTSP_OK when field was found, GST_RTSP_ENOTIMPL if the key
was not found. |
GstRTSPResult gst_rtsp_message_append_headers (const GstRTSPMessage *msg
,GString *str
);
Append the currently configured headers in msg
to the GString str
suitable
for transmission.
|
a GstRTSPMessage |
|
a string |
Returns : |
GST_RTSP_OK. |
GstRTSPResult gst_rtsp_message_set_body (GstRTSPMessage *msg
,const guint8 *data
,guint size
);
Set the body of msg
to a copy of data
.
|
a GstRTSPMessage |
|
the data |
|
the size of data
|
Returns : |
GST_RTSP_OK. |
GstRTSPResult gst_rtsp_message_take_body (GstRTSPMessage *msg
,guint8 *data
,guint size
);
Set the body of msg
to data
and size
. This method takes ownership of
data
.
|
a GstRTSPMessage |
|
the data |
|
the size of data
|
Returns : |
GST_RTSP_OK. |
GstRTSPResult gst_rtsp_message_get_body (const GstRTSPMessage *msg
,guint8 **data
,guint *size
);
Get the body of msg
. data
remains valid for as long as msg
is valid and
unchanged.
|
a GstRTSPMessage |
|
location for the data |
|
location for the size of data
|
Returns : |
GST_RTSP_OK. |
GstRTSPResult gst_rtsp_message_steal_body (GstRTSPMessage *msg
,guint8 **data
,guint *size
);
Take the body of msg
and store it in data
and size
. After this method,
the body and size of msg
will be set to NULL and 0 respectively.
|
a GstRTSPMessage |
|
location for the data |
|
location for the size of data
|
Returns : |
GST_RTSP_OK. |
GstRTSPResult gst_rtsp_message_dump (GstRTSPMessage *msg
);
Dump the contents of msg
to stdout.
|
a GstRTSPMessage |
Returns : |
GST_RTSP_OK. |