Add license.
Fix crash.

When playback request failed for whatever reason, if we were to check for the playback status it would crash due to ic being NULL.
(cherry picked from commit cc1ca2ef2c12cd25cbced5b57b527382d2d70926)
Properly handle multi-part http request in AirPlay video

This commit also adds the basics required to support AirPlay photo. Incidentally, properly handling multi-part data now allows to play videos from the iPhone "Photos" app.
(cherry picked from commit 75541357af4a527057301f8f1b4b2ae0368f47b1)
changed: allow 4 second skew between streams in mov before attempting to seek

Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
(cherry picked from commit e4170c604e6a6af969e5de74ac740ac596686da8)
Apply patch from XBMC by Joakim Plate: "changed: allow 4 second skew between streams in mov before attempting to seek"
(cherry picked from commit d0ea1417db42debc12e56030581e573151960538)

Conflicts:
	mythtv/external/FFmpeg/README.sync
Rewrite of StreamingRingBuffer::safe_read

safe_read was based on FFmpeg's ffurl_read_complete, however when an EOF or an error is encountered, ffurl_read_complete returns the error code rather than the number of bytes read so far.
Rather than wait for FFmpeg to fix it (ref: https://ffmpeg.org/trac/ffmpeg/ticket/2537) ; work around it.
safe_read now will set errno as expected and always return a value >= 0 representing the number of bytes actually read.

Fixes #11263
(cherry picked from commit 8b8ec72b005ecf1cb9d36bb4f82469b3718fefb4)
Ignore network error on an interface that no longer exists.

Under some circumstances, a network interface can disappear during the lifetime of the process. Simply ignore those rather than failing the whole process (by default, networking operations must work on all interfaces found)
(cherry picked from commit fd44e2fcbbc4c3dc6fe835c1d62686fafe3b2833)
If AV codec context doesn't match the context for which it was first opened, close/re-open it.

There's something suspiciously wrong about the way we handle change of streams. This is at best a work-around.

Fixes #11519
(cherry picked from commit 40db16fc3b486042469df8e84290e5d42fc6036f)
Rework RAOP audio sync

commit 9ec7421138adef73ef9cb83b74e046092fecdd6a that fixed audio timestamp calculations revealed an issue in the way RAOP was calculating and setting time syncing.
Rework how things are done: We now calculate the audio card latency and simply drop the initial audio frames amounting for such length of time. From that point on, when we get too far behind we drop all queued audio and restart.

Rather than dropping a whole audio packet at a time (352 frames) we now drop frame by frame, so re-syncs are much smoother.

Surprisingly, this simpler method gives much better results. Synchronisation across multiple airplay device is almost perfect (tested across 2 macs and one linux). Remote audio and video sync are spot on.

Fixes #11530
(cherry picked from commit 96f58cbf4baa16b2008888f92d4ce2fb7e615aec)
Fix possible segfault when exiting a screen when using the Qt painter

This changes MythScreenStack::PopScreen() to call deleteLater() on the
screen rather than immediately deleting it so as to allow any keypressEvent
handlers to complete safely before the screen is deleted when control
returns to the event loop.

Fixes #11383.
(cherry picked from commit c713988707d2c795a2a2abeff817d1b187d4b3f6)
Fix bug in mythtranscodes clean-cutting mechanism

One of the clean-cut methods interacted badly with mythtranscodes
synchronisation algorithm and would sometimes cause frames from
cut segments to be kept. This commit fixes that bug

Refs #11531
MythMusic: append "\r\n" to the Authorization line in the shoutcast header

This fixes a problem with connecting to ice/shoutcast streams requiring
authentication.

Thanks to dashs on irc for finding the error.
(cherry picked from commit bbc5e9cb0df704d3cc96deffbdad2b925031f73e)
MythMusic: remove any username/password when displaying any radio stream URLs
(cherry picked from commit 324738353ef07c8dba811dea4069c7b1112c6c3e)

Conflicts:
	mythtv/libs/libmythmetadata/musicmetadata.cpp
MythMusic: fix compilation after last cherry-pick
Potentially fix segfaults on frontend startup

In nvctrl-util's GetNvidiaRates():
Initialise buf values to NULL, reduce it's size from 256 to 8 since
we're only interested in the first 8 tokens and actually check that we
parsed all 8 from the string before proceeding to use them.

While here change logging from VB_PLAYBACK to VB_GUI which makes more sense.

This may fix some frontend startup segfaults experienced by some
people since we ended up using an area of uninitialised memory in
strtol.

Coverity 746855
(cherry picked from commit 516719ad7e750a258bd2f72f79eae099f79d303b)
Pull in fix for out-of-bounds array write in xine_demux_sputext.cpp from upstream. Coverity 746831
(cherry picked from commit 70309164e52c24a69cc151d3b37036e68e45f096)
Fix fence post error in 516719a
(cherry picked from commit ec3a978eec841652993147940472c9a059c2c14b)
MythSystem: Fix copy/paste in [8532584f]
(cherry picked from commit 1d3ffebc9b81114b1d212dc9b59386fd4717d747)
Mostly revert 788bc510.  It's not needed and created a new bug.

That change was intended to fix a deadlock.  In reality, it only
worked around the deadlock and added a race condition that could cause
delayed handling of reschedule requests.  It was a series of later
changes that actually fixed the deadlocks, so this fix can be fixed by
reverting it.

(cherry picked from commit aafa07e9e314793990e7f58f30bfb6199a430978)
Don't skip over recordings that are still tuning.

Fix a bug where the scheduler sometimes skips over recordings in the
rsTuning state.  This doesn't matter normally as the recording usually
transitiions to the rsRecording state quickly.  When there is a tuning
problem, however, this bug defeats the tuning timeout check in the
scheduler and the recording gets stuck in the tuning state.  This fix
makes sure the tuning check is always done.

(cherry picked from commit f455e491239cc128200db85c90dcab7ea15044c3)