Skip to content

Commit

Permalink
[droidcamsrc] make iso modeas available as a property and refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
piggz committed Oct 16, 2018
1 parent 69ba7d8 commit 58d3431
Showing 1 changed file with 30 additions and 15 deletions.
45 changes: 30 additions & 15 deletions gst/droidcamsrc/gstdroidcamsrcphotography.c
Expand Up @@ -327,6 +327,26 @@ gst_droidcamsrc_photography_prepare_for_capture (GstPhotography * photo,
capture_caps, user_data);
}

gchar *
gst_droid_camsrc_glist_to_string (GList * list, gboolean key)
{
int len = g_list_length (list);
gchar *modes = "";
if (len == 0) {
return modes;
}

struct DataEntry *entry;
GList *l;
for (l = list; l != NULL; l = l->next) {
entry = l->data;
modes =
g_strconcat (modes, ",", (key ? g_strdup_printf ("%i",
entry->key) : entry->value), NULL);
}
return modes;
}

static void
gst_droidcamsrc_photography_set_autofocus (GstPhotography * photo, gboolean on)
{
Expand Down Expand Up @@ -612,22 +632,17 @@ gst_droidcamsrc_photography_get_property (GstDroidCamSrc * src, guint prop_id,

case PROP_SUPPORTED_EXPOSURE_MODES:
{
int len = g_list_length (src->photo->scene);
if (len == 0) {
GST_WARNING_OBJECT (src, "params for scene not yet available.");
return TRUE;
}

struct DataEntry *entry;

GList *l;
gchar *modes = "";
for (l = src->photo->scene; l != NULL; l = l->next) {
entry = l->data;
modes = g_strconcat (modes, ",", entry->value, NULL);
}
gchar *exposure_modes =
gst_droid_camsrc_glist_to_string (src->photo->scene, FALSE);
g_value_set_string (value, exposure_modes);
}
return TRUE;

g_value_set_string (value, modes);
case PROP_SUPPORTED_ISO_VALUES:
{
gchar *iso_modes =
gst_droid_camsrc_glist_to_string (src->photo->iso, TRUE);
g_value_set_string (value, iso_modes);
}
return TRUE;
}
Expand Down

0 comments on commit 58d3431

Please sign in to comment.