Mplayer cross-Compilation

Source: Internet
Author: User

1. To support MP3 decoding, add-enable-mad when cross-compiling mplayer; otherwise, the following error occurs during make: mad. h cannot be found.
1. Cross-compile libmad
Download the libmadpackage (libmad-0.15.1b.tar.gz );
Open a terminal, enter the libmad directory, and enter the configuration command:
. /Configure -- enable-FPM = arm -- Host = arm-Linux -- disable-shared (this option indicates static compilation) -- disable-debugging -- prefix =/usr/local/Program/libmad0.15/
Cc = arm-Linux-GCC (ensure that the path of arm-Linux-GCC has export; otherwise, the complete path is provided .)
Make
Make install
In this way, we can see that the include and Lib directories are added under the/usr/local/Program/libmad0.15/directory, which are the libraries related to libmad.

2. mplayer porting

After preparing the libmad library, you can port mplayer. Download the source file of mplayer and decompress it.

Where: mplayer version: mplayer-export-2010-03-07 Latest Version

Cross-compilation chain: 4.2.2

1. Create a setup. Sh file in the mplayer-1.0pre7 directory and put the configure configuration in it. Command: Touch setup. Sh, chmod 777 setup. Sh

2. Edit setup. sh, in setup. sh to add a line of configure command ,. /configure -- Host-CC = GCC -- cc = arm-Linux-GCC -- target = arm-armv6-linux -- enable-static -- prefix =/usr/local/software/mplayer -- disable-win32waveout -- disable- dvdread -- enable-fbdev -- disable-mencoder -- disable-live -- disable-mp3lib -- enable-mad -- remove after enable-libavcodec_a -- With-extraincdir =/usr/local/Program/libmad0.15/include- -extralibdir =/usr/local/Ar M/Program/libmad0.15/lib where-... This parameter has already been described above. -- Host-CC = GCC must be available; otherwise, the compilation will fail, because a file needs to be generated by GCC instead of arm-Linux-GCC.

Note: because the source code of the newly downloaded mplayer is configured -- With-extraincdir-with-extralibdir prompts that this configuration option is not available, you need to manually add support for the libmad library, my solution is to directly copy the files under/usr/local/Program/libmad0.15/include to the mplayer source code, and for the library libmad. a, then modify config. in the Mak, click-LMAD-L/usr/local/Program/libmad0.15/lib, and then execute the next step. (The above is only my own practice and is not guaranteed to be correct)

Note: For version reasons, the following summary error is not displayed when compiling this version. Instead, the following error occurs at libmp eg: libmp eg2/motion_comp_arm_s.s: 29: Error: selected processor does not support 'pld [R1] ', but for the solution, refer to the solution of the last error below.

3. Compile make after configuration, and everything goes smoothly. The migration has been completed.

 

Parameter description:
-- CC
The cross-compilation tool. If it is not added to the environment variable, you must specify the complete path.

-- Target
In the PRE version, -- target and this configuration parameter are described as follows:
========================================================== ========
-- Target = arm-armv4l-linux this parameter should pay attention to a three-part, the first part of the arm refers to the arch, here set to arm; the second part of the armv4l refers to the specific version, this should be noted that it must be consistent with the Platform directory name under the libavcodec directory, otherwise the optimization code for this platform cannot be compiled (as I have observed ); the third part is the system platform.
========================================================== ========
However, in RC2, you only need to specify -- target = arm-Linux.

-- Enable-static
Setting static connections does not require a bunch of messy dynamic libraries, which saves a lot of trouble for new users. If this parameter is set, you do not need to set -- prefix, or execute make install.

-- Prefix =/tmp/mplayer-rc2
After make install, the executable program is installed in the/tmp/mplayer-rc2 directory.

Disable-win32dll
Disable Win32 dynamic link library support. In the PRE version, this parameter is

-- Disable-dvdread
Disable libdvdread.

-- Enable-fbdev
Support for fbdev. This must be selected.

-- Disable-mp3lib and -- enable-mad
The CPU of the ARM Series generally has no floating-point operation units, while mp3lib is used by default for MP3 Decoding of mplayer. This is a floating-point operation library and cannot be run on arm, use ffmp3 or libmad (which requires the external library libmad Support) should be okay. Therefore, we need to disable mencoder and libmad.

-- Disable-mencoder
Disable encoding. This function is not required on the project. It is disabled to reduce the size. I also heard that there is a problem compiling mencoder here. I have heard of it and have never tried it.

-- Disable-live
Disable live 555 streaming media. (I don't know what to do)

Enable-libavcodec_a

Enable static libavcodec decoding. In the PRE version, this parameter is -- enable-libavcodec.

-- Disable-armv5te -- disable-armv6
Disable armv5te and armv6 command extensions.

-- With-extraincdir and-with-extralibdir
Specify the path of libmad and mad. h. The mad path is added after the compilation parameters-I and-l, and must be specified after replacing libmad.

Note: In the pre version, you must specify the -- Host-CC = GCC configuration parameter. It is used to compile intermediate files that need to be executed on the host, such as codec-cfg. However, this parameter can be omitted in RC2.

 

 

4. repost the problems encountered by others

 

Mplayer corruption.
Modify source code:
Libavcodec/bitstream. h: Row 181
Add the following statement.
-------------------------------------------------
# If defined (arch_armv4l)
Typedef int32_t intptr_t;/* Add By Andrew Huang */
# Endif
---------------------------------------------------
Otherwise, the following compilation errors will occur:
Compilation error:
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-Limit = 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

 

1. Modify the source code libavcodec/armv4l/dsputil_arm_s.s, motion_comp_arm_s.s
Add at the beginning
-------------------------
# Ifndef have_pld
. Macro PLD Reg
. Endm
# Endif
-------------------------
Otherwise, the following compilation errors 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]

The error is because the PLD command is valid only in armv5te or later versions and is invalid in armv4l.

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.

 

 

V. Others

Http://blog.chinaunix.net/u3/105675/showart_2148571.html

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.