IdStr#

Added in version 1.26.

class IdStr(**kwargs)#

A IdStr is string type optimized for short strings and used for structure names, structure field names and in other places.

Strings up to 16 bytes (including NUL terminator) are stored inline, other strings are stored on the heap.

GstIdStr s = GST_ID_STR_INIT;

gst_id_str_set (&s, "Hello, World!");
g_print ("%s\n", gst_id_str_as_str (&s));

gst_id_str_clear (&s);

Constructors#

class IdStr
classmethod new() IdStr#

Returns a newly heap allocated empty string.

Added in version 1.26.

Methods#

class IdStr
as_str() str#

Added in version 1.26.

clear() None#

Clears s and sets it to the empty string.

Added in version 1.26.

free() None#

Frees s. This should only be called for heap-allocated IdStr.

Added in version 1.26.

get_len() int#

Returns the length of s, exluding the NUL-terminator. This is equivalent to calling strcmp() but potentially faster.

Added in version 1.26.

init() None#

Initializes a (usually stack-allocated) id string s. The newly-initialized id string will contain an empty string by default as value.

Added in version 1.26.

is_equal(s2: IdStr) bool#

Compares s1 and s2 for equality.

Added in version 1.26.

Parameters:

s2 – A %GstIdStr

is_equal_to_str(s2: str) bool#

Compares s1 and s2 for equality.

Added in version 1.26.

Parameters:

s2 – A string

is_equal_to_str_with_len(s2: str, len: int) bool#

Compares s1 and s2 with length len for equality. s2 does not have to be NUL-terminated and len should not include the NUL-terminator.

This is generally faster than is_equal_to_str() if the length is already known.

Added in version 1.26.

Parameters:
  • s2 – A string

  • len – Length of s2.

move(s: IdStr) None#

Moves s into d and resets s.

Added in version 1.26.

Parameters:

s – The source %GstIdStr

set(value: str) None#

Sets s to the string value.

Added in version 1.26.

Parameters:

value – A NUL-terminated string

set_static_str(value: str) None#

Sets s to the string value. value needs to be valid for the remaining lifetime of the process, e.g. has to be a static string.

Added in version 1.26.

Parameters:

value – A NUL-terminated string

set_static_str_with_len(value: str, len: int) None#

Sets s to the string value of length len. value needs to be valid for the remaining lifetime of the process, e.g. has to be a static string.

value must be NUL-terminated and len should not include the NUL-terminator.

Added in version 1.26.

Parameters:
  • value – A string

  • len – Length of the string

set_with_len(value: str, len: int) None#

Sets s to the string value of length len. value does not have to be NUL-terminated and len should not include the NUL-terminator.

Added in version 1.26.

Parameters:
  • value – A string

  • len – Length of the string

Fields#

class IdStr
padding#
pointer#