- 积分
- 101
贡献497
飞刀106 FD
注册时间2021-3-9
在线时间14 小时
|
楼主 |
发表于 2021-10-26 17:58:36
|
显示全部楼层
- #include <gst/gst.h>
-
- int main (int argc, char *argv[])
- {
- GstElementFactory *factory;
- GstElement * element;
-
- /* init GStreamer */
- gst_init (&argc, &argv);
-
- /* create element, method #2 */
- factory = gst_element_factory_find ("fakesrc");
- if (!factory) {
- g_print ("Failed to find factory of type 'fakesrc'\n");
- return -1;
- }
- element = gst_element_factory_create (factory, "source");
- if (!element) {
- g_print ("Failed to create element, even though its factory exists!\n");
- return -1;
- }
-
- /* get name */
- g_object_get (G_OBJECT (element), "name", &name, NULL);
- g_print ("The name of the element is '%s'.\n", name);
- g_free (name);
-
- gst_object_unref (GST_OBJECT (element));
- gst_object_unref (GST_OBJECT (factory));
-
- return 0;
- }
复制代码 |
|