Commit graph

994 commits

Author SHA1 Message Date
Matthew Waters
b947c9805a glupload: allow NULL buffer for accept vfunc 2015-02-03 14:32:55 +11:00
Matthew Waters
917dcfdfee glupload: remove unsed convert field in private struct 2015-02-03 14:32:55 +11:00
Matthew Waters
c06715bde6 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
7d46357627 gstglwindow_cocoa: fix slow render rate
In gst_gl_window_cocoa_draw we used to just call setNeedsDisplay:YES. That was
creating an implicit CA transaction which was getting committed at the next
runloop iteration. Since we don't know how often the main runloop is running,
and when we run it implicitly (from gst_gl_window_cocoa_nsapp_iteration) we only
do so every 200ms, use an explicit CA transaction instead and commit it
immediately. CA transactions nest and debounce automatically so this will never
result in extra work.
2015-02-03 11:19:35 +11:00
Matthew Waters
ddcc580505 gstglcaopengllayer: use the correct rectangle type for iOS and OS X 2015-02-02 23:43:54 +11:00
Matthew Waters
ed7d7418c2 glcolorconvert: use the correct caps feature for supported caps
glcolorconvert currently only supports converting between GLMemory
targets.
2015-02-02 21:07:48 +11:00
Matthew Waters
abb55f2453 glsyncmeta: don't use the gst debug object variants
We are not a GObject or any inferable GstMiniObject supported by
the gst debug system.  Also fixes a segfault.
2015-02-02 20:51:31 +11:00
Alessandro Decina
b1aae5cb70 Revert "libgstgl: gstglcaopengllayer: set the layer as opaque"
This reverts commit 6f152d381c.

The layer shouldn't be always opaque, it should be made a property.
2015-01-30 12:32:17 +11:00
Alessandro Decina
6f152d381c libgstgl: gstglcaopengllayer: set the layer as opaque 2015-01-30 12:22:25 +11:00
Sebastian Dröge
c2492b3a6b glcolorconvert: Add FIXME comment about possibility of non-Apple YCbCr422 rectangular textures 2015-01-29 16:30:34 +01:00
Sebastian Dröge
4b6a968203 glcolorconvert: Only use GL_TEXTURE_RECTANGLE with OpenGL
It's not defined for GLES.
2015-01-29 16:26:26 +01:00
Alessandro Decina
3655e8b8bc libgstgl: run a custom shader to convert YUV to RGB on mac and ios
When GL_APPLE_ycbcr_422 is available, run a custom shader to convert
GL_TEXTURE_RECTANGLE textures from YUV to RGB.

See https://www.opengl.org/registry/specs/APPLE/ycbcr_422.txt
2015-01-30 00:34:08 +11:00
Alessandro Decina
5f547c5600 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
Alessandro Decina
12e8bb4a66 gstglcolorconvert: micro optimization
Don't call glClear && glClearColor at each draw since we're going to draw the
whole viewport anyway. Gets rid of a glFlush triggered by glClear on OSX.
2015-01-30 00:34:08 +11:00
Alessandro Decina
c7284a6390 gstglcolorconvert: relax caps features check
Require caps to have the GST_CAPS_FEATURE_MEMORY_GL_MEMORY feature but allow
them to have more features.
2015-01-30 00:34:08 +11:00
Matthew Waters
1e6011bcdf gl/win32: fixup compilation 2015-01-29 23:46:57 +11:00
Matthew Waters
6cf97eb221 glwindow: make showing a window explicit
Also fixes the cgl context always displaying a window to render to for
every GstGLContextCocoa created
2015-01-29 22:26:37 +11:00
Matthew Waters
6d9dc9c81c gl/calayer: add resize callback based on the bounds rectangle 2015-01-29 18:32:04 +11:00
Matthew Waters
2ab0e1517f gl/caopengllayer: draw asynchronously
This essentially makes the CAOpenGLLayer draw every refresh cycle.
2015-01-29 18:32:04 +11:00
Matthew Waters
f3273cafc4 gl/cocoa: don't segfault if we have a NULL draw/resize/close callback 2015-01-29 18:32:04 +11:00
Matthew Waters
8d5ba8d96a cgl/calayer: use a callback instead of hardcoding the draw functionality 2015-01-29 18:32:04 +11:00
Matthew Waters
693cdb47cd cgl: install the gl context and gl layer headers 2015-01-29 18:32:04 +11:00
Matthew Waters
9caf706185 cgl: add a header for the CAOpenGLLayer support 2015-01-29 18:32:04 +11:00
Philippe Normand
cfc0230e04 gl/dispmanx: fix build
Commit ab48bb6f0f changed the API of
GstGLWindow.
2015-01-27 21:31:21 +11:00
Matthew Waters
08dbd8bbd7 glmemory: more compatibility defines for gles2 systems 2015-01-27 14:52:47 +11:00
Matthew Waters
eea03967e4 glmemory: add some thread safety for gl operations 2015-01-27 12:26:05 +11:00
Matthew Waters
9a55a3f98c glmemory: use pbo's for download
In order to use pbo's efficiently, the transfer operation has to
be separated from the use of the downloaded data which requires some
rearchitecturing around glcolorconvert/gldownload and elements
2015-01-27 12:26:04 +11:00
Matthew Waters
f2667ebc7b glprototypes: add some (un)map buffer variants for GL/GLES 2015-01-27 12:26:04 +11:00
Matthew Waters
27e5e0c2df gl/window/eagl: fix a couple of typos 2015-01-23 16:52:25 +11:00
Matthew Waters
06fdbd44b9 glwindow: cleanup/reorganize functions/members into logical groups 2015-01-23 16:39:44 +11:00
Matthew Waters
ab48bb6f0f glwindow: remove width/height from _draw()
Depending on the platform, it was only ever implemented to 1) set a
default surface size, 2) resize based on the video frame or 3) nothing.
Instead, provide a set_preferred_size () that elements/applications
can use to request a certain size which may be ignored for
videooverlay/other cases.
2015-01-23 16:11:31 +11:00
Matthew Waters
4fc554054c glcontext/cocoa: avoid destroying a possibly 0 GSource id 2015-01-22 21:43:51 +11:00
Matthew Waters
e10d2417e2 gl/cocoa: move to CGL and CAOpenGLLayer for rendering
Removes the use of NSOpenGL* variety and functions.  Any Cocoa
specific functions that took/returned a NSOpenGL* object now
take/return the CGL equivalents.
2015-01-22 21:29:52 +11:00
Matthew Waters
fe8fdbdc7c glcontext/cocoa: add debug category 2015-01-22 21:27:44 +11:00
Sebastian Dröge
80e02cbdf9 Constify some static arrays everywhere 2015-01-21 10:18:50 +01:00
Lasse Laursen
174ea7af7b glapi: fix compilation with latest MSVC
https://bugzilla.gnome.org/show_bug.cgi?id=743041
2015-01-17 10:56:20 +11:00
Matthew Waters
989af902fe glmemory: use the correct size for the pbo
It was missing the GstVideoAlignment padding which could cause GL
errors related to overrunning the size of the pbo.
2015-01-17 10:56:20 +11:00
Matthew Waters
8fef381417 glmemory: remove spurious gst_video_info_align
That will be taken care of by the calling code (typically a bufferpool).
The GstVideoAlignment is purely informational to compute plane data sizes.
2015-01-15 09:50:02 +11:00
Matthew Waters
d5c3693791 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
Matthew Waters
4ccf45823e glmemory: offset the data pointer for upload for GstVideoAlignment
otherwise we attempt to read from the padding data
2015-01-14 22:22:13 +11:00
Matthew Waters
d1e923765b glmemory: use pbo's for upload 2015-01-14 22:22:13 +11:00
Matthew Waters
8c2d5dac72 glupload: relax the GLMemory uploader check for input caps features
As there may be a sysmem caps features with GLMemory filled buffers.
e.g.

videotestsrc ! glimagesink
2015-01-14 22:22:13 +11:00
Nicola Murino
442451a30d glcolorconvert: fix memleak
https://bugzilla.gnome.org/show_bug.cgi?id=741943
2015-01-13 15:20:34 +11:00
Nicola Murino
3c6d775766 glupload: fix some memory leaks
https://bugzilla.gnome.org/show_bug.cgi?id=741943
2015-01-13 15:19:39 +11:00
Matthew Waters
4c73e20553 glcontext: allow wrapped contexts to be utilised like non-wrapped contexts
Fill in the missing pieces like get_proc_address, the gl function vtable
2015-01-13 15:18:41 +11:00
Sebastian Dröge
fa5c433e7e gl/cocoa: Disable hack for NSApp iteration with a special #define
The hack causes deadlocks and other interesting problems and it really
can only be fixed properly inside GLib. We will include a patch for
GLib in our builds for now that handles this, and hopefully at some
point GLib will also merge a proper solution.

A proper solution would first require to refactor the polling in
GMainContext to only provide a single fd, e.g. via epoll/kqueue
or a thread like the one added by our patch. Then this single
fd could be retrieved from the GMainContext and directly integrated
into a NSRunLoop.

https://bugzilla.gnome.org/show_bug.cgi?id=741450
https://bugzilla.gnome.org/show_bug.cgi?id=704374
2015-01-10 15:54:30 +01:00
Sebastian Dröge
1b2de14000 gl/cocoa: Don't init and clear static GMutex / GCond
We would potentially use it from the main loop later in
gst_gl_window_cocoa_init_nsapp() if it timed out before.
2015-01-08 09:36:24 +01:00
Luis de Bethencourt
75cc750efc glfilter: remove logically dead code
Soon after setting two variables to 1, the code checks if their values are
different from each other. This would never be true. Removing this.

CID 1226443
2015-01-07 16:53:41 +00:00
Nicolas Dufresne
207308446b glbufferpool: Always recalculate buffer size
Actually we should always recalculate buffer size since our buffer size
even when not-padded is smaller for many sub-sampled formats. This is
because we don't add padding between the planes.

https://bugzilla.gnome.org/show_bug.cgi?id=740900
2014-12-19 12:25:41 -05:00
Nicolas Dufresne
170a49f901 glmemory: No need for padding
A memory object cannot be put on stack, so no need for padding.
2014-12-19 12:12:08 -05:00
Nicolas Dufresne
9954de1ccd 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
2014-12-19 12:11:08 -05:00
Nicolas Dufresne
da3ae06cd1 glmemory: Handle upload/download flags from map
Problem was that if buffer was mapped READWRITE (state of buffers from
libav right now), mapping it READ/GL will not upload. This is because the
flag is only set when the buffer is unmapped. We can fix this by setting
the flags in map. This result in already mapped buffer that get mapped
to be read in GL will be uploaded. The problem is that if the write
mapper makes modification afterward, the modification will never get
uploaded.

https://bugzilla.gnome.org/show_bug.cgi?id=740900
2014-12-19 11:45:35 -05:00
Nicolas Dufresne
4f3c33af3a glmemory: Handle custom stride with OPENGL3
https://bugzilla.gnome.org/show_bug.cgi?id=740900
2014-12-19 11:45:35 -05:00
Wang Xin-yu (王昕宇)
15eab1ed01 glfilter: fix position/texcoord attrib index usage
https://bugzilla.gnome.org/show_bug.cgi?id=741231
2014-12-11 19:41:23 +11:00
Matthew Waters
f021549294 gl: fixup vao and vbo usage for legacy GL 2014-12-11 19:41:23 +11:00
Philippe Normand
c4ba73e39b glsyncmeta: add G_END_DECLS 2014-12-04 01:36:38 +11:00
Julien Isorce
230022fe62 glcontext: try cgl before glx
It was already done by commit
f506e80686
but it has been broken by commit
45ec777cea
2014-12-03 08:02:58 +00:00
Matthew Waters
90a2477b9e glcontext: require GL_ARB_ES2_compatibility for opengl3
until we generate gl3 compliant shaders

