Commit 17bab664 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

dmime: Fix index handling in segment GetParam().

parent 4649f2f1
...@@ -368,49 +368,36 @@ static HRESULT WINAPI IDirectMusicSegment8Impl_RemoveNotificationType(IDirectMus ...@@ -368,49 +368,36 @@ static HRESULT WINAPI IDirectMusicSegment8Impl_RemoveNotificationType(IDirectMus
return S_OK; return S_OK;
} }
static HRESULT WINAPI IDirectMusicSegment8Impl_GetParam(IDirectMusicSegment8 *iface, static HRESULT WINAPI IDirectMusicSegment8Impl_GetParam(IDirectMusicSegment8 *iface, REFGUID type,
REFGUID type, DWORD group, DWORD index, MUSIC_TIME time, MUSIC_TIME *next, DWORD group, DWORD index, MUSIC_TIME time, MUSIC_TIME *next, void *param)
void *param)
{ {
IDirectMusicSegment8Impl *This = impl_from_IDirectMusicSegment8(iface); IDirectMusicSegment8Impl *This = impl_from_IDirectMusicSegment8(iface);
struct list *item;
IDirectMusicTrack *track; IDirectMusicTrack *track;
DMUS_PRIVATE_SEGMENT_TRACK *segment; unsigned int i, count;
HRESULT hr; HRESULT hr = DMUS_E_TRACK_NOT_FOUND;
FIXME("(%p, %s, 0x%x, %d, %d, %p, %p) Semi-stub\n", This, debugstr_dmguid(type), group,
index, time, next, param);
if (index == DMUS_SEG_ANYTRACK || group == 0xffffffff) { TRACE("(%p, %s, %#x, %u, %d, %p, %p)\n", This, debugstr_dmguid(type), group, index, time,
if (group == 0xffffffff && index != DMUS_SEG_ANYTRACK) next, param);
WARN("Any group doesnt have DMUS_SEG_ANYTRACK index.\n");
LIST_FOR_EACH (item, &This->Tracks) { if (!type)
segment = LIST_ENTRY(item, DMUS_PRIVATE_SEGMENT_TRACK, entry); return E_POINTER;
TRACE(" - %p -> 0x%x,%p\n", segment, segment->dwGroupBits, segment->pTrack);
if (group != 0xffffffff && !(segment->dwGroupBits & group)) /* Index is relative to the search pattern: group bits and supported param type */
continue; for (i = 0, count = 0; i < DMUS_SEG_ANYTRACK && count <= index; i++) {
if (FAILED(IDirectMusicTrack_IsParamSupported(segment->pTrack, type))) if (FAILED(IDirectMusicSegment8Impl_GetTrack(iface, &GUID_NULL, group, i, &track)))
break;
if (FAILED(IDirectMusicTrack_IsParamSupported(track, type)))
continue; continue;
hr = IDirectMusicTrack_GetParam(segment->pTrack, type, time, next, param); if (index == count || index == DMUS_SEG_ANYTRACK)
hr = IDirectMusicTrack_GetParam(track, type, time, next, param);
IDirectMusicTrack_Release(track);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
return hr; return hr;
count++;
} }
WARN("(%p): not found\n", This); TRACE("(%p): not found\n", This);
return DMUS_E_TRACK_NOT_FOUND;
}
hr = IDirectMusicSegment8Impl_GetTrack(iface, &GUID_NULL, group, index, &track);
if (FAILED(hr)) {
ERR("(%p): not found\n", This);
return DMUS_E_TRACK_NOT_FOUND;
}
hr = IDirectMusicTrack_GetParam(track, type, time, next, param);
IDirectMusicTrack_Release(track);
return hr; return hr;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment