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 new ()
class set_media_from_caps (caps, media)
  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 ()
  init ()
  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 new()[source]
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, media)[source]
Parameters:
Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

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)[source]
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)[source]
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)[source]
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)[source]
Parameters:format (str) – the format
Returns:GstSdp.SDPResult.OK.
Return type:GstSdp.SDPResult

Add the format information to self.

as_text()[source]
Returns:A dynamically allocated string representing the media.
Return type:str

Convert the contents of self to a text string.

attributes_len()[source]
Returns:the number of attributes in self.
Return type:int

Get the number of attribute fields in self.

attributes_to_caps(caps)[source]
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()[source]
Returns:the number of bandwidths in self.
Return type:int

Get the number of bandwidth fields in self.

connections_len()[source]
Returns:the number of connections in self.
Return type:int

Get the number of connection fields in self.

copy()[source]
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()[source]
Returns:the number of formats in self.
Return type:int

Get the number of formats in self.

free()[source]
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)[source]
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)[source]
Parameters:key (str) – a key
Returns:the first attribute value for key.
Return type:str

Get the first attribute value for key in self.

get_attribute_val_n(key, nth)[source]
Parameters:
  • key (str) – a key
  • nth (int) – an index
Returns:

the nth attribute value.

Return type:

str

Get the nth attribute value for key in self.

get_bandwidth(idx)[source]
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)[source]
Parameters:pt (int) – a payload type
Returns:a Gst.Caps, or None if an error happened
Return type:Gst.Caps

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 attribute is set only by GstSdp.SDPMedia.attributes_to_caps().

New in version 1.8.

get_connection(idx)[source]
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)[source]
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()[source]
Returns:the information of self.
Return type:str

Get the information of self

get_key()[source]
Returns:a GstSdp.SDPKey.
Return type:GstSdp.SDPKey

Get the encryption information from self.

get_media()[source]
Returns:the media description.
Return type:str

Get the media description of self.

get_num_ports()[source]
Returns:the number of ports for self.
Return type:int

Get the number of ports for self.

get_port()[source]
Returns:the port number of self.
Return type:int

Get the port number for self.

get_proto()[source]
Returns:the transport protocol of self.
Return type:str

Get the transport protocol of self

init()[source]
Returns:a GstSdp.SDPResult.
Return type:GstSdp.SDPResult

Initialize self 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.

insert_attribute(idx, attr)[source]
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)[source]
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)[source]
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)[source]
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()[source]
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)[source]
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)[source]
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)[source]
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)[source]
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)[source]
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)[source]
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)[source]
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)[source]
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)[source]
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)[source]
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)[source]
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)[source]
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)[source]
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()[source]
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().