https://bugzilla.gnome.org/show_bug.cgi?id=740012
2014-11-30 00:44:46 +11:00
Matthew Waters
e653ae9fc2 gl: fixup compat definition for GLuint64 for OS X 2014-11-28 13:04:21 +11:00
Matthew Waters
b0faa2dd77 gl: add compat definition for GLuint64 for android
../../../../gst-libs/gst/gl/glprototypes/sync.h:41:23: error: unknown type name 'GLuint64'
                       GLuint64 timeout))
2014-11-28 11:57:25 +11:00
Matthew Waters
3e92a8ef53 glsync: fix build with desktop gl 2014-11-28 11:11:43 +11:00
Matthew Waters
57898fec2a gl: fix various build errors without desktop gl 2014-11-28 10:59:46 +11:00
Matthew Waters
f67190d3ca gldisplay: fix build error
gstgldisplay.c:234:541: error: 'return' with no value, in function returning non-void [-Werror]
   g_return_if_fail (GST_IS_GL_DISPLAY (display));
2014-11-28 10:03:18 +11:00
Matthew Waters
3c1e77eb31 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
6bd1150ca8 gl: remove the use of glu 2014-11-28 09:14:26 +11:00
Matthew Waters
f2af65ee2d 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
Matthew Waters
480d3f97eb glprototypes: add sync function definitions 2014-11-28 09:14:25 +11:00
Matthew Waters
6d39e04992 glfilter: add a gl3 code path using vao's and vbo's 2014-11-28 09:14:25 +11:00
Matthew Waters
5ff5f8c1ee glframebuffer: add support for gl3 2014-11-28 09:14:25 +11:00
Matthew Waters
a32f29f2ce glcolorconvert: add support for gl3 2014-11-28 09:14:25 +11:00
Matthew Waters
fca0bc97a4 glshader add support for gl3 2014-11-28 09:14:25 +11:00
Matthew Waters
2c24b97cf0 glx: ask for a GL3 core context 2014-11-28 09:14:25 +11:00
Sebastian Dröge
082c12b8e2 glcolorconvert: Unref buffer with the correct function 2014-11-27 18:09:58 +01:00
Sebastian Dröge
b6ba579fa0 glmemory: Handle failure of memory allocation gracefully 2014-11-27 18:09:14 +01:00
Sebastian Dröge
f2dc9b2b8f glmemory: Use g_try_malloc() in the appropriate places
g_malloc() aborts if allocation fails, it's pointless to check against NULL
afterwards. That's why g_try_malloc() exists.
2014-11-27 18:06:26 +01:00
Wang Xin-yu (王昕宇)
15c0d5c21b glcolorconvert: support RGB16/BGR16 video format download
https://bugzilla.gnome.org/show_bug.cgi?id=740801
2014-11-27 10:08:11 +01:00
Matthew Waters
2d97e03c54 gl/wayland: implement resizing the window using the right mouse button 2014-11-27 13:03:21 +11:00
Matthew Waters
1d7c4f4344 glfilter: support fixed dimensions on both sides of the element
Fixes:

  width=320,height=240 ! glfilter ! width=800,height=600
  width=230,height=240 ! glfilter ! width=600
  ... ! glfilter ! width=800
2014-11-27 01:32:21 +11:00
Ramprakash Jelari
aea08e86a5 glcontext: Fix unused variable warning by moving declaration where it is actually used 2014-11-24 14:16:58 +01:00
Sebastian Dröge
0f753b7099 glupload: Fix valid compiler warning
gstglupload.c:442:32: error: if statement has empty body [-Werror,-Wempty-body]
    if (upload->texture_ids[i]);
                               ^
2014-11-24 11:32:33 +01:00
Philippe Normand
c08a461fa4 gl: ship the gstglcontext_egl.h header
It is required by gsteglimagememory.h.

https://bugzilla.gnome.org/show_bug.cgi?id=740611
2014-11-24 21:24:27 +11:00
Tim-Philipp Müller
1a613c5d4e gl: shadervariables: make parsing of floats locale-independent
Floating point numbers are written differently in different
locales, e.g. in many countries 1/2 = 0,5 instead of 0.5, and
strtod will not be able to parse "0.5" correctly in such a
locale.
2014-11-24 10:02:33 +00:00
Matthew Waters
59085936b8 glshadervariables: also trim \r as well as \n 2014-11-24 02:52:24 +11:00
Matthew Waters
810d38c29f 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
Vineeth T M
aafc0d509c glcontext: build errors when GST_GL_HAVE_OPENGL is 0
Moving variables within #if GST_GL_HAVE_OPENGL, which are not going to be used otherwise.
and which are needed only when OpenGl is present

