GstSdp.SDPMessage

Fields

Name

Type

Access

Description

attributes

[object]

r/w

array of GstSdp.SDPAttribute with session attributes

bandwidths

[object]

r/w

array of GstSdp.SDPBandwidth with bandwidth information

connection

GstSdp.SDPConnection

r/w

connection information for the session

emails

[object]

r/w

array of str with email addresses

information

str

r/w

session information

key

GstSdp.SDPKey

r/w

encryption key

medias

[object]

r/w

array of GstSdp.SDPMedia with media descriptions

origin

GstSdp.SDPOrigin

r/w

owner/creator and session identifier

phones

[object]

r/w

array of str with phone numbers

session_name

str

r/w

session name

times

[object]

r/w

array of GstSdp.SDPTime with time descriptions

uri

str

r/w

URI of description

version

str

r/w

the protocol version

zones

[object]

r/w

array of GstSdp.SDPZone with time zone adjustments

Methods

class

as_uri (scheme, msg)

class

init ()

class

new ()

class

new_from_text (text)

class

parse_buffer (data, msg)

class

parse_uri (uri, msg)

add_attribute (key, value)

add_bandwidth (bwtype, bandwidth)

add_email (email)

add_media (media)

add_phone (phone)

add_time (start, stop, repeat)

add_zone (adj_time, typed_time)

as_text ()

attributes_len ()

attributes_to_caps (caps)

bandwidths_len ()

copy ()

dump ()

emails_len ()

free ()

get_attribute (idx)

get_attribute_val (key)

get_attribute_val_n (key, nth)

get_bandwidth (idx)

get_connection ()

get_email (idx)

get_information ()

get_key ()

get_media (idx)

get_origin ()

get_phone (idx)

get_session_name ()

get_time (idx)

get_uri ()

get_version ()

get_zone (idx)

insert_attribute (idx, attr)

insert_bandwidth (idx, bw)

insert_email (idx, email)

insert_phone (idx, phone)

insert_time (idx, t)

insert_zone (idx, zone)

medias_len ()

parse_keymgmt ()

phones_len ()

remove_attribute (idx)

remove_bandwidth (idx)

remove_email (idx)

remove_media (idx)

remove_phone (idx)

remove_time (idx)

remove_zone (idx)

replace_attribute (idx, attr)

replace_bandwidth (idx, bw)

replace_email (idx, email)

replace_phone (idx, phone)

replace_time (idx, t)

replace_zone (idx, zone)

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

set_information (information)

set_key (type, data)

set_origin (username, sess_id, sess_version, nettype, addrtype, addr)

set_session_name (session_name)

set_uri (uri)

set_version (version)

times_len ()

uninit ()

zones_len ()

Details

class GstSdp.SDPMessage

The GstSdp.SDPMessage helper functions makes it easy to parse and create SDP messages.

classmethod as_uri(scheme, msg)[source]
Parameters:
Returns:

a uri for msg.

Return type:

str

Creates a uri from msg with the given scheme. The uri has the format:

\`scheme`:///[#type=value *[&type=value]]

Where each value is url encoded.

classmethod init()[source]
Returns:

a GstSdp.SDPResult.

msg:

a GstSdp.SDPMessage

Return type:

(GstSdp.SDPResult, msg: GstSdp.SDPMessage)

Initialize msg so that its contents are as if it was freshly allocated with GstSdp.SDPMessage.new(). This function is mostly used to initialize a message allocated on the stack. GstSdp.SDPMessage.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()[source]
Returns:

a GstSdp.SDPResult.

msg:

pointer to new GstSdp.SDPMessage

Return type:

(GstSdp.SDPResult, msg: GstSdp.SDPMessage)

Allocate a new GstSdp.SDPMessage and store the result in msg.

classmethod new_from_text(text)[source]
Parameters:

text (str) – A dynamically allocated string representing the SDP description

Returns:

a GstSdp.SDPResult.

msg:

pointer to new GstSdp.SDPMessage

Return type:

(GstSdp.SDPResult, msg: GstSdp.SDPMessage)

Parse text and create a new SDPMessage from these.

New in version 1.16.

classmethod parse_buffer(data, msg)[source]
Parameters:
Returns:

GstSdp.SDPResult.OK on success.

Return type:

GstSdp.SDPResult

Parse the contents of size bytes pointed to by data and store the result in msg.

classmethod parse_uri(uri, msg)[source]
Parameters:
Returns:

GstSdp.SDPResult.OK on success.

Return type:

GstSdp.SDPResult

Parse the null-terminated uri and store the result in msg.

The uri should be of the form:

