Commit graph

72 commits

Author SHA1 Message Date
Tim-Philipp Müller 69534fe9a0 gl: Update for g_type_class_add_private() deprecation in recent GLib 2018-06-24 01:37:08 +02:00
Sebastian Dröge 33a8e28207 videoaggregator: Switch to a GstVideoAggregatorConvertPad subclass
This moves all the conversion related code to a single place, allows
less code-duplication inside compositor and makes the glmixer code less
awkward. It's also the same pattern as used by GstAudioAggregator.
2018-05-06 15:22:51 +02:00
Sebastian Dröge d37e778692 glmixer: Include string.h for memset()
gstglmixer.c:143:5: error: implicit declaration of function ‘memset’ [-Werror=implicit-function-declaration]
     memset (prepared_frame, 0, sizeof (GstVideoFrame));
     ^~~~~~
gstglmixer.c:143:5: error: incompatible implicit declaration of built-in function ‘memset’ [-Werror]
2018-05-05 17:48:30 +02:00
Sebastian Dröge 1c8110ab17 videoaggregator: Move aggregated_frame and the pad buffer into the private struct
The aggregated_frame is now called prepared_frame and passed to the
prepare_frame and cleanup_frame virtual methods directly. For the
currently queued buffer there is a method on the video aggregator pad
now.
2018-05-05 16:32:19 +02:00
Sebastian Dröge 404b802846 glmixer: Move frame/texture mapping/unmapping into prepare/clean_frame
Previously we assumed that the texture ID is going to be valid even
after unmapping the frame, as it was immediately unmapped before even
being used. Now we only unmap once we're done with the texture.
2018-05-05 12:17:34 +02:00
Mathieu Duponchelle b59da8eced Port to latest GstAggregator segment API
The aggregator segment is now exposed on the src pad

https://bugzilla.gnome.org/show_bug.cgi?id=793946
2018-03-01 15:37:06 +01:00
Mathieu Duponchelle 14f886b7b0 aggregator: Remove klass->sinkpads_type
This posed problems for the python bindings (and possibly others).

Instead, subclasses now use add_pad_template_with_gtype.

https://bugzilla.gnome.org/show_bug.cgi?id=789986
2017-11-22 16:52:29 +01:00
Tim-Philipp Müller b798cfbece gl: use new gst_element_foreach_sink_pad()
Instead of gst_aggregator_iterate_sinkpads() which will
soon be removed.

https://bugzilla.gnome.org/show_bug.cgi?id=785679
2017-11-02 12:47:28 +00:00
Ponnam Srinivas 0ffa10652a glmixer: Unmap video frame in error case
https://bugzilla.gnome.org/show_bug.cgi?id=788127
2017-09-26 11:12:04 +03:00
Nicolas Dufresne c1f524f3a8 Request minimum buffer even if need_pool is FALSE
When tee is used, it will not request a pool, but still it wants to
know how many buffers are required.

https://bugzilla.gnome.org/show_bug.cgi?id=730758
2017-09-06 14:19:37 -04:00
Olivier Crête a2b0f2771a gl*mixer: Use propose_allocation from the GstAggregator base class
https://bugzilla.gnome.org/show_bug.cgi?id=782918
2017-05-21 18:17:54 +02:00
Olivier Crête b2d4a6835b glbasemixer: Remove own decide_allocation, use GstAggregator's
https://bugzilla.gnome.org/show_bug.cgi?id=746529
2017-05-21 13:24:29 +02:00
Olivier Crête 4a571db4c7 videoaggregator: Get the buffer from the pool if available
https://bugzilla.gnome.org/show_bug.cgi?id=746529
2017-05-21 13:24:29 +02:00
Matthew Waters 719498601f aggregator: add simple support for caps handling
Modelled off the videoaggregator caps handling as that seems the most
mature aggregtor-using implementation that has caps handling there is.

https://bugzilla.gnome.org/show_bug.cgi?id=776931
2017-05-20 16:21:17 +02:00
Matthew Waters c6bf4b36e6 glmixer: ensure caps are writable after intersection
gst_caps_intersect () may return an increased reference of one of the
input caps.

Fixes critical in the simple-launch-lines test:

