GstBaseTransform's prepare_output_buffer and occasional passthrough
Carlos Rafael Giani
dv at pseudoterminal.org
Mon Sep 1 15:17:56 PDT 2014
Hello,
in gstreamer-imx I have a "imxvpuvideotransform" element. This element
uses the i.MX6 IPU for rotations, colorspace conversions, scaling, and
deinterlacing. All of these operations can be done in one step.
As an optimization, I check if a frame really needs to be transformed,
or if it can be passed through. Cases where pass through is possible:
- input and output width/height/pixel format are the same
- video cropping is enabled, but the crop rectangle contains the entire
frame (thus not actually cropping anything)
- input frame is not interlaced
- input frame is interlaced, but no deinterlacing will be performed
- rotation is disabled
Since rotation can be set at any time (it is a property), video crop
rectangles can in theory change during playback, and deinterlacing might
be required only for some frames in mixed mode, I need to evaluate this
per-frame. I perform the evaluation in the prepare_output_buffer() function.
Initially I called gst_base_transform_set_passthrough() in
prepare_output_buffer(). However, this lead to problems in certain
situations, such as when playbin tries to play next media. For this
reason, I now call gst_base_transform_set_passthrough() once, during
initialization, and set GstBaseTransform's passthrough flag to FALSE. I
handle passthrough manually by setting the output buffer to the input
buffer in prepare_output_buffer() if passthrough is required.
transform() is still called, but does nothing then.
Here is the relevant part in the code:
https://github.com/Freescale/gstreamer-imx/blob/master/src/ipu/videotransform/videotransform.c#L1295
My question now is: is this an acceptable solution? The documentation
neither confirms nor denies this. It states: "Elements that only do
analysis can return a subbuffer or even just return a reference to the
input buffer (if in passthrough mode)." What if I do *outbuf = input; if
I set GstBaseTransform's passthrough to FALSE?
It works right now. I want to make sure this isn't just a fluke, and in
some future GStreamer version, somebody puts an assert that fires in
this case.
cheers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140902/85b21969/attachment.html>
More information about the gstreamer-devel
mailing list