summaryrefslogtreecommitdiffstats
path: root/audio
Commit message (Collapse)AuthorAgeFilesLines
* audio: don't let ao_lavc access frontend internals, change gapless audiowm42013-11-083-35/+33
| | | | | | | | | | | | | | | | | | | | | | | ao_lavc.c accesses ao->buffer, which I consider internal. The access was done in ao_lavc.c/uninit(), which tried to get the left-over audio in order to write the last (possibly partial) audio frame. The play() function didn't accept partial frames, because the AOPLAY_FINAL_CHUNK flag was not correctly set, and handling it otherwise would require an internal FIFO. Fix this by making sure that with gapless audio (used with encoding), the AOPLAY_FINAL_CHUNK is set only once, instead when each file ends. Basically, move the hack in ao_lavc's uninit to uninit_player. One thing can not be entirely correctly handled: if gapless audio is active, we don't know really whether the AO is closed because the file ended playing (i.e. we want to send the buffered remainder of the audio to the AO), or whether the user is quitting the player. (The stop_play flag is overwritten, fixing that is perhaps not worth it.) Handle this by adding additional code to drain the AO and the buffers when playback is quit (see play_current_file() change). Test case: mpv avdevice://lavfi:sine=441 avdevice://lavfi:sine=441 -length 0.2267 -gapless-audio
* audio: stop "unsupported sample format" spamwm42013-11-071-6/+1
| | | | | | | It spams these in verbose mode. It's caused by format negotiation code in af.c. It's for the mpv format to ffmpeg-format case, and that one is very uninteresting. (The ffmpeg supported audio formats are practically never extended.)
* audio: fix bogus audio format comparisonwm42013-11-071-1/+1
|
* af: remove a pointless macrowm42013-11-072-28/+16
| | | | | The code should be equivalent; a compatibility macro definition is left. (It should be mass-replaced later.)
* audio/format: convert format macros to enum, drop NE suffixwm42013-11-072-95/+96
| | | | | | | | | | Turn the sample format definitions into an enum. (The format bits are still macros.) The native endian versions of the new definitions don't have a NE suffix anymore, although there are still compatibility defines since too much code uses the NE variants. Rename the format bits for special formats to help to distinguish them from the actual definitions, e.g. AF_FORMAT_AC3 to AF_FORMAT_S_AC3.
* audio: replace af_fmt2str_short -> af_fmt_to_strwm42013-11-0713-34/+22
| | | | Also, remove all af_fmt2str usages.
* audio/format: reformatwm42013-11-072-58/+56
|
* ao_oss: fix previous ao_oss commitwm42013-11-061-1/+0
| | | | | Basically I introduced an inverted condition, and the line removed was inactive before commit ce72aaa.
* ao_oss: hide warningwm42013-11-061-2/+2
|
* ao_oss: don't enable -softvol by default on OSSv4bugmen0t2013-11-061-0/+4
|
* ao_oss: make no_persistent_volume volume work when seekingbugmen0t2013-11-061-0/+4
|
* osx: fix -Wshadow warnings on platform specific codeStefano Pigozzi2013-11-041-3/+3
|
* configure: uniform the defines to #define HAVE_xxx (0|1)Stefano Pigozzi2013-11-035-27/+27
| | | | | | | | | | | | | | | | | | | | | The configure followed 5 different convetions of defines because the next guy always wanted to introduce a new better way to uniform it[1]. For an hypothetic feature 'hurr' you could have had: * #define HAVE_HURR 1 / #undef HAVE_DURR * #define HAVE_HURR / #undef HAVE_DURR * #define CONFIG_HURR 1 / #undef CONFIG_DURR * #define HAVE_HURR 1 / #define HAVE_DURR 0 * #define CONFIG_HURR 1 / #define CONFIG_DURR 0 All is now uniform and uses: * #define HAVE_HURR 1 * #define HAVE_DURR 0 We like definining to 0 as opposed to `undef` bcause it can help spot typos and is very helpful when doing big reorganizations in the code. [1]: http://xkcd.com/927/ related
* demux: rename Windows symbolswm42013-11-021-1/+1
| | | | | | | | | | | | | | | | | | | | There are some Microsoft Windows symbols which are traditionally used by the mplayer core, because it used to be convenient (avi was the big format, using binary windows decoders made sense...). So these symbols have the exact same definition as the Windows one, and if mplayer is compiled on Windows, the symbols from windows.h are used. This broke recently just because some files were shuffled around, and the symbols defined in ms_hdr.h collided with windows.h ones. Since we don't have windows binary decoders anymore, there's not the slightest reason our symbols should have the same names. Rename them to reduce the risk for collision, and to fix the recent regression. Drop WAVEFORMATEXTENSIBLE, because it's mostly unused. ao_dsound defines its own version if the windows headers don't define it, and ao_wasapi is not available on systems where this symbol is missing. Also reindent ms_hdr.h.
* ao_pulse: fix channel layoutswm42013-10-311-1/+4
| | | | | | | | The code was selecting PA_CHANNEL_POSITION_MONO for MP_SPEAKER_ID_FC, which is correct only with the "mono" channel layout, but not anything else. Remove the mono entry, and handle mono separately. See github issue #326.
* 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.
* af: replace macros with too generic nameswm42013-10-2611-43/+33
| | | | | | | | Defining names like min, max etc. in an often used header is not really a good idea. Somewhat similar to MPlayer svn commit 36491, but don't use libavutil, because that typically causes us sorrow.
* af_volume: some more cosmeticswm42013-10-261-27/+15
|
* af_volume: switch to new option parsingwm42013-10-261-31/+18
|
* af_volume: uncrustifywm42013-10-261-94/+85
| | | | Also, use more C99 and remove "register" keywords.
* af_volume: don't change volume if nothing is to be changedwm42013-10-261-0/+2
| | | | | On the float path. Note that this skips clipping, but we expect that everything on the audio-path is pre-clipped anyway.
* af_volume: remove unused featureswm42013-10-263-56/+1
| | | | | | Roughly follows MPlayer svn commits 36492 and 36493. We also remove the volume peak reporting. (There are much better libavfilter filters for this, I think.)
* 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-2318-106/+45
|
* audio/filter: remove useless af_info fieldswm42013-10-2326-152/+94
| | | | | | | Drop the author and comment fields. They were completely unused - not even printed in verbose mode, just dead weight. Also use designated initializers and drop redundant flags.
* af_force: set format early for better debug outputwm42013-10-231-18/+34
| | | | | | | Set the input/output format in filter init. This doesn't change anything functionally, but it makes the forced format show up in the filter chain init verbose output (which sometimes prints the filter chain before all filters have been configured).
* af_force: minor simplificationswm42013-10-231-9/+0
|
* audio/filter: rename af_force.c to af_format.cwm42013-10-231-0/+0
| | | | The filter itself was already renamed earlier - but rename the file too.
* audio/filter: split af_format into separate filters, rename af_forcewm42013-10-235-516/+365
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | af_format is the old audio conversion filter. It could do all possible conversions supported by the audio chain. However, ever since the addition of af_lavrresample, most conversions are done by libav/swresample, and af_format is used as fallback. Separate out the fallback cases and remove af_format. af_convert24 does 24 bit <-> 32 bit conversions, while af_convertsignendian does sign and endian conversions. Maybe the way the conversions are split sounds a bit odd. But the former changes the size of the audio data, while the latter is fully in-place, so there's at least different buffer management. This requires a quite complicated algorithm to make sure all these "partial" conversion filters can actually get from one format to another. E.g. s24le->s32be always requires convertsignendian and convert24, but af.c has no idea what the intermediate format should be. So I added a graph search (trying every possible format and filter) to determine required format and filter. When I wrote this, it seemed this was still better than messing everything into af_lavrresample, but maybe this is overkill and I'll change my opinion. For now, it seems nice to get rid of af_format though. The AC3->IEC61937 conversion isn't supported anymore, but I don't think this is needed anywhere. Most AOs test all formats explicitly, or use the AF_FORMAT_IS_IEC61937() macro (which includes AC3). One positive consequence of this change is that conversions always include dithering (done by libav/swresample), instead of possibly going through af_format, which doesn't do anything fancy. Rename af_force to af_format. It's essentially compatible with command line uses of af_format. We retain a compatibility alias for af_force.
* audio/format: add some helper functionswm42013-10-222-0/+33
|
* ao_pcm: big endian AC3 in wav doesn't workwm42013-10-221-1/+0
| | | | | | | | At least not with ffmpeg. Honestly, I have no idea how little endian AC3 works at all, since ao_pcm doesn't do anything special about it, and treats it like s16le. Maybe it's broken and ffmpeg has special logic to detect it.
* af_lavrresample: actually free resamplerwm42013-10-191-0/+3
| | | | Fixes #304.
* mp_msg: remove gettext() supportwm42013-10-181-1/+1
| | | | | | | | | Was disabled by default, was never used, internal support was inconsistent and poor, and there has been virtually no interest in creating translations. And I don't even think that a terminal program should be translated. This is something for (hypothetical) GUIs.
* command: don't allow changing volume if no audio initializedwm42013-10-122-0/+6
| | | | | | | | | | | | | | | | | | | | | | | Changing volume when audio is disabled was a feature request (github issue #215), and was introduced with commit 327a779. But trying to fix github issue #280 (volume is not correct in no-audio mode, and if audio is re-enabled, the volume set in no-audio mode isn't set), I concluded that it's not worth the trouble and the current implementation is questionable all around. (For example, you can't change the real volume in no-audio mode, even if the AO is open - this could happen with gapless audio.) It's hard to get right, and the current mixer code is already hilariously overcomplicated. (Virtually all of mixer.c is an amalgamation of various obscure corner cases.) So just remove this feature again. Note that "options/volume" and "options/mute" still can be used in idle mode to adjust the volume used next time, though these properties can't be used during playback and thus not in audio-only mode. Querying the volume still "works" in audio-only mode, though it can return bogus values.
* ad_mpeg123: support in-stream format changesThomas Orgis2013-10-061-61/+88
| | | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@36461 b3059339-0415-0410-9bf9-f77b7e298cf2 Fixes playback of http://mpg123.org/test/44and22.mp3 Cherry-picked from MPlayer SVN rev. #36461, a patch by Thomas Orgis, committed by by Reimar Döffinger.
* 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
* audio/out: add sndio supportChristian Neukirchen2013-10-032-0/+344
| | | | Based on an earlier patch for mplayer by Alexandre Ratchov <alex@caoua.org>
* cosmetics: replace "CTRL" defines by enumswm42013-10-021-1/+3
| | | | Because why not.
* 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.
* ao_jack: don’t force exact client nameMartin Herkt2013-09-301-1/+1
| | | | | | | | Trying to connect multiple mpv clients to JACK with the JackUseExactName option would fail unless the user manually specifies a unique client name. This changes the behavior to automatically generate a unique name if the requested one is already in use.
* ao_oss: add support for SNDCTL_DSP_RESET and use it when pausingPaul B Mahol2013-09-231-0/+6
| | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: wm4 <wm4@nowhere>
* ao_pulse: bug fix: goto the correct error handlerJohan Kiviniemi2013-09-201-2/+2
|
* ao_pulse: set the property media.role=videoJohan Kiviniemi2013-09-201-2/+17
|
* af: merge af_reinit() and fix_output_format()wm42013-09-202-30/+12
| | | | | | | | | | | | | | | | Calling them separately doesn't really make sense, and all existing calls to them usually combined them. One subtitle difference was that af_init() didn't wipe the filter chain if initialization of the chain itself failed, but that didn't really make sense anyway. Also remove af_init() from the code for setting balance in mixer.c. The mixer should be in the initialized state only if audio is fully initialized, so the af_init() call made no sense. Note that the filter "editing" code in command.c doesn't really do a nice job of handling errors in case recreating an _old_ (known to work) filter chain unexpectedly fails, and this obscure/rare case might be differently handled after this change.
* mixer: make struct opaquewm42013-09-204-42/+50
| | | | Also remove stray include statements from ao_alsa and ao_oss.
* mixer: restore volume with playback resumewm42013-09-202-1/+30
| | | | | | | | | Note that this is intentionally never done if the AO or softvolume is different, or if the current volume control method is thought to control system wide volume (such as ALSA) or otherwise user controllable (such as PulseAudio). The intention is to keep things robust and to avoid messing with the user's audio settings as far as possible, while still providing the ability to resume volume if it makes sense.
* mixer: don't unmute audio when raising volumewm42013-09-191-2/+0
| | | | This is rather strange behavior, away with it.
* mixer: refactor, fix some aspects of --volume handlingwm42013-09-192-68/+124
| | | | | | | | | | | | | | | | | | | | Refactor how mixer.c does volume/mute restoration and initialization. Move to handling of --volume and --mute to mixer.c. Simplify the implementation of these and hopefully fix bugs/strange behavior related to using them as file-local options (this uses a somewhat dirty trick: the option values are reverted to "auto" after initialization). Put most code related to initialization and volume restoring in probe_softvol() and restore_volume(). Having this code all in one place is less confusing. Instead of trying to detect whether to use softvol at runtime, detect it at initialization time using AOCONTROL_GET_VOLUME (same with mute, AOCONTROL_GET_MUTE). This implies we expect SET_VOLUME/SET_MUTE to work if the GET variants work. Hopefully this is always the case. This is also preparation for being able to change volume/mute settings if audio is disabled, and for allowing restoring value with playback resume.
* mixer, af_volume: use linear values instead of dBwm42013-09-192-21/+21
| | | | | | | Softvol always used a linear multiplier for volume control. This was converted to dB, and then back to linear in af_volume. Remove this non- sense. We still try to keep the command line argument to af_volume in dB, though.
* mixer: minor refactoringwm42013-09-192-26/+27
| | | | | Let struct mixer access access MPOpts to simplify some things. Rename some variables and functions. There should be no functional changes.
* af_export: fix compilation warningwm42013-09-191-2/+1
| | | | Blargh.
* Config path functions can return NULLwm42013-09-181-0/+6
| | | | | | | It's quite unlikely, but functions like mp_find_user_config_file() can return NULL, e.g. if $HOME is unset. Fix all the code that didn't check for this correctly yet.
* audio: fix playback of Musepack SV8 fileswm42013-09-011-2/+4
| | | | | | | | | | | | | | This is basically a libavcodec API oddity: it can happen that avcodec_decode_audio4() returns 0 (meaning 0 bytes were consumed). It requires you to feed the complete packet again to decode the full packet, and to successfully decode the following packets. We ignored this case with the argument that there's the danger of an endless decode loop (because nothing of that packet is apparently decoded, so it would retry forever), but change it in order to decode mpc8 files correctly. Also add some comments to explain the mess.
* audio: don't allow setting unknown formats from command linewm42013-08-261-17/+1
| | | | | | | af_str2fmt_short(), which is used by the command line option parser, allowed passing a hex number. The user could set arbitrary integers as internal audio formats, even formats which don't exist or make no sense. This is not very useful, so get rid of it.
* audio: make internal audio format 0 an invalid formatwm42013-08-263-9/+9
| | | | | | | | | | | | Having to use -1 for that is generally quite annoying. Audio formats are created from bitmasks, and it can't be excluded that 0 is not a valid format. Fix this by adjusting AF_FORMAT_I so that it is never 0. Along with AF_FORMAT_F and the special formats, all valid formats are covered and guaranteed to be non-0. It's possible that this commit will cause some regressions, as the check for invalid audio formats changes a bit.
* Some more mp_msg conversionswm42013-08-232-101/+61
| | | | | Also add a note to mp_msg.h, since it might be not clear which of the two mechanisms is preferred.
* audio/out: do some mp_msg conversionswm42013-08-228-163/+118
| | | | | | | 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.
* ao: remove some leftoverswm42013-08-222-7/+0
|
* core: move contents to mpvcore (2/2)Stefano Pigozzi2013-08-0635-73/+73
| | | | Followup commit. Fixes all the files references.
* Merge pull request #154 from rossy2401/wasapi-pauseDiogo Franco2013-08-051-1/+2
|\ | | | | WASAPI stops working after pause
| * ao_wasapi: don't check the audio feed while pausedJames Ross-Gowan2013-07-271-1/+2
| |
* | core: change speed option/property to doublewm42013-08-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The --speed option and the speed property used float. Change them to double. Change the commands that manipulate the property (speed_mult/add) to double as well. Since the cycle command shares code with the add command, we change that as well. The reason for this change is that this allows better control over speed, such as stepping by semitones. Using floats is also just plain unnecessary.
* | ao_coreaudio: move to new log APIStefano Pigozzi2013-08-014-99/+101
| |
* | ao_coreaudio: remove useless definesStefano Pigozzi2013-08-011-3/+0
| | | | | | | | They are already defined in the header file
* | audio/out: add support for new logging APIStefano Pigozzi2013-08-012-8/+15
| |
* | Fix some warningsJonathan Yong2013-07-301-6/+6