summaryrefslogtreecommitdiffstats
path: root/audio/out/ao_coreaudio.c
Commit message (Collapse)AuthorAgeFilesLines
* audio/out: prepare for non-interleaved audiowm42013-11-121-3/+5
| | | | | | | | | | | | | | | | | | | This comes with two internal AO API changes: 1. ao_driver.play now can take non-interleaved audio. For this purpose, the data pointer is changed to void **data, where data[0] corresponds to the pointer in the old API. Also, the len argument as well as the return value are now in samples, not bytes. "Sample" in this context means the unit of the smallest possible audio frame, i.e. sample_size * channels. 2. ao_driver.get_space now returns samples instead of bytes. (Similar to the play function.) Change all AOs to use the new API. The AO API as exposed to the rest of the player still uses the old API. It's emulated in ao.c. This is purely to split the commits changing all AOs and the commits adding actual support for outputting N-I audio.
* audio/out: reject non-interleaved formatswm42013-11-121-0/+2
| | | | | | | | | | No AO can handle these, so it would be a problem if they get added later, and non-interleaved formats get accepted erroneously. Let them gracefully fall back to other formats. Most AOs actually would fall back, but to an unrelated formats. This is covered by this commit too, and if possible they should pick the interleaved variant if a non-interleaved format is requested.
* osx: fix -Wshadow warnings on platform specific codeStefano Pigozzi2013-11-041-3/+3
|
* audio/out: remove useless info struct and redundant fieldswm42013-10-231-6/+5
|
* ao_coreaudio: clear output buffer on buffer underrunStefano Pigozzi2013-10-031-0/+1
| | | | | | | | Output silence to the output buffer during underruns. This removes small occasional glitches that happen before the AUHAL is actually paused from the `audio_pause` call. Fixes #269
* ao_coreaudio: fetch device name only for verbose log levelStefano Pigozzi2013-10-011-6/+8
| | | | | The previous code fetched the device name regardless of log level and then only printed it if log level was verbose.
* core: move contents to mpvcore (2/2)Stefano Pigozzi2013-08-061-3/+3
| | | | Followup commit. Fixes all the files references.
* ao_coreaudio: move to new log APIStefano Pigozzi2013-08-011-29/+27
|
* ao_coreaudio: use default output unit when no device is specifiedStefano Pigozzi2013-07-291-1/+3
| | | | | | Using the default output audio unit should provide a much better user exeperience since it changes automatically the output device based on which becomes the default one.
* ao_coreaudio: prevent buffer underruns to output garbageStefano Pigozzi2013-07-281-1/+6
| | | | | | This was removed in d427b4fd. I now found a sample that causes underruns when moving to a chapter and apparently this is also a problem when taking screenshots.
* audio/out: remove options argument from init()wm42013-07-221-1/+1
| | | | Same as with VOs in the previous commit.
* ao_coreaudio: fix ifdef'd conditionalStefano Pigozzi2013-07-221-1/+1
| | | | | The big endian case was not covered. Doesn't make much difference since mpv runs on Macs with x86 only, but for the sake of correctness.
* ao_coreaudio: use new option APIStefano Pigozzi2013-07-221-38/+22
|
* ao_coreaudio: switch properties getters to tallocStefano Pigozzi2013-07-221-12/+12
|
* ao_coreaudio: revert to original device format on digital uninitStefano Pigozzi2013-07-221-3/+11
| | | | | | This is not done automatically by CoreAudio. I am told that it would a PITA to have to switch back the format manually on the device (especially if the same device is used for lpcm output).
* ao_coreaudio: refactor chmap detectionStefano Pigozzi2013-07-221-88/+11
| | | | | | b2f9e0610 introduced this functionality with code that was quite 'monolithic'. Split the functionality over several functions and ose the new macros to get array properties.
* ao_coreaudio: refactor properties codeStefano Pigozzi2013-07-221-40/+26
| | | | | | | | Introduce some macros to deal with properties. These allow to work around the limitation of CoreAudio's API being `void **` based. The macros allow to keep their client's code DRY, by not asking size and other details which can be derived by the macro itself. I have no idea why Apple didn't design their API like this in the first place.
* ao_coreaudio: move utils functions to snake_caseStefano Pigozzi2013-07-221-6/+6
|
* ao_coreaudio: split ao_coreaudio_common in two filesStefano Pigozzi2013-07-221-10/+7
| | | | | | | | | * ao_coreaudio_utils: contains several utility function * ao_coreaudio_properties: contains functions to set and get audio object properties. Conflicts: audio/out/ao_coreaudio.c
* ao_coreaudio: store asbd only when selectedStefano Pigozzi2013-07-221-4/+1
| | | | | Previous code needlessly stored the input asbd before actually testing it's support against the hardware.
* ao_coreaudio: fallback to waveext on non surround inputsStefano Pigozzi2013-07-221-3/+3
|
* ao_coreaudio: set channel layout based on hardware queryStefano Pigozzi2013-07-221-2/+106
| | | | this is a wip
* ao_coreaudio: fix regression in digital stream selectionStefano Pigozzi2013-07-221-1/+1
| | | | | | The condition was checked wrongly on asbd which is the input format description. This lead to the condition always being true, thus selecting lpcm streams for digital input.
* ao_coreaudio: return errors instead false in init functionsStefano Pigozzi2013-07-221-3/+3
|
* ao_coreaudio: remove useless function declarationStefano Pigozzi2013-07-221-3/+0
|
* ao_coreaudio: only set chmap_sel info for lpcmStefano Pigozzi2013-07-221-5/+7
|
* ao_coreaudio: set channel layout bitmapStefano Pigozzi2013-07-221-1/+17
|
* ao_coreaudio: move digital detection before asbd creationStefano Pigozzi2013-07-221-10/+9
|
* ao_coreaudio: remove chmap selection if format is digitalStefano Pigozzi2013-07-221-1/+0
|
* ao_coreaudio: remove volume multiplication by 4Stefano Pigozzi2013-07-221-2/+2
| | | | | kHALOutputParam_Volume is the linear gain so it should be at maximum 1 to keep the audio quality good. No idea why it was more than that.
* ao_coreaudio: remove device property listener on uninitStefano Pigozzi2013-07-221-12/+6
| | | | Also extract this functionality inside a function in coreaudio_common
* ao_coreaudio: print help string in one goStefano Pigozzi2013-07-221-5/+11
|
* ao_coreaudio: change all ++var to var++Stefano Pigozzi2013-07-221-5/+3
| | | | | Luckily they all were inside for loops so the functionality does not actually change.
* ao_coreaudio: change private vars names to match mpv conventionsStefano Pigozzi2013-07-221-91/+101
|
* ao_coreaudio: remove packetSize private variableStefano Pigozzi2013-07-221-3/+3
|
* ao_coreaudio: refactor play/pauseStefano Pigozzi2013-07-221-27/+15
|
* ao_coreaudio: refactor uninitStefano Pigozzi2013-07-221-17/+6
|
* ao_coreaudio: remove a fixme since that seems fixedStefano Pigozzi2013-07-221-2/+0
|
* ao_coreaudio: ca_msg: add trailing \n where missingStefano Pigozzi2013-07-221-5/+5
|
* ao_coreaudio: refactor playStefano Pigozzi2013-07-221-16/+8
|
* ao_coreaudio: extract mixmode set/unset in utility functionsStefano Pigozzi2013-07-221-46/+7
|
* ao_coreaudio: move AudioStreamChangeFormat to common file and refactorStefano Pigozzi2013-07-221-86/+0
|
* ao_coreaudio: extract methods to lock/unlock device for digital outputStefano Pigozzi2013-07-221-28/+7
|
* ao_coreaudio: lpcm: remove buffer size calculation depending on audio unitStefano Pigozzi2013-07-221-8/+0
|
* ao_coreaudio: refactor initializationStefano Pigozzi2013-07-221-389/+267
| | | | | | | | | | | | | The initialization is split more clearly between compressed and lpcm case. For the compressed case, format selection is simplified a lot and negotiation removed. The way it was written it just passed back to the core the original requested format, not what was found available on hardware. Since this is most likely useless for the compressed case, I didn't bother with this. In the future I'd like to split this AO in two one that only uses the AUHAL and the other with direct access to the hardware so that even passthrough of lcpm can be possible. This would decrease the latency, audiophiles would like that.
* ao_coreaudio: refactor print_helpStefano Pigozzi2013-07-221-26/+21
|
* ao_coreaudio: split out some utility functions and refactor themStefano Pigozzi2013-07-221-310/+11
| | | | | | | Split out some utility functions that use the CoreAudio API but are not related the main task of the AOs (which is to move data correctly to the ringbuffer). These are mainly need for the verbosity of the CoreAudio API and are just obscuring the 'real' code.
* ao_coreaudio: make variable names shorterStefano Pigozzi2013-07-221-30/+30
| | | | property_address -> p_addr
* ao_coreaudio: add error check function and macroStefano Pigozzi2013-07-221-41/+68
| | | | WIP
* ao_coreaudio: dry up ca_msg and use it everywhereStefano Pigozzi2013-07-221-61/+57
| | | | | Change the ca_msg macro to pass along MSGT_AO automatically. Also use it for every output for consistency.
* ao_coreaudio: simplify digital render callbackStefano Pigozzi2013-07-221-4/+3
| | | | | It was reported that it also works by not setting the read size in the AudioBuffer (now idea how, but I will discover it later).
* ao_coreaudio: rewrite spdif render callbackStefano Pigozzi2013-07-221-39/+20
|
* ao_coreaudio: simplify render callbackStefano Pigozzi2013-07-221-23/+9
| | | | | | | Read only the requested amount by the AUHAL (instead of all the buffered data). No idea what the deal is with pausing the audio units if there is no audio to play, maybe to avoid underruns of some sort. Anyway from my tests this condition never occurred so I'm removing it all.
* audio/out: remove ao->outburst/buffersize fieldswm42013-06-161-6/+0
| | | | | | | | | | | | | | | 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: fix af_fmt_seconds_to_bytesStefano Pigozzi2013-06-161-4/+8
| | | | Was missing samplerate
* core: add a spsc ringbuffer implementationStefano Pigozzi2013-06-161-21/+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-161-73/+16
| | | | | | | | | 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
* Replace calls to usec_sleep()wm42013-05-261-2/+2
| | | | | | This is just dumb sed replacement to mp_sleep_us(). Also remove the now unused usec_sleep() wrapper.
* ao_coreaudio: fix switched parameterswm42013-05-121-1/+1
|
* Merge branch 'audio_changes'wm42013-05-121-6/+13
|\ | | | | | | | | Conflicts: audio/out/ao_lavc.c
| * audio/out: channel map selectionwm42013-05-121-3/+8
| | | | | | | | | | | | | | | | | | 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.
| * 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.
| * audio/out: switch to channel mapwm42013-05-121-6/+9
| | | | | | | | | | | | 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.
* | 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.
* ao_coreaudio: use 0 as timeout for CFRunLoopRunInModeMad Fish2013-01-201-1/+1
| | | | | | | Handle all pending events and exit instead of waiting. When there are lots of input events (for example, scrolling with trackpad), timeout can add up to make a huge frame delay. In my tests, if I scroll fast enough, that loop would never exit.
* ao_coreaudio: fix deprecation warningsStefano Pigozzi2012-11-131-6/+6
|
* Rename directories, move files (step 2 of 2)wm42012-11-121-4/+4
| | | | | | | | | | | | Finish renaming directories and moving files. Adjust all include statements to make the previous commit compile. The two commits are separate, because git is bad at tracking renames and content changes at the same time. Also take this as an opportunity to remove the separation between "common" and "mplayer" sources in the Makefile. ("common" used to be shared between mplayer and mencoder.)
* Rename directories, move files (step 1 of 2) (does not compile)wm42012-11-121-0/+1283
Tis drops the silly lib prefixes, and attempts to organize the tree in a more logical way. Make the top-level directory less cluttered as well. Renames the following directories: libaf -> audio/filter libao2 -> audio/out libvo -> video/out libmpdemux -> demux Split libmpcodecs: vf* -> video/filter vd*, dec_video.* -> video/decode mp_image*, img_format*, ... -> video/ ad*, dec_audio.* -> audio/decode libaf/format.* is moved to audio/ - this is similar to how mp_image.* is located in video/. Move most top-level .c/.h files to core. (talloc.c/.h is left on top- level, because it's external.) Park some of the more annoying files in compat/. Some of these are relicts from the time mplayer used ffmpeg internals. sub/ is not split, because it's too much of a mess (subtitle code is mixed with OSD display and rendering). Maybe the organization of core is not ideal: it mixes playback core (like mplayer.c) and utility helpers (like bstr.c/h). Should the need arise, the playback core will be moved somewhere else, while core contains all helper and common code.