mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
ges: Use registry to select the compositor element
This commit is contained in:
parent
0d2256b5bd
commit
ea2b814fba
4 changed files with 44 additions and 3 deletions
|
@ -261,6 +261,8 @@ G_GNUC_INTERNAL gint element_start_compare (GESTimelineElement *
|
|||
GESTimelineElement * b);
|
||||
G_GNUC_INTERNAL gint element_end_compare (GESTimelineElement * a,
|
||||
GESTimelineElement * b);
|
||||
G_GNUC_INTERNAL GstElementFactory *
|
||||
ges_get_compositor_factory (void);
|
||||
|
||||
void
|
||||
ges_base_xml_formatter_set_timeline_properties(GESBaseXmlFormatter * self,
|
||||
|
|
|
@ -209,10 +209,10 @@ static void
|
|||
ges_smart_mixer_init (GESSmartMixer * self)
|
||||
{
|
||||
GstPad *pad;
|
||||
|
||||
g_mutex_init (&self->lock);
|
||||
|
||||
self->mixer = gst_element_factory_make ("videomixer", "smart-mixer-mixer");
|
||||
self->mixer = gst_element_factory_create (ges_get_compositor_factory (),
|
||||
"smart-mixer-mixer");
|
||||
g_object_set (self->mixer, "background", 1, NULL);
|
||||
gst_bin_add (GST_BIN (self), self->mixer);
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#include "ges-layer.h"
|
||||
#include "ges.h"
|
||||
|
||||
static GstElementFactory *compositor_factory = NULL;
|
||||
|
||||
/**
|
||||
* ges_timeline_new_audio_video:
|
||||
*
|
||||
|
@ -122,3 +124,40 @@ ges_pspec_hash (gconstpointer key_spec)
|
|||
|
||||
return h;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
find_compositor (GstPluginFeatureFilter * feature, gpointer udata)
|
||||
{
|
||||
const gchar *klass;
|
||||
|
||||
if (G_UNLIKELY (!GST_IS_ELEMENT_FACTORY (feature)))
|
||||
return FALSE;
|
||||
|
||||
klass = gst_element_factory_get_metadata (GST_ELEMENT_FACTORY_CAST (feature),
|
||||
GST_ELEMENT_METADATA_KLASS);
|
||||
|
||||
return (strstr (klass, "Compositor") != NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
GstElementFactory *
|
||||
ges_get_compositor_factory (void)
|
||||
{
|
||||
GList *result;
|
||||
|
||||
if (compositor_factory)
|
||||
return compositor_factory;
|
||||
|
||||
result = gst_registry_feature_filter (gst_registry_get (),
|
||||
(GstPluginFeatureFilter) find_compositor, FALSE, NULL);
|
||||
|
||||
/* sort on rank and name */
|
||||
result = g_list_sort (result, gst_plugin_feature_rank_compare_func);
|
||||
g_assert (result);
|
||||
|
||||
compositor_factory = result->data;
|
||||
gst_plugin_feature_list_free (result);
|
||||
|
||||
return compositor_factory;
|
||||
}
|
||||
|
|
|
@ -311,7 +311,7 @@ ges_video_transition_create_element (GESTrackElement * object)
|
|||
|
||||
gst_bin_add_many (GST_BIN (topbin), iconva, iconvb, oconv, NULL);
|
||||
|
||||
mixer = gst_element_factory_make ("videomixer", NULL);
|
||||
mixer = gst_element_factory_create (ges_get_compositor_factory (), NULL);
|
||||
g_assert (mixer);
|
||||
g_object_set (G_OBJECT (mixer), "background", 1, NULL);
|
||||
gst_bin_add (GST_BIN (topbin), mixer);
|
||||
|
|
Loading…
Reference in a new issue