cocoa: fix native fullscreen

This fixes a couple of issues with the Cocoa `--native-fs` mode, primarily:

 - A ghost titlebar at the top of the screen in full screen:

   This was caused by the window constraining code kicking in during
   fullscreen. Simply returning the unconstrained rect from the constraining
   method fixes the problem.

 - Incorrect behavior when using the titlebar buttons to enter/exit
   fullscreen, as opposed to the OSD button.

   This was caused by mpv's internal fullscreen state going out of sync with
   the NSWindow's one. This was the case because `toggleFullScreen:`
   completely bypassed the normal event flow that mpv expects.

Signed-off-by: Ryan Goulden <percontation@gmail.com>

Change style for mpv, simplify and refactor some of the constraining code.

Signed-off-by: Stefano Pigozzi <stefano.pigozzi@gmail.com>
cocoa: cosmetics: use NSMakeSize
cocoa: move sync section assignments in vo_control
cocoa: add constraints to prevent the window to exit the screen

Previously the window could be made to completly exit the screen with a
combination or moving it close to an edge and halving it's size (via cmd+0).

This commit address the problem in the most simple way possibile by
constraining the window to the closest edge in these edge cases.
cocoa: disallow the titlebar to exit the visibleFrame on the bottom edge
cocoa: use mainScreen as a fallback for window constraining
cocoa: refactor sync scheduling to a function

This extracts the scheduling logic to a single function which is nicer to keep
it consistent.

Additionally make sure we don't schedule sync operations from a sync operation
itself since that could cause deadlocks (even if it should not be happening
with the current code).
TOOLS: make youtube-dl_mpv.sh executable
video: don't drop last frame when deinterlacing with yadif

Or in other words, add support for properly draining remaining frames
from video filters. vf_yadif is buffering at least one frame, and the
buffered frame was not retrieved on EOF.

For most filters, ignore this for now, and just adjust them to the
changed semantics of filter_ext. But for vf_lavfi (used by vf_yadif),
real support is implemented. libavfilter handles this simply by passing
a NULL frame to av_buffersrc_add_frame(), so we just have to make
mp_to_av() handle NULL arguments.

In load_next_vo_frame(), we first try to output a frame buffered in the
VO, then the filter, and then (if EOF is reached and there's still no
new frame) the VO again, with draining enabled. I guess this was
implemented slightly incorrectly before, because the filter chain still
could have had remaining output frames.
vf_lavfi: distinguish real errors from other states

Don't just hide real errors, should a filter return them.
vf_vapoursynth: remove incorrect copyright notice

This file merely started out by copy&pasting vf_lavfi.c and removing
everything to have a basic skeleton.
vf_vapoursynth: fix memory leak on error

Since this leaks video images, and the player keeps feeding new images
to the fitler even if it fails, this would probably have disastrous
consequences.
vf_vapoursynth: use frame durations instead of _AbsoluteTime

Set _DurationNum/_DurationDen on each VS frame, instead of
_AbsoluteTime. The duration is the difference between the timestamp of
the frame and the next frame, and when receiving filtered VS frames, we
convert them back to an absolute PTS by summing them.

We pass the timestamps with microsecond resolution. mpv uses double for
timestamps internally, so we don't know the "real" timebase or FPS. VS
on the other hand uses fractions for frame durations. We can't pass
through the numbers exactly, but microseconds ought to be enough to be
even safe from accumulating rounding errors.
vf_vapoursynth: add more VS frame properties

We only support them for input. The frame properties of output frames
are ignored (except frame durations).

Properties not set for now: _ChromaLocation, _Field, _FieldBased
TOOLS/umpv: make it work with Python 3

Apparently they removed octal literals, and made them invalid syntax.
TOOLS/umpv: allow passing options

But only via a special environment variable.
TOOLS/umpv: allow passing 0 files

Some might use that to just create an empty window with --force-window
--idle (for whatever reasons).
TOOLS/umpv, mpv.desktop: use --no-terminal instead of --really-quiet

So this won't initialize terminal handling if stdout happens to be a
terminal. It also suppresses all output to stdout/stderr.
TOOLS/umpv: don't mangle URLs

This attempted to prefix the current directory to URLs, because it
didn't recognize them as already absolute paths.
TOOLS/umpv: make it work with Python 3 (again)

Apparently, the 3rd (2nd) parameter to string.translate() function was
removed.

Also, make_abs() had a mistake - not sure how this passed testing.