Commit graph

805 commits

Author SHA1 Message Date
Julien Isorce
9db9834128 gl/cocoa: only draw once the window has been resized
It avoids to draw the first frame with an incorrect view port.
2017-12-09 19:31:37 +00:00
Julien Isorce
545bed3c7a gl/cocoa: set the view to use for drawing by the context
It avoids to draw to an invalid buffer.
Withtout this the default frame buffer is undefined:
glBindFramebuffer (GL_FRAMEBUFFER, 0)

Visually you could see some white frames at the beginning
when lunching videotestsrc ! glimagesink

With OpenGL Profiler from XCode you could see some
GL_INVALID_FRAMEBUFFER_OPERATION for the first frames
2017-12-09 19:31:37 +00:00
Julien Isorce
e4b832db90 gl: fix declaration-definition mismatch for _init_upload 2017-12-09 19:31:37 +00:00
Julien Isorce
213590c79c gl/bufferpool: do not reset upload when set_config does not change the caps
With videotestsrc ! glimagesink it was reset 3 times
2017-12-09 19:31:37 +00:00
Julien Isorce
bc52c7bb00 gl: use #ifdef instead of #if for __APPLE__
warning: "__APPLE__" is not defined [-Wundef]

with gcc version 4.7.2 20120731 (prerelease)
    (crosstool-NG linaro-1.13.1+bzr2458 - Linaro GCC 2012.08)
2017-12-09 19:31:37 +00:00
Nicolas Dufresne
4372ba8999 glmemory: User g_slice_new0 to ensure fully initilized structure
The pbo pointer not being initialized would trigger a use of unitilialized variable
in valgrind.
2017-12-09 19:31:37 +00:00
Sebastian Dröge
569f1363f4 glimagesink: Use the pixel-aspect-ratio adjusted width/height when centering the frame in the display area
Makes sure we actually keep the display aspect ratio
2017-12-09 19:31:37 +00:00
Sebastian Dröge
889e92e738 glimagesink: By default keep the display aspect ratio
Also the default for the pixel-aspect-ratio should be 1/1, not 0/1.
2017-12-09 19:31:37 +00:00
Sebastian Dröge
7f7ceea8de gltestsrc: Unref context when creation failed and guard against that in fill() 2017-12-09 19:31:37 +00:00
Sebastian Dröge
fc607b3c53 glimagesink: Call gst_object_unref() on the GstGL GObjects again
While they're plain GObjects it does not hurt to call gst_object_unref()
on them and potentially allows to debug reference leaks a bit easier.
2017-12-09 19:31:37 +00:00
Sebastian Dröge
2b38f86b4e glimagesink: If creating a context or upload failed, destroy it
Fixes deadlocks in error cases when later code assumes the broken
context is actually usable.

https://bugzilla.gnome.org/show_bug.cgi?id=728761
2017-12-09 19:31:37 +00:00
Vincent Penquerc'h
f230f758e7 gl: a couple spelling/grammar fixes 2017-12-09 19:31:37 +00:00
Vincent Penquerc'h
d6a87fb0c3 gl: guard against using a NULL window pointer
Coverity 1195145
2017-12-09 19:31:37 +00:00
Vincent Penquerc'h
c728fd3b8d gl: prevent division by 0 on unsupported texture type
Coverity 1199697
2017-12-09 19:31:37 +00:00
Jan Schmidt
c891eedb79 glcolorconvert: Fix bt709 conversion matrices.
Fix the sign on one entry in the bt.709 YUV->RGB conversion
matrix, and the corresponding inverse matrix. Fixes really
wrong colouring of some videos.
2017-12-09 19:31:37 +00:00
Julien Isorce
d539fd4a54 gl: allow to include GLES/gl.h
https://bugzilla.gnome.org/show_bug.cgi?id=703343
2017-12-09 19:31:37 +00:00
Sebastian Dröge
2843ca2066 gl/eagl: Fix compilation 2017-12-09 19:31:37 +00:00
Sebastian Dröge
a6f5b079d8 gl/eagl: Notify the window's resize callback about surface dimension changes
https://bugzilla.gnome.org/show_bug.cgi?id=728107
2017-12-09 19:31:37 +00:00
Sebastian Dröge
d462e7f6df gl/eagl: Remove spurious private struct pointer 2017-12-09 19:31:37 +00:00
Sebastian Dröge
6fb0f1d1c7 gl/android: Notify the window's resize callback about surface dimension changes
https://bugzilla.gnome.org/show_bug.cgi?id=728107
2017-12-09 19:31:37 +00:00
Matthew Waters
9eb5001e02 glimagesink: remove unused texture 2017-12-09 19:31:36 +00:00
Matthew Waters
57b4bd6905 glimagesink: move upload into _prepare() 2017-12-09 19:31:36 +00:00
Matthew Waters
175ca3f7b0 gl/context: output available extensions 2017-12-09 19:31:36 +00:00
Matthew Waters
1460d22e92 gl/context: provide get_gl_version 2017-12-09 19:31:36 +00:00
Julien Isorce
9062658bc7 gl/color: restore viewport dimensions when fbo done
Regression introduced by 95abfda139.
It caused to display the wrong frame size when resizing the window.
2017-12-09 19:31:36 +00:00
Sebastian Dröge
b83d2df47d gl: Import QuartzCore/QuartzCore.h for CAEAGLLayer on older iOS versions 2017-12-09 19:31:36 +00:00
Sebastian Dröge
a05928ba62 gl: Set glimagesink rank to SECONDARY
This is a full-featured video sink now and especially should be
used instead of osxvideosink on OSX if available.
2017-12-09 19:31:36 +00:00
Sebastian Dröge
3770d2a406 gl: Add support for iOS EAGL platform
https://bugzilla.gnome.org/show_bug.cgi?id=703341
2017-12-09 19:31:36 +00:00
Julien Isorce
9d396a2495 gl/cocoa: make gst_gl_window_cocoa_send_message_async re-entrant
Backends that use g_main_context_invoke are re-entrant.

Il allows to call two nested gst_gl_context_thread_add.
ex: init_upload / init_colorconvert
2017-12-09 19:31:36 +00:00
Sebastian Dröge
aab3ef1b5d glimagesink: First handle GL window setup, then create the context and its thread 2017-12-09 19:31:36 +00:00
Julien Isorce
3819fbef46 gl/cocoa: fix NSAutoreleasePool initialization 2017-12-09 19:31:36 +00:00
Julien Isorce
08cce2cd5b gl/cocoa: ensure to call NSApplication:sharedApplication in the main thread
"(NSApplication *)sharedApplication This method also makes a connection
to the window server and completes other initialization"
The implicit thing which is not mentioned is that it required
to be called in the main thread.

Fix a regression introduces by 82b7c915bb
When using with gst-launch, it was not possible to click on the close
cross of the window anymore which is a bit anoying and also because
it's was possible before.

Prior to this commit the GstGLContextCocoaClass was initialized
in the main thread because gst_gl_context_new was called in the
state change function from going from ready to paused.

From this commit this call is done from the streaming thread.
So that the call to [NSApplication sharedApplication];
was not done in the main thread anymore.

We now ensure that by assuming there is a GMainLoop running.
It's for debugging purpose so that's ok to do that. Also
note we already do this assumtion to run app itereations.

The regression had no consequence on the cocoa/videooverlay example
(that should be moved from gst-plugins-gl to -bad) because the
application is responsible for that necessary call.
2017-12-09 19:31:36 +00:00
Julien Isorce
e7dc1d787e gl/color: fix warning type qualifiers ignored
i686-apple-darwin11-llvm-gcc-4.2
"warning: type qualifiers ignored on function return type"
2017-12-09 19:31:36 +00:00
Matthew Waters
a321fa998a gl/color: remove if statement with no effect
Coverity 1199698
2017-12-09 19:31:36 +00:00
Matthew Waters
92c243be62 gl/color: pass large value by reference
Coverity 1199700
2017-12-09 19:31:36 +00:00
Matthew Waters
6c73fa0b5f gl/mem: cache the stride/unpack length for upload 2017-12-09 19:31:36 +00:00
Matthew Waters
1ce0c5356f gl/color: explicitly map the buffers we are copying into
Otherwise it may not be downloaded at all.
2017-12-09 19:31:36 +00:00
Matthew Waters
50ff50c10e gl/color: cache the temporary textures 2017-12-09 19:31:36 +00:00
Matthew Waters
94371dc204 gl/mem: provide defines for tokens not defined in GLES2/ancient platforms 2017-12-09 19:31:36 +00:00
Matthew Waters
7c77c31afd gl: fixup incorrect number of arguments 2017-12-09 19:31:36 +00:00
Matthew Waters
12ecf507b8 gl: fix incorrect usage of g_return_if_fail 2017-12-09 19:31:36 +00:00
Matthew Waters
30c6efc432 gl/mem: allocate the memory per plane
This patch provides the basic infrastructure required for this.
Upload and Download has been ported to this.

Has the nice effect of allowing GstGLMemory to be our
refcounted texture object for any texture type (not just RGBA).

Should not lose any features/video formats.
2017-12-09 19:31:36 +00:00
Matthew Waters
ea2d4cb446 gl/eglimage: #if 0 unused code 2017-12-09 19:31:36 +00:00
Matthew Waters
fba49c3463 gl: add colorconvert object that converts between color spaces/formats
Currently used by both upload and download objects separately.
2017-12-09 19:31:36 +00:00
Vincent Penquerc'h
2767aae4e2 gl: pass large structure by const pointer, not value
Avoids large pointless memcpy.

Coverity 206236, 206237
2017-12-09 19:31:36 +00:00
Vincent Penquerc'h
07565d0ff7 gl: test for frame NULLness before dereferencing it
Coverity 1195172, 1195171
2017-12-09 19:31:36 +00:00
Vincent Penquerc'h
7de81a33ca gl: fix leaks
As the relevant variables are initialized to 0/NULL, we can loop
over the full range and make sure we free partial allocations
when an error happens partway through initialization.
2017-12-09 19:31:36 +00:00
Sebastian Dröge
4ecffcf76b glimagesink: Create GL context and set up window from the streaming thread
gst_gl_context_create() might need to dispatch some operations to the
application's main thread, and calling this in the change_state function
can cause deadlocks.
2017-12-09 19:31:36 +00:00
Tim-Philipp Müller
efeaf7467b tests: fix gl unit tests for recent API changes 2017-12-09 19:31:35 +00:00
Matthew Waters
a20a5d36e2 gl: pass video info's by reference 2017-12-09 19:31:35 +00:00