Commit 1762c2e7 authored by Nicolas Dufresne's avatar Nicolas Dufresne

v4l2: Ignore register issue and keep probing

Don't stop registering the other dynamic plugins if one registration
fails.
parent 4b8d0a29
......@@ -119,7 +119,6 @@ gst_v4l2_probe_and_register (GstPlugin * plugin)
GstV4l2Iterator *it;
gint video_fd = -1;
struct v4l2_capability vcap;
gboolean ret = TRUE;
guint32 device_caps;
it = gst_v4l2_iterator_new ();
......@@ -183,23 +182,21 @@ gst_v4l2_probe_and_register (GstPlugin * plugin)
basename = g_path_get_basename (it->device_path);
if (gst_v4l2_is_video_dec (sink_caps, src_caps))
ret = gst_v4l2_video_dec_register (plugin, basename, it->device_path,
if (gst_v4l2_is_video_dec (sink_caps, src_caps)) {
gst_v4l2_video_dec_register (plugin, basename, it->device_path,
sink_caps, src_caps);
else if (gst_v4l2_is_h264_enc (sink_caps, src_caps))
ret = gst_v4l2_h264_enc_register (plugin, basename, it->device_path,
} else if (gst_v4l2_is_h264_enc (sink_caps, src_caps)) {
gst_v4l2_h264_enc_register (plugin, basename, it->device_path,
sink_caps, src_caps);
else if (gst_v4l2_is_transform (sink_caps, src_caps))
ret = gst_v4l2_transform_register (plugin, basename, it->device_path,
} else if (gst_v4l2_is_transform (sink_caps, src_caps)) {
gst_v4l2_transform_register (plugin, basename, it->device_path,
sink_caps, src_caps);
}
/* else if ( ... etc. */
gst_caps_unref (sink_caps);
gst_caps_unref (src_caps);
g_free (basename);
if (!ret)
break;
}
if (video_fd >= 0)
......@@ -207,7 +204,7 @@ gst_v4l2_probe_and_register (GstPlugin * plugin)
gst_v4l2_iterator_free (it);
return ret;
return TRUE;
}
#endif
......
......@@ -531,11 +531,11 @@ gst_v4l2_is_h264_enc (GstCaps * sink_caps, GstCaps * src_caps)
return ret;
}
gboolean
void
gst_v4l2_h264_enc_register (GstPlugin * plugin, const gchar * basename,
const gchar * device_path, GstCaps * sink_caps, GstCaps * src_caps)
{
return gst_v4l2_video_enc_register (plugin, GST_TYPE_V4L2_H264_ENC,
gst_v4l2_video_enc_register (plugin, GST_TYPE_V4L2_H264_ENC,
"h264", basename, device_path, sink_caps,
gst_static_caps_get (&src_template_caps), src_caps);
}
......@@ -55,7 +55,7 @@ GType gst_v4l2_h264_enc_get_type (void);
gboolean gst_v4l2_is_h264_enc (GstCaps * sink_caps, GstCaps * src_caps);
gboolean gst_v4l2_h264_enc_register (GstPlugin * plugin, const gchar * basename,
void gst_v4l2_h264_enc_register (GstPlugin * plugin, const gchar * basename,
const gchar * device_path, GstCaps * sink_caps, GstCaps * src_caps);
G_END_DECLS
......
......@@ -1166,7 +1166,7 @@ gst_v4l2_is_transform (GstCaps * sink_caps, GstCaps * src_caps)
return ret;
}
gboolean
void
gst_v4l2_transform_register (GstPlugin * plugin, const gchar * basename,
const gchar * device_path, GstCaps * sink_caps, GstCaps * src_caps)
{
......@@ -1193,9 +1193,8 @@ gst_v4l2_transform_register (GstPlugin * plugin, const gchar * basename,
type_name = g_strdup_printf ("v4l2%sconvert", basename);
subtype = g_type_register_static (type, type_name, &type_info, 0);
gst_element_register (plugin, type_name, GST_RANK_NONE, subtype);
if (!gst_element_register (plugin, type_name, GST_RANK_NONE, subtype))
GST_WARNING ("Failed to register plugin '%s'", type_name);
g_free (type_name);
return TRUE;
}
......@@ -74,7 +74,7 @@ struct _GstV4l2TransformClass
GType gst_v4l2_transform_get_type (void);
gboolean gst_v4l2_is_transform (GstCaps * sink_caps, GstCaps * src_caps);
gboolean gst_v4l2_transform_register (GstPlugin * plugin,
void gst_v4l2_transform_register (GstPlugin * plugin,
const gchar *basename,
const gchar *device_path,
GstCaps * sink_caps, GstCaps * src_caps);
......
......@@ -1059,7 +1059,7 @@ G_STMT_START { \
#undef SET_META
}
gboolean
void
gst_v4l2_video_dec_register (GstPlugin * plugin, const gchar * basename,
const gchar * device_path, GstCaps * sink_caps, GstCaps * src_caps)
{
......@@ -1098,10 +1098,10 @@ gst_v4l2_video_dec_register (GstPlugin * plugin, const gchar * basename,
type_info.instance_init = gst_v4l2_video_dec_subinstance_init;
subtype = g_type_register_static (type, type_name, &type_info, 0);
gst_element_register (plugin, type_name, GST_RANK_PRIMARY + 1, subtype);
if (!gst_element_register (plugin, type_name, GST_RANK_PRIMARY + 1,
subtype))
GST_WARNING ("Failed to register plugin '%s'", type_name);
g_free (type_name);
}
return TRUE;
}
......@@ -76,7 +76,7 @@ struct _GstV4l2VideoDecClass
GType gst_v4l2_video_dec_get_type (void);
gboolean gst_v4l2_is_video_dec (GstCaps * sink_caps, GstCaps * src_caps);
gboolean gst_v4l2_video_dec_register (GstPlugin * plugin,
void gst_v4l2_video_dec_register (GstPlugin * plugin,
const gchar *basename,
const gchar *device_path,
GstCaps * sink_caps, GstCaps * src_caps);
......
......@@ -903,7 +903,7 @@ gst_v4l2_video_enc_subclass_init (gpointer g_class, gpointer data)
}
/* Probing functions */
gboolean
void
gst_v4l2_video_enc_register (GstPlugin * plugin, GType type,
const char *codec, const gchar * basename, const gchar * device_path,
GstCaps * sink_caps, GstCaps * codec_caps, GstCaps * src_caps)
......@@ -942,9 +942,9 @@ gst_v4l2_video_enc_register (GstPlugin * plugin, GType type,
}
subtype = g_type_register_static (type, type_name, &type_info, 0);
gst_element_register (plugin, type_name, GST_RANK_PRIMARY + 1, subtype);
g_free (type_name);
if (!gst_element_register (plugin, type_name, GST_RANK_PRIMARY + 1, subtype))
GST_WARNING ("Failed to register plugin '%s'", type_name);
return TRUE;
g_free (type_name);
}
......@@ -79,7 +79,7 @@ struct _GstV4l2VideoEncClass
GType gst_v4l2_video_enc_get_type (void);
gboolean gst_v4l2_video_enc_register (GstPlugin * plugin, GType type,
void gst_v4l2_video_enc_register (GstPlugin * plugin, GType type,
const char *codec, const gchar * basename, const gchar * device_path,
GstCaps * sink_caps, GstCaps *codec_caps, GstCaps * src_caps);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment