forked from mirrors/gstreamer-rs
Manual try_from_glib shortcuts + unsafe
This commit is contained in:
parent
03e8e6d22f
commit
8dda8def6e
27 changed files with 69 additions and 79 deletions
|
@ -210,7 +210,7 @@ impl AppSrc {
|
|||
#[doc(alias = "gst_app_src_push_buffer")]
|
||||
pub fn push_buffer(&self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe {
|
||||
gst::FlowSuccess::try_from_glib(ffi::gst_app_src_push_buffer(
|
||||
try_from_glib(ffi::gst_app_src_push_buffer(
|
||||
self.to_glib_none().0,
|
||||
buffer.into_ptr(),
|
||||
))
|
||||
|
@ -225,7 +225,7 @@ impl AppSrc {
|
|||
list: gst::BufferList,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe {
|
||||
gst::FlowSuccess::try_from_glib(ffi::gst_app_src_push_buffer_list(
|
||||
try_from_glib(ffi::gst_app_src_push_buffer_list(
|
||||
self.to_glib_none().0,
|
||||
list.into_ptr(),
|
||||
))
|
||||
|
|
|
@ -66,7 +66,7 @@ impl<O: IsA<AudioDecoder>> AudioDecoderExtManual for O {
|
|||
frames: i32,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe {
|
||||
gst::FlowSuccess::try_from_glib(ffi::gst_audio_decoder_finish_frame(
|
||||
try_from_glib(ffi::gst_audio_decoder_finish_frame(
|
||||
self.as_ref().to_glib_none().0,
|
||||
buffer.map(|b| b.into_ptr()).unwrap_or(ptr::null_mut()),
|
||||
frames,
|
||||
|
@ -82,7 +82,7 @@ impl<O: IsA<AudioDecoder>> AudioDecoderExtManual for O {
|
|||
buffer: Option<gst::Buffer>,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe {
|
||||
gst::FlowSuccess::try_from_glib(ffi::gst_audio_decoder_finish_subframe(
|
||||
try_from_glib(ffi::gst_audio_decoder_finish_subframe(
|
||||
self.as_ref().to_glib_none().0,
|
||||
buffer.map(|b| b.into_ptr()).unwrap_or(ptr::null_mut()),
|
||||
))
|
||||
|
@ -160,7 +160,7 @@ impl<O: IsA<AudioDecoder>> AudioDecoderExtManual for O {
|
|||
line: u32,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe {
|
||||
gst::FlowSuccess::try_from_glib(_gst_audio_decoder_error(
|
||||
try_from_glib(_gst_audio_decoder_error(
|
||||
self.as_ref().to_glib_none().0,
|
||||
weight,
|
||||
T::domain().into_glib(),
|
||||
|
|
|
@ -36,7 +36,7 @@ impl<O: IsA<AudioEncoder>> AudioEncoderExtManual for O {
|
|||
frames: i32,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe {
|
||||
gst::FlowSuccess::try_from_glib(ffi::gst_audio_encoder_finish_frame(
|
||||
try_from_glib(ffi::gst_audio_encoder_finish_frame(
|
||||
self.as_ref().to_glib_none().0,
|
||||
buffer.map(|b| b.into_ptr()).unwrap_or(ptr::null_mut()),
|
||||
frames,
|
||||
|
|
|
@ -324,7 +324,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
|
|||
(*parent_class)
|
||||
.handle_frame
|
||||
.map(|f| {
|
||||
gst::FlowSuccess::try_from_glib(f(
|
||||
try_from_glib(f(
|
||||
element.unsafe_cast_ref::<AudioDecoder>().to_glib_none().0,
|
||||
buffer
|
||||
.map(|buffer| buffer.as_mut_ptr() as *mut *mut gst::ffi::GstBuffer)
|
||||
|
|
|
@ -279,7 +279,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
|
|||
(*parent_class)
|
||||
.handle_frame
|
||||
.map(|f| {
|
||||
gst::FlowSuccess::try_from_glib(f(
|
||||
try_from_glib(f(
|
||||
element.unsafe_cast_ref::<AudioEncoder>().to_glib_none().0,
|
||||
buffer
|
||||
.map(|buffer| buffer.as_mut_ptr() as *mut *mut gst::ffi::GstBuffer)
|
||||
|
|
|
@ -105,7 +105,7 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
|
|||
|
||||
fn finish_buffer(&self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe {
|
||||
gst::FlowSuccess::try_from_glib(ffi::gst_aggregator_finish_buffer(
|
||||
try_from_glib(ffi::gst_aggregator_finish_buffer(
|
||||
self.as_ref().to_glib_none().0,
|
||||
buffer.into_ptr(),
|
||||
))
|
||||
|
@ -119,7 +119,7 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
|
|||
bufferlist: gst::BufferList,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe {
|
||||
gst::FlowSuccess::try_from_glib(ffi::gst_aggregator_finish_buffer_list(
|
||||
try_from_glib(ffi::gst_aggregator_finish_buffer_list(
|
||||
self.as_ref().to_glib_none().0,
|
||||
bufferlist.into_ptr(),
|
||||
))
|
||||
|
|
|
@ -132,7 +132,7 @@ impl<O: IsA<BaseParse>> BaseParseExtManual for O {
|
|||
size: u32,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe {
|
||||
gst::FlowSuccess::try_from_glib(ffi::gst_base_parse_finish_frame(
|
||||
try_from_glib(ffi::gst_base_parse_finish_frame(
|
||||
self.as_ref().to_glib_none().0,
|
||||
frame.to_glib_none().0,
|
||||
i32::try_from(size).expect("size higher than i32::MAX"),
|
||||
|
|
|
@ -73,7 +73,7 @@ impl FlowCombiner {
|
|||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
let fret: gst::FlowReturn = fret.into();
|
||||
unsafe {
|
||||
gst::FlowSuccess::try_from_glib(ffi::gst_flow_combiner_update_flow(
|
||||
try_from_glib(ffi::gst_flow_combiner_update_flow(
|
||||
self.to_glib_none().0,
|
||||
fret.into_glib(),
|
||||
))
|
||||
|
@ -88,7 +88,7 @@ impl FlowCombiner {
|
|||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
let fret: gst::FlowReturn = fret.into();
|
||||
unsafe {
|
||||
gst::FlowSuccess::try_from_glib(ffi::gst_flow_combiner_update_pad_flow(
|
||||
try_from_glib(ffi::gst_flow_combiner_update_pad_flow(
|
||||
self.to_glib_none().0,
|
||||
pad.as_ref().to_glib_none().0,
|
||||
fret.into_glib(),
|
||||
|
|
|
@ -288,7 +288,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
(*parent_class)
|
||||
.flush
|
||||
.map(|f| {
|
||||
gst::FlowSuccess::try_from_glib(f(aggregator
|
||||
try_from_glib(f(aggregator
|
||||
.unsafe_cast_ref::<Aggregator>()
|
||||
.to_glib_none()
|
||||
.0))
|
||||
|
@ -328,7 +328,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
let f = (*parent_class)
|
||||
.finish_buffer
|
||||
.expect("Missing parent function `finish_buffer`");
|
||||
gst::FlowSuccess::try_from_glib(f(
|
||||
try_from_glib(f(
|
||||
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
|
||||
buffer.into_ptr(),
|
||||
))
|
||||
|
@ -348,7 +348,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
let f = (*parent_class)
|
||||
.finish_buffer_list
|
||||
.expect("Missing parent function `finish_buffer_list`");
|
||||
gst::FlowSuccess::try_from_glib(f(
|
||||
try_from_glib(f(
|
||||
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
|
||||
buffer_list.into_ptr(),
|
||||
))
|
||||
|
@ -389,7 +389,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
let f = (*parent_class)
|
||||
.sink_event_pre_queue
|
||||
.expect("Missing parent function `sink_event_pre_queue`");
|
||||
gst::FlowSuccess::try_from_glib(f(
|
||||
try_from_glib(f(
|
||||
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
|
||||
aggregator_pad.to_glib_none().0,
|
||||
event.into_ptr(),
|
||||
|
@ -502,7 +502,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
let f = (*parent_class)
|
||||
.aggregate
|
||||
.expect("Missing parent function `aggregate`");
|
||||
gst::FlowSuccess::try_from_glib(f(
|
||||
try_from_glib(f(
|
||||
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
|
||||
timeout.into_glib(),
|
||||
))
|
||||
|
|
|
@ -54,7 +54,7 @@ impl<T: AggregatorPadImpl> AggregatorPadImplExt for T {
|
|||
(*parent_class)
|
||||
.flush
|
||||
.map(|f| {
|
||||
gst::FlowSuccess::try_from_glib(f(
|
||||
try_from_glib(f(
|
||||
aggregator_pad
|
||||
.unsafe_cast_ref::<AggregatorPad>()
|
||||
.to_glib_none()
|
||||
|
|
|
@ -152,7 +152,7 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
|
|||
(*parent_class)
|
||||
.handle_frame
|
||||
.map(|f| {
|
||||
let res = gst::FlowSuccess::try_from_glib(f(
|
||||
let res = try_from_glib(f(
|
||||
element.unsafe_cast_ref::<BaseParse>().to_glib_none().0,
|
||||
frame.to_glib_none().0,
|
||||
&mut skipsize,
|
||||
|
|
|
@ -179,7 +179,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
|||
(*parent_class)
|
||||
.render
|
||||
.map(|f| {
|
||||
gst::FlowSuccess::try_from_glib(f(
|
||||
try_from_glib(f(
|
||||
element.unsafe_cast_ref::<BaseSink>().to_glib_none().0,
|
||||
buffer.to_glib_none().0,
|
||||
))
|
||||
|
@ -199,7 +199,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
|||
(*parent_class)
|
||||
.prepare
|
||||
.map(|f| {
|
||||
gst::FlowSuccess::try_from_glib(f(
|
||||
try_from_glib(f(
|
||||
element.unsafe_cast_ref::<BaseSink>().to_glib_none().0,
|
||||
buffer.to_glib_none().0,
|
||||
))
|
||||
|
@ -219,7 +219,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
|||
(*parent_class)
|
||||
.render_list
|
||||
.map(|f| {
|
||||
gst::FlowSuccess::try_from_glib(f(
|
||||
try_from_glib(f(
|
||||
element.unsafe_cast_ref::<BaseSink>().to_glib_none().0,
|
||||
list.to_glib_none().0,
|
||||
))
|
||||
|
@ -244,7 +244,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
|||
(*parent_class)
|
||||
.prepare_list
|
||||
.map(|f| {
|
||||
gst::FlowSuccess::try_from_glib(f(
|
||||
try_from_glib(f(
|
||||
element.unsafe_cast_ref::<BaseSink>().to_glib_none().0,
|
||||
list.to_glib_none().0,
|
||||
))
|
||||
|
|
|
@ -284,7 +284,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
|||
(*parent_class)
|
||||
.fill
|
||||
.map(|f| {
|
||||
gst::FlowSuccess::try_from_glib(f(
|
||||
try_from_glib(f(
|
||||
element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
|
||||
offset,
|
||||
length,
|
||||
|
|
|
@ -601,7 +601,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
|||
(*parent_class)
|
||||
.transform
|
||||
.map(|f| {
|
||||
gst::FlowSuccess::try_from_glib(f(
|
||||
try_from_glib(f(
|
||||
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||
inbuf.to_glib_none().0,
|
||||
outbuf.as_mut_ptr(),
|
||||
|
@ -642,7 +642,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
|||
}
|
||||
});
|
||||
|
||||
gst::FlowSuccess::try_from_glib(f(
|
||||
try_from_glib(f(
|
||||
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||
buf.as_mut_ptr() as *mut _,
|
||||
))
|
||||
|
@ -673,7 +673,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
|||
|
||||
// FIXME: Wrong signature in FFI
|
||||
let buf: *mut gst::ffi::GstBuffer = buf.to_glib_none().0;
|
||||
gst::FlowSuccess::try_from_glib(f(
|
||||
try_from_glib(f(
|
||||
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||
buf as *mut _,
|
||||
))
|
||||
|
@ -755,7 +755,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
|||
.submit_input_buffer
|
||||
.expect("Missing parent function `submit_input_buffer`");
|
||||
|
||||
gst::FlowSuccess::try_from_glib(f(
|
||||
try_from_glib(f(
|
||||
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||
is_discont.into_glib(),
|
||||
inbuf.into_ptr(),
|
||||
|
|
|
@ -51,7 +51,7 @@ impl<T: PushSrcImpl> PushSrcImplExt for T {
|
|||
(*parent_class)
|
||||
.fill
|
||||
.map(|f| {
|
||||
gst::FlowSuccess::try_from_glib(f(
|
||||
try_from_glib(f(
|
||||
element.unsafe_cast_ref::<PushSrc>().to_glib_none().0,
|
||||
buffer.as_mut_ptr(),
|
||||
))
|
||||
|
|
|
@ -301,12 +301,7 @@ impl Harness {
|
|||
|
||||
#[doc(alias = "gst_harness_push")]
|
||||
pub fn push(&mut self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe {
|
||||
gst::FlowSuccess::try_from_glib(ffi::gst_harness_push(
|
||||
self.0.as_ptr(),
|
||||
buffer.into_ptr(),
|
||||
))
|
||||
}
|
||||
unsafe { try_from_glib(ffi::gst_harness_push(self.0.as_ptr(), buffer.into_ptr())) }
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_harness_push_and_pull")]
|
||||
|
@ -332,12 +327,12 @@ impl Harness {
|
|||
|
||||
#[doc(alias = "gst_harness_push_from_src")]
|
||||
pub fn push_from_src(&mut self) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe { gst::FlowSuccess::try_from_glib(ffi::gst_harness_push_from_src(self.0.as_ptr())) }
|
||||
unsafe { try_from_glib(ffi::gst_harness_push_from_src(self.0.as_ptr())) }
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_harness_push_to_sink")]
|
||||
pub fn push_to_sink(&mut self) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe { gst::FlowSuccess::try_from_glib(ffi::gst_harness_push_to_sink(self.0.as_ptr())) }
|
||||
unsafe { try_from_glib(ffi::gst_harness_push_to_sink(self.0.as_ptr())) }
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_harness_push_upstream_event")]
|
||||
|
@ -457,7 +452,7 @@ impl Harness {
|
|||
#[doc(alias = "gst_harness_sink_push_many")]
|
||||
pub fn sink_push_many(&mut self, pushes: u32) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe {
|
||||
gst::FlowSuccess::try_from_glib(ffi::gst_harness_sink_push_many(
|
||||
try_from_glib(ffi::gst_harness_sink_push_many(
|
||||
self.0.as_ptr(),
|
||||
pushes as i32,
|
||||
))
|
||||
|
@ -471,7 +466,7 @@ impl Harness {
|
|||
pushes: u32,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe {
|
||||
gst::FlowSuccess::try_from_glib(ffi::gst_harness_src_crank_and_push_many(
|
||||
try_from_glib(ffi::gst_harness_src_crank_and_push_many(
|
||||
self.0.as_ptr(),
|
||||
cranks as i32,
|
||||
pushes as i32,
|
||||
|
|
|
@ -269,7 +269,7 @@ impl<T: VideoDecoderImpl> VideoDecoderImplExt for T {
|
|||
(*parent_class)
|
||||
.finish
|
||||
.map(|f| {
|
||||
gst::FlowSuccess::try_from_glib(f(element
|
||||
try_from_glib(f(element
|
||||
.unsafe_cast_ref::<VideoDecoder>()
|
||||
.to_glib_none()
|
||||
.0))
|
||||
|
@ -285,7 +285,7 @@ impl<T: VideoDecoderImpl> VideoDecoderImplExt for T {
|
|||
(*parent_class)
|
||||
.drain
|
||||
.map(|f| {
|
||||
gst::FlowSuccess::try_from_glib(f(element
|
||||
try_from_glib(f(element
|
||||
.unsafe_cast_ref::<VideoDecoder>()
|
||||
.to_glib_none()
|
||||
.0))
|
||||
|
@ -331,7 +331,7 @@ impl<T: VideoDecoderImpl> VideoDecoderImplExt for T {
|
|||
(*parent_class)
|
||||
.parse
|
||||
.map(|f| {
|
||||
gst::FlowSuccess::try_from_glib(f(
|
||||
try_from_glib(f(
|
||||
element.unsafe_cast_ref::<VideoDecoder>().to_glib_none().0,
|
||||
frame.to_glib_none().0,
|
||||
adapter.to_glib_none().0,
|
||||
|
@ -353,7 +353,7 @@ impl<T: VideoDecoderImpl> VideoDecoderImplExt for T {
|
|||
(*parent_class)
|
||||
.handle_frame
|
||||
.map(|f| {
|
||||
gst::FlowSuccess::try_from_glib(f(
|
||||
try_from_glib(f(
|
||||
element.unsafe_cast_ref::<VideoDecoder>().to_glib_none().0,
|
||||
frame.to_glib_none().0,
|
||||
))
|
||||
|
|
|
@ -245,7 +245,7 @@ impl<T: VideoEncoderImpl> VideoEncoderImplExt for T {
|
|||
(*parent_class)
|
||||
.finish
|
||||
.map(|f| {
|
||||
gst::FlowSuccess::try_from_glib(f(element
|
||||
try_from_glib(f(element
|
||||
.unsafe_cast_ref::<VideoEncoder>()
|
||||
.to_glib_none()
|
||||
.0))
|
||||
|
@ -289,7 +289,7 @@ impl<T: VideoEncoderImpl> VideoEncoderImplExt for T {
|
|||
(*parent_class)
|
||||
.handle_frame
|
||||
.map(|f| {
|
||||
gst::FlowSuccess::try_from_glib(f(
|
||||
try_from_glib(f(
|
||||
element.unsafe_cast_ref::<VideoEncoder>().to_glib_none().0,
|
||||
frame.to_glib_none().0,
|
||||
))
|
||||
|
|
|
@ -120,7 +120,7 @@ impl<T: VideoFilterImpl> VideoFilterImplExt for T {
|
|||
(*parent_class)
|
||||
.transform_frame
|
||||
.map(|f| {
|
||||
gst::FlowSuccess::try_from_glib(f(
|
||||
try_from_glib(f(
|
||||
element.unsafe_cast_ref::<VideoFilter>().to_glib_none().0,
|
||||
mut_override(inframe.as_ptr()),
|
||||
outframe.as_mut_ptr(),
|
||||
|
@ -167,7 +167,7 @@ impl<T: VideoFilterImpl> VideoFilterImplExt for T {
|
|||
}
|
||||
});
|
||||
|
||||
gst::FlowSuccess::try_from_glib(f(
|
||||
try_from_glib(f(
|
||||
element.unsafe_cast_ref::<VideoFilter>().to_glib_none().0,
|
||||
frame.as_mut_ptr(),
|
||||
))
|
||||
|
@ -199,7 +199,7 @@ impl<T: VideoFilterImpl> VideoFilterImplExt for T {
|
|||
}
|
||||
});
|
||||
|
||||
gst::FlowSuccess::try_from_glib(f(
|
||||
try_from_glib(f(
|
||||
element.unsafe_cast_ref::<VideoFilter>().to_glib_none().0,
|
||||
mut_override(frame.as_ptr()),
|
||||
))
|
||||
|
|
|
@ -37,7 +37,7 @@ impl<T: VideoSinkImpl> VideoSinkImplExt for T {
|
|||
(*parent_class)
|
||||
.show_frame
|
||||
.map(|f| {
|
||||
gst::FlowSuccess::try_from_glib(f(
|
||||
try_from_glib(f(
|
||||
element.unsafe_cast_ref::<VideoSink>().to_glib_none().0,
|
||||
buffer.to_glib_none().0,
|
||||
))
|
||||
|
|
|
@ -102,13 +102,11 @@ impl<O: IsA<VideoDecoder>> VideoDecoderExtManual for O {
|
|||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe {
|
||||
let params_ptr = params.to_glib_none().0 as *mut _;
|
||||
gst::FlowSuccess::try_from_glib(
|
||||
ffi::gst_video_decoder_allocate_output_frame_with_params(
|
||||
self.as_ref().to_glib_none().0,
|
||||
frame.to_glib_none().0,
|
||||
params_ptr,
|
||||
),
|
||||
)
|
||||
try_from_glib(ffi::gst_video_decoder_allocate_output_frame_with_params(
|
||||
self.as_ref().to_glib_none().0,
|
||||
frame.to_glib_none().0,
|
||||
params_ptr,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,7 +127,7 @@ impl<O: IsA<VideoDecoder>> VideoDecoderExtManual for O {
|
|||
#[doc(alias = "gst_video_decoder_finish_frame")]
|
||||
fn finish_frame(&self, frame: VideoCodecFrame) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe {
|
||||
gst::FlowSuccess::try_from_glib(ffi::gst_video_decoder_finish_frame(
|
||||
try_from_glib(ffi::gst_video_decoder_finish_frame(
|
||||
self.as_ref().to_glib_none().0,
|
||||
frame.into_ptr(),
|
||||
))
|
||||
|
@ -146,7 +144,7 @@ impl<O: IsA<VideoDecoder>> VideoDecoderExtManual for O {
|
|||
#[doc(alias = "gst_video_decoder_drop_frame")]
|
||||
fn drop_frame(&self, frame: VideoCodecFrame) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe {
|
||||
gst::FlowSuccess::try_from_glib(ffi::gst_video_decoder_drop_frame(
|
||||
try_from_glib(ffi::gst_video_decoder_drop_frame(
|
||||
self.as_ref().to_glib_none().0,
|
||||
frame.into_ptr(),
|
||||
))
|
||||
|
@ -330,7 +328,7 @@ impl<O: IsA<VideoDecoder>> VideoDecoderExtManual for O {
|
|||
line: u32,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe {
|
||||
gst::FlowSuccess::try_from_glib(_gst_video_decoder_error(
|
||||
try_from_glib(_gst_video_decoder_error(
|
||||
self.as_ref().to_glib_none().0,
|
||||
weight,
|
||||
T::domain().into_glib(),
|
||||
|
|
|
@ -76,7 +76,7 @@ impl<O: IsA<VideoEncoder>> VideoEncoderExtManual for O {
|
|||
size: usize,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe {
|
||||
gst::FlowSuccess::try_from_glib(ffi::gst_video_encoder_allocate_output_frame(
|
||||
try_from_glib(ffi::gst_video_encoder_allocate_output_frame(
|
||||
self.as_ref().to_glib_none().0,
|
||||
frame.to_glib_none().0,
|
||||
size,
|
||||
|
@ -102,7 +102,7 @@ impl<O: IsA<VideoEncoder>> VideoEncoderExtManual for O {
|
|||
frame: Option<VideoCodecFrame>,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe {
|
||||
gst::FlowSuccess::try_from_glib(ffi::gst_video_encoder_finish_frame(
|
||||
try_from_glib(ffi::gst_video_encoder_finish_frame(
|
||||
self.as_ref().to_glib_none().0,
|
||||
frame.map(|f| f.into_ptr()).unwrap_or(ptr::null_mut()),
|
||||
))
|
||||
|
@ -113,7 +113,7 @@ impl<O: IsA<VideoEncoder>> VideoEncoderExtManual for O {
|
|||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
||||
fn finish_subframe(&self, frame: &VideoCodecFrame) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
unsafe {
|
||||
gst::FlowSuccess::try_from_glib(ffi::gst_video_encoder_finish_subframe(
|
||||
try_from_glib(ffi::gst_video_encoder_finish_subframe(
|
||||
self.as_ref().to_glib_none().0,
|
||||
frame.to_glib_none().0,
|
||||
))
|
||||
|
|
|
@ -48,10 +48,7 @@ impl ClockId {
|
|||
pub fn wait(&self) -> (Result<ClockSuccess, ClockError>, ClockTimeDiff) {
|
||||
unsafe {
|
||||
let mut jitter = 0;
|
||||
let res = ClockSuccess::try_from_glib(ffi::gst_clock_id_wait(
|
||||
self.to_glib_none().0,
|
||||
&mut jitter,
|
||||
));
|
||||
let res = try_from_glib(ffi::gst_clock_id_wait(self.to_glib_none().0, &mut jitter));
|
||||
(res, jitter)
|
||||
}
|
||||
}
|
||||
|
@ -169,7 +166,7 @@ impl SingleShotClockId {
|
|||
let func: Box<Option<F>> = Box::new(Some(func));
|
||||
|
||||
unsafe {
|
||||
ClockSuccess::try_from_glib(ffi::gst_clock_id_wait_async(
|
||||
try_from_glib(ffi::gst_clock_id_wait_async(
|
||||
self.to_glib_none().0,
|
||||
Some(trampoline::<F>),
|
||||
Box::into_raw(func) as gpointer,
|
||||
|
@ -273,7 +270,7 @@ impl PeriodicClockId {
|
|||
|
||||
let func: Box<F> = Box::new(func);
|
||||
unsafe {
|
||||
ClockSuccess::try_from_glib(ffi::gst_clock_id_wait_async(
|
||||
try_from_glib(ffi::gst_clock_id_wait_async(
|
||||
self.to_glib_none().0,
|
||||
Some(trampoline::<F>),
|
||||
Box::into_raw(func) as gpointer,
|
||||
|
|
|
@ -317,7 +317,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
|
||||
fn chain(&self, buffer: Buffer) -> Result<FlowSuccess, FlowError> {
|
||||
unsafe {
|
||||
FlowSuccess::try_from_glib(ffi::gst_pad_chain(
|
||||
try_from_glib(ffi::gst_pad_chain(
|
||||
self.as_ref().to_glib_none().0,
|
||||
buffer.into_ptr(),
|
||||
))
|
||||
|
@ -326,7 +326,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
|
||||
fn push(&self, buffer: Buffer) -> Result<FlowSuccess, FlowError> {
|
||||
unsafe {
|
||||
FlowSuccess::try_from_glib(ffi::gst_pad_push(
|
||||
try_from_glib(ffi::gst_pad_push(
|
||||
self.as_ref().to_glib_none().0,
|
||||
buffer.into_ptr(),
|
||||
))
|
||||
|
@ -335,7 +335,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
|
||||
fn chain_list(&self, list: BufferList) -> Result<FlowSuccess, FlowError> {
|
||||
unsafe {
|
||||
FlowSuccess::try_from_glib(ffi::gst_pad_chain_list(
|
||||
try_from_glib(ffi::gst_pad_chain_list(
|
||||
self.as_ref().to_glib_none().0,
|
||||
list.into_ptr(),
|
||||
))
|
||||
|
@ -344,7 +344,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
|
||||
fn push_list(&self, list: BufferList) -> Result<FlowSuccess, FlowError> {
|
||||
unsafe {
|
||||
FlowSuccess::try_from_glib(ffi::gst_pad_push_list(
|
||||
try_from_glib(ffi::gst_pad_push_list(
|
||||
self.as_ref().to_glib_none().0,
|
||||
list.into_ptr(),
|
||||
))
|
||||
|
@ -1035,7 +1035,7 @@ unsafe fn create_probe_info<'a>(
|
|||
info: *mut ffi::GstPadProbeInfo,
|
||||
) -> (PadProbeInfo<'a>, Option<glib::Type>) {
|
||||
let mut data_type = None;
|
||||
let flow_res = FlowSuccess::try_from_glib((*info).ABI.abi.flow_ret);
|
||||
let flow_res = try_from_glib((*info).ABI.abi.flow_ret);
|
||||
let info = PadProbeInfo {
|
||||
mask: from_glib((*info).type_),
|
||||
id: Some(PadProbeId(NonZeroU64::new_unchecked((*info).id as u64))),
|
||||
|
|
|
@ -50,7 +50,7 @@ impl<O: IsA<ProxyPad>> ProxyPadExtManual for O {
|
|||
) -> Result<FlowSuccess, FlowError> {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
FlowSuccess::try_from_glib(ffi::gst_proxy_pad_chain_default(
|
||||
try_from_glib(ffi::gst_proxy_pad_chain_default(
|
||||
self.as_ptr() as *mut ffi::GstPad,
|
||||
parent.map(|p| p.as_ref()).to_glib_none().0,
|
||||
buffer.into_ptr(),
|
||||
|
@ -65,7 +65,7 @@ impl<O: IsA<ProxyPad>> ProxyPadExtManual for O {
|
|||
) -> Result<FlowSuccess, FlowError> {
|
||||
skip_assert_initialized!();
|
||||
unsafe {
|
||||
FlowSuccess::try_from_glib(ffi::gst_proxy_pad_chain_list_default(
|
||||
try_from_glib(ffi::gst_proxy_pad_chain_list_default(
|
||||
self.as_ptr() as *mut ffi::GstPad,
|
||||
parent.map(|p| p.as_ref()).to_glib_none().0,
|
||||
list.into_ptr(),
|
||||
|
|
|
@ -141,7 +141,7 @@ impl<T: ClockImpl> ClockImplExt for T {
|
|||
let mut jitter = 0;
|
||||
|
||||
(
|
||||
ClockSuccess::try_from_glib(
|
||||
try_from_glib(
|
||||
(*parent_class)
|
||||
.wait
|
||||
.map(|f| {
|
||||
|
@ -166,7 +166,7 @@ impl<T: ClockImpl> ClockImplExt for T {
|
|||
unsafe {
|
||||
let data = Self::type_data();
|
||||
let parent_class = data.as_ref().parent_class() as *mut ffi::GstClockClass;
|
||||
ClockSuccess::try_from_glib(
|
||||
try_from_glib(
|
||||
(*parent_class)
|
||||
.wait_async
|
||||
.map(|f| {
|
||||
|
|
|
@ -170,7 +170,7 @@ impl<T: ElementImpl> ElementImplExt for T {
|
|||
let f = (*parent_class)
|
||||
.change_state
|
||||
.expect("Missing parent function `change_state`");
|
||||
StateChangeSuccess::try_from_glib(f(
|
||||
try_from_glib(f(
|
||||
element.unsafe_cast_ref::<Element>().to_glib_none().0,
|
||||
transition.into_glib(),
|
||||
))
|
||||
|
|
Loading…
Reference in a new issue