小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

SUSE10.2環(huán)境下gstreamer安裝全記錄

 moyqsky 2011-01-14

SUSE10.2環(huán)境下gstreamer安裝全記錄 收藏

SUSE10.2環(huán)境下gstreamer安裝全記錄

 


1.         安裝gstreamer (gstreamer-0.10.29.tar.gz)

# tar xzf gstreamer-0.10.29.tar.gz

# cd gstreamer-0.10.29/

# ./configure

出現(xiàn)錯(cuò)誤:

configure: Requested 'glib-2.0 >= 2.18' but version of GLib is 2.8.6

configure: error: This package requires GLib >= 2.18 to compile.


2.         安裝glib (glib-2.24.1.tar.gz)

# tar xzf glib-2.24.1.tar.gz

# cd glib-2.24.1/

# ./configure

# make

# make install


3.         返回安裝gstreamer

# cd ../gstreamer-0.10.29/

# ./configure

又出現(xiàn)錯(cuò)誤:

configure: error:

Need libxml2 and development headers/files to build GStreamer.

 

You can do without libxml2 if you pass --disable-loadsave to

configure, but that breaks ABI, so don't do that unless you

are building for an embedded setup and know what you are doing.


4.         安裝libxml (libxml2-2.7.4.tar.gz)

# tar xzf libxml2-2.7.4.tar.gz

# cd libxml2-2.7.4/

# ./configure

最后出現(xiàn):

