Commit 52c63a49 authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

Change CodecType variable name into AudioCodecType

To avoid a conflict with the same variable name in ffmeg/avcodec.h
parent 645487c3
......@@ -60,7 +60,7 @@ CodecDescriptor::init()
int i;
for( i = 0 ; i < _nbCodecs ; i++ ) {
_CodecsMap[(CodecType)CodecDynamicList[i]->getPayload()] = CodecDynamicList[i];
_CodecsMap[(AudioCodecType)CodecDynamicList[i]->getPayload()] = CodecDynamicList[i];
_debug("%s\n" , CodecDynamicList[i]->getCodecName().c_str());
}
}
......@@ -79,7 +79,7 @@ CodecDescriptor::setDefaultOrder()
}
std::string
CodecDescriptor::getCodecName(CodecType payload)
CodecDescriptor::getCodecName(AudioCodecType payload)
{
std::string resNull = "";
CodecsMap::iterator iter = _CodecsMap.find(payload);
......@@ -90,7 +90,7 @@ CodecDescriptor::getCodecName(CodecType payload)
}
AudioCodec*
CodecDescriptor::getCodec(CodecType payload)
CodecDescriptor::getCodec(AudioCodecType payload)
{
CodecsMap::iterator iter = _CodecsMap.find(payload);
if (iter!=_CodecsMap.end()) {
......@@ -100,7 +100,7 @@ CodecDescriptor::getCodec(CodecType payload)
}
bool
CodecDescriptor::isActive(CodecType payload)
CodecDescriptor::isActive(AudioCodecType payload)
{
int i;
for(i=0 ; i < _codecOrder.size() ; i++)
......@@ -112,7 +112,7 @@ CodecDescriptor::isActive(CodecType payload)
}
void
CodecDescriptor::removeCodec(CodecType payload)
CodecDescriptor::removeCodec(AudioCodecType payload)
{
CodecMap::iterator iter = _codecMap.begin();
while(iter!=_codecMap.end()) {
......@@ -127,12 +127,12 @@ CodecDescriptor::removeCodec(CodecType payload)
}
void
CodecDescriptor::addCodec(CodecType payload)
CodecDescriptor::addCodec(AudioCodecType payload)
{
}
double
CodecDescriptor::getBitRate(CodecType payload)
CodecDescriptor::getBitRate(AudioCodecType payload)
{
CodecsMap::iterator iter = _CodecsMap.find(payload);
if (iter!=_CodecsMap.end())
......@@ -142,7 +142,7 @@ CodecDescriptor::getBitRate(CodecType payload)
}
double
CodecDescriptor::getBandwidthPerCall(CodecType payload)
CodecDescriptor::getBandwidthPerCall(AudioCodecType payload)
{
CodecsMap::iterator iter = _CodecsMap.find(payload);
if (iter!=_CodecsMap.end())
......@@ -152,7 +152,7 @@ CodecDescriptor::getBandwidthPerCall(CodecType payload)
}
int
CodecDescriptor::getSampleRate(CodecType payload)
CodecDescriptor::getSampleRate(AudioCodecType payload)
{
CodecsMap::iterator iter = _CodecsMap.find(payload);
if (iter!=_CodecsMap.end())
......@@ -162,7 +162,7 @@ CodecDescriptor::getSampleRate(CodecType payload)
}
int
CodecDescriptor::getChannel(CodecType payload)
CodecDescriptor::getChannel(AudioCodecType payload)
{
CodecsMap::iterator iter = _CodecsMap.find(payload);
if (iter!=_CodecsMap.end())
......@@ -184,8 +184,8 @@ CodecDescriptor::saveActiveCodecs(const std::vector<std::string>& list)
{
payload = std::atoi(list[i].data());
if( isCodecLoaded( payload ) ) {
_codecOrder.push_back((CodecType)payload);
_CodecsMap.find((CodecType)payload)->second->setState( true );
_codecOrder.push_back((AudioCodecType)payload);
_CodecsMap.find((AudioCodecType)payload)->second->setState( true );
}
i++;
}
......
......@@ -53,17 +53,17 @@ typedef enum {
PAYLOAD_CODEC_SPEEX_8000 = 110,
PAYLOAD_CODEC_SPEEX_16000 = 111,
PAYLOAD_CODEC_SPEEX_32000 = 112
} CodecType;
} AudioCodecType;
#include "codecs/audiocodec.h"
/* A codec is identified by its payload. A payload is associated with a name. */
typedef std::map<CodecType, std::string> CodecMap;
typedef std::map<AudioCodecType, std::string> CodecMap;
/* The struct to reflect the order the user wants to use the codecs */
typedef std::vector<CodecType> CodecOrder;
typedef std::vector<AudioCodecType> CodecOrder;
typedef std::pair<AudioCodec* , void*> CodecHandlePointer;
typedef std::map<CodecType , AudioCodec*> CodecsMap;
typedef std::map<AudioCodecType , AudioCodec*> CodecsMap;
class CodecDescriptor {
public:
......@@ -86,14 +86,14 @@ public:
* same as getPayload()
* @return the name of the codec
*/
std::string getCodecName(CodecType payload);
std::string getCodecName(AudioCodecType payload);
/*
* Get the codec object associated with the payload
* @param payload The payload looked for
* @return AudioCodec* A pointer on a AudioCodec object
*/
AudioCodec* getCodec( CodecType payload );
AudioCodec* getCodec( AudioCodecType payload );
/**
* Initialiaze the map with all the supported codecs, even those inactive
......@@ -111,26 +111,26 @@ public:
* @return true if the codec specified is supported
* false otherwise
*/
bool isActive(CodecType payload);
bool isActive(AudioCodecType payload);
/**
* Remove the codec with payload payload from the list
* @param payload the codec to erase
*/
void removeCodec(CodecType payload);
void removeCodec(AudioCodecType payload);
/**
* Add a codec in the list.
* @param payload the codec to add
*/
void addCodec(CodecType payload);
void addCodec(AudioCodecType payload);
/**
* Get the bit rate of the specified codec.
* @param payload The payload of the codec
* @return double The bit rate
*/
double getBitRate(CodecType payload);
double getBitRate(AudioCodecType payload);
/**
* Get the bandwidth for one call with the specified codec.
......@@ -139,7 +139,7 @@ public:
* @param payload The payload of the codec
* @return double The bandwidth
*/
double getBandwidthPerCall(CodecType payload);
double getBandwidthPerCall(AudioCodecType payload);
/**
......@@ -147,14 +147,14 @@ public:
* @param payload The payload of the codec
* @return int The clock rate of the specified codec
*/
int getSampleRate(CodecType payload);
int getSampleRate(AudioCodecType payload);
/*
* Get the number of channels
* @param payload The payload of the codec
* @return int Number of channels
*/
int getChannel(CodecType payload);
int getChannel(AudioCodecType payload);
/**
* Set the order of codecs by their payload
......
......@@ -99,7 +99,7 @@ Call::getRemoteIp()
return _remoteIPAddress;
}
CodecType
AudioCodecType
Call::getAudioCodec()
{
ost::MutexLock m(_callMutex);
......
......@@ -149,7 +149,7 @@ public:
const std::string& getRemoteIp();
/** Return audio codec [mutex protected] */
CodecType getAudioCodec();
AudioCodecType getAudioCodec();
......@@ -164,14 +164,14 @@ protected:
void setRemoteAudioPort(unsigned int port) { _remoteAudioPort = port; }
/** Set the audio codec used. [not protected] */
void setAudioCodec(CodecType audioCodec) { _audioCodec = audioCodec; }
void setAudioCodec(AudioCodecType audioCodec) { _audioCodec = audioCodec; }
/** Codec Map */
CodecDescriptor _codecMap;
/** Codec pointer */
//AudioCodec* _audioCodec;
CodecType _audioCodec;
AudioCodecType _audioCodec;
bool _audioStarted;
......
......@@ -46,7 +46,7 @@ IAXCall::setFormat(int format)
case AST_FORMAT_SPEEX:
setAudioCodec(PAYLOAD_CODEC_SPEEX_8000); break;
default:
setAudioCodec((CodecType) -1);
setAudioCodec((AudioCodecType) -1);
break;
}
}
......
......@@ -1205,14 +1205,14 @@ ManagerImpl::getCodecDetails( const ::DBus::Int32& payload )
std::vector<std::string> v;
std::stringstream ss;
v.push_back(_codecDescriptorMap.getCodecName((CodecType)payload));
ss << _codecDescriptorMap.getSampleRate((CodecType)payload);
v.push_back(_codecDescriptorMap.getCodecName((AudioCodecType)payload));
ss << _codecDescriptorMap.getSampleRate((AudioCodecType)payload);
v.push_back((ss.str()).data());
ss.str("");
ss << _codecDescriptorMap.getBitRate((CodecType)payload);
ss << _codecDescriptorMap.getBitRate((AudioCodecType)payload);
v.push_back((ss.str()).data());
ss.str("");
ss << _codecDescriptorMap.getBandwidthPerCall((CodecType)payload);
ss << _codecDescriptorMap.getBandwidthPerCall((AudioCodecType)payload);
v.push_back((ss.str()).data());
ss.str("");
......
......@@ -283,12 +283,12 @@ SIPCall::SIPCallAnsweredWithoutHold(eXosip_event_t* event)
#else
char *tmp = (char*) osip_list_get (&(remote_med->m_payloads), 0);
#endif
setAudioCodec((CodecType)-1);
setAudioCodec((AudioCodecType)-1);
if (tmp != NULL) {
int payload = atoi (tmp);
_debug(" Remote Payload: %d\n", payload);
//setAudioCodec(_codecMap.getCodecName((CodecType)payload)); // codec builder for the mic
setAudioCodec((CodecType)payload); // codec builder for the mic
//setAudioCodec(_codecMap.getCodecName((AudioCodecType)payload)); // codec builder for the mic
setAudioCodec((AudioCodecType)payload); // codec builder for the mic
}
/*
......@@ -359,8 +359,8 @@ SIPCall::sdp_complete_message(sdp_message_t * remote_sdp, osip_message_t * msg)
if (tmp!=NULL) {
int payload = atoi(tmp);
_debug("remote payload = %s\n", tmp);
CodecType audiocodec = (CodecType)payload;
if (audiocodec != (CodecType)-1 && _codecMap.isActive(audiocodec)) {
AudioCodecType audiocodec = (AudioCodecType)payload;
if (audiocodec != (AudioCodecType)-1 && _codecMap.isActive(audiocodec)) {
listCodec << payload << " ";
//listRtpMap << "a=rtpmap:" << payload << " " << audiocodec->getCodecName() << "/" << audiocodec->getClockRate();
listRtpMap << "a=rtpmap:" << payload << " " << _codecMap.getCodecName(audiocodec) << "/" << _codecMap.getSampleRate(audiocodec);
......@@ -585,7 +585,7 @@ SIPCall::setAudioCodecFromSDP(sdp_media_t* remote_med, int tid)
if (tmp != NULL ) {
int payload = atoi(tmp);
// stop if we find a correct codec
if (_codecMap.isActive((CodecType)payload)){
if (_codecMap.isActive((AudioCodecType)payload)){
break;
}
}
......@@ -593,13 +593,13 @@ SIPCall::setAudioCodecFromSDP(sdp_media_t* remote_med, int tid)
pos++;
}
setAudioCodec((CodecType)-1);
setAudioCodec((AudioCodecType)-1);
if (tmp != NULL) {
int payload = atoi (tmp);
_debug(" Payload: %d\n", payload);
setAudioCodec((CodecType)payload); // codec builder for the mic
setAudioCodec((AudioCodecType)payload); // codec builder for the mic
}
if (getAudioCodec() == (CodecType) -1) {
if (getAudioCodec() == (AudioCodecType) -1) {
_debug("SIPCall Failure: Unable to set codec\n");
_debug("< Sending 415 Unsupported media type\n");
eXosip_lock();
......
......@@ -1101,7 +1101,7 @@ SIPVoIPLink::SIPStartCall(SIPCall* call, const std::string& subject)
std::ostringstream media_audio;
std::ostringstream rtpmap_attr;
CodecType payload;
AudioCodecType payload;
int nbChannel;
int iter;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment