mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-05-13 13:52:44 +00:00
Compare commits
4 commits
afd8a20a8e
...
cfe83d4248
Author | SHA1 | Date | |
---|---|---|---|
cfe83d4248 | |||
241338f43c | |||
5c8a989029 | |||
d1cf3f372f |
|
@ -364,7 +364,8 @@ mod tests {
|
|||
fn test_display() {
|
||||
gst::init().unwrap();
|
||||
|
||||
format!("{}", crate::AudioFormat::S16be);
|
||||
assert_eq!(format!("{}", crate::AudioFormat::S16be), "S16BE");
|
||||
assert_eq!(format!("{:?}", crate::AudioFormat::S16be), "S16be");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -480,18 +480,12 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic(expected = "gst_video_format_to_string returned NULL")]
|
||||
fn enum_to_string_panics() {
|
||||
assert_eq!(&format!("{}", crate::VideoFormat::__Unknown(-1)), "UNKNOWN");
|
||||
assert_eq!(crate::VideoFormat::__Unknown(-1).to_str(), "UNKNOWN");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_display() {
|
||||
gst::init().unwrap();
|
||||
|
||||
format!("{}", crate::VideoFormat::Nv16);
|
||||
assert_eq!(format!("{}", crate::VideoFormat::Nv16), "NV16");
|
||||
assert_eq!(format!("{:?}", crate::VideoFormat::Nv16), "Nv16");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -238,6 +238,15 @@ impl EventRef {
|
|||
self.structure().map_or(false, |s| s.has_name(name))
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_event_type_get_name")]
|
||||
#[inline]
|
||||
pub fn type_name(&self) -> &'static str {
|
||||
unsafe {
|
||||
let type_ = ffi::gst_event_type_get_name((*self.as_ptr()).type_);
|
||||
CStr::from_ptr(type_).to_str().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn view(&self) -> EventView {
|
||||
unsafe {
|
||||
let type_ = (*self.as_ptr()).type_;
|
||||
|
@ -3068,6 +3077,7 @@ mod tests {
|
|||
let flush_start_evt = FlushStart::builder()
|
||||
.other_fields(&[("extra-field", &true)])
|
||||
.build();
|
||||
assert_eq!(flush_start_evt.type_name(), "flush-start");
|
||||
match flush_start_evt.view() {
|
||||
EventView::FlushStart(flush_start_evt) => {
|
||||
assert!(flush_start_evt.structure().is_some());
|
||||
|
|
|
@ -83,6 +83,15 @@ impl MessageRef {
|
|||
self.structure().map_or(false, |s| s.has_name(name))
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_message_type_get_name")]
|
||||
#[inline]
|
||||
pub fn type_name(&self) -> &'static str {
|
||||
unsafe {
|
||||
let type_ = ffi::gst_message_type_get_name((*self.as_ptr()).type_);
|
||||
CStr::from_ptr(type_).to_str().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn view(&self) -> MessageView {
|
||||
unsafe {
|
||||
let type_ = (*self.as_ptr()).type_;
|
||||
|
@ -3956,6 +3965,7 @@ mod tests {
|
|||
// Message without arguments
|
||||
let seqnum = Seqnum::next();
|
||||
let eos_msg = Eos::builder().seqnum(seqnum).build();
|
||||
assert_eq!(eos_msg.type_name(), "eos");
|
||||
match eos_msg.view() {
|
||||
MessageView::Eos(eos_msg) => {
|
||||
assert_eq!(eos_msg.seqnum(), seqnum);
|
||||
|
|
|
@ -34,6 +34,15 @@ impl QueryRef {
|
|||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_query_type_get_name")]
|
||||
#[inline]
|
||||
pub fn type_name(&self) -> &'static str {
|
||||
unsafe {
|
||||
let type_ = ffi::gst_query_type_get_name((*self.as_ptr()).type_);
|
||||
CStr::from_ptr(type_).to_str().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "get_mut_structure")]
|
||||
#[doc(alias = "gst_query_writable_structure")]
|
||||
#[inline]
|
||||
|
|
Loading…
Reference in a new issue