segmentstate.c 5.97 KB
Newer Older
1 2
/* IDirectMusicSegmentState8 Implementation
 *
3
 * Copyright (C) 2003-2004 Rok Mandeljc
4
 *
5 6 7 8
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
9 10 11
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
14
 *
15 16 17
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 19 20
 */

#include "dmime_private.h"
21
#include "dmobject.h"
22

23
WINE_DEFAULT_DEBUG_CHANNEL(dmime);
24

25 26 27 28 29 30 31 32
typedef struct IDirectMusicSegmentState8Impl {
    IDirectMusicSegmentState8 IDirectMusicSegmentState8_iface;
    LONG ref;
} IDirectMusicSegmentState8Impl;

static inline IDirectMusicSegmentState8Impl *impl_from_IDirectMusicSegmentState8(IDirectMusicSegmentState8 *iface)
{
    return CONTAINING_RECORD(iface, IDirectMusicSegmentState8Impl, IDirectMusicSegmentState8_iface);
33 34
}

35 36 37 38 39
static HRESULT WINAPI DirectMusicSegmentState8_QueryInterface(IDirectMusicSegmentState8 *iface, REFIID riid, void **ppobj)
{
    IDirectMusicSegmentState8Impl *This = impl_from_IDirectMusicSegmentState8(iface);

    TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
40

41 42 43
    if (!ppobj)
        return E_POINTER;

44
    *ppobj = NULL;
45

46 47 48 49 50 51 52 53
    if (IsEqualIID(riid, &IID_IUnknown) ||
        IsEqualIID(riid, &IID_IDirectMusicSegmentState) ||
        IsEqualIID(riid, &IID_IDirectMusicSegmentState8))
    {
        IDirectMusicSegmentState8_AddRef(iface);
        *ppobj = &This->IDirectMusicSegmentState8_iface;
        return S_OK;
    }
54

55 56
    WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
    return E_NOINTERFACE;
57 58
}

59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
static ULONG WINAPI DirectMusicSegmentState8_AddRef(IDirectMusicSegmentState8 *iface)
{
    IDirectMusicSegmentState8Impl *This = impl_from_IDirectMusicSegmentState8(iface);
    ULONG ref = InterlockedIncrement(&This->ref);

    TRACE("(%p): %d\n", This, ref);

    DMIME_LockModule();

    return ref;
}

static ULONG WINAPI DirectMusicSegmentState8_Release(IDirectMusicSegmentState8 *iface)
{
    IDirectMusicSegmentState8Impl *This = impl_from_IDirectMusicSegmentState8(iface);
    ULONG ref = InterlockedDecrement(&This->ref);

    TRACE("(%p): %d\n", This, ref);

    if (ref == 0)
        HeapFree(GetProcessHeap(), 0, This);
80

81
    DMIME_UnlockModule();
82

83
    return ref;
84 85
}

86 87 88 89 90
static HRESULT WINAPI DirectMusicSegmentState8_GetRepeats(IDirectMusicSegmentState8 *iface,  DWORD* pdwRepeats)
{
    IDirectMusicSegmentState8Impl *This = impl_from_IDirectMusicSegmentState8(iface);
    FIXME("(%p, %p): stub\n", This, pdwRepeats);
    return S_OK;
91 92
}

93 94 95 96 97
static HRESULT WINAPI DirectMusicSegmentState8_GetSegment(IDirectMusicSegmentState8 *iface, IDirectMusicSegment** ppSegment)
{
    IDirectMusicSegmentState8Impl *This = impl_from_IDirectMusicSegmentState8(iface);
    FIXME("(%p, %p): stub\n", This, ppSegment);
    return S_OK;
98 99
}

100 101 102 103 104
static HRESULT WINAPI DirectMusicSegmentState8_GetStartTime(IDirectMusicSegmentState8 *iface, MUSIC_TIME* pmtStart)
{
    IDirectMusicSegmentState8Impl *This = impl_from_IDirectMusicSegmentState8(iface);
    FIXME("(%p, %p): stub\n", This, pmtStart);
    return S_OK;
105 106
}

