We can pass null for the value of string type property.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1241>
const gchar * device_name, const gchar * device_path)
{
GstMFSourceObject *self;
- gchar *name;
- gchar *path;
/* TODO: add more type */
g_return_val_if_fail (type == GST_MF_SOURCE_TYPE_VIDEO, NULL);
- name = device_name ? g_strdup (device_name) : g_strdup ("");
- path = device_path ? g_strdup (device_path) : g_strdup ("");
-
self = (GstMFSourceObject *) g_object_new (GST_TYPE_MF_CAPTURE_ENGINE,
- "source-type", type, "device-index", device_index, "device-name", name,
- "device-path", path, NULL);
+ "source-type", type, "device-index", device_index, "device-name",
+ device_name, "device-path", device_path, NULL);
gst_object_ref_sink (self);
- g_free (name);
- g_free (path);
if (!self->opened) {
GST_WARNING_OBJECT (self, "Couldn't open device");
}
#endif
+ GST_DEBUG_OBJECT (self,
+ "Requested device index: %d, name: \"%s\", path \"%s\"",
+ self->device_index, GST_STR_NULL (self->device_name),
+ GST_STR_NULL (self->device_path));
+
for (iter = activate_list; iter; iter = g_list_next (iter)) {
GstMFDeviceActivate *activate = (GstMFDeviceActivate *) iter->data;
gboolean match;
- if (self->device_path && strlen (self->device_path) > 0) {
+ if (self->device_path) {
match = g_ascii_strcasecmp (activate->path, self->device_path) == 0;
- } else if (self->device_name && strlen (self->device_name) > 0) {
+ } else if (self->device_name) {
match = g_ascii_strcasecmp (activate->name, self->device_name) == 0;
} else if (self->device_index >= 0) {
match = activate->index == self->device_index;
const gchar * device_name, const gchar * device_path)
{
GstMFSourceObject *self;
- gchar *name;
- gchar *path;
/* TODO: add more type */
g_return_val_if_fail (type == GST_MF_SOURCE_TYPE_VIDEO, NULL);
- name = device_name ? g_strdup (device_name) : g_strdup ("");
- path = device_path ? g_strdup (device_path) : g_strdup ("");
-
self = (GstMFSourceObject *) g_object_new (GST_TYPE_MF_SOURCE_READER,
- "source-type", type, "device-index", device_index, "device-name", name,
- "device-path", path, NULL);
+ "source-type", type, "device-index", device_index, "device-name",
+ device_name, "device-path", device_path, NULL);
gst_object_ref_sink (self);
- g_free (name);
- g_free (path);
if (!self->opened) {
GST_WARNING_OBJECT (self, "Couldn't open device");