Compare commits

...
42 Commits
Author SHA1 Message Date
Jan Ekström 723fd02919 Release 0.29.1 2018-10-02 22:03:41 +03:00
Akemi 7c2368ad7d cocoa-cb: fix side by side Split View
when entering a Split View a windowDidEnterFullScreen event happens
without a previous toggleFullScreen call. in that case it tries to stop
an animation that was never initiated by us and basically breaks the
system initiated fullscreen, or in this case the Split View. immediately
after entering the fullscreen it tries top stop the animation and
resizes the window, which causes the window to exit fullscreen. only
try to stop an animation that was initiated by us and is safe to stop.

(cherry picked from commit 2b0b9bb6a1)
2018-10-02 20:36:55 +03:00
Rodger Combs 008ddf42a1 {mac,cocoa}: trim trailing null out of macosx_icon when loading it
This prevents crashes when loading the application icon image.

Suggested-by: Akemi <der.richter@gmx.de>
(cherry picked from commit 1842a932d3)
2018-10-02 00:42:58 +03:00
Rodger Combs 5b9cf1d0a6 mac: fix crash if we can't get an event tap
without assistive-device permissions the event tap can't be create on
10.14 any more which lead to an assertion.

System Preferences > Security & Privacy > Privacy > Accessibility and
add mpv or your terminal App to the list.

(cherry picked from commit ada4f7c600)
2018-10-02 00:42:51 +03:00
Niklas Haas a985e8ed6b encode: fix AVPacket deinitialization logic
Since this function is called with packets on the stack, trying to free
them makes no sense. Instead, it should unref (which is what
`av_interleaved_write_frame` does anyway, rather than freeing).

Also, the calling code tried unreffing the packet a second time, even
after it was "freed" by the callee in the failure case - and after
ownership was taken over by `av_interleaved_write_frame` in the
successful case. Both of these cases were wrong.

(cherry picked from commit 6d61c5f68a)
2018-10-01 20:29:51 +03:00
wm4 36eeeecff6 demux_lavf: hack-fix EDL mp4 DASH hack
I encountered a stream that fails with "Could not demux init fragment.".
It turns out this is a regression from the recent change to that code.
The assumption was that demux_lavf.c would treat this as concatenated
stream - which it does, but not for probing.

Doing this transparently is hard without doing it properly. Doing it
properly would mean creating some sort of stream_concat (reminiscent of
that FFmpeg security bug). I probably don't want to go there, and I
think libavformat should just support this directly, so whatever.
Hack-fix this with the knowledge that the init segment will always
contain the headers.

(cherry picked from commit 315004a38a)
2018-10-01 18:55:06 +03:00
wm4 e74ffab36e stream_libarchive: fix hangs when demuxer does out of bound seeks
This happened with a .flac file inside an archive. It tried to seek
beyond the end of the archive entry in a format where seeking isn't
supported. stream_libarchive handles these situations by skipping data.
But when the end of the archive is reached, archive_read_data() returns
0. While libarchive didn't bother to fucking document this, they do say
it's supposed to work like read(), so I guess a return value of 0 really
means EOF. So change the "< 0" to "<= 0". Also add some error logging.

The same file actually worked without out of bounds reads when
extracted, so there still might be something very wrong.

(cherry picked from commit 7e85dc2167)
2018-10-01 18:54:54 +03:00
wm4 4f47596043 demux_lavf: v4l streams are not seekable
FFmpeg is retarded enough not to give us any indication whether it is
(unless we query fields not in the ABI/API). I bet FFmpeg developers
love it when library users have to litter their code with duplicated
information.

(cherry picked from commit 20d381d1e9)
2018-10-01 18:54:27 +03:00
Akemi 3e8fd22f07 cocoa-cb: add Apple Software Renderer support
by default the pixel format creation falls back to software renderer
when everything fails. this is mostly needed for VMs. additionally one
can directly request an sw renderer or exclude it entirely.

(cherry picked from commit 8d2d0f0640)
2018-09-30 23:38:11 +03:00
Akemi 53a1a955d7 cocoa-cb: move macOS option retrieval to the earliest point possible
moved the retrieval of the macOS specific options from the backend
initialisation to the initialisation of the CocoaCB class, the earliest
point possible. this way macOS specific options can be used for the
opengl context creation for example.

