~ubuntu-branches/ubuntu/saucy/sflphone/saucy

« back to all changes in this revision

Viewing changes to sflphone-common/src/audio/codecs/codecDescriptor.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Francois Marier
  • Date: 2010-12-24 16:33:55 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20101224163355-tkvvikqxbrbav6up
Tags: 0.9.11-1
* New upstream release
* Add new build dependencies on libwebkit-dev and libyaml-dev

* Bump Standards-Version up to 3.9.1
* Bump debhelper compatibility to 8
* Patch another typo in the upstream code (lintian notice)

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
void
49
49
CodecDescriptor::deleteHandlePointer (void)
50
50
{
51
 
        _debug("CodecDesccriptor: Delete codec handle pointers");
 
51
    _debug ("CodecDesccriptor: Delete codec handle pointers");
52
52
 
53
53
    for (int i = 0 ; (unsigned int) i < _CodecInMemory.size() ; i++) {
54
54
        unloadCodec (_CodecInMemory[i]);
75
75
    }
76
76
}
77
77
 
78
 
void CodecDescriptor::setDefaultOrder() {
 
78
void CodecDescriptor::setDefaultOrder()
 
79
{
79
80
 
80
81
    _defaultCodecOrder.clear();
81
82
    CodecsMap::iterator iter = _CodecsMap.begin();
115
116
    return NULL;
116
117
}
117
118
 
118
 
double CodecDescriptor::getBitRate (AudioCodecType payload) {
 
119
double CodecDescriptor::getBitRate (AudioCodecType payload)
 
120
{
119
121
 
120
122
    CodecsMap::iterator iter = _CodecsMap.find (payload);
121
123
 
125
127
        return 0.0;
126
128
}
127
129
 
128
 
double CodecDescriptor::getBandwidthPerCall (AudioCodecType payload) {
 
130
double CodecDescriptor::getBandwidthPerCall (AudioCodecType payload)
 
131
{
129
132
 
130
133
    CodecsMap::iterator iter = _CodecsMap.find (payload);
131
134
 
135
138
        return 0.0;
136
139
}
137
140
 
138
 
int CodecDescriptor::getSampleRate (AudioCodecType payload) {
 
141
int CodecDescriptor::getSampleRate (AudioCodecType payload)
 
142
{
139
143
 
140
144
    CodecsMap::iterator iter = _CodecsMap.find (payload);
141
145
 
145
149
        return 0;
146
150
}
147
151
 
148
 
void CodecDescriptor::saveActiveCodecs (const std::vector<std::string>& list) {
 
152
void CodecDescriptor::saveActiveCodecs (const std::vector<std::string>& list)
 
153
{
149
154
 
150
155
    _defaultCodecOrder.clear();
151
156
    // list contains the ordered payload of active codecs picked by the user
166
171
    }
167
172
}
168
173
 
169
 
std::vector<AudioCodec*> CodecDescriptor::scanCodecDirectory (void) {
 
174
std::vector<AudioCodec*> CodecDescriptor::scanCodecDirectory (void)
 
175
{
170
176
 
171
177
    std::vector<AudioCodec*> codecs;
172
178
    std::string tmp;
206
212
    return codecs;
207
213
}
208
214
 
209
 
AudioCodec* CodecDescriptor::loadCodec (std::string path) {
 
215
AudioCodec* CodecDescriptor::loadCodec (std::string path)
 
216
{
210
217
 
211
218
    CodecHandlePointer p;
212
219
    using std::cerr;
232
239
}
233
240
 
234
241
 
235
 
void CodecDescriptor::unloadCodec (CodecHandlePointer p) {
 
242
void CodecDescriptor::unloadCodec (CodecHandlePointer p)
 
243
{
236
244
 
237
245
    using std::cerr;
238
246
    destroy_t* destroyCodec = (destroy_t*) dlsym (p.second , "destroy");
245
253
    dlclose (p.second);
246
254
}
247
255
 
248
 
AudioCodec* CodecDescriptor::instantiateCodec (AudioCodecType payload) {
 
256
AudioCodec* CodecDescriptor::instantiateCodec (AudioCodecType payload)
 
257
{
249
258
 
250
259
    using std::cerr;
251
260
 
262
271
 
263
272
            return a;
264
273
        }
 
274
 
265
275
        iter++;
266
276
    }
267
277
 
270
280
 
271
281
 
272
282
 
273
 
AudioCodec* CodecDescriptor::getFirstCodecAvailable (void) {
 
283
AudioCodec* CodecDescriptor::getFirstCodecAvailable (void)
 
284
{
274
285
 
275
286
    CodecsMap::iterator iter = _CodecsMap.begin();
276
287
 
280
291
        return NULL;
281
292
}
282
293
 
283
 
bool CodecDescriptor::seemsValid (std::string lib) {
 
294
bool CodecDescriptor::seemsValid (std::string lib)
 
295
{
284
296
 
285
297
    // The name of the shared library seems valid  <==> it looks like libcodec_xxx.so
286
298
    // We check this
302
314
#ifdef HAVE_SPEEX_CODEC
303
315
    // Nothing special
304
316
#else
 
317
 
305
318
    if (lib.substr (begin.length() , lib.length() - begin.length() - end.length()) == SPEEX_STRING_DESCRIPTION)
306
319
        return false;
307
320
 
310
323
#ifdef HAVE_GSM_CODEC
311
324
    // Nothing special
312
325
#else
 
326
 
313
327
    if (lib.substr (begin.length() , lib.length() - begin.length() - end.length()) == GSM_STRING_DESCRIPTION)
314
328
        return false;
315
329
 
318
332
#ifdef BUILD_ILBC
319
333
    // Nothing special
320
334
#else
 
335
 
321
336
    if (lib.substr (begin.length() , lib.length() - begin.length() - end.length()) == ILBC_STRING_DESCRIPTION)
322
337
        return false;
323
338
 
346
361
    return false;
347
362
}
348
363
 
349
 
bool CodecDescriptor::isCodecLoaded (int payload) {
 
364
bool CodecDescriptor::isCodecLoaded (int payload)
 
365
{
350
366
 
351
367
    CodecsMap::iterator iter = _CodecsMap.begin();
352
368
 
360
376
    return false;
361
377
}
362
378
 
363
 
std::vector <std::string> CodecDescriptor::getCodecSpecifications (const int32_t& payload) {
364
 
 
365
 
        _debug ("CodecDescriptor: Gathering codec specifications for payload %i", payload);
366
 
 
367
 
        std::vector<std::string> v;
 
379
std::vector <std::string> CodecDescriptor::getCodecSpecifications (const int32_t& payload)
 
380
{
 
381
 
 
382
    _debug ("CodecDescriptor: Gathering codec specifications for payload %i", payload);
 
383
 
 
384
    std::vector<std::string> v;
368
385
    std::stringstream ss;
369
386
 
370
 
        // Add the name of the codec
 
387
    // Add the name of the codec
371
388
    v.push_back (getCodecName ( (AudioCodecType) payload));
372
389
 
373
 
        // Add the sample rate
 
390
    // Add the sample rate
374
391
    ss << getSampleRate ( (AudioCodecType) payload);
375
392
    v.push_back ( (ss.str()).data());
376
393
    ss.str ("");
377
394
 
378
 
        // Add the bit rate
 
395
    // Add the bit rate
379
396
    ss << getBitRate ( (AudioCodecType) payload);
380
397
    v.push_back ( (ss.str()).data());
381
398
    ss.str ("");
382
399
 
383
 
        // Add the bandwidth information
 
400
    // Add the bandwidth information
384
401
    ss << getBandwidthPerCall ( (AudioCodecType) payload);
385
402
    v.push_back ( (ss.str()).data());
386
403
    ss.str ("");
387
404
 
388
 
        return v;
 
405
    return v;
389
406
 
390
407
}
391
408