summaryrefslogtreecommitdiffstats
path: root/audio/out
Commit message (Collapse)AuthorAgeFilesLines
* ao_jack: allow more control about channel layoutswm42013-07-071-1/+21
|
* ao_jack: increase buffer size, always round up buffer sizewm42013-07-061-2/+2
| | | | | This should help with github issue #128, which reported stuttering distorted sound with 6 channel audio, but not with 2 channels.
* ao_wasapi0: add new wasapi event mode aoJonathan Yong2013-06-182-0/+844
|
* ao_dsound: fix compilationwm42013-06-161-0/+2
|
* audio/out: remove ao->outburst/buffersize fieldswm42013-06-1612-73/+64
| | | | | | | | | | | | | | | The core didn't use these fields, and use of them was inconsistent accross AOs. Some didn't use them at all. Some only set them; the values were completely unused by the core. Some made full use of them. Remove these fields. In places where they are still needed, make them private AO state. Remove the --abs option. It set the buffer size for ao_oss and ao_dsound (being ignored by all other AOs), and was already marked as obsolete. If it turns out that it's still needed for ao_oss or ao_dsound, their default buffer sizes could be adjusted, and if even that doesn't help, AO suboptions could be added in these cases.
* audio/out: don't require AOs to set ao->bpswm42013-06-169-40/+28
| | | | | | | Some still do, because they use the value in other places of the init function. ao_portaudio is tricky and reads ao->bps in the stream thread, which might be started on initialization (not sure about that, but better safe than sorry).
* audio: fix af_fmt_seconds_to_bytesStefano Pigozzi2013-06-162-5/+10
| | | | Was missing samplerate
* audio/out: remove wrapper for old AOswm42013-06-163-130/+0
| | | | It's unused now.
* ao_jack: use mp_ringStefano Pigozzi2013-06-161-31/+12
|
* ao_portaudio: use mp_ringStefano Pigozzi2013-06-161-56/+11
|
* core: add a spsc ringbuffer implementationStefano Pigozzi2013-06-163-164/+22
| | | | | | | | | | | | | | | | | Currently every single AO was implementing it's own ringbuffer, many times with slightly different semantics. This is an attempt to fix the problem. I stole some good ideas from ao_portaudio's ringbuffer and went from there. The main difference is this one stores wpos and rpos which are absolute positions in an "infinite" buffer. To find the actual position for writing / reading just apply modulo size. The producer only modifies wpos while the consumer only modifies rpos. This makes it pretty easy to reason about and make the operations thread safe by using barriers (thread safety is guaranteed only in the Single-Producer/Single- Consumer case). Also adapted ao_coreaudio to use this ringbuffer.
* ao_coreaudio: fix output with spdifStefano Pigozzi2013-06-161-5/+4
| | | | The mute condition was inverted...
* ao_coreaudio: split ringbuffer in it's own fileStefano Pigozzi2013-06-163-73/+159
| | | | | | | | | This is hopefully the start of something good. ca_ringbuffer_read and ca_ringbuffer_write can probably cleaned up from all the NULL checks once ao_coreaudio.c gets simplyfied. Conflicts: audio/out/ao_coreaudio.c
* ao_coreaudio: move to new libao APIStefano Pigozzi2013-06-161-310/+339
| | | | | This is just a first pass and the bare minimum to make it compile and work. SPDIF is untested for lack of hardware.
* ao_coreaudio: uncrustifyStefano Pigozzi2013-06-161-491/+553
| | | | | uncrustify -l C -c TOOLS/uncrustify.cfg --no-backup --replace \ audio/out/ao_coreaudio.c
* encode_lavc strings: use new option syntaxRudolf Polzer2013-06-161-1/+1
|
* ao_oss: fix compilation on BSDwm42013-06-111-2/+3
| | | | | | This was overlooked with commit 32a898f, because OSS4 volume control is typically not available on Linux. BSD does have this feature, so the broken code broke compilation there.
* ao_jack: remove global variableswm42013-06-071-71/+79
|
* ao_jack: align data sizes on audio frame sizewm42013-06-071-5/+5
| | | | | | | | | | Fixes crashes when playing with certain numbers of channels. The core assumes AOs accept data aligned on channels * samplesize, and ao_jack's play() function broke that assumption: mpv: core/mplayer.c:2348: fill_audio_out_buffers: Assertion `played % unitsize == 0' failed. Fix by aligning the buffer and chunk sizes as needed.
* ao_jack: switch to new AO APIwm42013-06-071-62/+62
|
* ao_jack: uncrustifywm42013-06-071-211/+236
|
* ao_oss: remove duplicated format infowm42013-06-071-50/+27
| | | | | Instead of having two big switch statements to convert between two audio formats, use a single table.
* ao_oss: remove global variableswm42013-06-071-80/+104
|
* ao_oss: switch to new AO APIwm42013-06-071-128/+117
|
* ao_oss: uncrustifywm42013-06-071-298/+334
|
* ao_openal: switch to new AO APIwm42013-06-041-52/+66
|
* ao_openal: uncrustifywm42013-06-041-172/+185
|
* ao_jack: add (no-)connect suboptionreimar2013-06-041-11/+17
| | | | | | | | | | | | | Add (no)connect option to ao_jack. Patch by Markus Appel [masolomaster3000 googlemail com]. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@36297 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: DOCS/man/de/mplayer.1 DOCS/man/en/mplayer.1 audio/out/ao_jack.c
* ao_dsound: remove global variableswm42013-06-041-100/+129
|
* ao_dsound: switch to new AO APIwm42013-06-041-61/+70
|
* ao_dsound: uncrustifywm42013-06-041-339/+375
|
* Replace calls to usec_sleep()wm42013-05-265-7/+7
| | | | | | This is just dumb sed replacement to mp_sleep_us(). Also remove the now unused usec_sleep() wrapper.
* Replace all calls to GetTimer()/GetTimerMS()wm42013-05-263-16/+16
| | | | | | | | | | | | | | | | | | | | | | GetTimer() is generally replaced with mp_time_us(). Both calls return microseconds, but the latter uses int64_t, us defined to never wrap, and never returns 0 or negative values. GetTimerMS() has no direct replacement. Instead the other functions are used. For some code, switch to mp_time_sec(), which returns the time as double float value in seconds. The returned time is offset to program start time, so there is enough precision left to deliver microsecond resolution for at least 100 years. Unless it's casted to a float (or the CPU reduces precision), which is why we still use mp_time_us() out of paranoia in places where precision is clearly needed. Always switch to the correct time. The whole point of the new timer calls is that they don't wrap, and storing microseconds in unsigned int variables would negate this. In some cases, remove wrap-around handling for time values.
* ao_alsa: always unset ALSA error handler, cleanup on init errorwm42013-05-261-8/+9
| | | | | | | | | | | | | | | | The ALSA device was not closed when initialization failed. The ALSA error handler (set with snd_lib_error_set_handler()) was not unset when closing ao_alsa. If this is not done, the handler will still be called when other libraries using ALSA cause errors, even though ao_alsa was long closed. Since these messages were prefixed with "[AO_ALSA]", they were misleading and implying ao_alsa was still used. For some reason, our error handler is still called even after doing snd_lib_error_set_handler(NULL), which should be impossible. Checking with the debuggers, inserting printf(), as well as the alsa-lib source code all suggest our error handler should not be called, but it still happens. It's a complete mystery.
* audio: fix ALSA 4 channel surround outputwm42013-05-131-1/+1
| | | | | | | | | It turns out that ALSA's 4 channel layout is different from mpv's and ffmpeg's 4.0 layout. Thus trying to do 4 channel output led to incorrect remixing via lib{av,sw}resample. Fix the default layouts for the internal filter chain as well, although I'm not sure if it matters at all.
* ao_coreaudio: fix switched parameterswm42013-05-121-1/+1
|
* Merge branch 'audio_changes'wm42013-05-1216-947/+960
|\ | | | | | | | | Conflicts: audio/out/ao_lavc.c
| * ao_alsa: set fallback if format unknownwm42013-05-121-4/+6
| | | | | | | | | | | | The snd_pcm_hw_params_test_format() call actually crashes in alsa-lib if called with SND_PCM_FORMAT_UNKNOWN, so the already existing fallback code won't work in this case.
| * audio/out: channel map selectionwm42013-05-1213-66/+114
| | | | | | | | | | | | | | | | | | Make all AOs use what has been introduced in the previous commit. Note that even AOs which can handle all possible layouts (like ao_null) use the new functions. This might be important if in the future ao_select_champ() possibly honors global user options about downmixing and so on.
| * audio: add channel map selection functionwm42013-05-122-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The point is selecting a minimal fallback. The AOs will call this through the AO API, so it will be possible to add options affecting the general channel layout selection. It provides the following mechanism to AOs: - forcing the correct channel order - downmixing to stereo if no layout is available - allow 5.1 <-> 5.1(side) fallback - handling "unknown" channel layouts This is quite weak and lots of code/complexity for little gain. All AOs already made sure the channel order was correct, and the fallback is of little value, and could perhaps be done in the frontend instead, like stereo downmixing with --channels=2 is handled. But I'm not really sure how this stuff should _really_ work, and the new code will hopefully provides enough flexibility to make radical changes to channel layout negotiation easier.
| * ao_pulse: move format setup codewm42013-05-121-27/+27
| |
| * ao_openal: use channel map instead of ALSA fixed layoutwm42013-05-121-10/+31
| | | | | | | | | | | | | | | | | | Now mpv's channel map is used to map each channel to a speaker. This allows in theory for playback of any layout for which ao_openal actually has a speaker defined. Also add the back-center (BC) speaker, which allows playback of 6.0 audio. Enabling more layouts by adding other speakers would be possible, but I'm not sure about the speaker positions.
| * ao: remove ao_driver.is_new fieldwm42013-05-129-9/+0
| | | | | | | | Is unused, is completely pointless.
| * ao_alsa: remove global variableswm42013-05-121-110/+116
| |
| * ao_alsa: switch to new AO APIwm42013-05-121-39/+54
| |
| * ao_alsa: map to exact channel layoutwm42013-05-121-38/+48
| | | | | | | | | | | | | | This allows supporting 5 channel audio (which can be eother 5.0 or 4.1). Fallback doesn't work yet. It will do nonsense if the channel layout doesn't match perfectly, even though it's similar.
| * ao_alsa: move format lookup into separate functionwm42013-05-121-58/+36
| |
| * ao_alsa: more reformatwm42013-05-121-118/+113
| |
| * ao_alsa: cosmetics, macro-fy error reportingwm42013-05-121-321/+181
| | | | | | | | | | | | | | | | Add a CHECK_ALSA_ERROR macro to report ALSA errors. This is similar to what vo_vdpau does. This removes lots of boiler plate, it almost gives me the feeling the ao_alsa initialization code is now readable. This change is squashed with the reformatting, because both changes are just as noisy and useless.
| * ao_alsa: uncrustifywm42013-05-121-623/+717
| |
| * ao_coreaudio: switch to WAVEEXT channel orderwm42013-05-121-2/+1
| | | | | | | | | | This used ALSA order, which was not correct. Most likely this has been wrong since forever.
| * ao_pulse: try to set correct channel layoutwm42013-05-121-2/+54
| | | | | | | | | | | | | | | | | | | | | | | | Like most other AOs, ao_pulse set the channel count only, always using a default layout. Try to set the exact layout. For this, we need a big lookup table to map waveex/lavc/mpv speaker position to PulseAudio's, since PA_CHANNEL_POSITION_ is apparently not compatible to waveext, and I haven't seen any API functions that would help mapping them. Completely untested. (Let's leave that to someone else...)
| * audio/out: switch to channel mapwm42013-05-1216-230/+150
| | | | | | | | | | | | This actually breaks audio for 5/6/8 channels. There's no reordering done yet. The actual reordering will be done inside of af_lavrresample and has to be made part of the format negotiation.
| * audio: add some setters for mp_audio, and require filters to use themwm42013-05-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mp_audio has some redundant fields. Setters like mp_audio_set_format() initialize these properly. Also move the mp_audio struct to a the file audio.c. We can remove a mysterious line of code from af.c: in.format |= af_bits2fmt(in.bps * 8); I'm not sure if this was ever actually needed, or if it was some kind of "make it work" quick-fix that works against the way things were supposed to work. All filters etc. now set the format correctly, so if there ever was a need for this code, it's definitely gone.
| * audio: switch to libavcodec channel order, use libavresample for mixingwm42013-04-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Switch the internal channel order to libavcodec's. If the channel number mismatches at some point, use libavresample for up- or downmixing. Remove the old af_pan automatic downmixing. The libavcodec channel order should be equivalent to WAVEFORMATEX order, at least nowadays. reorder_ch.h assumes that WAVEFORMATEX and libavcodec might be different, but all defined channels have the same mappings. Remove the downmixing with af_pan as well as the channel conversion with af_channels from af.c, and prefer af_lavrresample for this. The automatic downmixing behavior should be the same as before (if the --channels option is set to 2, which is the default, the audio output is forced to 2 channels, and libavresample does all downmixing). Note that mpv still can't do channel layouts. It will pick the default channel layout according to the channel count. This will be fixed later by passing down the channel layout as well. af_hrtf depends on the order of the input channels, so reorder to ALSA (for which this code was written). This is better than changing the filter code, which is more risky. ao_pulse can accept waveext order directly, so set that as channel mapping.
| * ao_alsa: reorder channels from internal to alsa orderwm42013-04-131-0/+6
| | | | | | | | | | Currently, internal and alsa order are exactly the same, so this will do absolutely nothing.
* | OSX: use native Cocoa's event loopStefano Pigozzi2013-05-121-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Schedule mpv's playloop as a high frequency timer inside the main Cocoa event loop. This has the benefit to allow accessing menus as well as resizing the window without the playback being blocked and allows to remove countless hacks from the code that involved manually pumping the event loop as well simulating manually some of the Cocoa default behaviours. A huge improvement consists in removing NSApplicationLoad. This is a C function defined in the Cocoa header and implements a minimal OSX application under ther hood so that you can use the Cocoa GUI toolkit from C/C++ without having to respect the Cocoa standards in terms of application initialization. This was bad because the behaviour implemented by NSApplicationLoad was hard to customize and had several gotchas especially in the menu department. mpv was changed to be just a nib-less application. All the Cocoa part is still generated in code but the event handling is now not dissimilar to what is present in a stock Mac application. As a part of reviewing the initialization process, I also removed all of `osdep/macosx_finder_args`. The useful parts of the code were moved to `osdep/macosx_appication` which has the broaded responsibility of managing the full lifecycle of the Cocoa application. By consequence the `--enable-macosx-finder` configure switch was killed as well, as this feature is always enabled. Another change the users will notice is that when using a bundle the `--quiet` option will be inserted much earlier in the initializaion process. This results in mpv not spamming mpv.log anymore with all the initialization outputs.
* | encoding: fix final audio frame syncRudolf Polzer2013-04-281-10/+22
|/ | | | | When --ocopyts was used, the final audio frame got improper pts. Fixed by now using the play() logic to play the final frame too.
* ao_jack: fix deprecation warningStefano Pigozzi2013-04-121-2/+5
| | | | | jack_port_get_total_latency is deprecated: use the "new" API based on jack_port_get_latency_range instead.
* ao_dsound: add missing includeKovensky2013-03-231-0/+1
| | | | libavutil/common.h is needed for FF_ARRAY_ELEMS.
* core: redo how codecs are mapped, remove codecs.confwm42013-02-101-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | |