' ########################################################################################
' Microsoft Windows
' File: MMStream.inc
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_mmstream_PBI)
#DEFINE PBX_mmstream_PBI
%EQUATE `MMSTREAN_INC = 1
'#define MS_ERROR_CODE(x) MAKE_HRESULT(1, FACILITY_ITF, (x) + 0x400)
'#define MS_SUCCESS_CODE(x) MAKE_HRESULT(0, FACILITY_ITF, x)
%EQUATE `MS_S_PENDING = &H00040001& ' MS_SUCCESS_CODE(1)
%EQUATE `MS_S_NOUPDATE = &H00040002& ' MS_SUCCESS_CODE(2)
%EQUATE `MS_S_ENDOFSTREAM = &H00040003& ' MS_SUCCESS_CODE(3)
%EQUATE `MS_E_SAMPLEALLOC = &H80040401& ' MS_ERROR_CODE(1)
%EQUATE `MS_E_PURPOSEID = &H80040402& ' MS_ERROR_CODE(2)
%EQUATE `MS_E_NOSTREAM = &H80040403& ' MS_ERROR_CODE(3)
%EQUATE `MS_E_NOSEEKING = &H80040404& ' MS_ERROR_CODE(4)
%EQUATE `MS_E_INCOMPATIBLE = &H80040405& ' MS_ERROR_CODE(5)
%EQUATE `MS_E_BUSY = &H80040406& ' MS_ERROR_CODE(6)
%EQUATE `MS_E_NOTINIT = &H80040407& ' MS_ERROR_CODE(7)
%EQUATE `MS_E_SOURCEALREADYDEFINED = &H80040408& ' MS_ERROR_CODE(8)
%EQUATE `MS_E_INVALIDSTREAMTYPE = &H80040409& ' MS_ERROR_CODE(9)
%EQUATE `MS_E_NOTRUNNING = &H8004040A& ' MS_ERROR_CODE(10)
$MSPID_PrimaryVideo = GUID$("{A35FF56A-9FDA-11D0-8FDF-00C04FD9189D}")
$MSPID_PrimaryAudio = GUID$("{A35FF56B-9FDA-11D0-8FDF-00C04FD9189D}")
'#if(_WIN32_WINNT < 0x0400)
'typedef void ( __stdcall *PAPCFUNC )(
' DWORD_PTR dwParam);
'#endif
'typedef LONGLONG STREAM_TIME;
'typedef GUID MSPID;
'typedef REFGUID REFMSPID;
'MACRO STREAM_TIME = QUAD
'MACRO MSPID = GUID
'MACRO REFMSPID = GUID
' STREAM_TYPE enum
MACRO STREAM_TYPE_ENUM = LONG
%EQUATE `STREAMTYPE_READ = 0
%EQUATE `STREAMTYPE_WRITE = 1
%EQUATE `STREAMTYPE_TRANSFORM = 2
' STREAM_STATE enum
MACRO STREAM_STATE_ENUM = LONG
%EQUATE `STREAMSTATE_STOP = 0
%EQUATE `STREAMSTATE_RUN = 1
' COMPLETION_STATUS_FLAGS enum
MACRO COMPLETION_STATUS_FLAGS_ENUM = DWORD
%EQUATE `COMPSTAT_NOUPDATEOK = &H1
%EQUATE `COMPSTAT_WAIT = &H2
%EQUATE `COMPSTAT_ABORT = &H4
'enum __MIDL___MIDL_itf_mmstream_0000_0004
%EQUATE `MMSSF_HASCLOCK = &H1
%EQUATE `MMSSF_SUPPORTSEEK = &H2
%EQUATE `MMSSF_ASYNCHRONOUS = &H4
'enum __MIDL___MIDL_itf_mmstream_0000_0005
%EQUATE `SSUPDATE_ASYNC = &H1
%EQUATE `SSUPDATE_CONTINUOUS = &H2
' ########################################################################################
' Interface name = IMultiMediaStream
' IID = {B502D1BC-9A57-11d0-8FDE-00C04FD9189D}
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IMultiMediaStream_INTERFACE_DEFINED)
 %IMultiMediaStream_INTERFACE_DEFINED = 1
$IID_IMultiMediaStream = GUID$("{B502D1BC-9A57-11d0-8FDE-00C04FD9189D}")
INTERFACE IMultiMediaStream $IID_IMultiMediaStream
 INHERIT IUnknown
 ' =====================================================================================
 METHOD GetInformation ( ' VTable offset = 12
 BYREF pdwFlags AS DWORD
 , BYREF pStreamType AS STREAM_TYPE_ENUM
 ) AS LONG
 ' =====================================================================================
 METHOD GetMediaStream ( ' VTable offset = 16
 BYREF idPurpose AS GUID
 , BYREF ppMediaStream AS IMediaStream
 ) AS LONG
 ' =====================================================================================
 METHOD EnumMediaStreams ( ' VTable offset = 20
 BYVAL Index AS LONG
 , BYREF ppMediaStream AS IMediaStream
 ) AS LONG
 ' =====================================================================================
 METHOD GetState ( ' VTable offset = 24
 BYREF pCurrentState AS STREAM_STATE_ENUM
 ) AS LONG
 ' =====================================================================================
 METHOD SetState ( ' VTable offset = 28
 BYVAL NewState AS STREAM_STATE_ENUM
 ) AS LONG
 ' =====================================================================================
 METHOD GetTime ( ' VTable offset = 32
 BYREF pCurrentTime AS QUAD
 ) AS LONG
 ' =====================================================================================
 METHOD GetDuration ( ' VTable offset = 36
 BYREF pDuration AS QUAD
 ) AS LONG
 ' =====================================================================================
 METHOD Seek ( ' VTable offset = 40
 BYVAL SeekTime AS QUAD
 ) AS LONG
 ' =====================================================================================
 METHOD GetEndOfStreamEventHandle ( ' VTable offset = 44
 BYREF phEOS AS DWORD
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IMultiMediaStream_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IMediaStream
' IID = {B502D1BD-9A57-11D0-8FDE-00C04FD9189D}
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IMediaStream_INTERFACE_DEFINED)
 %IMediaStream_INTERFACE_DEFINED = 1
$IID_IMediaStream = GUID$("{B502D1BD-9A57-11D0-8FDE-00C04FD9189D}")
INTERFACE IMediaStream $IID_IMediaStream
 INHERIT IUnknown
 ' =====================================================================================
 METHOD GetMultiMediaStream ( ' VTable offset = 12
 BYREF ppMultiMediaStream AS IMultiMediaStream
 ) AS LONG
 ' =====================================================================================
 METHOD GetInformation ( ' VTable offset = 16
 BYREF pPurposeId AS GUID
 , BYREF pType AS STREAM_TYPE_ENUM
 ) AS LONG
 ' =====================================================================================
 METHOD SetSameFormat ( ' VTable offset = 20
 BYVAL pStreamThatHasDesiredFormat AS IMediaStream
 , BYVAL dwFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD AllocateSample ( ' VTable offset = 24
 BYVAL dwFlags AS DWORD
 , BYREF ppSample AS IStreamSample
 ) AS LONG
 ' =====================================================================================
 METHOD CreateSharedSample ( ' VTable offset = 28
 BYVAL pExistingSample AS IStreamSample
 , BYVAL dwFlags AS DWORD
 , BYREF ppNewSample AS IStreamSample
 ) AS LONG
 ' =====================================================================================
 METHOD SendEndOfStream ( ' VTable offset = 32
 BYVAL dwFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IMediaStream_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IStreamSample
' IID = {B502D1BE-9A57-11D0-8FDE-00C04FD9189D}
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IStreamSample_INTERFACE_DEFINED)
 %IStreamSample_INTERFACE_DEFINED = 1
$IID_IStreamSample = GUID$("{B502D1BE-9A57-11D0-8FDE-00C04FD9189D}")
INTERFACE IStreamSample $IID_IStreamSample
 INHERIT IUnknown
 ' =====================================================================================
 METHOD GetMediaStream ( ' VTable offset = 12
 BYREF ppMediaStream AS IMediaStream
 ) AS LONG
 ' =====================================================================================
 METHOD GetSampleTimes ( ' VTable offset = 16
 BYREF pStartTime AS QUAD
 , BYREF pEndTime AS QUAD
 , BYREF pCurrentTime AS QUAD
 ) AS LONG
 ' =====================================================================================
 METHOD SetSampleTimes ( ' VTable offset = 20
 BYVAL pStartTime AS QUAD
 , BYVAL pEndTime AS QUAD
 ) AS LONG
 ' =====================================================================================
 METHOD Update ( ' VTable offset = 24
 BYVAL dwFlags AS DWORD
 , BYVAL hEvent AS DWORD
 , BYVAL pfnAPC AS DWORD
 , BYVAL dwAPCData AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD CompletionStatus ( ' VTable offset = 28
 BYVAL dwFlags AS DWORD
 , BYVAL dwMilliseconds AS DWORD
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IStreamSample_INTERFACE_DEFINED__ */
#ENDIF
