static Suite * imagecapturebin_suite (void) { GstElementFactory *jpegenc_factory; Suite *s = suite_create ("imagecapturebin"); TCase *tc_chain = tcase_create ("general"); jpegenc_factory = gst_element_factory_find ("jpegenc"); suite_add_tcase (s, tc_chain); if (jpegenc_factory) { tcase_add_test (tc_chain, test_simple_capture); /* only adds this test if jpegenc contains the fix for its getcaps * The fix on good: dcbba0932dc579abd6aab4460fa1a416374eda1b */ if (gst_plugin_feature_check_version ((GstPluginFeature *) jpegenc_factory, 0, 10, 27)) tcase_add_test (tc_chain, test_multiple_captures_different_caps); else GST_WARNING ("Skipped test that needs gst-plugins-good 0.10.27"); tcase_add_test (tc_chain, test_setting_encoder); tcase_add_test (tc_chain, test_setting_muxer); } else GST_WARNING ("Skipped imagecapturebin tests because jpegenc is missing"); return s; }
GstElement * _bp_equalizer_new (BansheePlayer *player) { GstElement *equalizer; if (player->equalizer_status == BP_EQ_STATUS_DISABLED) { return NULL; } if (player->equalizer_status == BP_EQ_STATUS_UNCHECKED || player->equalizer_status == BP_EQ_STATUS_USE_BUILTIN) { equalizer = gst_element_factory_make ("banshee-equalizer", "banshee-equalizer"); if (equalizer != NULL) { if (player->equalizer_status == BP_EQ_STATUS_UNCHECKED) { player->equalizer_status = BP_EQ_STATUS_USE_BUILTIN; bp_debug ("Using built-in equalizer element"); } return equalizer; } } if (player->equalizer_status == BP_EQ_STATUS_UNCHECKED || player->equalizer_status == BP_EQ_STATUS_USE_SYSTEM) { equalizer = gst_element_factory_make ("equalizer-10bands", "equalizer-10bands"); if (equalizer != NULL) { GstElementFactory *efactory = NULL; if (player->equalizer_status == BP_EQ_STATUS_USE_SYSTEM) { return equalizer; } efactory = gst_element_get_factory (equalizer); if (gst_plugin_feature_check_version (GST_PLUGIN_FEATURE (efactory), 0, 10, 9)) { bp_debug ("Using system (gst-plugins-good) equalizer element"); player->equalizer_status = BP_EQ_STATUS_USE_SYSTEM; return equalizer; } bp_debug ("Buggy system equalizer found. gst-plugins-good 0.10.9 or better " "required, or build Banshee with the built-in equalizer."); gst_object_unref (equalizer); } else { bp_debug ("No system equalizer found"); } } bp_debug ("No suitable equalizer element could be found, disabling EQ for this session"); player->equalizer_status = BP_EQ_STATUS_DISABLED; return NULL; }
// This function creates and initializes some internal variables, and returns a // pointer to the element that should receive the data flow first GstElement* MediaPlayerPrivateGStreamerBase::createVideoSink(GstElement* pipeline) { if (!initializeGStreamer()) return 0; #if USE(NATIVE_FULLSCREEN_VIDEO) m_gstGWorld = GStreamerGWorld::createGWorld(pipeline); m_webkitVideoSink = webkitVideoSinkNew(m_gstGWorld.get()); #else UNUSED_PARAM(pipeline); m_webkitVideoSink = webkitVideoSinkNew(); #endif m_repaintHandler = g_signal_connect(m_webkitVideoSink.get(), "repaint-requested", G_CALLBACK(mediaPlayerPrivateRepaintCallback), this); #if USE(NATIVE_FULLSCREEN_VIDEO) // Build a new video sink consisting of a bin containing a tee // (meant to distribute data to multiple video sinks) and our // internal video sink. For fullscreen we create an autovideosink // and initially block the data flow towards it and configure it m_videoSinkBin = gst_bin_new("video-sink"); GstElement* videoTee = gst_element_factory_make("tee", "videoTee"); GstElement* queue = gst_element_factory_make("queue", 0); #ifdef GST_API_VERSION_1 GRefPtr<GstPad> sinkPad = adoptGRef(gst_element_get_static_pad(videoTee, "sink")); GST_OBJECT_FLAG_SET(GST_OBJECT(sinkPad.get()), GST_PAD_FLAG_PROXY_ALLOCATION); #endif gst_bin_add_many(GST_BIN(m_videoSinkBin.get()), videoTee, queue, NULL); // Link a new src pad from tee to queue1. gst_element_link_pads_full(videoTee, 0, queue, "sink", GST_PAD_LINK_CHECK_NOTHING); #endif GstElement* actualVideoSink = 0; m_fpsSink = gst_element_factory_make("fpsdisplaysink", "sink"); if (m_fpsSink) { // The verbose property has been added in -bad 0.10.22. Making // this whole code depend on it because we don't want // fpsdiplaysink to spit data on stdout. GstElementFactory* factory = GST_ELEMENT_FACTORY(GST_ELEMENT_GET_CLASS(m_fpsSink)->elementfactory); if (gst_plugin_feature_check_version(GST_PLUGIN_FEATURE(factory), 0, 10, 22)) { g_object_set(m_fpsSink, "silent", TRUE , NULL); // Turn off text overlay unless logging is enabled. #if LOG_DISABLED g_object_set(m_fpsSink, "text-overlay", FALSE , NULL); #else WTFLogChannel* channel = getChannelFromName("Media"); if (channel->state != WTFLogChannelOn) g_object_set(m_fpsSink, "text-overlay", FALSE , NULL); #endif // LOG_DISABLED if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_fpsSink), "video-sink")) { g_object_set(m_fpsSink, "video-sink", m_webkitVideoSink.get(), NULL); #if USE(NATIVE_FULLSCREEN_VIDEO) gst_bin_add(GST_BIN(m_videoSinkBin.get()), m_fpsSink); #endif actualVideoSink = m_fpsSink; } else m_fpsSink = 0; } else m_fpsSink = 0; } if (!m_fpsSink) { #if USE(NATIVE_FULLSCREEN_VIDEO) gst_bin_add(GST_BIN(m_videoSinkBin.get()), m_webkitVideoSink.get()); #endif actualVideoSink = m_webkitVideoSink.get(); } ASSERT(actualVideoSink); #if USE(NATIVE_FULLSCREEN_VIDEO) // Faster elements linking. gst_element_link_pads_full(queue, "src", actualVideoSink, "sink", GST_PAD_LINK_CHECK_NOTHING); // Add a ghostpad to the bin so it can proxy to tee. GRefPtr<GstPad> pad = adoptGRef(gst_element_get_static_pad(videoTee, "sink")); gst_element_add_pad(m_videoSinkBin.get(), gst_ghost_pad_new("sink", pad.get())); // Set the bin as video sink of playbin. return m_videoSinkBin.get(); #else return actualVideoSink; #endif }
int main (int argc, char *argv[]) { gboolean print_all = FALSE; gboolean do_print_blacklist = FALSE; gboolean plugin_name = FALSE; gboolean print_aii = FALSE; gboolean uri_handlers = FALSE; gboolean check_exists = FALSE; gchar *min_version = NULL; guint minver_maj = GST_VERSION_MAJOR; guint minver_min = GST_VERSION_MINOR; guint minver_micro = 0; #ifndef GST_DISABLE_OPTION_PARSING GOptionEntry options[] = { {"print-all", 'a', 0, G_OPTION_ARG_NONE, &print_all, N_("Print all elements"), NULL}, {"print-blacklist", 'b', 0, G_OPTION_ARG_NONE, &do_print_blacklist, N_("Print list of blacklisted files"), NULL}, {"print-plugin-auto-install-info", '\0', 0, G_OPTION_ARG_NONE, &print_aii, N_("Print a machine-parsable list of features the specified plugin " "or all plugins provide.\n " "Useful in connection with external automatic plugin " "installation mechanisms"), NULL}, {"plugin", '\0', 0, G_OPTION_ARG_NONE, &plugin_name, N_("List the plugin contents"), NULL}, {"exists", '\0', 0, G_OPTION_ARG_NONE, &check_exists, N_("Check if the specified element or plugin exists"), NULL}, {"atleast-version", '\0', 0, G_OPTION_ARG_STRING, &min_version, N_ ("When checking if an element or plugin exists, also check that its " "version is at least the version specified"), NULL}, {"uri-handlers", 'u', 0, G_OPTION_ARG_NONE, &uri_handlers, N_ ("Print supported URI schemes, with the elements that implement them"), NULL}, GST_TOOLS_GOPTION_VERSION, {NULL} }; GOptionContext *ctx; GError *err = NULL; #endif setlocale (LC_ALL, ""); #ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); #endif /* avoid glib warnings when inspecting deprecated properties */ g_setenv ("G_ENABLE_DIAGNOSTIC", "0", FALSE); g_set_prgname ("gst-inspect-" GST_API_VERSION); #ifndef GST_DISABLE_OPTION_PARSING ctx = g_option_context_new ("[ELEMENT-NAME | PLUGIN-NAME]"); g_option_context_add_main_entries (ctx, options, GETTEXT_PACKAGE); g_option_context_add_group (ctx, gst_init_get_option_group ()); if (!g_option_context_parse (ctx, &argc, &argv, &err)) { g_printerr ("Error initializing: %s\n", err->message); g_clear_error (&err); g_option_context_free (ctx); return -1; } g_option_context_free (ctx); #else gst_init (&argc, &argv); #endif gst_tools_print_version (); if (print_all && argc > 1) { g_printerr ("-a requires no extra arguments\n"); return -1; } if (uri_handlers && argc > 1) { g_printerr ("-u requires no extra arguments\n"); return -1; } /* --atleast-version implies --exists */ if (min_version != NULL) { if (sscanf (min_version, "%u.%u.%u", &minver_maj, &minver_min, &minver_micro) < 2) { g_printerr ("Can't parse version '%s' passed to --atleast-version\n", min_version); return -1; } check_exists = TRUE; } if (check_exists) { int exit_code; if (argc == 1) { g_printerr ("--exists requires an extra command line argument\n"); exit_code = -1; } else { if (!plugin_name) { GstPluginFeature *feature; feature = gst_registry_lookup_feature (gst_registry_get (), argv[1]); if (feature != NULL && gst_plugin_feature_check_version (feature, minver_maj, minver_min, minver_micro)) { exit_code = 0; } else { exit_code = 1; } } else { /* FIXME: support checking for plugins too */ g_printerr ("Checking for plugins is not supported yet\n"); exit_code = -1; } } return exit_code; } /* if no arguments, print out list of elements */ if (uri_handlers) { print_all_uri_handlers (); } else if (argc == 1 || print_all) { if (do_print_blacklist) print_blacklist (); else { if (print_aii) print_all_plugin_automatic_install_info (); else print_element_list (print_all); } } else { /* else we try to get a factory */ GstElementFactory *factory; GstPlugin *plugin; const char *arg = argv[argc - 1]; int retval; if (!plugin_name) { factory = gst_element_factory_find (arg); /* if there's a factory, print out the info */ if (factory) { retval = print_element_info (factory, print_all); gst_object_unref (factory); } else { retval = print_element_features (arg); } } else { retval = -1; } /* otherwise check if it's a plugin */ if (retval) { plugin = gst_registry_find_plugin (gst_registry_get (), arg); /* if there is such a plugin, print out info */ if (plugin) { if (print_aii) { print_plugin_automatic_install_info (plugin); } else { print_plugin_info (plugin); print_plugin_features (plugin); } } else { GError *error = NULL; if (g_file_test (arg, G_FILE_TEST_EXISTS)) { plugin = gst_plugin_load_file (arg, &error); if (plugin) { if (print_aii) { print_plugin_automatic_install_info (plugin); } else { print_plugin_info (plugin); print_plugin_features (plugin); } } else { g_printerr (_("Could not load plugin file: %s\n"), error->message); g_clear_error (&error); return -1; } } else { g_printerr (_("No such element or plugin '%s'\n"), arg); return -1; } } } } return 0; }