static gboolean
ensure_vpp (GstVaapiDecodeBin * vaapidecbin)
{
  GstVaapiDisplay *display;

  if (vaapidecbin->has_vpp != HAS_VPP_UNKNOWN)
    return TRUE;

  display = GST_VAAPI_PLUGIN_BASE_DISPLAY (vaapidecbin->decoder);
  if (display) {
    GST_INFO_OBJECT (vaapidecbin, "Got display from vaapidecode");
    gst_vaapi_display_ref (display);
  } else {
    GST_INFO_OBJECT (vaapidecbin, "Creating a dummy display to test for vpp");
    display = gst_vaapi_create_test_display ();
  }
  if (!display)
    return FALSE;

  vaapidecbin->has_vpp = gst_vaapi_display_has_video_processing (display) ?
    HAS_VPP_YES : HAS_VPP_NO;

  gst_vaapi_display_unref (display);

  return TRUE;
}
예제 #2
0
static gboolean
plugin_init (GstPlugin * plugin)
{
  GstVaapiDisplay *display;
  GArray *decoders;
  guint rank;

  plugin_add_dependencies (plugin);

  display = gst_vaapi_create_test_display ();
  if (!display)
    goto error_no_display;
  if (!gst_vaapi_driver_is_whitelisted (display))
    goto unsupported_driver;

  _gst_vaapi_has_video_processing =
      gst_vaapi_display_has_video_processing (display);

  decoders = display_get_decoder_codecs (display);
  if (decoders) {
    gst_vaapidecode_register (plugin, decoders);
    g_array_unref (decoders);
  }

  gst_element_register (plugin, "vaapipostproc",
      GST_RANK_PRIMARY, GST_TYPE_VAAPIPOSTPROC);

  gst_element_register (plugin, "vaapidecodebin",
      GST_RANK_PRIMARY + 2, GST_TYPE_VAAPI_DECODE_BIN);

  rank = GST_RANK_PRIMARY;
  if (g_getenv ("WAYLAND_DISPLAY"))
    rank = GST_RANK_MARGINAL;
  gst_element_register (plugin, "vaapisink", rank, GST_TYPE_VAAPISINK);

#if USE_ENCODERS
  gst_vaapiencode_register (plugin, display);
#endif

  gst_object_unref (display);

  return TRUE;

  /* ERRORS: */
error_no_display:
  {
    GST_ERROR ("Cannot create a VA display");
    /* Avoid blacklisting: failure to create a display could be a
     * transient condition */
    return TRUE;
  }
unsupported_driver:
  {
    gst_object_unref (display);
    return TRUE;                /* return TRUE to avoid get blacklisted */
  }
}