gstreamer: Handle NULL caps when parsing the allocation query

With the next release this will be handled explicitly and setting no
caps will also be possible when creating allocation queries.

See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1194

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1195>
This commit is contained in:
Sebastian Dröge 2023-01-19 16:10:31 +02:00
parent 24f8b74f21
commit ee2505388b

View file

@ -1019,7 +1019,16 @@ impl Allocation {
ffi::gst_query_parse_allocation(self.as_mut_ptr(), &mut caps, need_pool.as_mut_ptr());
(
crate::CapsRef::from_ptr(caps),
if caps.is_null() {
#[link(name = "gstreamer-1.0")]
extern "C" {
pub static _gst_caps_any: *mut ffi::GstCaps;
}
crate::CapsRef::from_ptr(_gst_caps_any)
} else {
crate::CapsRef::from_ptr(caps)
},
from_glib(need_pool.assume_init()),
)
}