GstRtsp.RTSPMessage

Fields

Name

Type

Access

Description

body

int

r

body_buffer

Gst.Buffer

r

body_size

int

r

hdr_fields

[object]

r

type

GstRtsp.RTSPMsgType

r/w

the message type

Methods

add_header (field, value)

add_header_by_name (header, value)

append_headers (str)

copy ()

dump ()

free ()

get_body ()

get_body_buffer ()

get_header (field, indx)

get_header_by_name (header, index)

get_type ()

has_body_buffer ()

init ()

init_data (channel)

init_request (method, uri)

init_response (code, reason, request)

parse_auth_credentials (field)

parse_data ()

parse_request ()

parse_response ()

remove_header (field, indx)

remove_header_by_name (header, index)

set_body (data)

set_body_buffer (buffer)

steal_body ()

steal_body_buffer ()

take_body (data)

take_body_buffer (buffer)

take_header (field, value)

take_header_by_name (header, value)

unset ()

Details

class GstRtsp.RTSPMessage

Provides methods for creating and parsing GstRtsp.request, GstRtsp.response and GstRtsp.data messages.

add_header(field, value)[source]
Parameters:
Returns:

a GstRtsp.RTSPResult.

Return type:

GstRtsp.RTSPResult

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:
  • header (str) – header string

  • value (str) – the value of the header

Returns:

a GstRtsp.RTSPResult.

Return type:

GstRtsp.RTSPResult

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:

GstRtsp.RTSPResult.OK.

Return type:

GstRtsp.RTSPResult

Append the currently configured headers in self to the GLib.String str suitable for transmission.

copy()[source]
Returns:

a GstRtsp.RTSPResult

copy:

pointer to new GstRtsp.RTSPMessage

Return type:

(GstRtsp.RTSPResult, copy: GstRtsp.RTSPMessage or None)

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.

dump()[source]
Returns:

GstRtsp.RTSPResult.OK.

Return type:

GstRtsp.RTSPResult

Dump the contents of self to stdout.

free()[source]
Returns:

a GstRtsp.RTSPResult.

Return type:

GstRtsp.RTSPResult

Free the memory used by self.

get_body()[source]
Returns:

GstRtsp.RTSPResult.OK.

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 the GstRtsp.data to be copied and stored in the message. The Gst.Buffer will no longer be kept in the message.

get_body_buffer()[source]
Returns:

GstRtsp.RTSPResult.OK.

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 a Gst.Buffer this function will always return None. The caller can check if there is a body buffer by calling GstRtsp.RTSPMessage.has_body_buffer().

New in version 1.16.

get_header(field, indx)[source]
Parameters:
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 or None)

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:
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 or None)

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.

get_type()[source]
Returns:

the message type.

Return type:

GstRtsp.RTSPMsgType

Get the message type of self.

has_body_buffer()[source]
Returns:

True if self has a body and it’s stored as Gst.Buffer, False otherwise.

Return type:

bool

Checks if self has a body and the body is stored as Gst.Buffer.

New in version 1.16.

init()[source]
Returns:

a GstRtsp.RTSPResult.

Return type:

GstRtsp.RTSPResult

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:

a GstRtsp.RTSPResult.

Return type:

GstRtsp.RTSPResult

Initialize a new GstRtsp.data GstRtsp.RTSPMessage for channel.

init_request(method, uri)[source]
Parameters:
  • method (GstRtsp.RTSPMethod) – the GstRtsp.request method to use

  • uri (str) – the uri of the GstRtsp.request

Returns:

a GstRtsp.RTSPResult.

Return type:

GstRtsp.RTSPResult

Initialize self as a GstRtsp.request message with method and uri. To clear self again, use GstRtsp.RTSPMessage.unset().

init_response(code, reason, request)[source]
Parameters:
Returns:

a GstRtsp.RTSPResult.

Return type:

GstRtsp.RTSPResult

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 new GstRtsp.response message.

parse_auth_credentials(field)[source]
Parameters:

field (GstRtsp.RTSPHeaderField) – a GstRtsp.RTSPHeaderField

Returns:

None-terminated array of GstRtsp.RTSPAuthCredential or None.

Return type:

[GstRtsp.RTSPAuthCredential]

Parses the credentials given in a WWW-Authenticate or Authorization header.

New in version 1.12.

parse_data()[source]
Returns:

a GstRtsp.RTSPResult.

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:

a GstRtsp.RTSPResult.

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 be None if one is not interested in its value.

uri remains valid for as long as self is valid and unchanged.

parse_response()[source]
Returns:

a GstRtsp.RTSPResult.

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 be None 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:
Returns:

a GstRtsp.RTSPResult.

Return type:

GstRtsp.RTSPResult

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:
  • header (str) – the header string

  • index (int) – the index of the header

Returns:

a GstRtsp.RTSPResult

Return type:

GstRtsp.RTSPResult

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) – the GstRtsp.data

Returns:

GstRtsp.RTSPResult.OK.

Return type:

GstRtsp.RTSPResult

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) – a Gst.Buffer

Returns:

GstRtsp.RTSPResult.OK.

Return type:

GstRtsp.RTSPResult

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:

GstRtsp.RTSPResult.OK.

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:

GstRtsp.RTSPResult.OK.

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 a Gst.Buffer this function will always return None. The caller can check if there is a body buffer by calling GstRtsp.RTSPMessage.has_body_buffer().

New in version 1.16.

take_body(data)[source]
Parameters:

data (bytes) – the GstRtsp.data

Returns:

GstRtsp.RTSPResult.OK.

Return type:

GstRtsp.RTSPResult

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) – a Gst.Buffer

Returns:

GstRtsp.RTSPResult.OK.

Return type:

GstRtsp.RTSPResult

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:
Returns:

a GstRtsp.RTSPResult.

Return type:

GstRtsp.RTSPResult

Add a header with key field and value to self. This function takes ownership of value.

take_header_by_name(header, value)[source]
Parameters:
  • header (str) – a header string

  • value (str) – the value of the header

Returns:

a GstRtsp.RTSPResult.

Return type:

GstRtsp.RTSPResult

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:

GstRtsp.RTSPResult.OK.

Return type:

GstRtsp.RTSPResult

Unset the contents of self so that it becomes an uninitialized GstRtsp.RTSPMessage again. This function is mostly used in combination with GstRtsp.RTSPMessage.init_request(), GstRtsp.RTSPMessage.init_response() and GstRtsp.RTSPMessage.init_data() on stack allocated GstRtsp.RTSPMessage structures.