Commit graph

66 commits

Author SHA1 Message Date
Matthew Waters
69da104456 glutils: document functions 2017-12-09 19:32:26 +00:00
Matthew Waters
de6c39189f glutils: privatise matrix multiplication/videoaffinetransformation retrieval 2017-12-09 19:32:26 +00:00
Matthew Waters
ceda9dc1aa gl/utils: also take care of the local GL context in query functions
Simplifies a deduplicates a lot of code in elements retrieving/setting
the local OpenGL context.
2017-12-09 19:32:26 +00:00
Matthew Waters
d00a13f01d glutils: remove trivial helper function
gst_gl_caps_replace_all_caps_features() is only used in two places and can
be trivially reproduced.
2017-12-09 19:32:26 +00:00
Matthew Waters
8a1d31f6ab gl/utils: move gen_shader() to the plugin and remove del_shader()
gst_gl_context_del_shader() can be replaced by a g_object_unref().
gst_gl_context_gen_shader() should be replaced by using GstGLSLStage.
2017-12-09 19:32:24 +00:00
Matthew Waters
18ac98c58b gl: GST_GL_TYPE -> GST_TYPE_GL
Some deprecated symbols are kept for backwards compatibility
2017-12-09 19:32:23 +00:00
Matthew Waters
9bafa08a5d gl/docs: massive update
- add Since: markers where necessary.
- document structs
- add documentation headers for each module (short_description,
  see_also, etc)
- reduce the number of warnings gtk-doc outputs
- fix spelling mistakes
2017-12-09 19:32:23 +00:00
Matthew Waters
3c1c5e9d83 glcontext: remove not thread-safe get/set_error()
Use GError's instead if necessary.
2017-12-09 19:32:21 +00:00
Matthew Waters
4bbda2b626 glframebuffer: rewrite for a more consistent API
Facilities are given to create fbo's and attach GL memory (renderbuffers
or textures).  It also keeps track of the renderable size for use with
effective use with glViewport().
2017-12-09 19:32:21 +00:00
Matthew Waters
072b47d5b8 glutils: remove unused functions for texture creation/deletion
Everyone uses GstGLMemory now and any future code should as well.
2017-12-09 19:32:20 +00:00
Haihua Hu
3cf27dd1c8 glimagesink: support video rotation using transform matrix
Add "rotate-method" to glimagesink and apply transform matrix
to vertex coordinate to control rotation.

https://bugzilla.gnome.org/show_bug.cgi?id=765795
2017-12-09 19:32:20 +00:00
Matthew Waters
2d62b2910c gl: take the affine transformation in NDC
Provide a function to get the affine matrix in the meta in terms of NDC
coordinates and use as a standard opengl matrix.

Also advertise support for the affine transformation meta in the allocation
query.
2017-12-09 19:32:19 +00:00
Matthew Waters
2ba61c9049 glutils: remove custom code for setting caps features
Just use gst_caps_set_features() instead.
2017-12-09 19:32:17 +00:00
Matthew Waters
31b1094744 gl: misc docs fixes/additions 2017-12-09 19:32:17 +00:00
Matthew Waters
86110c4765 glupload: always add texture-target field to GL caps
1. Various elements/base classes only perform a subset check on accept-caps
2. Some GL elements have texture-target in their pad template
3. When checking subsets, only the caps to check are allowed to contain extra
   fields.  If the 'template' caps have extra fields, the subset fails.
Thus without texture-target on the caps, various accept-caps implementations
were failing.

Also, add some convenience functions for setting and retrieving
texture targets to/from GValue.

https://bugzilla.gnome.org/show_bug.cgi?id=759860
2017-12-09 19:32:14 +00:00
Matthew Waters
caee3e41f9 gl: add convenience function for the start of a video frame
Get's the start of the video frame based on a GstVideoInfo and
GstVideoAlignment.
2017-12-09 19:32:12 +00:00
Reynaldo H. Verdejo Pinochet
68e668168d Remove unnecessary NULL checks before g_free()
g_free() is NULL-safe
2017-12-09 19:32:11 +00:00
Matthew Waters
117fc0409a glshader: properly unref the stages on failure
When failing in the varargs functions, all the stage objects not handled need to
be unreffed to prevent a leak.
2017-12-09 19:32:11 +00:00
Alessandro Decina
7fedb34bea gstglutils: fix shader compilation on Mountain Lion
Make gst_gl_context_gen_shader/_compile_shader assume GST_GLSL_PROFILE_ES |
GST_GLSL_PROFILE_COMPATIBILITY as the profile. Without this, the shader compiler
doesn't inject the #version tag resulting in a compilation error on Mountain
Lion.

This is a workaround for old code using gst_gl_context_gen_shader. New code
should use the gst_glsl_stage_* API directly which allows the caller to
explicitly specify version/profile.
2017-12-09 19:32:10 +00:00
Matthew Waters
f688a8f0b2 glshader: port to using GstGLSLStage objects for string management
A GstGLShader is now simply a collection of stages that are
compiled and linked together into a program.  The uniform/attribute
interface has remained the same.
2017-12-09 19:32:09 +00:00
Matthew Waters
16ee1636dc gl: move debugging related functions to their own file 2017-12-09 19:32:09 +00:00
Matthew Waters
0580536fa1 glutils: use gst_element_set_context for setting display/other_context
1. So we get tracking inside GstElement properly when e.g. adding to a bin
2. Removes redundant code.  Now only one place where
   GstContext->GstGLDisplay/GstGLContext transformation occurs
