ptaudiocodec.cpp

来自「基于sipfoundy 公司开发的sipx协议API」· C++ 代码 · 共 133 行

CPP
133
字号
//// Copyright (C) 2004, 2005 Pingtel Corp.// //// $$//////////////////////////////////////////////////////////////////////////////// SYSTEM INCLUDES#include <assert.h>// APPLICATION INCLUDES#include "ptapi/PtAudioCodec.h"// EXTERNAL FUNCTIONS// EXTERNAL VARIABLES// CONSTANTS// STATIC VARIABLE INITIALIZATIONS/* //////////////////////////// PUBLIC //////////////////////////////////// *//* ============================ CREATORS ================================== */// Constructor//:TODO: find the channels definitionPtAudioCodec::PtAudioCodec(PtRtpAudioCodecType codecType){        mCodecType = codecType;        switch (mCodecType)        {        case UNKNOWN_CODEC:                mAudioEncodingMethod = UNKNOWN_ENCODING;                mSampleSize = 0;                mSampleRate = 0;                mNumberOfChannels = 0;                break;        case MU_LAW_8B_8K:                mAudioEncodingMethod = MU_LAW;                mSampleSize = 8;                mSampleRate = 8000;                mNumberOfChannels = 1;                break;        case A_LAW_8B_8K:                mAudioEncodingMethod = A_LAW;                mSampleSize = 8;                mSampleRate = 8000;                mNumberOfChannels = 1;                break;        case LINEAR_16B_8K:                mAudioEncodingMethod = LINEAR;                mSampleSize = 16;                mSampleRate = 8000;                mNumberOfChannels = 1;                break;        }}// Copy constructorPtAudioCodec::PtAudioCodec(const PtAudioCodec& rPtAudioCodec){        mCodecType = rPtAudioCodec.mCodecType;        mAudioEncodingMethod = rPtAudioCodec.mAudioEncodingMethod;        mSampleSize = rPtAudioCodec.mSampleSize;        mSampleRate = rPtAudioCodec.mSampleRate;        mNumberOfChannels = rPtAudioCodec.mNumberOfChannels;}// DestructorPtAudioCodec::~PtAudioCodec(){        // doing nothing right now.}/* ============================ MANIPULATORS ============================== */// Assignment operatorPtAudioCodec&PtAudioCodec::operator=(const PtAudioCodec& rhs){   if (this == &rhs)            // handle the assignment to self case      return *this;        mCodecType = rhs.mCodecType;        mAudioEncodingMethod = rhs.mAudioEncodingMethod;        mSampleSize = rhs.mSampleSize;        mSampleRate = rhs.mSampleRate;        mNumberOfChannels = rhs.mNumberOfChannels;   return *this;}/* ============================ ACCESSORS ================================= */// Get the codec typePtAudioCodec::PtRtpAudioCodecType PtAudioCodec::getRtpCodecType() const{        return mCodecType;}// Get the encoding method.PtAudioCodec::PtRtpAudioEncodingMethod PtAudioCodec::getRtpEncodingMethod() const{        return mAudioEncodingMethod;}// Get the sample size for this codecint PtAudioCodec::getSampleSize() const{        return mSampleSize;}// Get the sample rateint PtAudioCodec::getSampleRate() const{        return mSampleRate;}// Get the number of channels supported for this codecint PtAudioCodec::getNumChannels() const{        return mNumberOfChannels;}/* ============================ INQUIRY =================================== *//* //////////////////////////// PROTECTED ///////////////////////////////// *//* //////////////////////////// PRIVATE /////////////////////////////////// *//* ============================ TESTING =================================== *//* ============================ FUNCTIONS ================================= */

⌨️ 快捷键说明

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