vlc-android 移植live555到android

來源:互聯網
上載者:User

先下載vlc-android的源碼,並編譯成功,參考 vlc-android編譯流程

一. 在contrib目錄下編譯live555

修改~/code/vlc-android/extras/contrib 下的distro.mak   增加.live

 

all: .zlib \

     .a52 .mpeg2 .mad .ogg .vorbis .vorbisenc .theora \

     .flac .speex .faad .lame .ffmpeg \

     .twolame \

     .png .dvbpsi \

     .dca .kate .live

 

終端執行如下命令:
cd vlc-android/extras/contrib/
export ANDROID_NDK=/usr/local/android-ndk-r5b
./bootstrap -t arm-eabi -d android
make
此時會在~/code/vlc-android/extras/contrib/build-src下載live555的源碼,在live檔案夾,此時編譯是不能通過的

 

修改/home/administrator/code/vlc-android/extras/contrib/build-src/live/makefile.tail

注視掉cd $(TESTPROGS_DIR) ; $(MAKE)   cd $(MEDIA_SERVER_DIR) ; $(MAKE)   cd $(TESTPROGS_DIR) ; $(MAKE) clean

 cd $(MEDIA_SERVER_DIR) ; $(MAKE) clean

如下所示:

all:
cd $(LIVEMEDIA_DIR) ; $(MAKE)
cd $(GROUPSOCK_DIR) ; $(MAKE)
cd $(USAGE_ENVIRONMENT_DIR) ; $(MAKE)
cd $(BASIC_USAGE_ENVIRONMENT_DIR) ; $(MAKE)
#cd $(TESTPROGS_DIR) ; $(MAKE)
#cd $(MEDIA_SERVER_DIR) ; $(MAKE)
clean:
cd $(LIVEMEDIA_DIR) ; $(MAKE) clean
cd $(GROUPSOCK_DIR) ; $(MAKE) clean
cd $(USAGE_ENVIRONMENT_DIR) ; $(MAKE) clean
cd $(BASIC_USAGE_ENVIRONMENT_DIR) ; $(MAKE) clean
#cd $(TESTPROGS_DIR) ; $(MAKE) clean
#cd $(MEDIA_SERVER_DIR) ; $(MAKE) clean

 

 在~/code/vlc-android/extras/contrib/build-src/live/liveMedia/Makefile.head增加  -I/home/administrator/android-ndk-r5b/platforms/android-9/arch-arm/usr/include
如下所示:
INCLUDES = -Iinclude -I../UsageEnvironment/include -I../groupsock/include -I/home/administrator/android-ndk-r5b/platforms/android-9/arch-arm/usr/include
其他目錄下的Makefile.head也要增加標頭檔路徑,如groupsock     UsageEnvironment BasicUsageEnvironment  mediaServer testProgs目錄的Makefile.head,方法同上
修改groupsock 目錄下GroupsockHelper.cpp的socketJoinGroupSSM   socketLeaveGroupSSM函數

