Commit b87b5a49 authored by Justin Kim's avatar Justin Kim

ahc2src: implement get_capabilities

Signed-off-by: Justin Kim's avatarJustin Kim <justin.kim@collabora.com>
parent 3a7a2501
......@@ -177,6 +177,43 @@ enum
static guint signals[LAST_SIGNAL] = { 0 };
static GstPhotographyCaps
gst_ahc2_src_get_capabilities (GstPhotography * photo)
{
GstAHC2Src *self = GST_AHC2_SRC (photo);
GstAHC2SrcPrivate *priv = GST_AHC2_SRC_GET_PRIVATE (self);
GstPhotographyCaps caps = GST_PHOTOGRAPHY_CAPS_EV_COMP |
GST_PHOTOGRAPHY_CAPS_WB_MODE | GST_PHOTOGRAPHY_CAPS_TONE |
GST_PHOTOGRAPHY_CAPS_SCENE | GST_PHOTOGRAPHY_CAPS_FLASH |
GST_PHOTOGRAPHY_CAPS_FOCUS;
ACameraMetadata* metadata = NULL;
ACameraMetadata_const_entry entry;
g_return_val_if_fail (priv->camera_manager != NULL, caps);
g_return_val_if_fail (priv->camera_id_list != NULL, caps);
g_return_val_if_fail (priv->camera_index < priv->camera_id_list->numCameras,
caps);
if (ACameraManager_getCameraCharacteristics (priv->camera_manager,
priv->camera_id_list->cameraIds[priv->camera_index],
&metadata) != ACAMERA_OK) {
return caps;
}
if (ACameraMetadata_getConstEntry (metadata,
ACAMERA_LENS_INFO_AVAILABLE_FOCAL_LENGTHS, &entry) == ACAMERA_OK) {
if (entry.count > 1) {
caps |= GST_PHOTOGRAPHY_CAPS_ZOOM;
}
}
g_clear_pointer (&metadata, (GDestroyNotify) ACameraMetadata_free);
return caps;
}
static gboolean
gst_ahc2_src_get_white_balance_mode (GstPhotography * photo,
GstPhotographyWhiteBalanceMode * mode)
......@@ -738,6 +775,14 @@ gst_ahc2_src_get_property (GObject * object,
case PROP_MAX_IMAGES:
g_value_set_int (value, priv->max_images);
break;
case PROP_CAPABILITIES:{
GstPhotographyCaps caps;
caps = gst_ahc2_src_get_capabilities (GST_PHOTOGRAPHY (self));
g_value_set_ulong (value, caps);
break;
}
case PROP_WHITE_BALANCE_MODE: {
GstPhotographyWhiteBalanceMode wb;
if (gst_ahc2_src_get_white_balance_mode (GST_PHOTOGRAPHY (self), &wb))
......@@ -1195,6 +1240,8 @@ gst_ahc2_src_photography_init (gpointer g_iface, gpointer iface_data)
{
GstPhotographyInterface *iface = g_iface;
iface->get_capabilities = gst_ahc2_src_get_capabilities;
iface->get_white_balance_mode = gst_ahc2_src_get_white_balance_mode;
iface->set_white_balance_mode = gst_ahc2_src_set_white_balance_mode;
}
......
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