TagList

class TagList(*args, **kwargs)

List of tags and values used to describe media metadata.

Strings in structures must be ASCII or UTF-8 encoded. Other encodings are not allowed. Strings must not be empty or None.

Constructors

class TagList
classmethod new_empty() TagList

Creates a new empty GstTagList.

Free-function: gst_tag_list_unref

classmethod new_from_string(str: str) TagList | None

Deserializes a tag list.

Parameters:

str – a string created with to_string()

Methods

class TagList
add_value(mode: TagMergeMode, tag: str, value: Any) None

Sets the GValue for a given tag using the specified mode.

Parameters:
  • mode – the mode to use

  • tag – tag

  • value – GValue for this tag

foreach(func: Callable[[...], None], *user_data: Any) None

Calls the given function for each tag inside the tag list. Note that if there is no tag, the function won’t be called at all.

Parameters:
  • func – function to be called for each tag

  • user_data – user specified data

get_boolean(tag: str) tuple[bool, bool]

Copies the contents for the given tag into the value, merging multiple values into one if multiple values are associated with the tag.

Parameters:

tag – tag to read out

get_boolean_index(tag: str, index: int) tuple[bool, bool]

Gets the value that is at the given index for the given tag in the given list.

Parameters:
  • tag – tag to read out

  • index – number of entry to read out

get_date(tag: str) tuple[bool, Date]

Copies the first date for the given tag in the taglist into the variable pointed to by value. Free the date with free() when it is no longer needed.

Free-function: g_date_free

Parameters:

tag – tag to read out

get_date_index(tag: str, index: int) tuple[bool, Date]

Gets the date that is at the given index for the given tag in the given list and copies it into the variable pointed to by value. Free the date with free() when it is no longer needed.

Free-function: g_date_free

Parameters:
  • tag – tag to read out

  • index – number of entry to read out

get_date_time(tag: str) tuple[bool, DateTime]

Copies the first datetime for the given tag in the taglist into the variable pointed to by value. Unref the date with unref() when it is no longer needed.

Free-function: gst_date_time_unref

Parameters:

tag – tag to read out

get_date_time_index(tag: str, index: int) tuple[bool, DateTime]

Gets the datetime that is at the given index for the given tag in the given list and copies it into the variable pointed to by value. Unref the datetime with unref() when it is no longer needed.

Free-function: gst_date_time_unref

Parameters:
  • tag – tag to read out

  • index – number of entry to read out

get_double(tag: str) tuple[bool, float]

Copies the contents for the given tag into the value, merging multiple values into one if multiple values are associated with the tag.

Parameters:

tag – tag to read out

get_double_index(tag: str, index: int) tuple[bool, float]

Gets the value that is at the given index for the given tag in the given list.

Parameters:
  • tag – tag to read out

  • index – number of entry to read out

get_float(tag: str) tuple[bool, float]

Copies the contents for the given tag into the value, merging multiple values into one if multiple values are associated with the tag.

Parameters:

tag – tag to read out

get_float_index(tag: str, index: int) tuple[bool, float]

Gets the value that is at the given index for the given tag in the given list.

Parameters:
  • tag – tag to read out

  • index – number of entry to read out

get_int(tag: str) tuple[bool, int]

Copies the contents for the given tag into the value, merging multiple values into one if multiple values are associated with the tag.

Parameters:

tag – tag to read out

get_int64(tag: str) tuple[bool, int]

Copies the contents for the given tag into the value, merging multiple values into one if multiple values are associated with the tag.

Parameters:

tag – tag to read out

get_int64_index(tag: str, index: int) tuple[bool, int]

Gets the value that is at the given index for the given tag in the given list.

Parameters:
  • tag – tag to read out

  • index – number of entry to read out

get_int_index(tag: str, index: int) tuple[bool, int]

Gets the value that is at the given index for the given tag in the given list.

Parameters:
  • tag – tag to read out

  • index – number of entry to read out

get_pointer(tag: str) tuple[bool, None]

Copies the contents for the given tag into the value, merging multiple values into one if multiple values are associated with the tag.

Parameters:

tag – tag to read out

get_pointer_index(tag: str, index: int) tuple[bool, None]

Gets the value that is at the given index for the given tag in the given list.

Parameters:
  • tag – tag to read out

  • index – number of entry to read out

