1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmhais/videohai/devvideo/src/DevVideo/devvideoplay.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1675 @@
1.4 +// Copyright (c) 2003-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 <ecom/ecom.h>
1.20 +#ifdef SYMBIAN_MULTIMEDIA_CODEC_API
1.21 +#include <mdf/codecapiuids.hrh>
1.22 +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
1.23 +#include <mmf/devvideo/devvideohwdeviceadaptersetup.h>
1.24 +#endif
1.25 +#endif // SYMBIAN_MULTIMEDIA_CODEC_API
1.26 +
1.27 +#include "devvideoplay.h"
1.28 +#include "videoplayhwdevice.h"
1.29 +#include "devvideointernal.h"
1.30 +
1.31 +#include <mm/mmpluginutils.h>
1.32 +
1.33 +const THwDeviceId KHwDeviceIdVideoDecoder = 1;
1.34 +const THwDeviceId KHwDeviceIdVideoPostProcessor = 2;
1.35 +
1.36 +//
1.37 +// CMMFVideoDecodeHwDevice
1.38 +//
1.39 +EXPORT_C CMMFVideoDecodeHwDevice* CMMFVideoDecodeHwDevice::NewL(TUid aUid, MMMFDevVideoPlayProxy& aProxy)
1.40 + {
1.41 + CMMFVideoDecodeHwDevice* s = reinterpret_cast<CMMFVideoDecodeHwDevice*>
1.42 + (REComSession::CreateImplementationL(aUid, _FOFF(CMMFVideoDecodeHwDevice,iDtor_ID_Key)));
1.43 + s->SetProxy(aProxy);
1.44 + return s;
1.45 + }
1.46 +
1.47 +#ifdef SYMBIAN_MULTIMEDIA_CODEC_API
1.48 +const TInt KUidMDFVideoDecoderHwDeviceAdapter = 0x102737ED;
1.49 +EXPORT_C CMMFVideoDecodeHwDevice* CMMFVideoDecodeHwDevice::NewPuAdapterL(const CImplementationInformation& aInfo, MMMFDevVideoPlayProxy& aProxy)
1.50 + {
1.51 + CMMFVideoDecodeHwDevice* hwdevice = NewL(TUid::Uid(KUidMDFVideoDecoderHwDeviceAdapter), aProxy);
1.52 + CleanupStack::PushL(hwdevice);
1.53 +
1.54 + MDevVideoHwDeviceAdapterSetup* setup = static_cast<MDevVideoHwDeviceAdapterSetup*>(
1.55 + hwdevice->CustomInterface(TUid::Uid(KUidDevVideoHwDeviceAdapterSetup)));
1.56 +
1.57 + if (setup!=NULL)
1.58 + {
1.59 + setup->LoadProcessingUnitL(aInfo);
1.60 + }
1.61 + CleanupStack::Pop(hwdevice);
1.62 + return hwdevice;
1.63 + }
1.64 +#else
1.65 +EXPORT_C CMMFVideoDecodeHwDevice* CMMFVideoDecodeHwDevice::NewPuAdapterL(const CImplementationInformation& /*aInfo*/, MMMFDevVideoPlayProxy& /*aProxy*/)
1.66 + {
1.67 + User::Leave(KErrNotSupported);
1.68 + return NULL;
1.69 + }
1.70 +#endif // SYMBIAN_MULTIMEDIA_CODEC_API
1.71 +
1.72 +EXPORT_C CMMFVideoDecodeHwDevice::~CMMFVideoDecodeHwDevice()
1.73 + {
1.74 + REComSession::DestroyedImplementation(iDtor_ID_Key);
1.75 + }
1.76 +
1.77 +EXPORT_C CMMFVideoDecodeHwDevice::CMMFVideoDecodeHwDevice()
1.78 + {
1.79 + }
1.80 +
1.81 +
1.82 +//
1.83 +// CMMFVideoPostProcHwDevice
1.84 +//
1.85 +EXPORT_C CMMFVideoPostProcHwDevice* CMMFVideoPostProcHwDevice::NewL(TUid aUid, MMMFDevVideoPlayProxy& aProxy)
1.86 + {
1.87 + CMMFVideoPostProcHwDevice* s = reinterpret_cast<CMMFVideoPostProcHwDevice*>
1.88 + (REComSession::CreateImplementationL(aUid, _FOFF(CMMFVideoPostProcHwDevice,iDtor_ID_Key)));
1.89 + s->SetProxy(aProxy);
1.90 + return s;
1.91 + }
1.92 +
1.93 +EXPORT_C CMMFVideoPostProcHwDevice::~CMMFVideoPostProcHwDevice()
1.94 + {
1.95 + REComSession::DestroyedImplementation(iDtor_ID_Key);
1.96 + }
1.97 +
1.98 +EXPORT_C CMMFVideoPostProcHwDevice::CMMFVideoPostProcHwDevice()
1.99 + {
1.100 + }
1.101 +
1.102 +
1.103 +EXPORT_C TVideoInputBuffer::TVideoInputBuffer() :
1.104 + iData(0,0,0),
1.105 + iOptions(0),
1.106 + iDecodingTimestamp(0),
1.107 + iPresentationTimestamp(0),
1.108 + iPreRoll(EFalse),
1.109 + iSequenceNumber(0),
1.110 + iError(EFalse),
1.111 + iUser(NULL)
1.112 + {
1.113 + }
1.114 +
1.115 +
1.116 +//
1.117 +// CPostProcessorInfo
1.118 +//
1.119 +EXPORT_C CPostProcessorInfo* CPostProcessorInfo::NewL(TUid aUid,
1.120 + const TDesC& aManufacturer,
1.121 + const TDesC& aIdentifier,
1.122 + TVersion aVersion,
1.123 + const TArray<TUncompressedVideoFormat>& aSupportedFormats,
1.124 + const TArray<TUint32>& aSupportedCombinations,
1.125 + TBool aAccelerated,
1.126 + TBool aSupportsDirectDisplay,
1.127 + const TYuvToRgbCapabilities& aYuvToRgbCapabilities,
1.128 + TUint32 aSupportedRotations,
1.129 + TBool aSupportArbitraryScaling,
1.130 + const TArray<TScaleFactor>& aSupportedScaleFactors,
1.131 + TBool aAntiAliasedScaling,
1.132 + const TDesC8& aImplementationSpecificInfo)
1.133 + {
1.134 + CPostProcessorInfo* s = new(ELeave) CPostProcessorInfo(aUid,
1.135 + aVersion,
1.136 + aAccelerated,
1.137 + aSupportsDirectDisplay,
1.138 + aYuvToRgbCapabilities,
1.139 + aSupportedRotations,
1.140 + aSupportArbitraryScaling,
1.141 + aAntiAliasedScaling);
1.142 +
1.143 + CleanupStack::PushL(s);
1.144 +
1.145 + s->ConstructL(aManufacturer,
1.146 + aIdentifier,
1.147 + aSupportedFormats,
1.148 + aSupportedCombinations,
1.149 + aSupportedScaleFactors,
1.150 + aImplementationSpecificInfo);
1.151 +
1.152 + CleanupStack::Pop(s);
1.153 + return s;
1.154 + }
1.155 +
1.156 +CPostProcessorInfo::CPostProcessorInfo(TUid aUid,
1.157 + TVersion aVersion,
1.158 + TBool aAccelerated,
1.159 + TBool aSupportDirectDisplay,
1.160 + const TYuvToRgbCapabilities& aYuvToRgbCapabilities,
1.161 + TUint32 aSupportedRotations,
1.162 + TBool aSupportArbitraryScaling,
1.163 + TBool aAntiAliasedScaling) :
1.164 + iUid(aUid),
1.165 + iVersion(aVersion),
1.166 + iAccelerated(aAccelerated),
1.167 + iSupportDirectDisplay(aSupportDirectDisplay),
1.168 + iYuvToRgbCapabilities(aYuvToRgbCapabilities),
1.169 + iSupportedRotations(aSupportedRotations),
1.170 + iSupportArbitraryScaling(aSupportArbitraryScaling),
1.171 + iAntiAliasedScaling(aAntiAliasedScaling),
1.172 + iSupportsContentProtected(EFalse)
1.173 + {
1.174 + iSupportedScreens.Reset();
1.175 + }
1.176 +
1.177 +void CPostProcessorInfo::ConstructL(const TDesC& aManufacturer,
1.178 + const TDesC& aIdentifier,
1.179 + const TArray<TUncompressedVideoFormat>& aSupportedFormats,
1.180 + const TArray<TUint32>& aSupportedCombinations,
1.181 + const TArray<TScaleFactor>& aSupportedScaleFactors,
1.182 + const TDesC8& aImplementationSpecificInfo)
1.183 + {
1.184 + iManufacturer = aManufacturer.AllocL();
1.185 + iIdentifier = aIdentifier.AllocL();
1.186 + iImplementationSpecificInfo = aImplementationSpecificInfo.AllocL();
1.187 +
1.188 + TInt i=0;
1.189 + TInt supportedFormatsCount = aSupportedFormats.Count();
1.190 + for (i=0; i<supportedFormatsCount; i++)
1.191 + {
1.192 + User::LeaveIfError(iSupportedFormats.Append(aSupportedFormats[i]));
1.193 + }
1.194 +
1.195 + TInt supportedCombinationsCount = aSupportedCombinations.Count();
1.196 + for (i=0; i<supportedCombinationsCount; i++)
1.197 + {
1.198 + User::LeaveIfError(iSupportedCombinations.Append(aSupportedCombinations[i]));
1.199 + }
1.200 +
1.201 + TInt supportedScaleFactors = aSupportedScaleFactors.Count();
1.202 + for (i=0; i<supportedScaleFactors; i++)
1.203 + {
1.204 + User::LeaveIfError(iSupportedScaleFactors.Append(aSupportedScaleFactors[i]));
1.205 + }
1.206 + }
1.207 +
1.208 +EXPORT_C CPostProcessorInfo::~CPostProcessorInfo()
1.209 + {
1.210 + delete iManufacturer;
1.211 + delete iIdentifier;
1.212 + delete iImplementationSpecificInfo;
1.213 + iSupportedFormats.Reset();
1.214 + iSupportedCombinations.Reset();
1.215 + iSupportedScaleFactors.Reset();
1.216 + iSupportedScreens.Close();
1.217 + }
1.218 +
1.219 +EXPORT_C TUid CPostProcessorInfo::Uid() const
1.220 + {
1.221 + return iUid;
1.222 + }
1.223 +
1.224 +EXPORT_C const TDesC& CPostProcessorInfo::Manufacturer() const
1.225 + {
1.226 + return *iManufacturer;
1.227 + }
1.228 +
1.229 +EXPORT_C const TDesC& CPostProcessorInfo::Identifier() const
1.230 + {
1.231 + return *iIdentifier;
1.232 + }
1.233 +
1.234 +EXPORT_C TVersion CPostProcessorInfo::Version() const
1.235 + {
1.236 + return iVersion;
1.237 + }
1.238 +
1.239 +EXPORT_C TBool CPostProcessorInfo::SupportsFormat(const TUncompressedVideoFormat& aFormat) const
1.240 + {
1.241 + TBool found = EFalse;
1.242 + TInt count = iSupportedFormats.Count();
1.243 + for (TInt i=0; i<count; i++)
1.244 + {
1.245 + if (iSupportedFormats[i] == aFormat)
1.246 + {
1.247 + found = ETrue;
1.248 + break;
1.249 + }
1.250 + }
1.251 + return found;
1.252 + }
1.253 +
1.254 +EXPORT_C const RArray<TUncompressedVideoFormat>& CPostProcessorInfo::SupportedFormats() const
1.255 + {
1.256 + return iSupportedFormats;
1.257 + }
1.258 +
1.259 +EXPORT_C TBool CPostProcessorInfo::SupportsCombination(TUint32 aCombination) const
1.260 + {
1.261 + TBool found = EFalse;
1.262 + TInt count = iSupportedCombinations.Count();
1.263 + for (TInt i=0; i<count; i++)
1.264 + {
1.265 + if (iSupportedCombinations[i] == aCombination)
1.266 + {
1.267 + found = ETrue;
1.268 + break;
1.269 + }
1.270 + }
1.271 + return found;
1.272 + }
1.273 +
1.274 +EXPORT_C const RArray<TUint32>& CPostProcessorInfo::SupportedCombinations() const
1.275 + {
1.276 + return iSupportedCombinations;
1.277 + }
1.278 +
1.279 +EXPORT_C TBool CPostProcessorInfo::Accelerated() const
1.280 + {
1.281 + return iAccelerated;
1.282 + }
1.283 +
1.284 +EXPORT_C TBool CPostProcessorInfo::SupportsDirectDisplay() const
1.285 + {
1.286 + return iSupportDirectDisplay;
1.287 + }
1.288 +
1.289 +EXPORT_C const TYuvToRgbCapabilities& CPostProcessorInfo::YuvToRgbCapabilities() const
1.290 + {
1.291 + return iYuvToRgbCapabilities;
1.292 + }
1.293 +
1.294 +EXPORT_C TUint32 CPostProcessorInfo::SupportedRotations() const
1.295 + {
1.296 + return iSupportedRotations;
1.297 + }
1.298 +
1.299 +EXPORT_C TBool CPostProcessorInfo::SupportsArbitraryScaling() const
1.300 + {
1.301 + return iSupportArbitraryScaling;
1.302 + }
1.303 +
1.304 +EXPORT_C const RArray<TScaleFactor>& CPostProcessorInfo::SupportedScaleFactors() const
1.305 + {
1.306 + return iSupportedScaleFactors;
1.307 + }
1.308 +
1.309 +EXPORT_C TBool CPostProcessorInfo::AntiAliasedScaling() const
1.310 + {
1.311 + return iAntiAliasedScaling;
1.312 + }
1.313 +
1.314 +EXPORT_C const TDesC8& CPostProcessorInfo::ImplementationSpecificInfo() const
1.315 + {
1.316 + return *iImplementationSpecificInfo;
1.317 + }
1.318 +
1.319 +EXPORT_C void CPostProcessorInfo::AddSupportedScreenL(TInt aScreenNo)
1.320 + {
1.321 +#ifdef SYMBIAN_ENABLE_MMF_MULTISCREEN_SUPPORT
1.322 + iSupportedScreens.AppendL(aScreenNo);
1.323 +#else
1.324 + aScreenNo = aScreenNo; //Added to remove the warning
1.325 + User::Leave(KErrNotSupported);
1.326 +#endif
1.327 + }
1.328 +
1.329 +EXPORT_C void CPostProcessorInfo::GetSupportedScreensL(RArray<TInt>& aSupportedScreens) const
1.330 + {
1.331 +#ifdef SYMBIAN_ENABLE_MMF_MULTISCREEN_SUPPORT
1.332 + aSupportedScreens.Reset();
1.333 + TInt screensCount = iSupportedScreens.Count();
1.334 + for (TInt i = 0; i < screensCount;i++)
1.335 + {
1.336 + aSupportedScreens.AppendL(iSupportedScreens[i]);
1.337 + }
1.338 +#else
1.339 + aSupportedScreens = aSupportedScreens;//Added to remove the warning
1.340 + User::Leave(KErrNotSupported);
1.341 +#endif
1.342 + }
1.343 +
1.344 +EXPORT_C void CPostProcessorInfo::SetSupportsContentProtected(const TBool aSetting)
1.345 + {
1.346 + iSupportsContentProtected = aSetting;
1.347 + }
1.348 +
1.349 +EXPORT_C TBool CPostProcessorInfo::SupportsContentProtected() const
1.350 + {
1.351 + return iSupportsContentProtected;
1.352 + }
1.353 +
1.354 +//
1.355 +// CVideoDecoderInfo
1.356 +//
1.357 +EXPORT_C CVideoDecoderInfo* CVideoDecoderInfo::NewL(TUid aUid,
1.358 + const TDesC& aManufacturer,
1.359 + const TDesC& aIdentifier,
1.360 + TVersion aVersion,
1.361 + const TArray<CCompressedVideoFormat*>& aSupportedFormats,
1.362 + TBool aAccelerated,
1.363 + TBool aSupportsDirectDisplay,
1.364 + const TSize& aMaxPictureSize,
1.365 + TUint aMaxBitrate,
1.366 + const TArray<TPictureRateAndSize>& aMaxPictureRates,
1.367 + TBool aSupportsPictureLoss,
1.368 + TBool aSupportsSliceLoss,
1.369 + const TDesC8& aCodingStandardSpecificInfo,
1.370 + const TDesC8& aImplementationSpecificInfo)
1.371 + {
1.372 + CVideoDecoderInfo* s = new(ELeave) CVideoDecoderInfo(aUid,
1.373 + aVersion,
1.374 + aAccelerated,
1.375 + aSupportsDirectDisplay,
1.376 + aMaxPictureSize,
1.377 + aMaxBitrate,
1.378 + aSupportsPictureLoss,
1.379 + aSupportsSliceLoss);
1.380 +
1.381 + CleanupStack::PushL(s);
1.382 + s->ConstructL(aManufacturer, aIdentifier, aSupportedFormats, aMaxPictureRates, aCodingStandardSpecificInfo, aImplementationSpecificInfo);
1.383 + CleanupStack::Pop(s);
1.384 + return s;
1.385 + }
1.386 +
1.387 +CVideoDecoderInfo::CVideoDecoderInfo(TUid aUid,
1.388 + TVersion aVersion,
1.389 + TBool aAccelerated,
1.390 + TBool aSupportsDirectDisplay,
1.391 + const TSize& aMaxPictureSize,
1.392 + TUint aMaxBitrate,
1.393 + TBool aSupportsPictureLoss,
1.394 + TBool aSupportsSliceLoss) :
1.395 + iUid(aUid),
1.396 + iVersion(aVersion),
1.397 + iAccelerated(aAccelerated),
1.398 + iSupportsDirectDisplay(aSupportsDirectDisplay),
1.399 + iMaxPictureSize(aMaxPictureSize),
1.400 + iMaxBitrate(aMaxBitrate),
1.401 + iSupportsPictureLoss(aSupportsPictureLoss),
1.402 + iSupportsSliceLoss(aSupportsSliceLoss),
1.403 + iSupportsContentProtected(EFalse)
1.404 + {
1.405 + iSupportedScreens.Reset();
1.406 + }
1.407 +
1.408 +void CVideoDecoderInfo::ConstructL(const TDesC& aManufacturer,
1.409 + const TDesC& aIdentifier,
1.410 + const TArray<CCompressedVideoFormat*>& aSupportedFormats,
1.411 + const TArray<TPictureRateAndSize>& aMaxPictureRates,
1.412 + const TDesC8& aCodingStandardSpecificInfo,
1.413 + const TDesC8& aImplementationSpecificInfo)
1.414 + {
1.415 + iManufacturer = aManufacturer.AllocL();
1.416 + iIdentifier = aIdentifier.AllocL();
1.417 + iCodingStandardSpecificInfo = aCodingStandardSpecificInfo.AllocL();
1.418 + iImplementationSpecificInfo = aImplementationSpecificInfo.AllocL();
1.419 +
1.420 + TInt i=0;
1.421 + TInt count = aSupportedFormats.Count();
1.422 + for (i=0; i<count; i++)
1.423 + {
1.424 + CCompressedVideoFormat* f = CCompressedVideoFormat::NewL(*(aSupportedFormats[i]));
1.425 + CleanupStack::PushL(f);
1.426 + User::LeaveIfError(iSupportedFormats.Append(f));
1.427 + CleanupStack::Pop(f);
1.428 + }
1.429 +
1.430 + count = aMaxPictureRates.Count();
1.431 + for (i=0; i<count; i++)
1.432 + {
1.433 + User::LeaveIfError(iMaxPictureRates.Append(aMaxPictureRates[i]));
1.434 + }
1.435 + }
1.436 +
1.437 +EXPORT_C CVideoDecoderInfo::~CVideoDecoderInfo()
1.438 + {
1.439 + delete iManufacturer;
1.440 + delete iIdentifier;
1.441 + delete iCodingStandardSpecificInfo;
1.442 + delete iImplementationSpecificInfo;
1.443 + iSupportedFormats.ResetAndDestroy();
1.444 + iSupportedFormats.Close();
1.445 + iMaxPictureRates.Reset();
1.446 + iMaxPictureRates.Close();
1.447 + iSupportedScreens.Close();
1.448 + }
1.449 +
1.450 +EXPORT_C TBool CVideoDecoderInfo::SupportsFormat(const CCompressedVideoFormat& aFormat) const
1.451 + {
1.452 + TBool result = EFalse;
1.453 + TInt count = iSupportedFormats.Count();
1.454 + for (TInt i=0; i<count; i++)
1.455 + {
1.456 + if (*(iSupportedFormats[i]) == aFormat)
1.457 + {
1.458 + result = ETrue;
1.459 + break;
1.460 + }
1.461 + }
1.462 + return result;
1.463 + }
1.464 +
1.465 +EXPORT_C const RPointerArray<CCompressedVideoFormat>& CVideoDecoderInfo::SupportedFormats() const
1.466 + {
1.467 + return iSupportedFormats;
1.468 + }
1.469 +
1.470 +EXPORT_C const TDesC& CVideoDecoderInfo::Manufacturer() const
1.471 + {
1.472 + return *iManufacturer;
1.473 + }
1.474 +
1.475 +EXPORT_C const TDesC& CVideoDecoderInfo::Identifier() const
1.476 + {
1.477 + return *iIdentifier;
1.478 + }
1.479 +
1.480 +EXPORT_C TVersion CVideoDecoderInfo::Version() const
1.481 + {
1.482 + return iVersion;
1.483 + }
1.484 +
1.485 +EXPORT_C TUid CVideoDecoderInfo::Uid() const
1.486 + {
1.487 + return iUid;
1.488 + }
1.489 +
1.490 +EXPORT_C TBool CVideoDecoderInfo::Accelerated() const
1.491 + {
1.492 + return iAccelerated;
1.493 + }
1.494 +
1.495 +EXPORT_C TBool CVideoDecoderInfo::SupportsDirectDisplay() const
1.496 + {
1.497 + return iSupportsDirectDisplay;
1.498 + }
1.499 +
1.500 +EXPORT_C const TSize& CVideoDecoderInfo::MaxPictureSize() const
1.501 + {
1.502 + return iMaxPictureSize;
1.503 + }
1.504 +
1.505 +EXPORT_C TUint CVideoDecoderInfo::MaxBitrate() const
1.506 + {
1.507 + return iMaxBitrate;
1.508 + }
1.509 +
1.510 +EXPORT_C const RArray<TPictureRateAndSize>& CVideoDecoderInfo::MaxPictureRates() const
1.511 + {
1.512 + return iMaxPictureRates;
1.513 + }
1.514 +
1.515 +EXPORT_C TBool CVideoDecoderInfo::SupportsPictureLoss() const
1.516 + {
1.517 + return iSupportsPictureLoss;
1.518 + }
1.519 +
1.520 +EXPORT_C TBool CVideoDecoderInfo::SupportsSliceLoss() const
1.521 + {
1.522 + return iSupportsSliceLoss;
1.523 + }
1.524 +
1.525 +EXPORT_C const TDesC8& CVideoDecoderInfo::CodingStandardSpecificInfo() const
1.526 + {
1.527 + return *iCodingStandardSpecificInfo;
1.528 + }
1.529 +
1.530 +EXPORT_C const TDesC8& CVideoDecoderInfo::ImplementationSpecificInfo() const
1.531 + {
1.532 + return *iImplementationSpecificInfo;
1.533 + }
1.534 +
1.535 +EXPORT_C void CVideoDecoderInfo::AddSupportedScreenL(TInt aScreenNo)
1.536 + {
1.537 +#ifdef SYMBIAN_ENABLE_MMF_MULTISCREEN_SUPPORT
1.538 + iSupportedScreens.AppendL(aScreenNo);
1.539 +#else
1.540 + aScreenNo = aScreenNo; //Added to remove the warning.
1.541 + User::Leave(KErrNotSupported);
1.542 +#endif
1.543 + }
1.544 +
1.545 +EXPORT_C void CVideoDecoderInfo::GetSupportedScreensL(RArray<TInt>& aSupportedScreens) const
1.546 + {
1.547 +#ifdef SYMBIAN_ENABLE_MMF_MULTISCREEN_SUPPORT
1.548 + aSupportedScreens.Reset();
1.549 + TInt screensCount = iSupportedScreens.Count();
1.550 + for (TInt i = 0; i < screensCount;i++)
1.551 + {
1.552 + aSupportedScreens.AppendL(iSupportedScreens[i]);
1.553 + }
1.554 +#else
1.555 + aSupportedScreens = aSupportedScreens;//Added to remove the warning
1.556 + User::Leave(KErrNotSupported);
1.557 +#endif
1.558 + }
1.559 +
1.560 +EXPORT_C void CVideoDecoderInfo::SetSupportsContentProtected(const TBool aSetting)
1.561 + {
1.562 + iSupportsContentProtected = aSetting;
1.563 + }
1.564 +
1.565 +EXPORT_C TBool CVideoDecoderInfo::SupportsContentProtected() const
1.566 + {
1.567 + return iSupportsContentProtected;
1.568 + }
1.569 +
1.570 +//
1.571 +// CMMFDevVideoPlay
1.572 +//
1.573 +EXPORT_C CMMFDevVideoPlay* CMMFDevVideoPlay::NewL(MMMFDevVideoPlayObserver& aObserver)
1.574 + {
1.575 + return new(ELeave) CMMFDevVideoPlay(aObserver);
1.576 + }
1.577 +
1.578 +CMMFDevVideoPlay::CMMFDevVideoPlay(MMMFDevVideoPlayObserver& aObserver) :
1.579 + iObserver(aObserver),
1.580 + iInitializationState(ENotInitialized),
1.581 + iVideoPictureQue(_FOFF(TVideoPicture,iLink)),
1.582 + iVideoPictureQueIter(iVideoPictureQue)
1.583 + {
1.584 + }
1.585 +
1.586 +EXPORT_C CMMFDevVideoPlay::~CMMFDevVideoPlay()
1.587 + {
1.588 + delete iVideoDecodeHwDevice;
1.589 + delete iVideoPostProcHwDevice;
1.590 +#ifdef SYMBIAN_MULTIMEDIA_CODEC_API
1.591 + iPuImplementations.ResetAndDestroy();
1.592 +#endif
1.593 + }
1.594 +
1.595 +EXPORT_C TBool CMMFDevVideoPlay::FindCommonFormat(const TArray<TUncompressedVideoFormat>& aFormats1, const TArray<TUncompressedVideoFormat>& aFormats2, TUncompressedVideoFormat& aCommonFormat)
1.596 + {
1.597 + // Find the least expensive format common to both arrays.
1.598 + // Expense is proportional to array position, so do search twice, using each array as a base
1.599 +
1.600 + TInt formats1Position;
1.601 + TInt formats2Position;
1.602 +
1.603 + const TUncompressedVideoFormat* firstTry = NULL;
1.604 + TInt firstTryCumulativePosition = -1;
1.605 + const TUncompressedVideoFormat* secondTry = NULL;
1.606 + TInt secondTryCumulativePosition = -1;
1.607 +
1.608 + TInt formats1Count = aFormats1.Count();
1.609 + TInt formats2Count = aFormats2.Count();
1.610 +
1.611 + for (formats1Position=0; formats1Position < formats1Count; formats1Position++)
1.612 + {
1.613 + const TUncompressedVideoFormat& format1 = aFormats1[formats1Position];
1.614 +
1.615 + for (formats2Position=0; formats2Position < formats2Count; formats2Position++)
1.616 + {
1.617 + const TUncompressedVideoFormat& format2 = aFormats2[formats2Position];
1.618 + if (format1 == format2)
1.619 + {
1.620 + firstTry = &format1;
1.621 + firstTryCumulativePosition = formats1Position+formats2Position;
1.622 + break;
1.623 + }
1.624 + }
1.625 +
1.626 + if (firstTry != NULL)
1.627 + break;
1.628 + }
1.629 +
1.630 + for (formats2Position=0; formats2Position < formats2Count; formats2Position++)
1.631 + {
1.632 + const TUncompressedVideoFormat& format2 = aFormats2[formats2Position];
1.633 +
1.634 + for (formats1Position=0; formats1Position < formats1Count; formats1Position++)
1.635 + {
1.636 + const TUncompressedVideoFormat& format1 = aFormats1[formats1Position];
1.637 + if (format1 == format2)
1.638 + {
1.639 + secondTry = &format1;
1.640 + secondTryCumulativePosition = formats1Position+formats2Position;
1.641 + break;
1.642 + }
1.643 + }
1.644 +
1.645 + if (secondTry != NULL)
1.646 + break;
1.647 + }
1.648 +
1.649 + TBool found = EFalse;
1.650 +
1.651 + if (firstTry!=NULL)
1.652 + {
1.653 + ASSERT(secondTry!=NULL);
1.654 + found = ETrue;
1.655 + // Work out which is cheaper
1.656 + if (firstTryCumulativePosition <= secondTryCumulativePosition)
1.657 + {
1.658 + aCommonFormat = *firstTry;
1.659 + }
1.660 + else
1.661 + {
1.662 + aCommonFormat = *secondTry;
1.663 + }
1.664 + }
1.665 +
1.666 + return found;
1.667 + }
1.668 +
1.669 +EXPORT_C void CMMFDevVideoPlay::FindDecodersL(const TDesC8& aMimeType, TUint32 aPostProcType, RArray<TUid>& aDecoders, TBool aExactMatch)
1.670 + {
1.671 +#ifdef SYMBIAN_MULTIMEDIA_CODEC_API
1.672 + // find PU based plugins
1.673 + RImplInfoPtrArray codecPlugins;
1.674 + CleanupResetAndDestroyPushL(codecPlugins);
1.675 + DevVideoUtilities::FindVideoDecoderPluginsL(aMimeType, codecPlugins);
1.676 +
1.677 + aDecoders.Reset();
1.678 + for (TInt i = 0; i < codecPlugins.Count();i++)
1.679 + {
1.680 + aDecoders.AppendL(codecPlugins[i]->ImplementationUid());
1.681 + }
1.682 +
1.683 + CleanupStack::PopAndDestroy(&codecPlugins);
1.684 +#endif // SYMBIAN_MULTIMEDIA_CODEC_API
1.685 + RImplInfoPtrArray plugins;
1.686 + CleanupResetAndDestroyPushL(plugins);
1.687 +
1.688 + MmPluginUtils::FindImplementationsL(KUidDevVideoDecoderHwDevice, plugins);
1.689 +
1.690 + DevVideoUtilities::SelectPluginBasedOnMatchType(aMimeType, plugins);
1.691 +
1.692 + DevVideoUtilities::MatchPrePostProcessorCapabilitiesL(plugins, aPostProcType, aDecoders);
1.693 +
1.694 + // Perform the extra processing required if an exact match was requested
1.695 + if (aExactMatch)
1.696 + {
1.697 + // We now need to go through each of the plugins returned (which may have been matched using
1.698 + // a wildcard), instantiate each one, and perform an exact mime-type match.
1.699 + // Any plugins that don't support the desired mime type exactly will be removed from aDecoders.
1.700 + CCompressedVideoFormat* format = CCompressedVideoFormat::NewL(aMimeType);
1.701 + CleanupStack::PushL(format);
1.702 +
1.703 + for (TInt i=aDecoders.Count()-1; i>=0; i--)
1.704 + {
1.705 + TUid pluginUid = aDecoders[i];
1.706 + CVideoDecoderInfo* info = NULL;
1.707 + TRAPD(err, info = VideoDecoderInfoLC(pluginUid); CleanupStack::Pop(info););
1.708 + if (err == KErrNone)
1.709 + {
1.710 + if (!info->SupportsFormat(*format))
1.711 + {
1.712 + // The decoder doesn't support the format, so remove it from the list
1.713 + aDecoders.Remove(i);
1.714 + }
1.715 + delete info;
1.716 + }
1.717 + else if (err==KErrNotFound)
1.718 + {
1.719 + // we have a bogus UID so remove it from the list
1.720 + aDecoders.Remove(i);
1.721 + }
1.722 + else
1.723 + {
1.724 + User::Leave(err);
1.725 + }
1.726 + }
1.727 +
1.728 + CleanupStack::PopAndDestroy(format);
1.729 + }
1.730 +
1.731 + // Leave if we didn't find anything.
1.732 + if (aDecoders.Count() == 0)
1.733 + {
1.734 + User::Leave(KErrNotFound);
1.735 + }
1.736 +
1.737 + CleanupStack::PopAndDestroy(&plugins);
1.738 + }
1.739 +
1.740 +EXPORT_C void CMMFDevVideoPlay::FindPostProcessorsL(TUint32 aPostProcType, RArray<TUid>& aPostProcessors)
1.741 + {
1.742 + RImplInfoPtrArray plugins;
1.743 + CleanupResetAndDestroyPushL(plugins);
1.744 +
1.745 + MmPluginUtils::FindImplementationsL(KUidDevVideoPostProcessorHwDevice, plugins);
1.746 +
1.747 + DevVideoUtilities::MatchPrePostProcessorCapabilitiesL(plugins, aPostProcType, aPostProcessors);
1.748 +
1.749 + // Leave if we didn't find anything.
1.750 + if (aPostProcessors.Count() == 0)
1.751 + {
1.752 + User::Leave(KErrNotFound);
1.753 + }
1.754 +
1.755 + CleanupStack::PopAndDestroy(&plugins);
1.756 + }
1.757 +
1.758 +EXPORT_C void CMMFDevVideoPlay::GetDecoderListL(RArray<TUid>& aDecoders)
1.759 + {
1.760 + RImplInfoPtrArray plugins;
1.761 + CleanupResetAndDestroyPushL(plugins);
1.762 +
1.763 + MmPluginUtils::FindImplementationsL(KUidDevVideoDecoderHwDevice, plugins);
1.764 +
1.765 + aDecoders.Reset();
1.766 +
1.767 + TInt count = plugins.Count();
1.768 + for (TInt i=0; i<count; i++)
1.769 + {
1.770 + User::LeaveIfError(aDecoders.Append(plugins[i]->ImplementationUid()));
1.771 + }
1.772 +
1.773 + CleanupStack::PopAndDestroy(&plugins);
1.774 + }
1.775 +
1.776 +EXPORT_C void CMMFDevVideoPlay::GetPostProcessorListL(RArray<TUid>& aPostProcessors)
1.777 + {
1.778 + RImplInfoPtrArray plugins;
1.779 + CleanupResetAndDestroyPushL(plugins);
1.780 +
1.781 + MmPluginUtils::FindImplementationsL(KUidDevVideoPostProcessorHwDevice, plugins);
1.782 +
1.783 + aPostProcessors.Reset();
1.784 +
1.785 + TInt count = plugins.Count();
1.786 + for (TInt i=0; i<count; i++)
1.787 + {
1.788 + User::LeaveIfError(aPostProcessors.Append(plugins[i]->ImplementationUid()));
1.789 + }
1.790 +
1.791 + CleanupStack::PopAndDestroy(&plugins);
1.792 + }
1.793 +
1.794 +EXPORT_C CVideoDecoderInfo* CMMFDevVideoPlay::VideoDecoderInfoLC(TUid aVideoDecoder)
1.795 + {
1.796 + CMMFVideoDecodeHwDevice* dev = CreateDecoderL(aVideoDecoder);
1.797 + CleanupStack::PushL(dev);
1.798 + CVideoDecoderInfo* info = dev->VideoDecoderInfoLC();
1.799 + CleanupStack::Pop(info);
1.800 + CleanupStack::PopAndDestroy(dev);
1.801 + CleanupStack::PushL(info);
1.802 + return info;
1.803 + }
1.804 +
1.805 +EXPORT_C CPostProcessorInfo* CMMFDevVideoPlay::PostProcessorInfoLC(TUid aPostProcessor)
1.806 + {
1.807 + CMMFVideoPlayHwDevice* device = NULL;
1.808 +
1.809 + // Determine whether the aPostProcessor uid is for a decoder or a postprocessor hw device
1.810 + RArray<TUid> array;
1.811 + CleanupClosePushL(array);
1.812 +
1.813 + GetDecoderListL(array);
1.814 + TInt position = array.Find(aPostProcessor);
1.815 + if (position == KErrNotFound)
1.816 + {
1.817 + array.Reset();
1.818 + GetPostProcessorListL(array);
1.819 + position = array.Find(aPostProcessor);
1.820 + if (position != KErrNotFound)
1.821 + {
1.822 + // uid is a post processor
1.823 + device = static_cast<CMMFVideoPlayHwDevice*>(CMMFVideoPostProcHwDevice::NewL(aPostProcessor, *this));
1.824 + }
1.825 + }
1.826 + else
1.827 + {
1.828 + // uid is a decoder
1.829 + device = static_cast<CMMFVideoPlayHwDevice*>(CMMFVideoDecodeHwDevice::NewL(aPostProcessor, *this));
1.830 + }
1.831 + CleanupStack::PopAndDestroy(&array);
1.832 +
1.833 + CPostProcessorInfo* info = NULL;
1.834 + if (device)
1.835 + {
1.836 + CleanupStack::PushL(device);
1.837 + info = device->PostProcessorInfoLC();
1.838 + CleanupStack::Pop(info);
1.839 + CleanupStack::PopAndDestroy(device);
1.840 + CleanupStack::PushL(info);
1.841 + }
1.842 + return info;
1.843 + }
1.844 +
1.845 +EXPORT_C THwDeviceId CMMFDevVideoPlay::SelectDecoderL(TUid aDecoder)
1.846 + {
1.847 + // This method can only be called before InitializeL() has been called.
1.848 + CheckInitializationState(ENotInitialized);
1.849 +
1.850 + delete iVideoDecodeHwDevice;
1.851 + iVideoDecodeHwDevice = NULL;
1.852 +#ifdef SYMBIAN_MULTIMEDIA_CODEC_API
1.853 + iVideoDecodeHwDevice = CreateDecoderL(aDecoder);
1.854 +#else
1.855 + iVideoDecodeHwDevice = CMMFVideoDecodeHwDevice::NewL(aDecoder, *this);
1.856 +#endif // SYMBIAN_MULTIMEDIA_CODEC_API
1.857 + return KHwDeviceIdVideoDecoder;
1.858 + }
1.859 +
1.860 +EXPORT_C THwDeviceId CMMFDevVideoPlay::SelectPostProcessorL(TUid aPostProcessor)
1.861 + {
1.862 + // This method can only be called before InitializeL() has been called.
1.863 + CheckInitializationState(ENotInitialized);
1.864 +
1.865 + delete iVideoPostProcHwDevice;
1.866 + iVideoPostProcHwDevice = NULL;
1.867 + iVideoPostProcHwDevice = CMMFVideoPostProcHwDevice::NewL(aPostProcessor, *this);
1.868 +
1.869 + return KHwDeviceIdVideoPostProcessor;
1.870 + }
1.871 +
1.872 +EXPORT_C TVideoPictureHeader* CMMFDevVideoPlay::GetHeaderInformationL(TVideoDataUnitType aDataUnitType, TVideoDataUnitEncapsulation aDataUnitEncapsulation, TVideoInputBuffer* aDataUnit)
1.873 + {
1.874 + return VideoDecodeHwDevice().GetHeaderInformationL(aDataUnitType, aDataUnitEncapsulation, aDataUnit);
1.875 + }
1.876 +
1.877 +/**
1.878 +Configures the Decoder using header information known by the client.
1.879 +@param "aVideoPictureHeader" "Header information to configure the decoder with"
1.880 +@leave "The method will leave if an error occurs. Running out of data is not considered an error,
1.881 + as described above.
1.882 +@pre "This method can only be called before the API has been initialized with Initialize()."
1.883 +*/
1.884 +EXPORT_C void CMMFDevVideoPlay::ConfigureDecoderL(const TVideoPictureHeader& aVideoPictureHeader)
1.885 + {
1.886 + CheckInitializationState(ENotInitialized);
1.887 +
1.888 + VideoDecodeHwDevice().ConfigureDecoderL(aVideoPictureHeader);
1.889 + }
1.890 +
1.891 +
1.892 +
1.893 +EXPORT_C void CMMFDevVideoPlay::ReturnHeader(TVideoPictureHeader* aHeader)
1.894 + {
1.895 + // This method can only be called before InitializeL()
1.896 + CheckInitializationState(ENotInitialized);
1.897 +
1.898 + VideoDecodeHwDevice().ReturnHeader(aHeader);
1.899 + }
1.900 +
1.901 +EXPORT_C void CMMFDevVideoPlay::SetInputFormatL(THwDeviceId aHwDevice, const TUncompressedVideoFormat& aFormat)
1.902 + {
1.903 + CheckInitializationState(ENotInitialized);
1.904 +
1.905 + VideoPostProcHwDevice(aHwDevice).SetInputFormatL(aFormat);
1.906 + }
1.907 +
1.908 +EXPORT_C void CMMFDevVideoPlay::SetInputFormatL(THwDeviceId aHwDevice, const CCompressedVideoFormat& aFormat, TVideoDataUnitType aDataUnitType, TVideoDataUnitEncapsulation aEncapsulation, TBool aDataInOrder)
1.909 + {
1.910 + CheckInitializationState(ENotInitialized);
1.911 +
1.912 + VideoDecodeHwDevice(aHwDevice).SetInputFormatL(aFormat, aDataUnitType, aEncapsulation, aDataInOrder);
1.913 + }
1.914 +
1.915 +EXPORT_C void CMMFDevVideoPlay::GetOutputFormatListL(THwDeviceId aHwDevice, RArray<TUncompressedVideoFormat>& aFormats)
1.916 + {
1.917 + CheckInitializationState(ENotInitialized);
1.918 +
1.919 + VideoPlayHwDevice(aHwDevice).GetOutputFormatListL(aFormats);
1.920 + }
1.921 +
1.922 +EXPORT_C void CMMFDevVideoPlay::SetOutputFormatL(THwDeviceId aHwDevice, const TUncompressedVideoFormat &aFormat)
1.923 + {
1.924 + CheckInitializationState(ENotInitialized);
1.925 +
1.926 + VideoPlayHwDevice(aHwDevice).SetOutputFormatL(aFormat);
1.927 + }
1.928 +
1.929 +EXPORT_C void CMMFDevVideoPlay::SetClockSource(MMMFClockSource* aClock)
1.930 + {
1.931 + CheckInitializationState(ENotInitialized);
1.932 +
1.933 + ASSERT(aClock);
1.934 +
1.935 + // Make sure we have at least one of the hwdevices set up
1.936 + __ASSERT_ALWAYS((iVideoDecodeHwDevice||iVideoPostProcHwDevice), DevVideoPanic(EDevVideoPanicPreConditionViolation));
1.937 +
1.938 + // Set the clock source on both hw devices.
1.939 + if (iVideoDecodeHwDevice)
1.940 + iVideoDecodeHwDevice->SetClockSource(aClock);
1.941 + if (iVideoPostProcHwDevice)
1.942 + iVideoPostProcHwDevice->SetClockSource(aClock);
1.943 + }
1.944 +
1.945 +EXPORT_C void CMMFDevVideoPlay::SetVideoDestScreenL(TBool aScreen)
1.946 + {
1.947 + CheckInitializationState(ENotInitialized);
1.948 +
1.949 + // Pass on to the rendering hw device
1.950 + RenderingHwDevice().SetVideoDestScreenL(aScreen);
1.951 + }
1.952 +
1.953 +EXPORT_C void CMMFDevVideoPlay::SynchronizeDecoding(TBool aSynchronize)
1.954 + {
1.955 + CheckInitializationState(ENotInitialized);
1.956 +
1.957 + VideoDecodeHwDevice().SynchronizeDecoding(aSynchronize);
1.958 + }
1.959 +
1.960 +EXPORT_C void CMMFDevVideoPlay::SetBufferOptionsL(const TBufferOptions& aOptions)
1.961 + {
1.962 + CheckInitializationState(ENotInitialized);
1.963 +
1.964 + VideoDecodeHwDevice().SetBufferOptionsL(aOptions);
1.965 + }
1.966 +
1.967 +EXPORT_C void CMMFDevVideoPlay::GetBufferOptions(TBufferOptions& aOptions)
1.968 + {
1.969 + CheckInitializationState(ENotInitialized);
1.970 +
1.971 + VideoDecodeHwDevice().GetBufferOptions(aOptions);
1.972 + }
1.973 +
1.974 +EXPORT_C void CMMFDevVideoPlay::SetHrdVbvSpec(THrdVbvSpecification aHrdVbvSpec, const TDesC8& aHrdVbvParams)
1.975 + {
1.976 + CheckInitializationState(ENotInitialized);
1.977 +
1.978 + VideoDecodeHwDevice().SetHrdVbvSpec(aHrdVbvSpec, aHrdVbvParams);
1.979 + }
1.980 +
1.981 +EXPORT_C void CMMFDevVideoPlay::SetPostProcessTypesL(THwDeviceId aHwDevice, TUint32 aPostProcCombination)
1.982 + {
1.983 + CheckInitializationState(ENotInitialized|EInitialized);
1.984 +
1.985 + VideoPlayHwDevice(aHwDevice).SetPostProcessTypesL(aPostProcCombination);
1.986 + }
1.987 +
1.988 +EXPORT_C void CMMFDevVideoPlay::SetInputCropOptionsL(THwDeviceId aHwDevice, const TRect& aRect)
1.989 + {
1.990 + CheckInitializationState(ENotInitialized|EInitialized);
1.991 +
1.992 + VideoPlayHwDevice(aHwDevice).SetInputCropOptionsL(aRect);
1.993 + }
1.994 +
1.995 +EXPORT_C void CMMFDevVideoPlay::SetYuvToRgbOptionsL(THwDeviceId aHwDevice, const TYuvToRgbOptions& aOptions, const TYuvFormat& aYuvFormat, TRgbFormat aRgbFormat)
1.996 + {
1.997 + CheckInitializationState(ENotInitialized|EInitialized);
1.998 +
1.999 + VideoPlayHwDevice(aHwDevice).SetYuvToRgbOptionsL(aOptions, aYuvFormat, aRgbFormat);
1.1000 + }
1.1001 +
1.1002 +EXPORT_C void CMMFDevVideoPlay::SetYuvToRgbOptionsL(THwDeviceId aHwDevice, const TYuvToRgbOptions& aOptions)
1.1003 + {
1.1004 + CheckInitializationState(ENotInitialized|EInitialized);
1.1005 +
1.1006 + VideoPlayHwDevice(aHwDevice).SetYuvToRgbOptionsL(aOptions);
1.1007 + }
1.1008 +
1.1009 +EXPORT_C void CMMFDevVideoPlay::SetRotateOptionsL(THwDeviceId aHwDevice, TRotationType aRotationType)
1.1010 + {
1.1011 + CheckInitializationState(ENotInitialized|EInitialized);
1.1012 +
1.1013 + VideoPlayHwDevice(aHwDevice).SetRotateOptionsL(aRotationType);
1.1014 + }
1.1015 +
1.1016 +EXPORT_C void CMMFDevVideoPlay::SetScaleOptionsL(THwDeviceId aHwDevice, const TSize& aTargetSize, TBool aAntiAliasFiltering)
1.1017 + {
1.1018 + CheckInitializationState(ENotInitialized|EInitialized);
1.1019 +
1.1020 + VideoPlayHwDevice(aHwDevice).SetScaleOptionsL(aTargetSize, aAntiAliasFiltering);
1.1021 + }
1.1022 +
1.1023 +EXPORT_C void CMMFDevVideoPlay::SetOutputCropOptionsL(THwDeviceId aHwDevice, const TRect& aRect)
1.1024 + {
1.1025 + CheckInitializationState(ENotInitialized|EInitialized);
1.1026 +
1.1027 + VideoPlayHwDevice(aHwDevice).SetOutputCropOptionsL(aRect);
1.1028 + }
1.1029 +
1.1030 +EXPORT_C void CMMFDevVideoPlay::SetPostProcSpecificOptionsL(THwDeviceId aHwDevice, const TDesC8& aOptions)
1.1031 + {
1.1032 + CheckInitializationState(ENotInitialized|EInitialized);
1.1033 +
1.1034 + VideoPlayHwDevice(aHwDevice).SetPostProcSpecificOptionsL(aOptions);
1.1035 + }
1.1036 +
1.1037 +EXPORT_C void CMMFDevVideoPlay::Initialize()
1.1038 + {
1.1039 + CheckInitializationState(ENotInitialized);
1.1040 +
1.1041 + // First introduce the two plugins to each other
1.1042 + ConnectPlugins();
1.1043 +
1.1044 + // Next initialize the first hwdevice in the chain
1.1045 + if (iVideoDecodeHwDevice)
1.1046 + {
1.1047 + iInitializationState = EInitializing;
1.1048 + iVideoDecodeHwDevice->Initialize();
1.1049 + }
1.1050 + else if (iVideoPostProcHwDevice)
1.1051 + {
1.1052 + iInitializationState = EInitializing;
1.1053 + iVideoPostProcHwDevice->Initialize();
1.1054 + }
1.1055 + else
1.1056 + {
1.1057 + // No hwdevice to initialize so panic
1.1058 + DevVideoPanic(EDevVideoPanicPreConditionViolation);
1.1059 + }
1.1060 + }
1.1061 +
1.1062 +EXPORT_C void CMMFDevVideoPlay::StartDirectScreenAccessL(const TRect& aVideoRect, CFbsScreenDevice& aScreenDevice, const TRegion& aClipRegion)
1.1063 + {
1.1064 + CheckInitializationState(EInitialized);
1.1065 + RenderingHwDevice().StartDirectScreenAccessL(aVideoRect, aScreenDevice, aClipRegion);
1.1066 + }
1.1067 +
1.1068 +EXPORT_C void CMMFDevVideoPlay::SetScreenClipRegion(const TRegion& aRegion)
1.1069 + {
1.1070 + CheckInitializationState(EInitialized);
1.1071 + RenderingHwDevice().SetScreenClipRegion(aRegion);
1.1072 + }
1.1073 +
1.1074 +EXPORT_C void CMMFDevVideoPlay::SetPauseOnClipFail(TBool aPause)
1.1075 + {
1.1076 + CheckInitializationState(EInitialized);
1.1077 + RenderingHwDevice().SetPauseOnClipFail(aPause);
1.1078 + }
1.1079 +
1.1080 +EXPORT_C void CMMFDevVideoPlay::AbortDirectScreenAccess()
1.1081 + {
1.1082 + CheckInitializationState(EInitialized);
1.1083 + RenderingHwDevice().AbortDirectScreenAccess();
1.1084 + }
1.1085 +
1.1086 +EXPORT_C TBool CMMFDevVideoPlay::IsPlaying()
1.1087 + {
1.1088 + CheckInitializationState(EInitialized);
1.1089 + return RenderingHwDevice().IsPlaying();
1.1090 + }
1.1091 +
1.1092 +EXPORT_C void CMMFDevVideoPlay::Redraw()
1.1093 + {
1.1094 + CheckInitializationState(EInitialized);
1.1095 + RenderingHwDevice().Redraw();
1.1096 + }
1.1097 +
1.1098 +EXPORT_C void CMMFDevVideoPlay::Start()
1.1099 + {
1.1100 + CheckInitializationState(EInitialized);
1.1101 +
1.1102 + if (iVideoDecodeHwDevice)
1.1103 + iVideoDecodeHwDevice->Start();
1.1104 + if (iVideoPostProcHwDevice)
1.1105 + iVideoPostProcHwDevice->Start();
1.1106 + }
1.1107 +
1.1108 +EXPORT_C void CMMFDevVideoPlay::Stop()
1.1109 + {
1.1110 + CheckInitializationState(EInitialized);
1.1111 +
1.1112 + if (iVideoDecodeHwDevice)
1.1113 + iVideoDecodeHwDevice->Stop();
1.1114 + if (iVideoPostProcHwDevice)
1.1115 + iVideoPostProcHwDevice->Stop();
1.1116 + }
1.1117 +
1.1118 +EXPORT_C void CMMFDevVideoPlay::Pause()
1.1119 + {
1.1120 + CheckInitializationState(EInitialized);
1.1121 +
1.1122 + if (iVideoDecodeHwDevice)
1.1123 + iVideoDecodeHwDevice->Pause();
1.1124 + if (iVideoPostProcHwDevice)
1.1125 + iVideoPostProcHwDevice->Pause();
1.1126 + }
1.1127 +
1.1128 +EXPORT_C void CMMFDevVideoPlay::Resume()
1.1129 + {
1.1130 + CheckInitializationState(EInitialized);
1.1131 +
1.1132 + if (iVideoDecodeHwDevice)
1.1133 + iVideoDecodeHwDevice->Resume();
1.1134 + if (iVideoPostProcHwDevice)
1.1135 + iVideoPostProcHwDevice->Resume();
1.1136 + }
1.1137 +
1.1138 +EXPORT_C void CMMFDevVideoPlay::SetPosition(const TTimeIntervalMicroSeconds& aPlaybackPosition)
1.1139 + {
1.1140 + CheckInitializationState(EInitialized);
1.1141 +
1.1142 + if (iVideoDecodeHwDevice)
1.1143 + iVideoDecodeHwDevice->SetPosition(aPlaybackPosition);
1.1144 + if (iVideoPostProcHwDevice)
1.1145 + iVideoPostProcHwDevice->SetPosition(aPlaybackPosition);
1.1146 + }
1.1147 +
1.1148 +EXPORT_C void CMMFDevVideoPlay::FreezePicture(const TTimeIntervalMicroSeconds& aPlaybackPosition)
1.1149 + {
1.1150 + CheckInitializationState(EInitialized);
1.1151 + RenderingHwDevice().FreezePicture(aPlaybackPosition);
1.1152 + }
1.1153 +
1.1154 +EXPORT_C void CMMFDevVideoPlay::ReleaseFreeze(const TTimeIntervalMicroSeconds& aPlaybackPosition)
1.1155 + {
1.1156 + CheckInitializationState(EInitialized);
1.1157 + RenderingHwDevice().ReleaseFreeze(aPlaybackPosition);
1.1158 + }
1.1159 +
1.1160 +EXPORT_C TTimeIntervalMicroSeconds CMMFDevVideoPlay::DecodingPosition()
1.1161 + {
1.1162 + CheckInitializationState(EInitialized);
1.1163 + return VideoDecodeHwDevice().DecodingPosition();
1.1164 + }
1.1165 +
1.1166 +EXPORT_C TTimeIntervalMicroSeconds CMMFDevVideoPlay::PlaybackPosition()
1.1167 + {
1.1168 + CheckInitializationState(EInitialized);
1.1169 + return RenderingHwDevice().PlaybackPosition();
1.1170 + }
1.1171 +
1.1172 +EXPORT_C TUint CMMFDevVideoPlay::PreDecoderBufferBytes()
1.1173 + {
1.1174 + CheckInitializationState(EInitialized);
1.1175 + return VideoDecodeHwDevice().PreDecoderBufferBytes();
1.1176 + }
1.1177 +
1.1178 +EXPORT_C TUint CMMFDevVideoPlay::PictureBufferBytes()
1.1179 + {
1.1180 + CheckInitializationState(EInitialized);
1.1181 + return RenderingHwDevice().PictureBufferBytes();
1.1182 + }
1.1183 +
1.1184 +EXPORT_C void CMMFDevVideoPlay::GetPictureCounters(TPictureCounters& aCounters)
1.1185 + {
1.1186 + CheckInitializationState(EInitialized);
1.1187 +
1.1188 + TPictureCounters decoderPictureCounters;
1.1189 + TPictureCounters postProcPictureCounters;
1.1190 +
1.1191 + if (iVideoDecodeHwDevice)
1.1192 + iVideoDecodeHwDevice->GetPictureCounters(decoderPictureCounters);
1.1193 +
1.1194 + if (iVideoPostProcHwDevice)
1.1195 + iVideoPostProcHwDevice->GetPictureCounters(postProcPictureCounters);
1.1196 +
1.1197 +
1.1198 + // Only the decoder (if any) knows the number of pictures decoded
1.1199 + aCounters.iPicturesDecoded = decoderPictureCounters.iPicturesDecoded;
1.1200 +
1.1201 + // Pictures skipped is sum of pictures skipped from decoder and postproc
1.1202 + aCounters.iPicturesSkipped = decoderPictureCounters.iPicturesSkipped
1.1203 + + postProcPictureCounters.iPicturesSkipped;
1.1204 +
1.1205 + // Ask last plugin in chain for number of pictures displayed
1.1206 + if (iVideoPostProcHwDevice)
1.1207 + aCounters.iPicturesDisplayed = postProcPictureCounters.iPicturesDisplayed;
1.1208 + else
1.1209 + aCounters.iPicturesDisplayed = decoderPictureCounters.iPicturesDisplayed;
1.1210 +
1.1211 + // Ask first plugin in chain for number of input pictures
1.1212 + if (iVideoDecodeHwDevice)
1.1213 + aCounters.iTotalPictures = decoderPictureCounters.iTotalPictures;
1.1214 + else
1.1215 + aCounters.iTotalPictures = postProcPictureCounters.iTotalPictures;
1.1216 + }
1.1217 +
1.1218 +EXPORT_C void CMMFDevVideoPlay::GetBitstreamCounters(TBitstreamCounters& aCounters)
1.1219 + {
1.1220 + CheckInitializationState(EInitialized);
1.1221 + VideoDecodeHwDevice().GetBitstreamCounters(aCounters);
1.1222 + }
1.1223 +
1.1224 +EXPORT_C TUint CMMFDevVideoPlay::NumFreeBuffers()
1.1225 + {
1.1226 + CheckInitializationState(EInitialized);
1.1227 + return VideoDecodeHwDevice().NumFreeBuffers();
1.1228 + }
1.1229 +
1.1230 +EXPORT_C void CMMFDevVideoPlay::SetComplexityLevel(THwDeviceId aHwDevice, TUint aLevel)
1.1231 + {
1.1232 + CheckInitializationState(EInitialized);
1.1233 + VideoPlayHwDevice(aHwDevice).SetComplexityLevel(aLevel);
1.1234 + }
1.1235 +
1.1236 +EXPORT_C TUint CMMFDevVideoPlay::NumComplexityLevels(THwDeviceId aHwDevice)
1.1237 + {
1.1238 + CheckInitializationState(EInitialized);
1.1239 + return VideoPlayHwDevice(aHwDevice).NumComplexityLevels();
1.1240 + }
1.1241 +
1.1242 +EXPORT_C void CMMFDevVideoPlay::GetComplexityLevelInfo(THwDeviceId aHwDevice, TUint aLevel, TComplexityLevelInfo& aInfo)
1.1243 + {
1.1244 + CheckInitializationState(EInitialized);
1.1245 + VideoPlayHwDevice(aHwDevice).GetComplexityLevelInfo(aLevel, aInfo);
1.1246 + }
1.1247 +
1.1248 +EXPORT_C TVideoInputBuffer* CMMFDevVideoPlay::GetBufferL(TUint aBufferSize)
1.1249 + {
1.1250 + return VideoDecodeHwDevice().GetBufferL(aBufferSize);
1.1251 + }
1.1252 +
1.1253 +EXPORT_C void CMMFDevVideoPlay::WriteCodedDataL(TVideoInputBuffer* aBuffer)
1.1254 + {
1.1255 + CheckInitializationState(EInitialized);
1.1256 + VideoDecodeHwDevice().WriteCodedDataL(aBuffer);
1.1257 + }
1.1258 +
1.1259 +EXPORT_C void CMMFDevVideoPlay::WritePictureL(TVideoPicture* aPicture)
1.1260 + {
1.1261 + CheckInitializationState(EInitialized);
1.1262 + VideoPostProcHwDevice().WritePictureL(aPicture);
1.1263 + }
1.1264 +
1.1265 +EXPORT_C void CMMFDevVideoPlay::InputEnd()
1.1266 + {
1.1267 + CheckInitializationState(EInitialized);
1.1268 +
1.1269 + //If decoder and post-processor exist,InputEnd() of decoder is issued
1.1270 + //and wait for reply from it before issuing PostProcessor InputEnd()
1.1271 + //iIsDecodeComplete is EFalse, until decoder responds
1.1272 + iIsDecodeComplete=EFalse;
1.1273 +
1.1274 + if (iVideoDecodeHwDevice)
1.1275 + {
1.1276 + iVideoDecodeHwDevice->InputEnd();
1.1277 + return;
1.1278 + }
1.1279 + if (iVideoPostProcHwDevice)
1.1280 + {
1.1281 + iVideoPostProcHwDevice->InputEnd();
1.1282 + }
1.1283 + }
1.1284 +
1.1285 +EXPORT_C void CMMFDevVideoPlay::GetNewPictureInfo(TUint& aNumPictures, TTimeIntervalMicroSeconds& aEarliestTimestamp, TTimeIntervalMicroSeconds& aLatestTimestamp)
1.1286 + {
1.1287 + CheckInitializationState(EInitialized);
1.1288 +
1.1289 + aNumPictures = iNumberOfVideoPictures;
1.1290 + if (iNumberOfVideoPictures > 0)
1.1291 + {
1.1292 + aEarliestTimestamp = iVideoPictureQue.First()->iTimestamp;
1.1293 + aLatestTimestamp = iVideoPictureQue.Last()->iTimestamp;
1.1294 + }
1.1295 + }
1.1296 +
1.1297 +EXPORT_C TVideoPicture* CMMFDevVideoPlay::NextPictureL()
1.1298 + {
1.1299 +
1.1300 + CheckInitializationState(EInitialized);
1.1301 +
1.1302 + if (iNumberOfVideoPictures == 0)
1.1303 + return NULL;
1.1304 +
1.1305 + TVideoPicture* picture = iVideoPictureQue.First();
1.1306 +
1.1307 + // Remove the picture from the list
1.1308 + picture->iLink.Deque();
1.1309 + iNumberOfVideoPictures--;
1.1310 +
1.1311 + return picture;
1.1312 + }
1.1313 +
1.1314 +EXPORT_C void CMMFDevVideoPlay::ReturnPicture(TVideoPicture* aPicture)
1.1315 + {
1.1316 + CheckInitializationState(EInitialized);
1.1317 +
1.1318 + // Return the picture to the hwdevice
1.1319 + RenderingHwDevice().ReturnPicture(aPicture);
1.1320 + }
1.1321 +
1.1322 +EXPORT_C TBool CMMFDevVideoPlay::GetSnapshotL(TPictureData& aPictureData, const TUncompressedVideoFormat& aFormat)
1.1323 + {
1.1324 + CheckInitializationState(EInitialized);
1.1325 + return RenderingHwDevice().GetSnapshotL(aPictureData, aFormat);
1.1326 + }
1.1327 +
1.1328 +EXPORT_C void CMMFDevVideoPlay::GetTimedSnapshotL(TPictureData* aPictureData, const TUncompressedVideoFormat& aFormat, const TTimeIntervalMicroSeconds& aPresentationTimestamp)
1.1329 + {
1.1330 + CheckInitializationState(EInitialized);
1.1331 + RenderingHwDevice().GetTimedSnapshotL(aPictureData, aFormat, aPresentationTimestamp);
1.1332 + }
1.1333 +
1.1334 +EXPORT_C void CMMFDevVideoPlay::GetTimedSnapshotL(TPictureData* aPictureData, const TUncompressedVideoFormat& aFormat, const TPictureId& aPictureId)
1.1335 + {
1.1336 + CheckInitializationState(EInitialized);
1.1337 + RenderingHwDevice().GetTimedSnapshotL(aPictureData, aFormat, aPictureId);
1.1338 + }
1.1339 +
1.1340 +EXPORT_C void CMMFDevVideoPlay::CancelTimedSnapshot()
1.1341 + {
1.1342 + CheckInitializationState(EInitialized);
1.1343 + RenderingHwDevice().CancelTimedSnapshot();
1.1344 + }
1.1345 +
1.1346 +EXPORT_C void CMMFDevVideoPlay::GetSupportedSnapshotFormatsL(RArray<TUncompressedVideoFormat>& aFormats)
1.1347 + {
1.1348 + CheckInitializationState(EInitialized);
1.1349 + RenderingHwDevice().GetSupportedSnapshotFormatsL(aFormats);
1.1350 + }
1.1351 +
1.1352 +EXPORT_C void CMMFDevVideoPlay::CommitL()
1.1353 + {
1.1354 + CheckInitializationState(EInitialized);
1.1355 + if (iVideoDecodeHwDevice)
1.1356 + iVideoDecodeHwDevice->CommitL();
1.1357 + if (iVideoPostProcHwDevice)
1.1358 + iVideoPostProcHwDevice->CommitL();
1.1359 + }
1.1360 +
1.1361 +EXPORT_C void CMMFDevVideoPlay::Revert()
1.1362 + {
1.1363 + CheckInitializationState(EInitialized);
1.1364 + if (iVideoDecodeHwDevice)
1.1365 + iVideoDecodeHwDevice->Revert();
1.1366 + if (iVideoPostProcHwDevice)
1.1367 + iVideoPostProcHwDevice->Revert();
1.1368 + }
1.1369 +
1.1370 +EXPORT_C TAny* CMMFDevVideoPlay::CustomInterface(THwDeviceId aHwDevice, TUid aInterface)
1.1371 + {
1.1372 + CheckInitializationState(ENotInitialized|EInitialized);
1.1373 + return VideoHwDevice(aHwDevice).CustomInterface(aInterface);
1.1374 + }
1.1375 +
1.1376 +void CMMFDevVideoPlay::MdvppNewPicture(TVideoPicture* aPicture)
1.1377 + {
1.1378 + iVideoPictureQue.AddLast(*aPicture);
1.1379 + iNumberOfVideoPictures++;
1.1380 +
1.1381 + iObserver.MdvpoNewPictures();
1.1382 + }
1.1383 +
1.1384 +void CMMFDevVideoPlay::MdvppNewBuffers()
1.1385 + {
1.1386 + iObserver.MdvpoNewBuffers();
1.1387 + }
1.1388 +
1.1389 +void CMMFDevVideoPlay::MdvppReturnPicture(TVideoPicture* aPicture)
1.1390 + {
1.1391 + iObserver.MdvpoReturnPicture(aPicture);
1.1392 + }
1.1393 +
1.1394 +void CMMFDevVideoPlay::MdvppSupplementalInformation(const TDesC8& aData, const TTimeIntervalMicroSeconds& aTimestamp, const TPictureId& aPictureId)
1.1395 + {
1.1396 + iObserver.MdvpoSupplementalInformation(aData, aTimestamp, aPictureId);
1.1397 + }
1.1398 +
1.1399 +void CMMFDevVideoPlay::MdvppPictureLoss()
1.1400 + {
1.1401 + iObserver.MdvpoPictureLoss();
1.1402 + }
1.1403 +
1.1404 +void CMMFDevVideoPlay::MdvppPictureLoss(const TArray<TPictureId>& aPictures)
1.1405 + {
1.1406 + iObserver.MdvpoPictureLoss(aPictures);
1.1407 + }
1.1408 +
1.1409 +void CMMFDevVideoPlay::MdvppSliceLoss(TUint aFirstMacroblock, TUint aNumMacroblocks, const TPictureId& aPicture)
1.1410 + {
1.1411 + iObserver.MdvpoSliceLoss(aFirstMacroblock, aNumMacroblocks, aPicture);
1.1412 + }
1.1413 +
1.1414 +void CMMFDevVideoPlay::MdvppReferencePictureSelection(const TDesC8& aSelectionData)
1.1415 + {
1.1416 + iObserver.MdvpoReferencePictureSelection(aSelectionData);
1.1417 + }
1.1418 +
1.1419 +void CMMFDevVideoPlay::MdvppTimedSnapshotComplete(TInt aError, TPictureData* aPictureData, const TTimeIntervalMicroSeconds& aPresentationTimestamp, const TPictureId& aPictureId)
1.1420 + {
1.1421 + iObserver.MdvpoTimedSnapshotComplete(aError, aPictureData, aPresentationTimestamp, aPictureId);
1.1422 + }
1.1423 +
1.1424 +void CMMFDevVideoPlay::MdvppFatalError(CMMFVideoHwDevice* aDevice, TInt aError)
1.1425 + {
1.1426 + // Make sure the other plugin gets stopped
1.1427 + __ASSERT_DEBUG((aDevice!=NULL) && ((aDevice==iVideoDecodeHwDevice) || (aDevice==iVideoPostProcHwDevice)), DevVideoPanic(EDevVideoPanicPreConditionViolation));
1.1428 + if ((aDevice == iVideoDecodeHwDevice) && (iVideoPostProcHwDevice))
1.1429 + iVideoPostProcHwDevice->Stop();
1.1430 + else if ((aDevice == iVideoPostProcHwDevice) && (iVideoDecodeHwDevice))
1.1431 + iVideoDecodeHwDevice->Stop();
1.1432 +
1.1433 + // Place the object in the "initialization failed" state to prevent any more method calls
1.1434 + // This state is purely internal so this is ok.
1.1435 + iInitializationState = EInitializationFailed;
1.1436 +
1.1437 + iObserver.MdvpoFatalError(aError);
1.1438 + }
1.1439 +
1.1440 +void CMMFDevVideoPlay::MdvppInitializeComplete(CMMFVideoHwDevice* aDevice, TInt aError)
1.1441 + {
1.1442 + if (aDevice == iVideoDecodeHwDevice)
1.1443 + {
1.1444 + HandleDecodeInitializeComplete(aError);
1.1445 + }
1.1446 + else if (aDevice == iVideoPostProcHwDevice)
1.1447 + {
1.1448 + HandlePostProcInitializeComplete(aError);
1.1449 + }
1.1450 + else
1.1451 + {// We've been given a random pointer back!
1.1452 + DevVideoPanic(EDevVideoPanicPreConditionViolation);
1.1453 + }
1.1454 + }
1.1455 +
1.1456 +
1.1457 +void CMMFDevVideoPlay::HandleDecodeInitializeComplete(TInt aError)
1.1458 + {
1.1459 + // Make sure we are in the correct state
1.1460 + __ASSERT_ALWAYS(iInitializationState==EInitializing, DevVideoPanic(EDevVideoPanicPreConditionViolation));
1.1461 +
1.1462 + if (aError == KErrNone)
1.1463 + {
1.1464 + // If we have a post processor, initialize that. Otherwise, we're initialized.
1.1465 + if (iVideoPostProcHwDevice)
1.1466 + {
1.1467 + iVideoPostProcHwDevice->Initialize();
1.1468 + // Now wait for the next callback
1.1469 + }
1.1470 + else
1.1471 + {
1.1472 + iInitializationState = EInitialized;
1.1473 + iObserver.MdvpoInitComplete(KErrNone);
1.1474 + }
1.1475 + }
1.1476 + else
1.1477 + {//aError
1.1478 + iInitializationState = EInitializationFailed;
1.1479 + iObserver.MdvpoInitComplete(aError);
1.1480 + }
1.1481 + }
1.1482 +
1.1483 +void CMMFDevVideoPlay::HandlePostProcInitializeComplete(TInt aError)
1.1484 + {
1.1485 + // Make sure we are in the correct state
1.1486 + __ASSERT_ALWAYS(iInitializationState==EInitializing, DevVideoPanic(EDevVideoPanicPreConditionViolation));
1.1487 +
1.1488 + if (aError == KErrNone)
1.1489 + {
1.1490 + // We're now fully initialized
1.1491 + iInitializationState = EInitialized;
1.1492 + iObserver.MdvpoInitComplete(KErrNone);
1.1493 + }
1.1494 + else
1.1495 + {//aError
1.1496 + iInitializationState = EInitializationFailed;
1.1497 + iObserver.MdvpoInitComplete(aError);
1.1498 + }
1.1499 + }
1.1500 +
1.1501 +
1.1502 +void CMMFDevVideoPlay::MdvppStreamEnd()
1.1503 + {
1.1504 + // This method must be called the same number of times as the number of plugins we have
1.1505 + // before we call iObserver.MdvpoStreamEnd().
1.1506 + iNumberOfMdvppStreamEndCallbacks++;
1.1507 +
1.1508 + TUint numberOfPlugins = 0;
1.1509 + if (iVideoDecodeHwDevice && !iIsDecodeComplete)
1.1510 + {
1.1511 + iIsDecodeComplete = ETrue;
1.1512 + if(iVideoPostProcHwDevice)
1.1513 + {
1.1514 + iVideoPostProcHwDevice->InputEnd();
1.1515 + return;
1.1516 + }
1.1517 + }
1.1518 +
1.1519 + ASSERT(!iVideoDecodeHwDevice||iIsDecodeComplete);
1.1520 + if(iVideoDecodeHwDevice)
1.1521 + {
1.1522 + numberOfPlugins++;
1.1523 + }
1.1524 +
1.1525 + if (iVideoPostProcHwDevice)
1.1526 + {
1.1527 + numberOfPlugins++;
1.1528 + }
1.1529 +
1.1530 + if (iNumberOfMdvppStreamEndCallbacks == numberOfPlugins)
1.1531 + {
1.1532 + // We've received the correct number of callbacks so signal the client
1.1533 + iNumberOfMdvppStreamEndCallbacks = 0;
1.1534 + iObserver.MdvpoStreamEnd();
1.1535 + }
1.1536 + // else wait for the next plugin to call back
1.1537 + }
1.1538 +
1.1539 +CMMFVideoPlayHwDevice& CMMFDevVideoPlay::VideoPlayHwDevice(THwDeviceId aHwDevice) const
1.1540 + {
1.1541 + if (aHwDevice == KHwDeviceIdVideoDecoder)
1.1542 + {
1.1543 + __ASSERT_ALWAYS(iVideoDecodeHwDevice, DevVideoPanic(EDevVideoPanicPreConditionViolation));
1.1544 + return *iVideoDecodeHwDevice;
1.1545 + }
1.1546 + else if (aHwDevice == KHwDeviceIdVideoPostProcessor)
1.1547 + {
1.1548 + __ASSERT_ALWAYS(iVideoPostProcHwDevice, DevVideoPanic(EDevVideoPanicPreConditionViolation));
1.1549 + return *iVideoPostProcHwDevice;
1.1550 + }
1.1551 + else
1.1552 + {
1.1553 + DevVideoPanic(EDevVideoPanicInvalidHwDeviceId);
1.1554 + // The following is unreachable
1.1555 + CMMFVideoPlayHwDevice* ret = NULL;
1.1556 + return *ret;
1.1557 + }
1.1558 + }
1.1559 +
1.1560 +CMMFVideoPlayHwDevice& CMMFDevVideoPlay::RenderingHwDevice() const
1.1561 + {
1.1562 + // Return the last plugin in the chain
1.1563 + // - the postprocessor if available, otherwise the videodecoder
1.1564 + if (iVideoPostProcHwDevice)
1.1565 + return *iVideoPostProcHwDevice;
1.1566 + else if (iVideoDecodeHwDevice)
1.1567 + return *iVideoDecodeHwDevice;
1.1568 + else
1.1569 + {
1.1570 + DevVideoPanic(EDevVideoPanicPreConditionViolation);
1.1571 + // The following is unreachable
1.1572 + CMMFVideoPlayHwDevice* ret = NULL;
1.1573 + return *ret;
1.1574 + }
1.1575 + }
1.1576 +
1.1577 +
1.1578 +CMMFVideoDecodeHwDevice& CMMFDevVideoPlay::VideoDecodeHwDevice(THwDeviceId aHwDevice) const
1.1579 + {
1.1580 + if (aHwDevice == KHwDeviceIdVideoDecoder)
1.1581 + {
1.1582 + __ASSERT_ALWAYS(iVideoDecodeHwDevice, DevVideoPanic(EDevVideoPanicPreConditionViolation));
1.1583 + return *iVideoDecodeHwDevice;
1.1584 + }
1.1585 + else
1.1586 + {
1.1587 + DevVideoPanic(EDevVideoPanicInvalidHwDeviceId);
1.1588 + // The following is unreachable
1.1589 + CMMFVideoDecodeHwDevice* ret = NULL;
1.1590 + return *ret;
1.1591 + }
1.1592 + }
1.1593 +
1.1594 +CMMFVideoPostProcHwDevice& CMMFDevVideoPlay::VideoPostProcHwDevice(THwDeviceId aHwDevice) const
1.1595 + {
1.1596 + if (aHwDevice == KHwDeviceIdVideoPostProcessor)
1.1597 + {
1.1598 + __ASSERT_ALWAYS(iVideoPostProcHwDevice, DevVideoPanic(EDevVideoPanicPreConditionViolation));
1.1599 + return *iVideoPostProcHwDevice;
1.1600 + }
1.1601 + else
1.1602 + {
1.1603 + DevVideoPanic(EDevVideoPanicInvalidHwDeviceId);
1.1604 + // The following is unreachable
1.1605 + CMMFVideoPostProcHwDevice* ret = NULL;
1.1606 + return *ret;
1.1607 + }
1.1608 + }
1.1609 +
1.1610 +CMMFVideoDecodeHwDevice& CMMFDevVideoPlay::VideoDecodeHwDevice() const
1.1611 + {
1.1612 + return VideoDecodeHwDevice(KHwDeviceIdVideoDecoder);
1.1613 + }
1.1614 +
1.1615 +CMMFVideoPostProcHwDevice& CMMFDevVideoPlay::VideoPostProcHwDevice() const
1.1616 + {
1.1617 + return VideoPostProcHwDevice(KHwDeviceIdVideoPostProcessor);
1.1618 + }
1.1619 +
1.1620 +CMMFVideoHwDevice& CMMFDevVideoPlay::VideoHwDevice(THwDeviceId aHwDevice) const
1.1621 + {
1.1622 + if (aHwDevice == KHwDeviceIdVideoPostProcessor)
1.1623 + {
1.1624 + __ASSERT_ALWAYS(iVideoPostProcHwDevice, DevVideoPanic(EDevVideoPanicPreConditionViolation));
1.1625 + return *iVideoPostProcHwDevice;
1.1626 + }
1.1627 + else if (aHwDevice == KHwDeviceIdVideoDecoder)
1.1628 + {
1.1629 + __ASSERT_ALWAYS(iVideoDecodeHwDevice, DevVideoPanic(EDevVideoPanicPreConditionViolation));
1.1630 + return *iVideoDecodeHwDevice;
1.1631 + }
1.1632 + else
1.1633 + {
1.1634 + DevVideoPanic(EDevVideoPanicInvalidHwDeviceId);
1.1635 + // The following is unreachable
1.1636 + CMMFVideoHwDevice* ret = NULL;
1.1637 + return *ret;
1.1638 + }
1.1639 + }
1.1640 +
1.1641 +void CMMFDevVideoPlay::CheckInitializationState(TUint aExpected)
1.1642 + {
1.1643 + __ASSERT_ALWAYS(iInitializationState&aExpected, DevVideoPanic(EDevVideoPanicPreConditionViolation));
1.1644 + }
1.1645 +
1.1646 +void CMMFDevVideoPlay::ConnectPlugins()
1.1647 + {
1.1648 + __ASSERT_ALWAYS((iVideoDecodeHwDevice||iVideoPostProcHwDevice), DevVideoPanic(EDevVideoPanicPreConditionViolation));
1.1649 + if (iVideoDecodeHwDevice && iVideoPostProcHwDevice)
1.1650 + {
1.1651 + iVideoDecodeHwDevice->SetOutputDevice(iVideoPostProcHwDevice);
1.1652 + iVideoPostProcHwDevice->SetInputDevice(iVideoDecodeHwDevice);
1.1653 + }
1.1654 + }
1.1655 +
1.1656 +CMMFVideoDecodeHwDevice* CMMFDevVideoPlay::CreateDecoderL(TUid aDecoder)
1.1657 + {
1.1658 +#ifdef SYMBIAN_MULTIMEDIA_CODEC_API
1.1659 + // need to check whether we've been given a PU
1.1660 + if (!iPuListCreated)
1.1661 + {
1.1662 + DevVideoUtilities::CreatePuListL(iPuImplementations);
1.1663 + iPuListCreated = ETrue;
1.1664 + }
1.1665 + const CImplementationInformation* info = DevVideoUtilities::FindPu(iPuImplementations, aDecoder);
1.1666 +
1.1667 + if (!info)
1.1668 + {
1.1669 + return CMMFVideoDecodeHwDevice::NewL(aDecoder, *this);
1.1670 + }
1.1671 + else
1.1672 + {
1.1673 + return CMMFVideoDecodeHwDevice::NewPuAdapterL(*info, *this);
1.1674 + }
1.1675 +#else
1.1676 + return CMMFVideoDecodeHwDevice::NewL(aDecoder, *this);
1.1677 +#endif // SYMBIAN_MULTIMEDIA_CODEC_API
1.1678 + }