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 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;
}
示例#4
0
{
	// never miss calling the parent implementation!!
	RETURN_IF_FAILED(cFilter::Init(eStage, __exception_ptr))

	// in StageFirst you can create and register your static pins.
	if (eStage == StageFirst)
	{
		// create and register the input pin
		cObjectPtr<IMediaDescriptionManager> pDescManager;
		RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER, IID_ADTF_MEDIA_DESCRIPTION_MANAGER, (tVoid**)&pDescManager, __exception_ptr));

		// phase 1
		tChar const * strDescSignalValueInput = pDescManager->GetMediaDescription("tSignalValue");
		RETURN_IF_POINTER_NULL(strDescSignalValueInput);
		cObjectPtr<IMediaType> pTypeSignalValueInput = new cMediaType(0, 0, 0, "tSignalValue", strDescSignalValueInput, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
		RETURN_IF_FAILED(pTypeSignalValueInput->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pCoderDescSignalInput));

		// phase 2
		RETURN_IF_FAILED(m_oInputMeas.Create("input_sample", pTypeSignalValueInput, static_cast<IPinEventSink*> (this)));
		RETURN_IF_FAILED(RegisterPin(&m_oInputMeas));

		// create and register the output pin
		// phase 1
		tChar const * strDescSignalValueOutput = pDescManager->GetMediaDescription("tSignalValue");
		RETURN_IF_POINTER_NULL(strDescSignalValueOutput);
		cObjectPtr<IMediaType> pTypeSignalValueOutput = new cMediaType(0, 0, 0, "tSignalValue", strDescSignalValueOutput, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
		RETURN_IF_FAILED(pTypeSignalValueOutput->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pCoderDescSignalOutput));
		// phase 2
		RETURN_IF_FAILED(m_oOutputFilter.Create("output_filter", pTypeSignalValueOutput, static_cast<IPinEventSink*> (this)));
		RETURN_IF_FAILED(RegisterPin(&m_oOutputFilter));
	}