ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

clock.c
Go to the documentation of this file.
00001 /* IReferenceClock Implementation
00002  *
00003  * Copyright (C) 2003-2004 Rok Mandeljc
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2.1 of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00018  */
00019 
00020 #include "dmusic_private.h"
00021 
00022 WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
00023 
00024 /* IReferenceClockImpl IUnknown part: */
00025 static HRESULT WINAPI IReferenceClockImpl_QueryInterface (IReferenceClock *iface, REFIID riid, LPVOID *ppobj) {
00026     IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
00027     TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
00028 
00029     if (IsEqualIID (riid, &IID_IUnknown) || 
00030         IsEqualIID (riid, &IID_IReferenceClock)) {
00031         IUnknown_AddRef(iface);
00032         *ppobj = This;
00033         return S_OK;
00034     }
00035     WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
00036     return E_NOINTERFACE;
00037 }
00038 
00039 static ULONG WINAPI IReferenceClockImpl_AddRef (IReferenceClock *iface) {
00040     IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
00041     ULONG refCount = InterlockedIncrement(&This->ref);
00042 
00043     TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
00044 
00045     DMUSIC_LockModule();
00046 
00047     return refCount;
00048 }
00049 
00050 static ULONG WINAPI IReferenceClockImpl_Release (IReferenceClock *iface) {
00051     IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
00052     ULONG refCount = InterlockedDecrement(&This->ref);
00053 
00054     TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
00055 
00056     if (!refCount) {
00057         HeapFree(GetProcessHeap(), 0, This);
00058     }
00059 
00060     DMUSIC_UnlockModule();
00061 
00062     return refCount;
00063 }
00064 
00065 /* IReferenceClockImpl IReferenceClock part: */
00066 static HRESULT WINAPI IReferenceClockImpl_GetTime (IReferenceClock *iface, REFERENCE_TIME* pTime) {
00067     IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
00068     TRACE("(%p, %p)\n", This, pTime);
00069     *pTime = This->rtTime;
00070     return S_OK;
00071 }
00072 
00073 static HRESULT WINAPI IReferenceClockImpl_AdviseTime (IReferenceClock *iface, REFERENCE_TIME baseTime, REFERENCE_TIME streamTime, HANDLE hEvent, DWORD* pdwAdviseCookie) {
00074     IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
00075     FIXME("(%p, 0x%s, 0x%s, %p, %p): stub\n", This, wine_dbgstr_longlong(baseTime), wine_dbgstr_longlong(streamTime), hEvent, pdwAdviseCookie);
00076     return S_OK;
00077 }
00078 
00079 static HRESULT WINAPI IReferenceClockImpl_AdvisePeriodic (IReferenceClock *iface, REFERENCE_TIME startTime, REFERENCE_TIME periodTime, HANDLE hSemaphore, DWORD* pdwAdviseCookie) {
00080     IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
00081     FIXME("(%p, 0x%s, 0x%s, %p, %p): stub\n", This, wine_dbgstr_longlong(startTime), wine_dbgstr_longlong(periodTime), hSemaphore, pdwAdviseCookie);
00082     return S_OK;
00083 }
00084 
00085 static HRESULT WINAPI IReferenceClockImpl_Unadvise (IReferenceClock *iface, DWORD dwAdviseCookie) {
00086     IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
00087     FIXME("(%p, %d): stub\n", This, dwAdviseCookie);
00088     return S_OK;
00089 }
00090 
00091 static const IReferenceClockVtbl ReferenceClock_Vtbl = {
00092     IReferenceClockImpl_QueryInterface,
00093     IReferenceClockImpl_AddRef,
00094     IReferenceClockImpl_Release,
00095     IReferenceClockImpl_GetTime,
00096     IReferenceClockImpl_AdviseTime,
00097     IReferenceClockImpl_AdvisePeriodic,
00098     IReferenceClockImpl_Unadvise
00099 };
00100 
00101 /* for ClassFactory */
00102 HRESULT WINAPI DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
00103     IReferenceClockImpl* clock;
00104 
00105     clock = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IReferenceClockImpl));
00106     if (NULL == clock) {
00107         *ppobj = NULL;
00108         return E_OUTOFMEMORY;
00109     }
00110     clock->lpVtbl = &ReferenceClock_Vtbl;
00111     clock->ref = 0; /* will be inited by QueryInterface */
00112     clock->rtTime = 0;
00113     clock->pClockInfo.dwSize = sizeof (DMUS_CLOCKINFO);
00114         
00115     return IReferenceClockImpl_QueryInterface ((IReferenceClock *)clock, lpcGUID, ppobj);
00116 }

Generated on Sun May 27 2012 04:21:01 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.