[gst-devel] On writing GStreamer plugins for OpenCV video surveillance facility

Andrey Nechypurenko andreynech at googlemail.com
Sun Jun 13 02:38:18 CEST 2010

Hi Giorgio,

> I've already worked with gst-opencv project. Plugins defined in gst-opencv
> wraps some of the C APIs of OpenCV. I need to work with some OpenCV's C++
> APIs and classes that do not have a C correspondence (and are documented at
> all, but this is a different problem).

AFAIK, there should not be any problems mixing C/C++ with gstreamer.
It just a matter of adding ' extern "C" ' in the proper places :-) .

I did not try it myself but I think it should be possible to compile
whole plugin with C++ but declare functions expected by gstreamer
infrastructure as extern "C". As alternative (and I preffere this
way), it should be possible to define C-style interface to your C++
algorithms and invoke it where appropriate. For example:

extern "C" void MyMegaProcessingFunction(...)
  OpenCVClassA a;

and compile it with C++. Then, for in other file compiled with C:

gst_your_plugin_chain(GstPad * pad, GstBuffer * buf)

Once again, this is just my thoughs and I did not test it. Maybe there
are some other problems which I did not realize. You are welcome to
try it and tell whether it works ;-) .


More information about the gstreamer-devel mailing list