107 108 109 110 111
static HRESULT WINAPI DirectMusicSegmentState8_GetSeek(IDirectMusicSegmentState8 *iface, MUSIC_TIME* pmtSeek)
{
    IDirectMusicSegmentState8Impl *This = impl_from_IDirectMusicSegmentState8(iface);
    FIXME("(%p, %p): stub\n", This, pmtSeek);
    return S_OK;
112 113
}

114 115 116 117 118
static HRESULT WINAPI DirectMusicSegmentState8_GetStartPoint(IDirectMusicSegmentState8 *iface, MUSIC_TIME* pmtStart)
{
    IDirectMusicSegmentState8Impl *This = impl_from_IDirectMusicSegmentState8(iface);
    FIXME("(%p, %p): stub\n", This, pmtStart);
    return S_OK;
119 120
}

121 122 123 124
static HRESULT WINAPI DirectMusicSegmentState8_SetTrackConfig(IDirectMusicSegmentState8 *iface, REFGUID rguidTrackClassID, DWORD dwGroupBits, DWORD dwIndex, DWORD dwFlagsOn, DWORD dwFlagsOff) {
    IDirectMusicSegmentState8Impl *This = impl_from_IDirectMusicSegmentState8(iface);
    FIXME("(%p, %s, %d, %d, %d, %d): stub\n", This, debugstr_dmguid(rguidTrackClassID), dwGroupBits, dwIndex, dwFlagsOn, dwFlagsOff);
    return S_OK;
125 126
}

127 128 129 130
static HRESULT WINAPI DirectMusicSegmentState8_GetObjectInPath(IDirectMusicSegmentState8 *iface, DWORD dwPChannel, DWORD dwStage, DWORD dwBuffer, REFGUID guidObject, DWORD dwIndex, REFGUID iidInterface, void** ppObject) {
    IDirectMusicSegmentState8Impl *This = impl_from_IDirectMusicSegmentState8(iface);
    FIXME("(%p, %d, %d, %d, %s, %d, %s, %p): stub\n", This, dwPChannel, dwStage, dwBuffer, debugstr_dmguid(guidObject), dwIndex, debugstr_dmguid(iidInterface), ppObject);
    return S_OK;
131 132
}

133 134 135 136 137 138 139 140 141 142 143
static const IDirectMusicSegmentState8Vtbl DirectMusicSegmentState8Vtbl = {
    DirectMusicSegmentState8_QueryInterface,
    DirectMusicSegmentState8_AddRef,
    DirectMusicSegmentState8_Release,
    DirectMusicSegmentState8_GetRepeats,
    DirectMusicSegmentState8_GetSegment,
    DirectMusicSegmentState8_GetStartTime,
    DirectMusicSegmentState8_GetSeek,
    DirectMusicSegmentState8_GetStartPoint,
    DirectMusicSegmentState8_SetTrackConfig,
    DirectMusicSegmentState8_GetObjectInPath
144 145 146
};

/* for ClassFactory */
147
HRESULT WINAPI create_dmsegmentstate(REFIID riid, void **ret_iface)
148
{
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
    IDirectMusicSegmentState8Impl* obj;
    HRESULT hr;

    *ret_iface = NULL;

    obj = HeapAlloc (GetProcessHeap(), 0, sizeof(IDirectMusicSegmentState8Impl));
    if (!obj)
        return E_OUTOFMEMORY;

    obj->IDirectMusicSegmentState8_iface.lpVtbl = &DirectMusicSegmentState8Vtbl;
    obj->ref = 1;

    hr = IDirectMusicSegmentState8_QueryInterface(&obj->IDirectMusicSegmentState8_iface, riid, ret_iface);
    IDirectMusicSegmentState8_Release(&obj->IDirectMusicSegmentState8_iface);
    return hr;
164
}