(cherry picked from commit 44e49aee3c)
2018-09-30 23:38:04 +03:00
Akemi 5a9add1fb3 add swift as main dependency so all dependencies can be disabled easily
(cherry picked from commit 5c2056ad0a)
2018-09-30 23:37:57 +03:00
Akemi 89e52a228c build: check for Swift version and disable dependencies if needed
(cherry picked from commit 50787acb27)
2018-09-30 23:37:50 +03:00
Anton Kindestam 46969b449a drm_atomic: Allow to create atomic context w/o drmprime video plane
This is to improve the experience when running with default settings
on a driver that doesn't have any overlay planes (or indeed only one
plane), but still supports DRM atomic. Since the drmprime video plane
is set to pick an overlay plane by default it would fail on these
drivers due to not being able to create any atomic context. Users with
such cards had to specify --drm-video-plane-id manually to some bogus
value (it's not used after all).

The "video" plane is only ever used by the drmprime-drm hwdec interop,
which is not used at all in the typical usecase where everything is
actually rendered on to the "OSD" plane using EGL, so having an atomic
context without the "video" plane should be fine most of the time.

(cherry picked from commit 810acf32d6)
2018-09-30 17:16:40 +03:00
Anton Kindestam ed9d644e06 manpage: minor fix to --drm-format
Looking at other examples, a bar should be used when listing OPT_CHOICE options.

(cherry picked from commit f277f9f6d2)
2018-09-30 17:16:33 +03:00
Tom Yan 5a7aca4be8 demux/packet: fix demux_packet_shorten
for the rawaudio demuxer to do the expected gapless playback

(cherry picked from commit 95636c65e7)
2018-09-30 12:35:13 +03:00
Jan Ekström af39f87258 travis: enable CI for release branches
(cherry picked from commit 085943df25)
2018-09-29 23:07:19 +03:00
Jan Ekström e0682490d7 ao_alsa: log the ALSA state if we get a non-XRUN error
The ALSA state generally can tell us more information in case we
get an unexpected error.

(cherry picked from commit cea4ff3e5f)
2018-09-29 23:07:19 +03:00
Jan Ekström 03e3abcb0c ao_alsa: handle XRUNs separately from other errors
According to ALSA doxy, EPIPE is a synonym to SND_PCM_STATE_XRUN,
and that is a state that we should attempt to automatically recover
from. In case recovery fails, log an error and return zero.

A warning message will still be output for each XRUN since those
are not something we should generally be receiving.

(cherry picked from commit fdc952486a)
2018-09-29 23:07:19 +03:00
Jan Ekström 1dd77e41c1 ao_alsa: early exit get_space if paused or ALSA is not ready
This has been way too long coming, and for me to notice that a
whole lot of ao_alsa functions do an early return if the AO is
paused.

For the STATE_SETUP case, I had this reproduced once, and never
since. Still, seems like we can start calling this function before
the ALSA device has been fully initialized so we might as well
early exit in that case.

(cherry picked from commit 3218a58082)
2018-09-29 23:07:19 +03:00
Ricardo Constantino 8e0b94e7eb man/options: emphasize ytdl_hook's script options
(cherry picked from commit 9c184078a6)
2018-09-29 23:07:15 +03:00
Ricardo Constantino 0f7b08b0fc ytdl_hook: fix audio not being picked up for some sites
(cherry picked from commit 9dbab9661c)
2018-09-29 23:06:49 +03:00
Niklas Haas a8a4c7def7 ao_jack: only auto-connect to audio ports
This prevents ao_jack from auto-connecting to MIDI ports (or other,
hypothetical future port types).

(cherry picked from commit fed0ea111b)
2018-09-29 23:06:49 +03:00
TSaaristo c994a81aa4 encode: fix expected streams when using --lavfi-complex
mpctx->current_track[0][STREAM_VIDEO] (and STREAM_AUDIO) are empty when
using --lavfi-complex. Moving the muxer stream hinting after audio/video chain
initialization and checking if the chains exist fixes encoding with --lavfi-complex.

Previously, the output audio/video streams did not get prepared and the encode
would fail due to unexpected stream addition.

(cherry picked from commit 3744d0bda9)
2018-09-29 23:06:49 +03:00
Niklas Haas 5ae13ad13b mp_image: strip all HDR peak information from SDR clips
By overriding it with 1.0 (aka SDR). This prevents blowing up on
mistagged clips.

Fixes #6111

(cherry picked from commit 48c38f730d)
2018-09-29 23:06:49 +03:00
Tom Yan 0a92548684 ao_pulse: fix tlength calculation
also remove the now unused non-sensical af_fmt_seconds_to_bytes.

(cherry picked from commit 9d6b15ab32)
2018-09-29 23:06:49 +03:00
Michael Hoang 56098c5636 Revert "ao_openal: enable building on OSX"
This reverts commit af6126adbe. Apple's
OpenAL support is ridiculously out of date, revert back to just using
OpenAL Soft on macOS (fixes #4645).

(cherry picked from commit 91786fa99c)
2018-09-29 23:06:49 +03:00
Niklas Haas 312b88d360 vo_gpu: avoid overwriting compute shader block sizes
When using multiple compute shaders as part of the same pass, there can
be a conflict in the block sizes. In the problematic case, the HDR
detection shader can collide with the polar sampling shader. In this
case, the solution is clear - the passes that can handle any size should
"give in" and not overwrite the block sizes.

Fixes #6083.

(cherry picked from commit 1890ca024e)
2018-09-29 23:06:49 +03:00
Hector Martin b97f172faa af_rubberband: reset delay to 0 on reset
This fixes A-V drift on seeking

(cherry picked from commit a10754f038)
2018-09-29 23:06:49 +03:00
Anton Kindestam f3a58e5f4a manpage: fix reference to --tone-mapping by old option name
(cherry picked from commit d2d7dba6ee)
2018-09-29 23:06:49 +03:00
Ricardo Constantino 49606f5a3b ytdl_hook: always load ytdl:// links with ytdl_hook first
Suggested in IRC by sfan5.

(cherry picked from commit d8131568c8)
2018-09-29 23:06:03 +03:00
Michael Hoang 7d5468ace3 osx: Fix initialization and access of service menu
Replace dot syntax with accessor syntax so that clang no longer errors
out due to not finding the property servicesMenu on NSApp.

(cherry picked from commit 4e9e46b9f8)
2018-09-29 22:22:20 +03:00
Akemi a4e7580c5a cocoa-cb: fix crash on macOS 10.10
the colorspace of the layer is only available on 10.11 and upwards.

Fixes #6041

(cherry picked from commit 049816c145)
2018-09-29 22:22:20 +03:00
Akemi 7b91bf7f20 cocoa-cb: fix crash when no screen is available
instead of force unwrapping and chaining the optional vars in our
containsMouseLocation function, safely unwrap and guard the resulting
var.

Fixes #6062

(cherry picked from commit 6bf0edc59c)
2018-09-29 22:22:20 +03:00
Tom Yan 4243d06761 audio/format: decouple af_fmt_is_planar from af_fmt_to_planar
so that af_fmt_to_planar (and hence af_fmt_from_planar) can just
return the input when it is not an interleaved (planar) format.

(cherry picked from commit f2311ff514)
2018-09-29 22:22:20 +03:00
jaseg 4d074a960d manpage: Correct show-text duration default value
duration is parsed as an integer, and the default value is used if ```-1``` is passed. Passing ```-``` as described here causes a parameter value error.

(cherry picked from commit cfecbac863)
2018-09-29 22:22:20 +03:00
pavelxdd 071556efee manpage: fix --vf exclamation mark description
An exclamation mark disables the filter by default instead of
enabling it.

(cherry picked from commit 759a6a259e)
2018-09-29 22:22:20 +03:00
Tom Yan 876341417a audio/format: minor fix for af_fmt_from_planar
See af_fmt_to_planar.

(cherry picked from commit 4e91cb72ef)
2018-09-29 22:22:20 +03:00
Martin Herkt 6a57e1a298 ci: explicitly call waf with python3
Python 2 may not be present in the CI images in the future,
but waf’s shebang line still uses its executable name.
Explicitly call the right major version of the interpreter.

(cherry picked from commit 6eb59fea2f)
2018-09-29 22:22:20 +03:00
Jan Ekström 0e316d7032 ci: do bootstrap outside the docker container
This way the docker container in itself does no networking.

It seems like travis disabled network access from the actual docker
containers.

(cherry picked from commit 2d785f3ea3)
2018-09-29 22:22:20 +03:00
Yclept Nemo 0914da082f stream_smb/stream_file: fix write_buffer
Functions `write` and `smbc_write` are given a diminishing buffer of
incorrect constant size. After partial writes, the code would do another
write of the full original length, failing to subtract the amount
already written.
2018-07-29 12:59:03 +03:00
Yclept Nemo 021bea1592 stream_smb: locking to bypass libsmbclient issues
Thread-unsafe libsmbclient is likely to crash when used simultaneously
across threads. For example, by:

    mpv "smb://...mkv" --sub-file "smb://...srt"

Work around this by locking all calls to this library under a single
global mutex. This is a temporary solution. When the libsmbclient bug
[1] is fixed, switch to the code from branch [2] which uses a new api to
create per-thread smb contexts. Fixes [3].

[1] https://bugzilla.samba.org/show_bug.cgi?id=11413
[2] https://github.com/orbisvicis/mpv/tree/smbclient_threaded_api
[3] https://github.com/mpv-player/mpv/issues/5936

(cherry picked from commit 112b3fa922)
2018-07-29 12:59:03 +03:00
Daniel M. Capella 0d134dc010 manpage: fixup mistaken show playlist/track-list shortcuts
This was mistaken in 496b13227b and
not noticed in review.

(cherry picked from commit 45beb7073a)
2018-07-23 01:33:53 +03:00
44 changed files with 304 additions and 157 deletions

No files matched your search

+2
View File
@@ -27,10 +27,12 @@ branches:
- master
- ci
- coverity_scan
- /release\/.*$/
before_install:
- docker pull $CONTAINER
script:
- ./bootstrap.py
- docker run --env CC --env TARGET -v $TRAVIS_BUILD_DIR:/build $CONTAINER /bin/sh -c "cd /build && $CI_SCRIPT"
after_failure: cat ./build/config.log
after_script: TOOLS/travis-rebuild-website
+2
View File
@@ -19,6 +19,8 @@ Interface changes
::
--- mpv 0.29.1 ---
- add --cocoa-cb-sw-renderer to control the usage of Apple Software Renderer
--- mpv 0.29.0 ---
- drop --opensles-sample-rate, as --audio-samplerate should be used if desired
- drop deprecated --videotoolbox-format, --ff-aid, --ff-vid, --ff-sid,
+1 -1
View File
@@ -350,7 +350,7 @@ List of Input Commands
Print text to stdout. The string can contain properties (see
`Property Expansion`_).
``show-text "<string>" [<duration>|- [<level>]]``
``show-text "<string>" [<duration>|-1 [<level>]]``
Show text on the OSD. The string can contain properties, which are expanded
as described in `Property Expansion`_. This can be used to show playback
time, filename, and so on.
+2 -2
View File
@@ -210,11 +210,11 @@ Alt + and Alt -
Alt+BACKSPACE
Reset the pan/zoom settings.
F9
F8
Show the playlist and the current position in it (useful only if a UI window
is used, broken on the terminal).
F10
F9
Show the list of audio and subtitle streams (useful only if a UI window is
used, broken on the terminal).
+15 -7
View File
@@ -540,19 +540,15 @@ Program Behavior
If the script can't do anything with an URL, it will do nothing.
The `try_ytdl_first` script option accepts a boolean 'yes' or 'no', and if
The ``try_ytdl_first`` script option accepts a boolean 'yes' or 'no', and if
'yes' will try parsing the URL with youtube-dl first, instead of the default
where it's only after mpv failed to open it. This mostly depends on whether
most of your URLs need youtube-dl parsing.
The `exclude` script option accepts a ``|``-separated list of URL patterns
The ``exclude`` script option accepts a ``|``-separated list of URL patterns
which mpv should not use with youtube-dl. The patterns are matched after
the ``http(s)://`` part of the URL.
The `use_manifests` script option makes mpv use the master manifest URL for
formats like HLS and DASH, if available, allowing for video/audio selection
in runtime. It's disabled ("no") by default for performance reasons.
``^`` matches the beginning of the URL, ``$`` matches its end, and you
should use ``%`` before any of the characters ``^$()%|,.[]*+-?`` to match
that character.
@@ -567,6 +563,9 @@ Program Behavior
See more lua patterns here: https://www.lua.org/manual/5.1/manual.html#5.4.1
The ``use_manifests`` script option makes mpv use the master manifest URL for
formats like HLS and DASH, if available, allowing for video/audio selection
in runtime. It's disabled ("no") by default for performance reasons.
``--ytdl-format=<best|worst|mp4|webm|...>``
Video format/quality that is directly passed to youtube-dl. The possible
@@ -4882,6 +4881,15 @@ The following video options are currently all specific to ``--vo=gpu`` and
OS X only.
``--cocoa-cb-sw-renderer=<yes|no|auto>``
Use the Apple Software Renderer when using cocoa-cb (default: auto). If set
to ``no`` the software renderer is never used and instead fails when a the
usual pixel format could not be created, ``yes`` will always only use the
software renderer, and ``auto`` only falls back to the software renderer
when the usual pixel format couldn't be created.
OS X only.
``--macos-title-bar-style=<dark|ultradark|light|mediumlight|auto>``
Sets the styling of the title bar (default: dark).
OS X and cocoa-cb only
@@ -5175,7 +5183,7 @@ The following video options are currently all specific to ``--vo=gpu`` and
desaturating everything. Developed by John Hable for use in video
games. Use this when you care about detail preservation more than
color/brightness accuracy. This is roughly equivalent to
``--hdr-tone-mapping=reinhard --tone-mapping-param=0.24``. If possible,
``--tone-mapping=reinhard --tone-mapping-param=0.24``. If possible,
you should also enable ``--hdr-compute-peak`` for the best results.
(Default)
gamma
+1 -1
View File
@@ -16,7 +16,7 @@ The exact syntax is:
name is an arbitrary user-given name, which identifies the filter. This
is only needed if you want to toggle the filter at runtime.
A ``!`` before the filter name means the filter is enabled by default. It
A ``!`` before the filter name means the filter is disabled by default. It
will be skipped on filter creation. This is also useful for runtime filter
toggling.
+1 -1
View File
@@ -502,7 +502,7 @@ Available video output drivers are:
supports several layers) together with ``vo=gpu`` and ``gpu-context=drm``.
(default: first overlay plane)
``--drm-format=<xrgb8888,xrgb2101010>``
``--drm-format=<xrgb8888|xrgb2101010>``
Select the DRM format to use (default: xrgb8888). This allows you to
choose the bit depth of the DRM mode. xrgb8888 is your usual 24 bit per
pixel/8 bits per channel packed RGB format with 8 bits of padding.
+41
View File
@@ -1,3 +1,44 @@
Release 0.29.1
==============
A bug fix release for the 0.29 release branch.
Fixes and Minor Enhancements
----------------------------
- af_rubberband: Fix for A-V drift on seeking.
- ao_alsa: Fixes to remove spam during pausing and end-of-file.
- ao_jack: Fix for mpv attempting to connect to non-standard devices such as MIDI.
- ao_openal: Drop support for Apple's bundled OpenAL due to lack of features to successfully build.
- ao_pulse: Fix for audio buffer length calculation.
- demux_lavf: Fix EDL playback of certain DASH streams.
- demux_lavf: Mark v4l streams as not seekable.
- demux_raw: Fix for gapless playback from raw audio input.
- drm_atomic: Fix to enable video output with devices without a video overlay plane.
- encode: Fix for crashes in case of failure to write to output.
- encode: Fix for encoding when utilizing lavfi-complex.
- Fix to strip HDR peak metadata if attached to SDR video (#6111)
- macOS: Capability to fall back on SW rendering for testing purposes.
- macOS: Fix for issues with the main menu.
- macOS: Fix for side by side split view.
- macOS: Fixes for crashes, most notably those happening on 10.14 (#5908, #6097, #6041, #6062).
- macOS: No longer let older, unsupported versions of the Swift build tools through configure.
- manpage: Misc fixups.
- stream_{smb,file}: Fix for partial writes to buffers.
- stream_libarchive: Fix hang when an out-of-bound seek happens.
- stream_smb: Fix for crashes due to libsmbclient and threading (#5936).
- vo_gpu: Fix for corruption when multiple compute shaders override each others' block sizes (#6083).
- ytdl_hook: Always load "ytdl://" URLs with ytdl_hook first.
- ytdl_hook: Fix audio streams not being picked up for some sites.
Options and Commands
--------------------
Added
~~~~~
- `--cocoa-cb-sw-renderer` to control whether or not to fall back on software rendering on macOS.
Release 0.29.0
==============
+1 -1
View File
@@ -1 +1 @@
0.29.0
0.29.1
+2
View File
@@ -167,6 +167,7 @@ static void process(struct mp_filter *f)
if (eof) {
mp_pin_in_write(f->ppins[1], MP_EOF_FRAME);
rubberband_reset(p->rubber);
p->rubber_delay = 0;
TA_FREEP(&p->pending);
p->sent_final = false;
return;
@@ -263,6 +264,7 @@ static void reset(struct mp_filter *f)
if (p->rubber)
rubberband_reset(p->rubber);
p->rubber_delay = 0;
p->sent_final = false;
TA_FREEP(&p->pending);
}
+14 -24
View File
@@ -55,12 +55,6 @@ bool af_fmt_is_int(int format)
return format && !af_fmt_is_spdif(format) && !af_fmt_is_float(format);
}
// false for interleaved and AF_FORMAT_UNKNOWN
bool af_fmt_is_planar(int format)
{
return format && af_fmt_to_planar(format) == format;
}
bool af_fmt_is_spdif(int format)
{
return af_format_sample_alignment(format) > 1;
@@ -79,23 +73,30 @@ static const int planar_formats[][2] = {
{AF_FORMAT_DOUBLEP, AF_FORMAT_DOUBLE},
};
bool af_fmt_is_planar(int format)
{
for (int n = 0; n < MP_ARRAY_SIZE(planar_formats); n++) {
if (planar_formats[n][0] == format)
return true;
}
return false;
}
// Return the planar format corresponding to the given format.
// If the format is already planar, return it.
// Return 0 if there's no equivalent.
// If the format is already planar or if there's no equivalent,
// return it.
int af_fmt_to_planar(int format)
{
for (int n = 0; n < MP_ARRAY_SIZE(planar_formats); n++) {
if (planar_formats[n][1] == format)
return planar_formats[n][0];
if (planar_formats[n][0] == format)
return format;
}
return 0;
return format;
}
// Return the interleaved format corresponding to the given format.
// If the format is already interleaved, return it.
// Always succeeds if format is actually planar; otherwise return 0.
// If the format is already interleaved or if there's no equivalent,
// return it.
int af_fmt_from_planar(int format)
{
for (int n = 0; n < MP_ARRAY_SIZE(planar_formats); n++) {
@@ -134,17 +135,6 @@ const char *af_fmt_to_str(int format)
return "??";
}
int af_fmt_seconds_to_bytes(int format, float seconds, int channels, int samplerate)
{
assert(!af_fmt_is_planar(format));
int bps = af_fmt_to_bytes(format);
int framelen = channels * bps;
int bytes = seconds * bps * samplerate;
if (bytes % framelen)
bytes += framelen - (bytes % framelen);
return bytes;
}
void af_fill_silence(void *dst, size_t bytes, int format)
{
memset(dst, af_fmt_is_unsigned(format) ? 0x80 : 0, bytes);
-3
View File
@@ -64,9 +64,6 @@ bool af_fmt_is_pcm(int format);
int af_fmt_to_planar(int format);
int af_fmt_from_planar(int format);
// Amount of bytes that contain audio of the given duration, aligned to frames.
int af_fmt_seconds_to_bytes(int format, float seconds, int channels, int samplerate);
void af_fill_silence(void *dst, size_t bytes, int format);
void af_get_best_sample_formats(int src_format, int *out_formats);
+15 -3
View File
@@ -940,12 +940,24 @@ static int get_space(struct ao *ao)
{
struct priv *p = ao->priv;
// in case of pausing or the device still being configured,
// just return our buffer size.
if (p->paused || snd_pcm_state(p->alsa) == SND_PCM_STATE_SETUP)
return p->buffersize;
snd_pcm_sframes_t space = snd_pcm_avail(p->alsa);
if (space < 0) {
MP_ERR(ao, "Error received from snd_pcm_avail (%ld, %s)!\n",
space, snd_strerror(space));
if (space == -EPIPE) // EOF
if (space == -EPIPE) {
MP_WARN(ao, "ALSA XRUN hit, attempting to recover...\n");
int err = snd_pcm_prepare(p->alsa);
CHECK_ALSA_ERROR("Unable to recover from under/overrun!");
return p->buffersize;
}
MP_ERR(ao, "Error received from snd_pcm_avail "
"(%ld, %s with ALSA state %s)!\n",
space, snd_strerror(space),
snd_pcm_state_name(snd_pcm_state(p->alsa)));
// request a reload of the AO if device is not present,
// then error out.
+2 -1
View File
@@ -143,7 +143,8 @@ connect_to_outports(struct ao *ao)
if (!port_name)
port_flags |= JackPortIsPhysical;
matching_ports = jack_get_ports(p->client, port_name, NULL, port_flags);
const char *port_type = JACK_DEFAULT_AUDIO_TYPE; // exclude MIDI ports
matching_ports = jack_get_ports(p->client, port_name, port_type, port_flags);
if (!matching_ports || !matching_ports[0]) {
MP_FATAL(ao, "no ports to connect to\n");
-14
View File
@@ -24,19 +24,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#ifdef __APPLE__
#ifndef AL_FORMAT_MONO_FLOAT32
#define AL_FORMAT_MONO_FLOAT32 0x10010
#endif
#ifndef AL_FORMAT_STEREO_FLOAT32
#define AL_FORMAT_STEREO_FLOAT32 0x10011
#endif
#ifndef AL_FORMAT_MONO_DOUBLE_EXT
#define AL_FORMAT_MONO_DOUBLE_EXT 0x10012
#endif
#include <OpenAL/MacOSX_OALExtensions.h>
#else
#ifdef OPENAL_AL_H
#include <OpenAL/alc.h>
#include <OpenAL/al.h>
@@ -46,7 +33,6 @@
#include <AL/al.h>
#include <AL/alext.h>
#endif
#endif // __APPLE__
#include "common/msg.h"
+3 -3
View File
@@ -454,11 +454,11 @@ static int init(struct ao *ao)
pa_stream_set_write_callback(priv->stream, stream_request_cb, ao);
pa_stream_set_latency_update_callback(priv->stream,
stream_latency_update_cb, ao);
int buf_size = af_fmt_seconds_to_bytes(ao->format, priv->cfg_buffer / 1000.0,
ao->channels.num, ao->samplerate);
uint32_t buf_size = ao->samplerate * (priv->cfg_buffer / 1000.0) *
af_fmt_to_bytes(ao->format) * ao->channels.num;
pa_buffer_attr bufattr = {
.maxlength = -1,
.tlength = buf_size > 0 ? buf_size : (uint32_t)-1,
.tlength = buf_size > 0 ? buf_size : -1,
.prebuf = -1,
.minreq = -1,
.fragsize = -1,
+2 -3
View File
@@ -16,8 +16,7 @@ export RANLIB=$TARGET-ranlib
export CFLAGS="-O2 -mtune=intel -g -ggdb -pipe -Wall --param=ssp-buffer-size=4 -mms-bitfields -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fexceptions -fasynchronous-unwind-tables -fstack-protector-strong -fno-ident"
export LDFLAGS="-Wl,--no-keep-memory -fstack-protector-strong"
./bootstrap.py
./waf configure \
python3 ./waf configure \
--enable-static-build \
--enable-libmpv-shared \
--enable-lua \
@@ -32,4 +31,4 @@ export LDFLAGS="-Wl,--no-keep-memory -fstack-protector-strong"
--enable-shaderc \
--enable-rubberband \
--enable-lcms2
./waf build --verbose
python3 ./waf build --verbose
+2 -3
View File
@@ -1,8 +1,7 @@
#!/bin/sh
set -e
./bootstrap.py
./waf configure \
python3 ./waf configure \
--enable-cdda \
--enable-dvbin \
--enable-dvdnav \
@@ -14,4 +13,4 @@ set -e
--enable-shaderc \
--enable-vulkan \
--enable-zsh-comp
./waf build --verbose
python3 ./waf build --verbose
+4 -3
View File
@@ -436,7 +436,7 @@ done:
return dst;
}
// Write a packet. Callee will create new pkt refs as needed.
// Write a packet. This will take over ownership of `pkt`
static void encode_lavc_add_packet(struct mux_stream *dst, AVPacket *pkt)
{
struct encode_lavc_context *ctx = dst->ctx;
@@ -476,6 +476,7 @@ static void encode_lavc_add_packet(struct mux_stream *dst, AVPacket *pkt)
if (av_interleaved_write_frame(p->muxer, pkt) < 0) {
MP_ERR(p, "Writing packet failed.\n");
p->failed = true;
pkt = NULL;
goto done;
}
@@ -483,7 +484,8 @@ static void encode_lavc_add_packet(struct mux_stream *dst, AVPacket *pkt)
done:
pthread_mutex_unlock(&ctx->lock);
av_packet_free(&pkt);
if (pkt)
av_packet_unref(pkt);
}
void encode_lavc_discontinuity(struct encode_lavc_context *ctx)
@@ -949,7 +951,6 @@ bool encoder_encode(struct encoder_context *p, AVFrame *frame)
break;
encode_lavc_add_packet(p->mux_stream, &packet);
av_packet_unref(&packet);
}
return true;
+6
View File
@@ -162,6 +162,8 @@ static const struct format_hack format_hacks[] = {
{"mp4", .skipinfo = true, .fix_editlists = true},
{"matroska", .skipinfo = true},
{"v4l2", .no_seek = true},
// In theory, such streams might contain timestamps, but virtually none do.
{"h264", .if_flags = AVFMT_NOTIMESTAMPS },
{"hevc", .if_flags = AVFMT_NOTIMESTAMPS },
@@ -428,6 +430,10 @@ static int lavf_check_file(demuxer_t *demuxer, enum demux_check check)
int nsize = av_clip(avpd.buf_size * 2, INITIAL_PROBE_SIZE,
PROBE_BUF_SIZE);
bstr buf = stream_peek(s, nsize);
if (demuxer->params && demuxer->params->init_fragment.len) {
buf = demuxer->params->init_fragment;
buf.len = MPMIN(buf.len, nsize);
}
if (buf.len <= avpd.buf_size)
final_probe = true;
memcpy(avpd.buf, buf.start, buf.len);
+2 -2
View File
@@ -110,8 +110,8 @@ struct demux_packet *new_demux_packet(size_t len)
void demux_packet_shorten(struct demux_packet *dp, size_t len)
{
assert(len <= dp->len);
dp->len = len;
memset(dp->buffer + dp->len, 0, AV_INPUT_BUFFER_PADDING_SIZE);
av_shrink_packet(dp->avpacket, len);
dp->len = dp->avpacket->size;
}
void free_demux_packet(struct demux_packet *dp)
+6
View File
@@ -45,6 +45,12 @@ class MPVHelper: NSObject {
mpctx = UnsafeMutablePointer<MPContext>(mp_client_get_core(mpvHandle))
inputContext = mpctx!.pointee.input
if let app = NSApp as? Application {
let ptr = mp_get_config_group(mpctx!, mp_client_get_global(mpvHandle),
app.getMacOSConf())
macOpts = UnsafeMutablePointer<macos_opts>(OpaquePointer(ptr))!.pointee
}
mpv_observe_property(mpvHandle, 0, "ontop", MPV_FORMAT_FLAG)
mpv_observe_property(mpvHandle, 0, "border", MPV_FORMAT_FLAG)
mpv_observe_property(mpvHandle, 0, "keepaspect-window", MPV_FORMAT_FLAG)
+1
View File
@@ -23,6 +23,7 @@
struct macos_opts {
int macos_title_bar_style;
int macos_fs_animation_duration;
int cocoa_cb_sw_renderer;
};
// multithreaded wrapper for mpv_main
+5 -1
View File
@@ -49,11 +49,14 @@ const struct m_sub_options macos_conf = {
OPT_CHOICE_OR_INT("macos-fs-animation-duration",
macos_fs_animation_duration, 0, 0, 1000,
({"default", -1})),
OPT_CHOICE("cocoa-cb-sw-renderer", cocoa_cb_sw_renderer, 0,
({"auto", -1}, {"no", 0}, {"yes", 1})),
{0}
},
.size = sizeof(struct macos_opts),
.defaults = &(const struct macos_opts){
.macos_fs_animation_duration = -1,
.cocoa_cb_sw_renderer = -1,
},
};
@@ -124,8 +127,9 @@ static const char macosx_icon[] =
- (NSImage *)getMPVIcon
{
// The C string contains a trailing null, so we strip it away
NSData *icon_data = [NSData dataWithBytesNoCopy:(void *)macosx_icon
length:sizeof(macosx_icon)
length:sizeof(macosx_icon) - 1
freeWhenDone:NO];
return [[NSImage alloc] initWithData:icon_data];
}
+12 -9
View File
@@ -375,7 +375,8 @@ void cocoa_set_mpv_handle(struct mpv_handle *ctx)
- (void)restartMediaKeys
{
CGEventTapEnable(self->_mk_tap_port, true);
if (self->_mk_tap_port)
CGEventTapEnable(self->_mk_tap_port, true);
}
- (void)setHighestPriotityMediaKeysTap
@@ -410,10 +411,10 @@ void cocoa_set_mpv_handle(struct mpv_handle *ctx)
tap_event_callback,
self);
assert(self->_mk_tap_port != nil);
NSMachPort *port = (NSMachPort *)self->_mk_tap_port;
[[NSRunLoop mainRunLoop] addPort:port forMode:NSRunLoopCommonModes];
if (self->_mk_tap_port) {
NSMachPort *port = (NSMachPort *)self->_mk_tap_port;
[[NSRunLoop mainRunLoop] addPort:port forMode:NSRunLoopCommonModes];
}
});
}
@@ -421,10 +422,12 @@ void cocoa_set_mpv_handle(struct mpv_handle *ctx)
{
dispatch_async(dispatch_get_main_queue(), ^{
NSMachPort *port = (NSMachPort *)self->_mk_tap_port;
CGEventTapEnable(self->_mk_tap_port, false);
[[NSRunLoop mainRunLoop] removePort:port forMode:NSRunLoopCommonModes];
CFRelease(self->_mk_tap_port);
self->_mk_tap_port = nil;
if (port) {
CGEventTapEnable(self->_mk_tap_port, false);
[[NSRunLoop mainRunLoop] removePort:port forMode:NSRunLoopCommonModes];
CFRelease(self->_mk_tap_port);
self->_mk_tap_port = nil;
}
});
}
+2 -2
View File
@@ -602,7 +602,7 @@
- (NSMenu *)mainMenu
{
NSMenu *mainMenu = [[NSMenu alloc] initWithTitle:@"MainMenu"];
NSApp.servicesMenu = [NSMenu alloc];
[NSApp setServicesMenu:[[NSMenu alloc] init]];
for(id mMenu in menuTree) {
NSMenu *menu = [[NSMenu alloc] initWithTitle:mMenu[@"name"]];
@@ -633,7 +633,7 @@
}
if ([subMenu[@"name"] isEqual:@"Services"]) {
iItem.submenu = NSApp.servicesMenu;
iItem.submenu = [NSApp servicesMenu];
}
}
}
+9 -9
View File
@@ -1296,21 +1296,21 @@ static void play_current_file(struct MPContext *mpctx)
update_demuxer_properties(mpctx);
if (mpctx->encode_lavc_ctx) {
if (mpctx->current_track[0][STREAM_VIDEO])
encode_lavc_expect_stream(mpctx->encode_lavc_ctx, STREAM_VIDEO);
if (mpctx->current_track[0][STREAM_AUDIO])
encode_lavc_expect_stream(mpctx->encode_lavc_ctx, STREAM_AUDIO);
encode_lavc_set_metadata(mpctx->encode_lavc_ctx,
mpctx->demuxer->metadata);
}
update_playback_speed(mpctx);
reinit_video_chain(mpctx);
reinit_audio_chain(mpctx);
reinit_sub_all(mpctx);
if (mpctx->encode_lavc_ctx) {
if (mpctx->vo_chain)
encode_lavc_expect_stream(mpctx->encode_lavc_ctx, STREAM_VIDEO);
if (mpctx->ao_chain)
encode_lavc_expect_stream(mpctx->encode_lavc_ctx, STREAM_AUDIO);
encode_lavc_set_metadata(mpctx->encode_lavc_ctx,
mpctx->demuxer->metadata);
}
if (!mpctx->vo_chain && !mpctx->ao_chain && opts->stream_auto_sel) {
MP_FATAL(mpctx, "No video or audio streams selected.\n");
mpctx->error_playing = MPV_ERROR_NOTHING_TO_PLAY;
+25 -9
View File
@@ -314,8 +314,8 @@ local function add_single_video(json)
if track.vcodec and track.vcodec ~= "none" then
-- video track
streamurl = edl_track or track.url
elseif track.acodec and track.acodec ~= "none" and track.vcodec == "none" then
-- audio track
elseif track.vcodec == "none" then
-- according to ytdl, if vcodec is None, it's audio
mp.commandv("audio-add",
edl_track or track.url, "auto",
track.format_note or "")
@@ -429,12 +429,7 @@ local function add_single_video(json)
mp.set_property_native("file-local-options/stream-lavf-o", stream_opts)
end
mp.add_hook(o.try_ytdl_first and "on_load" or "on_load_fail", 10, function ()
local url = mp.get_property("stream-open-filename", "")
if not (url:find("ytdl://") == 1) and
not ((url:find("https?://") == 1) and not is_blacklisted(url)) then
return
end
function run_ytdl_hook(url)
local start_time = os.clock()
-- check for youtube-dl in mpv's config dir
@@ -655,8 +650,29 @@ mp.add_hook(o.try_ytdl_first and "on_load" or "on_load_fail", 10, function ()
add_single_video(json)
end
msg.debug('script running time: '..os.clock()-start_time..' seconds')
end)
end
if (not o.try_ytdl_first) then
mp.add_hook("on_load", 10, function ()
msg.verbose('ytdl:// hook')
local url = mp.get_property("stream-open-filename", "")
if not (url:find("ytdl://") == 1) then
msg.verbose('not a ytdl:// url')
return
end
run_ytdl_hook(url)
end)
end
mp.add_hook(o.try_ytdl_first and "on_load" or "on_load_fail", 10, function()
msg.verbose('full hook')
local url = mp.get_property("stream-open-filename", "")
if not (url:find("ytdl://") == 1) and
not ((url:find("https?://") == 1) and not is_blacklisted(url)) then
return
end
run_ytdl_hook(url)
end)
mp.add_hook("on_preloaded", 10, function ()
if next(chapter_list) ~= nil then
+8 -8
View File
@@ -121,16 +121,16 @@ static int fill_buffer(stream_t *s, char *buffer, int max_len)
static int write_buffer(stream_t *s, char *buffer, int len)
{
struct priv *p = s->priv;
int r;
int wr = 0;
while (wr < len) {
r = write(p->fd, buffer, len);
if (r <= 0)
int r = len;
int wr;
while (r > 0) {
wr = write(p->fd, buffer, r);
if (wr <= 0)
return -1;
wr += r;
buffer += r;
r -= wr;
buffer += wr;
}
return len;
return len - r;
}
static int seek(stream_t *s, int64_t newpos)
+9 -2
View File
@@ -432,8 +432,15 @@ static int archive_entry_seek(stream_t *s, int64_t newpos)
int size = MPMIN(newpos - s->pos, sizeof(buffer));
locale_t oldlocale = uselocale(p->mpa->locale);
int r = archive_read_data(p->mpa->arch, buffer, size);
if (r < 0) {
MP_ERR(s, "%s\n", archive_error_string(p->mpa->arch));
if (r <= 0) {
if (r == 0 && newpos > p->entry_size) {
MP_ERR(s, "demuxer trying to seek beyond end of archive "
"entry\n");
} else if (r == 0) {
MP_ERR(s, "end of archive entry reached while seeking\n");
} else {
MP_ERR(s, "%s\n", archive_error_string(p->mpa->arch));
}
uselocale(oldlocale);
if (mp_archive_check_fatal(p->mpa, r)) {
mp_archive_free(p->mpa);
+29 -9
View File
@@ -21,6 +21,7 @@
#include <libsmbclient.h>
#include <unistd.h>
#include <pthread.h>
#include "common/msg.h"
#include "stream.h"
@@ -31,6 +32,8 @@
#error GPL only
#endif
static pthread_mutex_t smb_lock = PTHREAD_MUTEX_INITIALIZER;
struct priv {
int fd;
};
@@ -46,8 +49,10 @@ static int control(stream_t *s, int cmd, void *arg) {
struct priv *p = s->priv;
switch(cmd) {
case STREAM_CTRL_GET_SIZE: {
pthread_mutex_lock(&smb_lock);
off_t size = smbc_lseek(p->fd,0,SEEK_END);
smbc_lseek(p->fd,s->pos,SEEK_SET);
pthread_mutex_unlock(&smb_lock);
if(size != (off_t)-1) {
*(int64_t *)arg = size;
return 1;
@@ -60,7 +65,10 @@ static int control(stream_t *s, int cmd, void *arg) {
static int seek(stream_t *s,int64_t newpos) {
struct priv *p = s->priv;
if(smbc_lseek(p->fd,newpos,SEEK_SET)<0) {
pthread_mutex_lock(&smb_lock);
off_t size = smbc_lseek(p->fd,newpos,SEEK_SET);
pthread_mutex_unlock(&smb_lock);
if(size<0) {
return 0;
}
return 1;
@@ -68,27 +76,33 @@ static int seek(stream_t *s,int64_t newpos) {
static int fill_buffer(stream_t *s, char* buffer, int max_len){
struct priv *p = s->priv;
pthread_mutex_lock(&smb_lock);
int r = smbc_read(p->fd,buffer,max_len);
pthread_mutex_unlock(&smb_lock);
return (r <= 0) ? -1 : r;
}
static int write_buffer(stream_t *s, char* buffer, int len) {
struct priv *p = s->priv;
int r;
int wr = 0;
while (wr < len) {
r = smbc_write(p->fd,buffer,len);
if (r <= 0)
int r = len;
int wr;
while (r > 0) {
pthread_mutex_lock(&smb_lock);
wr = smbc_write(p->fd,buffer,r);
pthread_mutex_unlock(&smb_lock);
if (wr <= 0)
return -1;
wr += r;
buffer += r;
r -= wr;
buffer += wr;
}
return len;
return len - r;
}
static void close_f(stream_t *s){
struct priv *p = s->priv;
pthread_mutex_lock(&smb_lock);
smbc_close(p->fd);
pthread_mutex_unlock(&smb_lock);
}
static int open_f (stream_t *stream)
@@ -110,13 +124,17 @@ static int open_f (stream_t *stream)
return STREAM_ERROR;
}
pthread_mutex_lock(&smb_lock);
err = smbc_init(smb_auth_fn, 1);
pthread_mutex_unlock(&smb_lock);
if (err < 0) {
MP_ERR(stream, "Cannot init the libsmbclient library: %d\n",err);
return STREAM_ERROR;
}
pthread_mutex_lock(&smb_lock);
fd = smbc_open(filename, m,0644);
pthread_mutex_unlock(&smb_lock);
if (fd < 0) {
MP_ERR(stream, "Could not open from LAN: '%s'\n", filename);
return STREAM_ERROR;
@@ -124,8 +142,10 @@ static int open_f (stream_t *stream)
len = 0;
if(!write) {
pthread_mutex_lock(&smb_lock);
len = smbc_lseek(fd,0,SEEK_END);
smbc_lseek (fd, 0, SEEK_SET);
pthread_mutex_unlock(&smb_lock);
}
if(len > 0 || write) {
stream->seekable = true;
+6
View File
@@ -812,6 +812,12 @@ void mp_image_params_guess_csp(struct mp_image_params *params)
}
}
if (!mp_trc_is_hdr(params->color.gamma)) {
// Some clips have leftover HDR metadata after conversion to SDR, so to
// avoid blowing up the tone mapping code, strip/sanitize it
params->color.sig_peak = 1.0;
}
if (params->chroma_location == MP_CHROMA_AUTO) {
if (params->color.levels == MP_CSP_LEVELS_TV)
params->chroma_location = MP_CHROMA_LEFT;
+1 -1
View File
@@ -233,7 +233,7 @@ class EventsView: NSView {
topMargin = cocoaCB.window.titleBarHeight + 1 + menuBarHeight
}
var vF = window!.screen!.frame
guard var vF = window?.screen?.frame else { return false }
vF.size.height -= topMargin
let vFW = window!.convertFromScreen(vF)
+27 -2
View File
@@ -32,6 +32,7 @@ class VideoLayer: CAOpenGLLayer {
var needsFlip: Bool = false
var canDrawOffScreen: Bool = false
var cglContext: CGLContextObj? = nil
var cglPixelFormat: CGLPixelFormatObj? = nil
var surfaceSize: NSSize?
enum Draw: Int { case normal = 1, atomic, atomicEnd }
@@ -62,7 +63,8 @@ class VideoLayer: CAOpenGLLayer {
autoresizingMask = [.layerWidthSizable, .layerHeightSizable]
backgroundColor = NSColor.black.cgColor
CGLCreateContext(copyCGLPixelFormat(forDisplayMask: 0), nil, &cglContext)
cglPixelFormat = copyCGLPixelFormat(forDisplayMask: 0)
CGLCreateContext(cglPixelFormat!, nil, &cglContext)
var i: GLint = 1
CGLSetParameter(cglContext!, kCGLCPSwapInterval, &i)
CGLSetCurrentContext(cglContext!)
@@ -147,6 +149,8 @@ class VideoLayer: CAOpenGLLayer {
}
override func copyCGLPixelFormat(forDisplayMask mask: UInt32) -> CGLPixelFormatObj {
if cglPixelFormat != nil { return cglPixelFormat! }
let glVersions: [CGLOpenGLProfile] = [
kCGLOGLPVersion_3_2_Core,
kCGLOGLPVersion_Legacy
@@ -157,6 +161,8 @@ class VideoLayer: CAOpenGLLayer {
var npix: GLint = 0
verLoop : for ver in glVersions {
if mpv.macOpts!.cocoa_cb_sw_renderer == 1 { break }
var glAttributes: [CGLPixelFormatAttribute] = [
kCGLPFAOpenGLProfile, CGLPixelFormatAttribute(ver.rawValue),
kCGLPFAAccelerated,
@@ -177,9 +183,28 @@ class VideoLayer: CAOpenGLLayer {
}
}
if (err != kCGLNoError || pix == nil) && mpv.macOpts!.cocoa_cb_sw_renderer != 0 {
if mpv.macOpts!.cocoa_cb_sw_renderer == -1 {
let errS = String(cString: CGLErrorString(err))
mpv.sendWarning("Couldn't create hardware accelerated CGL " +
"pixel format, falling back to software " +
"renderer: \(errS) (\(err.rawValue))")
}
let glAttributes: [CGLPixelFormatAttribute] = [
kCGLPFAOpenGLProfile, CGLPixelFormatAttribute(kCGLOGLPVersion_3_2_Core.rawValue),
kCGLPFARendererID, CGLPixelFormatAttribute(UInt32(kCGLRendererGenericFloatID)),
kCGLPFADoubleBuffer,
kCGLPFABackingStore,
_CGLPixelFormatAttribute(rawValue: 0)
]
err = CGLChoosePixelFormat(glAttributes, &pix, &npix)
}
if err != kCGLNoError || pix == nil {
let errS = String(cString: CGLErrorString(err))
mpv.sendError("Couldn't create CGL pixel format: \(errS) (\(err.rawValue))")
mpv.sendError("Couldn't create any CGL pixel format: \(errS) (\(err.rawValue))")
exit(1)
}
return pix!
+1 -1
View File
@@ -309,7 +309,7 @@ class Window: NSWindow, NSWindowDelegate {
}
func endAnimation(_ newFrame: NSRect = NSZeroRect) {
if !NSEqualRects(newFrame, NSZeroRect) {
if !NSEqualRects(newFrame, NSZeroRect) && isAnimating {
NSAnimationContext.runAnimationGroup({ (context) -> Void in
context.duration = 0.01
self.animator().setFrame(newFrame, display: true)
+3 -7
View File
@@ -61,12 +61,6 @@ class CocoaCB: NSObject {
if backendState == .uninitialized {
backendState = .needsInit
if let app = NSApp as? Application {
let ptr = mp_get_config_group(mpv.mpctx!, vo.pointee.global,
app.getMacOSConf())
mpv.macOpts = UnsafeMutablePointer<macos_opts>(OpaquePointer(ptr))!.pointee
}
view = EventsView(cocoaCB: self)
view.layer = layer
view.wantsLayer = true
@@ -241,7 +235,9 @@ class CocoaCB: NSObject {
func updateICCProfile() {
mpv.setRenderICCProfile(window.screen!.colorSpace!)
layer.colorspace = window.screen!.colorSpace!.cgColorSpace!
if #available(macOS 10.11, *) {
layer.colorspace = window.screen!.colorSpace!.cgColorSpace!
}
}
func lmuToLux(_ v: UInt64) -> Int {
+3 -1
View File
@@ -172,8 +172,10 @@ static void set_application_icon(NSApplication *app)
NSBundle *bundle = [NSBundle mainBundle];
if ([bundle pathForResource:@"icon" ofType:@"icns"])
return;
// The C string contains a trailing null, so we strip it away
NSData *icon_data = [NSData dataWithBytesNoCopy:(void *)macosx_icon
length:sizeof(macosx_icon)
length:sizeof(macosx_icon) - 1
freeWhenDone:NO];
NSImage *icon = [[NSImage alloc] initWithData:icon_data];
[app setApplicationIconImage:icon];
+7 -6
View File
@@ -263,21 +263,16 @@ struct drm_atomic_context *drm_atomic_create_context(struct mp_log *log, int fd,
mp_verbose(log, "Using default plane %d for video\n", overlay_id);
ctx->video_plane = drm_object_create(log, ctx->fd, overlay_id, DRM_MODE_OBJECT_PLANE);
} else {
mp_err(log, "Failed to find video plane with id=%d\n", video_plane_id);
goto fail;
mp_verbose(log, "Failed to find video plane with id=%d. drmprime-drm hwdec interop will not work\n", video_plane_id);
}
} else {
mp_verbose(log, "Found video plane with ID %d\n", ctx->video_plane->id);
}
mp_verbose(log, "Found Video plane with ID %d, OSD with ID %d\n",
ctx->video_plane->id, ctx->osd_plane->id);
drmModeFreePlaneResources(plane_res);
drmModeFreeResources(res);
return ctx;
fail:
if (res)
drmModeFreeResources(res);
@@ -301,6 +296,9 @@ void drm_atomic_destroy_context(struct drm_atomic_context *ctx)
static bool drm_atomic_save_plane_state(struct drm_object *plane,
struct drm_atomic_plane_state *plane_state)
{
if (!plane)
return true;
bool ret = true;
if (0 > drm_object_get_property(plane, "FB_ID", &plane_state->fb_id))
@@ -333,6 +331,9 @@ static bool drm_atomic_restore_plane_state(drmModeAtomicReq *request,
struct drm_object *plane,
const struct drm_atomic_plane_state *plane_state)
{
if (!plane)
return true;
bool ret = true;
if (0 > drm_object_set_property(request, plane, "FB_ID", plane_state->fb_id))
+10 -4
View File
@@ -1103,8 +1103,14 @@ static void cleanup_binds(struct gl_video *p)
// Sets the appropriate compute shader metadata for an implicit compute pass
// bw/bh: block size
static void pass_is_compute(struct gl_video *p, int bw, int bh)
static void pass_is_compute(struct gl_video *p, int bw, int bh, bool flexible)
{
if (p->pass_compute.active && flexible) {
// Avoid overwriting existing block sizes when using a flexible pass
bw = p->pass_compute.block_w;
bh = p->pass_compute.block_h;
}
p->pass_compute = (struct compute_info){
.active = true,
.block_w = bw,
@@ -1248,7 +1254,7 @@ static void finish_pass_tex(struct gl_video *p, struct ra_tex **dst_tex,
// If RA_CAP_PARALLEL_COMPUTE is set, try to prefer compute shaders
// over fragment shaders wherever possible.
if (!p->pass_compute.active && (p->ra->caps & RA_CAP_PARALLEL_COMPUTE))
pass_is_compute(p, 16, 16);
pass_is_compute(p, 16, 16, true);
if (p->pass_compute.active) {
gl_sc_uniform_image2D_wo(p->sc, "out_image", *dst_tex);
@@ -1744,7 +1750,7 @@ static void pass_dispatch_sample_polar(struct gl_video *p, struct scaler *scaler
if (shmem_req > p->ra->max_shmem)
goto fallback;
pass_is_compute(p, bw, bh);
pass_is_compute(p, bw, bh, false);
pass_compute_polar(p->sc, scaler, img.components, bw, bh, iw, ih);
return;
@@ -2485,7 +2491,7 @@ static void pass_colormanage(struct gl_video *p, struct mp_colorspace src, bool
if (detect_peak) {
pass_describe(p, "detect HDR peak");
pass_is_compute(p, 8, 8); // 8x8 is good for performance
pass_is_compute(p, 8, 8, true); // 8x8 is good for performance
gl_sc_ssbo(p->sc, "PeakDetect", p->hdr_peak_ssbo,
"uint counter;"
"uint frame_idx;"
+2 -1
View File
@@ -42,7 +42,8 @@ static bool is_software_gl(GL *gl)
strcmp(renderer, "Software Rasterizer") == 0 ||
strstr(renderer, "llvmpipe") ||
strcmp(vendor, "Microsoft Corporation") == 0 ||
strcmp(renderer, "Mesa X11") == 0;
strcmp(renderer, "Mesa X11") == 0 ||
strcmp(renderer, "Apple Software Renderer") == 0;
}
static void GLAPIENTRY dummy_glBindFramebuffer(GLenum target, GLuint framebuffer)
+4
View File
@@ -257,6 +257,10 @@ static int init(struct ra_hwdec *hw)
mp_err(p->log, "Failed to retrieve DRM atomic context.\n");
goto err;
}
if (!p->ctx->video_plane) {
mp_warn(p->log, "No video plane. You might need to specify it manually using --drm-video-plane-id\n");
goto err;
}
} else {
mp_verbose(p->log, "Failed to retrieve DRM fd from native display.\n");
goto err;
+7 -9
View File
@@ -4,7 +4,7 @@ from waflib import Utils
import os
__all__ = ["check_pthreads", "check_iconv", "check_lua",
"check_cocoa", "check_openal", "check_wl_protocols"]
"check_cocoa", "check_wl_protocols", "check_swift"]
pthreads_program = load_fragment('pthreads.c')
@@ -112,13 +112,11 @@ def check_cocoa(ctx, dependency_identifier):
return res
def check_openal(ctx, dependency_identifier):
checks = [
check_pkg_config('openal', '>= 1.13'),
check_statement(['OpenAL/AL.h'], 'int i = AL_VERSION', framework='OpenAL')
]
for fn in checks:
if fn(ctx, dependency_identifier):
def check_swift(ctx, dependency_identifier):
if ctx.env.SWIFT_VERSION:
major = int(ctx.env.SWIFT_VERSION.split('.')[0])
ctx.add_optional_message(dependency_identifier,
'version found: ' + ctx.env.SWIFT_VERSION)
if major >= 3:
return True
return False
+2 -2
View File
@@ -11,8 +11,8 @@ def __add_swift_flags(ctx):
ctx.env.SWIFT_FLAGS = ('-frontend -c -sdk %s -enable-objc-interop'
' -emit-objc-header -parse-as-library'
' -target x86_64-apple-macosx10.10') % (ctx.env.MACOS_SDK)
swift_version = __run([ctx.env.SWIFT, '-version']).split(' ')[3].split('.')[:2]
major, minor = [int(n) for n in swift_version]
ctx.env.SWIFT_VERSION = __run([ctx.env.SWIFT, '-version']).split(' ')[3]
major, minor = [int(n) for n in ctx.env.SWIFT_VERSION.split('.')[:2]]
# the -swift-version parameter is only supported on swift 3.1 and newer
if major >= 3 and minor >= 1 or major >= 4:
+7 -2
View File
@@ -168,6 +168,11 @@ main_dependencies = [
'req': True,
'fmsg': 'Unable to find either POSIX or MinGW-w64 environment, ' \
'or compiler does not work.',
}, {
'name': '--swift',
'desc': 'macOS Swift build tools',
'deps': 'os-darwin',
'func': check_swift,
}, {
'name': '--uwp',
'desc': 'Universal Windows Platform',
@@ -506,7 +511,7 @@ audio_output_features = [
}, {
'name': '--openal',
'desc': 'OpenAL audio output',
'func': check_openal,
'func': check_pkg_config('openal', '>= 1.13'),
'default': 'disable'
}, {
'name': '--opensles',
@@ -912,7 +917,7 @@ standalone_features = [
}, {
'name': '--macos-cocoa-cb',
'desc': 'macOS opengl-cb backend',
'deps': 'cocoa',
'deps': 'cocoa && swift',
'func': check_true
}
]