Commit Graph

469 Commits

Author SHA1 Message Date
xylosper c6448d7a9b audio: add enum name for speaker id 2014-02-28 20:54:15 +01:00
wm4 6b2a929ca7 ao: document some functions 2014-02-28 00:56:10 +01:00
wm4 14607f27ef command: use the step size for "add volume" commands
The step argument for "add volume <step>" was ignored until now. Fix it.

There is one problem: by defualt, "add volume" should use the value set
with --volstep. This value is 3 by default. Since the default volue for
the step argument is always 1 (and we don't really want to make the
generic code more complicated by introducing custom step sizes), we
simply multiply the step argument with --volstep to keep it compatible.

The --volstep option should probably be just removed in the future.
2014-02-27 01:07:46 +01:00
wm4 fdd5d00be3 audio: fix signedness of AF_FORMAT_S32P
This was marked as unsigned, but it's signed. Found by xylosper.
2014-02-05 18:53:00 +01:00
James Ross-Gowan d26ee98fa6 w32: use safe DLL search paths everywhere
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.
2014-01-27 10:04:29 +01:00
Stefano Pigozzi 3137a1a7b5 build: fix usage of HAVE_SDL1 define
This is needed after fd1f8ed49.
2014-01-25 09:18:07 +01:00
wm4 39b40e1ffb audio/filter: remove redundant log message prefixes
These are now appended automatically, so you'd get them twice before
this commit.
2014-01-24 21:30:15 +01:00
wm4 8b0cfdc81e audio: fix balance control
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.
2014-01-23 15:53:36 +01:00
11rcombs a0cc204528 af: fixed out-of-bounds accesses caused by NUM_FMT and co.
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.
2014-01-19 21:15:54 +01:00
wm4 4b4926bbb3 Factor out setting AVCodecContext extradata 2014-01-11 01:25:49 +01:00
wm4 e0d7876eca ao_pulse: lower default buffer size from 1000ms to 250ms
1000ms is a bit insane. It makes behavior on playback speed changes
worse (because the player has to catch up the dropped audio due to
audio-chain reset), and perhaps makes seeking slower.

