plugin writing: base class for format conversion

Michael Gruner michael.gruner at ridgerun.com
Sat Jul 17 20:15:57 UTC 2021


The default is to only allow the same format. You need to reimplement the transform_caps virtual method in order to change the format. (note that transform_caps is a basetransform method).

> On 17 Jul 2021, at 13:50, Guennadi Liakhovetski <g.liakhovetski at gmx.de> wrote:
> 
> Hi Michael,
> 
>> On Sat, 17 Jul 2021, Michael Gruner wrote:
>> 
>> Hi Guennadi
>> 
>> The videoconvert element can already handle this conversion for you:
>> 
>> gst-launch-1.0 v4l2src ! videoconvert ! video/x-raw,format=RGB ! …
> 
> Yes, I know about videoconvert, but I need to do some special processing
> of thermal data. For the algorithms to work I have to access the raw data,
> which is output by the v4l2 driver in GRAY16_BE format (1-to-1 from the
> camera), and I want to transform that to a colour gradient similar to well
> known thermal images, so my plugin cannot just stay within GRAY16_BE and
> use videoconvert to convert that to RGB - you'd just get a gray image of
> course.
> 
>> If you, for other reason, need to write your own element, you probably
>> want to use the videofilter base class. It’s a specialization of the
>> basetransform class for video. The important virtual method for you to
>> implement is “transform_caps”, that will allow you to specify the input
>> and output caps respectively.
> 
> The videofilter class is "allowed" to convert between formats? I thought
> it would be, so I actually tried it. But I was unable to get it to input
> and output different formats. I was only able to get it to work with the
> same format. Are you sure that is supposed to work?
> 
> Thanks
> Guennadi
> 
>> Michael
>> 
>>>> On 17 Jul 2021, at 05:05, Guennadi Liakhovetski via gstreamer-devel <gstreamer-devel at lists.freedesktop.org> wrote:
>>> 
>>> Hi,
>>> 
>>> I'm trying to write a plugin to convert data from a thermal camera. It
>>> should take data from the v4l2src source in GRAY16_BE format and convert
>>> it to an RGB video output. I'm looking at gst-element-maker but I'm not
>>> finding any suitable base class that would take video/x-raw as input and
>>> generate the same as output and would convert between format. Do I have to
>>> write a plugin from scratch? Or should I use basetransform? Any tutorials
>>> for that?
>>> 
>>> Thanks
>>> Guennadi
>>> _______________________________________________
>>> gstreamer-devel mailing list
>>> gstreamer-devel at lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>> 


More information about the gstreamer-devel mailing list