hlsdemux: replace uridownloader with a GstElement

The GstElement is directly linked into a ghost pad and
its buffers are pushed as received downstream. This way the
buffers are small enough and not a whole fragment that usually
causes extra latency and makes buffering harder
hlsdemux: re-enable decryption after uridownloader removal

Now the decryption is done buffer by buffer instead of on the
whole fragment at once. As it expects multiples of 16 bytes a
GstAdapter was added to properly chunk the buffers.

Also the last buffer must be resized depending on the value of the
last byte of the fragment, so hlsdemux always keeps a pending buffer
as it doesn't know if it is the last one yet
hlsdemux: enable download bitrate measure

Measure the download bitrate to be able to select
the best playlist.

As the buffers are directly pushed downstream and it
might block. The time is only measured from the download
until the pad push and it is started again after the push
returns.
hlsdemux: do not try to run typefind again if caps is the same

Always reset the do_typefind flag if hls did typefind because
trying it on non-zero offsets doesn't make sense and will cause
assertions
hlsdemux: create sources from uri

Instead of using always an http source, create it dynamically from
uri when needed. If not needed just replace the URI on the current
element
hlsdemux: keep connection alive between downloads

Use the same properties as uridownloader to keep connections alive
between consecutive fragments downloads.

1) set keep-alive property to true
2) keep the element in READY instead of in NULL
hlsdemux: fix decryption function return

Correctly return the decrypted buffer when it succeeds and
return NULL otherwise
hlsdemux: decrypt before typefinding

Make sure typefinding gets the decrypted content instead of
trying to typefind the encrypted data.
hlsdemux: properly stop tasks by stopping fragment download

Issue a signal to the fragment download cond to stop
the task earlier
hlsdemux: Track fragments duration

When receving EOS from the internal src, increase the current positon
by the fragment duration to allow correct restoring of download position
if the bitrate changes
hlsdemux: properly flush decryption status on seeks

Avoids mixing decryption of different fragments when seeking happens
and leading to broken stream output.
hlsdemux: Improve pad switching conditions

When using the internal source, hlsdemux doesn't know the caps of
the input before adding the pad, so remove the arguments that would
use that as it is always NULL.

And use an specific flag to signal when a pad switch is required.
Using the discont flag is a bad idea now because when a fragment
download fails it will lead to exposing a pad group without any
data, causing decodebin to abort.
hlsdemux: handle errors from internal source

Set up a message handling function to catch errors from the internal
source and store the last return code to identify error situations
when returning from a fragment download.

Also moves the duration increase to after the download when we
know if it was successful or not
hlsdemux: handle more error cases

Handle some more error cases:

1) When the source element fails to go to ready
2) When decryption fails
3) When there is no source to handle a specific URI
4) When the URI is invalid
hlsdemux: flush the adapter in the end of a fragment

In case of error there might be some data left in the
adapter when EOS is received. Clear the adapter to be
able to restart again later if requested.
hlsdemux: Do not push last buffer after error

In decryption scenario, a buffer is always stored to be sent later
to wait for more data or EOS to be able to strip the final bytes
if requested. In case an error hapenned this buffer can be ignored
and not pushed downstream.
hlsdemux: Only unref pending buffer if there is one
gl: add convenient functions to setup default vertex and fragment shaders

Most of our 2D filters use the same simple vertex shader.
Also define the default fragment shader as the identity.

Avoid duplicating the same vertex and fragment shader text.
gleffects: use new helper functions to avoid duplicating the same vertex shader text

And also use the default fragment shader text for the identity effect
glimagesink: use new helper function to avoid duplicating default shader text