交叉编译faac共享库
来源:互联网 发布:mac os x 10.10好用吗 编辑:程序博客网 时间:2024/06/03 19:38
作者:咕唧咕唧liukun321
来自:http://blog.csdn.net/liukun321
Advanced Audio Coding。一种专为声音数据设计的文件压缩格式,与Mp3不同,它采用了全新的算法进行编码,更加高效,具有更高的“性价比”。利用AAC格式,可使人感觉声音质量没有明显降低的前提下,更加小巧。
FAAC是在嵌入式系统中常用的AAC音频编码开源库,关于AAC音频格式可以看一下这篇博文作简单了解:AAC音频编码格式简析
FAAC开源工程源码下载链接:FAAC源码下载
得到FAAC工程源码后首先执行 configure获得Makefile,并指定目标平台和交叉工具链
./configure--target=arm-linux--host=arm-none-linux-gnueabi
编译:
make
安装:
make install
最终会在指定安装目录获得如下动态及静态库:
libfaac.a
libfaac.la
libfaac.so
libfaac.so.0
libfaac.so.0.0.0
将获得的动态链接库放入开发板/usr/lib目录即可
下面顺带附上一个将PCM 16bit 原始音频数据编码成AAC格式音频数据的C++类,下面的代码是从一个项目中抽取的,没有单独测试,仅做参考:
class AudioProcess {public:AudioProcess (void){nSampleRate = RATE; // 采样率nChannels = CHANNELS; // 声道数nPCMBitSize = SIZE; nInputSamples = 0;nMaxOutputBytes = 0;AACDecoderInitFlag = 0;DecoderHandle = 0;ADTSFrameInBuf = NULL;PCMData = NULL;ppBuffer = NULL;}// var init~AudioProcess(void){}// var initprivate:ULONG nInputSamples ;ULONG nMaxOutputBytes ;faacEncHandle hEncoder;faacEncConfigurationPtr pConfiguration;BYTE* pbAACBuffer;int nRet;public:int OutAACLength;ULONG nSampleRate; // 采样率UINT nChannels; // 声道数UINT nPCMBitSize; unsigned char* ppBuffer;unsigned long pSizeOfDecoderSpecificInfo;int nBytesRead;int nPCMBufferSize;int nAACBufferSize;BYTE* pbPCMBuffer;BYTE* OutAACBuffer;public:int AACEncoderInit();int AACEncoding();int AACEncoderDestory();};
int AudioProcess ::AACEncoderInit(){ hEncoder = faacEncOpen(nSampleRate, nChannels, &nInputSamples, &nMaxOutputBytes); if(hEncoder == NULL) { printf("[ERROR] Failed to call faacEncOpen()\n"); return -1; } printf("nInputSamples = %d\n",nInputSamples); nPCMBufferSize = nInputSamples * nPCMBitSize / 8; pbPCMBuffer = new BYTE [nPCMBufferSize]; pbAACBuffer = new BYTE [nMaxOutputBytes]; // Get current encoding configuration pConfiguration = faacEncGetCurrentConfiguration(hEncoder); pConfiguration->inputFormat = FAAC_INPUT_16BIT;//_16BIT;pConfiguration->mpegVersion = MPEG4; pConfiguration->version = MPEG4; // 1 pConfiguration->outputFormat =1;// ADTS_STREAM; pConfiguration->aacObjectType = 2;//LOW; pConfiguration->useTns = 0;//DEFAULT_TNS; pConfiguration->shortctl = 0;//SHORTCTL_NORMAL; pConfiguration->allowMidside = 1 ; // Set encoding configuration nRet = faacEncSetConfiguration(hEncoder, pConfiguration); faacEncGetDecoderSpecificInfo(hEncoder,&(ppBuffer), &(pSizeOfDecoderSpecificInfo));}int AudioProcess ::AACEncoding(){ // 输入样本数,用实际读入字节数计算,一般只有读到文件尾时才不是//nPCMBufferSize/(nPCMBitSize/8); nBytesRead = length;nInputSamples = nBytesRead / (nPCMBitSize / 8);printf("nInputSamples = %d\n",nInputSamples); //Encode nRet = faacEncEncode(hEncoder, (int*) pbPCMBuffer, nInputSamples, pbAACBuffer,nMaxOutputBytes); OutAACBuffer = pbAACBuffer; OutAACLength = nRet; return nRet;}void AudioProcess::AACEncoderDestroy(){nRet = faacEncClose(hEncoder);delete[] pbPCMBuffer;delete[] pbAACBuffer;}
0 0
- 交叉编译faac共享库
- 交叉编译faac共享库
- ubuntu 交叉编译x264 faac ffmpeg
- faac 1.28的交叉编译与问题解决
- linux下编译faac库
- linux下编译faac库
- faac编译
- faac库的编译与移植
- faac简介、编译、使用
- 编译faac错误分析
- ffmpeg编译faac小结
- Live555实战之交叉编译live555共享库
- linux下编译faac和x264的库
- linux下编译faac和x264的库
- ubuntu下编译faac-1.28
- android编译ffmpeg+x264+faac
- ios平台下面编译faac
- 交叉编译libIDL库
- Chipmunk物理引擎总结
- 在Windows Service 2012上安装IIS 8.0 IIS 6
- Kienct与Arduino学习笔记(1) 基础知识之Arduino’Kinect‘Processing
- MFC消息映射机制
- bzoj1010: [HNOI2008]玩具装箱toy 斜率优化DP
- 交叉编译faac共享库
- Java中的基本数据类型
- 给ubuntu设置root密码
- jQuery:如何创建一个最基本的插件(How to Create a Basic Plugin)
- Spring与RESTful
- Unity 提取游戏资源之ktx转换
- VisualC++2012 Compiler Warning C4566
- getCurrentSession和openSession
- nagios配置