void
gst_auto_video_convert_update_factory_list (GstAutoVideoConvert *
    autovideoconvert)
{
  /* use a static mutex to protect factories list and factories cookie */
  g_static_mutex_lock (&factories_mutex);

  /* test if a factories list already exist or not */
  if (!factories) {
    /* no factories list create it */
    factories_cookie =
        gst_registry_get_feature_list_cookie (gst_registry_get ());
    factories = gst_auto_video_convert_create_factory_list (autovideoconvert);
  } else {
    /* a factories list exist but is it up to date? */
    if (factories_cookie !=
        gst_registry_get_feature_list_cookie (gst_registry_get ())) {
      /* we need to update the factories list */
      /* first free the old one */
      gst_plugin_feature_list_free (factories);
      /* then create an updated one */
      factories_cookie =
          gst_registry_get_feature_list_cookie (gst_registry_get ());
      factories = gst_auto_video_convert_create_factory_list (autovideoconvert);
    }
  }

  g_static_mutex_unlock (&factories_mutex);
}
GList* GStreamerFormatHelper::GetFactories() {
  NS_ASSERTION(sLoadOK, "GStreamer library not linked");

#if GST_VERSION_MAJOR >= 1
  uint32_t cookie = gst_registry_get_feature_list_cookie(gst_registry_get());
#else
  uint32_t cookie = gst_default_registry_get_feature_list_cookie();
#endif
  if (cookie != mCookie) {
    g_list_free(mFactories);
#if GST_VERSION_MAJOR >= 1
    mFactories =
      gst_registry_feature_filter(gst_registry_get(),
                                  (GstPluginFeatureFilter)FactoryFilter,
                                  false, nullptr);
#else
    mFactories =
      gst_default_registry_feature_filter((GstPluginFeatureFilter)FactoryFilter,
                                          false, nullptr);
#endif
    mCookie = cookie;
  }

  return mFactories;
}
GList* GStreamerFormatHelper::GetFactories() {
  NS_ASSERTION(sLoadOK, "GStreamer library not linked");

  uint32_t cookie = gst_registry_get_feature_list_cookie(gst_registry_get());
  if (cookie != mCookie) {
    g_list_free(mFactories);
    mFactories =
      gst_registry_feature_filter(gst_registry_get(),
                                  (GstPluginFeatureFilter)FactoryFilter,
                                  false, nullptr);
    mCookie = cookie;
  }

  return mFactories;
}