Gst_bit_writer _ free_and_get_data()

Yesterday we got a new issue related to gstreamer Nim bindings.

We added the gstreamer main module Gst-1.0.gir some years ago due to a user request and provided a minimal example, but that user fast dissappeared.

From this new issue

it seems that user needs GstBase-1.0.gir and GstApp-1.0.gir at least.

But for GstBase-1.0.gir our generator script produces some errors. First is related to


From /usr/share/gir-1.0/GstBase-1.0.gir we have

      <method name="free_and_get_data"
        <doc xml:space="preserve"
             line="261">Frees @bitwriter without destroying the internal data, which is

Free-function: g_free</doc>
        <source-position filename="gstbitwriter.h" line="74"/>
        <return-value transfer-ownership="full">
          <doc xml:space="preserve"
               line="270">the current data. g_free() after
          <array zero-terminated="0" c:type="guint8*">
            <type name="guint8" c:type="guint8"/>
          <instance-parameter name="bitwriter" transfer-ownership="full">
            <doc xml:space="preserve"
                 line="263">#GstBitWriter instance</doc>
            <type name="BitWriter" c:type="GstBitWriter*"/>

which confuses our bindings generators.

My current feeling is that is wrong, as there is no length parameter provided. Should it be zero-terminated=“1” instead?

Unfortunately I do know nearly nothing about gstreamer.

This is for gstreamer-1.16.2 provided by Gentoo-Linux.

No, it’s not zero-terminated. You would get the length from gst_bit_writer_get_size() before calling gst_bit_writer_free_and_get_data().

As such there are currently no annotations to cover this and allow autogeneration. You would have to manually bind this, or ignore it. I assume in Nim there are various native implementations of bit/byte writers/readers already that would be better suited.

1 Like