gstreamer-base/basetransform: Rename PreparedOutputBuffer and GeneratedOutput enums

PrepareOutputBufferSuccess and GenerateOutputSuccess is more consistent
with what we do elsewhere.
This commit is contained in:
Sebastian Dröge 2020-04-02 19:57:04 +03:00
parent 2006bd51cc
commit d3e93f172f

View file

@ -106,7 +106,7 @@ pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl + Send + Sync +
&self, &self,
element: &BaseTransform, element: &BaseTransform,
inbuf: &gst::BufferRef, inbuf: &gst::BufferRef,
) -> Result<PreparedOutputBuffer, gst::FlowError> { ) -> Result<PrepareOutputBufferSuccess, gst::FlowError> {
self.parent_prepare_output_buffer(element, inbuf) self.parent_prepare_output_buffer(element, inbuf)
} }
@ -167,7 +167,10 @@ pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl + Send + Sync +
self.parent_submit_input_buffer(element, is_discont, inbuf) self.parent_submit_input_buffer(element, is_discont, inbuf)
} }
fn generate_output(&self, element: &BaseTransform) -> Result<GeneratedOutput, gst::FlowError> { fn generate_output(
&self,
element: &BaseTransform,
) -> Result<GenerateOutputSuccess, gst::FlowError> {
self.parent_generate_output(element) self.parent_generate_output(element)
} }
} }
@ -233,7 +236,7 @@ pub trait BaseTransformImplExt {
&self, &self,
element: &BaseTransform, element: &BaseTransform,
inbuf: &gst::BufferRef, inbuf: &gst::BufferRef,
) -> Result<PreparedOutputBuffer, gst::FlowError>; ) -> Result<PrepareOutputBufferSuccess, gst::FlowError>;
fn parent_transform( fn parent_transform(
&self, &self,
@ -281,7 +284,7 @@ pub trait BaseTransformImplExt {
fn parent_generate_output( fn parent_generate_output(
&self, &self,
element: &BaseTransform, element: &BaseTransform,
) -> Result<GeneratedOutput, gst::FlowError>; ) -> Result<GenerateOutputSuccess, gst::FlowError>;
fn take_queued_buffer(&self) -> Option<gst::Buffer> fn take_queued_buffer(&self) -> Option<gst::Buffer>
where where
@ -552,7 +555,7 @@ impl<T: BaseTransformImpl + ObjectImpl> BaseTransformImplExt for T {
&self, &self,
element: &BaseTransform, element: &BaseTransform,
inbuf: &gst::BufferRef, inbuf: &gst::BufferRef,
) -> Result<PreparedOutputBuffer, gst::FlowError> { ) -> Result<PrepareOutputBufferSuccess, gst::FlowError> {
unsafe { unsafe {
let data = self.get_type_data(); let data = self.get_type_data();
let parent_class = let parent_class =
@ -572,9 +575,9 @@ impl<T: BaseTransformImpl + ObjectImpl> BaseTransformImplExt for T {
Err(err) => Err(err), Err(err) => Err(err),
Ok(_) => { Ok(_) => {
if outbuf == inbuf.as_ptr() as *mut _ { if outbuf == inbuf.as_ptr() as *mut _ {
Ok(PreparedOutputBuffer::InputBuffer) Ok(PrepareOutputBufferSuccess::InputBuffer)
} else { } else {
Ok(PreparedOutputBuffer::Buffer(from_glib_full(outbuf))) Ok(PrepareOutputBufferSuccess::Buffer(from_glib_full(outbuf)))
} }
} }
} }
@ -761,7 +764,7 @@ impl<T: BaseTransformImpl + ObjectImpl> BaseTransformImplExt for T {
fn parent_generate_output( fn parent_generate_output(
&self, &self,
element: &BaseTransform, element: &BaseTransform,
) -> Result<GeneratedOutput, gst::FlowError> { ) -> Result<GenerateOutputSuccess, gst::FlowError> {
unsafe { unsafe {
let data = self.get_type_data(); let data = self.get_type_data();
let parent_class = let parent_class =
@ -775,11 +778,11 @@ impl<T: BaseTransformImpl + ObjectImpl> BaseTransformImplExt for T {
.into_result() .into_result()
.map(|res| { .map(|res| {
if res == ::BASE_TRANSFORM_FLOW_DROPPED { if res == ::BASE_TRANSFORM_FLOW_DROPPED {
GeneratedOutput::Dropped GenerateOutputSuccess::Dropped
} else if res != gst::FlowSuccess::Ok || outbuf.is_null() { } else if res != gst::FlowSuccess::Ok || outbuf.is_null() {
GeneratedOutput::NoOutput GenerateOutputSuccess::NoOutput
} else { } else {
GeneratedOutput::Buffer(from_glib_full(outbuf)) GenerateOutputSuccess::Buffer(from_glib_full(outbuf))
} }
}) })
} }
@ -893,14 +896,14 @@ where
} }
#[derive(Debug)] #[derive(Debug)]
pub enum GeneratedOutput { pub enum GenerateOutputSuccess {
Buffer(gst::Buffer), Buffer(gst::Buffer),
NoOutput, NoOutput,
Dropped, Dropped,
} }
#[derive(Debug)] #[derive(Debug)]
pub enum PreparedOutputBuffer { pub enum PrepareOutputBufferSuccess {
Buffer(gst::Buffer), Buffer(gst::Buffer),
InputBuffer, InputBuffer,
} }
@ -1153,11 +1156,11 @@ where
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
match imp.prepare_output_buffer(&wrap, gst::BufferRef::from_ptr(inbuf)) { match imp.prepare_output_buffer(&wrap, gst::BufferRef::from_ptr(inbuf)) {
Ok(PreparedOutputBuffer::InputBuffer) => { Ok(PrepareOutputBufferSuccess::InputBuffer) => {
*outbuf = inbuf; *outbuf = inbuf;
gst::FlowReturn::Ok gst::FlowReturn::Ok
} }
Ok(PreparedOutputBuffer::Buffer(buf)) => { Ok(PrepareOutputBufferSuccess::Buffer(buf)) => {
*outbuf = buf.into_ptr(); *outbuf = buf.into_ptr();
gst::FlowReturn::Ok gst::FlowReturn::Ok
} }
@ -1372,9 +1375,9 @@ where
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, { gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
match imp.generate_output(&wrap) { match imp.generate_output(&wrap) {
Ok(GeneratedOutput::Dropped) => ::BASE_TRANSFORM_FLOW_DROPPED.into(), Ok(GenerateOutputSuccess::Dropped) => ::BASE_TRANSFORM_FLOW_DROPPED.into(),
Ok(GeneratedOutput::NoOutput) => gst::FlowReturn::Ok, Ok(GenerateOutputSuccess::NoOutput) => gst::FlowReturn::Ok,
Ok(GeneratedOutput::Buffer(outbuf)) => { Ok(GenerateOutputSuccess::Buffer(outbuf)) => {
*buf = outbuf.into_ptr(); *buf = outbuf.into_ptr();
gst::FlowReturn::Ok gst::FlowReturn::Ok
} }