Commit graph

994 commits

Author SHA1 Message Date
Julien Isorce
a259391c10 gl/cocoa: fix uncaught exception 'unrecognized selector sent to instance'
Need to set the ':' as the reshape method now takes one parameter.
For the story, the GstGLNSView was previously inheriting from
NSOpenGLView which has a reshape function without any parameter.
Now the GstGLNSView inherits from NSView and we re-use the reshape
function manually.
2014-11-03 23:02:17 +00:00
Julien Isorce
11661ceca9 gl/cocoa: fix compiler warning
Use the reshape function after being defined. The other way
would have been to declare the reshape function in the header.

gstglwindow_cocoa.m: In function '-[GstGLNSView drawRect:]':
gstglwindow_cocoa.m:555: warning: 'GstGLNSView' may not respond to '-reshape'
gstglwindow_cocoa.m:555: warning: (Messages without a matching method signature
gstglwindow_cocoa.m:555: warning: will be assumed to return 'id' and accept
gstglwindow_cocoa.m:555: warning: '...' as arguments.)
2014-11-03 22:59:41 +00:00
Tim-Philipp Müller
ebcee78fab gl: fix Since marker for gst_gl_window_run_navigation() 2014-11-03 00:17:41 +00:00
Luis de Bethencourt
658f403a26 glshader: Fix memory leak
Memory is only freed in the TRUE clause of the if conditional. Free in the else
clause as well.
Also, consolidate g_malloc + sprintf into a g_strdup_printf().

CID #1212171

https://bugzilla.gnome.org/show_bug.cgi?id=739368
2014-11-01 15:42:21 +00:00
Luis de Bethencourt
50f2a803f6 glcolorconvert: fix comments that confuse gtk-doc
GTK-Doc uses a special syntax for code documentation. A multiline comment that
starts with an additional '*' marks a documentation block that will be processed
by the GTK-Doc tools. So GTK-Doc is confused if a comment block starts with that
additional '*' but isn't meant to be processed. Removing this additional '*'.

https://bugzilla.gnome.org/show_bug.cgi?id=739444
2014-10-31 11:20:29 +00:00
Matthew Waters
f36d6daf51 gl: sprinkle some Since markers 2014-10-31 21:29:25 +11:00
Matthew Waters
c1f3cc9f1c gl/examples: update for other-context property removal 2014-10-30 18:58:50 +11:00
Matthew Waters
567185a277 glcontext: add more functionality to wrapped contexts
Implements get_current_context() and get_proc_address() for wrapped
contexts.
2014-10-30 18:58:50 +11:00
Matthew Waters
d2cbc7cc16 glshader: advertise the default vertex and fragment shaders on desktop GL 2014-10-30 18:58:49 +11:00
Matthew Waters
5e2e6f3326 glfilter: get the config from the correct pool 2014-10-28 18:27:11 +11:00
Matthew Waters
28105a6e7d glfilter: avoid uninitialized variable size when chaining multiple glfilters
https://bugzilla.gnome.org/show_bug.cgi?id=739277
2014-10-28 18:01:27 +11:00
Matthew Waters
0289fbe2cd glfilter: gst-indent file 2014-10-28 18:01:01 +11:00
Matthew Waters
81ceca1aea glcontext: add api for retreiving the current context and api
that is current in the calling thread.
2014-10-28 17:33:20 +11:00
Matthew Waters
ce14777919 glprototypes: add vertex attribute array definitions 2014-10-28 17:33:20 +11:00
Matthew Waters
e40d70c69a gl: propogate other-context using GstContext 2014-10-23 23:58:33 +11:00
Sebastian Dröge
af6e2228b2 gl/cocoa: Fix compiler warning
gstglwindow_cocoa.m: In function '-[GstGLNSView drawRect:]':
gstglwindow_cocoa.m:555: warning: 'GstGLNSView' may not respond to '-reshape'
gstglwindow_cocoa.m:555: warning: (Messages without a matching method signature
gstglwindow_cocoa.m:555: warning: will be assumed to return 'id' and accept
gstglwindow_cocoa.m:555: warning: '...' as arguments.)
2014-10-21 16:22:06 +02:00
Matthew Waters
2e49c99db3 glbufferpool: add the GstVideoGLTextureUploadMeta buffer pool option 2014-10-21 02:00:09 +11:00
Wang Xin-yu (王昕宇)
5eb538f9e2 glcolorconvert: support RGB16/BGR16 video format upload
https://bugzilla.gnome.org/show_bug.cgi?id=738842
2014-10-20 12:55:39 +02:00
Brion Vibber
88b19bcf99 gl/cocoa: Fix for building on Mac OS X 10.10
Using NSApp directly seems to confuse something, as the compiler
was expecting an id<NSFileManagerDelegate>. Switched to using
[NSApplication sharedApplication], and specified the delegate
protocol on the window class as well.

https://bugzilla.gnome.org/show_bug.cgi?id=738740
2014-10-19 20:01:55 +02:00
Matthew Waters
4b019ba268 glfilter: add uploaded_buffer field 2014-10-14 16:54:01 +02:00
Sebastian Dröge
014cbbbb33 gl/cocoa: Add support for HiDPI displays
Without this our GL surface would be upscaled after rendering
by Cocoa, which would reduce image quality.
2014-10-09 10:56:06 +03:00
Matthew Waters
ccdd88eb5a glcolorconvert: output why we cannot convert a buffer 2014-10-09 12:29:57 +11:00
Matthew Waters
9108c52a22 glcolorconvert: fix planar YUV download
- sample the u and v planes properly
- output the correctly scaled u and v planes for different chroma block sizes
2014-10-09 12:29:57 +11:00
Matthew Waters
9dc1f9be36 glcolorconvert: fix UYVY download green screen 2014-10-07 23:04:30 +11:00
Matthew Waters
2fb0b28f74 glcolrconvert: fix YUY2 download
- The shader was outputing the wrong values compared with raw
  videotestsrc.
