sl@0: // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include "mdfvideoencodehwdeviceadapter.h" sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: // Literal descriptor for the encoder's info sl@0: _LIT8(KEncoderInfoCSInfo, "Coded by Symbian"); sl@0: // Literal descriptor for the encoder's implementation info sl@0: _LIT8(KEncoderInfoISInfo, "Implemented by Symbian"); sl@0: // Literal descriptor for the video encoder panic sl@0: _LIT(KDevVideoEncoderPanicCategory, "DevVideoEncoder"); sl@0: sl@0: // Processing unit's input port index sl@0: const TInt KEncoderPUInputPortIndex = 0; sl@0: // Processing unit's output port index sl@0: const TInt KEncoderPUOutputPortIndex = 0; sl@0: // Processing unit's major version number sl@0: const TInt KEncoderPUInfoVersionMaj = 0; sl@0: // Processing unit's minor version number sl@0: const TInt KEncoderPUInfoVersionMin = 1; sl@0: // Processing unit's build version number sl@0: const TInt KEncoderPUInfoVersionBuild = 1; sl@0: // Bytes per pixel sl@0: const TInt KBytesPerPixel = 3; sl@0: sl@0: void DevVideoEncoderPanic(TInt aReason) sl@0: { sl@0: User::Panic(KDevVideoEncoderPanicCategory, aReason); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Constructs a new instance of CMdfVideoEncodeHwDeviceAdapter. sl@0: @return "CMdfVideoEncodeHwDeviceAdapter*" sl@0: A pointer to the newly constructed HwDevice sl@0: */ sl@0: CMdfVideoEncodeHwDeviceAdapter* CMdfVideoEncodeHwDeviceAdapter::NewL() sl@0: { sl@0: CMdfVideoEncodeHwDeviceAdapter* self = new(ELeave) CMdfVideoEncodeHwDeviceAdapter; sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: /** sl@0: Default constructor sl@0: */ sl@0: CMdfVideoEncodeHwDeviceAdapter::CMdfVideoEncodeHwDeviceAdapter() sl@0: { sl@0: } sl@0: sl@0: /** sl@0: Safe contructor for CMdfVideoEncodeHwDeviceAdapter. sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::ConstructL() sl@0: { sl@0: // Load the PU Loader plugin sl@0: iPuLoader = static_cast sl@0: (REComSession::CreateImplementationL(TUid::Uid(KUidPuLoaderImplementation), iPuLoaderDtorKey)); sl@0: } sl@0: sl@0: /** sl@0: Default destructor sl@0: */ sl@0: CMdfVideoEncodeHwDeviceAdapter::~CMdfVideoEncodeHwDeviceAdapter() sl@0: { sl@0: if(iEncoderPU) sl@0: { sl@0: iPuLoader->UnloadProcessingUnit(iEncoderPU); sl@0: } sl@0: sl@0: delete iPuLoader; sl@0: delete iPuData; sl@0: delete iManufacturer; sl@0: REComSession::DestroyedImplementation(iPuLoaderDtorKey); sl@0: sl@0: for (TInt i = 0; i < iOutputVideoFormats.Count(); i++) sl@0: { sl@0: delete iOutputVideoFormats[i]; sl@0: } sl@0: sl@0: iEncoderPUOutputPortsArray.Reset(); sl@0: iEncoderPUOutputPortsArray.Close(); sl@0: sl@0: iEncoderPUInputPortsArray.Reset(); sl@0: iEncoderPUInputPortsArray.Close(); sl@0: sl@0: iPictureRates.Reset(); sl@0: iPictureRates.Close(); sl@0: sl@0: iInputVideoFormats.Reset(); sl@0: iInputVideoFormats.Close(); sl@0: sl@0: iOutputVideoFormats.Reset(); sl@0: iOutputVideoFormats.Close(); sl@0: sl@0: for (TInt i = 0; i < iDataBuffers.Count(); i++) sl@0: { sl@0: User::Free((TAny*)iDataBuffers[i].iData.Ptr()); sl@0: } sl@0: iDataBuffers.Reset(); sl@0: iDataBuffers.Close(); sl@0: sl@0: delete iInputBuffer; sl@0: delete iOutputBuffer; sl@0: } sl@0: sl@0: void CMdfVideoEncodeHwDeviceAdapter::LoadProcessingUnitL(const CImplementationInformation& aImplInfo) sl@0: { sl@0: iPuUid = aImplInfo.ImplementationUid(); sl@0: sl@0: iEncoderPU = iPuLoader->LoadProcessingUnitL(*this,iPuUid); sl@0: // store the opaque data associated with this PU so we can extract information about sl@0: // the PU later sl@0: iPuData = CCodecApiVideoOpaqueData::NewL(aImplInfo.OpaqueData()); sl@0: iManufacturer = HBufC::NewL(iPuData->Manufacturer().Length()); sl@0: iManufacturer->Des().Copy(iPuData->Manufacturer()); sl@0: } sl@0: sl@0: // private method : body of Initialize() sl@0: void CMdfVideoEncodeHwDeviceAdapter::InitializeL() sl@0: { sl@0: if (!iEncoderPU) sl@0: { sl@0: iProxy->MdvrpInitializeComplete(this, KErrNotFound); sl@0: return; sl@0: } sl@0: sl@0: // we have to pre-check that the image format is set correctly, sl@0: // else an attempt to set it into the config will panic. sl@0: switch(iFormat.iDataFormat) sl@0: { sl@0: case 0: sl@0: User::Leave(KErrNotReady); sl@0: break; sl@0: case ERgbRawData: sl@0: case ERgbFbsBitmap: sl@0: case EYuvRawData: sl@0: break; sl@0: default: sl@0: User::Leave(KErrNotSupported); sl@0: break; sl@0: } sl@0: sl@0: // get the encoder input ports sl@0: User::LeaveIfError(iEncoderPU->GetInputPorts(iEncoderPUInputPortsArray)); sl@0: sl@0: // set the observer for the encoder input ports sl@0: for(TInt i = 0; i < iEncoderPUInputPortsArray.Count(); i++) sl@0: { sl@0: iEncoderPUInputPortsArray[i]->MipSetObserver(*this); sl@0: } sl@0: sl@0: // get the encoder output ports sl@0: User::LeaveIfError(iEncoderPU->GetOutputPorts(iEncoderPUOutputPortsArray)); sl@0: sl@0: // set the observer for the encoder input ports sl@0: for(TInt i = 0; i < iEncoderPUOutputPortsArray.Count(); i++) sl@0: { sl@0: iEncoderPUOutputPortsArray[i]->MopSetObserver(*this); sl@0: } sl@0: sl@0: TInt bufSize = iPictureSize.iHeight * iPictureSize.iWidth * KBytesPerPixel; sl@0: iDataBuffers.Reset(); sl@0: sl@0: // create the buffer. zero out all fields sl@0: TVideoOutputBuffer buf; sl@0: memset(&buf, 0, sizeof(buf)); sl@0: sl@0: TUint8* bufData = (TUint8*)User::AllocL(bufSize); sl@0: CleanupStack::PushL(bufData); sl@0: sl@0: buf.iData.Set(bufData, bufSize); sl@0: iDataBuffers.AppendL(buf); sl@0: sl@0: CleanupStack::Pop(bufData); // don't destroy - owned by iDataBuffers sl@0: sl@0: TDevVideoRecordPuConfig config; sl@0: config.iFrameSize = iPictureSize; sl@0: config.iImageFormat = iFormat; sl@0: config.iFrameRate = iFrameRate; sl@0: sl@0: TPuConfigDevVideoRecord puConfig(config); sl@0: sl@0: // initialize with config info. sl@0: iEncoderPU->Configure(puConfig); sl@0: sl@0: // create input buffer sl@0: iInputBuffer = CMMFDescriptorBuffer::NewL(bufSize); sl@0: iEncoderPUInputPortsArray[KEncoderPUInputPortIndex]->MipUseBuffer(*iInputBuffer); sl@0: sl@0: // create output buffer sl@0: TUint32 outputPortBufferSize = sl@0: iEncoderPUOutputPortsArray[KEncoderPUOutputPortIndex]->MopBufferSize(); sl@0: iOutputBuffer = CMMFDescriptorBuffer::NewL(outputPortBufferSize); sl@0: iEncoderPUOutputPortsArray[KEncoderPUOutputPortIndex]->MopUseBuffer(*iOutputBuffer); sl@0: sl@0: // initialize the encoder PU sl@0: iEncoderPU->Initialize(); sl@0: sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoHwDevice sl@0: */ sl@0: TAny* CMdfVideoEncodeHwDeviceAdapter::CustomInterface(TUid aInterface) sl@0: { sl@0: if (aInterface.iUid == KUidDevVideoHwDeviceAdapterSetup) sl@0: { sl@0: return static_cast(this); sl@0: } sl@0: return NULL; sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: CPreProcessorInfo* CMdfVideoEncodeHwDeviceAdapter::PreProcessorInfoLC() sl@0: { sl@0: // we have no preprocessor info sl@0: return NULL; sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetInputFormatL(const TUncompressedVideoFormat& aFormat, const TSize& aPictureSize) sl@0: { sl@0: iFormat = aFormat; sl@0: iPictureSize = aPictureSize; sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetSourceCameraL(TInt /* aCameraHandle */, TReal /* aPictureRate */) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetSourceMemoryL(TReal aMaxPictureRate, TBool /* aConstantPictureRate */, TBool /* aProcessRealtime */) sl@0: { sl@0: iFrameRate = (TInt)aMaxPictureRate; sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::Initialize() sl@0: { sl@0: TRAPD(err, InitializeL()); sl@0: if(err != KErrNone) sl@0: { sl@0: iProxy->MdvrpInitializeComplete(this, err); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::WritePictureL(TVideoPicture* aPicture) sl@0: { sl@0: __ASSERT_ALWAYS(iEncoderPU, DevVideoEncoderPanic(0)); sl@0: sl@0: if(!aPicture) sl@0: { sl@0: User::Leave(KErrArgument); sl@0: } sl@0: sl@0: // the picture size MUST be the same as the size the encoder has sl@0: // been initialized with. sl@0: if(aPicture->iData.iDataSize != iPictureSize) sl@0: { sl@0: User::Leave(KErrArgument); sl@0: } sl@0: sl@0: // Picture received : increment picture count sl@0: iPictureCounters.iInputPictures++; sl@0: iCurrentPicture = aPicture; sl@0: TDes8& data = iInputBuffer->Data(); sl@0: data.SetLength((*aPicture->iData.iRawData).Length()); sl@0: data.Copy(*aPicture->iData.iRawData); sl@0: iEncoderPUInputPortsArray[KEncoderPUInputPortIndex]->MipWriteData(*iInputBuffer); sl@0: iEncoderPUOutputPortsArray[KEncoderPUOutputPortIndex]->MopReadData(*iOutputBuffer); sl@0: sl@0: // Picture encoded : increment picture count sl@0: iPictureCounters.iPicturesProcessed++; sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::InputEnd() sl@0: { sl@0: // The client has notified us it has reached the end of the input stream sl@0: iInputStreamEnd = ETrue; sl@0: iProxy->MdvrpStreamEnd(); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::Start() sl@0: { sl@0: __ASSERT_ALWAYS(iEncoderPU, DevVideoEncoderPanic(0)); sl@0: iEncoderPU->Execute(); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::Stop() sl@0: { sl@0: iProxy->MdvrpFatalError(this, KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::Pause() sl@0: { sl@0: iProxy->MdvrpFatalError(this, KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::Resume() sl@0: { sl@0: iProxy->MdvrpFatalError(this, KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::Freeze() sl@0: { sl@0: iProxy->MdvrpFatalError(this, KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::ReleaseFreeze() sl@0: { sl@0: iProxy->MdvrpFatalError(this, KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: TTimeIntervalMicroSeconds CMdfVideoEncodeHwDeviceAdapter::RecordingPosition() sl@0: { sl@0: // return picture count times frame rate sl@0: return iPictureCounters.iPicturesProcessed * (1000000 / iFrameRate); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::GetPictureCounters(CMMFDevVideoRecord::TPictureCounters& aCounters) sl@0: { sl@0: aCounters = iPictureCounters; sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::GetFrameStabilisationOutput(TRect& aRect) sl@0: { sl@0: aRect = TRect(iPictureSize); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: TUint CMdfVideoEncodeHwDeviceAdapter::NumComplexityLevels() sl@0: { sl@0: // separate complexity levels are not available; return 1 sl@0: return 1; sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetComplexityLevel(TUint /* aLevel */) sl@0: { sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: CVideoEncoderInfo* CMdfVideoEncodeHwDeviceAdapter::VideoEncoderInfoLC() sl@0: { sl@0: //if PU is not loaded panic sl@0: if(iPuData == NULL) sl@0: { sl@0: DevVideoEncoderPanic(KErrNotReady); sl@0: } sl@0: // output formats array sl@0: iOutputVideoFormats.Reset(); sl@0: CCompressedVideoFormat* videoCV = NULL; sl@0: videoCV = CCompressedVideoFormat::NewL(iPuData->OutputDataType() , KNullDesC8); sl@0: CleanupStack::PushL(videoCV); sl@0: iOutputVideoFormats.AppendL(videoCV); sl@0: // Note; CCompressedVideo object is destroyed in destructor sl@0: CleanupStack::Pop(videoCV); sl@0: sl@0: // input formats array sl@0: iInputVideoFormats.Reset(); sl@0: TUncompressedVideoFormat inputFormats[3]; sl@0: inputFormats[0].iDataFormat = ERgbRawData; sl@0: inputFormats[0].iRgbFormat = ERgb16bit565; sl@0: iInputVideoFormats.AppendL(inputFormats[0]); sl@0: inputFormats[1].iDataFormat = ERgbFbsBitmap; sl@0: inputFormats[1].iRgbFormat = EFbsBitmapColor16M; sl@0: iInputVideoFormats.AppendL(inputFormats[1]); sl@0: inputFormats[2].iDataFormat = EYuvRawData; sl@0: memset(&inputFormats[2].iYuvFormat, 0, sizeof(TYuvFormat)); sl@0: iInputVideoFormats.AppendL(inputFormats[2]); sl@0: sl@0: // construct the video Encoder info object sl@0: CVideoEncoderInfo* vInfo = CVideoEncoderInfo::NewL( sl@0: iPuUid, sl@0: *iManufacturer, sl@0: KNullDesC, sl@0: TVersion(KEncoderPUInfoVersionMaj, KEncoderPUInfoVersionMin, KEncoderPUInfoVersionBuild), sl@0: EFalse, // not accelerated sl@0: EFalse, // does not support direct capture sl@0: iInputVideoFormats.Array(), sl@0: iOutputVideoFormats.Array(), sl@0: iPuData->MaxPictureSize(), sl@0: EDuCodedPicture, // data unit type(s) sl@0: EDuElementaryStream, // data encapsulation type sl@0: 1, // num bitrate layers sl@0: EFalse, // does not support supplemental enhancement info sl@0: 1, // unequal error protection levels not supported sl@0: KMaxTUint32, // max bitrate supported sl@0: iPuData->MaxPictureRates().Array(), sl@0: 1, // in-layer scalability not supported sl@0: 0, // no supported picture options sl@0: EFalse, // picture loss not supported, sl@0: EFalse, // slice loss not supported, sl@0: KEncoderInfoCSInfo, sl@0: KEncoderInfoISInfo); sl@0: sl@0: CleanupStack::PushL(vInfo); sl@0: return vInfo; sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetOutputFormatL(const CCompressedVideoFormat& /* aFormat */, sl@0: TVideoDataUnitType /* aDataUnitType */, sl@0: TVideoDataUnitEncapsulation /* aDataEncapsulation */, sl@0: TBool /* aSegmentationAllowed */) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetOutputRectL(const TRect& /* aRect */) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetInputDevice(CMMFVideoPreProcHwDevice* /*aDevice*/) sl@0: { sl@0: // Function is not supported. sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetErrorsExpected(TBool /* aBitErrors */, TBool /* aPacketLosses */) sl@0: { sl@0: // Function is not supported. sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetMinRandomAccessRate(TReal /* aRate */) sl@0: { sl@0: // Function is not supported. sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetNumBitrateLayersL(TUint /* aNumLayers */) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetScalabilityLayerTypeL(TUint /* aLayer */, TScalabilityType /* aScalabilityType */) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetGlobalReferenceOptions(TUint /* aMaxReferencePictures */, TUint /* aMaxPictureOrderDelay */) sl@0: { sl@0: // Function is not supported. sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetLayerReferenceOptions(TUint /* aLayer */, TUint /* aMaxReferencePictures */, TUint /* aMaxPictureOrderDelay */) sl@0: { sl@0: // Function is not supported. sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetBufferOptionsL(const TEncoderBufferOptions& /* aOptions */) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetCodingStandardSpecificOptionsL(const TDesC8& /* aOptions */) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetImplementationSpecificEncoderOptionsL(const TDesC8& /* aOptions */) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: HBufC8* CMdfVideoEncodeHwDeviceAdapter::CodingStandardSpecificInitOutputLC() sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: return NULL; sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: HBufC8* CMdfVideoEncodeHwDeviceAdapter::ImplementationSpecificInitOutputLC() sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: return NULL; sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetErrorProtectionLevelsL(TUint /* aNumLevels */, TBool /* aSeparateBuffers */) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetErrorProtectionLevelL(TUint /* aLevel */, TUint /* aBitrate */, TUint /* aStrength */) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetChannelPacketLossRate(TUint /* aLevel */, sl@0: TReal /* aLossRate */, sl@0: TTimeIntervalMicroSeconds32 /* aLossBurstLength */) sl@0: { sl@0: // Function is not supported. sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetChannelBitErrorRate(TUint /* aLevel */, TReal /* aErrorRate */, TReal /* aStdDeviation */) sl@0: { sl@0: // Function is not supported. sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetSegmentTargetSize(TUint /* aLayer */, TUint /* aSizeBytes */, TUint /* aSizeMacroblocks */) sl@0: { sl@0: // Function is not supported. sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetRateControlOptions(TUint /* aLayer */, const TRateControlOptions& /* aOptions */) sl@0: { sl@0: // Function is not supported. sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetInLayerScalabilityL(TUint /* aLayer */, TUint /* aNumSteps */, sl@0: TInLayerScalabilityType /* aScalabilityType */, sl@0: const TArray& /* aBitrateShare */, sl@0: const TArray& /* aPictureShare */) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetLayerPromotionPointPeriod(TUint /* aLayer */, TUint /* aPeriod */) sl@0: { sl@0: // Function is not supported. sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: HBufC8* CMdfVideoEncodeHwDeviceAdapter::CodingStandardSpecificSettingsOutputLC() sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: return NULL; sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: HBufC8* CMdfVideoEncodeHwDeviceAdapter::ImplementationSpecificSettingsOutputLC() sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: return NULL; sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SendSupplementalInfoL(const TDesC8& /* aData */) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SendSupplementalInfoL(const TDesC8& /* aData */, const TTimeIntervalMicroSeconds& /* aTimestamp */) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::CancelSupplementalInfo() sl@0: { sl@0: // Function is not supported. sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::GetOutputBufferStatus(TUint& aNumFreeBuffers, TUint& aTotalFreeBytes) sl@0: { sl@0: // We have one output buffer, which has a max size of one raw frame. sl@0: aNumFreeBuffers = 1; sl@0: aTotalFreeBytes = iDataBuffers[0].iData.Size(); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::ReturnBuffer(TVideoOutputBuffer* /*aBuffer*/) sl@0: { sl@0: // Receive a used output buffer (from DevVideoRecord) sl@0: // We do nothing - we have one buffer, which is going to be re-used. sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::PictureLoss() sl@0: { sl@0: // Function is not supported. sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::PictureLoss(const TArray& /* aPictures */) sl@0: { sl@0: // Function is not supported. sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SliceLoss(TUint /* aFirstMacroblock */, TUint /* aNumMacroblocks */, const TPictureId& /* aPicture */) sl@0: { sl@0: // Function is not supported. sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::ReferencePictureSelection(const TDesC8& /* aSelectionData */) sl@0: { sl@0: // Function is not supported. sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::CommitL() sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::Revert() sl@0: { sl@0: // Function is not supported. sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoEncodeHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetProxy(MMMFDevVideoRecordProxy& aProxy) sl@0: { sl@0: ASSERT(!iProxy); sl@0: iProxy = &aProxy; sl@0: } sl@0: sl@0: void CMdfVideoEncodeHwDeviceAdapter::MipoWriteDataComplete(const MMdfInputPort* aInputPort, CMMFBuffer* aBuffer, TInt aErrorCode) sl@0: { sl@0: if (aErrorCode != KErrNone) sl@0: { sl@0: iProxy->MdvrpFatalError(this, aErrorCode); sl@0: return; sl@0: } sl@0: sl@0: if (aInputPort == iEncoderPUInputPortsArray[KEncoderPUInputPortIndex]) sl@0: { sl@0: if (aBuffer->LastBuffer()) sl@0: { sl@0: iEncoderPU->Stop(); sl@0: } sl@0: else sl@0: { sl@0: iProxy->MdvrpReturnPicture(iCurrentPicture); sl@0: iCurrentPicture = NULL; sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: void CMdfVideoEncodeHwDeviceAdapter::MipoDisconnectTunnelComplete(const MMdfInputPort* /*aInputPort*/, TInt aErrorCode) sl@0: { sl@0: if (aErrorCode != KErrNone) sl@0: { sl@0: iProxy->MdvrpFatalError(this, aErrorCode); sl@0: } sl@0: } sl@0: sl@0: void CMdfVideoEncodeHwDeviceAdapter::MopoDisconnectTunnelComplete(const MMdfOutputPort* /*aOutputPort*/, TInt aErrorCode) sl@0: { sl@0: if (aErrorCode != KErrNone) sl@0: { sl@0: iProxy->MdvrpFatalError(this, aErrorCode); sl@0: } sl@0: } sl@0: sl@0: sl@0: void CMdfVideoEncodeHwDeviceAdapter::MopoReadDataComplete(const MMdfOutputPort* aOutputPort, CMMFBuffer* aBuffer, TInt aErrorCode) sl@0: { sl@0: if (aErrorCode != KErrNone) sl@0: { sl@0: iProxy->MdvrpFatalError(this, aErrorCode); sl@0: return; sl@0: } sl@0: if (aOutputPort == iEncoderPUOutputPortsArray[KEncoderPUOutputPortIndex]) sl@0: { sl@0: TVideoOutputBuffer buf; sl@0: CMMFDataBuffer* dataBuffer = static_cast(aBuffer); sl@0: TUint bufSize = dataBuffer->BufferSize(); sl@0: buf.iData.Set(const_cast((dataBuffer->Data()).Ptr()), dataBuffer->BufferSize()); sl@0: sl@0: if (aBuffer->LastBuffer()) sl@0: { sl@0: iEncoderPU->Stop(); sl@0: iProxy->MdvrpStreamEnd(); sl@0: } sl@0: else sl@0: { sl@0: sl@0: if (!iInputStreamEnd) sl@0: { sl@0: // still expecting more buffers, so let client know sl@0: iProxy->MdvrpNewBuffer(&buf); sl@0: } sl@0: else sl@0: { sl@0: dataBuffer->Data().SetLength(0); sl@0: dataBuffer->SetLastBuffer(ETrue); sl@0: // Write a zero sized input buffer to the port, with the last buffer flag set sl@0: iEncoderPUInputPortsArray[KEncoderPUInputPortIndex]->MipWriteData(*iInputBuffer); sl@0: } sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: void CMdfVideoEncodeHwDeviceAdapter::InitializeComplete(const CMdfProcessingUnit* /*aPu*/, TInt aErrorCode) sl@0: { sl@0: // KB: We have an error code, so use it not fatal error in this case sl@0: iProxy->MdvrpInitializeComplete(this, aErrorCode); sl@0: } sl@0: sl@0: void CMdfVideoEncodeHwDeviceAdapter::ExecuteComplete(const CMdfProcessingUnit* /*aPu*/, TInt aErrorCode) sl@0: { sl@0: if (aErrorCode != KErrNone) sl@0: { sl@0: iProxy->MdvrpFatalError(this, aErrorCode); sl@0: return; sl@0: } sl@0: } sl@0: sl@0: void CMdfVideoEncodeHwDeviceAdapter::MipoRestartTunnelComplete(const MMdfInputPort* /*aInputPort*/, TInt /*aErrorCode*/) sl@0: { sl@0: // Function is not supported. sl@0: } sl@0: sl@0: void CMdfVideoEncodeHwDeviceAdapter::MopoRestartTunnelComplete(const MMdfOutputPort* /*aOutputPort*/, TInt /*aErrorCode*/) sl@0: { sl@0: // Function is not supported. sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetClockSource(MMMFClockSource* /* aClock */) sl@0: { sl@0: // Function is not supported. sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetPreProcessTypesL(TUint32 /* aPreProcessTypes */) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetRgbToYuvOptionsL(TRgbRange /* aRange */, const TYuvFormat& /* aOutputFormat */) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetYuvToYuvOptionsL(const TYuvFormat& /* aInputFormat */, const TYuvFormat& /* aOutputFormat */) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetRotateOptionsL(TRotationType /* aRotationType */) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetScaleOptionsL(const TSize& /* aTargetSize */, TBool /* aAntiAliasFiltering */) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetInputCropOptionsL(const TRect& /* aRect */) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetOutputCropOptionsL(const TRect& /* aRect */) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetOutputPadOptionsL(const TSize& /* aOutputSize */, const TPoint& /* aPicturePos */) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetColorEnhancementOptionsL(const TColorEnhancementOptions& /* aOptions */) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetFrameStabilisationOptionsL(const TSize& /* aOutputSize */, TBool /* aFrameStabilisation */) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: /** sl@0: @see CMMFVideoRecordHwDevice sl@0: */ sl@0: void CMdfVideoEncodeHwDeviceAdapter::SetCustomPreProcessOptionsL(const TDesC8& /* aOptions */) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: