aboutsummaryrefslogtreecommitdiffhomepage
path: root/audio
Commit message (Collapse)AuthorAge
* mixer: don't restore volume with different --softvol-max settingsGravatar wm42014-05-06
| | | | | | | | | | | 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.
* audio: fix the exact value that is used for the wait timeGravatar wm42014-05-04
| | | | | | | | | The comment says that it wakes up the main thread if 50% has been played, but in reality the value was 0.74/2 => 37.5%. Correct this. This probably changes little, because it's a very fuzzy heuristic in the first place. Also move down the min_wait calculation to where it's actually used.
* ao_null: fix unit mismatch with latency optionGravatar wm42014-05-04
| | | | It's in seconds, but the code used it as sample count.
* options: remove deprecated --identifyGravatar Martin Herkt2014-05-04
| | | | | | | Also remove MSGL_SMODE and friends. Note: The indent in options.rst was added to work around a bug in ReportLab that causes the PDF manual build to fail.
* ao_coreaudio: log even more info in verbose modeGravatar Stefano Pigozzi2014-04-24
| | | | | 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 layoutsGravatar Stefano Pigozzi2014-04-23
| | | | This can be useful for debugging purposes.
* audio: minor simplification in wait codeGravatar wm42014-04-23
|
* audio: preallocate audio buffers on resizeGravatar wm42014-04-18
| | | | | | 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.
* player: unrangle one aspect of audio EOF handlingGravatar wm42014-04-17
| | | | | | | | | | | | | | | | | | For some reason, the buffered_audio variable was used to "cache" the ao_get_delay() result. But I can't really see any reason why this should be done, and it just seems to complicate everything. One reason might be that the value should be checked only if the AO buffers have been recently filled (as otherwise the delay could go low and trigger an accidental EOF condition), but this didn't work anyway, since buffered_audio is set from ao_get_delay() anyway at a later point if it was unset. And in both cases, the value is used _after_ filling the audio buffers anyway. Simplify it. Also, move the audio EOF condition to a separate function. (Note that ao_eof_reached() probably could/should whether the last ao_play() call had AOPLAY_FINAL_CHUNK set to avoid accidental EOF on underflows, but for now let's keep the code equivalent.)
* audio: add hack against broken pulseaudio EOF conditionGravatar wm42014-04-17
| | | | | | | | | | | | This was reported with PulseAudio 2.1. Apparently it still has problems with reporting the correct delay. Since ao_pulse.c still has our custom get_delay implementation, there's a possibility that this is our fault, but this seems unlikely, because it's full of workarounds for issues like this. It's also possible that this problem doesn't exist on PulseAudio 5.0 anymore (I didn't explicitly retest it). The check is general and works for all push based AOs. For pull based AOs, this can't happen as pull.c implements all the logic correctly.
* audio: explicitly document audio EOF conditionGravatar wm42014-04-17
| | | | | | This should probably be an AO function, but since the playloop still has some strange stuff (using the buffered_audio variable instead of calling ao_get_delay() directly), just leave it and make it more explicit.
* ao_null: add simulated device latency, simulate EOF problemsGravatar wm42014-04-17
| | | | | This EOF problems happen at least with PulseAudio, but since it's hard to reproduce, let ao_null optionally simulate it.
* player: add a --dump-stats optionGravatar wm42014-04-17
| | | | | | | | | | | | | | | | | | | | | | | This collects statistics and other things. The option dumps raw data into a file. A script to visualize this data is included too. Litter some of the player code with calls that generate these statistics. In general, this will be helpful to debug timing dependent issues, such as A/V sync problems. Normally, one could argue that this is the task of a real profiler, but then we'd have a hard time to include extra information like audio/video PTS differences. We could also just hardcode all statistics collection and processing in the player code, but then we'd end up with something like mplayer's status line, which was cluttered and required a centralized approach (i.e. getting the data to the status line; so it was all in mplayer.c). Some players can visualize such statistics on OSD, but that sounds even more complicated. So the approach added with this commit sounds sensible. The stats-conv.py script is rather primitive at the moment and its output is semi-ugly. It uses matplotlib, so it could probably be extended to do a lot, so it's not a dead-end.
* ao: remove redundant get_delay checkGravatar wm42014-04-17
| | | | It did nothing; the real check is in push.c.
* af_lavcac3enc: detach on any passthrough format, not just ac3Gravatar wm42014-04-16
|
* audio: wake up the core when audio buffer is running low (2)Gravatar wm42014-04-15
| | | | | | | | | | | | | | Same change as in e2184fcb, but this time for pull based AOs. This is slightly controversial, because it will make a fast syscall from e.g. ao_jack. And according to JackAudio developers, syscalls are evil and will destroy realtime operation. But I don't think this is an issue at all. Still avoid locking a mutex. I'm not sure what jackaudio does in the worst case - but if they set the jackaudio thread (and only this thread) to realtime, we might run into deadlock situations due to priority inversion and such. I'm not quite sure whether this can happen, but I'll readily follow the cargo cult if it makes hack happy.
* ao_pulse: use ao_need_data()Gravatar wm42014-04-15
| | | | | | | | | I'm not quite sure why ao_pulse needs this. It was broken when a thread to fill audio buffers was added to AO - the pulseaudio callback was waking up the playback thread, not the audio thread. But nobody noticed, so it can't be very important. In any case, this change makes it wake up the audio thread instead (which in turn wakes up the playback thread if needed).
* audio: wake up the core when audio buffer is running lowGravatar wm42014-04-15
| | | | | | | | | | | | | | | | | And also add a function ao_need_data(), which AO drivers can call if their audio buffer runs low. This change intends to make it easier for the playback thread: instead of making the playback thread calculate a timeout at which the audio buffer should be refilled, make the push.c audio thread wakeup the core instead. ao_need_data() is going to be used by ao_pulse, and we need to workaround a stupid situation with pulseaudio causing a deadlock because its callback still holds the internal pulseaudio lock. For AOs that don't call ao_need_data(), the deadline is calculated by the buffer fill status and latency, as before.
* Kill all tabsGravatar wm42014-04-13
| | | | | | | | | | | I hate tabs. This replaces all tabs in all source files with spaces. The only exception is old-makefile. The replacement was made by running the GNU coreutils "expand" command on every file. Since the replacement was automatic, it's possible that some formatting was destroyed (but perhaps only if it was assuming that the end of a tab does not correspond to aligning the end to multiples of 8 spaces).
* af_volume: fix clang -Wsometimes-uninitializedGravatar Kevin Mitchell2014-04-13
|
* af_lavfi: fix graph parse deprecation warningGravatar Kevin Mitchell2014-04-13
|
* encode: add a missing \n to a log callGravatar wm42014-04-10
|
* demux: move metadata-based replaygain decoding out of af_volumeGravatar Alessandro Ghedini2014-04-04
|
* af_volume: use replaygain side dataGravatar Alessandro Ghedini2014-04-04
|
* af: add replaygain_data field to af_stream and af_instanceGravatar Alessandro Ghedini2014-04-04
| | | | Closes #664
* ao_wasapi: make code shorterGravatar wm42014-03-30
| | | | | | | | | Also fix a format string mistake in a log call using it. I wonder if this code shouldn't use FormatMessage, but it looks kind of involved [1], so: no, thanks. [1] http://support.microsoft.com/kb/256348/en-us
* af_volume: fix replaygainGravatar wm42014-03-27
| | | | | | | | This was accidentally broken in commit b72ba3f7. I somehow made the wild assumption that replaygain adjusted the volume relative to 0% instead of 100%. The detach suboption was similarly broken.
* af_lavcac3enc: use new AVFrame APIGravatar wm42014-03-16
|
* ao_lavc: set AVFrame.formatGravatar wm42014-03-16
| | | | | Seems kind of wrong that this wasn't done, although it didn't have any bad consequences.
* encode: use new AVFrame APIGravatar wm42014-03-16
|
* ad_lavc: use new AVFrame APIGravatar wm42014-03-16
| | | | | | | Set refcounted_frames, because in some versions of libavcodec mixing the new AVFrame API and non-refcounted decoding could cause memory corruption. Likewise, it's probably still required to unref a frame before calling the decoder.
* build: simplify libavfilter configure checksGravatar wm42014-03-16
| | | | | This is all not needed anymore. In particular, remove all configure switches except --enable-libavfilter.
* Remove some more unneeded version checksGravatar wm42014-03-16
| | | | | All of these check against things that happened before the latest supported FFmpeg/Libav release.
* ad_lavc: remove deprecated downmixing by channel countGravatar wm42014-03-16
| | | | | Downmixing by channel layout now hopefully works with all supported libavcodec versions.
* ao_dsound: remove duplicated codeGravatar wm42014-03-16
|
* af_lavrresample: remove avresample_set_channel_mapping() fallbacksGravatar wm42014-03-16
| | | | | | | This function is now always available. Also remove includes of reorder_ch.h from some AOs (these are just old relicts).
* options: fix off-by-1 error in option help outputGravatar wm42014-03-15
|
* ao: print (estimated) device buffer size on init in verbose modeGravatar wm42014-03-14
|
* af_volume: don't print missing replaygain tags as errorGravatar wm42014-03-14
| | | | There's no reason to. Audio files often lack them.
* af_volume: add detach optionGravatar wm42014-03-14
| | | | | | Maybe this should be default. On the other hand, this filter does something even if the volume is neutral: it clips samples against the allowed range, should the decoder or a previous filter output garbage.
* af_volume: separate softvol volume control from replaygain levelGravatar wm42014-03-14
| | | | | | | | | Currently, both replaygain adjustment and user volume control (if softvol is enabled) share the same variable. Sharing the variable would cause especially if --volume is used; then the replaygain volume would always be overwritten. Now both gain values are simple added right before doing filtering.
* af_volume: remove double-negated suboptionGravatar wm42014-03-14
| | | | | You had to use "no-replaygain-noclip" to set this option. Rename it, so that only one negation is needed.
* af_volume: add support for replaygain pre-amp and clipping preventionGravatar Alessandro Ghedini2014-03-13
|
* af_volume: add replaygain supportGravatar Alessandro Ghedini2014-03-13
| | | | | | | | | This adds the options replaygain-track and replaygain-album. If either is set, the replaygain track or album gain will be automatically read from the track metadata and the volume adjusted accordingly. This only supports reading REPLAYGAIN_(TRACK|ALBUM)_GAIN tags. Other formats like LAME's info header would probably require support from libav.
* af: add metadata field to af_stream and af_instanceGravatar Alessandro Ghedini2014-03-13
| | | | | | This allows to propagate metadata information to audio filters. Closes #632
* af_lavfi: beat it into working with LibavGravatar wm42014-03-13
| | | | | | | | | | | | | | | | | | | The main incompatibility was that Libav didn't have av_opt_set_int_list. But since that function is excessively ugly and idiotic (look how it handles types), I'm not missing it much. Use an aformat filter instead to handle the functionality that was indirectly provided by it. This is similar to how vf_lavfi works. The other incompatibility was channel handling. Libav consistently uses channel layouts only, why ffmpeg still requires messing with channel counts to some degree. Get rid of most channel count uses (and hope channel layouts are "exact" enough). Only in one case FFmpeg fails with a runtime check if we feed it AVFrames with channel count unset. Another issue were AVFrame accessor functions. FFmpeg introduced these for ABI compatibility with Libav. I refuse to use them, and it's not my problem if FFmpeg doesn't manage to provide a stable ABI for fields provided both by FFmpeg and Libav.
* ao_wasapi: Use the character set conversion functions from io.hGravatar Diogo Franco (Kovensky)2014-03-11
| | | | | ...rather than rolling out our own. The only possible advantage is that the "custom" ones didn't use talloc.
* ao_wasapi: Implement AOCONTROL_UPDATE_STREAM_TITLEGravatar Diogo Franco (Kovensky)2014-03-11
|
* ao_wasapi: Implement per-application mixingGravatar Diogo Franco (Kovensky)2014-03-11
| | | | | | | | | | | | | The volume controls in mpv now affect the session's volume (the application's volume in the mixer). Since we do not request a non-persistent session, the volume and mute status persist across mpv invocations and system reboots. In exclusive mode, WASAPI doesn't have access to a mixer so the endpoint (sound card)'s master volume is modified instead. Since by definition mpv is the only thing outputting audio in exclusive mode, this causes no conflict, and ao_wasapi restores the last user-set volume when it's uninitialized.
* ao_wasapi: Move non-critical code outside of the event threadGravatar Diogo Franco (Kovensky)2014-03-11
| | | | | | | | | | | | | | | Due to the COM Single-Threaded Apartment model, the thread owning the objects will still do all the actual method calls (in the form of message dispatches), but at least this will be COM's problem rather than having to set up several handles and adding extra code to the event thread. Since the event thread still needs to own the WASAPI handles to avoid waiting on another thread to dispatch the messages, the init and uninit code still has to run in the thread. This also removes a broken drain implementation and removes unused headers from each of the files split from the original ao_wasapi.c.