Development of a local video player in Android

Source: Internet
Author: User

In the search local video section of Android local video player development, we can search for a local video and display the image, title, and duration of each video, of course, if you need to add other methods such as the Video length and width, you can use the method in the Video class. Since we have obtained the Video, the next step is to decode the Video. I use ffmpeg to decode the Video, so this is the FFmpeg library that can be used to compile mobile phones using NDK.

NDK =/opt/android-ndk-r8d

PLATFORM = $ NDK/platforms/android-8/arch-arm/

PREBUILT = $ NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86

LOCAL_ARM_NEON = true

CPU = armv7-a

OPTIMIZE_CFLAGS = "-mfloat-abi = softfp-mfpu = neon-marm-mcpu = cortex-a8"

PREFIX =./android/$ CPU

./Configure -- target-OS = linux

-- Prefix = $ PREFIX

-- Enable-cross-compile

-- Arch = arm

-- Enable-nonfree

-- Enable-asm

-- Cpu = cortex-a8

-- Enable-neon

-- Cc = $ PREBUILT/bin/arm-linux-androideabi-gcc

-- Cross-prefix = $ PREBUILT/bin/arm-linux-androideabi-

-- Nm = $ PREBUILT/bin/arm-linux-androideabi-nm

-- Sysroot = $ PLATFORM

-- Extra-cflags = "-O3-fpic-DANDROID-DHAVE_SYS_UIO_H = 1 $ OPTIMIZE_CFLAGS"

-- Disable-shared

-- Enable-static

-- Extra-ldflags = "-Wl,-rpath-link = $ PLATFORM/usr/lib-L $ PLATFORM/usr/lib-nostdlib-lc-lm-ldl-llog"

-- Disable-ffmpeg

-- Disable-ffplay

-- Disable-ffprobe

-- Disable-ffserver

-- Disable-swscale

-- Disable-swresample

-- Enable-avformat

-- Enable-avcodec

-- Disable-optimizations

-- Disable-debug

-- Disable-doc

-- Disable-stripping

-- Enable-pthreads

-- Disable-yasm

-- Enable-zlib

-- Enable-pic

-- Enable-small

Make clean

Make-j4 install

$ PREBUILT/bin/arm-linux-androideabi-ar d libavcodec/libavcodec. a inverse. o

$ PREBUILT/bin/arm-linux-androideabi-ld-rpath-link = $ PLATFORM/usr/lib-L $ PLATFORM/usr/lib-soname libffmpeg-neon.so-shared-nostdlib-z noexecstack-Bsymbolic -- whole-archive -- no-undefined-o $ PREFIX/libffmpeg-neon.so libavcodec/libavcodec. a libavformat/libavformat. a libavutil/libavutil. a-lc-lm-lz-ldl-llog -- warn-once -- dynamic-linker =/system/bin/linker $ PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3 /libgcc. a

NDK =/opt/android-ndk-r8d

PLATFORM = $ NDK/platforms/android-8/arch-arm/

PREBUILT = $ NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86

LOCAL_ARM_NEON = true

CPU = armv7-a

OPTIMIZE_CFLAGS = "-mfloat-abi = softfp-mfpu = neon-marm-mcpu = cortex-a8"

PREFIX =./android/$ CPU

./Configure -- target-OS = linux

-- Prefix = $ PREFIX

-- Enable-cross-compile

-- Arch = arm

-- Enable-nonfree

-- Enable-asm

-- Cpu = cortex-a8

-- Enable-neon

-- Cc = $ PREBUILT/bin/arm-linux-androideabi-gcc

-- Cross-prefix = $ PREBUILT/bin/arm-linux-androideabi-

-- Nm = $ PREBUILT/bin/arm-linux-androideabi-nm

-- Sysroot = $ PLATFORM

-- Extra-cflags = "-O3-fpic-DANDROID-DHAVE_SYS_UIO_H = 1 $ OPTIMIZE_CFLAGS"

-- Disable-shared

-- Enable-static

-- Extra-ldflags = "-Wl,-rpath-link = $ PLATFORM/usr/lib-L $ PLATFORM/usr/lib-nostdlib-lc-lm-ldl-llog"

-- Disable-ffmpeg

-- Disable-ffplay

-- Disable-ffprobe

-- Disable-ffserver

-- Disable-swscale

-- Disable-swresample

-- Enable-avformat

-- Enable-avcodec

-- Disable-optimizations

-- Disable-debug

-- Disable-doc

-- Disable-stripping

-- Enable-pthreads

-- Disable-yasm

-- Enable-zlib

-- Enable-pic

-- Enable-small

Make clean

Make-j4 install

$ PREBUILT/bin/arm-linux-androideabi-ar d libavcodec/libavcodec. a inverse. o

$ PREBUILT/bin/arm-linux-androideabi-ld-rpath-link = $ PLATFORM/usr/lib-L $ PLATFORM/usr/lib-soname libffmpeg-neon.so-shared-nostdlib-z noexecstack-Bsymbolic -- whole-archive -- no-undefined-o $ PREFIX/libffmpeg-neon.so libavcodec/libavcodec. a libavformat/libavformat. a libavutil/libavutil. a-lc-lm-lz-ldl-llog -- warn-once -- dynamic-linker =/system/bin/linker $ PREBUILT/lib/gcc/arm-linux-androideabi /4.4.3/libgcc. a note that the NDK above should be replaced with your local path. This script is enabled with neon, so it can only run on a mobile phone with neon. If you want to run it on a non-neon mobile phone, you need to remove the neon feature.

Then execute this script to generate a libffmpeg-neon.so

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.