• 大小: 13.81MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-06-20
  • 语言: C/C++
  • 标签: 音频通信  编解码  

资源简介

音频通信 编解码,资源相当好,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.embed.manifest

     文件        732  2010-04-24 01:29  音频通信\Dll\Debug\TalkDll.dll.embed.manifest.res

     文件        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个文件信息

评论

共有 条评论