Download the VLC-android source code and compile it successfully. For more information, see VLC-android compilation process.
1. Compile live555 in the contrib directory
Modify ~ /Code/VLC-android/extras/contrib distro. Mak added. Live
ALL:. zlib \
. A52. MPEG2. Mad. Ogg. Vorbis. vorbisenc. theora \
. FLAC. speex. faad. Lame. FFMPEG \
. Twolame \
. PNG. dvbpsi \
. DCA. Kate. Live
The terminal executes the following command:
Cd vlc-android/extras/contrib/
Export android_ndk =/usr/local/android-ndk-r5b
./Bootstrap-t arm-Eabi-D android
Make
At this time ~ /Code/VLC-android/extras/contrib/build-Src download the live555 source code. In the live folder, compilation fails.
Modify/home/Administrator/code/VLC-android/extras/contrib/build-src/live/makefile. Tail
Watch CD $ (testprogs_dir); $ (make) CD $ (media_server_dir); $ (make) CD $ (testprogs_dir); $ (make) clean
CD $ (media_server_dir); $ (make) clean
As follows:
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
In ~ /Code/VLC-android/extras/contrib/build-src/live/livemedia/makefile. head added-I/home/Administrator/android-ndk-r5b/platforms/Android-9/arch-arm/usr/include
As follows:
Includes =-iinclude-I .. /usageenvironment/include-I .. /groupsock/include-I/home/Administrator/android-ndk-r5b/platforms/Android-9/arch-arm/usr/include
The path of the header file must be added to makefile. Head in other directories, for example, makefile. Head in the groupsock usageenvironment basicusageenvironment mediaserver testprogs directory. The method is the same as above
Modify the socketjoingroupssm socketleavegroupssm function of groupsockhelper. cpp in the groupsock directory.
Set
IMR. imr_multiaddr.s_addr = groupaddress;
IMR. imr_sourceaddr.s_addr = sourcefilteraddr;
IMR. imr_interface.s_addr = receivinginterfaceaddr;
Change
IMR. imr_multiaddr = groupaddress;
IMR. imr_sourceaddr = sourcefilteraddr;
IMR. imr_interface = receivinginterfaceaddr;
As follows:
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;
}
Modify contrib/build-src/live/config. armlinux (Change cross_compile to arm-Linux-androideabi-, and add compile_opts
-Dlocale_not_used)
Cross_compile? = Arm-Linux-androideabi-
Compile_opts = $ (primary des)-I.-O2-dsocklen_t = socklen_t-dno_sstream = 1-d_largefile_source = 1
-D_file_offset_bits = 64-dlocale_not_used
Then we will compile it in the VLC-android/extras/contrib/library that runs make live555.
2. Compile liblive555_plugin.a
Modify/VLC-android/modules/Demux/live555.cpp and comment out # include <iostream>
Modify/VLC-android/extras/package/Android/makefile to add-llivemedia-lusageenvironment-lbasicusageenvironment-lgroupsock to $ (apk_mk)
As follows:
Ldvbpsi-ltwolame-lkate-llog-la52-llivemedia-lusageenvironment-lbasicusageenvironment-lgroupsock \ n ">$ (apk_mk );\
Modify VLC-android/extras/package/Android/configure. Sh
Add
Enable-live555 \
-- With-live555-tree =/home/Administrator/code/VLC-android/extras/contrib/build-src/live \
-- Enable-RTSP \
-- Enable-realrtsp \
As shown below
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-Disable \
-- Disable-VCD \
Disable-v4l2 \
-- Disable-atmo \
-- Disable-VLC
To ~ /Code/VLC-android/extras/package/run make distclean in Android
Execute in builddir
../Extras/package/Android/configure. Sh
./Compile (without the-K option, liblive555_plugin.a will be generated under builddir/modules/Demux/. libs)
3. Compile libvlcjni. So
Run the command in/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
Report
/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/empty 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/empty multiple definition of 'opendecoder'
Modify VLC-android/extras/package/Android/VLC-android/JNI/libvlcjni. h
Watch out
Vlc_declare_plugin (Stats)
Vlc_plugin (Stats)
Execute make again
Administrator @ Ubuntu :~ /Code/VLC-android/extras/package/Android $ vlc_build_dir = ~ /Code/VLC-android/builddir vlc_contrib = ~ /Code/VLC-android/extras/contrib/build make
The prompt is successful. The size is 13 MB.
=== 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