/bin/rm: cannot remove `libtoolT': No such file or directory

Done configuring

沒(méi)報(bào)錯(cuò),就不管它,繼續(xù)

# make

# make install


5.         再次返回安裝gstreamer

# cd ../gstreamer-0.10.29/

# ./configure

總算是成功了,出現(xiàn)提示:

Configuration

Version                    : 0.10.29

Source code location       : .

Prefix                     : /usr/local

Compiler                   : gcc

Package name               : GStreamer source release

Package origin             : Unknown package origin

 

Documentation (manuals)    : no

Documentation (API)        : no

 

Debug Logging              : yes

Pipeline XML load/save     : yes

Command-line parser        : yes

Option parsing in gst_init : yes

Tracing subsystem          : yes

Allocation tracing         : yes

Plugin registry            : yes

Plugin support             : yes

Network support            : yes

Unit testing support       : yes

 

Debug                      : yes

Profiling                  : no

 

Building examples          : yes

Building test apps         : yes

Building tests that fail   : no

繼續(xù)

# make

# make install


6.         安裝gst-plugins-base插件 (gst-plugins-base-0.10.29.tar.gz)

# tar xzf gst-plugins-base-0.10.29.tar.gz

# cd gst-plugins-base-0.10.29/

# ./configure

又報(bào)錯(cuò)了:

configure: error: liboil-0.3.14 or later is required


7.         安裝liboil (liboil-0.3.17.tar.gz)

# tar xzf liboil-0.3.17.tar.gz

# cd liboil-0.3.17/

# ./configure

# make

# make install


8.         返回安裝gst-plugins-base插件

# cd ../gst-plugins-base-0.10.29/

# ./configure

成功,出現(xiàn)提示:

configure: *** Plug-ins without external dependencies that will be built:

adder

app

audioconvert

audiorate

audioresample

audiotestsrc

ffmpegcolorspace

gdp

playback

subparse

tcp

typefind

videorate

videoscale

videotestsrc

volume

 

configure: *** Plug-ins without external dependencies that will NOT be built:

 

configure: *** Plug-ins with dependencies that will be built:

gio

video4linux

ximagesink

xvimagesink

 

configure: *** Plug-ins with dependencies that will NOT be built:

alsa

cdparanoia

gnomevfs

ivorbisdec

libvisual

ogg

pango

theora

vorbis

應(yīng)該是缺少一些插件,不管,繼續(xù)先:

# make

# make install


9.         安裝gst-plugins-good插件 (gst-plugins-good-0.10.23.tar.gz)

# tar xzf gst-plugins-good-0.10.23.tar.gz

# cd gst-plugins-good-0.10.23/

# ./configure

成功,出現(xiàn)提示:

configure: *** Plug-ins without external dependencies that will be built:

alpha

apetag

audiofx

auparse

autodetect

avi

cutter

debugutils

deinterlace

effectv

equalizer

flv

flx

goom

goom2k1

icydemux

id3demux

imagefreeze

interleave

law

level

matroska

multifile

multipart

qtdemux

replaygain

rtp

rtpmanager

rtsp

shapewipe

smpte

spectrum

udp

videobox

videocrop

videofilter

videomixer

wavenc

wavparse

y4m

 

configure: *** Plug-ins without external dependencies that will NOT be built:

monoscope

 

configure: *** Plug-ins with dependencies that will be built:

annodex

cairo

gdkpixbuf

oss4

ossaudio

png

v4l2src

ximagesrc

 

configure: *** Plug-ins with dependencies that will NOT be built:

1394

aasink

cacasink

directsoundsink

dv

esdsink

flac

gconfelements

halelements

jpeg

osxaudio

osxvideosink

pulseaudio

shout2

souphttpsrc

speex

sunaudio

taglib

wavpack

貌似比上面那個(gè)缺少的還多,本人只要不報(bào)錯(cuò),就不理它,真有問(wèn)題,返工。繼續(xù):

# make

# make install


10.     測(cè)試

至此,gstreamer安裝結(jié)束,可進(jìn)行簡(jiǎn)單測(cè)試:

# gst-launch -vm audiotestsrc ! audioconvert ! audioresample ! osssink

很不幸,報(bào)錯(cuò)了:

/usr/local/bin/gst-launch-0.10: symbol lookup error: /usr/local/bin/gst-launch-0.10: undefined symbol: g_malloc0_n

差不多也就是路徑?jīng)]設(shè)置好的問(wèn)題,在/etc/profile文件最后添加以下兩行:

export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

export LD_LIBRARY_PATH=/usr/lib:/usr/local/lib:$LD_LIBRARY_PATH

再次運(yùn)行:

# gst-launch -vm audiotestsrc ! audioconvert ! audioresample ! osssink

成功:能從楊聲器里聽到蜂鳴音了。


注意了:下面要實(shí)現(xiàn)一個(gè)簡(jiǎn)單的MP3播放。

不過(guò),在安裝下面3個(gè)插件的時(shí)候,特別注意安裝順序,具體原因下面有詳細(xì)分析,不過(guò)你可以先按照我的順序試一下,呵呵。


11.     安裝gst-plugins-ugly插件 (gst-plugins-ugly-0.10.15.tar.gz)

# tar xzf gst-plugins-ugly-0.10.15.tar.gz

# cd gst-plugins-ugly-0.10.15/

# ./configure

# make

# make install


12.     安裝libmad插件 (libmad-0.15.1b.tar.gz)

# tar xzf libmad-0.15.1b.tar.gz

# cd libmad-0.15.1b/

# ./configure

# make

# make install


13.     安裝libid3tag插件 (libid3tag-0.15.1b.tar.gz) (非必須)

# tar xzf libid3tag-0.15.1b.tar.gz

# cd libid3tag-0.15.1b/

# ./configure

# make

# make install


14.     編寫最簡(jiǎn)單的mp3播放程序

代碼如下:(有拷貝嫌疑,不管怎么樣,請(qǐng)注意代碼中的convert

只是讓你測(cè)試一下,想搞明白代碼的意思,請(qǐng)參考以下鏈接,本人也是這里參考過(guò)來(lái)的。

http://www.cnblogs.com/phinecos/archive/2009/06/07/1498166.html

 

#include <gst/gst.h>

#include <glib.h>

 

static gboolean bus_call(GstBus *bus, GstMessage *msg, gpointer data)

{

         GMainLoop *loop = (GMainLoop *)data;        

         switch (GST_MESSAGE_TYPE(msg))

         {

         case GST_MESSAGE_EOS:

                   g_print("End of stream\n");

                   g_main_loop_quit(loop);

                   break;

         case GST_MESSAGE_ERROR:

                   {

                            gchar *debug;

                            GError *error;

                            gst_message_parse_error(msg, &error, &debug);

                            g_free(debug);

                            g_printerr("ERROR:%s\n", error->message);

                            g_error_free(error);

                            g_main_loop_quit(loop);

                            break;

                   }

         default:

                   break;

    }   

         return TRUE;

}

 

int main(int argc, char *argv[])

{

         GMainLoop     *loop;

         GstBus             *bus;

         GstElement    *pipeline, *source, *decoder, *convert, *sink;

 

         gst_init(&argc, &argv);

         loop = g_main_loop_new(NULL, FALSE);

         if (argc != 2)

         {

                   g_printerr("Usage:%s <mp3 filename>\n", argv[0]);

                   return -1;

         }

        

         pipeline = gst_pipeline_new("audio-player");

         source = gst_element_factory_make("filesrc", "file-source");

         decoder = gst_element_factory_make("mad", "mad-decoder");

         convert = gst_element_factory_make("audioconvert", "a-convert");

         sink = gst_element_factory_make("autoaudiosink", "audio-output");

         if (!pipeline || !source || !decoder || !convert || !sink)

         {

                   g_printerr("One element could not be created. Exiting...\n");

                   return -1;

         }

        

         g_object_set(G_OBJECT(source), "location", argv[1], NULL);

        

         bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));

         gst_bus_add_watch(bus, bus_call, loop);

         gst_object_unref(bus);

        

         gst_bin_add_many(GST_BIN(pipeline), source, decoder, convert, sink, NULL);

         gst_element_link_many(source, decoder, convert, sink, NULL);

         gst_element_set_state(pipeline, GST_STATE_PLAYING);

         g_print("Running\n");

 

         g_main_loop_run(loop);

         g_print("Returned,stopping playback\n");

 

         gst_element_set_state(pipeline, GST_STATE_NULL);

         gst_object_unref(GST_OBJECT(pipeline));

        

         return 0;

}

 

編譯:

# gcc -Wall $(pkg-config --cflags --libs gstreamer-0.10) -g my_mp3.c -o my_mp3

編譯成功,生成可執(zhí)行文件my_mp3

開始運(yùn)行:

# ./my_mp3 /home/chenjj/my_test/src/yanhua.mp3

 

眼看快要成功了,但是可惡的錯(cuò)誤又回來(lái)了:

./my_mp3: /usr/lib/libxml2.so.2: no version information available (required by /usr/local/lib/libgstreamer-0.10.so.0)

One element could not be created. Exiting...


15.     分析和解決問(wèn)題

n  關(guān)于libxml2.so.2的問(wèn)題

# cd /usr/lib/

# ls -l libxml2*

lrwxrwxrwx 1 root root      17 2010-06-25 20:05 libxml2.so.2 -> libxml2.so.2.6.23

-rwxr-xr-x 1 root root 1259452 2008-04-22 07:30 libxml2.so.2.6.23

# cd /usr/local/lib/

# ls -l libxml2*

-rw-r--r-- 1 root root 4176246 2010-06-30 18:33 libxml2.a

-rwxr-xr-x 1 root root     932 2010-06-30 18:33 libxml2.la

lrwxrwxrwx 1 root root      16 2010-06-30 18:33 libxml2.so -> libxml2.so.2.7.4

lrwxrwxrwx 1 root root      16 2010-06-30 18:33 libxml2.so.2 -> libxml2.so.2.7.4

-rwxr-xr-x 1 root root 3264492 2010-06-30 18:33 libxml2.so.2.7.4

由此可以看出,是路徑的問(wèn)題。簡(jiǎn)單一點(diǎn),直接把/usr/lib/下面的那個(gè)軟連接刪除,并手動(dòng)建立一個(gè)軟連接:

# cd /usr/lib

# rm libxml2.so.2

# ln -sf /usr/local/lib/libxml2.so.2.7.4 libxml2.so.2

再次運(yùn)行:

# ./my_mp3 /home/chenjj/my_test/src/yanhua.mp3

明顯第一個(gè)錯(cuò)誤就沒(méi)有了:

One element could not be created. Exiting...

 

n  下面解決第2個(gè)錯(cuò)誤

很明顯這個(gè)錯(cuò)誤是程序本身打印出來(lái)的,修改程序添加打印信息:

if (!pipeline || !source || !decoder || !convert || !sink)

{

         g_printerr("One element could not be created. Exiting...\n");

         g_printerr("%d %d %d %d %d\n", pipeline, source, decoder, convert, sink);

         return -1;

}

重新編譯,符號(hào)不匹配報(bào)警,不管,繼續(xù)。

再次運(yùn)行,打印信息如下:

One element could not be created. Exiting...

135155728 135168456 0 135200912 135209000

說(shuō)明是decode沒(méi)有創(chuàng)建成功,即下面這條語(yǔ)句執(zhí)行不成功:

decoder = gst_element_factory_make("mad", "mad-decoder");

 

難道是mad沒(méi)有安裝成功???

使用下面命令,檢測(cè)mad插件是否安裝上的命令:

# gst-inspect mad

沒(méi)有那樣的組件或插件‘mad

瘋掉,再看其他幾個(gè):

# gst-inspect filesrc

# gst-inspect audioconvert

# gst-inspect autoaudiosink

都是有信息打印出來(lái)的,唯獨(dú)這個(gè)mad沒(méi)有。。。

 

重裝?試試看:

# cd libmad-0.15.1b/

# make uninstall

# make clean

# ./configure --prefix=/usr/local/

# make

# make install

查看一下,有沒(méi)有生成lib庫(kù):

# cd /usr/local/lib

# ls -l libmad*

-rw-r--r-- 1 root root 241596 2010-06-30 20:21 libmad.a

-rwxr-xr-x 1 root root    798 2010-06-30 20:21 libmad.la

lrwxrwxrwx 1 root root     15 2010-06-30 20:21 libmad.so -> libmad.so.0.2.1

lrwxrwxrwx 1 root root     15 2010-06-30 20:21 libmad.so.0 -> libmad.so.0.2.1

-rwxr-xr-x 1 root root 191090 2010-06-30 20:21 libmad.so.0.2.1

說(shuō)明該有的也都有了。

 

再次檢測(cè)mad插件是否安裝上:

# gst-inspect mad

沒(méi)有那樣的組件或插件‘mad

天哪!問(wèn)題不在這里。

 

回想,在安裝gst-plugins-ugly插件的時(shí)候,好像有什么警告,再看一下。

為了查明此gst-plugins-ugly插件是否和mad插件有關(guān)系,還得把mad先卸載掉。

# cd libmad-0.15.1b/

# make uninstall

# cd ../gst-plugins-ugly-0.10.15/

# ./configure

configure: *** Plug-ins without external dependencies that will be built:

asfdemux

dvdlpcmdec

dvdsub

iec958

mpegaudioparse

mpegstream

realmedia

 

configure: *** Plug-ins without external dependencies that will NOT be built:

synaesthesia

 

configure: *** Plug-ins with dependencies that will be built:

 

configure: *** Plug-ins with dependencies that will NOT be built:

a52dec

amrnb

amrwbdec

cdio

dvdreadsrc

lame

mad

mpeg2dec

sid

twolame

x264

好,現(xiàn)在問(wèn)題就明顯了,Plug-ins with dependencies that will NOT be built,包括mad

這樣就好辦了,先裝mad,再裝gst-plugins-ugly

# cd ../libmad-0.15.1b/

# make install

# cd ../gst-plugins-ugly-0.10.15/

# ./configure

configure: *** Plug-ins with dependencies that will be built:

mad

 

configure: *** Plug-ins with dependencies that will NOT be built:

a52dec

amrnb

amrwbdec

cdio

dvdreadsrc

lame

mpeg2dec

sid

twolame

x264

# make

# make install

 

再次檢測(cè)mad插件是否安裝上:

# gst-inspect mad

一堆信息出來(lái)了。。。

 

回去重新運(yùn)行程序:

# ./my_mp3 /home/chenjj/my_test/src/yanhua.mp3

Running

恭喜,你是不是聽到歌曲了(如果你裝了音響或使用耳機(jī))

 

再次總結(jié):

在裝libmad插件和gst-plugins-ugly插件時(shí):

1)         先裝libmad

2)         再裝gst-plugins-ugly

原因嘛,后者依賴前者吧。。。


16.     總結(jié):

1)         安裝gstreamer

n  安裝glib

n  安裝libxml

n  安裝gstreamer

2)         安裝幾個(gè)插件

n  安裝liboil

n  安裝gst-plugins-base插件

n  安裝gst-plugins-good插件

3)         測(cè)試

n  # gst-launch -vm audiotestsrc ! audioconvert ! audioresample ! osssink

4)         實(shí)現(xiàn)MP3播放

n  安裝libmad插件

n  安裝libid3tag插件

n  安裝gst-plugins-ugly插件

n  編寫最簡(jiǎn)單的mp3播放程序

n  編譯:

# gcc -Wall $(pkg-config --cflags --libs gstreamer-0.10) -g my_mp3.c -o my_mp3

n  運(yùn)行:

# ./my_mp3 /home/chenjj/my_test/src/yanhua.mp3

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多