Skip to content
Snippets Groups Projects
Commit 757dcc85 authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

Clean up and documentation

parent 97e0438e
Branches
Tags
No related merge requests found
...@@ -39,7 +39,6 @@ CodecDescriptor::~CodecDescriptor() ...@@ -39,7 +39,6 @@ CodecDescriptor::~CodecDescriptor()
void void
CodecDescriptor::deleteHandlePointer( void ) CodecDescriptor::deleteHandlePointer( void )
{ {
//_debug("Destroy codecs handles\n");
int i; int i;
for( i = 0 ; i < _CodecInMemory.size() ; i++) for( i = 0 ; i < _CodecInMemory.size() ; i++)
{ {
...@@ -51,11 +50,13 @@ CodecDescriptor::deleteHandlePointer( void ) ...@@ -51,11 +50,13 @@ CodecDescriptor::deleteHandlePointer( void )
void void
CodecDescriptor::init() CodecDescriptor::init()
{ {
std::stringstream errMsg;
std::vector<AudioCodec*> CodecDynamicList = scanCodecDirectory(); std::vector<AudioCodec*> CodecDynamicList = scanCodecDirectory();
_nbCodecs = CodecDynamicList.size(); _nbCodecs = CodecDynamicList.size();
if( _nbCodecs <= 0 ){ if( _nbCodecs <= 0 ){
_debug("Error - No codecs available in directory %s\n", CODECS_DIR); errMsg << "Error - No codecs available in directory " << CODECS_DIR ;
exit(0); _debug("%s\n" , errMsg.str().c_str());
//exit(0);
} }
int i; int i;
...@@ -114,16 +115,6 @@ CodecDescriptor::isActive(AudioCodecType payload) ...@@ -114,16 +115,6 @@ CodecDescriptor::isActive(AudioCodecType payload)
void void
CodecDescriptor::removeCodec(AudioCodecType payload) CodecDescriptor::removeCodec(AudioCodecType payload)
{ {
CodecMap::iterator iter = _codecMap.begin();
while(iter!=_codecMap.end()) {
if (iter->first == payload) {
_debug("Codec %s removed from the list", getCodecName(payload).data());
_codecMap.erase(iter);
break;
}
iter++;
}
} }
void void
......
...@@ -76,7 +76,6 @@ public: ...@@ -76,7 +76,6 @@ public:
/* /*
* Accessor to data structures * Accessor to data structures
*/ */
CodecMap& getCodecMap() { return _codecMap; }
CodecsMap& getCodecsMap() { return _CodecsMap; } CodecsMap& getCodecsMap() { return _CodecsMap; }
CodecOrder& getActiveCodecs() { return _codecOrder; } CodecOrder& getActiveCodecs() { return _codecOrder; }
...@@ -203,16 +202,33 @@ private: ...@@ -203,16 +202,33 @@ private:
*/ */
void unloadCodec( CodecHandlePointer ); void unloadCodec( CodecHandlePointer );
/*
* Check if the files found in searched directories seems valid
* @param std::string The name of the file
* @return true if the file name begins with libcodec_ and ends with .so
* false otherwise
*/
bool seemsValid( std::string ); bool seemsValid( std::string );
/*
* Check if the codecs shared library has already been scanned during the session
* Useful not to load twice the same codec saved in the different directory
* @param std::string The complete name of the shared directory ( without the path )
* @return true if the codecs has been scanned
* false otherwise
*/
bool alreadyInCache( std::string ); bool alreadyInCache( std::string );
bool isCodecLoaded( int payload );
/* /*
* Map the payload of a codec and its name * Check if the audiocodec object has been successfully created
* @param payload The payload of the codec
* @return true if the audiocodec has been created
* false otherwise
*/ */
CodecMap _codecMap; bool isCodecLoaded( int payload );
/* /*
* Map the payload of a codec and the object associated * Map the payload of a codec and the object associated ( AudioCodec * )
*/ */
CodecsMap _CodecsMap; CodecsMap _CodecsMap;
...@@ -221,6 +237,9 @@ private: ...@@ -221,6 +237,9 @@ private:
*/ */
CodecOrder _codecOrder; CodecOrder _codecOrder;
/*
* Vector containing the complete name of the codec shared library scanned
*/
std::vector<std::string> _Cache; std::vector<std::string> _Cache;
/* /*
...@@ -233,6 +252,9 @@ private: ...@@ -233,6 +252,9 @@ private:
* Pair between pointer on function handle and pointer on audiocodec object * Pair between pointer on function handle and pointer on audiocodec object
*/ */
std::vector< CodecHandlePointer > _CodecInMemory; std::vector< CodecHandlePointer > _CodecInMemory;
}; };
#endif // __CODEC_DESCRIPTOR_H__ #endif // __CODEC_DESCRIPTOR_H__
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment