Commit graph

438 commits

Author SHA1 Message Date
Tim-Philipp Müller 212ed5523b glmixerbin: fix minor leak
Don't leak removed list node.
2017-12-09 19:32:10 +00:00
Matthew Waters c256f0285b glcolorconvert: remove unused ret variable 2017-12-09 19:32:10 +00:00
Matthew Waters 6141d3fc7e glcolorconvert: add support for converting texture targets
Solved with a simple shader templating mechanism and string replacements
of the necessary sampler types/texture accesses and texture coordinate
mangling for rectangular and external-oes textures.
2017-12-09 19:32:10 +00:00
Matthew Waters 681cb5b16d glmemory: add support for rectangle textures
Add the various tokens/strings for the differnet texture types (2D, rect, oes)

Changes the GLmemory api to include the GstGLTextureTarget in all relevant
functions.

Update the relevant caps/templates for 2D only textures.
2017-12-09 19:32:10 +00:00
Matthew Waters 68215b0a47 opengl: build/provide glstereomix/split on gles only systems 2017-12-09 19:32:10 +00:00
Matthew Waters cfb0d7e9f3 glviewconvert: expose the element on gles2 platforms
We can do everything with gles3 however gles2 restricts us not allowing
separated or frame-by-frame multiview modes due to multiple draw buffers.
2017-12-09 19:32:09 +00:00
Matthew Waters 89122224eb glshaderelement: free the vertex and fragment strings on finalize
Fixes a memory leak when using the vertex/fragment properties.
2017-12-09 19:32:09 +00:00
Matthew Waters 3f8edbee03 glshaderelement: remove unneeded reference to <gst/gl/gstglshadervariables.h> 2017-12-09 19:32:09 +00:00
Matthew Waters c3b69f3478 glimagesink: create a context in NULL_READY
So that it's possible for decoders et al. to request the OpenGL context
in their READY_PAUSED transition with decodebin/playbin.
2017-12-09 19:32:09 +00:00
Matthew Waters c766ca0381 glshaderelement: implement setting arbitrary uniforms
Currently float and int are supported by default. vec2, vec3, vec4
and mat4 are supported if graphene is used.  Of course if one wants
to set custom uniforms they can also be set using the create-shader
signal.
2017-12-09 19:32:09 +00:00
Matthew Waters 06de6998e5 gl: be consistent in gobject boilerpate
GST_GL_IS_* vs GST_IS_GL_*

git grep -l 'GST_GL_IS_' | xargs sed -i 's/GST_GL_IS_/GST_IS_GL_/g'
2017-12-09 19:32:09 +00:00
Matthew Waters 3a8fc708ee glshaderelement: implement on-demand create-shader signalling
One may not have an GstGLContext available or current in the thread where one
would need to update the shader.  Support this by signalling create-shader
whenever the one-shot 'update-shader' is set to TRUE.
2017-12-09 19:32:09 +00:00
Matthew Waters 9650e92bea gl/calayer: don't leak a gl shader object
We will always overwrite the ca_sink->redisplay_shader without freeing the
object.
2017-12-09 19:32:09 +00:00
Matthew Waters 2b3a224dc0 gl/caopengllayersink: port to new GstGLShader API
fixes build error:
"undefined symbols for architecture:
gst_gl_shader_compile_with_default_vf_and_check"
2017-12-09 19:32:09 +00:00
Matthew Waters ad4109dbec glshader: port element to GstGLSLStage
- Provide a shader property to set the full shader pipeline
- Provide vertex and fragment properties for just providing simple
  shader sources.
