os/mm/mmswadaptation/videorenderer/inc/buffermanager.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2007-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 //
    15 
    16 /**
    17  @file
    18  @internalComponent
    19 */
    20 
    21 #ifndef BUFFERMANAGER_H
    22 #define BUFFERMANAGER_H
    23 
    24 #include <e32std.h>
    25 #include <e32base.h>
    26 #include <e32cmn.h>
    27 #include <graphics/surfacemanager.h>
    28 
    29 // class declaration
    30 class TVideoFrameBuffer;
    31 
    32 /** Buffer manager for video renderer */
    33 NONSHARABLE_CLASS(CRendererBufferManager) : public CBase
    34 	{
    35 public:
    36 	static CRendererBufferManager* NewL(const RSurfaceManager::TSurfaceInfoV01& aSurfaceInfo, const RArray<TInt>& aBufferOffsets, const RChunk& aChunk, TBool aTimed);
    37 	~CRendererBufferManager();
    38 	TVideoFrameBuffer* NextBuffer();
    39 	TBool ReleaseBuffer(TVideoFrameBuffer* aBuffer);
    40 	TBool UpdateBuffer(TVideoFrameBuffer* aBuffer, const TTime& aTime);
    41 	void BufferAvailable(TInt aBufferId);
    42 	TVideoFrameBuffer* WaitingBuffer(TBool aRemoveFromList, TBool& aIsLast);
    43 	void BufferSubmitted(TVideoFrameBuffer* aBuffer);
    44 	TBool WaitingListIsEmpty();
    45 
    46 private:
    47 	CRendererBufferManager(const RChunk& aChunk, TBool aTimed);
    48 	void ConstructL(const RSurfaceManager::TSurfaceInfoV01& aSurfaceInfo, const RArray<TInt>& aBufferOffsets);
    49 	TBool BufferUsedByClient(TVideoFrameBuffer* aBuffer);
    50 	void Lock();
    51 	void Unlock();
    52 
    53 private:
    54 	RChunk iChunk;
    55 	TBool iTimed;
    56 	RPointerArray<TVideoFrameBuffer> iBuffers;
    57 	TDblQue<TVideoFrameBuffer> iAvailBuffers;
    58 	TDblQue<TVideoFrameBuffer> iWaitingBuffers; // buffers waiting to be submitted
    59 	TDblQueIter<TVideoFrameBuffer> iWaitingBuffersIter;
    60 	RMutex iMutex;
    61 	};
    62 
    63 #endif // BUFFERMANAGER_H