GstSdp.SDPMedia

Fields

Name

Type

Access

Description

attributes

[object]

r/w

array of GstSdp.SDPAttribute with the additional media attributes

bandwidths

[object]

r/w

array of GstSdp.SDPBandwidth with media bandwidth information

connections

[object]

r/w

array of GstSdp.SDPConnection with media connection information

fmts

[object]

r/w

an array of str formats

information

str

r/w

the media title

key

GstSdp.SDPKey

r/w

the encryption key

media

str

r/w

the media type

num_ports

int

r/w

the number of ports or -1 if only one port was specified

port

int

r/w

the transport port to which the media stream will be sent

proto

str

r/w

the transport protocol

Methods

class

init ()

class

new ()

class

set_media_from_caps (caps)

add_attribute (key, value)

add_bandwidth (bwtype, bandwidth)

add_connection (nettype, addrtype, address, ttl, addr_number)

add_format (format)

as_text ()

attributes_len ()

attributes_to_caps (caps)

bandwidths_len ()

connections_len ()

copy ()

formats_len ()

free ()

get_attribute (idx)

get_attribute_val (key)

get_attribute_val_n (key, nth)

get_bandwidth (idx)

get_caps_from_media (pt)

get_connection (idx)

get_format (idx)

get_information ()

get_key ()

get_media ()

get_num_ports ()

get_port ()

get_proto ()

insert_attribute (idx, attr)

insert_bandwidth (idx, bw)

insert_connection (idx, conn)

insert_format (idx, format)

parse_keymgmt ()

remove_attribute (idx)

remove_bandwidth (idx)

remove_connection (idx)

remove_format (idx)

replace_attribute (idx, attr)

replace_bandwidth (idx, bw)

replace_connection (idx, conn)

replace_format (idx, format)

set_information (information)

set_key (type, data)

set_media (med)

set_port_info (port, num_ports)

set_proto (proto)

uninit ()

Details

class GstSdp.SDPMedia

The contents of the SDP “m=” field with all related fields.

classmethod init()
Returns:

a GstSdp.SDPResult.

media:

a GstSdp.SDPMedia

Return type:

(GstSdp.SDPResult, media: GstSdp.SDPMedia)

Initialize media so that its contents are as if it was freshly allocated with GstSdp.SDPMedia.new(). This function is mostly used to initialize a media allocated on the stack. GstSdp.SDPMedia.uninit() undoes this operation.

When this function is invoked on newly allocated data (with malloc or on the stack), its contents should be set to 0 before calling this function.

classmethod new()
Returns:

a GstSdp.SDPResult.

media:

pointer to new GstSdp.SDPMedia

Return type:

(GstSdp.SDPResult, media: GstSdp.SDPMedia)

Allocate a new GstSdp.SDPMedia and store the result in media.

classmethod set_media_from_caps(caps)
Parameters:

caps (Gst.Caps) – a Gst.Caps

Returns:

a GstSdp.SDPResult.

media:

a GstSdp.SDPMedia

Return type:

(GstSdp.SDPResult, media: GstSdp.SDPMedia)

Mapping of caps to SDP fields:

a=rtpmap:(payload) (encoding_name) or (clock_rate)[or (encoding_params)]

a=framesize:(payload) (width)-(height)

a=fmtp:(payload) (param)[=(value)];…

a=rtcp-fb:(payload) (param1) [param2]…

a=extmap:(id)[/direction] (extensionname) (extensionattributes)

New in version 1.8.

add_attribute(key, value)
Parameters:
  • key (str) – a key

  • value (str or None) – a value

Returns:

GstSdp.SDPResult.OK.

Return type:

GstSdp.SDPResult

Add the attribute with key and value to self.

add_bandwidth(bwtype, bandwidth)
Parameters:
  • bwtype (str) – the bandwidth modifier type

  • bandwidth (int) – the bandwidth in kilobits per second

Returns:

GstSdp.SDPResult.OK.

Return type:

GstSdp.SDPResult

Add the bandwidth information with bwtype and bandwidth to self.