Unexpected critical/warning: gst_caps_set_features: assertion 'IS_WRITABLE (caps)' failed
2017-01-18 15:07:48 +11:00
Matthew Waters b4301e2235 glutils: remove trivial helper function
gst_gl_caps_replace_all_caps_features() is only used in two places and can
be trivially reproduced.
2017-01-13 11:20:51 +11:00
Matthew Waters 5a74878988 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().
2016-07-26 14:07:24 +10:00
Matthew Waters c8c016ed17 gl: use GLMemory for accessing textures everywhere
This simplifies and consolidates a lot of duplicated code creating
and modifying textures.
2016-07-26 14:07:24 +10:00
Matthew Waters 0283c3d8aa gl/egl: replace gsteglimagememory with an EGLImage wrapper
That can be passed to GstGLMemoryEGL.

This also ports the dmabuf uploader to GstEGLImage and GstGLMemoryEGL.
2016-05-04 13:31:48 +10:00
Matthew Waters 71877db25f glmixer: set the current texture to 0 before mapping
If we fail mapping, we don't want to use undefined video data in the subclass.
2016-04-05 16:24:53 +10:00
Vineeth TM 8741806671 bad: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763081
2016-03-24 14:56:51 +02:00
Matthew Waters 03d1f755fa glmixer: Remove usage of GstGLMixerFrameData
Subclasses can just iterate over the list of pads themselves

https://bugzilla.gnome.org/show_bug.cgi?id=760873
2016-02-17 10:30:45 +11:00
Matthew Waters a3b2d36abd glmixer: don't hold the object lock while calling into GL
Doing so can deadlock between the GL thread and the object lock e.g.
when performing reconfigure events in glimagesink on a resize event.

https://bugzilla.gnome.org/show_bug.cgi?id=760559
2016-02-17 10:30:45 +11:00
Matthew Waters f1323fb6df videoaggregator: don't do caps processing that is not overridable
Allows the subclass to completely override the chosen src caps.

This is needed as videoaggregator generally has no idea exactly
what operation is being performed.

- Adds a fixate_caps vfunc for fixation
- Merges gst_video_aggregator_update_converters() into
  gst_videoaggregator_update_src_caps() as we need some of its info
  for proper caps handling.
- Pass the downstream caps to the update_caps vfunc

https://bugzilla.gnome.org/show_bug.cgi?id=756207
2016-01-27 20:36:25 +11:00
Nicolas Dufresne 1c66a33c56 gl: Don't leak pool if set_config failed 2015-07-02 09:40:05 -04:00
Sebastian Dröge fa6dbaeb6c glmixer: Implement GstVideoAggregator::find_best_format()
Without this, we will fixate weird pixel-aspect-ratios like 1/2147483647. But
in the end, all the negotiation code in videoaggregator needs a big cleanup
and videoaggregator needs to get rid of the software-mixer specific things
everywhere.
2015-05-11 16:34:26 +03:00
Sebastian Dröge ee275a167d Revert "gl: readd glupload/download onto element pads"
This reverts commit 87d8270f30.
2015-05-06 15:46:49 +02:00
Matthew Waters 2c7c82d748 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
2015-04-30 11:26:33 +10:00
Vineeth T M 52a40dfc48 glmixer: Possible null pointer dereference
While printing error message when context fails, error variable is not being used anymore
so it will lead to null pointer dereference

https://bugzilla.gnome.org/show_bug.cgi?id=748287
2015-04-22 22:33:28 +10:00
Guillaume Desmottes 9827138061 glmixer: fix caps leak in gst_gl_mixer_pad_sink_getcaps()
Caps refcounting was all wrong in this function. Rewrote it and add some
comments to make it clearer.

Fix caps leaks with the
validate.file.glvideomixer.simple.play_15s.synchronized scenario.

https://bugzilla.gnome.org/show_bug.cgi?id=747915

Signed-off-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
2015-04-20 09:05:11 +01:00
Guillaume Desmottes 516dc5e302 glmixer: unref owned caps when finalizing the mixer
Fix a caps leak with the
validate.file.glvideomixer.simple.play_15s.synchronized scenario.

https://bugzilla.gnome.org/show_bug.cgi?id=747915

Signed-off-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
2015-04-17 14:28:37 +01:00
Guillaume Desmottes 293d6a7ebe glmixer: pass the proper free function to frames and buffers array
'array_buffers' contain borrowed GstBuffer and so shouldn't have a free
function. 'frames' is the one containing GstGLMixerFrameData and so should use
_free_glmixer_frame_data as free function.

Fix GstGLMixerFrameData leaks with the
validate.file.glvideomixer.simple.play_15s.synchronized scenario.

https://bugzilla.gnome.org/show_bug.cgi?id=747913

