' ########################################################################################
' Microsoft Windows
' File: mfreadwrite.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_mfreadwrite_PBI)
#DEFINE PBX_mfreadwrite_PBI
%EQUATE `MFREADWRITE_INC = 1
'/* header files for imported files */
#INCLUDE ONCE "Legacy/System/mfobjects.inc"
#INCLUDE ONCE "Legacy/System/mfidl.inc"
'#if (WINVER >= _WIN32_WINNT_WIN7)
$CLSID_MFReadWriteClassFactory = GUID$("{48e2ed0f-98c2-4a37-bed5-166312ddd83f}")
' ########################################################################################
' IMFReadWriteClassFactory interface
' IID = E7FE2E12-661C-40DA-92F9-4F002AB67627
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IMFReadWriteClassFactory_INTERFACE_DEFINED)
 %IMFReadWriteClassFactory_INTERFACE_DEFINED = 1
$IID_IMFReadWriteClassFactory = GUID$("{E7FE2E12-661C-40DA-92F9-4F002AB67627}")
INTERFACE IMFReadWriteClassFactory $IID_IMFReadWriteClassFactory
 INHERIT IUnknown
 ' =====================================================================================
 METHOD CreateInstanceFromURL ( ' VTable offset = 12
 BYREF clsid AS GUID
 , BYREF pwszURL AS WSTRINGZ
 , BYVAL pAttributes AS IMFAttributes
 , BYREF riid AS GUID
 , BYREF ppvObject AS IUnknown
 ) AS LONG
 ' =====================================================================================
 METHOD CreateInstanceFromObject ( ' VTable offset = 16
 BYREF clsid AS GUID
 , BYVAL punkObject AS IUnknown
 , BYVAL pAttributes AS IMFAttributes
 , BYREF riid AS GUID
 , BYREF ppvObject AS IUnknown
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IMFReadWriteClassFactory_INTERFACE_DEFINED__ */
$CLSID_MFSourceReader = GUID$("{1777133c-0881-411b-a577-ad545f0714c4}")
DECLARE FUNCTION MFCreateSourceReaderFromURL LIB "mfreadwrite.dll" ALIAS "MFCreateSourceReaderFromURL" ( BYREF pwszURL AS WSTRINGZ , BYVAL pAttributes AS IMFAttributes , BYREF ppSourceReader AS IMFSourceReader ) AS LONG
DECLARE FUNCTION MFCreateSourceReaderFromByteStream LIB "mfreadwrite.dll" ALIAS "MFCreateSourceReaderFromByteStream" ( BYVAL pByteStream AS IMFByteStream
 , BYVAL pAttributes AS IMFAttributes
 , BYREF ppSourceReader AS IMFSourceReader
 ) AS LONG
DECLARE FUNCTION MFCreateSourceReaderFromMediaSource LIB "mfreadwrite.dll" ALIAS "MFCreateSourceReaderFromMediaSource" ( BYVAL pMediaSource AS IMFMediaSource
 , BYVAL pAttributes AS IMFAttributes
 , BYREF ppSourceReader AS IMFSourceReader
 ) AS LONG
$MF_SOURCE_READER_ASYNC_CALLBACK = GUID$("{1e3dbeac-bb43-4c35-b507-cd644464c965}")
$MF_SOURCE_READER_D3D_MANAGER = GUID$("{ec822da2-e1e9-4b29-a0d8-563c719f5269}")
$MF_SOURCE_READER_DISABLE_DXVA = GUID$("{aa456cfd-3943-4a1e-a77d-1838c0ea2e35}")
$MF_SOURCE_READER_MEDIASOURCE_CONFIG = GUID$("{9085abeb-0354-48f9-abb5-200df838c68e}")
$MF_SOURCE_READER_MEDIASOURCE_CHARACTERISTICS = GUID$("{6d23f5c8-c5d7-4a9b-9971-5d11f8bca880}")
$MF_SOURCE_READER_ENABLE_VIDEO_PROCESSING = GUID$("{fb394f3d-ccf1-42ee-bbb3-f9b845d5681d}")
$MF_SOURCE_READER_DISCONNECT_MEDIASOURCE_ON_SHUTDOWN = GUID$("{56b67165-219e-456d-a22e-2d3004c7fe56}")
' enum MF_SOURCE_READER_FLAG
%EQUATE `MF_SOURCE_READERF_ERROR = &H1
%EQUATE `MF_SOURCE_READERF_ENDOFSTREAM = &H2
%EQUATE `MF_SOURCE_READERF_NEWSTREAM = &H4
%EQUATE `MF_SOURCE_READERF_NATIVEMEDIATYPECHANGED = &H10
%EQUATE `MF_SOURCE_READERF_CURRENTMEDIATYPECHANGED = &H20
%EQUATE `MF_SOURCE_READERF_STREAMTICK = &H100
' enum MF_SOURCE_READER_CONTROL_FLAG
%EQUATE `MF_SOURCE_READER_CONTROLF_DRAIN = &H1
' enum __MIDL___MIDL_itf_mfreadwrite_0000_0001_0001
%EQUATE `MF_SOURCE_READER_INVALID_STREAM_INDEX = &Hffffffff
%EQUATE `MF_SOURCE_READER_ALL_STREAMS = &Hfffffffe
%EQUATE `MF_SOURCE_READER_ANY_STREAM = &Hfffffffe
%EQUATE `MF_SOURCE_READER_FIRST_AUDIO_STREAM = &Hfffffffd
%EQUATE `MF_SOURCE_READER_FIRST_VIDEO_STREAM = &Hfffffffc
%EQUATE `MF_SOURCE_READER_MEDIASOURCE = &Hffffffff
' ########################################################################################
' IMFSourceReader interface
' IID = 70ae66f2-c809-4e4f-8915-bdcb406b7993
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IMFSourceReader_INTERFACE_DEFINED)
 %IMFSourceReader_INTERFACE_DEFINED = 1
