简体   繁体   English

如何在gstreamer插件中使用c ++模块?

[英]How to use c++ module in gstreamer plugin?

I need to include algorithm written in C++ into my gstreamer plugin. 我需要将用C ++编写的算法包含到我的gstreamer插件中。 I've created algorithm.h file, which holds 我创建了algorithm.h文件,该文件包含

extern "C" int myFunction( );

and algorithm algorithm.cpp file which implements this function. 以及实现此功能的算法algorithm.cpp文件。 Now after I built & install my plugin, which includes the algorithm.h file and calls myFunction(), I tried to run test pipeline with my element, which resulted in error telling me that there is no myFunction object. 现在,在构建并安装我的插件(包括algorithm.h文件并调用myFunction())之后,我尝试使用我的元素运行测试管道,这导致错误告诉我没有myFunction对象。

I suppose this has something to do with not including object module with myFunction into the plugin's binary file. 我想这与在插件的二进制文件中不包含myFunction对象模块有关。 Thus my question is: 因此,我的问题是:

How to properly use my c++ module with my plugin? 如何正确使用我的c ++模块和插件?

I've managed to use my c++ module in my plugin by using this tutorial: link . 通过使用本教程,我设法在插件中使用了c ++模块: link

I also needed to include some flags in configure.ac file. 我还需要在configure.ac文件中包括一些标志。

17 dnl enable mainainer mode by default
18 AM_MAINTAINER_MODE([enable])
19 
20 dnl check for tools (compiler etc.)
21 AC_PROG_CC
22 AC_PROG_CXX         // <-- 22, 23 lines were included.
23 AC_PROG_LIBTOOL     // <-- |
24 
25 dnl required version of libtool
26 LT_PREREQ([2.2.6])
27 LT_INIT

This allowed me to compile and run my c++ function from my plugin's code. 这使我能够从插件的代码中编译并运行c ++函数。 However I'm still experiencing problems if I try to include header file in my c++ code. 但是,如果我尝试在我的c ++代码中包含头文件,我仍然遇到问题。 The problem is that this module is compiled without gstreamer's dependencies, and I can't figure out how to set it properly. 问题在于该模块的编译没有gstreamer的依赖关系,我不知道如何正确设置它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM