查看: 21931|回复: 1

[Linux] 有gstreamer的库吗?

20

主题

20

回帖

101

积分

mao0504 发表于 2021-10-26 17:56:20 | 显示全部楼层 |阅读模式
我想搞一个基于gstreamer的应用,类似gst-launch-1.0,有对应的库吗?还是需要自己移植?
回复

使用道具 举报

20

主题

20

回帖

101

积分

楼主| mao0504 发表于 2021-10-26 17:58:36 | 显示全部楼层
  1. #include <gst/gst.h>

  2. int main (int argc, char *argv[])
  3. {
  4.   GstElementFactory *factory;
  5.   GstElement * element;

  6.   /* init GStreamer */
  7.   gst_init (&argc, &argv);

  8.   /* create element, method #2 */
  9.   factory = gst_element_factory_find ("fakesrc");
  10.   if (!factory) {
  11.     g_print ("Failed to find factory of type 'fakesrc'\n");
  12.     return -1;
  13.   }
  14.   element = gst_element_factory_create (factory, "source");
  15.   if (!element) {
  16.     g_print ("Failed to create element, even though its factory exists!\n");
  17.     return -1;
  18.   }
  19.   
  20.   /* get name */
  21.   g_object_get (G_OBJECT (element), "name", &name, NULL);
  22.   g_print ("The name of the element is '%s'.\n", name);
  23.   g_free (name);
  24.   
  25.   gst_object_unref (GST_OBJECT (element));
  26.   gst_object_unref (GST_OBJECT (factory));

  27.   return 0;
  28. }
复制代码
点评回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则