g GObject.GInterface GObject.GInterface Gst.TagSetter Gst.TagSetter GObject.GInterface->Gst.TagSetter



  add_tag_value (mode, tag, value)
  get_tag_list ()
  get_tag_merge_mode ()
  merge_tags (list, mode)
  reset_tags ()
  set_tag_merge_mode (mode)

Virtual Methods








Class Details

class Gst.TagSetter

Element interface that allows setting of media metadata.

Elements that support changing a stream’s metadata will implement this interface. Examples of such elements are ‘vorbisenc’, ‘theoraenc’ and ‘id3v2mux’.

If you just want to retrieve metadata in your application then all you need to do is watch for tag messages on your pipeline’s bus. This interface is only for setting metadata, not for extracting it. To set tags from the application, find tagsetter elements and set tags using e.g. Gst.TagSetter.merge_tags() or gst_tag_setter_add_tags(). Also consider setting the Gst.TagMergeMode that is used for tag events that arrive at the tagsetter element (default mode is to keep existing tags). The application should do that before the element goes to Gst.State.PAUSED.

Elements implementing the Gst.TagSetter interface often have to merge any tags received from upstream and the tags set by the application via the interface. This can be done like this:

GstTagMergeMode merge_mode;
const GstTagList *application_tags;
const GstTagList *event_tags;
GstTagSetter *tagsetter;
GstTagList *result;

tagsetter = GST_TAG_SETTER (element);

merge_mode = gst_tag_setter_get_tag_merge_mode (tagsetter);
application_tags = gst_tag_setter_get_tag_list (tagsetter);
event_tags = (const GstTagList *) element->event_tags;

GST_LOG_OBJECT (tagsetter, "merging tags, merge mode = %d", merge_mode);
GST_LOG_OBJECT (tagsetter, "event tags: %" GST_PTR_FORMAT, event_tags);
GST_LOG_OBJECT (tagsetter, "set   tags: %" GST_PTR_FORMAT, application_tags);

result = gst_tag_list_merge (application_tags, event_tags, merge_mode);

GST_LOG_OBJECT (tagsetter, "final tags: %" GST_PTR_FORMAT, result);
add_tag_value(mode, tag, value)[source]

Adds the given tag / GObject.Value pair on the setter using the given merge mode.

Returns:a current snapshot of the taglist used in the setter or None if none is used.
Return type:Gst.TagList or None

Returns the current list of tags the setter uses. The list should not be modified or freed.

This function is not thread-safe.

Returns:the merge mode used inside the element.
Return type:Gst.TagMergeMode

Queries the mode by which tags inside the setter are overwritten by tags from events

merge_tags(list, mode)[source]

Merges the given list into the setter’s list using the given mode.


Reset the internal taglist. Elements should call this from within the state-change handler.

Parameters:mode (Gst.TagMergeMode) – The mode with which tags are added

Sets the given merge mode that is used for adding tags from events to tags specified by this interface. The default is Gst.TagMergeMode.KEEP, which keeps the tags set with this interface and discards tags from events.