get_sample(tag: str) tuple[bool, Sample]

Copies the first sample for the given tag in the taglist into the variable pointed to by sample. Free the sample with gst_sample_unref() when it is no longer needed. You can retrieve the buffer from the sample using get_buffer() and the associated caps (if any) with get_caps().

Free-function: gst_sample_unref

Parameters:

tag – tag to read out

get_sample_index(tag: str, index: int) tuple[bool, Sample]

Gets the sample that is at the given index for the given tag in the given list and copies it into the variable pointed to by sample. Free the sample with gst_sample_unref() when it is no longer needed. You can retrieve the buffer from the sample using get_buffer() and the associated caps (if any) with get_caps().

Free-function: gst_sample_unref

Parameters:
  • tag – tag to read out

  • index – number of entry to read out

get_scope() TagScope

Gets the scope of list.

get_string(tag: str) tuple[bool, str]

Copies the contents for the given tag into the value, possibly merging multiple values into one if multiple values are associated with the tag.

Use gst_tag_list_get_string_index (list, tag, 0, value) if you want to retrieve the first string associated with this tag unmodified.

The resulting string in value will be in UTF-8 encoding and should be freed by the caller using g_free when no longer needed. The returned string is also guaranteed to be non-None and non-empty.

Free-function: g_free

Parameters:

tag – tag to read out

get_string_index(tag: str, index: int) tuple[bool, str]

Gets the value that is at the given index for the given tag in the given list.

The resulting string in value will be in UTF-8 encoding and should be freed by the caller using g_free when no longer needed. The returned string is also guaranteed to be non-None and non-empty.

Free-function: g_free

Parameters:
  • tag – tag to read out

  • index – number of entry to read out

get_tag_size(tag: str) int

Checks how many value are stored in this tag list for the given tag.

Parameters:

tag – the tag to query

get_uint(tag: str) tuple[bool, int]

Copies the contents for the given tag into the value, merging multiple values into one if multiple values are associated with the tag.

Parameters:

tag – tag to read out

get_uint64(tag: str) tuple[bool, int]

Copies the contents for the given tag into the value, merging multiple values into one if multiple values are associated with the tag.

Parameters:

tag – tag to read out

get_uint64_index(tag: str, index: int) tuple[bool, int]

Gets the value that is at the given index for the given tag in the given list.

Parameters:
  • tag – tag to read out

  • index – number of entry to read out

get_uint_index(tag: str, index: int) tuple[bool, int]

Gets the value that is at the given index for the given tag in the given list.

Parameters:
  • tag – tag to read out

  • index – number of entry to read out

get_value_index(tag: str, index: int) Any | None

Gets the value that is at the given index for the given tag in the given list.

Parameters:
  • tag – tag to read out

  • index – number of entry to read out

insert(from_: TagList, mode: TagMergeMode) None

Inserts the tags of the from list into the first list using the given mode.

Parameters:
  • from

  • mode – the mode to use

is_empty() bool

Checks if the given taglist is empty.

is_equal(list2: TagList) bool

Checks if the two given taglists are equal.

Parameters:

list2 – a TagList.

merge(list2: TagList | None, mode: TagMergeMode) TagList | None

Merges the two given lists into a new list. If one of the lists is None, a copy of the other is returned. If both lists are None, None is returned.

Free-function: gst_tag_list_unref

Parameters:
  • list2 – second list to merge

  • mode – the mode to use

n_tags() int

Get the number of tags in list.

nth_tag_name(index: int) str

Get the name of the tag in list at index.

Parameters:

index – the index

peek_string_index(tag: str, index: int) tuple[bool, str]

Peeks at the value that is at the given index for the given tag in the given list.

The resulting string in value will be in UTF-8 encoding and doesn’t need to be freed by the caller. The returned string is also guaranteed to be non-None and non-empty.

Parameters:
  • tag – tag to read out

  • index – number of entry to read out

remove_tag(tag: str) None

Removes the given tag from the taglist.

Parameters:

tag – tag to remove

set_scope(scope: TagScope) None

Sets the scope of list to scope. By default the scope of a taglist is stream scope.

Parameters:

scope – new scope for list

to_string() str

Serializes a tag list to a string.

Fields

class TagList
mini_object

The parent type