Amr is widely used in sound transmission, because more than 10 KB of content can be up to one minute. This format is no longer supported after IOS sdk4.0. Only open-source opencore-Amr is used. Today, I tried to compile the file and the result was successful.
I wrote a script:
#!/bin/sh############################################################################ Change values here ## #VERSION="0.1.2" #SDKVERSION="4.2" ## ############################################################################# ## Don't change anything under this line! ## #############################################################################opencore-amr-0.1.2CURRENTPATH=`pwd`mkdir -p "${CURRENTPATH}/src"tar zxf opencore-amr-${VERSION}.tar.gz -C "${CURRENTPATH}/src"cd "${CURRENTPATH}/src/opencore-amr-${VERSION}"############# iPhone Simulatorecho "Building opencore-amr for iPhoneSimulator ${SDKVERSION} i386"echo "Please stand by..."mkdir -p "${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}.sdk"LOG="${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}.sdk/build-openamr-${VERSION}.log"SDK=/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${SDKVERSION}.sdkexport CC ="/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -arch i386"export CXX="/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++ -arch i386"LDFLAGS="-Wl,-syslibroot,$SDK" ./configure --disable-shared --prefix="${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}.sdk"make >> "${LOG}" 2>&1make install >> "${LOG}" 2>&1make clean >> "${LOG}" 2>&1########################### iPhoneOS armv6echo "Building opencore-amr for iPhoneOS ${SDKVERSION} armv6"echo "Please stand by..."mkdir -p "${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv6.sdk"LOG="${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv6.sdk/build-openamr-${VERSION}.log"SDK=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVERSION}.sdkexport CC ="/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv6 --sysroot=$SDK"export CXX="/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++ -arch armv6 --sysroot=$SDK"LDFLAGS="-Wl,-syslibroot,$SDK"./configure --host=arm-apple-darwin --target=darwin --prefix="${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv6.sdk" --disable-sharedmake >> "${LOG}" 2>&1make install >> "${LOG}" 2>&1make clean >> "${LOG}" 2>&1########################### iPhoneOS armv7echo "Building opencore-amr for iPhoneOS ${SDKVERSION} armv7"echo "Please stand by..."mkdir -p "${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7.sdk"LOG="${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7.sdk/build-openamr-${VERSION}.log"SDK=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVERSION}.sdkexport CC ="/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7 --sysroot=$SDK"export CXX="/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++ -arch armv7 --sysroot=$SDK"LDFLAGS="-Wl,-syslibroot,$SDK"./configure --host=arm-apple-darwin --target=darwin --prefix="${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7.sdk" --disable-shared make >> "${LOG}" 2>&1make install >> "${LOG}" 2>&1make clean >> "${LOG}" 2>&1#############echo "Build library..."mkdir -p ${CURRENTPATH}/liblipo -create -arch i386 ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}.sdk/lib/libopencore-amrwb.a -arch armv6 ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv6.sdk/lib/libopencore-amrwb.a -arch armv7 ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7.sdk/lib/libopencore-amrwb.a -output ${CURRENTPATH}/lib/libopencore-amrwb.alipo -create -arch i386 ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}.sdk/lib/libopencore-amrnb.a -arch armv6 ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv6.sdk/lib/libopencore-amrnb.a -arch armv7 ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7.sdk/lib/libopencore-amrnb.a -output ${CURRENTPATH}/lib/libopencore-amrnb.amkdir -p ${CURRENTPATH}/includecp -R ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}.sdk/include ${CURRENTPATH}/include/echo "Building done."echo "Cleaning up..."rm -rf ${CURRENTPATH}/srcrm -rf ${CURRENTPATH}/binecho "Done."
1. Save the above script content to A. Sh file,
2. Then modify it to run chmod 777 XXX. Sh.
3. Put the downloaded opencore-amr.tar.gz and XXX. Sh in the same directory,
4. Then run./xxx. Sh on the command line.
In this way, an include and Lib folder is generated under the Directory, which is the library you want.
I wrote another article about the usage of the database. The portal encountered a small problem in the process, but the solution was finally solved.
Here is a demo to convert AMR into WAV
Because the directory has changed since xcode4.3, the script above is no longer correct.
I have seen that many people need problems in compilation. I should have spent some time studying it. In fact, I have never used it in projects, but I am only interested in it.
I found a new script and modified it. It was compiled in xcode4.5.1 + ios6. Supports i386, armv7, and armv7s
#!/bin/shset -xeVERSION="0.1.3" #SDKVERSION="6.0"DEVELOPER=`xcode-select -print-path`DEST=${HOME}/opencore-amr-iphoneARCHS="i386 armv7 armv7s"LIBS="libopencore-amrnb.a libopencore-amrwb.a"for arch in $ARCHS; docase $arch inarm*) echo "Building opencore-amr for iPhone $arch ****************" PLATFORM="iPhoneOS" PATH="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/usr/bin:$PATH" SDK="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk"CC="gcc -arch $arch --sysroot=$SDK" CXX="g++ -arch $arch --sysroot=$SDK" \LDFLAGS="-Wl,-syslibroot,$SDK" ./configure \--host=arm-apple-darwin --prefix=$DEST \--disable-shared --enable-gcc-armv5;;*) PLATFORM="iPhoneSimulator" PATH="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/usr/bin:$PATH" SDK="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk" echo "Building opencore-amr for iPhoneSimulator $arch*****************"CC="gcc -arch $arch" CXX="g++ -arch $arch" \./configure \--prefix=$DEST \--disable-shared;;esacmake -j3make installmake cleanfor i in $LIBS; domv $DEST/lib/$i $DEST/lib/$i.$archdonedonefor i in $LIBS; doinput=""for arch in $ARCHS; doinput="$input $DEST/lib/$i.$arch"donelipo -create -output $DEST/lib/$i $inputdone
The generated library and header file are in the $ {home} directory.
I have compiled i386, armv7, and armv7s.
References:
Http://sourceforge.net/mailarchive/forum.php? Thread_name = alpine. deb.2.00.1106152258040.2333 % 40cone. Martin. st & forum_name = opencore-Amr-devel
Http://sourceforge.net/mailarchive/forum.php? Thread_name = alpine. deb.2.00.1103211053460.00004 % 40cone. Home. Martin. st & forum_name = opencore-Amr-devel
Http://tinsuke.wordpress.com/2011/02/17/how-to-cross-compiling-libraries-for-ios-armv6armv7i386/
Http://iosdeveloperzone.com/2012/09/28/tutorial-open-source-on-ios-part-1-build-your-tools/