diff options
author | Luis de Bethencourt <luis@debethencourt.com> | 2015-08-10 19:06:16 +0100 |
---|---|---|
committer | Luis de Bethencourt <luis@debethencourt.com> | 2015-08-10 19:09:52 +0100 |
commit | 29786be80f9bdfa45f30ff464d76c637db51c597 (patch) | |
tree | 9800ab3783eb673c58ebbff8db3e59182bbeae4f /tests/examples | |
parent | 53a9374eb559b0e7e245a615ed23bb4c83022b6a (diff) | |
download | gstreamer-plugins-bad-29786be80f9bdfa45f30ff464d76c637db51c597.tar.gz |
examples: facedetect: only create variables when needed
The variables to store face values are only needed if they will be used to
control the volume. Which isn't the default to avoid potentially being very
loud accidentally. Only create variables when needed.
Diffstat (limited to 'tests/examples')
-rw-r--r-- | tests/examples/opencv/gstfacedetect_test.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/tests/examples/opencv/gstfacedetect_test.c b/tests/examples/opencv/gstfacedetect_test.c index 1337c2fef..138faf213 100644 --- a/tests/examples/opencv/gstfacedetect_test.c +++ b/tests/examples/opencv/gstfacedetect_test.c @@ -36,10 +36,6 @@ bus_sync_handler (GstBus * bus, GstMessage * message, GstPipeline * pipeline) { const GstStructure *structure; const GValue *value; - const GstStructure *faces_structure; - const GValue *faces_value; - gboolean have_mouth_x, have_mouth_y; - gboolean have_nose_x, have_nose_y; gchar *contents; gint i; guint size = 0; @@ -91,12 +87,17 @@ bus_sync_handler (GstBus * bus, GstMessage * message, GstPipeline * pipeline) if (ctrlvol) { gdouble volume; - faces_value = gst_value_list_get_value (value, 0); - faces_structure = gst_value_get_structure (faces_value); - have_mouth_y = gst_structure_has_field (faces_structure, "mouth->y"); - have_mouth_x = gst_structure_has_field (faces_structure, "mouth->x"); - have_nose_y = gst_structure_has_field (faces_structure, "nose->y"); - have_nose_x = gst_structure_has_field (faces_structure, "nose->x"); + const GValue *faces_value = gst_value_list_get_value (value, 0); + const GstStructure *faces_structure = + gst_value_get_structure (faces_value); + gboolean have_mouth_y = + gst_structure_has_field (faces_structure, "mouth->y"); + gboolean have_mouth_x = + gst_structure_has_field (faces_structure, "mouth->x"); + gboolean have_nose_y = + gst_structure_has_field (faces_structure, "nose->y"); + gboolean have_nose_x = + gst_structure_has_field (faces_structure, "nose->x"); /* get the volume value */ g_object_get (G_OBJECT (playbin), "volume", &volume, NULL); |