@@ -86,8 +86,108 @@
gchar *value;
};
-static GList *gst_droidcamsrc_photography_load (GKeyFile * file,
- const gchar * property);
+struct DataEntry FlashValues[] = {
+ {GST_PHOTOGRAPHY_FLASH_MODE_AUTO, "auto"},
+ {GST_PHOTOGRAPHY_FLASH_MODE_OFF, "off"},
+ {GST_PHOTOGRAPHY_FLASH_MODE_ON, "on"},
+ {GST_PHOTOGRAPHY_FLASH_MODE_RED_EYE, "red-eye"}
+};
+
+struct DataEntry FocusValues[] = {
+ {GST_PHOTOGRAPHY_FOCUS_MODE_AUTO, "auto"},
+ {GST_PHOTOGRAPHY_FOCUS_MODE_MACRO, "macro"},
+ {GST_PHOTOGRAPHY_FOCUS_MODE_INFINITY, "infinity"},
+ {GST_PHOTOGRAPHY_FOCUS_MODE_HYPERFOCAL, "fixed"},
+ {GST_PHOTOGRAPHY_FOCUS_MODE_EXTENDED, "edof"},
+ {GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_NORMAL, "continuous"},
+ {GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_EXTENDED, "continuous"},
+ {GST_PHOTOGRAPHY_FOCUS_MODE_MANUAL, "manual"}
+};
+
+struct DataEntry ISOValues[] = {
+ {0, "auto"},
+ {0, "iso-auto"},
+ {1, "ISO_HJR"},
+ {100, "ISO100"},
+ {100, "iso-100"},
+ {100, "100"},
+ {200, "ISO200"},
+ {200, "iso-200"},
+ {200, "200"},
+ {400, "ISO400"},
+ {400, "iso-400"},
+ {400, "400"},
+ {800, "ISO800"},
+ {800, "iso-800"},
+ {800, "800"},
+ {1600, "ISO1600"},
+ {1600, "1600"},
+ {3200, "ISO3200"},
+ {3200, "3200"},
+ {6400, "ISO6400"},
+ {6400, "6400"},
+ {12800, "ISO12800"},
+ {12800, "12800"}
+};
+
+struct DataEntry WhiteBalanceValues[] = {
+ {GST_PHOTOGRAPHY_WB_MODE_AUTO, "auto"},
+ {GST_PHOTOGRAPHY_WB_MODE_DAYLIGHT, "daylight"},
+ {GST_PHOTOGRAPHY_WB_MODE_CLOUDY, "cloudy-daylight"},
+ {GST_PHOTOGRAPHY_WB_MODE_SUNSET, "twilight"},
+ {GST_PHOTOGRAPHY_WB_MODE_TUNGSTEN, "incandescent"},
+ {GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT, "fluorescent"},
+ {GST_PHOTOGRAPHY_WB_MODE_MANUAL, "manual"},
+ {GST_PHOTOGRAPHY_WB_MODE_WARM_FLUORESCENT, "warm-fluorescent"},
+ {GST_PHOTOGRAPHY_WB_MODE_SHADE, "shade"}
+};
+
+struct DataEntry SceneValues[] = {
+ {GST_PHOTOGRAPHY_SCENE_MODE_PORTRAIT, "portrait"},
+ {GST_PHOTOGRAPHY_SCENE_MODE_LANDSCAPE, "landscape"},
+ {GST_PHOTOGRAPHY_SCENE_MODE_SPORT, "sports"},
+ {GST_PHOTOGRAPHY_SCENE_MODE_NIGHT, "night"},
+ {GST_PHOTOGRAPHY_SCENE_MODE_AUTO, "auto"},
+ {GST_PHOTOGRAPHY_SCENE_MODE_ACTION, "action"},
+ {GST_PHOTOGRAPHY_SCENE_MODE_NIGHT_PORTRAIT, "night-portrait"},
+ {GST_PHOTOGRAPHY_SCENE_MODE_THEATRE, "theatre"},
+ {GST_PHOTOGRAPHY_SCENE_MODE_BEACH, "beach"},
+ {GST_PHOTOGRAPHY_SCENE_MODE_SNOW, "snow"},
+ {GST_PHOTOGRAPHY_SCENE_MODE_SUNSET, "sunset"},
+ {GST_PHOTOGRAPHY_SCENE_MODE_STEADY_PHOTO, "steadyphoto"},
+ {GST_PHOTOGRAPHY_SCENE_MODE_FIREWORKS, "fireworks"},
+ {GST_PHOTOGRAPHY_SCENE_MODE_PARTY, "party"},
+ {GST_PHOTOGRAPHY_SCENE_MODE_CANDLELIGHT, "candlelight"},
+ {GST_PHOTOGRAPHY_SCENE_MODE_BARCODE, "barcode"}
+};
+
+struct DataEntry ColourToneValues[] = {
+ {GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL, "none"},
+ {GST_PHOTOGRAPHY_COLOR_TONE_MODE_SEPIA, "sepia"},
+ {GST_PHOTOGRAPHY_COLOR_TONE_MODE_NEGATIVE, "negative"},
+ {GST_PHOTOGRAPHY_COLOR_TONE_MODE_GRAYSCALE, "mono"},
+ {GST_PHOTOGRAPHY_COLOR_TONE_MODE_VIVID, "vivid"},
+ {GST_PHOTOGRAPHY_COLOR_TONE_MODE_SOLARIZE, "solarize"},
+ {GST_PHOTOGRAPHY_COLOR_TONE_MODE_SKY_BLUE, "still-sky-blue"},
+ {GST_PHOTOGRAPHY_COLOR_TONE_MODE_GRASS_GREEN, "still-grass-green"},
+ {GST_PHOTOGRAPHY_COLOR_TONE_MODE_SKIN_WHITEN, "still-skin-whiten-medium"},
+ {GST_PHOTOGRAPHY_COLOR_TONE_MODE_POSTERIZE, "posterize"},
+ {GST_PHOTOGRAPHY_COLOR_TONE_MODE_WHITEBOARD, "whiteboard"},
+ {GST_PHOTOGRAPHY_COLOR_TONE_MODE_BLACKBOARD, "blackboard"},
+ {GST_PHOTOGRAPHY_COLOR_TONE_MODE_AQUA, "aqua"},
+};
+
+struct DataEntry FlickerValues[] = {
+ {GST_PHOTOGRAPHY_FLICKER_REDUCTION_OFF, "off"},
+ {GST_PHOTOGRAPHY_FLICKER_REDUCTION_50HZ, "50hz"},
+ {GST_PHOTOGRAPHY_FLICKER_REDUCTION_60HZ, "60hz"},
+ {GST_PHOTOGRAPHY_FLICKER_REDUCTION_AUTO, "auto"}
+};
+
+static GList *gst_droidcamsrc_photography_append_list (GList * list,
+ const int key, const gchar * value);
+static GList *gst_droidcamsrc_photography_create_list (const gchar * params,
+ struct DataEntry entries[], gsize len);
#define PHOTO_IFACE_FUNC(name, tset, tget) \
static gboolean gst_droidcamsrc_get_##name (GstDroidCamSrc * src, tget val); \
@@ -125,6 +225,14 @@
#define SET_ENUM(table,val,droid,memb) \
int x; \
int len = g_list_length (table); \
+ if (len == 0) { \
+ GST_WARNING_OBJECT (src, "params for %s not yet available. not applying value %d yet", droid, val); \
+ GST_OBJECT_LOCK (src); \
+ src->photo->settings.memb = val; \
+ GST_OBJECT_UNLOCK (src); \
+ return FALSE; \
+ } \
+ \
const gchar *value = NULL; \
for (x = 0; x < len; x++) { \
struct DataEntry *entry = (struct DataEntry *) g_list_nth_data (table, x); \
@@ -600,15 +708,9 @@
}
void
-gst_droidcamsrc_photography_init (GstDroidCamSrc * src, gint dev)
+gst_droidcamsrc_photography_init (GstDroidCamSrc * src)
{
int x;
- GKeyFile *file = g_key_file_new ();
- gchar *file_path =
- g_strdup_printf ("/%s/gst-droid/gstdroidcamsrc-%d.conf", SYSCONFDIR, dev);
- GError *err = NULL;
-
- GST_INFO_OBJECT (src, "using configuration file %s", file_path);
if (!src->photo) {
src->photo = g_slice_new0 (GstDroidCamSrcPhotography);
@@ -637,59 +739,87 @@
src->photo->settings.white_point[x] = 0;
}
}
+}
- if (!g_key_file_load_from_file (file, file_path, G_KEY_FILE_NONE, &err)) {
- GST_WARNING ("failed to load configuration file %s: %s", file_path,
- err->message);
- }
-
- if (err) {
- g_error_free (err);
- err = NULL;
- }
+void
+gst_droidcamsrc_photography_update_params (GstDroidCamSrc * src)
+{
+ /* Set photography parameters from Android HAL */
- /* load settings */
+ /* Flash */
if (src->photo->flash) {
g_list_free_full (src->photo->flash, (GDestroyNotify) free_data_entry);
}
- src->photo->flash = gst_droidcamsrc_photography_load (file, "flash-mode");
+ src->photo->flash =
+ gst_droidcamsrc_photography_create_list (gst_droidcamsrc_params_get_string
+ (src->dev->params, "flash-mode-values"), FlashValues,
+ G_N_ELEMENTS (FlashValues));
+ /* Colour tone / Effects */
if (src->photo->color_tone) {
g_list_free_full (src->photo->color_tone, (GDestroyNotify) free_data_entry);
}
src->photo->color_tone =
- gst_droidcamsrc_photography_load (file, "color-tone-mode");
+ gst_droidcamsrc_photography_create_list (gst_droidcamsrc_params_get_string
+ (src->dev->params, "effect-values"), ColourToneValues,
+ G_N_ELEMENTS (ColourToneValues));
+ /* Focus */
if (src->photo->focus) {
g_list_free_full (src->photo->focus, (GDestroyNotify) free_data_entry);
}
- src->photo->focus = gst_droidcamsrc_photography_load (file, "focus-mode");
+ src->photo->focus =
+ gst_droidcamsrc_photography_create_list (gst_droidcamsrc_params_get_string
+ (src->dev->params, "focus-mode-values"), FocusValues,
+ G_N_ELEMENTS (FocusValues));
+ /* Scene Mode */
if (src->photo->scene) {
g_list_free_full (src->photo->scene, (GDestroyNotify) free_data_entry);
}
- src->photo->scene = gst_droidcamsrc_photography_load (file, "scene-mode");
+ src->photo->scene =
|