假设我已经制作了基于gstreamer的插件。我安装了它,并且它与gst-launch应用程序一起正常工作。
但现在我想测试我的gstreamer插件。这样的插件测试是否有标准测试套件?
是否有使用gstreamer组件构建的媒体播放器所以我可以用我的插件替换该组件并进行测试?
答案 0 :(得分:1)
我不确定GStreamer 0.10,这是我认为这个问题是关于它的年龄。但对于为GStreamer 1.0编写插件的人来说,这是一个非常简单的单元测试套件,它使用GStreamer的内置Check framework和GstCheck 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
这应该就是它的全部!
*编辑:实际上,如果您的测试访问其内部数据结构和功能,您只需要与您的插件链接。
答案 1 :(得分:-1)
我认为this会解决您的问题。