summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLuis de Bethencourt <luis@debethencourt.com>2015-08-08 13:19:41 +0100
committerLuis de Bethencourt <luis@debethencourt.com>2015-08-08 13:19:47 +0100
commitc895f3f3b3b7a89be096eaa0b765635f0f6f590d (patch)
tree239e323d02bcf878564eee166f4ab1e7a77fc579 /tests
parentd7fbb72c72ff2df3fba72c7a1483816e73567e67 (diff)
downloadgstreamer-plugins-bad-c895f3f3b3b7a89be096eaa0b765635f0f6f590d.tar.gz
examples: facedetect: only set to playing when it's not already
Diffstat (limited to 'tests')
-rw-r--r--tests/examples/opencv/gstfacedetect_test.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/examples/opencv/gstfacedetect_test.c b/tests/examples/opencv/gstfacedetect_test.c
index ffcb5dfbf..5b7869887 100644
--- a/tests/examples/opencv/gstfacedetect_test.c
+++ b/tests/examples/opencv/gstfacedetect_test.c
@@ -79,6 +79,8 @@ bus_sync_handler (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
/* if face is detected, obtain the values X and Y of mouth and of nose. */
if (size != 0) {
+ GstState state;
+
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");
@@ -86,9 +88,15 @@ bus_sync_handler (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
have_nose_y = gst_structure_has_field (faces_structure, "nose->y");
have_nose_x = gst_structure_has_field (faces_structure, "nose->x");
- /* get the volume value and playbin changed the state to play */
+ /* if paused, set to playing */
+ gst_element_get_state (GST_ELEMENT (playbin), &state, NULL,
+ GST_CLOCK_TIME_NONE);
+ if (state != GST_STATE_PLAYING) {
+ gst_element_set_state (GST_ELEMENT (playbin), GST_STATE_PLAYING);
+ }
+
+ /* get the volume value */
g_object_get (G_OBJECT (playbin), "volume", &volume, NULL);
- gst_element_set_state (GST_ELEMENT (playbin), GST_STATE_PLAYING);
/* media operation - hide your mouth for down the volume of the video */
if (have_mouth_y == 0 && have_mouth_x == 0) {