//copy qpainter if context nut null void Filter::process(FilterContext *&context, Statistics *statistics, Frame* frame) { if (contextType() == FilterContext::None) { process(statistics, frame); return; } DPTR_D(Filter); if (!d.context) { d.context = FilterContext::create(contextType()); d.context->video_width = statistics->video_only.width; d.context->video_height = statistics->video_only.height; } // TODO: reduce mem allocation if (!context || context->type() != contextType()) { if (context) { delete context; } context = FilterContext::create(contextType()); context->video_width = statistics->video_only.width; context->video_height = statistics->video_only.height; } // share common data d.context->shareFrom(context); d.context->initializeOnFrame(frame); context->shareFrom(d.context); d.statistics = statistics; process(); }
void Filter::process(FilterContext *&context, Statistics *statistics, QByteArray* data) { DPTR_D(Filter); if (!context || context->type() != contextType()) { if (context) { qDebug("incompatible context type"); //we don't delete it because the context MUST be used by other filters //TODO: How to release them at the end? refcount? } else { qDebug("null context"); } //use internal context if (d.context) { qDebug("replace context with internal one"); context = d.context; } else { context = FilterContext::create(contextType()); qDebug("new filter context=%p, type=%d", context, contextType()); context->video_width = statistics->video_only.width; context->video_height = statistics->video_only.height; } } //if (data) context->initializeOnData(data); d.context = context; d.statistics = statistics; process(); }
FilterContext* Filter::context() { DPTR_D(Filter); if (!d.context) { d.context = FilterContext::create(contextType()); } return d.context; }
extern "C" int compat_get_next_path(path_context *ctx) { switch (ctx->state++) { case 0: strncpy( ctx->path, ".", PATH_MAX ); return 1; case 1: { QByteArray type(QStandardPaths::writableLocation(QStandardPaths::DataLocation).toUtf8() + QDir::separator().toLatin1() + contextType(ctx->type)); strncpy( ctx->path, type.constData(), PATH_MAX ); return 1; } case 2: { QByteArray type(":/" + contextType(ctx->type)); strncpy( ctx->path, type.constData(), PATH_MAX ); return 1; } } return 0; }
TInt CMmPacketQoSGsmWcdmaExt::SetProfileParametersL( TDes8* aProfile ) { OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMPACKETQOSGSMWCDMAEXT_SETPROFILEPARAMETERSL_1, "TSY: CMmPacketQoSGsmWcdmaExt::SetProfileParametersL. \t aProfile:%d", aProfile ); //Datapackage CMmDataPackage data; // Initialize parameters TInfoName contextName; RPacketContext::TProtocolType pdpType; TBool contextType( EFalse ); TInfoName primaryContextName; //Get context configuration information TInt ret = iMmPacketQoSTsy->PacketContextTsy()-> PacketContextGsmWcdmaExt()->GetConfigurationData( contextName, pdpType, contextType, primaryContextName ); //Get context status RPacketContext::TContextStatus contextStatus = iMmPacketQoSTsy->PacketContextTsy()->ContextStatus(); //initialize contextParams struct TContextParams contextParams; contextParams.iContextName = contextName; contextParams.iContextType = contextType; contextParams.iPdpType = pdpType; contextParams.iPrimaryContextName = primaryContextName; contextParams.iContextStatus = contextStatus; TPckg<TPacketDataConfigBase>* profilePckg = ( TPckg<TPacketDataConfigBase>* ) aProfile; TPacketDataConfigBase& profile = ( *profilePckg )(); //Save what client has requested if ( TPacketDataConfigBase::KConfigGPRS == profile.ExtensionId() ) { TPckg<RPacketQoS::TQoSGPRSRequested >* gprsProfilePckg = ( TPckg<RPacketQoS::TQoSGPRSRequested >* ) aProfile; RPacketQoS::TQoSGPRSRequested& gprsProfile =( *gprsProfilePckg )(); iRequested = gprsProfile; iConfigurationType = TPacketDataConfigBase::KConfigGPRS; iQoSGPRSRequested = ETrue; } else if ( TPacketDataConfigBase::KConfigRel99Rel4 == profile.ExtensionId() ) { TPckg<RPacketQoS::TQoSR99_R4Requested >* gprsProfilePckg = ( TPckg<RPacketQoS::TQoSR99_R4Requested >* ) aProfile; RPacketQoS::TQoSR99_R4Requested& gprsProfile = ( *gprsProfilePckg )(); iRequested99 = gprsProfile; iConfigurationType = TPacketDataConfigBase::KConfigRel99Rel4; iQoSR99_R4Requested = ETrue; } else if ( TPacketDataConfigBase::KConfigRel5 == profile.ExtensionId() ) { OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMPACKETQOSGSMWCDMAEXT_SETPROFILEPARAMETERSL_2, "TSY: CMmPacketQoSGsmWcdmaExt::SetProfileParameters. Rel 5"); TPckg<RPacketQoS::TQoSR5Requested >* gprsProfilePckg = ( TPckg<RPacketQoS::TQoSR5Requested >* ) aProfile; RPacketQoS::TQoSR5Requested& gprsProfile = ( *gprsProfilePckg )(); iRequestedR5 = gprsProfile; iConfigurationType = TPacketDataConfigBase::KConfigRel5; iQoSR5Requested = ETrue; } else { ret = KErrNotSupported; } if ( KErrNone == ret ) { data.PackData( &contextParams, &aProfile ); TInt err = iMmPacketService->MessageManager()->HandleRequestL( EPacketQoSSetProfileParams, &data ); if ( KErrNone != err ) { ret = KErrNotSupported; } iQosAsked = ETrue; } else { ret = KErrNotSupported; } return ret; }