3. Fixes a memory leak in the process
4. Make the retrieval of debug categories thread safe
2017-12-09 19:32:09 +00:00
Matthew Waters
dc469454d7 gl: set the context on the element on a context query
Otherwise it's possible to lose the context information if the
context is only propagated through queries.
2017-12-09 19:32:09 +00:00
Matthew Waters
c486b1b3b0 gl/utils: add a function to insert a debug marker
These markers are visible in tools that record the GL function calls
such as apitrace, et al.

Makes it easier to match up GL draw commands with specific elements.
2017-12-09 19:32:08 +00:00
Matthew Waters
1e9f7b6303 gl: consolidate internal_rgba_format into glmemory
Expose some useful value format conversion functions available in
GstGLMemory.
2017-12-09 19:32:03 +00:00
Matthew Waters
79f4a5fcf3 gl/utils: implement wayland display GstContext
requried for sharing GL contexts or subsurface support
2017-12-09 19:32:03 +00:00
Julien Isorce
fce0e0ba3c gl: add and use gst_gl_internal_format_rgba
Previously when compiling GstGL with both GL and GLES2,
GL_RGBA8 was picked from GL/gl.h. But a clash may happen at
runtime when one is selecting GLES2.

gst_gl_internal_format_rgba allows to check at runtime
if it should use GL_RGBA or GL_RGBA8.
2017-12-09 19:32:02 +00:00
Sebastian Dröge
51d3a0a059 Revert "gl: readd glupload/download onto element pads"
This reverts commit 87d8270f30.
2017-12-09 19:32:00 +00:00
Matthew Waters
343947f383 gl: readd glupload/download onto element pads
Allows insertion of gl elements into non-gl pipelines without converter
(upload/download) elements.

https://bugzilla.gnome.org/show_bug.cgi?id=743974
2017-12-09 19:32:00 +00:00
Julien Isorce
a51680b1b3 gl: avoid overwriting display and context to NULL
It happens when the application provides display
and/or context.
2017-12-09 19:31:57 +00:00
Matthew Waters
6d4cca89ef glutils: expose running a query on a set of src/sink pads 2017-12-09 19:31:56 +00:00
Jan Schmidt
6350c35352 Remove a bunch of silly ';;' typos at the end of lines 2017-12-09 19:31:56 +00:00
Matthew Waters
530ae2cbb0 glupload/download/convert: provide transform_caps functions
Allows finer grain decisions about formats and features at each
stage of the pipeline.
Also provide propose_allocation for glupload besed on the supported
methods.
2017-12-09 19:31:54 +00:00
Nicolas Dufresne
a1e02726ee gl: Add support for GstVideoAlignment
This allow saving a copy with libav video decoders or decoders with
similar padding requirement.

https://bugzilla.gnome.org/show_bug.cgi?id=740900
2017-12-09 19:31:52 +00:00
Matthew Waters
892d056a44 gl: remove the use of glu 2017-12-09 19:31:51 +00:00
Matthew Waters
d738b78229 glutils: only attempt getting the app context when we don't already have a display
avoids querying/messaging the world on each frame
2017-12-09 19:31:49 +00:00
Matthew Waters
6811c39ff9 gl/examples: update for other-context property removal 2017-12-09 19:31:49 +00:00
Matthew Waters
62e3c40d97 gl: propogate other-context using GstContext 2017-12-09 19:31:48 +00:00
Wang Xin-yu (王昕宇)
c8d1e4ad5f gl: check null before unref GstGLDisplay 2017-12-09 19:31:45 +00:00
Matthew Waters
a76fe07919 gl: don't take an extra ref on the display on set_context
gst_context_get_gl_display() returns a ref.  Don't take another in
gst_object_replace().
2017-12-09 19:31:45 +00:00
Matthew Waters
4a8b31afd6 glfeature: remove GST_GL_API_GLES3
instead check the gl version using gst_gl_context_check_gl_version()
2017-12-09 19:31:42 +00:00
Julien Isorce
4bc96ae4cd gl: allow to avoid calling glTexImage2D(w, h, NULL) when generating a texture
Just pass 0 as width or height to gst_gl_context_gen_texture.
2017-12-09 19:31:39 +00:00
Jan Schmidt
cf018389e1 gl: Reduce noisy Info level output to LOG 2017-12-09 19:31:38 +00:00
Julien Isorce
c2471aec81 gl: add EGLImage support
* picked from old libgstegl:
  - GstEGLImageMemory
  - GstEGLImageAllocator
  - last_buffer management from removed GstEGLImageBufferPool

* add-ons:
  - GstEGLImageMemory now old a reference on GstGLContext
    so that it can delete the EGLImage and its gltexture source
    while having the associated gl context being current.
  - add EGLImage support for GstVideoGLTextureUploadMeta which
    mainly call EGLImageTargetTexture2D
  - GstGLBufferPool now supports GstEGLImageAllocator
  - glimagesink / glfilters / etc.. now propose GstEGLImageAllocator
    to upstream

https://bugzilla.gnome.org/show_bug.cgi?id=703343
2017-12-09 19:31:35 +00:00
Matthew Waters
d55eb1e859 gl: fix undeclared symbol when building without GST_DEBUG 2017-12-09 19:31:34 +00:00
Matthew Waters
e51e0a8869 gl: fix a double unref of the query when building without X 2017-12-09 19:31:34 +00:00
Matthew Waters
312741634d gl: silence a compiler warning about missing prototypes 2017-12-09 19:31:34 +00:00
Matthew Waters
f64292325d gl/utils: add x11 GstContext handling
https://bugzilla.gnome.org/show_bug.cgi?id=726360
2017-12-09 19:31:34 +00:00
Matthew Waters
e225af3e0d gl: silence all the compiler warnings 2017-12-09 19:31:34 +00:00
Matthew Waters
0fb0776432 [896/906] utils: use the vtable for deleting the texture 2017-12-09 19:31:34 +00:00