[gst-devel] VideoFilter(transformation element) implementation

alex pkit at mail.ru
Sun Apr 4 13:12:37 CEST 2010


On 04/02/2010 10:27 AM, Stefan Kost wrote:
> Am 02.04.2010 00:17, schrieb alex:
> There are lot of examples in the atual plugins. Also

Yeh, but as for me they mostly overloaded by concrete thing 
implementation, so it's hard to see basic structure.

> gst-plugins-base/gst-libs/gst/video has a GstVideoFilter baseclass.

Ok. Thanks that's hotter point. Here i see even template for plugin,
but when i try to build plugin generated from this template i got error:

0/videofilter> ./make_filter test
$Id$
1/videofilter> gcc  `pkg-config --libs --cflags gstreamer-0.10` 
`pkg-config --libs --cflags gstreamer-video-0.10` 
-I/usr/include/gstreamer-0.10/gst/video  gsttest.c --shared -o libtest.so

gsttest.c:52: error: expected specifier-qualifier-list before 
‘GstVideofilter’
gsttest.c:58: error: expected specifier-qualifier-list before 
‘GstVideofilterClass’
gsttest.c:85: error: expected ‘)’ before ‘*’ token
gsttest.c:87: error: expected ‘)’ before ‘*’ token
gsttest.c: In function ‘gst_test_get_type’:
gsttest.c:107: error: ‘GST_TYPE_VIDEOFILTER’ undeclared (first use in 
this function)
gsttest.c:107: error: (Each undeclared identifier is reported only once
gsttest.c:107: error: for each function it appears in.)
gsttest.c: At top level:
gsttest.c:113: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ 
before ‘gst_test_formats’
gsttest.c: In function ‘gst_test_base_init’:
gsttest.c:127: error: ‘GstVideofilterClass’ undeclared (first use in 
this function)
gsttest.c:127: error: ‘videofilter_class’ undeclared (first use in this 
function)
gsttest.c:132: error: ‘gst_test_formats’ undeclared (first use in this 
function)
gsttest.c: In function ‘gst_test_class_init’:
gsttest.c:144: error: ‘GstVideofilterClass’ undeclared (first use in 
this function)
gsttest.c:144: error: ‘videofilter_class’ undeclared (first use in this 
function)
gsttest.c:159: error: ‘gst_test_setup’ undeclared (first use in this 
function)
gsttest.c: In function ‘gst_test_init’:
gsttest.c:166: error: ‘GstVideofilter’ undeclared (first use in this 
function)
gsttest.c:166: error: ‘videofilter’ undeclared (first use in this function)
gsttest.c: At top level:
gsttest.c:224: error: ‘VERSION’ undeclared here (not in a function)
gsttest.c:224: error: ‘GST_LICENSE’ undeclared here (not in a function)
gsttest.c:224: error: ‘PACKAGE’ undeclared here (not in a function)
gsttest.c:224: error: ‘GST_PACKAGE_NAME’ undeclared here (not in a function)
gsttest.c:224: error: ‘GST_PACKAGE_ORIGIN’ undeclared here (not in a 
function)
gsttest.c:230: error: expected ‘)’ before ‘*’ token
gsttest.c:242: error: expected ‘)’ before ‘*’ token

> For transform type of filters there are two modes: in place where you modyfy the
> received bufffer and push that further and not in place. When operating not in

Ok, I understand this.
> place, you allocate a new buffer (gst_pad_alloc_new_and_set_caps()) process

I dont find that function and assume that you mean 
gst_pad_alloc_buffer_and_set_caps()

> input, putting the result into the new buffer, then you copy buffer metadata
> over (gst_buffer_copy_metadata()). FInally you unref the input-buffer and push
> the new buffer.

The core question for me is where place buffer allocation? Is it must be 
in *_transform(*_chain) method(function), or like in gstedgedetect 
plugin from gst-opencv in _set_caps() function and unref it in _finalize()
or like in edgetv in -plugins-good:
alloc in _start(), free in _finalize()

At the end you say i must unref input-buffer and then push new buffer. 
But I don't see in referenced examples[edgetv,edgedetect] that they 
unref input buffer.

Also when i tried to make the whole thing like in gstedgedetect, i found 
that blinking stayed (in 1st xvimagesink image sometimes overwriten by 
the image in 2nd). Launch string was:

gst-launch   --gst-plugin-path=./ videotestsrc num-buffers=1000 ! 
video/x-raw-yuv,width=320,height=240 ! tee name=tscreen ! queue ! 
autovideosink  tscreen. ! queue ! decodebin ! ffmpegcolorspace ! 
examplefilter ! edge_detector ! ffmpegcolorspace ! autovideosink

here "edge_detector" is discussed element.
But there is no such effect in gstedgedetect.

p.s. i just try this pipeline with edgetv, and it has same trouble, so 
maybe this is not my element problem.




More information about the gstreamer-devel mailing list