Implemented some properties
This commit is contained in:
34
pinesrcbin.c
34
pinesrcbin.c
@@ -38,6 +38,8 @@ enum
|
|||||||
PROP_NUM_BUFFERS,
|
PROP_NUM_BUFFERS,
|
||||||
PROP_TEST_PATTERN,
|
PROP_TEST_PATTERN,
|
||||||
PROP_HUE,
|
PROP_HUE,
|
||||||
|
PROP_DEVICE,
|
||||||
|
PROP_MODE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -158,6 +160,7 @@ gst_pinesrcbin_dispose (GObject * object)
|
|||||||
{
|
{
|
||||||
GstPineSrcBin *self = GST_PINESRCBIN (object);
|
GstPineSrcBin *self = GST_PINESRCBIN (object);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (self, "gst_pinesrcbin_dispose: dispose");
|
||||||
gst_pinesrcbin_clear_kid (self);
|
gst_pinesrcbin_clear_kid (self);
|
||||||
|
|
||||||
if (self->filter_caps)
|
if (self->filter_caps)
|
||||||
@@ -197,6 +200,16 @@ gst_pinesrcbin_set_property (GObject * object, guint prop_id,
|
|||||||
g_print("setting prop hue: %d\n", self->hue);
|
g_print("setting prop hue: %d\n", self->hue);
|
||||||
set_camera_control("rear", CONTROL_HUE, self->hue);
|
set_camera_control("rear", CONTROL_HUE, self->hue);
|
||||||
break;
|
break;
|
||||||
|
case PROP_MODE:
|
||||||
|
self->mode = g_value_get_int (value);
|
||||||
|
g_print("setting prop mode: %d\n", self->hue);
|
||||||
|
break;
|
||||||
|
case PROP_DEVICE:
|
||||||
|
{
|
||||||
|
const char * devname = g_value_get_int (value);
|
||||||
|
g_print("setting prop device: %s\n", devname);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@@ -226,6 +239,14 @@ gst_pinesrcbin_get_property (GObject * object, guint prop_id,
|
|||||||
g_print("getting prop hue: %d\n", self->hue);
|
g_print("getting prop hue: %d\n", self->hue);
|
||||||
g_value_set_int (value, self->hue);
|
g_value_set_int (value, self->hue);
|
||||||
break;
|
break;
|
||||||
|
case PROP_MODE:
|
||||||
|
g_print("getting prop mode: %d\n", self->mode);
|
||||||
|
g_value_set_int (value, self->mode);
|
||||||
|
break;
|
||||||
|
case PROP_DEVICE:
|
||||||
|
g_print("getting prop device: %s\n", "");
|
||||||
|
g_value_set_string (value, "");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@@ -322,6 +343,7 @@ gst_pinesrcbin_change_state (GstElement * element, GstStateChange transition)
|
|||||||
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
|
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
|
||||||
GstPineSrcBin *sink = GST_PINESRCBIN (element);
|
GstPineSrcBin *sink = GST_PINESRCBIN (element);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (sink, "gst_pinesrcbin_change_state: state change");
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
case GST_STATE_CHANGE_NULL_TO_READY:
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||||
if (!gst_pinesrcbin_detect (sink))
|
if (!gst_pinesrcbin_detect (sink))
|
||||||
@@ -379,6 +401,14 @@ gst_pinesrcbin_class_init (GstPineSrcBinClass * klass)
|
|||||||
g_param_spec_int ("hue", "Hue",
|
g_param_spec_int ("hue", "Hue",
|
||||||
"Set image hue", 0, 65535, 128,
|
"Set image hue", 0, 65535, 128,
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
g_object_class_install_property (gobject_class, PROP_DEVICE,
|
||||||
|
g_param_spec_string ("device", "Device",
|
||||||
|
"Device", "",
|
||||||
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
g_object_class_install_property (gobject_class, PROP_MODE,
|
||||||
|
g_param_spec_int ("mode", "Mode",
|
||||||
|
"Set image hue", 1, 2, 1,
|
||||||
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (pinesrcbin_debug);
|
GST_DEBUG_CATEGORY (pinesrcbin_debug);
|
||||||
@@ -391,6 +421,7 @@ gst_pinesrcbin_init (GstPineSrcBin * self)
|
|||||||
self->num_buffers = -1;
|
self->num_buffers = -1;
|
||||||
self->test_pattern = 0;
|
self->test_pattern = 0;
|
||||||
self->hue = 128;
|
self->hue = 128;
|
||||||
|
self->mode = 1;
|
||||||
g_print("initial hue: %d\n", self->hue);
|
g_print("initial hue: %d\n", self->hue);
|
||||||
GST_DEBUG_OBJECT (self, "Starting device configuration");
|
GST_DEBUG_OBJECT (self, "Starting device configuration");
|
||||||
gst_pinesrcbin_configure_device(self, "rear");
|
gst_pinesrcbin_configure_device(self, "rear");
|
||||||
@@ -401,8 +432,9 @@ plugin_init (GstPlugin * plugin)
|
|||||||
{
|
{
|
||||||
GST_DEBUG_CATEGORY_INIT (pinesrcbin_debug, "pinesrcbin", 0,
|
GST_DEBUG_CATEGORY_INIT (pinesrcbin_debug, "pinesrcbin", 0,
|
||||||
"pinephone v4lsrc camera wrapper");
|
"pinephone v4lsrc camera wrapper");
|
||||||
return gst_element_register (plugin, "pinesrcbin",
|
gst_element_register (plugin, "pinesrcbin",
|
||||||
GST_RANK_NONE, GST_TYPE_PINESRCBIN);
|
GST_RANK_NONE, GST_TYPE_PINESRCBIN);
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR,
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR,
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ typedef struct _GstPineSrcBin
|
|||||||
int num_buffers;
|
int num_buffers;
|
||||||
int test_pattern;
|
int test_pattern;
|
||||||
int hue;
|
int hue;
|
||||||
|
int mode;
|
||||||
} GstPineSrcBin;
|
} GstPineSrcBin;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user