fix issue #10222: mythcommflag segfaulting

The problem in issue #10222 is that it is adding the CODEC_FLAG2_FAST flag.  This causes unsafe functions to be used, causing a segfault. The proper way to fix this would probably be to figure out how to test for the "experimental speedups" flag, however I don't know the codebase well enough for this.

I tested how this would affect the speed of mythcommflag on one of my recordings.  The results:

Before removing flag:
real 2m13.123s
user 2m16.713s
sys 0m3.502s

After removing flag:
real 2m13.021s
user 2m15.446s
sys 0m3.758s
FIx video scanning following [a05b4d48]. Calling QDir::setFilter() with a negative filter overwrites the default positive filters of QDir::Files | QDir::Dirs.
Generally empty()/isEmpty() is more efficient than using size()
Few more size() replacements with empty() or isEmpty(). Silences some warnings from cppcheck and other SA tools.
Make sure forked process has stopped when deleting MythSystem

This forces a termination in a forked MythSystem process when the
MythSystem object is destroyed, preventing a situation where the private
internal object tries to access resources from the no-longer-existent
parent object.

Fixes #11412
Called methods against wrong object in destructor.

Refs #11412
Sync libdvdnav up to R1251.

* Fix failed assertion when there's no menu.
* Make sure we get nav packets for all cells in multi angle features
* Fix strict aliasing warnings.

Signed-off-by: Stuart Morgan <smorgan@mythtv.org>
Sync libdvdread to R1250:

* Accommodate duplicate language units and pgcs (avoid potentially consuming large amounts of memory)
* Fix a segmentation fault by preventing a read/write beyond end of an array due to using a length value taken from the DVD, which can exceed the allocated size.

Signed-off-by: Stuart Morgan <smorgan@mythtv.org>
Fix h.264 frame/keyframe identification in the player.

If a NAL unit that determines a frame start appears as the last NAL
unit in the packet, then the frame start is not identified until the
start of the next packet.  If this new packet has its own NAL unit
that determines a frame start, and that NAL unit is not at the end of
the packet, then only one frame start would be counted rather than
two.  This is fixed by returning the total number of frame starts,
rather than a bool.

In theory, the same problem could exist in the recorder, but it
appears that the packets in the original recording may have some
trailing NAL units that are stripped by the ffmpeg libraries when
assembling the packet for the player, causing the situation not to
occur.
Add test target to base makefile and the libs makefile.

This introduces a script called unittests.sh which locates all files
matching test_*.pro and then runs the tests those are expected to
generate and complains if either the tests fail or it can't find
the test executable. This script is run on both make test in the
mythtv directory and make test in the mythtv/libs directory.

The lib*/test directories have been added to the subdirs that
libs.pro compiles and a clean of the test_mythtimer.pro target has
been added. This allows a make in mythtv or mythtv/libs to compile
the unit test and a make clean to remove it. It would be nice to
have these targets work from mythtv/libs/libmythbase, but I don't
know how to do that with the current .pro file arrangement.

Note: This and the MythTimer unit test are intended as templates
for other unit tests. Any suggestions for improvement are welcome.
Add unistd.h include for usleep in unit tests.
Add coverage to the unit test framework.
Fix clang build.
Fix broken formatting string (%lld for uint), use QString instead (clang).
Allow the EPG to be called from ViewScheduled and ProgList.

Also add the ability to set the initial time when calling the EPG.
The primary use case for this is to more easily check what shows
preceed a scheduled recording to see if padding needs to be added in
case live programming runs late.
Improve the accuracy of durations computed by the recorder and player.

For the most part, the millisecond timestamps in the seek table match
between the recorder and "mythcommflag --rebuild".

Occasionally the player seems to miss a keyframe entry that the
recoder identifies (but this has nothing to do with duration
calculation), and more rarely the recorder misses a keyframe that the
player finds.  In addition, I have a "troublesome" ATSC channel that
sometimes throws in repeat_pict frames, and that (or maybe something
unrelated) causes some timestamps to be off by 1 millisecond.
Add extra settings to LIBS.

Fixes a build error when Qt is installed in a nonstandard location.
MythArchive: update the encoding profiles to work with the current mythffmpeg

Refs #11299.

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

(cherry picked from 5a0e83a20e8f75612b86fb56039b7803a11afd1b)
MythArchive: update mythburn.py to work with the updated encoding profiles

Refs #11299.

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

(cherry picked from a784b93f1d1c6edbc0b47ac578def5d3275171a8)
MythArchive: update mythburn.py to work with the new mpeg2video codec name

Refs #11299.

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

(cherry picked from 13c3035d1fed13a37c42d872b1f8dafb2e6f556f)