' ########################################################################################
' Microsoft Windows
' File: wmspacket.inc
' Contents: Microsoft Windows Media Technologies
' 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_wmspacket_PBI)
#DEFINE PBX_wmspacket_PBI
%EQUATE `WMSPACKET_INC = 1
'/* header files for imported files */
#INCLUDE ONCE "Legacy/COM/ObjIdl.inc"
#INCLUDE ONCE "Legacy/Media/wmsbuffer.inc"
#INCLUDE ONCE "Legacy/Media/wmscontext.inc"
$IID_IWMSPacket = GUID$("{3309C901-10A4-11D2-9EEE-006097D2D7CF}")
$IID_IWMSPacketList = GUID$("{3309C902-10A4-11D2-9EEE-006097D2D7CF}")
$IID_IWMSPacketParser = GUID$("{8B59F7E1-5411-11D2-9EFF-006097D2D7CF}")
$IID_IWMSPacketListCallback = GUID$("{49C2A6F1-64B8-11D2-9F0E-006097D2D7CF}")
$IID_IWMSStreamSignalHandler = GUID$("{7B10F261-26AA-11D2-9EF2-006097D2D7CF}")
' WMS_PACKET_ATTRIBUTES enum
%EQUATE `WMS_PACKET_PACKET_NUM = 0
%EQUATE `WMS_PACKET_NUM_BUFFERS = %WMS_PACKET_PACKET_NUM + 1
%EQUATE `WMS_PACKET_LENGTH = %WMS_PACKET_NUM_BUFFERS + 1
%EQUATE `WMS_PACKET_SEND_TIME_HI = %WMS_PACKET_LENGTH + 1
%EQUATE `WMS_PACKET_SEND_TIME = %WMS_PACKET_SEND_TIME_HI + 1
%EQUATE `WMS_PACKET_STREAM_NUM = %WMS_PACKET_SEND_TIME + 1
%EQUATE `WMS_PACKET_FLAGS = %WMS_PACKET_STREAM_NUM + 1
%EQUATE `WMS_PACKET_NET_SEQUENCE_NUMBER = %WMS_PACKET_FLAGS + 1
%EQUATE `WMS_PACKET_PRESENT_TIME_HI = %WMS_PACKET_NET_SEQUENCE_NUMBER + 1
%EQUATE `WMS_PACKET_PRESENT_TIME = %WMS_PACKET_PRESENT_TIME_HI + 1
%EQUATE `WMS_PACKET_RECV_TIME = %WMS_PACKET_PRESENT_TIME + 1
%EQUATE `WMS_PACKET_NUM_NACKS = %WMS_PACKET_RECV_TIME + 1
%EQUATE `WMS_PACKET_DURATION = %WMS_PACKET_NUM_NACKS + 1
%EQUATE `WMS_PACKET_ERASURES_DETECTED = %WMS_PACKET_DURATION + 1
%EQUATE `WMS_PACKET_SEND_TIME_ADJUSTMENT = %WMS_PACKET_ERASURES_DETECTED + 1
%EQUATE `WMS_PACKET_PACKETIZED_HDRLEN = %WMS_PACKET_SEND_TIME_ADJUSTMENT + 1
%EQUATE `WMS_LAST_PACKET_ATTRIBUTE = %WMS_PACKET_PACKETIZED_HDRLEN
' WMS_PACKET_FLAG_TYPES enum
%EQUATE `WMS_KEY_FRAME_PACKET = &H1
%EQUATE `WMS_RETRANSMITTED_PACKET = &H2
%EQUATE `WMS_PACKET_REPORTED = &H4
%EQUATE `WMS_PACKET_PACKETIZED = &H8
%EQUATE `WMS_RECOVERED_PACKET = &H10
%EQUATE `WMS_FEC_PACKET = &H20
%EQUATE `WMS_FEC_ENCODED_PACKET = &H40
%EQUATE `WMS_PACKET_BURST_FLAG = &H80
%EQUATE `WMS_PACKET_FIRST_PAYLOAD_FLAG = &H100
' WMS_PACKET_LIST_ATTRIBUTES enum
%EQUATE `WMS_PACKET_LIST_FLAGS = 0
%EQUATE `WMS_STREAM_SIGNAL = 1
%EQUATE `WMS_PACKET_LIST_GENID = 2
%EQUATE `WMS_PACKET_LIST_SEND_TIME = 3
%EQUATE `WMS_PACKET_LIST_SEND_TIME_HI = 4
%EQUATE `WMS_PACKET_LIST_PLAYLIST_GEN_ID = 5
%EQUATE `WMS_LAST_PACKET_LIST_ATTRIBUTE = %WMS_PACKET_LIST_PLAYLIST_GEN_ID
' WMS_PACKET_LIST_FLAG_TYPES enum
%EQUATE `WMS_PACKET_LIST_NEEDS_FIXUP = &H1
%EQUATE `WMS_PACKET_LIST_UDP_RESEND = &H2
%EQUATE `WMS_PACKET_LIST_PRESTUFF = &H4
%EQUATE `WMS_PACKET_LIST_PLAYLIST_CHANGE_RECEDING = &H8
' WMS_PACKET_LIST_EX_FLAGS enum
%EQUATE `WMS_NO_ADDREF = &H80000000
%EQUATE `WMS_PACKET_NO_ADDREF = &H80000000
%EQUATE `WMS_PACKET_NO_RELEASE = &H40000000
%EQUATE `WMS_PLIST_BUFFER_NO_ADDREF = &H80000000
%EQUATE `WMS_PLIST_BUFFER_NO_RELEASE = &H40000000
%EQUATE `WMS_PLIST_NO_ADDREF = &H80000000
' WMS_PACKET_BUFFER_FLAGS enum
%EQUATE `WMS_INSERT_BUFFER_AT_END = &HFFFFFFFF
' WMS_PACKET_BUFFER_EX_FLAGS enum
%EQUATE `WMS_BUFFER_NO_ADDREF = &H80000000
%EQUATE `WMS_BUFFER_NO_RELEASE = &H40000000
%EQUATE `WMS_BUFFER_NO_REFCOUNT = &H20000000
%EQUATE `WMS_BUFFER_COMBINE = &H10000000
' WMS_PACKET_STATUS_FLAGS enum
%EQUATE `WMS_START_NEXT_READ = &H1
%EQUATE `WMS_WRITE_COMPLETED = &H2
%EQUATE `WMS_REQUEST_BUFFER = &H4
%EQUATE `WMS_HEADER_BUFFER = &H8
' WMS_PARSER_FLAG_TYPES enum
%EQUATE `WMS_PARSER_PRESERVE_PADDING = &H1
'typedef unsigned __int64 QWORD;
' ########################################################################################
' Interface name = IWMSPacket
' IID = {3309C901-10A4-11D2-9EEE-006097D2D7CF}
' Contains methods for managing the buffers, attributes, and headers associated with a packet.
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IWMSPacket_INTERFACE_DEFINED)
 %IWMSPacket_INTERFACE_DEFINED = 1
