gboolean negotiated;
GstGLContext *other_context;
-
- GstBufferPool *pool;
- GstAllocator *allocator;
- GstAllocationParams params;
- GstQuery *query;
};
G_DEFINE_TYPE (GstGLBaseMixerPad, gst_gl_base_mixer_pad,
}
static gboolean
-_default_propose_allocation (GstGLBaseMixer * mix, GstGLBaseMixerPad * pad,
- GstQuery * decide_query, GstQuery * query)
-{
- return TRUE;
-}
-
-static gboolean
gst_gl_base_mixer_sink_event (GstAggregator * agg, GstAggregatorPad * bpad,
GstEvent * event)
{
}
static gboolean
+gst_gl_base_mixer_propose_allocation (GstAggregator * agg,
+ GstAggregatorPad * aggpad, GstQuery * decide_query, GstQuery * query)
+{
+ GstGLBaseMixer *mix = GST_GL_BASE_MIXER (agg);
+
+ if (!_get_gl_context (mix))
+ return FALSE;
+
+ return TRUE;
+}
+
+static gboolean
gst_gl_base_mixer_sink_query (GstAggregator * agg, GstAggregatorPad * bpad,
GstQuery * query)
{
- gboolean ret = FALSE;
GstGLBaseMixer *mix = GST_GL_BASE_MIXER (agg);
- GstGLBaseMixerClass *mix_class = GST_GL_BASE_MIXER_GET_CLASS (mix);
- GstGLBaseMixerPad *pad = GST_GL_BASE_MIXER_PAD (bpad);
GST_TRACE ("QUERY %" GST_PTR_FORMAT, query);
switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_ALLOCATION:
- {
- GstQuery *decide_query = NULL;
-
- GST_OBJECT_LOCK (mix);
- if (G_UNLIKELY (!pad->negotiated)) {
- GST_DEBUG_OBJECT (mix,
- "not negotiated yet, can't answer ALLOCATION query");
- GST_OBJECT_UNLOCK (mix);
- return FALSE;
- }
-
- if ((decide_query = mix->priv->query))
- gst_query_ref (decide_query);
- GST_OBJECT_UNLOCK (mix);
-
- if (!_get_gl_context (mix))
- return FALSE;
-
- GST_DEBUG_OBJECT (mix,
- "calling propose allocation with query %" GST_PTR_FORMAT,
- decide_query);
-
- /* pass the query to the propose_allocation vmethod if any */
- if (mix_class->propose_allocation)
- ret = mix_class->propose_allocation (mix, pad, decide_query, query);
- else
- ret = FALSE;
-
- if (decide_query)
- gst_query_unref (decide_query);
-
- GST_DEBUG_OBJECT (mix, "ALLOCATION ret %d, %" GST_PTR_FORMAT, ret, query);
- return ret;
- }
case GST_QUERY_CONTEXT:
{
if (gst_gl_handle_context_query ((GstElement *) mix, query,
agg_class->stop = gst_gl_base_mixer_stop;
agg_class->start = gst_gl_base_mixer_start;
agg_class->decide_allocation = gst_gl_base_mixer_decide_allocation;
-
- klass->propose_allocation = _default_propose_allocation;
+ agg_class->propose_allocation = gst_gl_base_mixer_propose_allocation;
g_object_class_install_property (gobject_class, PROP_CONTEXT,
g_param_spec_object ("context",
{
GstGLBaseMixer *mix = GST_GL_BASE_MIXER (agg);
- if (mix->priv->query) {
- gst_query_unref (mix->priv->query);
- mix->priv->query = NULL;
- }
-
- if (mix->priv->pool) {
- gst_object_unref (mix->priv->pool);
- mix->priv->pool = NULL;
- }
-
if (mix->context) {
gst_object_unref (mix->context);
mix->context = NULL;
GstVideoAggregatorClass parent_class;
GstGLAPI supported_gl_api;
- gboolean (*propose_allocation) (GstGLBaseMixer * mix, GstGLBaseMixerPad * pad, GstQuery * decide_query, GstQuery *query);
-
gpointer _padding[GST_PADDING];
};
}
static gboolean
-gst_gl_mixer_propose_allocation (GstGLBaseMixer * base_mix,
- GstGLBaseMixerPad * base_pad, GstQuery * decide_query, GstQuery * query)
+gst_gl_mixer_propose_allocation (GstAggregator * agg,
+ GstAggregatorPad * agg_pad, GstQuery * decide_query, GstQuery * query)
{
- GstGLMixer *mix = GST_GL_MIXER (base_mix);
- GstGLContext *context = base_mix->context;
+ GstGLMixer *mix = GST_GL_MIXER (agg);
+ GstGLBaseMixer *base_mix = GST_GL_BASE_MIXER (agg);
+ GstGLContext *context;
GstBufferPool *pool = NULL;
GstStructure *config;
GstCaps *caps;
guint size = 0;
gboolean need_pool;
+
+ if (!GST_AGGREGATOR_CLASS (gst_gl_mixer_parent_class)->propose_allocation
+ (agg, agg_pad, decide_query, query))
+ return FALSE;
+
+ context = base_mix->context;
+
gst_query_parse_allocation (query, &caps, &need_pool);
if (caps == NULL)
GstVideoAggregatorClass *videoaggregator_class =
(GstVideoAggregatorClass *) klass;
GstAggregatorClass *agg_class = (GstAggregatorClass *) klass;
- GstGLBaseMixerClass *mix_class = GST_GL_BASE_MIXER_CLASS (klass);;
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "glmixer", 0, "OpenGL mixer");
agg_class->start = gst_gl_mixer_start;
agg_class->negotiated_src_caps = _negotiated_caps;
agg_class->decide_allocation = gst_gl_mixer_decide_allocation;
+ agg_class->propose_allocation = gst_gl_mixer_propose_allocation;
videoaggregator_class->aggregate_frames = gst_gl_mixer_aggregate_frames;
videoaggregator_class->find_best_format = _find_best_format;
- mix_class->propose_allocation = gst_gl_mixer_propose_allocation;
/* Register the pad class */
g_type_class_ref (GST_TYPE_GL_MIXER_PAD);
static GstCaps *_update_caps (GstVideoAggregator * vagg, GstCaps * caps);
static GstCaps *_fixate_caps (GstAggregator * agg, GstCaps * caps);
-static gboolean gst_gl_video_mixer_propose_allocation (GstGLBaseMixer *
- base_mix, GstGLBaseMixerPad * base_pad, GstQuery * decide_query,
- GstQuery * query);
+static gboolean gst_gl_video_mixer_propose_allocation (GstAggregator *
+ agg, GstAggregatorPad * agg_pad, GstQuery * decide_query, GstQuery * query);
static void gst_gl_video_mixer_reset (GstGLMixer * mixer);
static gboolean gst_gl_video_mixer_init_shader (GstGLMixer * mixer,
GstCaps * outcaps);
GstElementClass *element_class;
GstAggregatorClass *agg_class = (GstAggregatorClass *) klass;
GstVideoAggregatorClass *vagg_class = (GstVideoAggregatorClass *) klass;
- GstGLBaseMixerClass *mix_class = GST_GL_BASE_MIXER_CLASS (klass);
gobject_class = (GObjectClass *) klass;
element_class = GST_ELEMENT_CLASS (klass);
GST_GL_MIXER_CLASS (klass)->process_textures =
gst_gl_video_mixer_process_textures;
+
vagg_class->update_caps = _update_caps;
agg_class->sinkpads_type = GST_TYPE_GL_VIDEO_MIXER_PAD;
agg_class->fixate_src_caps = _fixate_caps;
-
- mix_class->propose_allocation = gst_gl_video_mixer_propose_allocation;
+ agg_class->propose_allocation = gst_gl_video_mixer_propose_allocation;
GST_GL_BASE_MIXER_CLASS (klass)->supported_gl_api =
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 | GST_GL_API_GLES2;
}
static gboolean
-gst_gl_video_mixer_propose_allocation (GstGLBaseMixer * base_mix,
- GstGLBaseMixerPad * base_pad, GstQuery * decide_query, GstQuery * query)
+gst_gl_video_mixer_propose_allocation (GstAggregator * agg,
+ GstAggregatorPad * agg_pad, GstQuery * decide_query, GstQuery * query)
{
- if (!GST_GL_BASE_MIXER_CLASS (parent_class)->propose_allocation (base_mix,
- base_pad, decide_query, query))
+ if (!GST_AGGREGATOR_CLASS (parent_class)->propose_allocation (agg,
+ agg_pad, decide_query, query))
return FALSE;
gst_query_add_allocation_meta (query,