Changeset 846 for trunk/src/multimedia
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 61 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/multimedia/audio/audio.pri
r769 r846 43 43 44 44 } else:symbian { 45 INCLUDEPATH += /epoc32/include/mmf/common46 INCLUDEPATH += /epoc32/include/mmf/server45 INCLUDEPATH += epoc32/include/mmf/common 46 INCLUDEPATH += epoc32/include/mmf/server 47 47 48 48 HEADERS += $$PWD/qaudio_symbian_p.h \ -
trunk/src/multimedia/audio/qaudio.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/multimedia/audio/qaudio.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/multimedia/audio/qaudio_mac.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 69 69 audioFormat.setSampleSize(sf.mBitsPerChannel); 70 70 audioFormat.setCodec(QString::fromLatin1("audio/pcm")); 71 audioFormat.setByteOrder( sf.mFormatFlags & kLinearPCMFormatFlagIsBigEndian!= 0 ? QAudioFormat::BigEndian : QAudioFormat::LittleEndian);71 audioFormat.setByteOrder( != 0 ? QAudioFormat::BigEndian : QAudioFormat::LittleEndian); 72 72 QAudioFormat::SampleType type = QAudioFormat::UnSignedInt; 73 if ((sf.mFormatFlags & k LinearPCMFormatFlagIsSignedInteger) != 0)73 if ((sf.mFormatFlags & kFormatFlagIsSignedInteger) != 0) 74 74 type = QAudioFormat::SignedInt; 75 else if ((sf.mFormatFlags & k LinearPCMFormatFlagIsFloat) != 0)75 else if ((sf.mFormatFlags & kFormatFlagIsFloat) != 0) 76 76 type = QAudioFormat::Float; 77 77 audioFormat.setSampleType(type); … … 99 99 case QAudioFormat::Unknown: default: break; 100 100 } 101 102 103 101 104 102 105 return sf; -
trunk/src/multimedia/audio/qaudio_mac_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/multimedia/audio/qaudio_symbian_p.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 314 314 case IdleState: 315 315 return QAudio::IdleState; 316 case SuspendedState: 316 case SuspendedPausedState: 317 case SuspendedStoppedState: 317 318 return QAudio::SuspendedState; 318 319 default: … … 433 434 int DevSoundWrapper::samplesProcessed() const 434 435 { 435 Q_ASSERT(StateInitialized == m_state);436 436 int result = 0; 437 switch (m_mode) { 438 case QAudio::AudioInput: 439 result = m_devsound->SamplesRecorded(); 440 break; 441 case QAudio::AudioOutput: 442 result = m_devsound->SamplesPlayed(); 443 break; 437 if (StateInitialized == m_state) { 438 switch (m_mode) { 439 case QAudio::AudioInput: 440 result = m_devsound->SamplesRecorded(); 441 break; 442 case QAudio::AudioOutput: 443 result = m_devsound->SamplesPlayed(); 444 break; 445 } 444 446 } 445 447 return result; … … 476 478 } 477 479 478 void DevSoundWrapper::pause() 479 { 480 Q_ASSERT(StateInitialized == m_state); 481 m_devsound->Pause(); 480 bool DevSoundWrapper::pause() 481 { 482 Q_ASSERT(StateInitialized == m_state); 483 const bool canPause = isResumeSupported(); 484 if (canPause) 485 m_devsound->Pause(); 486 else 487 stop(); 488 return canPause; 489 } 490 491 void DevSoundWrapper::resume() 492 { 493 Q_ASSERT(StateInitialized == m_state); 494 Q_ASSERT(isResumeSupported()); 495 // TODO: QTBUG-13625 482 496 } 483 497 … … 558 572 } 559 573 574 575 576 577 578 579 560 580 void DevSoundWrapper::InitializeComplete(TInt aError) 561 581 { -
trunk/src/multimedia/audio/qaudio_symbian_p.h
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 82 82 , ActiveState 83 83 , IdleState 84 , SuspendedState 84 // QAudio is suspended; DevSound is paused 85 , SuspendedPausedState 86 // QAudio is suspended; DevSound is stopped 87 , SuspendedStoppedState 85 88 }; 86 89 … … 118 121 bool setFormat(const QAudioFormat &format); 119 122 bool start(); 120 void pause(); 123 124 // If DevSound implementation supports pause, calls pause and returns true. 125 // Otherwise calls stop and returns false. In this case, all DevSound buffers 126 // currently held by the backend must be discarded. 127 bool pause(); 128 129 void resume(); 130 121 131 void stop(); 122 132 void bufferProcessed(); … … 141 151 void getSupportedCodecs(); 142 152 void populateCapabilities(); 153 143 154 144 155 private: -
trunk/src/multimedia/audio/qaudiodevicefactory.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 68 68 QT_BEGIN_NAMESPACE 69 69 70 71 70 72 Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, 71 73 (QAudioEngineFactoryInterface_iid, QLatin1String("/audio"), Qt::CaseInsensitive)) 72 74 #endif 73 75 74 76 class QNullDeviceInfo : public QAbstractAudioDeviceInfo … … 138 140 #endif 139 141 #endif 142 140 143 QFactoryLoader* l = loader(); 141 144 … … 149 152 delete plugin; 150 153 } 151 154 #endif 152 155 return devices; 153 156 } … … 155 158 QAudioDeviceInfo QAudioDeviceFactory::defaultInputDevice() 156 159 { 160 157 161 QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(QLatin1String("default"))); 158 162 … … 162 166 return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioInput); 163 167 } 168 169 164 170 #ifndef QT_NO_AUDIO_BACKEND 165 171 #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN)) … … 172 178 QAudioDeviceInfo QAudioDeviceFactory::defaultOutputDevice() 173 179 { 180 174 181 QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(QLatin1String("default"))); 175 182 … … 179 186 return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioOutput); 180 187 } 188 189 181 190 #ifndef QT_NO_AUDIO_BACKEND 182 191 #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN)) … … 197 206 #endif 198 207 #endif 208 199 209 QAudioEngineFactoryInterface* plugin = 200 210 qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(realm)); … … 202 212 if (plugin) 203 213 rc = plugin->createDeviceInfo(handle, mode); 204 214 #endif 205 215 return rc == 0 ? new QNullDeviceInfo() : rc; 206 216 } … … 226 236 #endif 227 237 #endif 238 228 239 QAudioEngineFactoryInterface* plugin = 229 240 qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(deviceInfo.realm())); … … 231 242 if (plugin) 232 243 return plugin->createInput(deviceInfo.handle(), format); 233 244 #endif 234 245 return new QNullInputDevice(); 235 246 } … … 245 256 #endif 246 257 #endif 258 247 259 QAudioEngineFactoryInterface* plugin = 248 260 qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(deviceInfo.realm())); … … 250 262 if (plugin) 251 263 return plugin->createOutput(deviceInfo.handle(), format); 252 264 #endif 253 265 return new QNullOutputDevice(); 254 266 } -
trunk/src/multimedia/audio/qaudiodevicefactory_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/multimedia/audio/qaudiodeviceinfo.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 107 107 The values supported by the the device for each of these 108 108 parameters can be fetched with 109 supportedByteOrders(), supportedChannel s(), supportedCodecs(),110 supported Frequencies(), supportedSampleSizes(), and109 supportedByteOrders(), supportedChannels(), supportedCodecs(), 110 supportedes(), supportedSampleSizes(), and 111 111 supportedSampleTypes(). The combinations supported are dependent on the platform, 112 112 audio plugins installed and the audio device capabilities. If you need a specific format, you can check if … … 320 320 321 321 /*! 322 Returns a list of supported frequencies. 322 Returns a list of supported sample rates. 323 324 \since 4.7 325 */ 326 327 QList<int> QAudioDeviceInfo::supportedSampleRates() const 328 { 329 return supportedFrequencies(); 330 } 331 332 /*! 333 \obsolete 334 335 Use supportedSampleRates() instead. 323 336 */ 324 337 … … 329 342 330 343 /*! 331 Returns a list of supported channels. 344 Returns a list of supported channel counts. 345 346 \since 4.7 347 */ 348 349 QList<int> QAudioDeviceInfo::supportedChannelCounts() const 350 { 351 return supportedChannels(); 352 } 353 354 /*! 355 \obsolete 356 357 Use supportedChannelCount() instead. 332 358 */ 333 359 -
trunk/src/multimedia/audio/qaudiodeviceinfo.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 85 85 QStringList supportedCodecs() const; 86 86 QList<int> supportedFrequencies() const; 87 87 88 QList<int> supportedChannels() const; 89 88 90 QList<int> supportedSampleSizes() const; 89 91 QList<QAudioFormat::Endian> supportedByteOrders() const; -
trunk/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 63 63 device = QLatin1String(dev); 64 64 this->mode = mode; 65 66 67 68 65 69 } 66 70 … … 256 260 snd_pcm_hw_params_set_channels(handle,params,format.channels()); 257 261 snd_pcm_hw_params_set_rate(handle,params,format.frequency(),dir); 262 263 264 258 265 switch(format.sampleSize()) { 259 266 case 8: 260 267 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); 262 269 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); 264 271 break; 265 272 case 16: 266 273 if(format.sampleType() == QAudioFormat::SignedInt) { 267 274 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); 269 276 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); 271 278 } else if(format.sampleType() == QAudioFormat::UnSignedInt) { 272 279 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); 274 281 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); 276 283 } 277 284 break; … … 279 286 if(format.sampleType() == QAudioFormat::SignedInt) { 280 287 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); 282 289 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); 284 291 } else if(format.sampleType() == QAudioFormat::UnSignedInt) { 285 292 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); 287 294 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); 289 296 } 290 297 } … … 390 397 channelz.append(1); 391 398 channelz.append(2); 399 400 401 402 403 392 404 sizez.append(8); 393 405 sizez.append(16); … … 427 439 while (*n != NULL) { 428 440 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 429 519 descr = snd_device_name_get_hint(*n, "DESC"); 430 520 io = snd_device_name_get_hint(*n, "IOID"); 431 if((name != NULL) && (descr != NULL) && ((io == NULL) || (io == filter))) {521 if((name != NULL) && (descr != NULL)) { 432 522 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 } 437 531 } 438 532 if(name != NULL) … … 445 539 } 446 540 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 485 543 486 544 QT_END_NAMESPACE -
trunk/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 99 99 void close(); 100 100 101 102 103 104 105 106 107 101 108 QString device; 102 109 QAudio::Mode mode; -
trunk/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 79 79 bool QAudioDeviceInfoInternal::isFormatSupported(const QAudioFormat& format) const 80 80 { 81 return format.codec() == QString::fromLatin1("audio/pcm"); 81 QAudioDeviceInfoInternal *self = const_cast<QAudioDeviceInfoInternal*>(this); 82 83 return format.isValid() 84 && format.codec() == QString::fromLatin1("audio/pcm") 85 && self->frequencyList().contains(format.frequency()) 86 && self->channelsList().contains(format.channels()) 87 && self->sampleSizeList().contains(format.sampleSize()); 82 88 } 83 89 -
trunk/src/multimedia/audio/qaudiodeviceinfo_mac_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/multimedia/audio/qaudiodeviceinfo_symbian_p.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/multimedia/audio/qaudiodeviceinfo_symbian_p.h
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 98 98 if(mode == QAudio::AudioOutput) { 99 99 nearest.setFrequency(44100); 100 nearest.setChannel s(2);100 nearest.setChannel(2); 101 101 nearest.setByteOrder(QAudioFormat::LittleEndian); 102 102 nearest.setSampleType(QAudioFormat::SignedInt); … … 105 105 } else { 106 106 nearest.setFrequency(11025); 107 nearest.setChannel s(1);107 nearest.setChannel(1); 108 108 nearest.setByteOrder(QAudioFormat::LittleEndian); 109 109 nearest.setSampleType(QAudioFormat::SignedInt); … … 197 197 } 198 198 } 199 } 200 if (!match) failed = true; 199 if (!match) 200 failed = true; 201 } 201 202 202 203 // check frequency … … 209 210 } 210 211 } 212 213 211 214 } 212 215 … … 220 223 } 221 224 } 225 226 222 227 } 223 228 … … 231 236 } 232 237 } 238 239 233 240 } 234 241 … … 242 249 } 243 250 } 251 252 244 253 } 245 254 … … 269 278 if(waveOutGetDevCaps(i, &woc, sizeof(WAVEOUTCAPS)) 270 279 == MMSYSERR_NOERROR) { 271 tmp = QString ::fromUtf16((const unsigned short*)woc.szPname);280 tmp = QString*)woc.szPname); 272 281 if(tmp.compare(device) == 0) { 273 282 match = true; … … 289 298 if(waveInGetDevCaps(i, &woc, sizeof(WAVEINCAPS)) 290 299 == MMSYSERR_NOERROR) { 291 tmp = QString ::fromUtf16((const unsigned short*)woc.szPname);300 tmp = QString*)woc.szPname); 292 301 if(tmp.compare(device) == 0) { 293 302 match = true; … … 375 384 channelz.append(1); 376 385 channelz.append(2); 386 387 388 389 390 377 391 378 392 byteOrderz.append(QAudioFormat::LittleEndian); … … 400 414 if(waveOutGetDevCaps(i, &woc, sizeof(WAVEOUTCAPS)) 401 415 == MMSYSERR_NOERROR) { 402 devices.append(QString ::fromUtf16((const unsigned short*)woc.szPname).toLocal8Bit().constData());416 devices.append(QString*)woc.szPname).toLocal8Bit().constData()); 403 417 } 404 418 } … … 410 424 if(waveInGetDevCaps(i, &woc, sizeof(WAVEINCAPS)) 411 425 == MMSYSERR_NOERROR) { 412 devices.append(QString ::fromUtf16((const unsigned short*)woc.szPname).toLocal8Bit().constData());426 devices.append(QString*)woc.szPname).toLocal8Bit().constData()); 413 427 } 414 428 } -
trunk/src/multimedia/audio/qaudiodeviceinfo_win32_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/multimedia/audio/qaudioengine.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 134 134 creates an internal QIODevice. Returns a pointer to the QIODevice being used to handle 135 135 the data transfer. This QIODevice can be used to write() audio data directly. Passing a 136 QIODevice allows the data to be transfer ed without any extra code.136 QIODevice allows the data to be transfered without any extra code. 137 137 */ 138 138 … … 248 248 then the class creates an internal QIODevice. Returns a pointer to the 249 249 QIODevice being used to handle the data transfer. This QIODevice can be used to 250 read() audio data directly. Passing a QIODevice allows the data to be transfer ed250 read() audio data directly. Passing a QIODevice allows the data to be transfered 251 251 without any extra code. 252 252 */ -
trunk/src/multimedia/audio/qaudioengine.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/multimedia/audio/qaudioengineplugin.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/multimedia/audio/qaudioengineplugin.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/multimedia/audio/qaudioformat.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 112 112 \o Description 113 113 \row 114 \o Frequency114 \o 115 115 \o Samples per second of audio data in Hertz. 116 116 \row … … 144 144 Values are initialized as follows: 145 145 \list 146 \o frequency() = -1147 \o channel s()= -1146 \o () = -1 147 \o channel = -1 148 148 \o sampleSize() = -1 149 149 \o byteOrder() = QAudioFormat::Endian(QSysInfo::ByteOrder) … … 225 225 226 226 /*! 227 Sets the frequency to \a frequency. 227 Sets the sample rate to \a samplerate Hertz. 228 229 \since 4.7 230 */ 231 232 void QAudioFormat::setSampleRate(int samplerate) 233 { 234 d->frequency = samplerate; 235 } 236 237 /*! 238 \obsolete 239 240 Use setSampleRate() instead. 228 241 */ 229 242 … … 234 247 235 248 /*! 236 Returns the current frequency value. 249 Returns the current sample rate in Hertz. 250 251 \since 4.7 252 */ 253 254 int QAudioFormat::sampleRate() const 255 { 256 return d->frequency; 257 } 258 259 /*! 260 \obsolete 261 262 Use sampleRate() instead. 237 263 */ 238 264 … … 243 269 244 270 /*! 245 Sets the channels to \a channels. 271 Sets the channel count to \a channels. 272 273 \since 4.7 274 */ 275 276 void QAudioFormat::setChannelCount(int channels) 277 { 278 d->channels = channels; 279 } 280 281 /*! 282 \obsolete 283 284 Use setChannelCount() instead. 246 285 */ 247 286 … … 252 291 253 292 /*! 254 Returns the current channel value. 293 Returns the current channel count value. 294 295 \since 4.7 296 */ 297 298 int QAudioFormat::channelCount() const 299 { 300 return d->channels; 301 } 302 303 /*! 304 \obsolete 305 306 Use channelCount() instead. 255 307 */ 256 308 -
trunk/src/multimedia/audio/qaudioformat.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 76 76 void setFrequency(int frequency); 77 77 int frequency() const; 78 79 78 80 79 81 void setChannels(int channels); 80 82 int channels() const; 83 84 81 85 82 86 void setSampleSize(int sampleSize); -
trunk/src/multimedia/audio/qaudioinput.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 202 202 /*! 203 203 Uses the \a device as the QIODevice to transfer data. 204 Passing a QIODevice allows the data to be transfer ed without any extra code.204 Passing a QIODevice allows the data to be transfered without any extra code. 205 205 All that is required is to open the QIODevice. 206 206 … … 212 212 state() is set to QAudio::StoppedState and stateChanged() signal is emitted. 213 213 214 In either case, the stateChanged() signal may be emitted either synchronously 215 during execution of the start() function or asynchronously after start() has 216 returned to the caller. 217 218 \sa {Symbian Platform Security Requirements} 214 \l{QAudioInput#Symbian Platform Security Requirements} 219 215 220 216 \sa QIODevice … … 238 234 state() is set to QAudio::StoppedState and stateChanged() signal is emitted. 239 235 240 In either case, the stateChanged() signal may be emitted either synchronously 241 during execution of the start() function or asynchronously after start() has 242 returned to the caller. 243 244 \sa {Symbian Platform Security Requirements} 236 \l{QAudioInput#Symbian Platform Security Requirements} 245 237 246 238 \sa QIODevice … … 287 279 Sets error() to QAudio::NoError, state() to QAudio::SuspendedState and 288 280 emit stateChanged() signal. 289 290 Note: signal will always be emitted during execution of the resume() function.291 281 */ 292 282 … … 311 301 312 302 /*! 313 Sets the audio buffer size to \a value bytes.303 Sets the audio buffer size to \a value s. 314 304 315 305 Note: This function can be called anytime before start(), calls to this … … 326 316 327 317 /*! 328 Returns the audio buffer size in bytes.318 Returns the audio buffer size in s. 329 319 330 320 If called before start(), returns platform default value. -
trunk/src/multimedia/audio/qaudioinput.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/multimedia/audio/qaudioinput_alsa_p.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 121 121 reset = true; 122 122 else { 123 bytesAvailable = bytesReady();123 bytesAvailable = ytesReady(); 124 124 if (bytesAvailable <= 0) 125 125 reset = true; … … 153 153 int QAudioInputPrivate::setFormat() 154 154 { 155 snd_pcm_format_t format = SND_PCM_FORMAT_ S16;155 snd_pcm_format_t format = SND_PCM_FORMAT_; 156 156 157 157 if(settings.sampleSize() == 8) { … … 205 205 } 206 206 207 return snd_pcm_hw_params_set_format( handle, hwparams, format); 207 return format != SND_PCM_FORMAT_UNKNOWN 208 ? snd_pcm_hw_params_set_format( handle, hwparams, format) 209 : -1; 208 210 } 209 211 … … 260 262 261 263 int dir; 262 int err =-1;264 int err; 263 265 int count=0; 264 266 unsigned int freakuency=settings.frequency(); 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 265 283 266 284 QString dev = QString(QLatin1String(m_device.constData())); … … 409 427 410 428 // Step 5: Setup timer 411 bytesAvailable = bytesReady();429 bytesAvailable = ytesReady(); 412 430 413 431 if(pullMode) … … 438 456 } 439 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 440 478 int QAudioInputPrivate::bytesReady() const 441 479 { 442 if(resuming) 443 return period_size; 444 445 if(deviceState != QAudio::ActiveState && deviceState != QAudio::IdleState) 446 return 0; 447 int frames = snd_pcm_avail_update(handle); 448 if (frames < 0) return frames; 449 if((int)frames > (int)buffer_frames) 450 frames = buffer_frames; 451 452 return snd_pcm_frames_to_bytes(handle, frames); 480 return qMax(bytesAvailable, 0); 453 481 } 454 482 455 483 qint64 QAudioInputPrivate::read(char* data, qint64 len) 456 484 { 457 Q_UNUSED(len)458 459 485 // Read in some audio data and write it to QIODevice, pull mode 460 486 if ( !handle ) 461 487 return 0; 462 488 463 bytesAvailable = bytesReady(); 464 465 if (bytesAvailable < 0) { 489 // bytesAvaiable is saved as a side effect of checkBytesReady(). 490 int bytesToRead = checkBytesReady(); 491 492 if (bytesToRead < 0) { 466 493 // bytesAvailable as negative is error code, try to recover from it. 467 xrun_recovery(bytes Available);468 bytes Available = bytesReady();469 if (bytes Available< 0) {494 xrun_recovery(bytes); 495 bytesytesReady(); 496 if (bytes < 0) { 470 497 // recovery failed must stop and set error. 471 498 close(); … … 477 504 } 478 505 506 507 479 508 int count=0, err = 0; 480 509 while(count < 5) { 481 int chunks = bytes Available/period_size;510 int chunks = bytes/period_size; 482 511 int frames = chunks*period_frames; 483 512 if(frames > (int)buffer_frames) … … 527 556 } 528 557 } else { 558 529 559 totalTimeValue += err; 530 560 resuming = false; … … 539 569 } else { 540 570 memcpy(data,audioBuffer,err); 571 541 572 totalTimeValue += err; 542 573 resuming = false; … … 634 665 if(pullMode) { 635 666 // reads some audio data and writes it to QIODevice 636 read(0, 0);667 read(0,); 637 668 } else { 638 669 // emits readyRead() so user will call read() on QIODevice to get some audio data … … 640 671 a->trigger(); 641 672 } 642 bytesAvailable = bytesReady();673 bytesAvailable = ytesReady(); 643 674 644 675 if(deviceState != QAudio::ActiveState) 645 676 return true; 677 678 679 680 681 682 683 684 685 686 687 688 689 690 646 691 647 692 if(intervalTime && (timeStamp.elapsed() + elapsedTimeOffset) > intervalTime) { -
trunk/src/multimedia/audio/qaudioinput_alsa_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 62 62 #include <QtCore/qstring.h> 63 63 #include <QtCore/qstringlist.h> 64 64 65 #include <QtCore/qdatetime.h> 65 66 … … 110 111 111 112 private: 113 112 114 int xrun_recovery(int err); 113 115 int setFormat(); … … 117 119 118 120 QTimer* timer; 119 Q TimetimeStamp;120 Q TimeclockStamp;121 Q timeStamp; 122 Q clockStamp; 121 123 qint64 elapsedTimeOffset; 122 124 int intervalTime; -
trunk/src/multimedia/audio/qaudioinput_mac_p.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 211 211 } 212 212 213 214 215 216 217 213 218 private: 214 219 UInt32 totalPackets; … … 260 265 UInt32 inNumberFrames) 261 266 { 262 const bool wasEmpty = m_buffer->used()== 0;267 const bool == 0; 263 268 264 269 OSStatus err; … … 276 281 QAudioPacketFeeder feeder(m_inputBufferList); 277 282 278 bool wecan = true;279 283 int copied = 0; 280 281 284 const int available = m_buffer->free(); 282 285 283 while (err == noErr && wecan) {286 while (err == noErr && ) { 284 287 QAudioRingBuffer::Region region = m_buffer->acquireWriteRegion(available); 285 288 286 if (region.second > 0) { 287 AudioBufferList output; 288 output.mNumberBuffers = 1; 289 output.mBuffers[0].mNumberChannels = 1; 290 output.mBuffers[0].mDataByteSize = region.second; 291 output.mBuffers[0].mData = region.first; 292 293 UInt32 packetSize = region.second / m_outputFormat.mBytesPerPacket; 294 err = AudioConverterFillComplexBuffer(m_audioConverter, 295 converterCallback, 296 &feeder, 297 &packetSize, 298 &output, 299 0); 300 301 region.second = output.mBuffers[0].mDataByteSize; 302 copied += region.second; 303 304 m_buffer->releaseWriteRegion(region); 305 } 306 else 307 wecan = false; 289 if (region.second == 0) 290 break; 291 292 AudioBufferList output; 293 output.mNumberBuffers = 1; 294 output.mBuffers[0].mNumberChannels = 1; 295 output.mBuffers[0].mDataByteSize = region.second; 296 output.mBuffers[0].mData = region.first; 297 298 UInt32 packetSize = region.second / m_outputFormat.mBytesPerPacket; 299 err = AudioConverterFillComplexBuffer(m_audioConverter, 300 converterCallback, 301 &feeder, 302 &packetSize, 303 &output, 304 0); 305 region.second = output.mBuffers[0].mDataByteSize; 306 copied += region.second; 307 308 m_buffer->releaseWriteRegion(region); 308 309 } 309 310 … … 331 332 } 332 333 333 if ( wasEmpty&& framesRendered > 0)334 if ( && framesRendered > 0) 334 335 emit readyRead(); 335 336 … … 717 718 QIODevice* op = device; 718 719 719 if (!audio Format.isValid() || !open()) {720 if (!audio) || !open()) { 720 721 stateCode = QAudio::StoppedState; 721 722 errorCode = QAudio::OpenError; -
trunk/src/multimedia/audio/qaudioinput_mac_p.h
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/multimedia/audio/qaudioinput_symbian_p.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 175 175 m_notifyTimer->stop(); 176 176 m_pullTimer->stop(); 177 m_devSound->pause();178 177 const qint64 samplesRecorded = getSamplesRecorded(); 179 178 m_totalSamplesRecorded += samplesRecorded; 180 179 181 if (m_devSoundBuffer) { 182 m_devSoundBufferQ.append(m_devSoundBuffer); 180 const bool paused = m_devSound->pause(); 181 if (paused) { 182 if (m_devSoundBuffer) 183 m_devSoundBufferQ.append(m_devSoundBuffer); 183 184 m_devSoundBuffer = 0; 185 186 187 188 189 190 184 191 } 185 186 setState(SymbianAudio::SuspendedState);187 192 } 188 193 } … … 190 195 void QAudioInputPrivate::resume() 191 196 { 192 if (SymbianAudio::SuspendedState == m_internalState) { 193 if (!m_pullMode && !bytesReady()) 197 if (QAudio::SuspendedState == m_externalState) { 198 if (SymbianAudio::SuspendedPausedState == m_internalState) 199 m_devSound->resume(); 200 else 194 201 m_devSound->start(); 195 202 startDataTransfer(); … … 247 254 { 248 255 int samplesPlayed = 0; 249 if (m_devSound && SymbianAudio::SuspendedState != m_internalState)256 if (m_devSound && ternalState) 250 257 samplesPlayed = getSamplesRecorded(); 251 258 … … 336 343 pushData(); 337 344 } else { 338 if ( SymbianAudio::SuspendedState == m_internalState)345 if (ternalState) 339 346 setState(SymbianAudio::ActiveState); 340 347 else … … 374 381 TDesC8 &inputBuffer = buffer->Data(); 375 382 376 const qint64 inputBytes = bytesReady(); 383 Q_ASSERT(inputBuffer.Length() >= m_devSoundBufferPos); 384 const qint64 inputBytes = inputBuffer.Length() - m_devSoundBufferPos; 377 385 const qint64 outputBytes = len - bytesRead; 378 386 const qint64 copyBytes = outputBytes < inputBytes ? … … 385 393 bytesRead += copyBytes; 386 394 387 if ( !bytesReady())395 if () 388 396 bufferEmptied(); 389 397 } … … 404 412 TDesC8 &inputBuffer = buffer->Data(); 405 413 406 const qint64 inputBytes = bytesReady(); 414 Q_ASSERT(inputBuffer.Length() >= m_devSoundBufferPos); 415 const qint64 inputBytes = inputBuffer.Length() - m_devSoundBufferPos; 407 416 const qint64 bytesPushed = m_sink->write( 408 417 (char*)inputBuffer.Ptr() + m_devSoundBufferPos, inputBytes); … … 410 419 m_devSoundBufferPos += bytesPushed; 411 420 412 if ( !bytesReady())421 if () 413 422 bufferEmptied(); 414 423 … … 442 451 m_totalBytesReady += buffer->Data().Length(); 443 452 444 if (SymbianAudio::Suspended State == m_internalState) {453 if (SymbianAudio::SuspendedState == m_internalState) { 445 454 m_devSoundBufferQ.append(buffer); 446 455 } else { -
trunk/src/multimedia/audio/qaudioinput_symbian_p.h
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/multimedia/audio/qaudioinput_win32_p.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 80 80 } 81 81 82 void CALLBACK QAudioInputPrivate::waveInProc( HWAVEIN hWaveIn, UINT uMsg,82 void CALLBACK QAudioInputPrivate::waveInProc( HWAVEIN hWaveIn, UINT uMsg, 83 83 DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 ) 84 84 { … … 149 149 for(int i = 0; i < count; i++) { 150 150 waveInUnprepareHeader(hWaveIn,blocks, sizeof(WAVEHDR)); 151 blocks+ =sizeof(WAVEHDR);151 blocks+; 152 152 } 153 153 HeapFree(GetProcessHeap(), 0, blockArray); … … 215 215 #endif 216 216 header = 0; 217 if(buffer_size == 0) { 218 // Default buffer size, 200ms, default period size is 40ms 219 buffer_size = settings.frequency()*settings.channels()*(settings.sampleSize()/8)*0.2; 220 period_size = buffer_size/5; 217 period_size = 0; 218 219 if (!settings.isValid()) { 220 qWarning("QAudioInput: open error, invalid format."); 221 } else if (settings.channels() <= 0) { 222 qWarning("QAudioInput: open error, invalid number of channels (%d).", 223 settings.channels()); 224 } else if (settings.sampleSize() <= 0) { 225 qWarning("QAudioInput: open error, invalid sample size (%d).", 226 settings.sampleSize()); 227 } else if (settings.frequency() < 8000 || settings.frequency() > 48000) { 228 qWarning("QAudioInput: open error, frequency out of range (%d).", settings.frequency()); 229 } else if (buffer_size == 0) { 230 231 buffer_size 232 = (settings.frequency() 233 * settings.channels() 234 * settings.sampleSize() 235 #ifndef Q_OS_WINCE // Default buffer size, 200ms, default period size is 40ms 236 + 39) / 40; 237 period_size = buffer_size / 5; 221 238 } else { 222 period_size = buffer_size/5; 223 } 239 period_size = buffer_size / 5; 240 #else // For wince reduce size to 40ms for buffer size and 20ms period 241 + 199) / 200; 242 period_size = buffer_size / 2; 243 } else { 244 period_size = buffer_size / 2; 245 #endif 246 } 247 248 if (period_size == 0) { 249 errorState = QAudio::OpenError; 250 deviceState = QAudio::StoppedState; 251 emit stateChanged(deviceState); 252 return false; 253 } 254 224 255 timeStamp.restart(); 225 256 elapsedTimeOffset = 0; … … 242 273 == MMSYSERR_NOERROR) { 243 274 QString tmp; 244 tmp = QString ::fromUtf16((const unsigned short*)wic.szPname);275 tmp = QString*)wic.szPname); 245 276 if(tmp.compare(QLatin1String(m_device)) == 0) { 246 277 devId = ii; … … 370 401 } 371 402 } else { 403 372 404 // push mode 373 memcpy(p,waveBlocks[header].lpData,waveBlocks[header].dwBytesRecorded); 374 l = waveBlocks[header].dwBytesRecorded; 405 memcpy(p, waveBlocks[header].lpData, l); 406 407 len -= l; 408 375 409 #ifdef DEBUG_AUDIO 376 410 qDebug()<<"IN: "<<waveBlocks[header].dwBytesRecorded<<", OUT: "<<l; … … 427 461 mutex.lock(); 428 462 if(!pullMode) { 429 if(l+period_size > len &&waveFreeBlockCount == buffer_size/period_size)463 waveFreeBlockCount == buffer_size/period_size) 430 464 done = true; 431 465 } else { … … 538 572 if(pullMode) { 539 573 // reads some audio data and writes it to QIODevice 540 read(0, 0);574 read(0,); 541 575 } else { 542 576 // emits readyRead() so user will call read() on QIODevice to get some audio data -
trunk/src/multimedia/audio/qaudioinput_win32_p.h
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 125 125 126 126 QMutex mutex; 127 128 static void CALLBACK waveInProc( HWAVEIN hWaveIn, UINT uMsg, 127 static void QT_WIN_CALLBACK waveInProc( HWAVEIN hWaveIn, UINT uMsg, 129 128 DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 ); 130 129 -
trunk/src/multimedia/audio/qaudiooutput.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 200 200 /*! 201 201 Uses the \a device as the QIODevice to transfer data. 202 Passing a QIODevice allows the data to be transfer ed without any extra code.202 Passing a QIODevice allows the data to be transfered without any extra code. 203 203 All that is required is to open the QIODevice. 204 204 -
trunk/src/multimedia/audio/qaudiooutput.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/multimedia/audio/qaudiooutput_alsa_p.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 156 156 int QAudioOutputPrivate::setFormat() 157 157 { 158 snd_pcm_format_t pcmformat = SND_PCM_FORMAT_ S16;158 snd_pcm_format_t pcmformat = SND_PCM_FORMAT_; 159 159 160 160 if(settings.sampleSize() == 8) { … … 209 209 } 210 210 211 return snd_pcm_hw_params_set_format( handle, hwparams, pcmformat); 211 return pcmformat != SND_PCM_FORMAT_UNKNOWN 212 ? snd_pcm_hw_params_set_format( handle, hwparams, pcmformat) 213 : -1; 212 214 } 213 215 … … 276 278 277 279 int dir; 278 int err =-1;280 int err; 279 281 int count=0; 280 282 unsigned int freakuency=settings.frequency(); 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 281 298 282 299 QString dev = QString(QLatin1String(m_device.constData())); -
trunk/src/multimedia/audio/qaudiooutput_alsa_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 61 61 #include <QtCore/qstring.h> 62 62 #include <QtCore/qstringlist.h> 63 63 64 #include <QtCore/qdatetime.h> 64 65 … … 134 135 QByteArray m_device; 135 136 int bytesAvailable; 136 Q TimetimeStamp;137 Q TimeclockStamp;137 Q timeStamp; 138 Q clockStamp; 138 139 qint64 elapsedTimeOffset; 139 140 char* audioBuffer; -
trunk/src/multimedia/audio/qaudiooutput_mac_p.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 61 61 #include <QtCore/qdebug.h> 62 62 63 #include <QtMultimedia/qaudiodeviceinfo.h>64 63 #include <QtMultimedia/qaudiooutput.h> 65 64 66 65 #include "qaudio_mac_p.h" 67 66 #include "qaudiooutput_mac_p.h" 67 68 68 69 69 … … 279 279 errorCode = QAudio::OpenError; 280 280 else { 281 281 282 isOpen = false; 282 283 audioDeviceId = AudioDeviceID(did); … … 300 301 QAudioOutputPrivate::~QAudioOutputPrivate() 301 302 { 303 302 304 close(); 303 305 } … … 359 361 streamFormat = toAudioStreamBasicDescription(audioFormat); 360 362 361 UInt32 size = sizeof(deviceFormat); 362 if (AudioUnitGetProperty(audioUnit, 363 kAudioUnitProperty_StreamFormat, 364 kAudioUnitScope_Input, 365 0, 366 &deviceFormat, 367 &size) != noErr) { 368 qWarning() << "QAudioOutput: Unable to retrieve device format"; 369 return false; 370 } 371 363 UInt32 size = sizeof(streamFormat); 372 364 if (AudioUnitSetProperty(audioUnit, 373 365 kAudioUnitProperty_StreamFormat, … … 393 385 } 394 386 395 periodSizeBytes = (numberOfFrames * streamFormat.mSampleRate / deviceFormat.mSampleRate) * 396 streamFormat.mBytesPerFrame; 387 periodSizeBytes = numberOfFrames * streamFormat.mBytesPerFrame; 397 388 if (internalBufferSize < periodSizeBytes * 2) 398 389 internalBufferSize = periodSizeBytes * 2; … … 436 427 QIODevice* op = device; 437 428 438 if (!audio Format.isValid() || !open()) {429 if (!audio) || !open()) { 439 430 stateCode = QAudio::StoppedState; 440 431 errorCode = QAudio::OpenError; -
trunk/src/multimedia/audio/qaudiooutput_mac_p.h
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 74 74 75 75 class QIODevice; 76 76 77 77 78 namespace QtMultimediaInternal … … 102 103 QMutex mutex; 103 104 QTimer* intervalTimer; 105 104 106 105 107 QAudio::Error errorCode; -
trunk/src/multimedia/audio/qaudiooutput_symbian_p.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 181 181 m_notifyTimer->stop(); 182 182 m_underflowTimer->stop(); 183 184 183 const qint64 samplesWritten = SymbianAudio::Utils::bytesToSamples( 185 184 m_format, m_bytesWritten); 186 187 185 const qint64 samplesPlayed = getSamplesPlayed(); 188 186 m_totalSamplesPlayed += samplesPlayed; 189 187 m_bytesWritten = 0; 190 191 // CMMFDevSound::Pause() is not guaranteed to work correctly in all 192 // implementations, for play-mode DevSound sessions. We therefore 193 // have to implement suspend() by calling CMMFDevSound::Stop(). 194 // Because this causes buffered data to be dropped, we replace the 195 // lost data with silence following a call to resume(), in order to 196 // ensure that processedUSecs() returns the correct value. 197 m_devSound->stop(); 198 m_totalSamplesPlayed += samplesPlayed; 199 200 // Calculate the amount of data dropped 201 const qint64 paddingSamples = samplesWritten - samplesPlayed; 202 Q_ASSERT(paddingSamples >= 0); 203 m_bytesPadding = SymbianAudio::Utils::samplesToBytes(m_format, 204 paddingSamples); 205 206 setState(SymbianAudio::SuspendedState); 188 const bool paused = m_devSound->pause(); 189 if (paused) { 190 setState(SymbianAudio::SuspendedPausedState); 191 } else { 192 m_devSoundBuffer = 0; 193 // Calculate the amount of data dropped 194 const qint64 paddingSamples = samplesWritten - samplesPlayed; 195 Q_ASSERT(paddingSamples >= 0); 196 m_bytesPadding = SymbianAudio::Utils::samplesToBytes(m_format, 197 paddingSamples); 198 setState(SymbianAudio::SuspendedStoppedState); 199 } 207 200 } 208 201 } … … 210 203 void QAudioOutputPrivate::resume() 211 204 { 212 if (SymbianAudio::SuspendedState == m_internalState) { 213 if (!m_pullMode && m_devSoundBuffer && m_devSoundBuffer->Data().Length()) 214 bufferFilled(); 215 startPlayback(); 205 if (QAudio::SuspendedState == m_externalState) { 206 if (SymbianAudio::SuspendedPausedState == m_internalState) 207 m_devSound->resume(); 208 else 209 startPlayback(); 216 210 } 217 211 } … … 271 265 { 272 266 int samplesPlayed = 0; 273 if (m_devSound && SymbianAudio::SuspendedState != m_internalState)267 if (m_devSound && ternalState) 274 268 samplesPlayed = getSamplesPlayed(); 275 269 … … 371 365 else 372 366 setState(SymbianAudio::IdleState); 367 368 369 373 370 break; 374 371 default: -
trunk/src/multimedia/audio/qaudiooutput_symbian_p.h
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/multimedia/audio/qaudiooutput_win32_p.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 53 53 #include "qaudiooutput_win32_p.h" 54 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 55 102 //#define DEBUG_AUDIO 1 56 103 … … 147 194 for(int i = 0; i < count; i++) { 148 195 waveOutUnprepareHeader(hWaveOut,blocks, sizeof(WAVEHDR)); 149 blocks+ =sizeof(WAVEHDR);196 blocks+; 150 197 } 151 198 HeapFree(GetProcessHeap(), 0, blockArray); … … 205 252 qDebug()<<now.second()<<"s "<<now.msec()<<"ms :open()"; 206 253 #endif 207 if (!(settings.frequency() >= 8000 && settings.frequency() <= 48000)) { 254 255 period_size = 0; 256 257 if (!settings.isValid()) { 258 qWarning("QAudioOutput: open error, invalid format."); 259 } else if (settings.channels() <= 0) { 260 qWarning("QAudioOutput: open error, invalid number of channels (%d).", 261 settings.channels()); 262 } else if (settings.sampleSize() <= 0) { 263 qWarning("QAudioOutput: open error, invalid sample size (%d).", 264 settings.sampleSize()); 265 } else if (settings.frequency() < 8000 || settings.frequency() > 48000) { 266 qWarning("QAudioOutput: open error, frequency out of range (%d).", settings.frequency()); 267 } else if (buffer_size == 0) { 268 // Default buffer size, 200ms, default period size is 40ms 269 buffer_size 270 = (settings.frequency() 271 * settings.channels() 272 * settings.sampleSize() 273 + 39) / 40; 274 period_size = buffer_size / 5; 275 } else { 276 period_size = buffer_size / 5; 277 } 278 279 if (period_size == 0) { 208 280 errorState = QAudio::OpenError; 209 281 deviceState = QAudio::StoppedState; 210 282 emit stateChanged(deviceState); 211 qWarning("QAudioOutput: open error, frequency out of range.");212 283 return false; 213 284 } 214 if(buffer_size == 0) { 215 // Default buffer size, 200ms, default period size is 40ms 216 buffer_size = settings.frequency()*settings.channels()*(settings.sampleSize()/8)*0.2; 217 period_size = buffer_size/5; 218 } else { 219 period_size = buffer_size/5; 220 } 285 221 286 waveBlocks = allocateBlocks(period_size, buffer_size/period_size); 222 287 … … 251 316 == MMSYSERR_NOERROR) { 252 317 QString tmp; 253 tmp = QString ::fromUtf16((const unsigned short*)woc.szPname);318 tmp = QString*)woc.szPname); 254 319 if(tmp.compare(QLatin1String(m_device)) == 0) { 255 320 devId = ii; … … 259 324 } 260 325 261 if(waveOutOpen(&hWaveOut, devId, &wfx, 262 (DWORD_PTR)&waveOutProc, 263 (DWORD_PTR) this, 264 CALLBACK_FUNCTION) != MMSYSERR_NOERROR) { 265 errorState = QAudio::OpenError; 266 deviceState = QAudio::StoppedState; 267 emit stateChanged(deviceState); 268 qWarning("QAudioOutput: open error"); 269 return false; 326 if ( settings.channels() <= 2) { 327 if(waveOutOpen(&hWaveOut, devId, &wfx, 328 (DWORD_PTR)&waveOutProc, 329 (DWORD_PTR) this, 330 CALLBACK_FUNCTION) != MMSYSERR_NOERROR) { 331 errorState = QAudio::OpenError; 332 deviceState = QAudio::StoppedState; 333 emit stateChanged(deviceState); 334 qWarning("QAudioOutput: open error"); 335 return false; 336 } 337 } else { 338 WAVEFORMATEXTENSIBLE wfex; 339 wfex.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; 340 wfex.Format.nChannels = settings.channels(); 341 wfex.Format.wBitsPerSample = settings.sampleSize(); 342 wfex.Format.nSamplesPerSec = settings.frequency(); 343 wfex.Format.nBlockAlign = wfex.Format.nChannels*wfex.Format.wBitsPerSample/8; 344 wfex.Format.nAvgBytesPerSec=wfex.Format.nSamplesPerSec*wfex.Format.nBlockAlign; 345 wfex.Samples.wValidBitsPerSample=wfex.Format.wBitsPerSample; 346 static const GUID _KSDATAFORMAT_SUBTYPE_PCM = { 347 0x00000001, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; 348 wfex.SubFormat=_KSDATAFORMAT_SUBTYPE_PCM; 349 wfex.Format.cbSize=22; 350 351 wfex.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT; 352 if (settings.channels() >= 4) 353 wfex.dwChannelMask |= SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT; 354 if (settings.channels() >= 6) 355 wfex.dwChannelMask |= SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY; 356 if (settings.channels() == 8) 357 wfex.dwChannelMask |= SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT; 358 359 if(waveOutOpen(&hWaveOut, devId, &wfex.Format, 360 (DWORD_PTR)&waveOutProc, 361 (DWORD_PTR) this, 362 CALLBACK_FUNCTION) != MMSYSERR_NOERROR) { 363 errorState = QAudio::OpenError; 364 deviceState = QAudio::StoppedState; 365 emit stateChanged(deviceState); 366 qWarning("QAudioOutput: open error"); 367 return false; 368 } 270 369 } 271 370 … … 488 587 } 489 588 if ( out < l) { 490 // Didn t write all data589 // Didnt write all data 491 590 audioSource->seek(audioSource->pos()-(l-out)); 492 591 } -
trunk/src/multimedia/audio/qaudiooutput_win32_p.h
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 118 118 bool pullMode; 119 119 int intervalTime; 120 static void CALLBACK waveOutProc( HWAVEOUT hWaveOut, UINT uMsg,120 static void CALLBACK waveOutProc( HWAVEOUT hWaveOut, UINT uMsg, 121 121 DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 ); 122 122 -
trunk/src/multimedia/multimedia.pro
r561 r846 12 12 include(video/video.pri) 13 13 14 symbian: TARGET.UID3 = 0x2001E627 14 symbian: { 15 TARGET.UID3 = 0x2001E627 16 } -
trunk/src/multimedia/video/qabstractvideobuffer.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 72 72 \value NoHandle The buffer has no handle, its data can only be accessed by mapping the buffer. 73 73 \value GLTextureHandle The handle of the buffer is an OpenGL texture ID. 74 75 76 74 77 \value UserHandle Start value for user defined handle types. 75 78 … … 85 88 \value ReadOnly The mapped memory is populated with data from the video buffer when mapped, but 86 89 the content of the mapped memory may be discarded when unmapped. 87 \value WriteOnly The mapped memory i n unitialized when mapped, and the content will be used to90 \value WriteOnly The mapped memory initialized when mapped, and the content will be used to 88 91 populate the video buffer when unmapped. 89 92 \value ReadWrite The mapped memory is populated with data from the video buffer, and the -
trunk/src/multimedia/video/qabstractvideobuffer.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 62 62 NoHandle, 63 63 GLTextureHandle, 64 65 66 64 67 UserHandle = 1000 65 68 }; -
trunk/src/multimedia/video/qabstractvideobuffer_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 66 66 {} 67 67 68 69 70 68 71 QAbstractVideoBuffer::HandleType handleType; 69 72 }; -
trunk/src/multimedia/video/qabstractvideosurface.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/multimedia/video/qabstractvideosurface.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/multimedia/video/qabstractvideosurface_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/multimedia/video/qimagevideobuffer.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/multimedia/video/qimagevideobuffer_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/multimedia/video/qmemoryvideobuffer.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/multimedia/video/qmemoryvideobuffer_p.h
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/multimedia/video/qvideoframe.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (