Gstreamer学习笔记----第一个helloworld程序

1.Ubuntu上安装gstreamer库:

  apt-get install libgstreamer0.10-0

  apt-get install libgstreamer0.10-dev

  apt-get install libgstreamer0.10-0-dbg

2.编写测试gstreamer库的helloworld.c:

#include 
#include 
int main (int   argc,char *argv[])
{
    const gchar *nano_str;
    guint major, minor, micro, nano;

    gst_init (&argc, &argv);
    gst_version (&major, &minor, µ, &nano);
    if (nano == 1)
        nano_str = "(CVS)";
    else if (nano == 2)
        nano_str = "(Prerelease)";
    else
        nano_str = "";
    printf ("This program is linked against GStreamer %d.%d.%d %s\n",
          major, minor, micro, nano_str);
    return 0;
}


 
   这是个获得gstreamer库版本的测试用例。

3.编译程序:

gcc -Wall helloworld.c -o helloworld $(pkg-config --cflags --libs gstreamer-0.10)

编译时借助了 pkg-config 
pkg-config --cflags --libs gstreamer-0.10 会把gstreamer-0.10编译所依赖的库的路径 头文件的路径全部帮你找出来,不用你再依次写出。
(上面这条pkg-config --cflags --libs gstreamer-0.10 就相当于:
-pthread -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/gstreamer-0.10 -I/usr/include/libxml2  -pthread -L/usr/lib/i386-linux-gnu -lgstreamer-0.10 -lgobject-2.0 -lgmodule-2.0 -lxml2 -lgthread-2.0 -lrt -lglib-2.0)


4.运行helloworld结果: ./helloworld

This program is linked against GStreamer 0.10.32 









你可能感兴趣的:(【多媒体技术】,【GStreamer】,音视频开发,测试,cvs,gcc)