' // Size = 16 bytes
TYPE WMSBUFFERDESC DWORD
 pBuffer AS DWORD PTR ' *INSSBuffer <interface>
 dwBufferOffset AS DWORD
 dwBufferLen AS DWORD
 wFlags AS WORD ' WORD
END TYPE
INTERFACE IWMSPacket $IID_IWMSPacket
 INHERIT IUnknown
 ' =====================================================================================
 METHOD GetAllBuffers ( ' VTable offset = 12
 BYVAL dwMaxNumBuffers AS DWORD
 , BYREF pDesc AS WMSBUFFERDESC
 , BYREF pdwNumBuffers AS DWORD
 , BYVAL dwExFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD GetBuffer ( ' VTable offset = 16
 BYVAL dwBufferNum AS DWORD
 , BYREF ppBuffer AS INSSBuffer
 , BYREF pdwBufferOffset AS DWORD
 , BYREF pdwBufferLen AS DWORD
 , BYREF pwFlags AS WORD
 , OPTIONAL BYVAL dwExFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD InsertBuffer ( ' VTable offset = 20
 BYVAL dwBufferNum AS DWORD
 , BYVAL pBuffer AS INSSBuffer
 , BYVAL dwBufferOffset AS DWORD
 , BYVAL dwBufferLen AS DWORD
 , BYVAL wFlags AS WORD
 , OPTIONAL BYVAL dwExFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD RemoveBuffer ( ' VTable offset = 24
 BYVAL dwBufferNum AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD RemoveAllBuffers ( ' VTable offset = 28
 ) AS LONG
 ' =====================================================================================
 METHOD GetAttribute ( ' VTable offset = 32
 BYVAL dwValueName AS DWORD
 , BYREF pdwValue AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetAttribute ( ' VTable offset = 36
 BYVAL dwValueName AS DWORD
 , BYVAL dwValue AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD GetExtendedAttribute ( ' VTable offset = 40
 BYVAL dwValueName AS DWORD
 , BYREF pVariantValue AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD GetExtendedAttributeByIndex ( ' VTable offset = 44
 BYVAL dwIndex AS DWORD
 , BYREF pdwValueName AS DWORD
 , BYREF pVariantValue AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD SetExtendedAttribute ( ' VTable offset = 48
 BYVAL dwValueName AS DWORD
 , BYVAL VariantValue AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD GetExtendedAttributeCount ( ' VTable offset = 52
 BYREF pdwAttrs AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD CopyAttributes ( ' VTable offset = 56
 BYVAL pDest AS IWMSPacket
 , OPTIONAL BYREF pdwAttrNames AS DWORD
 , OPTIONAL BYVAL dwNumAttr AS DWORD
 , OPTIONAL BYVAL fCopyExtAttr AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD AppendHeader ( ' VTable offset = 60
 BYVAL pAlloc AS IWMSBufferAllocator
 , BYVAL dwHeaderLen AS DWORD
 , BYREF pbHeader AS BYTE
 ) AS LONG
 ' =====================================================================================
 METHOD SetInHeader ( ' VTable offset = 64
 BYVAL cbOffset AS DWORD
 , BYREF pbData AS BYTE
 , BYVAL cbData AS DWORD
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IWMSPacket_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IWMSPacketListCallback
' IID = {49C2A6F1-64B8-11D2-9F0E-006097D2D7CF}
' Contains a method to respond to the IWMSPacketList::ReportStatus method call.
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IWMSPacketListCallback_INTERFACE_DEFINED)
 %IWMSPacketListCallback_INTERFACE_DEFINED = 1
INTERFACE IWMSPacketListCallback $IID_IWMSPacketListCallback
 INHERIT IUnknown
 ' =====================================================================================
 METHOD OnReportPacketListStatus ( ' VTable offset = 12
 BYVAL pBuffer AS IWMSPacketList
 , BYVAL dwStatus AS DWORD
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IWMSPacketListCallback_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IWMSPacketList
' IID = {3309C902-10A4-11D2-9EEE-006097D2D7CF}
' Contains methods for managing the packets, attributes, and buffers associated with a packet list.
' Inherited interface = IWMSBufferAllocator
' ########################################################################################
#IF NOT %DEF(%IWMSPacketList_INTERFACE_DEFINED)
 %IWMSPacketList_INTERFACE_DEFINED = 1
' // Size = 32 bytes
TYPE WMSPACKETDESC_Attrs DWORD
 dwPacketNum AS DWORD
 dwPacketNumBuffers AS DWORD
 dwPacketLength AS DWORD
 dwPacketSendTimeHi AS DWORD
 dwPacketSendTime AS DWORD
 dwPacketStreamNum AS DWORD
 dwPacketFlags AS DWORD
 dwPacketNetSequenceNum AS DWORD
END TYPE
' // Size = 36 bytes
TYPE WMSPACKETDESC DWORD
 pPacket AS DWORD PTR ' *IWMSPacket <interface>
 WMSPACKETDESC_Attrs
END TYPE
INTERFACE IWMSPacketList $IID_IWMSPacketList
 INHERIT IUnknown
 ' =====================================================================================
 ' IWMSBufferAllocator Methods
 ' =====================================================================================
 METHOD AllocateBuffer ( ' VTable offset = 12
 BYVAL dwMaxBufferSize AS DWORD
 , BYREF ppBuffer AS INSSBuffer
 ) AS LONG
 ' =====================================================================================
 METHOD AllocatePageSizeBuffer ( ' VTable offset = 16
 BYVAL dwMaxBufferSize AS DWORD
 , BYREF ppBuffer AS INSSBuffer
 ) AS LONG
 ' =====================================================================================
 ' =====================================================================================
 ' IWMSPacketList Methods
 ' =====================================================================================
 METHOD GetPacketCount ( ' VTable offset = 20
 BYREF pdwNumPackets AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD GetPacket ( ' VTable offset = 24
 BYVAL dwPacketNum AS DWORD
 , BYREF ppPacket AS IWMSPacket
 , OPTIONAL BYVAL dwExFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD GetAllPackets ( ' VTable offset = 28
 BYVAL dwFirstPacket AS DWORD
 , BYVAL dwMaxNumPackets AS DWORD
 , BYREF pPacketDesc AS WMSPACKETDESC
 , BYREF ppPacket AS IWMSPacket
 , BYREF pdwDescNum AS DWORD
 , BYVAL dwExFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD InsertPacket ( ' VTable offset = 32
 BYVAL dwPacketNum AS DWORD
 , BYVAL pPacket AS IWMSPacket
 , OPTIONAL BYVAL dwExFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD AppendPacket ( ' VTable offset = 36
 BYVAL pPacket AS IWMSPacket
 , OPTIONAL BYVAL dwExFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD RemovePacket ( ' VTable offset = 40
 BYVAL dwPacketNum AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD RemoveAllPackets ( ' VTable offset = 44
 OPTIONAL BYVAL dwExFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD GetAttribute ( ' VTable offset = 48
 BYVAL dwValueName AS DWORD
 , BYREF pdwValue AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetAttribute ( ' VTable offset = 52
 BYVAL dwValueName AS DWORD
 , BYVAL dwValue AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD GetStreamSignalParam ( ' VTable offset = 56
 BYREF pParameter AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD SetStreamSignalParam ( ' VTable offset = 60
 BYREF pParameter AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD GetPacketParser ( ' VTable offset = 64
 BYREF ppSource AS IWMSPacketParser
 , OPTIONAL BYVAL dwExFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetPacketParser ( ' VTable offset = 68
 BYVAL pSource AS IWMSPacketParser
 ) AS LONG
 ' =====================================================================================
 METHOD GetBuffer ( ' VTable offset = 72
 BYREF ppBuffer AS INSSBuffer
 , OPTIONAL BYVAL dwExFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetBuffer ( ' VTable offset = 76
 BYVAL pBuffer AS INSSBuffer
 ) AS LONG
 ' =====================================================================================
 METHOD SetCompletionCallback ( ' VTable offset = 80
 BYVAL pCallback AS IWMSPacketListCallback
 ) AS LONG
 ' =====================================================================================
 METHOD GetCompletionCallback ( ' VTable offset = 84
 BYREF ppCallback AS IWMSPacketListCallback
 ) AS LONG
 ' =====================================================================================
 METHOD GetExtendedAttribute ( ' VTable offset = 88
 BYVAL dwValueName AS DWORD
 , BYREF pVariantValue AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD GetExtendedAttributeByIndex ( ' VTable offset = 92
 BYVAL dwIndex AS DWORD
 , BYREF pdwValueName AS DWORD
 , BYREF pVariantValue AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD SetExtendedAttribute ( ' VTable offset = 96
 BYVAL dwValueName AS DWORD
 , BYVAL VariantValue AS VARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD GetExtendedAttributeCount ( ' VTable offset = 100
 BYREF pdwAttrs AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD ReportStatus ( ' VTable offset = 104
 BYVAL dwStatus AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD ClonePacketList ( ' VTable offset = 108
 BYREF ppClonedPacketList AS IWMSPacketList
 ) AS LONG
 ' =====================================================================================
 METHOD AllocPacket ( ' VTable offset = 112
 BYREF ppPacket AS IWMSPacket
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IWMSPacketList_INTERFACE_DEFINED__ */
' ########################################################################################
' Interface name = IWMSPacketParser
' IID = {8B59F7E1-5411-11D2-9EFF-006097D2D7CF}
' Provides methods to manipulate individual packets. This interface is implemented by a media parser plug-in.
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IWMSPacketParser_INTERFACE_DEFINED)
 %IWMSPacketParser_INTERFACE_DEFINED = 1
INTERFACE IWMSPacketParser $IID_IWMSPacketParser
 INHERIT IUnknown
 ' =====================================================================================
 METHOD UpdatePacket ( ' VTable offset = 12
 BYVAL pPacket AS IWMSPacket
 ) AS LONG
 ' =====================================================================================
 METHOD CombinePackets ( ' VTable offset = 16
 BYVAL dwNumInputPackets AS DWORD
 , BYREF pInputPacketArray AS IWMSPacket
 , BYVAL pPacketList AS IWMSPacketList
 , BYVAL dwFlags AS DWORD
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IWMSPacketParser_INTERFACE_DEFINED__ */
' WMS_STREAM_SIGNAL_TYPE enum
%EQUATE `WMS_NO_STREAM_CHANGE = 0
%EQUATE `WMS_STREAM_ERROR = %WMS_NO_STREAM_CHANGE + 1
%EQUATE `WMS_STREAM_ERROR_HANDLED_BY_PLAYLIST = %WMS_STREAM_ERROR + 1
%EQUATE `WMS_PLAYLIST_CHANGED = %WMS_STREAM_ERROR_HANDLED_BY_PLAYLIST + 1
%EQUATE `WMS_END_OF_STREAM = %WMS_PLAYLIST_CHANGED + 1
%EQUATE `WMS_PLAYLIST_STREAM_QUEUED = %WMS_END_OF_STREAM + 1
%EQUATE `WMS_BEGIN_NO_DATA_PERIOD = %WMS_PLAYLIST_STREAM_QUEUED + 1
%EQUATE `WMS_PLAYLIST_EVENT = %WMS_BEGIN_NO_DATA_PERIOD + 1
%EQUATE `WMS_PLAYLIST_CUE_EVENT = %WMS_PLAYLIST_EVENT + 1
%EQUATE `WMS_PLAYLIST_UNCUE_EVENT = %WMS_PLAYLIST_CUE_EVENT + 1
%EQUATE `WMS_PLAYLIST_BEGIN_ELEMENT_EVENT = %WMS_PLAYLIST_UNCUE_EVENT + 1
%EQUATE `WMS_PLAYLIST_END_ELEMENT_EVENT = %WMS_PLAYLIST_BEGIN_ELEMENT_EVENT + 1
%EQUATE `WMS_STREAM_SWITCH_DONE = %WMS_PLAYLIST_END_ELEMENT_EVENT + 1
%EQUATE `WMS_RESET_TO_REAL_TIME = %WMS_STREAM_SWITCH_DONE + 1
%EQUATE `WMS_DATA_LOSS_DETECTED = %WMS_RESET_TO_REAL_TIME + 1
%EQUATE `WMS_REUSE_ACCEL_PARAMS = %WMS_DATA_LOSS_DETECTED + 1
' enum WMS_STREAM_SIGNAL_EOS_TYPE
%EQUATE `WMS_STREAM_SIGNAL_EOS_RESERVED = 1
%EQUATE `WMS_STREAM_SIGNAL_EOS_RECEDING = 2
' ########################################################################################
' Interface name = IWMSStreamSignalHandler
' IID = {7B10F261-26AA-11D2-9EF2-006097D2D7CF}
' Contains a method to provide notification of stream signals defined by WMS_STREAM_SIGNAL_TYPE.
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IWMSStreamSignalHandler_INTERFACE_DEFINED)
 %IWMSStreamSignalHandler_INTERFACE_DEFINED = 1
INTERFACE IWMSStreamSignalHandler $IID_IWMSStreamSignalHandler
 INHERIT IUnknown
 ' =====================================================================================
 METHOD OnStreamSignal ( ' VTable offset = 12
 BYVAL dwSignalType AS DWORD
 , BYREF pSignalParameter AS VARIANT
 , BYVAL pPresentation AS IWMSContext
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IWMSStreamSignalHandler_INTERFACE_DEFINED__ */
#ENDIF