add_connection(nettype, addrtype, address, ttl, addr_number)
Parameters:
  • nettype (str) – the type of network. “IN” is defined to have the meaning “Internet”.

  • addrtype (str) – the type of address.

  • address (str) – the address

  • ttl (int) – the time to live of the address

  • addr_number (int) – the number of layers

Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Add the given connection parameters to self.

add_format(format)
Parameters:

format (str) – the format

Returns:

GstSdp.SDPResult.OK.

Return type:

GstSdp.SDPResult

Add the format information to self.

as_text()
Returns:

A dynamically allocated string representing the media.

Return type:

str

Convert the contents of self to a text string.

attributes_len()
Returns:

the number of attributes in self.

Return type:

int

Get the number of attribute fields in self.

attributes_to_caps(caps)
Parameters:

caps (Gst.Caps) – a Gst.Caps

Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Mapping of attributes of GstSdp.SDPMedia to Gst.Caps

New in version 1.8.

bandwidths_len()
Returns:

the number of bandwidths in self.

Return type:

int

Get the number of bandwidth fields in self.

connections_len()
Returns:

the number of connections in self.

Return type:

int

Get the number of connection fields in self.

copy()
Returns:

a GstSdp.SDPResult

copy:

pointer to new GstSdp.SDPMedia

Return type:

(GstSdp.SDPResult, copy: GstSdp.SDPMedia)

Allocate a new copy of self and store the result in copy. The value in copy should be release with GstSdp.SDPMedia.free function.

New in version 1.2.

formats_len()
Returns:

the number of formats in self.

Return type:

int

Get the number of formats in self.

free()
Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Free all resources allocated by self. self should not be used anymore after this function. This function should be used when self was dynamically allocated with GstSdp.SDPMedia.new().

get_attribute(idx)
Parameters:

idx (int) – an index

Returns:

the GstSdp.SDPAttribute at position idx.

Return type:

GstSdp.SDPAttribute

Get the attribute at position idx in self.

get_attribute_val(key)
Parameters:

key (str) – a key

Returns:

the first attribute value for key.

Return type:

str or None

Get the first attribute value for key in self.

get_attribute_val_n(key, nth)
Parameters:
  • key (str) – a key

  • nth (int) – an index

Returns:

the nth attribute value.

Return type:

str or None

Get the nth attribute value for key in self.

get_bandwidth(idx)
Parameters:

idx (int) – an index

Returns:

the GstSdp.SDPBandwidth at position idx.

Return type:

GstSdp.SDPBandwidth

Get the bandwidth at position idx in self.

get_caps_from_media(pt)
Parameters:

pt (int) – a payload type

Returns:

a Gst.Caps, or None if an error happened

Return type:

Gst.Caps or None

Mapping of caps from SDP fields:

a=rtpmap:(payload) (encoding_name)/(clock_rate)[/(encoding_params)]

a=framesize:(payload) (width)-(height)

a=fmtp:(payload) (param)[=(value)];…

Note that the extmap, ssrc and rid attributes are set only by GstSdp.SDPMedia.attributes_to_caps().

New in version 1.8.

get_connection(idx)
Parameters:

idx (int) – an index

Returns:

the GstSdp.SDPConnection at position idx.

Return type:

GstSdp.SDPConnection

Get the connection at position idx in self.

get_format(idx)
Parameters:

idx (int) – an index

Returns:

the format at position idx.

Return type:

str

Get the format information at position idx in self.

get_information()
Returns:

the information of self.

Return type:

str

Get the information of self

get_key()
Returns:

a GstSdp.SDPKey.

Return type:

GstSdp.SDPKey

Get the encryption information from self.

get_media()
Returns:

the media description.

Return type:

str

Get the media description of self.

get_num_ports()
Returns:

the number of ports for self.

Return type:

int

Get the number of ports for self.

get_port()
Returns:

the port number of self.

Return type:

int

Get the port number for self.

get_proto()
Returns:

the transport protocol of self.

Return type:

str

Get the transport protocol of self

insert_attribute(idx, attr)
Parameters:
Returns:

GstSdp.SDPResult.OK.

Return type:

GstSdp.SDPResult

