2009-10-03 07:12:01 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2009-10-02 13:44:16 +00:00
|
|
|
[DllImport ("libgstbase-0.10.dll", CallingConvention = CallingConvention.Cdecl) ]
|
|
|
|
static extern bool gst_byte_reader_peek_data (IntPtr raw, uint size, out IntPtr val);
|
|
|
|
|
|
|
|
public bool PeekData (uint size, out byte[] val) {
|
|
|
|
IntPtr raw_ret;
|
|
|
|
|
|
|
|
bool ret = gst_byte_reader_peek_data (Handle, size, out raw_ret);
|
|
|
|
|
|
|
|
if (!ret || raw_ret == IntPtr.Zero) {
|
|
|
|
val = null;
|
|
|
|
} else {
|
|
|
|
val = new byte[size];
|
|
|
|
Marshal.Copy (raw_ret, val, 0, (int) size);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
[DllImport ("libgstbase-0.10.dll", CallingConvention = CallingConvention.Cdecl) ]
|
|
|
|
static extern bool gst_byte_reader_get_data (IntPtr raw, uint size, out IntPtr val);
|
|
|
|
|
|
|
|
public bool GetData (uint size, out byte[] val) {
|
|
|
|
IntPtr raw_ret;
|
|
|
|
|
|
|
|
bool ret = gst_byte_reader_get_data (Handle, size, out raw_ret);
|
|
|
|
|
|
|
|
if (!ret || raw_ret == IntPtr.Zero) {
|
|
|
|
val = null;
|
|
|
|
} else {
|
|
|
|
val = new byte[size];
|
|
|
|
Marshal.Copy (raw_ret, val, 0, (int) size);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|