1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmplugins/lib3gpunittest/src/parserapinegative.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1842 @@
1.4 +// Copyright (c) 2008-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 <mmf/common/mmferrors.h>
1.20 +#include <caf/caf.h>
1.21 +using namespace ContentAccess;
1.22 +#include "tsu3gplibraryapinegative.h"
1.23 +
1.24 +// --------------------------
1.25 +// C3GPLibParser_Negative
1.26 +// --------------------------
1.27 +//
1.28 +void C3GPLibParser_Negative::CallAudioApiL(C3GPParse* aParse, TInt aExpectedError)
1.29 + {
1.30 + TInt err = KErrNone;
1.31 + // Retrieve audio stream attributes
1.32 + T3GPAudioType audioType;
1.33 + TInt framesPerSample;
1.34 + TUint length;
1.35 + TUint avgBitRate;
1.36 + TUint timeScale;
1.37 +
1.38 + err = aParse->GetAudioProperties(audioType, length, framesPerSample, avgBitRate, timeScale);
1.39 + User::LeaveIfError(CheckError(err, aExpectedError, _L("aParse->GetAudioProperties")));
1.40 +
1.41 + TBool available;
1.42 + T3GPFrameType type = E3GPAudio;
1.43 + err = aParse->GetFrameAvailability(type, available);
1.44 + if (aExpectedError == KErrNotSupported)
1.45 + {
1.46 + // GetFrameAvailability will return KErrNotFound when there is no audio in the 3gp files
1.47 + User::LeaveIfError(CheckError(err, KErrNotFound, _L("GetFrameAvailability")));
1.48 + }
1.49 + else
1.50 + {
1.51 + User::LeaveIfError(CheckError(err, aExpectedError, _L("GetFrameAvailability")));
1.52 + }
1.53 +
1.54 + TUint size;
1.55 + err = aParse->GetAudioFramesSize(size);
1.56 + User::LeaveIfError(CheckError(err, aExpectedError, _L("GetAudioFramesSize")));
1.57 +
1.58 + RBuf8 buffer;
1.59 + CleanupClosePushL(buffer);
1.60 +
1.61 + if (aExpectedError == KErrNone)
1.62 + {
1.63 + buffer.CreateL(size); // Use size retrieved from GetVideoFrameSize
1.64 + }
1.65 + else
1.66 + {
1.67 + buffer.CreateL(KBufferSize); // size from above may not be assigned since this is negative tests.
1.68 + }
1.69 +
1.70 + TUint timeStampInMs;
1.71 + TUint timeStampInTimescale;
1.72 + TInt returnedFrames;
1.73 + err = aParse->ReadAudioFrames(buffer, returnedFrames, timeStampInMs, timeStampInTimescale);
1.74 + User::LeaveIfError(CheckError(err, aExpectedError, _L("ReadAudioFrames")));
1.75 + CleanupStack::PopAndDestroy(&buffer);
1.76 +
1.77 + TUint index;
1.78 + err = aParse->GetAudioSampleEntryIndex(index);
1.79 + User::LeaveIfError(CheckError(err, aExpectedError, _L("GetAudioSampleEntryIndex")));
1.80 +
1.81 + T3GPQcelpStorageMode mode;
1.82 + err = aParse->GetQcelpStorageMode(mode);
1.83 + User::LeaveIfError(CheckError(err, aExpectedError, _L("GetQcelpStorageMode")));
1.84 + }
1.85 +
1.86 +void C3GPLibParser_Negative::CallVideoApiL(C3GPParse* aParse, TInt aExpectedError)
1.87 + {
1.88 + TInt err = KErrNone;
1.89 + // Retrieve video & audio stream attributes
1.90 + T3GPVideoType videoType;
1.91 + TUint length;
1.92 + TReal frameRate;
1.93 + TUint avgBitRate;
1.94 + TSize videoSize;
1.95 + TUint timeScale;
1.96 +
1.97 + err = aParse->GetVideoProperties(videoType, length, frameRate, avgBitRate, videoSize, timeScale);
1.98 + User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoProperties")));
1.99 +
1.100 + TBool available;
1.101 + T3GPFrameType type = E3GPVideo;
1.102 + err = aParse->GetFrameAvailability(type, available);
1.103 + if (aExpectedError == KErrNotSupported)
1.104 + {
1.105 + // GetFrameAvailability will return KErrNotFound when there is no video in the 3gp files
1.106 + User::LeaveIfError(CheckError(err, KErrNotFound, _L("GetFrameAvailability")));
1.107 + }
1.108 + else
1.109 + {
1.110 + User::LeaveIfError(CheckError(err, aExpectedError, _L("GetFrameAvailability")));
1.111 + }
1.112 +
1.113 + TUint size;
1.114 + err = aParse->GetVideoFrameSize(size);
1.115 + User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoFrameSize")));
1.116 +
1.117 + RBuf8 buffer;
1.118 + CleanupClosePushL(buffer);
1.119 + if (aExpectedError == KErrNone)
1.120 + {
1.121 + buffer.CreateL(size); // Use size retrieved from GetVideoFrameSize
1.122 + }
1.123 + else
1.124 + {
1.125 + buffer.CreateL(KBufferSize); // size from above may not be assigned since this is negative tests.
1.126 + }
1.127 + TBool keyFrame;
1.128 + TUint timeStampInMs;
1.129 + TUint timeStampInTimescale;
1.130 + err = aParse->ReadVideoFrame(buffer, keyFrame, timeStampInMs, timeStampInTimescale);
1.131 + User::LeaveIfError(CheckError(err, aExpectedError, _L("ReadVideoFrame")));
1.132 + CleanupStack::PopAndDestroy(&buffer);
1.133 +
1.134 + err = aParse->GetVideoTimestamp(timeStampInMs, timeStampInTimescale);
1.135 + User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoTimestamp")));
1.136 +
1.137 + TUint num;
1.138 + err = aParse->GetNumberOfVideoFrames(num);
1.139 + User::LeaveIfError(CheckError(err, aExpectedError, _L("GetNumberOfVideoFrames")));
1.140 +
1.141 + TUint index;
1.142 + err = aParse->GetVideoSampleEntryIndex(index);
1.143 + User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoSampleEntryIndex")));
1.144 +
1.145 + err = aParse->GetVideoFrameSize(index, size);
1.146 + User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoFrameSize")));
1.147 +
1.148 + err = aParse->GetVideoFrameStartTime(index, timeStampInMs, timeStampInTimescale);
1.149 + User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoFrameStartTime")));
1.150 +
1.151 + err = aParse->GetVideoFrameKeyType(index, keyFrame);
1.152 + User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoFrameKeyType")));
1.153 +
1.154 + TInt level;
1.155 + err = aParse->GetH263VideoLevel(level);
1.156 + User::LeaveIfError(CheckError(err, aExpectedError, _L("GetH263VideoLevel")));
1.157 +
1.158 + T3GPFrameDependencies dependencies;
1.159 + err = aParse->GetVideoFrameDependencies(dependencies);
1.160 + User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoFrameDependencies")));
1.161 +
1.162 + TUint numberOfFrames = 2;
1.163 + RArray<T3GPFrameInfoParameters> array;
1.164 + err = aParse->GetVideoFrameProperties(index, numberOfFrames, array);
1.165 + array.Close();
1.166 + User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoFrameProperties")));
1.167 + }
1.168 +
1.169 +void C3GPLibParser_Negative::CallVideoDecoderInfoApiL(C3GPParse* aParse, TInt aExpectedError)
1.170 + {
1.171 + RBuf8 buffer;
1.172 + CleanupClosePushL(buffer);
1.173 +
1.174 + TInt dsiSize;
1.175 + TInt err = aParse->GetVideoDecoderSpecificInfoSize(dsiSize);
1.176 + User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoDecoderSpecificInfoSize")));
1.177 +
1.178 + if (aExpectedError == KErrNone)
1.179 + {
1.180 + buffer.CreateL(dsiSize);
1.181 + }
1.182 + else
1.183 + {
1.184 + buffer.CreateL(KBufferSize); // size from above may not be assigned since this is negative tests.
1.185 + }
1.186 + err = aParse->GetVideoDecoderSpecificInfo(buffer);
1.187 + User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoDecoderSpecificInfo")));
1.188 +
1.189 + CleanupStack::PopAndDestroy(&buffer);
1.190 + }
1.191 +
1.192 +void C3GPLibParser_Negative::CallAudioDecoderInfoApiL(C3GPParse* aParse, TInt aExpectedError)
1.193 + {
1.194 + RBuf8 buffer;
1.195 + CleanupClosePushL(buffer);
1.196 + TInt dsiSize;
1.197 + TInt err = aParse->GetAudioDecoderSpecificInfoSize(dsiSize);
1.198 + User::LeaveIfError(CheckError(err, aExpectedError, _L("GetAudioDecoderSpecificInfoSize")));
1.199 +
1.200 + if (aExpectedError == KErrNone)
1.201 + {
1.202 + buffer.CreateL(dsiSize);
1.203 + }
1.204 + else
1.205 + {
1.206 + buffer.CreateL(KBufferSize); // size from above may not be assigned since this is negative tests.
1.207 + }
1.208 + err = aParse->GetAudioDecoderSpecificInfo(buffer);
1.209 + User::LeaveIfError(CheckError(err, aExpectedError, _L("GetAudioDecoderSpecificInfo")));
1.210 +
1.211 + CleanupStack::PopAndDestroy(&buffer);
1.212 + }
1.213 +
1.214 +// Retrieve user data atom.
1.215 +void C3GPLibParser_Negative::CallUDTApiL(C3GPParse* aParse, TUint32 aUdtType, TUint& aIndex, TInt aExpectedError, T3GPUdtaLocation aLocation)
1.216 + {
1.217 + TInt err = KErrNone;
1.218 + TInt udtSize;
1.219 + TUint tempIndex = aIndex; // use the copy of the aIndex so it does not get overwritten by GetUserDataAtomSize
1.220 +
1.221 + err = aParse->GetUserDataAtomSize(aUdtType, aLocation, tempIndex, udtSize);
1.222 + User::LeaveIfError(CheckError(err, aExpectedError, _L("GetUserDataAtomSize")));
1.223 +
1.224 + RBuf8 buffer;
1.225 + CleanupClosePushL(buffer);
1.226 +
1.227 + if (aExpectedError == KErrNone && err == KErrNone)
1.228 + {
1.229 + buffer.CreateL(udtSize); // Use size retrieved from GetUserDataAtomSize
1.230 + }
1.231 + else
1.232 + {
1.233 + buffer.CreateL(KBufferSize); // size from above may not be assigned since this is negative tests.
1.234 + }
1.235 + err = aParse->GetUserDataAtom(aUdtType, aLocation, buffer, aIndex);
1.236 + CleanupStack::PopAndDestroy(&buffer);
1.237 +
1.238 + User::LeaveIfError(CheckError(err, aExpectedError, _L("GetUserDataAtom")));
1.239 + }
1.240 +
1.241 +void C3GPLibParser_Negative::CallCommonApiL(C3GPParse* aParse, TInt aExpectedError)
1.242 + {
1.243 + TInt err = KErrNone;
1.244 +
1.245 + TUint size;
1.246 + TUint avgBitRate;
1.247 + err = aParse->GetContainerProperties(size, avgBitRate);
1.248 + User::LeaveIfError(CheckError(err, aExpectedError, _L("GetContainerProperties")));
1.249 +
1.250 + T3GPFrameType type;
1.251 + err = aParse->C3GPParse::GetFrameType(type);
1.252 + User::LeaveIfError(CheckError(err, aExpectedError, _L("GetFrameType")));
1.253 +
1.254 + TBool streamable;
1.255 + err = aParse->GetStreamable(streamable);
1.256 + User::LeaveIfError(CheckError(err, aExpectedError, _L("GetStreamable")));
1.257 +
1.258 + TUint position = 0;
1.259 + TBool keyFrame = EFalse;
1.260 + TUint audioPosition;
1.261 + TUint videoPosition;
1.262 + err = aParse->Seek(position, keyFrame, audioPosition, videoPosition);
1.263 + User::LeaveIfError(CheckError(err, aExpectedError, _L("Seek")));
1.264 + }
1.265 +
1.266 +// -----------------------------------------------------------------------------
1.267 +// Create 3GP Parser to read zero size file content and call all APIs except
1.268 +// asynchrounous read
1.269 +// -----------------------------------------------------------------------------
1.270 +//
1.271 +C3GPLibParser_0101::C3GPLibParser_0101()
1.272 + {
1.273 + }
1.274 +
1.275 +TVerdict C3GPLibParser_0101::doTestStepL()
1.276 + {
1.277 + if(TestStepResult() == EPass)
1.278 + {
1.279 + C3GPParse* parser = C3GPParse::NewL();
1.280 + CleanupStack::PushL(parser);
1.281 +
1.282 + TRAPD(err, EmptyFileFailedCorruptL(parser));
1.283 + if (err != KErrNone)
1.284 + {
1.285 + SetTestStepResult(EFail);
1.286 + }
1.287 +
1.288 + CleanupStack::PopAndDestroy(parser);
1.289 + }
1.290 + return TestStepResult();
1.291 + }
1.292 +
1.293 +void C3GPLibParser_0101::EmptyFileFailedCorruptL(C3GPParse* aParse)
1.294 + {
1.295 + // all api test with empty file using file path
1.296 + // When the parser is in use, calling parser open again should fail with KErrInUse
1.297 + ParserOpenFileL(aParse, KErrInUse);
1.298 +
1.299 + CallCommonApiL(aParse, KErrCorrupt);
1.300 + CallVideoApiL(aParse, KErrCorrupt);
1.301 + CallAudioApiL(aParse, KErrCorrupt);
1.302 + CallVideoDecoderInfoApiL(aParse, KErrCorrupt);
1.303 + CallAudioDecoderInfoApiL(aParse, KErrCorrupt);
1.304 + TUint32 udtType = 0x7469746c;
1.305 + TUint index;
1.306 + CallUDTApiL(aParse, udtType, index, KErrCorrupt);
1.307 + T3GPUdtaLocation location = E3GPUdtaAudioTrak;
1.308 + CallUDTApiL(aParse, udtType, index, KErrCorrupt, location);
1.309 + ParserCompleteL(aParse);
1.310 +
1.311 + // all api test with empty file using file handle
1.312 + // When the parser is in use, calling parser open again should fail with KErrInUse
1.313 + ParserOpenFileHandleL(aParse, EFileRead | EFileShareReadersOnly, KErrInUse);
1.314 +
1.315 + CallCommonApiL(aParse, KErrCorrupt);
1.316 + CallVideoApiL(aParse, KErrCorrupt);
1.317 + CallAudioApiL(aParse, KErrCorrupt);
1.318 + CallVideoDecoderInfoApiL(aParse, KErrCorrupt);
1.319 + CallAudioDecoderInfoApiL(aParse, KErrCorrupt);
1.320 + CallUDTApiL(aParse, udtType, index, KErrCorrupt);
1.321 + CallUDTApiL(aParse, udtType, index, KErrCorrupt, location);
1.322 + ParserCompleteHandleL(aParse);
1.323 +
1.324 + // all api test with empty file using CAF
1.325 + // When the parser is in use, calling parser open again should fail with KErrInUse
1.326 + ParserOpenCafLC(aParse, KErrInUse);
1.327 +
1.328 + CallCommonApiL(aParse, KErrCorrupt);
1.329 + CallVideoApiL(aParse, KErrCorrupt);
1.330 + CallAudioApiL(aParse, KErrCorrupt);
1.331 + CallVideoDecoderInfoApiL(aParse, KErrCorrupt);
1.332 + CallAudioDecoderInfoApiL(aParse, KErrCorrupt);
1.333 + CallUDTApiL(aParse, udtType, index, KErrCorrupt);
1.334 + CallUDTApiL(aParse, udtType, index, KErrCorrupt, location);
1.335 + ParserCompleteCafL(aParse);
1.336 +
1.337 + // test open using buffer mode
1.338 + // When the parser is in use, calling parser open again should fail with KErrInUse
1.339 + ParserOpenL(aParse, KErrInUse);
1.340 + ParserCompleteL(aParse);
1.341 + // Call complete again, should pass with no error
1.342 + ParserCompleteL(aParse);
1.343 + }
1.344 +
1.345 +// -----------------------------------------------------------------------------
1.346 +// Initialise a 3GP file parse with an empty filename and file path pointing
1.347 +// at non-existent files
1.348 +// -----------------------------------------------------------------------------
1.349 +//
1.350 +C3GPLibParser_0102::C3GPLibParser_0102()
1.351 + {
1.352 + }
1.353 +
1.354 +TVerdict C3GPLibParser_0102::doTestStepL()
1.355 + {
1.356 + if(TestStepResult() == EPass)
1.357 + {
1.358 + C3GPParse* parser = C3GPParse::NewL();
1.359 + CleanupStack::PushL(parser);
1.360 +
1.361 + // Initialise a 3GP file parse with an empty filename and it should fail with KErrUnderflow
1.362 + TInt err = parser->Open(KEmptyFileString);
1.363 + if (err != KErrUnderflow)
1.364 + {
1.365 + ERR_PRINTF2(_L("parser->Open(KEmptyFileString) expects KErrUnderflow. Returns with %d"), err);
1.366 + SetTestStepResult(EFail);
1.367 + }
1.368 +
1.369 + // Setup 3GP Parser with a file path of a non-existing file. This should fail with KErrAccessDenied.
1.370 + err = parser->Open(KInvalidFileString);
1.371 + if (err != KErrAccessDenied)
1.372 + {
1.373 + ERR_PRINTF2(_L("parser->Open(KEmptyFileString) expects KErrAccessDenied. Returns with %d"), err);
1.374 + SetTestStepResult(EFail);
1.375 + }
1.376 +
1.377 + CleanupStack::PopAndDestroy(parser);
1.378 + }
1.379 + return TestStepResult();
1.380 + }
1.381 +
1.382 +// -----------------------------------------------------------------------------
1.383 +// Create parser by passing in a file path of a file already opened in
1.384 +// EFileShareExclusive mode.
1.385 +// -----------------------------------------------------------------------------
1.386 +//
1.387 +C3GPLibParser_0104::C3GPLibParser_0104()
1.388 + {
1.389 + }
1.390 +
1.391 +TVerdict C3GPLibParser_0104::doTestStepL()
1.392 + {
1.393 + if(TestStepResult() == EPass)
1.394 + {
1.395 + C3GPParse* parser = C3GPParse::NewL();
1.396 + CleanupStack::PushL(parser);
1.397 +
1.398 + // Open a valid mp4/3gp/3g2 file with EFileShareExclusive mode
1.399 + // Instantiate a 3GP parser object with the same file path already opened above
1.400 + FileOpenL(EFileShareExclusive);
1.401 + TInt err = parser->Open(iInputFile);
1.402 + if (err != KErrAccessDenied)
1.403 + {
1.404 + ERR_PRINTF2(_L("parser->Open(iInputFile) expects KErrAccessDenied. Returns with %d"), err);
1.405 + SetTestStepResult(EFail);
1.406 + }
1.407 + ParserCompleteL(parser);
1.408 + FileClose();
1.409 +
1.410 + CleanupStack::PopAndDestroy(parser);
1.411 + }
1.412 + return TestStepResult();
1.413 + }
1.414 +
1.415 +// -----------------------------------------------------------------------------
1.416 +// Use 3GP Parser to parse file before it has been setup
1.417 +// -----------------------------------------------------------------------------
1.418 +//
1.419 +C3GPLibParser_0106::C3GPLibParser_0106()
1.420 + {
1.421 + }
1.422 +
1.423 +TVerdict C3GPLibParser_0106::doTestStepL()
1.424 + {
1.425 + if(TestStepResult() == EPass)
1.426 + {
1.427 + C3GPParse* parser = C3GPParse::NewL();
1.428 + CleanupStack::PushL(parser);
1.429 +
1.430 + TRAPD(err, AllApiFailedNotReadyL(parser));
1.431 + if (err != KErrNone)
1.432 + {
1.433 + SetTestStepResult(EFail);
1.434 + }
1.435 +
1.436 + CleanupStack::PopAndDestroy(parser);
1.437 + }
1.438 + return TestStepResult();
1.439 + }
1.440 +
1.441 +void C3GPLibParser_0106::AllApiFailedNotReadyL(C3GPParse* aParse)
1.442 + {
1.443 + CallCommonApiL(aParse, KErrNotReady);
1.444 + CallVideoApiL(aParse, KErrNotReady);
1.445 + CallAudioApiL(aParse, KErrNotReady);
1.446 + CallVideoDecoderInfoApiL(aParse, KErrNotReady);
1.447 + CallAudioDecoderInfoApiL(aParse, KErrNotReady);
1.448 + TUint32 udtType = 0x7469746c;
1.449 + TUint index;
1.450 + CallUDTApiL(aParse, udtType, index, KErrNotReady);
1.451 +
1.452 + RBuf8 buffer;
1.453 + CleanupClosePushL(buffer);
1.454 + // create 0 size buffer for negative test when API is called before parse is opened
1.455 + buffer.CreateL(0);
1.456 + TInt err = aParse->InsertData(buffer);
1.457 + User::LeaveIfError(CheckError(err, KErrNotReady, _L("aParse->InsertData")));
1.458 + CleanupStack::PopAndDestroy(&buffer);
1.459 +
1.460 + TInt num;
1.461 + err = aParse->GetNumBufferedBytes(num);
1.462 + User::LeaveIfError(CheckError(err, KErrNotReady, _L("aParse->InsertData")));
1.463 + }
1.464 +
1.465 +// -----------------------------------------------------------------------------
1.466 +// Use invalid frame type for all frame type API.
1.467 +// -----------------------------------------------------------------------------
1.468 +//
1.469 +C3GPLibParser_0107::C3GPLibParser_0107()
1.470 + {
1.471 + }
1.472 +
1.473 +TVerdict C3GPLibParser_0107::doTestStepL()
1.474 + {
1.475 + if(TestStepResult() == EPass)
1.476 + {
1.477 + C3GPParse* parser = C3GPParse::NewL();
1.478 + CleanupStack::PushL(parser);
1.479 +
1.480 + TRAPD(err, InvalidFrameTypeL(parser));
1.481 + if (err != KErrNone)
1.482 + {
1.483 + SetTestStepResult(EFail);
1.484 + }
1.485 +
1.486 + CleanupStack::PopAndDestroy(parser);
1.487 + }
1.488 + return TestStepResult();
1.489 + }
1.490 +
1.491 +void C3GPLibParser_0107::InvalidFrameTypeL(C3GPParse* aParse)
1.492 + {
1.493 + // file mode
1.494 + ParserOpenFileL(aParse);
1.495 +
1.496 + // Invalid type tests
1.497 + TInt invalidType = 10;
1.498 + T3GPVideoType invalidVideoType = static_cast<T3GPVideoType>(invalidType);
1.499 + TUint length;
1.500 + TReal frameRate;
1.501 + TUint avgBitRate;
1.502 + TSize videoSize;
1.503 + TUint timeScale;
1.504 + // should pass
1.505 + TInt err = aParse->GetVideoProperties(invalidVideoType, length, frameRate, avgBitRate, videoSize, timeScale);
1.506 + User::LeaveIfError(CheckError(err, KErrNone, _L("GetVideoProperties")));
1.507 +
1.508 + T3GPAudioType invalidAudioType = static_cast<T3GPAudioType>(invalidType);
1.509 + TInt framesPerSample;
1.510 + // should pass
1.511 + err = aParse->GetAudioProperties(invalidAudioType, length, framesPerSample, avgBitRate, timeScale);
1.512 + User::LeaveIfError(CheckError(err, KErrNone, _L("aParse->GetAudioProperties")));
1.513 +
1.514 + T3GPFrameType invalidFrameType = static_cast<T3GPFrameType>(invalidType);
1.515 + // should pass
1.516 + err = aParse->GetFrameType(invalidFrameType);
1.517 + User::LeaveIfError(CheckError(err, KErrNone, _L("aParse->GetAudioProperties")));
1.518 +
1.519 + T3GPQcelpStorageMode invalidMode = static_cast<T3GPQcelpStorageMode>(invalidType);
1.520 + //Should pass
1.521 + err = aParse->GetQcelpStorageMode(invalidMode);
1.522 + User::LeaveIfError(CheckError(err, KErrNone, _L("aParse->GetVideoProperties() invalid type")));
1.523 +
1.524 + ParserCompleteL(aParse);
1.525 + }
1.526 +
1.527 +// -----------------------------------------------------------------------------
1.528 +// Use invalid frame index for video frame APIs and Get video frame properties for more
1.529 +// than the total number of video frames in the video clip
1.530 +// -----------------------------------------------------------------------------
1.531 +//
1.532 +C3GPLibParser_0108::C3GPLibParser_0108()
1.533 + {
1.534 + }
1.535 +
1.536 +TVerdict C3GPLibParser_0108::doTestStepL()
1.537 + {
1.538 + if(TestStepResult() == EPass)
1.539 + {
1.540 + C3GPParse* parser = C3GPParse::NewL();
1.541 + CleanupStack::PushL(parser);
1.542 +
1.543 + TRAPD(err, AllInvalidFrameIndexL(parser));
1.544 + if (err != KErrNone)
1.545 + {
1.546 + SetTestStepResult(EFail);
1.547 + }
1.548 +
1.549 + CleanupStack::PopAndDestroy(parser);
1.550 + }
1.551 + return TestStepResult();
1.552 + }
1.553 +
1.554 +void C3GPLibParser_0108::AllInvalidFrameIndexL(C3GPParse* aParse)
1.555 + {
1.556 + // file mode
1.557 + ParserOpenFileL(aParse);
1.558 +
1.559 + TUint numOfVideoFrames;
1.560 + TInt err = aParse->GetNumberOfVideoFrames(numOfVideoFrames);
1.561 + User::LeaveIfError(CheckError(err, KErrNone, _L("aParse->GetNumberOfVideoFrames()")));
1.562 +
1.563 + // Invalid index.
1.564 + TUint size;
1.565 + err = aParse->GetVideoFrameSize(numOfVideoFrames + 100, size);
1.566 + User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameSize() invalid index")));
1.567 +
1.568 + err = aParse->GetVideoFrameSize((KMaxTUint-15), size);
1.569 + User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameSize() negative index")));
1.570 +
1.571 + TUint timeStampInMs;
1.572 + TUint timeStampInTimescale;
1.573 + err = aParse->GetVideoFrameStartTime(numOfVideoFrames + 10, timeStampInMs, timeStampInTimescale);
1.574 + User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameStartTime() invalid index")));
1.575 +
1.576 + err = aParse->GetVideoFrameStartTime((KMaxTUint-15), timeStampInMs, timeStampInTimescale);
1.577 + User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameStartTime() negative index")));
1.578 +
1.579 + TBool keyFrame;
1.580 + err = aParse->GetVideoFrameKeyType(numOfVideoFrames + 10, keyFrame);
1.581 + User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameKeyType() invalid index")));
1.582 +
1.583 + err = aParse->GetVideoFrameKeyType((KMaxTUint-15), keyFrame);
1.584 + User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameKeyType() negative index")));
1.585 +
1.586 + TUint numberOfFrames = 2;
1.587 + RArray<T3GPFrameInfoParameters> array;
1.588 + CleanupClosePushL(array);
1.589 +
1.590 + err = aParse->GetVideoFrameProperties(numOfVideoFrames + 10, numberOfFrames, array);
1.591 + User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameProperties() invalid index")));
1.592 +
1.593 + // Get video frame properties for more than the total number of video frames in the video clip
1.594 + err = aParse->GetVideoFrameProperties(0, numOfVideoFrames + 10, array);
1.595 + User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameProperties() invalid number of frame")));
1.596 +
1.597 + err = aParse->GetVideoFrameProperties((KMaxTUint-1), numOfVideoFrames, array);
1.598 + User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameProperties() with negative index")));
1.599 +
1.600 + err = aParse->GetVideoFrameProperties(15, (KMaxTUint-10), array);
1.601 + User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameProperties() with negative numOfVideoFrames")));
1.602 +
1.603 + err = aParse->GetVideoFrameProperties((KMaxTUint-15), numOfVideoFrames + 10, array);
1.604 + User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameProperties() with negative index and invalid numOfVideoFrames")));
1.605 +
1.606 + CleanupStack::PopAndDestroy(&array);
1.607 +
1.608 + ParserCompleteL(aParse);
1.609 + }
1.610 +
1.611 +// -----------------------------------------------------------------------------
1.612 +// Instantiate a 3GP Parser and Call all Parser API that uses frame type as
1.613 +// input parameter with invalid frame types
1.614 +// -----------------------------------------------------------------------------
1.615 +//
1.616 +C3GPLibParser_0109::C3GPLibParser_0109()
1.617 + {
1.618 + }
1.619 +
1.620 +TVerdict C3GPLibParser_0109::doTestStepL()
1.621 + {
1.622 + if(TestStepResult() == EPass)
1.623 + {
1.624 + C3GPParse* parser = C3GPParse::NewL();
1.625 + CleanupStack::PushL(parser);
1.626 +
1.627 + TRAPD(err, InvalidFrameTypePanicL(parser));
1.628 + if (err != KErrNone)
1.629 + {
1.630 + SetTestStepResult(EFail);
1.631 + }
1.632 +
1.633 + CleanupStack::PopAndDestroy(parser);
1.634 + }
1.635 + return TestStepResult();
1.636 + }
1.637 +
1.638 +void C3GPLibParser_0109::InvalidFrameTypePanicL(C3GPParse* aParse)
1.639 + {
1.640 + // file mode
1.641 + ParserOpenFileL(aParse);
1.642 +
1.643 + TInt invalidType = 10;
1.644 + TBool available;
1.645 + T3GPFrameType invalidFrameType = static_cast<T3GPFrameType>(invalidType);
1.646 + //Should panic
1.647 + aParse->GetFrameAvailability(invalidFrameType, available);
1.648 +
1.649 + ParserCompleteL(aParse);
1.650 + }
1.651 +
1.652 +// -----------------------------------------------------------------------------
1.653 +// Get user data atom by passing in an invalid user atom location.
1.654 +// -----------------------------------------------------------------------------
1.655 +//
1.656 +C3GPLibParser_0110::C3GPLibParser_0110()
1.657 + {
1.658 + }
1.659 +
1.660 +TVerdict C3GPLibParser_0110::doTestStepL()
1.661 + {
1.662 + if(TestStepResult() == EPass)
1.663 + {
1.664 + C3GPParse* parser = C3GPParse::NewL();
1.665 + CleanupStack::PushL(parser);
1.666 +
1.667 + TRAPD(err, InvalidUdtLocationL(parser));
1.668 + if (err != KErrNone)
1.669 + {
1.670 + SetTestStepResult(EFail);
1.671 + }
1.672 +
1.673 + CleanupStack::PopAndDestroy(parser);
1.674 + }
1.675 + return TestStepResult();
1.676 + }
1.677 +
1.678 +void C3GPLibParser_0110::InvalidUdtLocationL(C3GPParse* aParse)
1.679 + {
1.680 + // file mode
1.681 + ParserOpenFileL(aParse);
1.682 +
1.683 + // Invalid type tests
1.684 + TInt invalidType = 10;
1.685 + TUint index;
1.686 + TUint32 udtType = 0x7469746c;
1.687 + T3GPUdtaLocation invalidLocation = static_cast<T3GPUdtaLocation>(invalidType);
1.688 + RBuf8 buffer;
1.689 + CleanupClosePushL(buffer);
1.690 + buffer.CreateL(KBufferSize);
1.691 + //Should panic
1.692 + aParse->GetUserDataAtom(udtType, invalidLocation, buffer, index);
1.693 + CleanupStack::PopAndDestroy(&buffer);
1.694 +
1.695 + ParserCompleteL(aParse);
1.696 + }
1.697 +
1.698 +// -----------------------------------------------------------------------------
1.699 +// Retrieve information when that info is not in the file or the info is not
1.700 +// supported by the library
1.701 +// -----------------------------------------------------------------------------
1.702 +//
1.703 +C3GPLibParser_0111::C3GPLibParser_0111()
1.704 + {
1.705 + }
1.706 +
1.707 +TVerdict C3GPLibParser_0111::doTestStepL()
1.708 + {
1.709 + if(TestStepResult() == EPass)
1.710 + {
1.711 + C3GPParse* parser = C3GPParse::NewL();
1.712 + CleanupStack::PushL(parser);
1.713 +
1.714 + TRAPD(err, AllVideoAudioApiFailedL(parser));
1.715 + if (err != KErrNone)
1.716 + {
1.717 + SetTestStepResult(EFail);
1.718 + }
1.719 +
1.720 + CleanupStack::PopAndDestroy(parser);
1.721 + }
1.722 + return TestStepResult();
1.723 + }
1.724 +
1.725 +void C3GPLibParser_0111::AllVideoAudioApiFailedL(C3GPParse* aParse)
1.726 + {
1.727 + // file mode
1.728 + ParserOpenFileL(aParse);
1.729 +
1.730 + TInt expectedErr = KErrNone;
1.731 + TUint32 udtType = 0x7469746c;
1.732 + TUint index;
1.733 + T3GPUdtaLocation location = E3GPUdtaVideoTrak;
1.734 + if (iTestSection.Compare(KAudioOnly) == 0 || iTestSection.Compare(KUnsupportedVideo) == 0)
1.735 + {
1.736 + CallVideoApiL(aParse, KErrNotSupported);
1.737 + CallVideoDecoderInfoApiL(aParse, KErrNotSupported);
1.738 + }
1.739 + else if (iTestSection.Compare(KVideoOnly) == 0 || iTestSection.Compare(KUnsupportedAudioCodec) == 0 ||
1.740 + iTestSection.Compare(KUnsupportedAudioStream) == 0)
1.741 + {
1.742 + CallAudioApiL(aParse, KErrNotSupported);
1.743 + CallAudioDecoderInfoApiL(aParse, KErrNotSupported);
1.744 +
1.745 + location = E3GPUdtaAudioTrak;
1.746 + }
1.747 + else if (iTestSection.Compare(KWmaFile) == 0)
1.748 + {
1.749 + expectedErr = KErrCorrupt;
1.750 + CallVideoDecoderInfoApiL(aParse, expectedErr);
1.751 + CallUDTApiL(aParse, udtType, index, expectedErr, location);
1.752 + }
1.753 + else if (iTestSection.Compare(KMisMatch) == 0)
1.754 + {
1.755 + // The test file doesn't contain MPEG-4 / AVC video stream. The decoder info should fail.
1.756 + CallVideoDecoderInfoApiL(aParse, KErrNotSupported);
1.757 + CallUDTApiL(aParse, udtType, index, KErrNotFound, location);
1.758 + }
1.759 + else if (iTestSection.Compare(KNoAudioNoVideo) == 0)
1.760 + {
1.761 + expectedErr = KErrNotSupported;
1.762 + CallVideoApiL(aParse, expectedErr);
1.763 + CallVideoDecoderInfoApiL(aParse, expectedErr);
1.764 + CallAudioApiL(aParse, expectedErr);
1.765 + CallAudioDecoderInfoApiL(aParse, expectedErr);
1.766 + CallCommonApiL(aParse, KErrGeneral);
1.767 + }
1.768 + if (iTestSection.Compare(KWmaFile) == 0 || iTestSection.Compare(KMisMatch) == 0)
1.769 + {
1.770 + CallVideoApiL(aParse, expectedErr);
1.771 + CallAudioApiL(aParse, expectedErr);
1.772 + CallAudioDecoderInfoApiL(aParse, expectedErr);
1.773 + CallCommonApiL(aParse, expectedErr);
1.774 + }
1.775 + else
1.776 + {
1.777 + CallUDTApiL(aParse, udtType, index, KErrNotFound, location);
1.778 + }
1.779 + ParserCompleteL(aParse);
1.780 + }
1.781 +
1.782 +// -----------------------------------------------------------------------------
1.783 +// Seek to an invalid position of the file.
1.784 +// -----------------------------------------------------------------------------
1.785 +//
1.786 +C3GPLibParser_0119::C3GPLibParser_0119()
1.787 + {
1.788 + }
1.789 +
1.790 +TVerdict C3GPLibParser_0119::doTestStepL()
1.791 + {
1.792 + if(TestStepResult() == EPass)
1.793 + {
1.794 + C3GPParse* parser = C3GPParse::NewL();
1.795 + CleanupStack::PushL(parser);
1.796 +
1.797 + TRAPD(err, SeekTestL(parser));
1.798 + if (err != KErrNone)
1.799 + {
1.800 + SetTestStepResult(EFail);
1.801 + }
1.802 +
1.803 + CleanupStack::PopAndDestroy(parser);
1.804 + }
1.805 + return TestStepResult();
1.806 + }
1.807 +
1.808 +void C3GPLibParser_0119::SeekTestL(C3GPParse* aParse)
1.809 + {
1.810 + // file mode
1.811 + ParserOpenFileL(aParse);
1.812 +
1.813 + TUint audioPos;
1.814 + TUint videoPos;
1.815 + TUint timeStampInMs = 0;
1.816 +
1.817 + // Seek to position 0.
1.818 + TInt err = KErrNone;
1.819 + err = aParse->Seek(timeStampInMs, ETrue, audioPos, videoPos);
1.820 + if (iTestSection.Compare(KNoAudioNoVideo) == 0)
1.821 + {
1.822 + User::LeaveIfError(CheckError(err, KErrGeneral,
1.823 + _L("aParser->Seek(timeStampInMs, ETrue, audioPos, videoPos) with file without audio nor video")));
1.824 + err = aParse->Seek(timeStampInMs, EFalse, audioPos, videoPos);
1.825 + User::LeaveIfError(CheckError(err, KErrGeneral,
1.826 + _L("aParser->Seek(timeStampInMs, EFalse, audioPos, videoPos) with file without audio nor video")));
1.827 + }
1.828 + else
1.829 + {
1.830 + User::LeaveIfError(CheckError(err, KErrNone,
1.831 + _L("aParser->Seek(timeStampInMs, ETrue, audioPos, videoPos) with file with audio/video")));
1.832 + err = aParse->Seek(timeStampInMs, EFalse, audioPos, videoPos);
1.833 + User::LeaveIfError(CheckError(err, KErrNone,
1.834 + _L("aParser->Seek(timeStampInMs, EFalse, audioPos, videoPos) with file with audio/video")));
1.835 + }
1.836 +
1.837 + if (iTestSection.Compare(KNoAudioNoVideo) != 0)
1.838 + {
1.839 + // Retrieve video & audio stream length
1.840 + TUint videoLength;
1.841 + TUint audioLength;
1.842 + TInt videoError;
1.843 +
1.844 + err = GetClipProperties(aParse, videoError, videoLength, audioLength);
1.845 + if (iTestSection.Compare(KAudioOnly) == 0)
1.846 + {
1.847 + // audio only, GetVideoProperties should fail with KErrNotSupported. Set video length to 0
1.848 + User::LeaveIfError(CheckError(videoError, KErrNotSupported, _L("GetClipProperties(aParse, videoError, videoLength, audioLength))")));
1.849 + videoLength = 0;
1.850 + }
1.851 + else if (iTestSection.Compare(KVideoOnly) == 0)
1.852 + {
1.853 + // video only, GetAudioProperties should fail with KErrNotSupported. Set audio length to 0
1.854 + User::LeaveIfError(CheckError(err, KErrNotSupported, _L("GetClipProperties(aParse, videoError, videoLength, audioLength)")));
1.855 + audioLength = 0;
1.856 + }
1.857 + else
1.858 + {
1.859 + // All other files contains audio data
1.860 + User::LeaveIfError(CheckError(videoError, KErrNone, _L("GetClipProperties(aParse, videoError, videoLength, audioLength)")));
1.861 + User::LeaveIfError(CheckError(err, KErrNone, _L("GetClipProperties(aParse, videoError, videoLength, audioLength)")));
1.862 + }
1.863 +
1.864 + if (audioLength >= videoLength)
1.865 + {
1.866 + timeStampInMs = audioLength + 10000;
1.867 + }
1.868 + else
1.869 + {
1.870 + timeStampInMs = videoLength + 10000;
1.871 + }
1.872 +
1.873 + // Seek returns KErrNone even thought the position is more than the audio/video length. AudioPos/videoPos should
1.874 + // be the the last audio/video position
1.875 + err = aParse->Seek(timeStampInMs, EFalse, audioPos, videoPos);
1.876 + User::LeaveIfError(CheckError(err, KErrNone, _L("aParser->Seek() to an invalid position")));
1.877 +
1.878 + timeStampInMs = 0;
1.879 + err = aParse->Seek(timeStampInMs, EFalse, audioPos, videoPos);
1.880 + User::LeaveIfError(CheckError(err, KErrNone, _L("aParser->Seek(0, EFalse, audioPos, videoPos)")));
1.881 + }
1.882 + ParserCompleteL(aParse);
1.883 + }
1.884 +
1.885 +// -----------------------------------------------------------------------------
1.886 +// Read Video Decoder Info, video frame dependencies and user atom when these
1.887 +// info is not in the file
1.888 +// -----------------------------------------------------------------------------
1.889 +//
1.890 +C3GPLibParser_0120::C3GPLibParser_0120()
1.891 + {
1.892 + }
1.893 +
1.894 +TVerdict C3GPLibParser_0120::doTestStepL()
1.895 + {
1.896 + if(TestStepResult() == EPass)
1.897 + {
1.898 + TInt readBufferSize = 1000;
1.899 + C3GPParse* parser = C3GPParse::NewL(readBufferSize);
1.900 + CleanupStack::PushL(parser);
1.901 +
1.902 + TRAPD(err, VideoAttributesL(parser));
1.903 + if (err != KErrNone)
1.904 + {
1.905 + SetTestStepResult(EFail);
1.906 + }
1.907 +
1.908 + CleanupStack::PopAndDestroy(parser);
1.909 + }
1.910 + return TestStepResult();
1.911 + }
1.912 +
1.913 +void C3GPLibParser_0120::VideoAttributesL(C3GPParse* aParse)
1.914 + {
1.915 + // file mode
1.916 + ParserOpenFileL(aParse);
1.917 +
1.918 + // Read Video Decoder Info from a mp4/3gp/3g2 file containing H263 video.
1.919 + CallVideoDecoderInfoApiL(aParse, KErrNotSupported);
1.920 +
1.921 + ParserCompleteL(aParse);
1.922 + }
1.923 +
1.924 +// -----------------------------------------------------------------------------
1.925 +// Instantiate parser with read buffer size < 0.
1.926 +// -----------------------------------------------------------------------------
1.927 +//
1.928 +C3GPLibParser_0126::C3GPLibParser_0126()
1.929 + {
1.930 + }
1.931 +
1.932 +TVerdict C3GPLibParser_0126::doTestStepL()
1.933 + {
1.934 + if(TestStepResult() == EPass)
1.935 + {
1.936 + TInt readBufferSize = -1;
1.937 + C3GPParse* parser = C3GPParse::NewL(readBufferSize);
1.938 + if (parser)
1.939 + {
1.940 + SetTestStepResult(EFail);
1.941 + delete parser;
1.942 + parser = NULL;
1.943 + }
1.944 + }
1.945 + return TestStepResult();
1.946 + }
1.947 +
1.948 +// -----------------------------------------------------------------------------
1.949 +// Retrieve video and audio info using empty buffer and size 1 buffer for all
1.950 +// buffer related API.
1.951 +// -----------------------------------------------------------------------------
1.952 +//
1.953 +C3GPLibParser_0127::C3GPLibParser_0127()
1.954 + {
1.955 + }
1.956 +
1.957 +TVerdict C3GPLibParser_0127::doTestStepL()
1.958 + {
1.959 + if(TestStepResult() == EPass)
1.960 + {
1.961 + TInt readBufferSize = 1000;
1.962 + C3GPParse* parser = C3GPParse::NewL(readBufferSize);
1.963 + CleanupStack::PushL(parser);
1.964 +
1.965 + TRAPD(err, TestEmptyBufferL(parser));
1.966 + if (err != KErrNone)
1.967 + {
1.968 + SetTestStepResult(EFail);
1.969 + }
1.970 +
1.971 + CleanupStack::PopAndDestroy(parser);
1.972 + }
1.973 + return TestStepResult();
1.974 + }
1.975 +
1.976 +void C3GPLibParser_0127::TestEmptyBufferL(C3GPParse* aParse)
1.977 + {
1.978 + // file mode
1.979 + ParserOpenFileL(aParse);
1.980 +
1.981 + // Create an empty buffer
1.982 + TInt expectedErr = KErrOverflow;
1.983 + RBuf8 buffer;
1.984 + CleanupClosePushL(buffer);
1.985 +
1.986 + TUint32 udtType = 0x6d657461; // The udt type of test file is 'meta'
1.987 + TUint index = 0;
1.988 + T3GPUdtaLocation location = E3GPUdtaVideoTrak;
1.989 +
1.990 + if (iTestSection.Compare(KAudioMore) != 0)
1.991 + {
1.992 + buffer.CreateL(1);
1.993 + }
1.994 + else
1.995 + {
1.996 + buffer.CreateL(0);
1.997 + }
1.998 +
1.999 + TInt err = aParse->GetUserDataAtom(udtType, location, buffer, index);
1.1000 + User::LeaveIfError(CheckError(err, expectedErr, _L("GetUserDataAtom")));
1.1001 +
1.1002 + err = aParse->GetVideoDecoderSpecificInfo(buffer);
1.1003 + User::LeaveIfError(CheckError(err, expectedErr, _L("GetVideoDecoderSpecificInfo")));
1.1004 +
1.1005 + err = aParse->GetAudioDecoderSpecificInfo(buffer);
1.1006 + User::LeaveIfError(CheckError(err, expectedErr, _L("GetAudioDecoderSpecificInfo")));
1.1007 +
1.1008 + err = aParse->InsertData(buffer);
1.1009 + User::LeaveIfError(CheckError(err, KErrGeneral, _L("InsertData")));
1.1010 +
1.1011 + TUint timeStampInMs;
1.1012 + TUint timeStampInTimescale;
1.1013 + TInt returnedFrames;
1.1014 + err = aParse->ReadAudioFrames(buffer, returnedFrames, timeStampInMs, timeStampInTimescale);
1.1015 + User::LeaveIfError(CheckError(err, expectedErr, _L("ReadAudioFrames")));
1.1016 +
1.1017 + TBool keyframe;
1.1018 + err = aParse->ReadVideoFrame(buffer, keyframe, timeStampInMs, timeStampInTimescale);
1.1019 + User::LeaveIfError(CheckError(err, expectedErr, _L("ReadVideoFrame")));
1.1020 +
1.1021 + iSchedulerWait = new (ELeave) CActiveSchedulerWait;
1.1022 + if(!iSchedulerWait)
1.1023 + {
1.1024 + User::Leave(KErrNoMemory);
1.1025 + }
1.1026 +
1.1027 + iWaitForNotification = ETrue;
1.1028 + aParse->ReadVideoFrame(*this, buffer);
1.1029 +
1.1030 + if (iWaitForNotification)
1.1031 + {
1.1032 + iSchedulerWait->Start();
1.1033 + }
1.1034 + err = iAsyncError;
1.1035 + User::LeaveIfError(CheckError(err, expectedErr, _L("ReadVideoFrame async")));
1.1036 +
1.1037 + iWaitForNotification = ETrue;
1.1038 + aParse->ReadAudioFrames(*this, buffer);
1.1039 + CleanupStack::PopAndDestroy(&buffer);
1.1040 +
1.1041 + if (iWaitForNotification)
1.1042 + {
1.1043 + iSchedulerWait->Start();
1.1044 + }
1.1045 + err = iAsyncError;
1.1046 + User::LeaveIfError(CheckError(err, expectedErr, _L("ReadAudioFrames async")));
1.1047 +
1.1048 + if ( iSchedulerWait->IsStarted() )
1.1049 + {
1.1050 + iSchedulerWait->AsyncStop();
1.1051 + }
1.1052 + ParserCompleteL(aParse);
1.1053 + }
1.1054 +
1.1055 +// -----------------------------------------------------------------------------
1.1056 +// Async read before the parser has been setup.
1.1057 +// -----------------------------------------------------------------------------
1.1058 +//
1.1059 +C3GPLibParser_0130::C3GPLibParser_0130()
1.1060 + {
1.1061 + }
1.1062 +
1.1063 +TVerdict C3GPLibParser_0130::doTestStepPreambleL()
1.1064 + {
1.1065 + C3GPLib_AsyncObserver::doTestStepPreambleL();
1.1066 + if (TestStepResult() == EPass)
1.1067 + {
1.1068 + iScheduler = new (ELeave) CActiveScheduler;
1.1069 + CActiveScheduler::Install(iScheduler);
1.1070 + }
1.1071 + return TestStepResult();
1.1072 + }
1.1073 +
1.1074 +TVerdict C3GPLibParser_0130::doTestStepPostambleL()
1.1075 + {
1.1076 + C3GPLibParser_base::doTestStepPostambleL();
1.1077 + if( iScheduler )
1.1078 + {
1.1079 + INFO_PRINTF1(_L("delete iScheduler"));
1.1080 + CActiveScheduler::Install(NULL);
1.1081 + delete iScheduler;
1.1082 + iScheduler = NULL;
1.1083 + }
1.1084 +
1.1085 + return TestStepResult();
1.1086 + }
1.1087 +
1.1088 +TVerdict C3GPLibParser_0130::doTestStepL()
1.1089 + {
1.1090 + if(TestStepResult() == EPass)
1.1091 + {
1.1092 + C3GPParse* parser = C3GPParse::NewL();
1.1093 + CleanupStack::PushL(parser);
1.1094 +
1.1095 + TRAPD(err, ReadFrameAsyncWoOpenL(parser));
1.1096 + if (err != KErrNone)
1.1097 + {
1.1098 + SetTestStepResult(EFail);
1.1099 + }
1.1100 +
1.1101 + CleanupStack::PopAndDestroy(parser);
1.1102 + }
1.1103 + return TestStepResult();
1.1104 + }
1.1105 +
1.1106 +void C3GPLibParser_0130::ReadFrameAsyncWoOpenL(C3GPParse* aParser)
1.1107 + {
1.1108 + TInt err = ReadAudioVideoFrameAsync(aParser, ETrue);
1.1109 + User::LeaveIfError(CheckError(err, KErrNotReady, _L("ReadAudioVideoFrameAsync audio")));
1.1110 +
1.1111 + err = ReadAudioVideoFrameAsync(aParser, EFalse);
1.1112 + User::LeaveIfError(CheckError(err, KErrNotReady, _L("ReadAudioVideoFrameAsync video")));
1.1113 +
1.1114 + aParser->CancelReadFrame();
1.1115 + }
1.1116 +
1.1117 +// -----------------------------------------------------------------------------
1.1118 +// Async read negative test after the parser has been setup.
1.1119 +// -----------------------------------------------------------------------------
1.1120 +//
1.1121 +C3GPLibParser_0131::C3GPLibParser_0131()
1.1122 + {
1.1123 + }
1.1124 +
1.1125 +TVerdict C3GPLibParser_0131::doTestStepPreambleL()
1.1126 + {
1.1127 + C3GPLib_AsyncObserver::doTestStepPreambleL();
1.1128 + if (TestStepResult() == EPass)
1.1129 + {
1.1130 + iScheduler = new (ELeave) CActiveScheduler;
1.1131 + CActiveScheduler::Install(iScheduler);
1.1132 + }
1.1133 + return TestStepResult();
1.1134 + }
1.1135 +
1.1136 +TVerdict C3GPLibParser_0131::doTestStepPostambleL()
1.1137 + {
1.1138 + C3GPLib_AsyncObserver::doTestStepPostambleL();
1.1139 + if( iScheduler )
1.1140 + {
1.1141 + INFO_PRINTF1(_L("delete iScheduler"));
1.1142 + CActiveScheduler::Install(NULL);
1.1143 + delete iScheduler;
1.1144 + iScheduler = NULL;
1.1145 + }
1.1146 +
1.1147 + return TestStepResult();
1.1148 + }
1.1149 +
1.1150 +TVerdict C3GPLibParser_0131::doTestStepL()
1.1151 + {
1.1152 + if(TestStepResult() == EPass)
1.1153 + {
1.1154 + C3GPParse* parser = C3GPParse::NewL();
1.1155 + CleanupStack::PushL(parser);
1.1156 +
1.1157 + TRAPD(err, ReadFrameAsyncAfterOpenL(parser));
1.1158 + if (err != KErrNone)
1.1159 + {
1.1160 + SetTestStepResult(EFail);
1.1161 + }
1.1162 +
1.1163 + CleanupStack::PopAndDestroy(parser);
1.1164 + }
1.1165 + return TestStepResult();
1.1166 + }
1.1167 +
1.1168 +void C3GPLibParser_0131::ReadFrameAsyncAfterOpenL(C3GPParse* aParser)
1.1169 + {
1.1170 + // file mode
1.1171 + ParserOpenFileL(aParser);
1.1172 +
1.1173 + TInt videoError;
1.1174 + TUint videoLength;
1.1175 + TUint audioLength;
1.1176 + TInt AudioErr = GetClipProperties(aParser, videoError, videoLength, audioLength);
1.1177 +
1.1178 + if (AudioErr != KErrNone && AudioErr != KErrNotSupported && AudioErr == KErrCorrupt)
1.1179 + {
1.1180 + SetTestStepError(AudioErr);
1.1181 + if (!ShouldRunOOMTest())
1.1182 + {
1.1183 + ERR_PRINTF2(_L("audioErr %d; "), AudioErr);
1.1184 + }
1.1185 + ParserCompleteL(aParser);
1.1186 + return;
1.1187 + }
1.1188 + if (videoError != KErrNone && videoError != KErrNotSupported && videoError != KErrCorrupt)
1.1189 + {
1.1190 + SetTestStepError(videoError);
1.1191 + ERR_PRINTF2(_L("videoError %d; "), videoError);
1.1192 + ParserCompleteL(aParser);
1.1193 + return;
1.1194 + }
1.1195 +
1.1196 + TInt err = KErrNone;
1.1197 +
1.1198 + // Call read audio frame async when there is no audio. Expects error
1.1199 + if (AudioErr == KErrNotSupported || AudioErr == KErrCorrupt)
1.1200 + {
1.1201 + err = ReadAudioVideoFrameAsync(aParser, ETrue);
1.1202 + }
1.1203 +
1.1204 + if (err != KErrNone)
1.1205 + {
1.1206 + if (!ShouldRunOOMTest())
1.1207 + {
1.1208 + ERR_PRINTF2(_L("ReadAudioVideoFrameAsync audio err %d "), err);
1.1209 + }
1.1210 + SetTestStepError(err);
1.1211 + }
1.1212 +
1.1213 + // Call read video frame async when there is no video. Expects error
1.1214 + if (videoError == KErrNotSupported && AudioErr != KErrNotSupported)
1.1215 + {
1.1216 + err = ReadAudioVideoFrameAsync(aParser, EFalse);
1.1217 + if (err != KErrNone)
1.1218 + {
1.1219 + if (!ShouldRunOOMTest())
1.1220 + {
1.1221 + ERR_PRINTF2(_L("ReadAudioVideoFrameAsync video err %d "), err);
1.1222 + }
1.1223 + SetTestStepError(err);
1.1224 + }
1.1225 + }
1.1226 +
1.1227 + // call Cancel Async read when there is no outstanding async read request
1.1228 + aParser->CancelReadFrame();
1.1229 +
1.1230 + ParserCompleteL(aParser);
1.1231 + }
1.1232 +
1.1233 +// -----------------------------------------------------------------------------
1.1234 +// Retrieve video & audio frames async in buffer mode.
1.1235 +// -----------------------------------------------------------------------------
1.1236 +//
1.1237 +C3GPLibParser_0136::C3GPLibParser_0136()
1.1238 + {
1.1239 + }
1.1240 +
1.1241 +TVerdict C3GPLibParser_0136::doTestStepPreambleL()
1.1242 + {
1.1243 + C3GPLib_AsyncObserver::doTestStepPreambleL();
1.1244 + if (TestStepResult() == EPass)
1.1245 + {
1.1246 + iScheduler = new (ELeave) CActiveScheduler;
1.1247 + CActiveScheduler::Install(iScheduler);
1.1248 + }
1.1249 + return TestStepResult();
1.1250 + }
1.1251 +
1.1252 +TVerdict C3GPLibParser_0136::doTestStepPostambleL()
1.1253 + {
1.1254 + C3GPLib_AsyncObserver::doTestStepPostambleL();
1.1255 + if( iScheduler )
1.1256 + {
1.1257 + INFO_PRINTF1(_L("delete iScheduler"));
1.1258 + CActiveScheduler::Install(NULL);
1.1259 + delete iScheduler;
1.1260 + iScheduler = NULL;
1.1261 + }
1.1262 +
1.1263 + return TestStepResult();
1.1264 + }
1.1265 +
1.1266 +TVerdict C3GPLibParser_0136::doTestStepL()
1.1267 + {
1.1268 + if(TestStepResult() == EPass)
1.1269 + {
1.1270 + C3GPParse* parser = C3GPParse::NewL();
1.1271 + CleanupStack::PushL(parser);
1.1272 +
1.1273 + TRAPD(err, ReadFrameAsyncInBufferModeL(parser));
1.1274 + if (err != KErrNone)
1.1275 + {
1.1276 + SetTestStepResult(EFail);
1.1277 + }
1.1278 +
1.1279 + CleanupStack::PopAndDestroy(parser);
1.1280 + }
1.1281 + return TestStepResult();
1.1282 + }
1.1283 +
1.1284 +void C3GPLibParser_0136::OpenFileInBufferModeL(C3GPParse& aParser)
1.1285 + {
1.1286 + // open parser in buffer mode
1.1287 + User::LeaveIfError(aParser.Open());
1.1288 +
1.1289 + RFs fs;
1.1290 + User::LeaveIfError(fs.Connect());
1.1291 + CleanupClosePushL(fs);
1.1292 +
1.1293 + RFile file;
1.1294 + User::LeaveIfError(file.Open(fs, iInputFile, EFileRead | EFileStream));
1.1295 + CleanupClosePushL(file);
1.1296 +
1.1297 + RBuf8 buffer;
1.1298 + buffer.CreateL(1000);
1.1299 + CleanupClosePushL(buffer);
1.1300 +
1.1301 + TInt bufferRead = 0;
1.1302 + do
1.1303 + {
1.1304 + User::LeaveIfError(file.Read(buffer));
1.1305 + bufferRead = buffer.Length();
1.1306 + if (bufferRead > 0)
1.1307 + {
1.1308 + User::LeaveIfError(aParser.InsertData(buffer));
1.1309 + }
1.1310 + } while (bufferRead > 0);
1.1311 +
1.1312 + CleanupStack::PopAndDestroy(&buffer);
1.1313 + CleanupStack::PopAndDestroy(&file);
1.1314 + CleanupStack::PopAndDestroy(&fs);
1.1315 + }
1.1316 +
1.1317 +void C3GPLibParser_0136::ReadFrameAsyncInBufferModeL(C3GPParse* aParser)
1.1318 + {
1.1319 + ASSERT(aParser);
1.1320 +
1.1321 + // buffer mode
1.1322 + OpenFileInBufferModeL(*aParser);
1.1323 +
1.1324 + // Get Video & Audio properties to ensure both source exist
1.1325 + T3GPVideoType videoType;
1.1326 + T3GPAudioType audioType;
1.1327 + TReal frameRate;
1.1328 + TUint avgBitRate;
1.1329 + TSize videoSize;
1.1330 + TUint timeScale;
1.1331 + TInt framesPerSample;
1.1332 + TUint length;
1.1333 +
1.1334 + User::LeaveIfError(aParser->GetVideoProperties(videoType, length, frameRate, avgBitRate, videoSize, timeScale));
1.1335 + User::LeaveIfError(aParser->GetAudioProperties(audioType, length, framesPerSample, avgBitRate, timeScale));
1.1336 +
1.1337 + TInt audioFrameErr = ReadAudioVideoFrameAsync(aParser, ETrue);
1.1338 + TInt videoFrameErr = ReadAudioVideoFrameAsync(aParser, EFalse);
1.1339 + if (audioFrameErr != videoFrameErr)
1.1340 + {
1.1341 + ERR_PRINTF1(_L("Unexpected error returned"));
1.1342 + SetTestStepResult(EInconclusive);
1.1343 + }
1.1344 + else
1.1345 + {
1.1346 + SetTestStepError(audioFrameErr);
1.1347 + }
1.1348 +
1.1349 + // call Cancel Async read when there is no outstanding async read request
1.1350 + aParser->CancelReadFrame();
1.1351 +
1.1352 + ParserCompleteL(aParser);
1.1353 + }
1.1354 +
1.1355 +
1.1356 +// -----------------------------------------------------------------------------
1.1357 +// Get frame type using file path
1.1358 +// -----------------------------------------------------------------------------
1.1359 +//
1.1360 +C3GPLibParser_0135::C3GPLibParser_0135()
1.1361 + {
1.1362 + }
1.1363 +
1.1364 +
1.1365 +TVerdict C3GPLibParser_0135::doTestStepL()
1.1366 + {
1.1367 + if(TestStepResult() == EPass)
1.1368 + {
1.1369 + C3GPParse* parser = C3GPParse::NewL();
1.1370 + CleanupStack::PushL(parser);
1.1371 +
1.1372 + TRAPD(err, GetFrameTypeNegativeL(parser));
1.1373 + if (err != KErrNone)
1.1374 + {
1.1375 + SetTestStepResult(EFail);
1.1376 + }
1.1377 +
1.1378 + CleanupStack::PopAndDestroy(parser);
1.1379 + }
1.1380 + return TestStepResult();
1.1381 + }
1.1382 +
1.1383 +void C3GPLibParser_0135::GetFrameTypeNegativeL(C3GPParse* aParser)
1.1384 + {
1.1385 + ParserOpenFileL(aParser);
1.1386 +
1.1387 + T3GPFrameType type;
1.1388 + TInt err = KErrNone;
1.1389 + TInt videoError;
1.1390 + TUint videoLength;
1.1391 + TUint audioLength;
1.1392 + TInt AudioErr = GetClipProperties(aParser, videoError, videoLength, audioLength);
1.1393 +
1.1394 + if ((AudioErr != KErrNone && AudioErr != KErrNotSupported))
1.1395 + {
1.1396 + SetTestStepError(AudioErr);
1.1397 + ERR_PRINTF2(_L("audioErr %d; "), AudioErr);
1.1398 + ParserCompleteL(aParser);
1.1399 + return;
1.1400 + }
1.1401 + if ((videoError != KErrNone && videoError != KErrNotSupported))
1.1402 + {
1.1403 + SetTestStepError(videoError);
1.1404 + ERR_PRINTF2(_L("videoError %d; "), videoError);
1.1405 + ParserCompleteL(aParser);
1.1406 + return;
1.1407 + }
1.1408 +
1.1409 + if (AudioErr == KErrNone)
1.1410 + {
1.1411 + // read all audio frames and then check the next frame type
1.1412 + err = ReadAudioVideoFrame(aParser, ETrue, ETrue);
1.1413 + User::LeaveIfError(CheckError(err, KErrNotFound, _L("ReadAudioVideoFrame")));
1.1414 + }
1.1415 +
1.1416 + if (videoError == KErrNone )
1.1417 + {
1.1418 + // read all video frames
1.1419 + err = ReadAudioVideoFrame(aParser, ETrue);
1.1420 + User::LeaveIfError(CheckError(err, KErrNotFound, _L("ReadAudioVideoFrame")));
1.1421 + }
1.1422 +
1.1423 + if (err == KErrNotFound && (AudioErr == KErrNone || videoError == KErrNone))
1.1424 + {
1.1425 + err = aParser->GetFrameType(type);
1.1426 + }
1.1427 +
1.1428 + if (err != KErrNone)
1.1429 + {
1.1430 + SetTestStepError(err);
1.1431 + }
1.1432 +
1.1433 + ParserCompleteL(aParser);
1.1434 + }
1.1435 +
1.1436 +// -----------------------------------------------------------------------------
1.1437 +// Get audio/video attributes of a large file (>2GB) using 32bit APIs
1.1438 +// -----------------------------------------------------------------------------
1.1439 +//
1.1440 +C3GPLibParser_0137::C3GPLibParser_0137()
1.1441 + {
1.1442 + }
1.1443 +
1.1444 +TVerdict C3GPLibParser_0137::doTestStepL()
1.1445 + {
1.1446 + if(TestStepResult() == EPass)
1.1447 + {
1.1448 + C3GPParse* parser = C3GPParse::NewL();
1.1449 + CleanupStack::PushL(parser);
1.1450 +
1.1451 + TRAPD(err, GetVideoAudioAttributesL(parser));
1.1452 + if (err != KErrNone)
1.1453 + {
1.1454 + SetTestStepError(err);
1.1455 + }
1.1456 +
1.1457 + CleanupStack::PopAndDestroy(parser);
1.1458 + }
1.1459 + return TestStepResult();
1.1460 + }
1.1461 +
1.1462 +void C3GPLibParser_0137::GetVideoAudioAttributesL(C3GPParse* aParser)
1.1463 + {
1.1464 + // open parser in 32bit file handle
1.1465 + ParserOpenFileHandleL(aParser);
1.1466 + DoGetVideoAudioAttributesL(aParser);
1.1467 + ParserCompleteHandleL(aParser);
1.1468 + }
1.1469 +
1.1470 +// -----------------------------------------------------------------------------
1.1471 +// Get audio/video frames of a large file (>2GB) using 32bit APIs
1.1472 +// -----------------------------------------------------------------------------
1.1473 +//
1.1474 +C3GPLibParser_0138::C3GPLibParser_0138()
1.1475 + {
1.1476 + }
1.1477 +
1.1478 +TVerdict C3GPLibParser_0138::doTestStepL()
1.1479 + {
1.1480 + if(TestStepResult() == EPass)
1.1481 + {
1.1482 + C3GPParse* parser = C3GPParse::NewL();
1.1483 + CleanupStack::PushL(parser);
1.1484 +
1.1485 + TRAPD(err, ReadFrameL(parser));
1.1486 + if (err != KErrNone)
1.1487 + {
1.1488 + SetTestStepError(err);
1.1489 + }
1.1490 +
1.1491 + CleanupStack::PopAndDestroy(parser);
1.1492 + }
1.1493 + return TestStepResult();
1.1494 + }
1.1495 +
1.1496 +void C3GPLibParser_0138::ReadFrameL(C3GPParse* aParser)
1.1497 + {
1.1498 + // open parser in 32bit file handle
1.1499 + ParserOpenFileHandleL(aParser);
1.1500 + User::LeaveIfError(DoReadFrame(aParser));
1.1501 + ParserCompleteHandleL(aParser);
1.1502 + }
1.1503 +
1.1504 +// -----------------------------------------------------------------------------
1.1505 +// Get audio/video frames of a large file (>2GB) using 32bit APIs
1.1506 +// -----------------------------------------------------------------------------
1.1507 +//
1.1508 +C3GPLibParser_0139::C3GPLibParser_0139()
1.1509 + {
1.1510 + }
1.1511 +
1.1512 +TVerdict C3GPLibParser_0139::doTestStepPreambleL()
1.1513 + {
1.1514 + C3GPLib_AsyncObserver::doTestStepPreambleL();
1.1515 + if (TestStepResult() == EPass)
1.1516 + {
1.1517 + iScheduler = new (ELeave) CActiveScheduler;
1.1518 + CActiveScheduler::Install(iScheduler);
1.1519 + }
1.1520 + return TestStepResult();
1.1521 + }
1.1522 +
1.1523 +TVerdict C3GPLibParser_0139::doTestStepPostambleL()
1.1524 + {
1.1525 + C3GPLib_AsyncObserver::doTestStepPostambleL();
1.1526 + if( iScheduler )
1.1527 + {
1.1528 + INFO_PRINTF1(_L("delete iScheduler"));
1.1529 + CActiveScheduler::Install(NULL);
1.1530 + delete iScheduler;
1.1531 + iScheduler = NULL;
1.1532 + }
1.1533 +
1.1534 + return TestStepResult();
1.1535 + }
1.1536 +
1.1537 +TVerdict C3GPLibParser_0139::doTestStepL()
1.1538 + {
1.1539 + if(TestStepResult() == EPass)
1.1540 + {
1.1541 + C3GPParse* parser = C3GPParse::NewL();
1.1542 + CleanupStack::PushL(parser);
1.1543 +
1.1544 + TRAPD(err, ReadFrameAsyncL(parser));
1.1545 + if (err != KErrNone)
1.1546 + {
1.1547 + SetTestStepError(err);
1.1548 + }
1.1549 +
1.1550 + CleanupStack::PopAndDestroy(parser);
1.1551 + }
1.1552 + return TestStepResult();
1.1553 + }
1.1554 +
1.1555 +void C3GPLibParser_0139::ReadFrameAsyncL(C3GPParse* aParser)
1.1556 + {
1.1557 + ParserOpenFileHandleL(aParser);
1.1558 + User::LeaveIfError(DoReadFrameAsync(aParser));
1.1559 + if (!ShouldRunOOMTest())
1.1560 + {
1.1561 + INFO_PRINTF1(_L("C3GPLibParser_0014::ReadFrameAsyncL() using file handler"));
1.1562 + }
1.1563 + ParserCompleteHandleL(aParser);
1.1564 + }
1.1565 +
1.1566 +TInt C3GPLibParser_0139::DoReadFrameAsync(C3GPParse* aParser, TBool aCancel)
1.1567 + {
1.1568 + TInt err = KErrNone;
1.1569 +
1.1570 + if (!aCancel)
1.1571 + {
1.1572 + err = ReadAudioVideoFrameAsync(aParser, ETrue);
1.1573 + if (err == KErrNone)
1.1574 + {
1.1575 + err = ReadAudioVideoFrameAsync(aParser, EFalse);
1.1576 + }
1.1577 + }
1.1578 + else
1.1579 + {
1.1580 + err = ReadAudioVideoFrameAsync(aParser, EFalse, ETrue);
1.1581 + }
1.1582 +
1.1583 + return err;
1.1584 + }
1.1585 +
1.1586 +// -----------------------------------------------------------------------------
1.1587 +// Test the retrieval of Get video / audio properties when the properties are filled
1.1588 +// in but the file does not contain any actual data
1.1589 +// -----------------------------------------------------------------------------
1.1590 +//
1.1591 +TVerdict C3GPSingleDataSourceTest::doTestStepPreambleL()
1.1592 + {
1.1593 + TPtrC inputFile;
1.1594 + if(!GetStringFromConfig(ConfigSection(),_L("inputFile"), inputFile))
1.1595 + {
1.1596 + SetTestStepResult(EFail);
1.1597 + }
1.1598 + else
1.1599 + {
1.1600 + iParser = C3GPParse::NewL();
1.1601 + User::LeaveIfError(iParser->Open(inputFile));
1.1602 + SetTestStepResult(EPass);
1.1603 + SetTestStepError(KErrNone);
1.1604 + }
1.1605 +
1.1606 + return TestStepResult();
1.1607 + }
1.1608 +
1.1609 +TVerdict C3GPSingleDataSourceTest::doTestStepPostambleL()
1.1610 + {
1.1611 + if (iParser)
1.1612 + {
1.1613 + iParser->Complete();
1.1614 + delete iParser;
1.1615 +
1.1616 + }
1.1617 +
1.1618 + return TestStepResult();
1.1619 + }
1.1620 +
1.1621 +
1.1622 +TVerdict C3GPSingleDataSourceTest::doTestStepL()
1.1623 + {
1.1624 + if (TestStepResult() != EPass)
1.1625 + {
1.1626 + return TestStepResult();
1.1627 + }
1.1628 +
1.1629 + if (ConfigSection() == _L("MM-3GP-PARSE-U-0112-CP-2"))
1.1630 + {
1.1631 + // for a video only file containing audio properties but no real audio data
1.1632 + T3GPVideoType videoType;
1.1633 + TUint length;
1.1634 + TReal frameRate;
1.1635 + TUint avgBitRate;
1.1636 + TSize videoSize;
1.1637 + TUint timeScale;
1.1638 + TInt err = iParser->GetVideoProperties(videoType, length, frameRate, avgBitRate, videoSize, timeScale);
1.1639 + if (err == KErrNone)
1.1640 + {
1.1641 + T3GPAudioType audioType;
1.1642 + TInt framesPerSample;
1.1643 + TUint length;
1.1644 + TUint avgBitRate;
1.1645 + TUint timeScale;
1.1646 +
1.1647 + err = iParser->GetAudioProperties(audioType, length, framesPerSample, avgBitRate, timeScale);
1.1648 + if (err == KErrNone)
1.1649 + {
1.1650 + if (audioType == E3GPMpeg4Audio)
1.1651 + {
1.1652 + TInt size = 0;
1.1653 + err = iParser->GetAudioDecoderSpecificInfoSize(size);
1.1654 + if (err != KErrNone)
1.1655 + {
1.1656 + if (!ShouldRunOOMTest())
1.1657 + {
1.1658 + ERR_PRINTF2(_L("C3GPParse::GetAudioDecoderSpecificInfoSize returns %d."), err);
1.1659 + }
1.1660 + User::Leave(err);
1.1661 + }
1.1662 + }
1.1663 +
1.1664 + TBool available = EFalse;
1.1665 + err = iParser->GetFrameAvailability(E3GPAudio, available);
1.1666 + if (err != KErrNone && err != KErrNotFound)
1.1667 + {
1.1668 + if (!ShouldRunOOMTest())
1.1669 + {
1.1670 + ERR_PRINTF2(_L("C3GPParse::GetFrameAvailability returns %d."), err);
1.1671 + }
1.1672 + User::Leave(err);
1.1673 + }
1.1674 +
1.1675 + TUint frameSize = 0;
1.1676 + err = iParser->GetAudioFramesSize(frameSize);
1.1677 + if (err == KErrNone)
1.1678 + {
1.1679 + // Expect retrieval of audio properties to fail, doesn't matter what error code
1.1680 + // is returned
1.1681 + if (!ShouldRunOOMTest())
1.1682 + {
1.1683 + ERR_PRINTF1(_L("C3GPParse::GetAudioFramesSize expects to fail but does not"));
1.1684 + }
1.1685 + SetTestStepResult(EFail);
1.1686 + }
1.1687 +
1.1688 + if (TestStepResult() == EPass)
1.1689 + {
1.1690 + TUint frameIndex = 0;
1.1691 + err = iParser->GetAudioSampleEntryIndex(frameIndex);
1.1692 + if (err == KErrNone)
1.1693 + {
1.1694 + // Expect retrieval of audio properties to fail, doesn't matter what error code
1.1695 + // is returned
1.1696 + if (!ShouldRunOOMTest())
1.1697 + {
1.1698 + ERR_PRINTF1(_L("C3GPParse::GetAudioSampleEntryIndex expects to fail but does not"));
1.1699 + }
1.1700 + SetTestStepResult(EFail);
1.1701 + }
1.1702 + }
1.1703 + }
1.1704 + else
1.1705 + {
1.1706 + if (!ShouldRunOOMTest())
1.1707 + {
1.1708 + ERR_PRINTF2(_L("C3GPParse::GetAudioProperties returns %d"), err);
1.1709 + }
1.1710 + User::Leave(err);
1.1711 + }
1.1712 + }
1.1713 + }
1.1714 + else if (ConfigSection() == _L("MM-3GP-PARSE-U-0111-CP-2"))
1.1715 + {
1.1716 + // for a file containing audio data & video properties and a video track, but the video track
1.1717 + // contains NO video data
1.1718 + T3GPAudioType audioType;
1.1719 + TInt framesPerSample;
1.1720 + TUint length;
1.1721 + TUint avgBitRate;
1.1722 + TUint timeScale;
1.1723 +
1.1724 + TInt err = iParser->GetAudioProperties(audioType, length, framesPerSample, avgBitRate, timeScale);
1.1725 + if (err == KErrNone)
1.1726 + {
1.1727 + T3GPVideoType videoType;
1.1728 + TUint length;
1.1729 + TReal frameRate;
1.1730 + TUint avgBitRate;
1.1731 + TSize videoSize;
1.1732 + TUint timeScale;
1.1733 + err = iParser->GetVideoProperties(videoType, length, frameRate, avgBitRate, videoSize, timeScale);
1.1734 + if (err == KErrNone)
1.1735 + {
1.1736 + if (videoType == E3GPMpeg4Video || videoType == E3GPAvcProfileBaseline)
1.1737 + {
1.1738 + TInt size = 0;
1.1739 + err = iParser->GetVideoDecoderSpecificInfoSize(size);
1.1740 + if (err != KErrNone)
1.1741 + {
1.1742 + if (!ShouldRunOOMTest())
1.1743 + {
1.1744 + ERR_PRINTF2(_L("C3GPParse::GetVideoDecoderSpecificInfoSize returns %d."), err);
1.1745 + }
1.1746 + User::Leave(err);
1.1747 + }
1.1748 + }
1.1749 + }
1.1750 + else
1.1751 + {
1.1752 + if (!ShouldRunOOMTest())
1.1753 + {
1.1754 + ERR_PRINTF2(_L("C3GPParse::GetVideoProperties returns %d"), err);
1.1755 + }
1.1756 + User::Leave(err);
1.1757 + }
1.1758 +
1.1759 + TBool available = EFalse;
1.1760 + err = iParser->GetFrameAvailability(E3GPVideo, available);
1.1761 + if (err != KErrNone && err != KErrNotFound)
1.1762 + {
1.1763 + if (!ShouldRunOOMTest())
1.1764 + {
1.1765 + ERR_PRINTF2(_L("C3GPParse::GetFrameAvailability returns %d."), err);
1.1766 + }
1.1767 + User::Leave(err);
1.1768 + }
1.1769 +
1.1770 + TUint numberOfFrames = 0;
1.1771 + if (TestStepResult() == EPass)
1.1772 + {
1.1773 + err = iParser->GetNumberOfVideoFrames(numberOfFrames);
1.1774 + if (err != KErrNone)
1.1775 + {
1.1776 + if (!ShouldRunOOMTest())
1.1777 + {
1.1778 + ERR_PRINTF2(_L("C3GPParse::GetNumberOfVideoFrames returns %d"), err);
1.1779 + }
1.1780 + User::Leave(err);
1.1781 + }
1.1782 + if (numberOfFrames != 0)
1.1783 + {
1.1784 + if (!ShouldRunOOMTest())
1.1785 + {
1.1786 + ERR_PRINTF2(_L("C3GPParse::GetNumberOfVideoFrames retrieves %d frames when expecting 0"), numberOfFrames);
1.1787 + }
1.1788 + SetTestStepResult(EFail);
1.1789 + }
1.1790 + }
1.1791 +
1.1792 + if (TestStepResult() == EPass)
1.1793 + {
1.1794 + TUint frameSize;
1.1795 + TInt err = iParser->GetVideoFrameSize(frameSize);
1.1796 + if (err == KErrNone)
1.1797 + {
1.1798 + if (!ShouldRunOOMTest())
1.1799 + {
1.1800 + ERR_PRINTF1(_L("C3GPParse::GetVideoFrameSize expects to fail but does not"));
1.1801 + }
1.1802 + SetTestStepResult(EFail);
1.1803 + }
1.1804 + }
1.1805 +
1.1806 + if (TestStepResult() == EPass)
1.1807 + {
1.1808 + TUint tsInMs = 0;
1.1809 + TUint tsInTs = 0;
1.1810 + TInt err = iParser->GetVideoTimestamp(tsInMs, tsInTs);
1.1811 + if (err == KErrNone)
1.1812 + {
1.1813 + if (!ShouldRunOOMTest())
1.1814 + {
1.1815 + ERR_PRINTF1(_L("C3GPParse::GetVideoTimestamp expects to fail but does not"));
1.1816 + }
1.1817 + SetTestStepResult(EFail);
1.1818 + }
1.1819 + }
1.1820 +
1.1821 + if (TestStepResult() == EPass)
1.1822 + {
1.1823 + TUint index = 0;
1.1824 + TInt err = iParser->GetVideoSampleEntryIndex(index);
1.1825 + if (err == KErrNone)
1.1826 + {
1.1827 + if (!ShouldRunOOMTest())
1.1828 + {
1.1829 + ERR_PRINTF1(_L("C3GPParse::GetVideoSampleEntryIndex expects to fail but does not"));
1.1830 + }
1.1831 + SetTestStepResult(EFail);
1.1832 + }
1.1833 + }
1.1834 + }
1.1835 + }
1.1836 + else
1.1837 + {
1.1838 + SetTestStepResult(ETestSuiteError);
1.1839 + }
1.1840 +
1.1841 + return TestStepResult();
1.1842 + }
1.1843 +
1.1844 +
1.1845 +