blob: 5e71d49c584b96486690ba0566158934e9e93688 [file] [log] [blame]
/*
* # Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _GST_GLSVGOVERLAY_H
#define _GST_GLSVGOVERLAY_H
#include <gst/gst.h>
#include <gst/gl/egl/gstegl.h>
#include "gst/gl/egl/gstgldisplay_egl.h"
#include <gst/gl/gstglfilter.h>
G_BEGIN_DECLS
#define GST_TYPE_GL_SVG_OVERLAY (gst_gl_svg_overlay_get_type())
#define GST_GL_SVG_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_SVG_OVERLAY,GstGLSvgOverlay))
#define GST_IS_GL_SVG_OVERLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_SVG_OVERLAY))
#define GST_GL_SVG_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_GL_SVG_OVERLAY,GstGLSvgOverlayClass))
#define GST_IS_GL_SVG_OVERLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_GL_SVG_OVERLAY))
#define GST_GL_SVG_OVERLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_GL_SVG_OVERLAY,GstGLSvgOverlayClass))
typedef struct _GstGLSvgOverlay GstGLSvgOverlay;
typedef struct _GstGLSvgOverlayClass GstGLSvgOverlayClass;
typedef struct _TaskData TaskData;
typedef struct _EglImageTexture EglImageTexture;
struct _GstGLSvgOverlay
{
GstGLFilter filter;
GstGLContext *context;
GMutex mutex;
GCond cond;
GstGLShader *shader;
GThreadPool *thread_pool;
GstBufferPool *buffer_pool;
GstAllocator *ion_allocator;
gboolean use_ion;
GQueue *svg_queue;
GQueue *gl_queue;
GstClockTime next_pts;
guint num_tasks;
TaskData *current;
gboolean sync;
gboolean started;
gint internal_format;
GstVideoInfo info;
};
struct _GstGLSvgOverlayClass
{
GstGLFilterClass filter_class;
gboolean (*set_svg) (GstGLSvgOverlay *overlay, const gchar *svg, GstClockTime pts);
};
enum TaskOp
{
OP_ALLOC,
OP_DRAW,
OP_UPLOAD,
OP_READY,
};
struct _EglImageTexture {
GstGLSvgOverlay *overlay;
EGLImageKHR *image;
guint tex;
};
struct _TaskData {
GstGLSvgOverlay *overlay;
enum TaskOp op;
gchar *svg;
GstClockTime pts;
GstBuffer *buf;
GstMapInfo map;
EglImageTexture *egl_tex;
guint tex;
};
GType gst_gl_svg_overlay_get_type (void);
G_END_DECLS
#endif /* _GST_GLSVGOVERLAY_H */