Using device property
This commit is contained in:
15
pinesrcbin.c
15
pinesrcbin.c
@@ -135,7 +135,8 @@ gst_pinesrcbin_constructed (GObject * object)
|
||||
G_OBJECT_CLASS (parent_class)->constructed (object);
|
||||
self->type_klass = (self->flag == GST_ELEMENT_FLAG_SINK) ? "Sink" : "Source";
|
||||
self->filter_caps = gst_static_caps_get (&raw_video_caps);
|
||||
gst_pinesrcbin_get_gst_caps_data("rear", &width, &height, &format, &interval);
|
||||
gst_pinesrcbin_get_gst_caps_data(self->device, &width, &height, &format, &interval);
|
||||
|
||||
self->filter_caps = gst_caps_new_simple ("video/x-raw",
|
||||
"format", G_TYPE_STRING, format,
|
||||
/* we "flip" interval to get frame rate */
|
||||
@@ -194,20 +195,27 @@ gst_pinesrcbin_set_property (GObject * object, guint prop_id,
|
||||
break;
|
||||
case PROP_TEST_PATTERN:
|
||||
self->test_pattern = g_value_get_int (value);
|
||||
g_print("setting prop test-pattern: %d\n", self->test_pattern);
|
||||
set_camera_control(self->device, CONTROL_TEST_PATTERN, self->test_pattern);
|
||||
break;
|
||||
case PROP_HUE:
|
||||
self->hue = g_value_get_int (value);
|
||||
g_print("setting prop hue: %d\n", self->hue);
|
||||
set_camera_control("rear", CONTROL_HUE, self->hue);
|
||||
set_camera_control(self->device, CONTROL_HUE, self->hue);
|
||||
break;
|
||||
case PROP_MODE:
|
||||
self->mode = g_value_get_int (value);
|
||||
g_print("setting prop mode: %d\n", self->hue);
|
||||
g_print("setting prop mode: %d\n", self->mode);
|
||||
break;
|
||||
case PROP_DEVICE:
|
||||
{
|
||||
const char * devname = g_value_get_int (value);
|
||||
g_print("setting prop device: %s\n", devname);
|
||||
if (devname && strlen(devname) > 0) {
|
||||
if (self->device)
|
||||
g_free(self->device);
|
||||
self->device = g_strdup(devname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -422,6 +430,7 @@ gst_pinesrcbin_init (GstPineSrcBin * self)
|
||||
self->test_pattern = 0;
|
||||
self->hue = 128;
|
||||
self->mode = 1;
|
||||
self->device = g_strdup("front");
|
||||
g_print("initial hue: %d\n", self->hue);
|
||||
GST_DEBUG_OBJECT (self, "Starting device configuration");
|
||||
gst_pinesrcbin_configure_device(self, "rear");
|
||||
|
||||
@@ -493,6 +493,10 @@ void set_camera_control(const char * conf_name, int control, int value)
|
||||
g_print("configuring saturation = %d\n", value);
|
||||
camera_control (cam_data->subdev_fd, V4L2_CID_SATURATION, VIDIOC_S_EXT_CTRLS, &value);
|
||||
break;
|
||||
case CONTROL_TEST_PATTERN:
|
||||
g_print("configuring test pattern = %d\n", value);
|
||||
camera_control (cam_data->subdev_fd, V4L2_CID_TEST_PATTERN, VIDIOC_S_EXT_CTRLS, &value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
void gst_pinesrcbin_configure_device(GstPineSrcBin * self, const char *conf_name)
|
||||
@@ -592,6 +596,7 @@ void gst_pinesrcbin_configure_device(GstPineSrcBin * self, const char *conf_name
|
||||
camera_control (cam_data->subdev_fd, V4L2_CID_FOCUS_AUTO, VIDIOC_S_EXT_CTRLS, &enable);
|
||||
}
|
||||
setup_gain (cam_data->subdev_fd, &cam_data->gain_ctrl, &cam_data->gain_max);
|
||||
self->test_pattern = 1;
|
||||
camera_control (cam_data->subdev_fd, V4L2_CID_TEST_PATTERN, VIDIOC_S_EXT_CTRLS, &self->test_pattern);
|
||||
{
|
||||
int auto_gain = 1;
|
||||
|
||||
Reference in New Issue
Block a user