void test_parse_launch_errors() { GstElement *pipe; GError *err; const gchar *arr[] = { "fakesrc", "fakesink", NULL }; std_log(LOG_FILENAME_LINE, "Test started test_parse_launch_errors"); err = NULL; pipe = gst_parse_launch ("fakesrc ! fakesink", &err); fail_unless (err != NULL, "expected an error, but did not get one"); fail_unless (pipe == NULL, "got pipeline, but expected NULL"); fail_unless (err->domain == GST_CORE_ERROR); fail_unless (err->code == GST_CORE_ERROR_DISABLED); g_error_free (err); err = NULL; pipe = gst_parse_bin_from_description ("fakesrc ! fakesink", TRUE, &err); fail_unless (err != NULL, "expected an error, but did not get one"); fail_unless (pipe == NULL, "got pipeline, but expected NULL"); fail_unless (err->domain == GST_CORE_ERROR); fail_unless (err->code == GST_CORE_ERROR_DISABLED); g_error_free (err); err = NULL; pipe = gst_parse_launchv (arr, &err); fail_unless (err != NULL, "expected an error, but did not get one"); fail_unless (pipe == NULL, "got pipeline, but expected NULL"); fail_unless (err->domain == GST_CORE_ERROR); fail_unless (err->code == GST_CORE_ERROR_DISABLED); g_error_free (err); std_log(LOG_FILENAME_LINE, "Test Successful"); create_xml(0); }
int main (int argc, char *argv[]) { GstElement *pipeline = NULL; #ifndef GST_DISABLE_PARSE GError *error = NULL; #endif GstElement *volume; GstBus *bus; #ifdef GST_DISABLE_PARSE g_print ("GStreamer was built without pipeline parsing capabilities.\n"); g_print ("Please rebuild GStreamer with pipeline parsing capabilities activated to use this example.\n"); return 1; #else gst_init (&argc, &argv); gtk_init (&argc, &argv); pipeline = gst_parse_launchv ((const gchar **) &argv[1], &error); if (error) { g_print ("pipeline could not be constructed: %s\n", error->message); g_print ("Please give a complete pipeline with a 'volume' element.\n"); g_print ("Example: audiotestsrc ! volume ! %s\n", DEFAULT_AUDIOSINK); g_error_free (error); return 1; } #endif volume = gst_bin_get_by_name (GST_BIN (pipeline), "volume0"); if (volume == NULL) { g_print ("Please give a pipeline with a 'volume' element in it\n"); return 1; } /* setup message handling */ bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); gst_bus_add_signal_watch_full (bus, G_PRIORITY_HIGH); g_signal_connect (bus, "message::error", (GCallback) message_received, pipeline); g_signal_connect (bus, "message::warning", (GCallback) message_received, pipeline); g_signal_connect (bus, "message::eos", (GCallback) eos_message_received, pipeline); /* setup GUI */ setup_gui (volume); /* go to main loop */ gst_element_set_state (pipeline, GST_STATE_PLAYING); gtk_main (); gst_element_set_state (pipeline, GST_STATE_NULL); gst_object_unref (pipeline); return 0; }
int main (int argc, gchar ** argv) { GstElement *pipeline = NULL; GError *error = NULL; GstBus *bus; GMainLoop *mainloop; gst_init (&argc, &argv); gst_mpegts_initialize (); pipeline = gst_parse_launchv ((const gchar **) &argv[1], &error); if (error) { g_printf ("pipeline could not be constructed: %s\n", error->message); g_error_free (error); return 1; } /* Hack: ensure all enum type classes are loaded */ g_type_class_ref (GST_TYPE_MPEG_TS_SECTION_TYPE); g_type_class_ref (GST_TYPE_MPEG_TS_SECTION_TABLE_ID); g_type_class_ref (GST_TYPE_MPEG_TS_RUNNING_STATUS); g_type_class_ref (GST_TYPE_MPEG_TS_DESCRIPTOR_TYPE); g_type_class_ref (GST_TYPE_MPEG_TS_DVB_DESCRIPTOR_TYPE); g_type_class_ref (GST_TYPE_MPEG_TS_ATSC_DESCRIPTOR_TYPE); g_type_class_ref (GST_TYPE_MPEG_TS_ISDB_DESCRIPTOR_TYPE); g_type_class_ref (GST_TYPE_MPEG_TS_MISC_DESCRIPTOR_TYPE); g_type_class_ref (GST_TYPE_MPEG_TS_ISO639_AUDIO_TYPE); g_type_class_ref (GST_TYPE_MPEG_TS_DVB_SERVICE_TYPE); g_type_class_ref (GST_TYPE_MPEG_TS_STREAM_TYPE); mainloop = g_main_loop_new (NULL, FALSE); /* Put a bus handler */ bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); gst_bus_add_signal_watch (bus); g_signal_connect (bus, "message", (GCallback) _on_bus_message, mainloop); /* Start pipeline */ gst_element_set_state (pipeline, GST_STATE_PLAYING); g_main_loop_run (mainloop); gst_element_set_state (pipeline, GST_STATE_NULL); gst_object_unref (pipeline); gst_object_unref (bus); return 0; }
int main (int argc, char *argv[]) { GstElement *pipeline = NULL; GError *error = NULL; GstElement *level; gst_init (&argc, &argv); gtk_init (&argc, &argv); pipeline = gst_parse_launchv ((const gchar **) &argv[1], &error); if (error) { g_print ("pipeline could not be constructed: %s\n", error->message); g_print ("Please give a complete pipeline with a 'level' element.\n"); g_print ("Example: sinesrc ! level ! %s\n", DEFAULT_AUDIOSINK); g_error_free (error); return 1; } level = gst_bin_get_by_name (GST_BIN (pipeline), "level0"); if (level == NULL) { g_print ("Please give a pipeline with a 'level' element in it\n"); return 1; } g_object_set (level, "signal", TRUE, NULL); g_signal_connect (level, "level", G_CALLBACK (level_callback), NULL); /* setup GUI */ setup_gui (); /* connect level signal */ /* go to main loop */ gst_element_set_state (pipeline, GST_STATE_PLAYING); g_idle_add (idler, pipeline); gtk_main (); return 0; }