static void setup (void) { GstTagSetter *setter; gchar *desc_str; GstCaps *filter_caps; GstBus *bus; gint i; GST_INFO ("init"); main_loop = g_main_loop_new (NULL, TRUE); camera = gst_check_setup_element ("camerabin"); setup_camerabin_elements (camera); g_signal_connect (camera, "image-done", G_CALLBACK (capture_done), main_loop); bus = gst_pipeline_get_bus (GST_PIPELINE (camera)); gst_bus_add_watch (bus, (GstBusFunc) capture_bus_cb, main_loop); gst_bus_set_sync_handler (bus, bus_sync_callback, main_loop); gst_object_unref (bus); filter_caps = gst_caps_from_string ("video/x-raw-yuv,format=(fourcc)I420"); g_object_set (G_OBJECT (camera), "filter-caps", filter_caps, NULL); gst_caps_unref (filter_caps); /* force a low framerate here to not timeout the tests because of the * encoders */ g_signal_emit_by_name (camera, "set-video-resolution-fps", 320, 240, 5, 1, NULL); /* Set some default tags */ setter = GST_TAG_SETTER (camera); desc_str = g_strdup_printf ("Created by %s", g_get_real_name ()); gst_tag_setter_add_tags (setter, GST_TAG_MERGE_REPLACE, GST_TAG_DESCRIPTION, desc_str, NULL); g_free (desc_str); if (gst_element_set_state (GST_ELEMENT (camera), GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) { GST_WARNING ("setting camerabin to PLAYING failed"); gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL); gst_object_unref (camera); camera = NULL; } /* create the taglists */ for (i = 0; i < TAGLISTS_COUNT; i++) { taglists[i] = gst_tag_list_new_full (GST_TAG_ARTIST, "test-artist", GST_TAG_GEO_LOCATION_LONGITUDE, g_random_double_range (-180, 180), GST_TAG_GEO_LOCATION_LATITUDE, g_random_double_range (-90, 90), GST_TAG_GEO_LOCATION_ELEVATION, g_random_double_range (0, 3000), NULL); } GST_INFO ("init finished"); }
static void setup (void) { GstTagSetter *setter; gchar *desc_str; GstCaps *filter_caps; GstBus *bus; GST_INFO ("init"); main_loop = g_main_loop_new (NULL, TRUE); camera = gst_check_setup_element ("camerabin"); setup_camerabin_elements (camera); g_signal_connect (camera, "img-done", G_CALLBACK (capture_done), main_loop); bus = gst_pipeline_get_bus (GST_PIPELINE (camera)); gst_bus_add_watch (bus, (GstBusFunc) capture_bus_cb, main_loop); gst_object_unref (bus); filter_caps = gst_caps_from_string ("video/x-raw-yuv,format=(fourcc)I420"); g_object_set (G_OBJECT (camera), "filter-caps", filter_caps, NULL); gst_caps_unref (filter_caps); /* force a low framerate here to not timeout the tests because of the * encoders */ g_signal_emit_by_name (camera, "user-res-fps", 320, 240, 5, 1, NULL); /* Set some default tags */ setter = GST_TAG_SETTER (camera); desc_str = g_strdup_printf ("Created by %s", g_get_real_name ()); gst_tag_setter_add_tags (setter, GST_TAG_MERGE_REPLACE, GST_TAG_DESCRIPTION, desc_str, NULL); g_free (desc_str); if (gst_element_set_state (GST_ELEMENT (camera), GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) { GST_WARNING ("setting camerabin to PLAYING failed"); gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL); gst_object_unref (camera); camera = NULL; } GST_INFO ("init finished"); }