Signed-off-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
2015-04-17 14:28:25 +01:00
Sebastian Dröge 78a1841c86 gl: Remove some empty ::finalize() implementations 2015-04-17 14:09:47 +02:00
Matthew Waters 875e5c0320 glsyncmeta: make context to wait and set sync explicit
otherwise we may wait on a sync object in same context by accident
2015-03-14 16:53:46 +00:00
Matthew Waters 4c72910825 gl: get the context from basemixer/basefilter 2015-03-13 12:30:20 +00:00
Matthew Waters b6cf2d9f21 glmixer: remove usage of upload/download objects 2015-03-12 16:45:51 +00:00
Matthew Waters d175b0be59 gl: add a new glbasemixer class below glmixer
It deals with propagating the gl display/contexts throughout the
application/pipeline
2015-03-12 16:45:50 +00:00
Nicolas Dufresne f433695b5d glmixer: Don't share our downstream pool with upstream
Pool cannot have multiple owner. This can lead to spurious
pool was flushing error.

https://bugzilla.gnome.org/show_bug.cgi?id=74570
2015-03-06 20:12:09 -05:00
Sebastian Dröge f153b9ee59 gl: Remove format info in glcolorconvert's transform_caps function instead of on every caller
... and let glmixer actually transform the caps it is supposed to transform
instead of inventing new caps.
2015-03-06 18:53:13 +01:00
Matthew Waters bae0d5755a gl: remove the egl caps from the src pads
we don't actually support producing EGLImage buffers anywhere.
2015-02-03 15:30:08 +11:00
Matthew Waters 47feb5e011 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.
2015-02-03 14:32:55 +11:00
Alessandro Decina 4860e179fa gl: initial support for texture targets other than GL_TEXTURE_2D
Make GstGLMemory hold the texture target (tex_target) the texture it represents
(tex_id) is bound to. Modify gst_gl_memory_wrapped_texture and
gst_gl_download_perform_with_data to take the texture target as an argument.

This change is needed to support wrapping textures created outside libgstgl,
which might be bound to a target other than GL_TEXTURE_2D. For example on OSX
textures coming from VideoToolbox have target GL_TEXTURE_RECTANGLE.

With this change we still keep (and sometimes imply) GL_TEXTURE_2D as the
target of textures created with libgstgl.

API: modify GstGLMemory
API: modify gst_gl_memory_wrapped_texture
API: gst_gl_download_perform_with_data
2015-01-30 00:34:08 +11:00
Matthew Waters 95a98d1d05 glvideomixer: don't upload if alpha <= 0
Implemented using a upload_buffer vfunc within GstGLMixer allowing
NULL uploaded buffers.
2015-01-15 09:50:02 +11:00
Matthew Waters bd04b36280 gl: split glcolorconvert usage from glupload
the separation allows the transfer operation to occur in a separate
thread/time which may increase performance in specific circumstances.
2015-01-14 22:22:13 +11:00
Tim-Philipp Müller 13af5efb07 glmixer, glvideomixer: update for GstAggregatorPadForeachFunc change 2014-12-30 19:43:43 +00:00
Tim-Philipp Müller 6ad57a882a glmixer: update for aggregator start/stop vfunc change 2014-12-30 19:26:47 +00:00
Matthew Waters c90f7001b1 gldisplay: implement runtime GL api filtering
Needed so that the pipeline/application can limit the choice of GL api
to what it supports
2014-11-28 09:14:26 +11:00
Matthew Waters 8f86923b00 gl: add a sync meta for synchronizing across GL contexts
A context can create a GLsync object that can be waited on in order
to ensure that GL resources created in one context are able to be
used in another shared context without any chance of reading invalid
data.

This meta would be placed on buffers that are known to cross from
one context to another.  The receiving element would then wait
on the sync object to ensure that the data to be used is complete.
2014-11-28 09:14:25 +11:00
Thibault Saunier 8cc214fdb8 videoaggregator: Expose vmethods to set converters and prepare/clean frames
This gives more flexibility to the subclasses and permits to remove the
GstVideoAggregatorClass->disable_frame_conversion ugly API.

WARNING: This breaks the API as it removes the disable_frame_conversion
field

API:
  + GstVideoAggregatorClass->find_best_format
  + GstVideoAggregatorPadClass->set_format
  + GstVideoAggregatorPadClass->prepare_frame
  + GstVideoAggregatorPadClass->clean_frame

  - GstVideoAggregatorClass->disable_frame_conversion

https://bugzilla.gnome.org/show_bug.cgi?id=740768
2014-11-27 19:10:58 +01:00
Matthew Waters c337aab991 glupload: rearchitecture for non GLMemory inputs/outputs
Allows other memory types to be implemented/returned/used by the caller.
2014-11-23 17:13:36 +11:00