2009-10-27 14:27:14 +00:00
|
|
|
/*
|
2009-10-22 23:11:27 +00:00
|
|
|
* GStreamer
|
|
|
|
* Copyright (C) 2009 Julien Isorce <julien.isorce@gmail.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-08 11:53:56 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2009-10-22 23:11:27 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GST_GL_MIXER_H__
|
|
|
|
#define __GST_GL_MIXER_H__
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
#include <gst/video/video.h>
|
2013-07-11 09:03:31 +00:00
|
|
|
#include <gst/gl/gl.h>
|
|
|
|
#include <gst/gl/gstglmixerpad.h>
|
2012-07-12 08:19:44 +00:00
|
|
|
|
2009-10-22 23:11:27 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
#define GST_TYPE_GL_MIXER (gst_gl_mixer_get_type())
|
|
|
|
#define GST_GL_MIXER(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_MIXER, GstGLMixer))
|
|
|
|
#define GST_GL_MIXER_CLASS(klass) \
|
|
|
|
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_MIXER, GstGLMixerClass))
|
|
|
|
#define GST_IS_GL_MIXER(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_MIXER))
|
|
|
|
#define GST_IS_GL_MIXER_CLASS(klass) \
|
|
|
|
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_MIXER))
|
|
|
|
#define GST_GL_MIXER_GET_CLASS(obj) \
|
|
|
|
(G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_GL_MIXER,GstGLMixerClass))
|
|
|
|
|
|
|
|
typedef struct _GstGLMixer GstGLMixer;
|
|
|
|
typedef struct _GstGLMixerClass GstGLMixerClass;
|
2012-07-12 08:19:44 +00:00
|
|
|
typedef struct _GstGLMixerPrivate GstGLMixerPrivate;
|
2013-11-14 04:08:47 +00:00
|
|
|
typedef struct _GstGLMixerFrameData GstGLMixerFrameData;
|
2009-10-22 23:11:27 +00:00
|
|
|
|
2009-10-27 14:27:14 +00:00
|
|
|
typedef gboolean (*GstGLMixerSetCaps) (GstGLMixer* mixer,
|
2009-10-22 23:11:27 +00:00
|
|
|
GstCaps* outcaps);
|
|
|
|
typedef void (*GstGLMixerReset) (GstGLMixer *mixer);
|
|
|
|
typedef gboolean (*GstGLMixerProcessFunc) (GstGLMixer *mix,
|
2009-10-27 14:27:14 +00:00
|
|
|
GPtrArray *buffers, GstBuffer *outbuf);
|
2012-09-20 13:27:00 +00:00
|
|
|
typedef gboolean (*GstGLMixerProcessTextures) (GstGLMixer *mix,
|
2013-11-14 04:08:47 +00:00
|
|
|
GPtrArray *frames, guint out_tex);
|
2009-10-22 23:11:27 +00:00
|
|
|
|
|
|
|
struct _GstGLMixer
|
|
|
|
{
|
|
|
|
GstElement element;
|
|
|
|
|
2012-07-12 08:19:44 +00:00
|
|
|
GstGLMixerPrivate *priv;
|
|
|
|
|
2009-10-22 23:11:27 +00:00
|
|
|
/* pad */
|
|
|
|
GstPad *srcpad;
|
|
|
|
|
|
|
|
/* Lock to prevent the state to change while blending */
|
2012-06-19 05:54:24 +00:00
|
|
|
GMutex lock;
|
2009-10-22 23:11:27 +00:00
|
|
|
/* Sink pads using Collect Pads from core's base library */
|
|
|
|
GstCollectPads *collect;
|
2012-06-19 05:54:24 +00:00
|
|
|
|
2009-10-22 23:11:27 +00:00
|
|
|
/* sinkpads, a GSList of GstGLMixerPads */
|
|
|
|
GSList *sinkpads;
|
|
|
|
gint numpads;
|
2012-06-19 05:54:24 +00:00
|
|
|
/* Next available sinkpad index */
|
|
|
|
gint next_sinkpad;
|
2009-10-22 23:11:27 +00:00
|
|
|
|
2012-06-19 05:54:24 +00:00
|
|
|
GPtrArray *array_buffers;
|
2012-09-20 13:27:00 +00:00
|
|
|
GPtrArray *in_frames;
|
2013-11-14 04:08:47 +00:00
|
|
|
GPtrArray *frames;
|
2009-10-22 23:11:27 +00:00
|
|
|
|
2012-09-20 13:27:00 +00:00
|
|
|
GstVideoInfo out_info;
|
|
|
|
GLuint out_tex_id;
|
|
|
|
GstGLDownload *download;
|
2009-10-22 23:11:27 +00:00
|
|
|
|
2012-06-19 05:54:24 +00:00
|
|
|
gboolean newseg_pending;
|
|
|
|
gboolean flush_stop_pending;
|
2009-10-27 14:27:14 +00:00
|
|
|
|
2012-06-19 05:54:24 +00:00
|
|
|
GstSegment segment;
|
|
|
|
GstClockTime ts_offset;
|
|
|
|
guint64 nframes;
|
2009-10-22 23:11:27 +00:00
|
|
|
|
|
|
|
/* sink event handling */
|
2012-06-19 05:54:24 +00:00
|
|
|
gdouble proportion;
|
|
|
|
GstClockTime earliest_time;
|
|
|
|
guint64 qos_processed, qos_dropped;
|
2009-10-22 23:11:27 +00:00
|
|
|
|
|
|
|
GstGLDisplay *display;
|
2013-09-15 04:23:43 +00:00
|
|
|
GstGLContext *context;
|
2009-10-22 23:11:27 +00:00
|
|
|
GLuint fbo;
|
|
|
|
GLuint depthbuffer;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GstGLMixerClass
|
|
|
|
{
|
|
|
|
GstElementClass parent_class;
|
|
|
|
|
|
|
|
GstGLMixerSetCaps set_caps;
|
|
|
|
GstGLMixerReset reset;
|
|
|
|
GstGLMixerProcessFunc process_buffers;
|
2012-09-20 13:27:00 +00:00
|
|
|
GstGLMixerProcessTextures process_textures;
|
2009-10-22 23:11:27 +00:00
|
|
|
};
|
|
|
|
|
2013-11-14 04:08:47 +00:00
|
|
|
struct _GstGLMixerFrameData
|
|
|
|
{
|
|
|
|
GstGLMixerPad *pad;
|
|
|
|
guint texture;
|
|
|
|
};
|
|
|
|
|
2009-10-22 23:11:27 +00:00
|
|
|
GType gst_gl_mixer_get_type(void);
|
|
|
|
|
2012-09-20 13:27:00 +00:00
|
|
|
gboolean gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf);
|
|
|
|
|
2009-10-22 23:11:27 +00:00
|
|
|
G_END_DECLS
|
|
|
|
#endif /* __GST_GL_MIXER_H__ */
|