Commit graph

442 commits

Author SHA1 Message Date
Matthew Waters
50b59150fd glviewconvert: remove set_format
We need the caps to be able to
1. check the caps features
2. get the requested texture-target on input/output
2015-11-11 15:16:37 +11:00
Matthew Waters
715f3bb828 glimagesink: fix a memory leak if the view conversion fails 2015-11-11 14:41:38 +11:00
Matthew Waters
2bc391851e glimagesink: balance the creation/destruction of the overlay compositor
Fixes some leaks/possible segfault on when failing to create the compositor.
2015-11-11 14:41:38 +11:00
Matthew Waters
0602539f1b glimagesink: wait on the provided sync meta provided to glimagesink 2015-11-10 15:42:35 +11:00
Tim-Philipp Müller
02c9247d54 glmixerbin: fix minor leak
Don't leak removed list node.
2015-11-06 13:00:55 +00:00
Matthew Waters
1c05479715 glcolorconvert: remove unused ret variable 2015-10-30 14:43:23 +11:00
Matthew Waters
ccce217502 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.
2015-10-30 14:24:53 +11:00
Matthew Waters
e61d504556 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.
2015-10-30 14:24:53 +11:00
Matthew Waters
de808c6439 opengl: build/provide glstereomix/split on gles only systems 2015-10-27 15:30:58 +11:00
Matthew Waters
09976e021b 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.
2015-10-26 18:24:59 +11:00
Matthew Waters
d81a96c81c glshaderelement: free the vertex and fragment strings on finalize
Fixes a memory leak when using the vertex/fragment properties.
2015-10-21 05:35:03 +11:00
Matthew Waters
71b4ae1f43 glshaderelement: remove unneeded reference to <gst/gl/gstglshadervariables.h> 2015-10-21 05:01:29 +11:00
Matthew Waters
70be81ad92 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.
2015-10-21 04:28:59 +11:00
Matthew Waters
5f4f240ada 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.
2015-10-21 04:05:00 +11:00
Matthew Waters
3dfc6899ad 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'
2015-10-19 15:15:30 +11:00
Matthew Waters
b9e1cd3732 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.
2015-10-17 16:10:41 +11:00
Matthew Waters
61b51b82ed gl/calayer: don't leak a gl shader object
We will always overwrite the ca_sink->redisplay_shader without freeing the
object.
2015-10-17 16:10:41 +11:00
Matthew Waters
9ad6872b5b gl/caopengllayersink: port to new GstGLShader API
fixes build error:
"undefined symbols for architecture:
gst_gl_shader_compile_with_default_vf_and_check"
2015-10-15 23:47:11 +11:00
Matthew Waters
7ddb05eab2 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.
2015-10-15 21:27:57 +11:00
Matthew Waters
b25807c382 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.
2015-10-15 21:27:57 +11:00
Nirbheek Chauhan
4977ec1189 glvideomixer: Proxy the ignore-eos videoaggregator property as well
Identical to how the z-order property is proxied
2015-10-06 16:57:53 +01:00
Matthew Waters
50b690cadb glcolorscale: use glbasefilter vfuncs
Uses less code \o/
Fixes legacy opengl rendering \o/
2015-10-01 23:20:19 +10:00
Matthew Waters
49e6516550 glupload: remove useless release_buffer
It's a leftover from when we weren't outputting GstBuffer's and
returning raw texture id's.
2015-09-30 13:36:09 +10:00
Matthew Waters
609977a56b gl: chain up to the parent class for GstElement::set_context
https://bugzilla.gnome.org/show_bug.cgi?id=705579
2015-09-28 22:24:04 +10:00
Matthew Waters
2195dad288 gl: sprinkle some debug markers to ease debugging 2015-09-28 16:47:00 +10:00
Jan Schmidt
587e7c4a23 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.
2015-09-18 00:29:51 +10:00
Matthew Waters
557ca6fda5 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
2015-09-17 20:26:23 +10:00
Matthew Waters
d088a5294b gl/uploadelement: fail earlier if we could not upload the buffer 2015-09-17 20:21:43 +10:00
Vineeth T M
00438fdff0 gl: Fix GError leaks during failures
https://bugzilla.gnome.org/show_bug.cgi?id=755140
2015-09-17 11:52:55 +02:00
Matthew Waters
7ae0dd2361 glimagesink: avoid updating the viewport in the draw loop
Fixes flashes/incorrect aspect ratio when resizing glimagesink on OSX.
2015-09-16 18:04:51 +10:00
Nicolas Dufresne
ae6f4a261b 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
2015-08-25 13:20:52 -04:00
Nicolas Dufresne
b06fc679ba 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
2015-08-25 13:20:52 -04:00
Nicolas Dufresne
88d7b22d40 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.
2015-08-22 22:15:36 -07:00
Nicolas Dufresne
206638c439 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
2015-08-22 22:15:36 -07:00
hoonhee.lee
cdd484800a caopengllayersink: Don't chain up to parent's query handling twice for DRAIN query
https://bugzilla.gnome.org/show_bug.cgi?id=753913
2015-08-21 11:10:42 +03:00
Nicolas Dufresne
f935b2c547 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.
2015-08-15 15:55:08 +02:00
Nicolas Dufresne
ea484fb968 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.
2015-08-15 15:55:08 +02:00
Matthew Waters
b38f107bd3 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.
2015-08-12 00:25:35 +02:00
Matthew Waters
b7777b9181 gl: use gles2 shaders everywhere
This effectively limits a glfilter subclass to be > GL(ES) 2.0.
rather than a possible GL 1.4.
2015-08-10 16:38:32 +02:00
Lubosz Sarnecki
80d77aa0a5 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
2015-08-08 16:32:53 -04:00
Matthew Waters
374cd2a570 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.
2015-08-03 20:08:52 +10:00
Luis de Bethencourt
22baf364fe gstglfilterbin: remove unused variable
res is set multiple times but never used or returned. Removing it.
2015-07-30 11:12:26 +01:00
Luis de Bethencourt
82a2b43bdd glstereomix: remove redundant initialization
v is initialized in the for loop init, no need to do it twice. Removing
first initialization.
2015-07-29 17:49:01 +01:00
Julien Isorce
fb6457e90a caopengllayersink: remove unused label context_creation_error
Build error introduced by commit
5457e55f25

