niimaqdxsrc: allow attributes to be set at any time, not just startup
This commit is contained in:
parent
425994d8fb
commit
a0302d6faa
@ -90,6 +90,7 @@ static GstFlowReturn gst_niimaqdxsrc_fill (GstPushSrc * src, GstBuffer * buf);
|
|||||||
static GstCaps *gst_niimaqdxsrc_get_cam_caps (GstNiImaqDxSrc * src);
|
static GstCaps *gst_niimaqdxsrc_get_cam_caps (GstNiImaqDxSrc * src);
|
||||||
static gboolean gst_niimaqdxsrc_close_interface (GstNiImaqDxSrc * niimaqdxsrc);
|
static gboolean gst_niimaqdxsrc_close_interface (GstNiImaqDxSrc * niimaqdxsrc);
|
||||||
static void gst_niimaqdxsrc_reset (GstNiImaqDxSrc * niimaqdxsrc);
|
static void gst_niimaqdxsrc_reset (GstNiImaqDxSrc * niimaqdxsrc);
|
||||||
|
static void gst_niimaqdxsrc_set_dx_attributes (GstNiImaqDxSrc * niimaqdxsrc);
|
||||||
|
|
||||||
IMAQdxError
|
IMAQdxError
|
||||||
gst_niimaqdxsrc_report_imaq_error (IMAQdxError code)
|
gst_niimaqdxsrc_report_imaq_error (IMAQdxError code)
|
||||||
@ -420,11 +421,10 @@ gst_niimaqdxsrc_class_init (GstNiImaqDxSrcClass * klass)
|
|||||||
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE));
|
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE));
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
||||||
PROP_ATTRIBUTES, g_param_spec_string ("attributes",
|
PROP_ATTRIBUTES, g_param_spec_string ("attributes",
|
||||||
"Attributes", "Initial attributes to set", DEFAULT_PROP_ATTRIBUTES,
|
"Attributes", "Attributes to change, comma separated key=value pairs",
|
||||||
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE));
|
DEFAULT_PROP_ATTRIBUTES, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE));
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_BAYER_AS_GRAY,
|
||||||
PROP_BAYER_AS_GRAY, g_param_spec_boolean ("bayer-as-gray",
|
g_param_spec_boolean ("bayer-as-gray", "Bayer as gray",
|
||||||
"Bayer as gray",
|
|
||||||
"For Bayer sources use GRAY caps", DEFAULT_PROP_BAYER_AS_GRAY,
|
"For Bayer sources use GRAY caps", DEFAULT_PROP_BAYER_AS_GRAY,
|
||||||
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE));
|
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE));
|
||||||
|
|
||||||
@ -665,6 +665,9 @@ gst_niimaqdxsrc_fill (GstPushSrc * src, GstBuffer * buf)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* will change attributes if provided */
|
||||||
|
gst_niimaqdxsrc_set_dx_attributes (niimaqdxsrc);
|
||||||
|
|
||||||
if (niimaqdxsrc->caps_info == NULL) {
|
if (niimaqdxsrc->caps_info == NULL) {
|
||||||
GST_ELEMENT_ERROR (niimaqdxsrc, RESOURCE, FAILED,
|
GST_ELEMENT_ERROR (niimaqdxsrc, RESOURCE, FAILED,
|
||||||
("Failed to create caps, possibly unsupported format (%s).",
|
("Failed to create caps, possibly unsupported format (%s).",
|
||||||
@ -907,13 +910,20 @@ error:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
gst_niimaqdxsrc_set_dx_attributes (GstNiImaqDxSrc * niimaqdxsrc)
|
gst_niimaqdxsrc_set_dx_attributes (GstNiImaqDxSrc * niimaqdxsrc)
|
||||||
{
|
{
|
||||||
gchar **pairs;
|
gchar **pairs;
|
||||||
int i;
|
int i;
|
||||||
IMAQdxError rval;
|
IMAQdxError rval;
|
||||||
|
|
||||||
|
if (!niimaqdxsrc->attributes) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (niimaqdxsrc, "Trying to set following attributes: %s",
|
||||||
|
niimaqdxsrc->attributes);
|
||||||
|
|
||||||
pairs = g_strsplit (niimaqdxsrc->attributes, ";", 0);
|
pairs = g_strsplit (niimaqdxsrc->attributes, ";", 0);
|
||||||
|
|
||||||
for (i = 0;; i++) {
|
for (i = 0;; i++) {
|
||||||
@ -938,6 +948,11 @@ gst_niimaqdxsrc_set_dx_attributes (GstNiImaqDxSrc * niimaqdxsrc)
|
|||||||
g_strfreev (pair);
|
g_strfreev (pair);
|
||||||
}
|
}
|
||||||
g_strfreev (pairs);
|
g_strfreev (pairs);
|
||||||
|
|
||||||
|
if (niimaqdxsrc->attributes) {
|
||||||
|
g_free (niimaqdxsrc->attributes);
|
||||||
|
niimaqdxsrc->attributes = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user