2017-12-09 19:32:09 +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
Nirbheek Chauhan 5890c51bd3 glvideomixer: Proxy the ignore-eos videoaggregator property as well
Identical to how the z-order property is proxied
2017-12-09 19:32:09 +00:00
Matthew Waters e01fc68c02 glcolorscale: use glbasefilter vfuncs
Uses less code \o/
Fixes legacy opengl rendering \o/
2017-12-09 19:32:09 +00:00
Matthew Waters 73bad9e856 glupload: remove useless release_buffer
It's a leftover from when we weren't outputting GstBuffer's and
returning raw texture id's.
2017-12-09 19:32:09 +00:00
Matthew Waters 8187171908 gl: chain up to the parent class for GstElement::set_context
https://bugzilla.gnome.org/show_bug.cgi?id=705579
2017-12-09 19:32:08 +00:00
Matthew Waters bf98930546 gl: sprinkle some debug markers to ease debugging 2017-12-09 19:32:08 +00:00
Jan Schmidt 7f20eedcae Don't throw compiler warnings with G_DISABLE_ASSERT
Disable code that warns about unused variables when G_DISABLE_ASSERT
is defined, as it is in tarballs and pre-releases.
2017-12-09 19:32:08 +00:00
Matthew Waters 25c109f850 glimagesink: request a resize on caps/3d mode changes
Fixes incorrect aspect ratio on OSX when changing caps or the 3d
output mode.

https://bugzilla.gnome.org/show_bug.cgi?id=755111
2017-12-09 19:32:08 +00:00
Matthew Waters 817f05cd70 gl/uploadelement: fail earlier if we could not upload the buffer 2017-12-09 19:32:08 +00:00
Vineeth T M 6944433677 gl: Fix GError leaks during failures
https://bugzilla.gnome.org/show_bug.cgi?id=755140
2017-12-09 19:32:08 +00:00
Matthew Waters b537e98ae7 glimagesink: avoid updating the viewport in the draw loop
Fixes flashes/incorrect aspect ratio when resizing glimagesink on OSX.
2017-12-09 19:32:08 +00:00
Nicolas Dufresne 5efb855edd glupload: Use base class metadata copy function
This allow properly copying selected meta, like the composition
overlay. Note that output buffer need to be readable, but GlUpload
keeps a ref. For now, simply drop GlUpload ref after perform,
leaving that ref has no purpose. The method shall be removed
in the future.

https://bugzilla.gnome.org/show_bug.cgi?id=754047
2017-12-09 19:32:08 +00:00
Nicolas Dufresne 741118fb73 glcolorconvert: Use base transform metadata copy
Use base class default method instead of only copying flags and
timestamp. This way, selected meta's like compostion overlay will
be passed downstream as expected.

https://bugzilla.gnome.org/show_bug.cgi?id=754047
2017-12-09 19:32:08 +00:00
Nicolas Dufresne 369acd42c9 glimagesink: update display size before sending event
This is minor issue, as the reconfigure event is asynchronous.
Basically, update width/height before sending the event.
2017-12-09 19:32:08 +00:00
Nicolas Dufresne d1cece731e gl: Let base transform relay the meta api for us
During allocation query, when this element is not passthrough, it must
relay the overlay compostion meta and it's parameters. Fortunatly, base
transform can do this for us.

https://bugzilla.gnome.org/show_bug.cgi?id=753850
2017-12-09 19:32:08 +00:00
hoonhee.lee 3edb758d5d caopengllayersink: Don't chain up to parent's query handling twice for DRAIN query
https://bugzilla.gnome.org/show_bug.cgi?id=753913
2017-12-09 19:32:08 +00:00
Nicolas Dufresne a342d95ca6 glsink: Enable sync meta on pools we offer
As the upload is asynchronous, we need to enable the sync meta to
gain correct rendering. The buffer pool receiver don't know about
that.
2017-12-09 19:32:07 +00:00
Nicolas Dufresne a3a0e0db30 glimagesink: Move overlay rendering after video rendering
This is mostly cosmetic, but heoretically it reduces the amount of
required object in the context at one point. It also avoids potential
conflicts.
2017-12-09 19:32:07 +00:00
Matthew Waters 83716a0586 glimagesink: take into account non 1/1 par for navigation
The current code was ignoring the par/dar aspect when transforming
from window coordinates to stream coordinates resulting in incorrect
coordinates being sent upstream in the navigation events.
2017-12-09 19:32:07 +00:00
Matthew Waters 3ba30d42a4 gl: use gles2 shaders everywhere
This effectively limits a glfilter subclass to be > GL(ES) 2.0.
rather than a possible GL 1.4.
2017-12-09 19:32:07 +00:00
Lubosz Sarnecki 6a58c684a7 gltransformation: implement pivot point for rotation and scale
https://bugzilla.gnome.org/show_bug.cgi?id=744763

