videoencoder: Allow passing None to finish_frame()

This commit is contained in:
Sebastian Dröge 2019-08-14 20:17:35 +03:00
parent e00781309b
commit 5c53f10135

View file

@ -30,7 +30,10 @@ pub trait VideoEncoderExtManual: 'static {
fn get_frames(&self) -> Vec<VideoCodecFrame>;
fn get_oldest_frame(&self) -> Option<VideoCodecFrame>;
fn finish_frame(&self, frame: VideoCodecFrame) -> Result<gst::FlowSuccess, gst::FlowError>;
fn finish_frame(
&self,
frame: Option<VideoCodecFrame>,
) -> Result<gst::FlowSuccess, gst::FlowError>;
fn get_latency(&self) -> (gst::ClockTime, gst::ClockTime);
fn set_latency(&self, min_latency: gst::ClockTime, max_latency: gst::ClockTime);
@ -65,11 +68,14 @@ impl<O: IsA<VideoEncoder>> VideoEncoderExtManual for O {
ret.into_result()
}
fn finish_frame(&self, frame: VideoCodecFrame) -> Result<gst::FlowSuccess, gst::FlowError> {
fn finish_frame(
&self,
frame: Option<VideoCodecFrame>,
) -> Result<gst::FlowSuccess, gst::FlowError> {
let ret: gst::FlowReturn = unsafe {
from_glib(gst_video_sys::gst_video_encoder_finish_frame(
self.as_ref().to_glib_none().0,
frame.into_ptr(),
frame.map(|f| f.into_ptr()).unwrap_or(ptr::null_mut()),
))
};
ret.into_result()