static GstFlowReturn gst_inference_consumer_chain()

in tst/utils/inferenceconsumer/gstinferenceconsumer.cc [106:126]


static GstFlowReturn gst_inference_consumer_chain(GstPad * pad, GstObject * parent, GstBuffer * buf) {
    GstInferenceConsumer *filter;
    filter = GST_INFERENCECONSUMER(parent);

    GstLookoutVisionMeta* lookoutvision_meta = gst_buffer_get_lookout_vision_meta(buf);
    if (lookoutvision_meta) {
        GstLookoutVisionResult* inference_result = lookoutvision_meta->result;
        if (inference_result && inference_result->result_status == GstLookoutVisionResultStatus::SUCCESSFUL) {
            std::string result_message = "Detect Anomaly Result - Is Anomalous? "
                                         + std::to_string(inference_result->is_anomalous) + ", Confidence: "
                                         + std::to_string(inference_result->confidence);
            std::cout << result_message << std::endl;
        } else {
            std::cout << "Inference call failed / No result in metadata" << std::endl;
        }
    } else {
        std::cout << "Failed to read metadata" << std::endl;
    }

    return gst_pad_push(filter->srcpad, buf);
}