Add a pivot vector for setting the origin of rotations and scales.

With the pivot point the rotation and scale operations can have
different origins. This adds the ability to rotate around different points.
Currently the default (0, 0) pivot point is possible,
a rotation around the center, and zooming into and out of the center.

With an pivot point this is optional.
I defined the following image coordinates for the pivot point:

	 (-1,1) ------------------------- (1,1)
		|			|
		|			|
		|			|
		|	  (0,0)		|
		|			|
		|			|
		|			|
	(-1,-1) ------------------------- (1,-1)

Example:

	Rotate the video at the bottom left corner

	gst-launch-1.0 videotestsrc \
			! gltransformation \
		 		scale-x=0.5 \
				scale-y=0.5 \
				rotation-z=25.0 \
				pivot-x=-1.0 \
				pivot-y=-1.0 \
			! glimagesink

The pivot-z option defines the pivot point in 3D space.
This only affects rotation, since we have no Z data to scale.
With this option a video can be rotated around a point in 3D space.

Example:

	Rotate around point behind the video:

    	gst-launch-1.0 videotestsrc \
			! gltransformation \
				rotation-x=10.0 \
				pivot-z=-4.0 \
			! glimagesink
2017-12-09 19:32:07 +00:00
Matthew Waters dec64d9036 glvideomixer: swap control binding proxy
The ref_object and object parameters were the wrong way around.

For the typical use case where an application is setting a
GstControlBinding on the returned ghost pad:
1. our control binding would be removed when the new one was set
2. sync_values calls were not being forwarded from the internal
   pad to the ghost pad.

If an application attempts to perform other control binding
operations (get_* family of functions) on the internal pad, they
will also be forwarded to the ghost pad where a possible
GstControlBinding will provide the necessary values.
2017-12-09 19:32:07 +00:00
Luis de Bethencourt b9a7cefae6 gstglfilterbin: remove unused variable
res is set multiple times but never used or returned. Removing it.
2017-12-09 19:32:07 +00:00
Luis de Bethencourt 52a9fe006f glstereomix: remove redundant initialization
v is initialized in the for loop init, no need to do it twice. Removing
first initialization.
2017-12-09 19:32:07 +00:00
Julien Isorce 485ad4f5c1 caopengllayersink: remove unused label context_creation_error
Build error introduced by commit
5457e55f25

https://bugzilla.gnome.org/show_bug.cgi?id=750310
2017-12-09 19:32:06 +00:00
Tim-Philipp Müller 0a2f2426b0 glimagesink: fix allocation meta structure leak
gst_query_add_allocation_meta() does not take ownership
of the structure, for some reason.

CID 1312135
2017-12-09 19:32:06 +00:00
Olivier Crête f59948c5c0 glvideomixer: Add GstControlBinding proxy
This is used to proxy GstControlBinding to the pad on the
parent object. This avoid having to sync the values in the proxy pad,
this is too early if you have a queue between the pad and the actual
aggregation operation.

https://bugzilla.gnome.org/show_bug.cgi?id=734060
2017-12-09 19:32:06 +00:00
Nicolas Dufresne 4cf2d84315 glupload: Forward composition meta even without params
When the sink does not know the window size (e.g not created yet)
it will not add any param to the the composition meta. This is no
reason not to forward this meta API. Fixes issue where it could not
attach until we resize the window.

https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Nicolas Dufresne 1812c19291 composition-overlay: Positions are relative to texture
The coordinate are relative to the texture dimension and not
the window dimension now. There is no need to pass the window
dimension or to update the overlay if the dimension changes.

https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Lubosz Sarnecki 8abd2bbe35 gloverlaycompositor: Create own shader object
Make gloverlaycompositor independent of the shader used in the sink.

https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Nicolas Dufresne 1fae4b199a glimagesink: Properly handle compsositor life time
Should be created in READY_TO_PAUSED, not PAUSED_TO_PLAYING.
Should be cleared in PAUSED_TO_READY.

https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Julien Isorce 32ddcf102c caopengllayersink: use gst_gl_display_create_context
https://bugzilla.gnome.org/show_bug.cgi?id=750310
2017-12-09 19:32:06 +00:00
Julien Isorce 6e7dc76b56 glstereosplit: use gst_gl_display_create_context
Also unlock the lock on error.

https://bugzilla.gnome.org/show_bug.cgi?id=750310
2017-12-09 19:32:06 +00:00
Julien Isorce f068020645 gl: use gst_gl_display_create_context in more elements.
glbasefilter, glbasemixer and gltestsrc.

https://bugzilla.gnome.org/show_bug.cgi?id=750310
2017-12-09 19:32:06 +00:00
Lubosz Sarnecki 91d4cfe2b0 glimagesink: Send reconfigure event when window size changes
https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Lubosz Sarnecki 052b0a1caf glimagesinkbin: Add allocation query for GstVideoOverlayComposition
Adds an GST_VIDEO_OVERLAY_COMPOSITION_META_API_TYPE query to glupload
and glimagesink.  Detects the query from the downstream elements, so
it is executed only when downstream supports the overlay API.

This makes pipelines with textoverlay ! glupload ! gldownload ! xvimagesink possible.
Uses allocation meta struct for passing the window size upstream.

https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Lubosz Sarnecki dc47e6d3c0 glimagesinkbin: Add GstVideoOverlayCompositionMeta caps features
https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Lubosz Sarnecki 1c0ddbd9a8 glimagesink: Upload and draw overlays with GstGLOverlayCompositor
Receives the GstOverlayComposition buffer in the glimagesink and draws them.

https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Matthew Waters 36408736c0 glcolorconvertelement: propagate failure to convert buffer upstream
Rather than just silently continuing
2017-12-09 19:32:05 +00:00
Nicolas Dufresne 5f38bcf905 uploadelement: Protect against NULL pointer
I notice that if you stop the pipeline during a renegotiation
the upload may be NULL while an allocation query is being run.
In that scenario, returning FALSE to the allocation query is the
best thing.
2017-12-09 19:32:05 +00:00
Matthew Waters b7a3b54b2a download: only start a download transfer for sysmem caps features 2017-12-09 19:32:05 +00:00
Matthew Waters e4af6201c0 gltransformation: correct vao usage
keep the vao bound after uploading the new vertex data

fixes a mesa GL error "no vertex array object bound" on caps changes
2017-12-09 19:32:05 +00:00
Matthew Waters afcb6aa1da gl: consolidate egl header includes to egl-only headers
They may conflict with other headers.
2017-12-09 19:32:05 +00:00
Olivier Crête 1c99bc92ca glvideomixer, glmixer: Add description and klass 2017-12-09 19:32:05 +00:00
Nicolas Dufresne b8d3c2d2a5 gl: Don't leak pool if set_config failed 2017-12-09 19:32:05 +00:00
Vineeth TM 5229b50125 glimagesink: use g_clear_error instead of g_error_free
replace g_error_free with g_clear_error, as it internally
checks if error variable is valid or not.

