[gst-devel] plan to write a bayer filter

Bertrik Sikken bertrik at zonnet.nl
Mon Jan 10 15:47:10 CET 2005


Benjamin Otte wrote:
> General comment: We need a good intro on what link and getcaps functions
> do, since a lot of people have a hard time understanding what this part of
> a plugin does.
> 
> On Sun, 9 Jan 2005, Bertrik Sikken wrote:

<snip original anouncement>

>>A couple more questions:
>>
>>I'm having trouble writing the get_caps and link functions.
>>Basically I am not able to make the pipeline work properly,
>>seeing various failure phenomena.
>>For example the pipeline won't link (in gst-editor) and I have
>>no clear idea how to debug it.
>>Gst-launch complains about an erroneous pipeline, then tries
>>to run it anyway. In some cases this produces and unkillable
>>gdb process ('kill -9' as root cannot kill it), which is keeping
>>my v4l2 device busy and I am forced to reboot. This makes the whole
>>development process kind of troublesome.
>>
> 
> It might be useful to dump some output to a file (via 4vlsrc ! filesink or
> whatever) and use that. This is easy if Bayer frames are fixed size.
> Just run the pipeline like this:
> gst-launch gnomevfssrc location=/path/to/frames bytesperread=$framesize !
> bayerdec ! ...
> (You need to use gnomevfssrc here because filesrc's blocksizes need to be
> multiples of 2 iirc.)

Yes, they are fixed size, equal to width*height bytes.

> Off Topic: This trick works nicely for raw video dumps, too. Just run
> something like
> gst-launch gnomevfssrc location=/path/to/frames bytesperread=153600 !
> video/x-raw-yuv,width=320,height=240,framerate=25.0,format=\(fourcc\)I420
> ! xvimagesink
> and you can view it.
> 
> 
>>I used the median filter plugin as an example for my bayer plugin
>>(because it looked like a simple plugin with not-to-much code)
>>This was perhaps not such a good idea, since the bayer plugin
>>takes one video format and transforms it into another, while
>>the median filter uses the same video format for input and
>>output.
>>Is there an existing gstreamer plugin that is better suitable
>>to use as an example for my bayer plugin?
>>(I can provide details on the bayer format if required)
>>
> 
> Maybe have a look at a simple video decoder (if we have those - do we have
> simple ones, I can only come up with mpeg2dec and ffmpeg and they're both
> not simple) or colorspace transformation plugins (I believe there's an
> alpha plugin somewhere that does I420=>AYUV or so?)
> Anyway, some tips I find useful when doing caps stuff:
> 
> 1) the simplest solution to get a plugin working first and not need
> to care about link and getcaps is to only decode a fixed format. Elements
> that only decode a fixed format don't need link or getcaps functions, they
> specify the supported format in their fixed pad templates. Fixed caps can
> easily be found: They don't contain ranges ("[x, y]") or lists ("{x, y,
> ...}").

Ah ok, this sounds useful. I'm trying to write the bayer plugin to
improve support for my webcam, which has a fixed width and height.

> 2) when implementing caps stuff, particularly caps negotiation, the
> GST_PADS debugging category is important. So running your app with
> --gst-debug=GST_PADS:5 might clue you in on quite some stuff.
> It might also be useful for general understanding to just watch what
> happens when you run simple GStreamer pipelines with that debugging
> output, like gst-launch videotestsrc ! xvimagesink --gst-debug=GST_PADS:5
> or gst-launch v4lsrc ! xvimagesink --gst-debug=GST_PADS:5
> 
> 3) Get to know gst-launch filtercaps syntax. It's very helpful if you can
> just force a particular caps.

Ok thanks, didn't know this.

What I got until now w.r.t. pads is
"Pad Templates:
   SINK template: 'sink'
     Availability: Always
     Capabilities:
       video/x-raw
                     bpp: 8
                   depth: 8
                   width: [ 16, 4096 ]
                  height: [ 16, 4096 ]
               framerate: [ 0, 1.7976931348623157e+308 ]
                  format: BA81

   SRC template: 'src'
     Availability: Always
     Capabilities:
       video/x-raw-rgb
                     bpp: 24
                   depth: 24
              endianness: 4321
                red_mask: 16711680
              green_mask: 65280
               blue_mask: 255
                   width: [ 16, 4096 ]
                  height: [ 16, 4096 ]
               framerate: [ 0, 1.7976931348623157e+308 ]"

Basically the output width and height is equal to the input width
and height. The v4l2src source seems to specify a framerate cap,
but that is total irrelevant for the bayer plugin.

Regards,
Bertrik


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.10 - Release Date: 1/10/2005





More information about the gstreamer-devel mailing list