Commit Graph

36041 Commits

Author SHA1 Message Date
wm4 7c2bf06615 af_lavrresample: switch to new option API
Also add a "o" suboption, which should allow fine control over
libavresample.
2013-07-22 15:11:04 +02:00
wm4 1189f64dd1 af_force: use new option API 2013-07-22 15:11:04 +02:00
wm4 3b8dfddb4c audio/filter: use new option API
Make the VF/VO/AO option parser available to audio filters. No audio
filter uses this yet, but it's still a quite intrusive change.

In particular, the commands for manipulating filters at runtime
completely change. We delete the old code, and use the same
infrastructure as for video filters. (This forces complete
reinitialization of the filter chain, which hopefully isn't a problem
for any use cases. The old code forced reinitialization too, but it
could potentially allow a filter to cache things; e.g. consider loaded
ladspa plugins and such.)
2013-07-22 15:11:03 +02:00
wm4 221ef23d0d af_force: add option that causes filter to fail at initialization
This is useful for debugging.
2013-07-22 15:06:43 +02:00
wm4 0c9b0ba40d af: fix recovery code for filter insertion (changing volume with spdif crash)
This code is supposed to run if dynamic filter insertion (such as when
inserting a volume filter in mixer.c) fails. Then it removes all filters
and recreates the default list of filters. But the code just blew up and
entered an endless loop, because it removed even the sentinel in/out
filters. This could happen when trying to use softvol controls while
using spdif, but also other situations. Fix it by calling the correct
code.

Also remove these obnoxious yoda-conditions.
2013-07-22 15:06:07 +02:00
wm4 f86b94f9b4 audio/decode: remove macro crap
Declare decoders directly, instead of using the LIBAD_EXTERN macro. This
is simpler (no weird magic) and more extensible.
2013-07-22 14:41:56 +02:00
wm4 0b160e1257 vf_scale: actually respect param and param2 suboptions
This was forgotten in commit b81f5e2.
2013-07-22 14:41:33 +02:00
Diogo Franco (Kovensky) db9102765a stream_vcd.c: fix compilation on win32
The mp_vcd_priv_t struct doesn't have a file descriptor but a file
handle on win32.
2013-07-22 02:52:04 +02:00
Diogo Franco (Kovensky) 58338f9240 ao_wasapi: Make default on Windows.
Ahead of OSS because cygwin provides OSS.
2013-07-22 02:42:38 +02:00
Diogo Franco (Kovensky) 1b2dc3613f ao_wasapi: Fix S/PDIF passthrough init
MSDN tells me to multiply the samplerates by 4 (for setting up the S/PDIF
signal frequency), but doesn't mention that I'm only supposed to do it
on the new, NT6.1+ IEC 61937 structs. Works on my Realtek Digital Output,
but as I can't connect any hardware to it I can't hear the result.

Also, always ask for little-endian AC3. I'm not sure if this is supposed
to be LE or NE, but Windows is LE on all platforms, so we go with LE.
2013-07-22 02:42:38 +02:00
Diogo Franco (Kovensky) 9fe2772780 ao_wasapi: Log the passthrough format in MSGL_V 2013-07-22 02:42:38 +02:00
Diogo Franco (Kovensky) a8b4be274c ao_wasapi: Also do passthrough for AF_FORMAT_MPEG2
That's the sample format ad_spdif uses when the source is MP3.
2013-07-22 02:42:38 +02:00
Diogo Franco (Kovensky) dcf38e0190 ao_wasapi: Support S/PDIF passthrough
Entirely untested as this troper has no S/PDIF hardware.

Refuses trying any other format if we can't use passthrough, or we would
end up sending white noise at the user.
2013-07-22 02:42:38 +02:00
Diogo Franco (Kovensky) bcb398ddb4 DOCS/man/en/ao.rst: Update wasapi:device=<id> documentation 2013-07-22 02:42:38 +02:00
Diogo Franco (Kovensky) 58e3d3f207 ao_wasapi: Fix double free on uninit
Caused by incorrect conversion to the m_option API: since we don't allocate
the state ourselves, we also don't free it ourselves.
2013-07-22 02:42:38 +02:00
Diogo Franco (Kovensky) c62395dc09 ao_wasapi: Support loading devices by name
Do an strstr match against the device description and, if we have only
a single match, take it. This works as long as the devices in the system
don't change, but it's not supposed to be reliable; if one wants
reliability, one uses the device ID string.

