⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 waveformats.h

📁 rtp在linux下的实现
💻 H
字号:
// WaveFormats.h: extra WAVEFORMAT definitions, etc.
//
//////////////////////////////////////////////////////////////////////

#ifndef AFX_WAVEFORMATS_H__963A2A54_7AFE_4DE9_BF2A_1E79F911E37B__INCLUDED_
#define AFX_WAVEFORMATS_H__963A2A54_7AFE_4DE9_BF2A_1E79F911E37B__INCLUDED_

#ifdef WIN32
#include <mmreg.h>
#include <mmsystem.h>
#else
#include "vtypes.h"

typedef struct WaveFormat_t
{
    int32_t wFormatTag;
    int32_t nChannels;
    int64_t nSamplesPerSec;
    int64_t nAvgBytesPerSec;
    int32_t nBlockAlign;
    int32_t wBitsPerSample;
    int32_t cbSize;
} WAVEFORMATEX;

#define WAVE_FORMAT_MULAW   0x0007
#define WAVE_FORMAT_ALAW    0x0006
#define WAVE_FORMAT_PCM     0x0001
#endif

enum WaveFormats
{
	WaveFormat_ULaw			= 0,
	WaveFormat_ALaw			= 1,
	WaveFormat_G729			= 2,
	WaveFormat_G723_53		= 3,
	WaveFormat_G723_63		= 4,
	WaveFormat_PCM_16_8_1	= 5
};

#define WAVE_FORMAT_CISCO_G729			0xFE01
#define WAVE_FORMAT_CISCO_G723_53		0xFE02
#define WAVE_FORMAT_CISCO_G723_63		0xFE03

class WaveFormat  
{
public:
	static WAVEFORMATEX GetWaveFormat(int nWaveFormat)
	{
		WAVEFORMATEX wfx;
		switch(nWaveFormat)
		{
		case WaveFormat_ULaw:
			wfx.wFormatTag = WAVE_FORMAT_MULAW;
			wfx.cbSize = 0;
			wfx.nAvgBytesPerSec = 8000;
			wfx.nBlockAlign = 1;
			wfx.nChannels = 1;
			wfx.nSamplesPerSec = 8000;
			wfx.wBitsPerSample = 8;
			break;
		case WaveFormat_ALaw:
			wfx.wFormatTag = WAVE_FORMAT_ALAW;
			wfx.cbSize = 0;
			wfx.nAvgBytesPerSec = 8000;
			wfx.nBlockAlign = 1;
			wfx.nChannels = 1;
			wfx.nSamplesPerSec = 8000;
			wfx.wBitsPerSample = 8;
			break;
		case WaveFormat_G729:
			wfx.wFormatTag = WAVE_FORMAT_CISCO_G729;
			wfx.cbSize = 0;
			wfx.nAvgBytesPerSec = 1000;
			wfx.nBlockAlign = 1;
			wfx.nChannels = 1;
			wfx.nSamplesPerSec = 8000;
			wfx.wBitsPerSample = 8;
			break;
		case WaveFormat_G723_53:
			wfx.wFormatTag = WAVE_FORMAT_CISCO_G723_53;
			wfx.cbSize = 0;
			wfx.nAvgBytesPerSec = 667;
			wfx.nBlockAlign = 1;
			wfx.nChannels = 1;
			wfx.nSamplesPerSec = 8000;
			wfx.wBitsPerSample = 8;
		case WaveFormat_G723_63:
			wfx.wFormatTag = WAVE_FORMAT_CISCO_G723_63;
			wfx.cbSize = 0;
			wfx.nAvgBytesPerSec = 800;
			wfx.nBlockAlign = 1;
			wfx.nChannels = 1;
			wfx.nSamplesPerSec = 8000;
			wfx.wBitsPerSample = 8;
			break;
		case WaveFormat_PCM_16_8_1:
			wfx.wFormatTag = WAVE_FORMAT_PCM;
			wfx.cbSize = 0;
			wfx.nAvgBytesPerSec = 16000;
			wfx.nBlockAlign = 2;
			wfx.nChannels = 1;
			wfx.nSamplesPerSec = 8000;
			wfx.wBitsPerSample = 16;
			break;
		default:
			break;
		}
		return wfx;
	}
private:
	WaveFormat();
	virtual ~WaveFormat();

};

#endif	// AFX_WAVEFORMATS_H__963A2A54_7AFE_4DE9_BF2A_1E79F911E37B__INCLUDED_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -