Multifilesink messages and unclear doc

pisymbol . pisymbol at gmail.com
Fri Jun 14 20:16:25 UTC 2019


On Fri, Jun 14, 2019 at 4:00 PM pisymbol . <pisymbol at gmail.com> wrote:

> The doc states the following:
>
> "If the post-messages
> <https://gstreamer.freedesktop.org/documentation/multifile/multifilesink.html#multifilesink:post-messages>
> property is TRUE
> <https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS>,
> it sends an application message named GstMultiFileSink after writing each
> buffer.
>
> The message's structure contains these fields:
>
>    - int <https://docs.python.org/3/library/functions.html#int> *filename:
>    the filename where the buffer was written.
>    - int <https://docs.python.org/3/library/functions.html#int> index:
>    index of the buffer.
>    - int <https://docs.python.org/3/library/functions.html#int> timestamp:
>    the timestamp of the buffer.
>    - int <https://docs.python.org/3/library/functions.html#int>
>    stream-time: the stream time of the buffer.
>    - int <https://docs.python.org/3/library/functions.html#int>
>    running-time`: the running_time of the buffer.
>    - int <https://docs.python.org/3/library/functions.html#int> duration:
>    the duration of the buffer.
>    - int <https://docs.python.org/3/library/functions.html#int> offset:
>    the offset of the buffer that triggered the message.
>    - int <https://docs.python.org/3/library/functions.html#int> offset-end:
>    the offset-end of the buffer that triggered the message"
>
> Source:
> https://gstreamer.freedesktop.org/documentation/multifile/multifilesink.html?gi-language=python#properties
>
> But when my pipeline runs, the message I see on the bus is
> Gst.MessageType.ELEMENT with the message.src set to a GstMultiFileSink.
>
> Where can I get the application specific data? I need a callback after
> every capture file is written via multifilesink.
>
>
So the doc is flat out wrong. But after digging into source this worked for
you Googlers:

Register a message handler on your bus:

     bus = pipeline.get_bus()
     bus.add_watch(GLib.PRIORITY_DEFAULT, on_message)

Then in on_message do:

  def on_message(bus, message):
        if message.type == Gst.MessageType.ELEMENT:
            if message.src.name.startswith("multifilesink"):
                msg_struct = message.get_structure()
                print(msg_struct.get_string('filename')) # Prints out the
current capture file

Need MOAR doc! :-)

-aps
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20190614/7fd20036/attachment-0001.html>


More information about the gstreamer-devel mailing list