summaryrefslogtreecommitdiffstats
path: root/audio/out/ao_alsa.c
Commit message (Collapse)AuthorAgeFilesLines
* audio: drop "_NE"/"ne" suffix from audio formatswm42013-11-151-2/+2
| | | | | | You get the native format by not appending any suffix to the format. This change includes user-facing names, e.g. for the --format option.
* ao_alsa: non-interleaved access is not always availablewm42013-11-141-0/+5
| | | | | | I thought this would always work... how disappointing. Revert to interleaved format if requesting non-interleaved fails.
* ao_alsa: support non-interleaved audiowm42013-11-121-25/+23
| | | | | | | | ALSA supports non-interleaved audio natively using a separate API function for writing audio. (Though you have to tell it about this on initialization.) ALSA doesn't have separate sample formats for this, so just pretend to negotiate the interleaved format, and assume that all non-interleaved formats have an interleaved companion format.
* audio/out: prepare for non-interleaved audiowm42013-11-121-11/+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.
* ao: add ao_play_silence, use for ao_alsa and ao_osswm42013-11-101-6/+2
| | | | | Also add a corresponding function to audio/format.c, which fills an audio block with silence.
* ao_alsa: use correct magic spdif flagswm42013-11-091-14/+11
| | | | | I accidentally copied the AES4/ORIGFS constants from the ALSA headers, instead of the AES3/FS ones. The difference is probably important.
* ao: print requested audio format on initwm42013-11-091-3/+0
| | | | Also remove the rather bad/incomplete log calls from ao_alsa and ao_oss.
* ao_alsa: add magic spdif parameterswm42013-11-091-1/+25
| | | | | | | | | | | | | | I have no idea what these do, but apparently they are needed to inform ALSA about spdif configuration. First, replace the literal constant "6" for the AES0 parameter with the symbolic constants from the ALSA headers (the final value is the same). Second, copy paste some funky looking parameter setup from VLC's alsa output for setting the AES1, AES2, AES3 parameters. (The code is actually not literally copy-pasted, but does exactly the same.) My small but non-zero hope is that this could make DTS-HD work, or at least work into that direction. I can't test spdif stuff though, and for DTS-HD not even opening the ALSA device succeeds on my system.
* ao_alsa: redo the way parameters are added in the spdif casewm42013-11-091-38/+24
| | | | | | | | | | | Using spdif with alsa requires adding magic parameters to the device name, and the existing code tried to deal with the situation when the user wanted to add parameters too. Rewrite this code, in particular remove the duplicated parameter string as preparation for the next commit. The new code is a bit stricter, e.g. it doesn't skip spaces before and after '{' and '}'. (Just don't add spaces.)
* audio: replace af_fmt2str_short -> af_fmt_to_strwm42013-11-071-1/+1
| | | | Also, remove all af_fmt2str usages.
* ao_alsa: return negative value on error in play()wm42013-10-301-3/+3
| | | | | No functional change, because the only user of ao_play() ignores return values below 1.
* ao_alsa: don't include alloca.hwm42013-10-251-1/+0
| | | | | | | | It's true that ALSA uses alloca() in some of its API functions, but since this is hidden behind macros in the ALSA headers, we have no reason to include alloca.h ourselves. Might help with portability (FreeBSD).
* audio/out: remove useless info struct and redundant fieldswm42013-10-231-6/+3
|
* mixer: make struct opaquewm42013-09-201-1/+0
| | | | Also remove stray include statements from ao_alsa and ao_oss.
* audio/out: do some mp_msg conversionswm42013-08-221-54/+35
| | | | | | | Use the new MP_ macros for some AOs instead of mp_msg. Not all AOs are converted, and some only partially. In some cases, some additional cosmetic changes are made.
* core: move contents to mpvcore (2/2)Stefano Pigozzi2013-08-061-3/+3
| | | | Followup commit. Fixes all the files references.
* audio/out: remove options argument from init()wm42013-07-221-1/+1
| | | | Same as with VOs in the previous commit.
* Remove subopt-helperwm42013-07-221-1/+1
| | | | Finally not used by anything anymore. Farewell.
* options: remove --mixer and --mixer-channel, turn them into alsa/oss suboptswm42013-07-211-32/+16
| | | | | | These two options were supported by ALSA and OSS only. Further, their values were specific to the respective audio systems, so it doesn't make sense to keep them as top-level options.
* ao_alsa: use new option API (changes syntax)wm42013-07-211-66/+25
| | | | | | | | | | | | This changes how device names are handled. Before this commit, device names were mangled in strange ways to avoid clashing with the option parser syntax. "." was replaced with ",", and "=" with ":" (the user had to do the inverse to get the correct device name). The "new" option parser has multiple ways to escape option strings, so we don't need this confusing hack anymore. Add an explicit note to the manpage as well.
* audio/out: remove ao->outburst/buffersize fieldswm42013-06-161-7/+9
| | | | | | | | | | | | | | | 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-161-1/+0
| | | | | | | 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).
* 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_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-121-23/+30
| | | | | | | | | 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: remove ao_driver.is_new fieldwm42013-05-121-1/+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
|
* audio/out: switch to channel mapwm42013-05-121-17/+14
| | | | | | 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.
* 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.
* ao_alsa: do not call snd_pcm_delay() when pausedwm42013-01-061-0/+8
| | | | | | | | | | | | | | | | | | | | | | This causes trouble when a hw device is used: pcm_hw.c:514:(snd_pcm_hw_delay) SNDRV_PCM_IOCTL_DELAY failed (-77): File descriptor in bad state when running mpv test.mkv --ao=alsa:device=iec958,alsa and pausing during playback. Historically, mplayer usually did not call snd_pcm_delay() (which is called by get_delay()) while paused, so this problem never showed up. But at least mpv has changes that cause get_delay() to be called when updating the status line (see commit 3f949cf). It's possible that calling snd_pcm_delay() is not always legal when the audio is paused, and at least fails with the error message mentioned above is the device is a hardware device. Change get_delay() to return the last delay before the audio was paused. The intention is to get a continuous playback status display, even when pausing or frame stepping, otherwise we could just return the audio buffer fill status in get_delay() or even just 0 when paused.
* audio: remove support for native alaw/mulaw/adpcm outputwm42012-12-111-6/+0
| | | | | | This is considered a worthless feature. Note that alaw/mulaw/adpcm input is unaffected: such data is handed to libavcodec and "decoded" to linear PCM.
* audio: make AC3 pass-through with ad_spdif workreimar2012-12-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Do not fall back to 0 for samplerate when parser is not initialized. Might fix some issues with using -ac spdifenc with audio in MKV or MP4. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35517 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace outdated list of unsupported formats by list of supported formats. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35534 b3059339-0415-0410-9bf9-f77b7e298cf2 Do not call af_fmt2str on the same data over and over. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35535 b3059339-0415-0410-9bf9-f77b7e298cf2 ad_spdif: use the more specific AF_FORMAT_AC3_LE when we handle AC3. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35536 b3059339-0415-0410-9bf9-f77b7e298cf2 Make AF_FORMAT_IS_IEC61937 include AF_FORMAT_IS_AC3. Our AC3 "sample format" is also iec61937. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35537 b3059339-0415-0410-9bf9-f77b7e298cf2 af_format: support endianness conversion also for iec61937 formats in general, not just AC3. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35538 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: audio/filter/af_format.c af_format: Fix check_format, non-special formats are of course supported. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35545 b3059339-0415-0410-9bf9-f77b7e298cf2 Note: see mplayer bug #2110
* Fix potential bugs and issues, general cleanupsreimar2012-11-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most of these are reimar fixing issues found by Coverity static analyzer, and possibly some more cleanup commits independent from this. Since these commits are rather noisy, squash them all together. Try to make code a bit clearer. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35294 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: audio/out/ao_alsa.c Check the correct variable for NULL. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35323 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove pointless unreachable code (the loop condition already checks the 0xff case). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35325 b3059339-0415-0410-9bf9-f77b7e298cf2 Fix typo that might have caused reading beyond the string end. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35326 b3059339-0415-0410-9bf9-f77b7e298cf2 Do not needlessly use "long" types. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35331 b3059339-0415-0410-9bf9-f77b7e298cf2 Use AV_RB32 to avoid sign extension issues and validate offset before using it. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35332 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove nonsense casts. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35343 b3059339-0415-0410-9bf9-f77b7e298cf2 Fix crash in case sh_audio allocation failed. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35348 b3059339-0415-0410-9bf9-f77b7e298cf2 Fix potential NULL dereference. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35351 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: libmpcodecs/ad_ffmpeg.c Note: Slightly modified. Fix malloc failure check to check the correct variable. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35353 b3059339-0415-0410-9bf9-f77b7e298cf2 Avoid code duplication and pointless casts. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35363 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: stream/tv.c Error out if an invalid channel list name was specified instead of continuing and reading outside array bounds all over the place. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35364 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: stream/tv.c Make array "static const". git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35365 b3059339-0415-0410-9bf9-f77b7e298cf2 Properly free resources even when encountering many parse errors. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35367 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: parser-cfg.c Avoid leaks in error handling. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35380 b3059339-0415-0410-9bf9-f77b7e298cf2 Do not do sign comparisons on "char" type which can be both signed or unsigned. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35381 b3059339-0415-0410-9bf9-f77b7e298cf2 Free cookies file data after parsing it. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35382 b3059339-0415-0410-9bf9-f77b7e298cf2 http_set_field only makes a copy of the string, so we still need to free it. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35383 b3059339-0415-0410-9bf9-f77b7e298cf2 check4proxies does not modify input URL, so mark it const. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35390 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove proxy "support" from stream_rtp and stream_upd, trying to use a http proxy for UDP connections makes no sense. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35394 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: stream/stream_rtp.c stream/stream_udp.c Add url_new_with_proxy function to reduce code duplication and memleaks. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35395 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: stream/pnm.c stream/stream_live555.c stream/stream_nemesi.c stream/stream_rtsp.c Fix off-by-one errors in file descriptor validity checks. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35402 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove pointless cast. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35403 b3059339-0415-0410-9bf9-f77b7e298cf2 Abort when opening the file failed instead of calling "write" with an invalid descriptor. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35404 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove pointless local variable. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35411 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: stream/http.c
* Rename directories, move files (step 2 of 2)wm42012-11-121-5/+5
| | | | | | | | | | | | 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/+868
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.