Make sure that the Bit/BitReader buffer is not GC'd before we stop using it
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Sat, 3 Oct 2009 07:12:01 +0000 (09:12 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Sat, 3 Oct 2009 07:12:01 +0000 (09:12 +0200)
Also add a property to get the used buffer.

gstreamer-sharp/BitReader.custom [new file with mode: 0644]
gstreamer-sharp/ByteReader.custom
gstreamer-sharp/Gstreamer.metadata
gstreamer-sharp/Makefile.am

diff --git a/gstreamer-sharp/BitReader.custom b/gstreamer-sharp/BitReader.custom
new file mode 100644 (file)
index 0000000..f62ef4e
--- /dev/null
@@ -0,0 +1,15 @@
+Gst.Buffer buffer = null;
+public Gst.Buffer Buffer {
+  get {
+    return buffer;
+  }
+}
+
+[DllImport ("libgstbase-0.10.dll", CallingConvention = CallingConvention.Cdecl) ]
+static extern IntPtr gst_bit_reader_new_from_buffer (IntPtr buffer);
+
+public BitReader (Gst.Buffer buffer) {
+  Raw = gst_bit_reader_new_from_buffer (buffer == null ? IntPtr.Zero : buffer.Handle);
+  this.buffer = buffer;
+}
+
index 71bce84..2033fae 100644 (file)
@@ -1,3 +1,19 @@
+Gst.Buffer buffer = null;
+public Gst.Buffer Buffer {
+  get {
+    return buffer;
+  }
+}
+
+[DllImport("libgstbase-0.10.dll", CallingConvention = CallingConvention.Cdecl)]
+static extern IntPtr gst_byte_reader_new_from_buffer(IntPtr buffer);
+
+public ByteReader (Gst.Buffer buffer)
+{
+  Raw = gst_byte_reader_new_from_buffer(buffer == null ? IntPtr.Zero : buffer.Handle);
+  this.buffer = buffer;
+}
+
 [DllImport ("libgstbase-0.10.dll", CallingConvention = CallingConvention.Cdecl) ]
 static extern bool gst_byte_reader_peek_data (IntPtr raw, uint size, out IntPtr val);
 
index 70b3e00..fba0c44 100644 (file)
   <attr path="/api/namespace/struct[@cname='GstBitReader']/method[@cname='gst_bit_reader_init']" name="hidden">1</attr>
   <attr path="/api/namespace/struct[@cname='GstBitReader']/method[@cname='gst_bit_reader_init_from_buffer']" name="hidden">1</attr>
   <attr path="/api/namespace/struct[@cname='GstBitReader']/constructor[@cname='gst_bit_reader_new']" name="hidden">1</attr>
+  <attr path="/api/namespace/struct[@cname='GstBitReader']/constructor[@cname='gst_bit_reader_new_from_buffer']" name="hidden">1</attr>
   <attr path="/api/namespace/struct[@cname='GstBitReader']/method[@cname='gst_bit_reader_get_bits_uint8']" name="name">Get</attr>
   <attr path="/api/namespace/struct[@cname='GstBitReader']/method[@cname='gst_bit_reader_get_bits_uint16']" name="name">Get</attr>
   <attr path="/api/namespace/struct[@cname='GstBitReader']/method[@cname='gst_bit_reader_get_bits_uint32']" name="name">Get</attr>
   <attr path="/api/namespace/struct[@cname='GstByteReader']/method[@cname='gst_byte_reader_init']" name="hidden">1</attr>
   <attr path="/api/namespace/struct[@cname='GstByteReader']/method[@cname='gst_byte_reader_init_from_buffer']" name="hidden">1</attr>
   <attr path="/api/namespace/struct[@cname='GstByteReader']/constructor[@cname='gst_byte_reader_new']" name="hidden">1</attr>
+  <attr path="/api/namespace/struct[@cname='GstByteReader']/constructor[@cname='gst_byte_reader_new_from_buffer']" name="hidden">1</attr>
   <attr path="/api/namespace/struct[@cname='GstByteReader']/method[@cname='gst_byte_reader_peek_uint8']" name="name">PeekUInt8</attr>
   <attr path="/api/namespace/struct[@cname='GstByteReader']/method[@cname='gst_byte_reader_peek_uint16_le']" name="name">PeekUInt16Le</attr>
   <attr path="/api/namespace/struct[@cname='GstByteReader']/method[@cname='gst_byte_reader_peek_uint16_be']" name="name">PeekUInt16Be</attr>
index d4d2786..7c5caa0 100644 (file)
@@ -115,6 +115,7 @@ customs =                   \
        Controller.custom       \
        ControlSource.custom    \
        VideoUtil.custom        \
+       BitReader.custom        \
        ByteReader.custom
 
 plugin_csfiles = $(builddir)/coreplugins/generated/*.cs \