mmlibs/mmfw/src/ControllerFramework/MMFVideoFrameMessage.cpp
changeset 0 b8ed18f6c07b
equal deleted inserted replaced
-1:000000000000 0:b8ed18f6c07b
       
     1 // Copyright (c) 2002-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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // VideoFrameMessage.cpp
       
    15 // 
       
    16 //
       
    17 
       
    18 #include <mmf/common/mmfcontrollerframework.h>
       
    19 #include <fbs.h>
       
    20 #include "MMFVideoFrameMessage.h"
       
    21 
       
    22 /**
       
    23 Handles decoding the video frame message and providing a reference to the bitmap
       
    24 to modify for the user of the class.
       
    25 Provides a callback to return the message to the client
       
    26 */
       
    27 CMMFVideoFrameMessage* CMMFVideoFrameMessage::NewL(TMMFMessage& aMessage)
       
    28 	{
       
    29 	CMMFVideoFrameMessage * self = new (ELeave) CMMFVideoFrameMessage(aMessage);
       
    30 	CleanupStack::PushL(self);
       
    31 	self->ConstructL();
       
    32 	CleanupStack::Pop(self);
       
    33 	return self;
       
    34 	}
       
    35 
       
    36 CFbsBitmap& CMMFVideoFrameMessage::GetBitmap()
       
    37 	{
       
    38 	return *iBitmap;
       
    39 	}
       
    40 void CMMFVideoFrameMessage::FrameReady(TInt aErr)
       
    41 	{
       
    42 	iMessage.Complete(aErr);
       
    43 	}
       
    44 
       
    45 CMMFVideoFrameMessage::CMMFVideoFrameMessage(TMMFMessage& aMessage)
       
    46 	: iMessage(aMessage)
       
    47 	{
       
    48 	}
       
    49 
       
    50 void CMMFVideoFrameMessage::ConstructL()
       
    51 	{
       
    52 	TPckgBuf<TMMFVideoConfig> pckg;
       
    53 	iMessage.ReadData1FromClientL(pckg);
       
    54 	iFbsSession.Connect();
       
    55 	iBitmap = new (ELeave) CFbsBitmap;
       
    56 	User::LeaveIfError(iBitmap->Duplicate(pckg().iFrameBitmapServerHandle));
       
    57 	}
       
    58 
       
    59 CMMFVideoFrameMessage::~CMMFVideoFrameMessage()
       
    60 	{
       
    61 	delete iBitmap;
       
    62 	iFbsSession.Disconnect();
       
    63 	}
       
    64 
       
    65