cogl-gst-video-sink: Premultiply the colors coming from the video

Commit 99a53c82e9ab0a1e5 removed the internal format argument when
uploading a video frame to a texture so that the format will just be
determined automatically from the image format. However this also
leaves the premultiplied state at the default and the default is TRUE.
That means that when we upload RGBA data Cogl will do a premultiplied
conversion on the CPU. We probably don't want to be putting a CPU
conversion in the way of video frames so this patch changes it to set
the premultiplied state to FALSE on the textures and then do the
premultiplied conversion in the shader.

This is particularly important for AYUV which uses the alpha channel
for the V component so doing a premultiplied conversion on the CPU
just creates garbage and messes up the image.

The RGB and RGBA renderers have each been split into two; one that
uses GLSL and one that uses a regular pipeline. The RGBA pipeline
without GLSL is then changed to use 2 layers so we that we can do the
premultiplied conversion in the second layer with a special layer
combine string.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 07a57f26596c72507035369c90ed6d62568330b5)
cogl-gst: video-sink: add NV12 support

This adds a cogl-gst renderer to decode NV12 data. NV12 is split into
two buffers, one for the luma component and another for the two
chrominance components at a quarter of the resolution. The second
buffer is uploaded to a two-component RG texture. RG-component
textures are only supported if COGL_FEATURE_ID_TEXTURE_RG is
advertised by Cogl so the NV12 cap is also only advertised when that
is available.

Based on a patch by Lionel Landwerlin which was in turn based on a
patch from Edward Hervey and Matthieu Bouron for Clutter-Gst:

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

Reviewed-by: Robert Bragg <robert@linux.intel.com>
Reviewed-by: Lionel Landwerlin <llandwerlin@gmail.com>
(cherry picked from commit 2c619216964b46aab313be3ef1c405dfc720d258)
cogl-gst: Fix get_caps implementation when no context is set

If no context is set on the CoglGstVideoSink then it would previously
call gst_caps_ref with a NULL pointer. This patch makes it just return
NULL instead. I think that is a valid thing to do because that is what
gst_base_sink_default_get_caps does. If we don't do this then it's not
possible to use CoglGstVideoSink with GstParse because that tries to
link the pipeline after parsing the string. That was previously
causing a critical error because the freshly parsed sink doesn't have
a CoglContext.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
Reviewed-by: Lionel Landwerlin <llandwerlin@gmail.com>
(cherry picked from commit cf26da2964e372c9fe5bd6da060a57006a83af38)
cogl-basic-video-player: Allow passing a GStreamer pipeline

If the URI argument given on the command line doesn't look like a URI
then the basic video player will now try to parse it as a GStreamer
pipeline description. The pipeline must contain a coglsink element
which the player will look for. This can be used to test Cogl GST. For
example, to test NV12 this can be used:

./cogl-basic-video-player 'videotestsrc !
                           video/x-raw,format=(string)NV12 !
                           coglsink'

Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 49e47c8329d50774e365fc7c3a7504b5fc005dc7)
GLX winsys: fix feature handling for INTEL_swap_event

The declaration of INTEL_swap_event was treating winsys features as
if they were a bitfield, but they aren't. The end result was that
instead of reporting two features when INTEL_swap_event is present,
we report none.

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

Reviewed-by: Robert Bragg <robert@linux.intel.com>