libout123 cannot be build on UWP with CMake
Brought to you by:
sobukus
win32 module is completely unusable (mmsystem.h if unsupported).
win32_wasapi partially supported, unusable:
1>D:\source\repos\libmpg123\src\libout123\modules\win32_wasapi.c(135,53): warning C4013: 'IMMDeviceEnumerator_GetDefaultAudioEndpoint' undefined; assuming extern returning int 1>D:\source\repos\libmpg123\src\libout123\modules\win32_wasapi.c(135,80): error C2065: 'eRender': undeclared identifier 1>D:\source\repos\libmpg123\src\libout123\modules\win32_wasapi.c(135,90): error C2065: 'eConsole': undeclared identifier 1>D:\source\repos\libmpg123\src\libout123\modules\win32_wasapi.c(140,35): warning C4013: 'IMMDeviceActivator_Activate' undefined; assuming extern returning int 1>D:\source\repos\libmpg123\src\libout123\modules\win32_wasapi.c(190,56): warning C4244: '=': conversion from 'DWORD' to 'WORD', possible loss of data 1>D:\source\repos\libmpg123\src\libout123\modules\win32_wasapi.c(191,48): warning C4244: '=': conversion from 'DWORD' to 'WORD', possible loss of data 1>D:\source\repos\libmpg123\src\libout123\modules\win32_wasapi.c(325,49): warning C4013: 'AvSetMmThreadCharacteristicsW' undefined; assuming extern returning int 1>D:\source\repos\libmpg123\src\libout123\modules\win32_wasapi.c(325,82): warning C4047: '=': 'HANDLE' differs in levels of indirection from 'int' 1>D:\source\repos\libmpg123\src\libout123\modules\win32_wasapi.c(397,12): warning C4267: 'function': conversion from 'size_t' to 'UINT32', possible loss of data 1>D:\source\repos\libmpg123\src\libout123\modules\win32_wasapi.c(442,12): warning C4267: 'function': conversion from 'size_t' to 'UINT32', possible loss of data 1>D:\source\repos\libmpg123\src\libout123\modules\win32_wasapi.c(450,12): warning C4267: 'function': conversion from 'size_t' to 'UINT32', possible loss of data 1>D:\source\repos\libmpg123\src\libout123\modules\win32_wasapi.c(460,1): warning C4244: 'initializing': conversion from 'double' to 'DWORD', possible loss of data 1>D:\source\repos\libmpg123\src\libout123\modules\win32_wasapi.c(504,51): warning C4013: 'AvRevertMmThreadCharacteristics' undefined; assuming extern returning int 1>D:\source\repos\libmpg123\src\libout123\modules\win32_wasapi.c(505,53): warning C4013: 'IMMDeviceEnumerator_Release' undefined; assuming extern returning int 1>D:\source\repos\libmpg123\src\libout123\modules\win32_wasapi.c(506,39): warning C4013: 'IMMDevice_Release' undefined; assuming extern returning int 1>D:\source\repos\libmpg123\src\libout123\modules\win32_wasapi.c(528,45): warning C4013: 'IMMDeviceEnumerator_EnumAudioEndpoints' undefined; assuming extern returning int 1>D:\source\repos\libmpg123\src\libout123\modules\win32_wasapi.c(528,66): error C2065: 'eRender': undeclared identifier 1>D:\source\repos\libmpg123\src\libout123\modules\win32_wasapi.c(528,87): error C2065: 'DEVICE_STATE_ACTIVE': undeclared identifier 1>D:\source\repos\libmpg123\src\libout123\modules\win32_wasapi.c(530,35): warning C4013: 'IMMDeviceCollection_GetCount' undefined; assuming extern returning int 1>D:\source\repos\libmpg123\src\libout123\modules\win32_wasapi.c(535,32): warning C4013: 'IMMDeviceCollection_Item' undefined; assuming extern returning int 1>D:\source\repos\libmpg123\src\libout123\modules\win32_wasapi.c(537,23): warning C4013: 'IMMDevice_GetId' undefined; assuming extern returning int 1>D:\source\repos\libmpg123\src\libout123\modules\win32_wasapi.c(539,35): warning C4013: 'IMMDevice_OpenPropertyStore' undefined; assuming extern returning int 1>D:\source\repos\libmpg123\src\libout123\modules\win32_wasapi.c(573,29): warning C4013: 'IMMDeviceCollection_Release' undefined; assuming extern returning int
I guess the only simple way is to introduce option to disable liboout123 target, and set it to OFF
for CMAKE_SYSTEM_NAME STREQUAL WindowsStore
.
Well, what would you use for audio output on UWP?
Without libout123, you will have to disable mpg123 itself. You could also just limit the output module to dummy. WAV writing would still work.
Otherwise, the build would be just for libmpg123 and libsyn123, wich might be enough for vcpkg purposes.
Yep. BTW The previous port, based on Visual Studio solution, only built libmpg123.
I know very little about UWP, sorry.
Can you prepare the change to disable the other stuff on UWP, then? We'd need someone with interest in that platform to actually port an audio output.
Here it is.
Forgot about that one, here is complete, working patch.
Not sure about two fixes in
sample.h
andresample.c
.They produce errors:
Is my fix correct?
Last fix.
The last. I swear.
Vcpkg port passes all build tests:
https://github.com/microsoft/vcpkg/pull/18403
Close. I tweaked the CMake changes to have the BUILD_LIBOUT123 flag also working on Unix.
The part about the numbers … that's a bit differend. I did the sample.h one like aleady present for the very same reason to the (-biggest_unsigned -1) trick. The one in resample.c I fixed like you in the patch. I probably should define the arguments to muloffdiv() as signed integers, but the internals of that one actually rely on unsigned wrap behaviour.
Care to verify that current trunk is still good for you?
Yes, i works: