summaryrefslogtreecommitdiffstats
path: root/audio
Commit message (Collapse)AuthorAgeFilesLines
* audio: minor cosmeticswm42015-05-051-16/+16
| | | | | These ( ) were probably not removed when the format constants were changed from defines to an enum.
* ao_coreaudio: move channel mapping code to a separate filewm42015-05-053-255/+297
| | | | | | | | | | 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.
* ao_coreaudio_utils: don't require talloc for fourcc_repr()wm42015-05-053-17/+13
| | | | | Instead, apply a trick to make the caller allocate enough space on the stack.
* ao_coreaudio_utils: unbreak default device selectionwm42015-05-051-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.
* ao_coreaudio_exclusive: fix latency calculation non-sensewm42015-05-051-1/+1
| | | | Didn't use the properties it was supposed to use.
* ao_coreaudio_utils: refine format selectionwm42015-05-051-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.
* ao_coreaudio: change physical format before channel negotiationwm42015-05-051-4/+10
| | | | | | 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.
* ao_coreaudio: add an option for changing the physical formatwm42015-05-051-0/+55
| | | | | | | | | | | | 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.
* ao_coreaudio_utils: add a format negotiation helper functionwm42015-05-052-0/+37
|
* af_lavrresample: remove dead undefswm42015-05-051-3/+0
|
* ao_coreaudio: support padded channel layoutswm42015-05-051-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.
* audio: introduce support for padding channelswm42015-05-053-56/+142
| | | | | | | | | | | | | | | | | | | 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.)
* audio: introduce mp_audio readonly bitwm42015-05-042-1/+3
| | | | Convenience for the following commit.
* audio: chmap: explicitly drop channels not supported by lavcwm42015-05-041-2/+5
| | | | Basically as before, but avoid undefined behavior.
* audio: drop unused functionwm42015-05-042-10/+0
|
* ao_coreaudio: fix out of bounds accesswm42015-05-041-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.
* ao_coreaudio_exclusive: check format explicitly on change notifcationwm42015-04-291-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.
* ao_coreaudio_utils: log mp format with CoreAudio format descriptionwm42015-04-291-2/+4
| | | | As a consequence, it also logs whether mpv can a this format at all.
* ao_coreaudio_utils: add function for ASBD -> mp format lookupwm42015-04-292-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.
* ao_coreaudio_utils: float is not a signed integer formatwm42015-04-291-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.
* ao_coreaudio_exclusive: move code for getting original formatwm42015-04-281-6/+4
| | | | | Should be almost equivalent, unless there are streams on which this call does not work for unknown reasons.
* ao_coreaudio_utils: change audio format loggingwm42015-04-281-3/+3
| | | | Make it easier to distinguish the fields.
* ao_coreaudio_exclusive: account for additional latencywm42015-04-281-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.
* audio: separate fallbacks for upmix and downmix caseswm42015-04-281-12/+18
| | | | | | | | We always want to prefer upmix to downmix, as long as it makes sense. Even if the upmix is not "perfect" (not just adding channels), we want to prefer the upmix. Cleanup for commit d3c7fd9d.
* audio: avoid downmixing in a certain special-casewm42015-04-271-3/+3
| | | | | | | | As indicated by the added test. In this case, fallback and downmix have the same score, but fallback happens to give better results. So prefer fallback over downmix. (This is probably not a correct solution.)
* ao_null: add an option for testing channel layout selectionwm42015-04-271-2/+16
|
* player: change video-bitrate and audio-bitrate propertieswm42015-04-201-3/+0
| | | | | | | | | | | | | | Remove the old implementation for these properties. It was never very good, often returned very innaccurate values or just 0, and was static even if the source was variable bitrate. Replace it with the implementation of "packet-video-bitrate". Mark the "packet-..." properties as deprecated. (The effective difference is different formatting, and returning the raw value in bits instead of kilobits.) Also extend the documentation a little. It appears at least some decoders (sipr?) need the AVCodecContext.bit_rate field set, so this one is still passed through.
* af_lavrresample: fix drainingwm42015-04-181-8/+8
| | | | | configure_lavrr() clears s->pending, so we have to assign it after that call.
* 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-1357-288/+232
| | | | Signed-off-by: wm4 <wm4@nowhere>
* af_lavrresample: minor simplificationwm42015-04-121-4/+4
| | | | | The in/out pointers usually have not much meaning outside of AF_CONTROL_REINIT. Also remove the redundant casts.
* af_lavrresample: allow resetting output sample formatwm42015-04-121-2/+3
| | | | It must be allowed to set format==0.
* audio/filter: fully renegotiate audio formats on every reconfigwm42015-04-121-0/+10
| | | | | | | | | | | | | | | | | | | It could happen that a lavrresample filter would keep its old output format when the decoder changed its output format. This simply happened because the output format was never reset. Normally, this was not an issue, because lavrresample filters only inserted for format conversion were removed on format changes. But if --no-audio-pitch-correction is set and playback speed is changed, then there is a "permanent" lavrresample filter in the filter chain, which shows this behavior. Fix by explicitly resetting output formats for all filters which support it. Note: this can crash with libswresample in some cases. I'm not sure if this is mpv's fault or libswresample's, but since it works with libavresample, I'm going to assume it's not our's.
* ao_coreaudio: fix inverted conditionwm42015-04-101-3/+4
| | | | And also use the correct type for the printf call below.
* audio: automatically deatch filters if spdif prevents their usewm42015-04-072-5/+17
| | | | Fixes #1743 and partially #1780.
* audio: change a detail about filter insertionwm42015-04-073-10/+14
| | | | | | | | | | The af_add() function has a problem: if the inserted filter returns AF_DETACH during init, the function will have a dangling pointer. Until now this was avoided by making sure none of the used filters actually return AF_DETACH, but it's getting infeasible. Solve this by requiring passing an unique label to af_add(), which is then used instead of the pointer.
* 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-039-25/+15
| | | | | 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
* af_lavrresample: always normalize (libswresample is stupid)wm42015-04-021-0/+4
| | | | | | | | | | libswresample doesn't normalize when remixing to a float format. This will cause clipping due to float samples being out of the allowed range. Fortunately this extremely bad default can be changed. This does not happen with libavresample: it normalizes by default. Fixes #1752.
* af: remove unused functionswm42015-04-012-34/+0
|
* ao_wasapi: abstract HRESULT_to_strKevin Mitchell2015-04-014-79/+67
|
* mixer: per-app volume and private volume conflictwm42015-04-011-1/+3
| | | | | | Per-app volume would change the volume across all instances of the same application, while a private volume control (HAS_PER_APP_VOLUME) obviously should influence only one instance/audio stream only.
* 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.
* mixer: handle prevention of unneeded af_volume insertion differentlywm42015-04-011-2/+3
| | | | Just so that this special-case is out of the common volume path.
* mixer: cleanup volume logic slightlywm42015-04-011-12/+11
|
* mixer: add more debug outputwm42015-04-011-3/+16
| | | | For remote-debugging volume rstore problems.
* 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.
* ad_lavc: disable AC3 DRC by defaultwm42015-03-301-2/+2
|
* 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.
* mixer: fix how volume is restored with per-app system mixerswm42015-03-241-3/+6
| | | | | | | | | | This broke with PulseAudio: when changing some audio filters (like for playback speed), mixer_reinit_audio() was called - and it overwrote the volume with whatever mpv thought the volume was before. If the volume was changed externally before and while mpv was running, this would reset the volume to the old value. Fixes #1335.
* 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.
* audio: remove internal libmpg123 wrapperwm42015-03-242-309/+0
| | | | | | | We've been prefering the libavcodec mp3 decoder for half a year now. There is likely no benefit at all for using the libmpg123 one. It's just a maintenance burden, and tricks users into thinking it's a required dependency.
* af_bs2b: fix option default valuewm42015-03-221-1/+2
| | | | | | | | | --af=bs2b:help abort()ed because the default value of the "profile" option is not represented by any choice. Fix it by adding an "unset" choice. (It's a bit odd because there's already a "default" choice, which is not default, but I don't care enough about this filter.) Fixes #1712.
* player: better handling of video with no timestampswm42015-03-201-0/+3
| | | | | | | | | | | Trying to handle such video is almost worthless, but it was requested by at least 2 users. If there are no timestamps, enable byte seeking by setting ts_resets_possible. Use the video FPS (wherever it comes from) and the audio samplerate for timing. The latter was already done by making the first packet emit DTS=0; remove this again and do it "properly" in a higher level.
* af_lavfi: handle seekingwm42015-03-171-1/+27
| | | | | | | | To handle seeking correctly, we need to flush the filter. libavfilter does not support flushing, so we destroy and recreate it. We also need to handle resume-after-EOF, because the mpv audio code sends an EOF before and after seeking (the latter happens because the player drains the filter chain in a generic way, which "causes" EOF).
* ao: slightly extend debug messageswm42015-03-161-1/+4
| | | | | This function already got uglified with debug printing; might as well go all the way.
* audio: fix off by one error in channel map selection codewm42015-03-151-2/+2
| | | | | | | The consequence was that some AOs (like ao_jack) could not output 8 channels. Fixes #1688.
* ao: align audio buffer sizewm42015-03-131-0/+3
| | | | Might or might not matter.
* audio: fix spdif packet size unitwm42015-03-102-9/+9
| | | | | | |