summaryrefslogtreecommitdiffstats
path: root/audio/out
Commit message (Collapse)AuthorAgeFilesLines
* threads: use utility+POSIX functions instead of weird wrapperswm42015-05-151-3/+6
| | | | | | | | | There is not much of a reason to have these wrappers around. Use POSIX standard functions directly, and use a separate utility function to take care of the timespec calculations. (Course POSIX for using this weird format for time values.) (cherry picked from commit 92b9d75d7256be71d8c8b18438af9494b78f0e96)
* ao: make better use of atomicswm42015-05-152-14/+11
| | | | | | | The main reason for this was compatibility; but some associated problems have been solved in the previous commit. (cherry picked from commit ca9964a4fb6b1faa0155da43b3c815db0075e2d5)
* ao: log reordered versions of channel mapswm42015-05-091-3/+10
| | | | | | Useful for debugging cases when no standard orders are used. (cherry picked from commit 8b7035c8ff15f14c17b6c019e951226b9eeaca02)
* audio: define only a single NA speaker IDwm42015-05-093-15/+6
| | | | | | | Remove the requirement from mp_chmap that speaker entries must be unique. Use this to get rid of all the redundant NA speaker IDs. (cherry picked from commit b91b4944bd7ddf6fef4c4254d457117017292c0a)
* ao_alsa: log requested numbers of channels if ALSA rejects themwm42015-05-091-2/+3
| | | | (cherry picked from commit ad9bce2a5ca62f6a64f65fe79ae170edc0e05da4)
* ao_coreaudio_utils: don't list some formats as "unusable"wm42015-05-081-1/+1
| | | | | | | While mpv has no internal equivalent representation, they can still be used as physical CoreAudio formats. Thus this label is confusing. (cherry picked from commit 1bcb82ec93cc3e037df2dd4e2216a473fe87baf9)
* ao_sndio: add notice about padding channelswm42015-05-071-1/+3
| | | | | | (I won't do this, but someone else seeing this might.) (cherry picked from commit cd5ab98ff992217abfd0234601c21eb0fe0dbc19)
* ao_alsa: use new padding channels supportwm42015-05-071-21/+26
| | | | | | | | | | | | | | 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. (cherry picked from commit 85fc6b2a0569b24c5652f600d90d7a131b61eb07)
* ao_alsa: move ALSA -> mp channel map to a functionwm42015-05-071-11/+18
| | | | | | | One side effect is that the warning about too many channels goes away, and is replaced with printing the ALSA channel map as "unknown". (cherry picked from commit d577872a28c9729e987566530905bde238af8109)
* ao_coreaudio_exclusive: check new format before waiting for changewm42015-05-071-12/+13
| | | | | | | It seems if the format was already set, setting the same format will not cause a property change. (cherry picked from commit 0ae0e90eb5348c58d5b4f13fe0792199c460a4b6)
* ao_coreaudio_exclusive: use atomics instead of volatilewm42015-05-071-19/+16
| | | | | | | | | | | | | 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). (cherry picked from commit 4444ff48fa578461688fe9feb9ebcd996cd64506)
* ao_coreaudio_exclusive: rename "digital" -> "compressed"wm42015-05-071-22/+20
| | | | | | PCM is digital too. (cherry picked from commit 028739932bf4e2d32439b3756811a2b06cc81128)
* ao_coreaudio_exclusive: explicitly check for spdif formatswm42015-05-071-8/+5
| | | | (cherry picked from commit 1e1045b13ea4acbbd77dd52c4e0599f1517e6ac3)
* ao_coreaudio_exclusive: merge init_digital() functionwm42015-05-071-15/+3
| | | | | | | | 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. (cherry picked from commit 32bc61ae07fe441c327b4aa96dd80fa4771fd569)
* ao_coreaudio_utils: decide formats by comparing raw bitswm42015-05-071-5/+6
| | | | | | | | | | | | | | | | | | 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. (cherry picked from commit 4ffcf2531bb525c19c3b6df75ecb27c5cffbdd28)
* ao_coreaudio_utils: don't require talloc for fourcc_repr()wm42015-05-073-17/+13
| | | | | | | Instead, apply a trick to make the caller allocate enough space on the stack. (cherry picked from commit 399267393bb96710cde53c2fc7563f55cc32deb8)
* ao_coreaudio_utils: unbreak default device selectionwm42015-05-071-4/+3
| | | | | | | | 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. (cherry picked from commit 7a5f5a8adf5921ed8fcee29d76113d9a7f018974)
* ao_coreaudio_exclusive: fix latency calculation non-sensewm42015-05-071-1/+1
| | | | | | Didn't use the properties it was supposed to use. (cherry picked from commit bbedceb467033b239b35ee9b2db963a93d8a57c9)
* ao_coreaudio_utils: refine format selectionwm42015-05-071-19/+25
| | | | | | | | | | | | | 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. (cherry picked from commit fd6809f98a546c2abe87b378bb1fe0bbec40a4ef)
* ao_coreaudio_utils: add a format negotiation helper functionwm42015-05-072-0/+37
| | | | (cherry picked from commit 305a85cc9aa169a75317acb55e539f49d420f629)
* ao_coreaudio: support padded channel layoutswm42015-05-071-2/+6
| | | | | | | | | 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. (cherry picked from commit 4d8a7e03944155bf07ba9a775cf9554bb1c76f0f)
* ao_coreaudio: fix out of bounds accesswm42015-05-071-0/+2
| | | | | | | | 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. (cherry picked from commit eead97f10303436b8da1c75dcdaa79efaba5b015)
* ao_coreaudio_exclusive: check format explicitly on change notifcationwm42015-05-071-6/+11
| | | | | | | | | | | This should for now be equivalent; it's merely more explicit and will be required if we add PCM support. Note that the property listeners actually tell you what property exactly changed, but resolving the current listener mess would be too hard. So check for changes manually. (cherry picked from commit 382434d45a72967f5b607c871e363e02dce1f1e6)
* ao_coreaudio_utils: log mp format with CoreAudio format descriptionwm42015-05-071-2/+4
| | | | | | As a consequence, it also logs whether mpv can a this format at all. (cherry picked from commit 34a5229b231f15c95876fed472bd1edc5283db31)
* ao_coreaudio_utils: add function for ASBD -> mp format lookupwm42015-05-072-7/+59
| | | | | | | | | | | | Useful with some of the following commits. ca_fill_asbd() should behave exactly as before. Instead of actually implementing the inverse function of ca_fill_asbd(), just loop over the (small) list of mpv functions and check if any mpv equivalent to a given ASBD exists. (cherry picked from commit 32b835c03b4dc98a0344d171adef36c7562f1e7b)
* ao_coreaudio_utils: float is not a signed integer formatwm42015-05-071-3/+3
| | | | | | | | | | | kAudioFormatFlagIsSignedInteger implicates that it's only used with integer formats. The mpv internal flag on the other hand signals the presence of a sign, and this is set on float formats. Until now, this probably worked fine, because at least AudioUnit is ignoring the uncorrect flag. (cherry picked from commit 3295ce48ab4badff0e13e2e9c2a1ec945413d4e2)
* ao_coreaudio_exclusive: move code for getting original formatwm42015-04-291-6/+4
| | | | | | | Should be almost equivalent, unless there are streams on which this call does not work for unknown reasons. (cherry picked from commit 8b4ca5806207c1482df30d9815e6970697cea5b2)
* ao_coreaudio_utils: change audio format loggingwm42015-04-291-3/+3
| | | | | | Make it easier to distinguish the fields. (cherry picked from commit d5e9bf66a1e0c4578bd8bef5c9f725dbc47e9fc6)
* ao_coreaudio_exclusive: account for additional latencywm42015-04-291-3/+10
| | | | | | | | | Whether this is correct is unknown. This change tripples the latency from ~15ms to ~45ms. XBMC does this, VLC does not from what I could see. (cherry picked from commit 5f86fad2f0ab76b7497230b18cd146a7c4d38cd2)
* ao_alsa: fallback to stereo channel layout if everything else failswm42015-04-141-1/+4
| | | | | | mp_chmap_from_channels_alsa() doesn't always succeed - there are a bunch of channel counts for which no defined ALSA layout exists. Fallback to stereo in this case. (Normally, this code path shouldn't happen at all.)
* Update license headersMarcin Kurczewski2015-04-1315-75/+60
| | | | Signed-off-by: wm4 <wm4@nowhere>
* ao_coreaudio: fix inverted conditionwm42015-04-101-3/+4
| | | | And also use the correct type for the printf call below.
* ao_alsa: change log outputwm42015-04-071-12/+15
| | | | | | | | Silence the usually user-visible warning about unsupported channel maps. This might be an ALSA bug, but ALSA will never fix this behavior anyway. (Or maybe it's a feature.) Log some other information that might be useful.
* ao_coreaudio: do not error if retrieving info for verbose mode failswm42015-04-071-6/+6
| | | | | | The message log level shouldn't get to decide whether something fails or not. So replace the fatal error check on the verbose output code path with a warning.
* ao/wasapi: use atomic state variable instead of different eventsKevin Mitchell2015-04-044-65/+78
| | | | | | | | | Unfortunately, because we have proxy objects (pAudioVolumeProxy, pEndpointVolumeProxy, pSessionControlProxy) it looks like we still have to use MsgWaitForMultipleObjects and watch for and dispatch pending messages: https://msdn.microsoft.com/en-us/library/windows/desktop/ms680112%28v=vs.85%29.aspx
* ao/wasapi: reorder priv membersKevin Mitchell2015-04-041-12/+14
|
* ao_wasapi: code formatting and alignmentKevin Mitchell2015-04-032-24/+23
|
* audio: make all format query shortcuts macrosKevin Mitchell2015-04-034-7/+7
| | | | | af_fmt_is_float and af_fmt_is_planar were previously inconsistent with AF_FORAMT_IS_SPECIAL/AF_FORMAT_IS_IEC61937
* ao_wasapi: passthrough reworkKevin Mitchell2015-04-032-161/+152
| | | | | | | | | | | | | | | * unify passthrough and pcm exclusive mode format setting/testing * set passthrough format parameters correctly * support all of mpv's existing passthrough formats * automatically test passthrough with exclusive mode and enable exclusive if it succeeds, even if it was not explictly requested. this obviates the need for --ao=wasapi,wasapi=exclusive * if passthrough fails (such as the device doesn't support the format), fallback to either exclusive pcm or shared mode depending on what the user specified. Right now this isn't very useful as it still fails due to the decoder path remainin stuck on spdif. fixes #1742
* ao_wasapi: abstract HRESULT_to_strKevin Mitchell2015-04-014-79/+67
|
* ao_coreaudio: do not signal per-app volumewm42015-04-011-2/+0
| | | | | CoreAudio doesn't seem to have this concept. The volume is reset the next time audio is opened.
* ao_wasapi: remove redundant castsKevin Mitchell2015-03-313-42/+37
|
* ao_wasapi: simplify hotplugKevin Mitchell2015-03-313-55/+22
| | | | | | | | | Take advantage of the fact that list_devs is called with a hotplug_inited ao. Also eliminate unnecessary nested function abstraction of hotplug_(un)init and list_devs. However, keep list_devs in ao_wasapi_utils.c since it uses the private functions get_device_id, get_device_name and exposing these would require including headers for IMMDevice in ao_wasapi_utils.h.
* ao_wasapi: fix device listingKevin Mitchell2015-03-313-92/+29
| | | | | remove depricated and convoluted validation. refer instead to the --audio-device option.
* ao/wasapi: add ao hotplugKevin Mitchell2015-03-315-64/+118
| | | | | | | Create a second copy of the change_notify structure for the hotplug ao. change_notify->is_hotplug distinguishes the hotplug version from the regular one monitoring the currently playing ao. Also make the change notification less verbose now that there might be two of them around.
* ao_alsa: add an option to ignore ALSA channel map negotiationwm42015-03-281-2/+6
| | | | This was requested, more or less.
* ao/wasapi: use built in KSDATAFORMATsKevin Mitchell2015-03-271-13/+8
| | | | | Rather than defining them ourselves. Thanks to rossy for figuring out the headers.
* ao/wasapi: add missing "if" bracesKevin Mitchell2015-03-262-35/+33
|
* ao/wasapi: rewrite format searchKevin Mitchell2015-03-262-182/+300
| | | | | | | More clearly separate the exclusive and shared mode format discovery. Make the exclusive mode search more systematic in particular about channel maps (i.e., use chmap_sel). Assume that the same sample format / sample rates work for all channels to narrow the search space.
* ao_sndio: open device in blocking mode, don't inflate buffer artificiallyDmitrij D. Czarkoff2015-03-261-20/+2
| | | | | | The code actually uses blocking mode, so opening sound device in non-blocking mode results in choppy sound. Also, inflating the buffer isn't necessary in blocking mode, so the function may simply return without doing anything.
* ao_pulse: drop video role; fixes random mutingwm42015-03-241-1/+0
| | | | | | | | | The details are described in #1173. This "features" causes problems to users so often, it's better to remove it. Fixes #1173.
* ao: slightly extend debug messageswm42015-03-161-1/+4
| | | | | This function already got uglified with debug printing; might as well go all the way.
* ao: align audio buffer sizewm42015-03-131-0/+3
| | | | Might or might not matter.
* ao_coreaudio_exclusive: port to pull API, fix latency calculationswm42015-03-101-78/+37
| | | | | | | | | | | | | | Instead of maintaining a private ring buffer, use the generic support for audio APIs with pull callbacks (internally called AO pull API). This also fixes latency calculations: instead of just returning the ringbuffer status, the audio playback state is calculated better and includes interpolation. The main reason this wasn't done earlier was mid-stream format switching. The pull API can now handle it (in a way) by destroying and recreating the AO. This is a bit brutal, but quite simple. It's untested in this new AO, though. Some details might not be right, like how ot restores the old format when reloading.
* ao_coreaudio: move some helpers to utilswm42015-03-103-16/+20
| | | | Needed by ao_coreaudio_exclusive.c in the next commit.
* ao_coreaudio_exclusive: rip out pseudo volume controlwm42015-03-101-40/+1
| | | | | | | | | | | | | | | | | This could mute a digital passthrough stream by writing zeros. All other volume values did nothing. The comment about MPlayer dying hasn't been true in mpv for quite a while. It's even possible that it's fixed in upstream MPlayer. mpv will print a scary error message when trying to change volume with spdif, and continue normally. If we really want to mute by writing zeros, we should do it in a separate filter. But I'm not overly fascinated by this approach; is it even guaranteed receivers will not be confused by a stream of zeros? The main reason to remove this is that it's in the way of further cleanups.
* ao/wasapi: move resume to audio threadKevin Mitchell2015-02-233-24/+38
| | | | | | | | | | | | | | This echanges the two events hForceFeed/hFeedDone for hResume. This like the last commit makes things more deterministic. Importantly, the forcefeed is only done if there is not already a full buffer yet to be played by the device. This should fix some of the problems with exclusive mode. This commit also removes the necessity to have a proxy to the AudioClient object in the main thread. fixes #1529
* ao_wasapi: move reset into audio threadKevin Mitchell2015-02-232-9/+37
| | | | | | | | | This makes things a bit more deterministic. It ensures that the audio thread isn't doing anything between IAudioClient_Stop(), IAudioClient_Reset() and setting the sample_count to 0. Buffer overfilling on resume is still a problem in exclusive mode (see next commit).
* ao: fix null dereferenceStefano Pigozzi2015-02-141-0/+2
|
* ao_coreaudio: add support for hotplug notificationsStefano Pigozzi2015-02-143-23/+96
| | | | | | | | | | This commit adds notifications for hot plugging of devices. It also extends the old behaviour of the `audio-out-detected-device` property which is now backed by the hotplugging code. This allows clients to be notified when the actual audio output device changes. Maybe hotplugging should be supported for ao_coreaudio_exclusive too, but it's device selection code is a bit fragile.
* ao_pulse: listen for hotplug eventswm42015-02-121-7/+41
| | | | | | | | | | | | | | | This requires jumping through multiple hoops on fire. Since the PulseAudio API is virtually undocumented, I'm not sure if this is correct either. We only react to sink events, and only to the NEW/REMOVE events. CHANGE events are ignored, because PulseAudio fires them far too often - even if the system is completely idle! If pa_sink_info.name can change, we're in trouble. pa_sink_info.description is not so important, but it'd also be a bit un-nice if it can change, and we don't update it. The weird way how the actual AO and the hotplug context share the same struct (ao) comes in handy here, although context_success_cb() still had to be duplicated from success_cb() - the unused argument has a different type.
* audio: add device change notification for hotpluggingwm42015-02-123-25/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | Not very important for the command line player; but GUI applications will want to know about this. This only adds the internal API; support for specific audio outputs comes later. This reuses the ao struct as context for the hotplug event listener, similar to how the "old" device listing API did. This is probably a bit unclean and confusing. One argument got reusing it is that otherwise rewriting parts of ao_pulse would be required (because the PulseAudio API requires so damn much boilerplate). Another is that --ao-defaults is applied to the hotplug dummy ao struct, which automatically applies such defaults even to the hotplug context. Notification works through the property observation mechanism in the client API. The notification chain is a bit complicated: the AO not