这里在讲的是有关gstreamer在linux如何不使用`pkg-config --cflags --libs gstreamer-0.10`
以及一些所需库的安装。
0.下载gstreamer教程 请参考 http://docs.gstreamer.com/display/GstSDK/Tutorials
说穿了就这行命令
git clonegit://anongit.freedesktop.org/gstreamer-sdk/gst-sdk-tutorials
1.下载 gstreamer0.1版用的, 注意是0.1版!!
若装成gstreamer1.0版且不安装0.1版 会在编译时就出限一堆错误
若强行求解 运行时也会出现问题
所以第一重点就是要apt-get (或yum) install gstreamer0.10*
(无脑安装所有0.1版的插件 开发环境)
所以很自然的 在Makefile里要加上
INC := -I/usr/include/gstreamer-0.10
LIB += -L/usr/lib/x86_64-linux-gnu #(这行是依ubuntu64, 其他发行版很可能需要修正)
LIB += -lgstreamer-0.10
2.光加上gstreamer库 教程编译还是不会过的
gstreamer 大量依赖 glib库
还要加上
INC += -I/usr/include/glib-2.0
INC += -I/usr/include/libxml2
INC += -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
(LIB就不用加上lglib-2.0 -lxml2 了 因為libgstreamer0.1自动相依於前两个库)
这样就可以编译例程一到四号了
3.六号到八号 有用到gtk库的东西
所以请 sudo apt-get installlibgtk2.0*
然后
INC += -I/usr/include/gtk-2.0
INC += -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include
LIB += -lgtk-x11-2.0
4.九号例程有用到gstreamer plugin的东西 所以要加上
LIB += -lgstpbutils-0.10
5.第五号最麻烦 用到 gdk-pixbuf这库
所以先 apt-get install libgdk-pixbuf2.0*
然后
INC += -I/usr/include/cairo
INC += -I/usr/include/pango-1.0
INC += -I/usr/include/gdk-pixbuf-2.0
INC += -I/usr/include/atk-1.0
LIB += -lgstinterfaces-0.10
这样即可
最后附上完整的Makefile (ubuntu 64)
CC := gcc
CFLAGS := -g
INC := -I/usr/include/gstreamer-0.10
INC += -I/usr/include/glib-2.0
INC += -I/usr/include/libxml2
INC += -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
INC += -I/usr/include/gtk-2.0
INC += -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include
INC += -I/usr/include/cairo
INC += -I/usr/include/pango-1.0
INC += -I/usr/include/gdk-pixbuf-2.0
INC += -I/usr/include/atk-1.0
LIB := -L/usr/lib/x86_64-linux-gnu
LIB += -lgstreamer-0.10
LIB += -lgtk-x11-2.0
LIB += -lgstpbutils-0.10-lgstinterfaces-0.10
all:
$(CC) $(CFLAGS) basic-tutorial-1.c -o basic-tutorial-1 $(INC)$(LIB)
$(CC) $(CFLAGS) basic-tutorial-2.c -o basic-tutorial-2 $(INC)$(LIB)
$(CC) $(CFLAGS) basic-tutorial-3.c -o basic-tutorial-3 $(INC)$(LIB)
$(CC) $(CFLAGS) basic-tutorial-4.c -o basic-tutorial-4 $(INC)$(LIB)
$(CC) $(CFLAGS) basic-tutorial-5.c -o basic-tutorial-5 $(INC)$(LIB)
$(CC) $(CFLAGS) basic-tutorial-6.c -o basic-tutorial-6 $(INC)$(LIB)
$(CC) $(CFLAGS) basic-tutorial-7.c -o basic-tutorial-7 $(INC)$(LIB)
$(CC) $(CFLAGS) basic-tutorial-8.c -o basic-tutorial-8 $(INC)$(LIB)
$(CC) $(CFLAGS) basic-tutorial-9.c -o basic-tutorial-9 $(INC)$(LIB)
clean:
rm basic-tutorial-1 basic-tutorial-2 basic-tutorial-3basic-tutorial-4 basic-tutorial-5 basic-tutorial-6 basic-tutorial-7basic-tutorial-8 basic-tutorial-9 -rf
Ubuntu下搭建gstreamer开发环境:http://www.linuxdiyf.com/linux/14918.html
SQLite Tutorial 1在ubuntu上安装SQLite 3.8.2:http://www.linuxdiyf.com/linux/16499.html