GstGLFilter

GstGLFilter

Synopsis

struct              GstGLFilter;
struct              GstGLFilterClass;
void                gst_gl_filter_draw_texture          (GstGLFilter *filter,
                                                         GLuint texture,
                                                         guint width,
                                                         guint height);
void                gst_gl_filter_render_to_target      (GstGLFilter *filter,
                                                         gboolean resize,
                                                         GLuint input,
                                                         GLuint target,
                                                         GLCB func,
                                                         gpointer data);
void                gst_gl_filter_render_to_target_with_shader
                                                        (GstGLFilter *filter,
                                                         gboolean resize,
                                                         GLuint input,
                                                         GLuint target,
                                                         GstGLShader *shader);
gboolean            gst_gl_filter_filter_texture        (GstGLFilter *filter,
                                                         GstBuffer *inbuf,
                                                         GstBuffer *outbuf);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----GstObject
               +----GstElement
                     +----GstBaseTransform
                           +----GstGLFilter

Properties

  "other-context"            GstGLContext*         : Read / Write

Description

Details

struct GstGLFilter

struct GstGLFilter;

GstGLFilter is a base class that provides the logic of getting the GL context from downstream and automatic upload/download for non-GstGLMemory GstBuffers.


struct GstGLFilterClass

struct GstGLFilterClass {
  GstBaseTransformClass base_transform_class;

  gboolean (*set_caps)          (GstGLFilter* filter, GstCaps* incaps, GstCaps* outcaps);
  gboolean (*filter)            (GstGLFilter *filter, GstBuffer *inbuf, GstBuffer *outbuf);
  gboolean (*filter_texture)    (GstGLFilter *filter, guint in_tex, guint out_tex);
  gboolean (*onInitFBO)         (GstGLFilter *filter);

  void (*onStart)               (GstGLFilter *filter);
  void (*onStop)                (GstGLFilter *filter);
  void (*onReset)               (GstGLFilter *filter);

  /* useful to init and cleanup custom gl resources */
  void (*display_init_cb)       (GstGLFilter *filter);
  void (*display_reset_cb)      (GstGLFilter *filter);
};

GstBaseTransformClass base_transform_class;

parent class

set_caps ()

mirror from GstBaseTransform

filter ()

perform operations on the input and output buffers. In general, you should avoid using this method if at all possible. One valid use-case for using this is keeping previous buffers for future calculations. Note: If filter exists, then filter_texture is not run

filter_texture ()

given in_tex, transform it into out_tex. Not used if filter exists

onInitFBO ()

perform initialization when the Framebuffer object is created

onStart ()

called when element activates see also GstBaseTransform

onStop ()

called when the element deactivates e also GstBaseTransform

onReset ()

called on inizialation and after onStop

display_init_cb ()

execute arbitrary gl code on start

display_reset_cb ()

execute arbitrary gl code at stop

gst_gl_filter_draw_texture ()

void                gst_gl_filter_draw_texture          (GstGLFilter *filter,
                                                         GLuint texture,
                                                         guint width,
                                                         guint height);

Draws texture into the OpenGL scene at the specified width and height.

filter :

a GstGLFilter

texture :

the texture to draw

width :

width of texture

height :

height of texture

gst_gl_filter_render_to_target ()

void                gst_gl_filter_render_to_target      (GstGLFilter *filter,
                                                         gboolean resize,
                                                         GLuint input,
                                                         GLuint target,
                                                         GLCB func,
                                                         gpointer data);

Transforms input into output using func on through FBO. resize should only ever be TRUE whenever input is the input texture of filter.

filter :

a GstGLFilter

resize :

whether to automatically resize the texture between the input size and the output size

input :

the input texture

target :

the output texture

func :

the function to transform input into output. called with data

data :

the data associated with func

gst_gl_filter_render_to_target_with_shader ()

void                gst_gl_filter_render_to_target_with_shader
                                                        (GstGLFilter *filter,
                                                         gboolean resize,
                                                         GLuint input,
                                                         GLuint target,
                                                         GstGLShader *shader);

Transforms input into output using shader on FBO. resize should only ever be TRUE whenever input is the input texture of filter.

See also: gst_gl_filter_render_to_target()

filter :

a GstGLFilter

resize :

whether to automatically resize the texture between the input size and the output size

input :

the input texture

target :

the output texture

shader :

the shader to use.

gst_gl_filter_filter_texture ()

gboolean            gst_gl_filter_filter_texture        (GstGLFilter *filter,
                                                         GstBuffer *inbuf,
                                                         GstBuffer *outbuf);

Perform automatic upload if needed, call filter_texture vfunc and then an automatic download if needed.

filter :

a GstGLFilter

inbuf :

an input buffer

outbuf :

an output buffer

Returns :

whether the transformation succeeded

Property Details

The "other-context" property

  "other-context"            GstGLContext*         : Read / Write

Give an external OpenGL context with which to share textures.