Esempio n. 1
0
static VALUE
rb_gst_update_registry(VALUE self)
{
    return CBOOL2RVAL(gst_update_registry());
}
Esempio n. 2
0
/*
 * this bit handles:
 * - initalization of threads if we use them
 * - log handler
 * - initial output
 * - initializes gst_format
 * - registers a bunch of types for gst_objects
 *
 * - we don't have cases yet where this fails, but in the future
 *   we might and then it's nice to be able to return that
 */
static gboolean
init_post (GOptionContext * context, GOptionGroup * group, gpointer data,
    GError ** error)
{
  GLogLevelFlags llf;

  if (gst_initialized) {
    GST_DEBUG ("already initialized");
    return TRUE;
  }

  llf = G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL;
  g_log_set_handler (g_log_domain_gstreamer, llf, debug_log_handler, NULL);

#ifndef GST_DISABLE_TRACE
  _priv_gst_alloc_trace_initialize ();
#endif

  _priv_gst_mini_object_initialize ();
  _priv_gst_quarks_initialize ();
  _priv_gst_allocator_initialize ();
  _priv_gst_memory_initialize ();
  _priv_gst_format_initialize ();
  _priv_gst_query_initialize ();
  _priv_gst_structure_initialize ();
  _priv_gst_caps_initialize ();
  _priv_gst_caps_features_initialize ();
  _priv_gst_meta_initialize ();
  _priv_gst_message_initialize ();

  g_type_class_ref (gst_object_get_type ());
  g_type_class_ref (gst_pad_get_type ());
  g_type_class_ref (gst_element_factory_get_type ());
  g_type_class_ref (gst_element_get_type ());
  g_type_class_ref (gst_tracer_factory_get_type ());
  g_type_class_ref (gst_type_find_factory_get_type ());
  g_type_class_ref (gst_bin_get_type ());
  g_type_class_ref (gst_bus_get_type ());
  g_type_class_ref (gst_task_get_type ());
  g_type_class_ref (gst_clock_get_type ());
  g_type_class_ref (gst_debug_color_mode_get_type ());

  gst_uri_handler_get_type ();

  g_type_class_ref (gst_object_flags_get_type ());
  g_type_class_ref (gst_bin_flags_get_type ());
  g_type_class_ref (gst_buffer_flags_get_type ());
  g_type_class_ref (gst_buffer_copy_flags_get_type ());
  g_type_class_ref (gst_bus_flags_get_type ());
  g_type_class_ref (gst_bus_sync_reply_get_type ());
  g_type_class_ref (gst_caps_flags_get_type ());
  g_type_class_ref (gst_clock_return_get_type ());
  g_type_class_ref (gst_clock_entry_type_get_type ());
  g_type_class_ref (gst_clock_flags_get_type ());
  g_type_class_ref (gst_clock_type_get_type ());
  g_type_class_ref (gst_debug_graph_details_get_type ());
  g_type_class_ref (gst_state_get_type ());
  g_type_class_ref (gst_state_change_return_get_type ());
  g_type_class_ref (gst_state_change_get_type ());
  g_type_class_ref (gst_element_flags_get_type ());
  g_type_class_ref (gst_core_error_get_type ());
  g_type_class_ref (gst_library_error_get_type ());
  g_type_class_ref (gst_resource_error_get_type ());
  g_type_class_ref (gst_stream_error_get_type ());
  g_type_class_ref (gst_event_type_flags_get_type ());
  g_type_class_ref (gst_event_type_get_type ());
  g_type_class_ref (gst_seek_type_get_type ());
  g_type_class_ref (gst_seek_flags_get_type ());
  g_type_class_ref (gst_qos_type_get_type ());
  g_type_class_ref (gst_format_get_type ());
  g_type_class_ref (gst_debug_level_get_type ());
  g_type_class_ref (gst_debug_color_flags_get_type ());
  g_type_class_ref (gst_iterator_result_get_type ());
  g_type_class_ref (gst_iterator_item_get_type ());
  g_type_class_ref (gst_message_type_get_type ());
  g_type_class_ref (gst_mini_object_flags_get_type ());
  g_type_class_ref (gst_pad_link_return_get_type ());
  g_type_class_ref (gst_pad_link_check_get_type ());
  g_type_class_ref (gst_flow_return_get_type ());
  g_type_class_ref (gst_pad_mode_get_type ());
  g_type_class_ref (gst_pad_direction_get_type ());
  g_type_class_ref (gst_pad_flags_get_type ());
  g_type_class_ref (gst_pad_presence_get_type ());
  g_type_class_ref (gst_pad_template_flags_get_type ());
  g_type_class_ref (gst_pipeline_flags_get_type ());
  g_type_class_ref (gst_plugin_error_get_type ());
  g_type_class_ref (gst_plugin_flags_get_type ());
  g_type_class_ref (gst_plugin_dependency_flags_get_type ());
  g_type_class_ref (gst_rank_get_type ());
  g_type_class_ref (gst_query_type_flags_get_type ());
  g_type_class_ref (gst_query_type_get_type ());
  g_type_class_ref (gst_buffering_mode_get_type ());
  g_type_class_ref (gst_stream_status_type_get_type ());
  g_type_class_ref (gst_structure_change_type_get_type ());
  g_type_class_ref (gst_tag_merge_mode_get_type ());
  g_type_class_ref (gst_tag_flag_get_type ());
  g_type_class_ref (gst_tag_scope_get_type ());
  g_type_class_ref (gst_task_pool_get_type ());
  g_type_class_ref (gst_task_state_get_type ());
  g_type_class_ref (gst_toc_entry_type_get_type ());
  g_type_class_ref (gst_type_find_probability_get_type ());
  g_type_class_ref (gst_uri_error_get_type ());
  g_type_class_ref (gst_uri_type_get_type ());
  g_type_class_ref (gst_parse_error_get_type ());
  g_type_class_ref (gst_parse_flags_get_type ());
  g_type_class_ref (gst_search_mode_get_type ());
  g_type_class_ref (gst_progress_type_get_type ());
  g_type_class_ref (gst_buffer_pool_acquire_flags_get_type ());
  g_type_class_ref (gst_memory_flags_get_type ());
  g_type_class_ref (gst_map_flags_get_type ());
  g_type_class_ref (gst_caps_intersect_mode_get_type ());
  g_type_class_ref (gst_pad_probe_type_get_type ());
  g_type_class_ref (gst_pad_probe_return_get_type ());
  g_type_class_ref (gst_segment_flags_get_type ());
  g_type_class_ref (gst_scheduling_flags_get_type ());
  g_type_class_ref (gst_meta_flags_get_type ());
  g_type_class_ref (gst_toc_entry_type_get_type ());
  g_type_class_ref (gst_toc_scope_get_type ());
  g_type_class_ref (gst_toc_loop_type_get_type ());
  g_type_class_ref (gst_control_binding_get_type ());
  g_type_class_ref (gst_control_source_get_type ());
  g_type_class_ref (gst_lock_flags_get_type ());
  g_type_class_ref (gst_allocator_flags_get_type ());
  g_type_class_ref (gst_stream_flags_get_type ());

  _priv_gst_event_initialize ();
  _priv_gst_buffer_initialize ();
  _priv_gst_buffer_list_initialize ();
  _priv_gst_sample_initialize ();
  _priv_gst_context_initialize ();
  _priv_gst_date_time_initialize ();
  _priv_gst_tag_initialize ();
  _priv_gst_toc_initialize ();
  _priv_gst_value_initialize ();

  g_type_class_ref (gst_param_spec_fraction_get_type ());
  gst_parse_context_get_type ();

  _priv_gst_plugin_initialize ();

  /* register core plugins */
  gst_plugin_register_static (GST_VERSION_MAJOR, GST_VERSION_MINOR,
      "staticelements", "core elements linked into the GStreamer library",
      gst_register_core_elements, VERSION, GST_LICENSE, PACKAGE,
      GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);

  /*
   * Any errors happening below this point are non-fatal, we therefore mark
   * gstreamer as being initialized, since it is the case from a plugin point of
   * view.
   *
   * If anything fails, it will be put back to %FALSE in gst_init_check().
   * This allows some special plugins that would call gst_init() to not cause a
   * looping effect (i.e. initializing GStreamer twice).
   */
  gst_initialized = TRUE;

  if (!gst_update_registry ())
    return FALSE;

  GST_INFO ("GLib runtime version: %d.%d.%d", glib_major_version,
      glib_minor_version, glib_micro_version);
  GST_INFO ("GLib headers version: %d.%d.%d", GLIB_MAJOR_VERSION,
      GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
  GST_INFO ("initialized GStreamer successfully");

#ifndef GST_DISABLE_GST_DEBUG
  _priv_gst_tracing_init ();
#endif

  return TRUE;
}
static void
on_plugin_installation_done (GstInstallPluginsReturn res, gpointer user_data)
{
	TotemCodecInstallContext *ctx = (TotemCodecInstallContext *) user_data;
	gchar **p;

	GST_INFO ("res = %d (%s)", res, gst_install_plugins_return_get_name (res));

	switch (res)
	{
		/* treat partial success the same as success; in the worst case we'll
		 * just do another round and get NOT_FOUND as result that time */
		case GST_INSTALL_PLUGINS_PARTIAL_SUCCESS:
		case GST_INSTALL_PLUGINS_SUCCESS:
			{
				/* blacklist installed plugins too, so that we don't get
				 * into endless installer loops in case of inconsistencies */
				for (p = ctx->details; p != NULL && *p != NULL; ++p)
					bacon_video_widget_gst_codec_install_blacklist_plugin (*p);

				bacon_video_widget_stop (ctx->bvw);
				g_message ("Missing plugins installed. Updating plugin registry ...");

				/* force GStreamer to re-read its plugin registry */
				if (gst_update_registry ())
				{
					g_message ("Plugin registry updated, trying again.");
					bacon_video_widget_play (ctx->bvw, NULL);
				} else {
					g_warning ("GStreamer registry update failed");
					/* FIXME: should we show an error message here? */
				}
			}
			break;
		case GST_INSTALL_PLUGINS_NOT_FOUND:
			{
				g_message ("No installation candidate for missing plugins found.");

				/* NOT_FOUND should only be returned if not a single one of the
				 * requested plugins was found; if we managed to play something
				 * anyway, we should just continue playing what we have and
				 * blacklist the requested plugins for this session; if we
				 * could not play anything we should blacklist them as well,
				 * so the install wizard isn't called again for nothing */
				for (p = ctx->details; p != NULL && *p != NULL; ++p)
					bacon_video_widget_gst_codec_install_blacklist_plugin (*p);

				if (ctx->playing)
				{
					bacon_video_widget_play (ctx->bvw, NULL);
				} else {
					/* wizard has not shown error, do stop/play again,
					 * so that an error message gets shown */
					bacon_video_widget_stop (ctx->bvw);
					bacon_video_widget_play (ctx->bvw, NULL);
				}
			}
			break;
		case GST_INSTALL_PLUGINS_USER_ABORT:
			{
				/* blacklist on user abort, so we show an error next time (or
				 * just play what we can) instead of calling the installer */
				for (p = ctx->details; p != NULL && *p != NULL; ++p)
					bacon_video_widget_gst_codec_install_blacklist_plugin (*p);

				if (ctx->playing) {
					bacon_video_widget_play (ctx->bvw, NULL);
				} else {
					/* if we couldn't play anything, do stop/play again,
					 * so that an error message gets shown */
					bacon_video_widget_stop (ctx->bvw);
					bacon_video_widget_play (ctx->bvw, NULL);
				}
			}
			break;
		case GST_INSTALL_PLUGINS_INVALID:
		case GST_INSTALL_PLUGINS_ERROR:
		case GST_INSTALL_PLUGINS_CRASHED:
		default:
			{
				g_message ("Missing plugin installation failed: %s",
				           gst_install_plugins_return_get_name (res));

				if (ctx->playing)
					bacon_video_widget_play (ctx->bvw, NULL);
				else
					bacon_video_widget_stop (ctx->bvw);
				break;
			}
		case GST_INSTALL_PLUGINS_STARTED_OK:
		case GST_INSTALL_PLUGINS_INTERNAL_FAILURE:
		case GST_INSTALL_PLUGINS_HELPER_MISSING:
		case GST_INSTALL_PLUGINS_INSTALL_IN_PROGRESS:
			{
				g_assert_not_reached ();
				break;
			}
	}

	bacon_video_widget_gst_codec_install_context_free (ctx);
}
Esempio n. 4
0
static void
on_plugin_installation_done (GstInstallPluginsReturn res, gpointer user_data)
{
	RBPluginInstallContext *ctx = (RBPluginInstallContext *) user_data;
	gchar **p;
	gboolean retry;

	rb_debug ("res = %d (%s)", res, gst_install_plugins_return_get_name (res));

	switch (res)
	{
		/* treat partial success the same as success; in the worst case we'll
		 * just do another round and get NOT_FOUND as result that time */
		case GST_INSTALL_PLUGINS_PARTIAL_SUCCESS:
		case GST_INSTALL_PLUGINS_SUCCESS:
		{
			/* blacklist installed plugins too, so that we don't get
			 * into endless installer loops in case of inconsistencies */
			for (p = ctx->details; p != NULL && *p != NULL; ++p) {
				rb_plugin_install_blacklist_plugin (*p);
			}

			g_message ("Missing plugins installed. Updating plugin registry ...");

			/* force GStreamer to re-read its plugin registry */
			retry = gst_update_registry ();

			rb_plugin_install_done (ctx, retry);
			break;
		}

		case GST_INSTALL_PLUGINS_NOT_FOUND:
		{
			g_message ("No installation candidate for missing plugins found.");

			/* NOT_FOUND should only be returned if not a single one of the
			 * requested plugins was found; if we managed to play something
			 * anyway, we should just continue playing what we have and
			 * blacklist the requested plugins for this session; if we
			 * could not play anything we should blacklist them as well,
			 * so the install wizard isn't called again for nothing */
			for (p = ctx->details; p != NULL && *p != NULL; ++p) {
				rb_plugin_install_blacklist_plugin (*p);
			}

			rb_plugin_install_done (ctx, FALSE);
			break;
		}

		case GST_INSTALL_PLUGINS_USER_ABORT:
		{
			/* blacklist on user abort, so we show an error next time (or
			 * just play what we can) instead of calling the installer */
			for (p = ctx->details; p != NULL && *p != NULL; ++p) {
				rb_plugin_install_blacklist_plugin (*p);
			}

			rb_plugin_install_done (ctx, FALSE);
			break;
		}

		case GST_INSTALL_PLUGINS_ERROR:
		case GST_INSTALL_PLUGINS_CRASHED:
		default:
		{
			g_message ("Missing plugin installation failed: %s",
				   gst_install_plugins_return_get_name (res));

			rb_plugin_install_done (ctx, FALSE);
			break;
		}
	}

	rb_plugin_install_context_free (ctx);
}