tResult CurveDetector::OnPinEvent(IPin *source, tInt eventCore, tInt param1, tInt param2, IMediaSample *mediaSample)
{
    RETURN_IF_POINTER_NULL(source);
    RETURN_IF_POINTER_NULL(mediaSample);

    if (eventCore == IPinEventSink::PE_MediaSampleReceived)
    {
        if (source == &this->videoInput)
        {
            if (this->isFirstFrame)
            {
                cObjectPtr<IMediaType> type;
                RETURN_IF_FAILED(this->videoInput.GetMediaType(&type));

                cObjectPtr<IMediaTypeVideo> typeVideo;
                RETURN_IF_FAILED(type->GetInterface(IID_ADTF_MEDIA_TYPE_VIDEO, (tVoid**)(&typeVideo)));

                const tBitmapFormat *format = typeVideo->GetFormat();
                RETURN_IF_POINTER_NULL(format);

                setBitmapFormat(format);
                this->isFirstFrame = false;
            }
            else {
                RETURN_IF_FAILED(processImage(mediaSample));
            }

        }
    }

    RETURN_NOERROR;
}
tResult MarkerEvaluator::CreateDescriptions(IException **__exception_ptr)
{
    cObjectPtr<IMediaDescriptionManager> descManager;
    RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER, IID_ADTF_MEDIA_DESCRIPTION_MANAGER,
                                         (tVoid **) &descManager, __exception_ptr));

    // get bool
    tChar const *boolSignalValueDescription = descManager->GetMediaDescription("tBoolSignalValue");
    RETURN_IF_POINTER_NULL(boolSignalValueDescription);
    boolMediaType = new cMediaType(0, 0, 0, "tBoolSignalValue", boolSignalValueDescription, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(boolMediaType->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid **) &boolDescription));

    // get enum
    tChar const *enumSignalValueDescription = descManager->GetMediaDescription("tEnumBox");
    RETURN_IF_POINTER_NULL(enumSignalValueDescription);
    enumMediaType = new cMediaType(0, 0, 0, "tEnumBox", enumSignalValueDescription, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(enumMediaType->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid **) &enumDescription));

    // get roadSign
    tChar const *roadSignSignalValueDescription = descManager->GetMediaDescription("tRoadSign");
    RETURN_IF_POINTER_NULL(roadSignSignalValueDescription);
    roadSignMediaType = new cMediaType(0, 0, 0, "tRoadSign", roadSignSignalValueDescription, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(roadSignMediaType->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid **) &roadSignDescription));

    RETURN_NOERROR;
}
// -------------------------------------------------------------------------------------------------
tResult LaneFilter::OnPinEvent(IPin* source, tInt event_code, tInt param1, tInt param2,
    IMediaSample* media_sample) {
// -------------------------------------------------------------------------------------------------
	RETURN_IF_POINTER_NULL(source);
	RETURN_IF_POINTER_NULL(media_sample);
	
	if (event_code == IPinEventSink::PE_MediaSampleReceived) {
		if (source == &video_input_pin_) {
      processImage(media_sample);
		} else if (source == &object_input_pin_) {
		  // read-out the incoming Media Sample
      cObjectPtr<IMediaCoder> coder_input;
      RETURN_IF_FAILED(object_data_description_->Lock(media_sample, &coder_input));
      
      //get values from media sample        
      tUInt32 size;
      coder_input->Get("size", (tVoid*)&size);
      Object object_array[size];
	    media_sample->CopyBufferTo((tVoid*)&object_array, sizeof(Object) * size, sizeof(tUInt32), 0);
	    lane_preprocessor_.set_object_vector(object_array, sizeof(object_array)/sizeof(Object));
      object_data_description_->Unlock(coder_input);
		}
	}
		
	RETURN_NOERROR;
}
tResult TemporalImage::OnPinEvent(IPin *source, tInt nEventCode, tInt nParam1, tInt nParam2, IMediaSample *mediaSample)
{
    if (nEventCode != IPinEventSink::PE_MediaSampleReceived)
    {
        RETURN_NOERROR;
    }

    RETURN_IF_POINTER_NULL(mediaSample);

    logger.StartLog();

    if (source == &videoInputPin)
    {
        VisionUtils::ExtractImageFromMediaSample(mediaSample, videoInputFormat).copyTo(workingImage);
        RETURN_IF_POINTER_NULL(workingImage.data);

        ProcessImage();

        TransmitOutput(mediaSample->GetTime());

        tFloat diff = (_clock->GetStreamTime() - mediaSample->GetTime()) / 1000.0;
        logger.Log(cString::Format("Total depth image processing time: %f ms", diff).GetPtr());
    }
    else if (source == &videoOutputPin)
    {
    }
    else
    {
        RETURN_ERROR(ERR_NOT_SUPPORTED);
    }

    logger.EndLog();

    RETURN_NOERROR;
}
tResult Emergency::OnPinEvent(IPin *source, tInt eventCore, tInt param1, tInt param2, IMediaSample *mediaSample)
{
    RETURN_IF_POINTER_NULL(source);
    RETURN_IF_POINTER_NULL(mediaSample);

    if (eventCore == IPinEventSink::PE_MediaSampleReceived)
    {
        if (source == &this->m_oIFrontIRF) //&& (steerAngle< 5  && steerAngle > -5) && !initSteerAngle
        {
            static tFloat32 signalValue = 0;
           // this->m_nLastMSTime = pMediaSample->GetTime();

            RETURN_IF_FAILED_AND_LOG_ERROR_STR(getValueFloat(mediaSample, signalValue), "Failed getting signalValue");

            this->m_nEmergencyDistanceFront = GetPropertyInt(PROPERTY_EMERGENCY_DISTANCE_FRONT);
            this->m_bEmergencybreak = (signalValue <= this->m_nEmergencyDistanceFront);

            LOG_INFO(cString::Format("IRF  _____  value: %d, steerangle: %d", signalValue, steerAngle));
            if (this->m_bEmergencybreak)
            {
                RETURN_IF_FAILED_AND_LOG_ERROR_STR(sendDecision(EMERGENCY_STOP), "Cant send decision to DriveAlgorithm");
                //break_and_wink(pMediaSample->GetTime(), true);
                this->initSteerAngle = true;
            }
            else{
                RETURN_IF_FAILED_AND_LOG_ERROR_STR(sendDecision(EMERGENCY_START), "Cant send decision to DriveAlgorithm");
            }
        }
    }

    RETURN_NOERROR;
}
// -------------------------------------------------------------------------------------------------
tResult SensorPackageFilter::Init(tInitStage stage, __exception) {
// -------------------------------------------------------------------------------------------------
  RETURN_IF_FAILED(cFilter::Init(stage, __exception_ptr));
  
	if (stage == StageFirst) {
	  // Create and register the input pin
    cObjectPtr<IMediaDescriptionManager> description_manager;
    RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER,
      IID_ADTF_MEDIA_DESCRIPTION_MANAGER,(tVoid**)&description_manager,__exception_ptr));
    
    // Create the sensor value media description
    tChar const * sensor_description = description_manager->GetMediaDescription("tSignalValue");
    RETURN_IF_POINTER_NULL(sensor_description);        
    cObjectPtr<IMediaType> sensor_type = new cMediaType(0, 0, 0, "tSignalValue",
      sensor_description,IMediaDescription::MDF_DDL_DEFAULT_VERSION);	
    RETURN_IF_FAILED(sensor_type->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION,
      (tVoid**)&sensor_data_description_));
    
    // Create the sensor input pins
    RETURN_IF_FAILED(ir_short_front_left_input_pin_.Create("IR_front_left_shortrange", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&ir_short_front_left_input_pin_));
    RETURN_IF_FAILED(ir_short_left_input_pin_.Create("IR_rear_left_shortrange", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&ir_short_left_input_pin_));
    RETURN_IF_FAILED(ir_long_front_left_input_pin_.Create("IR_front_left_longrange", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&ir_long_front_left_input_pin_));
    RETURN_IF_FAILED(ir_short_rear_center_input_pin_.Create("IR_rear_center_shortrange", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&ir_short_rear_center_input_pin_));
    RETURN_IF_FAILED(us_front_right_input_pin_.Create("US_range_front_right", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&us_front_right_input_pin_));
    RETURN_IF_FAILED(ir_short_front_center_input_pin_.Create("IR_front_center_shortrange", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&ir_short_front_center_input_pin_));
    RETURN_IF_FAILED(ir_short_front_right_input_pin_.Create("IR_front_right_shortrange", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&ir_short_front_right_input_pin_));
    RETURN_IF_FAILED(us_front_left_input_pin_.Create("US_range_front_left", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&us_front_left_input_pin_));
    RETURN_IF_FAILED(ir_long_front_center_input_pin_.Create("IR_front_center_longrange", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&ir_long_front_center_input_pin_));
    RETURN_IF_FAILED(ir_long_front_right_input_pin_.Create("IR_front_right_longrange", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&ir_long_front_right_input_pin_));
    RETURN_IF_FAILED(us_rear_right_input_pin_.Create("US_range_rear_right", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&us_rear_right_input_pin_));
    RETURN_IF_FAILED(ir_short_right_input_pin_.Create("IR_rear_right_shortrange", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&ir_short_right_input_pin_));
    RETURN_IF_FAILED(us_rear_left_input_pin_.Create("US_range_rear_left", sensor_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&us_rear_left_input_pin_));
    
    // Create the output pin description
    tChar const * package_description = description_manager->GetMediaDescription("SensorPackage");
    RETURN_IF_POINTER_NULL(package_description);        
    cObjectPtr<IMediaType> package_type = new cMediaType(0, 0, 0, "SensorPackage", package_description, IMediaDescription::MDF_DDL_DEFAULT_VERSION);	
    RETURN_IF_FAILED(package_type->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&sensor_package_description_));
    
    // Create the output pin
    RETURN_IF_FAILED(sensor_package_output_.Create("sensorPackage", package_type, NULL));
    RETURN_IF_FAILED(RegisterPin(&sensor_package_output_));
	}
	
	RETURN_NOERROR;
}
示例#7
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 EmergencyFilter::OnPinEvent(IPin* source, tInt event_code, tInt param1, tInt param2,
    IMediaSample* media_sample) {
// -------------------------------------------------------------------------------------------------
	RETURN_IF_POINTER_NULL(source);
	RETURN_IF_POINTER_NULL(media_sample);
	
	if (event_code == IPinEventSink::PE_MediaSampleReceived) {
	  // Retrieve the sensor values from the sensor package media sample
	  if (source == &sensor_package_input_) {
	    SensorData data;

      {
        __adtf_sample_read_lock_mediadescription(sensor_package_description_, media_sample, coder);
        coder->Get("ir_l_fc", (tVoid*) &(data.value_ir_l_fc));
        coder->Get("ir_l_fl", (tVoid*) &(data.value_ir_l_fl));
        coder->Get("ir_l_fr", (tVoid*) &(data.value_ir_l_fr));
        coder->Get("ir_s_fc", (tVoid*) &(data.value_ir_s_fc));
        coder->Get("ir_s_fl", (tVoid*) &(data.value_ir_s_fl));
        coder->Get("ir_s_fr", (tVoid*) &(data.value_ir_s_fr));
        coder->Get("ir_s_l", (tVoid*) &(data.value_ir_s_l));
        coder->Get("ir_s_r", (tVoid*) &(data.value_ir_s_r));
        coder->Get("ir_s_rc", (tVoid*) &(data.value_ir_s_rc));
        coder->Get("us_f_l", (tVoid*) &(data.value_us_f_l));
        coder->Get("us_f_r", (tVoid*) &(data.value_us_f_r));
        coder->Get("us_r_l", (tVoid*) &(data.value_us_r_l));
        coder->Get("us_r_r", (tVoid*) &(data.value_us_r_r));
      }
      
	    // Check if the car needs to stop immediately
	    if (stopCarNow(data) && !suppressed_) {
	      if (debug_) LOG_INFO("Enable emergency stopping");
	      transmitBool(wheel_active_output_, false);
	      transmitBool(hazard_light_output_, true);
	    } else if (!suppressed_) {
	      if (debug_) LOG_INFO("Disable emergency stopping");
	      transmitBool(wheel_active_output_, true);
	      transmitBool(hazard_light_output_, false);
	    }
	  } else if (source == &suppress_input_) {
      {
        __adtf_sample_read_lock_mediadescription(suppression_data_description_, media_sample, coder);
        coder->Get("bValue", (tVoid*)&suppressed_);
      }
      
      if(suppressed_) {
        transmitBool(wheel_active_output_, true);
      }
	  }
	}
	
	RETURN_NOERROR;
}
// -------------------------------------------------------------------------------------------------
tResult EmergencyFilter::Init(tInitStage stage, __exception) {
// -------------------------------------------------------------------------------------------------
  RETURN_IF_FAILED(cFilter::Init(stage, __exception_ptr));
  
	if (stage == StageFirst) {
	  // Create and register the input pin
    cObjectPtr<IMediaDescriptionManager> description_manager;
    RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER,
      IID_ADTF_MEDIA_DESCRIPTION_MANAGER,(tVoid**)&description_manager,__exception_ptr));
    
    // Create the output pin description
    tChar const * package_description = description_manager->GetMediaDescription("SensorPackage");
    RETURN_IF_POINTER_NULL(package_description);        
    cObjectPtr<IMediaType> package_type = new cMediaType(0, 0, 0, "SensorPackage", package_description, IMediaDescription::MDF_DDL_DEFAULT_VERSION);	
    RETURN_IF_FAILED(package_type->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&sensor_package_description_));
    
    // Create the input pin
    RETURN_IF_FAILED(sensor_package_input_.Create("sensorPackage", package_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&sensor_package_input_));
    
    // Create the suppression input description
    tChar const * suppression_description = description_manager->GetMediaDescription("tBoolSignalValue");
    RETURN_IF_POINTER_NULL(suppression_description);        
    cObjectPtr<IMediaType> suppression_type = new cMediaType(0, 0, 0, "tBoolSignalValue", suppression_description, IMediaDescription::MDF_DDL_DEFAULT_VERSION);	
		RETURN_IF_FAILED(suppression_type->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&suppression_data_description_));
		
		// Create the input pin
    RETURN_IF_FAILED(suppress_input_.Create("suppress_warnings", suppression_type, static_cast<IPinEventSink*>(this)));
    RETURN_IF_FAILED(RegisterPin(&suppress_input_));
    
    // Create the bool output description
    tChar const * bool_description = description_manager->GetMediaDescription("tBoolSignalValue");
    RETURN_IF_POINTER_NULL(bool_description);        
    cObjectPtr<IMediaType> bool_type = new cMediaType(0, 0, 0, "tBoolSignalValue", bool_description, IMediaDescription::MDF_DDL_DEFAULT_VERSION);	
		RETURN_IF_FAILED(bool_type->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&bool_data_description_));
    
    // Create the output pins
    RETURN_IF_FAILED(wheel_active_output_.Create("wheelActive", bool_type, NULL));
    RETURN_IF_FAILED(RegisterPin(&wheel_active_output_));
    
    RETURN_IF_FAILED(hazard_light_output_.Create("hazardLightsEnabled", bool_type, NULL));
    RETURN_IF_FAILED(RegisterPin(&hazard_light_output_));
	}
	
	else if (stage == StageGraphReady) {
	  debug_ = GetPropertyBool("debug");
	  
	  suppressed_ = false;
	}
	
	RETURN_NOERROR;
}
tResult ROI::OnPinEvent(IPin *source, tInt nEventCode, tInt nParam1, tInt nParam2, IMediaSample *mediaSample)
{
    if (nEventCode != IPinEventSink::PE_MediaSampleReceived)
    {
        RETURN_NOERROR;
    }

    RETURN_IF_POINTER_NULL(mediaSample);

    logger.StartLog();

    if (source == &rgbVideoInputPin)
    {
        tFloat diffBefore = (_clock->GetStreamTime() - mediaSample->GetTime()) / 1000.0;

        VisionUtils::ExtractImageFromMediaSample(mediaSample, rgbVideoInputFormat).copyTo(rgbOutputImage);
        RETURN_IF_POINTER_NULL(rgbOutputImage.data);

        ProcessRgbImage();

        TransmitRGBOutput(mediaSample->GetTime());

        tFloat diff = (_clock->GetStreamTime() - mediaSample->GetTime()) / 1000.0;
        logger.Log(cString::Format("RGB: Before: %f, After: %f, Diff: %f", diffBefore, diff, diff - diffBefore).GetPtr());
    }
    else if (source == &depthVideoInputPin)
    {
        tFloat diffBefore = (_clock->GetStreamTime() - mediaSample->GetTime()) / 1000.0;

        VisionUtils::ExtractImageFromMediaSample(mediaSample, depthVideoInputFormat).copyTo(depthOutputImage);
        RETURN_IF_POINTER_NULL(depthOutputImage.data);

        AnalyzeDepthImage();

        ProcessDepthImage();

        TransmitDepthOutput(mediaSample->GetTime());
        SendRoi(rgbROI, rgbRoiOutputPin);
        SendRoi(depthROI, depthRoiOutputPin);

        tFloat diff = (_clock->GetStreamTime() - mediaSample->GetTime()) / 1000.0;
        logger.Log(cString::Format("Depth: Before: %f, After: %f, Diff: %f", diffBefore, diff, diff - diffBefore).GetPtr());
    }
    else
    {
        RETURN_ERROR(ERR_NOT_SUPPORTED);
    }

    logger.EndLog();
    RETURN_NOERROR;
}
示例#11
0
tResult cDriverModule::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));

        // input jury struct
        tChar const * strDesc1 = pDescManager->GetMediaDescription("tJuryStruct");
        RETURN_IF_POINTER_NULL(strDesc1);
        cObjectPtr<IMediaType> pType1 = new cMediaType(0, 0, 0, "tJuryStruct", strDesc1, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
        RETURN_IF_FAILED(m_JuryStructInputPin.Create("Jury_Struct", pType1, this));
        RETURN_IF_FAILED(RegisterPin(&m_JuryStructInputPin));
        RETURN_IF_FAILED(pType1->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pDescJuryStruct));

        // input maneuver list
        tChar const * strDesc3 = pDescManager->GetMediaDescription("tManeuverList");
        RETURN_IF_POINTER_NULL(strDesc3);
        cObjectPtr<IMediaType> pType3 = new cMediaType(0, 0, 0, "tManeuverList", strDesc3, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
        RETURN_IF_FAILED(m_ManeuverListInputPin.Create("Maneuver_List", pType3, this));
        RETURN_IF_FAILED(RegisterPin(&m_ManeuverListInputPin));
        RETURN_IF_FAILED(pType3->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pDescManeuverList));

        // output driver struct
        tChar const * strDesc2 = pDescManager->GetMediaDescription("tDriverStruct");
        RETURN_IF_POINTER_NULL(strDesc2);
        cObjectPtr<IMediaType> pType2 = new cMediaType(0, 0, 0, "tDriverStruct", strDesc2, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
        RETURN_IF_FAILED(m_DriverStructOutputPin.Create("Driver_Struct", pType2, this));
        RETURN_IF_FAILED(RegisterPin(&m_DriverStructOutputPin));
        RETURN_IF_FAILED(pType2->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pDescDriverStruct));

        m_bDebugModeEnabled = GetPropertyBool("Debug Output to Console");
    }
    else if(eStage == StageGraphReady)
    {
        // disable maneuver group box until receiving maneuver list
        m_pWidget->EnableManeuverGroupBox(false);
        // no ids were set so far
        m_bIDsJuryStructSet = tFalse;
        m_bIDsDriverStructSet = tFalse;
    }
    RETURN_NOERROR;
}
tResult pylonDetection::CreateInputPins(__exception)
{	
    cObjectPtr<IMediaDescriptionManager> pDescManager;
    RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER,IID_ADTF_MEDIA_DESCRIPTION_MANAGER,(tVoid**)&pDescManager,__exception_ptr));
    tChar const * strDescMotion = pDescManager->GetMediaDescription("tMotionDataExt");
    RETURN_IF_POINTER_NULL(strDescMotion);
    cObjectPtr<IMediaType> pTypeMotion = new cMediaType(0, 0, 0, "tMotionDataExt", strDescMotion,IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(pTypeMotion->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pCoderDescMotion));

    //rgb image input pin
    RETURN_IF_FAILED(m_inputPin_colorImage.Create("rgb_image", adtf::IPin::PD_Input  , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_inputPin_colorImage));

    //depth image input pin
    RETURN_IF_FAILED(m_inputPin_depthImage.Create("depth_image_in", adtf::IPin::PD_Input  , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_inputPin_depthImage));

    //motion data input pin
    RETURN_IF_FAILED(m_inputPin_motion.Create("motion_data", pTypeMotion, static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_inputPin_motion));

    //sign data input pin
    tChar const * strMarkerInfoValue = pDescManager->GetMediaDescription("tRoadSign");
    RETURN_IF_POINTER_NULL(strMarkerInfoValue);
    cObjectPtr<IMediaType> pTypeSignInfoValue = new cMediaType(0, 0, 0, "tRoadSign", strMarkerInfoValue,IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(pTypeSignInfoValue->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pCoderDescSign));
    RETURN_IF_FAILED(m_inputPin_signLocation.Create("RoadSign", pTypeSignInfoValue  , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_inputPin_signLocation));

    //Color calib input pins
    tChar const * strDescSignalValue = pDescManager->GetMediaDescription("tSignalValue");
    RETURN_IF_POINTER_NULL(strDescSignalValue);
    cObjectPtr<IMediaType> pTypeSignalValue = new cMediaType(0, 0, 0, "tSignalValue", strDescSignalValue,IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(pTypeSignalValue->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pCoderDescSignal));
    RETURN_IF_FAILED(m_inputPin_0.Create("hlow", new cMediaType(0, 0, 0, "tSignalValue") , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_inputPin_0));
    RETURN_IF_FAILED(m_inputPin_1.Create("hhigh", new cMediaType(0, 0, 0, "tSignalValue") , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_inputPin_1));
    RETURN_IF_FAILED(m_inputPin_2.Create("slow", new cMediaType(0, 0, 0, "tSignalValue") , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_inputPin_2));
    RETURN_IF_FAILED(m_inputPin_3.Create("shigh", new cMediaType(0, 0, 0, "tSignalValue") , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_inputPin_3));
    RETURN_IF_FAILED(m_inputPin_4.Create("vlow", new cMediaType(0, 0, 0, "tSignalValue") , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_inputPin_4));
    RETURN_IF_FAILED(m_inputPin_5.Create("vhigh", new cMediaType(0, 0, 0, "tSignalValue") , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_inputPin_5));

	RETURN_NOERROR;
}
示例#13
0
tResult cBoolValueGenerator::Init(tInitStage eStage, __exception)
{
    RETURN_IF_FAILED(cBaseQtFilter::Init(eStage, __exception_ptr));

    if (eStage == StageFirst)    
    {        
        //get the media description manager for this filter
        cObjectPtr<IMediaDescriptionManager> pDescManager;
        RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER,IID_ADTF_MEDIA_DESCRIPTION_MANAGER,(tVoid**)&pDescManager,__exception_ptr));
        //get description
        tChar const * strDescignalValue = pDescManager->GetMediaDescription("tBoolSignalValue");
        
        // checks if exists
        RETURN_IF_POINTER_NULL(strDescignalValue);        
        
        //get mediatype
        cObjectPtr<IMediaType> pTypeSignalValue = new cMediaType(0, 0, 0, "tBoolSignalValue", strDescignalValue,IMediaDescription::MDF_DDL_DEFAULT_VERSION);	
        
        //get mediatype description
        RETURN_IF_FAILED(pTypeSignalValue->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pDescriptionBool)); 

        //create pin for output
        RETURN_IF_FAILED(m_oBoolValuePin.Create("BoolValue",pTypeSignalValue, static_cast<IPinEventSink*> (this)));
        RETURN_IF_FAILED(RegisterPin(&m_oBoolValuePin));

        RETURN_NOERROR;
    }
    else if(eStage == StageGraphReady)
    {
        // media descriptions ids not set by now
        m_bIDsBoolValueOutput = tFalse;
    }
    RETURN_NOERROR;
}
tResult cBoolValueGenerator::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));
    
	    tChar const * strDescignalValue = pDescManager->GetMediaDescription("tBoolSignalValue");
	
        RETURN_IF_POINTER_NULL(strDescignalValue);        
        cObjectPtr<IMediaType> pTypeSignalValue = new cMediaType(0, 0, 0, "tBoolSignalValue", strDescignalValue,IMediaDescription::MDF_DDL_DEFAULT_VERSION);	
        RETURN_IF_FAILED(pTypeSignalValue->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pCoderDescBool)); 
	
	    RETURN_IF_FAILED(m_oBoolValuePin.Create("BoolValue",pTypeSignalValue, static_cast<IPinEventSink*> (this)));
        RETURN_IF_FAILED(RegisterPin(&m_oBoolValuePin));

        RETURN_NOERROR;
    }
    else if(eStage == StageGraphReady)
    {

    }
    RETURN_NOERROR;
}
//#############################################################################
tResult cMovementAnalyzer::OnPinEvent(IPin *pSource, tInt nEventCode, tInt nParam1, tInt nParam2,
                                  IMediaSample *pMediaSample)
{
    RETURN_IF_POINTER_NULL(pSource);
    RETURN_IF_POINTER_NULL(pMediaSample);

    if (nEventCode == IPinEventSink::PE_MediaSampleReceived)
    {
        if (pSource != NULL)
        {
            RETURN_IF_FAILED(ProcessInput(pMediaSample, pSource));
        }
    }

    RETURN_NOERROR;
}
示例#16
0
tResult LaneFollower::CreateInputPins(__exception)
{
    RETURN_IF_FAILED(m_inputPin_LF_enable.Create("lf_enable", new cMediaType(0, 0, 0, "tSignalValue")  , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_inputPin_LF_enable));

    RETURN_IF_FAILED(m_inputPin_LaneInfo.Create("laneInfo", new cMediaType(0, 0, 0, "tLaneInfo")  , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_inputPin_LaneInfo));

    RETURN_IF_FAILED(m_inputPin_CD_enable.Create("cd_enable", new cMediaType(0, 0, 0, "tSignalValue")  , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_inputPin_CD_enable));

    RETURN_IF_FAILED(m_inputPin_PS_enable.Create("ps_enable", new cMediaType(0, 0, 0, "tSignalValue")  , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_inputPin_PS_enable));

    cObjectPtr<IMediaDescriptionManager> pDescManager;
    RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER,IID_ADTF_MEDIA_DESCRIPTION_MANAGER,(tVoid**)&pDescManager,__exception_ptr));

    tChar const * strDesc = pDescManager->GetMediaDescription("tCrossingInfo");
    RETURN_IF_POINTER_NULL(strDesc);
    cObjectPtr<IMediaType> pType = new cMediaType(0, 0, 0, "tCrossingInfo", strDesc, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(pType->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pCoderDescCrossingInfo));

    RETURN_IF_FAILED(m_inputPin_CrossingInfo.Create("CrossingInfo", pType , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_inputPin_CrossingInfo));

	RETURN_NOERROR;
}
示例#17
0
tResult LightMessageLogger::OnAsyncPinEvent(IPin* pSource, tInt nEventCode, tInt nParam1, tInt nParam2,
		IMediaSample* pMediaSample) {
	RETURN_IF_POINTER_NULL(pMediaSample);
	RETURN_IF_POINTER_NULL(pSource);

	__synchronized_obj(criticalSection_OnPinEvent);

	if (nEventCode == IPinEventSink::PE_MediaSampleReceived) {
		if (pSource == &actionInput) {
			TActionStruct::ActionSub actionSub_tmp;
			actionSub_tmp = tActionStruct_object.Read_Action(pMediaSample, F_LIGHT_MESSAGE_LOGGER);
			ProcessAction(actionSub_tmp);
		}
	}

	RETURN_NOERROR;
}
示例#18
0
tResult testPullOutFilter::Init(tInitStage eStage, __exception)
{
    RETURN_IF_FAILED(cBaseQtFilter::Init(eStage, __exception_ptr));

    if (eStage == StageFirst)    
    {        
        //get the media description manager for this filter
        cObjectPtr<IMediaDescriptionManager> pDescManager;
        RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER,IID_ADTF_MEDIA_DESCRIPTION_MANAGER,(tVoid**)&pDescManager,__exception_ptr));
      
		//get description for sensor data pins
        tChar const * strDescIntSignalValue = pDescManager->GetMediaDescription("tInt32SignalValue");
        RETURN_IF_POINTER_NULL(strDescIntSignalValue);
        //get mediatype for ultrasonic sensor data pins
        cObjectPtr<IMediaType> pTypeIntSignalValue = new cMediaType(0, 0, 0, "tInt32SignalValue", strDescIntSignalValue, IMediaDescription::MDF_DDL_DEFAULT_VERSION);


		// Get description for bool values
		tChar const * strDescBoolSignalValue = pDescManager->GetMediaDescription("tBoolSignalValue");	
		RETURN_IF_POINTER_NULL(strDescBoolSignalValue);	
		cObjectPtr<IMediaType> pTypeBoolSignalValue = new cMediaType(0, 0, 0, "tBoolSignalValue", strDescBoolSignalValue, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
     	
		RETURN_IF_FAILED(pTypeBoolSignalValue->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pDescriptionBool));
		RETURN_IF_FAILED(pTypeIntSignalValue->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pStartInput)); 
       

		//create input pin for starting
    	RETURN_IF_FAILED(m_oStartPullOut.Create("StartPullOut", pTypeIntSignalValue, static_cast<IPinEventSink*> (this)));
    	RETURN_IF_FAILED(RegisterPin(&m_oStartPullOut));
		//create input pin for nextSpotFree
    	RETURN_IF_FAILED(m_oNextSpotFree.Create("next_spot_free", pTypeBoolSignalValue, static_cast<IPinEventSink*> (this)));
    	RETURN_IF_FAILED(RegisterPin(&m_oNextSpotFree));

        RETURN_NOERROR;
    }
    else if(eStage == StageGraphReady)
    {
        // media descriptions ids not set by now
		m_bIDsBoolValueOutput = tFalse;
		m_bIDsStartSet = tFalse;
    }
    RETURN_NOERROR;
}
tResult StateControlManagementSlim::OnAsyncPinEvent(IPin* pSource, tInt nEventCode, tInt nParam1, tInt nParam2, IMediaSample* pMediaSample)
{

    RETURN_IF_POINTER_NULL(pMediaSample);
    RETURN_IF_POINTER_NULL(pSource);

    if (nEventCode == IPinEventSink::PE_MediaSampleReceived  )
    {
    	//process the request to set state error pin
		if (pSource == & m_FilterFeedbackInputPin)
		{
			TFeedbackStruct::Data tmp_feedback;
			TFeedbackStruct_object.Read(pMediaSample,&tmp_feedback);
			ProcessData(tmp_feedback);
		}
    }
    RETURN_NOERROR;

}
tResult Test::initMediaType(const char *mediaTypeDescriptionName, cObjectPtr<IMediaType> &mediaType, cObjectPtr<IMediaTypeDescription> &coderDescription)
{
	tChar const *descriptionSignalValue = this->descriptionManager->GetMediaDescription(mediaTypeDescriptionName);
    RETURN_IF_POINTER_NULL(descriptionSignalValue);        

	mediaType = new cMediaType(0, 0, 0, mediaTypeDescriptionName, descriptionSignalValue, IMediaDescription::MDF_DDL_DEFAULT_VERSION);	
	RETURN_IF_FAILED(mediaType->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**) &coderDescription));

	RETURN_NOERROR;
}
tResult Emergency::initOutputPins(cObjectPtr<IMediaType> &typeSignalOut)
{
    std::string signalValueName = "tSteeringAngleData";

    tChar const *descriptionSignalValue = this->descriptionManager->GetMediaDescription(signalValueName.c_str());
    RETURN_IF_POINTER_NULL(descriptionSignalValue);

    typeSignalOut = new cMediaType(0, 0, 0, signalValueName.c_str(), descriptionSignalValue, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(typeSignalOut->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**) &this->coderDescriptionSignalOutput));

    RETURN_NOERROR;
}
tResult pylonDetection::CreateOutputPins(__exception)
{
    //debug image otput pin
    RETURN_IF_FAILED(m_outputPin_debugImage.Create("debug_image", adtf::IPin::PD_Output  , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_outputPin_debugImage));

    //depth depth output pin
    RETURN_IF_FAILED(m_outputPin_depthImage.Create("depth_image_out", adtf::IPin::PD_Output  , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_outputPin_depthImage));

    //Pylon Info output pin
    cObjectPtr<IMediaDescriptionManager> pDescManager;
    RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER,IID_ADTF_MEDIA_DESCRIPTION_MANAGER,(tVoid**)&pDescManager,__exception_ptr));
    tChar const * strDesc = pDescManager->GetMediaDescription("tPylonInfo");
    if(!strDesc) LOG_ERROR(cString(OIGetInstanceName()) + ": Could not load mediadescription tPylonInfo, check path");
    RETURN_IF_POINTER_NULL(strDesc);
    cObjectPtr<IMediaType> pType = new cMediaType(0, 0, 0, "tPylonInfo", strDesc, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(m_outputPin_PylonInfo.Create("PylonInfo", pType, this));
    RETURN_IF_FAILED(RegisterPin(&m_outputPin_PylonInfo));
    RETURN_IF_FAILED(pType->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pCoderDescPylonInfo));
 
    //Lane Info
    tChar const * strDescLaneInfoValue = pDescManager->GetMediaDescription("tLaneInfo");
    RETURN_IF_POINTER_NULL(strDescLaneInfoValue);
    cObjectPtr<IMediaType> pTypeLaneInfoValue = new cMediaType(0, 0, 0, "tLaneInfo", strDescLaneInfoValue,IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(pTypeLaneInfoValue->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pCoderDescLaneInfo));

    RETURN_IF_FAILED(m_oLaneDataOutputPin.Create("laneInfo", pTypeLaneInfoValue  , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_oLaneDataOutputPin));

    //acceleration pin
    tChar const * strDescSignalValue = pDescManager->GetMediaDescription("tSignalValue");
    RETURN_IF_POINTER_NULL(strDescSignalValue);
    cObjectPtr<IMediaType> pTypeSignalValue = new cMediaType(0, 0, 0, "tSignalValue", strDescSignalValue,IMediaDescription::MDF_DDL_DEFAULT_VERSION);

    RETURN_IF_FAILED(m_outputPin_speed.Create("accelerate", pTypeSignalValue  , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_outputPin_speed));

    RETURN_NOERROR;
}
tResult YawToSteer::CreateDescriptions(IException **__exception_ptr)
{
    cObjectPtr<IMediaDescriptionManager> descManager;
    RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER, IID_ADTF_MEDIA_DESCRIPTION_MANAGER,
                                         (tVoid **) &descManager, __exception_ptr));
    // Get Signal Value
    tChar const *signalValueDescription = descManager->GetMediaDescription("tSignalValue");
    RETURN_IF_POINTER_NULL(signalValueDescription);
    typeSignalValue = new cMediaType(0, 0, 0, "tSignalValue", signalValueDescription,
                                     IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(typeSignalValue->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid **) &descriptionSignalValue));
    RETURN_NOERROR;
}
tResult ROI::InitDescriptions(IException **__exception_ptr)
{
    cObjectPtr<IMediaDescriptionManager> pDescManager;
    RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER, IID_ADTF_MEDIA_DESCRIPTION_MANAGER,
                                         (tVoid **) &pDescManager, __exception_ptr));

    tChar const *tRectDescription = pDescManager->GetMediaDescription("tRect");
    RETURN_IF_POINTER_NULL(tRectDescription);

    tRectType = new cMediaType(0, 0, 0, "tRect", tRectDescription, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(tRectType->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid **) &tRectDescriptionSignal));

    RETURN_NOERROR;
}
示例#25
0
tResult LaneFollower::CreateOutputPins(__exception)
{ 
    cObjectPtr<IMediaDescriptionManager> pDescManager;
    RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER,IID_ADTF_MEDIA_DESCRIPTION_MANAGER,(tVoid**)&pDescManager,__exception_ptr));

    tChar const * strDescSignalValue = pDescManager->GetMediaDescription("tSignalValue");
    RETURN_IF_POINTER_NULL(strDescSignalValue);
    cObjectPtr<IMediaType> pTypeSignalValue = new cMediaType(0, 0, 0, "tSignalValue", strDescSignalValue,IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(pTypeSignalValue->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pCoderDescSignal));
    pTypeSignalValue = new cMediaType(0, 0, 0, "tSignalValue", strDescSignalValue,IMediaDescription::MDF_DDL_DEFAULT_VERSION);
        RETURN_IF_FAILED(pTypeSignalValue->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pCoderDescSignal_cd));

    tChar const * strDescLaneInfoValue = pDescManager->GetMediaDescription("tLaneInfo");
    RETURN_IF_POINTER_NULL(strDescLaneInfoValue);
    cObjectPtr<IMediaType> pTypeLaneInfoValue = new cMediaType(0, 0, 0, "tLaneInfo", strDescLaneInfoValue,IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(pTypeLaneInfoValue->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pCoderDescLaneInfo));

    RETURN_IF_FAILED(m_outputPin_steer_angle.Create("steer_angle", pTypeSignalValue  , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_outputPin_steer_angle));


    RETURN_NOERROR;
}
tResult Emergency::initInputPins(IException** __exception_ptr, cObjectPtr<IMediaType> &typeSignal)
{
    std::string signalValueName = "tSignalValue";

    RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER, IID_ADTF_MEDIA_DESCRIPTION_MANAGER, (tVoid**) &this->descriptionManager, __exception_ptr));

    tChar const *descriptionSignalValue = this->descriptionManager->GetMediaDescription(signalValueName.c_str());
    RETURN_IF_POINTER_NULL(descriptionSignalValue);

    typeSignal = new cMediaType(0, 0, 0, signalValueName.c_str(), descriptionSignalValue, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(typeSignal->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**) &this->coderDescriptionSignalInput));

    RETURN_NOERROR;
}
tResult StateControllerNew::OnPinEvent(IPin *sourcePin, tInt eventCode, tInt param1, tInt param2, IMediaSample *mediaSample)
{
    if (eventCode != IPinEventSink::PE_MediaSampleReceived)
    {
        RETURN_NOERROR;
    }

    RETURN_IF_POINTER_NULL(mediaSample);

    logger.StartLog();
    EvaluatePin(sourcePin, mediaSample);
    logger.EndLog();

    RETURN_NOERROR;
}
tResult StateControllerNew::CreateDescriptions(IException **__exception_ptr)
{
    cObjectPtr<IMediaDescriptionManager> descManager;
    RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER, IID_ADTF_MEDIA_DESCRIPTION_MANAGER,
                                         (tVoid **) &descManager, __exception_ptr));

    // get signal
    tChar const *strSignal = descManager->GetMediaDescription("tSignalValue");
    RETURN_IF_POINTER_NULL(strSignal);
    signalMediaType = new cMediaType(0, 0, 0, "tSignalValue", strSignal, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(signalMediaType->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid **) &signalDescription));

    // get bool
    tChar const *strBool = descManager->GetMediaDescription("tBoolSignalValue");
    RETURN_IF_POINTER_NULL(strBool);
    boolMediaType = new cMediaType(0, 0, 0, "tBoolSignalValue", strBool, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(boolMediaType->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid **) &boolDescription));

    // get enum
    tChar const *strEnumBox = descManager->GetMediaDescription("tEnumBox");
    RETURN_IF_POINTER_NULL(strEnumBox);
    enumMediaType = new cMediaType(0, 0, 0, "tEnumBox", strEnumBox, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(enumMediaType->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid **) &enumDescription));

    // get drive
    tChar const *strDriveStruct = descManager->GetMediaDescription("tDriverStruct");
    RETURN_IF_POINTER_NULL(strDriveStruct);
    driveStructMediaType = new cMediaType(0, 0, 0, "tDriverStruct", strDriveStruct, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(driveStructMediaType->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid **) &driveStructDescription));

    // get jury
    tChar const *strJuryStruct = descManager->GetMediaDescription("tJuryStruct");
    RETURN_IF_POINTER_NULL(strJuryStruct);
    juryMediaType = new cMediaType(0, 0, 0, "tJuryStruct", strJuryStruct, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(juryMediaType->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid **) &juryDescription));

    // get maneuverlist
    tChar const *strManeuverList = descManager->GetMediaDescription("tManeuverList");
    RETURN_IF_POINTER_NULL(strManeuverList);
    maneuverListMediaType = new cMediaType(0, 0, 0, "tManeuverList", strManeuverList, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(maneuverListMediaType->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid **) &maneuverListDescription));

    // get juryStop
    tChar const *strJuryStop = descManager->GetMediaDescription("tJuryEmergencyStop");
    RETURN_IF_POINTER_NULL(strJuryStop);
    juryStopMediaType = new cMediaType(0, 0, 0, "tJuryEmergencyStop", strJuryStop, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(juryStopMediaType->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid **) &juryStopDescription));

    RETURN_NOERROR;
}
tResult Test::initVideoStream(void)
{
	//Read media type
	cObjectPtr<IMediaType> type;
	RETURN_IF_FAILED(this->xtionPin.GetMediaType(&type));

	cObjectPtr<IMediaTypeVideo> typeVideo;
	RETURN_IF_FAILED(type->GetInterface(IID_ADTF_MEDIA_TYPE_VIDEO, (tVoid**)(&typeVideo)));

	const tBitmapFormat *format = typeVideo->GetFormat();
	RETURN_IF_POINTER_NULL(format);

	//Set media type
	setBitmapFormat(format);

	RETURN_NOERROR;
}
tResult cSimpleFusion::Init(tInitStage eStage, __exception)
{
    RETURN_IF_FAILED(cFilter::Init(eStage, __exception_ptr));

    if (eStage == StageFirst)
    {
        cObjectPtr<IMediaDescriptionManager> pDescManager;

        RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER,IID_ADTF_MEDIA_DESCRIPTION_MANAGER,(tVoid**)&pDescManager,NULL));
        tChar const * strDescSignalValue = pDescManager->GetMediaDescription("tSignalValue");
        RETURN_IF_POINTER_NULL(strDescSignalValue);

        pTypeSignalValue = new cMediaType(0, 0, 0, "tSignalValue", strDescSignalValue,IMediaDescription::MDF_DDL_DEFAULT_VERSION);
        RETURN_IF_FAILED(pTypeSignalValue->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pCoderDescSignalInput));

        createOutputPin();
        createInputPinIRLongeRange("ir_long_in");
        createInputPinIRShortRange1("ir_short_in1");
        createInputPinIRShortRange2("ir_short_in2");
        createInputPinUSLeft("us_left_in");
        createInputPinUSRight("us_right_in");
    }
    else if (eStage == StageNormal)
    {
        // In this stage you would do further initialisation and/or create your dynamic pins.
        // Please take a look at the demo_dynamicpin example for further reference.

        stateOfLongeRangeInputPin = GetPropertyInt(PROP_NAME_IR_LONGE_RANGE_INPUT_PIN_ACTIVE);
        stateOfShortRangeInputPin1 = GetPropertyInt(PROP_NAME_IR_SHORT_RANGE_1_INPUT_PIN_ACTIVE);
        stateOfShortRangeInputPin2 = GetPropertyInt(PROP_NAME_IR_SHORT_RANGE_2_INPUT_PIN_ACTIVE);
        stateOfUSRightInputPin = GetPropertyInt(PROP_NAME_US_RIGHT_INPUT_PIN_ACTIVE);
        stateOfUSLeftInputPin = GetPropertyInt(PROP_NAME_US_LEFT_INPUT_PIN_ACTIVE);
        lengthOfMedianVector = GetPropertyInt(PROP_NAME_MEDIAN);
        thresholdIRLongRange = GetPropertyInt(PROP_NAME_IR_LONG_RANGE_THRESHOLD);
        thresholdIRShortRange = GetPropertyInt(PROP_NAME_IR_SHORT_RANGE_THRESHOLD);
        thresholdUS = GetPropertyInt(PROP_NAME_US_THRESHOLD);
        calculatedMedian();
    }

    else if (eStage == StageGraphReady)
    {
    }

    RETURN_NOERROR;
}