資源簡介
音頻通信 編解碼,資源相當好,VC實現,實測通過!
代碼片段和文件信息
#include?“stdafx.h“
#include?“AudioCode.h“
extern?“C“?void?va_g729a_init_encoder();
extern?“C“?void?va_g729a_encoder(short?*speech?unsigned?char?*bitstream);
extern?“C“?void?va_g729a_init_decoder();
extern?“C“?void?va_g729a_decoder(unsigned?char?*bitstream?short?*synth_short?int?bfi);
#define??L_frame_COMPRESSED?10
#define??L_frame????????????80
//包含動態鏈接庫
#pragma?comment(lib“G729a“)
//構造函數
CAudioCode::CAudioCode()
{
va_g729a_init_encoder();//初始化編碼器
va_g729a_init_decoder();//初始化解碼器
}
//析構函數
CAudioCode::~CAudioCode()
{
}
//編碼音頻數據
BOOL?CAudioCode::EncodeAudioData(char?*pinint?lenchar*?poutint*?lenr)
{
//編碼成功與否標記
BOOL?bRet=FALSE;
//無效輸入或輸出
if(!pin||len!=SIZE_AUDIO_frame||!pout)
goto?RET;
//分塊進行編碼
va_g729a_encoder((short*)pin(BYTE*)pout);
va_g729a_encoder((short*)(pin+160)(BYTE*)pout+10);
va_g729a_encoder((short*)(pin+320)(BYTE*)pout+20);
va_g729a_encoder((short*)(pin+480)(BYTE*)pout+30);
va_g729a_encoder((short*)(pin+640)(BYTE*)pout+40);
va_g729a_encoder((short*)(pin+800)(BYTE*)pout+50);
//編碼長度
if(lenr)
*lenr=SIZE_AUDIO_PACKED;
//編碼成功標記
bRet=TRUE;
RET:
//返回
return?bRet;
}
//音頻解碼
BOOL?CAudioCode::DecodeAudioData(char?*pinint?lenchar*?poutint*?lenr)
{
//解碼成功與否標記
BOOL?bRet=FALSE;
//無效輸入或輸出
if(!pin||len!=SIZE_AUDIO_PACKED||!pout)
goto?RET;
//分塊解碼
va_g729a_decoder((BYTE*)pin(short*)(pout)0);
va_g729a_decoder((BYTE*)pin+10(short*)(pout+160)0);
va_g729a_decoder((BYTE*)pin+20(short*)(pout+320)0);
va_g729a_decoder((BYTE*)pin+30(short*)(pout+480)0);
va_g729a_decoder((BYTE*)pin+40(short*)(pout+640)0);
va_g729a_decoder((BYTE*)pin+50(short*)(pout+800)0);
//解碼長度
if(lenr)
*lenr=SIZE_AUDIO_frame;
//設置解碼成功標記
bRet=TRUE;
RET:
//返回
return?bRet;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1918??2003-08-02?10:59??音頻通信\Dll\AudioCode.cpp
?????文件????????667??2003-08-02?10:59??音頻通信\Dll\AudioCode.h
?????文件???????2963??2003-08-02?10:59??音頻通信\Dll\ClientSocket.cpp
?????文件???????1461??2003-08-02?10:59??音頻通信\Dll\ClientSocket.h
?????文件???????9604??2010-04-24?01:29??音頻通信\Dll\Debug\AudioCode.obj
?????文件??????????0??2010-04-24?01:29??音頻通信\Dll\Debug\AudioCode.sbr
?????文件??????17374??2010-04-24?01:29??音頻通信\Dll\Debug\BuildLog.htm
?????文件??????25153??2010-04-24?01:29??音頻通信\Dll\Debug\ClientSocket.obj
?????文件??????????0??2010-04-24?01:29??音頻通信\Dll\Debug\ClientSocket.sbr
?????文件??????46039??2010-04-24?01:29??音頻通信\Dll\Debug\Interface.obj
?????文件??????????0??2010-04-24?01:29??音頻通信\Dll\Debug\Interface.sbr
?????文件??????23522??2010-04-24?01:29??音頻通信\Dll\Debug\ListenSocket.obj
?????文件??????????0??2010-04-24?01:29??音頻通信\Dll\Debug\ListenSocket.sbr
?????文件?????????67??2010-04-24?01:29??音頻通信\Dll\Debug\mt.dep
?????文件??????13340??2010-04-24?01:29??音頻通信\Dll\Debug\MyWaveIn.obj
?????文件??????????0??2010-04-24?01:29??音頻通信\Dll\Debug\MyWaveIn.sbr
?????文件??????17611??2010-04-24?01:29??音頻通信\Dll\Debug\RecSocket.obj
?????文件??????????0??2010-04-24?01:29??音頻通信\Dll\Debug\RecSocket.sbr
?????文件??????23926??2010-04-24?01:29??音頻通信\Dll\Debug\SendClient.obj
?????文件??????????0??2010-04-24?01:29??音頻通信\Dll\Debug\SendClient.sbr
?????文件??????16948??2010-04-24?01:29??音頻通信\Dll\Debug\SortData.obj
?????文件??????????0??2010-04-24?01:29??音頻通信\Dll\Debug\SortData.sbr
?????文件?????356787??2010-04-24?01:29??音頻通信\Dll\Debug\StdAfx.obj
?????文件????3212251??2010-04-24?01:29??音頻通信\Dll\Debug\StdAfx.sbr
?????文件????6835200??2010-04-24?01:29??音頻通信\Dll\Debug\TalkDll.bsc
?????文件????????666??2010-04-24?01:29??音頻通信\Dll\Debug\TalkDll.dll.em
?????文件????????732??2010-04-24?01:29??音頻通信\Dll\Debug\TalkDll.dll.em
?????文件????????631??2010-04-24?01:29??音頻通信\Dll\Debug\TalkDll.dll.intermediate.manifest
?????文件???????3324??2010-04-24?01:29??音頻通信\Dll\Debug\TalkDll.exp
?????文件???????6048??2010-04-24?01:29??音頻通信\Dll\Debug\TalkDll.lib
............此處省略85個文件信息
評論
共有 條評論