Commit 0cc2ff71 authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

Add iLBC codec. Non tested

You have to copy the codec_ilbc.so in /usr/lib and make ldconfig
parent e103d846
...@@ -31,17 +31,26 @@ ...@@ -31,17 +31,26 @@
CodecDescriptor::CodecDescriptor() CodecDescriptor::CodecDescriptor()
{ {
// Default codecs // Default codecs
_codecMap[PAYLOAD_CODEC_ALAW] = "PCMA";
_codecMap[PAYLOAD_CODEC_ULAW] = "PCMU"; _codecMap[PAYLOAD_CODEC_ULAW] = "PCMU";
_codecMap[PAYLOAD_CODEC_GSM] = "GSM"; _codecMap[PAYLOAD_CODEC_GSM] = "GSM";
//_codecMap[PAYLOAD_CODEC_ALAW] = "PCMA";
#ifdef HAVE_SPEEX #ifdef HAVE_SPEEX
//_codecMap[PAYLOAD_CODEC_SPEEX] = new CodecSpeex(PAYLOAD_CODEC_SPEEX); // TODO: this is a variable payload! _codecMap[PAYLOAD_CODEC_SPEEX] = new CodecSpeex(PAYLOAD_CODEC_SPEEX); // TODO: this is a variable payload!
#endif #endif
// theses one are not implemented yet.. // theses one are not implemented yet..
// _codecMap[PAYLOAD_CODEC_ILBC] = Ilbc(); _codecMap[PAYLOAD_CODEC_ILBC] = "iLBC";
// _codecMap[PAYLOAD_CODEC_SPEEX] = Speex(); // _codecMap[PAYLOAD_CODEC_SPEEX] = Speex();
} }
void
CodecDescriptor::init()
{
_codecMap[PAYLOAD_CODEC_ULAW] = "PCMU";
_codecMap[PAYLOAD_CODEC_GSM] = "GSM";
_codecMap[PAYLOAD_CODEC_ALAW] = "PCMA";
_codecMap[PAYLOAD_CODEC_ILBC] = "iLBC";
}
std::string& std::string&
CodecDescriptor::getCodecName(CodecType payload) CodecDescriptor::getCodecName(CodecType payload)
{ {
......
...@@ -68,6 +68,8 @@ public: ...@@ -68,6 +68,8 @@ public:
*/ */
std::string& getCodecName(CodecType payload); std::string& getCodecName(CodecType payload);
void init();
/** /**
* Check in the map codec if the specified codec is supported * Check in the map codec if the specified codec is supported
* @param payload unique identifier of a codec (RFC) * @param payload unique identifier of a codec (RFC)
......
...@@ -1057,9 +1057,9 @@ ManagerImpl::initConfigFile (void) ...@@ -1057,9 +1057,9 @@ ManagerImpl::initConfigFile (void)
fill_config_int(DRIVER_NAME_OUT, DFT_DRIVER_STR); fill_config_int(DRIVER_NAME_OUT, DFT_DRIVER_STR);
fill_config_int(DRIVER_SAMPLE_RATE, DFT_SAMPLE_RATE); fill_config_int(DRIVER_SAMPLE_RATE, DFT_SAMPLE_RATE);
fill_config_int(DRIVER_FRAME_SIZE, DFT_FRAME_SIZE); fill_config_int(DRIVER_FRAME_SIZE, DFT_FRAME_SIZE);
fill_config_str(CODEC1, DFT_CODEC1); //fill_config_str(CODEC1, DFT_CODEC1);
fill_config_str(CODEC2, DFT_CODEC2); //fill_config_str(CODEC2, DFT_CODEC2);
fill_config_str(CODEC3, DFT_CODEC3); //fill_config_str(CODEC3, DFT_CODEC3);
fill_config_str(RING_CHOICE, DFT_RINGTONE); fill_config_str(RING_CHOICE, DFT_RINGTONE);
fill_config_int(VOLUME_SPKR, DFT_VOL_SPKR_STR); fill_config_int(VOLUME_SPKR, DFT_VOL_SPKR_STR);
fill_config_int(VOLUME_MICRO, DFT_VOL_MICRO_STR); fill_config_int(VOLUME_MICRO, DFT_VOL_MICRO_STR);
...@@ -1087,11 +1087,13 @@ void ...@@ -1087,11 +1087,13 @@ void
ManagerImpl::initAudioCodec (void) ManagerImpl::initAudioCodec (void)
{ {
_debugInit("Active Codecs"); _debugInit("Active Codecs");
_codecDescriptorMap.init();
} }
void void
ManagerImpl::setPreferedCodec(const ::DBus::String& codec_name) ManagerImpl::setPreferedCodec(const ::DBus::String& codec_name)
{ { _debug("Set Prefered Order\n");
/*
std::vector<std::string> list = getCodecList(); std::vector<std::string> list = getCodecList();
std::string tmp; std::string tmp;
int i=0; int i=0;
...@@ -1103,6 +1105,7 @@ ManagerImpl::setPreferedCodec(const ::DBus::String& codec_name) ...@@ -1103,6 +1105,7 @@ ManagerImpl::setPreferedCodec(const ::DBus::String& codec_name)
setConfig("Audio", "Codecs.codec1", list[0]); setConfig("Audio", "Codecs.codec1", list[0]);
setConfig("Audio", "Codecs.codec2", list[1]); setConfig("Audio", "Codecs.codec2", list[1]);
setConfig("Audio", "Codecs.codec3", list[2]); setConfig("Audio", "Codecs.codec3", list[2]);
*/
} }
std::string std::string
...@@ -1149,13 +1152,19 @@ ManagerImpl::clockRate(std::string& name) ...@@ -1149,13 +1152,19 @@ ManagerImpl::clockRate(std::string& name)
std::vector< std::string > std::vector< std::string >
ManagerImpl::getCodecList( void ) ManagerImpl::getCodecList( void )
{ {
std::vector< std::string > v; std::vector< std::string > v;
std::string desc=getConfigString(AUDIO, "Codecs.codec1"); CodecMap codecs = _codecDescriptorMap.getCodecMap();
//std::string rate=clockRate(desc).strstream(); CodecMap::iterator iter = codecs.begin();
//printf("%s\n",rate.c_str()); while(iter!=codecs.end())
v.push_back(getConfigString(AUDIO, "Codecs.codec1")); {
v.push_back( getConfigString(AUDIO, "Codecs.codec2")); if(iter->first!=-1)
v.push_back( getConfigString(AUDIO, "Codecs.codec3")); {
printf("codec: %s\n", iter->second.data());
v.push_back(iter->second.data());
}
iter++;
}
return v; return v;
} }
......
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
#define CODEC1 "Codecs.codec1" #define CODEC1 "Codecs.codec1"
#define CODEC2 "Codecs.codec2" #define CODEC2 "Codecs.codec2"
#define CODEC3 "Codecs.codec3" #define CODEC3 "Codecs.codec3"
#define CODEC4 "Codecs.codec4"
#define RING_CHOICE "Rings.ringChoice" #define RING_CHOICE "Rings.ringChoice"
#define ACCOUNT_SIP_COUNT_DEFAULT 4 #define ACCOUNT_SIP_COUNT_DEFAULT 4
#define ACCOUNT_IAX_COUNT_DEFAULT 4 #define ACCOUNT_IAX_COUNT_DEFAULT 4
...@@ -100,6 +101,7 @@ ...@@ -100,6 +101,7 @@
#define DFT_CODEC1 "G711u" #define DFT_CODEC1 "G711u"
#define DFT_CODEC2 "G711a" #define DFT_CODEC2 "G711a"
#define DFT_CODEC3 "GSM" #define DFT_CODEC3 "GSM"
#define DFT_CODEC4 "iLBC"
#define DFT_RINGTONE "konga.ul" #define DFT_RINGTONE "konga.ul"
#define DFT_SKIN "metal" #define DFT_SKIN "metal"
#define DFT_ZONE "North America" #define DFT_ZONE "North America"
......
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