void init_logging() { init_factories(); std::istringstream strm(settings); logging::init_from_stream(strm); }
void init_logging() { init_factories(); logging::add_console_log(std::clog, keywords::format = "%TimeStamp% %Coordinates(format=\"{%0.3f; %0.3f}\")% %Message%"); logging::add_common_attributes(); }
ObjectFactory::ObjectFactory() : factories() { init_factories(); }
gint main (gint argc, gchar *argv[]) { GMainLoop *loop; GstElement *typefind, *realsink; GstElement *filesrc, *typefind1; GstBus *bus; GError *err = NULL; gchar *p; xmlfile = "manual_dynamic"; std_log(LOG_FILENAME_LINE, "Test Started manual_dynamic"); /* init GStreamer and ourselves */ gst_init (&argc, &argv); loop = g_main_loop_new (NULL, FALSE); init_factories (); /* args */ if (argc != 2) { g_print ("Usage: %s <filename>\n", argv[0]); std_log(LOG_FILENAME_LINE, "Test Failed argument need to be passed "); create_xml(1); exit (-1); } /* pipeline */ //changes for parse launch /* p = g_strdup_printf ("filesrc location=\"%s\" ! typefind name=tf", argv[1]); std_log(LOG_FILENAME_LINE, "parse launch Start"); pipeline = gst_parse_launch (p, &err); std_log(LOG_FILENAME_LINE, "parse launch Done"); g_free (p); if (err) { std_log(LOG_FILENAME_LINE, "Could not construct pipeline"); create_xml(1); g_error ("Could not construct pipeline: %s", err->message); g_error_free (err); return -1; } */ filesrc = gst_element_factory_make ("filesrc", "src"); g_assert (filesrc); g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); typefind1 = gst_element_factory_make ("typefind", "tf"); g_assert (typefind1); pipeline = gst_pipeline_new ("pipeline"); g_assert (pipeline); gst_bin_add_many (GST_BIN (pipeline), filesrc, typefind1, NULL); /* link the elements */ gst_element_link_many (filesrc, typefind1, NULL); ////////////////////////////////////////// bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); gst_bus_add_watch (bus, my_bus_callback, loop); gst_object_unref (bus); if(!bus) { std_log(LOG_FILENAME_LINE, "failed to create bus"); create_xml(1); return -1; } typefind = gst_bin_get_by_name (GST_BIN (pipeline), "tf"); if(!typefind) { std_log(LOG_FILENAME_LINE, "Failed to create typefind"); create_xml(1); return -1; } g_signal_connect (typefind, "have-type", G_CALLBACK (cb_typefound), NULL); gst_object_unref (GST_OBJECT (typefind)); std_log(LOG_FILENAME_LINE, "Element Create Start"); audiosink = gst_element_factory_make ("audioconvert", "aconv"); realsink = gst_element_factory_make ("filesink", "audiosink"); std_log(LOG_FILENAME_LINE, "Element Create Done"); if(!audiosink || !realsink) { std_log(LOG_FILENAME_LINE, "Failed to create audiosink or realsink"); create_xml(1); return -1; } std_log(LOG_FILENAME_LINE, "Create out.txt Start"); g_object_set(realsink,"location","c:\\data\\out.txt",NULL); std_log(LOG_FILENAME_LINE, "Create out.txt Done"); gst_bin_add_many (GST_BIN (pipeline), audiosink, realsink, NULL); std_log(LOG_FILENAME_LINE, "Element Link Start"); gst_element_link (audiosink, realsink); std_log(LOG_FILENAME_LINE, "Element Link Done"); std_log(LOG_FILENAME_LINE, "Set PLAY State"); gst_element_set_state (pipeline, GST_STATE_PLAYING); std_log(LOG_FILENAME_LINE, "Set Play State Done"); /* run */ std_log(LOG_FILENAME_LINE, "main loop run Start"); g_main_loop_run (loop); std_log(LOG_FILENAME_LINE, "main loop run Done"); /* exit */ gst_element_set_state (pipeline, GST_STATE_NULL); gst_object_unref (GST_OBJECT (pipeline)); std_log(LOG_FILENAME_LINE, "Test Successful"); create_xml(0); return 0; }