mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-26 03:21:03 +00:00
Add newtype wrappers and INVALID constants for event/message GroupId and Seqnum
This commit is contained in:
parent
97b786a0c7
commit
55f044dd83
6 changed files with 189 additions and 107 deletions
10
Gir_Gst.toml
10
Gir_Gst.toml
|
@ -796,6 +796,16 @@ status = "generate"
|
|||
# wrong mutable for context parameter
|
||||
ignore = true
|
||||
|
||||
[[object.function]]
|
||||
name = "util_group_id_next"
|
||||
# newtype wrapper
|
||||
ignore = true
|
||||
|
||||
[[object.function]]
|
||||
name = "util_seqnum_next"
|
||||
# newtype wrapper
|
||||
ignore = true
|
||||
|
||||
[[object]]
|
||||
name = "Gst.StateChangeReturn"
|
||||
status = "generate"
|
||||
|
|
|
@ -158,20 +158,6 @@ pub fn util_get_timestamp() -> ClockTime {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn util_group_id_next() -> u32 {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
ffi::gst_util_group_id_next()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn util_seqnum_next() -> u32 {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
ffi::gst_util_seqnum_next()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn version() -> (u32, u32, u32, u32) {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
|
|
|
@ -18,13 +18,75 @@ use std::ffi::CStr;
|
|||
|
||||
use glib;
|
||||
use glib::value::ToSendValue;
|
||||
use glib::translate::{from_glib, from_glib_full, from_glib_none, ToGlib, ToGlibPtr};
|
||||
use glib::translate::{from_glib, from_glib_full, from_glib_none, FromGlib, ToGlib, ToGlibPtr};
|
||||
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
use glib::translate::FromGlibPtrContainer;
|
||||
|
||||
use EventType;
|
||||
|
||||
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
|
||||
pub struct Seqnum(pub u32);
|
||||
pub const SEQNUM_INVALID: Seqnum = Seqnum(0);
|
||||
|
||||
impl ToGlib for Seqnum {
|
||||
type GlibType = u32;
|
||||
|
||||
fn to_glib(&self) -> u32 {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl FromGlib<u32> for Seqnum {
|
||||
fn from_glib(val: u32) -> Seqnum {
|
||||
skip_assert_initialized!();
|
||||
Seqnum(val)
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<u32> for Seqnum {
|
||||
fn into(self) -> u32 {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl From<u32> for Seqnum {
|
||||
fn from(v: u32) -> Seqnum {
|
||||
Seqnum(v)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
|
||||
pub struct GroupId(pub u32);
|
||||
pub const GROUP_ID_INVALID: GroupId = GroupId(0);
|
||||
|
||||
impl ToGlib for GroupId {
|
||||
type GlibType = u32;
|
||||
|
||||
fn to_glib(&self) -> u32 {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<u32> for GroupId {
|
||||
fn into(self) -> u32 {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl From<u32> for GroupId {
|
||||
fn from(v: u32) -> GroupId {
|
||||
GroupId(v)
|
||||
}
|
||||
}
|
||||
|
||||
impl FromGlib<u32> for GroupId {
|
||||
fn from_glib(val: u32) -> GroupId {
|
||||
skip_assert_initialized!();
|
||||
GroupId(val)
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct EventRef(ffi::GstEvent);
|
||||
|
||||
|
@ -92,8 +154,8 @@ impl PartialOrd for EventType {
|
|||
}
|
||||
|
||||
impl EventRef {
|
||||
pub fn get_seqnum(&self) -> u32 {
|
||||
unsafe { ffi::gst_event_get_seqnum(self.as_mut_ptr()) }
|
||||
pub fn get_seqnum(&self) -> Seqnum {
|
||||
unsafe { from_glib(ffi::gst_event_get_seqnum(self.as_mut_ptr())) }
|
||||
}
|
||||
|
||||
pub fn get_running_time_offset(&self) -> i64 {
|
||||
|
@ -239,7 +301,7 @@ impl GstRc<EventRef> {
|
|||
}
|
||||
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
pub fn new_stream_group_done<'a>(group_id: u32) -> StreamGroupDoneBuilder<'a> {
|
||||
pub fn new_stream_group_done<'a>(group_id: GroupId) -> StreamGroupDoneBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
StreamGroupDoneBuilder::new(group_id)
|
||||
}
|
||||
|
@ -474,13 +536,13 @@ impl<'a> StreamStart<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_group_id(&self) -> u32 {
|
||||
pub fn get_group_id(&self) -> GroupId {
|
||||
unsafe {
|
||||
let mut group_id = mem::uninitialized();
|
||||
|
||||
ffi::gst_event_parse_group_id(self.0.as_mut_ptr(), &mut group_id);
|
||||
|
||||
group_id
|
||||
from_glib(group_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -574,13 +636,13 @@ impl<'a> SinkMessage<'a> {
|
|||
pub struct StreamGroupDone<'a>(&'a EventRef);
|
||||
impl<'a> StreamGroupDone<'a> {
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
pub fn get_group_id(&self) -> u32 {
|
||||
pub fn get_group_id(&self) -> GroupId {
|
||||
unsafe {
|
||||
let mut group_id = mem::uninitialized();
|
||||
|
||||
ffi::gst_event_parse_stream_group_done(self.0.as_mut_ptr(), &mut group_id);
|
||||
|
||||
group_id
|
||||
from_glib(group_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -802,7 +864,7 @@ pub struct CustomBothOob<'a>(&'a EventRef);
|
|||
|
||||
macro_rules! event_builder_generic_impl {
|
||||
($new_fn:expr) => {
|
||||
pub fn seqnum(self, seqnum: u32) -> Self {
|
||||
pub fn seqnum(self, seqnum: Seqnum) -> Self {
|
||||
Self {
|
||||
seqnum: Some(seqnum),
|
||||
.. self
|
||||
|
@ -830,7 +892,7 @@ macro_rules! event_builder_generic_impl {
|
|||
unsafe {
|
||||
let event = $new_fn(&mut self);
|
||||
if let Some(seqnum) = self.seqnum {
|
||||
ffi::gst_event_set_seqnum(event, seqnum);
|
||||
ffi::gst_event_set_seqnum(event, seqnum.to_glib());
|
||||
}
|
||||
|
||||
if let Some(running_time_offset) = self.running_time_offset {
|
||||
|
@ -854,7 +916,7 @@ macro_rules! event_builder_generic_impl {
|
|||
}
|
||||
|
||||
pub struct FlushStartBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
}
|
||||
|
@ -872,7 +934,7 @@ impl<'a> FlushStartBuilder<'a> {
|
|||
}
|
||||
|
||||
pub struct FlushStopBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
reset_time: bool,
|
||||
|
@ -894,12 +956,12 @@ impl<'a> FlushStopBuilder<'a> {
|
|||
}
|
||||
|
||||
pub struct StreamStartBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
stream_id: &'a str,
|
||||
flags: Option<::StreamFlags>,
|
||||
group_id: Option<u32>,
|
||||
group_id: Option<GroupId>,
|
||||
}
|
||||
impl<'a> StreamStartBuilder<'a> {
|
||||
fn new(stream_id: &'a str) -> Self {
|
||||
|
@ -921,7 +983,7 @@ impl<'a> StreamStartBuilder<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn group_id(self, group_id: u32) -> Self {
|
||||
pub fn group_id(self, group_id: GroupId) -> Self {
|
||||
Self {
|
||||
group_id: Some(group_id),
|
||||
..self
|
||||
|
@ -934,14 +996,14 @@ impl<'a> StreamStartBuilder<'a> {
|
|||
ffi::gst_event_set_stream_flags(ev, flags.to_glib());
|
||||
}
|
||||
if let Some(group_id) = s.group_id {
|
||||
ffi::gst_event_set_group_id(ev, group_id);
|
||||
ffi::gst_event_set_group_id(ev, group_id.to_glib());
|
||||
}
|
||||
ev
|
||||
});
|
||||
}
|
||||
|
||||
pub struct CapsBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
caps: &'a ::Caps,
|
||||
|
@ -961,7 +1023,7 @@ impl<'a> CapsBuilder<'a> {
|
|||
}
|
||||
|
||||
pub struct SegmentBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
segment: &'a ::Segment,
|
||||
|
@ -984,7 +1046,7 @@ impl<'a> SegmentBuilder<'a> {
|
|||
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
pub struct StreamCollectionBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
stream_collection: &'a ::StreamCollection,
|
||||
|
@ -1007,7 +1069,7 @@ impl<'a> StreamCollectionBuilder<'a> {
|
|||
}
|
||||
|
||||
pub struct TagBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
tags: Option<::TagList>,
|
||||
|
@ -1030,7 +1092,7 @@ impl<'a> TagBuilder<'a> {
|
|||
}
|
||||
|
||||
pub struct BufferSizeBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
minsize: ::FormatValue,
|
||||
|
@ -1061,7 +1123,7 @@ impl<'a> BufferSizeBuilder<'a> {
|
|||
}
|
||||
|
||||
pub struct SinkMessageBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
name: &'a str,
|
||||
|
@ -1086,28 +1148,28 @@ impl<'a> SinkMessageBuilder<'a> {
|
|||
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
pub struct StreamGroupDoneBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
uid: u32,
|
||||
group_id: GroupId,
|
||||
}
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
impl<'a> StreamGroupDoneBuilder<'a> {
|
||||
fn new(uid: u32) -> Self {
|
||||
fn new(group_id: GroupId) -> Self {
|
||||
skip_assert_initialized!();
|
||||
Self {
|
||||
seqnum: None,
|
||||
running_time_offset: None,
|
||||
other_fields: Vec::new(),
|
||||
uid: uid,
|
||||
group_id: group_id,
|
||||
}
|
||||
}
|
||||
|
||||
event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_stream_group_done(s.uid));
|
||||
event_builder_generic_impl!(|s: &Self| ffi::gst_event_new_stream_group_done(s.group_id.to_glib()));
|
||||
}
|
||||
|
||||
pub struct EosBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
}
|
||||
|
@ -1125,7 +1187,7 @@ impl<'a> EosBuilder<'a> {
|
|||
}
|
||||
|
||||
pub struct TocBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
toc: &'a ::Toc,
|
||||
|
@ -1149,7 +1211,7 @@ impl<'a> TocBuilder<'a> {
|
|||
}
|
||||
|
||||
pub struct ProtectionBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
system_id: &'a str,
|
||||
|
@ -1179,7 +1241,7 @@ impl<'a> ProtectionBuilder<'a> {
|
|||
}
|
||||
|
||||
pub struct SegmentDoneBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
position: ::FormatValue,
|
||||
|
@ -1201,7 +1263,7 @@ impl<'a> SegmentDoneBuilder<'a> {
|
|||
}
|
||||
|
||||
pub struct GapBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
timestamp: u64,
|
||||
|
@ -1223,7 +1285,7 @@ impl<'a> GapBuilder<'a> {
|
|||
}
|
||||
|
||||
pub struct QosBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
type_: ::QOSType,
|
||||
|
@ -1251,7 +1313,7 @@ impl<'a> QosBuilder<'a> {
|
|||
}
|
||||
|
||||
pub struct SeekBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
rate: f64,
|
||||
|
@ -1298,7 +1360,7 @@ impl<'a> SeekBuilder<'a> {
|
|||
}
|
||||
|
||||
pub struct NavigationBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
structure: Option<Structure>,
|
||||
|
@ -1324,7 +1386,7 @@ impl<'a> NavigationBuilder<'a> {
|
|||
}
|
||||
|
||||
pub struct LatencyBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
latency: u64,
|
||||
|
@ -1344,7 +1406,7 @@ impl<'a> LatencyBuilder<'a> {
|
|||
}
|
||||
|
||||
pub struct StepBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
fmt: ::Format,
|
||||
|
@ -1380,7 +1442,7 @@ impl<'a> StepBuilder<'a> {
|
|||
}
|
||||
|
||||
pub struct ReconfigureBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
}
|
||||
|
@ -1398,7 +1460,7 @@ impl<'a> ReconfigureBuilder<'a> {
|
|||
}
|
||||
|
||||
pub struct TocSelectBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
uid: &'a str,
|
||||
|
@ -1421,7 +1483,7 @@ impl<'a> TocSelectBuilder<'a> {
|
|||
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
pub struct SelectStreamsBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
streams: &'a [&'a str],
|
||||
|
@ -1444,7 +1506,7 @@ impl<'a> SelectStreamsBuilder<'a> {
|
|||
}
|
||||
|
||||
pub struct CustomUpstreamBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
structure: Option<Structure>,
|
||||
|
@ -1471,7 +1533,7 @@ impl<'a> CustomUpstreamBuilder<'a> {
|
|||
}
|
||||
|
||||
pub struct CustomDownstreamBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
structure: Option<Structure>,
|
||||
|
@ -1498,7 +1560,7 @@ impl<'a> CustomDownstreamBuilder<'a> {
|
|||
}
|
||||
|
||||
pub struct CustomDownstreamOobBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
structure: Option<Structure>,
|
||||
|
@ -1527,7 +1589,7 @@ impl<'a> CustomDownstreamOobBuilder<'a> {
|
|||
}
|
||||
|
||||
pub struct CustomDownstreamStickyBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
structure: Option<Structure>,
|
||||
|
@ -1556,7 +1618,7 @@ impl<'a> CustomDownstreamStickyBuilder<'a> {
|
|||
}
|
||||
|
||||
pub struct CustomBothBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
structure: Option<Structure>,
|
||||
|
@ -1582,7 +1644,7 @@ impl<'a> CustomBothBuilder<'a> {
|
|||
}
|
||||
|
||||
pub struct CustomBothOobBuilder<'a> {
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
running_time_offset: Option<i64>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
structure: Option<Structure>,
|
||||
|
|
|
@ -85,3 +85,25 @@ pub fn parse_launchv_full<'a, P: Into<Option<&'a mut ParseContext>>>(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn util_group_id_next() -> ::GroupId {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
let v = from_glib(ffi::gst_util_group_id_next());
|
||||
if v == ::GROUP_ID_INVALID {
|
||||
return from_glib(ffi::gst_util_group_id_next());
|
||||
}
|
||||
v
|
||||
}
|
||||
}
|
||||
|
||||
pub fn util_seqnum_next() -> ::Seqnum {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
let v = from_glib(ffi::gst_util_seqnum_next());
|
||||
if v == ::SEQNUM_INVALID {
|
||||
return from_glib(ffi::gst_util_seqnum_next());
|
||||
}
|
||||
v
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ pub use bufferlist::{BufferList, BufferListRef};
|
|||
pub mod query;
|
||||
pub use query::{Query, QueryRef, QueryView};
|
||||
pub mod event;
|
||||
pub use event::{Event, EventRef, EventView};
|
||||
pub use event::{Event, EventRef, EventView, GroupId, Seqnum, GROUP_ID_INVALID, SEQNUM_INVALID};
|
||||
pub mod context;
|
||||
pub use context::{Context, ContextRef};
|
||||
mod static_caps;
|
||||
|
|
|
@ -12,6 +12,8 @@ use miniobject::*;
|
|||
use structure::*;
|
||||
use TagList;
|
||||
use GstObjectExt;
|
||||
use Seqnum;
|
||||
use GroupId;
|
||||
|
||||
use std::ptr;
|
||||
use std::mem;
|
||||
|
@ -41,8 +43,8 @@ impl MessageRef {
|
|||
unsafe { from_glib_none((*self.as_ptr()).src) }
|
||||
}
|
||||
|
||||
pub fn get_seqnum(&self) -> u32 {
|
||||
unsafe { ffi::gst_message_get_seqnum(self.as_mut_ptr()) }
|
||||
pub fn get_seqnum(&self) -> Seqnum {
|
||||
unsafe { from_glib(ffi::gst_message_get_seqnum(self.as_mut_ptr())) }
|
||||
}
|
||||
|
||||
pub fn get_structure(&self) -> Option<&StructureRef> {
|
||||
|
@ -961,7 +963,7 @@ impl<'a> ResetTime<'a> {
|
|||
|
||||
pub struct StreamStart<'a>(&'a MessageRef);
|
||||
impl<'a> StreamStart<'a> {
|
||||
pub fn get_group_id(&self) -> Option<u32> {
|
||||
pub fn get_group_id(&self) -> Option<GroupId> {
|
||||
unsafe {
|
||||
let mut group_id = mem::uninitialized();
|
||||
|
||||
|
@ -969,7 +971,7 @@ impl<'a> StreamStart<'a> {
|
|||
self.0.as_mut_ptr(),
|
||||
&mut group_id,
|
||||
)) {
|
||||
Some(group_id)
|
||||
Some(from_glib(group_id))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -1151,7 +1153,7 @@ macro_rules! message_builder_generic_impl {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn seqnum(self, seqnum: u32) -> Self {
|
||||
pub fn seqnum(self, seqnum: Seqnum) -> Self {
|
||||
Self {
|
||||
seqnum: Some(seqnum),
|
||||
.. self
|
||||
|
@ -1173,7 +1175,7 @@ macro_rules! message_builder_generic_impl {
|
|||
let src = self.src.to_glib_none().0;
|
||||
let msg = $new_fn(&mut self, src);
|
||||
if let Some(seqnum) = self.seqnum {
|
||||
ffi::gst_message_set_seqnum(msg, seqnum);
|
||||
ffi::gst_message_set_seqnum(msg, seqnum.to_glib());
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -1194,7 +1196,7 @@ macro_rules! message_builder_generic_impl {
|
|||
|
||||
pub struct EosBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
}
|
||||
impl<'a> EosBuilder<'a> {
|
||||
|
@ -1219,7 +1221,7 @@ impl MessageErrorDomain for ::LibraryError {}
|
|||
|
||||
pub struct ErrorBuilder<'a, T> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
error: T,
|
||||
message: &'a str,
|
||||
|
@ -1287,7 +1289,7 @@ impl<'a, T: MessageErrorDomain> ErrorBuilder<'a, T> {
|
|||
|
||||
pub struct WarningBuilder<'a, T> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
error: T,
|
||||
message: &'a str,
|
||||
|
@ -1355,7 +1357,7 @@ impl<'a, T: MessageErrorDomain> WarningBuilder<'a, T> {
|
|||
|
||||
pub struct InfoBuilder<'a, T> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
error: T,
|
||||
message: &'a str,
|
||||
|
@ -1423,7 +1425,7 @@ impl<'a, T: MessageErrorDomain> InfoBuilder<'a, T> {
|
|||
|
||||
pub struct TagBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
tags: &'a TagList,
|
||||
}
|
||||
|
@ -1445,7 +1447,7 @@ impl<'a> TagBuilder<'a> {
|
|||
|
||||
pub struct BufferingBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
percent: i32,
|
||||
stats: Option<(::BufferingMode, i32, i32, i64)>,
|
||||
|
@ -1495,7 +1497,7 @@ impl<'a> BufferingBuilder<'a> {
|
|||
|
||||
pub struct StateChangedBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
old: ::State,
|
||||
new: ::State,
|
||||
|
@ -1526,7 +1528,7 @@ impl<'a> StateChangedBuilder<'a> {
|
|||
|
||||
pub struct StateDirtyBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
}
|
||||
impl<'a> StateDirtyBuilder<'a> {
|
||||
|
@ -1544,7 +1546,7 @@ impl<'a> StateDirtyBuilder<'a> {
|
|||
|
||||
pub struct StepDoneBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
format: ::Format,
|
||||
amount: u64,
|
||||
|
@ -1595,7 +1597,7 @@ impl<'a> StepDoneBuilder<'a> {
|
|||
|
||||
pub struct ClockProvideBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
clock: &'a ::Clock,
|
||||
ready: bool,
|
||||
|
@ -1619,7 +1621,7 @@ impl<'a> ClockProvideBuilder<'a> {
|
|||
|
||||
pub struct ClockLostBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
clock: &'a ::Clock,
|
||||
}
|
||||
|
@ -1641,7 +1643,7 @@ impl<'a> ClockLostBuilder<'a> {
|
|||
|
||||
pub struct NewClockBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
clock: &'a ::Clock,
|
||||
}
|
||||
|
@ -1663,7 +1665,7 @@ impl<'a> NewClockBuilder<'a> {
|
|||
|
||||
pub struct StructureChangeBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
type_: ::StructureChangeType,
|
||||
owner: &'a ::Element,
|
||||
|
@ -1694,7 +1696,7 @@ impl<'a> StructureChangeBuilder<'a> {
|
|||
|
||||
pub struct StreamStatusBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
type_: ::StreamStatusType,
|
||||
owner: &'a ::Element,
|
||||
|
@ -1732,7 +1734,7 @@ impl<'a> StreamStatusBuilder<'a> {
|
|||
|
||||
pub struct ApplicationBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
structure: Option<::Structure>,
|
||||
}
|
||||
|
@ -1754,7 +1756,7 @@ impl<'a> ApplicationBuilder<'a> {
|
|||
|
||||
pub struct ElementBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
structure: Option<::Structure>,
|
||||
}
|
||||
|
@ -1776,7 +1778,7 @@ impl<'a> ElementBuilder<'a> {
|
|||
|
||||
pub struct SegmentStartBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
position: ::FormatValue,
|
||||
}
|
||||
|
@ -1802,7 +1804,7 @@ impl<'a> SegmentStartBuilder<'a> {
|
|||
|
||||
pub struct SegmentDoneBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
position: ::FormatValue,
|
||||
}
|
||||
|
@ -1828,7 +1830,7 @@ impl<'a> SegmentDoneBuilder<'a> {
|
|||
|
||||
pub struct DurationChangedBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
}
|
||||
impl<'a> DurationChangedBuilder<'a> {
|
||||
|
@ -1846,7 +1848,7 @@ impl<'a> DurationChangedBuilder<'a> {
|
|||
|
||||
pub struct LatencyBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
}
|
||||
impl<'a> LatencyBuilder<'a> {
|
||||
|
@ -1864,7 +1866,7 @@ impl<'a> LatencyBuilder<'a> {
|
|||
|
||||
pub struct AsyncStartBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
}
|
||||
impl<'a> AsyncStartBuilder<'a> {
|
||||
|
@ -1882,7 +1884,7 @@ impl<'a> AsyncStartBuilder<'a> {
|
|||
|
||||
pub struct AsyncDoneBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
running_time: u64,
|
||||
}
|
||||
|
@ -1904,7 +1906,7 @@ impl<'a> AsyncDoneBuilder<'a> {
|
|||
|
||||
pub struct RequestStateBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
state: ::State,
|
||||
}
|
||||
|
@ -1926,7 +1928,7 @@ impl<'a> RequestStateBuilder<'a> {
|
|||
|
||||
pub struct StepStartBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
active: bool,
|
||||
format: ::Format,
|
||||
|
@ -1973,7 +1975,7 @@ impl<'a> StepStartBuilder<'a> {
|
|||
|
||||
pub struct QosBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
live: bool,
|
||||
running_time: u64,
|
||||
|
@ -2035,7 +2037,7 @@ impl<'a> QosBuilder<'a> {
|
|||
|
||||
pub struct ProgressBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
type_: ::ProgressType,
|
||||
code: Option<&'a str>,
|
||||
|
@ -2080,7 +2082,7 @@ impl<'a> ProgressBuilder<'a> {
|
|||
|
||||
pub struct TocBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
toc: &'a ::Toc,
|
||||
updated: bool,
|
||||
|
@ -2104,7 +2106,7 @@ impl<'a> TocBuilder<'a> {
|
|||
|
||||
pub struct ResetTimeBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
running_time: u64,
|
||||
}
|
||||
|
@ -2126,9 +2128,9 @@ impl<'a> ResetTimeBuilder<'a> {
|
|||
|
||||
pub struct StreamStartBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
group_id: Option<u32>,
|
||||
group_id: Option<GroupId>,
|
||||
}
|
||||
impl<'a> StreamStartBuilder<'a> {
|
||||
fn new() -> Self {
|
||||
|
@ -2141,7 +2143,7 @@ impl<'a> StreamStartBuilder<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn group_id(self, group_id: u32) -> Self {
|
||||
pub fn group_id(self, group_id: GroupId) -> Self {
|
||||
Self {
|
||||
group_id: Some(group_id),
|
||||
..self
|
||||
|
@ -2151,7 +2153,7 @@ impl<'a> StreamStartBuilder<'a> {
|
|||
message_builder_generic_impl!(|s: &mut Self, src| {
|
||||
let msg = ffi::gst_message_new_stream_start(src);
|
||||
if let Some(group_id) = s.group_id {
|
||||
ffi::gst_message_set_group_id(msg, group_id);
|
||||
ffi::gst_message_set_group_id(msg, group_id.to_glib());
|
||||
}
|
||||
msg
|
||||
});
|
||||
|
@ -2159,7 +2161,7 @@ impl<'a> StreamStartBuilder<'a> {
|
|||
|
||||
pub struct NeedContextBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
context_type: &'a str,
|
||||
}
|
||||
|
@ -2181,7 +2183,7 @@ impl<'a> NeedContextBuilder<'a> {
|
|||
|
||||
pub struct HaveContextBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
context: Option<::Context>,
|
||||
}
|
||||
|
@ -2204,7 +2206,7 @@ impl<'a> HaveContextBuilder<'a> {
|
|||
|
||||
pub struct DeviceAddedBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
device: &'a ::Device,
|
||||
}
|
||||
|
@ -2226,7 +2228,7 @@ impl<'a> DeviceAddedBuilder<'a> {
|
|||
|
||||
pub struct DeviceRemovedBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
device: &'a ::Device,
|
||||
}
|
||||
|
@ -2249,7 +2251,7 @@ impl<'a> DeviceRemovedBuilder<'a> {
|
|||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
pub struct PropertyNotifyBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
property_name: &'a str,
|
||||
value: &'a glib::Value,
|
||||
|
@ -2279,7 +2281,7 @@ impl<'a> PropertyNotifyBuilder<'a> {
|
|||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
pub struct StreamCollectionBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
collection: &'a ::StreamCollection,
|
||||
}
|
||||
|
@ -2303,7 +2305,7 @@ impl<'a> StreamCollectionBuilder<'a> {
|
|||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
pub struct StreamsSelectedBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))] collection: &'a ::StreamCollection,
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))] streams: Option<&'a [&'a ::Stream]>,
|
||||
|
@ -2342,7 +2344,7 @@ impl<'a> StreamsSelectedBuilder<'a> {
|
|||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
pub struct RedirectBuilder<'a> {
|
||||
src: Option<Object>,
|
||||
seqnum: Option<u32>,
|
||||
seqnum: Option<Seqnum>,
|
||||
other_fields: Vec<(&'a str, &'a ToSendValue)>,
|
||||
location: &'a str,
|
||||
tag_list: Option<&'a TagList>,
|
||||
|
|
Loading…
Reference in a new issue