GstRtsp.RTSPMessage¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
body |
r |
||
body_buffer |
r |
||
body_size |
r |
||
hdr_fields |
[ |
r |
|
type |
r/w |
the message type |
Methods¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class GstRtsp.RTSPMessage¶
Provides methods for creating and parsing
GstRtsp.request
,GstRtsp.response
andGstRtsp.data
messages.- add_header(field, value)[source]¶
- Parameters:
field (
GstRtsp.RTSPHeaderField
) – aGstRtsp.RTSPHeaderField
value (
str
) – the value of the header
- Returns:
- Return type:
Add a header with key field and value to self. This function takes a copy of value.
- add_header_by_name(header, value)[source]¶
- Parameters:
- Returns:
- Return type:
Add a header with key header and value to self. This function takes a copy of value.
New in version 1.6.
- append_headers(str)[source]¶
- Parameters:
str (
GLib.String
) – a string- Returns:
- Return type:
Append the currently configured headers in self to the
GLib.String
str suitable for transmission.
- copy()[source]¶
- Returns:
-
- copy:
pointer to new
GstRtsp.RTSPMessage
- Return type:
(
GstRtsp.RTSPResult
, copy:GstRtsp.RTSPMessage
orNone
)
Allocate a new copy of self and store the result in copy. The value in copy should be release with
GstRtsp.RTSPMessage.free
function.New in version 1.14.
- get_body()[source]¶
- Returns:
-
- data:
location for the
GstRtsp.data
- Return type:
(
GstRtsp.RTSPResult
, data:bytes
)
Get the body of self. data remains valid for as long as self is valid and unchanged.
If the message body was set as a
Gst.Buffer
before this will cause theGstRtsp.data
to be copied and stored in the message. TheGst.Buffer
will no longer be kept in the message.
- get_body_buffer()[source]¶
- Returns:
-
- buffer:
location for the buffer
- Return type:
(
GstRtsp.RTSPResult
, buffer:Gst.Buffer
)
Get the body of self. buffer remains valid for as long as self is valid and unchanged.
If body
GstRtsp.data
was set from raw memory instead of aGst.Buffer
this function will always returnNone
. The caller can check if there is a body buffer by callingGstRtsp.RTSPMessage.has_body_buffer
().New in version 1.16.
- get_header(field, indx)[source]¶
- Parameters:
field (
GstRtsp.RTSPHeaderField
) – aGstRtsp.RTSPHeaderField
indx (
int
) – the index of the header
- Returns:
GstRtsp.RTSPResult.OK
when field was found,GstRtsp.RTSPResult.ENOTIMPL
if the key was not found.- value:
pointer to hold the result
- Return type:
(
GstRtsp.RTSPResult
, value:str
orNone
)
Get the indx header value with key field from self. The result in value stays valid as long as it remains present in self.
- get_header_by_name(header, index)[source]¶
- Parameters:
header (
str
) – aGstRtsp.RTSPHeaderField
index (
int
) – the index of the header
- Returns:
GstRtsp.RTSPResult.OK
when field was found,GstRtsp.RTSPResult.ENOTIMPL
if the key was not found.- value:
pointer to hold the result
- Return type:
(
GstRtsp.RTSPResult
, value:str
orNone
)
Get the index header value with key header from self. The result in value stays valid as long as it remains present in self.
New in version 1.6.
- has_body_buffer()[source]¶
- Returns:
True
if self has a body and it’s stored asGst.Buffer
,False
otherwise.- Return type:
Checks if self has a body and the body is stored as
Gst.Buffer
.New in version 1.16.
- init()[source]¶
- Returns:
- Return type:
Initialize self. This function is mostly used when self is allocated on the stack. The reverse operation of this is
GstRtsp.RTSPMessage.unset
().
- init_data(channel)[source]¶
- Parameters:
channel (
int
) – a channel- Returns:
- Return type:
Initialize a new
GstRtsp.data
GstRtsp.RTSPMessage
for channel.
- init_request(method, uri)[source]¶
- Parameters:
method (
GstRtsp.RTSPMethod
) – theGstRtsp.request
method to useuri (
str
) – the uri of theGstRtsp.request
- Returns:
- Return type:
Initialize self as a
GstRtsp.request
message with method and uri. To clear self again, useGstRtsp.RTSPMessage.unset
().
- init_response(code, reason, request)[source]¶
- Parameters:
code (
GstRtsp.RTSPStatusCode
) – the status coderequest (
GstRtsp.RTSPMessage
orNone
) – theGstRtsp.request
that triggered theGstRtsp.response
orNone
- Returns:
- Return type:
Initialize self with code and reason.
When reason is
None
, the default reason for code will be used.When request is not
None
, the relevant headers will be copied to the newGstRtsp.response
message.
- parse_auth_credentials(field)[source]¶
- Parameters:
field (
GstRtsp.RTSPHeaderField
) – aGstRtsp.RTSPHeaderField
- Returns:
None
-terminated array ofGstRtsp.RTSPAuthCredential
orNone
.- Return type:
Parses the credentials given in a WWW-Authenticate or Authorization header.
New in version 1.12.
- parse_data()[source]¶
- Returns:
-
- channel:
location to hold the channel
- Return type:
(
GstRtsp.RTSPResult
, channel:int
)
Parse the
GstRtsp.data
message self and store the channel in channel.
- parse_request()[source]¶
- Returns:
-
- method:
location to hold the method
- uri:
location to hold the uri
- version:
location to hold the version
- Return type:
(
GstRtsp.RTSPResult
, method:GstRtsp.RTSPMethod
, uri:str
, version:GstRtsp.RTSPVersion
)
Parse the
GstRtsp.request
message self and store the values method, uri and version. The result locations can beNone
if one is not interested in its value.uri remains valid for as long as self is valid and unchanged.
- parse_response()[source]¶
- Returns:
-
- code:
location to hold the status code
- reason:
location to hold the status reason
- version:
location to hold the version
- Return type:
(
GstRtsp.RTSPResult
, code:GstRtsp.RTSPStatusCode
, reason:str
, version:GstRtsp.RTSPVersion
)
Parse the
GstRtsp.response
message self and store the values code, reason and version. The result locations can beNone
if one is not interested in its value.reason remains valid for as long as self is valid and unchanged.
- remove_header(field, indx)[source]¶
- Parameters:
field (
GstRtsp.RTSPHeaderField
) – aGstRtsp.RTSPHeaderField
indx (
int
) – the index of the header
- Returns:
- Return type:
Remove the indx header with key field from self. If indx equals -1, all headers will be removed.
- remove_header_by_name(header, index)[source]¶
- Parameters:
- Returns:
- Return type:
Remove the index header with key header from self. If index equals -1, all matching headers will be removed.
New in version 1.6.
- set_body(data)[source]¶
- Parameters:
data (
bytes
) – theGstRtsp.data
- Returns:
- Return type:
Set the body of self to a copy of data. Any existing body or body buffer will be replaced by the new body.
- set_body_buffer(buffer)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – aGst.Buffer
- Returns:
- Return type:
Set the body of self to buffer. Any existing body or body buffer will be replaced by the new body.
New in version 1.16.
- steal_body()[source]¶
- Returns:
-
- data:
location for the
GstRtsp.data
- Return type:
(
GstRtsp.RTSPResult
, data:bytes
)
Take the body of self and store it in data and size. After this method, the body and size of self will be set to
None
and 0 respectively.
- steal_body_buffer()[source]¶
- Returns:
-
- buffer:
location for the buffer
- Return type:
(
GstRtsp.RTSPResult
, buffer:Gst.Buffer
)
Take the body of self and store it in buffer. After this method, the body and size of self will be set to
None
and 0 respectively.If body
GstRtsp.data
was set from raw memory instead of aGst.Buffer
this function will always returnNone
. The caller can check if there is a body buffer by callingGstRtsp.RTSPMessage.has_body_buffer
().New in version 1.16.
- take_body(data)[source]¶
- Parameters:
data (
bytes
) – theGstRtsp.data
- Returns:
- Return type:
Set the body of self to data and size. This method takes ownership of data. Any existing body or body buffer will be replaced by the new body.
- take_body_buffer(buffer)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – aGst.Buffer
- Returns:
- Return type:
Set the body of self to buffer. This method takes ownership of buffer. Any existing body or body buffer will be replaced by the new body.
New in version 1.16.
- take_header(field, value)[source]¶
- Parameters:
field (
GstRtsp.RTSPHeaderField
) – aGstRtsp.RTSPHeaderField
value (
str
) – the value of the header
- Returns:
- Return type:
Add a header with key field and value to self. This function takes ownership of value.
- take_header_by_name(header, value)[source]¶
- Parameters:
- Returns:
- Return type:
Add a header with key header and value to self. This function takes ownership of value, but not of header.
New in version 1.6.
- unset()[source]¶
- Returns:
- Return type:
Unset the contents of self so that it becomes an uninitialized
GstRtsp.RTSPMessage
again. This function is mostly used in combination withGstRtsp.RTSPMessage.init_request
(),GstRtsp.RTSPMessage.init_response
() andGstRtsp.RTSPMessage.init_data
() on stack allocatedGstRtsp.RTSPMessage
structures.