scheme://[address’:ttl=ttl [:noa=noa]’]/’sessionname [#type=value *[&type=value]’]

where value is url encoded. This looslely resembles http://tools.ietf.org/html/draft-fujikawa-sdp-url-01

add_attribute(key, value)[source]
Parameters:
  • key (str) – the key

  • value (str or None) – the 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:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Add the specified bandwidth information to self.

add_email(email)[source]
Parameters:

email (str) – an email

Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Add email to the list of emails in self.

add_media(media)[source]
Parameters:

media (GstSdp.SDPMedia) – a GstSdp.SDPMedia to add

Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Adds media to the array of medias in self. This function takes ownership of the contents of media so that media will have to be reinitialized with GstSdp.SDPMedia.init() before it can be used again.

add_phone(phone)[source]
Parameters:

phone (str) – a phone

Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Add phone to the list of phones in self.

add_time(start, stop, repeat)[source]
Parameters:
  • start (str) – the start time

  • stop (str) – the stop time

  • repeat ([str]) – the repeat times

Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Add time information start and stop to self.

add_zone(adj_time, typed_time)[source]
Parameters:
  • adj_time (str) – the NTP time that a time zone adjustment happens

  • typed_time (str) – the offset from the time when the session was first scheduled

Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Add time zone information to self.

as_text()[source]
Returns:

A dynamically allocated string representing the SDP description.

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 attributes 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.SDPMessage to Gst.Caps

New in version 1.8.

bandwidths_len()[source]
Returns:

the number of bandwidth information in self.

Return type:

int

Get the number of bandwidth information in self.

copy()[source]
Returns:

a GstSdp.SDPResult

copy:

pointer to new GstSdp.SDPMessage

Return type:

(GstSdp.SDPResult, copy: GstSdp.SDPMessage)

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

New in version 1.2.

dump()[source]
Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Dump the parsed contents of self to stdout.

emails_len()[source]
Returns:

the number of emails in self.

Return type:

int

Get the number of emails 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.SDPMessage.new().

get_attribute(idx)[source]
Parameters:

idx (int) – the 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) – the key

Returns:

the attribute value of the first attribute with key.

Return type:

str or None

Get the first attribute with key key in self.

get_attribute_val_n(key, nth)[source]
Parameters:
  • key (str) – the key

  • nth (int) – the index

Returns:

the attribute value of the nth attribute with key.

Return type:

str or None

Get the nth attribute with key key in self.

get_bandwidth(idx)[source]
Parameters:

idx (int) – the bandwidth index

Returns:

a GstSdp.SDPBandwidth.

Return type:

GstSdp.SDPBandwidth

Get the bandwidth at index idx from self.

get_connection()[source]
Returns:

a GstSdp.SDPConnection. The result remains valid as long as self is valid.

Return type:

GstSdp.SDPConnection

Get the connection of self.

get_email(idx)[source]
Parameters:

idx (int) – an email index

Returns:

the email at position idx.

Return type:

str

Get the email with number idx from self.

get_information()[source]
Returns:

a GstSdp.SDPResult.

Return type:

str

Get the information in self.

get_key()[source]
Returns:

a GstSdp.SDPKey.

Return type:

GstSdp.SDPKey

Get the encryption information from self.

get_media(idx)[source]
Parameters:

idx (int) – the index

Returns:

a GstSdp.SDPMedia.

Return type:

GstSdp.SDPMedia

Get the media description at index idx in self.

get_origin()[source]
Returns:

a GstSdp.SDPOrigin. The result remains valid as long as self is valid.

Return type:

GstSdp.SDPOrigin

Get the origin of self.

get_phone(idx)[source]
Parameters:

idx (int) – a phone index

Returns:

the phone at position idx.

Return type:

str

Get the phone with number idx from self.

get_session_name()[source]
Returns:

a GstSdp.SDPResult.

Return type:

str

Get the session name in self.

get_time(idx)[source]
Parameters:

idx (int) – the time index

Returns:

a GstSdp.SDPTime.

Return type:

GstSdp.SDPTime

Get time information with index idx from self.

get_uri()[source]
Returns:

a GstSdp.SDPResult.

Return type:

str

Get the URI in self.

get_version()[source]
Returns:

a GstSdp.SDPResult.

Return type:

str

Get the version in self.

get_zone(idx)[source]
Parameters:

idx (int) – the zone index

Returns:

a GstSdp.SDPZone.

Return type:

GstSdp.SDPZone

Get time zone information with index idx from self.

insert_attribute(idx, attr)[source]
Parameters:
Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Insert attribute into the array of attributes in self at index idx. When -1 is given as idx, the attribute is inserted at the end.

