aboutsummaryrefslogtreecommitdiffhomepage
path: root/audio/out/ao_wasapi_utils.c
Commit message (Collapse)AuthorAge
...
* ao_wasapi: move volume control init to it's own functionGravatar Kevin Mitchell2015-12-21
| | | | also make failure non-fatal
* ao_wasapi: correctly handle audio session display failureGravatar Kevin Mitchell2015-12-21
| | | | | In particular, try and release/null the interface so that it won't be marshalled.
* ao_wasapi: non-fatal error handling for COM marshallingGravatar Kevin Mitchell2015-12-21
| | | | | Also make sure that CoReleaseMarshalData is called if errors occur before unmarshalling.
* ao_wasapi: wrap long lines and use only c99 comment styleGravatar Kevin Mitchell2015-12-21
| | | | | also remove a log message in AOCONTROL_UPDATE_STREAM_TITLE since none of the other controls have one.
* ao_wasapi: remove useless buffer_block_sizeGravatar Kevin Mitchell2015-12-21
| | | | this was only ever used for a verbose message
* ao_wasapi: call the class-specific release functionsGravatar Kevin Mitchell2015-12-20
| | | | | IUnknown_Release() might be alright, but stay on the safe side.
* ao_wasapi: actually use hw volume support information for exclusive modeGravatar Kevin Mitchell2015-12-20
| | | | | | | | | Do not try and set/get master volume in exclusive if there is no hardware support. This would just uselessly change the master slider, but have no effect on the actual volume. Furthermore if getting hardware volume support information fails, then assume it has none.
* ao_wasapi: remove volume "restore" on exitGravatar Kevin Mitchell2015-12-20
| | | | | | It was complicated and not even very intuitive to the user. If you are controlling the master volume, you just have to be prepared to deal with the consequences.
* ao_wasapi: add E_NOINTERFACE to error listGravatar Kevin Mitchell2015-12-20
| | | | this is encountered trying to set up COM proxies in wine
* ao_wasapi: get rid of Vistablob hackGravatar Kevin Mitchell2015-11-24
| | | | | This was required to work around XP linking issues and is no longer required.
* ao_wasapi: work around DTS passthrough failureGravatar wm42015-11-19
| | | | | | | | | | Apparently, some audio drivers do not support the DTS subtype, but passthrough works anyway if the AC3 subtype is set. Just retry with AC3 if the proper format doesn't work. The audio device which exposed this behavior reported itself as "M601d-A3/A3R (Intel(R) Display Audio)". xbmc/kodi even always passes DTS as AC3.
* audio: always log channel maps before determining final mapGravatar wm42015-10-26
| | | | | Until now, this was done only in debug verbosity, while some AOs logged equivalent information in verbose mode. Clean this up.
* win32: revert wchar_t changesGravatar wm42015-08-01
| | | | | | | | | | | Revert "win32: more wchar_t -> WCHAR replacements" Revert "win32: replace wchar_t with WCHAR" Doing a "partial" port of this makes no sense anymore from my perspective. Revert the changes, as they're confusing without context, maintenance, and progress. These changes were a bit premature anyway, and might actually cause other issues (locale neutrality etc. as it was pointed out).
* win32: more wchar_t -> WCHAR replacementsGravatar wm42015-07-30
| | | | | | | | | | | | | This was essentially missing from commit 0b52ac8a. Since L"..." string literals have the type wchar_t[], we can't use them for UTF-16 strings. Use C11 u"..." string literals instead. These have the type char16_t[], but we simply assume char16_t is the same underlying type as WCHAR. In practice, they're both unsigned short. For this reason use -std=c11 on Windows. Since Windows is a "special" environment (we require either MinGW or Cygwin), we don't need to worry too much about compiler compatibility.
* win32: replace wchar_t with WCHARGravatar wm42015-07-29
| | | | | | | | | | | | | WCHAR is more portable. While at least MinGW, Cygwin, and MSVC actually use 16 bit wchar_t, Midipix will have 32 bit wchar_t. In that context, using WCHAR instead is more portable. This affects only non-MinGW parts, so not all uses of wchar_t need to be changed. For example, terminal-win.c won't be used on Midipix at all. (Most of io.c won't either, so the search & replace here is more than necessary, but also not harmful.) (Midipix is not useable yet, so this is just preparation.)
* ao_wasapi: fix regressionGravatar wm42015-06-27
| | | | This probably fixes the regression introduced with commit 6147bcce.
* audio: fix format function consistency issuesGravatar wm42015-06-26
| | | | | | | | | | | Replace all the check macros with function calls. Give them all the same case and naming schema. Drop af_fmt2bits(). Only af_fmt2bps() survives as af_fmt_to_bytes(). Introduce af_fmt_is_pcm(), and use it in situations that used !AF_FORMAT_IS_SPECIAL. Nobody really knew what a "special" format was. It simply meant "not PCM".
* ao/wasapi: use atomic state variable instead of different eventsGravatar Kevin Mitchell2015-04-04
| | | | | | | | | Unfortunately, because we have proxy objects (pAudioVolumeProxy, pEndpointVolumeProxy, pSessionControlProxy) it looks like we still have to use MsgWaitForMultipleObjects and watch for and dispatch pending messages: https://msdn.microsoft.com/en-us/library/windows/desktop/ms680112%28v=vs.85%29.aspx
* ao_wasapi: code formatting and alignmentGravatar Kevin Mitchell2015-04-03
|
* audio: make all format query shortcuts macrosGravatar Kevin Mitchell2015-04-03
| | | | | af_fmt_is_float and af_fmt_is_planar were previously inconsistent with AF_FORAMT_IS_SPECIAL/AF_FORMAT_IS_IEC61937
* ao_wasapi: passthrough reworkGravatar Kevin Mitchell2015-04-03
| | | | | | | | | | | | | | | * unify passthrough and pcm exclusive mode format setting/testing * set passthrough format parameters correctly * support all of mpv's existing passthrough formats * automatically test passthrough with exclusive mode and enable exclusive if it succeeds, even if it was not explictly requested. this obviates the need for --ao=wasapi,wasapi=exclusive * if passthrough fails (such as the device doesn't support the format), fallback to either exclusive pcm or shared mode depending on what the user specified. Right now this isn't very useful as it still fails due to the decoder path remainin stuck on spdif. fixes #1742
* ao_wasapi: abstract HRESULT_to_strGravatar Kevin Mitchell2015-04-01
|
* ao_wasapi: remove redundant castsGravatar Kevin Mitchell2015-03-31
|
* ao_wasapi: simplify hotplugGravatar Kevin Mitchell2015-03-31
| | | | | | | | | Take advantage of the fact that list_devs is called with a hotplug_inited ao. Also eliminate unnecessary nested function abstraction of hotplug_(un)init and list_devs. However, keep list_devs in ao_wasapi_utils.c since it uses the private functions get_device_id, get_device_name and exposing these would require including headers for IMMDevice in ao_wasapi_utils.h.
* ao_wasapi: fix device listingGravatar Kevin Mitchell2015-03-31
| | | | | remove depricated and convoluted validation. refer instead to the --audio-device option.
* ao/wasapi: add ao hotplugGravatar Kevin Mitchell2015-03-31
| | | | | | | Create a second copy of the change_notify structure for the hotplug ao. change_notify->is_hotplug distinguishes the hotplug version from the regular one monitoring the currently playing ao. Also make the change notification less verbose now that there might be two of them around.
* ao/wasapi: use built in KSDATAFORMATsGravatar Kevin Mitchell2015-03-27
| | | | | Rather than defining them ourselves. Thanks to rossy for figuring out the headers.
* ao/wasapi: add missing "if" bracesGravatar Kevin Mitchell2015-03-26
|
* ao/wasapi: rewrite format searchGravatar Kevin Mitchell2015-03-26
| | | | | | | More clearly separate the exclusive and shared mode format discovery. Make the exclusive mode search more systematic in particular about channel maps (i.e., use chmap_sel). Assume that the same sample format / sample rates work for all channels to narrow the search space.
* ao/wasapi: move resume to audio threadGravatar Kevin Mitchell2015-02-23
| | | | | | | | | | | | | | This echanges the two events hForceFeed/hFeedDone for hResume. This like the last commit makes things more deterministic. Importantly, the forcefeed is only done if there is not already a full buffer yet to be played by the device. This should fix some of the problems with exclusive mode. This commit also removes the necessity to have a proxy to the AudioClient object in the main thread. fixes #1529
* ao_wasapi: fix try_format logic in shared modeGravatar James Ross-Gowan2015-01-23
| | | | | | | | | | | | | | | | | The MSDN documentation for IsFormatSupported says a return code of AUDCLNT_E_UNSUPPORTED_FORMAT means the function "succeeded but the specified format is not supported in exclusive mode." This seems to imply that the format is supported in shared mode, and that's what the old code assumed, however try_format would incorrectly return success with some drivers. The remarks section of the documentation contradicts that assumption. It says that in shared mode, if the audio engine does not support the caller-specified format or any similar format, ppClosestMatch is set to NULL and the function returns AUDCLNT_E_UNSUPPORTED_FORMAT. This is the same as in exclusive mode, so treat AUDCLNT_E_UNSUPPORTED_FORMAT the same regardless of opt_exclusive. In shared mode, the format selection code will fall back to the mix format, which should always be supported.
* win32: request UTF-16 API variants, Vista+ APIs, and COM C macrosGravatar wm42015-01-07
| | | | | Put the Vista+ (_WIN32_WINNT) and the COM C (COBJMACROS) defines into the build system, instead of defining them over and over in the code.
* ao/wasapi: style/code formatting tweaksGravatar Kevin Mitchell2015-01-02
|
* ao/wasapi: improve exclusive mode format searchGravatar Kevin Mitchell2015-01-02
| | | | fixes #1376
* ao/wasapi: revamp set_waveformatexGravatar Kevin Mitchell2015-01-02
| | | | | | | | * bits instead of bytes * add valid_bits argument * just pass in the mp_chmap and get the number and wavext channel map from that * indicate valid bits in waveformat_to_str * make appropriate accomodations in try_format
* ao/wasapi: add CO_E_NOTINITIALIZED to explain_errGravatar Kevin Mitchell2015-01-02
| | | | someone on irc reported seeing this error
* ao/wasapi: use IsEqualGUID and IsEqualPropertyKeyGravatar Kevin Mitchell2014-12-16
| | | | before we were reinventing this wheel
* ao/wasapi: set the ao with the waveformat channelmapGravatar Kevin Mitchell2014-12-15
| | | | hopefully this fixes #1350
* ao/wasapi: make set_ao_format EX/EXTENSIBLE agnosticGravatar Kevin Mitchell2014-12-01
| | | | | | | | | There is no guarantee that closestMatch returned by IsFormatSupported is actually a WAVEFORMATEXTENSIBLE. http://msdn.microsoft.com/en-us/library/windows/desktop/dd370876%28v=vs.85%29.aspx We should therefore not blindly treat it as such.
* ao/wasapi: fix set_ao_formatGravatar Kevin Mitchell2014-12-01
| | | | | | | | | | | Before it used whatever was in ao->format and changed the bits even though this might have nothing to do with the actual WAVEFORMAT negotiated with WASAPI. For example, if the initial ao->format was a float and we had set the WAVEFORMAT to s24, this would create a non-existent float24 format. Worse, it might put an u16 into ao->format when WAVEFORMAT described s16. WASAPI doesn't support unsigned at all as far as I can tell.
* ao/wasapi: show actual waveformat triedGravatar Kevin Mitchell2014-12-01
| | | | also remove bogus ao_format
* ao/wasapi: don't assume 32-bits == floatGravatar Kevin Mitchell2014-12-01
| | | | | | | | | | This was based on old WAVEFORMATEX restrictions http://msdn.microsoft.com/en-us/library/windows/hardware/ff538799%28v=vs.85%29.aspx With the new WAVEFORMATEXTENSIBLE, this is no longer a problem. and we can have s32 or float32 so we need to actually check / set these correctly. fixes #1287
* ao/wasapi: make sure that < 16-bit pcm never happensGravatar Kevin Mitchell2014-12-01
| | | | it just sucks. noone should have to listen to that.
* ao/wasapi: get rid of WAVEFMT unionGravatar Kevin Mitchell2014-12-01
| | | | | It only confused the issue. Replace it's functionality with waveformat_copy function where needed.
* ao/wasapi: handle VistaBlob failure more gracefullyGravatar Kevin Mitchell2014-11-28
|
* ao/wasapi: more consistent/reliable method of computing extra ↵Gravatar Kevin Mitchell2014-11-28
| | | | WAVEFORMATEXTENSIBLE size
* ao/wasapi: make functions return bool that were acting like itGravatar Kevin Mitchell2014-11-28
| | | | | | | this involved inverting the logic of find_formats, enumerate_devies and wasapi_fill_VistaBlob. The latter two were trivial as their return values were not actually checked (to be fixed in a later commit).
* ao/wasapi: check full GUID of KSDATAFORMAT to determine floatGravatar Kevin Mitchell2014-11-28
|
* ao/wasapi: expose GUID and PKEY convenience functionsGravatar Kevin Mitchell2014-11-28
| | | | Give them the prefix mp_ and make them nonstatic.
* ao/wasapi: remove unused variableGravatar Kevin Mitchell2014-11-28
|