https://bugzilla.gnome.org/show_bug.cgi?id=750310
2015-07-24 00:02:32 +01:00
Tim-Philipp Müller
2992ff98e5 glimagesink: fix allocation meta structure leak
gst_query_add_allocation_meta() does not take ownership
of the structure, for some reason.

CID 1312135
2015-07-23 11:23:41 +01:00
Olivier Crête
6edf8dbaa6 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
2015-07-22 20:59:50 -04:00
Nicolas Dufresne
4f4aedecf3 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
2015-07-22 17:00:25 -04:00
Nicolas Dufresne
17788157a1 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
2015-07-22 13:17:18 -04:00
Lubosz Sarnecki
b155f5d73e gloverlaycompositor: Create own shader object
Make gloverlaycompositor independent of the shader used in the sink.

https://bugzilla.gnome.org/show_bug.cgi?id=745107
2015-07-22 13:16:39 -04:00
Nicolas Dufresne
e8c31619c4 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
2015-07-22 13:07:58 -04:00
Julien Isorce
5457e55f25 caopengllayersink: use gst_gl_display_create_context
https://bugzilla.gnome.org/show_bug.cgi?id=750310
2015-07-21 14:55:35 +01:00
Julien Isorce
6fc5b18138 glstereosplit: use gst_gl_display_create_context
Also unlock the lock on error.

https://bugzilla.gnome.org/show_bug.cgi?id=750310
2015-07-21 14:55:11 +01:00
Julien Isorce
57f389d9ce gl: use gst_gl_display_create_context in more elements.
glbasefilter, glbasemixer and gltestsrc.

https://bugzilla.gnome.org/show_bug.cgi?id=750310
2015-07-21 11:37:21 +01:00
Lubosz Sarnecki
2b7542400c glimagesink: Send reconfigure event when window size changes
https://bugzilla.gnome.org/show_bug.cgi?id=745107
2015-07-20 14:41:12 -04:00
Lubosz Sarnecki
2fb862b34f 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
2015-07-20 14:41:12 -04:00
Lubosz Sarnecki
a7d1b7fcad glimagesinkbin: Add GstVideoOverlayCompositionMeta caps features
https://bugzilla.gnome.org/show_bug.cgi?id=745107
2015-07-20 14:41:12 -04:00
Lubosz Sarnecki
778ad10518 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
2015-07-20 14:41:11 -04:00
Matthew Waters
0aaf9db1df glcolorconvertelement: propagate failure to convert buffer upstream
Rather than just silently continuing
2015-07-18 16:32:15 +10:00
Nicolas Dufresne
04beac6e0f 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.
2015-07-16 17:05:36 -04:00
Matthew Waters
d5a39896dc download: only start a download transfer for sysmem caps features 2015-07-07 22:38:08 +10:00
Matthew Waters
2b9dddbafe 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
2015-07-07 15:32:13 +10:00
Matthew Waters
26df88cd24 gl: consolidate egl header includes to egl-only headers
They may conflict with other headers.
2015-07-07 13:12:49 +10:00
Olivier Crête
81b9d1531d glvideomixer, glmixer: Add description and klass 2015-07-03 12:28:47 -04:00
Nicolas Dufresne
fe283a9aeb gl: Don't leak pool if set_config failed 2015-07-02 09:40:05 -04:00
Vineeth TM
8ec2e0ad62 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
2015-07-02 11:34:10 +01:00
Luis de Bethencourt
be664ae40d 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
2015-06-29 16:10:50 +01:00
Nicolas Dufresne
11150e3bea glimagesink: Don't leak pool
gst_query_add_allocation_pool is transfer none. Also unref
if there was a configuration error.
2015-06-26 14:59:15 -04:00
Julien Isorce
66d833fcf2 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
2015-06-19 13:10:30 +01:00
Julien Isorce
5b003b68ca Revert "gl: add GstGLContextGPUProcess backend"
This reverts commit b377112ee3.
2015-06-19 13:08:49 +01:00
Jan Schmidt
b973f9473e glimagesink: Remove duplicate, useless line of code 2015-06-19 14:37:24 +10:00
Nicolas Dufresne
c2b49fa732 opengl: glstero* are only built with full OpenGL
Don't try to register the elements unless they are built.
2015-06-18 22:11:05 -04:00
Jan Schmidt
eefdb2ed86 gl: Add glviewconvert, glstereomix and glstereosplit elements
Conversion elements for transforming multiview/stereoscopic video

https://bugzilla.gnome.org/show_bug.cgi?id=611157
2015-06-19 01:49:33 +10:00
Jan Schmidt
00d6fe9068 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
2015-06-19 01:49:33 +10:00
Matthew Waters
890de823e6 glimagesink: add missing handle-events/ignore-alpha property to the bin 2015-06-15 22:44:31 +10:00
Matthew Waters
4796cef882 glmixerbin: implement proper dynamic pad removal
https://bugzilla.gnome.org/show_bug.cgi?id=750881
2015-06-13 18:47:13 +10:00
Nicolas Dufresne
c72213ff8b 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
2015-06-12 20:14:37 -04:00
Matthew Waters
c3a47c910d 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.
2015-06-12 16:59:20 +10:00
Matthew Waters
cd2669fad1 gl: move basesink properties from glimagesinkbin to glsinkbin 2015-06-12 00:34:58 +10:00
Sebastian Dröge
e8a97877b4 gl: Use gst_object_ref_sink() for gl{filter,mixer,src}bin too 2015-06-11 15:22:04 +02:00
Sebastian Dröge
c1b43742bf glsinkbin: Use gst_object_ref_sink() for consistency with the video-sink property on playbin 2015-06-11 15:17:55 +02:00
Thiago Santos
045bfa10fe Fix a common typo: retreive -> retrieve
Seems to have been copy pasted around a few places
2015-06-05 09:43:35 -03:00
Matthew Waters
d914cc6e72 gl: consolidate internal_rgba_format into glmemory
Expose some useful value format conversion functions available in
GstGLMemory.
2015-06-02 16:33:44 +10:00
Matthew Waters
fac0cdc7ac glwindow: handle gst_video_overlay_set_render_rectangle 2015-05-31 16:04:13 +10:00
Julien Isorce
b377112ee3 gl: add GstGLContextGPUProcess backend
It builds its GL vtable from a proc address provided
by the application.
2015-05-27 17:22:40 +01:00
Julien Isorce
ba5bf50d5f 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.
2015-05-27 17:20:05 +01:00
Luis de Bethencourt
666a80236c gleffects: 'for' loop initial declaration
'for' loop initial declarations are not allowed in C89, moving the declarations
to before the 'for' loops.
2015-05-27 13:05:15 +01:00
Xavier Claessens
2bb01f9601 gloverlay: fix a leak
https://bugzilla.gnome.org/show_bug.cgi?id=749846
2015-05-26 16:49:55 -04:00
Xavier Claessens
53cd9e3e0e 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
2015-05-26 16:49:55 -04:00
Xavier Claessens
02b2c2edf6 gloverlay: remove unused type_file field
https://bugzilla.gnome.org/show_bug.cgi?id=749846
2015-05-26 16:49:55 -04:00
Matthew Waters
db9e0cf5c7 gleffects: properly initialize the shaders across contexts implementing multiple API's 2015-05-26 12:50:58 +10:00
Matthew Waters
cb482f13be gleffects_laplacian: fix shader compilation in gl3/gles2
https://bugzilla.gnome.org/show_bug.cgi?id=748393
2015-05-26 12:50:58 +10:00
Matthew Waters
9dcefacb3d gltransformation: fix DrawElements call for element array buffers
https://bugzilla.gnome.org/show_bug.cgi?id=749734
2015-05-25 17:39:08 +10:00
Sebastian Dröge
3230e51993 compositor/glvideomixer: Don't calculate PAR/DAR with unset GstVideoInfos
Otherwise we divide by zero.
2015-05-21 16:24:48 +03:00
Matthew Waters
d1419afef1 compositor/glvideomixer: fix up par handling
We were using the wrong formula

https://bugzilla.gnome.org/show_bug.cgi?id=749634
2015-05-21 01:04:38 +10:00
Matthew Waters
8157574d0f caopengllayersink: static const the indices array
the contents will never change anyway.
2015-05-20 00:56:44 +10:00
Matthew Waters
057130b93d 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
2015-05-20 00:36:48 +10:00
Matthew Waters
49c4d0850d caopengllayersink: update for GL3 element array buffer usage
fixes blank output
2015-05-20 00:36:48 +10:00
Matthew Waters
6a2d12bf47 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.
2015-05-20 00:36:48 +10:00
Matthew Waters
c6abd1632f glimagesink: free the vertex buffer when done
fixes a memory leak
2015-05-14 21:21:01 +10:00
Matthew Waters
0870e8785e gl: remove useless gl{En,Dis}able (GL_TEXTURE_*) calls
We are using shaders everywhere and so they are not needed
2015-05-14 16:42:09 +10:00