Example #1
0
void
kms_utils_set_pad_query_function_full (GstPad * pad,
    GstPadQueryFunction query_func, gpointer user_data, GDestroyNotify notify,
    gboolean chain_callbacks)
{
  GstPadQueryFunction prev_func;
  KmsQueryData *data;

  /* Create new data */
  data = g_slice_new0 (KmsQueryData);
  data->user_func = query_func;
  data->user_data = user_data;
  data->user_notify = notify;

  if (!chain_callbacks) {
    goto set_func;
  }

  prev_func = GST_PAD_QUERYFUNC (pad);

  if (prev_func != kms_query_function) {
    /* Keep first data to chain to it */
    KmsQueryData *first;

    first = g_slice_new0 (KmsQueryData);
    first->user_func = GST_PAD_QUERYFUNC (pad);
    first->user_data = pad->querydata;
    first->user_notify = pad->querynotify;
    data->next = first;
  } else {
    /* Point to previous data to be chained  */
    data->next = pad->querydata;
  }

  /* Do not destroy previous data when set_query is called */
  pad->querynotify = NULL;
  pad->querydata = NULL;

set_func:

  gst_pad_set_query_function_full (pad, kms_query_function, data,
      kms_query_data_destroy);
}
void
gst_vaapi_plugin_base_init (GstVaapiPluginBase * plugin,
    GstDebugCategory * debug_category)
{
  plugin->debug_category = debug_category;
  plugin->display_type = GST_VAAPI_DISPLAY_TYPE_ANY;
  plugin->display_type_req = GST_VAAPI_DISPLAY_TYPE_ANY;

  /* sink pad */
  plugin->sinkpad = gst_element_get_static_pad (GST_ELEMENT (plugin), "sink");
  plugin->sinkpad_query = GST_PAD_QUERYFUNC (plugin->sinkpad);
  gst_video_info_init (&plugin->sinkpad_info);

  /* src pad */
  if (!(GST_OBJECT_FLAGS (plugin) & GST_ELEMENT_FLAG_SINK)) {
    plugin->srcpad = gst_element_get_static_pad (GST_ELEMENT (plugin), "src");
    plugin->srcpad_query = GST_PAD_QUERYFUNC (plugin->srcpad);
  }
  gst_video_info_init (&plugin->srcpad_info);
}