我该如何测试我的gstreamer插件?是否有用于gstreamer插件测试的标准测试套件?

问题描述:

假设我制作了基于gstreamer的插件。我已经安装了它,它可以正常使用gst-launch应用程序。我该如何测试我的gstreamer插件?是否有用于gstreamer插件测试的标准测试套件?

但现在我想测试我的gstreamer插件。那么对于这种插件测试,是否有标准测试套件

是否有任何用gstreamer组件构建的媒体播放器所以我可以用我的插件替换该组件并测试它?

+0

我不太明白你想要做什么。你能否进一步描述你想达到的目标? – joar

+0

我已经做了一个插件元素,现在我想测试它是否正常工作?所以为了测试这样的元素,gstreamer中有没有标准的测试套件? –

+0

您可能想要咨询irc.freenode.net上的#gstreamer。 – joar

我认为this将解决您的问题。

+0

阅读后,我已经使插件...!但是这样的测试套件没有足够的信息 –

我不确定GStreamer 0.10,我认为这个问题是关于给定年龄的。但是,对于任何人编写插件的GStreamer 1.0,这里是一个非常简单的单元测试套件,使用的GStreamer的内置Check frameworkGstCheck module

// This header will include some GStreamer-specific test utilities, as well as 
// the internal Check API 
#include <gst/check/gstcheck.h> 

// Surround your tests with the GST_START_TEST and GST_END_TEST macros, then 
// use the GstCheck and Check APIs 
GST_START_TEST(my_test) 
{ 
    ck_assert(0); 
} 
GST_END_TEST; 

// This is a suite initialization function where you should register your tests. 
// It must end with "_suite" and traditionally starts with your plugin's 
// namespace. 
Suite *gst_myplugin_suite(void) { 
    Suite *s = suite_create("GstMyPlugin"); 
    TCase *tc = tcase_create("general"); 
    tcase_add_test(tc, my_test); 
    // Add more tests with tcase_add_test(tc, test_function_name) 
    suite_add_tcase(s, tc); 
    return s; 
} 

// This generates an entry point that executes your test suite. The argument 
// should be the name of your suite intialization function without "_suite". 
GST_CHECK_MAIN(gst_myplugin); 

在构建你的测试,你需要用你的插件*和链接gstcheck-1.0库。使用pkg-config可以使事情变得更加容易:

gcc -o gstmyplugintests `pkg-config --cflags --libs gstreamer-check-1.0` gstmyplugin.so gstmyplugintests.c 

当运行测试,记得告诉GStreamer的哪里寻找你的插件:

GST_PLUGIN_PATH=. ./gstmyplugintests 

这应该是所有有它!

*编辑:实际上,如果你的测试访问它的内部数据结构和功能,你只需要连接你的插件。