summaryrefslogtreecommitdiffstats
path: root/audio
Commit message (Collapse)AuthorAgeFilesLines
* mixer: don't restore volume with different --softvol-max settingswm42014-05-241-8/+11
| | | | | | | | | | | Changing --softvol-max and then resuming would change the volume level on resume to something different than the original volume. This is because the user volume setting is always between 0-100, and 100 corresponds to --softvol-max gain. Avoid that changing -softvol-max and resuming an older file could lead to a too loud volume level by refusing to restore if --softvol-max changed.
* ao_coreaudio: log even more info in verbose modeStefano Pigozzi2014-04-301-5/+27
| | | | | This logs more info that can be used for debugging purposes, in particular it prints all the AudioChannelDescription in the descriptions array.
* ao_coreaudio: add verbose output of detected channel layoutsStefano Pigozzi2014-04-301-0/+5
| | | | This can be useful for debugging purposes.
* audio: preallocate audio buffers on resizewm42014-04-301-2/+7
| | | | | | This avoids too many realloc() calls if the caller is appending to an audo buffer. This case is actually quite noticeable when using something that buffers a large amount of audio.
* af_lavcac3enc: detach on any passthrough format, not just ac3wm42014-04-171-1/+1
|
* encode: add a missing \n to a log callwm42014-04-171-1/+1
| | | | | Conflicts: audio/out/ao_lavc.c
* options: fix off-by-1 error in option help outputwm42014-03-301-1/+1
|
* ao_alsa: fix return value for volume operations with spdifwm42014-03-111-1/+1
| | | | | | | | | | | This AO pretended to support volume operations when in spdif passthrough mode, but actually did nothing. This is wrong: at least the GET operations must write their argument. Signal that volume is unsupported instead. This was probably a hack to prevent insertion of volume filters or so, but it didn't work anyway, while recovering after failed volume filter insertion does work, so this is not needed at all.
* ao_alsa: check ALSA PCM state before pause and resumefoo862014-03-111-5/+9
| | | | | | | | | | It is possible to have ao->reset() called between ao->pause() and ao->resume() when seeking during the pause. If the underlying PCM supports pausing, resuming an already reset PCM will produce an error. Avoid that by explicitly checking PCM state before calling snd_pcm_pause(). Signed-off-by: wm4 <wm4@nowhere>
* ao_rsound: pass correct data type to rsd_set_param()Hans-Kristian Arntzen2014-03-111-2/+2
| | | | Signed-off-by: wm4 <wm4@nowhere>
* ao_jack: fix termination on the end of filewm42014-03-111-3/+19
| | | | | | | | | | | | | | | | | | | | The player didn't quit when the end of a file was reached. The reason for this is that jack reported a constant audio delay even when all audio was done playing. Whether that was recognized as EOF by the player depended whether the exact value was higher or lower than the player's threshhold for what it considers no more audio. get_delay() should return amount of time it takes until the last sample written to the audio buffer reaches the speaker. Therefore, we have to track the estimated time when the last sample is done, and subtract it from the calculated latency. Basically, the latency is the only amount of time left in the delay, and it should go towards 0 as audio reaches ths speakers. I'm not sure if this is correct, but at least it solves the problem. One suspicious thing is that we use system time to estimate the end of the audio time. Maybe using jack_frame_time() would be more correct. But apart from this, there doesn't seem to be a better way to handle this.
* Factor out setting AVCodecContext extradatawm42014-03-111-10/+4
|
* audio: fix signedness of AF_FORMAT_S32Pwm42014-02-121-1/+1
| | | | This was marked as unsigned, but it's signed. Found by xylosper.
* w32: use safe DLL search paths everywhereJames Ross-Gowan2014-01-311-17/+0
| | | | | | | | | | | | Windows applications that use LoadLibrary are vulnerable to DLL preloading attacks if a malicious DLL with the same name as a system DLL is placed in the current directory. mpv had some code to avoid this in ao_wasapi.c. This commit just moves it to main.c, since there's no reason it can't be used process-wide. This change can affect how plugins are loaded in AviSynth, but it shouldn't be a problem since MPC-HC also does this and it's a very popular AviSynth client.
* audio: fix balance controlwm42014-01-311-2/+2
| | | | | | | | Balance controls as used by mixer.c was broken, because af_pan.c stopped accepting its arguments. We have to allow 0 channels explicitly. Also, fix null pointer access if the matrix parameter is not used. Regression from commit 82983970.
* af: fixed out-of-bounds accesses caused by NUM_FMT and co.11rcombs2014-01-311-18/+18
| | | | | | | | | Signed-off-by: wm4 <wm4@nowhere> This merges pull request #496. The problem was that at least the initialization of the distance[] array accessed af_fmtstr_table[] entries that were out of bounds. Small cosmetic changes applied to the original pull request.
* audio: check for overflowswm42014-01-061-0/+5
|
* ao_alsa: Unbreak pause/resumeMartin Herkt2014-01-061-11/+10
| | | | Well that was dumb.
* ao_alsa: Fix PCM resume after suspendMartin Herkt2014-01-061-15/+15
| | | | Fixes #324
* audio: fix format ID conversionwm42013-12-231-1/+1
| | | | | AV_SAMPLE_FMT_NONE != 0, could apparently cause crashes in certain situations.
* msg: rename mp_msg_log -> mp_msgwm42013-12-213-3/+3
| | | | Same for companion functions.
* af_export: require filename argumentwm42013-12-211-4/+3
| | | | | | Since mp_find_user_config_file() is going to get a context argument, which would be annoying to do in the audio chain (actually I'm just lazy).
* m_option: add mp_log callback to OPT_STRING_VALIDATE optionswm42013-12-213-60/+62
| | | | | And also convert a bunch of other code, especially ao_wasapi and ao_portaudio.
* m_option, m_config: mp_msg conversionswm42013-12-214-11/+13
| | | | | | | | Always pass around mp_log contexts in the option parser code. This of course affects all users of this API as well. In stream.c, pass a mp_null_log, because we can't do it properly yet. This will be fixed later.
* codecs: mp_msg conversionwm42013-12-211-1/+1
|
* ao: some missing mp_msg conversionswm42013-12-211-13/+17
|
* ao_wasapi: mp_msg conversionswm42013-12-211-67/+34
| | | | | | | Remove the nonsensical print_lock too. Things that are called from the option validator are not converted yet, because the option parser doesn't provide a log context yet.
* audio/fmt-conversion.c: remove unknown audio format messageswm42013-12-214-15/+19
| | | | Same deal as with video/fmt-conversion.c.
* audio: mp_msg conversionswm42013-12-2123-194/+178
|
* mixer: mp_msg conversionswm42013-12-212-13/+12
|
* ao_alsa: don't set ALSA message callbackwm42013-12-211-21/+0
| | | | | | | This could output additional, potentially useful error messages. But the callback is global and not library-safe, and would require us to add additional state. Remove it, because it's obviously too much of a pain. Also, it seems ALSA prints stuff to stderr anyway.
* ao_wasapi: fix includeswm42013-12-181-3/+2
| | | | Broken due to recent header renaming. Untested.
* ad_lavc: work around deprecation warningwm42013-12-181-1/+4
| | | | | | | | | | request_channels has been deprecated for years (request_channel_layout is the replacement), but it appears it's still needed despite the deprecation at least on older libavcodec versions. So still set request_channels, but to it with the avoption API, which hides the deprecation warning. This should also prevent mpv getting trashed when libavcodec happens to bump its major version.
* Reduce recursive config.h inclusions in headerswm42013-12-184-4/+4
| | | | | | In my opinion, config.h inclusions should be kept to a minimum. MPlayer code really liked including config.h everywhere, though, even in often used header files. Try to reduce this.
* Remove the _ macrowm42013-12-181-0/+2
| | | | | This was a gettext-style macro to mark strings that should be translated.
* Split mpvcore/ into common/, misc/, bstr/wm42013-12-1744-60/+60
|
* Merge mp_talloc.h into ta/ta_talloc.hwm42013-12-171-1/+1
|
* Move options/config related files from mpvcore/ to options/wm42013-12-1725-28/+28
| | | | | | | | | Since m_option.h and options.h are extremely often included, a lot of files have to be changed. Moving path.c/h to options/ is a bit questionable, but since this is mainly about access to config files (which are also handled in options/), it's probably ok.
* Move mpvcore/input/ to input/wm42013-12-171-1/+1
|
* Replace mp_tmsg, mp_dbg -> mp_msg, remove mp_gtext(), remove set_osd_tmsgwm42013-12-167-23/+23
| | | | | | | | | The tmsg stuff was for the internal gettext() based translation system, which nobody ever attempted to use and thus was removed. mp_gtext() and set_osd_tmsg() were also for this. mp_dbg was once enabled in debug mode only, but since we have log level for enabling debug messages, it seems utterly useless.
* ao_wasapi: Fix mistaken behavior on uninitDiogo Franco (Kovensky)2013-12-081-2/+2
| | | | | The parameter, when true, tells whether uninit should block for flushing the buffers, not whether it should quit immediately without flushing.
* ao_wasapi: handle AOPLAY_FINAL_CHUNKDiogo Franco (Kovensky)2013-12-081-2/+6
| | | | | Used for writing down all samples to the audio driver, even if it's not a full chunk; needed at EOF on weird files.
* ao_wasapi: Reduce the buffer size to a sane valueDiogo Franco (Kovensky)2013-12-081-1/+1
| | | | | | | The previous RING_BUFFER_COUNT value, 64, would have ao_wasapi buffer 64 frames of audio in the ring buffer; a delay of 1280ms, which is clearly overkill for everything. A value of 8 buffers 8 frames for a total of 160ms.
* ao_wasapi: fix audio buffering delay calculationDiogo Franco (Kovensky)2013-12-081-1/+1
| | | | | | | | When get_space was converted to returning samples instead of bytes, a unit type mismatch in get_delay's calculation returned bogus values. Fix by converting get_space's value back to bytes. Fixes playback with ao_wasapi when reaching EOF, or seeking past it.
* mixer: remove comment about af_pan doing downmixingwm42013-12-071-3/+1
| | | | We don't do that anymore.
* audio: flush remaining data from the filter chain on EOFwm42013-12-052-3/+7
| | | | | | | | | | | | | | | | | This can be reproduced with: mpv short.wav -af 'lavfi="aecho=0.8:0.9:5000|6800:0.3|0.25"' An audio file that is just 1-2 seconds long should play for 8-9 seconds, which audible echo towards the end. The code assumes that when playing with AF_FILTER_FLAG_EOF, the filter will either produce output, or has all remaining data flushed. I'm not really sure whether this really works if there are multiple filters with EOF handling in the chain. To handle it correctly, af_lavfi should retry filtering if 1. EOF flag is set, 2. there were input samples, and 3. no output samples were produced. But currently it seems to work well enough anyway.
* audio/filter: change filter callback signaturewm42013-12-0528-152/+152
| | | | | | | | | The new signature is actually closer to how it actually works, and someone who is not familiar to the API and how it works might make fewer fatal mistakes with the new signature than the old one. Pretty weird. Do this to sneak in a flags parameter, which will later be used to flush remaining data of at least vf_lavfi.
* ad_lavc: handle decoder EAGAIN only if there was an input packetwm42013-12-041-3/+3
| | | | | Otherwise, it'd probably get stuck if the decoder still returns EAGAIN at EOF on e.g. a shortened data stream.
* af: remove af->setup fieldwm42013-12-043-9/+7
| | | | Used to be used by filters that didn't use the option parser.
* af: remove legacy option parsing hackswm42013-12-042-10/+2
|
* af_pan: change options, use option parserwm42013-12-041-42/+38
| | | | Similar to af_channels etc...
* af_ladspa: change options, use option parserwm42013-12-041-158/+103
|
* af_delay: change option parsing, fix bugs, use option parserwm42013-12-041-27/+36
| | | | Similar situation to af_channels.
* af_channels: use "unknown" channel layoutswm42013-12-041-2/+4
| | | | | | | | | This will make af_channels output a channel layout that is compatible with any destination layout. Not sure if that's a good idea though, since the way the AO choses a layout is perhaps less predictable. On the other hand, using the old MPlayer standard layouts doesn't make much sense either. We'll see whether this improves or breaks someone's use case.
* af_channels: change options, fix bugs, use option parserwm42013-12-041-65/+45
| | | | | | | Apparently this stopped working after some planar changes (broken format negotiation). Radically change option parsing in an incompatible way. Suggest alternatives to this filter, since it barely has any importance anymore.
* af_sweep: use option parserwm42013-12-041-16/+7
|
* af_surround: use option parserwm42013-12-041-24/+8
|
* af_sub: use option parserwm42013-12-041-36/+9
|
* af_sinesuppress: use option parserwm42013-12-041-24/+8
|
* af_hrtf: use option parserwm42013-12-041-34/+23
|
* af_extrastereo: use option parserwm42013-12-041-22/+8
|
* af_export: use option parserwm42013-12-041-48/+16
| | | | Probably requires the user to quote the shared buffer filename.
* af_equalizer: use option parserwm42013-12-041-26/+17
|
* af_drc: use option parserwm42013-12-041-35/+18
|
* af_center: use option parserwm42013-12-041-27/+8
|
* af: returning NULL on filtering means errorwm42013-12-041-2/+4
| | | | | | This code used to be ok, until the assert() was added. Simplify the loop statement, since the other NULL check for data doesn't make sense anymore.
* ad_lavc: expose an option to enable threadingwm42013-12-041-0/+3
|
* ad_lavc: deal with arbitrary decoder delaywm42013-12-041-16/+24
| | | | | | | | | | | | | | | | | | | | Normally, audio decoder don't have a decoder delay, so the code was fine. But FFmpeg supports multithreaded decoding for some audio codecs, which introduces such a delay. The delay means that we won't get decoded audio for the first few packets, and that we need to do something to get the trailing audio still buffered in the decoder when reaching EOF. Two changes are needed to deal with the delay: - If EOF is reached, pass a "flush" packet to the decoder to return the buffered audio. Such a flush packet is automatically setup when calling mp_set_av_packet() with a NULL packet. - Use the PTS returned by the decoder, instead of the packet's. This is important to get correct timestamps for decoded audio. Ignoring this would result into offsetting the audio playback time by the decoder delay. Note that we can still use the timestamp of the first packet to get the timestamp for the start of the audio.
* av_common: add timebase parameter to mp_set_av_packet()wm42013-12-042-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | If the timebase is set, it's used for converting the packet timestamps. Otherwise, the previous method of reinterpret-casting the mpv style double timestamps to libavcodec style int64_t timestamps is used. Also replace the kind of awkward mp_get_av_frame_pkt_ts() function by mp_pts_from_av(), which simply converts timestamps in a way the old function did. (Plus it takes a timebase parameter, similar to the addition to mp_set_av_packet().) Note that this should not change anything yet. The code in ad_lavc.c and vd_lavc.c passes NULL for the timebase parameters. We could set AVCodecContext.pkt_timebase and use that if we want to give libavcodec "proper" timestamps. This could be important for ad_lavc.c: some codecs (opus, probably mp3 and aac too) have weird requirements about doing decoding preroll on the container level, and thus require adjusting the audio start timestamps in some cases. libavcodec doesn't tell us how much was skipped, so we either get shifted timestamps (by the length of the skipped data), or we give it proper timestamps. (Note: libavcodec interprets or changes timestamps only if pkt_timebase is set, which by default it is not.) This would require selecting a timebase though, so I feel uncomfortable with the idea. At least this change paves the way, and will allow some testing.
* ao_oss: when falling back from unknown prefer larger formatbugmen0t2013-12-041-0/+16
|
* ao_oss: add 24bit formatsbugmen0t2013-12-041-0/+12
|
* options: add options that set defaults for af/vf/ao/vowm42013-12-013-1/+4
| | | | | | | | There are some use cases for this. For example, you can use it to set defaults of automatically inserted filters (like af_lavrresample). It's also useful if you have a non-trivial VO configuration, and want to use --vo to quickly change between the drivers without repeating the whole configuration in the --vo argument.
* Use O_CLOEXEC when creating FDswm42013-11-301-1/+3
| | | | | | | | | | | | | | This is needed so that new processes (created with fork+exec) don't inherit open files, which can be important for a number of reasons. Since O_CLOEXEC is relatively new (POSIX.1-2008, before that Linux specific), we #define it to 0 in io.h to prevent compilation errors on older/crappy systems. At least this is the plan. input.c creates a pipe. For that, add a mp_set_cloexec() function (which is based on Weston's code in vo_wayland.c, but more correct). We could use pipe2() instead, but that is Linux specific. Technically, we have a race condition, but it won't matter.
* ao_oss: add 6.1 and 7.1 speaker placement from FreeBSDbugmen0t2013-11-301-1/+15
|
*