qtmobility/plugins/multimedia/symbian/mmf/audiosource/s60audiocapturesession.cpp
changeset 5 453da2cfceef
parent 4 90517678cc4f
child 11 06b8e2af4411
equal deleted inserted replaced
4:90517678cc4f 5:453da2cfceef
    60     QObject(parent)
    60     QObject(parent)
    61     , m_recorderUtility(NULL)    
    61     , m_recorderUtility(NULL)    
    62     , m_captureState(ENotInitialized)    
    62     , m_captureState(ENotInitialized)    
    63     , m_controllerIdMap(QHash<QString, ControllerData>())    
    63     , m_controllerIdMap(QHash<QString, ControllerData>())    
    64     , m_audioCodeclist(QHash<QString, CodecData>())    
    64     , m_audioCodeclist(QHash<QString, CodecData>())    
       
    65     , m_error(QMediaRecorder::NoError) 
    65 {
    66 {
    66     TRAPD(err, initializeSessionL());
    67     TRAPD(err, initializeSessionL());
    67     qWarning()<<err;
    68     setError(err);
    68 }
    69 }
    69 
    70 
    70 void S60AudioCaptureSession::initializeSessionL()
    71 void S60AudioCaptureSession::initializeSessionL()
    71 {    
    72 {    
    72     m_recorderUtility = CMdaAudioRecorderUtility::NewL(*this, 0, 80,(TMdaPriorityPreference) 0x5210001);        
    73     m_recorderUtility = CMdaAudioRecorderUtility::NewL(*this, 0, 80,(TMdaPriorityPreference) 0x5210001);        
    73     updateAudioContainersL();    
    74     updateAudioContainersL();    
    74     populateAudioCodecsDataL();
    75     populateAudioCodecsDataL();
    75     setDefaultSettings();
    76     setDefaultSettings();
    76 }
    77 }
    77 
    78 
       
    79 void S60AudioCaptureSession::setError(TInt aError)
       
    80 {
       
    81     if (aError == KErrNone)
       
    82         return;
       
    83         
       
    84     m_error = aError;
       
    85     QMediaRecorder::Error recorderError = fromSymbianErrorToMultimediaError(m_error);
       
    86     
       
    87     // TODO: fix to user friendly string at some point
       
    88     // These error string are only dev usable
       
    89     QString symbianError; 
       
    90     symbianError.append("Symbian:");
       
    91     symbianError.append(QString::number(m_error));
       
    92     emit error(recorderError, symbianError);
       
    93 }
       
    94 
       
    95 QMediaRecorder::Error S60AudioCaptureSession::fromSymbianErrorToMultimediaError(int error)
       
    96 {
       
    97     switch(error) {
       
    98     case KErrNoMemory:
       
    99     case KErrNotFound:
       
   100     case KErrBadHandle:
       
   101     case KErrAbort:    
       
   102     case KErrCorrupt:
       
   103     case KErrGeneral:    
       
   104     case KErrPathNotFound:        
       
   105     case KErrUnknown:
       
   106     case KErrNotReady:
       
   107     case KErrInUse:
       
   108     case KErrAccessDenied:
       
   109     case KErrLocked:
       
   110     case KErrPermissionDenied:
       
   111     case KErrAlreadyExists:        
       
   112         return QMediaRecorder::ResourceError;    
       
   113     case KErrNotSupported:   
       
   114     case KErrArgument:        
       
   115         return QMediaRecorder::FormatError;   
       
   116     case KErrNone:
       
   117     default:
       
   118         return QMediaRecorder::NoError;
       
   119     }
       
   120 }
       
   121 
    78 S60AudioCaptureSession::~S60AudioCaptureSession()
   122 S60AudioCaptureSession::~S60AudioCaptureSession()
    79 {       
   123 {       
    80     delete m_recorderUtility;    
   124     delete m_recorderUtility;    
    81 }
   125 }
    82 
   126 
    90     m_format = format;
   134     m_format = format;
    91     return true;
   135     return true;
    92 }
   136 }
    93 
   137 
    94 QStringList S60AudioCaptureSession::supportedAudioCodecs() const
   138 QStringList S60AudioCaptureSession::supportedAudioCodecs() const
    95 {    
   139 {   
    96 	return m_audioCodeclist.keys();
   140     return m_audioCodeclist.keys();    
    97 }
   141 }
    98 
   142 
    99 QStringList S60AudioCaptureSession::supportedAudioContainers() const
   143 QStringList S60AudioCaptureSession::supportedAudioContainers() const
   100 {
   144 {
   101     return m_controllerIdMap.keys();
   145     return m_controllerIdMap.keys();
   102 }
   146 }
   103 
   147 
   104 QString S60AudioCaptureSession::codecDescription(const QString &codecName)
   148 QString S60AudioCaptureSession::codecDescription(const QString &codecName)
   105 {
   149 {
   106     if (m_audioCodeclist.keys().contains(codecName))
   150     if (m_audioCodeclist.keys().contains(codecName))
   107         return m_audioCodeclist[codecName].codecDescription;
   151         return m_audioCodeclist.value(codecName).codecDescription;
   108     else
   152     else
   109         return QString();
   153         return QString();
   110 }
   154 }
   111 
   155 
   112 QString S60AudioCaptureSession::audioContainerDescription(const QString &containerName)
   156 QString S60AudioCaptureSession::audioContainerDescription(const QString &containerName)
   113 {   
   157 {   
   114     if (m_controllerIdMap.keys().contains(containerName))
   158     if (m_controllerIdMap.keys().contains(containerName))
   115         return m_controllerIdMap[containerName].destinationFormatDescription;
   159         return m_controllerIdMap.value(containerName).destinationFormatDescription;
   116     else
   160     else
   117         return QString();
   161         return QString();
   118 }
   162 }
   119 
   163 
   120 bool S60AudioCaptureSession::setAudioCodec(const QString &codecName)
   164 bool S60AudioCaptureSession::setAudioCodec(const QString &codecName)
   157     QString filename = QDir::toNativeSeparators(m_sink.toString());
   201     QString filename = QDir::toNativeSeparators(m_sink.toString());
   158     TPtrC16 path(reinterpret_cast<const TUint16*>(filename.utf16()));         
   202     TPtrC16 path(reinterpret_cast<const TUint16*>(filename.utf16()));         
   159     TRAPD(err, BaflUtils::EnsurePathExistsL(CCoeEnv::Static()->FsSession(),path));
   203     TRAPD(err, BaflUtils::EnsurePathExistsL(CCoeEnv::Static()->FsSession(),path));
   160     if (err==KErrNone) {
   204     if (err==KErrNone) {
   161         m_sink = sink;
   205         m_sink = sink;
       
   206         setError(err);
   162         return true;
   207         return true;
   163     }else 
   208     }else {
   164         return false;    
   209         setError(err);
       
   210         return false;
       
   211     }
   165 }
   212 }
   166 
   213 
   167 qint64 S60AudioCaptureSession::position() const
   214 qint64 S60AudioCaptureSession::position() const
   168 {    
   215 {    
   169     if ((m_captureState != ERecording) || !m_recorderUtility) 
   216     if ((m_captureState != ERecording) || !m_recorderUtility) 
   170         return 0;
   217         return 0;
   171         
   218         
   172     return m_recorderUtility->Duration().Int64() / 1000;        
   219     return m_recorderUtility->Duration().Int64() / 1000;        
   173 }
   220 }
   174 
   221 
       
   222 QString S60AudioCaptureSession::initializeSinkL()
       
   223 {    
       
   224     QString sink = QDir::toNativeSeparators(m_sink.toString());    
       
   225     int index = sink.lastIndexOf('.');
       
   226     if (index != -1)
       
   227         sink.chop(sink.length()-index);
       
   228     
       
   229     sink.append(m_controllerIdMap.value(m_container).fileExtension);    
       
   230     return sink;    
       
   231 }
       
   232 
   175 void S60AudioCaptureSession::record()
   233 void S60AudioCaptureSession::record()
   176 {   
   234 {   
   177     if (!m_recorderUtility)
   235     if (!m_recorderUtility)
   178         return;
   236         return;
   179     
   237     
   180     if (m_captureState == EInitialized || m_captureState == ERecordComplete) {
   238     if (m_captureState == EInitialized || m_captureState == ERecordComplete) {
   181         QString filename = QDir::toNativeSeparators(m_sink.toString());        
   239         QString filename = initializeSinkL();
   182         TPtrC16 sink(reinterpret_cast<const TUint16*>(filename.utf16()));         
   240         TPtrC16 sink(reinterpret_cast<const TUint16*>(filename.utf16()));        
   183         TUid controllerUid(TUid::Uid(m_controllerIdMap[m_container].controllerUid));
   241         TUid controllerUid(TUid::Uid(m_controllerIdMap.value(m_container).controllerUid));
   184         TUid formatUid(TUid::Uid(m_controllerIdMap[m_container].destinationFormatUid));
   242         TUid formatUid(TUid::Uid(m_controllerIdMap.value(m_container).destinationFormatUid));        
   185                 
       
   186         TRAPD(err, 
   243         TRAPD(err, 
   187         if (m_container != "audio/amr")   
   244         if (m_container != "audio/amr")   
   188             m_recorderUtility->OpenFileL(sink, controllerUid, KNullUid, formatUid);
   245             m_recorderUtility->OpenFileL(sink, controllerUid, KNullUid, formatUid);
   189         else   
   246         else   
   190             m_recorderUtility->OpenFileL(sink);
   247             m_recorderUtility->OpenFileL(sink);
   191         );       
   248         );       
   192         qWarning() << err;
   249         setError(err);
   193     }else if (m_captureState == EPaused) {        
   250     }else if (m_captureState == EPaused) {        
   194         m_recorderUtility->SetPosition(m_pausedPosition);
   251         m_recorderUtility->SetPosition(m_pausedPosition);
   195         TRAPD(error, m_recorderUtility->RecordL());
   252         TRAPD(error, m_recorderUtility->RecordL());
   196         qWarning() << error;
   253         setError(error);
   197         m_captureState = ERecording;
   254         m_captureState = ERecording;
   198         emit stateChanged(m_captureState);
   255         emit stateChanged(m_captureState);
   199     }        
   256     }        
   200 }
   257 }
   201 
   258 
   207             m_container = QString("audio/amr");
   264             m_container = QString("audio/amr");
   208         else
   265         else
   209             m_container = m_controllerIdMap.keys()[0];
   266             m_container = m_controllerIdMap.keys()[0];
   210     }
   267     }
   211     if (m_audioCodeclist.keys().count() > 0) {
   268     if (m_audioCodeclist.keys().count() > 0) {
   212         if (m_audioCodeclist.keys().contains("AMR"))
   269         if (m_audioCodeclist.keys().contains("AMR")) {            
       
   270             m_format.setSampleSize(8);
       
   271             m_format.setChannels(1);
       
   272             m_format.setFrequency(8000);
       
   273             m_format.setSampleType(QAudioFormat::SignedInt);            
   213             m_format.setCodec("AMR");
   274             m_format.setCodec("AMR");
   214         else
   275         }else
   215             m_format.setCodec(m_audioCodeclist.keys()[0]);
   276             m_format.setCodec(m_audioCodeclist.keys()[0]);
   216     }
   277     }
   217 }
   278 }
   218 
   279 
   219 void S60AudioCaptureSession::pause()
   280 void S60AudioCaptureSession::pause()
   226     m_captureState = EPaused;
   287     m_captureState = EPaused;
   227     emit stateChanged(m_captureState);    
   288     emit stateChanged(m_captureState);    
   228 }
   289 }
   229 
   290 
   230 void S60AudioCaptureSession::stop()
   291 void S60AudioCaptureSession::stop()
   231 {
   292 {    
   232     if (!m_recorderUtility)
   293     if (!m_recorderUtility)
   233         return;
   294         return;
   234     
   295     
   235     m_recorderUtility->Stop();
   296     m_recorderUtility->Stop();
   236     m_recorderUtility->Close();        
   297     m_recorderUtility->Close();        
   237     m_captureState = ERecordComplete;
   298     m_captureState = ERecordComplete;
   238     emit stateChanged(m_captureState);
   299     emit stateChanged(m_captureState);   
   239 }
   300 }
   240 
   301 
   241 void S60AudioCaptureSession::setCaptureDevice(const QString &deviceName)
   302 void S60AudioCaptureSession::setCaptureDevice(const QString &deviceName)
   242 {
   303 {
   243     m_captureDevice = deviceName;
   304     m_captureDevice = deviceName;
   244 }
   305 }
   245 
   306 
   246 void S60AudioCaptureSession::MoscoStateChangeEvent(CBase* aObject,
   307 void S60AudioCaptureSession::MoscoStateChangeEvent(CBase* aObject,
   247         TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
   308         TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
   248 {    
   309 { 	    
   249 	TRAPD(err, MoscoStateChangeEventL(aObject, aPreviousState, aCurrentState, NULL));    
   310     if (aErrorCode==KErrNone) {
   250 	qWarning() << err;
   311 	    TRAPD(err, MoscoStateChangeEventL(aObject, aPreviousState, aCurrentState, NULL));
       
   312 	    setError(err);
       
   313 	}
       
   314 	setError(aErrorCode);
   251 }
   315 }
   252 
   316 
   253 void S60AudioCaptureSession::MoscoStateChangeEventL(CBase* aObject,
   317 void S60AudioCaptureSession::MoscoStateChangeEventL(CBase* aObject,
   254         TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
   318         TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
   255 {    
   319 {    
   263                     retrieveSupportedAudioSampleRatesL();                   
   327                     retrieveSupportedAudioSampleRatesL();                   
   264                     m_recorderUtility->Close();                    
   328                     m_recorderUtility->Close();                    
   265                     m_captureState = EInitialized;
   329                     m_captureState = EInitialized;
   266                     emit stateChanged(m_captureState);
   330                     emit stateChanged(m_captureState);
   267                 }else {         
   331                 }else {         
   268                     applyAudioSettingsL();                            
   332                     applyAudioSettingsL();                    
   269                     m_recorderUtility->SetAudioDeviceMode(CMdaAudioRecorderUtility::ELocal);
   333                     m_recorderUtility->SetGain(m_recorderUtility->MaxGain());                 
   270                     m_recorderUtility->SetGain(m_recorderUtility->MaxGain());                    
       
   271                     m_recorderUtility->SetPosition(TTimeIntervalMicroSeconds(0));
       
   272                     m_recorderUtility->CropL();
       
   273                     m_recorderUtility->RecordL();
   334                     m_recorderUtility->RecordL();
   274                     m_captureState = EOpenCompelete;                    
   335                     m_captureState = EOpenCompelete;                    
   275                     emit stateChanged(m_captureState);
   336                     emit stateChanged(m_captureState);
   276                     }
   337                     }
   277                 break;
   338                 break;
   318 	for (TInt index=0; index<controllers.Count(); index++) {
   379 	for (TInt index=0; index<controllers.Count(); index++) {
   319 		const RMMFFormatImplInfoArray& recordFormats = 
   380 		const RMMFFormatImplInfoArray& recordFormats = 
   320 			controllers[index]->RecordFormats();
   381 			controllers[index]->RecordFormats();
   321 		for (TInt j=0; j<recordFormats.Count(); j++) {
   382 		for (TInt j=0; j<recordFormats.Count(); j++) {
   322 			const CDesC8Array& mimeTypes = recordFormats[j]->SupportedMimeTypes();
   383 			const CDesC8Array& mimeTypes = recordFormats[j]->SupportedMimeTypes();
   323 			TInt count = mimeTypes.Count();
   384 			const CDesC8Array& fileExtensions = recordFormats[j]->SupportedFileExtensions();
   324 			if (count > 0) {
   385 			TInt mimeCount = mimeTypes.Count();
   325 				TPtrC8 mimeType = mimeTypes[0];
   386 			TInt fileExtCount = fileExtensions.Count();
   326 				QString type = QString::fromUtf8((char *)mimeType.Ptr(), mimeType.Length());
   387 									                                      
   327 				if (type != "audio/mp4") {
   388 			if (mimeCount > 0 && fileExtCount > 0) {
       
   389                 TPtrC8 extension = fileExtensions[0];
       
   390                 TPtrC8 mimeType = mimeTypes[0];             
       
   391                 QString type = QString::fromUtf8((char *)mimeType.Ptr(), mimeType.Length());          
       
   392                 
       
   393 				if (type != "audio/mp4" && type != "audio/basic") {
   328                     ControllerData data;
   394                     ControllerData data;
   329                     data.controllerUid = controllers[index]->Uid().iUid;
   395                     data.controllerUid = controllers[index]->Uid().iUid;
   330                     data.destinationFormatUid = recordFormats[j]->Uid().iUid;
   396                     data.destinationFormatUid = recordFormats[j]->Uid().iUid;
   331                     data.destinationFormatDescription = QString::fromUtf16(
   397                     data.destinationFormatDescription = QString::fromUtf16(
   332                             recordFormats[j]->DisplayName().Ptr(),
   398                             recordFormats[j]->DisplayName().Ptr(),
   333                             recordFormats[j]->DisplayName().Length());                
   399                             recordFormats[j]->DisplayName().Length());  
       
   400                     data.fileExtension = QString::fromUtf8((char *)extension.Ptr(), extension.Length());  
   334                     m_controllerIdMap[type] = data;
   401                     m_controllerIdMap[type] = data;
   335 				}
   402 				}
   336 			}
   403 			}
   337 		}
   404 		}
   338 	}	
   405 	}	
   342 void S60AudioCaptureSession::retrieveSupportedAudioSampleRatesL()
   409 void S60AudioCaptureSession::retrieveSupportedAudioSampleRatesL()
   343 {       
   410 {       
   344     if (!m_recorderUtility || m_captureState != EInitializing) 
   411     if (!m_recorderUtility || m_captureState != EInitializing) 
   345         return;
   412         return;
   346     
   413     
       
   414     m_supportedSampleRates.clear();
       
   415     
   347     RArray<TUint> supportedSampleRates;
   416     RArray<TUint> supportedSampleRates;
   348     CleanupClosePushL(supportedSampleRates);
   417     CleanupClosePushL(supportedSampleRates);
   349     m_recorderUtility->GetSupportedSampleRatesL(supportedSampleRates);        
   418     m_recorderUtility->GetSupportedSampleRatesL(supportedSampleRates);        
   350     for (TInt j = 0; j < supportedSampleRates.Count(); j++ ) {            
   419     for (TInt j = 0; j < supportedSampleRates.Count(); j++ )             
   351         m_supportedSampleRates.append(supportedSampleRates[j]);
   420         m_supportedSampleRates.append(supportedSampleRates[j]);                                
   352         //qDebug()<<"S60AudioCaptureSession::doPopulateAudioCodecsDataL, samplerate: "<<m_supportedSampleRates[j];                        
   421 
   353     }            
       
   354     CleanupStack::PopAndDestroy(&supportedSampleRates);    
   422     CleanupStack::PopAndDestroy(&supportedSampleRates);    
   355 }
   423 }
   356 
   424 
   357 QList<int> S60AudioCaptureSession::supportedAudioSampleRates() const
   425 QList<int> S60AudioCaptureSession::supportedAudioSampleRates(const QAudioEncoderSettings &settings) const
   358 {
   426 {
   359     return m_supportedSampleRates;
   427     QList<int> supportedSampleRates;
       
   428 
       
   429     if (!settings.codec().isEmpty()) {
       
   430         if (settings.codec() == "AMR")             
       
   431             supportedSampleRates.append(8000);
       
   432         else
       
   433             supportedSampleRates = m_supportedSampleRates; 
       
   434     }else 
       
   435         supportedSampleRates = m_supportedSampleRates;           
       
   436     
       
   437     return supportedSampleRates;
   360 }
   438 }
   361 
   439 
   362 void S60AudioCaptureSession::populateAudioCodecsDataL()
   440 void S60AudioCaptureSession::populateAudioCodecsDataL()
   363 {
   441 {        
   364     //qDebug() << "S60AudioCaptureSession::doInitializeAudioRecorderL START";    
       
   365     if (!m_recorderUtility)  
   442     if (!m_recorderUtility)  
   366         return;
   443         return;
   367         
   444         
   368     if (m_controllerIdMap.contains("audio/amr")) {       
   445     if (m_controllerIdMap.contains("audio/amr")) {       
   369         CodecData data;              
   446         CodecData data;              
   387         data.fourCC = KMMFFourCCCodeAAC;                   
   464         data.fourCC = KMMFFourCCCodeAAC;                   
   388         data.codecDescription = QString("Advanced Audio Codec");
   465         data.codecDescription = QString("Advanced Audio Codec");
   389         m_audioCodeclist[QString("AAC")]=data;
   466         m_audioCodeclist[QString("AAC")]=data;
   390     }        
   467     }        
   391     
   468     
   392     if (m_controllerIdMap.contains("audio/wav")) {            
   469     // default samplerates
       
   470     m_supportedSampleRates << 96000 << 88200 << 64000 << 48000 << 44100 << 32000 << 24000 << 22050 << 16000 << 12000 << 11025 << 8000;
       
   471     m_captureState = EInitialized;
       
   472     if (m_controllerIdMap.contains("audio/wav") && m_captureState != EInitialized) {            
   393         TMdaFileClipLocation location;   
   473         TMdaFileClipLocation location;   
   394         location.iName = KAudioDummyFile();
   474         location.iName = KAudioDummyFile();
   395         TMdaWavClipFormat format;
   475         TMdaWavClipFormat format;
   396         m_captureState = EInitializing;
   476         m_captureState = EInitializing;
   397         m_recorderUtility->OpenL(&location, &format);             
   477         m_recorderUtility->OpenL(&location, &format);             
   398     }    
   478     }      
   399 }
   479 }
   400 
   480 
   401 void S60AudioCaptureSession::applyAudioSettingsL()
   481 void S60AudioCaptureSession::applyAudioSettingsL()
   402 {
   482 {      
   403     //qDebug() << "S60AudioCaptureSession::applyAudioSettings START";  
       
   404     if (!m_recorderUtility)
   483     if (!m_recorderUtility)
   405         return;
   484         return;
   406     
   485     
   407     TFourCC fourCC = m_audioCodeclist[m_format.codec()].fourCC;    
   486     TFourCC fourCC = m_audioCodeclist.value(m_format.codec()).fourCC;    
   408     
   487     
   409     //set destination datatype
   488     //set destination datatype
   410     RArray<TFourCC> supportedDataTypes;
   489     RArray<TFourCC> supportedDataTypes;
   411     CleanupClosePushL(supportedDataTypes);
   490     CleanupClosePushL(supportedDataTypes);
   412     m_recorderUtility->GetSupportedDestinationDataTypesL(supportedDataTypes);
   491     m_recorderUtility->GetSupportedDestinationDataTypesL(supportedDataTypes);    
   413     //qDebug() << "S60AudioCaptureSession::applyAudioSettingsL, datatype count"<<supportedDataTypes.Count();
   492 
   414 
   493     for (TInt k = 0; k < supportedDataTypes.Count(); k++ ) {        
   415     for (TInt k = 0; k < supportedDataTypes.Count(); k++ ) {
   494         if (supportedDataTypes[k].FourCC() == fourCC.FourCC()) {            
   416         qDebug() << "S60AudioCaptureSession::applyAudioSettingsL, codec"<<m_format.codec()<<"datatype"<<supportedDataTypes[k].FourCC();
       
   417         if (supportedDataTypes[k].FourCC() == fourCC.FourCC()) {
       
   418             //qDebug() << "S60AudioCaptureSession::applyAudioSettingsL, codec"<<m_format.codec()<<"matched datatype"<<supportedDataTypes[k].FourCC();
       
   419             m_recorderUtility->SetDestinationDataTypeL(supportedDataTypes[k]);
   495             m_recorderUtility->SetDestinationDataTypeL(supportedDataTypes[k]);
   420             break;
   496             break;
   421         }
   497         }
   422     }
   498     }
   423     CleanupStack::PopAndDestroy(&supportedDataTypes);
   499     CleanupStack::PopAndDestroy(&supportedDataTypes);    
   424     
   500     
   425     RArray<TUint> supportedSampleRates;
   501     RArray<TUint> supportedSampleRates;
   426     CleanupClosePushL(supportedSampleRates);
   502     CleanupClosePushL(supportedSampleRates);
   427     m_recorderUtility->GetSupportedSampleRatesL(supportedSampleRates);    
   503     m_recorderUtility->GetSupportedSampleRatesL(supportedSampleRates);    
   428     for (TInt i = 0; i < supportedSampleRates.Count(); i++ ) {
   504     for (TInt i = 0; i < supportedSampleRates.Count(); i++ ) {
   431             m_recorderUtility->SetDestinationSampleRateL(m_format.frequency());
   507             m_recorderUtility->SetDestinationSampleRateL(m_format.frequency());
   432             break;
   508             break;
   433         }        
   509         }        
   434     }
   510     }
   435     CleanupStack::PopAndDestroy(&supportedSampleRates);
   511     CleanupStack::PopAndDestroy(&supportedSampleRates);
   436  
   512     
   437     RArray<TUint> supportedChannels;
   513     RArray<TUint> supportedChannels;
   438     CleanupClosePushL(supportedChannels);
   514     CleanupClosePushL(supportedChannels);
   439     m_recorderUtility->GetSupportedNumberOfChannelsL(supportedChannels);
   515     m_recorderUtility->GetSupportedNumberOfChannelsL(supportedChannels);    
   440     for (TInt l = 0; l < supportedChannels.Count(); l++ ) {
   516     for (TInt l = 0; l < supportedChannels.Count(); l++ ) {        
   441         if (supportedChannels[l] == m_format.channels()) {
   517         if (supportedChannels[l] == m_format.channels()) {
   442             m_recorderUtility->SetDestinationNumberOfChannelsL(m_format.channels());
   518             m_recorderUtility->SetDestinationNumberOfChannelsL(m_format.channels());
   443             break;
   519             break;
   444         }
   520         }
   445     }
   521     }
   446     CleanupStack::PopAndDestroy(&supportedChannels);
   522     CleanupStack::PopAndDestroy(&supportedChannels);        
   447     //qDebug() << "S60AudioCaptureSession::applyAudioSettings END";        
       
   448 }
   523 }
   449 
   524 
   450 TFourCC S60AudioCaptureSession::determinePCMFormat()
   525 TFourCC S60AudioCaptureSession::determinePCMFormat()
   451 {
   526 {        
   452     //qDebug() << "S60AudioCaptureSession::determinePCMSampleSize START";    
       
   453     TFourCC fourCC;    
   527     TFourCC fourCC;    
   454     
   528     
   455     if (m_format.sampleSize() == 8) {
   529     if (m_format.sampleSize() == 8) {
   456         // 8 bit
   530         // 8 bit
   457         switch (m_format.sampleType()) {
   531         switch (m_format.sampleType()) {
   486         default: {
   560         default: {
   487             fourCC.Set(KMMFFourCCCodePCM16);
   561             fourCC.Set(KMMFFourCCCodePCM16);
   488             break;
   562             break;
   489         }
   563         }
   490         }    
   564         }    
   491     }    
   565     }
   492     //qDebug() << "S60AudioCaptureSession::determinePCMSampleSize END";
       
   493     return fourCC;
   566     return fourCC;
   494 }
   567 }