diff -r 0fd27995241b -r 9ac0a0a7da70 javauis/mmapi_qt/baseline/src/cmmammfratecontrol.cpp --- a/javauis/mmapi_qt/baseline/src/cmmammfratecontrol.cpp Tue May 11 16:07:20 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This class implements generic RateControl functionality. -* -*/ - - -// INCLUDE FILES -#include -#include - -#include "cmmammfratecontrol.h" - -namespace -{ -const TInt KErrorMessageSize = 32; -_LIT(KErrDefaultError, "Symbian OS Error: %d"); -} - -CMMAMMFRateControl* CMMAMMFRateControl::NewL(CMMAMMFPlayerBase* aPlayer) -{ - CMMAMMFRateControl* self = new(ELeave) CMMAMMFRateControl(aPlayer); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); - return self; -} - -CMMAMMFRateControl::~CMMAMMFRateControl() -{ - LOG( EJavaMMAPI, EInfo, "MMA:CMMAMMFRateControl::~CMMAMMFRateControl"); -} - -CMMAMMFRateControl::CMMAMMFRateControl(CMMAMMFPlayerBase* aPlayer) : - iPlayer(aPlayer), iCurrentRate(KMMADefaultRate) -{ - LOG( EJavaMMAPI, EInfo, "MMA:CMMAMMFRateControl::CMMAMMFRateControl"); -} - -void CMMAMMFRateControl::ConstructL() -{ - iPlayer->AddStateListenerL(this); -} - -void CMMAMMFRateControl::StateChanged(TInt aState) -{ - LOG( EJavaMMAPI, EInfo, "MMA:CMMAMMFRateControl::StateChanged"); - if (aState == CMMAPlayer::EStarted && iCurrentRate == KMMAMinRate) - { - RMMFController& controller = iPlayer->Controller(); - TInt err = controller.Pause(); - if ((err != KErrNone) && (err != KErrNotReady)) - { - ELOG1( EJavaMMAPI, "CMMAMMFRateControl::StateChanged: Pause error %d", err); - TBuf errorMessage; - errorMessage.Format(KErrDefaultError, err); - iPlayer->PostStringEvent(CMMAPlayerEvent::EError, errorMessage); - } - } -} - -TInt CMMAMMFRateControl::SetRateL(TInt aRate) -{ - LOG( EJavaMMAPI, EInfo, "MMA:CMMAMMFRateControl::SetRateL"); - RMMFController& controller = iPlayer->Controller(); - - TInt newRate; - if (aRate <= KMMAMinRate) - { - newRate = KMMAMinRate; - } - else - { - newRate = KMMADefaultRate; - } - - if ((iPlayer->State() == CMMAPlayer::EStarted) && - (newRate != iCurrentRate)) - { - if (newRate == KMMAMinRate) - { - TInt err = controller.Pause(); - if ((err != KErrNone) && (err != KErrNotReady)) - { - User::Leave(err); - } - } - else - { - User::LeaveIfError(controller.Play()); - } - } - iCurrentRate = newRate; - return iCurrentRate; -} - -TInt CMMAMMFRateControl::RateL() -{ - return iCurrentRate; -} - - -// END OF FILE