Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    6363    device = QLatin1String(dev);
    6464    this->mode = mode;
     65
     66
     67
     68
    6569}
    6670
     
    256260    snd_pcm_hw_params_set_channels(handle,params,format.channels());
    257261    snd_pcm_hw_params_set_rate(handle,params,format.frequency(),dir);
     262
     263
     264
    258265    switch(format.sampleSize()) {
    259266        case 8:
    260267            if(format.sampleType() == QAudioFormat::SignedInt)
    261                 snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S8);
     268                snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S8);
    262269            else if(format.sampleType() == QAudioFormat::UnSignedInt)
    263                 snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U8);
     270                snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U8);
    264271            break;
    265272        case 16:
    266273            if(format.sampleType() == QAudioFormat::SignedInt) {
    267274                if(format.byteOrder() == QAudioFormat::LittleEndian)
    268                     snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S16_LE);
     275                    snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S16_LE);
    269276                else if(format.byteOrder() == QAudioFormat::BigEndian)
    270                     snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S16_BE);
     277                    snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S16_BE);
    271278            } else if(format.sampleType() == QAudioFormat::UnSignedInt) {
    272279                if(format.byteOrder() == QAudioFormat::LittleEndian)
    273                     snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U16_LE);
     280                    snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U16_LE);
    274281                else if(format.byteOrder() == QAudioFormat::BigEndian)
    275                     snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U16_BE);
     282                    snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U16_BE);
    276283            }
    277284            break;
     
    279286            if(format.sampleType() == QAudioFormat::SignedInt) {
    280287                if(format.byteOrder() == QAudioFormat::LittleEndian)
    281                     snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S32_LE);
     288                    snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S32_LE);
    282289                else if(format.byteOrder() == QAudioFormat::BigEndian)
    283                     snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S32_BE);
     290                    snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S32_BE);
    284291            } else if(format.sampleType() == QAudioFormat::UnSignedInt) {
    285292                if(format.byteOrder() == QAudioFormat::LittleEndian)
    286                     snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U32_LE);
     293                    snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U32_LE);
    287294                else if(format.byteOrder() == QAudioFormat::BigEndian)
    288                     snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U32_BE);
     295                    snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U32_BE);
    289296            }
    290297    }
     
    390397    channelz.append(1);
    391398    channelz.append(2);
     399
     400
     401
     402
     403
    392404    sizez.append(8);
    393405    sizez.append(16);
     
    427439    while (*n != NULL) {
    428440        name = snd_device_name_get_hint(*n, "NAME");
     441
     442
     443
     444
     445
     446
     447
     448
     449
     450
     451
     452
     453
     454
     455
     456
     457
     458
     459
     460
     461
     462
     463
     464
     465
     466
     467
     468
     469
     470
     471
     472
     473
     474
     475
     476
     477
     478
     479
     480
     481
     482
     483
     484
     485
     486
     487
     488
     489
     490
     491
     492
     493
     494
     495
     496
     497
     498
     499
     500
     501
     502
     503
     504
     505
     506
     507
     508
     509
     510
     511
     512
     513
     514
     515
     516
     517
     518
    429519        descr = snd_device_name_get_hint(*n, "DESC");
    430520        io = snd_device_name_get_hint(*n, "IOID");
    431         if((name != NULL) && (descr != NULL) && ((io == NULL) || (io == filter))) {
     521        if((name != NULL) && (descr != NULL)) {
    432522            QString deviceName = QLatin1String(name);
    433             QString deviceDescription = QLatin1String(descr);
    434             allDevices.append(deviceName.toLocal8Bit().constData());
    435             if(deviceDescription.contains(QLatin1String("Default Audio Device")))
    436                 devices.append(deviceName.toLocal8Bit().constData());
     523            if (mode == QAudio::AudioOutput) {
     524                if(deviceName.contains(QLatin1String("surround40")))
     525                    surround40 = true;
     526                if(deviceName.contains(QLatin1String("surround51")))
     527                    surround51 = true;
     528                if(deviceName.contains(QLatin1String("surround71")))
     529                    surround71 = true;
     530            }
    437531        }
    438532        if(name != NULL)
     
    445539    }
    446540    snd_device_name_free_hint(hints);
    447 
    448     if(devices.size() > 0) {
    449         devices.append("default");
    450     }
    451 #else
    452     int idx = 0;
    453     char* name;
    454 
    455     while(snd_card_get_name(idx,&name) == 0) {
    456         devices.append(name);
    457         idx++;
    458     }
    459     if (idx > 0)
    460         devices.append("default");
    461 #endif
    462     if (devices.size() == 0 && allDevices.size() > 0)
    463         return allDevices;
    464 
    465     return devices;
    466 }
    467 
    468 QByteArray QAudioDeviceInfoInternal::defaultInputDevice()
    469 {
    470     QList<QByteArray> devices = availableDevices(QAudio::AudioInput);
    471     if(devices.size() == 0)
    472         return QByteArray();
    473 
    474     return devices.first();
    475 }
    476 
    477 QByteArray QAudioDeviceInfoInternal::defaultOutputDevice()
    478 {
    479     QList<QByteArray> devices = availableDevices(QAudio::AudioOutput);
    480     if(devices.size() == 0)
    481         return QByteArray();
    482 
    483     return devices.first();
    484 }
     541}
     542#endif
    485543
    486544QT_END_NAMESPACE
Note: See TracChangeset for help on using the changeset viewer.