Esempio n. 1
0
static struct device_resources find_source (GstElement* self)
{

    struct device_resources res = {};
    res.color.max = 255;

    /* if camera_src is not set we assume that the first default camera src found shall be used */

    GstElement* e = GST_ELEMENT(gst_object_get_parent(GST_OBJECT(self)));

    GList* l =  GST_BIN(e)->children;

    while (1==1)
    {

        const char* name = g_type_name(gst_element_factory_get_element_type(gst_element_get_factory(l->data)));

        if (g_strcmp0(name, "GstTcamSrc") == 0)
        {
            GST_INFO("Found tcam source element");
            res.source_element = l->data;
            break;
        }

        if (g_list_next(l) == NULL)
            break;

        l = g_list_next(l);
    }

    update_device_resources(&res);

    return res;
}
Esempio n. 2
0
struct device_resources find_source (GstElement* self)
{

    struct device_resources res = {};
    res.color.max = 255;

    /* if camera_src is not set we assume that the first default camera src found shall be used */

    GstElement* e = GST_ELEMENT( gst_object_get_parent(GST_OBJECT(self)));

    GList* l =  GST_BIN(e)->children;

    while (1==1)
    {

        const char* name = g_type_name(gst_element_factory_get_element_type (gst_element_get_factory(l->data)));

        if (g_strcmp0(name, CAMERASRC_USB) == 0)
        {
            GST_LOG_OBJECT(self, "Found v4l2 device");
            res.source_type = V4L2;
            res.source_element = l->data;
            break;
        }
        if (g_strcmp0(name, CAMERASRC_NETWORK) == 0)
        {
            GST_LOG_OBJECT(self, "Found aravis device");
            res.source_type = ARAVIS;
            res.source_element = l->data;
            break;
        }

        if (g_list_next(l) == NULL)
            break;

        l = g_list_next(l);
    }

    if (res.source_type == UNKNOWN)
    {
        GST_LOG_OBJECT(self, "Unknown source type");
    }

    update_device_resources (&res);

    return res;
}