コード例 #1
0
tResult StateControllerNew::SendValue(cOutputPin &pin, stateCar state, tInt16 maneuver)
{
    if (!pin.IsConnected())
    {
        RETURN_NOERROR;
    }

    cObjectPtr<IMediaSample> mediaSample;
    RETURN_IF_FAILED(AllocMediaSample((tVoid **) &mediaSample));

    cObjectPtr<IMediaSerializer> driverSerializer;
    driveStructDescription->GetMediaSampleSerializer(&driverSerializer);
    tInt nSize = driverSerializer->GetDeserializedSize();
    RETURN_IF_FAILED(mediaSample->AllocBuffer(nSize));

    tInt8 carState = tInt8(state);
    {
        __adtf_sample_write_lock_mediadescription(driveStructDescription, mediaSample, pCoder);
        pCoder->Set("i8StateID", (tVoid *) &carState);
        pCoder->Set("i16ManeuverEntry", (tVoid *) &maneuver);
    }

    mediaSample->SetTime(_clock->GetStreamTime());
    RETURN_IF_FAILED(pin.Transmit(mediaSample));

    RETURN_NOERROR;
}
コード例 #2
0
tResult ROI::SendRoi(const tRect &roi, cOutputPin &outputPin)
{
    if (!outputPin.IsConnected())
    {
        RETURN_NOERROR;
    }

    cObjectPtr<IMediaSample> mediaSample;
    RETURN_IF_FAILED(AllocMediaSample((tVoid **) &mediaSample));

    cObjectPtr<IMediaSerializer> pSerializer;
    tRectDescriptionSignal->GetMediaSampleSerializer(&pSerializer);
    tInt nSize = pSerializer->GetDeserializedSize();
    RETURN_IF_FAILED(mediaSample->AllocBuffer(nSize));

    {
        __adtf_sample_write_lock_mediadescription(tRectDescriptionSignal, mediaSample, pCoder);

        pCoder->Set("tX", (tVoid *) &roi.tX);
        pCoder->Set("tY", (tVoid *) &roi.tY);
        pCoder->Set("tWidth", (tVoid *) &roi.tWidth);
        pCoder->Set("tHeight", (tVoid *) &roi.tHeight);
    }

    //transmit media sample over output pin
    mediaSample->SetTime(_clock->GetStreamTime());
    RETURN_IF_FAILED(outputPin.Transmit(mediaSample));

    RETURN_NOERROR;
}
コード例 #3
0
tResult StateControllerNew::SendEnum(cOutputPin &pin, tInt value)
{
    if (!pin.IsConnected())
    {
        RETURN_NOERROR;
    }

    cObjectPtr<IMediaSample> mediaSample;
    RETURN_IF_FAILED(AllocMediaSample((tVoid **) &mediaSample));

    cObjectPtr<IMediaSerializer> pSerializer;
    enumDescription->GetMediaSampleSerializer(&pSerializer);
    tInt nSize = pSerializer->GetDeserializedSize();
    RETURN_IF_FAILED(mediaSample->AllocBuffer(nSize));

    {
        __adtf_sample_write_lock_mediadescription(enumDescription, mediaSample, pCoder);
        pCoder->Set("tEnumValue", (tVoid *) &value);
    }

    mediaSample->SetTime(_clock->GetStreamTime());
    RETURN_IF_FAILED(pin.Transmit(mediaSample));

    RETURN_NOERROR;
}