Exemplo n.º 1
0
tResult cJuryModule::Init(tInitStage eStage, __exception)
{
    RETURN_IF_FAILED(cBaseQtFilter::Init(eStage, __exception_ptr));

    // pins need to be created at StageFirst
    if (eStage == StageFirst)
    {

        cObjectPtr<IMediaDescriptionManager> pDescManager;
        RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER,
            IID_ADTF_MEDIA_DESCRIPTION_MANAGER,
            (tVoid**)&pDescManager,
            __exception_ptr));
        /*
        * the MediaDescription for <struct name="tJuryNotAusFlag" .../> has to exist in a description file (e.g. in $ADTF_DIR\description\ or $ADTF_DIR\src\examples\src\description
        * before (!) you start adtf_devenv !! if not: the Filter-Plugin will not loaded because cPin.Create() and so ::Init() failes !
        */
        // Select Output
        tChar const * strDesc2 = pDescManager->GetMediaDescription("tJuryStruct");
        RETURN_IF_POINTER_NULL(strDesc2);
        cObjectPtr<IMediaType> pType2 = new cMediaType(0, 0, 0, "tJuryStruct", strDesc2, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
        RETURN_IF_FAILED(m_JuryStructOutputPin.Create("Jury_Struct", pType2, this));
        RETURN_IF_FAILED(RegisterPin(&m_JuryStructOutputPin));
        RETURN_IF_FAILED(pType2->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pDescJuryStruct));

        // NotAus Output
        tChar const * strDesc1 = pDescManager->GetMediaDescription("tJuryEmergencyStop");
        RETURN_IF_POINTER_NULL(strDesc1);
        cObjectPtr<IMediaType> pType1 = new cMediaType(0, 0, 0, "tJuryEmergencyStop", strDesc1,IMediaDescription::MDF_DDL_DEFAULT_VERSION);
        RETURN_IF_FAILED(m_NotAusOutputPin.Create("Emergency_Stop", pType1, this));
        RETURN_IF_FAILED(RegisterPin(&m_NotAusOutputPin));
        RETURN_IF_FAILED(pType1->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pDescNotAus));      

        // input Pin
        tChar const * strDesc4 = pDescManager->GetMediaDescription("tDriverStruct");
        RETURN_IF_POINTER_NULL(strDesc4);
        cObjectPtr<IMediaType> pType4 = new cMediaType(0, 0, 0, "tDriverStruct", strDesc4, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
        RETURN_IF_FAILED(m_DriverStructInputPin.Create("Driver_Struct", pType4, this));
        RETURN_IF_FAILED(RegisterPin(&m_DriverStructInputPin));
        RETURN_IF_FAILED(pType4->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pDescDriverStruct));      

        m_bDebugModeEnabled = GetPropertyBool("Debug Output to Console");
    }
    else if(eStage == StageNormal)
    {

    }
    else if(eStage == StageGraphReady)
    {
        loadManeuverList();
        m_pWidget->SetManeuverList(m_sectorList);
        m_pWidget->FillComboBox();
        m_bIDNotAusSet = tFalse;
        m_bIDsJuryStructSet = tFalse;
        m_bIDsDriverStructSet = tFalse;
    }
    RETURN_NOERROR;
}
tResult DriverFilter::Init(tInitStage eStage, __exception)
{
	RETURN_IF_FAILED(cFilter::Init(eStage, __exception_ptr));
	
	if (eStage == StageFirst)
	{
		RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER, IID_ADTF_MEDIA_DESCRIPTION_MANAGER, (tVoid**) &this->descriptionManager, __exception_ptr));

		cObjectPtr<IMediaType> juryMediaType;
		cObjectPtr<IMediaType> driverMediaType;
		cObjectPtr<IMediaType> maneuverMediaType;
		
		RETURN_IF_FAILED(initMediaType("tJuryStruct", juryMediaType, this->coderDescriptionJury));
		RETURN_IF_FAILED(initMediaType("tDriverStruct", driverMediaType, this->coderDescriptionDriver));
		RETURN_IF_FAILED(initMediaType("tSteeringAngleData", maneuverMediaType, this->coderDescriptionManeuver));

		// input pins
		RETURN_IF_FAILED(createInputPin("Jury_Struct", this->juryStatePin, juryMediaType));
		RETURN_IF_FAILED(createInputPin("Maneuver_Finished", this->maneuverFinishedPin, maneuverMediaType));

		// output pins
		RETURN_IF_FAILED(createOutputPin("Driver_Struct", this->driverStatePin, driverMediaType));
		RETURN_IF_FAILED(createOutputPin("Current_Maneuver", this->currentManeuverPin, maneuverMediaType));
	}
	else if (eStage == StageGraphReady)
	{
		RETURN_IF_FAILED(loadManeuverList());
		getHighestManeuverId(this->highestManeuverId);

		cObjectPtr<IMediaSerializer> serializer;
		RETURN_IF_FAILED(this->coderDescriptionManeuver->GetMediaSampleSerializer(&serializer));
		this->ddlSizeManeuver = serializer->GetDeserializedSize();

		RETURN_IF_FAILED(this->coderDescriptionDriver->GetMediaSampleSerializer(&serializer));
		this->ddlSizeDriver = serializer->GetDeserializedSize();
	}
	
	RETURN_NOERROR;
}