mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 10:31:43 +00:00
[AUDIO] Implement retreiving audio playback position (#6817)
Implement GetWavePosition API for both Legacy and MMixer modes. [WDMAUD.DRV] - Fix wrong I/O control code passed to DeviceIoControl for Legacy mode. Use IOCTL_GETPOS instead of IOCTL_OPEN_WDMAUD, to use the correct routine. - Implement WdmAudGetWavePosition for MMixer mode, as it was completely unimplemented there. Call an appropiate MMixer routine and return back resulting wave position. [WDMAUD] - Implement WdmAudGetPostion routine, which is used by Legacy mode, and call the same MMixer routine from it too. - Handle it in IOCTL_GETPOS I/O control request of dispatch routine. [MMIXER] - Implement MMixerGetWavePosition internal routine, which is called by both Legacy and MMixer modes, and does the actual work of retrieving playback position. - Call an apporpriate KSPROPERTY_AUDIO_POSITION property from it, and return in the output resulting KSAUDIO_POSITION.PlayOffset member, which contains the current playback position offset, to be returned to the caller. This fixes a failure retreiving the current audio playback position snd subsequent playing the audio data by several 3rd-party applications which are using this API (for example, some Gecko based browsers by @roytam1: Basilisk (Serpent) 52.9.0 IA-32 build, NewMoon 28.10.7 IA-32 build and KMeleon 76.5.3 Goanna engine). CORE-19542
This commit is contained in:
parent
9b563d32d2
commit
d1b8feb690
7 changed files with 97 additions and 2 deletions
|
@ -207,6 +207,12 @@ MMixerOpenWave(
|
|||
IN PVOID Context,
|
||||
OUT PHANDLE PinHandle);
|
||||
|
||||
MIXER_STATUS
|
||||
MMixerGetWavePosition(
|
||||
_In_ PMIXER_CONTEXT MixerContext,
|
||||
_In_ HANDLE PinHandle,
|
||||
_Out_ PDWORD Position);
|
||||
|
||||
MIXER_STATUS
|
||||
MMixerSetWaveStatus(
|
||||
IN PMIXER_CONTEXT MixerContext,
|
||||
|
|
|
@ -614,6 +614,40 @@ MMixerGetWaveOutCount(
|
|||
return MixerList->WaveOutListCount;
|
||||
}
|
||||
|
||||
MIXER_STATUS
|
||||
MMixerGetWavePosition(
|
||||
_In_ PMIXER_CONTEXT MixerContext,
|
||||
_In_ HANDLE PinHandle,
|
||||
_Out_ PDWORD Position)
|
||||
{
|
||||
KSAUDIO_POSITION AudioPosition;
|
||||
KSPROPERTY Property;
|
||||
MIXER_STATUS Status;
|
||||
ULONG Length;
|
||||
|
||||
/* Validate mixer context */
|
||||
Status = MMixerVerifyContext(MixerContext);
|
||||
|
||||
if (Status != MM_STATUS_SUCCESS)
|
||||
return Status;
|
||||
|
||||
Property.Id = KSPROPERTY_AUDIO_POSITION;
|
||||
Property.Set = KSPROPSETID_Audio;
|
||||
Property.Flags = KSPROPERTY_TYPE_GET;
|
||||
|
||||
Status = MixerContext->Control(PinHandle, IOCTL_KS_PROPERTY,
|
||||
&Property, sizeof(Property),
|
||||
&AudioPosition, sizeof(AudioPosition),
|
||||
&Length);
|
||||
if (Status == MM_STATUS_SUCCESS)
|
||||
{
|
||||
/* store audio position */
|
||||
*Position = (DWORD)AudioPosition.PlayOffset;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
MIXER_STATUS
|
||||
MMixerSetWaveStatus(
|
||||
IN PMIXER_CONTEXT MixerContext,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue