Fix channel detection.

Use new request_channel_layout API

Fixes #12244

(cherry picked from commit cf65b55fe4b11219e1ca6ec80c33debc69b344a2)
Have info and playback screen show proper number of channels

(cherry picked from commit bade69e7a16f64049efa8c16dfda508484a1ada1)
simplify handling of missing endtime at end of file in mythfilldatabase

Instead of making up endtime of "next midnight" and "next 06:00 am" we
just let the database fill in its default of 0000-00-00 00:00 and replace
it later with whatever the next starttime is on that channel.

This has seen very light testing, so I'm commiting it to master only. If
I get positive reports from users I'm happing to merge it into fixes.

Fixes #11541

Reported as working on fixes/0.27 in https://code.mythtv.org/trac/ticket/11541#comment:12
(cherry picked from commit 619b00848a0f272cf4e0529be4fedf48d9c414e9)
MythMusic: Fix smart playlists uses lastplay or date_entered.

(cherry picked from commit 428609b782c5644b2e885d861f19dbb354f344c0)
MythMusic: Fix sql error in SmartPlaylist editor when adding a new playlist.

(cherry picked from commit e5d6a425053e2c6ce747cf8adfd7aaddf4bcb97a)
MythMusic: Fix NULL insert into NOT NULL column in SmartPlaylist editor.

(cherry picked from commit 43b799a5fc57214102d586a01fc755e541e29ccd)
MythMusic: Allow smart playlist to be saved even if it produces no matches. The nature of smart playlists means that it may match tracks in the future.

(cherry picked from commit 2f3f422e507dd5601aa0b0426bc81f59cda020a7)
Sync libdvdread up to R1290:

* Add missing strings.h #include for strcasecmp() / strncasecmp().
* Replace uses of the deprecated dvdcss_handle type by dvdcss_t.
* Replace deprecated dvdcss_title() function by dvdcss_seek().
* Do not extract libdvdcss version via dvdcss_interface_2.
* Add #define for DVDCSS_SEEK_KEY to allow compilation without dvdcss.h.
* If the start offset points past the last_byte (outside the region read) stop reading PTTs and adjust nr_of_srpts.
* Use correct name of the libdvdcss DLL on Windows.
* Fix spelling errors.
* Document warnings generated by DVDs made with the VDR-to-DVD device LG RC590M.
* Add an error message.
* Clear pf_temp to make sure it is initialized.
* Free `cached_dir_base` to fix memory leak.
* Abort when PTT search table has zero entries.
* Use 0 instead of NULL in integer comparison.
(cherry picked from commit 2874f0d150342539644a5838f5147fa4c31f51ff)
Sync libdvdnav up to R1294:

* Add missing strings.h #include for strncasecmp().
* Fix crash when trying to play a DVD from different region than currently set in the DVD drive.
* Prevent segmentation faults in vdnav_describe_title_chapters() in case of parts with missing PGC.
* Let dvdnav_describe_title_chapters() ignore parts where the pgc_start_byte is above the last_byte.
* Let dvdnav_describe_title_chapters() skip PGCs with a cell number of zero.
* Fix integer overflow in dvdnav_convert_time().
* Do not close file twice.
* Make sure program_map is not NULL.
* Let dvdnav_describe_title_chapters() skip PGCs with missing cells.
* Prevent general CPP macro from causing strange behavior.
* Avoid a crash when program number is zero.
* Check for out-of-bounds values for pgcn.
* In vm_new_vm(), use the proper calloc() argument order and don't derive 1 from the unrelated sizeof(char).
(cherry picked from commit 2a6038b5d7bf570e28fd8c3061483b0a22dcd830)
Merge branch 'fixes/0.27' into devel/027candidates
More accurate error message when an IP is passed to GetBackendServerIP() instead of a hostname

(cherry picked from commit cb54c9ce9bac3813a05a63601b4ee0b1f07e518c)
RemoteFile::Exists() - If we've been passed an empty string then don't waste time looking for it.

(cherry picked from commit 66f3d9e396828131d0fbd2a0921ae23a18bf56b1)
CoreContext: Simplify use of IsThisHost, make it work with hostnames

(cherry picked from commit 36a58a15b5a71e8213da183709da390889e784c4)

Conflicts:
	mythtv/libs/libmythbase/mythcorecontext.cpp
	mythtv/libs/libmythmetadata/metadataimagedownload.cpp
Fix doxygen comment

(cherry picked from commit a99e3d30e9ac1f5ca074757b5cf954c940e2c615)
corecontext: Add IsThisBackend API

Will determine if we are a backend, and we are the requested host

(cherry picked from commit be87ab8e4a84a5838c8947d9016d9a85683fe8a1)
UPNP: Fix upnp albumart after move to storage groups.

(cherry picked from commit 62d3892702ed1fdf5c1984839ef0cce6a8323bc0)

Conflicts:
	mythtv/libs/libmythmetadata/musicmetadata.cpp
remotefile: use IsThisBackend API

We really want each backend to look after the hostname they are managing, and not forward everything through the master backend.

(cherry picked from commit ef8694a20a3db8f1da91e78074314cdc635f6cf9)

Conflicts:
	mythtv/libs/libmythbase/remotefile.cpp
Fix more IP vs hostname confusion in myth:// urls

A myth url consists of <group>@<hostname>:<port> where <hostname> is
the unique identifier of a backend, NOT an IP address. Some code
rightly expects to be able to extract the hostname from the URL and
use it as the unique identifier, for example to StorageGroup() or as a
key for DB lookups. The places where an IP was used broke this
assumption and caused the code to take an extended route to complete
it's task, or caused failures.

The 'hostname' will be converted to an IP address only at the point
where we connect to the remote backend to transfer/delete/etc the
file. Since only mythtv is expected to handle myth:// urls this is OK.

Since this has been causing confusion for some time there may be parts
of the code that incorrectly expect an IP address which will have to
be fixed.

(cherry picked from commit 18cd3832585d3d993de9561f07885280c3c2ee8e)

Conflicts:
	mythtv/libs/libmythbase/remotefile.cpp
	mythtv/libs/libmythmetadata/musicmetadata.cpp
	mythtv/programs/mythbackend/mainserver.cpp
	mythtv/programs/mythfrontend/gallerydatabasehelper.cpp
	mythtv/programs/mythfrontend/gallerywidget.cpp
Fix compilation after 27791ae and 55e03d
UPnP: Convert dates and times to local time before serving to the client