os/mm/mmlibs/mmfw/src/server/BaseClasses/mmfvideoframebuffer.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmlibs/mmfw/src/server/BaseClasses/mmfvideoframebuffer.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,103 @@
     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 +// source\mmf\server\baseclasses\mmfvideoframebuffer.cpp
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#include "mmfvideoframebuffer.h"
    1.22 +
    1.23 +
    1.24 +/**
    1.25 +Factory function to create objects of type CMMFYUVBuffer used
    1.26 +to store a frame using YUV data. Allocates and constructs a YUV frame buffer.
    1.27 +
    1.28 +@return	A pointer to a fully constructed CMMFYUVBuffer.
    1.29 +*/
    1.30 +EXPORT_C CMMFYUVBuffer* CMMFYUVBuffer::NewL()
    1.31 +	{
    1.32 +	CMMFYUVBuffer* self = new(ELeave) CMMFYUVBuffer;
    1.33 +	CleanupStack::PushL(self);
    1.34 +	self->ConstructL();
    1.35 +	CleanupStack::Pop(); // self
    1.36 +	return self;
    1.37 +	}
    1.38 +
    1.39 +
    1.40 +void CMMFYUVBuffer::ConstructL()
    1.41 +	{
    1.42 +	}
    1.43 +
    1.44 +/**
    1.45 +Destructor.
    1.46 +*/
    1.47 +EXPORT_C CMMFYUVBuffer::~CMMFYUVBuffer()
    1.48 +	{
    1.49 +	delete iYUVBuffer;
    1.50 +	}
    1.51 +
    1.52 +/**
    1.53 +Destructor.
    1.54 +*/
    1.55 +EXPORT_C CMMFBitmapFrameBuffer::~CMMFBitmapFrameBuffer()
    1.56 +	{
    1.57 +	if (iFrame) iFrame->Reset(); //release bitmap handle
    1.58 +	delete iFrame;
    1.59 +	}
    1.60 +
    1.61 +/**
    1.62 +Factory function to create objects of type CMMFBitmapFrameBuffer used
    1.63 +to store a frame an EPOC bitmap.
    1.64 +Allocates and constructs a bitmap frame buffer with the specified size
    1.65 +and display mode.
    1.66 +
    1.67 +@param  aSize
    1.68 +        The bitmap frame buffer size.
    1.69 +@param  aDisplayMode
    1.70 +        The display mode.
    1.71 +
    1.72 +@return A pointer to a fully constructed CMMFBitmapFrameBuffer.
    1.73 +*/
    1.74 +EXPORT_C CMMFBitmapFrameBuffer* CMMFBitmapFrameBuffer::NewL(const TSize& aSize,TDisplayMode aDisplayMode)
    1.75 +	{
    1.76 +	CMMFBitmapFrameBuffer* self = new(ELeave) CMMFBitmapFrameBuffer;
    1.77 +	CleanupStack::PushL(self);
    1.78 +	self->ConstructL();
    1.79 +	User::LeaveIfError(self->iFrame->Create(aSize,aDisplayMode));
    1.80 +	CleanupStack::Pop(); // self
    1.81 +	return self;
    1.82 +	}
    1.83 +
    1.84 +/**
    1.85 +Factory function to create objects of type CMMFBitmapFrameBuffer used
    1.86 +to store a frame using an EPOC bitmap.
    1.87 +
    1.88 +@param  aBitmapHandle
    1.89 +        The handle to the bitmap from which to make a copy.
    1.90 +
    1.91 +@return A pointer to a fully constructed CMMFBitmapFrameBuffer.
    1.92 +*/
    1.93 +EXPORT_C CMMFBitmapFrameBuffer* CMMFBitmapFrameBuffer::NewL(TInt aBitmapHandle)
    1.94 +	{
    1.95 +	CMMFBitmapFrameBuffer* self = new(ELeave) CMMFBitmapFrameBuffer;
    1.96 +	CleanupStack::PushL(self);
    1.97 +	self->ConstructL();
    1.98 +	User::LeaveIfError(self->iFrame->Duplicate(aBitmapHandle));
    1.99 +	CleanupStack::Pop(); // self
   1.100 +	return self;
   1.101 +	}
   1.102 +
   1.103 +void CMMFBitmapFrameBuffer::ConstructL()
   1.104 +	{
   1.105 +	iFrame = new(ELeave)CFbsBitmap;
   1.106 +	}