First public contribution.
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include "teststepoggctrlplay.h"
20 * Test step constructor.
21 * It initialises its own name and the input filename
24 RTestStepOggCtrlPlay::RTestStepOggCtrlPlay(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
25 :RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
30 * This test Primes the OggPlayController and Plays an Ogg file to its completion
31 * and checks for the proper play completion
33 TVerdict RTestStepOggCtrlPlay::DoTestStepL( void )
35 INFO_PRINTF1(_L("this step plays an Ogg file "));
36 TInt errorCode = iController.Prime();
39 INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
42 errorCode = iController.Play();
45 INFO_PRINTF2(_L("Play() is failed with %d "), errorCode);
48 CActiveScheduler::Start();
49 return iTestStepResult;
54 * Test step constructor.
55 * It initialises its own name and the input filename
58 RTestStepOggCtrlVolume::RTestStepOggCtrlVolume(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
59 :RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
65 * This tests setting the volume on OggPlayController in Stopped, Primed and Playing
66 * states and checks if the volume set is same as the volume got.
68 TVerdict RTestStepOggCtrlVolume::DoTestStepL( void )
70 INFO_PRINTF1(_L("this step tests SetVolume/GetVolume() APIs of OggPlayController "));
71 RMMFAudioPlayDeviceCustomCommands theCommander( iController );
73 TInt errorCode =theCommander.GetMaxVolume( maxVolume );
76 INFO_PRINTF2(_L("GetMaxVolume() is failed with %d "), errorCode);
80 TInt theVolume = maxVolume /2;
81 //try setting volume in Stopped State
82 errorCode =theCommander.SetVolume(theVolume);
85 INFO_PRINTF2(_L("SetVolume() during Stopped State is failed with %d "), errorCode);
88 TInt theNewVolume (0);
89 errorCode =theCommander.GetVolume(theNewVolume);
92 INFO_PRINTF2(_L("GetVolume() during Stopped State is failed with %d "), errorCode);
95 if( theNewVolume != theVolume )
97 INFO_PRINTF1(_L("Set and Get Volumes are different during Stopped State"));
100 errorCode = iController.Prime();
103 INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
104 return EInconclusive;
106 //try setting volume in Primed State
107 errorCode =theCommander.SetVolume(theVolume);
110 INFO_PRINTF2(_L("SetVolume() during Primed State is failed with %d "), errorCode);
113 errorCode =theCommander.GetVolume(theNewVolume);
116 INFO_PRINTF2(_L("GetVolume() during Primed State is failed with %d "), errorCode);
119 if( theNewVolume != theVolume )
121 INFO_PRINTF1(_L("Set and Get Volumes are different during Primed State"));
124 errorCode = iController.Play();
127 INFO_PRINTF2(_L("Play() is failed with %d "), errorCode);
128 return EInconclusive;
130 //try setting volume in Playing State
131 errorCode =theCommander.SetVolume(theVolume);
134 INFO_PRINTF2(_L("SetVolume() during Playing State is failed with %d "), errorCode);
138 errorCode =theCommander.GetVolume(theNewVolume);
141 INFO_PRINTF2(_L("GetVolume() during Playing State is failed with %d "), errorCode);
145 if(theNewVolume != theVolume)
147 //stop the controller
148 INFO_PRINTF1(_L("Set and Get Volumes are different during Playing State"));
152 //get the play completion event
153 CActiveScheduler::Start();
154 return iTestStepResult;
159 * Test step constructor.
160 * It initialises its own name and the input filename
163 RTestStepOggCtrlPlayBalance::RTestStepOggCtrlPlayBalance(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
164 :RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
170 * This tests setting the PlayBalance on OggPlayController in Stopped, Primed and Playing
171 * states and checks if the PlayBalance set is same as the PlayBalance got.
173 TVerdict RTestStepOggCtrlPlayBalance::DoTestStepL( void )
175 INFO_PRINTF1(_L("this step tests SetBalance/GetBalance() APIs of OggPlayController "));
176 RMMFAudioPlayDeviceCustomCommands theCommander( iController );
177 TInt theBalance = (30 * (KMMFBalanceMaxRight-KMMFBalanceMaxLeft))/100 + KMMFBalanceMaxLeft;
178 TInt errorCode = theCommander.SetBalance( theBalance );
181 INFO_PRINTF2(_L("SetBalance() during Stopped State is failed with %d "), errorCode);
184 TInt theNewBalance (0);
185 errorCode =theCommander.GetBalance( theNewBalance );
188 INFO_PRINTF2(_L("GetVolume() during Stopped State is failed with %d "), errorCode);
191 if( theNewBalance != theBalance )
193 INFO_PRINTF1(_L("Set and Get Balances are different during Stopped State"));
196 errorCode = iController.Prime();
199 INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
200 return EInconclusive;
202 errorCode = theCommander.SetBalance( theBalance );
205 INFO_PRINTF2(_L("SetBalance() during Primed State is failed with %d "), errorCode);
208 errorCode =theCommander.GetBalance( theNewBalance );
211 INFO_PRINTF2(_L("GetBalance() during Primed State is failed with %d "), errorCode);
214 if( theNewBalance != theBalance )
216 INFO_PRINTF1(_L("Set and Get Balances are different during Primed State"));
219 errorCode = iController.Play();
222 INFO_PRINTF2(_L("Play() is failed with %d "), errorCode);
223 return EInconclusive;
225 errorCode =theCommander.SetBalance(theBalance);
228 INFO_PRINTF2(_L("SetBalance() during Playing State is failed with %d "), errorCode);
232 errorCode =theCommander.GetBalance(theNewBalance);
235 INFO_PRINTF2(_L("GetBalance() during Playing State is failed with %d "), errorCode);
239 if(theNewBalance != theBalance)
241 //stop the controller
242 INFO_PRINTF1(_L("Set and Get Balances are different during Playing State"));
246 //get the play completion event
247 CActiveScheduler::Start();
248 return iTestStepResult;
253 * Test step constructor.
254 * It initialises its own name and the input filename
257 RTestStepOggCtrlPosition::RTestStepOggCtrlPosition(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
258 :RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
264 * This tests setting the Position on OggPlayController in Stopped, Primed and Playing
265 * states and checks if the Position set is same as the Position got. It expects KErrNotReady
266 * error during Stopped state.
268 TVerdict RTestStepOggCtrlPosition::DoTestStepL(void)
270 INFO_PRINTF1(_L("this step tests SetPosition/GetPosition() APIs of OggPlayController "));
271 TTimeIntervalMicroSeconds theDuration;
272 TInt errorCode = iController.GetDuration(theDuration);
275 INFO_PRINTF2(_L("DurationL() is failed with %d "), errorCode);
276 return EInconclusive;
278 TInt64 duration = theDuration. Int64();
279 TTimeIntervalMicroSeconds thePosition(duration/2);
280 errorCode = iController.SetPosition(thePosition);
281 if(errorCode != KErrNotReady)
283 INFO_PRINTF2(_L("SetPosition() during Stopped State is failed to return KErrNotReady but returned %d "), errorCode);
286 errorCode = iController.Prime();
289 INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
290 return EInconclusive;
292 errorCode = iController.SetPosition(thePosition);
295 INFO_PRINTF2(_L("SetPosition() during Primed State is failed with %d "), errorCode);
298 TTimeIntervalMicroSeconds theNewPosition;
299 errorCode = iController.GetPosition(theNewPosition);
302 INFO_PRINTF2(_L("GetPosition() during Primed State is failed with %d "), errorCode);
305 /* There is a limitation in the repositioning in the vorbis stream. The position passed by the
306 client is converted into granulePos that is nearer to the positon passed. So when GetPosition is called
307 we may not get the exact position we have set using the setposition(). This is because granulePos
308 is same all through an oggPage and an oggPage will be of average size 6k. So the positioning is not that
309 precise. So the KDeviationInTime.
311 if(!TimeComparison(theNewPosition.Int64(), thePosition.Int64(), KDeviationInTime))
313 INFO_PRINTF1(_L("Set and Get Positions are different during Primed State"));
316 //Reset back to the beginning before play
317 iController.SetPosition(TTimeIntervalMicroSeconds(0));
318 errorCode = iController.Play();
321 INFO_PRINTF2(_L("Play() is failed with %d "), errorCode);
322 return EInconclusive;
324 User::After(KTwoSeconds);
325 errorCode = iController.SetPosition(thePosition);
328 INFO_PRINTF2(_L("SetPosition() during Playing State is failed with %d "), errorCode);
331 errorCode = iController.GetPosition(theNewPosition);
334 INFO_PRINTF2(_L("GetPosition() during Playing State is failed with %d "), errorCode);
337 if(!TimeComparison(theNewPosition.Int64(), thePosition.Int64(), KDeviationInTime))
339 //stop the controller
340 INFO_PRINTF1(_L("Current Position is lessthan the Postion Set in Playing State"));
344 //get the play completion event
345 CActiveScheduler::Start();
346 return iTestStepResult;
351 * Test step constructor.
352 * It initialises its own name and the input filename
355 RTestStepOggCtrlDuration::RTestStepOggCtrlDuration(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
356 :RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
362 * This tests setting the Position on OggPlayController in Stopped, Primed and Playing
363 * states and checks if the Position set is same as the Postion got. It expects KErrNotReady
364 * error during Stopped state.
366 TVerdict RTestStepOggCtrlDuration::DoTestStepL(void)
368 INFO_PRINTF1(_L("this step tests GetDuration() API of OggPlayController "));
369 TTimeIntervalMicroSeconds expectedtheDuration(6002426);
370 TTimeIntervalMicroSeconds theDuration;
371 TInt errorCode = iController.GetDuration(theDuration);
374 INFO_PRINTF2(_L("DurationL() is failed with %d "), errorCode);
377 else if(theDuration != expectedtheDuration)
379 INFO_PRINTF2(_L("GetDuration() returned the wrong duration %d "), theDuration. Int64());
382 errorCode = iController.Prime();
385 INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
386 return EInconclusive;
388 errorCode = iController.GetDuration(theDuration);
391 INFO_PRINTF2(_L("DurationL() is failed with %d "), errorCode);
394 else if(theDuration != expectedtheDuration)
396 INFO_PRINTF2(_L("GetDuration() returned the wrong duration %d "), theDuration. Int64());
399 errorCode = iController.Play();
402 INFO_PRINTF2(_L("Play() is failed with %d "), errorCode);
403 return EInconclusive;
405 errorCode = iController.GetDuration(theDuration);
408 INFO_PRINTF2(_L("DurationL() is failed with %d "), errorCode);
412 else if(theDuration != expectedtheDuration)
414 INFO_PRINTF2(_L("GetDuration() returned the wrong duration %d "), theDuration. Int64());
422 * Test step constructor.
423 * It initialises its own name and the input filename
426 RTestStepOggCtrlPause::RTestStepOggCtrlPause(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
427 :RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
433 * This tests the Pause functionality of the OggPlayController in Stopped, Primed and Playing
434 * states and checks if the Play starts from the current position. It expects KErrNotReady
435 * error if Pause is called during Stopped and Primed states.
437 * This test may fail as the position after pause-play may vary due to granularity and recalculation of the buffer.
439 TVerdict RTestStepOggCtrlPause::DoTestStepL(void)
441 INFO_PRINTF1(_L("this step tests Pause() API of OggPlayController "));
442 TInt errorCode = iController.Pause();
443 if(errorCode != KErrNotReady)
445 INFO_PRINTF2(_L("Pause() during Stopped State is failed to return KErrNotReady but returned %d "), errorCode);
448 errorCode = iController.Prime();
451 INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
452 return EInconclusive;
454 errorCode = iController.Pause();
455 if(errorCode != KErrNotReady)
457 INFO_PRINTF2(_L("Pause() during Primed State is failed to return KErrNotReady but returned %d "), errorCode);
460 INFO_PRINTF1(_L("Play"));
461 errorCode = iController.Play();
464 INFO_PRINTF2(_L("Play() is failed with %d "), errorCode);
465 return EInconclusive;
467 INFO_PRINTF1(_L("Pause"));
468 errorCode = iController.Pause();
471 INFO_PRINTF2(_L("Pause() during Playing State is failed with %d "), errorCode);
474 INFO_PRINTF1(_L("GetPosition - thePosition"));
475 TTimeIntervalMicroSeconds thePosition;
476 errorCode = iController.GetPosition(thePosition);
479 INFO_PRINTF2(_L("GetPosition() after Pause is failed with %d "), errorCode);
482 INFO_PRINTF1(_L("Play"));
483 errorCode = iController.Play();
486 INFO_PRINTF2(_L("Play() after Pause() is failed with %d "), errorCode);
487 return EInconclusive;
489 INFO_PRINTF1(_L("GetPosition - theNewPosition"));
490 TTimeIntervalMicroSeconds theNewPosition;
491 errorCode = iController.GetPosition(theNewPosition);
492 INFO_PRINTF2(_L(" Paused: %d"), I64INT(thePosition.Int64()));
493 INFO_PRINTF2(_L(" Current: %d"), I64INT(theNewPosition.Int64()));
495 if(theNewPosition < thePosition)
497 //stop the controller
498 INFO_PRINTF1(_L("Current Position is lessthan the Paused Postion"));
499 ERR_PRINTF2(_L(" Paused: %d"), I64INT(thePosition.Int64()));
500 ERR_PRINTF2(_L(" Current: %d"), I64INT(theNewPosition.Int64()));
504 //get the play completion event
505 CActiveScheduler::Start();
506 return iTestStepResult;
510 * Test step constructor.
511 * It initialises its own name and the input filename
514 RTestStepOggCtrlStop::RTestStepOggCtrlStop(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
515 :RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
521 * This tests the Stop functionality of the OggPlayController in Stopped, Primed and Playing
522 * states It expects KErrNotReady error if Stop is called during Stopped state.
524 TVerdict RTestStepOggCtrlStop::DoTestStepL(void)
526 INFO_PRINTF1(_L("this step tests Stop() API of OggPlayController "));
527 TInt errorCode = iController.Stop();
530 INFO_PRINTF2(_L("Stop() during Stopped State is failed with %d "), errorCode);
533 errorCode = iController.Prime();
536 INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
537 return EInconclusive;
539 errorCode = iController.Stop();
542 INFO_PRINTF2(_L("Stop() during Primed State is failed with %d "), errorCode);
545 errorCode = iController.Prime();
548 INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
549 return EInconclusive;
551 errorCode = iController.Play();
554 INFO_PRINTF2(_L("Play() is failed with %d "), errorCode);
555 return EInconclusive;
557 User::After(KTwoSeconds);
558 errorCode = iController.Stop();
561 INFO_PRINTF2(_L("Stop() during Playing State is failed with %d "), errorCode);
564 errorCode = iController.Prime();
567 INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
568 return EInconclusive;
570 errorCode = iController.Play();
573 INFO_PRINTF2(_L("Play() after Stop() is failed with %d "), errorCode);
574 return EInconclusive;
576 //get the play completion event
577 CActiveScheduler::Start();
578 return iTestStepResult;
582 * Test step constructor.
583 * It initialises its own name and the input filename
586 RTestStepOggCtrlMetaData::RTestStepOggCtrlMetaData(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
587 :RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
593 * This test tries to fetch the metadata from the Ogg file.
596 TVerdict RTestStepOggCtrlMetaData::DoTestStepL(void)
598 INFO_PRINTF1(_L("this step tests GetNumberOfMetaDataEntries/GetMetaDataEntryL() APIs of OggPlayController "));
600 TInt errorCode = iController.GetNumberOfMetaDataEntries( numEntries );
601 CMMFMetaDataEntry* metaEntry = NULL;
604 INFO_PRINTF2(_L("GetNumberOfMetaDataEntries() is failed with %d "), errorCode);
609 INFO_PRINTF1(_L("File does not have meta entries "));
613 for(TInt counter = 0; counter < numEntries; ++counter)
615 TRAP(errorCode, metaEntry = iController.GetMetaDataEntryL(counter));
618 INFO_PRINTF2(_L("GetMetaDataEntryL is failed with %d "), errorCode);
621 INFO_PRINTF3(_L("%S %S"), &metaEntry->Name(), &metaEntry->Value());
628 * Test step constructor.
629 * It initialises its own name and the input filename
632 RTestStepOggCtrlPlayWindow::RTestStepOggCtrlPlayWindow(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
633 :RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
639 * This tests the PlayWindow functionality of the OggPlayController.
640 * Sequence : Prime -> SetPlayWindow -> Play(check if the current position > PlayStart)
641 * Stop -> Prime -> Play(check if the current position > PlayStart)
642 * Stop -> Prime -> DeletePlayWindow -> Play(check if the current position <= PlayStart)
644 TVerdict RTestStepOggCtrlPlayWindow::DoTestStepL(void)
646 INFO_PRINTF1(_L("this step tests SetPlaybackWindow/DeletePlaybackWindow() API of OggPlayController "));
647 TInt errorCode = iController.Prime();
650 INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
651 return EInconclusive;
653 TTimeIntervalMicroSeconds theDuration;
654 errorCode = iController.GetDuration(theDuration);
657 INFO_PRINTF2(_L("DurationL() is failed with %d "), errorCode);
658 return EInconclusive;
660 TInt64 duration = theDuration. Int64();
661 TTimeIntervalMicroSeconds thePlayStart(duration/2);
662 TTimeIntervalMicroSeconds thePlayEnd(duration);
663 RMMFAudioPlayControllerCustomCommands theCommander(iController);
664 errorCode = theCommander.SetPlaybackWindow(thePlayStart, thePlayEnd);
667 INFO_PRINTF2(_L("SetPlaybackWindow() is failed with %d "), errorCode);
670 errorCode = iController.Play();
673 INFO_PRINTF2(_L("Play() after SetPlayWindow() is failed with %d "), errorCode);
674 return EInconclusive;
676 TTimeIntervalMicroSeconds theNewPosition;
677 errorCode = iController.GetPosition(theNewPosition);
678 if(!TimeComparison(theNewPosition.Int64(), thePlayStart.Int64(), KDeviationInTime))
680 //stop the controller
681 INFO_PRINTF1(_L("Current Position is lessthan the PlayWindowStart"));
685 User::After(KTwoSeconds);
686 errorCode = iController.Stop();
689 INFO_PRINTF2(_L("Stop() with PlayWindow set is failed with %d "), errorCode);
692 errorCode = iController.Prime();
695 INFO_PRINTF2(_L("Prime with PlayWindow set is failed with %d "), errorCode);
696 return EInconclusive;
698 errorCode = iController.Play();
701 INFO_PRINTF2(_L("Play() with PlayWindow is failed with %d "), errorCode);
702 return EInconclusive;
704 errorCode = iController.GetPosition(theNewPosition);
705 if(!TimeComparison(theNewPosition.Int64(), thePlayStart.Int64(), KDeviationInTime))
707 //stop the controller
708 INFO_PRINTF1(_L("Current Position is lessthan the PlayWindowStart(Second Play)"));
712 User::After(KTwoSeconds);
713 errorCode = iController.Stop();
716 INFO_PRINTF2(_L("Stop() with PlayWindow set is failed with %d "), errorCode);
719 errorCode = iController.Prime();
722 INFO_PRINTF2(_L("Prime with PlayWindow set is failed with %d "), errorCode);
725 errorCode = theCommander.DeletePlaybackWindow();
728 INFO_PRINTF2(_L("DeletePlaybackWindow() is failed with %d "), errorCode);
731 errorCode = iController.Play();
734 INFO_PRINTF2(_L("Play() after DeletePlaybackWindow is failed with %d "), errorCode);
737 errorCode = iController.GetPosition(theNewPosition);
738 if(theNewPosition > thePlayStart)
740 //stop the controller
741 INFO_PRINTF1(_L("PlaybackWindow is not deleted properly"));
745 //get the play completion event
746 CActiveScheduler::Start();
747 return iTestStepResult;
752 * Test step constructor.
753 * It initialises its own name and the input filename
756 RTestStepOggCtrlGetSetConfig::RTestStepOggCtrlGetSetConfig(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
757 :RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
763 * This test tries to fetch the audio configuration from the Ogg file
764 * and compares with the expected configuration.
766 TVerdict RTestStepOggCtrlGetSetConfig::DoTestStepL(void)
768 INFO_PRINTF1(_L("this step tests setting and getting audio configuration on OggPlayController "));
769 RMMFAudioControllerCustomCommands theCommander( iController );
771 const TUint KExpectedBitRate = 128000;
772 const TUint KExpectedSampleRate = 44100;
773 const TUint KExpectedSourceChannels = 2;
774 TInt errorCode = theCommander.GetSourceBitRate(theRate);
777 INFO_PRINTF2(_L("GetSourceBitRate() is failed with %d "), errorCode);
780 else if(theRate != KExpectedBitRate)
782 INFO_PRINTF2(_L("GetSourceBitRate() returned the wrong bitrate %d "), theRate);
785 errorCode = theCommander.GetSourceSampleRate(theRate);
788 INFO_PRINTF2(_L("GetSourceSampleRate() is failed with %d "), errorCode);
791 else if(theRate != KExpectedSampleRate)
793 INFO_PRINTF2(_L("GetSourceBitRate() returned the wrong samplerate %d "), theRate);
796 errorCode = theCommander.GetSourceNumChannels(theRate);
799 INFO_PRINTF2(_L("GetSourceNumChannels() is failed with %d "), errorCode);
802 else if(theRate != KExpectedSourceChannels)
804 INFO_PRINTF2(_L("GetSourceNumChannels() returned the wrong value %d "), theRate);
808 errorCode = theCommander.GetSourceFormat(formatUid);
811 INFO_PRINTF2(_L("GetSourceFormat(() during Stopped State is failed with %d "), errorCode);
814 if(formatUid != KOggDecodeUid)
816 INFO_PRINTF2(_L("GetSourceFormat() returned the wrong value %d "), formatUid.iUid);
820 errorCode =theCommander.GetSourceDataType(dataType);
823 INFO_PRINTF2(_L("GetSourceDataType() during Stopped State is failed with %d "), errorCode);
826 if( dataType != TFourCC('V', 'O', 'R', 'B') )
828 INFO_PRINTF1(_L("GetSourceDataType() returned datatype different from VORB "));
832 Setting configurations during playing is not possible because the file has to be played at a configuration
833 which is same as that of when it was recorded. However, if the client tries to set the configuration which
834 is same as the configutation of the file, all the SetXXX() custom commands will return KErrNone. We dont check
835 GetXXX() after SetXXX() here for this reason.
837 errorCode = theCommander.SetSourceBitRate(KExpectedBitRate);
840 INFO_PRINTF2(_L("SetSourceBitRate() is failed with %d "), errorCode);
843 errorCode = theCommander.SetSourceSampleRate(KExpectedSampleRate);
846 INFO_PRINTF2(_L("SetSourceSampleRate() is failed with %d "), errorCode);
849 errorCode = theCommander.SetSourceNumChannels(KExpectedSourceChannels);
852 INFO_PRINTF2(_L("SetSourceNumChannels() is failed with %d "), errorCode);
855 TFourCC theCodec('V', 'O', 'R', 'B');
856 errorCode = theCommander.SetSourceDataType(theCodec);
859 INFO_PRINTF2(_L("SetSourceDataType() is failed with %d "), errorCode);
862 errorCode = theCommander.SetCodec(theCodec, theCodec);
865 INFO_PRINTF2(_L("SetCodec() is failed with %d "), errorCode);
868 errorCode = theCommander.SetSourceFormat(KOggDecodeUid);
871 INFO_PRINTF2(_L("SetSourceFormat() is failed with %d "), errorCode);
880 * Test step constructor.
881 * It initialises its own name and the input filename
884 RTestStepOggCtrlPlayInvalid::RTestStepOggCtrlPlayInvalid(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
885 :RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
889 TVerdict RTestStepOggCtrlPlayInvalid::DoTestStepPreambleL(void)
895 * Do the test step(Negative Test).
896 * This test tries to open an invalid file. Expects KErrCurrupt from OggPlayController
898 TVerdict RTestStepOggCtrlPlayInvalid::DoTestStepL(void)
900 INFO_PRINTF1(_L("This test tries to open an invalid file using OggPlayController"));
901 iScheduler = new(ELeave)CActiveScheduler;
902 CleanupStack::PushL(iScheduler );
903 CActiveScheduler::Install(iScheduler );
905 iPriority.iPriority = 11; // set the priority to some default value
906 iPriority.iPref = EMdaPriorityPreferenceQuality;
907 iControllerEventMonitor = CMMFControllerEventMonitor::NewL(*this, iController);
908 TInt errorCode = iController.Open(KOggPlayControllerUid, iPriority);
911 INFO_PRINTF2(_L("Failed to load the controller %d "), errorCode);
912 return EInconclusive;
914 iControllerEventMonitor->Start();
915 SetupReadFileConfigL();
916 errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
917 if(errorCode != KErrCorrupt)
919 INFO_PRINTF2(_L("AddDataSource failed with %d "), errorCode);
926 * Test step constructor.
927 * It initialises its own name and the input filename
930 RTestStepOggCtrlSetInvalidConfig::RTestStepOggCtrlSetInvalidConfig(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
931 :RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
936 * Do the test step(Negative Test).
937 * This tests setting the an invalid SourceDataType on OggPlayController
938 * checks if the OggPlayController returns KErrNotSupported
940 TVerdict RTestStepOggCtrlSetInvalidConfig::DoTestStepL( void )
942 INFO_PRINTF1(_L("This tests setting an invalid SourceDataType on OggPlayController "));
943 RMMFAudioControllerCustomCommands theCommander( iController );
944 TFourCC theCodec(KMMFFourCCCodeIMAD);
945 TInt errorCode = theCommander.SetSourceDataType(theCodec);
946 if(errorCode != KErrNotSupported)
948 INFO_PRINTF2(_L("SetSourceDataType() with non vorbis failed to return KErrNotSupported but returned %d "), errorCode);
951 TUint newBitRate = 224000;
952 TUint newSampleRate = 8000;
953 TUint newSourceChannels = 1;
954 errorCode = theCommander.SetSourceBitRate(newBitRate);
955 if(errorCode != KErrNotSupported)
957 INFO_PRINTF2(_L("SetSourceBitRate() returned wrong error %d "), errorCode);
960 errorCode = theCommander.SetSourceSampleRate(newSampleRate);
961 if(errorCode != KErrNotSupported)
963 INFO_PRINTF2(_L("SetSourceSampleRate() returned wrong error %d "), errorCode);
966 errorCode = theCommander.SetSourceNumChannels(newSourceChannels);
967 if(errorCode != KErrNotSupported)
969 INFO_PRINTF2(_L("SetSourceNumChannels() returned wrong error %d "), errorCode);
972 errorCode = theCommander.SetSourceFormat(KOggEncodeUid);
973 if(errorCode != KErrNotSupported)
975 INFO_PRINTF2(_L("SetSourceFormat() returned wrong error %d "), errorCode);
983 * Test step constructor.
984 * It initialises its own name and the input filename
987 RTestStepOggCtrlPositionNegative::RTestStepOggCtrlPositionNegative(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
988 :RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
993 * Do the test step(Negative Test).
994 * This tests setting the Negative Position on OggPlayController
995 * checks if the Position set is to 0.
997 TVerdict RTestStepOggCtrlPositionNegative::DoTestStepL(void)
999 INFO_PRINTF1(_L("This tests setting the Negative Position on OggPlayController"));
1000 TInt errorCode = iController.Prime();
1003 INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
1004 return EInconclusive;
1006 errorCode = iController.SetPosition(-1);
1009 INFO_PRINTF2(_L("SetPosition() during Primed State is failed with %d "), errorCode);
1012 TTimeIntervalMicroSeconds theNewPosition;
1013 errorCode = iController.GetPosition(theNewPosition);
1016 INFO_PRINTF2(_L("GetPosition() during Primed State is failed with %d "), errorCode);
1020 if(theNewPosition != 0)
1022 INFO_PRINTF1(_L("Get Position is failed to return 0 when the position is set to a negative value"));