forked from mirrors/gstreamer-rs
Run everything through latest rustfmt-nightly
This commit is contained in:
parent
1fbc5e7644
commit
4117c01ff2
37 changed files with 213 additions and 265 deletions
|
@ -32,7 +32,8 @@ struct ErrorMessage {
|
||||||
src: String,
|
src: String,
|
||||||
error: String,
|
error: String,
|
||||||
debug: Option<String>,
|
debug: Option<String>,
|
||||||
#[cause] cause: glib::Error,
|
#[cause]
|
||||||
|
cause: glib::Error,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
||||||
|
|
|
@ -28,7 +28,8 @@ struct ErrorMessage {
|
||||||
src: String,
|
src: String,
|
||||||
error: String,
|
error: String,
|
||||||
debug: Option<String>,
|
debug: Option<String>,
|
||||||
#[cause] cause: glib::Error,
|
#[cause]
|
||||||
|
cause: glib::Error,
|
||||||
}
|
}
|
||||||
|
|
||||||
const WIDTH: usize = 320;
|
const WIDTH: usize = 320;
|
||||||
|
|
|
@ -28,7 +28,8 @@ struct ErrorMessage {
|
||||||
src: String,
|
src: String,
|
||||||
error: String,
|
error: String,
|
||||||
debug: Option<String>,
|
debug: Option<String>,
|
||||||
#[cause] cause: glib::Error,
|
#[cause]
|
||||||
|
cause: glib::Error,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn example_main() -> Result<(), Error> {
|
fn example_main() -> Result<(), Error> {
|
||||||
|
|
|
@ -38,7 +38,8 @@ struct ErrorMessage {
|
||||||
src: String,
|
src: String,
|
||||||
error: String,
|
error: String,
|
||||||
debug: Option<String>,
|
debug: Option<String>,
|
||||||
#[cause] cause: glib::Error,
|
#[cause]
|
||||||
|
cause: glib::Error,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_element<'a, P: Into<Option<&'a str>>>(
|
fn make_element<'a, P: Into<Option<&'a str>>>(
|
||||||
|
@ -121,16 +122,7 @@ fn example_main() -> Result<(), Error> {
|
||||||
let scale = make_element("videoscale", None)?;
|
let scale = make_element("videoscale", None)?;
|
||||||
let filter = make_element("capsfilter", None)?;
|
let filter = make_element("capsfilter", None)?;
|
||||||
|
|
||||||
pipeline.add_many(&[
|
pipeline.add_many(&[&src, &netsim, &rtpbin, &depay, &dec, &conv, &scale, &filter])?;
|
||||||
&src,
|
|
||||||
&netsim,
|
|
||||||
&rtpbin,
|
|
||||||
&depay,
|
|
||||||
&dec,
|
|
||||||
&conv,
|
|
||||||
&scale,
|
|
||||||
&filter,
|
|
||||||
])?;
|
|
||||||
gst::Element::link_many(&[&depay, &dec, &conv, &scale, &filter])?;
|
gst::Element::link_many(&[&depay, &dec, &conv, &scale, &filter])?;
|
||||||
|
|
||||||
match args[1].as_str() {
|
match args[1].as_str() {
|
||||||
|
@ -253,16 +245,14 @@ fn example_main() -> Result<(), Error> {
|
||||||
match msg.view() {
|
match msg.view() {
|
||||||
MessageView::Eos(..) => break,
|
MessageView::Eos(..) => break,
|
||||||
MessageView::Error(err) => {
|
MessageView::Error(err) => {
|
||||||
return Err(
|
return Err(ErrorMessage {
|
||||||
ErrorMessage {
|
|
||||||
src: msg.get_src()
|
src: msg.get_src()
|
||||||
.map(|s| s.get_path_string())
|
.map(|s| s.get_path_string())
|
||||||
.unwrap_or(String::from("None")),
|
.unwrap_or(String::from("None")),
|
||||||
error: err.get_error().description().into(),
|
error: err.get_error().description().into(),
|
||||||
debug: err.get_debug(),
|
debug: err.get_debug(),
|
||||||
cause: err.get_error(),
|
cause: err.get_error(),
|
||||||
}.into(),
|
}.into());
|
||||||
);
|
|
||||||
}
|
}
|
||||||
MessageView::StateChanged(s) => match msg.get_src() {
|
MessageView::StateChanged(s) => match msg.get_src() {
|
||||||
Some(element) => if element == pipeline && s.get_current() == gst::State::Playing {
|
Some(element) => if element == pipeline && s.get_current() == gst::State::Playing {
|
||||||
|
|
|
@ -35,7 +35,8 @@ struct ErrorMessage {
|
||||||
src: String,
|
src: String,
|
||||||
error: String,
|
error: String,
|
||||||
debug: Option<String>,
|
debug: Option<String>,
|
||||||
#[cause] cause: glib::Error,
|
#[cause]
|
||||||
|
cause: glib::Error,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_element<'a, P: Into<Option<&'a str>>>(
|
fn make_element<'a, P: Into<Option<&'a str>>>(
|
||||||
|
@ -183,16 +184,14 @@ fn example_main() -> Result<(), Error> {
|
||||||
match msg.view() {
|
match msg.view() {
|
||||||
MessageView::Eos(..) => break,
|
MessageView::Eos(..) => break,
|
||||||
MessageView::Error(err) => {
|
MessageView::Error(err) => {
|
||||||
return Err(
|
return Err(ErrorMessage {
|
||||||
ErrorMessage {
|
|
||||||
src: msg.get_src()
|
src: msg.get_src()
|
||||||
.map(|s| s.get_path_string())
|
.map(|s| s.get_path_string())
|
||||||
.unwrap_or(String::from("None")),
|
.unwrap_or(String::from("None")),
|
||||||
error: err.get_error().description().into(),
|
error: err.get_error().description().into(),
|
||||||
debug: err.get_debug(),
|
debug: err.get_debug(),
|
||||||
cause: err.get_error(),
|
cause: err.get_error(),
|
||||||
}.into(),
|
}.into());
|
||||||
);
|
|
||||||
}
|
}
|
||||||
MessageView::StateChanged(s) => match msg.get_src() {
|
MessageView::StateChanged(s) => match msg.get_src() {
|
||||||
Some(element) => if element == pipeline && s.get_current() == gst::State::Playing {
|
Some(element) => if element == pipeline && s.get_current() == gst::State::Playing {
|
||||||
|
|
|
@ -50,7 +50,10 @@ fn main_loop() -> Result<(), Error> {
|
||||||
|
|
||||||
server.attach(None);
|
server.attach(None);
|
||||||
|
|
||||||
println!("Stream ready at rtsp://127.0.0.1:{}/test", server.get_bound_port());
|
println!(
|
||||||
|
"Stream ready at rtsp://127.0.0.1:{}/test",
|
||||||
|
server.get_bound_port()
|
||||||
|
);
|
||||||
|
|
||||||
main_loop.run();
|
main_loop.run();
|
||||||
|
|
||||||
|
@ -62,7 +65,9 @@ fn example_main() -> Result<(), Error> {
|
||||||
|
|
||||||
#[cfg(not(feature = "gst-rtsp-server"))]
|
#[cfg(not(feature = "gst-rtsp-server"))]
|
||||||
{
|
{
|
||||||
eprintln!("Feature gst-rtsp-server is required. Please rebuild with --features gst-rtsp-server");
|
eprintln!(
|
||||||
|
"Feature gst-rtsp-server is required. Please rebuild with --features gst-rtsp-server"
|
||||||
|
);
|
||||||
std::process::exit(-1)
|
std::process::exit(-1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,8 @@ struct ErrorMessage {
|
||||||
src: String,
|
src: String,
|
||||||
error: String,
|
error: String,
|
||||||
debug: Option<String>,
|
debug: Option<String>,
|
||||||
#[cause] cause: glib::Error,
|
#[cause]
|
||||||
|
cause: glib::Error,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn example_main() -> Result<(), Error> {
|
fn example_main() -> Result<(), Error> {
|
||||||
|
|
|
@ -298,8 +298,7 @@ impl glib::types::StaticType for AudioInfo {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl<'a> glib::value::FromValueOptional<'a> for AudioInfo {
|
impl<'a> glib::value::FromValueOptional<'a> for AudioInfo {
|
||||||
unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> {
|
unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> {
|
||||||
Option::<AudioInfo>::from_glib_none(gobject_ffi::g_value_get_boxed(value.to_glib_none().0)
|
Option::<AudioInfo>::from_glib_none(gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as *mut ffi::GstAudioInfo)
|
||||||
as *mut ffi::GstAudioInfo)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,9 +46,7 @@ impl AsMut<gst::StructureRef> for PlayerConfig {
|
||||||
impl PlayerConfig {
|
impl PlayerConfig {
|
||||||
pub fn get_position_update_interval(&self) -> u32 {
|
pub fn get_position_update_interval(&self) -> u32 {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe { ffi::gst_player_config_get_position_update_interval(self.0.to_glib_none().0) }
|
||||||
ffi::gst_player_config_get_position_update_interval(self.0.to_glib_none().0)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_seek_accurate(&self) -> bool {
|
pub fn get_seek_accurate(&self) -> bool {
|
||||||
|
|
|
@ -10,19 +10,19 @@
|
||||||
extern crate bitflags;
|
extern crate bitflags;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
|
|
||||||
|
extern crate gio;
|
||||||
|
extern crate gio_sys as gio_ffi;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate glib;
|
extern crate glib;
|
||||||
extern crate glib_sys as glib_ffi;
|
extern crate glib_sys as glib_ffi;
|
||||||
extern crate gio;
|
|
||||||
extern crate gio_sys as gio_ffi;
|
|
||||||
extern crate gobject_sys as gobject_ffi;
|
extern crate gobject_sys as gobject_ffi;
|
||||||
extern crate gstreamer as gst;
|
extern crate gstreamer as gst;
|
||||||
extern crate gstreamer_sys as gst_ffi;
|
|
||||||
extern crate gstreamer_rtsp as gst_rtsp;
|
|
||||||
extern crate gstreamer_rtsp_sys as gst_rtsp_ffi;
|
|
||||||
extern crate gstreamer_net as gst_net;
|
extern crate gstreamer_net as gst_net;
|
||||||
extern crate gstreamer_net_sys as gst_net_ffi;
|
extern crate gstreamer_net_sys as gst_net_ffi;
|
||||||
|
extern crate gstreamer_rtsp as gst_rtsp;
|
||||||
extern crate gstreamer_rtsp_server_sys as ffi;
|
extern crate gstreamer_rtsp_server_sys as ffi;
|
||||||
|
extern crate gstreamer_rtsp_sys as gst_rtsp_ffi;
|
||||||
|
extern crate gstreamer_sys as gst_ffi;
|
||||||
|
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => (
|
() => (
|
||||||
|
|
|
@ -7,17 +7,36 @@ use glib::translate::*;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
pub trait RTSPAddressPoolExtManual {
|
pub trait RTSPAddressPoolExtManual {
|
||||||
fn reserve_address(&self, ip_address: &str, port: u32, n_ports: u32, ttl: u32) -> Result<RTSPAddress, RTSPAddressPoolResult>;
|
fn reserve_address(
|
||||||
|
&self,
|
||||||
|
ip_address: &str,
|
||||||
|
port: u32,
|
||||||
|
n_ports: u32,
|
||||||
|
ttl: u32,
|
||||||
|
) -> Result<RTSPAddress, RTSPAddressPoolResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<O: IsA<RTSPAddressPool>> RTSPAddressPoolExtManual for O {
|
impl<O: IsA<RTSPAddressPool>> RTSPAddressPoolExtManual for O {
|
||||||
fn reserve_address(&self, ip_address: &str, port: u32, n_ports: u32, ttl: u32) -> Result<RTSPAddress, RTSPAddressPoolResult> {
|
fn reserve_address(
|
||||||
|
&self,
|
||||||
|
ip_address: &str,
|
||||||
|
port: u32,
|
||||||
|
n_ports: u32,
|
||||||
|
ttl: u32,
|
||||||
|
) -> Result<RTSPAddress, RTSPAddressPoolResult> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut address = ptr::null_mut();
|
let mut address = ptr::null_mut();
|
||||||
let ret = from_glib(ffi::gst_rtsp_address_pool_reserve_address(self.to_glib_none().0, ip_address.to_glib_none().0, port, n_ports, ttl, &mut address));
|
let ret = from_glib(ffi::gst_rtsp_address_pool_reserve_address(
|
||||||
|
self.to_glib_none().0,
|
||||||
|
ip_address.to_glib_none().0,
|
||||||
|
port,
|
||||||
|
n_ports,
|
||||||
|
ttl,
|
||||||
|
&mut address,
|
||||||
|
));
|
||||||
match ret {
|
match ret {
|
||||||
RTSPAddressPoolResult::Ok => Ok(from_glib_full(address)),
|
RTSPAddressPoolResult::Ok => Ok(from_glib_full(address)),
|
||||||
_ => Err(ret)
|
_ => Err(ret),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,10 @@ impl<O: IsA<RTSPClient>> RTSPClientExtManual for O {
|
||||||
let context = context.into();
|
let context = context.into();
|
||||||
let context = context.to_glib_none();
|
let context = context.to_glib_none();
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib(ffi::gst_rtsp_client_attach(self.to_glib_none().0, context.0))
|
from_glib(ffi::gst_rtsp_client_attach(
|
||||||
|
self.to_glib_none().0,
|
||||||
|
context.0,
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,10 @@ impl<O: IsA<RTSPServer>> RTSPServerExtManual for O {
|
||||||
let context = context.into();
|
let context = context.into();
|
||||||
let context = context.to_glib_none();
|
let context = context.to_glib_none();
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib(ffi::gst_rtsp_server_attach(self.to_glib_none().0, context.0))
|
from_glib(ffi::gst_rtsp_server_attach(
|
||||||
|
self.to_glib_none().0,
|
||||||
|
context.0,
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ impl<O: IsA<RTSPSessionPool>> RTSPSessionPoolExtManual for O {
|
||||||
func: F,
|
func: F,
|
||||||
) -> glib::Source
|
) -> glib::Source
|
||||||
where
|
where
|
||||||
F: FnMut(&RTSPSessionPool) -> Continue + Send + 'static
|
F: FnMut(&RTSPSessionPool) -> Continue + Send + 'static,
|
||||||
{
|
{
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
@ -15,10 +15,10 @@ extern crate glib;
|
||||||
extern crate glib_sys as glib_ffi;
|
extern crate glib_sys as glib_ffi;
|
||||||
extern crate gobject_sys as gobject_ffi;
|
extern crate gobject_sys as gobject_ffi;
|
||||||
extern crate gstreamer as gst;
|
extern crate gstreamer as gst;
|
||||||
extern crate gstreamer_sys as gst_ffi;
|
extern crate gstreamer_rtsp_sys as ffi;
|
||||||
extern crate gstreamer_sdp as gst_sdp;
|
extern crate gstreamer_sdp as gst_sdp;
|
||||||
extern crate gstreamer_sdp_sys as gst_sdp_ffi;
|
extern crate gstreamer_sdp_sys as gst_sdp_ffi;
|
||||||
extern crate gstreamer_rtsp_sys as ffi;
|
extern crate gstreamer_sys as gst_ffi;
|
||||||
|
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => (
|
() => (
|
||||||
|
|
|
@ -13,8 +13,8 @@ extern crate glib;
|
||||||
extern crate glib_sys as glib_ffi;
|
extern crate glib_sys as glib_ffi;
|
||||||
extern crate gobject_sys as gobject_ffi;
|
extern crate gobject_sys as gobject_ffi;
|
||||||
extern crate gstreamer as gst;
|
extern crate gstreamer as gst;
|
||||||
extern crate gstreamer_sys as gst_ffi;
|
|
||||||
extern crate gstreamer_sdp_sys as ffi;
|
extern crate gstreamer_sdp_sys as ffi;
|
||||||
|
extern crate gstreamer_sys as gst_ffi;
|
||||||
|
|
||||||
macro_rules! skip_assert_initialized {
|
macro_rules! skip_assert_initialized {
|
||||||
() => (
|
() => (
|
||||||
|
|
|
@ -16,8 +16,8 @@ extern crate glib_sys as glib_ffi;
|
||||||
extern crate gobject_sys as gobject_ffi;
|
extern crate gobject_sys as gobject_ffi;
|
||||||
extern crate gstreamer as gst;
|
extern crate gstreamer as gst;
|
||||||
extern crate gstreamer_base as gst_base;
|
extern crate gstreamer_base as gst_base;
|
||||||
extern crate gstreamer_sys as gst_ffi;
|
|
||||||
extern crate gstreamer_base_sys as gst_base_ffi;
|
extern crate gstreamer_base_sys as gst_base_ffi;
|
||||||
|
extern crate gstreamer_sys as gst_ffi;
|
||||||
extern crate gstreamer_video_sys as ffi;
|
extern crate gstreamer_video_sys as ffi;
|
||||||
|
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
|
|
|
@ -395,7 +395,10 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> {
|
||||||
self.0.id
|
self.0.id
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn copy(&self, dest: &mut VideoFrameRef<&mut gst::BufferRef>) -> Result<(), glib::BoolError> {
|
pub fn copy(
|
||||||
|
&self,
|
||||||
|
dest: &mut VideoFrameRef<&mut gst::BufferRef>,
|
||||||
|
) -> Result<(), glib::BoolError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let res: bool = from_glib(ffi::gst_video_frame_copy(&mut dest.0, &self.0));
|
let res: bool = from_glib(ffi::gst_video_frame_copy(&mut dest.0, &self.0));
|
||||||
if res {
|
if res {
|
||||||
|
|
|
@ -26,7 +26,8 @@ pub enum VideoColorRange {
|
||||||
Unknown,
|
Unknown,
|
||||||
Range0255,
|
Range0255,
|
||||||
Range16235,
|
Range16235,
|
||||||
#[doc(hidden)] __Unknown(i32),
|
#[doc(hidden)]
|
||||||
|
__Unknown(i32),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
@ -205,7 +206,8 @@ pub struct VideoInfoBuilder<'a> {
|
||||||
stride: Option<&'a [i32]>,
|
stride: Option<&'a [i32]>,
|
||||||
multiview_mode: Option<::VideoMultiviewMode>,
|
multiview_mode: Option<::VideoMultiviewMode>,
|
||||||
multiview_flags: Option<::VideoMultiviewFlags>,
|
multiview_flags: Option<::VideoMultiviewFlags>,
|
||||||
#[cfg(any(feature = "v1_12", feature = "dox"))] field_order: Option<::VideoFieldOrder>,
|
#[cfg(any(feature = "v1_12", feature = "dox"))]
|
||||||
|
field_order: Option<::VideoFieldOrder>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> VideoInfoBuilder<'a> {
|
impl<'a> VideoInfoBuilder<'a> {
|
||||||
|
@ -636,8 +638,7 @@ impl glib::types::StaticType for VideoInfo {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl<'a> glib::value::FromValueOptional<'a> for VideoInfo {
|
impl<'a> glib::value::FromValueOptional<'a> for VideoInfo {
|
||||||
unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> {
|
unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> {
|
||||||
Option::<VideoInfo>::from_glib_none(gobject_ffi::g_value_get_boxed(value.to_glib_none().0)
|
Option::<VideoInfo>::from_glib_none(gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as *mut ffi::GstVideoInfo)
|
||||||
as *mut ffi::GstVideoInfo)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -157,9 +157,7 @@ impl GstRc<BufferRef> {
|
||||||
|
|
||||||
pub fn append(buffer: Self, other: Self) -> Self {
|
pub fn append(buffer: Self, other: Self) -> Self {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe { from_glib_full(ffi::gst_buffer_append(buffer.into_ptr(), other.into_ptr())) }
|
||||||
from_glib_full(ffi::gst_buffer_append(buffer.into_ptr(), other.into_ptr()))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,9 +170,8 @@ impl Default for GstRc<BufferRef> {
|
||||||
impl BufferRef {
|
impl BufferRef {
|
||||||
pub fn map_readable(&self) -> Option<BufferMap<Readable>> {
|
pub fn map_readable(&self) -> Option<BufferMap<Readable>> {
|
||||||
let mut map_info: ffi::GstMapInfo = unsafe { mem::zeroed() };
|
let mut map_info: ffi::GstMapInfo = unsafe { mem::zeroed() };
|
||||||
let res = unsafe {
|
let res =
|
||||||
ffi::gst_buffer_map(self.as_mut_ptr(), &mut map_info, ffi::GST_MAP_READ)
|
unsafe { ffi::gst_buffer_map(self.as_mut_ptr(), &mut map_info, ffi::GST_MAP_READ) };
|
||||||
};
|
|
||||||
if res == glib_ffi::GTRUE {
|
if res == glib_ffi::GTRUE {
|
||||||
Some(BufferMap {
|
Some(BufferMap {
|
||||||
buffer: self,
|
buffer: self,
|
||||||
|
@ -385,10 +382,7 @@ impl ToOwned for BufferRef {
|
||||||
type Owned = GstRc<BufferRef>;
|
type Owned = GstRc<BufferRef>;
|
||||||
|
|
||||||
fn to_owned(&self) -> GstRc<BufferRef> {
|
fn to_owned(&self) -> GstRc<BufferRef> {
|
||||||
unsafe {
|
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
|
||||||
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _)
|
|
||||||
as *mut _)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,9 +434,7 @@ impl<'a, T> BufferMap<'a, T> {
|
||||||
|
|
||||||
impl<'a> BufferMap<'a, Writable> {
|
impl<'a> BufferMap<'a, Writable> {
|
||||||
pub fn as_mut_slice(&mut self) -> &mut [u8] {
|
pub fn as_mut_slice(&mut self) -> &mut [u8] {
|
||||||
unsafe {
|
unsafe { slice::from_raw_parts_mut(self.map_info.data as *mut u8, self.map_info.size) }
|
||||||
slice::from_raw_parts_mut(self.map_info.data as *mut u8, self.map_info.size)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,9 +513,7 @@ impl<T> MappedBuffer<T> {
|
||||||
|
|
||||||
impl MappedBuffer<Writable> {
|
impl MappedBuffer<Writable> {
|
||||||
pub fn as_mut_slice(&mut self) -> &mut [u8] {
|
pub fn as_mut_slice(&mut self) -> &mut [u8] {
|
||||||
unsafe {
|
unsafe { slice::from_raw_parts_mut(self.map_info.data as *mut u8, self.map_info.size) }
|
||||||
slice::from_raw_parts_mut(self.map_info.data as *mut u8, self.map_info.size)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,10 +88,7 @@ impl ToOwned for BufferListRef {
|
||||||
type Owned = GstRc<BufferListRef>;
|
type Owned = GstRc<BufferListRef>;
|
||||||
|
|
||||||
fn to_owned(&self) -> GstRc<BufferListRef> {
|
fn to_owned(&self) -> GstRc<BufferListRef> {
|
||||||
unsafe {
|
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
|
||||||
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _)
|
|
||||||
as *mut _)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,9 +132,7 @@ impl Bus {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unset_sync_handler(&self) {
|
pub fn unset_sync_handler(&self) {
|
||||||
unsafe {
|
unsafe { ffi::gst_bus_set_sync_handler(self.to_glib_none().0, None, ptr::null_mut(), None) }
|
||||||
ffi::gst_bus_set_sync_handler(self.to_glib_none().0, None, ptr::null_mut(), None)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -359,10 +359,7 @@ impl ToOwned for CapsRef {
|
||||||
type Owned = GstRc<CapsRef>;
|
type Owned = GstRc<CapsRef>;
|
||||||
|
|
||||||
fn to_owned(&self) -> GstRc<CapsRef> {
|
fn to_owned(&self) -> GstRc<CapsRef> {
|
||||||
unsafe {
|
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
|
||||||
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _)
|
|
||||||
as *mut _)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,9 +59,7 @@ impl ContextRef {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_structure(&self) -> &StructureRef {
|
pub fn get_structure(&self) -> &StructureRef {
|
||||||
unsafe {
|
unsafe { StructureRef::from_glib_borrow(ffi::gst_context_get_structure(self.as_mut_ptr())) }
|
||||||
StructureRef::from_glib_borrow(ffi::gst_context_get_structure(self.as_mut_ptr()))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_mut_structure(&mut self) -> &mut StructureRef {
|
pub fn get_mut_structure(&mut self) -> &mut StructureRef {
|
||||||
|
@ -92,10 +90,7 @@ impl ToOwned for ContextRef {
|
||||||
type Owned = GstRc<ContextRef>;
|
type Owned = GstRc<ContextRef>;
|
||||||
|
|
||||||
fn to_owned(&self) -> GstRc<ContextRef> {
|
fn to_owned(&self) -> GstRc<ContextRef> {
|
||||||
unsafe {
|
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
|
||||||
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _)
|
|
||||||
as *mut _)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -454,10 +454,7 @@ impl ToOwned for EventRef {
|
||||||
type Owned = GstRc<EventRef>;
|
type Owned = GstRc<EventRef>;
|
||||||
|
|
||||||
fn to_owned(&self) -> GstRc<EventRef> {
|
fn to_owned(&self) -> GstRc<EventRef> {
|
||||||
unsafe {
|
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
|
||||||
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _)
|
|
||||||
as *mut _)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -884,7 +881,7 @@ impl<'a> EventBuilder<'a> {
|
||||||
Self {
|
Self {
|
||||||
seqnum: None,
|
seqnum: None,
|
||||||
running_time_offset: None,
|
running_time_offset: None,
|
||||||
other_fields: Vec::new()
|
other_fields: Vec::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -904,7 +901,9 @@ impl<'a> EventBuilder<'a> {
|
||||||
|
|
||||||
fn other_fields(self, other_fields: &[(&'a str, &'a ToSendValue)]) -> Self {
|
fn other_fields(self, other_fields: &[(&'a str, &'a ToSendValue)]) -> Self {
|
||||||
Self {
|
Self {
|
||||||
other_fields: self.other_fields.iter().cloned()
|
other_fields: self.other_fields
|
||||||
|
.iter()
|
||||||
|
.cloned()
|
||||||
.chain(other_fields.iter().cloned())
|
.chain(other_fields.iter().cloned())
|
||||||
.collect(),
|
.collect(),
|
||||||
..self
|
..self
|
||||||
|
@ -1618,7 +1617,7 @@ mod tests {
|
||||||
EventView::FlushStart(flush_start_evt) => {
|
EventView::FlushStart(flush_start_evt) => {
|
||||||
assert!(!flush_start_evt.is_sticky());
|
assert!(!flush_start_evt.is_sticky());
|
||||||
assert!(flush_start_evt.get_structure().is_none());
|
assert!(flush_start_evt.get_structure().is_none());
|
||||||
},
|
}
|
||||||
_ => panic!("flush_start_evt.view() is not an EventView::FlushStart(_)"),
|
_ => panic!("flush_start_evt.view() is not an EventView::FlushStart(_)"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1631,7 +1630,7 @@ mod tests {
|
||||||
if let Some(other_fields) = flush_start_evt.get_structure() {
|
if let Some(other_fields) = flush_start_evt.get_structure() {
|
||||||
assert!(other_fields.has_field("extra-field"));
|
assert!(other_fields.has_field("extra-field"));
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
_ => panic!("flush_start_evt.view() is not an EventView::FlushStart(_)"),
|
_ => panic!("flush_start_evt.view() is not an EventView::FlushStart(_)"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -372,10 +372,7 @@ impl ToOwned for MessageRef {
|
||||||
type Owned = GstRc<MessageRef>;
|
type Owned = GstRc<MessageRef>;
|
||||||
|
|
||||||
fn to_owned(&self) -> GstRc<MessageRef> {
|
fn to_owned(&self) -> GstRc<MessageRef> {
|
||||||
unsafe {
|
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
|
||||||
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _)
|
|
||||||
as *mut _)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1171,7 +1168,7 @@ impl<'a> MessageBuilder<'a> {
|
||||||
Self {
|
Self {
|
||||||
src: None,
|
src: None,
|
||||||
seqnum: None,
|
seqnum: None,
|
||||||
other_fields: Vec::new()
|
other_fields: Vec::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1284,7 +1281,8 @@ pub struct ErrorBuilder<'a, T> {
|
||||||
error: T,
|
error: T,
|
||||||
message: &'a str,
|
message: &'a str,
|
||||||
debug: Option<&'a str>,
|
debug: Option<&'a str>,
|
||||||
#[allow(unused)] details: Option<Structure>,
|
#[allow(unused)]
|
||||||
|
details: Option<Structure>,
|
||||||
}
|
}
|
||||||
impl<'a, T: MessageErrorDomain> ErrorBuilder<'a, T> {
|
impl<'a, T: MessageErrorDomain> ErrorBuilder<'a, T> {
|
||||||
fn new(error: T, message: &'a str) -> Self {
|
fn new(error: T, message: &'a str) -> Self {
|
||||||
|
@ -1348,7 +1346,8 @@ pub struct WarningBuilder<'a, T> {
|
||||||
error: T,
|
error: T,
|
||||||
message: &'a str,
|
message: &'a str,
|
||||||
debug: Option<&'a str>,
|
debug: Option<&'a str>,
|
||||||
#[allow(unused)] details: Option<Structure>,
|
#[allow(unused)]
|
||||||
|
details: Option<Structure>,
|
||||||
}
|
}
|
||||||
impl<'a, T: MessageErrorDomain> WarningBuilder<'a, T> {
|
impl<'a, T: MessageErrorDomain> WarningBuilder<'a, T> {
|
||||||
fn new(error: T, message: &'a str) -> Self {
|
fn new(error: T, message: &'a str) -> Self {
|
||||||
|
@ -1412,7 +1411,8 @@ pub struct InfoBuilder<'a, T> {
|
||||||
error: T,
|
error: T,
|
||||||
message: &'a str,
|
message: &'a str,
|
||||||
debug: Option<&'a str>,
|
debug: Option<&'a str>,
|
||||||
#[allow(unused)] details: Option<Structure>,
|
#[allow(unused)]
|
||||||
|
details: Option<Structure>,
|
||||||
}
|
}
|
||||||
impl<'a, T: MessageErrorDomain> InfoBuilder<'a, T> {
|
impl<'a, T: MessageErrorDomain> InfoBuilder<'a, T> {
|
||||||
fn new(error: T, message: &'a str) -> Self {
|
fn new(error: T, message: &'a str) -> Self {
|
||||||
|
@ -2241,8 +2241,10 @@ impl<'a> StreamCollectionBuilder<'a> {
|
||||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||||
pub struct StreamsSelectedBuilder<'a> {
|
pub struct StreamsSelectedBuilder<'a> {
|
||||||
builder: MessageBuilder<'a>,
|
builder: MessageBuilder<'a>,
|
||||||
#[cfg(any(feature = "v1_10", feature = "dox"))] collection: &'a ::StreamCollection,
|
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||||
#[cfg(any(feature = "v1_10", feature = "dox"))] streams: Option<&'a [&'a ::Stream]>,
|
collection: &'a ::StreamCollection,
|
||||||
|
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||||
|
streams: Option<&'a [&'a ::Stream]>,
|
||||||
}
|
}
|
||||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||||
impl<'a> StreamsSelectedBuilder<'a> {
|
impl<'a> StreamsSelectedBuilder<'a> {
|
||||||
|
@ -2363,14 +2365,12 @@ mod tests {
|
||||||
::init().unwrap();
|
::init().unwrap();
|
||||||
|
|
||||||
// Message without arguments
|
// Message without arguments
|
||||||
let eos_msg = Message::new_eos()
|
let eos_msg = Message::new_eos().seqnum(Seqnum(1)).build();
|
||||||
.seqnum(Seqnum(1))
|
|
||||||
.build();
|
|
||||||
match eos_msg.view() {
|
match eos_msg.view() {
|
||||||
MessageView::Eos(eos_msg) => {
|
MessageView::Eos(eos_msg) => {
|
||||||
assert_eq!(eos_msg.get_seqnum(), Seqnum(1));
|
assert_eq!(eos_msg.get_seqnum(), Seqnum(1));
|
||||||
assert!(eos_msg.get_structure().is_none());
|
assert!(eos_msg.get_structure().is_none());
|
||||||
},
|
}
|
||||||
_ => panic!("eos_msg.view() is not a MessageView::Eos(_)"),
|
_ => panic!("eos_msg.view() is not a MessageView::Eos(_)"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,9 +66,10 @@ impl<T: MiniObject> GstRc<T> {
|
||||||
return &mut *self.obj;
|
return &mut *self.obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.obj = T::from_mut_ptr(ffi::gst_mini_object_make_writable(self.as_mut_ptr()
|
self.obj = T::from_mut_ptr(
|
||||||
as *mut ffi::GstMiniObject)
|
ffi::gst_mini_object_make_writable(self.as_mut_ptr() as *mut ffi::GstMiniObject)
|
||||||
as *mut T::GstType);
|
as *mut T::GstType,
|
||||||
|
);
|
||||||
assert!(self.is_writable());
|
assert!(self.is_writable());
|
||||||
|
|
||||||
&mut *self.obj
|
&mut *self.obj
|
||||||
|
@ -85,8 +86,7 @@ impl<T: MiniObject> GstRc<T> {
|
||||||
|
|
||||||
pub fn is_writable(&self) -> bool {
|
pub fn is_writable(&self) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib(ffi::gst_mini_object_is_writable(self.as_ptr()
|
from_glib(ffi::gst_mini_object_is_writable(self.as_ptr() as *const ffi::GstMiniObject))
|
||||||
as *const ffi::GstMiniObject))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,9 +191,10 @@ where
|
||||||
|
|
||||||
fn copy(&self) -> GstRc<Self> {
|
fn copy(&self) -> GstRc<Self> {
|
||||||
unsafe {
|
unsafe {
|
||||||
GstRc::from_glib_full(ffi::gst_mini_object_copy(self.as_ptr()
|
GstRc::from_glib_full(
|
||||||
as *const ffi::GstMiniObject)
|
ffi::gst_mini_object_copy(self.as_ptr() as *const ffi::GstMiniObject)
|
||||||
as *const Self::GstType)
|
as *const Self::GstType,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,7 +288,8 @@ impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *mut *mut T::GstT
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *const *mut T::GstType>
|
impl<'a, T: MiniObject + 'static> ToGlibContainerFromSlice<'a, *const *mut T::GstType>
|
||||||
for GstRc<T> {
|
for GstRc<T>
|
||||||
|
{
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
|
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
|
||||||
type Storage = (
|
type Storage = (
|
||||||
Vec<Stash<'a, *mut T::GstType, GstRc<T>>>,
|
Vec<Stash<'a, *mut T::GstType, GstRc<T>>>,
|
||||||
|
@ -351,7 +353,8 @@ impl<T: MiniObject + 'static> FromGlibPtrBorrow<*mut T::GstType> for GstRc<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: MiniObject + 'static> FromGlibContainerAsVec<*mut T::GstType, *mut *mut T::GstType>
|
impl<T: MiniObject + 'static> FromGlibContainerAsVec<*mut T::GstType, *mut *mut T::GstType>
|
||||||
for GstRc<T> {
|
for GstRc<T>
|
||||||
|
{
|
||||||
unsafe fn from_glib_none_num_as_vec(ptr: *mut *mut T::GstType, num: usize) -> Vec<Self> {
|
unsafe fn from_glib_none_num_as_vec(ptr: *mut *mut T::GstType, num: usize) -> Vec<Self> {
|
||||||
if num == 0 || ptr.is_null() {
|
if num == 0 || ptr.is_null() {
|
||||||
return Vec::new();
|
return Vec::new();
|
||||||
|
@ -385,7 +388,8 @@ impl<T: MiniObject + 'static> FromGlibContainerAsVec<*mut T::GstType, *mut *mut
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: MiniObject + 'static> FromGlibPtrArrayContainerAsVec<*mut T::GstType, *mut *mut T::GstType>
|
impl<T: MiniObject + 'static> FromGlibPtrArrayContainerAsVec<*mut T::GstType, *mut *mut T::GstType>
|
||||||
for GstRc<T> {
|
for GstRc<T>
|
||||||
|
{
|
||||||
unsafe fn from_glib_none_as_vec(ptr: *mut *mut T::GstType) -> Vec<Self> {
|
unsafe fn from_glib_none_as_vec(ptr: *mut *mut T::GstType) -> Vec<Self> {
|
||||||
FromGlibContainerAsVec::from_glib_none_num_as_vec(ptr, c_ptr_array_len(ptr))
|
FromGlibContainerAsVec::from_glib_none_num_as_vec(ptr, c_ptr_array_len(ptr))
|
||||||
}
|
}
|
||||||
|
@ -400,7 +404,8 @@ impl<T: MiniObject + 'static> FromGlibPtrArrayContainerAsVec<*mut T::GstType, *m
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: MiniObject + 'static> FromGlibContainerAsVec<*mut T::GstType, *const *mut T::GstType>
|
impl<T: MiniObject + 'static> FromGlibContainerAsVec<*mut T::GstType, *const *mut T::GstType>
|
||||||
for GstRc<T> {
|
for GstRc<T>
|
||||||
|
{
|
||||||
unsafe fn from_glib_none_num_as_vec(ptr: *const *mut T::GstType, num: usize) -> Vec<Self> {
|
unsafe fn from_glib_none_num_as_vec(ptr: *const *mut T::GstType, num: usize) -> Vec<Self> {
|
||||||
FromGlibContainerAsVec::from_glib_none_num_as_vec(ptr as *mut *mut _, num)
|
FromGlibContainerAsVec::from_glib_none_num_as_vec(ptr as *mut *mut _, num)
|
||||||
}
|
}
|
||||||
|
@ -418,7 +423,8 @@ impl<T: MiniObject + 'static> FromGlibContainerAsVec<*mut T::GstType, *const *mu
|
||||||
|
|
||||||
impl<
|
impl<
|
||||||
T: MiniObject + 'static,
|
T: MiniObject + 'static,
|
||||||
> FromGlibPtrArrayContainerAsVec<*mut T::GstType, *const *mut T::GstType> for GstRc<T> {
|
> FromGlibPtrArrayContainerAsVec<*mut T::GstType, *const *mut T::GstType> for GstRc<T>
|
||||||
|
{
|
||||||
unsafe fn from_glib_none_as_vec(ptr: *const *mut T::GstType) -> Vec<Self> {
|
unsafe fn from_glib_none_as_vec(ptr: *const *mut T::GstType) -> Vec<Self> {
|
||||||
FromGlibPtrArrayContainerAsVec::from_glib_none_as_vec(ptr as *mut *mut _)
|
FromGlibPtrArrayContainerAsVec::from_glib_none_as_vec(ptr as *mut *mut _)
|
||||||
}
|
}
|
||||||
|
@ -441,7 +447,8 @@ impl<T: MiniObject + glib::StaticType> glib::StaticType for GstRc<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: MiniObject + glib::StaticType + 'static> glib::value::FromValueOptional<'a>
|
impl<'a, T: MiniObject + glib::StaticType + 'static> glib::value::FromValueOptional<'a>
|
||||||
for GstRc<T> {
|
for GstRc<T>
|
||||||
|
{
|
||||||
unsafe fn from_value_optional(v: &'a glib::Value) -> Option<Self> {
|
unsafe fn from_value_optional(v: &'a glib::Value) -> Option<Self> {
|
||||||
let ptr = gobject_ffi::g_value_get_boxed(v.to_glib_none().0);
|
let ptr = gobject_ffi::g_value_get_boxed(v.to_glib_none().0);
|
||||||
from_glib_none(ptr as *const T::GstType)
|
from_glib_none(ptr as *const T::GstType)
|
||||||
|
|
|
@ -35,120 +35,80 @@ unsafe impl MiniObject for QueryRef {
|
||||||
impl GstRc<QueryRef> {
|
impl GstRc<QueryRef> {
|
||||||
pub fn new_position(fmt: ::Format) -> Position<Self> {
|
pub fn new_position(fmt: ::Format) -> Position<Self> {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe { Position::<Self>(from_glib_full(ffi::gst_query_new_position(fmt.to_glib()))) }
|
||||||
Position::<Self>(
|
|
||||||
from_glib_full(ffi::gst_query_new_position(fmt.to_glib()))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_duration(fmt: ::Format) -> Duration<Self> {
|
pub fn new_duration(fmt: ::Format) -> Duration<Self> {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe { Duration::<Self>(from_glib_full(ffi::gst_query_new_duration(fmt.to_glib()))) }
|
||||||
Duration::<Self>(
|
|
||||||
from_glib_full(ffi::gst_query_new_duration(fmt.to_glib()))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_latency() -> Latency<Self> {
|
pub fn new_latency() -> Latency<Self> {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe { Latency::<Self>(from_glib_full(ffi::gst_query_new_latency())) }
|
||||||
Latency::<Self>(
|
|
||||||
from_glib_full(ffi::gst_query_new_latency())
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_seeking(fmt: ::Format) -> Seeking<Self> {
|
pub fn new_seeking(fmt: ::Format) -> Seeking<Self> {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe { Seeking::<Self>(from_glib_full(ffi::gst_query_new_seeking(fmt.to_glib()))) }
|
||||||
Seeking::<Self>(
|
|
||||||
from_glib_full(ffi::gst_query_new_seeking(fmt.to_glib()))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_segment(fmt: ::Format) -> Segment<Self> {
|
pub fn new_segment(fmt: ::Format) -> Segment<Self> {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe { Segment::<Self>(from_glib_full(ffi::gst_query_new_segment(fmt.to_glib()))) }
|
||||||
Segment::<Self>(
|
|
||||||
from_glib_full(ffi::gst_query_new_segment(fmt.to_glib()))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_convert<V: Into<GenericFormattedValue>>(
|
pub fn new_convert<V: Into<GenericFormattedValue>>(
|
||||||
value: V,
|
value: V,
|
||||||
dest_fmt: ::Format
|
dest_fmt: ::Format,
|
||||||
) -> Convert<Self> {
|
) -> Convert<Self> {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
let value = value.into();
|
let value = value.into();
|
||||||
unsafe {
|
unsafe {
|
||||||
Convert::<Self>(
|
Convert::<Self>(from_glib_full(ffi::gst_query_new_convert(
|
||||||
from_glib_full(ffi::gst_query_new_convert(
|
|
||||||
value.get_format().to_glib(),
|
value.get_format().to_glib(),
|
||||||
value.get_value(),
|
value.get_value(),
|
||||||
dest_fmt.to_glib(),
|
dest_fmt.to_glib(),
|
||||||
))
|
)))
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_formats() -> Formats<Self> {
|
pub fn new_formats() -> Formats<Self> {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe { Formats::<Self>(from_glib_full(ffi::gst_query_new_formats())) }
|
||||||
Formats::<Self>(
|
|
||||||
from_glib_full(ffi::gst_query_new_formats())
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_buffering(fmt: ::Format) -> Buffering<Self> {
|
pub fn new_buffering(fmt: ::Format) -> Buffering<Self> {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe { Buffering::<Self>(from_glib_full(ffi::gst_query_new_buffering(fmt.to_glib()))) }
|
||||||
Buffering::<Self>(
|
|
||||||
from_glib_full(ffi::gst_query_new_buffering(fmt.to_glib()))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_custom(structure: ::Structure) -> Custom<Self> {
|
pub fn new_custom(structure: ::Structure) -> Custom<Self> {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe {
|
||||||
Custom::<Self>(
|
Custom::<Self>(from_glib_full(ffi::gst_query_new_custom(
|
||||||
from_glib_full(ffi::gst_query_new_custom(
|
|
||||||
ffi::GST_QUERY_CUSTOM,
|
ffi::GST_QUERY_CUSTOM,
|
||||||
structure.into_ptr(),
|
structure.into_ptr(),
|
||||||
))
|
)))
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_uri() -> Uri<Self> {
|
pub fn new_uri() -> Uri<Self> {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe { Uri::<Self>(from_glib_full(ffi::gst_query_new_uri())) }
|
||||||
Uri::<Self>(
|
|
||||||
from_glib_full(ffi::gst_query_new_uri())
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_scheduling() -> Scheduling<Self> {
|
pub fn new_scheduling() -> Scheduling<Self> {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe { Scheduling::<Self>(from_glib_full(ffi::gst_query_new_scheduling())) }
|
||||||
Scheduling::<Self>(
|
|
||||||
from_glib_full(ffi::gst_query_new_scheduling())
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_accept_caps(caps: &::Caps) -> AcceptCaps<Self> {
|
pub fn new_accept_caps(caps: &::Caps) -> AcceptCaps<Self> {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe {
|
||||||
AcceptCaps::<Self>(
|
AcceptCaps::<Self>(from_glib_full(ffi::gst_query_new_accept_caps(
|
||||||
from_glib_full(ffi::gst_query_new_accept_caps(caps.as_mut_ptr()))
|
caps.as_mut_ptr(),
|
||||||
)
|
)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,27 +116,23 @@ impl GstRc<QueryRef> {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
let filter = filter.into();
|
let filter = filter.into();
|
||||||
unsafe {
|
unsafe {
|
||||||
Caps::<Self>(
|
Caps::<Self>(from_glib_full(ffi::gst_query_new_caps(
|
||||||
from_glib_full(ffi::gst_query_new_caps(filter.to_glib_none().0))
|
filter.to_glib_none().0,
|
||||||
)
|
)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_drain() -> Drain<Self> {
|
pub fn new_drain() -> Drain<Self> {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe { Drain::<Self>(from_glib_full(ffi::gst_query_new_drain())) }
|
||||||
Drain::<Self>(
|
|
||||||
from_glib_full(ffi::gst_query_new_drain())
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_context(context_type: &str) -> Context<Self> {
|
pub fn new_context(context_type: &str) -> Context<Self> {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe {
|
||||||
Context::<Self>(
|
Context::<Self>(from_glib_full(ffi::gst_query_new_context(
|
||||||
from_glib_full(ffi::gst_query_new_context(context_type.to_glib_none().0))
|
context_type.to_glib_none().0,
|
||||||
)
|
)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,21 +157,15 @@ impl QueryRef {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_downstream(&self) -> bool {
|
pub fn is_downstream(&self) -> bool {
|
||||||
unsafe {
|
unsafe { ((*self.as_ptr()).type_ as u32) & (ffi::GST_QUERY_TYPE_DOWNSTREAM.bits()) != 0 }
|
||||||
((*self.as_ptr()).type_ as u32) & (ffi::GST_QUERY_TYPE_DOWNSTREAM.bits()) != 0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_upstream(&self) -> bool {
|
pub fn is_upstream(&self) -> bool {
|
||||||
unsafe {
|
unsafe { ((*self.as_ptr()).type_ as u32) & (ffi::GST_QUERY_TYPE_UPSTREAM.bits()) != 0 }
|
||||||
((*self.as_ptr()).type_ as u32) & (ffi::GST_QUERY_TYPE_UPSTREAM.bits()) != 0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_serialized(&self) -> bool {
|
pub fn is_serialized(&self) -> bool {
|
||||||
unsafe {
|
unsafe { ((*self.as_ptr()).type_ as u32) & (ffi::GST_QUERY_TYPE_SERIALIZED.bits()) != 0 }
|
||||||
((*self.as_ptr()).type_ as u32) & (ffi::GST_QUERY_TYPE_SERIALIZED.bits()) != 0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn view(&self) -> QueryView<&Self> {
|
pub fn view(&self) -> QueryView<&Self> {
|
||||||
|
@ -1128,7 +1078,9 @@ mod tests {
|
||||||
QueryView::Position(ref p) => {
|
QueryView::Position(ref p) => {
|
||||||
let pos = p.get_result();
|
let pos = p.get_result();
|
||||||
assert_eq!(pos.try_into_time(), Ok(3 * ::SECOND));
|
assert_eq!(pos.try_into_time(), Ok(3 * ::SECOND));
|
||||||
unsafe { assert!(!p.as_mut_ptr().is_null()); }
|
unsafe {
|
||||||
|
assert!(!p.as_mut_ptr().is_null());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_ => panic!("Wrong concrete Query in Query"),
|
_ => panic!("Wrong concrete Query in Query"),
|
||||||
}
|
}
|
||||||
|
@ -1168,7 +1120,7 @@ mod tests {
|
||||||
match query.view_mut() {
|
match query.view_mut() {
|
||||||
QueryView::Duration(ref mut d) => {
|
QueryView::Duration(ref mut d) => {
|
||||||
d.set(2 * ::SECOND);
|
d.set(2 * ::SECOND);
|
||||||
},
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1176,7 +1128,7 @@ mod tests {
|
||||||
QueryView::Duration(ref d) => {
|
QueryView::Duration(ref d) => {
|
||||||
let duration = d.get_result();
|
let duration = d.get_result();
|
||||||
assert_eq!(duration.try_into_time(), Ok(2 * ::SECOND));
|
assert_eq!(duration.try_into_time(), Ok(2 * ::SECOND));
|
||||||
},
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1186,6 +1138,8 @@ mod tests {
|
||||||
::init().unwrap();
|
::init().unwrap();
|
||||||
|
|
||||||
let p = Query::new_position(::Format::Time);
|
let p = Query::new_position(::Format::Time);
|
||||||
unsafe { assert!(!p.as_mut_ptr().is_null()); }
|
unsafe {
|
||||||
|
assert!(!p.as_mut_ptr().is_null());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,10 +110,7 @@ impl ToOwned for SampleRef {
|
||||||
type Owned = GstRc<SampleRef>;
|
type Owned = GstRc<SampleRef>;
|
||||||
|
|
||||||
fn to_owned(&self) -> GstRc<SampleRef> {
|
fn to_owned(&self) -> GstRc<SampleRef> {
|
||||||
unsafe {
|
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
|
||||||
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _)
|
|
||||||
as *mut _)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -567,8 +567,7 @@ impl<T: FormattedValue> glib::types::StaticType for FormattedSegment<T> {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl<'a> glib::value::FromValueOptional<'a> for Segment {
|
impl<'a> glib::value::FromValueOptional<'a> for Segment {
|
||||||
unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> {
|
unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> {
|
||||||
Option::<Segment>::from_glib_none(gobject_ffi::g_value_get_boxed(value.to_glib_none().0)
|
Option::<Segment>::from_glib_none(gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as *mut ffi::GstSegment)
|
||||||
as *mut ffi::GstSegment)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,7 +600,8 @@ impl<T: FormattedValue> glib::translate::GlibPtrDefault for FormattedSegment<T>
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl<'a, T: FormattedValue> glib::translate::ToGlibPtr<'a, *const ffi::GstSegment>
|
impl<'a, T: FormattedValue> glib::translate::ToGlibPtr<'a, *const ffi::GstSegment>
|
||||||
for FormattedSegment<T> {
|
for FormattedSegment<T>
|
||||||
|
{
|
||||||
type Storage = &'a FormattedSegment<T>;
|
type Storage = &'a FormattedSegment<T>;
|
||||||
|
|
||||||
fn to_glib_none(&'a self) -> glib::translate::Stash<'a, *const ffi::GstSegment, Self> {
|
fn to_glib_none(&'a self) -> glib::translate::Stash<'a, *const ffi::GstSegment, Self> {
|
||||||
|
@ -615,7 +615,8 @@ impl<'a, T: FormattedValue> glib::translate::ToGlibPtr<'a, *const ffi::GstSegmen
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl<'a, T: FormattedValue> glib::translate::ToGlibPtrMut<'a, *mut ffi::GstSegment>
|
impl<'a, T: FormattedValue> glib::translate::ToGlibPtrMut<'a, *mut ffi::GstSegment>
|
||||||
for FormattedSegment<T> {
|
for FormattedSegment<T>
|
||||||
|
{
|
||||||
type Storage = &'a mut FormattedSegment<T>;
|
type Storage = &'a mut FormattedSegment<T>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -36,8 +36,7 @@ impl glib::types::StaticType for StaticCaps {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl<'a> glib::value::FromValueOptional<'a> for StaticCaps {
|
impl<'a> glib::value::FromValueOptional<'a> for StaticCaps {
|
||||||
unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> {
|
unsafe fn from_value_optional(value: &glib::Value) -> Option<Self> {
|
||||||
Option::<StaticCaps>::from_glib_none(gobject_ffi::g_value_get_boxed(value.to_glib_none().0)
|
Option::<StaticCaps>::from_glib_none(gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as *mut ffi::GstStaticCaps)
|
||||||
as *mut ffi::GstStaticCaps)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,7 @@ impl Structure {
|
||||||
pub fn new_empty(name: &str) -> Structure {
|
pub fn new_empty(name: &str) -> Structure {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
Structure(
|
Structure(
|
||||||
unsafe {
|
unsafe { ffi::gst_structure_new_empty(name.to_glib_none().0) as *mut StructureRef },
|
||||||
ffi::gst_structure_new_empty(name.to_glib_none().0) as *mut StructureRef
|
|
||||||
},
|
|
||||||
PhantomData,
|
PhantomData,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -306,9 +306,7 @@ impl TagListRef {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_size<'a, T: Tag<'a>>(&'a self) -> u32 {
|
pub fn get_size<'a, T: Tag<'a>>(&'a self) -> u32 {
|
||||||
unsafe {
|
unsafe { ffi::gst_tag_list_get_tag_size(self.as_ptr(), T::tag_name().to_glib_none().0) }
|
||||||
ffi::gst_tag_list_get_tag_size(self.as_ptr(), T::tag_name().to_glib_none().0)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn iter_tag<'a, T: Tag<'a>>(&'a self) -> TagIterator<'a, T> {
|
pub fn iter_tag<'a, T: Tag<'a>>(&'a self) -> TagIterator<'a, T> {
|
||||||
|
@ -320,9 +318,7 @@ impl TagListRef {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn insert(&mut self, other: &TagListRef, mode: TagMergeMode) {
|
pub fn insert(&mut self, other: &TagListRef, mode: TagMergeMode) {
|
||||||
unsafe {
|
unsafe { ffi::gst_tag_list_insert(self.as_mut_ptr(), other.as_ptr(), mode.to_glib()) }
|
||||||
ffi::gst_tag_list_insert(self.as_mut_ptr(), other.as_ptr(), mode.to_glib())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn merge(&self, other: &TagListRef, mode: TagMergeMode) -> TagList {
|
pub fn merge(&self, other: &TagListRef, mode: TagMergeMode) -> TagList {
|
||||||
|
@ -360,10 +356,7 @@ impl ToOwned for TagListRef {
|
||||||
type Owned = GstRc<TagListRef>;
|
type Owned = GstRc<TagListRef>;
|
||||||
|
|
||||||
fn to_owned(&self) -> GstRc<TagListRef> {
|
fn to_owned(&self) -> GstRc<TagListRef> {
|
||||||
unsafe {
|
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
|
||||||
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _)
|
|
||||||
as *mut _)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,15 +43,11 @@ impl TocRef {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn find_entry(&self, uid: &str) -> Option<TocEntry> {
|
pub fn find_entry(&self, uid: &str) -> Option<TocEntry> {
|
||||||
unsafe {
|
unsafe { from_glib_none(ffi::gst_toc_find_entry(self.as_ptr(), uid.to_glib_none().0)) }
|
||||||
from_glib_none(ffi::gst_toc_find_entry(self.as_ptr(), uid.to_glib_none().0))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_entries(&self) -> Vec<TocEntry> {
|
pub fn get_entries(&self) -> Vec<TocEntry> {
|
||||||
unsafe {
|
unsafe { FromGlibPtrContainer::from_glib_none(ffi::gst_toc_get_entries(self.as_ptr())) }
|
||||||
FromGlibPtrContainer::from_glib_none(ffi::gst_toc_get_entries(self.as_ptr()))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn append_entry(&mut self, entry: TocEntry) {
|
pub fn append_entry(&mut self, entry: TocEntry) {
|
||||||
|
@ -93,10 +89,7 @@ impl ToOwned for TocRef {
|
||||||
type Owned = GstRc<TocRef>;
|
type Owned = GstRc<TocRef>;
|
||||||
|
|
||||||
fn to_owned(&self) -> GstRc<TocRef> {
|
fn to_owned(&self) -> GstRc<TocRef> {
|
||||||
unsafe {
|
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
|
||||||
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _)
|
|
||||||
as *mut _)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,10 +234,7 @@ impl ToOwned for TocEntryRef {
|
||||||
type Owned = GstRc<TocEntryRef>;
|
type Owned = GstRc<TocEntryRef>;
|
||||||
|
|
||||||
fn to_owned(&self) -> GstRc<TocEntryRef> {
|
fn to_owned(&self) -> GstRc<TocEntryRef> {
|
||||||
unsafe {
|
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
|
||||||
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _)
|
|
||||||
as *mut _)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,11 @@ fn tutorial_main() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
MessageView::StateChanged(state_changed) => {
|
MessageView::StateChanged(state_changed) => {
|
||||||
if state_changed.get_src().map(|s| s == pipeline).unwrap_or(false) {
|
if state_changed
|
||||||
|
.get_src()
|
||||||
|
.map(|s| s == pipeline)
|
||||||
|
.unwrap_or(false)
|
||||||
|
{
|
||||||
println!(
|
println!(
|
||||||
"Pipeline state changed from {:?} to {:?}",
|
"Pipeline state changed from {:?} to {:?}",
|
||||||
state_changed.get_old(),
|
state_changed.get_old(),
|
||||||
|
|
|
@ -114,7 +114,8 @@ fn handle_message(custom_data: &mut CustomData, msg: &gst::GstRc<gst::MessageRef
|
||||||
// The duration has changed, mark the current one as invalid
|
// The duration has changed, mark the current one as invalid
|
||||||
custom_data.duration = gst::CLOCK_TIME_NONE;
|
custom_data.duration = gst::CLOCK_TIME_NONE;
|
||||||
}
|
}
|
||||||
MessageView::StateChanged(state_changed) => if state_changed.get_src()
|
MessageView::StateChanged(state_changed) => if state_changed
|
||||||
|
.get_src()
|
||||||
.map(|s| s == custom_data.playbin)
|
.map(|s| s == custom_data.playbin)
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
{
|
{
|
||||||
|
|
|
@ -347,7 +347,11 @@ mod tutorial5 {
|
||||||
// This is called when the pipeline changes states. We use it to
|
// This is called when the pipeline changes states. We use it to
|
||||||
// keep track of the current state.
|
// keep track of the current state.
|
||||||
gst::MessageView::StateChanged(state_changed) => {
|
gst::MessageView::StateChanged(state_changed) => {
|
||||||
if state_changed.get_src().map(|s| s == pipeline).unwrap_or(false) {
|
if state_changed
|
||||||
|
.get_src()
|
||||||
|
.map(|s| s == pipeline)
|
||||||
|
.unwrap_or(false)
|
||||||
|
{
|
||||||
println!("State set to {:?}", state_changed.get_current());
|
println!("State set to {:?}", state_changed.get_current());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue