1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/src/Client/Audio/MmfFifo.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,108 @@
1.4 +// Copyright (c) 2001-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 +//
1.18 +
1.19 +#include "MmfFifo.h"
1.20 +
1.21 +const TInt TMMFFifoItemBase::iOffset = _FOFF(TMMFFifoItemBase, iSlink);
1.22 +
1.23 +
1.24 +/**
1.25 + *
1.26 + * Construct
1.27 + *
1.28 + */
1.29 +CMMFFifoBase::CMMFFifoBase() : iFifo(TMMFFifoItemBase::iOffset), iFifoIter(iFifo)
1.30 + {
1.31 + }
1.32 +
1.33 +
1.34 +/**
1.35 + *
1.36 + * Destructor
1.37 + *
1.38 + */
1.39 +CMMFFifoBase::~CMMFFifoBase()
1.40 + {
1.41 + TMMFFifoItemBase* item;
1.42 + iFifoIter.SetToFirst();
1.43 + while((item = iFifoIter++)!=NULL)
1.44 + {
1.45 + iFifo.Remove(*item);
1.46 + delete item;
1.47 + };
1.48 + }
1.49 +
1.50 +
1.51 +/**
1.52 + *
1.53 + * To remove the first stream data from queue
1.54 + *
1.55 + */
1.56 +void CMMFFifoBase::RemoveFirstItemBase()
1.57 + {
1.58 + if(!iFifo.IsEmpty())
1.59 + {
1.60 + iFifo.Remove(*iFifo.First());
1.61 + }
1.62 + }
1.63 +
1.64 +/**
1.65 + *
1.66 + * To get the first stream data from queue
1.67 + *
1.68 + * @return "CMMFFifoItem*"
1.69 + * a pointer point to the stream data
1.70 + *
1.71 + */
1.72 +TMMFFifoItemBase* CMMFFifoBase::GetBase()
1.73 + {
1.74 + TMMFFifoItemBase* firstItem;
1.75 + if(iFifo.IsEmpty())
1.76 + return NULL;
1.77 + firstItem = iFifo.First();
1.78 + return firstItem;
1.79 + }
1.80 +
1.81 +/**
1.82 + *
1.83 + * To add a stream data to the queue, the data will be added at end of queue
1.84 + *
1.85 + * @param "TMMFFifoItemBase& aItem"
1.86 + * a reference to data
1.87 + *
1.88 + */
1.89 +void CMMFFifoBase::AddToFifo(TMMFFifoItemBase& aItem)
1.90 + {
1.91 + iFifo.AddLast(aItem);
1.92 + }
1.93 +
1.94 +/**
1.95 + *
1.96 + * To check stream data queue empty or not
1.97 + *
1.98 + * @return "TBool"
1.99 + * a boolean value to indicate the queue is empty or not (ETrue is empty)
1.100 + *
1.101 + */
1.102 +TBool CMMFFifoBase::IsEmpty()
1.103 + {
1.104 + return iFifo.IsEmpty();
1.105 + }
1.106 +
1.107 +
1.108 +
1.109 +
1.110 +
1.111 +