diff -r 000000000000 -r bde4ae8d615e os/mm/mmswadaptation/videorenderer/src/resourcefilereader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os/mm/mmswadaptation/videorenderer/src/resourcefilereader.cpp Fri Jun 15 03:10:57 2012 +0200 @@ -0,0 +1,88 @@ +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file + @internalComponent +*/ + +#include +#include +#include +#include "resourcefilereader.h" +#include "rendererutil.h" + + +CResourceFileReader* CResourceFileReader::NewL(const TDesC& aResourceFile) + { + CResourceFileReader* self = CResourceFileReader::NewLC(aResourceFile); + CleanupStack::Pop(self); + return self; + } + +CResourceFileReader* CResourceFileReader::NewLC(const TDesC& aResourceFile) + { + CResourceFileReader* self = new (ELeave) CResourceFileReader(); + CleanupStack::PushL(self); + self->ConstructL(aResourceFile); + return self; + } + +CResourceFileReader::CResourceFileReader() + { + } + +void CResourceFileReader::ConstructL(const TDesC& aResourceFile) + { + User::LeaveIfError(iFs.Connect()); + iResourceFile.OpenL(iFs, aResourceFile); + } + +CResourceFileReader::~CResourceFileReader() + { + iResourceFile.Close(); + iFs.Close(); + } + +void CResourceFileReader::ReadSupportedFormatL(RArray& aArray) + { + aArray.Reset(); // first clear the old data + + HBufC8* res = iResourceFile.AllocReadLC(GCE_SUPPORTED_FORMAT); + TResourceReader reader; + reader.SetBuffer(res); + + TInt count = reader.ReadInt16(); + for (TInt i = 0; i < count; ++i) + { + TVideoRendererPixelFormat format = static_cast(reader.ReadUint32()); + TUncompressedVideoFormat uncompressedFormat = VideoRendererUtil::ConvertPixelFormatToUncompressedVideoFormatL(format); + aArray.AppendL(uncompressedFormat); + } + + CleanupStack::PopAndDestroy(res); + } + +void CResourceFileReader::ReadTimerInfoL(TInt64& aDefaultDelay, TInt64& aMaxDelay) + { + HBufC8* res = iResourceFile.AllocReadLC(TIMER); + TResourceReader reader; + reader.SetBuffer(res); + + aDefaultDelay = static_cast(reader.ReadInt32()); + aMaxDelay = static_cast(reader.ReadInt32()); + + CleanupStack::PopAndDestroy(res); + }