简体   繁体   English

适用于 Android + Gstreamer 的 Qt 创建者

[英]Qt creator for Android + Gstreamer

I am using Qt Creator with Qt 5.9.1 for Android under a Linux 64 bit client and I'm trying to pull in Gstreamer 1.12.2 for Android into the build.我在 Linux 64 位客户端下使用 Qt Creator 和Qt 5.9.1 for Android,我试图将Gstreamer 1.12.2 for Android 引入构建。 I am able to partially run the gstreamer code.我能够部分运行 gstreamer 代码。 It will run gst_init and pass, but gst_parse_launch fails without being able to find any plugins, I always receive the same warning during runtime/debug with the error pointing to the first plugin.它将运行gst_init并通过,但gst_parse_launch失败而无法找到任何插件,我总是在运行时/调试期间收到相同的警告,错误指向第一个插件。 Example below.下面举例。

no element for "videotestsrc" “videotestsrc”没有元素

I assume my *.pro file is to blame, but I cannot find a solution that uses the *.mk files that gstreamer illustrates in their documentation .我认为应该怪我的 *.pro 文件,但我找不到使用gstreamer在其文档中说明的 *.mk 文件的解决方案。 Due to gradle usage, and my unfamiliarity with gradle, I am unable to find where to use the *.mk files.由于 gradle 的使用以及我对 gradle 的不熟悉,我无法找到在哪里使用 *.mk 文件。

My *.pro file includes the following for plugins, but I seem to be missing something that links them together.我的 *.pro 文件包含以下插件,但我似乎缺少将它们链接在一起的东西。

GST_ROOT = /usr/local/share/gstreamer-1.0-android/x86

INCLUDEPATH += $$GST_ROOT/include \
$$GST_ROOT/include/glib-2.0 \
$$GST_ROOT/lib/glib-2.0/include \
$$GST_ROOT/lib/gstreamer-1.0/include \
$$GST_ROOT/include/gstreamer-1.0

LIBS += -L$$GST_ROOT/lib/gstreamer-1.0/static  -lgstvideo-1.0 -lgstaudio-1.0 -lgstcoreelements \
    -lgstudp -lgstrtp -lgstx264 -lgstlibav -lgstvideoparsersbad -lgstadder -lgstapp -lgstaudiorate \
    -lgstaudioresample -lgstgio -lgstpango -lgstrawparse -lgsttypefindfunctions -lgstvideorate \
    -lgstvideoscale -lgstvolume -lgstvideofilter -lgstsoup -lgstopensles \
    -lgstvideotestsrc -lgstplayback -lgstaudiotestsrc -lgstaudioconvert -lgstvideoconvert \
    -lgstinterleave -lgstautodetect -lgstandroidmedia -lgstphotography-1.0 -lgstopengl

LIBS += -L$$GST_ROOT/lib/ -lgstreamer-1.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 \
    -lgstbase-1.0 -lgstrtsp-1.0 -lgstvideo-1.0 -lgnutls \
     -lintl -liconv -pthread  -lffi

C code sample for registering the plugins:用于注册插件的 C 代码示例:

GST_PLUGIN_STATIC_DECLARE(coreelements);
GST_PLUGIN_STATIC_DECLARE(videotestsrc);

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    GError *error;

    //init gstreamer
    gst_init (NULL, NULL);
    gst_init_check (NULL, NULL, &error);

    //to check in debug
    gboolean i = gst_is_initialized(); //returns 1

    GST_PLUGIN_STATIC_REGISTER(coreelements);  //fails -> cannot find gst_plugin_coreelements_register();
    GST_PLUGIN_STATIC_REGISTER(videotestsrc);  //fails -> cannot find gst_plugin_videotestsrc_register();

    ...

Any help would be useful, thanks for your time.任何帮助都会有用,感谢您的时间。

your gstreamer plugin not added to android device.您的 gstreamer 插件未添加到 android 设备。 In you pro file in Libs just linked, but not added to android.在您刚刚链接的 Libs 中的 pro 文件中,但未添加到 android 中。 Just add this for each plugin:只需为每个插件添加这个:

ANDROID_EXTRA_LIBS += \
      /path/to/plugins/android/gstreamer/libgstcoreelements.so \

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

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