void gst_mxnet_set_property()

in awstreamer/gst_plugins/mxnet/src/gstmxnet.cpp [181:230]


void gst_mxnet_set_property(GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
    GstMXNet *mxnet = GST_MXNET (object);
    GST_DEBUG_OBJECT (mxnet, "set_property");

    switch (property_id) {
    case PROP_MODEL_FILE:
        g_free(mxnet->model_file);
        mxnet->model_file = g_strdup(g_value_get_string(value));
        mxnet->imageProcessor->setParam("model-file", std::string(mxnet->model_file));
        break;
    case PROP_CLASS_FILE:
        g_free(mxnet->klass_file);
        mxnet->klass_file = g_strdup(g_value_get_string(value));
        mxnet->imageProcessor->setParam("class-file", std::string(mxnet->klass_file));
        break;
    case PROP_DEVICE_TYPE:
        g_free(mxnet->device_type);
        mxnet->device_type = g_strdup(g_value_get_string(value));
        mxnet->imageProcessor->setParam("device-type", std::string(mxnet->device_type));
        break;
    case PROP_IMAGE_SIZE:
        mxnet->image_size = g_value_get_int(value);
        mxnet->imageProcessor->setParam("image-size", (int)(mxnet->image_size));
        break;
    case PROP_FILTER_TAGS: {
        const GstStructure *s = gst_value_get_structure(value);

        if (mxnet->filter_tags) {
            gst_structure_free(mxnet->filter_tags);
        }
        mxnet->filter_tags = s ? gst_structure_copy(s) : NULL;

        // Parse input configuration
        std::map<std::string, std::string> filter_tags;
        if (mxnet->filter_tags) {
            gboolean ret;
            ret = gstructToMap(mxnet->filter_tags, &filter_tags);
            if (!ret) {
                GST_WARNING("Failed to parse stream tags");
                break;
            }
        }
        mxnet->imageProcessor->setParams(filter_tags);
        break;
    }
    default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
        break;
    }
}