[gst-devel] TagSetter in Python Bindings

Mark Nauwelaerts manauw at skynet.be
Sat Sep 22 10:10:05 CEST 2007


Wolfgang Silbermayr wrote:
> Wolfgang Silbermayr wrote:
>>> Hi List!
>>>
>>> I am trying to get a small python project done where it is important to set tags in ogg files. In the #gstreamer channel I got the hint that the oggmux element implements TagSetter, but I just can't figure out how to access this interface in the python gst bindings. Maybe somebody can point me there.
> 
> Okay, so I answer to myself if nobody can help me on. It seems that the
> TagSetter interface is not implemented in the python bindings. If this
> is the case, is there anything that I can do in order to get them in?

TagSetter is implemented in python bindings; I used it for example in GEntrans
(http://gentrans.sourceforge.net/).  Look at tools/entrans.py in download or svn
and search for TagSetter.  That should get you the following fragment (which is
not complete and/or may not be the best example), which should give you an idea
(and get going):

      tagsetter = self.pipeline.get_by_interface(gst.TagSetter)
      taglist = gst.TagList()
      for k, v in self.config.tag.iteritems():
        taglist[k] = v
      if tagsetter:
        tagsetter.merge_tags(taglist, gst.TAG_MERGE_PREPEND)

An exploratory python interactive session as follows may also be illustrative:
>>> import gst
>>> avimux = gst.element_factory_make ('avimux')
>>> taglist = gst.TagList()
>>> avimux.merge_tags (taglist, gst.TAG_MERGE_APPEND)

Since avimux implements GstTagSetter interface (as does e.g. matroskamux), (e.g)
merge_tags becomes conveniently available.  However, this will not be the case
for oggmux, as it seems *not* to implement GstTagSetter, that is at least what
gst-inspect says (though it does show the GstTagSetter interfaces on the other
mentioned muxers).  It does show that vorbisenc and vorbistag implement this
interface, and that is probably the way to go, depending on whether they have to
be set during encoding or re-tagged after encoding.

Regards,
Mark.




More information about the gstreamer-devel mailing list