--- a/tsrc/xmltestharness/group/bld.inf Wed Aug 25 12:40:50 2010 +0300
+++ b/tsrc/xmltestharness/group/bld.inf Fri Sep 03 07:55:02 2010 +0300
@@ -1,20 +1,20 @@
-/*
-* Copyright (c) 2008-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:
-*
-*/
-#include "../tools/t_videoframesupplier/group/bld.inf"
-#include "../xmlclient/group/bld.inf"
-#include "../te_xmlomxclient/group/bld.inf"
-
+/*
+* Copyright (c) 2008-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:
+*
+*/
+#include "../tools/t_videoframesupplier/group/bld.inf"
+#include "../xmlclient/group/bld.inf"
+#include "../te_xmlomxclient/group/bld.inf"
+
--- a/tsrc/xmltestharness/tools/group/bld.inf Wed Aug 25 12:40:50 2010 +0300
+++ b/tsrc/xmltestharness/tools/group/bld.inf Fri Sep 03 07:55:02 2010 +0300
@@ -1,18 +1,18 @@
-/*
-* Copyright (c) 2010 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:
-*
-*/
-
+/*
+* Copyright (c) 2010 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:
+*
+*/
+
#include "../t_videoframesupplier/group/bld.inf"
\ No newline at end of file
--- a/tsrc/xmltestharness/tools/t_videoframesupplier/bwins/t_videoframesupplieru.def Wed Aug 25 12:40:50 2010 +0300
+++ b/tsrc/xmltestharness/tools/t_videoframesupplier/bwins/t_videoframesupplieru.def Fri Sep 03 07:55:02 2010 +0300
@@ -1,8 +1,8 @@
-EXPORTS
- ?NewL@CVideoFrameSupplier@@SAPAV1@ABVTDesC16@@W4TVideoFileType@1@@Z @ 1 NONAME ; class CVideoFrameSupplier * CVideoFrameSupplier::NewL(class TDesC16 const &, enum CVideoFrameSupplier::TVideoFileType)
- ?LargestFrameSize@CVideoFrameSupplier@@QBEHXZ @ 2 NONAME ; int CVideoFrameSupplier::LargestFrameSize(void) const
- ??1CVideoFrameSupplier@@UAE@XZ @ 3 NONAME ; CVideoFrameSupplier::~CVideoFrameSupplier(void)
- ?NextFrameData@CVideoFrameSupplier@@QAEHPAEAAH@Z @ 4 NONAME ; int CVideoFrameSupplier::NextFrameData(unsigned char *, int &)
- ?IsLastFrame@CVideoFrameSupplier@@QBEHXZ @ 5 NONAME ; int CVideoFrameSupplier::IsLastFrame(void) const
- ?CurrentFrame@CVideoFrameSupplier@@QBEHXZ @ 6 NONAME ; int CVideoFrameSupplier::CurrentFrame(void) const
-
+EXPORTS
+ ?NewL@CVideoFrameSupplier@@SAPAV1@ABVTDesC16@@W4TVideoFileType@1@@Z @ 1 NONAME ; class CVideoFrameSupplier * CVideoFrameSupplier::NewL(class TDesC16 const &, enum CVideoFrameSupplier::TVideoFileType)
+ ?LargestFrameSize@CVideoFrameSupplier@@QBEHXZ @ 2 NONAME ; int CVideoFrameSupplier::LargestFrameSize(void) const
+ ??1CVideoFrameSupplier@@UAE@XZ @ 3 NONAME ; CVideoFrameSupplier::~CVideoFrameSupplier(void)
+ ?NextFrameData@CVideoFrameSupplier@@QAEHPAEAAH@Z @ 4 NONAME ; int CVideoFrameSupplier::NextFrameData(unsigned char *, int &)
+ ?IsLastFrame@CVideoFrameSupplier@@QBEHXZ @ 5 NONAME ; int CVideoFrameSupplier::IsLastFrame(void) const
+ ?CurrentFrame@CVideoFrameSupplier@@QBEHXZ @ 6 NONAME ; int CVideoFrameSupplier::CurrentFrame(void) const
+
--- a/tsrc/xmltestharness/tools/t_videoframesupplier/eabi/t_videoframesupplieru.def Wed Aug 25 12:40:50 2010 +0300
+++ b/tsrc/xmltestharness/tools/t_videoframesupplier/eabi/t_videoframesupplieru.def Fri Sep 03 07:55:02 2010 +0300
@@ -1,12 +1,12 @@
-EXPORTS
- _ZN19CVideoFrameSupplier13NextFrameDataEPhRi @ 1 NONAME
- _ZN19CVideoFrameSupplier4NewLERK7TDesC16NS_14TVideoFileTypeE @ 2 NONAME
- _ZN19CVideoFrameSupplierD0Ev @ 3 NONAME
- _ZN19CVideoFrameSupplierD1Ev @ 4 NONAME
- _ZN19CVideoFrameSupplierD2Ev @ 5 NONAME
- _ZNK19CVideoFrameSupplier11IsLastFrameEv @ 6 NONAME
- _ZNK19CVideoFrameSupplier12CurrentFrameEv @ 7 NONAME
- _ZNK19CVideoFrameSupplier16LargestFrameSizeEv @ 8 NONAME
- _ZTI19CVideoFrameSupplier @ 9 NONAME
- _ZTV19CVideoFrameSupplier @ 10 NONAME
-
+EXPORTS
+ _ZN19CVideoFrameSupplier13NextFrameDataEPhRi @ 1 NONAME
+ _ZN19CVideoFrameSupplier4NewLERK7TDesC16NS_14TVideoFileTypeE @ 2 NONAME
+ _ZN19CVideoFrameSupplierD0Ev @ 3 NONAME
+ _ZN19CVideoFrameSupplierD1Ev @ 4 NONAME
+ _ZN19CVideoFrameSupplierD2Ev @ 5 NONAME
+ _ZNK19CVideoFrameSupplier11IsLastFrameEv @ 6 NONAME
+ _ZNK19CVideoFrameSupplier12CurrentFrameEv @ 7 NONAME
+ _ZNK19CVideoFrameSupplier16LargestFrameSizeEv @ 8 NONAME
+ _ZTI19CVideoFrameSupplier @ 9 NONAME
+ _ZTV19CVideoFrameSupplier @ 10 NONAME
+
--- a/tsrc/xmltestharness/tools/t_videoframesupplier/group/bld.inf Wed Aug 25 12:40:50 2010 +0300
+++ b/tsrc/xmltestharness/tools/t_videoframesupplier/group/bld.inf Fri Sep 03 07:55:02 2010 +0300
@@ -1,27 +1,27 @@
-/*
-* Copyright (c) 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:
-*
-*/
-
-PRJ_PLATFORMS
-DEFAULT
-ARMv6
-
-PRJ_TESTEXPORTS
-..\inc\t_videoframesupplier.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(multimedia/t_videoframesupplier.h)
-t_videoframesupplier.iby /epoc32/rom/include/t_videoframesupplier.iby
-
-PRJ_TESTMMPFILES
-t_videoframesupplier.mmp
+/*
+* Copyright (c) 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:
+*
+*/
+
+PRJ_PLATFORMS
+DEFAULT
+ARMv6
+
+PRJ_TESTEXPORTS
+..\inc\t_videoframesupplier.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(multimedia/t_videoframesupplier.h)
+t_videoframesupplier.iby /epoc32/rom/include/t_videoframesupplier.iby
+
+PRJ_TESTMMPFILES
+t_videoframesupplier.mmp
--- a/tsrc/xmltestharness/tools/t_videoframesupplier/group/t_videoframesupplier.iby Wed Aug 25 12:40:50 2010 +0300
+++ b/tsrc/xmltestharness/tools/t_videoframesupplier/group/t_videoframesupplier.iby Fri Sep 03 07:55:02 2010 +0300
@@ -1,23 +1,23 @@
-/*
-* Copyright (c) 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:
-*
-*/
-
-#ifndef __T_VIDEOFRAMESUPPLIER_IBY__
-#define __T_VIDEOFRAMESUPPLIER_IBY__
-
-file=ABI_DIR\BUILD_DIR\t_videoframesupplier.dll System\Libs\t_videoframesupplier.dll
-
-#endif
+/*
+* Copyright (c) 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:
+*
+*/
+
+#ifndef __T_VIDEOFRAMESUPPLIER_IBY__
+#define __T_VIDEOFRAMESUPPLIER_IBY__
+
+file=ABI_DIR\BUILD_DIR\t_videoframesupplier.dll System\Libs\t_videoframesupplier.dll
+
+#endif
--- a/tsrc/xmltestharness/tools/t_videoframesupplier/group/t_videoframesupplier.mmp Wed Aug 25 12:40:50 2010 +0300
+++ b/tsrc/xmltestharness/tools/t_videoframesupplier/group/t_videoframesupplier.mmp Fri Sep 03 07:55:02 2010 +0300
@@ -1,38 +1,38 @@
-/*
-* Copyright (c) 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:
-*
-*/
-
-TARGET t_videoframesupplier.dll
-TARGETTYPE dll
-UID 0x1000008d 0xEDB08359
-CAPABILITY All -TCB
-
-OS_LAYER_SYSTEMINCLUDE_SYMBIAN
-
-USERINCLUDE ..\inc
-
-SOURCEPATH ..\src
-
-SOURCE t_videoframesupplier.cpp
-SOURCE t_videoframesupplierDllMain.cpp
-
-LIBRARY euser.lib
-LIBRARY efsrv.lib
-
-#ifdef ENABLE_ABIV2_MODE
- DEBUGGABLE_UDEBONLY
-#endif
-
+/*
+* Copyright (c) 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:
+*
+*/
+
+TARGET t_videoframesupplier.dll
+TARGETTYPE dll
+UID 0x1000008d 0xEDB08359
+CAPABILITY All -TCB
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+USERINCLUDE ..\inc
+
+SOURCEPATH ..\src
+
+SOURCE t_videoframesupplier.cpp
+SOURCE t_videoframesupplierDllMain.cpp
+
+LIBRARY euser.lib
+LIBRARY efsrv.lib
+
+#ifdef ENABLE_ABIV2_MODE
+ DEBUGGABLE_UDEBONLY
+#endif
+
--- a/tsrc/xmltestharness/tools/t_videoframesupplier/inc/t_videoframesupplier.h Wed Aug 25 12:40:50 2010 +0300
+++ b/tsrc/xmltestharness/tools/t_videoframesupplier/inc/t_videoframesupplier.h Fri Sep 03 07:55:02 2010 +0300
@@ -1,83 +1,83 @@
-/*
-* Copyright (c) 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:
-*
-*/
-
-#ifndef __T_VIDEOFRAMESUPPLIER_H__
-#define __T_VIDEOFRAMESUPPLIER_H__
-
-
-#include <e32base.h>
-#include <e32std.h>
-#include <f32file.h>
-
-typedef struct
- {
- TInt iPosition; // From start of the file.
- TInt iLength;
- }
-TFrameData;
-
-typedef enum
- {
- ESearchForZero = 0,
- ESearchForZeroZero,
- ESearchForZeroZeroOne,
- ESearchForStartCode,
- EBeginningOfFrame
- }
-TMPEG4ParseState;
-
-//
-//
-//
-class CVideoFrameSupplier : public CBase
- {
-public:
-
- typedef enum
- {
- EVideoFileTypeMPEG4
- }
- TVideoFileType;
-
- IMPORT_C static CVideoFrameSupplier* NewL(const TDesC& aFileName, TVideoFileType aFileType);
- IMPORT_C ~CVideoFrameSupplier();
-
-public:
- IMPORT_C TInt LargestFrameSize() const;
- IMPORT_C TInt CurrentFrame() const;
- IMPORT_C TInt NextFrameData(TUint8* aPtr, TInt& aFrameLength);
- IMPORT_C TBool IsLastFrame() const;
-
-private:
- CVideoFrameSupplier();
- void ConstructL(const TDesC& aFileName, TVideoFileType aFileType);
- void ParseMPEG4FileL();
- TInt AppendFrameData(TInt aPosition, TInt aLength);
- TInt ProcessMPEG4Byte(TUint8 aByte, TInt aBytePosition);
-
-private:
- RFs iFs;
- RFile iFile;
- RArray<TFrameData> iFrames;
- TInt iLargestFrameSize;
- TInt iCurrentFrame;
- TMPEG4ParseState iState;
- TInt iFrameStartPosition;
- };
-
-#endif // __T_VIDEOFRAMESUPPLIER_H__
-
+/*
+* Copyright (c) 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:
+*
+*/
+
+#ifndef __T_VIDEOFRAMESUPPLIER_H__
+#define __T_VIDEOFRAMESUPPLIER_H__
+
+
+#include <e32base.h>
+#include <e32std.h>
+#include <f32file.h>
+
+typedef struct
+ {
+ TInt iPosition; // From start of the file.
+ TInt iLength;
+ }
+TFrameData;
+
+typedef enum
+ {
+ ESearchForZero = 0,
+ ESearchForZeroZero,
+ ESearchForZeroZeroOne,
+ ESearchForStartCode,
+ EBeginningOfFrame
+ }
+TMPEG4ParseState;
+
+//
+//
+//
+class CVideoFrameSupplier : public CBase
+ {
+public:
+
+ typedef enum
+ {
+ EVideoFileTypeMPEG4
+ }
+ TVideoFileType;
+
+ IMPORT_C static CVideoFrameSupplier* NewL(const TDesC& aFileName, TVideoFileType aFileType);
+ IMPORT_C ~CVideoFrameSupplier();
+
+public:
+ IMPORT_C TInt LargestFrameSize() const;
+ IMPORT_C TInt CurrentFrame() const;
+ IMPORT_C TInt NextFrameData(TUint8* aPtr, TInt& aFrameLength);
+ IMPORT_C TBool IsLastFrame() const;
+
+private:
+ CVideoFrameSupplier();
+ void ConstructL(const TDesC& aFileName, TVideoFileType aFileType);
+ void ParseMPEG4FileL();
+ TInt AppendFrameData(TInt aPosition, TInt aLength);
+ TInt ProcessMPEG4Byte(TUint8 aByte, TInt aBytePosition);
+
+private:
+ RFs iFs;
+ RFile iFile;
+ RArray<TFrameData> iFrames;
+ TInt iLargestFrameSize;
+ TInt iCurrentFrame;
+ TMPEG4ParseState iState;
+ TInt iFrameStartPosition;
+ };
+
+#endif // __T_VIDEOFRAMESUPPLIER_H__
+
--- a/tsrc/xmltestharness/tools/t_videoframesupplier/src/t_videoframesupplier.cpp Wed Aug 25 12:40:50 2010 +0300
+++ b/tsrc/xmltestharness/tools/t_videoframesupplier/src/t_videoframesupplier.cpp Fri Sep 03 07:55:02 2010 +0300
@@ -1,260 +1,260 @@
-/*
-* Copyright (c) 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:
-*
-*/
-
-#include "t_videoframesupplier.h"
-
-
-//
-//
-//
-CVideoFrameSupplier::CVideoFrameSupplier()
- : iLargestFrameSize(KErrNotFound)
- {
- }
-
-//
-//
-//
-EXPORT_C CVideoFrameSupplier::~CVideoFrameSupplier()
- {
- iFrames.Close();
- iFile.Close();
- iFs.Close();
- }
-
-
-//
-//
-//
-EXPORT_C CVideoFrameSupplier* CVideoFrameSupplier::NewL(const TDesC& aFileName, TVideoFileType aFileType)
- {
- CVideoFrameSupplier* self = new(ELeave) CVideoFrameSupplier();
- CleanupStack::PushL(self);
- self->ConstructL(aFileName, aFileType);
- CleanupStack::Pop(self);
- return self;
- }
-
-
-//
-//
-//
-void CVideoFrameSupplier::ConstructL(const TDesC& aFileName, TVideoFileType aFileType)
- {
- User::LeaveIfError(iFs.Connect());
- TInt err = iFile.Open(iFs, aFileName, EFileRead);
- if (err != KErrNone)
- {
- RDebug::Print(_L("*** CVideoFrameSupplier: Error %d opening file %S"), err, &aFileName);
- User::Leave(err);
- }
-
- switch (aFileType)
- {
- case EVideoFileTypeMPEG4:
- ParseMPEG4FileL();
- break;
-
- default:
- User::Leave(KErrNotSupported);
- }
- }
-
-
-//
-//
-//
-EXPORT_C TInt CVideoFrameSupplier::LargestFrameSize() const
- {
- return iLargestFrameSize;
- }
-
-
-//
-//
-//
-EXPORT_C TInt CVideoFrameSupplier::CurrentFrame() const
- {
- return iCurrentFrame;
- }
-
-
-//
-//
-//
-EXPORT_C TBool CVideoFrameSupplier::IsLastFrame() const
- {
- return iCurrentFrame >= (iFrames.Count() - 1);
- }
-
-
-//
-//
-//
-EXPORT_C TInt CVideoFrameSupplier::NextFrameData(TUint8* aPtr, TInt& aFrameLength)
- {
- aFrameLength = KErrNotFound;
-
- if (!aPtr)
- {
- return KErrArgument;
- }
-
- if (iCurrentFrame >= iFrames.Count())
- {
- return KErrEof;
- }
-
- TFrameData data = iFrames[iCurrentFrame++];
- TInt pos = data.iPosition;
- TInt err = iFile.Seek(ESeekStart, pos);
- if (err == KErrNone)
- {
- TPtr8 des(aPtr, data.iLength);
- err = iFile.Read(des);
- if (err == KErrNone)
- {
- aFrameLength = data.iLength;
- }
- }
-
- return err;
- }
-
-
-//
-//
-//
-TInt CVideoFrameSupplier::AppendFrameData(TInt aPosition, TInt aLength)
- {
- ASSERT(aPosition >= 0);
- ASSERT(aLength > 0);
-
- TFrameData data;
- data.iPosition = aPosition;
- data.iLength = aLength;
-
- if (aLength > iLargestFrameSize)
- {
- iLargestFrameSize = aLength;
- }
-
- return iFrames.Append(data);
- }
-
-
-//
-//
-//
-void CVideoFrameSupplier::ParseMPEG4FileL()
- {
- iFrames.Reset();
-
- const TInt KBufferSize = 1024;
-
- iState = ESearchForZero;
- iLargestFrameSize = KErrNotFound;
- iFrameStartPosition = KErrNotFound;
-
- TBuf8<KBufferSize> data;
- TInt filePosition = 0;
- TBool lastBuffer = EFalse;
- TInt err = KErrNone;
-
- do
- {
- data.Zero();
- err = iFile.Read(data);
- lastBuffer = (data.Length() != KBufferSize);
-
- if (err == KErrNone)
- {
- for (TInt i = 0; i < data.Length(); i++)
- {
- err = ProcessMPEG4Byte(data[i], filePosition + i);
- }
-
- filePosition += KBufferSize;
- }
- }
- while (!lastBuffer);
- }
-
-
-//
-//
-//
-TInt CVideoFrameSupplier::ProcessMPEG4Byte(TUint8 aByte, TInt aBytePosition)
- {
- ASSERT(aBytePosition >= 0);
-
- TInt err = KErrNone;
-
- switch (iState)
- {
- case ESearchForZero:
- iState = (aByte == 0x00 ? ESearchForZeroZero : iState);
- break;
-
- case ESearchForZeroZero:
- iState = (aByte == 0x00 ? ESearchForZeroZeroOne : ESearchForZero);
- break;
-
- case ESearchForZeroZeroOne:
- if (aByte == 0x00)
- {
- // Do nothing. It is allowed to have more than two leading zero bytes.
- break;
- }
-
- iState = (aByte == 0x01 ? ESearchForStartCode : ESearchForZero);
- break;
-
- case ESearchForStartCode:
- if (iFrameStartPosition != KErrNotFound)
- {
- // If we are currently in a frame then it ends at this start code.
- TInt length = (aBytePosition - 3) - iFrameStartPosition;
- err = AppendFrameData(iFrameStartPosition, length);
- iFrameStartPosition = KErrNotFound;
- }
-
- iState = (aByte == 0xB6 ? EBeginningOfFrame : ESearchForZero);
- break;
-
- case EBeginningOfFrame:
- iFrameStartPosition = aBytePosition - 4; // The 0x000001B6 bytes count too.
- if (iFrames.Count() == 0)
- {
- if (iFrameStartPosition != 0)
- {
- // There was a header before the frame. The ST-E decoder
- // requires that this data is prepended to the frame data (first frame only).
- // We assume that all bytes before this frame are valid header bytes!
- iFrameStartPosition = 0;
- }
- }
-
- iState = ESearchForZero;
- break;
-
- default:
- ASSERT(EFalse);
- }
-
- return err;
- }
+/*
+* Copyright (c) 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:
+*
+*/
+
+#include "t_videoframesupplier.h"
+
+
+//
+//
+//
+CVideoFrameSupplier::CVideoFrameSupplier()
+ : iLargestFrameSize(KErrNotFound)
+ {
+ }
+
+//
+//
+//
+EXPORT_C CVideoFrameSupplier::~CVideoFrameSupplier()
+ {
+ iFrames.Close();
+ iFile.Close();
+ iFs.Close();
+ }
+
+
+//
+//
+//
+EXPORT_C CVideoFrameSupplier* CVideoFrameSupplier::NewL(const TDesC& aFileName, TVideoFileType aFileType)
+ {
+ CVideoFrameSupplier* self = new(ELeave) CVideoFrameSupplier();
+ CleanupStack::PushL(self);
+ self->ConstructL(aFileName, aFileType);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+
+//
+//
+//
+void CVideoFrameSupplier::ConstructL(const TDesC& aFileName, TVideoFileType aFileType)
+ {
+ User::LeaveIfError(iFs.Connect());
+ TInt err = iFile.Open(iFs, aFileName, EFileRead);
+ if (err != KErrNone)
+ {
+ RDebug::Print(_L("*** CVideoFrameSupplier: Error %d opening file %S"), err, &aFileName);
+ User::Leave(err);
+ }
+
+ switch (aFileType)
+ {
+ case EVideoFileTypeMPEG4:
+ ParseMPEG4FileL();
+ break;
+
+ default:
+ User::Leave(KErrNotSupported);
+ }
+ }
+
+
+//
+//
+//
+EXPORT_C TInt CVideoFrameSupplier::LargestFrameSize() const
+ {
+ return iLargestFrameSize;
+ }
+
+
+//
+//
+//
+EXPORT_C TInt CVideoFrameSupplier::CurrentFrame() const
+ {
+ return iCurrentFrame;
+ }
+
+
+//
+//
+//
+EXPORT_C TBool CVideoFrameSupplier::IsLastFrame() const
+ {
+ return iCurrentFrame >= (iFrames.Count() - 1);
+ }
+
+
+//
+//
+//
+EXPORT_C TInt CVideoFrameSupplier::NextFrameData(TUint8* aPtr, TInt& aFrameLength)
+ {
+ aFrameLength = KErrNotFound;
+
+ if (!aPtr)
+ {
+ return KErrArgument;
+ }
+
+ if (iCurrentFrame >= iFrames.Count())
+ {
+ return KErrEof;
+ }
+
+ TFrameData data = iFrames[iCurrentFrame++];
+ TInt pos = data.iPosition;
+ TInt err = iFile.Seek(ESeekStart, pos);
+ if (err == KErrNone)
+ {
+ TPtr8 des(aPtr, data.iLength);
+ err = iFile.Read(des);
+ if (err == KErrNone)
+ {
+ aFrameLength = data.iLength;
+ }
+ }
+
+ return err;
+ }
+
+
+//
+//
+//
+TInt CVideoFrameSupplier::AppendFrameData(TInt aPosition, TInt aLength)
+ {
+ ASSERT(aPosition >= 0);
+ ASSERT(aLength > 0);
+
+ TFrameData data;
+ data.iPosition = aPosition;
+ data.iLength = aLength;
+
+ if (aLength > iLargestFrameSize)
+ {
+ iLargestFrameSize = aLength;
+ }
+
+ return iFrames.Append(data);
+ }
+
+
+//
+//
+//
+void CVideoFrameSupplier::ParseMPEG4FileL()
+ {
+ iFrames.Reset();
+
+ const TInt KBufferSize = 1024;
+
+ iState = ESearchForZero;
+ iLargestFrameSize = KErrNotFound;
+ iFrameStartPosition = KErrNotFound;
+
+ TBuf8<KBufferSize> data;
+ TInt filePosition = 0;
+ TBool lastBuffer = EFalse;
+ TInt err = KErrNone;
+
+ do
+ {
+ data.Zero();
+ err = iFile.Read(data);
+ lastBuffer = (data.Length() != KBufferSize);
+
+ if (err == KErrNone)
+ {
+ for (TInt i = 0; i < data.Length(); i++)
+ {
+ err = ProcessMPEG4Byte(data[i], filePosition + i);
+ }
+
+ filePosition += KBufferSize;
+ }
+ }
+ while (!lastBuffer);
+ }
+
+
+//
+//
+//
+TInt CVideoFrameSupplier::ProcessMPEG4Byte(TUint8 aByte, TInt aBytePosition)
+ {
+ ASSERT(aBytePosition >= 0);
+
+ TInt err = KErrNone;
+
+ switch (iState)
+ {
+ case ESearchForZero:
+ iState = (aByte == 0x00 ? ESearchForZeroZero : iState);
+ break;
+
+ case ESearchForZeroZero:
+ iState = (aByte == 0x00 ? ESearchForZeroZeroOne : ESearchForZero);
+ break;
+
+ case ESearchForZeroZeroOne:
+ if (aByte == 0x00)
+ {
+ // Do nothing. It is allowed to have more than two leading zero bytes.
+ break;
+ }
+
+ iState = (aByte == 0x01 ? ESearchForStartCode : ESearchForZero);
+ break;
+
+ case ESearchForStartCode:
+ if (iFrameStartPosition != KErrNotFound)
+ {
+ // If we are currently in a frame then it ends at this start code.
+ TInt length = (aBytePosition - 3) - iFrameStartPosition;
+ err = AppendFrameData(iFrameStartPosition, length);
+ iFrameStartPosition = KErrNotFound;
+ }
+
+ iState = (aByte == 0xB6 ? EBeginningOfFrame : ESearchForZero);
+ break;
+
+ case EBeginningOfFrame:
+ iFrameStartPosition = aBytePosition - 4; // The 0x000001B6 bytes count too.
+ if (iFrames.Count() == 0)
+ {
+ if (iFrameStartPosition != 0)
+ {
+ // There was a header before the frame. The ST-E decoder
+ // requires that this data is prepended to the frame data (first frame only).
+ // We assume that all bytes before this frame are valid header bytes!
+ iFrameStartPosition = 0;
+ }
+ }
+
+ iState = ESearchForZero;
+ break;
+
+ default:
+ ASSERT(EFalse);
+ }
+
+ return err;
+ }
--- a/tsrc/xmltestharness/tools/t_videoframesupplier/src/t_videoframesupplierDllMain.cpp Wed Aug 25 12:40:50 2010 +0300
+++ b/tsrc/xmltestharness/tools/t_videoframesupplier/src/t_videoframesupplierDllMain.cpp Fri Sep 03 07:55:02 2010 +0300
@@ -1,29 +1,29 @@
-/*
-* Copyright (c) 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:
-*
-*/
-
-#include <e32std.h>
-
-
-#ifndef EKA2 // for EKA1 only
-EXPORT_C TInt E32Dll(TDllReason /*aReason*/)
-// Called when the DLL is loaded and unloaded. Note: have to define
-// epoccalldllentrypoints in MMP file to get this called in THUMB.
- {
- return KErrNone;
- }
-#endif
-
+/*
+* Copyright (c) 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:
+*
+*/
+
+#include <e32std.h>
+
+
+#ifndef EKA2 // for EKA1 only
+EXPORT_C TInt E32Dll(TDllReason /*aReason*/)
+// Called when the DLL is loaded and unloaded. Note: have to define
+// epoccalldllentrypoints in MMP file to get this called in THUMB.
+ {
+ return KErrNone;
+ }
+#endif
+