Note that the problem of playback speed changes misbehaving will be
fixed in the future, but even then we don't want to have a buffer that
large.
2014-01-07 23:52:18 +01:00
wm4 a220a3aae6 ao_pulse: add suboption to control buffer size 2014-01-07 23:50:22 +01:00
wm4 52ed634811 audio: check for overflows 2014-01-03 00:42:40 +01:00
wm4 d4588bf577 ao_alsa: remove 9 year old typo
Actually, remove the whole comment, because it's outdated and
get_space() returns the number of free samples now.
2014-01-02 21:29:33 +01:00
Martin Herkt 4350a76a01 ao_alsa: Unbreak pause/resume
Well that was dumb.
2014-01-02 18:46:11 +01:00
Martin Herkt 4083ae1de3 ao_alsa: Fix PCM resume after suspend
Fixes #324
2014-01-02 16:09:27 +01:00
wm4 96e6f3f4b6 audio: fix format ID conversion
AV_SAMPLE_FMT_NONE != 0, could apparently cause crashes in certain
situations.
2013-12-23 21:24:41 +01:00
wm4 eef36f03ea msg: rename mp_msg_log -> mp_msg
Same for companion functions.
2013-12-21 22:13:04 +01:00
wm4 232b8de095 af_export: require filename argument
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).
2013-12-21 21:43:17 +01:00
wm4 9242c34fa2 m_option: add mp_log callback to OPT_STRING_VALIDATE options
And also convert a bunch of other code, especially ao_wasapi and
ao_portaudio.
2013-12-21 21:43:16 +01:00
wm4 d8d42b44fc m_option, m_config: mp_msg conversions
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.
2013-12-21 21:05:02 +01:00
wm4 5f0fbacf16 codecs: mp_msg conversion 2013-12-21 20:50:12 +01:00
wm4 138d183d83 ao: some missing mp_msg conversions 2013-12-21 20:50:12 +01:00
wm4 7cc3c3aeec ao_wasapi: mp_msg conversions
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.
2013-12-21 20:50:12 +01:00
wm4 60c06fec1e audio/fmt-conversion.c: remove unknown audio format messages
Same deal as with video/fmt-conversion.c.
2013-12-21 20:50:12 +01:00
wm4 1974c9b49d audio: mp_msg conversions 2013-12-21 20:50:12 +01:00
wm4 4abe6b862f mixer: mp_msg conversions 2013-12-21 20:50:11 +01:00
wm4 fdceef6cc5 ao_alsa: don't set ALSA message callback
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.
2013-12-21 17:36:56 +01:00
wm4 03e53ab430 ao_wasapi: fix includes
Broken due to recent header renaming. Untested.
2013-12-18 17:14:31 +01:00
wm4 b170248389 ad_lavc: work around deprecation warning
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.
2013-12-18 17:12:49 +01:00
wm4 2c08bf1bd7 Reduce recursive config.h inclusions in headers
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.
2013-12-18 17:12:21 +01:00
wm4 4ed83fe2e5 Remove the _ macro
This was a gettext-style macro to mark strings that should be
translated.
2013-12-18 17:12:07 +01:00
wm4 0112143fda Split mpvcore/ into common/, misc/, bstr/ 2013-12-17 02:39:45 +01:00
wm4 73a5417950 Merge mp_talloc.h into ta/ta_talloc.h 2013-12-17 02:18:16 +01:00
wm4 eb15151705 Move options/config related files from mpvcore/ to options/
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.
2013-12-17 02:07:57 +01:00
wm4 8d5214de0a Move mpvcore/input/ to input/ 2013-12-17 01:23:09 +01:00
wm4 7dc7b900c6 Replace mp_tmsg, mp_dbg -> mp_msg, remove mp_gtext(), remove set_osd_tmsg
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.
2013-12-16 20:41:08 +01:00
Diogo Franco (Kovensky) 04faf9a1cb ao_wasapi: Fix mistaken behavior on uninit
The parameter, when true, tells whether uninit should block for flushing
the buffers, not whether it should quit immediately without flushing.
2013-12-08 19:36:44 -03:00
Diogo Franco (Kovensky) c7064ce5e5 ao_wasapi: handle AOPLAY_FINAL_CHUNK
Used for writing down all samples to the audio driver, even if it's not
a full chunk; needed at EOF on weird files.
2013-12-08 19:36:43 -03:00
Diogo Franco (Kovensky) 8f4380d6d5 ao_wasapi: Reduce the buffer size to a sane value
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.
2013-12-08 19:14:56 -03:00
Diogo Franco (Kovensky) 2329e46229 ao_wasapi: fix audio buffering delay calculation
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.
2013-12-08 19:03:26 -03:00
wm4 070269df73 mixer: remove comment about af_pan doing downmixing
We don't do that anymore.
2013-12-07 19:30:14 +01:00
wm4 84cfe0d8b2 audio: flush remaining data from the filter chain on EOF
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.
2013-12-05 00:31:55 +01:00
wm4 ed024aadb6 audio/filter: change filter callback signature
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.
2013-12-05 00:01:46 +01:00
wm4 2bcfb49a39 ad_lavc: handle decoder EAGAIN only if there was an input packet
Otherwise, it'd probably get stuck if the decoder still returns EAGAIN
at EOF on e.g. a shortened data stream.
2013-12-04 23:30:01 +01:00
wm4 193930ac3b af: remove af->setup field
Used to be used by filters that didn't use the option parser.
2013-12-04 23:13:46 +01:00
wm4 09bd19e59e af: remove legacy option parsing hacks 2013-12-04 23:13:46 +01:00
wm4 82983970b3 af_pan: change options, use option parser
Similar to af_channels etc...
2013-12-04 23:13:46 +01:00
wm4 adc843f984 af_ladspa: change options, use option parser 2013-12-04 23:13:46 +01:00
wm4 bcd8afc2ad af_delay: change option parsing, fix bugs, use option parser
Similar situation to af_channels.
2013-12-04 23:13:46 +01:00