mfsourceobject: Remove useless null check for string

We can pass null for the value of string type property.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1241>
This commit is contained in:
Seungha Yang 2020-05-25 21:18:16 +09:00 committed by GStreamer Merge Bot
parent 50b36ce257
commit 8ce4980273
3 changed files with 11 additions and 20 deletions

View file

@ -827,22 +827,15 @@ gst_mf_capture_engine_new (GstMFSourceType type, gint 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_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");

View file

@ -384,13 +384,18 @@ gst_mf_source_object_thread_func (GstMFSourceObject * self)
}
#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;

View file

@ -492,22 +492,15 @@ gst_mf_source_reader_new (GstMFSourceType type, gint 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");