让qtwebkit使用gstreamer - tinyle的专栏 - 博客频道 - CSDN.NET
花了一天事件, 终于编译出了支持gstreamer的qtwebkit, 可以开始html5 的<video><audio>之旅了。
1. 编译libxml2
下载libxml2-sources-2.7.6.tar.gz
解包后在当前目录下编写如下编译脚本:(当然,不用脚本也行,你可以直接执行)
- CC=arm-none-linux-gnueabi-gcc ./configure --build=i686-linux --host=arm-none-linux --prefix=/home/work/dist --without-python
- make && make install
CC=arm-none-linux-gnueabi-gcc ./configure --build=i686-linux --host=arm-none-linux --prefix=/home/work/dist --without-python<br /> make && make install
2. 编译zlib, 这个太common,我不啰嗦了, glib-2.0要依赖的。
3. 编译glib-2.0
下载glib-2.24.2.tar.bz2, 解包, 这个版本的依赖库很少, 竟然只需要zlib。
老版本需要的libconv, gettext等均不需要了。
同样, 编写编译脚本:
- CC=arm-none-linux-gnueabi-gcc ./configure --build=i686-linux --host=arm-none-linux \
- --prefix=/home/work/dist \
- CFLAGS="-I/home/work/dist/include -L/home/work/dist/lib" \
- glib_cv_stack_grows=no glib_cv_uscore=no ac_cv_func_posix_getpwuid_r=yes \
- ac_cv_func_posix_getgrgid_r=yes ac_cv_lib_rt_clock_gettime=no glib_cv_monotonic_clock=yes
- make && make install
CC=arm-none-linux-gnueabi-gcc ./configure --build=i686-linux --host=arm-none-linux \<br /> --prefix=/home/work/dist \<br /> CFLAGS="-I/home/work/dist/include -L/home/work/dist/lib" \<br /> glib_cv_stack_grows=no glib_cv_uscore=no ac_cv_func_posix_getpwuid_r=yes \<br /> ac_cv_func_posix_getgrgid_r=yes ac_cv_lib_rt_clock_gettime=no glib_cv_monotonic_clock=yes<br /> make && make install
4. 编译gstreamer
下载gstreamer-0.10.35.tar.gz, 这个是0.10版本里面最新的了。
编译脚本:
- CC=arm-none-linux-gnueabi-gcc PKG_CONFIG_PATH=/home/work/dist/lib/pkgconfig ./configure --build=i686-linux --host=arm-none-linux \
- --prefix=/home/work/dist CFLAGS=-I/home/work/dist/include --disable-registry --disable-loadsave --disable-gtk-doc \
- ac_cv_func_register_printf_function=no --disable-tests --disable-valgrind --disable-debug --disable-gst-debug
- make && make install
CC=arm-none-linux-gnueabi-gcc PKG_CONFIG_PATH=/home/work/dist/lib/pkgconfig ./configure --build=i686-linux --host=arm-none-linux \<br /> --prefix=/home/work/dist CFLAGS=-I/home/work/dist/include --disable-registry --disable-loadsave --disable-gtk-doc \<br /> ac_cv_func_register_printf_function=no --disable-tests --disable-valgrind --disable-debug --disable-gst-debug</p> <p>make && make install
5. 编译gst plugins base
下载gst-plugins-base-0.10.35.tar.gz。
编译脚本:
- CC=arm-none-linux-gnueabi-gcc PKG_CONFIG_PATH=/home/work/dist/lib/pkgconfig ./configure --build=i686-linux --host=arm-none-linux \
- --prefix=/home/work/dist CFLAGS=-I/home/work/dist/include --disable-valgrind --disable-x --disable-gnome_vfs --disable-alsa --disable-ogg --disable-pango --disable-theora --disable-vorbis --disable-examples
- make && make install
CC=arm-none-linux-gnueabi-gcc PKG_CONFIG_PATH=/home/work/dist/lib/pkgconfig ./configure --build=i686-linux --host=arm-none-linux \<br /> --prefix=/home/work/dist CFLAGS=-I/home/work/dist/include --disable-valgrind --disable-x --disable-gnome_vfs --disable-alsa --disable-ogg --disable-pango --disable-theora --disable-vorbis --disable-examples</p> <p>make && make install
好了, 万事具备, 只欠东风了。接下来开始编译Qt
Qt的配置文件很复杂, 我就不写出来了, 就是要注意这三点:
1. 在Qt 的configure 时加上-force-pkg-config, 否则会在WebCore的feature.pri中检查时报"Disabling video due the lack of GLib/Gio/GStreamer.",
也就是说会不支持video.
具体可以看这个pri片段:
- !contains(QT_CONFIG, no-pkg-config):system(pkg-config --exists glib-2.0 gio-2.0 gstreamer-0.10): {
- DEFINES -= ENABLE_VIDEO=0
- DEFINES += ENABLE_VIDEO=1
- DEFINES += WTF_USE_GSTREAMER=1
- DEFINES -= WTF_USE_GSTREAMER=0
- } else {
- message("Disabling video due the lack of GLib/Gio/GStreamer.")
- DEFINES -= ENABLE_VIDEO=1
- DEFINES += ENABLE_VIDEO=0
- }
!contains(QT_CONFIG, no-pkg-config):system(pkg-config --exists glib-2.0 gio-2.0 gstreamer-0.10): {<br /> DEFINES -= ENABLE_VIDEO=0<br /> DEFINES += ENABLE_VIDEO=1<br /> DEFINES += WTF_USE_GSTREAMER=1<br /> DEFINES -= WTF_USE_GSTREAMER=0<br /> } else {<br /> message("Disabling video due the lack of GLib/Gio/GStreamer.")<br /> DEFINES -= ENABLE_VIDEO=1<br /> DEFINES += ENABLE_VIDEO=0<br /> }
如果不指定-force-pkg-config, 就会被当作no-pkg-config.2. 为configure指定:PKG_CONFIG_PATH=/home/work/dist/lib/pkgconfig, 否则也会diabling video
3. 为了让webkit库能找到gstreamer等库, 还需要在webkit.pro中加上
上一篇: QtWebkit的画图