New in version 1.2.

insert_bandwidth(idx, bw)[source]
Parameters:
Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Insert bandwidth parameters into the array of bandwidths in self at index idx. When -1 is given as idx, the bandwidth is inserted at the end.

New in version 1.2.

insert_email(idx, email)[source]
Parameters:
  • idx (int) – an index

  • email (str) – an email

Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Insert email into the array of emails in self at index idx. When -1 is given as idx, the email is inserted at the end.

New in version 1.2.

insert_phone(idx, phone)[source]
Parameters:
  • idx (int) – a phone index

  • phone (str) – a phone

Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Insert phone into the array of phone numbers in self at index idx. When -1 is given as idx, the phone is inserted at the end.

New in version 1.2.

insert_time(idx, t)[source]
Parameters:
Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Insert time parameters into the array of times in self at index idx. When -1 is given as idx, the times are inserted at the end.

New in version 1.2.

insert_zone(idx, zone)[source]
Parameters:
Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Insert zone parameters into the array of zones in self at index idx. When -1 is given as idx, the zone is inserted at the end.

New in version 1.2.

medias_len()[source]
Returns:

the number of media descriptions in self.

Return type:

int

Get the number of media descriptions in self.

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.SDPMessage.

New in version 1.8.1.

phones_len()[source]
Returns:

the number of phones in self.

Return type:

int

Get the number of phones in self.

remove_attribute(idx)[source]
Parameters:

idx (int) – the index

Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Remove the attribute in self at index idx.

New in version 1.2.

remove_bandwidth(idx)[source]
Parameters:

idx (int) – the bandwidth index

Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Remove the bandwidth information in self at index idx.

New in version 1.2.

remove_email(idx)[source]
Parameters:

idx (int) – an email index

Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Remove the email in self at index idx.

New in version 1.2.

remove_media(idx)[source]
Parameters:

idx (int) – the media index

Returns:

GstSdp.SDPResult.OK when the specified media is found at idx and removed, GstSdp.SDPResult.EINVAL otherwise.

Return type:

GstSdp.SDPResult

Remove the media at idx from the array of medias in self if found.

New in version 1.24.

remove_phone(idx)[source]
Parameters:

idx (int) – a phone index

Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Remove the phone number in self at index idx.

New in version 1.2.

remove_time(idx)[source]
Parameters:

idx (int) – the index

Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Remove the time information in self at index idx.

New in version 1.2.

remove_zone(idx)[source]
Parameters:

idx (int) – the index

Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Remove the zone information in self at index idx.

New in version 1.2.

replace_attribute(idx, attr)[source]
Parameters:
Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Replace the attribute in self at index idx with attr.

New in version 1.2.

replace_bandwidth(idx, bw)[source]
Parameters:
Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Replace the bandwidth information in self at index idx with bw.

New in version 1.2.

replace_email(idx, email)[source]
Parameters:
  • idx (int) – an email index

  • email (str) – an email

Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Replace the email in self at index idx with email.

New in version 1.2.

replace_phone(idx, phone)[source]
Parameters:
  • idx (int) – a phone index

  • phone (str) – a phone

Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Replace the phone number in self at index idx with phone.

New in version 1.2.

replace_time(idx, t)[source]
Parameters:
Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Replace the time information in self at index idx with t.

New in version 1.2.

replace_zone(idx, zone)[source]
Parameters:
Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Replace the zone information in self at index idx with zone.

New in version 1.2.

set_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

Configure the SDP connection in self with the given parameters.

set_information(information)[source]
Parameters:

information (str) – the information

Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Set the information in self.

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_origin(username, sess_id, sess_version, nettype, addrtype, addr)[source]
Parameters:
  • username (str) – the user name

  • sess_id (str) – a session id

  • sess_version (str) – a session version

  • nettype (str) – a network type

  • addrtype (str) – an address type

  • addr (str) – an address

Returns:

GstSdp.SDPResult.OK.

Return type:

GstSdp.SDPResult

Configure the SDP origin in self with the given parameters.

set_session_name(session_name)[source]
Parameters:

session_name (str) – the session name

Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Set the session name in self.

set_uri(uri)[source]
Parameters:

uri (str) – the URI

Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Set the URI in self.

set_version(version)[source]
Parameters:

version (str) – the version

Returns:

a GstSdp.SDPResult.

Return type:

GstSdp.SDPResult

Set the version in self.

times_len()[source]
Returns:

the number of time information entries in self.

Return type:

int

Get the number of time information entries in self.

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.SDPMessage.init().

zones_len()[source]
Returns:

the number of time zone information entries in self.

Return type:

int

Get the number of time zone information entries in self.