os/mm/mdfdevvideoextensions/nga_mdf_postprocessor/src/NGAPostProcSessionManager.cpp
Update contrib.
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
20 #include <graphics/surfaceupdateclient.h> //RSurfaceUpdateSession
21 #include <graphics/surfacemanager.h> //RSurfaceManager
22 #include <graphics/suerror.h> //KAllScreens
24 #include "NGAPostProcSessionManager.h"
25 #include "NGAPostProcSessionManagerObserver.h"
26 #include "MdfRDebug.h"
27 #include "NGAPostProcNotifier.h"
30 const TInt KMessageSlots = 4;
32 //**************************************************
34 CNGAPostProcSessionManager* CNGAPostProcSessionManager::NewL()
36 PP_DEBUG(_L("CNGAPostProcSessionManager:NewL() ++"));
38 CNGAPostProcSessionManager* self = new (ELeave) CNGAPostProcSessionManager;
39 CleanupStack::PushL(self);
43 PP_DEBUG(_L("CNGAPostProcSessionManager:NewL() --"));
47 CNGAPostProcSessionManager::CNGAPostProcSessionManager()
48 :iSurfaceUpdateSession(NULL),
54 void CNGAPostProcSessionManager::ConstructL()
56 PP_DEBUG(_L("CNGAPostProcSessionManager[%x]:ConstructL() ++"), this);
58 iSurfaceUpdateSession = new (ELeave) RSurfaceUpdateSession();
59 User::LeaveIfError(iSurfaceUpdateSession->Connect(KMessageSlots));
61 PP_DEBUG(_L("CNGAPostProcSessionManager[%x]:ConstructL() --"), this);
64 CNGAPostProcSessionManager::~CNGAPostProcSessionManager()
66 PP_DEBUG(_L("CNGAPostProcSessionManager[%x]:~() ++"), this);
67 if(iSurfaceUpdateSession)
69 iSurfaceUpdateSession->Close();
70 delete iSurfaceUpdateSession;
71 iSurfaceUpdateSession = NULL;
73 while (iAOList.Count()>0)
75 CNGAPostProcNotifier* notifier = iAOList[0];
83 PP_DEBUG(_L("CNGAPostProcSessionManager[%x]:~() --"), this);
86 void CNGAPostProcSessionManager::PostPicture(const TSurfaceId& aSurfaceId,
87 TInt aBufId, TInt aNumOfBuf, TBool aNotifyRequired)
89 PP_DEBUG(_L("CNGAPostProcSessionManager[%x]:PostPicture() ++"), this);
93 CNGAPostProcNotifier* iNotifier;
94 if ( iAOList.Count() <= aNumOfBuf )
96 TRAP(err, iNotifier = CNGAPostProcNotifier::NewL(*this));
99 PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:Initialize -- failed to create CNGAPostProcNotifier %d."), this, err);
105 for(TInt j=0; j < iAOList.Count(); j++)
107 iNotifier = iAOList[j];
108 if(!iNotifier->IsActive())
116 iNotifier->SetBufferId(aBufId);
117 iNotifier->Activate();
118 iSurfaceUpdateSession->NotifyWhenAvailable(iNotifier->iStatus);
119 iAOList.Append(iNotifier);
121 iSurfaceUpdateSession->SubmitUpdate(KAllScreens, aSurfaceId, aBufId);
123 PP_DEBUG(_L("CNGAPostProcSessionManager[%x]:PostPicture() -- "), this);
126 void CNGAPostProcSessionManager::CancelUpdate()
128 PP_DEBUG(_L("CNGAPostProcSessionManager[%x]:SetClockSource() ++"), this);
129 iSurfaceUpdateSession->CancelAllUpdateNotifications();
130 PP_DEBUG(_L("CNGAPostProcSessionManager[%x]:SetClockSource() --"), this);
133 void CNGAPostProcSessionManager::HandleBufferRelease(TInt aBufId, TInt aStatus)
135 PP_DEBUG(_L("CNGAPostProcSessionManager[%x]:HandleBufferRelease() ++"), this);
138 iObserver->BufferAvailable(aBufId, aStatus);
140 PP_DEBUG(_L("CNGAPostProcSessionManager[%x]:HandleBufferRelease() --"), this);
143 void CNGAPostProcSessionManager::SetObserver(MNGAPostProcSessionManagerObserver& aObserver)
145 PP_DEBUG(_L("CNGAPostProcSessionManager[%x]:SetClockSource() ++"), this);
146 iObserver = &aObserver;
147 PP_DEBUG(_L("CNGAPostProcSessionManager[%x]:SetClockSource() --"), this);