summaryrefslogtreecommitdiff
path: root/include/gst/gl/gstglbasesrc.h
blob: 4c9d3a435c8224f36f22674917f05bc648fb268c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/* 
 * GStreamer
 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
 * Copyright (C) 2002,2007 David A. Schleef <ds@schleef.org>
 * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
 * Copyright (C) 2019 Philippe Normand <philn@igalia.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
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef __GST_GL_BASE_SRC_H__
#define __GST_GL_BASE_SRC_H__

#include <gst/base/gstpushsrc.h>
#include <gst/gl/gstgl_fwd.h>

G_BEGIN_DECLS

GST_GL_API
GType gst_gl_base_src_get_type(void);

#define GST_TYPE_GL_BASE_SRC            (gst_gl_base_src_get_type())
#define GST_GL_BASE_SRC(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_BASE_SRC,GstGLBaseSrc))
#define GST_GL_BASE_SRC_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_BASE_SRC,GstGLBaseSrcClass))
#define GST_IS_GL_BASE_SRC(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_BASE_SRC))
#define GST_IS_GL_BASE_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_BASE_SRC))
#define GST_GL_BASE_SRC_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_GL_BASE_SRC,GstGLBaseSrcClass))

/**
 * GstGLBaseSrc:
 * @display: the currently configured #GstGLDisplay
 * @context: the currently configured #GstGLContext
 * @out_caps: the currently configured output #GstCaps
 * @out_info: the currently configured output #GstVideoInfo
 * @running_time: the total running time
 *
 * The parent instance type of a base GStreamer GL Video source.
 *
 * Since: 1.18
 */
struct _GstGLBaseSrc {
  GstPushSrc parent;

  /*< public >*/
  GstGLDisplay *display;
  GstGLContext *context;

  /* video state */
  GstVideoInfo out_info;
  GstCaps *out_caps;

  /* total running time */
  GstClockTime running_time;

  /*< private >*/
  gpointer           _padding[GST_PADDING];

  GstGLBaseSrcPrivate *priv;
};

/**
 * GstGLBaseSrcClass:
 * @supported_gl_api: the logical-OR of #GstGLAPI's supported by this element
 * @gl_start: called in the GL thread to setup the element GL state.
 * @gl_stop: called in the GL thread to setup the element GL state.
 * @fill_gl_memory: called in the GL thread to fill the current video texture.
 *
 * The base class for GStreamer GL Video sources.
 *
 * Since: 1.18
 */
struct _GstGLBaseSrcClass {
  GstPushSrcClass parent_class;

  /*< public >*/
  GstGLAPI supported_gl_api;
  gboolean (*gl_start)          (GstGLBaseSrc *src);
  void     (*gl_stop)           (GstGLBaseSrc *src);
  gboolean (*fill_gl_memory)    (GstGLBaseSrc *src, GstGLMemory *mem);

  /*< private >*/
  gpointer _padding[GST_PADDING];
};

G_END_DECLS

#endif /* __GST_GL_BASE_SRC_H__ */