diff options
author | Dave Robillard <dave@drobilla.net> | 2009-07-03 20:01:36 -0400 |
---|---|---|
committer | Dave Robillard <dave@drobilla.net> | 2009-07-03 20:01:36 -0400 |
commit | e289c875a5e0ee56dd8289e78b63f36f709b6534 (patch) | |
tree | 9bd2b450261bbc0fa522bf27d9a89d017308687e /tests/examples/camerabin | |
parent | ed06ed3b658b49b1313df38909bcb2f907be83a7 (diff) | |
parent | caba48f261421d397900471b19350da2e5a4a4e5 (diff) | |
download | gst-plugins-bad-e289c875a5e0ee56dd8289e78b63f36f709b6534.tar.gz gst-plugins-bad-e289c875a5e0ee56dd8289e78b63f36f709b6534.tar.bz2 gst-plugins-bad-e289c875a5e0ee56dd8289e78b63f36f709b6534.zip |
Merge branch 'fdo' into lv2
Diffstat (limited to 'tests/examples/camerabin')
-rw-r--r-- | tests/examples/camerabin/gst-camera-perf.c | 68 |
1 files changed, 56 insertions, 12 deletions
diff --git a/tests/examples/camerabin/gst-camera-perf.c b/tests/examples/camerabin/gst-camera-perf.c index b6424181..858e60cd 100644 --- a/tests/examples/camerabin/gst-camera-perf.c +++ b/tests/examples/camerabin/gst-camera-perf.c @@ -105,7 +105,9 @@ static guint test_ix = 0; static gboolean signal_sink = FALSE; static gboolean signal_shot = FALSE; static gboolean signal_cont = FALSE; -//static gboolean signal_save = FALSE; + +static gboolean have_img_captured = FALSE; +static gboolean have_img_done = FALSE; /* time samples and test results */ static GstClockTime t_initial = G_GUINT64_CONSTANT (0); @@ -129,14 +131,14 @@ static GstClockTime target[TEST_CASES] = { static const gchar *test_names[TEST_CASES] = { "Camera OFF to VF on", - "(3A latency)", + "(3A latency)", /* time to get AF? */ "Shot to snapshot", "Shot to shot", "Serial shooting", "(Shutter lag)", "Image saved", "Mode change", - "(Video recording)" + "(Video recording)" /* time to get videobin to PLAYING? or first buffer reaching filesink? */ }; /* @@ -199,7 +201,14 @@ img_capture_done (GstElement * camera, GString * fname, gpointer user_data) GST_INFO ("%2d cont new filename '%s'", test_ix, filename->str); g_object_set (camera_bin, "filename", filename->str, NULL); // FIXME: is burst capture broken? new filename and return TRUE should be enough - g_signal_emit_by_name (camera_bin, "user-start", NULL); + // as a workaround we will kick next image from here + // but this needs sync so that we have received "image-captured" message already + if (have_img_captured) { + have_img_captured = FALSE; + g_signal_emit_by_name (camera_bin, "user-start", NULL); + } else { + have_img_done = TRUE; + } ret = TRUE; } else { GstClockTime max = 0; @@ -276,6 +285,25 @@ bus_callback (GstBus * bus, GstMessage * message, gpointer data) g_main_loop_quit (loop); break; } + case GST_MESSAGE_STATE_CHANGED: + if (GST_MESSAGE_SRC (message) == GST_OBJECT (camera_bin)) { + GstState oldstate, newstate; + + gst_message_parse_state_changed (message, &oldstate, &newstate, NULL); + GST_INFO ("state-changed: %s -> %s", + gst_element_state_get_name (oldstate), + gst_element_state_get_name (newstate)); + if (GST_STATE_TRANSITION (oldstate, + newstate) == GST_STATE_CHANGE_PAUSED_TO_PLAYING) { + GET_TIME (t_final[0]); + DIFF_TIME (t_final[0], t_initial, diff); + + result.avg = result.min = result.max = diff; + print_result (); + g_idle_add ((GSourceFunc) run_test, NULL); + } + } + break; case GST_MESSAGE_EOS: /* end-of-stream */ g_main_loop_quit (loop); @@ -291,6 +319,15 @@ bus_callback (GstBus * bus, GstMessage * message, gpointer data) DIFF_TIME (t_final[num_pics_cont], t_initial, diff); result.avg = result.min = result.max = diff; break; + case 4: + // we need to have this received before we can take next one + if (have_img_done) { + have_img_done = FALSE; + g_signal_emit_by_name (camera_bin, "user-start", NULL); + } else { + have_img_captured = TRUE; + } + break; } } else if (gst_structure_has_name (st, "preview-image")) { GST_INFO ("%2d preview-image", test_ix); @@ -318,8 +355,8 @@ static void cleanup_pipeline (void) { if (camera_bin) { + GST_INFO_OBJECT (camera_bin, "stopping and destroying"); gst_element_set_state (camera_bin, GST_STATE_NULL); - gst_element_get_state (camera_bin, NULL, NULL, GST_CLOCK_TIME_NONE); gst_object_unref (camera_bin); camera_bin = NULL; } @@ -446,6 +483,7 @@ setup_pipeline (void) g_warning ("can't set camerabin to playing\n"); goto error; } + GST_INFO_OBJECT (camera_bin, "created and started"); return TRUE; error: cleanup_pipeline (); @@ -466,19 +504,25 @@ error: static gboolean test_01 (void) { + gboolean res; + GET_TIME (t_initial); if (setup_pipeline ()) { /* MAKE SURE THE PIPELINE IS IN PLAYING STATE BEFORE START TAKING PICTURES AND SO ON (otherwise it will deadlock) */ - gst_element_get_state (camera_bin, NULL, NULL, GST_CLOCK_TIME_NONE); - } - GET_TIME (t_final[0]); - DIFF_TIME (t_final[0], t_initial, diff); + //gst_element_get_state (camera_bin, NULL, NULL, GST_CLOCK_TIME_NONE); + /* the actual results are fetched in bus_callback::state-changed */ + res = FALSE; + } else { + GET_TIME (t_final[0]); + DIFF_TIME (t_final[0], t_initial, diff); - result.avg = result.min = result.max = diff; + result.avg = result.min = result.max = diff; + res = TRUE; + } result.times = 1; - return TRUE; + return res; } @@ -528,6 +572,7 @@ static gboolean test_05 (void) { signal_cont = TRUE; + have_img_captured = have_img_done = FALSE; GET_TIME (t_initial); g_signal_emit_by_name (camera_bin, "user-start", 0); @@ -545,7 +590,6 @@ test_05 (void) static gboolean test_07 (void) { - // signal_save = TRUE; signal_shot = TRUE; GET_TIME (t_initial); |