From e5e79687e07ae9f71fff4a07403221b8078e933c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matti=20Lehtim=C3=A4ki?= Date: Sat, 25 Jun 2016 15:39:41 +0300 Subject: [PATCH] droidcamsrc: Use preview size values if video size values are missing. --- gst/droidcamsrc/gstdroidcamsrc.c | 5 ++++- gst/droidcamsrc/gstdroidcamsrcparams.c | 10 +++++++++- gst/droidcamsrc/gstdroidcamsrcparams.h | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/gst/droidcamsrc/gstdroidcamsrc.c b/gst/droidcamsrc/gstdroidcamsrc.c index 0a3f5238..69f97ac7 100644 --- a/gst/droidcamsrc/gstdroidcamsrc.c +++ b/gst/droidcamsrc/gstdroidcamsrc.c @@ -1659,7 +1659,10 @@ gst_droidcamsrc_vidsrc_negotiate (GstDroidCamSrcPad * data) } vid = g_strdup_printf ("%ix%i", info.width, info.height); - gst_droidcamsrc_params_set_string (src->dev->params, "video-size", vid); + gchar *key = + src->dev-> + params->has_separate_video_size_values ? "video-size" : "preview-size"; + gst_droidcamsrc_params_set_string (src->dev->params, key, vid); /* Now we need to find a picture size that is equal to our video size. * Some devices need to have a picture size otherwise the video mode viewfinder diff --git a/gst/droidcamsrc/gstdroidcamsrcparams.c b/gst/droidcamsrc/gstdroidcamsrcparams.c index 63d4fe60..8e7831da 100644 --- a/gst/droidcamsrc/gstdroidcamsrcparams.c +++ b/gst/droidcamsrc/gstdroidcamsrcparams.c @@ -195,6 +195,8 @@ gst_droidcamsrc_params_reload_locked (GstDroidCamSrcParams * params, gst_droidcamsrc_params_fill_fps_range_arrays_locked (params); params->is_dirty = FALSE; + params->has_separate_video_size_values = + g_hash_table_lookup (params->params, "video-size-values") != NULL; } GstDroidCamSrcParams * @@ -389,8 +391,14 @@ gst_droidcamsrc_params_get_video_caps (GstDroidCamSrcParams * params) GstCaps *caps; g_mutex_lock (¶ms->lock); - caps = gst_droidcamsrc_params_get_caps_locked (params, "video-size-values", + + gchar *key = + params->has_separate_video_size_values ? "video-size-values" : + "preview-size-values"; + + caps = gst_droidcamsrc_params_get_caps_locked (params, key, "video/x-raw", GST_CAPS_FEATURE_MEMORY_DROID_VIDEO_META_DATA, "YV12"); + g_mutex_unlock (¶ms->lock); return caps; diff --git a/gst/droidcamsrc/gstdroidcamsrcparams.h b/gst/droidcamsrc/gstdroidcamsrcparams.h index 9bd31b2b..ed699fd5 100644 --- a/gst/droidcamsrc/gstdroidcamsrcparams.h +++ b/gst/droidcamsrc/gstdroidcamsrcparams.h @@ -32,6 +32,7 @@ struct _GstDroidCamSrcParams GHashTable *params; gboolean is_dirty; GArray *min_fps_range, *max_fps_range; + gboolean has_separate_video_size_values; GMutex lock; };