mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 09:31:06 +00:00
Run everything through latest rustfmt
This commit is contained in:
parent
8f9c0a72e0
commit
33a6aab6d7
44 changed files with 542 additions and 234 deletions
|
@ -27,7 +27,12 @@ mod examples_common;
|
|||
struct MissingElement(&'static str);
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[fail(display = "Received error from {}: {} (debug: {:?})", src, error, debug)]
|
||||
#[fail(
|
||||
display = "Received error from {}: {} (debug: {:?})",
|
||||
src,
|
||||
error,
|
||||
debug
|
||||
)]
|
||||
struct ErrorMessage {
|
||||
src: String,
|
||||
error: String,
|
||||
|
@ -138,7 +143,8 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> {
|
|||
MessageView::Error(err) => {
|
||||
pipeline.set_state(gst::State::Null).into_result()?;
|
||||
Err(ErrorMessage {
|
||||
src: err.get_src()
|
||||
src: err
|
||||
.get_src()
|
||||
.map(|s| s.get_path_string())
|
||||
.unwrap_or_else(|| String::from("None")),
|
||||
error: err.get_error().description().into(),
|
||||
|
|
|
@ -21,7 +21,12 @@ mod examples_common;
|
|||
struct MissingElement(&'static str);
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[fail(display = "Received error from {}: {} (debug: {:?})", src, error, debug)]
|
||||
#[fail(
|
||||
display = "Received error from {}: {} (debug: {:?})",
|
||||
src,
|
||||
error,
|
||||
debug
|
||||
)]
|
||||
struct ErrorMessage {
|
||||
src: String,
|
||||
error: String,
|
||||
|
@ -122,7 +127,8 @@ fn main_loop(pipeline: gst::Pipeline) -> Result<(), Error> {
|
|||
MessageView::Error(err) => {
|
||||
pipeline.set_state(gst::State::Null).into_result()?;
|
||||
Err(ErrorMessage {
|
||||
src: err.get_src()
|
||||
src: err
|
||||
.get_src()
|
||||
.map(|s| s.get_path_string())
|
||||
.unwrap_or_else(|| String::from("None")),
|
||||
error: err.get_error().description().into(),
|
||||
|
|
|
@ -23,7 +23,12 @@ mod examples_common;
|
|||
struct MissingElement(&'static str);
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[fail(display = "Received error from {}: {} (debug: {:?})", src, error, debug)]
|
||||
#[fail(
|
||||
display = "Received error from {}: {} (debug: {:?})",
|
||||
src,
|
||||
error,
|
||||
debug
|
||||
)]
|
||||
struct ErrorMessage {
|
||||
src: String,
|
||||
error: String,
|
||||
|
@ -177,7 +182,8 @@ fn example_main() -> Result<(), Error> {
|
|||
.map(Result::Err)
|
||||
.expect("error-details message without actual error"),
|
||||
_ => Err(ErrorMessage {
|
||||
src: err.get_src()
|
||||
src: err
|
||||
.get_src()
|
||||
.map(|s| s.get_path_string())
|
||||
.unwrap_or_else(|| String::from("None")),
|
||||
error: err.get_error().description().into(),
|
||||
|
@ -189,7 +195,8 @@ fn example_main() -> Result<(), Error> {
|
|||
#[cfg(not(feature = "v1_10"))]
|
||||
{
|
||||
Err(ErrorMessage {
|
||||
src: err.get_src()
|
||||
src: err
|
||||
.get_src()
|
||||
.map(|s| s.get_path_string())
|
||||
.unwrap_or_else(|| String::from("None")),
|
||||
error: err.get_error().description().into(),
|
||||
|
|
|
@ -51,13 +51,17 @@ fn print_stream_info(stream: &DiscovererStreamInfo) {
|
|||
}
|
||||
|
||||
fn print_discoverer_info(info: &DiscovererInfo) -> Result<(), Error> {
|
||||
let uri = info.get_uri()
|
||||
let uri = info
|
||||
.get_uri()
|
||||
.ok_or(DiscovererError("URI should not be null"))?;
|
||||
println!("URI: {}", uri);
|
||||
println!("Duration: {}", info.get_duration());
|
||||
print_tags(info);
|
||||
print_stream_info(&info.get_stream_info()
|
||||
.ok_or(DiscovererError("Error while obtaining stream info"))?);
|
||||
print_stream_info(
|
||||
&info
|
||||
.get_stream_info()
|
||||
.ok_or(DiscovererError("Error while obtaining stream info"))?,
|
||||
);
|
||||
|
||||
let children = info.get_stream_list();
|
||||
println!("Children streams:");
|
||||
|
|
|
@ -9,8 +9,8 @@ use gio::prelude::*;
|
|||
extern crate gtk;
|
||||
use gtk::prelude::*;
|
||||
|
||||
use std::env;
|
||||
use std::cell::RefCell;
|
||||
use std::env;
|
||||
|
||||
fn create_ui(app: >k::Application) {
|
||||
let pipeline = gst::Pipeline::new(None);
|
||||
|
|
|
@ -46,7 +46,8 @@ fn create_ui(app: >k::Application) {
|
|||
|
||||
let video_window = gtk::DrawingArea::new();
|
||||
video_window.set_size_request(320, 240);
|
||||
let video_overlay = sink.clone()
|
||||
let video_overlay = sink
|
||||
.clone()
|
||||
.dynamic_cast::<gst_video::VideoOverlay>()
|
||||
.unwrap()
|
||||
.downgrade();
|
||||
|
|
|
@ -17,13 +17,9 @@ fn example_main() {
|
|||
"audiotestsrc name=src ! audio/x-raw,format={},channels=1 ! fakesink",
|
||||
gst_audio::AUDIO_FORMAT_S16.to_string()
|
||||
)).unwrap();
|
||||
let pipeline = pipeline
|
||||
.dynamic_cast::<gst::Pipeline>()
|
||||
.unwrap();
|
||||
let pipeline = pipeline.dynamic_cast::<gst::Pipeline>().unwrap();
|
||||
|
||||
let src = pipeline
|
||||
.get_by_name("src")
|
||||
.unwrap();
|
||||
let src = pipeline.get_by_name("src").unwrap();
|
||||
let src_pad = src.get_static_pad("src").unwrap();
|
||||
src_pad.add_probe(gst::PadProbeType::BUFFER, |_, probe_info| {
|
||||
if let Some(gst::PadProbeData::Buffer(ref buffer)) = probe_info.data {
|
||||
|
|
|
@ -33,7 +33,12 @@ struct UnknownPT(u32);
|
|||
struct UsageError(String);
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[fail(display = "Received error from {}: {} (debug: {:?})", src, error, debug)]
|
||||
#[fail(
|
||||
display = "Received error from {}: {} (debug: {:?})",
|
||||
src,
|
||||
error,
|
||||
debug
|
||||
)]
|
||||
struct ErrorMessage {
|
||||
src: String,
|
||||
error: String,
|
||||
|
@ -254,7 +259,8 @@ fn example_main() -> Result<(), Error> {
|
|||
assert_ne!(ret, gst::StateChangeReturn::Failure);
|
||||
|
||||
return Err(ErrorMessage {
|
||||
src: msg.get_src()
|
||||
src: msg
|
||||
.get_src()
|
||||
.map(|s| s.get_path_string())
|
||||
.unwrap_or_else(|| String::from("None")),
|
||||
error: err.get_error().description().into(),
|
||||
|
|
|
@ -30,7 +30,12 @@ struct NoSuchPad(&'static str, String);
|
|||
struct UsageError(String);
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[fail(display = "Received error from {}: {} (debug: {:?})", src, error, debug)]
|
||||
#[fail(
|
||||
display = "Received error from {}: {} (debug: {:?})",
|
||||
src,
|
||||
error,
|
||||
debug
|
||||
)]
|
||||
struct ErrorMessage {
|
||||
src: String,
|
||||
error: String,
|
||||
|
@ -187,7 +192,8 @@ fn example_main() -> Result<(), Error> {
|
|||
assert_ne!(ret, gst::StateChangeReturn::Failure);
|
||||
|
||||
return Err(ErrorMessage {
|
||||
src: msg.get_src()
|
||||
src: msg
|
||||
.get_src()
|
||||
.map(|s| s.get_path_string())
|
||||
.unwrap_or_else(|| String::from("None")),
|
||||
error: err.get_error().description().into(),
|
||||
|
|
|
@ -19,7 +19,12 @@ mod examples_common;
|
|||
struct MissingElement(String);
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
#[fail(display = "Received error from {}: {} (debug: {:?})", src, error, debug)]
|
||||
#[fail(
|
||||
display = "Received error from {}: {} (debug: {:?})",
|
||||
src,
|
||||
error,
|
||||
debug
|
||||
)]
|
||||
struct ErrorMessage {
|
||||
src: String,
|
||||
error: String,
|
||||
|
@ -72,7 +77,8 @@ fn example_main() -> Result<(), Error> {
|
|||
MessageView::Eos(..) => break,
|
||||
MessageView::Error(err) => {
|
||||
Err(ErrorMessage {
|
||||
src: err.get_src()
|
||||
src: err
|
||||
.get_src()
|
||||
.map(|s| s.get_path_string())
|
||||
.unwrap_or_else(|| String::from("None")),
|
||||
error: err.get_error().description().into(),
|
||||
|
|
|
@ -11,8 +11,9 @@ use glib_ffi;
|
|||
use gobject_ffi;
|
||||
|
||||
use glib;
|
||||
use glib::translate::{from_glib, from_glib_full, from_glib_none, FromGlibPtrNone, ToGlib,
|
||||
ToGlibPtr, ToGlibPtrMut};
|
||||
use glib::translate::{
|
||||
from_glib, from_glib_full, from_glib_none, FromGlibPtrNone, ToGlib, ToGlibPtr, ToGlibPtrMut,
|
||||
};
|
||||
use gst;
|
||||
use gst::prelude::*;
|
||||
|
||||
|
@ -312,7 +313,9 @@ impl glib::types::StaticType for AudioInfo {
|
|||
#[doc(hidden)]
|
||||
impl<'a> glib::value::FromValueOptional<'a> for AudioInfo {
|
||||
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) as *mut ffi::GstAudioInfo)
|
||||
Option::<AudioInfo>::from_glib_none(
|
||||
gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as *mut ffi::GstAudioInfo
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,10 @@ pub fn type_find_helper_for_data<
|
|||
let data = data.as_ref();
|
||||
let (ptr, len) = (data.as_ptr(), data.len());
|
||||
let ret = from_glib_full(ffi::gst_type_find_helper_for_data(
|
||||
obj.0, mut_override(ptr), len, &mut prob,
|
||||
obj.0,
|
||||
mut_override(ptr),
|
||||
len,
|
||||
&mut prob,
|
||||
));
|
||||
(ret, from_glib(prob))
|
||||
}
|
||||
|
|
|
@ -9,12 +9,16 @@
|
|||
use ffi;
|
||||
use NetTimeProvider;
|
||||
|
||||
use glib::IsA;
|
||||
use glib::translate::*;
|
||||
use glib::IsA;
|
||||
use gst;
|
||||
|
||||
impl NetTimeProvider {
|
||||
pub fn new<'a, P: IsA<gst::Clock>, Q: Into<Option<&'a str>>>(clock: &P, address: Q, port: i32) -> NetTimeProvider {
|
||||
pub fn new<'a, P: IsA<gst::Clock>, Q: Into<Option<&'a str>>>(
|
||||
clock: &P,
|
||||
address: Q,
|
||||
port: i32,
|
||||
) -> NetTimeProvider {
|
||||
assert_initialized_main_thread!();
|
||||
let address = address.into();
|
||||
let address = address.to_glib_none();
|
||||
|
@ -22,12 +26,20 @@ impl NetTimeProvider {
|
|||
let (major, minor, _, _) = gst::version();
|
||||
if (major, minor) > (1, 12) {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_net_time_provider_new(clock.to_glib_none().0, address.0, port))
|
||||
from_glib_full(ffi::gst_net_time_provider_new(
|
||||
clock.to_glib_none().0,
|
||||
address.0,
|
||||
port,
|
||||
))
|
||||
}
|
||||
} else {
|
||||
// Workaround for bad floating reference handling in 1.12. This issue was fixed for 1.13
|
||||
unsafe {
|
||||
from_glib_none(ffi::gst_net_time_provider_new(clock.to_glib_none().0, address.0, port))
|
||||
from_glib_none(ffi::gst_net_time_provider_new(
|
||||
clock.to_glib_none().0,
|
||||
address.0,
|
||||
port,
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,11 +13,7 @@ pub struct MIKEYMapSRTP(ffi::GstMIKEYMapSRTP);
|
|||
|
||||
impl MIKEYMapSRTP {
|
||||
pub fn new(policy: u8, ssrc: u32, roc: u32) -> MIKEYMapSRTP {
|
||||
MIKEYMapSRTP(ffi::GstMIKEYMapSRTP {
|
||||
policy,
|
||||
ssrc,
|
||||
roc,
|
||||
})
|
||||
MIKEYMapSRTP(ffi::GstMIKEYMapSRTP { policy, ssrc, roc })
|
||||
}
|
||||
|
||||
pub fn policy(&self) -> u8 {
|
||||
|
|
|
@ -104,10 +104,7 @@ impl<'a> DownstreamForceKeyUnitEventBuilder<'a> {
|
|||
}
|
||||
|
||||
pub fn timestamp(self, timestamp: gst::ClockTime) -> Self {
|
||||
Self {
|
||||
timestamp,
|
||||
..self
|
||||
}
|
||||
Self { timestamp, ..self }
|
||||
}
|
||||
|
||||
pub fn stream_time(self, stream_time: gst::ClockTime) -> Self {
|
||||
|
@ -132,10 +129,7 @@ impl<'a> DownstreamForceKeyUnitEventBuilder<'a> {
|
|||
}
|
||||
|
||||
pub fn count(self, count: u32) -> Self {
|
||||
Self {
|
||||
count,
|
||||
..self
|
||||
}
|
||||
Self { count, ..self }
|
||||
}
|
||||
|
||||
event_builder_generic_impl!(
|
||||
|
@ -231,10 +225,7 @@ impl<'a> UpstreamForceKeyUnitEventBuilder<'a> {
|
|||
}
|
||||
|
||||
pub fn count(self, count: u32) -> Self {
|
||||
Self {
|
||||
count,
|
||||
..self
|
||||
}
|
||||
Self { count, ..self }
|
||||
}
|
||||
|
||||
event_builder_generic_impl!(
|
||||
|
|
|
@ -238,7 +238,8 @@ impl VideoFrame<Writable> {
|
|||
&mut frame,
|
||||
info.to_glib_none().0 as *mut _,
|
||||
buffer.to_glib_none().0,
|
||||
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_ffi::GST_MAP_READ
|
||||
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF
|
||||
| gst_ffi::GST_MAP_READ
|
||||
| gst_ffi::GST_MAP_WRITE,
|
||||
));
|
||||
|
||||
|
@ -265,7 +266,8 @@ impl VideoFrame<Writable> {
|
|||
info.to_glib_none().0 as *mut _,
|
||||
buffer.to_glib_none().0,
|
||||
id,
|
||||
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_ffi::GST_MAP_READ
|
||||
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF
|
||||
| gst_ffi::GST_MAP_READ
|
||||
| gst_ffi::GST_MAP_WRITE,
|
||||
));
|
||||
|
||||
|
@ -512,7 +514,8 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> {
|
|||
&mut frame,
|
||||
info.to_glib_none().0 as *mut _,
|
||||
buffer.as_mut_ptr(),
|
||||
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_ffi::GST_MAP_READ
|
||||
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF
|
||||
| gst_ffi::GST_MAP_READ
|
||||
| gst_ffi::GST_MAP_WRITE,
|
||||
));
|
||||
|
||||
|
@ -539,7 +542,8 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> {
|
|||
info.to_glib_none().0 as *mut _,
|
||||
buffer.as_mut_ptr(),
|
||||
id,
|
||||
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF | gst_ffi::GST_MAP_READ
|
||||
ffi::GST_VIDEO_FRAME_MAP_FLAG_NO_REF
|
||||
| gst_ffi::GST_MAP_READ
|
||||
| gst_ffi::GST_MAP_WRITE,
|
||||
));
|
||||
|
||||
|
@ -591,7 +595,10 @@ impl<'a> ops::Deref for VideoFrameRef<&'a mut gst::BufferRef> {
|
|||
type Target = VideoFrameRef<&'a gst::BufferRef>;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
unsafe { &*(self as *const VideoFrameRef<&'a mut gst::BufferRef> as *const VideoFrameRef<&'a gst::BufferRef>) }
|
||||
unsafe {
|
||||
&*(self as *const VideoFrameRef<&'a mut gst::BufferRef>
|
||||
as *const VideoFrameRef<&'a gst::BufferRef>)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,8 +11,10 @@ use glib_ffi;
|
|||
use gobject_ffi;
|
||||
|
||||
use glib;
|
||||
use glib::translate::{from_glib, from_glib_full, from_glib_none, FromGlib, FromGlibPtrNone,
|
||||
ToGlib, ToGlibPtr, ToGlibPtrMut};
|
||||
use glib::translate::{
|
||||
from_glib, from_glib_full, from_glib_none, FromGlib, FromGlibPtrNone, ToGlib, ToGlibPtr,
|
||||
ToGlibPtrMut,
|
||||
};
|
||||
use gst;
|
||||
use gst::prelude::*;
|
||||
|
||||
|
@ -666,7 +668,9 @@ impl glib::types::StaticType for VideoInfo {
|
|||
#[doc(hidden)]
|
||||
impl<'a> glib::value::FromValueOptional<'a> for VideoInfo {
|
||||
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) as *mut ffi::GstVideoInfo)
|
||||
Option::<VideoInfo>::from_glib_none(
|
||||
gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as *mut ffi::GstVideoInfo
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,8 @@ mod tests {
|
|||
bin.add(&::ElementFactory::make("identity", "identity1").unwrap())
|
||||
.unwrap();
|
||||
|
||||
let mut child_names = bin.get_children()
|
||||
let mut child_names = bin
|
||||
.get_children()
|
||||
.iter()
|
||||
.map(|c| c.get_name())
|
||||
.collect::<Vec<String>>();
|
||||
|
|
|
@ -389,7 +389,7 @@ impl ToOwned for BufferRef {
|
|||
impl fmt::Debug for BufferRef {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
f.debug_struct("Buffer")
|
||||
.field("ptr", unsafe { &self.as_ptr() } )
|
||||
.field("ptr", unsafe { &self.as_ptr() })
|
||||
.field("pts", &self.get_pts().to_string())
|
||||
.field("dts", &self.get_dts().to_string())
|
||||
.field("duration", &self.get_duration().to_string())
|
||||
|
|
|
@ -198,7 +198,8 @@ impl BufferPoolAcquireParams {
|
|||
|
||||
impl PartialEq for BufferPoolAcquireParams {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.format() == other.format() && self.start() == other.start()
|
||||
self.format() == other.format()
|
||||
&& self.start() == other.start()
|
||||
&& self.stop() == other.stop()
|
||||
}
|
||||
}
|
||||
|
@ -210,14 +211,10 @@ impl BufferPool {
|
|||
assert_initialized_main_thread!();
|
||||
let (major, minor, _, _) = ::version();
|
||||
if (major, minor) > (1, 12) {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_buffer_pool_new())
|
||||
}
|
||||
unsafe { from_glib_full(ffi::gst_buffer_pool_new()) }
|
||||
} else {
|
||||
// Work-around for 1.14 switching from transfer-floating to transfer-full
|
||||
unsafe {
|
||||
from_glib_none(ffi::gst_buffer_pool_new())
|
||||
}
|
||||
unsafe { from_glib_none(ffi::gst_buffer_pool_new()) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,19 +106,22 @@ impl ToOwned for BufferListRef {
|
|||
|
||||
fn to_owned(&self) -> GstRc<BufferListRef> {
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
|
||||
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for BufferListRef {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let size = self.iter().map(|b| b.get_size()).sum::<usize>();
|
||||
let (pts, dts) = self.get(0)
|
||||
let (pts, dts) = self
|
||||
.get(0)
|
||||
.map(|b| (b.get_pts(), b.get_dts()))
|
||||
.unwrap_or((::ClockTime::none(), ::ClockTime::none()));
|
||||
|
||||
f.debug_struct("BufferList")
|
||||
.field("ptr", unsafe { &self.as_ptr() } )
|
||||
.field("ptr", unsafe { &self.as_ptr() })
|
||||
.field("buffers", &self.len())
|
||||
.field("pts", &pts.to_string())
|
||||
.field("dts", &dts.to_string())
|
||||
|
|
|
@ -252,7 +252,12 @@ impl CapsRef {
|
|||
|
||||
pub fn subtract(&self, other: &Self) -> Caps {
|
||||
skip_assert_initialized!();
|
||||
unsafe { from_glib_full(ffi::gst_caps_subtract(self.as_mut_ptr(), other.as_mut_ptr())) }
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_caps_subtract(
|
||||
self.as_mut_ptr(),
|
||||
other.as_mut_ptr(),
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,9 @@ impl ToOwned for ContextRef {
|
|||
|
||||
fn to_owned(&self) -> GstRc<ContextRef> {
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
|
||||
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,23 +6,19 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use DeviceMonitor;
|
||||
use ffi;
|
||||
use glib::translate::*;
|
||||
use DeviceMonitor;
|
||||
|
||||
impl DeviceMonitor {
|
||||
pub fn new() -> DeviceMonitor {
|
||||
assert_initialized_main_thread!();
|
||||
let (major, minor, _, _) = ::version();
|
||||
if (major, minor) > (1, 12) {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_device_monitor_new())
|
||||
}
|
||||
unsafe { from_glib_full(ffi::gst_device_monitor_new()) }
|
||||
} else {
|
||||
// Work-around for 1.14 switching from transfer-floating to transfer-full
|
||||
unsafe {
|
||||
from_glib_none(ffi::gst_device_monitor_new())
|
||||
}
|
||||
unsafe { from_glib_none(ffi::gst_device_monitor_new()) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,8 +13,9 @@ use glib;
|
|||
use glib::object::Downcast;
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
use glib::translate::FromGlibPtrBorrow;
|
||||
use glib::translate::{from_glib, from_glib_full, from_glib_none, FromGlib, FromGlibPtrContainer,
|
||||
ToGlib, ToGlibPtr};
|
||||
use glib::translate::{
|
||||
from_glib, from_glib_full, from_glib_none, FromGlib, FromGlibPtrContainer, ToGlib, ToGlibPtr,
|
||||
};
|
||||
use glib::IsA;
|
||||
use miniobject::MiniObject;
|
||||
use Event;
|
||||
|
|
|
@ -440,7 +440,7 @@ impl glib::types::StaticType for EventRef {
|
|||
impl fmt::Debug for EventRef {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
f.debug_struct("Event")
|
||||
.field("ptr", unsafe { &self.as_ptr() } )
|
||||
.field("ptr", unsafe { &self.as_ptr() })
|
||||
.field("type", &unsafe {
|
||||
let type_ = ffi::gst_event_type_get_name((*self.as_ptr()).type_);
|
||||
CStr::from_ptr(type_).to_str().unwrap()
|
||||
|
@ -902,7 +902,8 @@ impl<'a> EventBuilder<'a> {
|
|||
|
||||
fn other_fields(self, other_fields: &[(&'a str, &'a ToSendValue)]) -> Self {
|
||||
Self {
|
||||
other_fields: self.other_fields
|
||||
other_fields: self
|
||||
.other_fields
|
||||
.iter()
|
||||
.cloned()
|
||||
.chain(other_fields.iter().cloned())
|
||||
|
|
|
@ -317,10 +317,7 @@ where
|
|||
for<'a> T: StaticType + ToValue + FromValueOptional<'a> + Clone + Send + 'static,
|
||||
{
|
||||
fn new(items: Vec<T>) -> Self {
|
||||
Self {
|
||||
pos: 0,
|
||||
items,
|
||||
}
|
||||
Self { pos: 0, items }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,9 @@ pub use caps::{Caps, CapsRef};
|
|||
pub mod tags;
|
||||
pub use tags::{Tag, TagList, TagListRef};
|
||||
pub mod buffer;
|
||||
pub use buffer::{Buffer, BufferMap, BufferRef, MappedBuffer, BUFFER_COPY_ALL, BUFFER_COPY_METADATA};
|
||||
pub use buffer::{
|
||||
Buffer, BufferMap, BufferRef, MappedBuffer, BUFFER_COPY_ALL, BUFFER_COPY_METADATA,
|
||||
};
|
||||
pub mod sample;
|
||||
pub use sample::{Sample, SampleRef};
|
||||
pub mod bufferlist;
|
||||
|
@ -129,8 +131,10 @@ mod proxy_pad;
|
|||
mod tag_setter;
|
||||
pub use bin::BinExtManual;
|
||||
pub use element::{ElementExtManual, ElementMessageType, NotifyWatchId};
|
||||
pub use element::{ELEMENT_METADATA_AUTHOR, ELEMENT_METADATA_DESCRIPTION, ELEMENT_METADATA_DOC_URI,
|
||||
ELEMENT_METADATA_ICON_NAME, ELEMENT_METADATA_KLASS, ELEMENT_METADATA_LONGNAME};
|
||||
pub use element::{
|
||||
ELEMENT_METADATA_AUTHOR, ELEMENT_METADATA_DESCRIPTION, ELEMENT_METADATA_DOC_URI,
|
||||
ELEMENT_METADATA_ICON_NAME, ELEMENT_METADATA_KLASS, ELEMENT_METADATA_LONGNAME,
|
||||
};
|
||||
pub use object::GstObjectExtManual;
|
||||
|
||||
// OS dependent Bus extensions (also import the other plateform trait for doc)
|
||||
|
@ -153,8 +157,10 @@ pub use bus::BusStream;
|
|||
pub use child_proxy::ChildProxyExtManual;
|
||||
pub use clock_time::ClockTime;
|
||||
pub use device_provider::DeviceProviderExtManual;
|
||||
pub use enums::{ClockError, ClockSuccess, FlowError, FlowSuccess, PadLinkError, PadLinkSuccess,
|
||||
StateChangeError, StateChangeSuccess, TagError};
|
||||
pub use enums::{
|
||||
ClockError, ClockSuccess, FlowError, FlowSuccess, PadLinkError, PadLinkSuccess,
|
||||
StateChangeError, StateChangeSuccess, TagError,
|
||||
};
|
||||
pub use gobject::GObjectExtManualGst;
|
||||
pub use pad::{PadExtManual, PadProbeData, PadProbeId, PadProbeInfo};
|
||||
pub use parse_context::ParseContext;
|
||||
|
@ -162,9 +168,9 @@ pub use tag_setter::TagSetterExtManual;
|
|||
|
||||
mod plugin;
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
pub mod stream_collection;
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
mod stream;
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
pub mod stream_collection;
|
||||
|
||||
mod typefind;
|
||||
pub use typefind::*;
|
||||
|
|
|
@ -17,7 +17,6 @@ use gobject_ffi;
|
|||
use glib::translate::{from_glib, ToGlib, ToGlibPtr};
|
||||
use glib::IsA;
|
||||
|
||||
|
||||
#[derive(PartialEq, Eq, Clone, Copy)]
|
||||
pub struct DebugCategory(ptr::NonNull<ffi::GstDebugCategory>);
|
||||
|
||||
|
@ -78,11 +77,7 @@ impl DebugCategory {
|
|||
}
|
||||
|
||||
pub fn get_color(&self) -> ::DebugColorFlags {
|
||||
unsafe {
|
||||
from_glib(
|
||||
ffi::gst_debug_category_get_color(self.0.as_ptr()),
|
||||
)
|
||||
}
|
||||
unsafe { from_glib(ffi::gst_debug_category_get_color(self.0.as_ptr())) }
|
||||
}
|
||||
|
||||
pub fn get_name(&self) -> &str {
|
||||
|
|
|
@ -357,7 +357,7 @@ impl glib::types::StaticType for MessageRef {
|
|||
impl fmt::Debug for MessageRef {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
f.debug_struct("Message")
|
||||
.field("ptr", unsafe { &self.as_ptr() } )
|
||||
.field("ptr", unsafe { &self.as_ptr() })
|
||||
.field("type", &unsafe {
|
||||
let type_ = ffi::gst_message_type_get_name((*self.as_ptr()).type_);
|
||||
CStr::from_ptr(type_).to_str().unwrap()
|
||||
|
@ -1194,7 +1194,8 @@ impl<'a> MessageBuilder<'a> {
|
|||
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||
fn other_fields(self, other_fields: &[(&'a str, &'a ToSendValue)]) -> Self {
|
||||
Self {
|
||||
other_fields: self.other_fields
|
||||
other_fields: self
|
||||
.other_fields
|
||||
.iter()
|
||||
.cloned()
|
||||
.chain(other_fields.iter().cloned())
|
||||
|
|
|
@ -13,10 +13,11 @@ use std::{borrow, fmt, ops};
|
|||
|
||||
use ffi;
|
||||
use glib;
|
||||
use glib::translate::{c_ptr_array_len, from_glib, from_glib_full, from_glib_none,
|
||||
FromGlibContainerAsVec, FromGlibPtrArrayContainerAsVec, FromGlibPtrBorrow,
|
||||
FromGlibPtrFull, FromGlibPtrNone, GlibPtrDefault, Stash, StashMut,
|
||||
ToGlibContainerFromSlice, ToGlibPtr, ToGlibPtrMut};
|
||||
use glib::translate::{
|
||||
c_ptr_array_len, from_glib, from_glib_full, from_glib_none, FromGlibContainerAsVec,
|
||||
FromGlibPtrArrayContainerAsVec, FromGlibPtrBorrow, FromGlibPtrFull, FromGlibPtrNone,
|
||||
GlibPtrDefault, Stash, StashMut, ToGlibContainerFromSlice, ToGlibPtr, ToGlibPtrMut,
|
||||
};
|
||||
use glib_ffi;
|
||||
use glib_ffi::gpointer;
|
||||
use gobject_ffi;
|
||||
|
@ -66,10 +67,9 @@ impl<T: MiniObject> GstRc<T> {
|
|||
return self.obj.as_mut();
|
||||
}
|
||||
|
||||
let ptr = T::from_mut_ptr(
|
||||
ffi::gst_mini_object_make_writable(self.as_mut_ptr() as *mut ffi::GstMiniObject)
|
||||
as *mut T::GstType,
|
||||
);
|
||||
let ptr = T::from_mut_ptr(ffi::gst_mini_object_make_writable(
|
||||
self.as_mut_ptr() as *mut ffi::GstMiniObject
|
||||
) as *mut T::GstType);
|
||||
self.obj = ptr::NonNull::new_unchecked(ptr);
|
||||
assert!(self.is_writable());
|
||||
|
||||
|
@ -87,7 +87,9 @@ impl<T: MiniObject> GstRc<T> {
|
|||
|
||||
pub fn is_writable(&self) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_mini_object_is_writable(self.as_ptr() as *const ffi::GstMiniObject))
|
||||
from_glib(ffi::gst_mini_object_is_writable(
|
||||
self.as_ptr() as *const ffi::GstMiniObject
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,16 +189,18 @@ where
|
|||
|
||||
unsafe fn from_mut_ptr<'a>(ptr: *mut Self::GstType) -> &'a mut Self {
|
||||
assert!(!ptr.is_null());
|
||||
assert_ne!(ffi::gst_mini_object_is_writable(ptr as *mut ffi::GstMiniObject), glib_ffi::GFALSE);
|
||||
assert_ne!(
|
||||
ffi::gst_mini_object_is_writable(ptr as *mut ffi::GstMiniObject),
|
||||
glib_ffi::GFALSE
|
||||
);
|
||||
&mut *(ptr as *mut Self)
|
||||
}
|
||||
|
||||
fn copy(&self) -> GstRc<Self> {
|
||||
unsafe {
|
||||
GstRc::from_glib_full(
|
||||
ffi::gst_mini_object_copy(self.as_ptr() as *const ffi::GstMiniObject)
|
||||
as *const Self::GstType,
|
||||
)
|
||||
GstRc::from_glib_full(ffi::gst_mini_object_copy(
|
||||
self.as_ptr() as *const ffi::GstMiniObject
|
||||
) as *const Self::GstType)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,11 @@ use glib::IsA;
|
|||
use gobject_ffi;
|
||||
|
||||
pub trait GstObjectExtManual {
|
||||
fn connect_deep_notify<'a, P: Into<Option<&'a str>>, F: Fn(&Self, &::Object, &glib::ParamSpec) + Send + Sync + 'static>(
|
||||
fn connect_deep_notify<
|
||||
'a,
|
||||
P: Into<Option<&'a str>>,
|
||||
F: Fn(&Self, &::Object, &glib::ParamSpec) + Send + Sync + 'static,
|
||||
>(
|
||||
&self,
|
||||
name: P,
|
||||
f: F,
|
||||
|
@ -23,7 +27,11 @@ pub trait GstObjectExtManual {
|
|||
}
|
||||
|
||||
impl<O: IsA<::Object> + IsA<glib::Object> + glib::value::SetValue> GstObjectExtManual for O {
|
||||
fn connect_deep_notify<'a, P: Into<Option<&'a str>>, F: Fn(&Self, &::Object, &glib::ParamSpec) + Send + Sync + 'static>(
|
||||
fn connect_deep_notify<
|
||||
'a,
|
||||
P: Into<Option<&'a str>>,
|
||||
F: Fn(&Self, &::Object, &glib::ParamSpec) + Send + Sync + 'static,
|
||||
>(
|
||||
&self,
|
||||
name: P,
|
||||
f: F,
|
||||
|
|
|
@ -28,8 +28,10 @@ use std::mem::transmute;
|
|||
use std::ptr;
|
||||
|
||||
use glib;
|
||||
use glib::translate::{from_glib, from_glib_borrow, from_glib_full, from_glib_none, mut_override,
|
||||
FromGlib, ToGlib, ToGlibPtr};
|
||||
use glib::translate::{
|
||||
from_glib, from_glib_borrow, from_glib_full, from_glib_none, mut_override, FromGlib, ToGlib,
|
||||
ToGlibPtr,
|
||||
};
|
||||
use glib::Object;
|
||||
use glib::{IsA, StaticType};
|
||||
use glib_ffi;
|
||||
|
|
|
@ -107,7 +107,9 @@ impl ToOwned for SampleRef {
|
|||
|
||||
fn to_owned(&self) -> GstRc<SampleRef> {
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
|
||||
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,10 @@ impl Segment {
|
|||
if T::get_default_format() == Format::Undefined
|
||||
|| T::get_default_format() == self.get_format()
|
||||
{
|
||||
Some(unsafe { &*(self as *const FormattedSegment<GenericFormattedValue> as *const FormattedSegment<T>) })
|
||||
Some(unsafe {
|
||||
&*(self as *const FormattedSegment<GenericFormattedValue>
|
||||
as *const FormattedSegment<T>)
|
||||
})
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -60,7 +63,10 @@ impl Segment {
|
|||
if T::get_default_format() == Format::Undefined
|
||||
|| T::get_default_format() == self.get_format()
|
||||
{
|
||||
Some(unsafe { &mut *(self as *mut FormattedSegment<GenericFormattedValue> as *mut FormattedSegment<T>) })
|
||||
Some(unsafe {
|
||||
&mut *(self as *mut FormattedSegment<GenericFormattedValue>
|
||||
as *mut FormattedSegment<T>)
|
||||
})
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -83,7 +89,9 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
}
|
||||
|
||||
pub fn upcast_ref(&self) -> &Segment {
|
||||
unsafe { &*(self as *const FormattedSegment<T> as *const FormattedSegment<GenericFormattedValue>) }
|
||||
unsafe {
|
||||
&*(self as *const FormattedSegment<T> as *const FormattedSegment<GenericFormattedValue>)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn reset(&mut self) {
|
||||
|
@ -491,7 +499,9 @@ impl<T: FormattedValue> Clone for FormattedSegment<T> {
|
|||
|
||||
impl<T: FormattedValue> AsRef<Segment> for FormattedSegment<T> {
|
||||
fn as_ref(&self) -> &Segment {
|
||||
unsafe { &*(self as *const FormattedSegment<T> as *const FormattedSegment<GenericFormattedValue>) }
|
||||
unsafe {
|
||||
&*(self as *const FormattedSegment<T> as *const FormattedSegment<GenericFormattedValue>)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -499,7 +509,8 @@ impl<T: FormattedValue> fmt::Debug for FormattedSegment<T> {
|
|||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let segment = self.as_ref();
|
||||
match segment.get_format() {
|
||||
Format::Undefined => f.debug_struct("Segment")
|
||||
Format::Undefined => f
|
||||
.debug_struct("Segment")
|
||||
.field("format", &Format::Undefined)
|
||||
.finish(),
|
||||
Format::Time => {
|
||||
|
@ -518,7 +529,8 @@ impl<T: FormattedValue> fmt::Debug for FormattedSegment<T> {
|
|||
.field("duration", &segment.get_duration().to_string())
|
||||
.finish()
|
||||
}
|
||||
_ => f.debug_struct("Segment")
|
||||
_ => f
|
||||
.debug_struct("Segment")
|
||||
.field("format", &segment.get_format())
|
||||
.field("start", &segment.get_start())
|
||||
.field("offset", &segment.get_offset())
|
||||
|
@ -550,7 +562,9 @@ impl<T: FormattedValue> glib::types::StaticType for FormattedSegment<T> {
|
|||
#[doc(hidden)]
|
||||
impl<'a> glib::value::FromValueOptional<'a> for Segment {
|
||||
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) as *mut ffi::GstSegment)
|
||||
Option::<Segment>::from_glib_none(
|
||||
gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as *mut ffi::GstSegment
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,9 @@ impl glib::types::StaticType for StaticCaps {
|
|||
#[doc(hidden)]
|
||||
impl<'a> glib::value::FromValueOptional<'a> for StaticCaps {
|
||||
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) as *mut ffi::GstStaticCaps)
|
||||
Option::<StaticCaps>::from_glib_none(
|
||||
gobject_ffi::g_value_get_boxed(value.to_glib_none().0) as *mut ffi::GstStaticCaps
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,16 +6,21 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use ffi;
|
||||
use glib::translate::*;
|
||||
use Caps;
|
||||
use Stream;
|
||||
use StreamFlags;
|
||||
use StreamType;
|
||||
use Caps;
|
||||
use ffi;
|
||||
use glib::translate::*;
|
||||
|
||||
impl Stream {
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
pub fn new<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b Caps>>>(stream_id: P, caps: Q, type_: StreamType, flags: StreamFlags) -> Stream {
|
||||
pub fn new<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b Caps>>>(
|
||||
stream_id: P,
|
||||
caps: Q,
|
||||
type_: StreamType,
|
||||
flags: StreamFlags,
|
||||
) -> Stream {
|
||||
assert_initialized_main_thread!();
|
||||
let stream_id = stream_id.into();
|
||||
let stream_id = stream_id.to_glib_none();
|
||||
|
@ -25,12 +30,22 @@ impl Stream {
|
|||
let (major, minor, _, _) = ::version();
|
||||
if (major, minor) > (1, 12) {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_stream_new(stream_id.0, caps.0, type_.to_glib(), flags.to_glib()))
|
||||
from_glib_full(ffi::gst_stream_new(
|
||||
stream_id.0,
|
||||
caps.0,
|
||||
type_.to_glib(),
|
||||
flags.to_glib(),
|
||||
))
|
||||
}
|
||||
} else {
|
||||
// Work-around for 1.14 switching from transfer-floating to transfer-full
|
||||
unsafe {
|
||||
from_glib_none(ffi::gst_stream_new(stream_id.0, caps.0, type_.to_glib(), flags.to_glib()))
|
||||
from_glib_none(ffi::gst_stream_new(
|
||||
stream_id.0,
|
||||
caps.0,
|
||||
type_.to_glib(),
|
||||
flags.to_glib(),
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use Stream;
|
||||
use StreamCollection;
|
||||
use ffi;
|
||||
use glib::translate::*;
|
||||
use Stream;
|
||||
use StreamCollection;
|
||||
|
||||
pub struct Iter<'a> {
|
||||
collection: &'a StreamCollection,
|
||||
|
@ -73,14 +73,10 @@ impl StreamCollection {
|
|||
let upstream_id = upstream_id.to_glib_none();
|
||||
let (major, minor, _, _) = ::version();
|
||||
if (major, minor) > (1, 12) {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_stream_collection_new(upstream_id.0))
|
||||
}
|
||||
unsafe { from_glib_full(ffi::gst_stream_collection_new(upstream_id.0)) }
|
||||
} else {
|
||||
// Work-around for 1.14 switching from transfer-floating to transfer-full
|
||||
unsafe {
|
||||
from_glib_none(ffi::gst_stream_collection_new(upstream_id.0))
|
||||
}
|
||||
unsafe { from_glib_none(ffi::gst_stream_collection_new(upstream_id.0)) }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,10 @@ use Fraction;
|
|||
|
||||
use ffi;
|
||||
use glib;
|
||||
use glib::translate::{from_glib, from_glib_full, from_glib_none, FromGlibPtrFull, FromGlibPtrNone,
|
||||
GlibPtrDefault, Stash, StashMut, ToGlib, ToGlibPtr, ToGlibPtrMut};
|
||||
use glib::translate::{
|
||||
from_glib, from_glib_full, from_glib_none, FromGlibPtrFull, FromGlibPtrNone, GlibPtrDefault,
|
||||
Stash, StashMut, ToGlib, ToGlibPtr, ToGlibPtrMut,
|
||||
};
|
||||
use glib::value::{FromValueOptional, SendValue, ToSendValue};
|
||||
use glib_ffi::gpointer;
|
||||
use gobject_ffi;
|
||||
|
|
|
@ -46,30 +46,75 @@ macro_rules! impl_tag(
|
|||
);
|
||||
|
||||
impl_tag!(Title, &'a str, TAG_TITLE, GST_TAG_TITLE);
|
||||
impl_tag!(TitleSortname, &'a str, TAG_TITLE_SORTNAME, GST_TAG_TITLE_SORTNAME);
|
||||
impl_tag!(
|
||||
TitleSortname,
|
||||
&'a str,
|
||||
TAG_TITLE_SORTNAME,
|
||||
GST_TAG_TITLE_SORTNAME
|
||||
);
|
||||
impl_tag!(Artist, &'a str, TAG_ARTIST, GST_TAG_ARTIST);
|
||||
impl_tag!(ArtistSortname, &'a str, TAG_ARTIST_SORTNAME, GST_TAG_ARTIST_SORTNAME);
|
||||
impl_tag!(
|
||||
ArtistSortname,
|
||||
&'a str,
|
||||
TAG_ARTIST_SORTNAME,
|
||||
GST_TAG_ARTIST_SORTNAME
|
||||
);
|
||||
impl_tag!(Album, &'a str, TAG_ALBUM, GST_TAG_ARTIST_SORTNAME);
|
||||
impl_tag!(AlbumSortname, &'a str, TAG_ALBUM_SORTNAME, GST_TAG_ALBUM_SORTNAME);
|
||||
impl_tag!(
|
||||
AlbumSortname,
|
||||
&'a str,
|
||||
TAG_ALBUM_SORTNAME,
|
||||
GST_TAG_ALBUM_SORTNAME
|
||||
);
|
||||
impl_tag!(AlbumArtist, &'a str, TAG_ALBUM_ARTIST, GST_TAG_ALBUM_ARTIST);
|
||||
impl_tag!(AlbumArtistSortname, &'a str, TAG_ALBUM_ARTIST_SORTNAME, GST_TAG_ALBUM_ARTIST_SORTNAME);
|
||||
impl_tag!(
|
||||
AlbumArtistSortname,
|
||||
&'a str,
|
||||
TAG_ALBUM_ARTIST_SORTNAME,
|
||||
GST_TAG_ALBUM_ARTIST_SORTNAME
|
||||
);
|
||||
impl_tag!(Date, glib::Date, TAG_DATE, GST_TAG_DATE);
|
||||
impl_tag!(DateTime, ::auto::DateTime, TAG_DATE_TIME, GST_TAG_DATE_TIME);
|
||||
impl_tag!(Genre, &'a str, TAG_GENRE, GST_TAG_GENRE);
|
||||
impl_tag!(Comment, &'a str, TAG_COMMENT, GST_TAG_COMMENT);
|
||||
impl_tag!(ExtendedComment, &'a str, TAG_EXTENDED_COMMENT, GST_TAG_EXTENDED_COMMENT);
|
||||
impl_tag!(
|
||||
ExtendedComment,
|
||||
&'a str,
|
||||
TAG_EXTENDED_COMMENT,
|
||||
GST_TAG_EXTENDED_COMMENT
|
||||
);
|
||||
impl_tag!(TrackNumber, u32, TAG_TRACK_NUMBER, GST_TAG_TRACK_NUMBER);
|
||||
impl_tag!(TrackCount, u32, TAG_TRACK_COUNT, GST_TAG_TRACK_COUNT);
|
||||
impl_tag!(AlbumVolumeNumber, u32, TAG_ALBUM_VOLUME_NUMBER, GST_TAG_ALBUM_VOLUME_NUMBER);
|
||||
impl_tag!(AlbumVolumeCount, u32, TAG_ALBUM_VOLUME_COUNT, GST_TAG_ALBUM_VOLUME_COUNT);
|
||||
impl_tag!(
|
||||
AlbumVolumeNumber,
|
||||
u32,
|
||||
TAG_ALBUM_VOLUME_NUMBER,
|
||||
GST_TAG_ALBUM_VOLUME_NUMBER
|
||||
);
|
||||
impl_tag!(
|
||||
AlbumVolumeCount,
|
||||
u32,
|
||||
TAG_ALBUM_VOLUME_COUNT,
|
||||
GST_TAG_ALBUM_VOLUME_COUNT
|
||||
);
|
||||
impl_tag!(Location, &'a str, TAG_LOCATION, GST_TAG_LOCATION);
|
||||
impl_tag!(Homepage, &'a str, TAG_HOMEPAGE, GST_TAG_HOMEPAGE);
|
||||
impl_tag!(Description, &'a str, TAG_DESCRIPTION, GST_TAG_DESCRIPTION);
|
||||
impl_tag!(Version, &'a str, TAG_VERSION, GST_TAG_VERSION);
|
||||
impl_tag!(ISRC, &'a str, TAG_ISRC, GST_TAG_ISRC);
|
||||
impl_tag!(Organization, &'a str, TAG_ORGANIZATION, GST_TAG_ORGANIZATION);
|
||||
impl_tag!(
|
||||
Organization,
|
||||
&'a str,
|
||||
TAG_ORGANIZATION,
|
||||
GST_TAG_ORGANIZATION
|
||||
);
|
||||
impl_tag!(Copyright, &'a str, TAG_COPYRIGHT, GST_TAG_COPYRIGHT);
|
||||
impl_tag!(CopyrightUri, &'a str, TAG_COPYRIGHT_URI, GST_TAG_COPYRIGHT_URI);
|
||||
impl_tag!(
|
||||
CopyrightUri,
|
||||
&'a str,
|
||||
TAG_COPYRIGHT_URI,
|
||||
GST_TAG_COPYRIGHT_URI
|
||||
);
|
||||
impl_tag!(EncodedBy, &'a str, TAG_ENCODED_BY, GST_TAG_ENCODED_BY);
|
||||
impl_tag!(Composer, &'a str, TAG_COMPOSER, GST_TAG_COMPOSER);
|
||||
impl_tag!(Conductor, &'a str, TAG_CONDUCTOR, GST_TAG_CONDUCTOR);
|
||||
|
@ -81,75 +126,215 @@ impl_tag!(Duration, ::ClockTime, TAG_DURATION, GST_TAG_DURATION);
|
|||
impl_tag!(Codec, &'a str, TAG_CODEC, GST_TAG_CODEC);
|
||||
impl_tag!(VideoCodec, &'a str, TAG_VIDEO_CODEC, GST_TAG_VIDEO_CODEC);
|
||||
impl_tag!(AudioCodec, &'a str, TAG_AUDIO_CODEC, GST_TAG_AUDIO_CODEC);
|
||||
impl_tag!(SubtitleCodec, &'a str, TAG_SUBTITLE_CODEC, GST_TAG_SUBTITLE_CODEC);
|
||||
impl_tag!(ContainerFormat, &'a str, TAG_CONTAINER_FORMAT, GST_TAG_CONTAINER_FORMAT);
|
||||
impl_tag!(
|
||||
SubtitleCodec,
|
||||
&'a str,
|
||||
TAG_SUBTITLE_CODEC,
|
||||
GST_TAG_SUBTITLE_CODEC
|
||||
);
|
||||
impl_tag!(
|
||||
ContainerFormat,
|
||||
&'a str,
|
||||
TAG_CONTAINER_FORMAT,
|
||||
GST_TAG_CONTAINER_FORMAT
|
||||
);
|
||||
impl_tag!(Bitrate, u32, TAG_BITRATE, GST_TAG_BITRATE);
|
||||
impl_tag!(NominalBitrate, u32, TAG_NOMINAL_BITRATE, GST_TAG_NOMINAL_BITRATE);
|
||||
impl_tag!(MinimumBitrate, u32, TAG_MINIMUM_BITRATE, GST_TAG_MINIMUM_BITRATE);
|
||||
impl_tag!(MaximumBitrate, u32, TAG_MAXIMUM_BITRATE, GST_TAG_MAXIMUM_BITRATE);
|
||||
impl_tag!(
|
||||
NominalBitrate,
|
||||
u32,
|
||||
TAG_NOMINAL_BITRATE,
|
||||
GST_TAG_NOMINAL_BITRATE
|
||||
);
|
||||
impl_tag!(
|
||||
MinimumBitrate,
|
||||
u32,
|
||||
TAG_MINIMUM_BITRATE,
|
||||
GST_TAG_MINIMUM_BITRATE
|
||||
);
|
||||
impl_tag!(
|
||||
MaximumBitrate,
|
||||
u32,
|
||||
TAG_MAXIMUM_BITRATE,
|
||||
GST_TAG_MAXIMUM_BITRATE
|
||||
);
|
||||
impl_tag!(Serial, u32, TAG_SERIAL, GST_TAG_SERIAL);
|
||||
impl_tag!(Encoder, &'a str, TAG_ENCODER, GST_TAG_ENCODER);
|
||||
impl_tag!(EncoderVersion, u32, TAG_ENCODER_VERSION, GST_TAG_ENCODER_VERSION);
|
||||
impl_tag!(
|
||||
EncoderVersion,
|
||||
u32,
|
||||
TAG_ENCODER_VERSION,
|
||||
GST_TAG_ENCODER_VERSION
|
||||
);
|
||||
impl_tag!(TrackGain, f64, TAG_TRACK_GAIN, GST_TAG_TRACK_GAIN);
|
||||
impl_tag!(TrackPeak, f64, TAG_TRACK_PEAK, GST_TAG_TRACK_PEAK);
|
||||
impl_tag!(AlbumGain, f64, TAG_ALBUM_GAIN, GST_TAG_ALBUM_GAIN);
|
||||
impl_tag!(AlbumPeak, f64, TAG_ALBUM_PEAK, GST_TAG_ALBUM_PEAK);
|
||||
impl_tag!(ReferenceLevel, f64, TAG_REFERENCE_LEVEL, GST_TAG_REFERENCE_LEVEL);
|
||||
impl_tag!(
|
||||
ReferenceLevel,
|
||||
f64,
|
||||
TAG_REFERENCE_LEVEL,
|
||||
GST_TAG_REFERENCE_LEVEL
|
||||
);
|
||||
// TODO: Should ideally enforce this to be ISO-639
|
||||
impl_tag!(LanguageCode, &'a str, TAG_LANGUAGE_CODE, GST_TAG_LANGUAGE_CODE);
|
||||
impl_tag!(LanguageName, &'a str, TAG_LANGUAGE_NAME, GST_TAG_LANGUAGE_NAME);
|
||||
impl_tag!(
|
||||
LanguageCode,
|
||||
&'a str,
|
||||
TAG_LANGUAGE_CODE,
|
||||
GST_TAG_LANGUAGE_CODE
|
||||
);
|
||||
impl_tag!(
|
||||
LanguageName,
|
||||
&'a str,
|
||||
TAG_LANGUAGE_NAME,
|
||||
GST_TAG_LANGUAGE_NAME
|
||||
);
|
||||
impl_tag!(Image, Sample, TAG_IMAGE, GST_TAG_IMAGE);
|
||||
impl_tag!(PreviewImage, Sample, TAG_PREVIEW_IMAGE, GST_TAG_PREVIEW_IMAGE);
|
||||
impl_tag!(
|
||||
PreviewImage,
|
||||
Sample,
|
||||
TAG_PREVIEW_IMAGE,
|
||||
GST_TAG_PREVIEW_IMAGE
|
||||
);
|
||||
impl_tag!(Attachment, Sample, TAG_ATTACHMENT, GST_TAG_ATTACHMENT);
|
||||
impl_tag!(BeatsPerMinute, f64, TAG_BEATS_PER_MINUTE, GST_TAG_BEATS_PER_MINUTE);
|
||||
impl_tag!(
|
||||
BeatsPerMinute,
|
||||
f64,
|
||||
TAG_BEATS_PER_MINUTE,
|
||||
GST_TAG_BEATS_PER_MINUTE
|
||||
);
|
||||
impl_tag!(Keywords, &'a str, TAG_KEYWORDS, GST_TAG_KEYWORDS);
|
||||
impl_tag!(GeoLocationName, &'a str, TAG_GEO_LOCATION_NAME, GST_TAG_GEO_LOCATION_NAME);
|
||||
impl_tag!(GeoLocationLatitude, f64, TAG_GEO_LOCATION_LATITUDE, GST_TAG_GEO_LOCATION_LATITUDE);
|
||||
impl_tag!(GeoLocationLongitute, f64, TAG_GEO_LOCATION_LONGITUDE, GST_TAG_GEO_LOCATION_LONGITUDE);
|
||||
impl_tag!(GeoLocationElevation, f64, TAG_GEO_LOCATION_ELEVATION, GST_TAG_GEO_LOCATION_ELEVATION);
|
||||
impl_tag!(GeoLocationCity, &'a str, TAG_GEO_LOCATION_CITY, GST_TAG_GEO_LOCATION_CITY);
|
||||
impl_tag!(GeoLocationCountry, &'a str, TAG_GEO_LOCATION_COUNTRY, GST_TAG_GEO_LOCATION_COUNTRY);
|
||||
impl_tag!(
|
||||
GeoLocationName,
|
||||
&'a str,
|
||||
TAG_GEO_LOCATION_NAME,
|
||||
GST_TAG_GEO_LOCATION_NAME
|
||||
);
|
||||
impl_tag!(
|
||||
GeoLocationLatitude,
|
||||
f64,
|
||||
TAG_GEO_LOCATION_LATITUDE,
|
||||
GST_TAG_GEO_LOCATION_LATITUDE
|
||||
);
|
||||
impl_tag!(
|
||||
GeoLocationLongitute,
|
||||
f64,
|
||||
TAG_GEO_LOCATION_LONGITUDE,
|
||||
GST_TAG_GEO_LOCATION_LONGITUDE
|
||||
);
|
||||
impl_tag!(
|
||||
GeoLocationElevation,
|
||||
f64,
|
||||
TAG_GEO_LOCATION_ELEVATION,
|
||||
GST_TAG_GEO_LOCATION_ELEVATION
|
||||
);
|
||||
impl_tag!(
|
||||
GeoLocationCity,
|
||||
&'a str,
|
||||
TAG_GEO_LOCATION_CITY,
|
||||
GST_TAG_GEO_LOCATION_CITY
|
||||
);
|
||||
impl_tag!(
|
||||
GeoLocationCountry,
|
||||
&'a str,
|
||||
TAG_GEO_LOCATION_COUNTRY,
|
||||
GST_TAG_GEO_LOCATION_COUNTRY
|
||||
);
|
||||
impl_tag!(
|
||||
GeoLocationSublocation,
|
||||
&'a str,
|
||||
TAG_GEO_LOCATION_SUBLOCATION, GST_TAG_GEO_LOCATION_SUBLOCATION
|
||||
TAG_GEO_LOCATION_SUBLOCATION,
|
||||
GST_TAG_GEO_LOCATION_SUBLOCATION
|
||||
);
|
||||
impl_tag!(
|
||||
GeoLocationHorizontalError,
|
||||
f64,
|
||||
TAG_GEO_LOCATION_HORIZONTAL_ERROR, GST_TAG_GEO_LOCATION_HORIZONTAL_ERROR
|
||||
TAG_GEO_LOCATION_HORIZONTAL_ERROR,
|
||||
GST_TAG_GEO_LOCATION_HORIZONTAL_ERROR
|
||||
);
|
||||
impl_tag!(
|
||||
GeoLocationMovementDirection,
|
||||
f64,
|
||||
TAG_GEO_LOCATION_MOVEMENT_DIRECTION, GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION
|
||||
TAG_GEO_LOCATION_MOVEMENT_DIRECTION,
|
||||
GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION
|
||||
);
|
||||
impl_tag!(
|
||||
GeoLocationMovementSpeed,
|
||||
f64,
|
||||
TAG_GEO_LOCATION_MOVEMENT_SPEED, GST_TAG_GEO_LOCATION_MOVEMENT_SPEED
|
||||
TAG_GEO_LOCATION_MOVEMENT_SPEED,
|
||||
GST_TAG_GEO_LOCATION_MOVEMENT_SPEED
|
||||
);
|
||||
impl_tag!(
|
||||
GeoLocationCaptureDirection,
|
||||
f64,
|
||||
TAG_GEO_LOCATION_CAPTURE_DIRECTION, GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION
|
||||
TAG_GEO_LOCATION_CAPTURE_DIRECTION,
|
||||
GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION
|
||||
);
|
||||
impl_tag!(ShowName, &'a str, TAG_SHOW_NAME, GST_TAG_SHOW_NAME);
|
||||
impl_tag!(ShowSortname, &'a str, TAG_SHOW_SORTNAME, GST_TAG_SHOW_SORTNAME);
|
||||
impl_tag!(ShowEpisodeNumber, u32, TAG_SHOW_EPISODE_NUMBER, GST_TAG_SHOW_EPISODE_NUMBER);
|
||||
impl_tag!(ShowSeasonNumber, u32, TAG_SHOW_SEASON_NUMBER, GST_TAG_SHOW_SEASON_NUMBER);
|
||||
impl_tag!(
|
||||
ShowSortname,
|
||||
&'a str,
|
||||
TAG_SHOW_SORTNAME,
|
||||
GST_TAG_SHOW_SORTNAME
|
||||
);
|
||||
impl_tag!(
|
||||
ShowEpisodeNumber,
|
||||
u32,
|
||||
TAG_SHOW_EPISODE_NUMBER,
|
||||
GST_TAG_SHOW_EPISODE_NUMBER
|
||||
);
|
||||
impl_tag!(
|
||||
ShowSeasonNumber,
|
||||
u32,
|
||||
TAG_SHOW_SEASON_NUMBER,
|
||||
GST_TAG_SHOW_SEASON_NUMBER
|
||||
);
|
||||
impl_tag!(Lyrics, &'a str, TAG_LYRICS, GST_TAG_LYRICS);
|
||||
impl_tag!(ComposerSortname, &'a str, TAG_COMPOSER_SORTNAME, GST_TAG_COMPOSER_SORTNAME);
|
||||
impl_tag!(
|
||||
ComposerSortname,
|
||||
&'a str,
|
||||
TAG_COMPOSER_SORTNAME,
|
||||
GST_TAG_COMPOSER_SORTNAME
|
||||
);
|
||||
impl_tag!(Grouping, &'a str, TAG_GROUPING, GST_TAG_GROUPING);
|
||||
impl_tag!(UserRating, u32, TAG_USER_RATING, GST_TAG_USER_RATING);
|
||||
impl_tag!(DeviceManufacturer, &'a str, TAG_DEVICE_MANUFACTURER, GST_TAG_DEVICE_MANUFACTURER);
|
||||
impl_tag!(
|
||||
DeviceManufacturer,
|
||||
&'a str,
|
||||
TAG_DEVICE_MANUFACTURER,
|
||||
GST_TAG_DEVICE_MANUFACTURER
|
||||
);
|
||||
impl_tag!(DeviceModel, &'a str, TAG_DEVICE_MODEL, GST_TAG_DEVICE_MODEL);
|
||||
impl_tag!(ApplicationName, &'a str, TAG_APPLICATION_NAME, GST_TAG_APPLICATION_NAME);
|
||||
impl_tag!(ApplicationData, Sample, TAG_APPLICATION_DATA, GST_TAG_APPLICATION_DATA);
|
||||
impl_tag!(ImageOrientation, &'a str, TAG_IMAGE_ORIENTATION, GST_TAG_IMAGE_ORIENTATION);
|
||||
impl_tag!(
|
||||
ApplicationName,
|
||||
&'a str,
|
||||
TAG_APPLICATION_NAME,
|
||||
GST_TAG_APPLICATION_NAME
|
||||
);
|
||||
impl_tag!(
|
||||
ApplicationData,
|
||||
Sample,
|
||||
TAG_APPLICATION_DATA,
|
||||
GST_TAG_APPLICATION_DATA
|
||||
);
|
||||
impl_tag!(
|
||||
ImageOrientation,
|
||||
&'a str,
|
||||
TAG_IMAGE_ORIENTATION,
|
||||
GST_TAG_IMAGE_ORIENTATION
|
||||
);
|
||||
impl_tag!(Publisher, &'a str, TAG_PUBLISHER, GST_TAG_PUBLISHER);
|
||||
impl_tag!(InterpretedBy, &'a str, TAG_INTERPRETED_BY, GST_TAG_INTERPRETED_BY);
|
||||
impl_tag!(MidiBaseNote, &'a str, TAG_MIDI_BASE_NOTE, GST_TAG_MIDI_BASE_NOTE);
|
||||
impl_tag!(
|
||||
InterpretedBy,
|
||||
&'a str,
|
||||
TAG_INTERPRETED_BY,
|
||||
GST_TAG_INTERPRETED_BY
|
||||
);
|
||||
impl_tag!(
|
||||
MidiBaseNote,
|
||||
&'a str,
|
||||
TAG_MIDI_BASE_NOTE,
|
||||
GST_TAG_MIDI_BASE_NOTE
|
||||
);
|
||||
impl_tag!(PrivateData, Sample, TAG_PRIVATE_DATA, GST_TAG_PRIVATE_DATA);
|
||||
|
||||
pub type TagList = GstRc<TagListRef>;
|
||||
|
@ -183,23 +368,21 @@ impl TagListRef {
|
|||
|
||||
pub fn add_generic<T>(
|
||||
&mut self,
|
||||
tag_name : &str,
|
||||
tag_name: &str,
|
||||
value: &T,
|
||||
mode: TagMergeMode,
|
||||
) -> Result<(), TagError>
|
||||
where
|
||||
T: ToSendValue
|
||||
T: ToSendValue,
|
||||
{
|
||||
unsafe {
|
||||
let v = value.to_send_value();
|
||||
|
||||
let tag_name = tag_name.to_glib_none();
|
||||
|
||||
let tag_type: glib::Type = from_glib(
|
||||
ffi::gst_tag_get_type(tag_name.0)
|
||||
);
|
||||
let tag_type: glib::Type = from_glib(ffi::gst_tag_get_type(tag_name.0));
|
||||
if tag_type != v.type_() {
|
||||
return Err(TagError::TypeMismatch)
|
||||
return Err(TagError::TypeMismatch);
|
||||
}
|
||||
|
||||
ffi::gst_tag_list_add_value(
|
||||
|
@ -241,7 +424,11 @@ impl TagListRef {
|
|||
}
|
||||
|
||||
pub fn nth_tag_name(&self, idx: u32) -> &str {
|
||||
unsafe { CStr::from_ptr(ffi::gst_tag_list_nth_tag_name(self.as_ptr(), idx)).to_str().unwrap() }
|
||||
unsafe {
|
||||
CStr::from_ptr(ffi::gst_tag_list_nth_tag_name(self.as_ptr(), idx))
|
||||
.to_str()
|
||||
.unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_index<'a, T: Tag<'a>>(&'a self, idx: u32) -> Option<&'a TypedValue<T::TagType>> {
|
||||
|
@ -251,11 +438,8 @@ impl TagListRef {
|
|||
|
||||
pub fn get_index_generic<'a>(&'a self, tag_name: &str, idx: u32) -> Option<&'a SendValue> {
|
||||
unsafe {
|
||||
let value = ffi::gst_tag_list_get_value_index(
|
||||
self.as_ptr(),
|
||||
tag_name.to_glib_none().0,
|
||||
idx,
|
||||
);
|
||||
let value =
|
||||
ffi::gst_tag_list_get_value_index(self.as_ptr(), tag_name.to_glib_none().0, idx);
|
||||
|
||||
if value.is_null() {
|
||||
return None;
|
||||
|
@ -408,8 +592,7 @@ impl<'a, T: Tag<'a>> ExactSizeIterator for TagIterator<'a, T>
|
|||
where
|
||||
<T as Tag<'a>>::TagType: 'a,
|
||||
T: 'a,
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
pub struct GenericTagIterator<'a> {
|
||||
taglist: &'a TagListRef,
|
||||
|
@ -466,8 +649,7 @@ impl<'a> DoubleEndedIterator for GenericTagIterator<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> ExactSizeIterator for GenericTagIterator<'a> {
|
||||
}
|
||||
impl<'a> ExactSizeIterator for GenericTagIterator<'a> {}
|
||||
|
||||
pub struct TagListIterator<'a> {
|
||||
taglist: &'a TagListRef,
|
||||
|
@ -482,11 +664,7 @@ impl<'a> TagListIterator<'a> {
|
|||
TagListIterator {
|
||||
taglist,
|
||||
idx: 0,
|
||||
size: if size > 0 {
|
||||
size as u32
|
||||
} else {
|
||||
0
|
||||
},
|
||||
size: if size > 0 { size as u32 } else { 0 },
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -529,8 +707,7 @@ impl<'a> DoubleEndedIterator for TagListIterator<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> ExactSizeIterator for TagListIterator<'a> {
|
||||
}
|
||||
impl<'a> ExactSizeIterator for TagListIterator<'a> {}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
@ -584,10 +761,22 @@ mod tests {
|
|||
let mut tags = TagList::new();
|
||||
{
|
||||
let tags = tags.get_mut().unwrap();
|
||||
assert!(tags.add_generic(&TAG_TITLE, &"some title", TagMergeMode::Append).is_ok());
|
||||
assert!(tags.add_generic(&TAG_TITLE, &"second title", TagMergeMode::Append).is_ok());
|
||||
assert!(tags.add_generic(&TAG_DURATION, &(::SECOND * 120), TagMergeMode::Append).is_ok());
|
||||
assert!(tags.add_generic(&TAG_TITLE, &"third title", TagMergeMode::Append).is_ok());
|
||||
assert!(
|
||||
tags.add_generic(&TAG_TITLE, &"some title", TagMergeMode::Append)
|
||||
.is_ok()
|
||||
);
|
||||
assert!(
|
||||
tags.add_generic(&TAG_TITLE, &"second title", TagMergeMode::Append)
|
||||
.is_ok()
|
||||
);
|
||||
assert!(
|
||||
tags.add_generic(&TAG_DURATION, &(::SECOND * 120), TagMergeMode::Append)
|
||||
.is_ok()
|
||||
);
|
||||
assert!(
|
||||
tags.add_generic(&TAG_TITLE, &"third title", TagMergeMode::Append)
|
||||
.is_ok()
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
tags.add_generic(
|
||||
|
@ -599,10 +788,22 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
assert_eq!(tags.get_index_generic(&TAG_TITLE, 0).unwrap().get(), Some("some title"));
|
||||
assert_eq!(tags.get_index_generic(&TAG_TITLE, 1).unwrap().get(), Some("second title"));
|
||||
assert_eq!(tags.get_index_generic(&TAG_DURATION, 0).unwrap().get(), Some(::SECOND * 120));
|
||||
assert_eq!(tags.get_index_generic(&TAG_TITLE, 2).unwrap().get(), Some("third title"));
|
||||
assert_eq!(
|
||||
tags.get_index_generic(&TAG_TITLE, 0).unwrap().get(),
|
||||
Some("some title")
|
||||
);
|
||||
assert_eq!(
|
||||
tags.get_index_generic(&TAG_TITLE, 1).unwrap().get(),
|
||||
Some("second title")
|
||||
);
|
||||
assert_eq!(
|
||||
tags.get_index_generic(&TAG_DURATION, 0).unwrap().get(),
|
||||
Some(::SECOND * 120)
|
||||
);
|
||||
assert_eq!(
|
||||
tags.get_index_generic(&TAG_TITLE, 2).unwrap().get(),
|
||||
Some("third title")
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
tags.get_generic(&TAG_TITLE).unwrap().get(),
|
||||
|
|
|
@ -13,8 +13,9 @@ use std::mem;
|
|||
use ffi;
|
||||
|
||||
use glib;
|
||||
use glib::translate::{from_glib, from_glib_full, from_glib_none, FromGlibPtrContainer, ToGlib,
|
||||
ToGlibPtr};
|
||||
use glib::translate::{
|
||||
from_glib, from_glib_full, from_glib_none, FromGlibPtrContainer, ToGlib, ToGlibPtr,
|
||||
};
|
||||
|
||||
use miniobject::*;
|
||||
use TagList;
|
||||
|
@ -90,7 +91,9 @@ impl ToOwned for TocRef {
|
|||
|
||||
fn to_owned(&self) -> GstRc<TocRef> {
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
|
||||
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,7 +239,9 @@ impl ToOwned for TocEntryRef {
|
|||
|
||||
fn to_owned(&self) -> GstRc<TocEntryRef> {
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
|
||||
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -244,7 +244,11 @@ mod tests {
|
|||
.cloned()
|
||||
.find(|f| {
|
||||
f.get_caps()
|
||||
.map(|c| c.get_structure(0).map(|s| s.get_name() == "application/xml").unwrap_or(false))
|
||||
.map(|c| {
|
||||
c.get_structure(0)
|
||||
.map(|s| s.get_name() == "application/xml")
|
||||
.unwrap_or(false)
|
||||
})
|
||||
.unwrap_or(false)
|
||||
})
|
||||
.unwrap();
|
||||
|
|
|
@ -13,8 +13,9 @@ use std::ops;
|
|||
use std::slice;
|
||||
|
||||
use glib;
|
||||
use glib::translate::{from_glib, from_glib_full, FromGlib, ToGlib, ToGlibPtr, ToGlibPtrMut,
|
||||
Uninitialized};
|
||||
use glib::translate::{
|
||||
from_glib, from_glib_full, FromGlib, ToGlib, ToGlibPtr, ToGlibPtrMut, Uninitialized,
|
||||
};
|
||||
use glib::value::{FromValue, FromValueOptional, SetValue, ToSendValue, Value};
|
||||
|
||||
use ffi;
|
||||
|
@ -248,11 +249,7 @@ impl IntRange<i32> {
|
|||
assert!(min <= max);
|
||||
assert!(step > 0);
|
||||
|
||||
Self {
|
||||
min,
|
||||
max,
|
||||
step,
|
||||
}
|
||||
Self { min, max, step }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -268,11 +265,7 @@ impl IntRange<i64> {
|
|||
assert!(min <= max);
|
||||
assert!(step > 0);
|
||||
|
||||
Self {
|
||||
min,
|
||||
max,
|
||||
step,
|
||||
}
|
||||
Self { min, max, step }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,8 @@ fn tutorial_main() {
|
|||
print!("\rPosition {} / {}", position, custom_data.duration);
|
||||
io::stdout().flush().unwrap();
|
||||
|
||||
if custom_data.seek_enabled && !custom_data.seek_done
|
||||
if custom_data.seek_enabled
|
||||
&& !custom_data.seek_done
|
||||
&& position > 10 * gst::SECOND
|
||||
{
|
||||
println!("\nReached 10s, performing seek...");
|
||||
|
|
Loading…
Reference in a new issue