https://bugzilla.gnome.org/show_bug.cgi?id=751823
2017-12-09 19:32:05 +00:00
Luis de Bethencourt 237af0d21c gl: add missing break
gst_gl_view_convert_element_set_property() is missing a break at the end
of the PROP_OUTPUT_DOWNMIX_MODE case. Adding it.

CID #1308949
2017-12-09 19:32:05 +00:00
Nicolas Dufresne 0f3c34f05f glimagesink: Don't leak pool
gst_query_add_allocation_pool is transfer none. Also unref
if there was a configuration error.
2017-12-09 19:32:05 +00:00
Julien Isorce 76983d4454 gldisplay: add gst_gl_display_create_context
It also emits a create-context signal so that an application
can provide an external GstGLContext backend.

https://bugzilla.gnome.org/show_bug.cgi?id=750310
2017-12-09 19:32:04 +00:00
Julien Isorce e29e67fa6e Revert "gl: add GstGLContextGPUProcess backend"
This reverts commit b377112ee3.
2017-12-09 19:32:04 +00:00
Jan Schmidt dad74d40e1 glimagesink: Remove duplicate, useless line of code 2017-12-09 19:32:04 +00:00
Nicolas Dufresne 44a1492c30 opengl: glstero* are only built with full OpenGL
Don't try to register the elements unless they are built.
2017-12-09 19:32:04 +00:00
Jan Schmidt 020c7f1303 gl: Add glviewconvert, glstereomix and glstereosplit elements
Conversion elements for transforming multiview/stereoscopic video

https://bugzilla.gnome.org/show_bug.cgi?id=611157
2017-12-09 19:32:04 +00:00
Jan Schmidt 77676ffc90 glimagesink: Support multiview/stereoscopic video
Support video with multiview info in the caps, transform
it to mono anaglyph by default, but allow for configuring
other output modes and handoff to the app via
the draw signal.

https://bugzilla.gnome.org/show_bug.cgi?id=611157
2017-12-09 19:32:04 +00:00
Matthew Waters 5276b7ccbf glimagesink: add missing handle-events/ignore-alpha property to the bin 2017-12-09 19:32:04 +00:00
Matthew Waters 8c36e5193e glmixerbin: implement proper dynamic pad removal
https://bugzilla.gnome.org/show_bug.cgi?id=750881
2017-12-09 19:32:04 +00:00
Nicolas Dufresne ccc410e73c glimagesink: Don't do pool caching
We now know that pool caching can cause renegotiation issues
when an element in the pipeline change from passthrough to not
passthrough. As it's not needed, don't cache existing pools.

https://bugzilla.gnome.org/show_bug.cgi?id=748344
2017-12-09 19:32:04 +00:00
Matthew Waters 2210ba5d46 glmemory: separate pbo transfer from texture transfers
When supported, the potentially longer pbo upload/download can be
initiated before the texture upload/download, potentially increasing
throughput.
2017-12-09 19:32:04 +00:00
Matthew Waters dffa2857d7 gl: move basesink properties from glimagesinkbin to glsinkbin 2017-12-09 19:32:04 +00:00
Sebastian Dröge 3bfe8fcb5b gl: Use gst_object_ref_sink() for gl{filter,mixer,src}bin too 2017-12-09 19:32:04 +00:00
Sebastian Dröge 25c554a5e4 glsinkbin: Use gst_object_ref_sink() for consistency with the video-sink property on playbin 2017-12-09 19:32:04 +00:00
Thiago Santos 33b5cd5426 Fix a common typo: retreive -> retrieve
Seems to have been copy pasted around a few places
2017-12-09 19:32:03 +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 6c56aba687 glwindow: handle gst_video_overlay_set_render_rectangle 2017-12-09 19:32:03 +00:00
Julien Isorce 238edceda4 gl: add GstGLContextGPUProcess backend
It builds its GL vtable from a proc address provided
by the application.
2017-12-09 19:32:02 +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
Luis de Bethencourt 7361160673 gleffects: 'for' loop initial declaration
'for' loop initial declarations are not allowed in C89, moving the declarations
to before the 'for' loops.
2017-12-09 19:32:02 +00:00
Xavier Claessens 0280be02ca gloverlay: fix a leak
https://bugzilla.gnome.org/show_bug.cgi?id=749846
2017-12-09 19:32:02 +00:00
Xavier Claessens 01177670ea gloverlay: properly handle errors while loading file
Post an error on the bus if anything bad happens while reading
and parsing the image file.

