Top |
GstRTSPResult
gst_rtsp_message_new (GstRTSPMessage **msg
);
Create a new initialized GstRTSPMessage. Free with gst_rtsp_message_free()
.
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()
.
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.
GstRTSPResult
gst_rtsp_message_free (GstRTSPMessage *msg
);
Free the memory used by msg
.
GstRTSPMsgType
gst_rtsp_message_get_type (GstRTSPMessage *msg
);
Get the message type of msg
.
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()
.
msg |
a location for the new GstRTSPMessage. |
[out][transfer full] |
method |
the request method to use |
|
uri |
the uri of the request. |
[transfer none] |
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()
.
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.
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.
msg |
a location for the new GstRTSPMessage. |
[out][transfer full] |
code |
the status code |
|
reason |
the status reason or |
[transfer none][allow-none] |
request |
the request that triggered the response or |
[transfer none][allow-none] |
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.
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.
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()
.
GstRTSPResult gst_rtsp_message_init_data (GstRTSPMessage *msg
,guint8 channel
);
Initialize a new data GstRTSPMessage for channel
.
GstRTSPResult gst_rtsp_message_parse_data (GstRTSPMessage *msg
,guint8 *channel
);
Parse the data message msg
and store the channel in channel
.
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
.
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
.
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.
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
.
GstRTSPResult gst_rtsp_message_add_header_by_name (GstRTSPMessage *msg
,const gchar *header
,const gchar *value
);
Add a header with key header
and value
to msg
. This function takes a copy
of value
.
Since: 1.6
GstRTSPResult gst_rtsp_message_take_header_by_name (GstRTSPMessage *msg
,const gchar *header
,gchar *value
);
Add a header with key header
and value
to msg
. This function takes
ownership of value
, but not of header
.
msg |
||
header |
a header string. |
[transfer none] |
value |
the value of the header. |
[transfer full] |
Since: 1.6
GstRTSPResult gst_rtsp_message_remove_header_by_name (GstRTSPMessage *msg
,const gchar *header
,gint index
);
Remove the index
header with key header
from msg
. If index
equals -1,
all matching headers will be removed.
Since: 1.6
GstRTSPResult gst_rtsp_message_get_header_by_name (GstRTSPMessage *msg
,const gchar *header
,gchar **value
,gint index
);
Get the index
header value with key header
from msg
. The result in value
stays valid as long as it remains present in msg
.
msg |
||
header |
||
value |
pointer to hold the result. |
[out][transfer none] |
index |
the index of the header |
Since: 1.6
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.
GstRTSPResult gst_rtsp_message_set_body (GstRTSPMessage *msg
,const guint8 *data
,guint size
);
Set the body of msg
to a copy of data
.
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
.
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.
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.
GstRTSPResult
gst_rtsp_message_dump (GstRTSPMessage *msg
);
Dump the contents of msg
to stdout.
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; } type_data; };
An RTSP message containing request, response or data messages. Depending on
the type
, the appropriate structure may be accessed.