[omxplayer] Avoid hang when closing stream with clock stopped

Avoids a permanent hang at EOF when using IPTV streams
dsound: use accurate position when getting playposition

This flag is Vista+ only, but gives much better accuracy in
delay calculations
AE: Let sinks provide GetDelay function that timestamps values

This uses accurate timer ticks instead of milliseconds to
reduce unneccessary millisecond jitter at later stages.

For now fallbacks exist to not upgrade sinks directly
AE: let timestamps from sink delay propagate as far up as possible
AE: add generic spin locker for low prio consumers
d3d: take scanline into account when calculating vblank time

This increases precision from thread scheduling precision, to normally
sub millisecond precision for the video reference clock.
osx: fix video ref clock to use timestamp of display instead of now

Now represent the time of the call, OutputTime represent when this
frame is to be displayed. Thus technically it's the next vblank,
but i don't think it's worth adjusting for.
osx: add accurate GetDelay() function using timestamps from osx

This uses a lockless approach to get tick/delay/readsize in sync.
It does so by making sure rendercallback is neither running
nor has run at any point while we are grabbing data. The
render callback is high prio, thus this busy wait loop
should only ever trigger for a very short time.
ios: accurate GetDelay() function
win32: add accurate GetDelay() function for WASAPI
AESinkPULSE: Use new GetDelay method to win timestamp
AESinkPULSE: Don't throw packages away if we are not yet ready
Merge pull request #12 from fritsch/clock

AESinkPULSE: Use new AEDelayStatus to get Timestamp for free
AE: if we don't have a tick, don't reduce any set delay
Merge pull request #4778 from popcornmix/closing_iptv

[omxplayer] Skip out of submit loop when closing.
Merge pull request #4842 from elupus/clocks

Improve accuracy of several clocks used as references for dvdplayer
More efficient infobool expression evaluator

Expession infobools are evaluated at runtime from one or more single infobools
and a combination of boolean NOT, AND and OR operators. Previously, parsing
produced a vector of operands (leaf nodes) and operators in postfix
(reverse-Polish) form, and evaluated all leaf nodes every time the expression
was evaluated. But this ignores the fact that in many cases, once one operand
of an AND or OR operation has been evaluated, there is no need to evaluate the
other operand because its value can have no effect on the ultimate result. It
is also worth noting that AND and OR operations are associative, meaning they
can be rearranged at runtime to better suit the selected skin.

This patch rewrites the expression parsing and evaluation code. Now the
internal repreentation is in the form of a tree where leaf nodes represent a
single infobool, and branch nodes represent either an AND or an OR operation
on two or more child nodes.

Expressions are rewritten at parse time into a form which favours the
formation of groups of associative nodes. These groups are then reordered at
evaluation time such that nodes whose value renders the evaluation of the
remainder of the group unnecessary tend to be evaluated first (these are
true nodes for OR subexpressions, or false nodes for AND subexpressions).
The end effect is to minimise the number of leaf nodes that need to be
evaluated in order to determine the value of the expression. The runtime
adaptability has the advantage of not being customised for any particular skin.

The modifications to the expression at parse time fall into two groups:
1) Moving logical NOTs so that they are only applied to leaf nodes.
   For example, rewriting ![A+B]|C as !A|!B|C allows reordering such that
   any of the three leaves can be evaluated first.
2) Combining adjacent AND or OR operations such that each path from the root
   to a leaf encounters a strictly alternating pattern of AND and OR
   operations. So [A|B]|[C|D+[[E|F]|G] becomes A|B|C|[D+[E|F|G]].

I measured the effect while the Videos window of the default skin was open
(but idle) on a Raspberry Pi, and this reduced the CPU usage by 2.8% from
41.9% to 39.1%:

          Before          After
          Mean   StdDev   Mean   StdDev  Confidence  Change
IdleCPU%  41.9   0.5      39.1   0.9     100.0%      +7.0%
Where an infobool expression failed to parse, evaluate the infobool as false. Previously, this would result in a segfault due to the dereferencing of an uninitialised pointer to the head of the expression tree.
Add caching of infolabels

The functions CGUIInfoLabel::GetLabel and CGUIInfoLabel::GetItemLabel take
a number of strings returned from CGUIInfoManager::GetImage or
CGUIInfoManager::GetLabel, and combine them with various constant strings
which were determined during CGUIInfoLabel::Parse.

Rather than perform all the string operations on every call, this patch
changes to use a two-pass process: first it queries all the GetImage/GetLabel
strings, and then only if at least one of them has changed does it bother
rebuilding the resultant string - otherwise it re-uses the copy built on a
preceding call.

CGUIInfoLabel::GetLabel/GetItemLabel are also changed to return string
references, rather than forcing an additional string copy.

I have measured the effect while the Videos window of the default skin was
open (but idle) on a Raspberry Pi, and this reduced the CPU usage by 0.8%
from 36.2% to 35.4%:

          Before          After
          Mean   StdDev   Mean   StdDev  Confidence  Change
IdleCPU%  36.2   0.5      35.4   0.5     99.9%       +2.2%
De-duplication of string cache for non-item and item labels