mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-26 03:21:03 +00:00
gstreamer-video: Require &mut self for VideoCodecFrame functions that modify it
And add non-mutable getters for input/output buffer
This commit is contained in:
parent
12416a4031
commit
573055cb1e
3 changed files with 22 additions and 11 deletions
|
@ -79,11 +79,11 @@ impl<'a> VideoCodecFrame<'a> {
|
|||
VideoCodecFrameFlags::from_bits_truncate(flags)
|
||||
}
|
||||
|
||||
pub fn set_flags(&self, flags: VideoCodecFrameFlags) {
|
||||
pub fn set_flags(&mut self, flags: VideoCodecFrameFlags) {
|
||||
unsafe { (*self.to_glib_none().0).flags |= flags.bits() }
|
||||
}
|
||||
|
||||
pub fn unset_flags(&self, flags: VideoCodecFrameFlags) {
|
||||
pub fn unset_flags(&mut self, flags: VideoCodecFrameFlags) {
|
||||
unsafe { (*self.to_glib_none().0).flags &= !flags.bits() }
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ impl<'a> VideoCodecFrame<'a> {
|
|||
unsafe { from_glib((*self.to_glib_none().0).dts) }
|
||||
}
|
||||
|
||||
pub fn set_dts(&self, dts: gst::ClockTime) {
|
||||
pub fn set_dts(&mut self, dts: gst::ClockTime) {
|
||||
unsafe {
|
||||
(*self.to_glib_none().0).dts = dts.to_glib();
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ impl<'a> VideoCodecFrame<'a> {
|
|||
unsafe { from_glib((*self.to_glib_none().0).pts) }
|
||||
}
|
||||
|
||||
pub fn set_pts(&self, pts: gst::ClockTime) {
|
||||
pub fn set_pts(&mut self, pts: gst::ClockTime) {
|
||||
unsafe {
|
||||
(*self.to_glib_none().0).pts = pts.to_glib();
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ impl<'a> VideoCodecFrame<'a> {
|
|||
unsafe { from_glib((*self.to_glib_none().0).duration) }
|
||||
}
|
||||
|
||||
pub fn set_duration(&self, duration: gst::ClockTime) {
|
||||
pub fn set_duration(&mut self, duration: gst::ClockTime) {
|
||||
unsafe {
|
||||
(*self.to_glib_none().0).duration = duration.to_glib();
|
||||
}
|
||||
|
@ -144,7 +144,18 @@ impl<'a> VideoCodecFrame<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_output_buffer(&self) -> Option<&mut gst::BufferRef> {
|
||||
pub fn get_output_buffer(&self) -> Option<&gst::BufferRef> {
|
||||
unsafe {
|
||||
let ptr = (*self.to_glib_none().0).output_buffer;
|
||||
if ptr.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(gst::BufferRef::from_ptr(ptr))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_output_buffer_mut(&mut self) -> Option<&mut gst::BufferRef> {
|
||||
unsafe {
|
||||
let ptr = (*self.to_glib_none().0).output_buffer;
|
||||
if ptr.is_null() {
|
||||
|
@ -160,7 +171,7 @@ impl<'a> VideoCodecFrame<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn set_output_buffer(&self, output_buffer: gst::Buffer) {
|
||||
pub fn set_output_buffer(&mut self, output_buffer: gst::Buffer) {
|
||||
unsafe {
|
||||
let prev = (*self.to_glib_none().0).output_buffer;
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ pub trait VideoDecoderExtManual: 'static {
|
|||
#[cfg(any(feature = "v1_12", feature = "dox"))]
|
||||
fn allocate_output_frame(
|
||||
&self,
|
||||
frame: &VideoCodecFrame,
|
||||
frame: &mut VideoCodecFrame,
|
||||
params: Option<&gst::BufferPoolAcquireParams>,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||
|
||||
|
@ -97,7 +97,7 @@ impl<O: IsA<VideoDecoder>> VideoDecoderExtManual for O {
|
|||
#[cfg(any(feature = "v1_12", feature = "dox"))]
|
||||
fn allocate_output_frame(
|
||||
&self,
|
||||
frame: &VideoCodecFrame,
|
||||
frame: &mut VideoCodecFrame,
|
||||
params: Option<&gst::BufferPoolAcquireParams>,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
let ret: gst::FlowReturn = unsafe {
|
||||
|
|
|
@ -23,7 +23,7 @@ pub trait VideoEncoderExtManual: 'static {
|
|||
#[cfg(any(feature = "v1_12", feature = "dox"))]
|
||||
fn allocate_output_frame(
|
||||
&self,
|
||||
frame: &VideoCodecFrame,
|
||||
frame: &mut VideoCodecFrame,
|
||||
size: usize,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||
|
||||
|
@ -58,7 +58,7 @@ impl<O: IsA<VideoEncoder>> VideoEncoderExtManual for O {
|
|||
#[cfg(any(feature = "v1_12", feature = "dox"))]
|
||||
fn allocate_output_frame(
|
||||
&self,
|
||||
frame: &VideoCodecFrame,
|
||||
frame: &mut VideoCodecFrame,
|
||||
size: usize,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
let ret: gst::FlowReturn = unsafe {
|
||||
|
|
Loading…
Reference in a new issue