https://bugzilla.gnome.org/show_bug.cgi?id=740235
2014-11-17 22:39:07 +11:00
Matthew Waters
4afad4ecd3 glfilter: add read-only context property 2014-11-17 18:50:28 +11:00
Sebastian Dröge
236ffa69be gl/cocoa: Only use convertRectToBacking on OSX >= 10.7
It does not exist before and older versions also don't have
support for HiDPI displays anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=740201
2014-11-16 11:00:57 +01:00
Sebastian Dröge
9492db96d1 gl: Use numeric OSX version instead of the macro
The macro is not defined on older OSX versions and evaluates to 0.

https://bugzilla.gnome.org/show_bug.cgi?id=740201
2014-11-16 11:00:57 +01:00
Sebastian Dröge
402e1a067a gl/cocoa: Don't override the application delegate
Otherwise interesting things will happen in Cocoa applications, like
infinite event loops that block the NSApplication loop forever.

This was only needed for GNUStep and thus can safely be removed now.
2014-11-13 12:01:25 +01:00
Sebastian Dröge
13c8517570 gl/cocoa: Remove GNUStep support
Until gcc and GNUStep properly support Objective-C blocks and other
"new" features of Objective-C we can't properly support them without
making the code much more ugly.

https://bugzilla.gnome.org/show_bug.cgi?id=739152
2014-11-13 12:01:19 +01:00
Hyunjun Ko
a2e2507dbe gl: Correct invalid comment text 2014-11-12 11:29:41 +11:00
Julien Isorce
7d0de0577a gl: do not raise a critical msg if the backend does not handle window events
Fix "assertion 'window_class->handle_events != NULL' failed"
if not using a X11 window.
2014-11-12 00:07:06 +00:00
Matthew Waters
36ade75f4a gl: remove the width/height fields from the caps to support frame resizing
It was previously only occuring with sysmem caps features

https://bugzilla.gnome.org/show_bug.cgi?id=739334
2014-11-11 14:23:55 +11:00
Sebastian Dröge
da0369c66c gstglconfig: Put gstglconfig.h into $(libdir)/gstreamer-1.0/include
It's architecture dependent and should not be placed into the include
directory as the assumption is that all those headers are architecture
independent.

https://bugzilla.gnome.org/show_bug.cgi?id=739767
2014-11-07 12:00:29 +01:00
Matthew Waters
775ba4ff0b glutils: only attempt getting the app context when we don't already have a display
avoids querying/messaging the world on each frame
2014-11-06 18:47:34 +11:00
Matthew Waters
1800ffb34a glcontext: fail context creation if glGetString returns NULL 2014-11-06 18:46:48 +11:00
Lubosz Sarnecki
6702811e14 glimagesink: implement gst_video_overlay_handle_events
https://bugzilla.gnome.org/show_bug.cgi?id=736035
2014-11-06 16:04:11 +11:00
Julien Isorce
0a207c95dc gl/cocoa: use NSAutoreleasePool to free resize data
Otherwise when resizing the window you will also get messages like:
class NSConcreteMapTable autoreleased with no pool in place - just leaking
class NSConcreteValue autoreleased with no pool in place - just leaking
class NSConcreteValue autoreleased with no pool in place - just leaking
class __NSCFDictionary autoreleased with no pool in place - just leaking
2014-11-03 23:24:33 +00:00
Julien Isorce
4307449449 gl/cocoa: include gl3.h to have GL_CONTEXT_PROFILE_MASK 2014-11-03 23:08:09 +00:00
Julien Isorce
2b487ef62b gl/cocoa: make sure to turn on frame rectangle changes notifications
Default value of property postsFrameChangedNotifications is YES
but it is worth to explicitly enable it.
2014-11-03 23:07:34 +00:00