- deal with the texture edge properly.
- properly sample the 2x1 rectangle for the u and v values
- don't double sample the y value
2014-10-07 22:55:32 +11:00
Sebastian Dröge
c4cc2dfabf gl/cocoa: Always update our viewport if Cocoa tells us something has changed
The visible rect and bounds might be the same as before, but Cocoa
might've changed our viewport without us nothing. This happens if
you hide the view and show it again.
2014-10-01 16:04:36 +03:00
Sebastian Dröge
061d55f535 gl/cocoa: Handle NSView::renewGState() properly
Don't update the screen until we redraw, this prevents flickering during
scrolling, clipping, resizing, etc
2014-10-01 11:55:51 +03:00
Matthew Waters
dc4b4832d4 glcolorconvert: convert xRGB into ARGB properly
The alpha channel might not be the last component so check which one
it is in and clobber that one instead.
2014-09-30 14:46:14 +10:00
Matthew Waters
7b0a30343a glmemory: unset the opposite corresponding transfer flags when mapped with write
fixes consistency with consecutive gst_memory_map()'s with
flags & GST_MAP_WRITE
2014-09-30 01:49:05 +10:00
Sebastian Dröge
d4ed76e4da gl/cocoa: Update viewport according to the current clipping
We have to update the GL viewport if the NSView is only partially
visible. Otherwise the content of the frame will be visibly offset.
2014-09-29 14:34:42 +03:00
Sebastian Dröge
8d92b6a364 gl/cocoa: Improve the NSApplication initialization
This is only for non-Cocoa apps but previously caused a 2 second
waiting during startup for Cocoa apps. This is unacceptable.

Instead we now check a bit more extensive if something actually
runs on the GLib default main context, and if not don't even
bother waiting for something to happen from there.
2014-09-29 10:57:18 +03:00
Sebastian Dröge
0cd19cbda3 gl/cocoa: NSView::drawRect() should call into reshape too
We a) need to render again because part of the window was
obscured and b) might need to reshape because of clipping
changes.
2014-09-29 10:57:18 +03:00
Sebastian Dröge
66cb4166d3 gl/cocoa: Call UI related API from the application main thread 2014-09-29 10:57:18 +03:00
Sebastian Dröge
2173d34462 gl/cocoa: Switch to a plain NSView subclass instead of NSOpenGLView
We don't and can't use NSOpenGLView as it's supposed to be used and
it gets into our way by being to clever in various situations.
2014-09-29 10:57:18 +03:00
Edward Hervey
e064d280ea glcontext: Initialize variable
Avoids the following warning:

gstglcontext.c:647:58: error: 'prev' may be used uninitialized in
 this function [-Werror=maybe-uninitialized]
2014-09-29 08:54:29 +02:00
Matthew Waters
fc2471eb54 glcontext: fixup error in sharegroup comment 2014-09-29 00:32:05 +10:00
Matthew Waters
3b9893192c glcontext: detect the sharegroup case where the context are in different chains
In the end they will lead to the same root context in the tree so check that
for equality.
2014-09-29 00:24:28 +10:00
Matthew Waters
81c38c1d2b glfilter: silence a warning with empty input caps
discovered with the doublecube example

gst_caps_get_features: assertion 'index < GST_CAPS_LEN (caps)' failed
2014-09-28 21:18:32 +10:00
Sebastian Dröge
c9283c95f6 gl/cocoa: Switch from our custom main loop to a GMainLoop
Simplifies code a lot and makes it more similar to the other backends.
2014-09-25 16:13:19 +03:00
Sebastian Dröge
bc52e41641 gl/cocoa: Clear the current GL context when it should happen 2014-09-25 16:12:24 +03:00
Matthew Waters
c44352b11f gl: download whenever we have sysmem capsfeatures
Otherwise we could pass on a RGBA formatted buffer and downstream would
misinterpret that as some other video format.

Fixes pipelines of the form

    gleffects ! tee ! xvimagesink
2014-09-24 13:16:30 +10:00
Matthew Waters
82a3a34475 glupload: fallback to upload if contexts cannot share GL resources
Fixes pipelines of the form

    gleffects ! tee ! glimagesink

as tee does not pass on the allocation query.
2014-09-23 12:02:18 +10:00
Matthew Waters
d99b517b53 glcontext: add gst_gl_context_can_share
Which determines whether two GstGLContext's can share sharable
OpenGL resources.
2014-09-23 12:01:04 +10:00
Sebastian Dröge
8d457a4d18 gl: Let gst_gl_context_get_thread() return a new reference to the GThread
Otherwise it might go away in the meantime and the caller has some random pointer.
2014-09-22 10:09:24 +03:00
Anuj Jaiswal
d153b01280 gl: consecutive return, break statement
Signed-off-by: Anuj Jaiswal <anuj.jaiswal@samsung.com>

https://bugzilla.gnome.org/show_bug.cgi?id=736939
2014-09-22 16:17:15 +10:00
Matthew Waters
7216b360b7 gl/debug: desktop GL does not have the KHR suffixes 2014-09-22 12:21:22 +10:00
Tim-Philipp Müller
10997063a1 gl: add since markers for new API 2014-09-21 13:32:29 +01:00
Matthew Waters
64fc86844d glmemory: add debug line for freeing textures 2014-09-21 21:42:41 +10:00
Matthew Waters
5b8d7a443e glupload: provide the output buffer that is rendered into
Allows callers to properly reference count the buffers used for
rendering.

Fixes a redraw race in glimagesink where the previous buffer
(the one used for redraw operations) is freed as soon as the next
buffer is uploaded.

