Plugin input buffer size
nicolas at ndufresne.ca
Wed May 12 13:47:47 UTC 2021
Le mercredi 12 mai 2021 à 03:58 -0500, n0s via gstreamer-devel a écrit :
> I'm working on my own audio filter plugin based on the GStreamer
> /gst-template gstaudiofilter.c/ example.
> There is this function where the filtering should happen:
> static GstFlowReturn
> gst_audio_filter_template_filter (GstBaseTransform * base_transform,
> GstBuffer * inbuf, GstBuffer * outbuf)
> /* FIXME: do something interesting here. We simply copy the input data
> * to the output buffer for now. */
> g_assert (map_out.size == map_in.size);
> memcpy (map_out.data, map_in.data, map_out.size);
> Is it possible to set the input buffer size? Ideally I want the the
> map_in.size to be a power of 2.
> I know there is a /_class_init/ function where I could potentially set up
> the buffer sizes, but for me it is not clear how to do that.
As the name says, the input is what comes from the upstream element. Audio
elements rarely uses buffer pool in allocation queries, so there is generally no
way your filter can influence that. But, the size from upstream could be
controllable at the source, if that helps performance (e.g. audio source buffer
size is controlled through in duration with the latency property).
If you strictly need power of two here, you can use the GstAdapter to accumulate
and re-slice the data into the size you need. The adapter will merge the memory
as needed. (there is also GstPlanarAudioAdapter in case your filter works with
> Thank you guys!
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
More information about the gstreamer-devel