$IID_IMFSourceReader = GUID$("{70ae66f2-c809-4e4f-8915-bdcb406b7993}")
INTERFACE IMFSourceReader $IID_IMFSourceReader
 INHERIT IUnknown
 ' =====================================================================================
 METHOD GetStreamSelection ( ' VTable offset = 12
 BYVAL dwStreamIndex AS DWORD
 , BYREF pfSelected AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD SetStreamSelection ( ' VTable offset = 16
 BYVAL dwStreamIndex AS DWORD
 , BYVAL fSelected AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD GetNativeMediaType ( ' VTable offset = 20
 BYVAL dwStreamIndex AS DWORD
 , BYVAL dwMediaTypeIndex AS DWORD
 , BYREF ppMediaType AS IMFMediaType
 ) AS LONG
 ' =====================================================================================
 METHOD GetCurrentMediaType ( ' VTable offset = 24
 BYVAL dwStreamIndex AS DWORD
 , BYREF ppMediaType AS IMFMediaType
 ) AS LONG
 ' =====================================================================================
 METHOD SetCurrentMediaType ( ' VTable offset = 28
 BYVAL dwStreamIndex AS DWORD
 , BYREF pdwReserved AS DWORD
 , BYVAL pMediaType AS IMFMediaType
 ) AS LONG
 ' =====================================================================================
 METHOD SetCurrentPosition ( ' VTable offset = 32
 BYREF guidTimeFormat AS GUID
 , BYREF varPosition AS PROPVARIANT
 ) AS LONG
 ' =====================================================================================
 METHOD ReadSample ( ' VTable offset = 36
 BYVAL dwStreamIndex AS DWORD
 , BYVAL dwControlFlags AS DWORD
 , OPTIONAL BYREF pdwActualStreamIndex AS DWORD
 , OPTIONAL BYREF pdwStreamFlags AS DWORD
 , OPTIONAL BYREF pllTimestamp AS QUAD
 , OPTIONAL BYREF ppSample AS IMFSample
 ) AS LONG
 ' =====================================================================================
 METHOD Flush ( ' VTable offset = 40
 BYVAL dwStreamIndex AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD GetServiceForStream ( ' VTable offset = 44
 BYVAL dwStreamIndex AS DWORD
 , BYREF guidService AS GUID
 , BYREF riid AS GUID
 , BYREF ppvObject AS IUnknown
 ) AS LONG
 ' =====================================================================================
 METHOD GetPresentationAttribute ( ' VTable offset = 48
 BYVAL dwStreamIndex AS DWORD
 , BYREF guidAttribute AS GUID
 , BYREF pvarAttribute AS PROPVARIANT
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IMFSourceReader_INTERFACE_DEFINED__ */
' ########################################################################################
' IMFSourceReaderCallback interface
' IID = deec8d99-fa1d-4d82-84c2-2c8969944867
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IMFSourceReaderCallback_INTERFACE_DEFINED)
 %IMFSourceReaderCallback_INTERFACE_DEFINED = 1
$IID_IMFSourceReaderCallback = GUID$("{deec8d99-fa1d-4d82-84c2-2c8969944867}")
INTERFACE IMFSourceReaderCallback $IID_IMFSourceReaderCallback
 INHERIT IUnknown
 ' =====================================================================================
 METHOD OnReadSample ( ' VTable offset = 12
 BYVAL hrStatus AS LONG
 , BYVAL dwStreamIndex AS DWORD
 , BYVAL dwStreamFlags AS DWORD
 , BYVAL llTimestamp AS QUAD
 , OPTIONAL BYREF pSample AS IMFSample
 ) AS LONG
 ' =====================================================================================
 METHOD OnFlush ( ' VTable offset = 16
 BYVAL dwStreamIndex AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD OnEvent ( ' VTable offset = 20
 BYVAL dwStreamIndex AS DWORD
 , BYVAL pEvent AS IMFMediaEvent
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IMFSourceReaderCallback_INTERFACE_DEFINED__ */
$CLSID_MFSinkWriter = GUID$("{a3bbfb17-8273-4e52-9e0e-9739dc887990}")
DECLARE FUNCTION MFCreateSinkWriterFromURL LIB "mfreadwrite.dll" ALIAS "MFCreateSinkWriterFromURL" ( BYREF pwszOutputURL AS WSTRINGZ , BYVAL pByteStream AS IMFByteStream , BYVAL pAttributes AS IMFAttributes , BYREF ppSinkWriter AS IMFSinkWriter ) AS LONG
DECLARE FUNCTION MFCreateSinkWriterFromMediaSink LIB "mfreadwrite.dll" ALIAS "MFCreateSinkWriterFromMediaSink" ( BYVAL pMediaSink AS IMFMediaSink
 , BYVAL pAttributes AS IMFAttributes
 , BYREF ppSinkWriter AS IMFSinkWriter
 ) AS LONG
$MF_SINK_WRITER_ASYNC_CALLBACK = GUID$("{48cb183e-7b0b-46f4-822e-5e1d2dda4354}")
$MF_SINK_WRITER_DISABLE_THROTTLING = GUID$("{08b845d8-2b74-4afe-9d53-be16d2d5ae4f}")
' enum __MIDL___MIDL_itf_mfreadwrite_0000_0003_0001
%EQUATE `MF_SINK_WRITER_INVALID_STREAM_INDEX = &Hffffffff
%EQUATE `MF_SINK_WRITER_ALL_STREAMS = &Hfffffffe
%EQUATE `MF_SINK_WRITER_MEDIASINK = &Hffffffff
' // Size = 112 bytes
TYPE MF_SINK_WRITER_STATISTICS QWORD FILL
 cb AS DWORD
 llLastTimestampReceived AS QUAD ' LONGLONG
 llLastTimestampEncoded AS QUAD ' LONGLONG
 llLastTimestampProcessed AS QUAD ' LONGLONG
 llLastStreamTickReceived AS QUAD ' LONGLONG
 llLastSinkSampleRequest AS QUAD ' LONGLONG
 qwNumSamplesReceived AS QUAD ' QWORD
 qwNumSamplesEncoded AS QUAD ' QWORD
 qwNumSamplesProcessed AS QUAD ' QWORD
 qwNumStreamTicksReceived AS QUAD ' QWORD
 dwByteCountQueued AS DWORD
 qwByteCountProcessed AS QUAD ' QWORD
 dwNumOutstandingSinkSampleRequests AS DWORD
 dwAverageSampleRateReceived AS DWORD
 dwAverageSampleRateEncoded AS DWORD
 dwAverageSampleRateProcessed AS DWORD
END TYPE
' ########################################################################################
' IMFSinkWriter interface
' IID = 3137f1cd-fe5e-4805-a5d8-fb477448cb3d
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IMFSinkWriter_INTERFACE_DEFINED)
 %IMFSinkWriter_INTERFACE_DEFINED = 1
$IID_IMFSinkWriter = GUID$("{3137f1cd-fe5e-4805-a5d8-fb477448cb3d}")
INTERFACE IMFSinkWriter $IID_IMFSinkWriter
 INHERIT IUnknown
 ' =====================================================================================
 METHOD AddStream ( ' VTable offset = 12
 BYVAL pTargetMediaType AS IMFMediaType
 , BYREF pdwStreamIndex AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD SetInputMediaType ( ' VTable offset = 16
 BYVAL dwStreamIndex AS DWORD
 , BYVAL pInputMediaType AS IMFMediaType
 , OPTIONAL BYVAL pEncodingParameters AS IMFAttributes
 ) AS LONG
 ' =====================================================================================
 METHOD BeginWriting ( ' VTable offset = 20
 ) AS LONG
 ' =====================================================================================
 METHOD WriteSample ( ' VTable offset = 24
 BYVAL dwStreamIndex AS DWORD
 , BYVAL pSample AS IMFSample
 ) AS LONG
 ' =====================================================================================
 METHOD SendStreamTick ( ' VTable offset = 28
 BYVAL dwStreamIndex AS DWORD
 , BYVAL llTimestamp AS QUAD
 ) AS LONG
 ' =====================================================================================
 METHOD PlaceMarker ( ' VTable offset = 32
 BYVAL dwStreamIndex AS DWORD
 , BYVAL pvContext AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD NotifyEndOfSegment ( ' VTable offset = 36
 BYVAL dwStreamIndex AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD Flush ( ' VTable offset = 40
 BYVAL dwStreamIndex AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD Finalize ( ' VTable offset = 44
 ) AS LONG
 ' =====================================================================================
 METHOD GetServiceForStream ( ' VTable offset = 48
 BYVAL dwStreamIndex AS DWORD
 , BYREF guidService AS GUID
 , BYREF riid AS GUID
 , BYREF ppvObject AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD GetStatistics ( ' VTable offset = 52
 BYVAL dwStreamIndex AS DWORD
 , BYREF pStats AS MF_SINK_WRITER_STATISTICS
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IMFSinkWriter_INTERFACE_DEFINED__ */
' ########################################################################################
' IMFSinkWriterCallback interface
' IID = 666f76de-33d2-41b9-a458-29ed0a972c58
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%IMFSinkWriterCallback_INTERFACE_DEFINED)
 %IMFSinkWriterCallback_INTERFACE_DEFINED = 1
$IID_IMFSinkWriterCallback = GUID$("{666f76de-33d2-41b9-a458-29ed0a972c58}")
INTERFACE IMFSinkWriterCallback $IID_IMFSinkWriterCallback
 INHERIT IUnknown
 ' =====================================================================================
 METHOD OnFinalize ( ' VTable offset = 12
 BYVAL hrStatus AS LONG
 ) AS LONG
 ' =====================================================================================
 METHOD OnMarker ( ' VTable offset = 16
 BYVAL dwStreamIndex AS DWORD
 , BYVAL pvContext AS DWORD
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __IMFSinkWriterCallback_INTERFACE_DEFINED__ */
$MF_READWRITE_DISABLE_CONVERTERS = GUID$("{98d5b065-1374-4847-8d5d-31520fee7156}")
$MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS = GUID$("{a634a91c-822b-41b9-a494-4de4643612b0}")
'#endif // (WINVER >= _WIN32_WINNT_WIN7)
#ENDIF
