1 /* Generic video mixer plugin
4 * Copyright (C) 2009 Julien Isorce <julien.isorce@gmail.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
27 #include <gst/video/video.h>
29 #include "gstglmixer.h"
31 #if GST_GL_HAVE_PLATFORM_EGL
32 #include <gst/gl/egl/gsteglimagememory.h>
35 #define gst_gl_mixer_parent_class parent_class
36 G_DEFINE_ABSTRACT_TYPE (GstGLMixer, gst_gl_mixer, GST_TYPE_GL_BASE_MIXER);
38 #define GST_CAT_DEFAULT gst_gl_mixer_debug
39 GST_DEBUG_CATEGORY (gst_gl_mixer_debug);
41 static void gst_gl_mixer_pad_get_property (GObject * object, guint prop_id,
42 GValue * value, GParamSpec * pspec);
43 static void gst_gl_mixer_pad_set_property (GObject * object, guint prop_id,
44 const GValue * value, GParamSpec * pspec);
51 #define GST_GL_MIXER_GET_PRIVATE(obj) \
52 (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_GL_MIXER, GstGLMixerPrivate))
54 struct _GstGLMixerPrivate
58 gboolean gl_resource_ready;
59 GMutex gl_resource_lock;
60 GCond gl_resource_cond;
63 G_DEFINE_TYPE (GstGLMixerPad, gst_gl_mixer_pad, GST_TYPE_GL_BASE_MIXER_PAD);
66 gst_gl_mixer_pad_class_init (GstGLMixerPadClass * klass)
68 GObjectClass *gobject_class = (GObjectClass *) klass;
69 GstVideoAggregatorPadClass *vaggpad_class =
70 (GstVideoAggregatorPadClass *) klass;
72 gobject_class->set_property = gst_gl_mixer_pad_set_property;
73 gobject_class->get_property = gst_gl_mixer_pad_get_property;
75 vaggpad_class->set_info = NULL;
76 vaggpad_class->prepare_frame = NULL;
77 vaggpad_class->clean_frame = NULL;
81 gst_gl_mixer_pad_get_property (GObject * object, guint prop_id,
82 GValue * value, GParamSpec * pspec)
86 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
92 gst_gl_mixer_pad_set_property (GObject * object, guint prop_id,
93 const GValue * value, GParamSpec * pspec)
97 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
103 _negotiated_caps (GstVideoAggregator * vagg, GstCaps * caps)
105 GstGLMixer *mix = GST_GL_MIXER (vagg);
108 mix->priv->negotiated = TRUE;
110 gst_caps_replace (&mix->out_caps, caps);
112 ret = GST_VIDEO_AGGREGATOR_CLASS (parent_class)->negotiated_caps (vagg, caps);
118 _find_best_format (GstVideoAggregator * vagg, GstCaps * downstream_caps,
119 GstVideoInfo * best_info, gboolean * at_least_one_alpha)
121 GstVideoInfo tmp_info;
123 GST_VIDEO_AGGREGATOR_CLASS (parent_class)->find_best_format (vagg,
124 downstream_caps, best_info, at_least_one_alpha);
126 gst_video_info_set_format (&tmp_info, GST_VIDEO_FORMAT_RGBA,
127 best_info->width, best_info->height);
128 tmp_info.par_n = best_info->par_n;
129 tmp_info.par_d = best_info->par_d;
130 tmp_info.fps_n = best_info->fps_n;
131 tmp_info.fps_d = best_info->fps_d;
132 tmp_info.flags = best_info->flags;
133 tmp_info.interlace_mode = best_info->interlace_mode;
134 *best_info = tmp_info;
138 gst_gl_mixer_propose_allocation (GstGLBaseMixer * base_mix,
139 GstGLBaseMixerPad * base_pad, GstQuery * decide_query, GstQuery * query)
141 GstGLMixer *mix = GST_GL_MIXER (base_mix);
142 GstGLContext *context = base_mix->context;
143 GstBufferPool *pool = NULL;
144 GstStructure *config;
149 gst_query_parse_allocation (query, &caps, &need_pool);
157 if (!gst_video_info_from_caps (&info, caps))
160 GST_DEBUG_OBJECT (mix, "create new pool");
161 pool = gst_gl_buffer_pool_new (context);
163 /* the normal size of a frame */
166 config = gst_buffer_pool_get_config (pool);
167 gst_buffer_pool_config_set_params (config, caps, size, 0, 0);
169 if (!gst_buffer_pool_set_config (pool, config)) {
170 g_object_unref (pool);
174 gst_query_add_allocation_pool (query, pool, size, 1, 0);
175 g_object_unref (pool);
178 /* we also support various metadata */
179 if (context->gl_vtable->FenceSync)
180 gst_query_add_allocation_meta (query, GST_GL_SYNC_META_API_TYPE, 0);
187 GST_DEBUG_OBJECT (mix, "no caps specified");
192 GST_DEBUG_OBJECT (mix, "invalid caps specified");
197 GST_DEBUG_OBJECT (mix, "failed setting config");
203 gst_gl_mixer_pad_sink_acceptcaps (GstPad * pad, GstGLMixer * mix,
207 GstCaps *template_caps;
209 GST_DEBUG_OBJECT (pad, "try accept caps of %" GST_PTR_FORMAT, caps);
211 template_caps = gst_pad_get_pad_template_caps (pad);
212 template_caps = gst_caps_make_writable (template_caps);
214 ret = gst_caps_can_intersect (caps, template_caps);
215 GST_DEBUG_OBJECT (pad, "%saccepted caps %" GST_PTR_FORMAT,
216 (ret ? "" : "not "), caps);
217 gst_caps_unref (template_caps);
222 /* copies the given caps */
224 _update_caps (GstVideoAggregator * vagg, GstCaps * caps, GstCaps * filter)
229 tmp = gst_caps_intersect (caps, filter);
234 return gst_gl_caps_replace_all_caps_features (tmp,
235 GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
239 gst_gl_mixer_pad_sink_getcaps (GstPad * pad, GstGLMixer * mix, GstCaps * filter)
242 GstCaps *template_caps;
243 GstCaps *filtered_caps;
244 GstCaps *returned_caps;
246 template_caps = gst_pad_get_pad_template_caps (pad);
248 sinkcaps = gst_pad_get_current_caps (pad);
249 if (sinkcaps == NULL) {
250 sinkcaps = gst_caps_ref (template_caps);
252 sinkcaps = gst_caps_merge (sinkcaps, gst_caps_ref (template_caps));
256 filtered_caps = gst_caps_intersect (sinkcaps, filter);
257 gst_caps_unref (sinkcaps);
259 filtered_caps = sinkcaps; /* pass ownership */
262 returned_caps = gst_caps_intersect (filtered_caps, template_caps);
264 gst_caps_unref (template_caps);
265 gst_caps_unref (filtered_caps);
267 GST_DEBUG_OBJECT (pad, "returning %" GST_PTR_FORMAT, returned_caps);
269 return returned_caps;
273 gst_gl_mixer_sink_query (GstAggregator * agg, GstAggregatorPad * bpad,
276 gboolean ret = FALSE;
277 GstGLMixer *mix = GST_GL_MIXER (agg);
279 GST_TRACE ("QUERY %" GST_PTR_FORMAT, query);
281 switch (GST_QUERY_TYPE (query)) {
284 GstCaps *filter, *caps;
286 gst_query_parse_caps (query, &filter);
287 caps = gst_gl_mixer_pad_sink_getcaps (GST_PAD (bpad), mix, filter);
288 gst_query_set_caps_result (query, caps);
289 gst_caps_unref (caps);
293 case GST_QUERY_ACCEPT_CAPS:
297 gst_query_parse_accept_caps (query, &caps);
298 ret = gst_gl_mixer_pad_sink_acceptcaps (GST_PAD (bpad), mix, caps);
299 gst_query_set_accept_caps_result (query, ret);
304 ret = GST_AGGREGATOR_CLASS (parent_class)->sink_query (agg, bpad, query);
312 gst_gl_mixer_pad_init (GstGLMixerPad * mixerpad)
316 /* GLMixer signals and args */
328 static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
331 GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
332 (GST_CAPS_FEATURE_MEMORY_GL_MEMORY,
336 static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink_%u",
339 GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
340 (GST_CAPS_FEATURE_MEMORY_GL_MEMORY,
344 static gboolean gst_gl_mixer_src_query (GstAggregator * agg, GstQuery * query);
345 static GstFlowReturn gst_gl_mixer_get_output_buffer (GstVideoAggregator *
346 videoaggregator, GstBuffer ** outbuf);
347 static gboolean gst_gl_mixer_stop (GstAggregator * agg);
348 static gboolean gst_gl_mixer_start (GstAggregator * agg);
351 gst_gl_mixer_aggregate_frames (GstVideoAggregator * vagg,
352 GstBuffer * outbuffer);
354 static void gst_gl_mixer_set_property (GObject * object, guint prop_id,
355 const GValue * value, GParamSpec * pspec);
356 static void gst_gl_mixer_get_property (GObject * object, guint prop_id,
357 GValue * value, GParamSpec * pspec);
359 static gboolean gst_gl_mixer_decide_allocation (GstGLBaseMixer * mix,
362 static void gst_gl_mixer_finalize (GObject * object);
365 gst_gl_mixer_class_init (GstGLMixerClass * klass)
367 GObjectClass *gobject_class = (GObjectClass *) klass;
368 GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
369 GstVideoAggregatorClass *videoaggregator_class =
370 (GstVideoAggregatorClass *) klass;
371 GstAggregatorClass *agg_class = (GstAggregatorClass *) klass;
372 GstGLBaseMixerClass *mix_class = GST_GL_BASE_MIXER_CLASS (klass);;
374 GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "glmixer", 0, "OpenGL mixer");
376 g_type_class_add_private (klass, sizeof (GstGLMixerPrivate));
378 gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_gl_mixer_finalize);
380 gobject_class->get_property = gst_gl_mixer_get_property;
381 gobject_class->set_property = gst_gl_mixer_set_property;
383 gst_element_class_add_pad_template (element_class,
384 gst_static_pad_template_get (&src_factory));
385 gst_element_class_add_pad_template (element_class,
386 gst_static_pad_template_get (&sink_factory));
388 agg_class->sinkpads_type = GST_TYPE_GL_MIXER_PAD;
389 agg_class->sink_query = gst_gl_mixer_sink_query;
390 agg_class->src_query = gst_gl_mixer_src_query;
391 agg_class->stop = gst_gl_mixer_stop;
392 agg_class->start = gst_gl_mixer_start;
394 videoaggregator_class->aggregate_frames = gst_gl_mixer_aggregate_frames;
395 videoaggregator_class->get_output_buffer = gst_gl_mixer_get_output_buffer;
396 videoaggregator_class->negotiated_caps = _negotiated_caps;
397 videoaggregator_class->update_caps = _update_caps;
398 videoaggregator_class->find_best_format = _find_best_format;
400 mix_class->propose_allocation = gst_gl_mixer_propose_allocation;
401 mix_class->decide_allocation = gst_gl_mixer_decide_allocation;
403 /* Register the pad class */
404 g_type_class_ref (GST_TYPE_GL_MIXER_PAD);
406 klass->set_caps = NULL;
410 gst_gl_mixer_reset (GstGLMixer * mix)
412 mix->priv->negotiated = FALSE;
416 gst_gl_mixer_init (GstGLMixer * mix)
418 mix->priv = GST_GL_MIXER_GET_PRIVATE (mix);
419 mix->array_buffers = 0;
421 mix->depthbuffer = 0;
423 mix->priv->gl_resource_ready = FALSE;
424 g_mutex_init (&mix->priv->gl_resource_lock);
425 g_cond_init (&mix->priv->gl_resource_cond);
426 /* initialize variables */
427 gst_gl_mixer_reset (mix);
431 gst_gl_mixer_finalize (GObject * object)
433 GstGLMixer *mix = GST_GL_MIXER (object);
434 GstGLMixerPrivate *priv = mix->priv;
437 gst_caps_unref (mix->out_caps);
439 g_mutex_clear (&priv->gl_resource_lock);
440 g_cond_clear (&priv->gl_resource_cond);
441 G_OBJECT_CLASS (parent_class)->finalize (object);
445 gst_gl_mixer_query_caps (GstPad * pad, GstAggregator * agg, GstQuery * query)
447 GstCaps *filter, *current_caps, *retcaps, *template_caps;
449 gst_query_parse_caps (query, &filter);
451 template_caps = gst_pad_get_pad_template_caps (agg->srcpad);
453 current_caps = gst_pad_get_current_caps (pad);
454 if (current_caps == NULL)
455 retcaps = gst_caps_ref (template_caps);
457 retcaps = gst_caps_merge (current_caps, template_caps);
458 template_caps = NULL;
463 gst_caps_intersect_full (filter, retcaps, GST_CAPS_INTERSECT_FIRST);
464 gst_caps_unref (retcaps);
465 retcaps = current_caps;
468 gst_query_set_caps_result (query, retcaps);
469 gst_caps_unref (retcaps);
472 gst_caps_unref (template_caps);
478 gst_gl_mixer_src_query (GstAggregator * agg, GstQuery * query)
480 gboolean res = FALSE;
482 switch (GST_QUERY_TYPE (query)) {
484 res = gst_gl_mixer_query_caps (agg->srcpad, agg, query);
487 res = GST_AGGREGATOR_CLASS (parent_class)->src_query (agg, query);
495 gst_gl_mixer_get_output_buffer (GstVideoAggregator * videoaggregator,
498 GstGLMixer *mix = GST_GL_MIXER (videoaggregator);
503 gst_gl_base_mixer_get_buffer_pool (GST_GL_BASE_MIXER (videoaggregator));
506 return GST_FLOW_NOT_NEGOTIATED;
508 if (!gst_buffer_pool_is_active (pool)) {
509 if (!gst_buffer_pool_set_active (pool, TRUE)) {
510 GST_ELEMENT_ERROR (mix, RESOURCE, SETTINGS,
511 ("failed to activate bufferpool"), ("failed to activate bufferpool"));
512 return GST_FLOW_ERROR;
516 ret = gst_buffer_pool_acquire_buffer (pool, outbuf, NULL);
517 gst_object_unref (pool);
523 gst_gl_mixer_decide_allocation (GstGLBaseMixer * base_mix, GstQuery * query)
525 GstGLMixer *mix = GST_GL_MIXER (base_mix);
526 GstGLMixerClass *mixer_class = GST_GL_MIXER_GET_CLASS (mix);
527 GstVideoAggregator *vagg = GST_VIDEO_AGGREGATOR (mix);
528 GstGLContext *context = base_mix->context;
529 GstBufferPool *pool = NULL;
530 GstStructure *config;
532 guint min, max, size;
533 gboolean update_pool;
534 guint out_width, out_height;
536 out_width = GST_VIDEO_INFO_WIDTH (&vagg->info);
537 out_height = GST_VIDEO_INFO_HEIGHT (&vagg->info);
539 g_mutex_lock (&mix->priv->gl_resource_lock);
540 mix->priv->gl_resource_ready = FALSE;
542 gst_gl_context_del_fbo (context, mix->fbo, mix->depthbuffer);
544 mix->depthbuffer = 0;
547 if (!gst_gl_context_gen_fbo (context, out_width, out_height,
548 &mix->fbo, &mix->depthbuffer)) {
549 g_cond_signal (&mix->priv->gl_resource_cond);
550 g_mutex_unlock (&mix->priv->gl_resource_lock);
554 gst_query_parse_allocation (query, &caps, NULL);
556 if (mixer_class->set_caps)
557 mixer_class->set_caps (mix, caps);
559 mix->priv->gl_resource_ready = TRUE;
560 g_cond_signal (&mix->priv->gl_resource_cond);
561 g_mutex_unlock (&mix->priv->gl_resource_lock);
563 if (gst_query_get_n_allocation_pools (query) > 0) {
564 gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
570 gst_video_info_init (&vinfo);
571 gst_video_info_from_caps (&vinfo, caps);
578 pool = gst_gl_buffer_pool_new (context);
579 config = gst_buffer_pool_get_config (pool);
581 gst_buffer_pool_config_set_params (config, caps, size, min, max);
582 gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META);
584 gst_buffer_pool_set_config (pool, config);
587 gst_query_set_nth_allocation_pool (query, 0, pool, size, min, max);
589 gst_query_add_allocation_pool (query, pool, size, min, max);
591 gst_object_unref (pool);
597 GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND, ("Context error"), (NULL));
603 _upload_frames (GstAggregator * agg, GstAggregatorPad * agg_pad,
606 GstVideoAggregatorPad *vaggpad = GST_VIDEO_AGGREGATOR_PAD (agg_pad);
607 GstGLMixerPad *pad = GST_GL_MIXER_PAD (agg_pad);
608 GstElement *element = GST_ELEMENT (agg);
609 GstGLMixer *mix = GST_GL_MIXER (agg);
610 GstGLMixerFrameData *frame;
611 guint *array_index, i;
613 array_index = (guint *) user_data;
615 GST_OBJECT_LOCK (agg);
616 /* make sure the frames array is big enough */
617 i = mix->frames->len;
618 g_ptr_array_set_size (mix->frames, element->numsinkpads);
619 for (; i < element->numsinkpads; i++)
620 mix->frames->pdata[i] = g_new0 (GstGLMixerFrameData, 1);
622 frame = g_ptr_array_index (mix->frames, *array_index);
625 GST_OBJECT_UNLOCK (agg);
627 if (vaggpad->buffer != NULL) {
628 GstVideoInfo gl_info;
629 GstVideoFrame gl_frame;
630 GstGLSyncMeta *sync_meta;
632 gst_video_info_set_format (&gl_info,
633 GST_VIDEO_FORMAT_RGBA,
634 GST_VIDEO_INFO_WIDTH (&vaggpad->info),
635 GST_VIDEO_INFO_HEIGHT (&vaggpad->info));
637 sync_meta = gst_buffer_get_gl_sync_meta (vaggpad->buffer);
639 gst_gl_sync_meta_wait (sync_meta, GST_GL_BASE_MIXER (mix)->context);
641 if (!gst_video_frame_map (&gl_frame, &gl_info, vaggpad->buffer,
642 GST_MAP_READ | GST_MAP_GL)) {
643 GST_ERROR_OBJECT (agg_pad, "Failed to map input frame");
647 frame->texture = *(guint *) gl_frame.data[0];
648 gst_video_frame_unmap (&gl_frame);
657 gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf)
661 guint array_index = 0;
662 GstVideoFrame out_frame;
663 GstVideoAggregator *vagg = GST_VIDEO_AGGREGATOR (mix);
664 GstGLMixerClass *mix_class = GST_GL_MIXER_GET_CLASS (mix);
665 GstGLMixerPrivate *priv = mix->priv;
667 GST_TRACE ("Processing buffers");
669 if (!gst_video_frame_map (&out_frame, &vagg->info, outbuf,
670 GST_MAP_WRITE | GST_MAP_GL)) {
674 out_tex = *(guint *) out_frame.data[0];
676 if (!gst_aggregator_iterate_sinkpads (GST_AGGREGATOR (mix),
677 (GstAggregatorPadForeachFunc) _upload_frames, &array_index))
680 g_mutex_lock (&priv->gl_resource_lock);
681 if (!priv->gl_resource_ready)
682 g_cond_wait (&priv->gl_resource_cond, &priv->gl_resource_lock);
684 if (!priv->gl_resource_ready) {
685 g_mutex_unlock (&priv->gl_resource_lock);
686 GST_ERROR_OBJECT (mix,
687 "fbo used to render can't be created, do not run process_textures");
692 mix_class->process_textures (mix, mix->frames, out_tex);
694 g_mutex_unlock (&priv->gl_resource_lock);
697 gst_video_frame_unmap (&out_frame);
703 gst_gl_mixer_process_buffers (GstGLMixer * mix, GstBuffer * outbuf)
706 guint i, array_index = 0;
707 GstElement *element = GST_ELEMENT (mix);
708 GstGLMixerClass *mix_class = GST_GL_MIXER_GET_CLASS (mix);
710 GST_OBJECT_LOCK (mix);
711 walk = GST_ELEMENT (mix)->sinkpads;
712 i = mix->frames->len;
713 g_ptr_array_set_size (mix->frames, element->numsinkpads);
714 for (; i < element->numsinkpads; i++)
715 mix->frames->pdata[i] = g_new0 (GstGLMixerFrameData, 1);
716 while (walk) { /* We walk with this list because it's ordered */
717 GstVideoAggregatorPad *vaggpad = walk->data;
719 walk = g_list_next (walk);
721 if (vaggpad->buffer != NULL) {
722 /* put buffer into array */
723 mix->array_buffers->pdata[array_index] = vaggpad->buffer;
727 GST_OBJECT_UNLOCK (mix);
729 return mix_class->process_buffers (mix, mix->array_buffers, outbuf);
733 gst_gl_mixer_aggregate_frames (GstVideoAggregator * vagg, GstBuffer * outbuf)
735 gboolean res = FALSE;
736 GstGLMixer *mix = GST_GL_MIXER (vagg);
737 GstGLMixerClass *mix_class = GST_GL_MIXER_GET_CLASS (vagg);
738 GstGLContext *context = GST_GL_BASE_MIXER (mix)->context;
739 GstGLSyncMeta *sync_meta;
741 if (mix_class->process_buffers)
742 res = gst_gl_mixer_process_buffers (mix, outbuf);
743 else if (mix_class->process_textures)
744 res = gst_gl_mixer_process_textures (mix, outbuf);
746 sync_meta = gst_buffer_get_gl_sync_meta (outbuf);
748 gst_gl_sync_meta_set_sync_point (sync_meta, context);
750 return res ? GST_FLOW_OK : GST_FLOW_ERROR;
754 gst_gl_mixer_get_property (GObject * object,
755 guint prop_id, GValue * value, GParamSpec * pspec)
759 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
765 gst_gl_mixer_set_property (GObject * object,
766 guint prop_id, const GValue * value, GParamSpec * pspec)
770 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
776 gst_gl_mixer_start (GstAggregator * agg)
779 GstGLMixer *mix = GST_GL_MIXER (agg);
780 GstElement *element = GST_ELEMENT (agg);
782 GST_OBJECT_LOCK (mix);
783 mix->array_buffers = g_ptr_array_new_full (element->numsinkpads, NULL);
784 mix->frames = g_ptr_array_new_full (element->numsinkpads,
785 (GDestroyNotify) g_free);
787 g_ptr_array_set_size (mix->array_buffers, element->numsinkpads);
788 g_ptr_array_set_size (mix->frames, element->numsinkpads);
790 for (i = 0; i < element->numsinkpads; i++)
791 mix->frames->pdata[i] = g_new0 (GstGLMixerFrameData, 1);
793 GST_OBJECT_UNLOCK (mix);
795 return GST_AGGREGATOR_CLASS (parent_class)->start (agg);
799 gst_gl_mixer_stop (GstAggregator * agg)
801 GstGLMixer *mix = GST_GL_MIXER (agg);
802 GstGLMixerClass *mixer_class = GST_GL_MIXER_GET_CLASS (mix);
803 GstGLContext *context = GST_GL_BASE_MIXER (mix)->context;
805 GST_OBJECT_LOCK (agg);
806 g_ptr_array_free (mix->frames, TRUE);
808 g_ptr_array_free (mix->array_buffers, TRUE);
809 mix->array_buffers = NULL;
810 GST_OBJECT_UNLOCK (agg);
812 if (mixer_class->reset)
813 mixer_class->reset (mix);
815 gst_gl_context_del_fbo (context, mix->fbo, mix->depthbuffer);
817 mix->depthbuffer = 0;
820 gst_gl_mixer_reset (mix);
822 return GST_AGGREGATOR_CLASS (parent_class)->stop (agg);