Formatting.
2013-07-22 02:42:38 +02:00
Diogo Franco (Kovensky) ad6acddbcf ao_wasapi: Don't search for devices as part of validation
This could turn valid parameters into syntax errors by the mere presence
or abscence of a device (e.g. USB audio devices), so don't do that.

We do validate that, if the parameter is an integer, it is not negative.
We also respond to the "help" parameter, which does the same as the "list"
suboption but exits after listing.

Demote the validation logging to MSGL_DBG2.
2013-07-22 02:42:38 +02:00
Diogo Franco (Kovensky) d68fa0531f ao_wasapi: Change function macros to require semicolon after invocation
Add semicolons where they were missing.
2013-07-22 02:42:38 +02:00
Diogo Franco (Kovensky) 964341b02d ao_wasapi: Use OPT_STRING_VALIDATE for device suboption
Validates by trying to pick the device using the device enumerator and
aborting with out of range on failure.

Refactors find_and_load_device to not use the wasapi_state; it might be
called during validation. Adds missing CoInitialize/CoUninitialize calls.
Remove unused variables (the SAFE_RELEASE macros keep them referenced so
compiler warnings don't help finding them...).

Remove the IMMDeviceEnumerator from the wasapi_state, it's only needed
during initialization and initialization is now well factored enough to
get rid of it.

Try and connect to unplugged devices as well when using the device ID
string.
2013-07-22 02:42:38 +02:00
Diogo Franco (Kovensky) d42c3e51b4 ao_wasapi: Fully convert to m_option API 2013-07-22 02:42:38 +02:00
Diogo Franco (Kovensky) 56274c6664 ao_wasapi: Don't leak the default device's ID when listing devices
Also remove unused variable.
2013-07-22 02:42:38 +02:00
Diogo Franco (Kovensky) 32cb190855 ao_wasapi: Annotate the default device when listing devices 2013-07-22 02:42:38 +02:00
Diogo Franco (Kovensky) efc3668fbe ao_wasapi: Refactor device listing/loading
Omit "{0.0.0.00000000}." on devices that start with that substring,
re-add when searching for devices by ID.

Log the device ID of the default device.

Log the friendly name of the used device.

Consistently refer to endpoints/devices as devices, as this is more
consistent with mpv terminology.
2013-07-22 02:42:38 +02:00
Diogo Franco (Kovensky) d5adaed9d8 ao_wasapi0: Rename to ao_wasapi
Nobody knows what the 0 was for. There's no "WASAPI version 0". Just take
it out.
2013-07-22 02:42:38 +02:00
Diogo Franco (Kovensky) 553ed6b32f ao_wasapi0: Use the mix format directly in try_mix_format 2013-07-22 02:42:37 +02:00
Diogo Franco (Kovensky) d9a1358505 ao_wasapi0: Don't complain about failed init during AO probing
Only if the user specifically asked for ao_wasapi0.
2013-07-22 02:42:37 +02:00
Diogo Franco (Kovensky) 4cf1fc678f ao_wasapi0: Don't fail init when listing devices 2013-07-22 02:42:37 +02:00
Diogo Franco (Kovensky) 44f699da0d DOCS/man/en/ao.rst: Document ao_wasapi0 2013-07-22 02:42:37 +02:00
Diogo Franco (Kovensky) 0081f1facd ao_wasapi0: Demote "negotiation failed" message to MSGL_V
Could spam the console with what may be harmless in some cases. We already
complain loudly if we're stuck checking this too many times.
2013-07-22 02:42:37 +02:00
Diogo Franco (Kovensky) df1922babe ao_wasapi0: Support shared mode, better format guessing method
Uses WASAPI in shared mode by default, add :exclusive flag to choose
exclusive mode (duh). WASAPI works somewhat different in shared mode:
the OS suggests the sample format to use, and the GetBuffer call is
done slightly differently.

The shared mode driver does not consume audio as fast as it notifies
the thread; we need to check how much we're allowed to write. Not doing
this correctly results in spamming the console with
AUDCLNT_E_BUFFER_TOO_LARGE errors.

When guessing formats for exclusive mode, try several sample size and
sample rate combinations instead of just falling back to s16le@44100hz.
If none of the rates are accepted, tries remixing >6 channels to 5.1
channels. Failing that, tries remixing to stereo. Failing everything,
including the CD Red Book format, what else is left to test?

Calculate buffer_block_size based on the configured channels and bytes
per sample; MSDN docs say nBlockAlign is not guaranteed to be set for
anything but integer PCM formats.
2013-07-22 02:42:37 +02:00
Diogo Franco (Kovensky) f12e14849d ao_wasapi0: Support device enumeration and selection
Adds the :list suboption to ao_wasapi0, which enumerates the audio endpoints
in the system.

Adds the :device=<n> suboption, which either takes an ID string (as output by
list) or a device number and uses the requested device instead of the system
default.
2013-07-22 02:42:37 +02:00
wm4 b38e631ed2 vo_opengl: some option changes
Doing "mpv --vo=opengl:lscale=help" now lists possible scalers and
exits. The "backend" suboption behaves similar. Make the "stereo"
suboption a choice, instead of using magic integer values.
2013-07-22 02:14:15 +02:00
wm4 7bf1b9066c vo_direct3d: use new option API 2013-07-22 01:50:22 +02:00
wm4 1ff35c3a20 vo_opengl_old: use new option API 2013-07-22 01:50:22 +02:00
wm4 5e0ee41617 options: move --colorkey option to vo_xv 2013-07-22 01:50:22 +02:00
wm4 549ef68c62 vo_xv: use new option API 2013-07-22 01:50:16 +02:00
wm4 3fd7794d42 vo_direct3d: fix warning on MinGW
Commit 6ab2eeb attempted to fix it on Cygwin, but now it broke on MinGW
in turn. Don't think too hard about it and just remove the code. (vo.c
already prints the video rectangle anyway.)
2013-07-22 00:14:38 +02:00
wm4 15ab75c7a0 ao_dsound: use new option API 2013-07-22 00:11:06 +02:00
wm4 0c28dc6adc ao_jack: use new option API 2013-07-22 00:03:57 +02:00
wm4 ecc5cb67f8 ao_oss: switch to new option API 2013-07-21 23:52:40 +02:00
wm4 5b91ba0a8d options: remove --mixer and --mixer-channel, turn them into alsa/oss subopts
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.
2013-07-21 23:35:14 +02:00
wm4 5c610836cd ao_rsound: use new option API
Untested. I don't even know if this compiles. I have no clue what rsound
even is.
2013-07-21 23:27:32 +02:00
wm4 12e645fc24 ao_sdl: use new option API 2013-07-21 23:27:32 +02:00
wm4 73dc678c25 ao_openal: use new option API 2013-07-21 23:27:32 +02:00
wm4 ce89ba6d75 ao_pulse: use new option API
Untested, but should be fine.
2013-07-21 23:27:31 +02:00
wm4 3cdf4cf14d options: hide encoding AO/VO in help output
These can't be used manually. Encoding is enabled with -o instead, and
the encoding AO/VO is selected using internal mechanisms.
2013-07-21 23:27:31 +02:00
wm4 2111d7bc05 ao_alsa: use new option API (changes syntax)
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.
2013-07-21 23:27:31 +02:00
wm4 38f81c618e ao_pcm: use new option API 2013-07-21 23:27:31 +02:00
wm4 38f712d96d ao_portaudio: use new option API
This basically serves as example. All other AOs should be ported as
well.
2013-07-21 23:27:31 +02:00
wm4 7eba27c125 options: use new option code for --ao
This requires completely refactoring the AO creation code too.
2013-07-21 23:27:31 +02:00