Hi,
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. Thank you guys! -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Le mercredi 12 mai 2021 à 03:58 -0500, n0s via gstreamer-devel a écrit :
> Hi, > > 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 planar audio). > > Thank you guys! > > > > -- > Sent from: http://gstreamer-devel.966125.n4.nabble.com/ > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi,
thank you for your response. Could you point me to some documentation or example source code to implement the GstAdapter? -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Le mercredi 12 mai 2021 à 09:05 -0500, n0s via gstreamer-devel a écrit :
> Hi, > > thank you for your response. > > Could you point me to some documentation or example source code to implement > the GstAdapter? https://gstreamer.freedesktop.org/documentation/base/gstadapter.html > > > > -- > Sent from: http://gstreamer-devel.966125.n4.nabble.com/ > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |