Mplayer 1.0 already comes with most of the decoding libraries, such as FFMPEG, but the built-in audio library works very poorly in s32440. use libmad instead. therefore, to port mplayer in arm-Linux, you only need to port the two. after transplantation, the character interface is played. the arm version was first run successfully by my student Cheng lei.
However, the complete version requires the following libraries. if you need subtitle support. the FreeType library needs to be transplanted. libjpeg library is required for JPG skin, And dvdread and dvdna V are required for opening the DVD disc format. The skin of libpnm mplayer is supported mainly by X11. however, porting X11 requires a lot of work. this part of the program is implemented by my student Tong Jun, and the skin effect has been viewed on the S3C2440 Development Board. mplayer also supports SDL, but its implementation does not support skin display. usually turn it off. the arm version can also be added to the live555 support and supports remote RTSP Streaming Media players, similar to the x86 version.
Simple mplayer migrationAccording to the transplantation specification, libmad is in the libs directory, and mplayer is in the project directory.
Libmad portingCc = arm-Linux-GCC. /configure -- prefix = $ PWD /.. /.. /output/arm_linux -- enable-FPM = arm -- Host = arm-Linux -- disable-debugging -- enable-shared -- enable-static modify makefile to remove the 129 rows-Fforce-MEM flag, because the arm-Eabi compiler does not support this option, otherwise an error will be reported.
MAID: Error:Unrecognized command line option "-Fforce-MEM" Make [2]: *** [version. Lo] Error 1 Make [2]: Leaving directory '/ARM/madplay/libs/libmad-0.15.1b'' Make [1]: *** [All-recursive] Error 1 Make [1]: Leaving directory '/ARM/madplay/libs/libmad-0.15.1b'' Make: *** [all] Error 2 |
Make make install
Mplayer porting
0. DownloadMplayer v1.0rc2
Http://www1.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc2.tar.bz2
Compiling environment:In arm-Linux-GCC 3.3.2 + arm-Linux 2.6.13. Arm-Linux-GCC 4.3.2 + arm-Linux 2.6.29 arm-Linux-GCC 4.3.3 + arm-Linux 2.6.30, all tests passed.
1. Generate makefile
./Configure -- prefix = $ PWD/../output/arm_linux -- cc = arm-Linux-GCC -- Ar = arm-Linux-Ar/ -- Ranlib = arm-Linux-ranlib -- disable-Gui/ -- Target = arm-armv4-linux -- Host-CC = gcc-- Disable-FreeType/ -- Enable-fbdev-- Disable-mencoder -- disable-SDL -- disable-live -- disable-dvdread/ -- Disable-libdvdcss-Internal -- disable-x11-- Enable-Cross-compile -- disable-mp3lib/ -- Enable-mad-- With-extraincdir = "$ PWD/../output/arm_linux/include" -- with-extralibdir = "$ PWD/../output/arm_linux/lib "/ -- Disable-dvdna v -- disable-dvdread-Internal -- disable-JPEG -- disable-TGA/ -- Disable-dvbhead -- disable-PNM -- disable-TV -- disable-ivtv/ -- Disable-fontconfig -- disable-xanim -- disable-win32dll -- disable-armv5te -- disable-armv6 |
Note.
- Mplayer does not support common -- host to modify the prefix of the compilation tool. parameters such as -- CC, -- Ar, and -- ranlib must be used to modify the prefix.-- Enable-Cross-compileIs required.
- -- Disable-Gui: closes the graphical interface and uses only the character interface control.
- -- The disable-mp3lib is to disable the default MP3 decoding library, -- enable-mad is supported using libmad.
- -- Disable-dvbhead -- disable-dvdread -- disable-dvdna v -- disable-dvdread-Internal are all related to the dvd library. You do not need to install the basic version.
- Disable-x11-- Enable-fbdevDisable the X11 video output and enable framebuffer support. Required for the arm Development Board.
- -- Enable-static: if the size of static compilation is about 8 MB and the size of dynamic compilation is more than 6 MB, mplayer may link its own decoding library to itself regardless of the compilation method, the size of the system standard library should be 2 MB.
2. Compile:
If any compilation error occurs, modify the source code.
- In some compilers, The intptr_t definition cannot be found. If this is the case with libavcodec/bitstream. h: 181, add the following statement.
#if defined(ARCH_ARMV4L) typedef int32_t intptr_t ; /* Add by Andrew Huang*/ #endif
|
Otherwise, the following compilation error will be generated. intptr_t is defined in standard C, but cannot be found here, so it is directly defined:
Arm-Linux-gcc-I .. /libswscale-I .. /libavcodec-dhave_av_config_h-d_file_offset_bits = 64-d_largefile_source-d_isoc9x_source-I .. -I .. -I .. /libavutil-wdisabled-optimization-wno-pointer-sign-wdeclaration-after-statement-I. -I .. -I .. /libavutil-wall -Wno-switch-wpointer-Arith-wredundant-decls-O4-pipe-ffast-math-fomit-frame-pointer-d_largefile_source-entries = 64-member-dhave_config_h-I/usr /x11r6/include-c-o cyuv. O cyuv. c C0: Warning: Include location "/usr/x11r6/include" is unsafe for cross-Compilation In file encoded ded from mpegvideo. h: 32, From cyuv. C: 38: Bitstream. H: In function ''put _ bits '': Bitstream. h: 233: Error: ''intptr _ t' undeclared (first use in this function) Bitstream. h: 233: Error: (each undeclared identifier is reported only once Bitstream. h: 233: Error: for each function it appears in .) Bitstream. h: 233: Error: Expected '') ''before'' Bitstream. H: In function ''init _ get_bits '': Bitstream. h: 777: Error: ''intptr _ t' undeclared (first use in this function) Bitstream. h: 777: Error: Expected '') ''before'' 'buffer'' Bitstream. h: 778: Error: Expected '') ''before'' 'buffer'' Make [1]: *** [cyuv. O] Error 1 |
- Remove support for arm pld commands
Modify the source code libavcodec/armv4l/dsputil_arm_s.s, libmp eg2/motion_comp_arm_s.s
At the beginning, this Code defines an empty Arm Assembly macro PLD, so that when the Code displays the PLD command, it becomes an empty command.
#ifndef HAVE_PLD .macro pld reg .endm #endif
|
The PLD command is only valid in armv5te or later versions and is invalid in 2440 (armv4l). It must be canceled. The format of this command is
Pre-read PLD commands Function: cache pre-read (PLD, preload). PLD is used to instruct the storage system to read from the memory address specified by the following commands. The storage system can use this method to accelerate memory access.Format: PLD [Rn, {offset}] Where: The base register of the RN memory. Offset: the offset added to rn. The meaning is the same as 3. 2. Section 3 contains 1st commands. |
If you do not cancel the operation, the following error will occur:
Arm-Linux-gcc-I .. /libswscale-I .. /libavcodec-dhave_av_config_h-d_file_offset _ bits = 64-d_largefile_source-d_isoc9x_source-I .. -I .. -I .. /libavutil-wdisable D-Optimization -Wno-pointer-sign-wdeclaration-after-statement-I. -I .. -I .. /lib avutil-wall-wno-switch-wpointer-Arith-wredundant-decls-O4-pipe-ffast-ma th-fomit-frame-pointer -D_reentrant-dhave_config_h-I/home/workspace/mplayer/M Player-1.0rc2 /.. /output/linux_arm/include-I/usr/x11r6/include-c-o armv4l/DSP util_arm_s.o armv4l/dsputil_arm_s.s C0: Warning: Include location "/usr/x11r6/include" is unsafe for cross-compilat ion Armv4l/dsputil_arm_s.s: assembler messages: Armv4l/dsputil_arm_s.s: 79: Error:Selected processor does not support 'pld [R1]'' Armv4l/dsputil_arm_s.s: 90: Error: Selected processor does not support 'pld [R1]'' Armv4l/dsputil_arm_s.s: 100: Error: Selected processor does not support 'pld [R1]'' Armv4l/dsputil_arm_s.s: 111: Error: Selected processor does not support 'pld [R1]'' Armv4l/dsputil_arm_s.s: 122: Error: Selected processor does not support 'pld [R1]'' Armv4l/dsputil_arm_s.s: 141: Error: Selected processor does not support 'pld [R1] |
Make
Modify the bug of make install
A prompt is displayed when you execute make install.
Install-M 755-SMplayer/home/hxy/mplayer/ MPlayer-1.0rc2/../output/arm_linux/bin Strip: unable to recognize the format of the input file '/Home/hxy/mplayer/MPlayer-1.0rc2/../output/arm_linux/bin/mplayer' |
For more information, see that strip is automatically called to strip the application when install has the-S parameter. However, arm-Linux-strip must be called during arm compilation for proper processing. The solution is to cancel the-S parameter. Check the makefile and you will find that-S is as follows:
$ (Install)-M 755 $ (installstrip) mplayer $ (exesuf) $ (bindir)
The default value of installstrip is-S. Therefore, you only need to add
Installstrip: =# Leave it empty.
4.Run:
Export LD_LIBRARY_PATH =$ {lib};./mplayer
-AC madDemo. mpg
$ Lib is the path for saving the library required by mplayer-AC mad is required, indicating that libmad is required for decoding.
This is my successful execution of a script:
export APP_ROOT=/mnt/nfs/MPlayer/output/arm_linuxexport LD_LIBRARY_PATH=$APP_ROOT,OOT/lib;./mplayer -ac mad 2.mpg |
You can test whether mpg, Avi, MP3, or MP4 can be played. By default, the video is played at the original resolution. If you want mplayer to be fully displayed on the LCD, you can use the video filter parameter scale to set
./Mplayer-VF scale = 240: 320
In addition, some tests have found that the output will interfere with the subsequent shell execution line after playing the video on some development boards. It is generally okay to use the following long parameters.
export APP_ROOT=/mnt/nfs/MPlayer/output/arm_linuxexport LD_LIBRARY_PATH=$APP_ROOT,OOT/lib;./mplayer -ac mad 2.mpg -quiet / -vf scale=320:240 2>&1 1>/dev/null && |
If you cannot determine your resolution, you can use the-fullscreen parameter in mplayer or execute the busybox shell command fbset to view the resolution of the Self-n self-board.