Insert the attribute to self at idx. When idx is -1, the attribute is appended.

New in version 1.2.

insert_bandwidth(idx, bw)
Parameters:
Returns:

GstSdp.SDPResult.OK.

Return type:

GstSdp.SDPResult

Insert the bandwidth information to self at idx. When idx is -1, the bandwidth is appended.

New in version 1.2.

insert_connection(idx, conn)
Parameters:
Returns:

GstSdp.SDPResult.OK.

Return type:

GstSdp.SDPResult

Insert the connection information to self at idx. When idx is -1, the connection is appended.

New in version 1.2.

insert_format(idx, format)
Parameters:
  • idx (int) – an index

  • format (str) – the format

Returns:

GstSdp.SDPResult.OK.

Return type:

GstSdp.SDPResult

Insert the format information to self at idx. When idx is -1, the format is appended.

New in version 1.2.

parse_keymgmt()
Returns:

a GstSdp.SDPResult.

mikey:

pointer to new GstSdp.MIKEYMessage

Return type:

(GstSdp.SDPResult, mikey: GstSdp.MIKEYMessage)

Creates a new GstSdp.MIKEYMessage after parsing the key-mgmt attribute from a GstSdp.SDPMedia.

New in version 1.8.1.

remove_attribute(idx)
Parameters:

idx (int) – an index

Returns:

GstSdp.SDPResult.OK.

Return type:

GstSdp.SDPResult

Remove the attribute in self at idx.

New in version 1.2.

remove_bandwidth(idx)
Parameters:

idx (int) – an index

Returns:

GstSdp.SDPResult.OK.

Return type:

GstSdp.SDPResult

Remove the bandwidth information in self at idx.

New in version 1.2.

remove_connection(idx)
Parameters:

idx (int) – an index

Returns:

GstSdp.SDPResult.OK.

Return type:

GstSdp.SDPResult

Remove the connection information in self at idx.

New in version 1.2.

remove_format(idx)
Parameters:

idx (int) – an index

Returns:

GstSdp.SDPResult.OK.

Return type:

GstSdp.SDPResult

Remove the format information in self at idx.

New in version 1.2.

replace_attribute(idx, attr)
Parameters:
Returns:

GstSdp.SDPResult.OK.

Return type:

GstSdp.SDPResult

Replace the attribute in self at idx with attr.

New in version 1.2.

replace_bandwidth(idx, bw)
Parameters:
Returns:

GstSdp.SDPResult.OK.

Return type:

GstSdp.SDPResult

Replace the bandwidth information in self at idx with bw.

New in version 1.2.

replace_connection(idx, conn)
Parameters:
Returns:

GstSdp.SDPResult.OK.

Return type:

GstSdp.SDPResult

Replace the connection information in self at idx with conn.

New in version 1.2.

replace_format(idx, format)
Parameters:
  • idx (int) – an index

  • format (str) – the format

Returns:

GstSdp.SDPResult.OK.

Return type:

GstSdp.SDPResult

Replace the format information in self at idx with format.

New in version 1.2.

set_information(information)
Parameters:

information (str) – the media information

Returns:

GstSdp.SDPResult.OK.

Return type:

GstSdp.SDPResult

Set the media information of self to information.

set_key(type, data)
Parameters:
  • type (str) – the encryption type

  • data (str) – the encryption data

Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Adds the encryption information to self.

set_media(med)
Parameters:

med (str) – the media description

Returns:

GstSdp.SDPResult.OK.

Return type:

GstSdp.SDPResult

Set the media description of self to med.

set_port_info(port, num_ports)
Parameters:
  • port (int) – the port number

  • num_ports (int) – the number of ports

Returns:

GstSdp.SDPResult.OK.

Return type:

GstSdp.SDPResult

Set the port information in self.

set_proto(proto)
Parameters:

proto (str) – the media transport protocol

Returns:

GstSdp.SDPResult.OK.

Return type:

GstSdp.SDPResult

Set the media transport protocol of self to proto.

uninit()
Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Free all resources allocated in self. self should not be used anymore after this function. This function should be used when self was allocated on the stack and initialized with GstSdp.SDPMedia.init().