imr.imr_multiaddr.s_addr = groupAddress;
imr.imr_sourceaddr.s_addr = sourceFilterAddr;
imr.imr_interface.s_addr = ReceivingInterfaceAddr;
改為
imr.imr_multiaddr = groupAddress;
imr.imr_sourceaddr= sourceFilterAddr;
imr.imr_interface = ReceivingInterfaceAddr;
如下所示:
Boolean socketJoinGroupSSM (UsageEnvironment& env, int socket,
netAddressBits groupAddress,
netAddressBits sourceFilterAddr) {
if (!IsMulticastAddress(groupAddress)) return True; // ignore this case
struct ip_mreq_source imr;
imr.imr_multiaddr = groupAddress;
imr.imr_sourceaddr = sourceFilterAddr;
imr.imr_interface = ReceivingInterfaceAddr;
if (setsockopt(socket, IPPROTO_IP, IP_ADD_SOURCE_MEMBERSHIP,
(const char*)&imr, sizeof (struct ip_mreq_source)) < 0) {
socketErr(env, "setsockopt(IP_ADD_SOURCE_MEMBERSHIP) error: ");
return False;
}
return True;
}
Boolean socketLeaveGroupSSM(UsageEnvironment& /*env*/, int socket,
netAddressBits groupAddress,
netAddressBits sourceFilterAddr) {
if (!IsMulticastAddress(groupAddress)) return True; // ignore this case
struct ip_mreq_source imr;
imr.imr_multiaddr = groupAddress;
imr.imr_sourceaddr = sourceFilterAddr;
imr.imr_interface = ReceivingInterfaceAddr;
if (setsockopt(socket, IPPROTO_IP, IP_DROP_SOURCE_MEMBERSHIP,
(const char*)&imr, sizeof (struct ip_mreq_source)) < 0) {
return False;
}
修改 contrib/build-src/live/config.armlinux(CROSS_COMPILE改為arm-linux-androideabi-,COMPILE_OPTS 最後增加
-DLOCALE_NOT_USED)
       CROSS_COMPILE?= arm-linux-androideabi-

       COMPILE_OPTS = $(INCLUDES) -I. -O2 -DSOCKLEN_T=socklen_t -DNO_SSTREAM=1 -D_LARGEFILE_SOURCE=1

-D_FILE_OFFSET_BITS=64 -DLOCALE_NOT_USED

然後到vlc-android/extras/contrib/執行make  live555的庫就編出來了
二. 編譯liblive555_plugin.a
修改/vlc-android/modules/demux/live555.cpp    注釋掉#include <iostream>
修改/vlc-android/extras/package/android/makefile 增加-lliveMedia -lUsageEnvironment -lBasicUsageEnvironment -lgroupsock 到$(APK_MK)
如下所示:
ldvbpsi -ltwolame -lkate -llog -la52   -lliveMedia  -lUsageEnvironment  -lBasicUsageEnvironment -lgroupsock\n" >> $(APK_MK); \
修改vlc-android/extras/package/android/configure.sh
增加
 --enable-live555 \
--with-live555-tree=/home/administrator/code/vlc-android/extras/contrib/build-src/live \
--enable-rtsp \
--enable-realrtsp \
如下所示
sh ../configure --host=arm-eabi-linux --build=x86_64-unknown-linux \
                --enable-static-modules \
                --enable-debug \
                --disable-qt4 \
                --disable-skins2 \
                --disable-mad \
                --disable-mkv \
                --enable-live555 \
--with-live555-tree=/home/administrator/code/vlc-android/extras/contrib/build-src/live \
--enable-rtsp \
--enable-realrtsp \
                --disable-libgcrypt \
                --disable-lua \
                --enable-swscale \
                --enable-avcodec \
                --enable-avformat \
                --disable-xcb \
                --disable-dbus \
                --disable-vcd \
                --disable-v4l2 \
                --disable-atmo \
                --disable-vlc
到~/code/vlc-android/extras/package/android 下執行make distclean
到builddir 執行
../extras/package/android/configure.sh
./compile  (不帶-k選項,會產生liblive555_plugin.a在builddir/modules/demux/.libs下)
三. 編譯 libvlcjni.so
到/vlc-android/extras/package/android下執行
export ANDROID_NDK=/usr/local/android-ndk-r5b
export ANDROID_SDK=/usr/local/android-sdk
VLC_BUILD_DIR=~/code/vlc-android/builddir VLC_CONTRIB=~/code/vlc-android/extras/contrib/build make
此時會報
/home/administrator/code/vlc-android/builddir/modules/misc/dummy/.libs/libdummy_plugin.a(libdummy_plugin_la-decoder.o): In function `CloseDecoder':
/home/administrator/code/vlc-android/builddir/modules/misc/dummy/http://www.cnblogs.com/http://www.cnblogs.com/modules/misc/dummy/decoder.c:159: multiple definition of `CloseDecoder'
/home/administrator/code/vlc-android/builddir/modules/misc/stats/.libs/libstats_plugin.a(libstats_plugin_la-decoder.o):/home/administrator/code/vlc-android/builddir/modules/misc/stats/http://www.cnblogs.com/http://www.cnblogs.com/modules/misc/stats/decoder.c:106: first defined here
/home/administrator/code/vlc-android/builddir/modules/misc/dummy/.libs/libdummy_plugin.a(libdummy_plugin_la-decoder.o): In function `OpenDecoder':
/home/administrator/code/vlc-android/builddir/modules/misc/dummy/http://www.cnblogs.com/http://www.cnblogs.com/modules/misc/dummy/decoder.c:120: multiple definition of `OpenDecoder'
修改 vlc-android/extras/package/android/vlc-android/jni/libvlcjni.h
注視掉
vlc_declare_plugin(stats)
vlc_plugin(stats) 
重新執行make
administrator@ubuntu:~/code/vlc-android/extras/package/android$ VLC_BUILD_DIR=~/code/vlc-android/builddir VLC_CONTRIB=~/code/vlc-android/extras/contrib/build make
提示成功,大小為13m
=== Building libvlcjni ===
make[1]: Entering directory `/home/administrator/code/vlc-android/extras/package/android/vlc-android'
Compile thumb : vlcjni <= libvlcjni.c
SharedLibrary : libvlcjni.so
Install : libvlcjni.so => libs/armeabi/libvlcjni.so

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.