Commit Graph

41228 Commits

Author SHA1 Message Date
wm4 7b09654c33 audio: fix messed up assert()
This made no sense and always evaluated to true.
2015-05-07 23:26:33 +02:00
wm4 55e777f10b audio: remove UNKNOWN pseudo speakers
Reuse MP_SPEAKER_ID_NA for this. If all mp_chmap entries are set to NA,
the channel layout has special "unknown channel layout" semantics, which
are used to deal with some corner cases.
2015-05-07 23:20:06 +02:00
wm4 b91b4944bd audio: define only a single NA speaker ID
Remove the requirement from mp_chmap that speaker entries must be
unique. Use this to get rid of all the redundant NA speaker IDs.
2015-05-07 23:07:14 +02:00
wm4 3477088741 player: use profiles for libmpv and encoding defaults
The client API (libmpv) and encoding (--o) have slightly different
defaults from the command line player. Instead of doing a bunch of calls
to set the options explicitly, use profiles. This is simpler and has the
advantage that they can be listed on command line (instead of possibly
forcing the user to find and read the code to know all the details).
2015-05-07 21:26:11 +02:00
wm4 036a49478f m_config: make m_config_set_profile() use a name
Is simpler and avoids exposing profile structs to a degree.
2015-05-07 21:03:14 +02:00
wm4 b12ca2b980 DOCS: add a link to LIRC wiki entry 2015-05-07 21:03:06 +02:00
wm4 1bcb82ec93 ao_coreaudio_utils: don't list some formats as "unusable"
While mpv has no internal equivalent representation, they can still be
used as physical CoreAudio formats. Thus this label is confusing.
2015-05-07 20:55:00 +02:00
ChrisK2 6a0a67034d ytdl_hook: Escape EDL URLs
Should prevent the EDL parser from tripping over = and , in the
URL.
2015-05-07 20:41:46 +02:00
wm4 cd5ab98ff9 ao_sndio: add notice about padding channels
(I won't do this, but someone else seeing this might.)
2015-05-06 21:48:40 +02:00
wm4 85fc6b2a05 ao_alsa: use new padding channels support
Sometimes, ALSA will return channel layouts with padded channels (NA
speakers). Use them instead of failing.

This still includes the old "braindeath" code to retry with a layout
without NA channels. This might be helpful for performance, and also the
padded channel layout string looks confusing.

To be fair, I have not encountered a case yet which would really need
this, and for which the old "braindeath" code did not fix it.
2015-05-06 21:48:40 +02:00
wm4 d577872a28 ao_alsa: move ALSA -> mp channel map to a function
One side effect is that the warning about too many channels goes away,
and is replaced with printing the ALSA channel map as "unknown".
2015-05-06 21:48:40 +02:00
wm4 9434aa75b2 manpage: do not use deprecated syntax in example 2015-05-06 21:48:39 +02:00
wm4 f58d3591d9 cocoa: remove an unused parameter 2015-05-06 21:48:39 +02:00
wm4 0ae0e90eb5 ao_coreaudio_exclusive: check new format before waiting for change
It seems if the format was already set, setting the same format will
not cause a property change.
2015-05-06 21:48:39 +02:00
wm4 4444ff48fa ao_coreaudio_exclusive: use atomics instead of volatile
volatile barely means anything.

The polling is kind of bad too, but relatively harmless as device
opening/closing is a rare event, and the format change is not expected
to take long.

Remove the pointless talloc call too (must have been a leftover
from previous refactoring).
2015-05-06 21:48:36 +02:00
wm4 028739932b ao_coreaudio_exclusive: rename "digital" -> "compressed"
PCM is digital too.
2015-05-06 18:54:53 +02:00
wm4 1e1045b13e ao_coreaudio_exclusive: explicitly check for spdif formats 2015-05-06 18:51:31 +02:00
wm4 32bc61ae07 ao_coreaudio_exclusive: merge init_digital() function
No reason to keep them separate. It's an artifact from the old
ao_coreaudio.c, which kept usage of two different APIs in the same file.
Removes a forward reference too.
2015-05-06 18:46:51 +02:00
wm4 e777756301 cocoa: lock cocoa main thread on uninit
This should fix some crashes due to dangling pointers.

The problem was that with_cocoa_lock_on_main_thread() is asynchronous.
It will not wait until it is finished. In the uninit case, this means
the VO could be deallocated and destroyed while cocoa was still running
uninit code.

So simply wait until it is done by using dispatch_sync(). There were
concerns that this could introduce a deadlock by the main thread trying
to wait for something on the VO thread. But from what I can see, this
never happens, and even if it does, it would crash anyway since the VO
is already gone.

One remaining worry is the video_resize_redraw_callback. From what I can
see, it still can mess things up, and will need a more elaborate fix.
2015-05-06 00:36:33 +02:00
wm4 4ffcf2531b ao_coreaudio_utils: decide formats by comparing raw bits
Instead of trying to use af_format_conversion_score() (which tries to be
all kinds of clever), just compare the raw bits as a quality measure. Do
this because otherwise, weird formats like padded 24 bit formats will be
excluded, even though they might be the highest precision formats for
some hardware.

This means that for now, the user would have to check whether the format
is usable at all before calling ca_asbd_is_better(). But since this is
currently only used for ao_coreaudio.c and for the physical format, it
doesn't matter.

If coreaudio-exclusive should get PCM support, the best would be to
revert this change, and to add support for 24 bit formats directly.
2015-05-05 22:10:33 +02:00
wm4 656703e279 ao_coreaudio: log considered physical formats 2015-05-05 22:09:44 +02:00
wm4 86d65c80e1 ao_coreaudio: restore old physical format if format was changed 2015-05-05 22:09:39 +02:00
wm4 0025030cef af: don't attempt to remove last filter for spdif filter removal
Some time ago, a mechanism was added for automatically removing PCM-only
filters if the input format is spdif.

This could cause an infinite loop if the AO did not support spdif, but
was falling back to some PCM format. Then this code tried to remove the
last filter, which is a dummy filter for receiving and queuing filter
output. af_remove() simply fails gracefully in this case, so this
happens over and over again.

Fix by explicitly checking whether the filter to remove is a dummy
filter. (af_remove() also fails only if the dummy filters are attempted
to be removed - checking this directly is simpler.)
2015-05-05 21:47:48 +02:00
wm4 d76f9a484e audio: minor cosmetics
These ( ) were probably not removed when the format constants were
changed from defines to an enum.
2015-05-05 21:47:36 +02:00
wm4 934109a35b ao_coreaudio: move channel mapping code to a separate file
Move all of the channel map retrieval/negotiation code to a separate
file. This will (probably) be helpful when extending
ao_coreaudio_exclusive.c.

Nothing else changes, other than some minor cosmetics and renaming,
and changing some details for decoupling it from the ao_coreaudio.c
internals.
2015-05-05 21:47:19 +02:00
wm4 399267393b ao_coreaudio_utils: don't require talloc for fourcc_repr()
Instead, apply a trick to make the caller allocate enough space on the
stack.
2015-05-05 21:47:04 +02:00
wm4 7a5f5a8adf ao_coreaudio_utils: unbreak default device selection
It appears this is the reason coreaudio-exclusive does not work without
explicitly specifying a device, even if the default device maps to
something passthrough-capable.
2015-05-05 21:46:54 +02:00
wm4 bbedceb467 ao_coreaudio_exclusive: fix latency calculation non-sense
Didn't use the properties it was supposed to use.
2015-05-05 21:46:39 +02:00
wm4 fd6809f98a ao_coreaudio_utils: refine format selection
Instead of always picking a somehow better format over the previous one,
select a format that is equal to or better the requested format, but is
also reasonably close.

Drop the mFormatID comparison - checking the sample format handles this
already.

Make sure to exclude channel counts that can't be used.
2015-05-05 21:46:17 +02:00
wm4 66f4e7cce4 ao_coreaudio: change physical format before channel negotiation
If for example the physical format is set to stereo, the reported
multichannel layout will actually be stereo. It fixes itself only after
the physical format is changed.
2015-05-05 21:45:55 +02:00
wm4 cf210c4ffc vo_opengl: change default FBO format
Reduces (but likely does not remove) the danger of rounding intermediate
values down to 8 bit. This is important for cscale, or any other
processing that might store raw YUV values in framebuffers.

Fixes #1918.
2015-05-05 14:41:33 +02:00
wm4 22455b2961 manpage: fix typo 2015-05-05 14:40:26 +02:00
wm4 8121529a6c ao_coreaudio: add an option for changing the physical format
ao_coreaudio uses AudioUnit - the OSX software mixer. In theory, it
supports multichannel audio just fine. But in practice, this might be
disabled by default, and the user is supposed to select a multichannel
base format in the "Audio MIDI Setup" utility.

This option attempts to change this setting automatically. Some possible
disadvantages and caveats are listed in the manpage additions. It is off
by default, since changing this might be rather bad behavior for a
normal application.
2015-05-05 01:11:16 +02:00
wm4 305a85cc9a ao_coreaudio_utils: add a format negotiation helper function 2015-05-05 01:11:16 +02:00
wm4 f719b8164d af_lavrresample: remove dead undefs 2015-05-05 01:11:16 +02:00
wm4 19ab5f7943 ipc: silence some common info messages
They are not really interesting. At least one user complained about the
noise resulting from use with shell scripts, which connect and
disconnect immediately.
2015-05-05 01:11:16 +02:00
wm4 4d8a7e0394 ao_coreaudio: support padded channel layouts
If for example the audio settings are set to 5.1 output, but the
hardware does 8 channels natively (HDMI), the reported channel
layout will have 2 dummy channels. To avoid falling back to stereo,
we have to write audio in this format to the device.
2015-05-05 01:11:16 +02:00
wm4 06050aed99 audio: introduce support for padding channels
Some audio APIs explicitly require you to add dummy channels. These are
not rendered, and only exist for the sake of the audio API or hardware
strangeness. At least ALSA, Sndio, and CoreAudio seem to have them.

This commit is preparation for using them with ao_coreaudio.

The result is a bit messy. libavresample/libswresample don't have good
API for this; avresample_set_channel_mapping() is pretty useless.
Although in theory you can use it to add and remove channels, you
can't set the channel counts. So we do the ordering ourselves by making
sure the audio data is planar, and by swapping the plane pointers. This
requires lots of messiness to get the conversions in place. Also, the
input reordering is still done with the "old" method, and doesn't
support padded channels - hopefully this will never be needed. (I tried
to come up with cleaner solutions, but compared to my other attempts,
the final commit is not that bad.)
2015-05-05 01:11:16 +02:00
wm4 1b0b094ca2 audio: introduce mp_audio readonly bit
Convenience for the following commit.
2015-05-04 23:57:25 +02:00
wm4 937c8e513f audio: chmap: explicitly drop channels not supported by lavc
Basically as before, but avoid undefined behavior.
2015-05-04 23:56:27 +02:00
wm4 548cd826c2 audio: drop unused function 2015-05-04 23:54:53 +02:00
wm4 eead97f103 ao_coreaudio: fix out of bounds access
ca_label_to_mp_speaker_id() checked whether the last entry was >= 0, but
actually this condition was never true, and MP_SPEAKER_ID_UNKNOWN0 is
not negative.
2015-05-04 23:54:38 +02:00
James Ross-Gowan b6381a0ee3 subprocess-win: use the correct pipe namespace
This was a mistake, it should definitely be using the device namespace
rather than the file namespace. As it says in the docs, all pipe names
must start with \\.\pipe\
2015-05-04 09:24:53 +02:00
Niklas Haas 08d3ef3d9e
sws_utils: re-use avcolorspace for sws colorspaces
This lets us avoid having to maintain two separate copies of the
colorspace mapping functions.
2015-05-04 01:34:25 +02:00
wm4 a2da53027b win32: fix desktop directory
The folder argument wasn't used, so it always returned the APPDATA dir.
2015-05-03 19:28:14 +02:00
wm4 e25ecdd09a vo_opengl: gl_lcms: fix cache dir creation with path expansion
Path expansion (like "~/dir/" in config file) was used inconsistently,
so the cache directory wasn't always created correctly. Fix this by
moving the path expansion from load_file() to its callers.
2015-05-03 14:58:18 +02:00
wm4 2ae96f567c path: start special espansion with ~~name instead of ~name
Since commit 7381db60, strings like "~desktop/" were expanded as
platform-specific paths by mpv. Apparently this similarity to standard
Unix shell expansion caused confusion, so change it to "~~desktop/". The
shell doesn't expand this, so it should be better.
2015-05-03 14:52:11 +02:00
wm4 6a03357b71 options: fix typo in variable name 2015-05-03 14:44:42 +02:00
wm4 1982fedca6 options: remove --leak-report
Use the environment variable instead.
2015-05-02 19:03:28 +02:00
wm4 3508a3fbd1 win32: move platform specifics to osdep
This will probably disable this code for Cygwin. I don't know if this
matters, since Cygwin should strictly behave like a Unix anyway.
2015-05-02 18:59:58 +02:00