forked from mirrors/gstreamer-rs
audio/video: proxy_getcaps() can't return None and get_caps() vfuncs must not return None
Other than in git master / 0.15, proxy_getcaps() on the video base classes still returns an Option to preserve API compatibility.
This commit is contained in:
parent
a40835351f
commit
25860f7701
7 changed files with 32 additions and 70 deletions
|
@ -163,6 +163,11 @@ status = "generate"
|
|||
name = "get_allocator"
|
||||
ignore = true
|
||||
|
||||
[[object.function]]
|
||||
name = "proxy_getcaps"
|
||||
[object.function.return]
|
||||
nullable = false
|
||||
|
||||
[[object]]
|
||||
name = "GstAudio.AudioEncoder"
|
||||
status = "generate"
|
||||
|
@ -186,3 +191,8 @@ status = "generate"
|
|||
[[object.function]]
|
||||
name = "get_latency"
|
||||
ignore = true
|
||||
|
||||
[[object.function]]
|
||||
name = "proxy_getcaps"
|
||||
[object.function.return]
|
||||
nullable = false
|
||||
|
|
|
@ -57,11 +57,7 @@ pub trait AudioDecoderExt: 'static {
|
|||
|
||||
fn merge_tags(&self, tags: Option<&gst::TagList>, mode: gst::TagMergeMode);
|
||||
|
||||
fn proxy_getcaps(
|
||||
&self,
|
||||
caps: Option<&gst::Caps>,
|
||||
filter: Option<&gst::Caps>,
|
||||
) -> Option<gst::Caps>;
|
||||
fn proxy_getcaps(&self, caps: Option<&gst::Caps>, filter: Option<&gst::Caps>) -> gst::Caps;
|
||||
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
fn set_allocation_caps(&self, allocation_caps: Option<&gst::Caps>);
|
||||
|
@ -214,11 +210,7 @@ impl<O: IsA<AudioDecoder>> AudioDecoderExt for O {
|
|||
}
|
||||
}
|
||||
|
||||
fn proxy_getcaps(
|
||||
&self,
|
||||
caps: Option<&gst::Caps>,
|
||||
filter: Option<&gst::Caps>,
|
||||
) -> Option<gst::Caps> {
|
||||
fn proxy_getcaps(&self, caps: Option<&gst::Caps>, filter: Option<&gst::Caps>) -> gst::Caps {
|
||||
unsafe {
|
||||
from_glib_full(gst_audio_sys::gst_audio_decoder_proxy_getcaps(
|
||||
self.as_ref().to_glib_none().0,
|
||||
|
|
|
@ -54,11 +54,7 @@ pub trait AudioEncoderExt: 'static {
|
|||
|
||||
fn merge_tags(&self, tags: Option<&gst::TagList>, mode: gst::TagMergeMode);
|
||||
|
||||
fn proxy_getcaps(
|
||||
&self,
|
||||
caps: Option<&gst::Caps>,
|
||||
filter: Option<&gst::Caps>,
|
||||
) -> Option<gst::Caps>;
|
||||
fn proxy_getcaps(&self, caps: Option<&gst::Caps>, filter: Option<&gst::Caps>) -> gst::Caps;
|
||||
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
fn set_allocation_caps(&self, allocation_caps: Option<&gst::Caps>);
|
||||
|
@ -204,11 +200,7 @@ impl<O: IsA<AudioEncoder>> AudioEncoderExt for O {
|
|||
}
|
||||
}
|
||||
|
||||
fn proxy_getcaps(
|
||||
&self,
|
||||
caps: Option<&gst::Caps>,
|
||||
filter: Option<&gst::Caps>,
|
||||
) -> Option<gst::Caps> {
|
||||
fn proxy_getcaps(&self, caps: Option<&gst::Caps>, filter: Option<&gst::Caps>) -> gst::Caps {
|
||||
unsafe {
|
||||
from_glib_full(gst_audio_sys::gst_audio_encoder_proxy_getcaps(
|
||||
self.as_ref().to_glib_none().0,
|
||||
|
|
|
@ -83,7 +83,7 @@ pub trait AudioDecoderImpl: AudioDecoderImplExt + ElementImpl + Send + Sync + 's
|
|||
self.parent_negotiate(element)
|
||||
}
|
||||
|
||||
fn get_caps(&self, element: &AudioDecoder, filter: Option<&gst::Caps>) -> Option<gst::Caps> {
|
||||
fn get_caps(&self, element: &AudioDecoder, filter: Option<&gst::Caps>) -> gst::Caps {
|
||||
self.parent_get_caps(element, filter)
|
||||
}
|
||||
|
||||
|
@ -157,11 +157,7 @@ pub trait AudioDecoderImplExt {
|
|||
|
||||
fn parent_negotiate(&self, element: &AudioDecoder) -> Result<(), gst::LoggableError>;
|
||||
|
||||
fn parent_get_caps(
|
||||
&self,
|
||||
element: &AudioDecoder,
|
||||
filter: Option<&gst::Caps>,
|
||||
) -> Option<gst::Caps>;
|
||||
fn parent_get_caps(&self, element: &AudioDecoder, filter: Option<&gst::Caps>) -> gst::Caps;
|
||||
|
||||
fn parent_sink_event(&self, element: &AudioDecoder, event: gst::Event) -> bool;
|
||||
|
||||
|
@ -402,11 +398,7 @@ impl<T: AudioDecoderImpl + ObjectImpl> AudioDecoderImplExt for T {
|
|||
}
|
||||
}
|
||||
|
||||
fn parent_get_caps(
|
||||
&self,
|
||||
element: &AudioDecoder,
|
||||
filter: Option<&gst::Caps>,
|
||||
) -> Option<gst::Caps> {
|
||||
fn parent_get_caps(&self, element: &AudioDecoder, filter: Option<&gst::Caps>) -> gst::Caps {
|
||||
unsafe {
|
||||
let data = self.get_type_data();
|
||||
let parent_class =
|
||||
|
@ -807,7 +799,7 @@ where
|
|||
let imp = instance.get_impl();
|
||||
let wrap: AudioDecoder = from_glib_borrow(ptr);
|
||||
|
||||
gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
|
||||
AudioDecoderImpl::get_caps(
|
||||
imp,
|
||||
&wrap,
|
||||
|
|
|
@ -74,7 +74,7 @@ pub trait AudioEncoderImpl: AudioEncoderImplExt + ElementImpl + Send + Sync + 's
|
|||
self.parent_negotiate(element)
|
||||
}
|
||||
|
||||
fn get_caps(&self, element: &AudioEncoder, filter: Option<&gst::Caps>) -> Option<gst::Caps> {
|
||||
fn get_caps(&self, element: &AudioEncoder, filter: Option<&gst::Caps>) -> gst::Caps {
|
||||
self.parent_get_caps(element, filter)
|
||||
}
|
||||
|
||||
|
@ -142,11 +142,7 @@ pub trait AudioEncoderImplExt {
|
|||
|
||||
fn parent_negotiate(&self, element: &AudioEncoder) -> Result<(), gst::LoggableError>;
|
||||
|
||||
fn parent_get_caps(
|
||||
&self,
|
||||
element: &AudioEncoder,
|
||||
filter: Option<&gst::Caps>,
|
||||
) -> Option<gst::Caps>;
|
||||
fn parent_get_caps(&self, element: &AudioEncoder, filter: Option<&gst::Caps>) -> gst::Caps;
|
||||
|
||||
fn parent_sink_event(&self, element: &AudioEncoder, event: gst::Event) -> bool;
|
||||
|
||||
|
@ -353,11 +349,7 @@ impl<T: AudioEncoderImpl + ObjectImpl> AudioEncoderImplExt for T {
|
|||
}
|
||||
}
|
||||
|
||||
fn parent_get_caps(
|
||||
&self,
|
||||
element: &AudioEncoder,
|
||||
filter: Option<&gst::Caps>,
|
||||
) -> Option<gst::Caps> {
|
||||
fn parent_get_caps(&self, element: &AudioEncoder, filter: Option<&gst::Caps>) -> gst::Caps {
|
||||
unsafe {
|
||||
let data = self.get_type_data();
|
||||
let parent_class =
|
||||
|
@ -725,7 +717,7 @@ where
|
|||
let imp = instance.get_impl();
|
||||
let wrap: AudioEncoder = from_glib_borrow(ptr);
|
||||
|
||||
gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
|
||||
AudioEncoderImpl::get_caps(
|
||||
imp,
|
||||
&wrap,
|
||||
|
|
|
@ -84,7 +84,7 @@ pub trait VideoDecoderImpl: VideoDecoderImplExt + ElementImpl + Send + Sync + 's
|
|||
self.parent_negotiate(element)
|
||||
}
|
||||
|
||||
fn get_caps(&self, element: &VideoDecoder, filter: Option<&gst::Caps>) -> Option<gst::Caps> {
|
||||
fn get_caps(&self, element: &VideoDecoder, filter: Option<&gst::Caps>) -> gst::Caps {
|
||||
self.parent_get_caps(element, filter)
|
||||
}
|
||||
|
||||
|
@ -158,11 +158,7 @@ pub trait VideoDecoderImplExt {
|
|||
|
||||
fn parent_negotiate(&self, element: &VideoDecoder) -> Result<(), gst::LoggableError>;
|
||||
|
||||
fn parent_get_caps(
|
||||
&self,
|
||||
element: &VideoDecoder,
|
||||
filter: Option<&gst::Caps>,
|
||||
) -> Option<gst::Caps>;
|
||||
fn parent_get_caps(&self, element: &VideoDecoder, filter: Option<&gst::Caps>) -> gst::Caps;
|
||||
|
||||
fn parent_sink_event(&self, element: &VideoDecoder, event: gst::Event) -> bool;
|
||||
|
||||
|
@ -393,11 +389,7 @@ impl<T: VideoDecoderImpl + ObjectImpl> VideoDecoderImplExt for T {
|
|||
}
|
||||
}
|
||||
|
||||
fn parent_get_caps(
|
||||
&self,
|
||||
element: &VideoDecoder,
|
||||
filter: Option<&gst::Caps>,
|
||||
) -> Option<gst::Caps> {
|
||||
fn parent_get_caps(&self, element: &VideoDecoder, filter: Option<&gst::Caps>) -> gst::Caps {
|
||||
unsafe {
|
||||
let data = self.get_type_data();
|
||||
let parent_class =
|
||||
|
@ -405,7 +397,7 @@ impl<T: VideoDecoderImpl + ObjectImpl> VideoDecoderImplExt for T {
|
|||
(*parent_class)
|
||||
.getcaps
|
||||
.map(|f| from_glib_full(f(element.to_glib_none().0, filter.to_glib_none().0)))
|
||||
.unwrap_or(element.proxy_getcaps(None, filter))
|
||||
.unwrap_or(element.proxy_getcaps(None, filter).unwrap())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -798,7 +790,7 @@ where
|
|||
let imp = instance.get_impl();
|
||||
let wrap: VideoDecoder = from_glib_borrow(ptr);
|
||||
|
||||
gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
|
||||
VideoDecoderImpl::get_caps(
|
||||
imp,
|
||||
&wrap,
|
||||
|
|
|
@ -69,7 +69,7 @@ pub trait VideoEncoderImpl: VideoEncoderImplExt + ElementImpl + Send + Sync + 's
|
|||
self.parent_negotiate(element)
|
||||
}
|
||||
|
||||
fn get_caps(&self, element: &VideoEncoder, filter: Option<&gst::Caps>) -> Option<gst::Caps> {
|
||||
fn get_caps(&self, element: &VideoEncoder, filter: Option<&gst::Caps>) -> gst::Caps {
|
||||
self.parent_get_caps(element, filter)
|
||||
}
|
||||
|
||||
|
@ -133,11 +133,7 @@ pub trait VideoEncoderImplExt {
|
|||
|
||||
fn parent_negotiate(&self, element: &VideoEncoder) -> Result<(), gst::LoggableError>;
|
||||
|
||||
fn parent_get_caps(
|
||||
&self,
|
||||
element: &VideoEncoder,
|
||||
filter: Option<&gst::Caps>,
|
||||
) -> Option<gst::Caps>;
|
||||
fn parent_get_caps(&self, element: &VideoEncoder, filter: Option<&gst::Caps>) -> gst::Caps;
|
||||
|
||||
fn parent_sink_event(&self, element: &VideoEncoder, event: gst::Event) -> bool;
|
||||
|
||||
|
@ -329,11 +325,7 @@ impl<T: VideoEncoderImpl + ObjectImpl> VideoEncoderImplExt for T {
|
|||
}
|
||||
}
|
||||
|
||||
fn parent_get_caps(
|
||||
&self,
|
||||
element: &VideoEncoder,
|
||||
filter: Option<&gst::Caps>,
|
||||
) -> Option<gst::Caps> {
|
||||
fn parent_get_caps(&self, element: &VideoEncoder, filter: Option<&gst::Caps>) -> gst::Caps {
|
||||
unsafe {
|
||||
let data = self.get_type_data();
|
||||
let parent_class =
|
||||
|
@ -341,7 +333,7 @@ impl<T: VideoEncoderImpl + ObjectImpl> VideoEncoderImplExt for T {
|
|||
(*parent_class)
|
||||
.getcaps
|
||||
.map(|f| from_glib_full(f(element.to_glib_none().0, filter.to_glib_none().0)))
|
||||
.unwrap_or(element.proxy_getcaps(None, filter))
|
||||
.unwrap_or(element.proxy_getcaps(None, filter).unwrap())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -688,7 +680,7 @@ where
|
|||
let imp = instance.get_impl();
|
||||
let wrap: VideoEncoder = from_glib_borrow(ptr);
|
||||
|
||||
gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
|
||||
VideoEncoderImpl::get_caps(
|
||||
imp,
|
||||
&wrap,
|
||||
|
|
Loading…
Reference in a new issue