vlc-android 移植live555到android

先下载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/../../../../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/../../../../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/../../../../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

 

你可能感兴趣的:(android,socket,server,basic,interface,iostream)