diff --git a/sflphone-common/src/Codec.h b/sflphone-common/src/Codec.h index b903443fe70e9f45d6fe640701b8cc7f8be90edd..5afd4047072119e8f23cbc1ad880da147ab75c96 100644 --- a/sflphone-common/src/Codec.h +++ b/sflphone-common/src/Codec.h @@ -32,15 +32,13 @@ #include "MimeParameters.h" // TODO Move to some higher directory -#include <tr1/memory> - #include <cc++/digest.h> /** * Interface for both audio codecs as well as video codecs. */ namespace sfl { -class Codec : public virtual MimeParameters +class Codec : public MimeParameters { public: Codec() {}; @@ -56,16 +54,6 @@ class Codec : public virtual MimeParameters */ virtual double getBandwidth() const = 0; - /** - * @return Additional information (description) about this codec. This is meant to be shown to the user. - */ - virtual std::string getDescription() const = 0; - - /** - * @return A copy of the current codec. - */ - virtual Codec* clone() const = 0; - /** * Build a unique hash code for identifying the codec uniquely. * Note that if multiple implementations of codec are provided, diff --git a/sflphone-common/src/MimeParameters.h b/sflphone-common/src/MimeParameters.h index 1dfc6541bbf468f6163bea078fc3381288541b96..9ce67d76d679f8924105aebeb83c72eae812ca6a 100644 --- a/sflphone-common/src/MimeParameters.h +++ b/sflphone-common/src/MimeParameters.h @@ -30,65 +30,6 @@ #ifndef __SFL_MIME_PARAMETERS_H__ #define __SFL_MIME_PARAMETERS_H__ -/** - * Start a new payload format definition. - */ -#define MIME_PAYLOAD_FORMAT_DEFINITION( mime, subtype, payloadType, clock ) \ - private: \ - uint8 payload; \ - public: \ - virtual ~MimeParameters##subtype() {}; \ - std::string getMimeType() const { \ - return std::string( mime ); \ - } \ - std::string getMimeSubtype() const { \ - return std::string( #subtype ); \ - } \ - uint8 getPayloadType() const { \ - return payload; \ - } \ - void setPayloadType(uint8 pt) { \ - payload = pt; \ - } \ - uint32 getClockRate() const { \ - return clock; \ - } \ - MimeParameters##subtype() : payload(payloadType) { - -/** - * An alias for MIME_PARAMETER_OPTIONAL - */ -#define MIME_PARAMETER(name, handler) \ - addOptionalParameter( name ); \ - addHandler( name, handler ); - -/** - * Defines an optional parameter. - */ -#define MIME_PARAMETER_OPTIONAL(name, handler) \ - addOptionalParameter( name ); \ - addHandler( name, handler ); - -/** - * Defines a required parameter. The value of this parameter - * should be obtained when sending the initial SDP offer. - */ -#define MIME_PARAMETER_REQUIRED(name, handler) \ - addRequiredParameter( name ); \ - addHandler( name, handler ); - -/** - * End a payload format definition. - */ -#define MIME_PAYLOAD_FORMAT_DEFINITION_END() \ - } - -#define MIME_PARAMETER_KEEP_IF_EQUAL MimeParameters::addParameterIfEqual - -#define MIME_PARAMETER_KEEP_MINIMUM MimeParameters::addParameterMinimum - -#define MIME_PARAMETER_KEEP_REMOTE MimeParameters::addParameterRemote - #include <cstddef> using std::ptrdiff_t; @@ -97,7 +38,7 @@ using std::ptrdiff_t; #include <stdexcept> #include <vector> #include <map> -#include <errno.h> +#include <cerrno> #include "global.h" #include "sip/Fmtp.h" @@ -156,14 +97,14 @@ class MimeParameters * @param name The name that identifies the MIME parameter. * @return The value that is set for this parameter. */ - virtual std::string getParameter (const std::string& name) = 0; + virtual std::string getParameter (const std::string& name) const = 0; /** * @return A string containing the codec specific parameters, formatted by default as : * "PARAM_LIST : PARAM_NAME = VALUE SEMI_COLON PARAM_LIST | PARAM_END * PARAM_END : empty" */ - virtual std::string getParametersFormatted() { + virtual std::string getParametersFormatted() const { // TODO Instead of putting everything into the same vector, // enforce the required vs optional aspect. Unfilled required params. should // result in exception throwing. diff --git a/sflphone-common/src/audio/codecs/alaw.cpp b/sflphone-common/src/audio/codecs/alaw.cpp index f6826269eb889e1eba80029390dc86f6ce329d3a..f0ea91819d73b6ab26405d0a4d52e438f130a761 100644 --- a/sflphone-common/src/audio/codecs/alaw.cpp +++ b/sflphone-common/src/audio/codecs/alaw.cpp @@ -129,21 +129,6 @@ class Alaw : public sfl::AudioCodec return a^0x55; // A-law has alternate bits inverted for transmission } - /** - * @Override - */ - std::string getDescription() const { - return "audio/PCMA 8000 (\"alaw\") codec."; - } - - /** - * @Override - */ - Alaw* clone() const { - return new Alaw (*this); - } - - }; // the class factories diff --git a/sflphone-common/src/audio/codecs/audiocodec.cpp b/sflphone-common/src/audio/codecs/audiocodec.cpp index df7a692419b025193a03bb9a5bf0c245d62dcd60..51b29648c13513a0060fca4b3ec14d3a90ea070f 100644 --- a/sflphone-common/src/audio/codecs/audiocodec.cpp +++ b/sflphone-common/src/audio/codecs/audiocodec.cpp @@ -83,7 +83,7 @@ uint8 AudioCodec::getPayloadType (void) const return _payload; } -bool AudioCodec::hasDynamicPayload (void) +bool AudioCodec::hasDynamicPayload (void) const { return _hasDynamicPayload; } diff --git a/sflphone-common/src/audio/codecs/audiocodec.h b/sflphone-common/src/audio/codecs/audiocodec.h index 20558f0527127525c1a223cfbc272eafa5052fb9..7f97f2e1deb3e83701ffa89a1ae0e930cf01fb53 100644 --- a/sflphone-common/src/audio/codecs/audiocodec.h +++ b/sflphone-common/src/audio/codecs/audiocodec.h @@ -75,7 +75,7 @@ class AudioCodec : public Codec /** * @Override */ - std::string getParameter (const std::string& name UNUSED) { + std::string getParameter (const std::string& name UNUSED) const { return ""; }; @@ -106,7 +106,7 @@ class AudioCodec : public Codec /** * @return true if this payload is a dynamic one. */ - bool hasDynamicPayload(); + bool hasDynamicPayload() const; /** * @Override @@ -133,11 +133,6 @@ class AudioCodec : public Codec */ unsigned int getFrameSize() const; - /** - * @Override - */ - virtual AudioCodec* clone() const = 0; - protected: /** Holds SDP-compliant codec name */ std::string _codecName; // what we put inside sdp diff --git a/sflphone-common/src/audio/codecs/audiocodecfactory.cpp b/sflphone-common/src/audio/codecs/audiocodecfactory.cpp index 2dc459c41f762db96482334321b302de0886d608..51d73e2cbc1db880f70df8f4b4d572a35570c550 100644 --- a/sflphone-common/src/audio/codecs/audiocodecfactory.cpp +++ b/sflphone-common/src/audio/codecs/audiocodecfactory.cpp @@ -211,7 +211,7 @@ std::vector<sfl::Codec*> AudioCodecFactory::scanCodecDirectory (void) while ( (dirStruct = readdir (dir))) { tmp = dirStruct -> d_name ; - if (tmp == CURRENT_DIR || tmp == PARENT_DIR) {} else { + if (tmp != CURRENT_DIR and tmp != PARENT_DIR) { if (seemsValid (tmp) && !alreadyInCache (tmp)) { _Cache.push_back (tmp); audioCodec = loadCodec (dirStr.append (tmp)); @@ -421,7 +421,3 @@ std::vector <std::string> AudioCodecFactory::getCodecSpecifications (const int32 return v; } - - - - diff --git a/sflphone-common/src/audio/codecs/celtcodec.cpp b/sflphone-common/src/audio/codecs/celtcodec.cpp index 4ce2b45f201b4934343d9b51d438e797fe5ab3a4..46517825b3cea00327eefe3bcbea585eb1ac88a9 100644 --- a/sflphone-common/src/audio/codecs/celtcodec.cpp +++ b/sflphone-common/src/audio/codecs/celtcodec.cpp @@ -149,21 +149,6 @@ class Celt : public sfl::AudioCodec return len; } - /** - * @Override - */ - std::string getDescription() const { - return "audio/celt 32000 (\"HD\") codec. Based on libcelt, by Jean-Marc Valin."; - } - - /** - * @Override - */ - Celt* clone() const { - return new Celt (*this); - } - - private: CELTMode *_mode; diff --git a/sflphone-common/src/audio/codecs/g722.cpp b/sflphone-common/src/audio/codecs/g722.cpp index 41ec89a9e101dd2ec3b6b7f45566947de22444e4..ec971f760962820d41db4e7caa66e59c90ea2251 100644 --- a/sflphone-common/src/audio/codecs/g722.cpp +++ b/sflphone-common/src/audio/codecs/g722.cpp @@ -821,22 +821,6 @@ class G722 : public sfl::AudioCodec return g722_bytes; } - - /** - * @Override - */ - std::string getDescription() const { - return "G722 codec. Most of the code comes from Steve Underwood (<steveu@coppice.org>) for the Asterisk project."; - } - - /** - * @Override - */ - G722* clone() const { - return new G722 (*this); - } - - private: g722_decode_state_t *decode_s; diff --git a/sflphone-common/src/audio/codecs/gsmcodec.cpp b/sflphone-common/src/audio/codecs/gsmcodec.cpp index 8be02bc61c5a520f0a639a6a218bdac96459af04..4896bf6dfe4db03c48cf9c9a61d5b9ee7ecbb726 100644 --- a/sflphone-common/src/audio/codecs/gsmcodec.cpp +++ b/sflphone-common/src/audio/codecs/gsmcodec.cpp @@ -86,21 +86,6 @@ class Gsm : public sfl::AudioCodec return 33; } - /** - * @Override - */ - std::string getDescription() const { - return "GSM codec. Based on libgsm, (C) Jutta Degener and Carsten Bormann, Technische Universitaet Berlin."; - } - - /** - * @Override - */ - Gsm* clone() const { - return new Gsm (*this); - } - - private: gsm _decode_gsmhandle; gsm _encode_gsmhandle; diff --git a/sflphone-common/src/audio/codecs/speexcodec_nb.cpp b/sflphone-common/src/audio/codecs/speexcodec_nb.cpp index e0fcd2a8150eb8e9a18d4247dbaa91953ffd4aab..cce688407fa1d541699e310da889157ca2a33de3 100644 --- a/sflphone-common/src/audio/codecs/speexcodec_nb.cpp +++ b/sflphone-common/src/audio/codecs/speexcodec_nb.cpp @@ -114,21 +114,6 @@ class Speex : public sfl::AudioCodec return nbBytes; } - /** - * @Override - */ - std::string getDescription() const { - return "audio/speex 8000 (\"narrow band\") codec. Based on libspeex, by Jean-Marc Valin."; - } - - /** - * @Override - */ - Speex* clone() const { - return new Speex (*this); - } - - private: const SpeexMode* _speexModePtr; SpeexBits _speex_dec_bits; diff --git a/sflphone-common/src/audio/codecs/speexcodec_ub.cpp b/sflphone-common/src/audio/codecs/speexcodec_ub.cpp index 36a8cd1f42abd4c376f316bf588fa756459e0bc9..1ea2fc90c5a48f674f5ea6b8e7151da2e4451d41 100644 --- a/sflphone-common/src/audio/codecs/speexcodec_ub.cpp +++ b/sflphone-common/src/audio/codecs/speexcodec_ub.cpp @@ -116,21 +116,6 @@ class Speex : public sfl::AudioCodec return nbBytes; } - /** - * @Override - */ - std::string getDescription() const { - return "audio/speex 32000 (\"ultra wide band\") codec. Based on libspeex, by Jean-Marc Valin."; - } - - /** - * @Override - */ - Speex* clone() const { - return new Speex (*this); - } - - private: const SpeexMode* _speexModePtr; SpeexBits _speex_dec_bits; diff --git a/sflphone-common/src/audio/codecs/speexcodec_wb.cpp b/sflphone-common/src/audio/codecs/speexcodec_wb.cpp index e4fcd4146280b5b5037ddb6797ae1e7dd7e16c29..da5fc9849cd061293a7258caa7578dd16ce660b0 100644 --- a/sflphone-common/src/audio/codecs/speexcodec_wb.cpp +++ b/sflphone-common/src/audio/codecs/speexcodec_wb.cpp @@ -115,20 +115,6 @@ class Speex : public sfl::AudioCodec return nbBytes; } - /** - * @Override - */ - std::string getDescription() const { - return "audio/speex 16000 (\"wide band\") codec. Based on libspeex, by Jean-Marc Valin."; - } - - /** - * @Override - */ - Speex* clone() const { - return new Speex (*this); - } - private: const SpeexMode* _speexModePtr; SpeexBits _speex_dec_bits; diff --git a/sflphone-common/src/audio/codecs/ulaw.cpp b/sflphone-common/src/audio/codecs/ulaw.cpp index 56d65717425a1537dd281ad0cf9275ea05c2359d..4aff60fe8d3bed10feb1f92da60341fab6b404ff 100644 --- a/sflphone-common/src/audio/codecs/ulaw.cpp +++ b/sflphone-common/src/audio/codecs/ulaw.cpp @@ -123,21 +123,6 @@ class Ulaw : public sfl::AudioCodec return u; } - - /** - * @Override - */ - std::string getDescription() const { - return "audio/PCMU 8000 (\"ulaw\") codec."; - } - - /** - * @Override - */ - Ulaw* clone() const { - return new Ulaw (*this); - } - }; // the class factories