Skip to content
Snippets Groups Projects
Commit de81f1de authored by Alexandre Savard's avatar Alexandre Savard
Browse files
parents f4bdbfd9 57e2998e
No related branches found
No related tags found
No related merge requests found
Showing
with 8 additions and 208 deletions
...@@ -32,15 +32,13 @@ ...@@ -32,15 +32,13 @@
#include "MimeParameters.h" // TODO Move to some higher directory #include "MimeParameters.h" // TODO Move to some higher directory
#include <tr1/memory>
#include <cc++/digest.h> #include <cc++/digest.h>
/** /**
* Interface for both audio codecs as well as video codecs. * Interface for both audio codecs as well as video codecs.
*/ */
namespace sfl { namespace sfl {
class Codec : public virtual MimeParameters class Codec : public MimeParameters
{ {
public: public:
Codec() {}; Codec() {};
...@@ -56,16 +54,6 @@ class Codec : public virtual MimeParameters ...@@ -56,16 +54,6 @@ class Codec : public virtual MimeParameters
*/ */
virtual double getBandwidth() const = 0; 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. * Build a unique hash code for identifying the codec uniquely.
* Note that if multiple implementations of codec are provided, * Note that if multiple implementations of codec are provided,
......
...@@ -30,65 +30,6 @@ ...@@ -30,65 +30,6 @@
#ifndef __SFL_MIME_PARAMETERS_H__ #ifndef __SFL_MIME_PARAMETERS_H__
#define __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> #include <cstddef>
using std::ptrdiff_t; using std::ptrdiff_t;
...@@ -97,7 +38,7 @@ using std::ptrdiff_t; ...@@ -97,7 +38,7 @@ using std::ptrdiff_t;
#include <stdexcept> #include <stdexcept>
#include <vector> #include <vector>
#include <map> #include <map>
#include <errno.h> #include <cerrno>
#include "global.h" #include "global.h"
#include "sip/Fmtp.h" #include "sip/Fmtp.h"
...@@ -156,14 +97,14 @@ class MimeParameters ...@@ -156,14 +97,14 @@ class MimeParameters
* @param name The name that identifies the MIME parameter. * @param name The name that identifies the MIME parameter.
* @return The value that is set for this 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 : * @return A string containing the codec specific parameters, formatted by default as :
* "PARAM_LIST : PARAM_NAME = VALUE SEMI_COLON PARAM_LIST | PARAM_END * "PARAM_LIST : PARAM_NAME = VALUE SEMI_COLON PARAM_LIST | PARAM_END
* PARAM_END : empty" * PARAM_END : empty"
*/ */
virtual std::string getParametersFormatted() { virtual std::string getParametersFormatted() const {
// TODO Instead of putting everything into the same vector, // TODO Instead of putting everything into the same vector,
// enforce the required vs optional aspect. Unfilled required params. should // enforce the required vs optional aspect. Unfilled required params. should
// result in exception throwing. // result in exception throwing.
......
...@@ -129,21 +129,6 @@ class Alaw : public sfl::AudioCodec ...@@ -129,21 +129,6 @@ class Alaw : public sfl::AudioCodec
return a^0x55; // A-law has alternate bits inverted for transmission 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 // the class factories
......
...@@ -83,7 +83,7 @@ uint8 AudioCodec::getPayloadType (void) const ...@@ -83,7 +83,7 @@ uint8 AudioCodec::getPayloadType (void) const
return _payload; return _payload;
} }
bool AudioCodec::hasDynamicPayload (void) bool AudioCodec::hasDynamicPayload (void) const
{ {
return _hasDynamicPayload; return _hasDynamicPayload;
} }
......
...@@ -75,7 +75,7 @@ class AudioCodec : public Codec ...@@ -75,7 +75,7 @@ class AudioCodec : public Codec
/** /**
* @Override * @Override
*/ */
std::string getParameter (const std::string& name UNUSED) { std::string getParameter (const std::string& name UNUSED) const {
return ""; return "";
}; };
...@@ -106,7 +106,7 @@ class AudioCodec : public Codec ...@@ -106,7 +106,7 @@ class AudioCodec : public Codec
/** /**
* @return true if this payload is a dynamic one. * @return true if this payload is a dynamic one.
*/ */
bool hasDynamicPayload(); bool hasDynamicPayload() const;
/** /**
* @Override * @Override
...@@ -133,11 +133,6 @@ class AudioCodec : public Codec ...@@ -133,11 +133,6 @@ class AudioCodec : public Codec
*/ */
unsigned int getFrameSize() const; unsigned int getFrameSize() const;
/**
* @Override
*/
virtual AudioCodec* clone() const = 0;
protected: protected:
/** Holds SDP-compliant codec name */ /** Holds SDP-compliant codec name */
std::string _codecName; // what we put inside sdp std::string _codecName; // what we put inside sdp
......
...@@ -211,7 +211,7 @@ std::vector<sfl::Codec*> AudioCodecFactory::scanCodecDirectory (void) ...@@ -211,7 +211,7 @@ std::vector<sfl::Codec*> AudioCodecFactory::scanCodecDirectory (void)
while ( (dirStruct = readdir (dir))) { while ( (dirStruct = readdir (dir))) {
tmp = dirStruct -> d_name ; 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)) { if (seemsValid (tmp) && !alreadyInCache (tmp)) {
_Cache.push_back (tmp); _Cache.push_back (tmp);
audioCodec = loadCodec (dirStr.append (tmp)); audioCodec = loadCodec (dirStr.append (tmp));
...@@ -421,7 +421,3 @@ std::vector <std::string> AudioCodecFactory::getCodecSpecifications (const int32 ...@@ -421,7 +421,3 @@ std::vector <std::string> AudioCodecFactory::getCodecSpecifications (const int32
return v; return v;
} }
...@@ -149,21 +149,6 @@ class Celt : public sfl::AudioCodec ...@@ -149,21 +149,6 @@ class Celt : public sfl::AudioCodec
return len; 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: private:
CELTMode *_mode; CELTMode *_mode;
......
...@@ -821,22 +821,6 @@ class G722 : public sfl::AudioCodec ...@@ -821,22 +821,6 @@ class G722 : public sfl::AudioCodec
return g722_bytes; 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: private:
g722_decode_state_t *decode_s; g722_decode_state_t *decode_s;
......
...@@ -86,21 +86,6 @@ class Gsm : public sfl::AudioCodec ...@@ -86,21 +86,6 @@ class Gsm : public sfl::AudioCodec
return 33; 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: private:
gsm _decode_gsmhandle; gsm _decode_gsmhandle;
gsm _encode_gsmhandle; gsm _encode_gsmhandle;
......
...@@ -114,21 +114,6 @@ class Speex : public sfl::AudioCodec ...@@ -114,21 +114,6 @@ class Speex : public sfl::AudioCodec
return nbBytes; 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: private:
const SpeexMode* _speexModePtr; const SpeexMode* _speexModePtr;
SpeexBits _speex_dec_bits; SpeexBits _speex_dec_bits;
......
...@@ -116,21 +116,6 @@ class Speex : public sfl::AudioCodec ...@@ -116,21 +116,6 @@ class Speex : public sfl::AudioCodec
return nbBytes; 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: private:
const SpeexMode* _speexModePtr; const SpeexMode* _speexModePtr;
SpeexBits _speex_dec_bits; SpeexBits _speex_dec_bits;
......
...@@ -115,20 +115,6 @@ class Speex : public sfl::AudioCodec ...@@ -115,20 +115,6 @@ class Speex : public sfl::AudioCodec
return nbBytes; 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: private:
const SpeexMode* _speexModePtr; const SpeexMode* _speexModePtr;
SpeexBits _speex_dec_bits; SpeexBits _speex_dec_bits;
......
...@@ -123,21 +123,6 @@ class Ulaw : public sfl::AudioCodec ...@@ -123,21 +123,6 @@ class Ulaw : public sfl::AudioCodec
return u; return u;
} }
/**
* @Override
*/
std::string getDescription() const {
return "audio/PCMU 8000 (\"ulaw\") codec.";
}
/**
* @Override
*/
Ulaw* clone() const {
return new Ulaw (*this);
}
}; };
// the class factories // the class factories
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment