Always show programs that are still recording in ViewScheduled.

Includes a minor change by David Engel.

Backport to fixes/0.27.

Refs #12060
detect cropped HD (720p) content

Fixes #12048
(cherry picked from commit 2a026c45758a495fee0b4a4e7557901c6f701797)
Allow tmdb3.py to use $MYTHCONFDIR as a cache location.

This makes tmdb3.py follow the standard behavior of using MYTHCONFDIR,
falling back to HOME, for its selection of scratch space. This also adds
explicit error reporting to stdout when something goes wrong.

Refs #11876

(cherry picked from commit 2c50a824be1f3083ca966ff0309ea39854452b29)
Some HLS tweaks to make recording more robust when faced with unreliable
feeds.

(cherry picked from commit 7f8dd24816a251d51b3cb42173d7dd19a4ba1a52)
Rewrite qmake detection to better support Qt5
Rewrite qmake detection to better support Qt5 - plugins
Resolve X11/Xlib.h define of Bool and Qt5 (5.2)

Xlib.h has a "#define Bool int", which causes compilation issues with other uses of
Bool, specifically in qsonvalue.h in Qt5.  This patch rearranges the MythTV source file
includes to bypass the issue.

Fixes #12065
Signed-off-by: Stuart Auchterlonie <stuarta@squashedfrog.net>

Signed-off-by: Stuart Auchterlonie <stuarta@mythtv.org>
Remove check_cxxflags which doesn't work
Fix mythnetvision.pro for Qt5
Enable compilation of a couple of files that were disabled on Qt5 because they are apparently not compatible. They build, so let them.
Fix fileringbuffer locking up on read()

From time to time, most often seen during LiveTV, FileRingBuffer::safe_read() would lock and not return for a long time (on my system, it would block in excess of 20s).
Upon investigation, the issue occurs while reading a file currently being written to, if a call to read() encountered EOF, returned early and a following call to read() was made, before another write. Under those conditions, read() wouldn't return for a long time, causing the backend to abort the read and dropping the frontend connection.

So instead we now check the size of the current file via a call to POSIX fstat and never try to read beyond the EOF position.
If the file being read isn't a regular, or fstat returned an error, the old behaviour is used: read until we get as much data as we asked.

Surprisingly, this has fixed most of the issues I've been having for years with liveTV:
- Stuttering or temporary free when close to the live
- Freeze at program transition.

Add debugging information while in file mode

Fixes #12045

(cherry picked from commit 20f7cd2858e79385ceec07b2c19c7e4f84714e18)
Have backend advertise which files are currently being written to

It is necessary in some playback scenarios to know if a file being read is currently being written to. This is useful in determining when encountering EOF if we should wait for more data or abort the read.

MythCoreContext will now keep track of files as they are being opened for writing
Connected frontends will receive the information via the event socket in the form of a BACKEND_MESSAGE event.

The myth protocol is extended with two new BACKEND_MESSAGE events:
FILE_WRITTEN: Sent when a file is opened in write mode, and when the file is being written to (at most every 10s)
FILE_CLOSED: Sent when the file opened in write mode is closed.

The myth protocol version doesn’t have to be increased as frontends will make use of it only if available and the changes are backward compatible with exiting myth protocol.

(cherry picked from commit fafc658597b547e2f0173032515e9790170ebcbe)

Conflicts:
	mythtv/libs/libmythbase/threadedfilewriter.cpp
Prevent playback to exit early should backend's writes be delayed

Typical scenario is when watching on-going recordings and being very close to real time TV: should the backend take more than 360ms between two writes, the reader would treat it as an EOF and abort the read.

When encountering EOF, we now check if the file is being written to in parallel and if so wait.

We can also remove all EOF retries in FileRingBuffer::safe_read() as we definitely know now if we did reach EOF (as we check against the file size).
This allows for almost instantaneous program transition in live TV.

(cherry picked from commit 443b624ebcc8ea56026cb49ca833edc7d73832c1)
Fix typo

CR got deleted for some reason

(cherry picked from commit 534394068373c52fd712d653e5fea725c564a673)
Allow seeking within the entire liveTV chain of recordings.

Seeking across liveTV was fundamentally broken. You could only seek within the current recordings or go to the beginning of the next one or 15s to the end of the previous one.
This changes correct this behaviour. It is now possible to seek across the entire live TV session. We ensure however that we do not seek further than 15s from the end of a recordings (3s if reaching end of live program).

Fixes #12076

(cherry picked from commit 11daeaadc52214605e204cdfe6f7c001c9c1cc9b)
Never attempt to read more than in 512kB blocks

Recalculate the threshold and read block size when we've encountered EOF several times in a row.
512kB ought to be enough to read a file smoothly (famous last words)

This reduces the amount of unnecessary verbosity. When watching a SD 3Mbit/s DVB stream, it will take over a second to get 1MB of data, leading to a warning entry in the log for every single read.

Refs #10428

(cherry picked from commit 1cfdfa3f56876eb20170f33e9592b5c7ffd05064)
Bump API binary number following round of changes in ringbuffers
Change verbosity for some network messages
(cherry picked from commit e6245ca330bc7dcc4d358819a299b28f02f5b5a5)
Apply preroll on virtual tuners when the same multiplex is in use.

Previously, if any tuner in the same input group was already busy,
preroll would not be applied.  Now, if the recording on the other
input is on the same multiplex as the new recording, preroll will be
applied.

Refs #12023

(cherry picked from commit 11e65dfd38ca419b2157f0dbaa19f965647f648c)
MythMusic: add a 'First' resume mode and make 'Off' never resume

This fixes the resume playback feature so that 'Off' never starts playback and
adds a new 'First' mode which starts at the first track in the active playlist.

'Track' and 'Exact' modes remain the same and resume playback at the start of
the track or exact position within the track that was playing when MythMusic
was last exited.

(cherry picked from commit 385011e307c2d5f9d5d6a65663143f27189d1b17)