Commit acd0fc78 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

Add Buffer bindings from gst-plugin-rs

parent 28f66550
......@@ -52,6 +52,7 @@ generate = [
"Gst.PadProbeType",
"Gst.PadProbeReturn",
"Gst.CapsIntersectMode",
"Gst.BufferFlags",
]
manual = [
......
......@@ -8,6 +8,65 @@ use glib::value::{Value, SetValue, FromValue, FromValueOptional};
use gobject_ffi;
use glib::translate::*;
bitflags! {
pub struct BufferFlags: u32 {
const BUFFER_FLAG_LIVE = 16;
const BUFFER_FLAG_DECODE_ONLY = 32;
const BUFFER_FLAG_DISCONT = 64;
const BUFFER_FLAG_RESYNC = 128;
const BUFFER_FLAG_CORRUPTED = 256;
const BUFFER_FLAG_MARKER = 512;
const BUFFER_FLAG_HEADER = 1024;
const BUFFER_FLAG_GAP = 2048;
const BUFFER_FLAG_DROPPABLE = 4096;
const BUFFER_FLAG_DELTA_UNIT = 8192;
const BUFFER_FLAG_TAG_MEMORY = 16384;
const BUFFER_FLAG_SYNC_AFTER = 32768;
const BUFFER_FLAG_LAST = 1048576;
}
}
#[doc(hidden)]
impl ToGlib for BufferFlags {
type GlibType = ffi::GstBufferFlags;
fn to_glib(&self) -> ffi::GstBufferFlags {
ffi::GstBufferFlags::from_bits_truncate(self.bits())
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstBufferFlags> for BufferFlags {
fn from_glib(value: ffi::GstBufferFlags) -> BufferFlags {
skip_assert_initialized!();
BufferFlags::from_bits_truncate(value.bits())
}
}
impl StaticType for BufferFlags {
fn static_type() -> Type {
unsafe { from_glib(ffi::gst_buffer_flags_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for BufferFlags {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for BufferFlags {
unsafe fn from_value(value: &Value) -> Self {
from_glib(ffi::GstBufferFlags::from_bits_truncate(gobject_ffi::g_value_get_flags(value.to_glib_none().0)))
}
}
impl SetValue for BufferFlags {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib().bits())
}
}
bitflags! {
pub struct PadProbeType: u32 {
const PAD_PROBE_TYPE_INVALID = 0;
......
......@@ -100,6 +100,20 @@ pub use self::enums::URIError;
pub use self::enums::URIType;
mod flags;
pub use self::flags::BufferFlags;
pub use self::flags::BUFFER_FLAG_LIVE;
pub use self::flags::BUFFER_FLAG_DECODE_ONLY;
pub use self::flags::BUFFER_FLAG_DISCONT;
pub use self::flags::BUFFER_FLAG_RESYNC;
pub use self::flags::BUFFER_FLAG_CORRUPTED;
pub use self::flags::BUFFER_FLAG_MARKER;
pub use self::flags::BUFFER_FLAG_HEADER;
pub use self::flags::BUFFER_FLAG_GAP;
pub use self::flags::BUFFER_FLAG_DROPPABLE;
pub use self::flags::BUFFER_FLAG_DELTA_UNIT;
pub use self::flags::BUFFER_FLAG_TAG_MEMORY;
pub use self::flags::BUFFER_FLAG_SYNC_AFTER;
pub use self::flags::BUFFER_FLAG_LAST;
pub use self::flags::PadProbeType;
pub use self::flags::PAD_PROBE_TYPE_INVALID;
pub use self::flags::PAD_PROBE_TYPE_IDLE;
......
This diff is collapsed.
......@@ -56,6 +56,8 @@ pub mod caps;
pub use caps::{Caps, CapsRef};
pub mod tags;
pub use tags::*;
pub mod buffer;
pub use buffer::{Buffer, BufferRef, ReadBufferMap, ReadWriteBufferMap, ReadMappedBuffer, ReadWriteMappedBuffer};
mod element;
mod bin;
......
......@@ -145,8 +145,8 @@ impl<T: MiniObject> Drop for GstRc<T> {
}
}
unsafe impl<T: MiniObject + Sync> Sync for GstRc<T> {}
unsafe impl<T: MiniObject + Send> Send for GstRc<T> {}
unsafe impl<T: MiniObject + Sync + Send> Sync for GstRc<T> {}
unsafe impl<T: MiniObject + Sync + Send> Send for GstRc<T> {}
impl<T: MiniObject + fmt::Display> fmt::Display for GstRc<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment