1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/src/Client/Video/Mmfclientvideocallback.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,110 @@
1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// MmfVideoCallback.cpp
1.18 +//
1.19 +//
1.20 +
1.21 +#include "mmfvideocallback.h"
1.22 +
1.23 +CMMFVideoPlayerCallback::~CMMFVideoPlayerCallback()
1.24 + {
1.25 + }
1.26 +
1.27 +CMMFVideoPlayerCallback::CMMFVideoPlayerCallback(MVideoPlayerUtilityObserver& aCallback)
1.28 + : CActive(EPriorityStandard), iCallback(aCallback)
1.29 + {
1.30 + CActiveScheduler::Add(this);
1.31 + }
1.32 +
1.33 +void CMMFVideoPlayerCallback::SetFrame(CFbsBitmap& aBitmap)
1.34 + {
1.35 + iEvent = EFrameReadyEvent;
1.36 + iBitmap = &aBitmap;
1.37 + }
1.38 +
1.39 +void CMMFVideoPlayerCallback::RunL()
1.40 + {
1.41 + switch (iEvent)
1.42 + {
1.43 + case EOpenCompleteEvent: iCallback.MvpuoOpenComplete(iStatus.Int());
1.44 + break;
1.45 + case EFrameReadyEvent: ASSERT(iBitmap);
1.46 + iCallback.MvpuoFrameReady(*iBitmap,iStatus.Int());
1.47 + break;
1.48 + case EPlayCompleteEvent: iCallback.MvpuoPlayComplete(iStatus.Int());
1.49 + break;
1.50 + default: ASSERT(EFalse);
1.51 + break;
1.52 + }
1.53 + }
1.54 +
1.55 +void CMMFVideoPlayerCallback::DoCancel()
1.56 + {
1.57 + }
1.58 +
1.59 +void CMMFVideoPlayerCallback::Signal(const TInt aReason, TCallbackEvent aEvent)
1.60 + {
1.61 + ASSERT(!IsActive());
1.62 + iEvent = aEvent;
1.63 + // Signal ourselves to run with the given completion code
1.64 + TRequestStatus* status = &iStatus;
1.65 + User::RequestComplete(status, aReason);
1.66 + SetActive();
1.67 + }
1.68 +
1.69 +TRequestStatus& CMMFVideoPlayerCallback::ActiveStatus()
1.70 + {
1.71 + SetActive();
1.72 + return iStatus;
1.73 + }
1.74 +
1.75 +
1.76 +CMMFVideoRecorderCallback::~CMMFVideoRecorderCallback()
1.77 + {
1.78 + }
1.79 +
1.80 +CMMFVideoRecorderCallback::CMMFVideoRecorderCallback(MVideoRecorderUtilityObserver& aCallback)
1.81 + : CActive(EPriorityStandard), iCallback(aCallback)
1.82 + {
1.83 + CActiveScheduler::Add(this);
1.84 + }
1.85 +
1.86 +void CMMFVideoRecorderCallback::RunL()
1.87 + {
1.88 + switch (iEvent)
1.89 + {
1.90 + case EOpenCompleteEvent: iCallback.MvruoOpenComplete(iStatus.Int());
1.91 + break;
1.92 + case EPrepareCompleteEvent: iCallback.MvruoPrepareComplete(iStatus.Int());
1.93 + break;
1.94 + case ERecordCompleteEvent: iCallback.MvruoRecordComplete(iStatus.Int());
1.95 + break;
1.96 + default: ASSERT(EFalse);
1.97 + break;
1.98 + }
1.99 + }
1.100 +
1.101 +void CMMFVideoRecorderCallback::DoCancel()
1.102 + {
1.103 + }
1.104 +
1.105 +void CMMFVideoRecorderCallback::Signal(const TInt aReason, TCallbackEvent aEvent)
1.106 + {
1.107 + ASSERT(!IsActive());
1.108 + iEvent = aEvent;
1.109 + // Signal ourselves to run with the given completion code
1.110 + TRequestStatus* status = &iStatus;
1.111 + User::RequestComplete(status, aReason);
1.112 + SetActive();
1.113 + }