mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-06-12 19:29:26 +00:00
pbutils: Manually implement DiscovererStreamInfo::stream_id()
It can return `NULL` in some cases. The next release will use an `Option` but to keep backwards compatibility here, `NULL` is mapped to the empty string for now. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1274>
This commit is contained in:
parent
545781d241
commit
24a00b9929
|
@ -279,6 +279,10 @@ final_type = false
|
||||||
name = "list_free"
|
name = "list_free"
|
||||||
ignore = true
|
ignore = true
|
||||||
|
|
||||||
|
[[object.function]]
|
||||||
|
name = "get_stream_id"
|
||||||
|
manual = true
|
||||||
|
|
||||||
[[object]]
|
[[object]]
|
||||||
name = "GstPbutils.DiscovererSubtitleInfo"
|
name = "GstPbutils.DiscovererSubtitleInfo"
|
||||||
status = "generate"
|
status = "generate"
|
||||||
|
|
|
@ -40,10 +40,6 @@ pub trait DiscovererStreamInfoExt: 'static {
|
||||||
#[must_use]
|
#[must_use]
|
||||||
fn previous(&self) -> Option<DiscovererStreamInfo>;
|
fn previous(&self) -> Option<DiscovererStreamInfo>;
|
||||||
|
|
||||||
#[doc(alias = "gst_discoverer_stream_info_get_stream_id")]
|
|
||||||
#[doc(alias = "get_stream_id")]
|
|
||||||
fn stream_id(&self) -> glib::GString;
|
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
#[doc(alias = "gst_discoverer_stream_info_get_stream_number")]
|
#[doc(alias = "gst_discoverer_stream_info_get_stream_number")]
|
||||||
|
@ -96,14 +92,6 @@ impl<O: IsA<DiscovererStreamInfo>> DiscovererStreamInfoExt for O {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn stream_id(&self) -> glib::GString {
|
|
||||||
unsafe {
|
|
||||||
from_glib_none(ffi::gst_discoverer_stream_info_get_stream_id(
|
|
||||||
self.as_ref().to_glib_none().0,
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
fn stream_number(&self) -> i32 {
|
fn stream_number(&self) -> i32 {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// Take a look at the license at the top of the repository in the LICENSE file.
|
// Take a look at the license at the top of the repository in the LICENSE file.
|
||||||
|
|
||||||
|
use glib::translate::*;
|
||||||
|
|
||||||
use crate::{prelude::*, DiscovererStreamInfo};
|
use crate::{prelude::*, DiscovererStreamInfo};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -42,6 +44,18 @@ impl DiscovererStreamInfo {
|
||||||
direction_forward: false,
|
direction_forward: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn stream_id(&self) -> glib::GString {
|
||||||
|
unsafe {
|
||||||
|
let ptr = ffi::gst_discoverer_stream_info_get_stream_id(self.as_ref().to_glib_none().0);
|
||||||
|
|
||||||
|
if ptr.is_null() {
|
||||||
|
glib::GString::new()
|
||||||
|
} else {
|
||||||
|
from_glib_none(ptr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::iter::FusedIterator for Iter {}
|
impl std::iter::FusedIterator for Iter {}
|
||||||
|
|
Loading…
Reference in a new issue