https://bugzilla.gnome.org/show_bug.cgi?id=749846
2017-12-09 19:32:02 +00:00
Xavier Claessens 80914d1731 gloverlay: remove unused type_file field
https://bugzilla.gnome.org/show_bug.cgi?id=749846
2017-12-09 19:32:02 +00:00
Matthew Waters c55790143f gleffects: properly initialize the shaders across contexts implementing multiple API's 2017-12-09 19:32:02 +00:00
Matthew Waters b53178f724 gleffects_laplacian: fix shader compilation in gl3/gles2
https://bugzilla.gnome.org/show_bug.cgi?id=748393
2017-12-09 19:32:02 +00:00
Matthew Waters 1d796508e8 gltransformation: fix DrawElements call for element array buffers
https://bugzilla.gnome.org/show_bug.cgi?id=749734
2017-12-09 19:32:02 +00:00
Sebastian Dröge 5503937337 compositor/glvideomixer: Don't calculate PAR/DAR with unset GstVideoInfos
Otherwise we divide by zero.
2017-12-09 19:32:02 +00:00
Matthew Waters 44153e637b compositor/glvideomixer: fix up par handling
We were using the wrong formula

https://bugzilla.gnome.org/show_bug.cgi?id=749634
2017-12-09 19:32:01 +00:00
Matthew Waters f0ed0b728d caopengllayersink: static const the indices array
the contents will never change anyway.
2017-12-09 19:32:01 +00:00
Matthew Waters 56bd10a392 caopengllayersink: correctly use the sync meta across multiple contexts
1. Set the sync point after the (possible) upload has occured
2. Wait in the correct GL context (the draw context)

Note: We don't add the GL sync meta to the input buffer as it's not
writable and a copy would be expensive.

Similar to the change with the same name for glimagesink
2017-12-09 19:32:01 +00:00
Matthew Waters d6c4f850ea caopengllayersink: update for GL3 element array buffer usage
fixes blank output
2017-12-09 19:32:01 +00:00
Matthew Waters f272500ccb glimagesink: correctly use the sync meta across multiple contexts
1. Set the sync point after the (possible) upload has occured
2. Wait in the correct GL context (the draw context)

Note: We don't add the GL sync meta to the input buffer as it's not
writable and a copy would be expensive.
2017-12-09 19:32:01 +00:00
Matthew Waters 0e2fe3c2e9 glimagesink: free the vertex buffer when done
fixes a memory leak
2017-12-09 19:32:01 +00:00
Matthew Waters 72993f54fa gl: remove useless gl{En,Dis}able (GL_TEXTURE_*) calls
We are using shaders everywhere and so they are not needed
2017-12-09 19:32:01 +00:00
Matthew Waters ac793f691d glimagesink: cleanup properties
remove unused "display-name"
ensure defaults between the bin/element are the same
2017-12-09 19:32:01 +00:00
Matthew Waters 6c9f648462 gleffects: only try the GL2 shader init path if we have a GL2 context 2017-12-09 19:32:01 +00:00
Matthew Waters 65c57b77ff gl: element buffers are part of vao state
Use them as such.  They are also required for GL3 core profile support
with glDrawElements on OS X.
2017-12-09 19:32:01 +00:00
Matthew Waters 50d3161ac5 gl: don't deadlock on context creation failure
https://bugzilla.gnome.org/show_bug.cgi?id=749284
2017-12-09 19:32:01 +00:00