Make sure that the Bit/BitReader buffer is not GC'd before we stop using it

Also add a property to get the used buffer.
This commit is contained in:
Sebastian Dröge 2009-10-03 09:12:01 +02:00
parent 2453ddfe11
commit 28e879b517
4 changed files with 34 additions and 0 deletions

View file

@ -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;
}

View 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);

View file

@ -1068,6 +1068,7 @@
<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>
@ -1080,6 +1081,7 @@
<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>

View file

@ -115,6 +115,7 @@ customs = \
Controller.custom \
ControlSource.custom \
VideoUtil.custom \
BitReader.custom \
ByteReader.custom
plugin_csfiles = $(builddir)/coreplugins/generated/*.cs \