[Bug 750033] basetransform - allow collation/separation of buffers

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Thu May 28 08:02:19 PDT 2015


https://bugzilla.gnome.org/show_bug.cgi?id=750033

--- Comment #3 from Jan Schmidt <thaytan at noraisin.net> ---
(In reply to Nicolas Dufresne (stormer) from comment #2)
> Review of attachment 304157 [details] [review]:
> 
> I'm worried this is a partial solution to the need for a proper
> AsyncBaseTransform.

If you mean a base transform that implements a separate srcpad task for
outputting buffers, this should allow that - override the generate_output()
vfunc to just collect input buffers to somewhere for processing, and implement
whatever it wants for the srcpad task. The first person to actually implement
one might find some wrinkles to iron out, but it's feasible.

> ::: libs/gst/base/gstbasetransform.h
> @@ +93,3 @@
> +  /* Default submit_input_buffer places the buffer here,
> +   * for consumption by the generate_output method: */
> +  GstBuffer      *queued_buf;
> 
> What if the element would like to handle it's own queue ?

The pattern is for a sub-class to implement submit_input_buffer() as:

  GST_BASE_TRANSFORM_CLASS (parent)->submit_input_buffer(...) || fail;
  /* Parent submit succeeded,
     take any buffer from btrans->queued_buf and store it */

So, the default implementation does QoS as needed and places the buffer into
the queued_buf ptr. The default generate_output() function looks for a buffer
there and processes it, but the sub-class is free to do something else instead
- I'm doing something like the above pseudo-code in the stereoscopic branch.

Sub-classes are free to implement their own queueing, and can still use the
default generate_output() function by placing buffers into the queued_buf ptr.

I did it this way so that everything is backwards-compatible by default - 1
input buffer yields 1 output buffer.

> @@ +279,3 @@
>    GstFlowReturn (*transform_ip) (GstBaseTransform *trans, GstBuffer *buf);
>  
> +  GstFlowReturn (*submit_input_buffer) (GstBaseTransform *trans, gboolean
> is_discont, GstBuffer *input);
> 
> Other similar API uses the term finish, though I'm not sure how to make that
> fit.

We use finish() in places where the sub-class wants a parent class to take a
buffer it's created and do something with it, but this is a receive function
for input buffers. 

> Why do you need the discount boolean ? Isn't the discont flag on the
> buffer you submit enough ?

As well as the input buffer DISCONT flag, the is_discont param also reflects
whether or not basetransform dropped a buffer due to QoS since the last one was
input. Passing it as a separate param prevents having to make the input buffer
writable and set its DISCONT flag in that case.

> @@ +280,3 @@
>  
> +  GstFlowReturn (*submit_input_buffer) (GstBaseTransform *trans, gboolean
> is_discont, GstBuffer *input);
> +  GstFlowReturn (*generate_output) (GstBaseTransform *trans, GstBuffer
> **outbuf);
> 
> generate or create (create seems more popular so far).

Either one is a bit weird when there's already a prepare_output_buffer vfunc,
but I'll go with consensus :)

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list