1. glimagesink uploads in _prepare() to texture n
1.1 glupload holds buffer n
2. glimagesink _render()s texture n
3. glimagesink uploads texture n+1
3.1 glupload free previous buffer which deletes texture n
3.2 glupload holds buffer n+1
4. glwindow resize/expose
5. glimagesink redraws with texture n

The race is that the buffer n (the one used for redrawing) is freed as soon as
the buffer n+1 arrives.  There could be any amount of time and number of
redraws between this event and when buffer n+1 is actually rendered and thus
replaces buffer n as the redraw source.

https://bugzilla.gnome.org/show_bug.cgi?id=736740
2014-09-21 21:36:49 +10:00
Matthew Waters
e7bd332887 glcontext: add API to retreive the thread that context is active in 2014-09-21 21:30:58 +10:00
Ognyan Tonchev
5dc2843c86 glfilter: do not leak pool in error cases
https://bugzilla.gnome.org/show_bug.cgi?id=736732
2014-09-16 12:51:25 +03:00
Vasilis Liaskovitis
3c3b78508f GstGLWindow: Introduce navigation thread
This thread dispatches navigation events. It is needed to avoid deadlocks
between window backend threads that emit navigation events (e.g. X11/GMainLoop
thread) and consumers of navigation events such as glimagesink, see
https://bugzilla.gnome.org/show_bug.cgi?id=733661

GstGlWindow_x11 thread is changed to invoke the navigation thread for navigation
dispatching, instead of emiting the event itself. Othe backends beside X11 do
not dispatch navigation events yet, but should use this thread when dispatching
these events in the future.

The navigation thread is currently part of GstGLWindow and not implemented in
separate subclasses / backends. This will be needed in the future.

gst_gl_window_x11_get_surface_dimensions is also changed to use a cached value
of the window's width, height. These values are now retrieved in the X11
thread, function gst_gl_window_x11_handle_event. This change is needed because
otherwise the XGetWindowAttributes gets called from the navigation thread,
leading to xlib aborting due to multithreaded access (if XInitThreads is not
called before, as is the case for gst-launch)
2014-09-09 21:47:02 +10:00
Wang Xin-yu (王昕宇)
9047a01f5f gl: Add GSTGLAPI macro to the debug callback function
Fixes the Windows build.

https://bugzilla.gnome.org/show_bug.cgi?id=735565
2014-08-28 10:00:54 +03:00
Jan Schmidt
c93017a074 egl: Wrap KHR_create_context flags in an ifdef
EGL_CONTEXT_FLAGS_KHR and EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR
don't exist in the Android NDK. Wrap their usage in an #ifdef
EGL_KHR_create_context to fix the build there.
2014-08-26 12:41:35 +10:00
Matthew Waters
83a32dbddb egl: fallback to a non-debug context if a debug one fails
The text for EGL_KHR_create_context added the possiblity for ES
contexts to ask for a debug context however that has not been
fully realized by all implementations.  Fallback to a non-debug
context when the implementation errors.
2014-08-22 16:51:29 +10:00
Lubosz Sarnecki
5ae3d68590 gstopengl: add introspection support
https://bugzilla.gnome.org/show_bug.cgi?id=734482
2014-08-21 18:41:38 +10:00
Lubosz Sarnecki
d2cac06eeb glshader: expose opengl handle in getter
https://bugzilla.gnome.org/show_bug.cgi?id=734482
2014-08-21 17:38:36 +10:00
Wang Xin-yu (王昕宇)
4c65eca7be gl: check null before unref GstGLDisplay 2014-08-21 14:59:45 +10:00
Matthew Waters
14bd147a2d gl: add prototype definition for KHR_debug 2014-08-21 10:03:07 +10:00
Matthew Waters
95a4585d4c glcontext: implement the debug callback
For both GL_KHR_debug and ARB_debug_output.  This allows us to
receive errors and other hints from the GL instead of querying after
every GL operation.
2014-08-20 23:26:26 +10:00
Matthew Waters
14a3484b14 gl: add prototypes for KHR_debug/ARB_debug_output 2014-08-20 23:26:26 +10:00
Matthew Waters
cb4fd36e7e 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().
2014-08-19 20:14:22 +10:00
Tim-Philipp Müller
21e6989848 glbufferpool: fix allocator leak in some cases
Spotted by Sebastian Rasmussen.

https://bugzilla.gnome.org/show_bug.cgi?id=734523
2014-08-13 18:05:40 +03:00
Vasilis Liaskovitis
4dacc4ba55 GstGLWindow, GstGLImagesink, x11: Scale navigation events on resized windows
If window is resized, GstStructure pointer values have to be rescaled to
original geometry. A get_surface_dimensions GLWindow class method is added for
this purpose and used in the navigation send_event function.

https://bugzilla.gnome.org/show_bug.cgi?id=703486
2014-08-07 13:55:02 +10:00
Wang Xin-yu (王昕宇)
ba822e1dd0 glupload: don't determine if frame needs upload by pointer compare
https://bugzilla.gnome.org/show_bug.cgi?id=734269
2014-08-06 14:47:52 +10:00
Matthew Waters
8f045ab18c gl/docs: remove superflous 'the' 2014-08-01 17:51:08 +10:00
Matthew Waters
707cb58004 gl: document GST_GL_* environment variables
https://bugzilla.gnome.org/show_bug.cgi?id=733245
2014-08-01 16:43:47 +10:00
Matthew Waters
750c70f8f5 glcontext: add a destroy function
that just calls the subclass
2014-07-31 18:46:33 +10:00
Matthew Waters
46db28ac2c gl/x11: silence runtime warning
g_main_loop_quit: assertion 'loop != NULL' failed
2014-07-31 18:36:58 +10:00
Matthew Waters
acb38a2a79 glmemory: use the plane offsets to compute the size of the data pointer
Certain elements expect that there be a certain number of lines
that they can write into.  e.g. for odd heights, I420, YV12, NV12,
NV21 (and others) Y lines are expected to have exactly twice the
number of U/UV lines.

https://bugzilla.gnome.org/show_bug.cgi?id=733717
2014-07-31 15:19:54 +10:00
Matthew Waters
89636392fa glmemory: use GstVideoInfo everywhere
Simplifies a lot of the calling code

https://bugzilla.gnome.org/show_bug.cgi?id=733717
2014-07-31 15:19:54 +10:00
Matthew Waters
dc5b0c8c8d glmemory: reenable the texture_rg support for !eagl
The GST_GL_HAVE_PLATFORM_EAGL is always defined we need to compare
against the value instead.
2014-07-29 11:47:55 +10:00
Vasilis Liaskovitis
05f908bf45 glwindow/11: Emit signals for mouse and key navigation events
https://bugzilla.gnome.org/show_bug.cgi?id=703486
2014-07-24 12:24:34 +02:00
Sebastian Dröge
eab38c5b21 glwindow: Constify string parameters to the send_*_event() functions 2014-07-24 12:23:03 +02:00
Vasilis Liaskovitis
41632d486b GstGLWindow : Add mouse-event and key-event signals for navigation
https://bugzilla.gnome.org/show_bug.cgi?id=703486
2014-07-24 12:48:44 +10:00
Wang Xin-yu (王昕宇)
1adb0a77d6 gl: fix multi gl object leaks
1. fix FBO leaks in decide_allocation
2. fix texture leaks in decide_allocation and reset
3. fix texture leaks in FBO incomplete error path
2014-07-24 11:46:56 +10:00
Sebastian Dröge
acb1d5afc3 gl: Link to all required libraries but not more 2014-07-11 12:06:48 +02:00
Sebastian Dröge
92d00d0233 gl: Move GstGLMixer to the plugin for now
It depends on GstAggregator and we don't want to install headers
for that yet.

https://bugzilla.gnome.org/show_bug.cgi?id=732207
2014-07-11 09:41:05 +02:00
Julien Isorce
6e51790a11 glcocoa: initalize NSApp asap when using gst-launch
See https://bugzilla.gnome.org/show_bug.cgi?id=732661
2014-07-03 10:39:44 +01:00
Sebastian Dröge
4cbddec9fe eagl: Disable usage of R and RG textures on iOS
They don't work currently and just render zeroes, while the
fallback code path with LUM and LUM_ALPHA textures still works.

https://bugzilla.gnome.org/show_bug.cgi?id=732390
2014-06-30 19:16:13 +02:00
Matthew Waters
c39105524a glcolorconvert: free pixel swizzling information 2014-06-26 11:25:37 +10:00
Matthew Waters
a03dbd11e4 glmixer: remove redundant/unused lock
Use the GstObject lock instead
2014-06-26 11:15:56 +10:00
Matthew Waters
de05daec80 glmixer: remove redundant creation and free of GPtrArrays
Also plugs a memory leak
2014-06-26 11:12:49 +10:00
Matthew Waters
f686c890e4 glmixer: plug a memory leak for the caps
gst_query_set_caps_result() takes a ref on the caps
2014-06-26 10:54:38 +10:00
Matthew Waters
596353854f glmixer: intersect with the filtercaps if available 2014-06-26 10:31:41 +10:00
Matthew Waters
8ef71b5db7 gl: update gles2 compatability header 2014-06-26 10:31:41 +10:00
Matthew Waters
720405b561 glfilter: pass through the allocation query when in passthrough mode
Otherwise two GL elements on either side will fail to use the same
GL context.
2014-06-25 22:05:37 +10:00
Matthew Waters
a2bd2ce83b glfilter: prefer passthrough for non-sysmem caps 2014-06-25 21:50:40 +10:00
Julien Isorce
f63c91ab71 glfilter: handle NULL decide_query which means passthrough
See https://bugzilla.gnome.org/show_bug.cgi?id=732178
2014-06-25 06:56:33 +01:00
Julien Isorce
045aa4ee7e glfilter: prepend intersection to src caps
Prefer to stay in the same memory space if possible.
Also it let a chance to do passthrough.

See https://bugzilla.gnome.org/show_bug.cgi?id=732178
2014-06-25 06:56:25 +01:00
Matthew Waters
1d16cd50a3 gl: add a scary note about initializing thread support for the winsys
We cannot do it as the winsys may crash if we initialize too late.

Example, GLX contexts with Intel drivers:
Intel requires the X Display to be the same in order to share GL
resources across GL contexts.  These GL contexts are generally
accessed from different threads.  Without winsys support it is
nearly impossible to guarentee that concurrent access will not
occur.  This concurrent access could result in crashes or abortion
by the winsys (xcb).

https://bugzilla.gnome.org/show_bug.cgi?id=731525
2014-06-24 23:41:00 +10:00
Matthew Waters
078c789ffa gluploadmeta: reenable GLMemory upload path 2014-06-23 21:43:10 +10:00
Matthew Waters
d52ef19d7f gl: move gles2 compat header to glprototypes 2014-06-22 09:48:22 +10:00
Matthew Waters
838fd776cf glbufferpool: provide a consistent API regardless of platform 2014-06-22 09:48:22 +10:00
Matthew Waters
1970659fa1 gl: mark library as API unstable 2014-06-22 09:48:22 +10:00
Thibault Saunier
4ce8b409cc gl: Port glmixer to the GstVideoAggregator baseclass
https://bugzilla.gnome.org/show_bug.cgi?id=731921
2014-06-20 19:53:33 +02:00
Matthew Waters
189353619c glframebuffer: don't segfault needlessly with GLES2
gst_gl_framebuffer_use_v2 was using a function that is not available
with GLES2
2014-06-17 23:21:15 +10:00
Matthew Waters
7899b9af9f gldownload: plug a memory leak 2014-06-15 15:17:07 +10:00
Matthew Waters
015beb5404 glmixer: allow the subclass to choose the sink pad type
Allows custom properties to be placed on the sink pads by subclasses
2014-06-15 12:28:45 +10:00
Matthew Waters
e1e2a88358 glmixer: send the stream-start event
and the caps event after.

https://bugzilla.gnome.org/show_bug.cgi?id=730944
2014-06-12 14:58:47 +10:00
Matthew Waters
d7f8cc9a78 glfilterapp: remove the reshape/draw properties
The reshape property was never used.
Replace the draw property with a signal.

Based on patch by Mathieu Duponchelle <mathieu.duponchelle@epitech.eu>

https://bugzilla.gnome.org/show_bug.cgi?id=704507
2014-06-12 12:49:42 +10:00
Matthew Waters
9e662b8229 glmixer: lock the size of mix->frames to the number of pads
Fixes a segfault with decodebin ! glmixer where the request pads on
both sides were being requested after the state change to PAUSED.

Also fixes dynamically adding and removing pads while glmixer is
in a state >= PAUSED.
2014-06-12 12:18:23 +10:00
Matthew Waters
574b29f2c4 gl/wayland: create a dummy display instead of an EGLDisplay
Currently, GstGLWindowWaylandEGL holds the wayland display connection
If we create the EGLDisplay at the GstDisplay creation time, then
libEGL will internally open another connection to the wayland server.
These two display connections are unable to communicate resulting in
no window output/display and hangs inside libEGL.

Eventually we will move the wl_display from GstGLWindow to GstGLDisplay.
2014-06-05 18:52:11 +10:00
Matthew Waters
59088f5a90 glupload: always release the previous buffer
Fixes the case where _perform_with_buffer() is called without
intervening calls to _release_buffer() as is the case on start up
with glimagesink.

Also release the buffer when reseting the upload.

https://bugzilla.gnome.org/show_bug.cgi?id=731107
2014-06-03 14:03:21 +10:00
Sebastian Dröge
91581cf531 glcontext: Handle (unlikely) NULL return of gl->GetString (GL_VERSION) more gracefully
CID 1219858
2014-06-02 09:23:39 +02:00
Matthew Waters
0f4485fc66 glmemory: remove uneeded gl api ifdefs 2014-05-30 12:29:54 +10:00
Matthew Waters
1f90323a4d glwindow_x11: allow expose events to redraw our window
otherwise we will not update the window contents on low framerate
streams until the next buffer

https://bugzilla.gnome.org/show_bug.cgi?id=723529
2014-05-30 11:51:01 +10:00
Matthew Waters
4ee5967414 glcontext: fix up assertion
error: 'return' with no value, in function returning non-void
2014-05-30 10:46:25 +10:00
Matthew Waters
da35876537 glfeature: remove GST_GL_API_GLES3
instead check the gl version using gst_gl_context_check_gl_version()
2014-05-30 10:29:37 +10:00
Matthew Waters
1334884a61 glcontext: check for GLES versions 2014-05-30 10:29:37 +10:00
Matthew Waters
5273b726a6 gl/context: add check_gl_version 2014-05-30 10:29:37 +10:00
Edward Hervey
45ec777cea glcontext: Try GLX support before EGL support
If available, glx has got a better chance of being the Gl platform
we want to use compared to EGL
2014-05-29 17:12:41 +02:00
Edward Hervey
30622337ab glcontext: Try to open lib{EGL|GL|GLESv2}.so.1 before lib{EGL|GL|GLESv2}
Fixes issues with .so (without numbering) being installed for development
(such as from mesa-dev) but actual driver (with numbering) coming from
some other place (like nvidia drivers)
2014-05-29 17:12:41 +02:00
Sebastian Dröge
f56aa3e32c glupload: Fix assertion after API changes 2014-05-29 10:37:02 +02:00
Matthew Waters
3390b2b385 gl/colorconvert: keep our private pointer
again, avoid to much trigger
2014-05-29 18:33:10 +10:00
Matthew Waters
4b5c5a7d37 gl/colorconvert: use GstObject's lock instead of our own 2014-05-29 17:29:41 +10:00
Matthew Waters
768c6de84e gl/colorconvert: remove unnecassary pointer inderection 2014-05-29 17:12:03 +10:00
Matthew Waters
07919d874c gl/upload: re add the upload meta to the private struct
try and avoid being to trigger happy
2014-05-29 16:45:37 +10:00
Matthew Waters
eff3da8871 gl/upload: small code cleanup and gst-indent 2014-05-29 16:30:14 +10:00
Matthew Waters
9eb6f536b9 gl/download: use GstObject's lock instead of out own 2014-05-29 16:30:13 +10:00
Matthew Waters
aa102d2660 gl/upload: use GstObject's lock instead of our own 2014-05-29 16:30:13 +10:00
Matthew Waters
75c7e5019c gl/filter: also remove the width/height in transform_caps
allows scaling in the filters
2014-05-29 16:30:13 +10:00
Matthew Waters
a181460755 gl/colorconvert: optimise the same format case
simply return the input buffer unchanged
2014-05-29 16:30:13 +10:00
Matthew Waters
ec8a617e8f gl/colorconvert: fix YUY2/UYVY download for RG/LA textures 2014-05-29 16:30:13 +10:00
Matthew Waters
f7f92e6d7a gl/colorconvert: allocate output buffers
Allows the nop optimisation by simply reffing the input buffer.
2014-05-29 16:30:13 +10:00
Matthew Waters
21b6ca75c3 gl/upload: fix incorrect type in macros 2014-05-28 14:43:43 +10:00
Matthew Waters
6ce3b82efe gl/upload: add GstGLUploadMeta object
That simply deals with the provider aspect of GstVideoGLTextureUploadMeta.
2014-05-28 14:41:35 +10:00
Matthew Waters
3ddcec8062 gl/win32: make send_message reentrant
I could not find a comparable win32API function so keep the running
thread pointer to compare against.

https://bugzilla.gnome.org/show_bug.cgi?id=730782
2014-05-28 00:57:25 +10:00
Tim-Philipp Müller
1f1bb8bbe3 glcolorconvert: fix compiler warning
gstglcolorconvert.c:1133:11: error: 'j' may be used uninitialized in this function

Was used uninitialized when jumping to out label
in error case.
2014-05-27 13:57:18 +01:00
Matthew Waters
60b6ef981e gl/colorconvert: operate on buffers instead of memories 2014-05-27 21:59:12 +10:00
Julien Isorce
ce4a2b6828 gl: add missing cgl and eagl context type
https://bugzilla.gnome.org/show_bug.cgi?id=729245
2014-05-27 08:54:20 +01:00
Julien Isorce
fbe6dd9c5f gl: rename platform cocoa to cgl
Before:
GST_GL_PLATFORM=cocoa GST_GL_WINDOW=cocoa
gst-launch-1.0 videotestsrc ! glimagesink

After:
GST_GL_PLATFORM=cgl GST_GL_WINDOW=cocoa
gst-launch-1.0 videotestsrc ! glimagesink

but still pass --enable-cocoa to configure script
because currently it can only be used with cocoa API.

We could later have cgl/gstglcontext_cgl.h that manages
a CGLContextObj directly and cocoa/gstglcontext_cocoa.h
would just wrap it.
So that it could be used with other Apple's window APIs.

https://bugzilla.gnome.org/show_bug.cgi?id=729245
2014-05-27 08:46:16 +01:00
Matthew Waters
397928714d gl/mixer: don't segfault when we don't have a buffer
https://bugzilla.gnome.org/show_bug.cgi?id=729257
2014-05-27 13:57:09 +10:00
Matthew Waters
1512666ac7 gl/window_x11: avoid BadDrawable error on shutdown 2014-05-27 13:57:09 +10:00
Matthew Waters
dad342454b gl/context_egl: pass the vars in the right order to DestroySurface
https://bugzilla.gnome.org/show_bug.cgi?id=728514
2014-05-27 10:49:26 +10:00
Nicolas Dufresne
075701669e glfilter: Remove format information to allow color convert again
We also need to remove the format information,  as glfilter can do
color convertion. This code was imported from videoconvert.

https://bugzilla.gnome.org/show_bug.cgi?id=729861
2014-05-25 09:03:32 -04:00
Matthew Waters
dbffcffaee gl/memory: allocate the correct memory size
and avoid wasting resources we will never need

https://bugzilla.gnome.org/show_bug.cgi?id=730703
2014-05-25 11:45:59 +10:00
Nicolas Dufresne
a7866aa9e5 glcolorconvert: Fix YUY2 and UYVY support with luminance_alpha
https://bugzilla.gnome.org/show_bug.cgi?id=730666
2014-05-24 08:56:10 -04:00
Matthew Waters
13402f0b98 gl/memory: provide compatability defines
fixes build on android/OS X
2014-05-23 12:07:50 +10:00
Matthew Waters
26e9517355 gl/colorconvert: remove scratch texture for YUY2/UYVY
We can get all our data from the one RG/LA texture with some shader magic.

https://bugzilla.gnome.org/show_bug.cgi?id=728890
2014-05-23 11:25:11 +10:00
Matthew Waters
9a0129a0e4 gl/memory: RGBA/UNSIGNED_BYTE only format supported by ReadPixels GLES2
Error out in case we attempt to read with any other invalid format.
2014-05-23 11:25:11 +10:00
Matthew Waters
0c8ccd8c5f gl/memory: generate textures with a sized internal format
Required in order to generate RG and RED textured with GLES3.
2014-05-23 11:25:11 +10:00
Matthew Waters
001b92ba12 gl/memory: implement GL_EXT_texture_rg support
Which is used by default over the Luminance formats due to it
being color renderable with fbos (and deprecation/removal with
GL 3.x).

https://bugzilla.gnome.org/show_bug.cgi?id=729750
https://bugzilla.gnome.org/show_bug.cgi?id=704222
https://bugzilla.gnome.org/show_bug.cgi?id=728890
2014-05-23 11:25:11 +10:00
Matthew Waters
746d021d70 gl/context: add gl extension checking to check_feature()
Useful for extensions that do not define any new GL API entrypoints
but can still modify behaviour when used.
2014-05-22 23:55:30 +10:00
Matthew Waters
0fb0286553 gl/download: fixup YUY2/UYVY download
Regression from 2da979831e as it did
not update the download code to reflect the change in texture format.
2014-05-22 23:55:30 +10:00
Matthew Waters
42f4869593 gl/filter: fixup passthrough bufferpool
In a pipeline like so:
  videotestsrc ! gleffects ! videoconvert ! sink
gleffects was simply passing the videoconvert bufferpool to videotestsrc
and not creating a glbufferpool. videobufferpool would then fail
to allocate from the glallocator.
2014-05-21 20:02:45 +10:00
Matthew Waters
2da979831e gl/upload: switch the 'master' texture for YUY2, UYVY
From d4bcef3204 on, using a RGBA
texture to hold the data causes the glmemory to have half width
and a scaling of [2, 1].  Using a LA texture solves this problem
however cannot be attached to the framebuffer for copying into
a RGBA texture.  Which will be solved by moving to EXT_texture_rg.

https://bugzilla.gnome.org/show_bug.cgi?id=728890
2014-05-21 10:26:21 +10:00
Matthew Waters
37c08c58c5 gl/eglimage: add eglimage context feature
Allows us to selectively use EGLImages only when available

https://bugzilla.gnome.org/show_bug.cgi?id=728234
2014-05-20 23:37:52 +10:00
Matthew Waters
b30023f571 gl/context: add generic feature checking
At the moment it simply delegates to the subclass.
2014-05-20 22:26:55 +10:00
Sebastian Dröge
911ec0d3ef glcontext: Add more assertions to make sure that everything sets the GError during context creation if something fails 2014-05-19 12:21:13 +02:00
Matthew Waters
ce561913de gl/download: update to be similar to the glupload semantics 2014-05-14 11:38:01 +10:00
Matthew Waters
b0a1e1f15b gl/colorconvert: fix up alpha clobbering
Previously it would only work if the alpha value was in the last
component (RGBx, BGRx).  Now it works wherever the alpha value may
be (xRGB, xBGR, etc).
2014-05-14 11:38:01 +10:00
Nicolas Dufresne
5c4ebaca4f glfilter: Fix building without EGL support
This fixes the OSX build and any builds with --disable-egl. That issue
was introduced in "glfilter: rewrite transform_caps to preserve caps fields".

https://bugzilla.gnome.org/show_bug.cgi?id=729861
2014-05-13 13:17:01 -04:00
Julien Isorce
e46de48f10 glfilter: rewrite transform_caps to preserve caps fields
https://bugzilla.gnome.org/show_bug.cgi?id=729861
2014-05-13 12:43:42 -04:00
Matthew Waters
1e90a68aec gl/colorconvert: use the texture scaling from the gl memory
The colorconvert values were not being used at all.

https://bugzilla.gnome.org/show_bug.cgi?id=729896
2014-05-13 11:44:06 -04:00
Nicolas Dufresne
d4bcef3204 glmemory: Fix handling of stride with alignement larger then 8
Setting a scaled factor for X coordinate is not enough as the indexer
will still think stride is shorter and will not fully skip it. Instead,
update width, so the lines are as expected. Combined with the scale, it
will hide the cropped portion.

https://bugzilla.gnome.org/show_bug.cgi?id=729896
2014-05-13 11:43:45 -04:00
Nicolas Dufresne
2d0a791348 glupload: Ensure we still have a texture after upload_set_format()
gst_gl_upload_set_format() resets the upload, hence the texture.
So we need to ensure we have a texture after this call when
uploading.
2014-05-12 18:26:12 -04:00
Nicolas Dufresne
864e1511c7 glupload: Correctly update the video info from video meta
Using gst_video_info_set_format() isn't complete when updating
a video info from video meta.
2014-05-12 18:26:12 -04:00
Nicolas Dufresne
4f84a6124a glupload: Correctly update video info in upload fallback
When the upload accelerated method fails, we fallback to an upload,
but the video info was not correctly updated.
2014-05-12 18:26:12 -04:00
Julien Isorce
d93cd25e2d gl/upload: set out_tex after reset, not before
Fix a regression introduced recently with the lazy init.
It was happening when calling gst_video_gl_texture_upload_meta_upload
from an aplication. So not using gst_gl_upload_perform_with_buffer.
2014-05-12 13:43:19 +01:00
Matthew Waters
f14e5ea027 gl/upload: update the video info on mapping a video frame
The buffer should contain the most specific data on how the data is
formatted.  We should use this information.

https://bugzilla.gnome.org/show_bug.cgi?id=729896
2014-05-12 22:13:19 +10:00
Matthew Waters
bd3e600710 gl/convert: clobber alpha channel when needed
Needed in the conversion from padded RGB formats to formats with an
alpha channel.  e.g. BGRx -> ABGR, etc

https://bugzilla.gnome.org/show_bug.cgi?id=729742
2014-05-12 22:10:19 +10:00
Matthew Waters
a4f0fbe4c3 gl/upload: avoid performing color conversion when there is no need
One such example is when the buffer contains GstGLMemory in the
RGBA format

https://bugzilla.gnome.org/show_bug.cgi?id=729278
2014-05-12 22:09:32 +10:00
Matthew Waters
91717ca5c2 gl/colorconvert: choose the right alpha component for AYUV -> RGBA 2014-05-11 14:04:22 +10:00
Matthew Waters
0c92f185c4 gl/upload: update the respective state when we cache textures/data 2014-05-11 10:45:34 +10:00
Matthew Waters
ecae7a1a41 gl/upload: cache the textures that we are using 2014-05-10 23:54:34 +10:00
Matthew Waters
c6e3f51ca5 gl/upload: avoid recreating the GLMemory struct for output textures 2014-05-10 23:05:03 +10:00
Nicolas Dufresne
afea9c6fe1 gl: Fix some of the error handling 2014-05-09 18:59:46 -04:00
Nicolas Dufresne
803f2c3dc0 glupload: Update GstVideoInfo after the buffer is mapped
gst_video_frame_map() will store an updated video info base
on the video meta. In order to have the right stride and offset
we should update that video info accordingly.
2014-05-09 17:59:43 -04:00
Sebastian Dröge
411f367dfc gl: Fix memory leak
CID #1212171
2014-05-09 15:42:08 +02:00
Matthew Waters
2dcbf08d73 gl/colorconvert: preserve alpha in AYUV <-> RGBA conversions
https://bugzilla.gnome.org/show_bug.cgi?id=729743
2014-05-09 22:32:11 +10:00
Matthew Waters
34b55f33f2 gl/colorconvert: implement lazy init 2014-05-09 22:32:11 +10:00
Julien Isorce
dff8abd57a gl/upload: set initted to TRUE when _init_upload succeeded 2014-05-09 13:07:16 +01:00
Sebastian Dröge
5c960069e4 gldisplay: Use GST_STR_NULL() for printing possibly NULL strings and print all variables we use
Fixes compiler warning about set but not used platform_choice variable
among other things.
2014-05-08 22:50:27 +02:00
Matthew Waters
ffe2c1f3c1 gl/upload: fix compilation on OS X 2014-05-08 17:28:11 +10:00
Matthew Waters
b0b630c69c gl/upload: fail propoerly if init fails 2014-05-08 15:40:33 +10:00
Matthew Waters
c247be334a gl: make all GObjects inherit from GstObject
Aids memory leak debugging with GST_TRACE=mem-live
2014-05-08 15:33:43 +10:00
Matthew Waters
a49a371710 gl/upload: implement lazy init
Rename init_format to set_format
2014-05-08 15:33:43 +10:00
Matthew Waters
5405273b0a gl/upload: add get_format method
Simply retreives the format set by init_format
2014-05-08 14:03:57 +10:00
Matthew Waters
810d6710d4 gl/filter: attempt to passthrough the pool if the caps are the same
Reduces the number of glbufferpool instances required for >=2
consecutive GL elements in a pipeline.
2014-05-08 14:03:57 +10:00
Matthew Waters
c2cdac278e gl/filter: always initialize the upload object 2014-05-08 14:03:50 +10:00
Matthew Waters
a27589629d gl: advertise GstGLMemory usage in the caps as capsfeatures
https://bugzilla.gnome.org/show_bug.cgi?id=729658
2014-05-07 21:48:57 +10:00
Matthew Waters
ee95595af0 gl/display: avoid endless recursion for cocoa 2014-05-07 19:07:23 +10:00
Julien Isorce
d4fe519c2e gl: do not allocate the target texture of an EGLImage
The target texture of an EGLImage is the texture bind just
before calling glEGLImageTargetTexture2D.

As we currently only support a gl texture as the source of an EGLImage
the gl texture is actually already allocated when creating the eglimage.

I also see some cases where it fails to upload an eglimage when
glTexImage2D is called on the target.
2014-05-06 15:39:12 +01:00
Julien Isorce
531e19214a 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.
2014-05-06 15:39:12 +01:00
Julien Isorce
2115f11f0b gl: no need to initialize a frame buffer object to upload an eglimage
Fix https://bugzilla.gnome.org/show_bug.cgi?id=729588
2014-05-06 15:39:12 +01:00
Julien Isorce
65381ee664 gl: use GST_CAT_ERROR instead of GST_ERROR_OBJECT
It fixes segault when GST_DEBUG is at least level 1 and eglCreateImage fails
2014-05-06 15:39:12 +01:00
Julien Isorce
dd8929a272 gl: delete texture used with GstVideoGLTextureUploadMeta 2014-05-06 15:39:12 +01:00
Julien Isorce
73a3c173c7 gl: use gst_gl_context_gen_shader helper instead of duplicating code 2014-05-06 15:35:00 +01:00
Matthew Waters
f19e5abcb8 gl/display: clean up pre gstglcontext api and struct fields
https://bugzilla.gnome.org/show_bug.cgi?id=729551
2014-05-06 21:08:30 +10:00
Matthew Waters
c28dd9b0d3 gl/display: add get_handle_type
https://bugzilla.gnome.org/show_bug.cgi?id=729551
2014-05-06 21:08:30 +10:00
Matthew Waters
1eeecae29e gl/display: avoid opening the X11 display on systems with Cocoa (OS X)
https://bugzilla.gnome.org/show_bug.cgi?id=729551
2014-05-06 21:08:30 +10:00
Matthew Waters
8743301af9 gl/window: fix string length check for eagl 2014-05-06 21:08:30 +10:00
Matthew Waters
b694b292b9 gl/display: check the correct env variable for choosing an egl display
GST_GL_WINDOW is used for window system specific choices.
An EGLDisplay can be created from window systems with egl support by using
eglGetDisplay().

https://bugzilla.gnome.org/show_bug.cgi?id=729551
2014-05-06 21:07:38 +10:00
Edward Hervey
48f770a2df gl/cocoa: Use OBJCFLAGS where needed
Should fix usage of c-compiler-only flags with an objective-c compiler
2014-05-06 12:57:36 +02:00
Matthew Waters
dfc6745143 gl: use the bufferpool's upload when available
Avoids duplicating GL resources

https://bugzilla.gnome.org/show_bug.cgi?id=728872
2014-05-02 15:59:28 +10:00
Julien Isorce
cf509574be gl: show internal cocoa window on top of others
Useful when your OSX terminal is fullscreen

https://bugzilla.gnome.org/show_bug.cgi?id=728127
2014-05-02 06:03:23 +01:00
Matthew Waters
b903c61ceb gl/pool: init the upload object on start
Theoretically, set_config could be called multiple times
2014-05-02 14:16:49 +10:00
Sebastian Dröge
cad1bb32c8 gl: Try harder to load symbols from the correct place
This commit makes the loading of the GModules threadsafe, and
always first tries to load the symbol for the GL library that
is selected for the current context. Only then it falls back
to looking into the current module (NULL), and only as a last
resort the context specific function (e.g. eglGetProcAddress())
is called.

Also add configure parameters to select the names of the library
modules instead of using the defaults, and let the defaults be
independent of the G_MODULE_SUFFIX.

https://bugzilla.gnome.org/show_bug.cgi?id=728753
2014-05-01 14:36:54 +02:00
Matthew Waters
598a79a5e2 gl/mem: implement texture copying between formats with strides properly
Previously, we used the width to determine the amount of data to be
copied using pbos.  This, makes it allocate enough data for the
the strides as well.
2014-05-01 14:00:04 +10:00