├── ChangeLog.txt ├── Common ├── MFAsyncCallback.h ├── MFAsyncState.h ├── MFBuffer.h ├── MFClassFactory.h ├── MFCriticSection.h ├── MFFile.h ├── MFGrowArray.h ├── MFInclude.h ├── MFLinkList.h ├── MFLogGuid.h ├── MFLogMediaType.h ├── MFLogging.h ├── MFMacro.h ├── MFMpeg2Definition.h ├── MFNodeEnum.h ├── MFNodeGuid.h ├── MFOperationQueue.h ├── MFReadParam.h ├── MFRegistry.h ├── MFSafeQueue.h ├── MFState.h ├── MFTExternTrace.h ├── MFTime.h ├── MFTinyMap.h ├── MFTrace.h └── MFTraceSample.h ├── LICENSE ├── LibA52Audio ├── LibA52Audio.vcxproj ├── LibA52Audio.vcxproj.filters ├── a52.h ├── a52_internal.h ├── bit_allocate.cpp ├── bitstream.cpp ├── bitstream.h ├── config.h ├── downmix.cpp ├── imdct.cpp ├── inttypes.h ├── parse.cpp └── tables.h ├── LibMpeg2 ├── LibMpeg2.vcxproj ├── LibMpeg2.vcxproj.filters ├── alloc.c ├── attributes.h ├── config.h ├── cpu_accel.obj ├── cpu_state.obj ├── decode.c ├── header.c ├── idct.c ├── idct_mmx.obj ├── inttypes.h ├── motion_comp.c ├── motion_comp_mmx.obj ├── mpeg2.h ├── mpeg2_internal.h ├── slice.c └── vlc.h ├── LibMpegAudio ├── LibMpegAudio.vcxproj ├── LibMpegAudio.vcxproj.filters ├── Mpeg12Decoder.cpp ├── Mpeg12Decoder.h ├── Mpeg12DecoderVersion.h ├── Mpeg12Decoder_Bits.cpp ├── Mpeg12LibDefinition.h ├── Mpeg12LibInternal.h ├── Mpeg12LibTab.h ├── StdAfx.cpp └── StdAfx.h ├── MFNode.sln ├── MFNodePlayer ├── MFControlManager.cpp ├── MFControlManager.h ├── MFNodeForm.cpp ├── MFNodeForm.h ├── MFNodeForm_Event.cpp ├── MFNodePlayer.cpp ├── MFNodePlayer.h ├── MFNodePlayer.rc ├── MFNodePlayer.vcxproj ├── MFNodePlayer.vcxproj.filters ├── MFNodePlayerVersion.h ├── MFNodePlayer_Capture.cpp ├── MFNodePlayer_Topology.cpp ├── MFNodePlayer_definition.h ├── StdAfx.cpp ├── StdAfx.h ├── ToDo.txt ├── WaveMixerSession.cpp ├── WaveMixerSession.h ├── WaveMixerSession_Topology.cpp ├── WinMain.cpp └── resource.h ├── MFSkDxva2Renderer ├── DllMain.cpp ├── Dxva2Manager.cpp ├── Dxva2Manager.h ├── Dxva2RendererSettings.idl ├── MFSVersion.h ├── MFSkDxva2Renderer.def ├── MFSkDxva2Renderer.rc ├── MFSkDxva2Renderer.vcxproj ├── MFSkDxva2Renderer.vcxproj.filters ├── SinkDxva2Renderer.cpp ├── SinkDxva2Renderer.h ├── SinkDxva2Renderer_Clock.cpp ├── SinkDxva2Renderer_Settings.cpp ├── SinkDxva2Renderer_Sink.cpp ├── SinkDxva2Renderer_Thread.cpp ├── StdAfx.cpp ├── StdAfx.h ├── StreamDxva2Renderer.cpp ├── StreamDxva2Renderer.h ├── StreamDxva2Renderer_Event.cpp ├── StreamDxva2Renderer_Sink.cpp ├── StreamDxva2Renderer_Type.cpp └── resource.h ├── MFSkImageWriter ├── DllMain.cpp ├── MFSVersion.h ├── MFSkImageWriter.def ├── MFSkImageWriter.rc ├── MFSkImageWriter.vcxproj ├── MFSkImageWriter.vcxproj.filters ├── SinkImageWriter.cpp ├── SinkImageWriter.h ├── SinkImageWriter_Clock.cpp ├── SinkImageWriter_Sink.cpp ├── StdAfx.cpp ├── StdAfx.h ├── StreamImage.cpp ├── StreamImage.h ├── StreamImage_Event.cpp ├── StreamImage_Sink.cpp ├── StreamImage_Type.cpp ├── ToDo.txt └── resource.h ├── MFSkJpegHttpStreamer ├── DllMain.cpp ├── HttpServer.cpp ├── HttpServer.h ├── Http_Definition.h ├── MFSVersion.h ├── MFSkJpegHttpStreamer.cpp ├── MFSkJpegHttpStreamer.def ├── MFSkJpegHttpStreamer.h ├── MFSkJpegHttpStreamer.rc ├── MFSkJpegHttpStreamer.vcxproj ├── MFSkJpegHttpStreamer.vcxproj.filters ├── MFSkJpegHttpStreamer_Clock.cpp ├── MFSkJpegHttpStreamer_Sink.cpp ├── MFSkStreamJpeg.cpp ├── MFSkStreamJpeg.h ├── MFSkStreamJpeg_Event.cpp ├── MFSkStreamJpeg_Sink.cpp ├── MFSkStreamJpeg_Type.cpp ├── StdAfx.cpp ├── StdAfx.h ├── ToDo.txt └── resource.h ├── MFSkVideoRenderer ├── DirectX9Manager.cpp ├── DirectX9Manager.h ├── DllMain.cpp ├── MFSVersion.h ├── MFSkVideoRenderer.def ├── MFSkVideoRenderer.rc ├── MFSkVideoRenderer.vcxproj ├── MFSkVideoRenderer.vcxproj.filters ├── Quad.h ├── SinkVideoRenderer.cpp ├── SinkVideoRenderer.h ├── SinkVideoRenderer_Clock.cpp ├── SinkVideoRenderer_Sink.cpp ├── SinkVideoRenderer_Thread.cpp ├── StdAfx.cpp ├── StdAfx.h ├── StreamVideoRenderer.cpp ├── StreamVideoRenderer.h ├── StreamVideoRenderer_Event.cpp ├── StreamVideoRenderer_Sink.cpp ├── StreamVideoRenderer_Type.cpp ├── ToDo.txt ├── VideoShader.fx ├── VideoShaderEffect.idl └── resource.h ├── MFSrA52Decoder ├── DllMain.cpp ├── MFA52Source.cpp ├── MFA52Source.h ├── MFA52Stream.cpp ├── MFA52Stream.h ├── MFByteStreamHandler.cpp ├── MFByteStreamHandler.h ├── MFSVersion.h ├── MFSrA52Decoder.def ├── MFSrA52Decoder.rc ├── MFSrA52Decoder.vcxproj ├── MFSrA52Decoder.vcxproj.filters ├── MFWriteWaveFile.cpp ├── MFWriteWaveFile.h ├── Resource.h ├── StdAfx.cpp ├── StdAfx.h └── ToDo.txt ├── MFSrFlvSplitter ├── DllMain.cpp ├── FlvByteStreamHandler.cpp ├── FlvByteStreamHandler.h ├── FlvDefinition.h ├── FlvParser.cpp ├── FlvParser.h ├── FlvSource.cpp ├── FlvSource.h ├── FlvSource_Parse.cpp ├── FlvSource_Sample.cpp ├── FlvSource_stream.cpp ├── FlvStream.cpp ├── FlvStream.h ├── MFByteStream.cpp ├── MFByteStream.h ├── MFSVersion.h ├── MFSrFlvSplitter.def ├── MFSrFlvSplitter.rc ├── MFSrFlvSplitter.vcxproj ├── MFSrFlvSplitter.vcxproj.filters ├── StdAfx.cpp ├── StdAfx.h ├── ToDo.txt └── resource.h ├── MFSrKinectCapture ├── DllMain.cpp ├── KinectDevice.cpp ├── KinectDevice.h ├── KinectSchemeHandler.cpp ├── KinectSchemeHandler.h ├── KinectSource.cpp ├── KinectSource.h ├── KinectSource_Def.h ├── KinectStream.cpp ├── KinectStream.h ├── KinectVersion.h ├── MFSrKinectCapture.def ├── MFSrKinectCapture.rc ├── MFSrKinectCapture.vcxproj ├── MFSrKinectCapture.vcxproj.filters ├── Resource.h ├── StdAfx.cpp ├── StdAfx.h └── ToDo.txt ├── MFSrMpeg12Decoder ├── DllMain.cpp ├── MFByteStreamHandler.cpp ├── MFByteStreamHandler.h ├── MFMpeg12Definition.h ├── MFMpeg12Source.cpp ├── MFMpeg12Source.h ├── MFMpeg12Source_Audio.cpp ├── MFMpeg12Stream.cpp ├── MFMpeg12Stream.h ├── MFSVersion.h ├── MFSrMpeg12Decoder.def ├── MFSrMpeg12Decoder.rc ├── MFSrMpeg12Decoder.vcxproj ├── MFSrMpeg12Decoder.vcxproj.filters ├── Resource.h ├── StdAfx.cpp └── StdAfx.h ├── MFSrMpeg2Splitter ├── DllMain.cpp ├── MFByteStream.cpp ├── MFByteStream.h ├── MFMpeg2Handler.cpp ├── MFMpeg2Handler.h ├── MFMpeg2Source.cpp ├── MFMpeg2Source.h ├── MFMpeg2Source_Event.cpp ├── MFMpeg2Source_MediaType.cpp ├── MFMpeg2Source_Operation.cpp ├── MFMpeg2Source_Source.cpp ├── MFMpeg2Source_Stream.cpp ├── MFMpeg2Stream.cpp ├── MFMpeg2Stream.h ├── MFMpeg2Stream_Event.cpp ├── MFMpeg2Stream_Stream.cpp ├── MFParser.cpp ├── MFParser.h ├── MFParser_AVHeader.cpp ├── MFSVersion.h ├── MFSourceOperation.h ├── MFSrMpeg2Splitter.def ├── MFSrMpeg2Splitter.rc ├── MFSrMpeg2Splitter.vcxproj ├── MFSrMpeg2Splitter.vcxproj.filters ├── Mpeg2Definition.h ├── StdAfx.cpp ├── StdAfx.h ├── ToDo.txt └── resource.h ├── MFSrScreenCapture ├── DllMain.cpp ├── MFSVersion.h ├── MFSrScreenCapture.def ├── MFSrScreenCapture.rc ├── MFSrScreenCapture.vcxproj ├── MFSrScreenCapture.vcxproj.filters ├── ScreenCapture.cpp ├── ScreenCapture.h ├── ScreenCaptureSchemeHandler.cpp ├── ScreenCaptureSchemeHandler.h ├── ScreenCaptureStream.cpp ├── ScreenCaptureStream.h ├── ScreenCapture_def.h ├── StdAfx.cpp ├── StdAfx.h ├── ToDo.txt └── resource.h ├── MFTA52Decoder ├── A52Decoder.cpp ├── A52Decoder.h ├── A52Decoder_Transform.cpp ├── A52Decoder_Types.cpp ├── DllMain.cpp ├── MFTA52Decoder.def ├── MFTA52Decoder.rc ├── MFTA52Decoder.vcxproj ├── MFTA52Decoder.vcxproj.filters ├── MFTVersion.h ├── StdAfx.cpp ├── StdAfx.h ├── ToDo.txt └── resource.h ├── MFTCudaDecoder ├── CudaDecoder.cpp ├── CudaDecoder.h ├── CudaFrame.cpp ├── CudaFrame.h ├── CudaManager.cpp ├── CudaManager.h ├── DllMain.cpp ├── MFTCudaDecoder.cpp ├── MFTCudaDecoder.def ├── MFTCudaDecoder.h ├── MFTCudaDecoder.rc ├── MFTCudaDecoder.vcxproj ├── MFTCudaDecoder.vcxproj.filters ├── MFTCudaDecoder_Def.h ├── MFTCudaDecoder_Process.cpp ├── MFTCudaDecoder_Transform.cpp ├── MFTCudaDecoder_Types.cpp ├── MFTVersion.h ├── Resource.h ├── StdAfx.cpp ├── StdAfx.h └── ToDo.txt ├── MFTDxva2Decoder ├── DllMain.cpp ├── Dxva2Decoder.cpp ├── Dxva2Decoder.h ├── Dxva2Decoder_Dxva2.cpp ├── Dxva2Decoder_Slice.cpp ├── Dxva2Decoder_Trace.cpp ├── Dxva2Decoder_Transform.cpp ├── Dxva2Decoder_Types.cpp ├── MFDxva2Definition.h ├── MFTDxva2Decoder.def ├── MFTDxva2Decoder.rc ├── MFTDxva2Decoder.vcxproj ├── MFTDxva2Decoder.vcxproj.filters ├── MFTVersion.h ├── StdAfx.cpp ├── StdAfx.h ├── SurfaceParam.h ├── TSScheduler.cpp ├── TSScheduler.h ├── ToDo.txt └── resource.h ├── MFTJpegEncoder ├── DllMain.cpp ├── JpegStream.cpp ├── JpegStream.h ├── MFTJpegEncoder.cpp ├── MFTJpegEncoder.def ├── MFTJpegEncoder.h ├── MFTJpegEncoder.rc ├── MFTJpegEncoder.vcxproj ├── MFTJpegEncoder.vcxproj.filters ├── MFTJpegEncoder_Transform.cpp ├── MFTJpegEncoder_Types.cpp ├── MFTVersion.h ├── StdAfx.cpp ├── StdAfx.h ├── ToDo.txt └── resource.h ├── MFTMpeg12Decoder ├── DllMain.cpp ├── MFTMpeg12Decoder.def ├── MFTMpeg12Decoder.rc ├── MFTMpeg12Decoder.vcxproj ├── MFTMpeg12Decoder.vcxproj.filters ├── MFTMpegAudioDecoder.cpp ├── MFTMpegAudioDecoder.h ├── MFTMpegAudioDecoder_MediaType.cpp ├── MFTMpegAudioDecoder_Transform.cpp ├── MFTVersion.h ├── StdAfx.cpp ├── StdAfx.h └── resource.h ├── MFTMpeg2Decoder ├── DllMain.cpp ├── MFTMpeg2Decoder.def ├── MFTMpeg2Decoder.rc ├── MFTMpeg2Decoder.vcxproj ├── MFTMpeg2Decoder.vcxproj.filters ├── MFTVersion.h ├── MFTVideoMpeg2.cpp ├── MFTVideoMpeg2.h ├── MFTVideoMpeg2_Mmx.cpp ├── MFTVideoMpeg2_Process.cpp ├── MFTVideoMpeg2_Transform.cpp ├── Mpeg2Decoder.cpp ├── Mpeg2Decoder.h ├── Mpeg2Decoder_LibDef.h ├── StdAfx.cpp ├── StdAfx.h ├── ToDo.txt └── resource.h ├── MFTVp6Decoder ├── DllMain.cpp ├── MFTVersion.h ├── MFTVp6Decoder.def ├── MFTVp6Decoder.rc ├── MFTVp6Decoder.vcxproj ├── MFTVp6Decoder.vcxproj.filters ├── StdAfx.cpp ├── StdAfx.h ├── VP62.cpp ├── VP62.h ├── Vp6Decoder.cpp ├── Vp6Decoder.h ├── Vp6Decoder_Mmx.cpp ├── Vp6Decoder_Transform.cpp ├── Vp6Decoder_Types.cpp └── resource.h ├── MFTWaveMixer ├── DllMain.cpp ├── MFTVersion.h ├── MFTWaveMixer.cpp ├── MFTWaveMixer.def ├── MFTWaveMixer.h ├── MFTWaveMixer.rc ├── MFTWaveMixer.vcxproj ├── MFTWaveMixer.vcxproj.filters ├── MFTWaveMixer_Mixer.cpp ├── MFTWaveMixer_Transform.cpp ├── StdAfx.cpp ├── StdAfx.h ├── ToDo.txt └── resource.h ├── Mp3Decoding ├── MFWaveWriter.cpp ├── MFWaveWriter.h ├── Main.cpp ├── Mp3Decoding.vcxproj ├── Mp3Decoding.vcxproj.filters ├── StdAfx.cpp └── StdAfx.h ├── README.md └── README.txt /Common/MFAsyncCallback.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFAsyncCallback.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef MFASYNCCALLBACK_H 5 | #define MFASYNCCALLBACK_H 6 | 7 | template class CAsyncCallback : public IMFAsyncCallback{ 8 | 9 | public: 10 | 11 | typedef HRESULT(T::*InvokeFn)(IMFAsyncResult*); 12 | 13 | CAsyncCallback(T* pParent, InvokeFn fn) : m_pParent(pParent), m_pInvokeFn(fn){} 14 | 15 | // IUnknown 16 | STDMETHODIMP QueryInterface(REFIID iid, void** ppv){ 17 | 18 | if(!ppv){ 19 | return E_POINTER; 20 | } 21 | 22 | if(iid == __uuidof(IUnknown)){ 23 | *ppv = static_cast(static_cast(this)); 24 | } 25 | else if(iid == __uuidof(IMFAsyncCallback)){ 26 | *ppv = static_cast(this); 27 | } 28 | else{ 29 | *ppv = NULL; 30 | return E_NOINTERFACE; 31 | } 32 | 33 | AddRef(); 34 | return S_OK; 35 | } 36 | 37 | STDMETHODIMP_(ULONG) AddRef(){ return m_pParent->AddRef(); } 38 | STDMETHODIMP_(ULONG) Release(){ return m_pParent->Release(); } 39 | 40 | // IMFAsyncCallback methods 41 | STDMETHODIMP GetParameters(DWORD*, DWORD*){ return E_NOTIMPL; } 42 | STDMETHODIMP Invoke(IMFAsyncResult* pAsyncResult){ return (m_pParent->*m_pInvokeFn)(pAsyncResult); } 43 | 44 | T* m_pParent; 45 | InvokeFn m_pInvokeFn; 46 | }; 47 | 48 | #endif -------------------------------------------------------------------------------- /Common/MFAsyncState.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFAsyncState.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef MFASYNCSTATE_H 5 | #define MFASYNCSTATE_H 6 | 7 | class IMFAsyncState : public IUnknown{ 8 | 9 | public: 10 | 11 | virtual MFNodeMediaEvent EventType() = 0; 12 | }; 13 | 14 | class CMFAsyncState : public IMFAsyncState{ 15 | 16 | public: 17 | 18 | CMFAsyncState(MFNodeMediaEvent type) : m_nRefCount(1), m_eventType(type){} 19 | virtual ~CMFAsyncState(){} 20 | 21 | STDMETHODIMP QueryInterface(REFIID riid, void** ppv){ 22 | 23 | HRESULT hr = S_OK; 24 | 25 | if(ppv == NULL){ 26 | return E_POINTER; 27 | } 28 | 29 | if(riid == IID_IUnknown){ 30 | *ppv = static_cast(this); 31 | } 32 | else if(riid == IID_IMFAsyncState){ 33 | *ppv = static_cast(this); 34 | } 35 | else{ 36 | *ppv = NULL; 37 | hr = E_NOINTERFACE; 38 | } 39 | 40 | if(SUCCEEDED(hr)) 41 | AddRef(); 42 | 43 | return hr; 44 | } 45 | 46 | STDMETHODIMP_(ULONG) AddRef(){ 47 | 48 | return InterlockedIncrement(&m_nRefCount); 49 | } 50 | 51 | STDMETHODIMP_(ULONG) Release(){ 52 | 53 | ULONG refCount = InterlockedDecrement(&m_nRefCount); 54 | 55 | if(refCount == 0){ 56 | delete this; 57 | } 58 | 59 | return refCount; 60 | } 61 | 62 | virtual MFNodeMediaEvent EventType(){ return m_eventType; } 63 | 64 | private: 65 | 66 | volatile long m_nRefCount; 67 | MFNodeMediaEvent m_eventType; 68 | }; 69 | 70 | #endif -------------------------------------------------------------------------------- /Common/MFCriticSection.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFCriticSection.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef MFCRITICSECTION_H 5 | #define MFCRITICSECTION_H 6 | 7 | class CriticSection{ 8 | 9 | private: 10 | 11 | CRITICAL_SECTION m_Section; 12 | 13 | public: 14 | 15 | CriticSection(){ InitializeCriticalSection(&m_Section); } 16 | ~CriticSection(){ DeleteCriticalSection(&m_Section); } 17 | 18 | void Lock(){ EnterCriticalSection(&m_Section); } 19 | void Unlock(){ LeaveCriticalSection(&m_Section); } 20 | }; 21 | 22 | class AutoLock{ 23 | 24 | private: 25 | 26 | CriticSection * m_pSection; 27 | 28 | public: 29 | 30 | AutoLock(CriticSection& critic){ m_pSection = &critic; m_pSection->Lock(); } 31 | ~AutoLock(){ m_pSection->Unlock(); } 32 | }; 33 | 34 | #endif -------------------------------------------------------------------------------- /Common/MFGrowArray.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFGrowArray.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef MFGROWARRAY_H 5 | #define MFGROWARRAY_H 6 | 7 | template class CGrowableArray{ 8 | 9 | public: 10 | 11 | CGrowableArray() : m_count(0), m_allocated(0), m_pArray(NULL){} 12 | virtual ~CGrowableArray(){ SAFE_DELETE_ARRAY(m_pArray); } 13 | 14 | HRESULT Allocate(DWORD alloc){ 15 | 16 | HRESULT hr = S_OK; 17 | 18 | if(alloc > m_allocated){ 19 | 20 | T* pTmp = new T[alloc]; 21 | 22 | if(pTmp){ 23 | 24 | ZeroMemory(pTmp, alloc * sizeof(T)); 25 | 26 | assert(m_count <= m_allocated); 27 | 28 | for(DWORD i = 0; i < m_count; i++){ 29 | pTmp[i] = m_pArray[i]; 30 | } 31 | 32 | delete[] m_pArray; 33 | 34 | m_pArray = pTmp; 35 | m_allocated = alloc; 36 | } 37 | else{ 38 | hr = E_OUTOFMEMORY; 39 | } 40 | } 41 | return hr; 42 | } 43 | 44 | HRESULT SetSize(DWORD count){ 45 | 46 | assert(m_count <= m_allocated); 47 | 48 | HRESULT hr = S_OK; 49 | 50 | if(count > m_allocated){ 51 | hr = Allocate(count); 52 | } 53 | 54 | if(SUCCEEDED(hr)){ 55 | m_count = count; 56 | } 57 | 58 | return hr; 59 | } 60 | 61 | DWORD GetCount() const { return m_count; } 62 | 63 | T& operator[](DWORD index){ 64 | 65 | assert(index < m_count); 66 | return m_pArray[index]; 67 | } 68 | 69 | const T& operator[](DWORD index) const{ 70 | 71 | assert(index < m_count); 72 | return m_pArray[index]; 73 | } 74 | 75 | T* Ptr() { return m_pArray; } 76 | 77 | protected: 78 | 79 | CGrowableArray & operator=(const CGrowableArray&); 80 | CGrowableArray(const CGrowableArray&); 81 | 82 | T* m_pArray; 83 | DWORD m_count; 84 | DWORD m_allocated; 85 | }; 86 | 87 | #endif -------------------------------------------------------------------------------- /Common/MFNodeEnum.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFNodeEnum.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef MFNODEENUM_H 5 | #define MFNODEENUM_H 6 | 7 | enum MFNodeMediaEvent{ 8 | 9 | ME_MFNodeSource = 750, 10 | ME_MFNodeSource2 = 751, 11 | ME_MFNodeSourceStream = 752, 12 | ME_MFNodeSourceStream2 = 753, 13 | ME_MFNodeStreamSink = 754, 14 | ME_MFNodeByteStreamHandler = 755, 15 | ME_MFNodeByteStreamHandler2 = 756, 16 | ME_MFNodeSampleRequest = 757 17 | }; 18 | 19 | #endif -------------------------------------------------------------------------------- /Common/MFOperationQueue.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFOperationQueue.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef MFOPERATIONQUEUE_H 5 | #define MFOPERATIONQUEUE_H 6 | 7 | template class CMFOperationQueue : public IUnknown{ 8 | 9 | public: 10 | 11 | typedef ComPtrList OpList; 12 | 13 | HRESULT QueueOperation(OP_TYPE* pOp){ 14 | 15 | HRESULT hr = S_OK; 16 | 17 | AutoLock lock(m_CriticSection); 18 | 19 | hr = m_OpQueue.InsertBack(pOp); 20 | 21 | if(SUCCEEDED(hr)){ 22 | hr = ProcessQueue(); 23 | } 24 | return hr; 25 | } 26 | 27 | protected: 28 | 29 | HRESULT ProcessQueue(){ 30 | 31 | HRESULT hr = S_OK; 32 | 33 | if(m_OpQueue.GetCount() > 0){ 34 | hr = MFPutWorkItem(MFASYNC_CALLBACK_QUEUE_STANDARD, &m_OnProcessQueue, NULL); 35 | } 36 | return hr; 37 | } 38 | 39 | HRESULT ProcessQueueAsync(IMFAsyncResult*){ 40 | 41 | HRESULT hr = S_OK; 42 | 43 | AutoLock lock(m_CriticSection); 44 | 45 | if(m_OpQueue.GetCount() > 0){ 46 | 47 | OP_TYPE* pOp = NULL; 48 | 49 | try{ 50 | 51 | IF_FAILED_THROW(hr = m_OpQueue.GetFront(&pOp)); 52 | 53 | IF_FAILED_THROW(hr = ValidateOperation(pOp)); 54 | 55 | IF_FAILED_THROW(hr = m_OpQueue.RemoveFront(NULL)); 56 | 57 | (void)DispatchOperation(pOp); 58 | } 59 | catch(HRESULT){} 60 | 61 | SAFE_RELEASE(pOp); 62 | } 63 | 64 | return hr; 65 | } 66 | 67 | virtual HRESULT DispatchOperation(OP_TYPE*) = 0; 68 | virtual HRESULT ValidateOperation(OP_TYPE*) = 0; 69 | 70 | CMFOperationQueue(CriticSection& critsec) : m_OnProcessQueue(this, &CMFOperationQueue::ProcessQueueAsync), m_CriticSection(critsec){} 71 | virtual ~CMFOperationQueue(){} 72 | 73 | protected: 74 | 75 | OpList m_OpQueue; 76 | CriticSection& m_CriticSection; 77 | 78 | CAsyncCallback m_OnProcessQueue; 79 | }; 80 | 81 | #endif -------------------------------------------------------------------------------- /Common/MFReadParam.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFReadParam.h 3 | // Copyright (C) 2014 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #ifndef MFREADPARAM_H 19 | #define MFREADPARAM_H 20 | 21 | class CMFReadParam : public IUnknown{ 22 | 23 | public: 24 | 25 | CMFReadParam(BYTE* pData, ULONG ulToRead) : m_nRefCount(1), m_pData(pData), m_ulToRead(ulToRead){} 26 | CMFReadParam() : m_nRefCount(1), m_pData(NULL), m_ulToRead(0){} 27 | 28 | STDMETHODIMP QueryInterface(REFIID riid, void** ppv){ 29 | 30 | static const QITAB qit[] = { 31 | QITABENT(CMFReadParam, IUnknown), 32 | {0} 33 | }; 34 | 35 | return QISearch(this, qit, riid, ppv); 36 | } 37 | 38 | STDMETHODIMP_(ULONG) AddRef(){ return InterlockedIncrement(&m_nRefCount); } 39 | 40 | STDMETHODIMP_(ULONG) Release(){ 41 | 42 | LONG cRef = InterlockedDecrement(&m_nRefCount); 43 | 44 | if(cRef == 0){ 45 | delete this; 46 | } 47 | return cRef; 48 | } 49 | 50 | BYTE* GetDataPtr(){ return m_pData; } 51 | ULONG GetByteToRead(){ return m_ulToRead; } 52 | DWORD* GetpByteRead(){ return &m_dwRead; } 53 | DWORD GetByteRead(){ return m_dwRead; } 54 | 55 | void SetDataPtr(BYTE* pData){ m_pData = pData; } 56 | void SetByteToRead(ULONG ulToRead){ m_ulToRead = ulToRead; } 57 | 58 | private: 59 | 60 | volatile long m_nRefCount; 61 | 62 | BYTE* m_pData; 63 | ULONG m_ulToRead; 64 | DWORD m_dwRead; 65 | }; 66 | 67 | #endif -------------------------------------------------------------------------------- /Common/MFSafeQueue.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFSafeQueue.h 3 | // Copyright (C) 2014 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #ifndef MFSAFEQUEUE_H 19 | #define MFSAFEQUEUE_H 20 | 21 | class CMFSafeQueue{ 22 | 23 | public: 24 | 25 | CMFSafeQueue(){} 26 | ~CMFSafeQueue(){} 27 | 28 | void PushSample(IMFSample* pSample){ 29 | 30 | assert(pSample); 31 | 32 | AutoLock lock(m_CriticSection); 33 | 34 | m_qVideoSample.push(pSample); 35 | pSample->AddRef(); 36 | } 37 | 38 | HRESULT GetSampleNoAddRef(IMFSample** ppSample){ 39 | 40 | assert(ppSample); 41 | 42 | AutoLock lock(m_CriticSection); 43 | 44 | HRESULT hr; 45 | 46 | if(m_qVideoSample.empty()){ 47 | hr = S_FALSE; 48 | } 49 | else{ 50 | 51 | *ppSample = m_qVideoSample.front(); 52 | hr = S_OK; 53 | } 54 | 55 | return hr; 56 | } 57 | 58 | void PopSample(){ 59 | 60 | AutoLock lock(m_CriticSection); 61 | 62 | if(m_qVideoSample.empty()){ 63 | return; 64 | } 65 | 66 | IMFSample* pSample = m_qVideoSample.front(); 67 | SAFE_RELEASE(pSample); 68 | m_qVideoSample.pop(); 69 | } 70 | 71 | void ReleaseQueue(){ 72 | 73 | AutoLock lock(m_CriticSection); 74 | 75 | IMFSample* pSample = NULL; 76 | 77 | while(!m_qVideoSample.empty()){ 78 | 79 | pSample = m_qVideoSample.front(); 80 | SAFE_RELEASE(pSample); 81 | m_qVideoSample.pop(); 82 | } 83 | } 84 | 85 | const UINT32 GetSize() const{ return m_qVideoSample.size(); } 86 | 87 | private: 88 | 89 | CriticSection m_CriticSection; 90 | 91 | queue m_qVideoSample; 92 | }; 93 | 94 | #endif -------------------------------------------------------------------------------- /Common/MFTExternTrace.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFTExternTrace.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef MFTEXTERNTRACE_H 5 | #define MFTEXTERNTRACE_H 6 | 7 | // CExternTrace initializes the memory leaks detection (see "crtdbg.h"). 8 | // CExternTrace ensures that no object is allocated before TRACE_INIT is called. 9 | // Because DllMain.cpp contains external objects, you will see "FAKE" memory leaks. 10 | #ifdef _DEBUG 11 | 12 | class CExternTrace{ 13 | 14 | public: 15 | 16 | CExternTrace(){ TRACE_INIT(); }; 17 | ~CExternTrace(){ TRACE_CLOSE(); }; 18 | }; 19 | 20 | CExternTrace cExternTrace; 21 | 22 | #endif 23 | 24 | #endif -------------------------------------------------------------------------------- /Common/MFTime.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFTime.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef MFTIME_H 5 | #define MFTIME_H 6 | 7 | // One second in hns 8 | const MFTIME ONE_SECOND = 10000000; 9 | 10 | // One msec in hns 11 | const LONG ONE_MSEC = 1000; 12 | 13 | inline LONG MFTimeToMilliSec(const LONGLONG& time){ 14 | 15 | return (LONG)(time / (ONE_SECOND / ONE_MSEC)); 16 | } 17 | 18 | inline LONG MFTimeToSec(const LONGLONG& time){ 19 | 20 | return (LONG)(time / ONE_SECOND); 21 | } 22 | 23 | #if (_DEBUG && MF_USE_LOGGING) 24 | 25 | inline void MFTimeString(const MFTIME& Duration){ 26 | 27 | MFTIME DurationInSec = 0; 28 | MFTIME Hours = 0; 29 | MFTIME Minutes = 0; 30 | MFTIME Seconds = 0; 31 | 32 | DurationInSec = (MFTIME)Duration / 10000000; 33 | 34 | if(DurationInSec > 60){ 35 | 36 | Minutes = DurationInSec / 60; 37 | 38 | if(Minutes > 60){ 39 | 40 | Hours = Minutes / 60; 41 | Minutes = Minutes % 60; 42 | } 43 | 44 | Seconds = (DurationInSec % 60); 45 | } 46 | else{ 47 | 48 | Seconds = DurationInSec; 49 | } 50 | 51 | TRACE((L"%02dh:%02dmn:%02ds:%03dms\n", (int)Hours, (int)Minutes, (int)Seconds, MFTimeToMilliSec(Duration) & 0x0000ffff)); 52 | } 53 | 54 | #else 55 | #define MFTimeString(x) 56 | #endif 57 | 58 | #endif -------------------------------------------------------------------------------- /LibA52Audio/LibA52Audio.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Fichiers d%27en-tête 20 | 21 | 22 | Fichiers d%27en-tête 23 | 24 | 25 | Fichiers d%27en-tête 26 | 27 | 28 | Fichiers d%27en-tête 29 | 30 | 31 | Fichiers d%27en-tête 32 | 33 | 34 | Fichiers d%27en-tête 35 | 36 | 37 | 38 | 39 | Fichiers sources 40 | 41 | 42 | Fichiers sources 43 | 44 | 45 | Fichiers sources 46 | 47 | 48 | Fichiers sources 49 | 50 | 51 | Fichiers sources 52 | 53 | 54 | -------------------------------------------------------------------------------- /LibA52Audio/a52.h: -------------------------------------------------------------------------------- 1 | /* 2 | * a52.h 3 | * Copyright (C) 2000-2002 Michel Lespinasse 4 | * Copyright (C) 1999-2000 Aaron Holtzman 5 | * 6 | * This file is part of a52dec, a free ATSC A-52 stream decoder. 7 | * See http://liba52.sourceforge.net/ for updates. 8 | * 9 | * a52dec is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * a52dec is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | */ 23 | 24 | #ifndef A52_H 25 | #define A52_H 26 | 27 | #ifndef LIBA52_DOUBLE 28 | typedef float sample_t; 29 | #else 30 | typedef double sample_t; 31 | #endif 32 | 33 | typedef struct a52_state_s a52_state_t; 34 | 35 | #define A52_CHANNEL 0 36 | #define A52_MONO 1 37 | #define A52_STEREO 2 38 | #define A52_3F 3 39 | #define A52_2F1R 4 40 | #define A52_3F1R 5 41 | #define A52_2F2R 6 42 | #define A52_3F2R 7 43 | #define A52_CHANNEL1 8 44 | #define A52_CHANNEL2 9 45 | #define A52_DOLBY 10 46 | #define A52_CHANNEL_MASK 15 47 | 48 | #define A52_LFE 16 49 | #define A52_ADJUST_LEVEL 32 50 | 51 | a52_state_t* a52_init(); 52 | sample_t* a52_samples(a52_state_t* state); 53 | int a52_syncinfo(uint8_t* buf, int* flags, int* sample_rate, int* bit_rate); 54 | int a52_frame(a52_state_t* state, uint8_t* buf, int* flags, sample_t* level, sample_t bias); 55 | void a52_dynrng(a52_state_t* state, sample_t(*call)(sample_t, void*), void* data); 56 | void a52_dynrngsetlevel(a52_state_t* state, sample_t compressionlevel); 57 | int a52_block(a52_state_t* state); 58 | void a52_free(a52_state_t* state); 59 | 60 | #endif /* A52_H */ 61 | -------------------------------------------------------------------------------- /LibA52Audio/bitstream.h: -------------------------------------------------------------------------------- 1 | /* 2 | * bitstream.h 3 | * Copyright (C) 2000-2003 Michel Lespinasse 4 | * Copyright (C) 1999-2000 Aaron Holtzman 5 | * 6 | * This file is part of a52dec, a free ATSC A-52 stream decoder. 7 | * See http://liba52.sourceforge.net/ for updates. 8 | * 9 | * a52dec is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * a52dec is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | */ 23 | 24 | /* (stolen from the kernel) */ 25 | #ifdef WORDS_BIGENDIAN 26 | 27 | # define swab32(x) (x) 28 | 29 | #else 30 | 31 | # if 0 && defined (__i386__) 32 | 33 | # define swab32(x) __i386_swab32(x) 34 | static inline const uint32_t __i386_swab32(uint32_t x) 35 | { 36 | __asm__("bswap %0" : "=r" (x) : "0" (x)); 37 | return x; 38 | } 39 | 40 | # else 41 | 42 | # define swab32(x)\ 43 | ((((uint8_t*)&x)[0] << 24) | (((uint8_t*)&x)[1] << 16) | \ 44 | (((uint8_t*)&x)[2] << 8) | (((uint8_t*)&x)[3])) 45 | 46 | # endif 47 | #endif 48 | 49 | void a52_bitstream_set_ptr (a52_state_t * state, uint8_t * buf); 50 | uint32_t a52_bitstream_get_bh (a52_state_t * state, uint32_t num_bits); 51 | int32_t a52_bitstream_get_bh_2 (a52_state_t * state, uint32_t num_bits); 52 | 53 | static inline uint32_t bitstream_get (a52_state_t * state, uint32_t num_bits) 54 | { 55 | uint32_t result; 56 | 57 | if (num_bits < state->bits_left) { 58 | result = (state->current_word << (32 - state->bits_left)) >> (32 - num_bits); 59 | state->bits_left -= num_bits; 60 | return result; 61 | } 62 | 63 | return a52_bitstream_get_bh (state, num_bits); 64 | } 65 | 66 | static inline int32_t bitstream_get_2 (a52_state_t * state, uint32_t num_bits) 67 | { 68 | int32_t result; 69 | 70 | if (num_bits < state->bits_left) { 71 | result = (((int32_t)state->current_word) << (32 - state->bits_left)) >> (32 - num_bits); 72 | state->bits_left -= num_bits; 73 | return result; 74 | } 75 | 76 | return a52_bitstream_get_bh_2 (state, num_bits); 77 | } 78 | -------------------------------------------------------------------------------- /LibA52Audio/inttypes.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // inttypes.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef INTTYPES_H 5 | #define INTTYPES_H 6 | 7 | typedef signed char int8_t; 8 | typedef signed short int16_t; 9 | typedef signed int int32_t; 10 | 11 | typedef unsigned char uint8_t; 12 | typedef unsigned short uint16_t; 13 | typedef unsigned int uint32_t; 14 | 15 | #endif -------------------------------------------------------------------------------- /LibMpeg2/alloc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * alloc.c 3 | * Copyright (C) 2000-2003 Michel Lespinasse 4 | * Copyright (C) 1999-2000 Aaron Holtzman 5 | * 6 | * This file is part of mpeg2dec, a free MPEG-2 video stream decoder. 7 | * See http://libmpeg2.sourceforge.net/ for updates. 8 | * 9 | * mpeg2dec is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * mpeg2dec is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | */ 23 | 24 | #include 25 | 26 | #include "inttypes.h" 27 | #include "mpeg2.h" 28 | 29 | static void * (* malloc_hook) (unsigned size, mpeg2_alloc_t reason) = NULL; 30 | static int (* free_hook) (void * buf) = NULL; 31 | 32 | void * mpeg2_malloc (unsigned size, mpeg2_alloc_t reason) 33 | { 34 | char * buf; 35 | 36 | if (malloc_hook) { 37 | buf = (char *) malloc_hook (size, reason); 38 | if (buf) 39 | return buf; 40 | } 41 | 42 | if (size) { 43 | buf = (char *) malloc (size + 63 + sizeof (void **)); 44 | if (buf) { 45 | char * align_buf; 46 | 47 | align_buf = buf + 63 + sizeof (void **); 48 | align_buf -= (long)align_buf & 63; 49 | *(((void **)align_buf) - 1) = buf; 50 | return align_buf; 51 | } 52 | } 53 | return NULL; 54 | } 55 | 56 | void mpeg2_free (void * buf) 57 | { 58 | if (free_hook && free_hook (buf)) 59 | return; 60 | 61 | if (buf) 62 | free (*(((void **)buf) - 1)); 63 | } 64 | 65 | void mpeg2_malloc_hooks (void * alloc_func (unsigned, mpeg2_alloc_t), 66 | int free_func (void *)) 67 | { 68 | malloc_hook = alloc_func; 69 | free_hook = free_func; 70 | } 71 | -------------------------------------------------------------------------------- /LibMpeg2/attributes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * attributes.h 3 | * Copyright (C) 2000-2003 Michel Lespinasse 4 | * Copyright (C) 1999-2000 Aaron Holtzman 5 | * 6 | * This file is part of mpeg2dec, a free MPEG-2 video stream decoder. 7 | * See http://libmpeg2.sourceforge.net/ for updates. 8 | * 9 | * mpeg2dec is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * mpeg2dec is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | */ 23 | 24 | #ifndef LIBMPEG2_ATTRIBUTES_H 25 | #define LIBMPEG2_ATTRIBUTES_H 26 | 27 | /* use gcc attribs to align critical data structures */ 28 | #ifdef ATTRIBUTE_ALIGNED_MAX 29 | #define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align))) 30 | #else 31 | #define ATTR_ALIGN(align) 32 | #endif 33 | 34 | #ifdef HAVE_BUILTIN_EXPECT 35 | #define likely(x) __builtin_expect ((x) != 0, 1) 36 | #define unlikely(x) __builtin_expect ((x) != 0, 0) 37 | #else 38 | #define likely(x) (x) 39 | #define unlikely(x) (x) 40 | #endif 41 | 42 | #endif /* LIBMPEG2_ATTRIBUTES_H */ 43 | -------------------------------------------------------------------------------- /LibMpeg2/cpu_accel.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/LibMpeg2/cpu_accel.obj -------------------------------------------------------------------------------- /LibMpeg2/cpu_state.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/LibMpeg2/cpu_state.obj -------------------------------------------------------------------------------- /LibMpeg2/idct_mmx.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/LibMpeg2/idct_mmx.obj -------------------------------------------------------------------------------- /LibMpeg2/inttypes.h: -------------------------------------------------------------------------------- 1 | typedef signed char int8_t; 2 | typedef signed short int16_t; 3 | typedef signed int int32_t; 4 | 5 | typedef unsigned char uint8_t; 6 | typedef unsigned short uint16_t; 7 | typedef unsigned int uint32_t; 8 | -------------------------------------------------------------------------------- /LibMpeg2/motion_comp_mmx.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/LibMpeg2/motion_comp_mmx.obj -------------------------------------------------------------------------------- /LibMpegAudio/LibMpegAudio.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Fichiers d%27en-tête 20 | 21 | 22 | Fichiers d%27en-tête 23 | 24 | 25 | Fichiers d%27en-tête 26 | 27 | 28 | Fichiers d%27en-tête 29 | 30 | 31 | Fichiers d%27en-tête 32 | 33 | 34 | Fichiers d%27en-tête 35 | 36 | 37 | 38 | 39 | Fichiers sources 40 | 41 | 42 | Fichiers sources 43 | 44 | 45 | Fichiers sources 46 | 47 | 48 | -------------------------------------------------------------------------------- /LibMpegAudio/Mpeg12Decoder.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------------------------- 2 | // Mp2Decoder.h 3 | // Copyright (C) 2013 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | 18 | // This program use lipmp2dec and libmpeg123 source code : 19 | // https://sourceforge.net/projects/libmp2codec/ 20 | // http://www.mpg123.de/ 21 | //---------------------------------------------------------------------------------------------- 22 | #ifndef MPEG12DECODER_H 23 | #define MPEG12DECODER_H 24 | 25 | class CMpeg12Decoder{ 26 | 27 | public: 28 | 29 | CMpeg12Decoder(){} 30 | ~CMpeg12Decoder(){} 31 | 32 | void Initialize(); 33 | HRESULT DecodeFrame(BYTE*, const UINT, UINT*, short*, UINT*); 34 | 35 | private: 36 | 37 | int mpa_decode_header(MPADecodeContext*, unsigned int); 38 | int check_header(unsigned int); 39 | int decode_header(MPADecodeContext*, unsigned int); 40 | int mp_decode_frame(MPADecodeContext*, short*); 41 | int mp_decode_layer1(MPADecodeContext*); 42 | int mp_decode_layer2(MPADecodeContext*); 43 | void synth_filter(MPADecodeContext*, int, short*, int, int sb_samples[SBLIMIT]); 44 | int l1_unscale(int, int, int); 45 | int l2_unscale_group(int, int, int); 46 | void dct32(int*, int*); 47 | 48 | // Mpeg12Decoder_Bits.cpp 49 | void init_get_bits(GetBitContext*, unsigned char*, int); 50 | unsigned int get_bits(GetBitContext*, int); 51 | 52 | MPADecodeContext m_ctx; 53 | }; 54 | 55 | #endif -------------------------------------------------------------------------------- /LibMpegAudio/Mpeg12DecoderVersion.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // Mpeg12DecoderVersion.h 3 | //-------------------------------------------------------------------------------------- 4 | #ifndef MPEG12DECODERVERSION_H 5 | #define MPEG12DECODERVERSION_H 6 | 7 | #define MPEG12_MAJOR_VERSION 1 8 | #define MPEG12_MINUS_VERSION 0 9 | #define MPEG12_MAJOR_BUGVERSION 0 10 | #define MPEG12_MINUS_BUGVERSION 0 11 | 12 | #define SZMPEG12_VERSION "1.0.0.0" 13 | #define SZMPEG12_COMPANY "MFNode Project : by Dumonteil David" 14 | #define SZMPEG12_DESCRIPTION "Mp1-Mp2 Decoder Library" 15 | #define SZMPEG12_DLLNAME "Mp2AudioDecoder.lib" 16 | #define SZMPEG12_COPYRIGHT "Copyright (C) 2013 Dumonteil David" 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /LibMpegAudio/Mpeg12LibDefinition.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------------------------- 2 | // Mpeg12LibDefinition.h 3 | // Copyright (C) 2013 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | 18 | // This program use lipmp2dec and libmpeg123 source code : 19 | // https://sourceforge.net/projects/libmp2codec/ 20 | // http://www.mpg123.de/ 21 | //---------------------------------------------------------------------------------------------- 22 | #ifndef MPEG12LIBDEFINITION_H 23 | #define MPEG12LIBDEFINITION_H 24 | 25 | // max compressed frame size 26 | #define MPA_MAX_CODED_FRAME_SIZE 1792 27 | #define MPA_MAX_CHANNELS 2 28 | #define MAX_AUDIO_BUFFER_SIZE 4608 29 | 30 | #define BACKSTEP_SIZE 512 31 | 32 | // number of subbands 33 | #define SBLIMIT 32 34 | 35 | // fractional bits for sb_samples and dct 36 | #define FRAC_BITS 15 37 | 38 | #if FRAC_BITS <= 15 39 | typedef short MPA_INT; 40 | #else 41 | typedef int MPA_INT; 42 | #endif 43 | 44 | struct GetBitContext{ 45 | 46 | const unsigned char* buffer; 47 | const unsigned char* buffer_end; 48 | unsigned char* buffer_ptr; 49 | unsigned int cache; 50 | int bit_count; 51 | int size_in_bits; 52 | }; 53 | 54 | struct MPADecodeContext{ 55 | 56 | int bit_rate; 57 | int nb_channels; 58 | int sample_rate; 59 | int sample_rate_index; // between 0 and 8 60 | int lsf; 61 | int mode; 62 | int mode_ext; 63 | int error_protection; 64 | int layer; 65 | int frame_size; 66 | 67 | // input buffer 68 | unsigned char inbuf1[2][MPA_MAX_CODED_FRAME_SIZE + BACKSTEP_SIZE]; 69 | int inbuf_index; 70 | unsigned char* inbuf_ptr; 71 | unsigned char* inbuf; 72 | 73 | int sb_samples[MPA_MAX_CHANNELS][36][SBLIMIT]; 74 | 75 | int synth_buf_offset[MPA_MAX_CHANNELS]; 76 | 77 | MPA_INT synth_buf[MPA_MAX_CHANNELS][512 * 2]; 78 | 79 | GetBitContext gb; 80 | }; 81 | 82 | #endif -------------------------------------------------------------------------------- /LibMpegAudio/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.cpp 3 | //---------------------------------------------------------------------------------------------- 4 | #include "StdAfx.h" -------------------------------------------------------------------------------- /LibMpegAudio/StdAfx.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef STDAFX_H 5 | #define STDAFX_H 6 | 7 | #pragma once 8 | #define WIN32_LEAN_AND_MEAN 9 | #define STRICT 10 | 11 | //---------------------------------------------------------------------------------------------- 12 | // Microsoft Windows SDK for Windows 7 13 | #include 14 | #include 15 | 16 | //---------------------------------------------------------------------------------------------- 17 | // Project Files 18 | #include "Mpeg12LibDefinition.h" 19 | #include "Mpeg12LibInternal.h" 20 | #include "Mpeg12Decoder.h" 21 | 22 | #endif -------------------------------------------------------------------------------- /MFNodePlayer/MFNodeForm.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFNodeForm.h 3 | // Copyright (C) 2013 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #ifndef MFNODEFORM_H 19 | #define MFNODEFORM_H 20 | 21 | class CMFNodeForm{ 22 | 23 | public: 24 | 25 | CMFNodeForm(); 26 | ~CMFNodeForm(); 27 | 28 | // MFNodeForm.cpp 29 | HRESULT InitForm(const HINSTANCE); 30 | // MFNodeForm_Event.cpp 31 | LRESULT CALLBACK MFNodeFormProc(HWND, UINT, WPARAM, LPARAM); 32 | 33 | // inline 34 | static CMFNodeForm* GetMFNodeForm(){ return m_pCMFNodeForm; } 35 | 36 | private: 37 | 38 | static CMFNodeForm* m_pCMFNodeForm; 39 | CMFNodePlayer* m_pPlayer; 40 | CMFControlManager m_cMFControlManager; 41 | 42 | HINSTANCE m_hInst; 43 | HWND m_hWnd; 44 | BOOL m_bRepaintVideo; 45 | BOOL m_bWaiting; 46 | BOOL m_bSetCursor; 47 | HBRUSH m_hBackGround; 48 | 49 | WCHAR m_wszFile1[MAX_PATH]; 50 | 51 | // MFNodeForm.cpp 52 | HRESULT OpenWaveMixer(); 53 | HRESULT OpenSession(const CURRENT_SESSION); 54 | HRESULT OpenSequencer(); 55 | HRESULT OpenFreeSession(const WCHAR*); 56 | HRESULT CloseSession(); 57 | void AddMediaFileToEdit(const int); 58 | void EnableSessionControls(const BOOL); 59 | void EnableControls(const BOOL); 60 | BOOL CheckWaveFile(const WCHAR*, const WCHAR*); 61 | void MFNodeCheck(); 62 | void UpdateDxva2Bar(); 63 | 64 | // MFNodeForm_Event.cpp 65 | void OnExit(); 66 | void OnHorizontalScroll(const HWND); 67 | void ResizeVideo(const WORD, const WORD); 68 | void OnSpaceBar(); 69 | void OnPlayerEvent(WPARAM, LPARAM); 70 | void OnPaint(const HWND); 71 | BOOL OnCommand(const DWORD); 72 | void OnDrop(WPARAM); 73 | 74 | #ifdef TEST_CUDA_DECODER 75 | HRESULT OpenCudaTestSession(const WCHAR*); 76 | #elif defined TEST_DXVA2_DECODER 77 | HRESULT OpenDxva2TestSession(const WCHAR*); 78 | #endif 79 | }; 80 | 81 | #endif -------------------------------------------------------------------------------- /MFNodePlayer/MFNodePlayer.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFNodePlayer/MFNodePlayer.rc -------------------------------------------------------------------------------- /MFNodePlayer/MFNodePlayerVersion.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // MFNodePlayerVersion.h 3 | //-------------------------------------------------------------------------------------- 4 | #ifndef MFNODEPLAYERVERSION_H 5 | #define MFNODEPLAYERVERSION_H 6 | 7 | #define MFP_MAJOR_VERSION 1 8 | #define MFP_MINUS_VERSION 11 9 | #define MFP_MAJOR_BUGVERSION 3 10 | #define MFP_MINUS_BUGVERSION 3 11 | 12 | #define SZMFP_VERSION "1.11.3.3" 13 | #define SZMFP_COMPANY "MFNode Project : by Dumonteil David" 14 | #define SZMFP_DESCRIPTION "Media Foundation Player" 15 | #define SZMFP_DLLNAME "MFNodePlayer.exe" 16 | #define SZMFP_COPYRIGHT "Copyright (C) 2013 Dumonteil David" 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /MFNodePlayer/MFNodePlayer_definition.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFNodePlayer_definition.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef MFNODEPLAYER_DEFINITION_H 5 | #define MFNODEPLAYER_DEFINITION_H 6 | 7 | #define MFNODE_CLASS L"MFNode Player" 8 | 9 | const UINT WM_APP_PLAYER_EVENT = WM_APP + 1; 10 | 11 | enum CURRENT_SESSION{ 12 | 13 | SESSION_NONE, 14 | SESSION_SCREENSHOT, 15 | SESSION_HTTP, 16 | SESSION_FLV, 17 | SESSION_WAVEMIXER, 18 | SESSION_RENDERER, 19 | SESSION_SEQUENCER, 20 | SESSION_AVCAPTURE, 21 | SESSION_DXVA2 22 | }; 23 | 24 | enum CUDA_DECODER{ 25 | 26 | CUDA_DECODER_NONE, 27 | CUDA_DECODER_CUDA 28 | }; 29 | 30 | enum SHADER_COLOR{ SHADER_COLOR_ORIGINAL, SHADER_COLOR_RED, SHADER_COLOR_GREEN, SHADER_COLOR_BLUE }; 31 | 32 | enum CHILD_CONTROL{ 33 | 34 | CHILD_EDIT_WAVE1, 35 | CHILD_EDIT_WAVE2, 36 | CHILD_EDIT_FLV, 37 | CHILD_EDIT_RENDERER, 38 | CHILD_EDIT_VIDEO1, 39 | CHILD_EDIT_VIDEO2, 40 | CHILD_EDIT_MPEG, 41 | CHILD_BUTTON_WAVE1, 42 | CHILD_BUTTON_WAVE2, 43 | CHILD_BUTTON_FLV, 44 | CHILD_BUTTON_RENDERER, 45 | CHILD_BUTTON_VIDEO1, 46 | CHILD_BUTTON_VIDEO2, 47 | CHILD_BUTTON_MPEG, 48 | CHILD_GROUPBOX, 49 | CHILD_CHECK_REVERSE_X, 50 | CHILD_CHECK_REVERSE_Y, 51 | CHILD_CHECK_NEGATIF, 52 | CHILD_CHECK_GRAY, 53 | CHILD_CHECK_GRAYSCALE, 54 | CHILD_RADIO_COLOR, 55 | CHILD_RADIO_RED, 56 | CHILD_RADIO_GREEN, 57 | CHILD_RADIO_BLUE, 58 | CHILD_RADIO_NOCUDA, 59 | CHILD_RADIO_CUDA, 60 | CHILD_TRACKBAR_CONTRAST, 61 | CHILD_TRACKBAR_SATURATION, 62 | CHILD_TRACKBAR_DXVA2_BRIGHTNESS, 63 | CHILD_TRACKBAR_DXVA2_HUE, 64 | CHILD_TRACKBAR_DXVA2_CONTRAST, 65 | CHILD_TRACKBAR_DXVA2_SATURATION, 66 | CHILD_TRACKBAR_DXVA2_NOISE, 67 | CHILD_TRACKBAR_DXVA2_EDGE, 68 | CHILD_TRACKBAR_DXVA2_ANAMORPHIC, 69 | CHILD_END 70 | }; 71 | 72 | #endif -------------------------------------------------------------------------------- /MFNodePlayer/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // Stdafx.cpp 3 | //---------------------------------------------------------------------------------------------- 4 | #include "Stdafx.h" -------------------------------------------------------------------------------- /MFNodePlayer/ToDo.txt: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // ToDo 3 | //---------------------------------------------------------------------------------------------- 4 | 5 | - MFNodePlayer handles session state. It should handle player state, and wave mixer session should handle session state. 6 | 7 | - WaveMixerSession does not handle correctly critic section. A lot are missing and with session state, it will be better 8 | to handle things correctly. 9 | 10 | - Pause to Play with flv session is very long to restart. I think a problem with Flv Source. 11 | 12 | - Need to understand what is MF_E_MULTIPLE_BEGIN. It sometimes happens (perhaps because of macro). -------------------------------------------------------------------------------- /MFNodePlayer/WinMain.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // WinMain.cpp 3 | // Copyright (C) 2013 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #include "Stdafx.h" 19 | 20 | int WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR, int){ 21 | 22 | CMFNodeForm cMFNodeForm; 23 | 24 | if(FAILED(cMFNodeForm.InitForm(hInst))) 25 | return -1; 26 | 27 | MSG msg; 28 | ZeroMemory(&msg, sizeof(MSG)); 29 | 30 | while(GetMessage(&msg, NULL, 0, 0) > 0){ 31 | 32 | TranslateMessage(&msg); 33 | DispatchMessage(&msg); 34 | } 35 | 36 | return static_cast(msg.wParam); 37 | } -------------------------------------------------------------------------------- /MFNodePlayer/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFNodePlayer/resource.h -------------------------------------------------------------------------------- /MFSkDxva2Renderer/Dxva2Manager.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // Dxva2Manager.h 3 | // Copyright (C) 2014 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #ifndef DXVA2MANAGER_H 19 | #define DXVA2MANAGER_H 20 | 21 | class CDxva2Manager{ 22 | 23 | public: 24 | 25 | CDxva2Manager(); 26 | ~CDxva2Manager(){ ReleaseDxva2(); } 27 | 28 | HRESULT InitDxva2(const UINT32, const UINT32, const UINT32, const D3DFORMAT); 29 | void ReleaseDxva2(); 30 | HRESULT OnFrameMove(IMFSample*); 31 | HRESULT OnFrameRender(); 32 | 33 | HRESULT SetProcAmp(const DXVAHD_FILTER, const BOOL, const INT); 34 | HRESULT GetProcAmp(const DXVAHD_FILTER, BOOL*, INT*, INT*, INT*); 35 | 36 | static DWORD WINAPI StaticThreadProc(LPVOID); 37 | 38 | private: 39 | 40 | IDXVAHD_Device * m_pDXVAHD; 41 | IDXVAHD_VideoProcessor* m_pDXVAVP; 42 | 43 | IDirect3D9Ex* m_pD3D9; 44 | IDirect3DDevice9Ex* m_pDevice9; 45 | IDirect3DSurface9* m_pSurface9; 46 | 47 | HWND m_hWnd; 48 | UINT m_uiFrameIndex; 49 | 50 | UINT32 m_uiWidth; 51 | UINT32 m_uiHeight; 52 | UINT32 m_uiStride; 53 | UINT32 m_uiYuvHeight; 54 | D3DFORMAT m_VideoFmt; 55 | 56 | HANDLE m_hRendererThread; 57 | HANDLE m_hThreadReadyEvent; 58 | DWORD m_dwThreadID; 59 | 60 | struct PROCAMP{ 61 | 62 | DXVAHD_FILTER_RANGE_DATA Range; 63 | DXVAHD_STREAM_STATE_FILTER_DATA FilterState; 64 | DXVAHD_FILTER Filter; 65 | DXVAHD_STREAM_STATE Stream; 66 | BOOL bSupported; 67 | }; 68 | 69 | PROCAMP m_ProcAmp[7]; 70 | 71 | BOOL InitWindow(const UINT32, const UINT32); 72 | HRESULT InitDevice9(); 73 | HRESULT InitVideoProcessor(); 74 | void GetProcAmpData(const DXVAHD_VPDEVCAPS&); 75 | HRESULT ConfigureVideoProcessor(); 76 | HRESULT FillTextureWithBlack(); 77 | }; 78 | 79 | #endif -------------------------------------------------------------------------------- /MFSkDxva2Renderer/Dxva2RendererSettings.idl: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // Dxva2RendererSettings.idl 3 | //-------------------------------------------------------------------------------------- 4 | import "unknwn.idl"; 5 | 6 | interface IMFDxva2RendererSettings; 7 | 8 | //-------------------------------------------------------------------------------------- 9 | // IMFDxva2RendererSettings 10 | //-------------------------------------------------------------------------------------- 11 | [local, object, uuid(F89DFD98-7E7A-43B2-BDD3-9071472CBB8B), 12 | helpstring("IMFDxva2RendererSettings Interface"), pointer_default(unique)] 13 | 14 | interface IMFDxva2RendererSettings : IUnknown{ 15 | 16 | HRESULT SetBrightness([in] BOOL, [in] INT); 17 | HRESULT GetBrightness([out] BOOL*, [out] INT*, [out] INT*, [out] INT*); 18 | HRESULT SetContrast([in] BOOL, [in] INT); 19 | HRESULT GetContrast([out] BOOL*, [out] INT*, [out] INT*, [out] INT*); 20 | HRESULT SetHue([in] BOOL, [in] INT); 21 | HRESULT GetHue([out] BOOL*, [out] INT*, [out] INT*, [out] INT*); 22 | HRESULT SetSaturation([in] BOOL, [in] INT); 23 | HRESULT GetSaturation([out] BOOL*, [out] INT*, [out] INT*, [out] INT*); 24 | HRESULT SetNoiseReduction([in] BOOL, [in] INT); 25 | HRESULT GetNoiseReduction([out] BOOL*, [out] INT*, [out] INT*, [out] INT*); 26 | HRESULT SetEdgeEnhancement([in] BOOL, [in] INT); 27 | HRESULT GetEdgeEnhancement([out] BOOL*, [out] INT*, [out] INT*, [out] INT*); 28 | HRESULT SetAnamorphicScaling([in] BOOL, [in] INT); 29 | HRESULT GetAnamorphicScaling([out] BOOL*, [out] INT*, [out] INT*, [out] INT*); 30 | }; 31 | 32 | //-------------------------------------------------------------------------------------- 33 | // Library and objects 34 | //-------------------------------------------------------------------------------------- 35 | [uuid(30808A08-EEE7-4BD8-9BD9-64343C1DA2D8), version(1.0), helpstring("Dxva2RendererSettings 1.0 Type Library")] 36 | 37 | library Dxva2RendererSettingsLib{ 38 | 39 | // MFDxva2RendererSettings 40 | [uuid(1BA26999-60BF-46F5-84C6-8F2BA53617A1), helpstring("MFDxva2RendererSettings Class")] 41 | 42 | coclass MFDxva2RendererSettings{ [default] interface IMFDxva2RendererSettings; }; 43 | }; -------------------------------------------------------------------------------- /MFSkDxva2Renderer/MFSVersion.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // MFSVersion.h 3 | //-------------------------------------------------------------------------------------- 4 | #ifndef MFSVERSION_H 5 | #define MFSVERSION_H 6 | 7 | #define MFS_MAJOR_VERSION 1 8 | #define MFS_MINUS_VERSION 1 9 | #define MFS_MAJOR_BUGVERSION 0 10 | #define MFS_MINUS_BUGVERSION 0 11 | 12 | #define SZMFS_VERSION "1.1.0.0" 13 | #define SZMFS_COMPANY "MFNode Project : by Dumonteil David" 14 | #define SZMFS_DESCRIPTION "Media Foundation Sink DFxva2 Renderer" 15 | #define SZMFS_DLLNAME "MFSkDxva2Renderer.dll" 16 | #define SZMFS_COPYRIGHT "Copyright (C) 2014 Dumonteil David" 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /MFSkDxva2Renderer/MFSkDxva2Renderer.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | DllCanUnloadNow PRIVATE 3 | DllRegisterServer PRIVATE 4 | DllUnregisterServer PRIVATE 5 | DllGetClassObject PRIVATE 6 | -------------------------------------------------------------------------------- /MFSkDxva2Renderer/MFSkDxva2Renderer.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFSkDxva2Renderer/MFSkDxva2Renderer.rc -------------------------------------------------------------------------------- /MFSkDxva2Renderer/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.cpp 3 | //---------------------------------------------------------------------------------------------- 4 | #include "Stdafx.h" -------------------------------------------------------------------------------- /MFSkDxva2Renderer/StdAfx.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef STDAFX_H 5 | #define STDAFX_H 6 | 7 | #pragma once 8 | #define WIN32_LEAN_AND_MEAN 9 | #define STRICT 10 | 11 | #pragma comment(lib, "winmm") 12 | 13 | //---------------------------------------------------------------------------------------------- 14 | // Microsoft Windows SDK for Windows 7 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | //---------------------------------------------------------------------------------------------- 21 | // Common Project Files 22 | #ifdef _DEBUG 23 | #define MF_USE_LOGGING 1 24 | //#define MF_USE_LOGREFCOUNT 25 | //#define MF_TRACE_SINK 26 | //#define MF_TRACE_STREAM 27 | #else 28 | #define MF_USE_LOGGING 0 29 | #endif 30 | 31 | #include "../Common/MFInclude.h" 32 | 33 | //---------------------------------------------------------------------------------------------- 34 | // Project Files 35 | class CSinkDxva2Renderer; 36 | 37 | extern HMODULE g_hModule; 38 | 39 | #include "Dxva2RendererSettings_h.h" 40 | #include "Dxva2Manager.h" 41 | #include "StreamDxva2Renderer.h" 42 | #include "SinkDxva2Renderer.h" 43 | 44 | #endif -------------------------------------------------------------------------------- /MFSkDxva2Renderer/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFSkDxva2Renderer/resource.h -------------------------------------------------------------------------------- /MFSkImageWriter/MFSVersion.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // MFSVersion.h 3 | //-------------------------------------------------------------------------------------- 4 | #ifndef MFSVERSION_H 5 | #define MFSVERSION_H 6 | 7 | #define MFS_MAJOR_VERSION 1 8 | #define MFS_MINUS_VERSION 1 9 | #define MFS_MAJOR_BUGVERSION 0 10 | #define MFS_MINUS_BUGVERSION 0 11 | 12 | #define SZMFS_VERSION "1.1.0.0" 13 | #define SZMFS_COMPANY "MFNode Project : by Dumonteil David" 14 | #define SZMFS_DESCRIPTION "Image Writer Media Foundation Sink" 15 | #define SZMFS_DLLNAME "MFSkImageWriter.dll" 16 | #define SZMFS_COPYRIGHT "Copyright (C) 2014 Dumonteil David" 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /MFSkImageWriter/MFSkImageWriter.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | DllCanUnloadNow PRIVATE 3 | DllRegisterServer PRIVATE 4 | DllUnregisterServer PRIVATE 5 | DllGetClassObject PRIVATE 6 | -------------------------------------------------------------------------------- /MFSkImageWriter/MFSkImageWriter.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFSkImageWriter/MFSkImageWriter.rc -------------------------------------------------------------------------------- /MFSkImageWriter/SinkImageWriter.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // SinkImageWriter.h 3 | // Copyright (C) 2014 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #ifndef MFSKIMAGEWRITER_H 19 | #define MFSKIMAGEWRITER_H 20 | 21 | class CSkinkImageWriter : BaseObject, public IMFMediaSink, public IMFClockStateSink{ 22 | 23 | public: 24 | 25 | // SinkImageWriter.cpp 26 | static HRESULT CreateInstance(IUnknown*, REFIID, void**); 27 | 28 | // IUnknown - SinkImageWriter.cpp 29 | STDMETHODIMP QueryInterface(REFIID, void**); 30 | STDMETHODIMP_(ULONG) AddRef(); 31 | STDMETHODIMP_(ULONG) Release(); 32 | 33 | // IMFMediaSink - SinkImageWriter_Sink.cpp 34 | STDMETHODIMP GetCharacteristics(DWORD*); 35 | STDMETHODIMP AddStreamSink(DWORD, IMFMediaType*, IMFStreamSink**); 36 | STDMETHODIMP RemoveStreamSink(DWORD); 37 | STDMETHODIMP GetStreamSinkCount(DWORD*); 38 | STDMETHODIMP GetStreamSinkByIndex(DWORD, IMFStreamSink**); 39 | STDMETHODIMP GetStreamSinkById(DWORD, IMFStreamSink**); 40 | STDMETHODIMP SetPresentationClock(IMFPresentationClock*); 41 | STDMETHODIMP GetPresentationClock(IMFPresentationClock**); 42 | STDMETHODIMP Shutdown(); 43 | 44 | // IMFClockStateSink - SinkImageWriter_Clock.cpp 45 | STDMETHODIMP OnClockStart(MFTIME, LONGLONG); 46 | STDMETHODIMP OnClockStop(MFTIME); 47 | STDMETHODIMP OnClockPause(MFTIME); 48 | STDMETHODIMP OnClockRestart(MFTIME); 49 | STDMETHODIMP OnClockSetRate(MFTIME, float); 50 | 51 | private: 52 | 53 | // SinkImageWriter.cpp 54 | CSkinkImageWriter(HRESULT&); 55 | virtual ~CSkinkImageWriter(); 56 | 57 | CriticSection m_CriticSection; 58 | volatile long m_nRefCount; 59 | BOOL m_IsShutdown; 60 | 61 | CStreamImage* m_pStreamImage; 62 | IMFPresentationClock* m_pPresentationClock; 63 | IMFClock* m_pClock; 64 | MFCLOCK_STATE m_ClockState; 65 | 66 | HRESULT CheckShutdown() const{ return (m_IsShutdown ? MF_E_SHUTDOWN : S_OK); } 67 | }; 68 | 69 | #endif -------------------------------------------------------------------------------- /MFSkImageWriter/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.cpp 3 | //---------------------------------------------------------------------------------------------- 4 | #include "Stdafx.h" -------------------------------------------------------------------------------- /MFSkImageWriter/StdAfx.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef STDAFX_H 5 | #define STDAFX_H 6 | 7 | #pragma once 8 | #define WIN32_LEAN_AND_MEAN 9 | #define STRICT 10 | 11 | //---------------------------------------------------------------------------------------------- 12 | // Microsoft Windows SDK for Windows 7 13 | #include 14 | #include 15 | #include 16 | 17 | //---------------------------------------------------------------------------------------------- 18 | // STL 19 | #include 20 | #include 21 | using std::wstring; 22 | using std::wostringstream; 23 | 24 | //---------------------------------------------------------------------------------------------- 25 | // Common Project Files 26 | #ifdef _DEBUG 27 | #define MF_USE_LOGGING 1 28 | //#define MF_USE_LOGREFCOUNT 29 | //#define MF_TRACE_SINK 30 | //#define MF_TRACE_STREAM 31 | #else 32 | #define MF_USE_LOGGING 0 33 | #endif 34 | 35 | #include "../Common/MFInclude.h" 36 | 37 | //---------------------------------------------------------------------------------------------- 38 | // Project Files 39 | class CSkinkImageWriter; 40 | 41 | #include "StreamImage.h" 42 | #include "SinkImageWriter.h" 43 | 44 | #endif -------------------------------------------------------------------------------- /MFSkImageWriter/ToDo.txt: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // ToDo 3 | //---------------------------------------------------------------------------------------------- 4 | 5 | - Handle both RGB24 and RGB32, not only at compilation. -------------------------------------------------------------------------------- /MFSkImageWriter/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFSkImageWriter/resource.h -------------------------------------------------------------------------------- /MFSkJpegHttpStreamer/HttpServer.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // HttpServer.h 3 | // Copyright (C) 2013 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #ifndef HTTPSERVER_H 19 | #define HTTPSERVER_H 20 | 21 | class CHttpServer{ 22 | 23 | public: 24 | 25 | CHttpServer() : m_ListenSocket(INVALID_SOCKET), m_ClientSocket(INVALID_SOCKET), m_bWsaIsInit(FALSE), m_NetState(NETWORK_CLOSE){} 26 | ~CHttpServer(){ Release(); } 27 | 28 | HRESULT Initialize(); 29 | void Release(); 30 | HRESULT SendSample(IMFSample*); 31 | 32 | private: 33 | 34 | SOCKET m_ListenSocket; 35 | SOCKET m_ClientSocket; 36 | BOOL m_bWsaIsInit; 37 | 38 | enum NETWORK_STATE{ NETWORK_CLOSE, NETWORK_LISTEN, NETWORK_READY, NETWORK_ERROR }; 39 | 40 | NETWORK_STATE m_NetState; 41 | 42 | static DWORD WINAPI ListenSocketThread(LPVOID); 43 | void ListenCallBack(NETWORK_STATE State){ m_NetState = State; } 44 | }; 45 | 46 | #endif -------------------------------------------------------------------------------- /MFSkJpegHttpStreamer/Http_Definition.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // Http_Definition.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef HTTP_DEFINITION_H 5 | #define HTTP_DEFINITION_H 6 | 7 | #define DEFAULT_PORT "13754" 8 | #define HTTP_BUFFER_SIZE 512 9 | 10 | #define BOUNDARY "boundarydonotcross" 11 | 12 | #define STD_HEADER "HTTP/1.0 200 OK\r\n" \ 13 | "Connection: close\r\n" \ 14 | "Server: David\r\n" \ 15 | "Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0\r\n" \ 16 | "Pragma: no-cache\r\n" \ 17 | "Content-Type: multipart/x-mixed-replace;boundary=" BOUNDARY "\r\n" \ 18 | "\r\n" \ 19 | "--" BOUNDARY "\r\n" 20 | 21 | #define BOUNDARY_ALL "\r\n--boundarydonotcross\r\n" 22 | 23 | #endif -------------------------------------------------------------------------------- /MFSkJpegHttpStreamer/MFSVersion.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // MFSVersion.h 3 | //-------------------------------------------------------------------------------------- 4 | #ifndef MFSVERSION_H 5 | #define MFSVERSION_H 6 | 7 | #define MFS_MAJOR_VERSION 1 8 | #define MFS_MINUS_VERSION 1 9 | #define MFS_MAJOR_BUGVERSION 1 10 | #define MFS_MINUS_BUGVERSION 0 11 | 12 | #define SZMFS_VERSION "1.1.1.0" 13 | #define SZMFS_COMPANY "MFNode Project : by Dumonteil David" 14 | #define SZMFS_DESCRIPTION "Jpeg Http Media Foundation Sink" 15 | #define SZMFS_DLLNAME "MFSkJpegHttpStreamer.dll" 16 | #define SZMFS_COPYRIGHT "Copyright (C) 2013 Dumonteil David" 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /MFSkJpegHttpStreamer/MFSkJpegHttpStreamer.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | DllCanUnloadNow PRIVATE 3 | DllRegisterServer PRIVATE 4 | DllUnregisterServer PRIVATE 5 | DllGetClassObject PRIVATE 6 | -------------------------------------------------------------------------------- /MFSkJpegHttpStreamer/MFSkJpegHttpStreamer.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFSkJpegHttpStreamer.h 3 | // Copyright (C) 2013 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #ifndef MFSKJPEGHTTPSTREAMER_H 19 | #define MFSKJPEGHTTPSTREAMER_H 20 | 21 | class CMFSkJpegHttpStreamer : BaseObject, public IMFMediaSink, public IMFClockStateSink{ 22 | 23 | public: 24 | 25 | // MFSkJpegHttpStreamer.cpp 26 | static HRESULT CreateInstance(IUnknown*, REFIID, void**); 27 | 28 | // IUnknown - MFSkJpegHttpStreamer.cpp 29 | STDMETHODIMP QueryInterface(REFIID, void**); 30 | STDMETHODIMP_(ULONG) AddRef(); 31 | STDMETHODIMP_(ULONG) Release(); 32 | 33 | // IMFMediaSink - MFSkJpegHttpStreamer_Sink.cpp 34 | STDMETHODIMP GetCharacteristics(DWORD*); 35 | STDMETHODIMP AddStreamSink(DWORD, IMFMediaType*, IMFStreamSink**); 36 | STDMETHODIMP RemoveStreamSink(DWORD); 37 | STDMETHODIMP GetStreamSinkCount(DWORD*); 38 | STDMETHODIMP GetStreamSinkByIndex(DWORD, IMFStreamSink**); 39 | STDMETHODIMP GetStreamSinkById(DWORD, IMFStreamSink**); 40 | STDMETHODIMP SetPresentationClock(IMFPresentationClock*); 41 | STDMETHODIMP GetPresentationClock(IMFPresentationClock**); 42 | STDMETHODIMP Shutdown(); 43 | 44 | // IMFClockStateSink - MFSkJpegHttpStreamer_Clock.cpp 45 | STDMETHODIMP OnClockStart(MFTIME, LONGLONG); 46 | STDMETHODIMP OnClockStop(MFTIME); 47 | STDMETHODIMP OnClockPause(MFTIME); 48 | STDMETHODIMP OnClockRestart(MFTIME); 49 | STDMETHODIMP OnClockSetRate(MFTIME, float); 50 | 51 | private: 52 | 53 | // MFSkJpegHttpStreamer.cpp 54 | CMFSkJpegHttpStreamer(HRESULT&); 55 | virtual ~CMFSkJpegHttpStreamer(); 56 | 57 | CriticSection m_CriticSection; 58 | volatile long m_nRefCount; 59 | BOOL m_IsShutdown; 60 | 61 | CMFSkStreamJpeg* m_pJpegStream; 62 | IMFPresentationClock* m_pClock; 63 | 64 | HRESULT CheckShutdown() const{ return (m_IsShutdown ? MF_E_SHUTDOWN : S_OK); } 65 | }; 66 | 67 | #endif -------------------------------------------------------------------------------- /MFSkJpegHttpStreamer/MFSkJpegHttpStreamer.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFSkJpegHttpStreamer/MFSkJpegHttpStreamer.rc -------------------------------------------------------------------------------- /MFSkJpegHttpStreamer/MFSkJpegHttpStreamer_Clock.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFSkJpegHttpStreamer_Clock.cpp 3 | // Copyright (C) 2013 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #include "StdAfx.h" 19 | 20 | HRESULT CMFSkJpegHttpStreamer::OnClockStart(MFTIME /*hnsSystemTime*/, LONGLONG llClockStartOffset){ 21 | 22 | TRACE_SINK((L"JpegSink::OnClockStart")); 23 | 24 | AutoLock lock(m_CriticSection); 25 | 26 | HRESULT hr; 27 | IF_FAILED_RETURN(hr = CheckShutdown()); 28 | 29 | IF_FAILED_RETURN(hr = m_pJpegStream->Start(llClockStartOffset)); 30 | 31 | return hr; 32 | } 33 | 34 | HRESULT CMFSkJpegHttpStreamer::OnClockStop(MFTIME /*hnsSystemTime*/){ 35 | 36 | TRACE_SINK((L"JpegSink::OnClockStop")); 37 | 38 | AutoLock lock(m_CriticSection); 39 | 40 | HRESULT hr; 41 | IF_FAILED_RETURN(hr = CheckShutdown()); 42 | 43 | IF_FAILED_RETURN(hr = m_pJpegStream->Stop()); 44 | 45 | return hr; 46 | } 47 | 48 | HRESULT CMFSkJpegHttpStreamer::OnClockPause(MFTIME /*hnsSystemTime*/){ 49 | 50 | TRACE_SINK((L"JpegSink::OnClockPause")); 51 | 52 | AutoLock lock(m_CriticSection); 53 | 54 | HRESULT hr; 55 | IF_FAILED_RETURN(hr = CheckShutdown()); 56 | 57 | IF_FAILED_RETURN(hr = m_pJpegStream->Pause()); 58 | 59 | return hr; 60 | } 61 | 62 | HRESULT CMFSkJpegHttpStreamer::OnClockRestart(MFTIME /*hnsSystemTime*/){ 63 | 64 | TRACE_SINK((L"JpegSink::OnClockRestart")); 65 | 66 | AutoLock lock(m_CriticSection); 67 | 68 | HRESULT hr; 69 | IF_FAILED_RETURN(hr = CheckShutdown()); 70 | 71 | IF_FAILED_RETURN(hr = m_pJpegStream->Restart()); 72 | 73 | return hr; 74 | } 75 | 76 | HRESULT CMFSkJpegHttpStreamer::OnClockSetRate(MFTIME /*hnsSystemTime*/, float /*flRate*/){ 77 | 78 | TRACE_SINK((L"JpegSink::OnClockSetRate")); 79 | 80 | HRESULT hr; 81 | IF_FAILED_RETURN(hr = CheckShutdown()); 82 | 83 | return hr; 84 | } -------------------------------------------------------------------------------- /MFSkJpegHttpStreamer/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.cpp 3 | //---------------------------------------------------------------------------------------------- 4 | #include "Stdafx.h" -------------------------------------------------------------------------------- /MFSkJpegHttpStreamer/StdAfx.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef STDAFX_H 5 | #define STDAFX_H 6 | 7 | #pragma once 8 | #define WIN32_LEAN_AND_MEAN 9 | #define STRICT 10 | 11 | //---------------------------------------------------------------------------------------------- 12 | // Microsoft Windows SDK for Windows 7 13 | #include 14 | #include 15 | #include 16 | 17 | //---------------------------------------------------------------------------------------------- 18 | // Common Project Files 19 | #ifdef _DEBUG 20 | #define MF_USE_LOGGING 1 21 | //#define MF_USE_LOGREFCOUNT 22 | //#define MF_TRACE_SINK 23 | //#define MF_TRACE_STREAM 24 | #else 25 | #define MF_USE_LOGGING 0 26 | #endif 27 | 28 | #include "../Common/MFInclude.h" 29 | 30 | //---------------------------------------------------------------------------------------------- 31 | // Project Files 32 | class CMFSkJpegHttpStreamer; 33 | 34 | #include "Http_Definition.h" 35 | #include "HttpServer.h" 36 | #include "MFSkStreamJpeg.h" 37 | #include "MFSkJpegHttpStreamer.h" 38 | 39 | #endif -------------------------------------------------------------------------------- /MFSkJpegHttpStreamer/ToDo.txt: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // ToDo 3 | //---------------------------------------------------------------------------------------------- 4 | 5 | - Implement IMFAttributes to be able to change default port. 6 | - Schedule network send. This sink is rateless. 7 | - Perhaps change the http server for multiple user. -------------------------------------------------------------------------------- /MFSkJpegHttpStreamer/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFSkJpegHttpStreamer/resource.h -------------------------------------------------------------------------------- /MFSkVideoRenderer/MFSVersion.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // MFSVersion.h 3 | //-------------------------------------------------------------------------------------- 4 | #ifndef MFSVERSION_H 5 | #define MFSVERSION_H 6 | 7 | #define MFS_MAJOR_VERSION 1 8 | #define MFS_MINUS_VERSION 3 9 | #define MFS_MAJOR_BUGVERSION 0 10 | #define MFS_MINUS_BUGVERSION 1 11 | 12 | #define SZMFS_VERSION "1.3.0.1" 13 | #define SZMFS_COMPANY "MFNode Project : by Dumonteil David" 14 | #define SZMFS_DESCRIPTION "Media Foundation Sink Video Renderer" 15 | #define SZMFS_DLLNAME "MFSkVideoRenderer.dll" 16 | #define SZMFS_COPYRIGHT "Copyright (C) 2014 Dumonteil David" 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /MFSkVideoRenderer/MFSkVideoRenderer.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | DllCanUnloadNow PRIVATE 3 | DllRegisterServer PRIVATE 4 | DllUnregisterServer PRIVATE 5 | DllGetClassObject PRIVATE 6 | -------------------------------------------------------------------------------- /MFSkVideoRenderer/MFSkVideoRenderer.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFSkVideoRenderer/MFSkVideoRenderer.rc -------------------------------------------------------------------------------- /MFSkVideoRenderer/Quad.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------- 2 | // Quad.h 3 | //------------------------------------------------------------------------- 4 | #ifndef QUAD_H 5 | #define QUAD_H 6 | 7 | #define D3DFVF_SCREENVERTEX (D3DFVF_XYZRHW | D3DFVF_TEX1) 8 | 9 | struct SCREENVERTEX{ 10 | 11 | struct Position{ 12 | 13 | Position() : x(0.0f), y(0.0f), z(0.0f), w(1.0f) {}; 14 | Position(float x_, float y_, float z_, float w_) : x(x_), y(y_), z(z_), w(w_){}; 15 | float x, y, z, w; 16 | }; 17 | 18 | Position Pos; 19 | float Tu, Tv; 20 | }; 21 | 22 | class CQuad{ 23 | 24 | public: 25 | 26 | CQuad() : m_QuadVB(NULL){} 27 | virtual ~CQuad(){ OnDelete(); } 28 | 29 | void OnCreate(const UINT32 uiWidth, const UINT32 uiHeight){ 30 | 31 | m_QuadVertex[0].Pos = SCREENVERTEX::Position(0.0f, 0.0f, 0.0f, 1.0f); 32 | m_QuadVertex[1].Pos = SCREENVERTEX::Position(0.0f, (float)uiHeight, 0.0f, 1.0f); 33 | m_QuadVertex[2].Pos = SCREENVERTEX::Position((float)uiWidth, 0.0f, 0.0f, 1.0f); 34 | m_QuadVertex[3].Pos = SCREENVERTEX::Position((float)uiWidth, (float)uiHeight, 0.0f, 1.0f); 35 | 36 | m_QuadVertex[0].Tu = 0.0f; m_QuadVertex[0].Tv = 0.0f; 37 | m_QuadVertex[1].Tu = 0.0f; m_QuadVertex[1].Tv = 1.0f; 38 | m_QuadVertex[2].Tu = 1.0f; m_QuadVertex[2].Tv = 0.0f; 39 | m_QuadVertex[3].Tu = 1.0f; m_QuadVertex[3].Tv = 1.0f; 40 | } 41 | 42 | HRESULT OnRestore(IDirect3DDevice9* pDevice){ 43 | 44 | HRESULT hr; 45 | OnDelete(); 46 | 47 | IF_FAILED_RETURN(hr = (pDevice == NULL ? E_POINTER : S_OK)); 48 | 49 | IF_FAILED_RETURN(pDevice->CreateVertexBuffer(sizeof(m_QuadVertex), D3DUSAGE_WRITEONLY, D3DFVF_SCREENVERTEX, D3DPOOL_DEFAULT, &m_QuadVB, NULL)); 50 | 51 | void* pData; 52 | 53 | IF_FAILED_RETURN(m_QuadVB->Lock(0, sizeof(pData), &pData, 0)); 54 | memcpy(pData, m_QuadVertex, sizeof(m_QuadVertex)); 55 | IF_FAILED_RETURN(m_QuadVB->Unlock()); 56 | 57 | return hr; 58 | } 59 | 60 | HRESULT OnRender(IDirect3DDevice9* pDevice){ 61 | 62 | HRESULT hr; 63 | 64 | IF_FAILED_RETURN(hr = (pDevice == NULL ? E_POINTER : S_OK)); 65 | 66 | if(m_QuadVB){ 67 | 68 | IF_FAILED_RETURN(pDevice->SetStreamSource(0, m_QuadVB, 0, sizeof(SCREENVERTEX)));// Do it once... 69 | IF_FAILED_RETURN(pDevice->SetFVF(D3DFVF_SCREENVERTEX));// Do it once... 70 | IF_FAILED_RETURN(pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2)); 71 | } 72 | 73 | return hr; 74 | } 75 | 76 | void OnDelete(){ SAFE_RELEASE(m_QuadVB); } 77 | 78 | private: 79 | 80 | SCREENVERTEX m_QuadVertex[4]; 81 | IDirect3DVertexBuffer9* m_QuadVB; 82 | }; 83 | 84 | #endif -------------------------------------------------------------------------------- /MFSkVideoRenderer/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.cpp 3 | //---------------------------------------------------------------------------------------------- 4 | #include "Stdafx.h" -------------------------------------------------------------------------------- /MFSkVideoRenderer/StdAfx.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef STDAFX_H 5 | #define STDAFX_H 6 | 7 | #pragma once 8 | #define WIN32_LEAN_AND_MEAN 9 | #define STRICT 10 | 11 | //---------------------------------------------------------------------------------------------- 12 | // Microsoft DirectX SDK (June 2010) 13 | #ifdef _DEBUG 14 | //#pragma comment(lib, "C:\\Program Files\\Microsoft DirectX SDK (June 2010)\\Lib\\x86\\d3dx9d") 15 | #pragma comment(lib, "C:\\Program Files (x86)\\Microsoft DirectX SDK (June 2010)\\Lib\\x86\\d3dx9d") 16 | #else 17 | //#pragma comment(lib, "C:\\Program Files\\Microsoft DirectX SDK (June 2010)\\Lib\\x86\\d3dx9") 18 | #pragma comment(lib, "C:\\Program Files (x86)\\Microsoft DirectX SDK (June 2010)\\Lib\\x86\\d3dx9") 19 | #endif 20 | 21 | #pragma comment(lib, "winmm") 22 | 23 | //---------------------------------------------------------------------------------------------- 24 | // Microsoft Windows SDK for Windows 7 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | //---------------------------------------------------------------------------------------------- 31 | // Microsoft DirectX SDK (June 2010) 32 | //#include "C:\Program Files\Microsoft DirectX SDK (June 2010)\Include\d3dx9.h" 33 | #include "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include\d3dx9.h" 34 | 35 | //---------------------------------------------------------------------------------------------- 36 | // Common Project Files 37 | #ifdef _DEBUG 38 | #define MF_USE_LOGGING 1 39 | //#define MF_USE_LOGREFCOUNT 40 | //#define MF_TRACE_SINK 41 | //#define MF_TRACE_STREAM 42 | #else 43 | #define MF_USE_LOGGING 0 44 | #endif 45 | 46 | #include "../Common/MFInclude.h" 47 | 48 | //---------------------------------------------------------------------------------------------- 49 | // Project Files 50 | class CSinkVideoRenderer; 51 | 52 | extern HMODULE g_hModule; 53 | 54 | #include "VideoShaderEffect_h.h" 55 | #include "resource.h" 56 | #include "Quad.h" 57 | #include "DirectX9Manager.h" 58 | #include "StreamVideoRenderer.h" 59 | #include "SinkVideoRenderer.h" 60 | 61 | #endif -------------------------------------------------------------------------------- /MFSkVideoRenderer/ToDo.txt: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // ToDo 3 | //---------------------------------------------------------------------------------------------- 4 | 5 | - When EndOfStream, we have to render all the samples before exit RendererThread. 6 | 7 | - CreateWindow inside a thread is not a good idea. But for first implementation, it seems to be OK. 8 | We need to implement IMFVideoDisplayControl. -------------------------------------------------------------------------------- /MFSkVideoRenderer/VideoShaderEffect.idl: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // VideoShaderEffect.idl 3 | //-------------------------------------------------------------------------------------- 4 | import "unknwn.idl"; 5 | 6 | interface IMFVideoShaderEffect; 7 | 8 | //-------------------------------------------------------------------------------------- 9 | // IMFVideoShaderEffect 10 | //-------------------------------------------------------------------------------------- 11 | [local, object, uuid(95C8C8D2-14A8-4ED1-8064-9AB562F69E9B), 12 | helpstring("IMFVideoShaderEffect Interface"), pointer_default(unique)] 13 | 14 | interface IMFVideoShaderEffect : IUnknown{ 15 | 16 | HRESULT SetShaderReverseX([in] BOOL); 17 | HRESULT SetShaderReverseY([in] BOOL); 18 | HRESULT SetShaderNegatif([in] BOOL); 19 | HRESULT SetShaderGray([in] BOOL); 20 | HRESULT SetShaderGrayScale([in] BOOL); 21 | HRESULT SetShaderColor([in] UINT); 22 | HRESULT SetShaderContrast([in] FLOAT); 23 | HRESULT SetShaderSaturation([in] FLOAT); 24 | }; 25 | 26 | //-------------------------------------------------------------------------------------- 27 | // Library and objects 28 | //-------------------------------------------------------------------------------------- 29 | [uuid(7C673E6B-FF72-4E44-BCD6-3B919D2E2506), version(1.0), helpstring("VideoShaderEffect 1.0 Type Library")] 30 | 31 | library VideoShaderEffectLib{ 32 | 33 | // MFVideoShaderEffect 34 | [uuid(D3200A97-06F5-44A1-A4BC-9137E6A0748F), helpstring("MFVideoShaderEffect Class")] 35 | 36 | coclass MFVideoShaderEffect{ [default] interface IMFVideoShaderEffect; }; 37 | }; -------------------------------------------------------------------------------- /MFSkVideoRenderer/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFSkVideoRenderer/resource.h -------------------------------------------------------------------------------- /MFSrA52Decoder/MFA52Stream.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFA52Stream.h 3 | // Copyright (C) 2014 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #ifndef MFMPEG12STREAM_H 19 | #define MFMPEG12STREAM_H 20 | 21 | class CMFA52Stream : public BaseObject, IMFMediaStream{ 22 | 23 | public: 24 | 25 | static HRESULT CreateInstance(CMFA52Stream**, CMFA52Source*, IMFStreamDescriptor*, HRESULT&); 26 | 27 | // IUnknown 28 | STDMETHODIMP QueryInterface(REFIID iid, void** ppv); 29 | STDMETHODIMP_(ULONG) AddRef(); 30 | STDMETHODIMP_(ULONG) Release(); 31 | 32 | // IMFMediaEventGenerator 33 | STDMETHODIMP BeginGetEvent(IMFAsyncCallback*, IUnknown*); 34 | STDMETHODIMP EndGetEvent(IMFAsyncResult*, IMFMediaEvent**); 35 | STDMETHODIMP GetEvent(DWORD, IMFMediaEvent**); 36 | STDMETHODIMP QueueEvent(MediaEventType, REFGUID, HRESULT, const PROPVARIANT*); 37 | 38 | // IMFMediaStream 39 | STDMETHODIMP GetMediaSource(IMFMediaSource**); 40 | STDMETHODIMP GetStreamDescriptor(IMFStreamDescriptor**); 41 | STDMETHODIMP RequestSample(IUnknown*); 42 | 43 | //HRESULT Flush(){ return S_OK; } 44 | HRESULT Shutdown(); 45 | void StartStream(){ AutoLock lock(m_CriticSection); m_bEOS = FALSE; } 46 | void EndOfStream(){ AutoLock lock(m_CriticSection); HRESULT hr; LOG_HRESULT(hr = QueueEvent(MEEndOfStream, GUID_NULL, S_OK, NULL)); m_bEOS = TRUE; } 47 | 48 | private: 49 | 50 | CMFA52Stream(CMFA52Source*, IMFStreamDescriptor*, HRESULT&); 51 | virtual ~CMFA52Stream(){ TRACE_STREAM((L"Stream::DTOR")); Shutdown(); } 52 | 53 | CriticSection m_CriticSection; 54 | volatile long m_nRefCount; 55 | StreamState m_State; 56 | 57 | IMFMediaEventQueue* m_pEventQueue; 58 | IMFStreamDescriptor* m_pStreamDescriptor; 59 | 60 | CMFA52Source* m_pSource; 61 | BOOL m_bEOS; 62 | 63 | HRESULT CheckShutdown() const{ return (m_State == StreamFinalized ? MF_E_SHUTDOWN : S_OK); } 64 | }; 65 | 66 | #endif -------------------------------------------------------------------------------- /MFSrA52Decoder/MFByteStreamHandler.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFByteStreamHandler.h 3 | // Copyright (C) 2014 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #ifndef MFBYTESTREAMHANDLER_H 19 | #define MFBYTESTREAMHANDLER_H 20 | 21 | class CMFByteStreamHandler : BaseObject, public IMFByteStreamHandler, public IMFAsyncCallback{ 22 | 23 | public: 24 | 25 | static HRESULT CreateInstance(IUnknown*, REFIID, void**); 26 | 27 | // IUnknown 28 | STDMETHODIMP QueryInterface(REFIID, void**); 29 | STDMETHODIMP_(ULONG) AddRef(); 30 | STDMETHODIMP_(ULONG) Release(); 31 | 32 | // IMFByteStreamHandler 33 | STDMETHODIMP BeginCreateObject(IMFByteStream*, LPCWSTR, DWORD, IPropertyStore*, IUnknown**, IMFAsyncCallback*, IUnknown*); 34 | STDMETHODIMP EndCreateObject(IMFAsyncResult*, MF_OBJECT_TYPE*, IUnknown**); 35 | STDMETHODIMP CancelObjectCreation(IUnknown*){ TRACE_HANDLER((L"ByteStream::CancelObjectCreation")); return E_NOTIMPL; } 36 | STDMETHODIMP GetMaxNumberOfBytesRequiredForResolution(QWORD*){ TRACE_HANDLER((L"ByteStream::GetMaxNumberOfBytes")); return E_NOTIMPL; } 37 | 38 | // IMFAsyncCallback 39 | STDMETHODIMP GetParameters(DWORD*, DWORD*){ TRACE_HANDLER((L"ByteStream::GetParameters")); return E_NOTIMPL; } 40 | STDMETHODIMP Invoke(IMFAsyncResult*); 41 | 42 | private: 43 | 44 | CMFByteStreamHandler() : m_nRefCount(1), m_pResult(NULL), m_pSource(NULL){ TRACE_HANDLER((L"ByteStream::CTOR")); } 45 | virtual ~CMFByteStreamHandler(){ TRACE_HANDLER((L"ByteStream::DTOR")); SAFE_RELEASE(m_pSource); SAFE_RELEASE(m_pResult); } 46 | 47 | volatile long m_nRefCount; 48 | 49 | IMFAsyncResult* m_pResult; 50 | CMFA52Source* m_pSource; 51 | }; 52 | 53 | #endif -------------------------------------------------------------------------------- /MFSrA52Decoder/MFSVersion.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // MFSVersion.h 3 | //-------------------------------------------------------------------------------------- 4 | #ifndef MFSVERSION_H 5 | #define MFSVERSION_H 6 | 7 | #define MFS_MAJOR_VERSION 1 8 | #define MFS_MINUS_VERSION 0 9 | #define MFS_MAJOR_BUGVERSION 0 10 | #define MFS_MINUS_BUGVERSION 0 11 | 12 | #define SZMFS_VERSION "1.0.0.0" 13 | #define SZMFS_COMPANY "MFNode Project : by Dumonteil David" 14 | #define SZMFS_DESCRIPTION "A52 Media Foundation Source" 15 | #define SZMFS_DLLNAME "MFSrA52Decoder.dll" 16 | #define SZMFS_COPYRIGHT "Copyright (C) 2014 Dumonteil David" 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /MFSrA52Decoder/MFSrA52Decoder.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | DllCanUnloadNow PRIVATE 3 | DllRegisterServer PRIVATE 4 | DllUnregisterServer PRIVATE 5 | DllGetClassObject PRIVATE 6 | 7 | -------------------------------------------------------------------------------- /MFSrA52Decoder/MFSrA52Decoder.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFSrA52Decoder/MFSrA52Decoder.rc -------------------------------------------------------------------------------- /MFSrA52Decoder/MFWriteWaveFile.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFWriteWaveFile.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef MFWRITEWAVEFILE_H 5 | #define MFWRITEWAVEFILE_H 6 | 7 | class CMFWriteWaveFile{ 8 | 9 | public: 10 | 11 | CMFWriteWaveFile() : m_hFile(INVALID_HANDLE_VALUE){} 12 | ~CMFWriteWaveFile(){ if(m_hFile != INVALID_HANDLE_VALUE) CloseHandle(m_hFile); } 13 | 14 | BOOL MFCreateFile(const WCHAR* wszFile){ 15 | 16 | BOOL bRet = FALSE; 17 | 18 | if(m_hFile != INVALID_HANDLE_VALUE){ 19 | CloseHandle(m_hFile); 20 | m_hFile = INVALID_HANDLE_VALUE; 21 | } 22 | 23 | m_hFile = CreateFile(wszFile, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); 24 | 25 | if(m_hFile == INVALID_HANDLE_VALUE){ 26 | return bRet; 27 | } 28 | 29 | return bRet = TRUE; 30 | } 31 | 32 | BOOL MFWriteFile(const void* pData, const DWORD dwLength){ 33 | 34 | BOOL bRet = FALSE; 35 | DWORD dwWritten; 36 | 37 | if(!WriteFile(m_hFile, (LPCVOID)pData, dwLength, &dwWritten, 0) || dwWritten != dwLength){ 38 | return bRet; 39 | } 40 | 41 | return bRet = TRUE; 42 | } 43 | 44 | BOOL WriteWaveHeader(const DWORD, const UINT16, const UINT32); 45 | 46 | void Close(){ if(m_hFile != INVALID_HANDLE_VALUE){ CloseHandle(m_hFile); m_hFile = INVALID_HANDLE_VALUE; } } 47 | 48 | const BOOL IsOpened() const{ return m_hFile != INVALID_HANDLE_VALUE; } 49 | 50 | private: 51 | 52 | HANDLE m_hFile; 53 | 54 | struct WAVEFORM{ 55 | 56 | UINT32 uiDataSize; 57 | UINT32 uiChunkSize; 58 | UINT16 usFormatTag; 59 | UINT16 usChannels; 60 | UINT32 uiSamplesPerSec; 61 | UINT32 uiAvgBytesPerSec; 62 | UINT16 usBlockAlign; 63 | UINT16 usBitsPerSample; 64 | 65 | UINT16 usChunkSizeEx; 66 | UINT16 usValidBits; 67 | UINT32 uiChannelMask; 68 | BYTE SubFormat[16]; 69 | }; 70 | }; 71 | 72 | #endif -------------------------------------------------------------------------------- /MFSrA52Decoder/Resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFSrA52Decoder/Resource.h -------------------------------------------------------------------------------- /MFSrA52Decoder/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.cpp 3 | //---------------------------------------------------------------------------------------------- 4 | #include "StdAfx.h" -------------------------------------------------------------------------------- /MFSrA52Decoder/StdAfx.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef STDAFX_H 5 | #define STDAFX_H 6 | 7 | #pragma once 8 | #define WIN32_LEAN_AND_MEAN 9 | #define STRICT 10 | 11 | //---------------------------------------------------------------------------------------------- 12 | // A52 Audio Library 13 | #ifdef _DEBUG 14 | #pragma comment(lib, "..\\Debug\\LibA52Audio") 15 | #else 16 | #pragma comment(lib, "..\\Release\\LibA52Audio") 17 | #endif 18 | 19 | //---------------------------------------------------------------------------------------------- 20 | // Microsoft Windows SDK for Windows 7 21 | #include 22 | #include 23 | #include 24 | 25 | #ifdef _DEBUG 26 | #define MF_USE_LOGGING 1 27 | //#define MF_USE_LOGREFCOUNT 28 | //#define MF_TRACE_HANDLER 29 | //#define MF_TRACE_SOURCE 30 | //#define MF_TRACE_STREAM 31 | #else 32 | #define MF_USE_LOGGING 0 33 | #endif 34 | 35 | //---------------------------------------------------------------------------------------------- 36 | // Common Project Files 37 | #include "../Common/MFInclude.h" 38 | 39 | //---------------------------------------------------------------------------------------------- 40 | // A52 Audio Library 41 | #include "../LibA52Audio/inttypes.h" 42 | #include "../LibA52Audio/a52.h" 43 | #include "../LibA52Audio/a52_internal.h" 44 | 45 | //---------------------------------------------------------------------------------------------- 46 | // Project Files 47 | class CMFA52Source; 48 | 49 | //#define WRITE_WAVE_FILE 50 | //#define WRITE_INPUT_FILE 51 | #define A52_BUFFER_SIZE 4608 52 | 53 | #include "MFByteStreamHandler.h" 54 | #include "MFA52Stream.h" 55 | #include "MFWriteWaveFile.h" 56 | #include "MFA52Source.h" 57 | 58 | #endif -------------------------------------------------------------------------------- /MFSrA52Decoder/ToDo.txt: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // ToDo 3 | //---------------------------------------------------------------------------------------------- 4 | 5 | - Alpha version : For now there is problem with sound. See CreateSample in MFA52Source.cpp. 6 | - I just test it with two channels. -------------------------------------------------------------------------------- /MFSrFlvSplitter/FlvByteStreamHandler.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // FlvByteStreamHandler.h 3 | // Copyright (C) 2014 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #ifndef FLVBYTESTREAMHANDLER_H 19 | #define FLVBYTESTREAMHANDLER_H 20 | 21 | class CFlvByteStreamHandler : BaseObject, public IMFByteStreamHandler, public IMFAsyncCallback{ 22 | 23 | public: 24 | 25 | static HRESULT CreateInstance(IUnknown*, REFIID, void**); 26 | 27 | // IUnknown 28 | STDMETHODIMP QueryInterface(REFIID, void**); 29 | STDMETHODIMP_(ULONG) AddRef(); 30 | STDMETHODIMP_(ULONG) Release(); 31 | 32 | // IMFByteStreamHandler 33 | STDMETHODIMP BeginCreateObject(IMFByteStream*, LPCWSTR, DWORD, IPropertyStore*, IUnknown**, IMFAsyncCallback*, IUnknown*); 34 | STDMETHODIMP EndCreateObject(IMFAsyncResult*, MF_OBJECT_TYPE*, IUnknown**); 35 | STDMETHODIMP CancelObjectCreation(IUnknown*){ TRACE_HANDLER((L"ByteStream::CancelObjectCreation")); return E_NOTIMPL; } 36 | STDMETHODIMP GetMaxNumberOfBytesRequiredForResolution(QWORD*){ TRACE_HANDLER((L"Scheme::GetMaxNumberOfBytes")); return E_NOTIMPL; } 37 | 38 | // IMFAsyncCallback 39 | STDMETHODIMP GetParameters(DWORD*, DWORD*){ TRACE_HANDLER((L"ByteStream::GetParameters")); return E_NOTIMPL; } 40 | STDMETHODIMP Invoke(IMFAsyncResult*); 41 | 42 | private: 43 | 44 | CFlvByteStreamHandler() : m_nRefCount(1), m_pResult(NULL), m_pSource(NULL){ TRACE_HANDLER((L"ByteStream::CTOR")); } 45 | virtual ~CFlvByteStreamHandler(){ TRACE_HANDLER((L"ByteStream::DTOR")); SAFE_RELEASE(m_pSource); SAFE_RELEASE(m_pResult); } 46 | 47 | volatile long m_nRefCount; 48 | 49 | IMFAsyncResult* m_pResult; 50 | CFlvSource* m_pSource; 51 | }; 52 | 53 | #endif -------------------------------------------------------------------------------- /MFSrFlvSplitter/MFByteStream.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFByteStream.h 3 | // Copyright (C) 2014 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #ifndef MFBYTESTREAM_H 19 | #define MFBYTESTREAM_H 20 | 21 | class CMFByteStream : public IMFAsyncCallback{ 22 | 23 | public: 24 | 25 | static HRESULT CreateInstance(CMFByteStream**); 26 | 27 | // IUnknown 28 | STDMETHODIMP QueryInterface(REFIID, void**); 29 | STDMETHODIMP_(ULONG) AddRef(); 30 | STDMETHODIMP_(ULONG) Release(); 31 | 32 | // IMFAsyncCallback 33 | STDMETHODIMP GetParameters(DWORD*, DWORD*){ TRACE_BYTESTREAM((L"MFByteStream::GetParameters")); return E_NOTIMPL; } 34 | STDMETHODIMP Invoke(IMFAsyncResult*); 35 | 36 | HRESULT Initialize(LPCWSTR, DWORD*); 37 | HRESULT Start(); 38 | void Close(); 39 | HRESULT CMFByteStream::Read(BYTE*, const DWORD, DWORD*); 40 | HRESULT BeginRead(BYTE*, ULONG, IMFAsyncCallback*); 41 | HRESULT EndRead(IMFAsyncResult*, ULONG*); 42 | HRESULT Seek(const LONGLONG); 43 | HRESULT SeekFile(LARGE_INTEGER); 44 | HRESULT Reset(); 45 | const BOOL IsInitialized() const{ return (m_hFile != INVALID_HANDLE_VALUE && m_pReadParam != NULL); } 46 | 47 | private: 48 | 49 | CMFByteStream(); 50 | virtual ~CMFByteStream(){ TRACE_BYTESTREAM((L"MFByteStream::DTOR")); Close(); } 51 | 52 | CriticSection m_CriticSection; 53 | 54 | volatile long m_nRefCount; 55 | 56 | wstring m_wszFile; 57 | HANDLE m_hFile; 58 | LARGE_INTEGER m_liFileSize; 59 | 60 | CMFReadParam* m_pReadParam; 61 | 62 | HRESULT Read(CMFReadParam*); 63 | }; 64 | 65 | #endif -------------------------------------------------------------------------------- /MFSrFlvSplitter/MFSVersion.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // MFSVersion.h 3 | //-------------------------------------------------------------------------------------- 4 | #ifndef MFSVERSION_H 5 | #define MFSVERSION_H 6 | 7 | #define MFS_MAJOR_VERSION 1 8 | #define MFS_MINUS_VERSION 2 9 | #define MFS_MAJOR_BUGVERSION 1 10 | #define MFS_MINUS_BUGVERSION 1 11 | 12 | #define SZMFS_VERSION "1.2.1.1" 13 | #define SZMFS_COMPANY "MFNode Project : by Dumonteil David" 14 | #define SZMFS_DESCRIPTION "Media Foundation Flv Splitter" 15 | #define SZMFS_DLLNAME "MFSrFlvSplitter.dll" 16 | #define SZMFS_COPYRIGHT "Copyright (C) 2014 Dumonteil David" 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /MFSrFlvSplitter/MFSrFlvSplitter.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | DllCanUnloadNow PRIVATE 3 | DllRegisterServer PRIVATE 4 | DllUnregisterServer PRIVATE 5 | DllGetClassObject PRIVATE -------------------------------------------------------------------------------- /MFSrFlvSplitter/MFSrFlvSplitter.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFSrFlvSplitter/MFSrFlvSplitter.rc -------------------------------------------------------------------------------- /MFSrFlvSplitter/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.cpp 3 | //---------------------------------------------------------------------------------------------- 4 | #include "StdAfx.h" -------------------------------------------------------------------------------- /MFSrFlvSplitter/StdAfx.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef STDAFX_H 5 | #define STDAFX_H 6 | 7 | #pragma once 8 | #define WIN32_LEAN_AND_MEAN 9 | #define STRICT 10 | 11 | //---------------------------------------------------------------------------------------------- 12 | // Microsoft Windows SDK for Windows 7 13 | #include 14 | #include 15 | #include 16 | 17 | //---------------------------------------------------------------------------------------------- 18 | // STL 19 | #include 20 | using std::wstring; 21 | 22 | #ifdef _DEBUG 23 | #define MF_USE_LOGGING 1 24 | //#define MF_USE_LOGREFCOUNT 25 | //#define MF_TRACE_HANDLER 26 | //#define MF_TRACE_SOURCE 27 | //#define MF_TRACE_STREAM 28 | //#define MF_TRACE_PARSER 29 | //#define MF_TRACE_EVENTSOURCE 30 | //#define MF_TRACE_EVENTSTREAM 31 | //#define MF_TRACE_STREAMSOURCE 32 | //#define MF_TRACE_BYTESTREAM 33 | #else 34 | #define MF_USE_LOGGING 0 35 | #endif 36 | 37 | //---------------------------------------------------------------------------------------------- 38 | // Common Project Files 39 | #include "../Common/MFInclude.h" 40 | 41 | //---------------------------------------------------------------------------------------------- 42 | // Project Files 43 | class CFlvSource; 44 | 45 | #include "MFSVersion.h" 46 | #include "MFByteStream.h" 47 | #include "FlvByteStreamHandler.h" 48 | #include "FlvDefinition.h" 49 | #include "FlvParser.h" 50 | #include "FlvStream.h" 51 | #include "FlvSource.h" 52 | 53 | #endif -------------------------------------------------------------------------------- /MFSrFlvSplitter/ToDo.txt: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // ToDo 3 | //---------------------------------------------------------------------------------------------- 4 | 5 | - Try to found if h263 decoding is possible with Windows Seven. 6 | - Refactor flv parser. 7 | - mpeg123 is same as Mpeg2 Splitter, add to common files. 8 | - the flv must have audio and video stream. Handle cases one audio stream or one video stream. -------------------------------------------------------------------------------- /MFSrFlvSplitter/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFSrFlvSplitter/resource.h -------------------------------------------------------------------------------- /MFSrKinectCapture/KinectSchemeHandler.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // KinectSchemeHandler.h 3 | // Copyright (C) 2012 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #ifndef KINECTSHCEMEHANDLER_H 19 | #define KINECTSHCEMEHANDLER_H 20 | 21 | class CKinectSchemeHandler : BaseObject, RefCountedObject, public IMFSchemeHandler{ 22 | 23 | public: 24 | 25 | static HRESULT CreateInstance(IUnknown*, REFIID, void**); 26 | 27 | // IUnknown 28 | STDMETHODIMP QueryInterface(REFIID, void**); 29 | STDMETHODIMP_(ULONG) AddRef(){ return RefCountedObject::AddRef(); } 30 | STDMETHODIMP_(ULONG) Release(){ return RefCountedObject::Release(); } 31 | 32 | // IMFSchemeHandler 33 | STDMETHODIMP BeginCreateObject(LPCWSTR, DWORD, IPropertyStore*, IUnknown**, IMFAsyncCallback*, IUnknown*); 34 | STDMETHODIMP CancelObjectCreation(IUnknown*){ return E_NOTIMPL; } 35 | STDMETHODIMP EndCreateObject(IMFAsyncResult*, MF_OBJECT_TYPE*, IUnknown**); 36 | 37 | private: 38 | 39 | CKinectSchemeHandler(){} 40 | virtual ~CKinectSchemeHandler(){} 41 | }; 42 | 43 | #endif -------------------------------------------------------------------------------- /MFSrKinectCapture/KinectSource.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFSrKinectCapture/KinectSource.cpp -------------------------------------------------------------------------------- /MFSrKinectCapture/KinectSource_Def.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // KinectSource_Def.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef KINECTSOURCE_DEF_H 5 | #define KINECTSOURCE_DEF_H 6 | 7 | #define KINECT_IMAGE_RESOLUTION_640x480 8 | //#define KINECT_IMAGE_RESOLUTION_1280x960 9 | 10 | #ifdef KINECT_IMAGE_RESOLUTION_640x480 11 | 12 | #define KINECT_VIDEO_WIDTH 640 13 | #define KINECT_VIDEO_HEIGHT 480 14 | #define KINECT_VIDEO_NUMERATOR 30 15 | #define KINECT_VIDEO_DENOMINATOR 1 16 | #define KINECT_IMAGE_RESOLUTION NUI_IMAGE_RESOLUTION_640x480 17 | 18 | #elif defined KINECT_IMAGE_RESOLUTION_1280x960 19 | 20 | #define KINECT_VIDEO_WIDTH 1280 21 | #define KINECT_VIDEO_HEIGHT 960 22 | #define KINECT_VIDEO_NUMERATOR 15 23 | #define KINECT_VIDEO_DENOMINATOR 1 24 | #define KINECT_IMAGE_RESOLUTION NUI_IMAGE_RESOLUTION_1280x960 25 | 26 | #else 27 | 28 | #error Must define an image resolution 29 | 30 | #endif 31 | 32 | #endif -------------------------------------------------------------------------------- /MFSrKinectCapture/KinectVersion.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // KinectVersion.h 3 | //-------------------------------------------------------------------------------------- 4 | #ifndef KINECTVERSION_H 5 | #define KINECTVERSION_H 6 | 7 | #define MFS_MAJOR_VERSION 1 8 | #define MFS_MINUS_VERSION 1 9 | #define MFS_MAJOR_BUGVERSION 0 10 | #define MFS_MINUS_BUGVERSION 0 11 | 12 | #define SZMFS_VERSION "1.1.0.0" 13 | #define SZMFS_COMPANY "MFNode Project : by Dumonteil David" 14 | #define SZMFS_DESCRIPTION "Media Foundation Kinect Source" 15 | #define SZMFS_DLLNAME "MFSrKinectCapture.dll" 16 | #define SZMFS_COPYRIGHT "Copyright (C) 2012 Dumonteil David" 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /MFSrKinectCapture/MFSrKinectCapture.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | DllCanUnloadNow PRIVATE 3 | DllRegisterServer PRIVATE 4 | DllUnregisterServer PRIVATE 5 | DllGetClassObject PRIVATE 6 | 7 | -------------------------------------------------------------------------------- /MFSrKinectCapture/MFSrKinectCapture.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFSrKinectCapture/MFSrKinectCapture.rc -------------------------------------------------------------------------------- /MFSrKinectCapture/Resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFSrKinectCapture/Resource.h -------------------------------------------------------------------------------- /MFSrKinectCapture/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------------------------- 2 | // StdAfx.cpp 3 | //----------------------------------------------------------------------------------------------- 4 | #include "StdAfx.h" -------------------------------------------------------------------------------- /MFSrKinectCapture/StdAfx.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------------------------- 2 | // StdAfx.h 3 | //----------------------------------------------------------------------------------------------- 4 | #ifndef STDAFX_H 5 | #define STDAFX_H 6 | 7 | #pragma once 8 | #define WIN32_LEAN_AND_MEAN 9 | #define STRICT 10 | 11 | //---------------------------------------------------------------------------------------------- 12 | // Microsoft Windows SDK for Windows 7 13 | #pragma comment(lib, "Dmoguids") 14 | #pragma comment(lib, "Msdmo") 15 | 16 | //---------------------------------------------------------------------------------------------- 17 | // Microsoft Kinect SDK 18 | // "C:\Program Files\Microsoft SDKs\Kinect\v1.7\lib\x86\" 19 | #pragma comment(lib, "Kinect10") 20 | 21 | //---------------------------------------------------------------------------------------------- 22 | // Microsoft Windows SDK for Windows 7 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | //---------------------------------------------------------------------------------------------- 30 | // Microsoft Kinect SDK 31 | // "C:\Program Files\Microsoft SDKs\Kinect\v1.7\inc\" 32 | #include "NuiApi.h" 33 | 34 | #ifdef _DEBUG 35 | #define MF_USE_LOGGING 1 36 | //#define MF_USE_LOGREFCOUNT 37 | #else 38 | #define MF_USE_LOGGING 0 39 | #endif 40 | 41 | //---------------------------------------------------------------------------------------------- 42 | // Common Project Files 43 | #include "../Common/MFInclude.h" 44 | 45 | //---------------------------------------------------------------------------------------------- 46 | // Project Files 47 | #include "KinectSource_Def.h" 48 | #include "KinectDevice.h" 49 | #include "KinectStream.h" 50 | #include "KinectSource.h" 51 | #include "KinectSchemeHandler.h" 52 | 53 | #endif -------------------------------------------------------------------------------- /MFSrKinectCapture/ToDo.txt: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // ToDo 3 | //---------------------------------------------------------------------------------------------- 4 | 5 | - In debug mode, stopping the MediaSource takes a long time (not try in release mode). 6 | - Refactoring code. 7 | - Make the MediaSource in asynchrone mode (scheme handler and stream). 8 | - There is memory leaks when a stream is deselected or if an error occurs. 9 | - Check lock when stream handles source (See it after asynchrone mode). 10 | - Provide all Mediatype that Kinect Handle. 11 | - Handle mediatype change during play/pause or stop (if possible). 12 | - Provide a second video stream for DepthBuffer. 13 | - See custom mediatype for skeleton stream and a custom presenter. 14 | - Why not handle multiple Kinect with multiple stream. 15 | - Perhaps need to handle Gap in the Kinect stream. 16 | - Handle activation stream, discontinuity. 17 | - See if there is a difference between QueueEventWithIUnknown and QueueEventParamUnk. 18 | - Handle device lost, Kinect can be disconnected. 19 | - There are a lot of things to add, due to Kinect capabilities... -------------------------------------------------------------------------------- /MFSrMpeg12Decoder/MFByteStreamHandler.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFByteStreamHandler.h 3 | // Copyright (C) 2013 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #ifndef MFBYTESTREAMHANDLER_H 19 | #define MFBYTESTREAMHANDLER_H 20 | 21 | class CMFByteStreamHandler : BaseObject, public IMFByteStreamHandler, public IMFAsyncCallback{ 22 | 23 | public: 24 | 25 | static HRESULT CreateInstance(IUnknown*, REFIID, void**); 26 | 27 | // IUnknown 28 | STDMETHODIMP QueryInterface(REFIID, void**); 29 | STDMETHODIMP_(ULONG) AddRef(); 30 | STDMETHODIMP_(ULONG) Release(); 31 | 32 | // IMFByteStreamHandler 33 | STDMETHODIMP BeginCreateObject(IMFByteStream*, LPCWSTR, DWORD, IPropertyStore*, IUnknown**, IMFAsyncCallback*, IUnknown*); 34 | STDMETHODIMP EndCreateObject(IMFAsyncResult*, MF_OBJECT_TYPE*, IUnknown**); 35 | STDMETHODIMP CancelObjectCreation(IUnknown*){ TRACE_HANDLER((L"ByteStream::CancelObjectCreation")); return E_NOTIMPL; } 36 | STDMETHODIMP GetMaxNumberOfBytesRequiredForResolution(QWORD*){ TRACE_HANDLER((L"ByteStream::GetMaxNumberOfBytes")); return E_NOTIMPL; } 37 | 38 | // IMFAsyncCallback 39 | STDMETHODIMP GetParameters(DWORD*, DWORD*){ TRACE_HANDLER((L"ByteStream::GetParameters")); return E_NOTIMPL; } 40 | STDMETHODIMP Invoke(IMFAsyncResult*); 41 | 42 | private: 43 | 44 | CMFByteStreamHandler() : m_nRefCount(1), m_pResult(NULL), m_pSource(NULL){ TRACE_HANDLER((L"ByteStream::CTOR")); } 45 | virtual ~CMFByteStreamHandler(){ TRACE_HANDLER((L"ByteStream::DTOR")); SAFE_RELEASE(m_pSource); SAFE_RELEASE(m_pResult); } 46 | 47 | volatile long m_nRefCount; 48 | 49 | IMFAsyncResult* m_pResult; 50 | CMFMpeg12Source* m_pSource; 51 | }; 52 | 53 | #endif -------------------------------------------------------------------------------- /MFSrMpeg12Decoder/MFMpeg12Definition.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFMpeg12Definition.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef MFMPEG12DEFINITION_H 5 | #define MFMPEG12DEFINITION_H 6 | 7 | // Bug : IMFByteStream with 4096 sometimes in Read 8 | // there is no bug with a constant buffer... 9 | #define MPEG12_READ_SIZE 4096 + 16 10 | 11 | enum Mpeg12AudioLayer{ 12 | 13 | Mpeg12_Audio_Layer1 = 0, 14 | Mpeg12_Audio_Layer2, 15 | Mpeg12_Audio_Layer3 16 | }; 17 | 18 | struct Mpeg12AudioFrameHeader{ 19 | 20 | BYTE btVersion; 21 | BYTE btLayer; 22 | BOOL bProtection; 23 | BYTE btBitrateIndex; 24 | BYTE btSamplingIndex; 25 | BOOL bPadding; 26 | BOOL bPrivate; 27 | BYTE btChannelMode; 28 | BYTE btModeExtension; 29 | BOOL bCopyright; 30 | BOOL bOriginal; 31 | BYTE btEmphasis; 32 | 33 | Mpeg12AudioLayer Layer; 34 | UINT uiChannel; 35 | UINT uiSamplePerSec; 36 | UINT uiBitrate; 37 | }; 38 | 39 | #endif -------------------------------------------------------------------------------- /MFSrMpeg12Decoder/MFMpeg12Stream.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFMpeg12Stream.h 3 | // Copyright (C) 2013 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #ifndef MFMPEG12STREAM_H 19 | #define MFMPEG12STREAM_H 20 | 21 | class CMFMpeg12Stream : BaseObject, public IMFMediaStream{ 22 | 23 | public: 24 | 25 | static HRESULT CreateInstance(CMFMpeg12Stream**, CMFMpeg12Source*, IMFStreamDescriptor*, HRESULT&); 26 | 27 | // IUnknown 28 | STDMETHODIMP QueryInterface(REFIID iid, void** ppv); 29 | STDMETHODIMP_(ULONG) AddRef(); 30 | STDMETHODIMP_(ULONG) Release(); 31 | 32 | // IMFMediaEventGenerator 33 | STDMETHODIMP BeginGetEvent(IMFAsyncCallback*, IUnknown*); 34 | STDMETHODIMP EndGetEvent(IMFAsyncResult*, IMFMediaEvent**); 35 | STDMETHODIMP GetEvent(DWORD, IMFMediaEvent**); 36 | STDMETHODIMP QueueEvent(MediaEventType, REFGUID, HRESULT, const PROPVARIANT*); 37 | 38 | // IMFMediaStream 39 | STDMETHODIMP GetMediaSource(IMFMediaSource**); 40 | STDMETHODIMP GetStreamDescriptor(IMFStreamDescriptor**); 41 | STDMETHODIMP RequestSample(IUnknown*); 42 | 43 | //HRESULT Flush(){ return S_OK; } 44 | HRESULT Shutdown(); 45 | void StartStream(){ AutoLock lock(m_CriticSection); m_bEOS = FALSE; } 46 | void EndOfStream(){ AutoLock lock(m_CriticSection); HRESULT hr; LOG_HRESULT(hr = QueueEvent(MEEndOfStream, GUID_NULL, S_OK, NULL)); m_bEOS = TRUE; } 47 | 48 | private: 49 | 50 | CMFMpeg12Stream(CMFMpeg12Source*, IMFStreamDescriptor*, HRESULT&); 51 | virtual ~CMFMpeg12Stream(){ TRACE_STREAM((L"Stream::DTOR")); Shutdown(); } 52 | 53 | CriticSection m_CriticSection; 54 | volatile long m_nRefCount; 55 | StreamState m_State; 56 | 57 | IMFMediaEventQueue* m_pEventQueue; 58 | IMFStreamDescriptor* m_pStreamDescriptor; 59 | 60 | CMFMpeg12Source* m_pSource; 61 | BOOL m_bEOS; 62 | 63 | HRESULT CheckShutdown() const{ return (m_State == StreamFinalized ? MF_E_SHUTDOWN : S_OK); } 64 | }; 65 | 66 | #endif -------------------------------------------------------------------------------- /MFSrMpeg12Decoder/MFSVersion.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // MFSVersion.h 3 | //-------------------------------------------------------------------------------------- 4 | #ifndef MFSVERSION_H 5 | #define MFSVERSION_H 6 | 7 | #define MFS_MAJOR_VERSION 1 8 | #define MFS_MINUS_VERSION 1 9 | #define MFS_MAJOR_BUGVERSION 1 10 | #define MFS_MINUS_BUGVERSION 0 11 | 12 | #define SZMFS_VERSION "1.1.1.0" 13 | #define SZMFS_COMPANY "MFNode Project : by Dumonteil David" 14 | #define SZMFS_DESCRIPTION "Mp1-Mp2 Media Foundation Source" 15 | #define SZMFS_DLLNAME "MFSrMpeg12Decoder.dll" 16 | #define SZMFS_COPYRIGHT "Copyright (C) 2013 Dumonteil David" 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /MFSrMpeg12Decoder/MFSrMpeg12Decoder.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | DllCanUnloadNow PRIVATE 3 | DllRegisterServer PRIVATE 4 | DllUnregisterServer PRIVATE 5 | DllGetClassObject PRIVATE 6 | 7 | -------------------------------------------------------------------------------- /MFSrMpeg12Decoder/MFSrMpeg12Decoder.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFSrMpeg12Decoder/MFSrMpeg12Decoder.rc -------------------------------------------------------------------------------- /MFSrMpeg12Decoder/Resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFSrMpeg12Decoder/Resource.h -------------------------------------------------------------------------------- /MFSrMpeg12Decoder/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.cpp 3 | //---------------------------------------------------------------------------------------------- 4 | #include "StdAfx.h" -------------------------------------------------------------------------------- /MFSrMpeg12Decoder/StdAfx.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef STDAFX_H 5 | #define STDAFX_H 6 | 7 | #pragma once 8 | #define WIN32_LEAN_AND_MEAN 9 | #define STRICT 10 | 11 | //---------------------------------------------------------------------------------------------- 12 | // Mpeg Audio Library 13 | #ifdef _DEBUG 14 | #pragma comment(lib, "..\\Debug\\LibMpegAudio") 15 | #else 16 | #pragma comment(lib, "..\\Release\\LibMpegAudio") 17 | #endif 18 | 19 | //---------------------------------------------------------------------------------------------- 20 | // Microsoft Windows SDK for Windows 7 21 | #include 22 | #include 23 | #include 24 | 25 | #ifdef _DEBUG 26 | #define MF_USE_LOGGING 1 27 | //#define MF_USE_LOGREFCOUNT 28 | //#define MF_TRACE_HANDLER 29 | //#define MF_TRACE_SOURCE 30 | //#define MF_TRACE_STREAM 31 | #else 32 | #define MF_USE_LOGGING 0 33 | #endif 34 | 35 | //---------------------------------------------------------------------------------------------- 36 | // Common Project Files 37 | #include "../Common/MFInclude.h" 38 | 39 | //---------------------------------------------------------------------------------------------- 40 | // Mpeg Audio Library 41 | #include "..\LibMpegAudio\Mpeg12LibDefinition.h" 42 | #include "..\LibMpegAudio\Mpeg12Decoder.h" 43 | 44 | //---------------------------------------------------------------------------------------------- 45 | // Project Files 46 | class CMFMpeg12Source; 47 | 48 | #include "MFMpeg12Definition.h" 49 | #include "MFByteStreamHandler.h" 50 | #include "MFMpeg12Stream.h" 51 | #include "MFMpeg12Source.h" 52 | 53 | #endif -------------------------------------------------------------------------------- /MFSrMpeg2Splitter/MFByteStream.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFByteStream.h 3 | // Copyright (C) 2014 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #ifndef MFBYTESTREAM_H 19 | #define MFBYTESTREAM_H 20 | 21 | class CMFByteStream : public IMFAsyncCallback{ 22 | 23 | public: 24 | 25 | static HRESULT CreateInstance(CMFByteStream**); 26 | 27 | // IUnknown 28 | STDMETHODIMP QueryInterface(REFIID, void**); 29 | STDMETHODIMP_(ULONG) AddRef(); 30 | STDMETHODIMP_(ULONG) Release(); 31 | 32 | // IMFAsyncCallback 33 | STDMETHODIMP GetParameters(DWORD*, DWORD*){ TRACE_BYTESTREAM((L"MFByteStream::GetParameters")); return E_NOTIMPL; } 34 | STDMETHODIMP Invoke(IMFAsyncResult*); 35 | 36 | HRESULT Initialize(LPCWSTR, DWORD*); 37 | HRESULT Start(); 38 | void Close(); 39 | HRESULT Read(CMFReadParam*); 40 | HRESULT BeginRead(BYTE*, ULONG, IMFAsyncCallback*); 41 | HRESULT EndRead(IMFAsyncResult*, ULONG*); 42 | HRESULT Seek(const LONG); 43 | HRESULT SeekEnd(const LONG); 44 | HRESULT SeekFile(LARGE_INTEGER); 45 | HRESULT Reset(); 46 | const BOOL IsInitialized() const{ return (m_hFile != INVALID_HANDLE_VALUE && m_pReadParam != NULL); } 47 | 48 | private: 49 | 50 | CMFByteStream(); 51 | virtual ~CMFByteStream(){ TRACE_BYTESTREAM((L"MFByteStream::DTOR")); Close(); } 52 | 53 | CriticSection m_CriticSection; 54 | 55 | volatile long m_nRefCount; 56 | 57 | wstring m_wszFile; 58 | HANDLE m_hFile; 59 | LARGE_INTEGER m_liFileSize; 60 | 61 | CMFReadParam* m_pReadParam; 62 | }; 63 | 64 | #endif -------------------------------------------------------------------------------- /MFSrMpeg2Splitter/MFMpeg2Handler.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFMpeg2Handler.h 3 | // Copyright (C) 2014 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #ifndef MFMPEG2HANDLER_H 19 | #define MFMPEG2HANDLER_H 20 | 21 | class CMFMpeg2Handler : BaseObject, public IMFByteStreamHandler, public IMFAsyncCallback{ 22 | 23 | public: 24 | 25 | static HRESULT CreateInstance(IUnknown*, REFIID, void**); 26 | 27 | // IUnknown 28 | STDMETHODIMP QueryInterface(REFIID, void**); 29 | STDMETHODIMP_(ULONG) AddRef(); 30 | STDMETHODIMP_(ULONG) Release(); 31 | 32 | // IMFAsyncCallback 33 | STDMETHODIMP GetParameters(DWORD*, DWORD*){ return E_NOTIMPL; } 34 | STDMETHODIMP Invoke(IMFAsyncResult*); 35 | 36 | // IMFByteStreamHandler 37 | STDMETHODIMP BeginCreateObject(IMFByteStream*, LPCWSTR, DWORD, IPropertyStore*, IUnknown**, IMFAsyncCallback*, IUnknown*); 38 | STDMETHODIMP EndCreateObject(IMFAsyncResult*, MF_OBJECT_TYPE*, IUnknown**); 39 | STDMETHODIMP CancelObjectCreation(IUnknown*){ return E_NOTIMPL; } 40 | STDMETHODIMP GetMaxNumberOfBytesRequiredForResolution(QWORD*){ return E_NOTIMPL; } 41 | 42 | private: 43 | 44 | CMFMpeg2Handler() : m_nRefCount(1), m_pSource(NULL), m_pResult(NULL){ TRACE_HANDLER((L"ByteStream::CTOR")); } 45 | virtual ~CMFMpeg2Handler(){ TRACE_HANDLER((L"ByteStream::DTOR")); SAFE_RELEASE(m_pSource); SAFE_RELEASE(m_pResult); } 46 | 47 | volatile long m_nRefCount; 48 | 49 | CMFMpeg2Source* m_pSource; 50 | IMFAsyncResult* m_pResult; 51 | }; 52 | 53 | #endif -------------------------------------------------------------------------------- /MFSrMpeg2Splitter/MFMpeg2Source_Event.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFMpeg2Source_Event.cpp 3 | // Copyright (C) 2014 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #include "StdAfx.h" 19 | 20 | HRESULT CMFMpeg2Source::BeginGetEvent(IMFAsyncCallback* pCallback, IUnknown* punkState){ 21 | 22 | TRACE_EVENTSOURCE((L"Source::BeginGetEvent")); 23 | 24 | HRESULT hr; 25 | 26 | AutoLock lock(m_CriticSection); 27 | 28 | IF_FAILED_RETURN(hr = CheckShutdown()); 29 | IF_FAILED_RETURN(hr = m_pEventQueue->BeginGetEvent(pCallback, punkState)); 30 | 31 | return hr; 32 | } 33 | 34 | HRESULT CMFMpeg2Source::EndGetEvent(IMFAsyncResult* pResult, IMFMediaEvent** ppEvent){ 35 | 36 | TRACE_EVENTSOURCE((L"Source::EndGetEvent")); 37 | 38 | HRESULT hr; 39 | 40 | AutoLock lock(m_CriticSection); 41 | 42 | IF_FAILED_RETURN(hr = CheckShutdown()); 43 | IF_FAILED_RETURN(hr = m_pEventQueue->EndGetEvent(pResult, ppEvent)); 44 | 45 | return hr; 46 | } 47 | 48 | HRESULT CMFMpeg2Source::GetEvent(DWORD dwFlags, IMFMediaEvent** ppEvent){ 49 | 50 | TRACE_EVENTSOURCE((L"Source::GetEvent")); 51 | 52 | HRESULT hr = S_OK; 53 | 54 | IMFMediaEventQueue* pQueue = NULL; 55 | 56 | { 57 | AutoLock lock(m_CriticSection); 58 | 59 | IF_FAILED_RETURN(hr = CheckShutdown()); 60 | 61 | pQueue = m_pEventQueue; 62 | pQueue->AddRef(); 63 | } 64 | 65 | LOG_HRESULT(hr = pQueue->GetEvent(dwFlags, ppEvent)); 66 | 67 | SAFE_RELEASE(pQueue); 68 | 69 | return hr; 70 | } 71 | 72 | HRESULT CMFMpeg2Source::QueueEvent(MediaEventType met, REFGUID guidExtendedType, HRESULT hrStatus, const PROPVARIANT* pvValue){ 73 | 74 | TRACE_EVENTSOURCE((L"Source::QueueEvent")); 75 | 76 | HRESULT hr = S_OK; 77 | 78 | AutoLock lock(m_CriticSection); 79 | 80 | IF_FAILED_RETURN(hr = CheckShutdown()); 81 | IF_FAILED_RETURN(hr = m_pEventQueue->QueueEventParamVar(met, guidExtendedType, hrStatus, pvValue)); 82 | 83 | return hr; 84 | } -------------------------------------------------------------------------------- /MFSrMpeg2Splitter/MFMpeg2Stream_Event.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFMpeg2Stream_Event.cpp 3 | // Copyright (C) 2014 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #include "StdAfx.h" 19 | 20 | HRESULT CMFMpeg2Stream::BeginGetEvent(IMFAsyncCallback* pCallback, IUnknown* punkState){ 21 | 22 | TRACE_EVENTSTREAM((L"Stream::BeginGetEvent")); 23 | 24 | HRESULT hr; 25 | 26 | SourceLock lock(m_pSource); 27 | 28 | IF_FAILED_RETURN(hr = CheckShutdown()); 29 | IF_FAILED_RETURN(hr = m_pEventQueue->BeginGetEvent(pCallback, punkState)); 30 | 31 | return hr; 32 | } 33 | 34 | HRESULT CMFMpeg2Stream::EndGetEvent(IMFAsyncResult* pResult, IMFMediaEvent** ppEvent){ 35 | 36 | TRACE_EVENTSTREAM((L"Stream::EndGetEvent")); 37 | 38 | HRESULT hr; 39 | 40 | SourceLock lock(m_pSource); 41 | 42 | IF_FAILED_RETURN(hr = CheckShutdown()); 43 | IF_FAILED_RETURN(hr = m_pEventQueue->EndGetEvent(pResult, ppEvent)); 44 | 45 | return hr; 46 | } 47 | 48 | HRESULT CMFMpeg2Stream::GetEvent(DWORD dwFlags, IMFMediaEvent** ppEvent){ 49 | 50 | TRACE_EVENTSTREAM((L"Stream::GetEvent")); 51 | 52 | HRESULT hr; 53 | 54 | IMFMediaEventQueue* pQueue = NULL; 55 | 56 | { 57 | SourceLock lock(m_pSource); 58 | 59 | IF_FAILED_RETURN(hr = CheckShutdown()); 60 | 61 | pQueue = m_pEventQueue; 62 | pQueue->AddRef(); 63 | } 64 | 65 | LOG_HRESULT(hr = pQueue->GetEvent(dwFlags, ppEvent)); 66 | 67 | SAFE_RELEASE(pQueue); 68 | 69 | return hr; 70 | } 71 | 72 | HRESULT CMFMpeg2Stream::QueueEvent(MediaEventType met, REFGUID guidExtendedType, HRESULT hrStatus, const PROPVARIANT* pvValue){ 73 | 74 | TRACE_EVENTSTREAM((L"Stream::QueueEvent")); 75 | 76 | HRESULT hr; 77 | 78 | SourceLock lock(m_pSource); 79 | 80 | IF_FAILED_RETURN(hr = CheckShutdown()); 81 | IF_FAILED_RETURN(hr = m_pEventQueue->QueueEventParamVar(met, guidExtendedType, hrStatus, pvValue)); 82 | 83 | return hr; 84 | } -------------------------------------------------------------------------------- /MFSrMpeg2Splitter/MFSVersion.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // MFSVersion.h 3 | //-------------------------------------------------------------------------------------- 4 | #ifndef MFSVERSION_H 5 | #define MFSVERSION_H 6 | 7 | #define MFS_MAJOR_VERSION 1 8 | #define MFS_MINUS_VERSION 3 9 | #define MFS_MAJOR_BUGVERSION 1 10 | #define MFS_MINUS_BUGVERSION 0 11 | 12 | #define SZMFS_VERSION "1.3.1.0" 13 | #define SZMFS_COMPANY "MFNode Project : by Dumonteil David" 14 | #define SZMFS_DESCRIPTION "Media Foundation Mpeg2 Splitter" 15 | #define SZMFS_DLLNAME "MFSrMpeg2Splitter.dll" 16 | #define SZMFS_COPYRIGHT "Copyright (C) 2014 Dumonteil David" 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /MFSrMpeg2Splitter/MFSrMpeg2Splitter.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | DllCanUnloadNow PRIVATE 3 | DllRegisterServer PRIVATE 4 | DllUnregisterServer PRIVATE 5 | DllGetClassObject PRIVATE -------------------------------------------------------------------------------- /MFSrMpeg2Splitter/MFSrMpeg2Splitter.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFSrMpeg2Splitter/MFSrMpeg2Splitter.rc -------------------------------------------------------------------------------- /MFSrMpeg2Splitter/Mpeg2Definition.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // Mpeg2Definition.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef MPEG2DEFINITION_H 5 | #define MPEG2DEFINITION_H 6 | 7 | class CMFMpeg2Source; 8 | class CMFMpeg2Stream; 9 | 10 | const DWORD READ_SIZE = 4096; 11 | const DWORD SAMPLE_QUEUE = 2; 12 | 13 | typedef CGrowableArray StreamList; 14 | typedef CTinyMap StreamMap; 15 | 16 | typedef ComPtrList SampleList; 17 | typedef ComPtrList TokenList; 18 | 19 | #endif -------------------------------------------------------------------------------- /MFSrMpeg2Splitter/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.cpp 3 | //---------------------------------------------------------------------------------------------- 4 | #include "StdAfx.h" -------------------------------------------------------------------------------- /MFSrMpeg2Splitter/StdAfx.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef STDAFX_H 5 | #define STDAFX_H 6 | 7 | #pragma once 8 | #define WIN32_LEAN_AND_MEAN 9 | #define STRICT 10 | 11 | //---------------------------------------------------------------------------------------------- 12 | // Microsoft Windows SDK for Windows 7 13 | #include 14 | #include 15 | #include 16 | 17 | //---------------------------------------------------------------------------------------------- 18 | // STL 19 | #include 20 | using std::wstring; 21 | 22 | #ifdef _DEBUG 23 | #define MF_USE_LOGGING 1 24 | //#define MF_USE_LOGREFCOUNT 25 | //#define MF_TRACE_HANDLER 26 | //#define MF_TRACE_SOURCE 27 | //#define MF_TRACE_EVENTSOURCE 28 | //#define MF_TRACE_OPSOURCE 29 | //#define MF_TRACE_STREAMSOURCE 30 | //#define MF_TRACE_MEDIATYPESOURCE 31 | //#define MF_TRACE_STREAM 32 | //#define MF_TRACE_EVENTSTREAM 33 | //#define MF_TRACE_PARSER 34 | //#define MF_TRACE_BYTESTREAM 35 | #else 36 | #define MF_USE_LOGGING 0 37 | #endif 38 | 39 | //---------------------------------------------------------------------------------------------- 40 | // Common Project Files 41 | #include "../Common/MFInclude.h" 42 | 43 | //---------------------------------------------------------------------------------------------- 44 | // Private trace 45 | //#define TRACE_PTSDTS 46 | //#define TRACE_OUTPUT_PTS 47 | 48 | //---------------------------------------------------------------------------------------------- 49 | // Project Files 50 | #include "Mpeg2Definition.h" 51 | #include "MFByteStream.h" 52 | #include "MFMpeg2Stream.h" 53 | #include "MFSourceOperation.h" 54 | #include "MFParser.h" 55 | #include "MFMpeg2Source.h" 56 | #include "MFMpeg2Handler.h" 57 | 58 | #endif -------------------------------------------------------------------------------- /MFSrMpeg2Splitter/ToDo.txt: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // ToDo 3 | //---------------------------------------------------------------------------------------------- 4 | 5 | - The seek functionality seems to have introduce aleatory bug at loading. 6 | - Have to rewrite it the same way as flv splitter but keeping async. 7 | - A lot of other things, to handle DVD format. -------------------------------------------------------------------------------- /MFSrMpeg2Splitter/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFSrMpeg2Splitter/resource.h -------------------------------------------------------------------------------- /MFSrScreenCapture/DllMain.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // DllMain.cpp 3 | //---------------------------------------------------------------------------------------------- 4 | #include "StdAfx.h" 5 | 6 | HMODULE g_hModule; 7 | 8 | DEFINE_CLASSFACTORY_SERVER_LOCK; 9 | 10 | ClassFactoryData g_ClassFactories[] = {{ &CLSID_MFSrScreenCapture, CScreenCaptureSchemeHandler::CreateInstance }}; 11 | 12 | DWORD g_numClassFactories = ARRAYSIZE(g_ClassFactories); 13 | 14 | const TCHAR* szSchemeHandlerDescription = TEXT("MFNode Screen Capture Scheme Handler"); 15 | const TCHAR* szSchemeExtension = TEXT("screen:"); 16 | 17 | BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID){ 18 | 19 | switch(ul_reason_for_call){ 20 | 21 | case DLL_PROCESS_ATTACH: 22 | g_hModule = (HMODULE)hModule; 23 | break; 24 | 25 | case DLL_PROCESS_DETACH: 26 | case DLL_THREAD_ATTACH: 27 | case DLL_THREAD_DETACH: 28 | break; 29 | } 30 | return TRUE; 31 | } 32 | 33 | STDAPI DllCanUnloadNow(){ 34 | 35 | if(!ClassFactory::IsLocked()){ 36 | return S_OK; 37 | } 38 | else{ 39 | return S_FALSE; 40 | } 41 | } 42 | 43 | STDAPI DllRegisterServer(){ 44 | 45 | HRESULT hr = S_OK; 46 | 47 | if(SUCCEEDED(hr = RegisterObject(g_hModule, CLSID_MFSrScreenCapture, szSchemeHandlerDescription, TEXT("Both")))){ 48 | 49 | hr = RegisterSchemeHandler(CLSID_MFSrScreenCapture, szSchemeExtension, szSchemeHandlerDescription); 50 | } 51 | 52 | return hr; 53 | } 54 | 55 | STDAPI DllUnregisterServer(){ 56 | 57 | UnregisterObject(CLSID_MFSrScreenCapture); 58 | 59 | UnregisterSchemeHandler(CLSID_MFSrScreenCapture, szSchemeExtension); 60 | 61 | return S_OK; 62 | } 63 | 64 | STDAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void** ppv){ 65 | 66 | ClassFactory* pFactory = NULL; 67 | 68 | HRESULT hr = CLASS_E_CLASSNOTAVAILABLE; 69 | 70 | for(DWORD index = 0; index < g_numClassFactories; index++){ 71 | 72 | if(*g_ClassFactories[index].pclsid == clsid){ 73 | 74 | pFactory = new (std::nothrow)ClassFactory(g_ClassFactories[index].pfnCreate); 75 | 76 | if(pFactory){ 77 | hr = S_OK; 78 | } 79 | else{ 80 | hr = E_OUTOFMEMORY; 81 | } 82 | break; 83 | } 84 | } 85 | 86 | if(SUCCEEDED(hr)){ 87 | hr = pFactory->QueryInterface(riid, ppv); 88 | } 89 | 90 | SAFE_RELEASE(pFactory); 91 | 92 | return hr; 93 | } -------------------------------------------------------------------------------- /MFSrScreenCapture/MFSVersion.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // MFSVersion.h 3 | //-------------------------------------------------------------------------------------- 4 | #ifndef MFSVERSION_H 5 | #define MFSVERSION_H 6 | 7 | #define MFS_MAJOR_VERSION 1 8 | #define MFS_MINUS_VERSION 0 9 | #define MFS_MAJOR_BUGVERSION 0 10 | #define MFS_MINUS_BUGVERSION 0 11 | 12 | #define SZMFS_VERSION "1.0.0.0" 13 | #define SZMFS_COMPANY "MFNode Project : by Dumonteil David" 14 | #define SZMFS_DESCRIPTION "Media Foundation Source Capture Screen" 15 | #define SZMFS_DLLNAME "MFSrScreenCapture.dll" 16 | #define SZMFS_COPYRIGHT "Copyright (C) 2013 Dumonteil David" 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /MFSrScreenCapture/MFSrScreenCapture.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | DllCanUnloadNow PRIVATE 3 | DllRegisterServer PRIVATE 4 | DllUnregisterServer PRIVATE 5 | DllGetClassObject PRIVATE 6 | 7 | -------------------------------------------------------------------------------- /MFSrScreenCapture/MFSrScreenCapture.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFSrScreenCapture/MFSrScreenCapture.rc -------------------------------------------------------------------------------- /MFSrScreenCapture/MFSrScreenCapture.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Fichiers d%27en-tête 20 | 21 | 22 | Fichiers d%27en-tête 23 | 24 | 25 | Fichiers d%27en-tête 26 | 27 | 28 | Fichiers d%27en-tête 29 | 30 | 31 | Fichiers d%27en-tête 32 | 33 | 34 | Fichiers d%27en-tête 35 | 36 | 37 | Fichiers d%27en-tête 38 | 39 | 40 | 41 | 42 | Fichiers de ressources 43 | 44 | 45 | 46 | 47 | 48 | Fichiers sources 49 | 50 | 51 | Fichiers sources 52 | 53 | 54 | Fichiers sources 55 | 56 | 57 | Fichiers sources 58 | 59 | 60 | Fichiers sources 61 | 62 | 63 | 64 | 65 | Fichiers de ressources 66 | 67 | 68 | -------------------------------------------------------------------------------- /MFSrScreenCapture/ScreenCaptureSchemeHandler.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // ScreenCaptureSchemeHandler.h 3 | // Copyright (C) 2013 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #ifndef SCREENCAPTURESCHEMEHANDLER_H 19 | #define SCREENCAPTURESCHEMEHANDLER_H 20 | 21 | class CScreenCaptureSchemeHandler : BaseObject, public IMFSchemeHandler{ 22 | 23 | public: 24 | 25 | static HRESULT CreateInstance(IUnknown*, REFIID, void**); 26 | 27 | // IUnknown 28 | STDMETHODIMP QueryInterface(REFIID, void**); 29 | STDMETHODIMP_(ULONG) AddRef(); 30 | STDMETHODIMP_(ULONG) Release(); 31 | 32 | // IMFSchemeHandler 33 | STDMETHODIMP BeginCreateObject(LPCWSTR, DWORD, IPropertyStore*, IUnknown**, IMFAsyncCallback*, IUnknown*); 34 | STDMETHODIMP CancelObjectCreation(IUnknown*){ return E_NOTIMPL; } 35 | STDMETHODIMP EndCreateObject(IMFAsyncResult*, MF_OBJECT_TYPE*, IUnknown**); 36 | 37 | private: 38 | 39 | CScreenCaptureSchemeHandler() : m_nRefCount(1){ TRACE_SCHEME((L"Scheme::CTOR")); } 40 | virtual ~CScreenCaptureSchemeHandler(){ TRACE_SCHEME((L"Scheme::DTOR")); } 41 | 42 | volatile long m_nRefCount; 43 | }; 44 | 45 | #endif -------------------------------------------------------------------------------- /MFSrScreenCapture/ScreenCapture_def.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // ScreenCapture_def.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef SCREENCAPTURE_DEF_H 5 | #define SCREENCAPTURE_DEF_H 6 | 7 | // GetDIBits provide a reverse image. 8 | // We can handle it if we define REVERSE_GDI_IMAGE. 9 | // Otherwise, we can use the Video Renderer or MFT to handle it. 10 | #define REVERSE_GDI_IMAGE 11 | 12 | //#define MF_SCREEN_RESOLUTION_24 13 | #define MF_SCREEN_RESOLUTION_32 14 | 15 | #define VIDEO_WIDTH 400 16 | #define VIDEO_HEIGHT 300 17 | #define VIDEO_FRAME_RATE 10 18 | #define VIDEO_FRAME_RATE_NUM 10 // for MFRatio 19 | #define VIDEO_FRAME_RATE_DEN 1 // for MFRatio 20 | 21 | #define VIDEO_DURATION 10000000 / VIDEO_FRAME_RATE 22 | 23 | #if defined MF_SCREEN_RESOLUTION_24 && !defined MF_SCREEN_RESOLUTION_32 24 | #define VideoFormatProject MFVideoFormat_RGB24 25 | #define VIDEO_BYTE_RGB 24 26 | #define VIDEO_OCTET_RGB 3 27 | #elif defined MF_SCREEN_RESOLUTION_32 && !defined MF_SCREEN_RESOLUTION_24 28 | #define VideoFormatProject MFVideoFormat_RGB32 29 | #define VIDEO_BYTE_RGB 32 30 | #define VIDEO_OCTET_RGB 4 31 | #else 32 | #error One screen resolution must be defined ! 33 | #endif 34 | 35 | #endif -------------------------------------------------------------------------------- /MFSrScreenCapture/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.cpp 3 | //---------------------------------------------------------------------------------------------- 4 | #include "StdAfx.h" -------------------------------------------------------------------------------- /MFSrScreenCapture/StdAfx.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef STDAFX_H 5 | #define STDAFX_H 6 | 7 | #pragma once 8 | #define WIN32_LEAN_AND_MEAN 9 | #define STRICT 10 | 11 | //---------------------------------------------------------------------------------------------- 12 | // Microsoft Windows SDK for Windows 7 13 | #include 14 | #include 15 | #include 16 | 17 | #ifdef _DEBUG 18 | #define MF_USE_LOGGING 1 19 | //#define MF_USE_LOGREFCOUNT 20 | //#define MF_TRACE_SOURCE 21 | //#define MF_TRACE_EVENTSOURCE 22 | //#define MF_TRACE_SCHEME 23 | //#define MF_TRACE_STREAMSOURCE 24 | #else 25 | #define MF_USE_LOGGING 0 26 | #endif 27 | 28 | //---------------------------------------------------------------------------------------------- 29 | // Common Project Files 30 | #include "../Common/MFInclude.h" 31 | 32 | //---------------------------------------------------------------------------------------------- 33 | // Project Files 34 | #include "ScreenCaptureSchemeHandler.h" 35 | #include "ScreenCapture_def.h" 36 | #include "ScreenCaptureStream.h" 37 | #include "ScreenCapture.h" 38 | 39 | #endif -------------------------------------------------------------------------------- /MFSrScreenCapture/ToDo.txt: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // ToDo 3 | //---------------------------------------------------------------------------------------------- 4 | 5 | -> CScreenCapture::CreateVideoMediaType 6 | 7 | -> Get Video Frame Size eg : Screen Size 8 | 9 | -> CScreenCaptureStream::CreateScreenVideoSample 10 | 11 | -> Make it asynchronous : it seems that it takes long time to go from pause/stop states to play state. 12 | 13 | -> When stopping the source, two Microsoft threads exit with code 0x1. -------------------------------------------------------------------------------- /MFSrScreenCapture/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFSrScreenCapture/resource.h -------------------------------------------------------------------------------- /MFTA52Decoder/MFTA52Decoder.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | DllCanUnloadNow PRIVATE 3 | DllRegisterServer PRIVATE 4 | DllUnregisterServer PRIVATE 5 | DllGetClassObject PRIVATE -------------------------------------------------------------------------------- /MFTA52Decoder/MFTA52Decoder.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFTA52Decoder/MFTA52Decoder.rc -------------------------------------------------------------------------------- /MFTA52Decoder/MFTA52Decoder.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Fichiers d%27en-tête 20 | 21 | 22 | Fichiers d%27en-tête 23 | 24 | 25 | Fichiers d%27en-tête 26 | 27 | 28 | Fichiers d%27en-tête 29 | 30 | 31 | 32 | 33 | Fichiers sources 34 | 35 | 36 | Fichiers sources 37 | 38 | 39 | Fichiers sources 40 | 41 | 42 | Fichiers sources 43 | 44 | 45 | Fichiers sources 46 | 47 | 48 | 49 | 50 | Fichiers de ressources 51 | 52 | 53 | 54 | 55 | 56 | Fichiers de ressources 57 | 58 | 59 | -------------------------------------------------------------------------------- /MFTA52Decoder/MFTVersion.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // MFTVersion.h 3 | //-------------------------------------------------------------------------------------- 4 | #ifndef MFTVERSION_H 5 | #define MFTVERSION_H 6 | 7 | #define MFT_MAJOR_VERSION 1 8 | #define MFT_MINUS_VERSION 0 9 | #define MFT_MAJOR_BUGVERSION 0 10 | #define MFT_MINUS_BUGVERSION 0 11 | 12 | #define SZMFT_VERSION "1.0.0.0" 13 | #define SZMFT_COMPANY "MFNode Project : by Dumonteil David" 14 | #define SZMFT_DESCRIPTION "Media Foundation Transform A52 Decoder" 15 | #define SZMFT_DLLNAME "MFTA52Decoder.dll" 16 | #define SZMFT_COPYRIGHT "Copyright (C) 2014 Dumonteil David" 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /MFTA52Decoder/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------------------------- 2 | // StdAfx.cpp 3 | //----------------------------------------------------------------------------------------------- 4 | #include "StdAfx.h" -------------------------------------------------------------------------------- /MFTA52Decoder/StdAfx.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------------------------- 2 | // StdAfx.h 3 | //----------------------------------------------------------------------------------------------- 4 | #ifndef STDAFX_H 5 | #define STDAFX_H 6 | 7 | #pragma once 8 | #define WIN32_LEAN_AND_MEAN 9 | #define STRICT 10 | 11 | //---------------------------------------------------------------------------------------------- 12 | // A52 Audio Library 13 | #ifdef _DEBUG 14 | #pragma comment(lib, "..\\Debug\\LibA52Audio") 15 | #else 16 | #pragma comment(lib, "..\\Release\\LibA52Audio") 17 | #endif 18 | 19 | //---------------------------------------------------------------------------------------------- 20 | // Microsoft Windows SDK for Windows 7 21 | #include 22 | #include 23 | #include 24 | 25 | #ifdef _DEBUG 26 | #define MF_USE_LOGGING 1 27 | //#define MF_USE_LOGREFCOUNT 28 | //#define MF_TRACE_TRANSFORM 29 | #else 30 | #define MF_USE_LOGGING 0 31 | #endif 32 | 33 | //---------------------------------------------------------------------------------------------- 34 | // Common Project Files 35 | #include "../Common/MFInclude.h" 36 | 37 | //---------------------------------------------------------------------------------------------- 38 | // A52 Audio Library 39 | #include "../LibA52Audio/inttypes.h" 40 | #include "../LibA52Audio/a52.h" 41 | #include "../LibA52Audio/a52_internal.h" 42 | 43 | //---------------------------------------------------------------------------------------------- 44 | // Project Files 45 | #include "A52Decoder.h" 46 | 47 | #endif -------------------------------------------------------------------------------- /MFTA52Decoder/ToDo.txt: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // ToDo 3 | //---------------------------------------------------------------------------------------------- 4 | 5 | - This is an alpha version. I did not test it yet. I currently try to improve the A52 source. -------------------------------------------------------------------------------- /MFTA52Decoder/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFTA52Decoder/resource.h -------------------------------------------------------------------------------- /MFTCudaDecoder/CudaDecoder.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // CudaDecoder.h 3 | // Copyright (C) 2014 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #ifndef CUDADECODER_H 19 | #define CUDADECODER_H 20 | 21 | class CCudaDecoder{ 22 | 23 | public: 24 | 25 | CCudaDecoder() : m_pDecoder(NULL){} 26 | ~CCudaDecoder(){ Release(); } 27 | 28 | HRESULT InitDecoder(const CUvideoctxlock, const UINT32, const UINT32, const BOOL); 29 | void Release(){ if(m_pDecoder){ cuvidDestroyDecoder(m_pDecoder); m_pDecoder = NULL; } } 30 | const BOOL IsInit() const{ return m_pDecoder != NULL; } 31 | 32 | HRESULT DecodePicture(CUVIDPICPARAMS*); 33 | HRESULT MapFrame(int, CUdeviceptr*, unsigned int*, CUVIDPROCPARAMS*); 34 | HRESULT UnmapFrame(CUdeviceptr); 35 | 36 | private: 37 | 38 | CUvideodecoder m_pDecoder; 39 | }; 40 | 41 | #endif -------------------------------------------------------------------------------- /MFTCudaDecoder/CudaManager.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // CudaManager.h 3 | // Copyright (C) 2014 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #ifndef CUDAMANAGER_H 19 | #define CUDAMANAGER_H 20 | 21 | class CCudaManager{ 22 | 23 | public: 24 | 25 | CCudaManager() : m_pCudaContext(NULL), m_pVideoCtxLock(NULL), m_ReadbackSID(NULL){ m_btFrame[0] = NULL; m_btFrame[1] = NULL; } 26 | ~CCudaManager(){ Release(); } 27 | 28 | HRESULT InitCudaManager(); 29 | HRESULT InitFrameCuda(const UINT, const UINT); 30 | void Release(); 31 | 32 | const CUvideoctxlock GetVideoLock() const{ return m_pVideoCtxLock; } 33 | const CUcontext GetCudaContext() const{ return m_pCudaContext; } 34 | const CUstream GetCudaStream() const{ return m_ReadbackSID; } 35 | 36 | BYTE* GetFrame(){ return m_btFrame[0]; } 37 | void SetNV12ToYV12(BYTE**, const UINT, const UINT, const UINT); 38 | 39 | private: 40 | 41 | CUdevice m_CudaDevice; 42 | CUcontext m_pCudaContext; 43 | CUstream m_ReadbackSID; 44 | CUvideoctxlock m_pVideoCtxLock; 45 | 46 | BYTE* m_btFrame[2]; 47 | }; 48 | 49 | #endif -------------------------------------------------------------------------------- /MFTCudaDecoder/MFTCudaDecoder.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | DllCanUnloadNow PRIVATE 3 | DllRegisterServer PRIVATE 4 | DllUnregisterServer PRIVATE 5 | DllGetClassObject PRIVATE -------------------------------------------------------------------------------- /MFTCudaDecoder/MFTCudaDecoder.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFTCudaDecoder/MFTCudaDecoder.rc -------------------------------------------------------------------------------- /MFTCudaDecoder/MFTCudaDecoder_Def.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFTCudaDecoder_Def.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef MFTCUDADECODER_DEF_H 5 | #define MFTCUDADECODER_DEF_H 6 | 7 | #define MAX_CUDA_DECODED_SURFACES 20 8 | #define NUM_CUDA_OUTPUT_SURFACES 1 9 | 10 | struct SCUDAFRAME{ 11 | 12 | int iTemporal; 13 | int iPType; 14 | int iIndex; 15 | REFERENCE_TIME rtTime; 16 | }; 17 | 18 | #endif -------------------------------------------------------------------------------- /MFTCudaDecoder/MFTVersion.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // MFTVersion.h 3 | //-------------------------------------------------------------------------------------- 4 | #ifndef MFTVERSION_H 5 | #define MFTVERSION_H 6 | 7 | #define MFT_MAJOR_VERSION 1 8 | #define MFT_MINUS_VERSION 4 9 | #define MFT_MAJOR_BUGVERSION 0 10 | #define MFT_MINUS_BUGVERSION 0 11 | 12 | #define SZMFT_VERSION "1.4.0.0" 13 | #define SZMFT_COMPANY "MFNode Project : by Dumonteil David" 14 | #define SZMFT_DESCRIPTION "Media Foundation Transform Cuda" 15 | #define SZMFT_DLLNAME "MFTCudaDecoder.dll" 16 | #define SZMFT_COPYRIGHT "Copyright (C) 2014 Dumonteil David" 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /MFTCudaDecoder/Resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFTCudaDecoder/Resource.h -------------------------------------------------------------------------------- /MFTCudaDecoder/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.cpp 3 | //---------------------------------------------------------------------------------------------- 4 | #include "Stdafx.h" -------------------------------------------------------------------------------- /MFTCudaDecoder/StdAfx.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef STDAFX_H 5 | #define STDAFX_H 6 | 7 | #pragma once 8 | #define WIN32_LEAN_AND_MEAN 9 | #define STRICT 10 | 11 | //---------------------------------------------------------------------------------------------- 12 | // Cuda SDK v7.0 13 | // "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.0\lib\Win32\" 14 | #pragma comment(lib, "cuda") 15 | #pragma comment(lib, "nvcuvid") 16 | 17 | //---------------------------------------------------------------------------------------------- 18 | // Microsoft Windows SDK for Windows 7 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | //---------------------------------------------------------------------------------------------- 25 | // STL 26 | #include 27 | using std::wstring; 28 | 29 | //---------------------------------------------------------------------------------------------- 30 | // Common Project Files 31 | #ifdef _DEBUG 32 | #define MF_USE_LOGGING 1 33 | //#define MF_USE_LOGREFCOUNT 34 | //#define MF_TRACE_TRANSFORM 35 | //#define MF_TRACE_TIME 36 | #else 37 | #define MF_USE_LOGGING 0 38 | #endif 39 | 40 | #include "../Common/MFInclude.h" 41 | 42 | //---------------------------------------------------------------------------------------------- 43 | // Cuda SDK v7.0 44 | // "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.0\include\" 45 | #include 46 | #include 47 | #include 48 | 49 | //---------------------------------------------------------------------------------------------- 50 | // Private trace 51 | //#define TRACE_PICTURE_PARAM 52 | //#define TRACE_SLICE 53 | //#define TRACE_PICTURE_OUTPUT 54 | //#define TRACE_TIME_REFERENCE 55 | //#define TRACE_SET_PTS 56 | //#define TRACE_CUDA_PTS 57 | //#define TRACE_INPUT_REFERENCE 58 | //#define TRACE_OUTPUT_PTS 59 | 60 | // {3584CA5C-947A-46B2-AC8E-48B0DB713C58} 61 | DEFINE_GUID(MFSampleExtension_PictureType, 0x3584ca5c, 0x947a, 0x46b2, 0xac, 0x8e, 0x48, 0xb0, 0xdb, 0x71, 0x3c, 0x58); 62 | 63 | //---------------------------------------------------------------------------------------------- 64 | // Project Files 65 | #include "MFTCudaDecoder_Def.h" 66 | #include "CudaManager.h" 67 | #include "CudaDecoder.h" 68 | #include "CudaFrame.h" 69 | #include "MFTCudaDecoder.h" 70 | 71 | #endif -------------------------------------------------------------------------------- /MFTCudaDecoder/ToDo.txt: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // ToDo 3 | //---------------------------------------------------------------------------------------------- 4 | 5 | - Check ratio on input type 6 | - Handle non progressive frame 7 | - Present first ready frame quickly 8 | - Also first cuda frame is never correctly decoded by cuda decoder... 9 | - Last frame has sometimes bad PTS, and has been already presented... 10 | - Need to check video timestamp with audio timestamp 11 | - This new design seems to introduce flickering with EVR : Perhaps this decoder should be asynchronous, due to the way Nvidia GPU behaves. -------------------------------------------------------------------------------- /MFTDxva2Decoder/MFDxva2Definition.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFDxva2Definition.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef MFDXVA2DEFINITION_H 5 | #define MFDXVA2DEFINITION_H 6 | 7 | #define NUM_DXVA2_SURFACE 24 8 | 9 | struct VIDEO_PARAMS{ 10 | 11 | unsigned int uiNumSlices; 12 | unsigned int uiBitstreamDataLen; 13 | const unsigned char* pBitstreamData; 14 | const unsigned int* pSliceDataOffsets; 15 | 16 | int iCurPictureId; 17 | int iForwardRefIdx; 18 | int iBackwardRefIdx; 19 | int PicWidthInMbs; 20 | int FrameHeightInMbs; 21 | 22 | int field_pic_flag; 23 | int bottom_field_flag; 24 | int second_field; 25 | 26 | int ref_pic_flag; 27 | int intra_pic_flag; 28 | int picture_coding_type; 29 | int f_code[2][2]; 30 | int intra_dc_precision; 31 | int picture_structure; 32 | int top_field_first; 33 | int frame_pred_frame_dct; 34 | int concealment_motion_vectors; 35 | int q_scale_type; 36 | int intra_vlc_format; 37 | int alternate_scan; 38 | int repeat_first_field; 39 | int chroma_420_type; 40 | int progressive_frame; 41 | int full_pel_forward_vector; 42 | int full_pel_backward_vector; 43 | 44 | unsigned char QuantMatrixIntra[64]; 45 | unsigned char QuantMatrixInter[64]; 46 | }; 47 | 48 | struct STemporalRef{ 49 | 50 | int iTemporal; 51 | int iPType; 52 | int iIndex; 53 | REFERENCE_TIME rtTime; 54 | }; 55 | 56 | #endif -------------------------------------------------------------------------------- /MFTDxva2Decoder/MFTDxva2Decoder.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | DllCanUnloadNow PRIVATE 3 | DllRegisterServer PRIVATE 4 | DllUnregisterServer PRIVATE 5 | DllGetClassObject PRIVATE -------------------------------------------------------------------------------- /MFTDxva2Decoder/MFTDxva2Decoder.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFTDxva2Decoder/MFTDxva2Decoder.rc -------------------------------------------------------------------------------- /MFTDxva2Decoder/MFTVersion.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // MFTVersion.h 3 | //-------------------------------------------------------------------------------------- 4 | #ifndef MFTVERSION_H 5 | #define MFTVERSION_H 6 | 7 | #define MFT_MAJOR_VERSION 1 8 | #define MFT_MINUS_VERSION 1 9 | #define MFT_MAJOR_BUGVERSION 0 10 | #define MFT_MINUS_BUGVERSION 0 11 | 12 | #define SZMFT_VERSION "1.1.0.0" 13 | #define SZMFT_COMPANY "MFNode Project : by Dumonteil David" 14 | #define SZMFT_DESCRIPTION "Media Foundation Transform Dxva2" 15 | #define SZMFT_DLLNAME "MFTDxva2Decoder.dll" 16 | #define SZMFT_COPYRIGHT "Copyright (C) 2014 Dumonteil David" 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /MFTDxva2Decoder/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.cpp 3 | //---------------------------------------------------------------------------------------------- 4 | #include "Stdafx.h" -------------------------------------------------------------------------------- /MFTDxva2Decoder/StdAfx.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef STDAFX_H 5 | #define STDAFX_H 6 | 7 | #pragma once 8 | #define WIN32_LEAN_AND_MEAN 9 | #define STRICT 10 | 11 | //---------------------------------------------------------------------------------------------- 12 | // Microsoft Windows SDK for Windows 7 13 | #include 14 | #include 15 | #include 16 | 17 | //---------------------------------------------------------------------------------------------- 18 | // Common Project Files 19 | #ifdef _DEBUG 20 | #define MF_USE_LOGGING 1 21 | //#define MF_USE_LOGREFCOUNT 22 | //#define MF_TRACE_TRANSFORM 23 | //#define TRACE_TIME_REFERENCE 24 | //#define TRACE_INPUT_REFERENCE 25 | //#define TRACE_SET_PTS 26 | //#define TRACE_MPEG_PTS 27 | #define TRACE_DXVA2_DECODER_CAPS 28 | //#define TRACE_DXVA2 29 | #else 30 | #define MF_USE_LOGGING 0 31 | #endif 32 | 33 | #include "../Common/MFInclude.h" 34 | 35 | //---------------------------------------------------------------------------------------------- 36 | // Project Files 37 | #include "MFDxva2Definition.h" 38 | #include "TSScheduler.h" 39 | #include "SurfaceParam.h" 40 | #include "Dxva2Decoder.h" 41 | 42 | #endif -------------------------------------------------------------------------------- /MFTDxva2Decoder/SurfaceParam.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // SurfaceParam.h 3 | // Copyright (C) 2015 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #ifndef SURFACEPARAM_H 19 | #define SURFACEPARAM_H 20 | 21 | class CSurfaceParam : RefCountedObject, public IUnknown{ 22 | 23 | public: 24 | 25 | // IUnknown 26 | STDMETHODIMP QueryInterface(REFIID riid, void** ppv){ static const QITAB qit[] = {QITABENT(CSurfaceParam, IUnknown), { 0 }}; return QISearch(this, qit, riid, ppv); } 27 | STDMETHODIMP_(ULONG) AddRef(){ return RefCountedObject::AddRef(); } 28 | STDMETHODIMP_(ULONG) Release(){ return RefCountedObject::Release(); } 29 | 30 | CSurfaceParam(const DWORD iSurfaceIndex) : m_iSurfaceIndex(iSurfaceIndex){} 31 | virtual ~CSurfaceParam(){} 32 | 33 | const DWORD GetSurfaceIndex() const{ return m_iSurfaceIndex; } 34 | 35 | private: 36 | 37 | DWORD m_iSurfaceIndex; 38 | }; 39 | 40 | #endif -------------------------------------------------------------------------------- /MFTDxva2Decoder/ToDo.txt: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // ToDo 3 | //---------------------------------------------------------------------------------------------- 4 | 5 | - Handle differents cases where nodes are disconnected/reconnected, source or EVR change, etc... 6 | - Use attributes to change dxva2 settings for MFVideoChromaSubsampling/MFNominalRange/MFVideoTransferMatrix/MFVideoPrimaries, etc... 7 | - Handle DXVA2_E_NEW_VIDEO_DEVICE (m_pDeviceManager->TestDevice). 8 | - Adapt TimeStampScheduler to handle free surface. 9 | - Change code to handle some of those cases : new EVR/Source connection. -------------------------------------------------------------------------------- /MFTDxva2Decoder/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFTDxva2Decoder/resource.h -------------------------------------------------------------------------------- /MFTJpegEncoder/JpegStream.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // JpegStream.cpp 3 | // Copyright (C) 2013 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #include "StdAfx.h" 19 | 20 | HRESULT CJpegStream::CreateInstance(CJpegStream** ppStream){ 21 | 22 | CJpegStream* pStream = new (std::nothrow)CJpegStream; 23 | 24 | if(pStream == NULL) 25 | return E_OUTOFMEMORY; 26 | 27 | *ppStream = pStream; 28 | 29 | return S_OK; 30 | } 31 | 32 | HRESULT CJpegStream::QueryInterface(REFIID riid, void** ppv){ 33 | 34 | static const QITAB qit[] = {QITABENT(CJpegStream, IStream), QITABENT(CJpegStream, ISequentialStream), {0}}; 35 | 36 | return QISearch(this, qit, riid, ppv); 37 | } 38 | 39 | ULONG CJpegStream::AddRef(){ 40 | 41 | LONG lRef = InterlockedIncrement(&m_nRefCount); 42 | 43 | return lRef; 44 | } 45 | 46 | ULONG CJpegStream::Release(){ 47 | 48 | ULONG uCount = InterlockedDecrement(&m_nRefCount); 49 | 50 | if(uCount == 0){ 51 | delete this; 52 | } 53 | 54 | return uCount; 55 | } 56 | 57 | HRESULT CJpegStream::Seek(LARGE_INTEGER /*dlibMove*/, DWORD /*dwOrigin*/, ULARGE_INTEGER *plibNewPosition){ 58 | 59 | // dwOrigin STREAM_SEEK_SET 0 60 | // dwOrigin STREAM_SEEK_CUR 1 61 | // dwOrigin STREAM_SEEK_END 2 62 | 63 | // The call of Seek is always 0. 64 | m_JpegBuffer.Reset(); 65 | plibNewPosition->QuadPart = 0; 66 | 67 | return S_OK; 68 | } 69 | 70 | HRESULT CJpegStream::SetSize(ULARGE_INTEGER libNewSize){ 71 | 72 | HRESULT hr; 73 | IF_FAILED_RETURN(hr = m_JpegBuffer.Reserve(libNewSize.LowPart)); 74 | return hr; 75 | } 76 | 77 | HRESULT CJpegStream::Write(void const *pv, ULONG cb, ULONG *pcbWritten){ 78 | 79 | HRESULT hr; 80 | 81 | IF_FAILED_RETURN(hr = m_JpegBuffer.Reserve(cb)); 82 | 83 | memcpy(m_JpegBuffer.GetReadStartBuffer(), pv, cb); 84 | 85 | IF_FAILED_RETURN(hr = m_JpegBuffer.SetEndPosition(cb)); 86 | 87 | *pcbWritten = cb; 88 | 89 | return hr; 90 | } -------------------------------------------------------------------------------- /MFTJpegEncoder/JpegStream.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // JpegStream.h 3 | // Copyright (C) 2013 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #ifndef JPEGSTREAM_H 19 | #define JPEGSTREAM_H 20 | 21 | class CJpegStream : public IStream{ 22 | 23 | public: 24 | 25 | static HRESULT CreateInstance(CJpegStream**); 26 | 27 | // IUnknown 28 | STDMETHODIMP QueryInterface(REFIID, void**); 29 | STDMETHODIMP_(ULONG) AddRef(); 30 | STDMETHODIMP_(ULONG) Release(); 31 | 32 | // IStream 33 | STDMETHODIMP Seek(LARGE_INTEGER, DWORD, ULARGE_INTEGER*); 34 | STDMETHODIMP SetSize(ULARGE_INTEGER); 35 | STDMETHODIMP CopyTo(IStream*, ULARGE_INTEGER, ULARGE_INTEGER*, ULARGE_INTEGER*){ return E_NOTIMPL; } 36 | STDMETHODIMP Commit(DWORD){ return E_NOTIMPL; } 37 | STDMETHODIMP Revert(){ return E_NOTIMPL; } 38 | STDMETHODIMP LockRegion(ULARGE_INTEGER, ULARGE_INTEGER, DWORD){ return E_NOTIMPL; } 39 | STDMETHODIMP UnlockRegion(ULARGE_INTEGER, ULARGE_INTEGER, DWORD){ return E_NOTIMPL; } 40 | STDMETHODIMP Stat(STATSTG*, DWORD){ return E_NOTIMPL; } 41 | STDMETHODIMP Clone(IStream**){ return E_NOTIMPL; } 42 | 43 | // IID_ISequentialStream 44 | STDMETHODIMP Read(void*, ULONG, ULONG*){ return E_NOTIMPL; } 45 | STDMETHODIMP Write(void const*, ULONG, ULONG*); 46 | 47 | BYTE* GetBufferAndSize(DWORD& dwSize){ dwSize = m_JpegBuffer.GetBufferSize(); return m_JpegBuffer.GetStartBuffer(); } 48 | void Initialize(const DWORD dwSize){ m_JpegBuffer.Initialize(dwSize); } 49 | 50 | private: 51 | 52 | CJpegStream() : m_nRefCount(1){} 53 | virtual ~CJpegStream(){} 54 | 55 | volatile long m_nRefCount; 56 | 57 | CMFBuffer m_JpegBuffer; 58 | }; 59 | 60 | #endif -------------------------------------------------------------------------------- /MFTJpegEncoder/MFTJpegEncoder.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | DllCanUnloadNow PRIVATE 3 | DllRegisterServer PRIVATE 4 | DllUnregisterServer PRIVATE 5 | DllGetClassObject PRIVATE -------------------------------------------------------------------------------- /MFTJpegEncoder/MFTJpegEncoder.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFTJpegEncoder/MFTJpegEncoder.rc -------------------------------------------------------------------------------- /MFTJpegEncoder/MFTJpegEncoder.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Fichiers sources 20 | 21 | 22 | Fichiers sources 23 | 24 | 25 | Fichiers sources 26 | 27 | 28 | Fichiers sources 29 | 30 | 31 | Fichiers sources 32 | 33 | 34 | Fichiers sources 35 | 36 | 37 | 38 | 39 | Fichiers d%27en-tête 40 | 41 | 42 | Fichiers d%27en-tête 43 | 44 | 45 | Fichiers d%27en-tête 46 | 47 | 48 | Fichiers d%27en-tête 49 | 50 | 51 | Fichiers d%27en-tête 52 | 53 | 54 | 55 | 56 | Fichiers de ressources 57 | 58 | 59 | 60 | 61 | 62 | Fichiers de ressources 63 | 64 | 65 | -------------------------------------------------------------------------------- /MFTJpegEncoder/MFTVersion.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // MFTVersion.h 3 | //-------------------------------------------------------------------------------------- 4 | #ifndef MFTVERSION_H 5 | #define MFTVERSION_H 6 | 7 | #define MFT_MAJOR_VERSION 1 8 | #define MFT_MINUS_VERSION 1 9 | #define MFT_MAJOR_BUGVERSION 0 10 | #define MFT_MINUS_BUGVERSION 0 11 | 12 | #define SZMFT_VERSION "1.1.0.0" 13 | #define SZMFT_COMPANY "MFNode Project : by Dumonteil David" 14 | #define SZMFT_DESCRIPTION "Media Foundation Transform Jpeg" 15 | #define SZMFT_DLLNAME "MFTJpegEncoder.dll" 16 | #define SZMFT_COPYRIGHT "Copyright (C) 2013 Dumonteil David" 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /MFTJpegEncoder/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.cpp 3 | //---------------------------------------------------------------------------------------------- 4 | #include "Stdafx.h" -------------------------------------------------------------------------------- /MFTJpegEncoder/StdAfx.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef STDAFX_H 5 | #define STDAFX_H 6 | 7 | #pragma once 8 | #define WIN32_LEAN_AND_MEAN 9 | #define STRICT 10 | 11 | //---------------------------------------------------------------------------------------------- 12 | // Microsoft Windows SDK for Windows 7 13 | #pragma comment(lib, "Gdiplus") 14 | 15 | //---------------------------------------------------------------------------------------------- 16 | // Microsoft Windows SDK for Windows 7 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | using namespace Gdiplus; 25 | 26 | //---------------------------------------------------------------------------------------------- 27 | // Common Project Files 28 | #ifdef _DEBUG 29 | #define MF_USE_LOGGING 1 30 | //#define MF_USE_LOGREFCOUNT 31 | //#define MF_TRACE_TRANSFORM 32 | #else 33 | #define MF_USE_LOGGING 0 34 | #endif 35 | 36 | #include "../Common/MFInclude.h" 37 | 38 | // Project Files 39 | #include "JpegStream.h" 40 | #include "MFTJpegEncoder.h" 41 | 42 | #endif -------------------------------------------------------------------------------- /MFTJpegEncoder/ToDo.txt: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // ToDo 3 | //---------------------------------------------------------------------------------------------- 4 | 5 | - Implement IMFAttributes to be able to change jpeg's encoding quality. 6 | - Set correct size in GetOutputStreamInfo. -------------------------------------------------------------------------------- /MFTJpegEncoder/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFTJpegEncoder/resource.h -------------------------------------------------------------------------------- /MFTMpeg12Decoder/MFTMpeg12Decoder.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | DllCanUnloadNow PRIVATE 3 | DllRegisterServer PRIVATE 4 | DllUnregisterServer PRIVATE 5 | DllGetClassObject PRIVATE 6 | 7 | -------------------------------------------------------------------------------- /MFTMpeg12Decoder/MFTMpeg12Decoder.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFTMpeg12Decoder/MFTMpeg12Decoder.rc -------------------------------------------------------------------------------- /MFTMpeg12Decoder/MFTMpeg12Decoder.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Fichiers d%27en-tête 20 | 21 | 22 | Fichiers d%27en-tête 23 | 24 | 25 | Fichiers d%27en-tête 26 | 27 | 28 | Fichiers d%27en-tête 29 | 30 | 31 | 32 | 33 | Fichiers de ressources 34 | 35 | 36 | 37 | 38 | Fichiers de ressources 39 | 40 | 41 | 42 | 43 | Fichiers sources 44 | 45 | 46 | Fichiers sources 47 | 48 | 49 | Fichiers sources 50 | 51 | 52 | Fichiers sources 53 | 54 | 55 | Fichiers sources 56 | 57 | 58 | -------------------------------------------------------------------------------- /MFTMpeg12Decoder/MFTVersion.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // MFTVersion.h 3 | //-------------------------------------------------------------------------------------- 4 | #ifndef MFTVERSION_H 5 | #define MFTVERSION_H 6 | 7 | #define MFT_MAJOR_VERSION 1 8 | #define MFT_MINUS_VERSION 1 9 | #define MFT_MAJOR_BUGVERSION 0 10 | #define MFT_MINUS_BUGVERSION 0 11 | 12 | #define SZMFT_VERSION "1.1.0.0" 13 | #define SZMFT_COMPANY "MFNode Project : by Dumonteil David" 14 | #define SZMFT_DESCRIPTION "Media Foundation Transform Mp1-Mp2 Audio" 15 | #define SZMFT_DLLNAME "MFTMpeg12Decoder.dll" 16 | #define SZMFT_COPYRIGHT "Copyright (C) 2013 Dumonteil David" 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /MFTMpeg12Decoder/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------------------------- 2 | // StdAfx.cpp 3 | //----------------------------------------------------------------------------------------------- 4 | #include "StdAfx.h" -------------------------------------------------------------------------------- /MFTMpeg12Decoder/StdAfx.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef STDAFX_H 5 | #define STDAFX_H 6 | 7 | #pragma once 8 | #define WIN32_LEAN_AND_MEAN 9 | #define STRICT 10 | 11 | //---------------------------------------------------------------------------------------------- 12 | // Mpeg Audio Library 13 | #ifdef _DEBUG 14 | #pragma comment(lib, "..\\Debug\\LibMpegAudio") 15 | #else 16 | #pragma comment(lib, "..\\Release\\LibMpegAudio") 17 | #endif 18 | 19 | //---------------------------------------------------------------------------------------------- 20 | // Microsoft Windows SDK for Windows 7 21 | #include 22 | #include 23 | #include 24 | 25 | #ifdef _DEBUG 26 | #define MF_USE_LOGGING 1 27 | //#define MF_USE_LOGREFCOUNT 28 | //#define MF_TRACE_TRANSFORM 29 | #else 30 | #define MF_USE_LOGGING 0 31 | #endif 32 | 33 | //---------------------------------------------------------------------------------------------- 34 | // Common Project Files 35 | #include "../Common/MFInclude.h" 36 | 37 | //---------------------------------------------------------------------------------------------- 38 | // Mpeg Audio Library 39 | #include "..\LibMpegAudio\Mpeg12LibDefinition.h" 40 | #include "..\LibMpegAudio\Mpeg12Decoder.h" 41 | 42 | //---------------------------------------------------------------------------------------------- 43 | // Test 44 | //#define TRACE_REFERENCE_TIME 45 | 46 | //---------------------------------------------------------------------------------------------- 47 | // Project Files 48 | #include "MFTMpegAudioDecoder.h" 49 | 50 | #endif -------------------------------------------------------------------------------- /MFTMpeg12Decoder/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFTMpeg12Decoder/resource.h -------------------------------------------------------------------------------- /MFTMpeg2Decoder/MFTMpeg2Decoder.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | DllCanUnloadNow PRIVATE 3 | DllRegisterServer PRIVATE 4 | DllUnregisterServer PRIVATE 5 | DllGetClassObject PRIVATE -------------------------------------------------------------------------------- /MFTMpeg2Decoder/MFTMpeg2Decoder.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFTMpeg2Decoder/MFTMpeg2Decoder.rc -------------------------------------------------------------------------------- /MFTMpeg2Decoder/MFTVersion.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // MFTVersion.h 3 | //-------------------------------------------------------------------------------------- 4 | #ifndef MFTVERSION_H 5 | #define MFTVERSION_H 6 | 7 | #define MFT_MAJOR_VERSION 1 8 | #define MFT_MINUS_VERSION 2 9 | #define MFT_MAJOR_BUGVERSION 0 10 | #define MFT_MINUS_BUGVERSION 3 11 | 12 | #define SZMFT_VERSION "1.2.0.3" 13 | #define SZMFT_COMPANY "MFNode Project : by Dumonteil David" 14 | #define SZMFT_DESCRIPTION "Media Foundation Transform Mpeg2" 15 | #define SZMFT_DLLNAME "MFTMpeg2Decoder.dll" 16 | #define SZMFT_COPYRIGHT "Copyright (C) 2012 Dumonteil David" 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /MFTMpeg2Decoder/Mpeg2Decoder.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // Mpeg2Decoder.cpp 3 | // Copyright (C) 2012 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #include "StdAfx.h" 19 | 20 | HRESULT CMpeg2Decoder::CreateInstance(CMpeg2Decoder** ppDec){ 21 | 22 | HRESULT hr; 23 | IF_FAILED_RETURN(hr = (ppDec == NULL ? E_POINTER : S_OK)); 24 | 25 | CMpeg2Decoder* pDec = new (std::nothrow)CMpeg2Decoder; 26 | 27 | IF_FAILED_RETURN(pDec == NULL ? E_OUTOFMEMORY : S_OK); 28 | 29 | *ppDec = pDec; 30 | (*ppDec)->AddRef(); 31 | 32 | SAFE_RELEASE(pDec); 33 | 34 | return hr; 35 | } 36 | 37 | HRESULT CMpeg2Decoder::QueryInterface(REFIID riid, void** ppv){ 38 | 39 | static const QITAB qit[] = {QITABENT(CMpeg2Decoder, IUnknown), {0}}; 40 | return QISearch(this, qit, riid, ppv); 41 | } -------------------------------------------------------------------------------- /MFTMpeg2Decoder/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.cpp 3 | //---------------------------------------------------------------------------------------------- 4 | #include "StdAfx.h" -------------------------------------------------------------------------------- /MFTMpeg2Decoder/StdAfx.h: -------------------------------------------------------------------------------- 1 | 2 | //---------------------------------------------------------------------------------------------- 3 | // StdAfx.h 4 | //---------------------------------------------------------------------------------------------- 5 | #ifndef STDAFX_H 6 | #define STDAFX_H 7 | 8 | #pragma once 9 | #define WIN32_LEAN_AND_MEAN 10 | #define STRICT 11 | 12 | //---------------------------------------------------------------------------------------------- 13 | // Mpeg2 Lib 14 | #ifdef _DEBUG 15 | #pragma comment(lib, "..\\Debug\\LibMpeg2") 16 | #else 17 | #pragma comment(lib, "..\\Release\\LibMpeg2") 18 | #endif 19 | 20 | //---------------------------------------------------------------------------------------------- 21 | // Microsoft Windows SDK for Windows 7 22 | #include 23 | #include 24 | #include 25 | 26 | #ifdef _DEBUG 27 | #define MF_USE_LOGGING 1 28 | //#define MF_USE_LOGREFCOUNT 29 | //#define MF_TRACE_TIME 30 | #else 31 | #define MF_USE_LOGGING 0 32 | #endif 33 | 34 | //---------------------------------------------------------------------------------------------- 35 | // Common Project Files 36 | #include "../Common/MFInclude.h" 37 | 38 | //---------------------------------------------------------------------------------------------- 39 | // Project Files 40 | #include "Mpeg2Decoder_LibDef.h" 41 | #include "Mpeg2Decoder.h" 42 | #include "MFTVideoMpeg2.h" 43 | 44 | #endif -------------------------------------------------------------------------------- /MFTMpeg2Decoder/ToDo.txt: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // ToDo 3 | //---------------------------------------------------------------------------------------------- 4 | 5 | - Check memory usage 6 | - Check memory leaks 7 | - Check special flag 8 | 9 | - Check or implement dynamic reconnexion 10 | - Check or implement for SSE2/SSE3 for I420/YV12 11 | -------------------------------------------------------------------------------- /MFTMpeg2Decoder/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFTMpeg2Decoder/resource.h -------------------------------------------------------------------------------- /MFTVp6Decoder/MFTVersion.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // MFTVersion.h 3 | //-------------------------------------------------------------------------------------- 4 | #ifndef MFTVERSION_H 5 | #define MFTVERSION_H 6 | 7 | #define MFT_MAJOR_VERSION 1 8 | #define MFT_MINUS_VERSION 0 9 | #define MFT_MAJOR_BUGVERSION 0 10 | #define MFT_MINUS_BUGVERSION 0 11 | 12 | #define SZMFT_VERSION "1.0.0.0" 13 | #define SZMFT_COMPANY "MFNode Project : by Dumonteil David" 14 | #define SZMFT_DESCRIPTION "Media Foundation Transform VP6 Decoder" 15 | #define SZMFT_DLLNAME "MFTVp6Decoder.dll" 16 | #define SZMFT_COPYRIGHT "Copyright (C) 2014 Dumonteil David" 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /MFTVp6Decoder/MFTVp6Decoder.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | DllCanUnloadNow PRIVATE 3 | DllRegisterServer PRIVATE 4 | DllUnregisterServer PRIVATE 5 | DllGetClassObject PRIVATE -------------------------------------------------------------------------------- /MFTVp6Decoder/MFTVp6Decoder.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFTVp6Decoder/MFTVp6Decoder.rc -------------------------------------------------------------------------------- /MFTVp6Decoder/MFTVp6Decoder.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Fichiers d%27en-tête 20 | 21 | 22 | Fichiers d%27en-tête 23 | 24 | 25 | Fichiers d%27en-tête 26 | 27 | 28 | Fichiers d%27en-tête 29 | 30 | 31 | Fichiers d%27en-tête 32 | 33 | 34 | 35 | 36 | Fichiers sources 37 | 38 | 39 | Fichiers sources 40 | 41 | 42 | Fichiers sources 43 | 44 | 45 | Fichiers sources 46 | 47 | 48 | Fichiers sources 49 | 50 | 51 | Fichiers sources 52 | 53 | 54 | Fichiers sources 55 | 56 | 57 | 58 | 59 | Fichiers de ressources 60 | 61 | 62 | 63 | 64 | Fichiers de ressources 65 | 66 | 67 | -------------------------------------------------------------------------------- /MFTVp6Decoder/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------------------------- 2 | // StdAfx.cpp 3 | //----------------------------------------------------------------------------------------------- 4 | #include "StdAfx.h" -------------------------------------------------------------------------------- /MFTVp6Decoder/StdAfx.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------------------------- 2 | // StdAfx.h 3 | //----------------------------------------------------------------------------------------------- 4 | #ifndef STDAFX_H 5 | #define STDAFX_H 6 | 7 | #pragma once 8 | #define WIN32_LEAN_AND_MEAN 9 | #define STRICT 10 | 11 | //---------------------------------------------------------------------------------------------- 12 | // Microsoft Windows SDK for Windows 7 13 | #include 14 | #include 15 | #include 16 | 17 | //---------------------------------------------------------------------------------------------- 18 | // STL 19 | #include 20 | #include 21 | using std::wstring; 22 | using std::wostringstream; 23 | 24 | #ifdef _DEBUG 25 | #define MF_USE_LOGGING 1 26 | //#define MF_USE_LOGREFCOUNT 27 | //#define MF_TRACE_TRANSFORM 28 | #else 29 | #define MF_USE_LOGGING 0 30 | #endif 31 | 32 | //---------------------------------------------------------------------------------------------- 33 | // Common Project Files 34 | #include "../Common/MFInclude.h" 35 | 36 | //---------------------------------------------------------------------------------------------- 37 | // Project Files 38 | #include "VP62.h" 39 | #include "Vp6Decoder.h" 40 | 41 | #endif -------------------------------------------------------------------------------- /MFTVp6Decoder/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFTVp6Decoder/resource.h -------------------------------------------------------------------------------- /MFTWaveMixer/MFTVersion.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // MFTVersion.h 3 | //-------------------------------------------------------------------------------------- 4 | #ifndef MFTVERSION_H 5 | #define MFTVERSION_H 6 | 7 | #define MFT_MAJOR_VERSION 1 8 | #define MFT_MINUS_VERSION 0 9 | #define MFT_MAJOR_BUGVERSION 0 10 | #define MFT_MINUS_BUGVERSION 0 11 | 12 | #define SZMFT_VERSION "1.0.0.0" 13 | #define SZMFT_COMPANY "MFNode Project : by Dumonteil David" 14 | #define SZMFT_DESCRIPTION "Media Foundation Transform Mixer Audio" 15 | #define SZMFT_DLLNAME "MFTWaveMixer.dll" 16 | #define SZMFT_COPYRIGHT "Copyright (C) 2013 Dumonteil David" 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /MFTWaveMixer/MFTWaveMixer.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | DllCanUnloadNow PRIVATE 3 | DllRegisterServer PRIVATE 4 | DllUnregisterServer PRIVATE 5 | DllGetClassObject PRIVATE 6 | 7 | -------------------------------------------------------------------------------- /MFTWaveMixer/MFTWaveMixer.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFTWaveMixer/MFTWaveMixer.rc -------------------------------------------------------------------------------- /MFTWaveMixer/MFTWaveMixer.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Fichiers d%27en-tête 20 | 21 | 22 | Fichiers d%27en-tête 23 | 24 | 25 | Fichiers d%27en-tête 26 | 27 | 28 | Fichiers d%27en-tête 29 | 30 | 31 | 32 | 33 | Fichiers de ressources 34 | 35 | 36 | 37 | 38 | 39 | Fichiers de ressources 40 | 41 | 42 | 43 | 44 | Fichiers sources 45 | 46 | 47 | Fichiers sources 48 | 49 | 50 | Fichiers sources 51 | 52 | 53 | Fichiers sources 54 | 55 | 56 | Fichiers sources 57 | 58 | 59 | -------------------------------------------------------------------------------- /MFTWaveMixer/MFTWaveMixer_Mixer.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFTWaveMixer_Mixer.cpp 3 | // Copyright (C) 2013 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #include "StdAfx.h" 19 | 20 | void CMFTWaveMixer::MixAudio(const BYTE* bInput1, const BYTE* bInput2, BYTE* bOutput, const DWORD dwSize){ 21 | 22 | DWORD sample, channel, cChannels; 23 | 24 | cChannels = NumChannels(); 25 | 26 | int iInput1; 27 | int iInput2; 28 | int iResult; 29 | 30 | if(BitsPerSample() == 8){ 31 | 32 | for(sample = 0; sample < dwSize; ++sample){ 33 | 34 | for(channel = 0; channel < cChannels; ++channel){ 35 | 36 | iInput1 = bInput1[sample * cChannels + channel]; 37 | iInput2 = bInput2[sample * cChannels + channel]; 38 | 39 | iResult = iInput1 + iInput2; 40 | 41 | if(iResult > 127){ 42 | iResult = 127; 43 | } 44 | else if(iResult < -128){ 45 | iResult = -128; 46 | } 47 | 48 | bOutput[sample * cChannels + channel] = (unsigned char)iResult; 49 | } 50 | } 51 | } 52 | else{ 53 | 54 | for(sample = 0; sample < dwSize; ++sample){ 55 | 56 | for(channel = 0; channel < cChannels; ++channel){ 57 | 58 | iInput1 = ((short*)bInput1)[sample * cChannels + channel]; 59 | iInput2 = ((short*)bInput2)[sample * cChannels + channel]; 60 | 61 | iResult = iInput1 + iInput2; 62 | 63 | if(iResult > 32767){ 64 | iResult = 32767; 65 | } 66 | else if(iResult < -32768){ 67 | iResult = -32768; 68 | } 69 | 70 | ((short*)bOutput)[sample * cChannels + channel] = (short)iResult; 71 | } 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /MFTWaveMixer/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------------------------- 2 | // StdAfx.cpp 3 | //----------------------------------------------------------------------------------------------- 4 | #include "StdAfx.h" -------------------------------------------------------------------------------- /MFTWaveMixer/StdAfx.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------------------------- 2 | // StdAfx.h 3 | //----------------------------------------------------------------------------------------------- 4 | #ifndef STDAFX_H 5 | #define STDAFX_H 6 | 7 | #pragma once 8 | #define WIN32_LEAN_AND_MEAN 9 | #define STRICT 10 | 11 | //---------------------------------------------------------------------------------------------- 12 | // Microsoft Windows SDK for Windows 7 13 | #include 14 | #include 15 | #include 16 | 17 | #ifdef _DEBUG 18 | #define MF_USE_LOGGING 1 19 | #define MF_USE_LOGREFCOUNT 20 | #else 21 | #define MF_USE_LOGGING 0 22 | #endif 23 | 24 | //---------------------------------------------------------------------------------------------- 25 | // Common Project Files 26 | #include "../Common/MFInclude.h" 27 | 28 | //---------------------------------------------------------------------------------------------- 29 | // Project Files 30 | #include "MFTWaveMixer.h" 31 | 32 | #endif -------------------------------------------------------------------------------- /MFTWaveMixer/ToDo.txt: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // ToDo 3 | //---------------------------------------------------------------------------------------------- 4 | 5 | - Try the filter with two different samples. 6 | - Make it work when streams have different frequencies. -------------------------------------------------------------------------------- /MFTWaveMixer/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mofo7777/MFNode/50fbdb1ac21022b9846aa70183f9d6abf336b345/MFTWaveMixer/resource.h -------------------------------------------------------------------------------- /Mp3Decoding/MFWaveWriter.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // MFWaveWriter.h 3 | // Copyright (C) 2014 Dumonteil David 4 | // 5 | // MFNode is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // MFNode is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | //---------------------------------------------------------------------------------------------- 18 | #ifndef MFWAVEWRITER_H 19 | #define MFWAVEWRITER_H 20 | 21 | const UINT32 WAVE_HEAD_LEN = 44; 22 | 23 | #define SWAP32(val) (UINT32)((((UINT32)(val)) & 0x000000FF)<<24| \ 24 | (((UINT32)(val)) & 0x0000FF00)<<8 | \ 25 | (((UINT32)(val)) & 0x00FF0000)>>8 | \ 26 | (((UINT32)(val)) & 0xFF000000)>>24) 27 | 28 | #pragma pack(push, 1) 29 | 30 | struct RIFFCHUNK{ 31 | 32 | UINT32 fcc; 33 | UINT32 cb; 34 | }; 35 | 36 | struct RIFFLIST{ 37 | 38 | UINT32 fcc; 39 | UINT32 cb; 40 | UINT32 fccListType; 41 | 42 | }; 43 | 44 | struct WAVEFORM{ 45 | 46 | UINT32 fcc; 47 | UINT32 cb; 48 | UINT16 wFormatTag; 49 | UINT16 nChannels; 50 | UINT32 nSamplesPerSec; 51 | UINT32 nAvgBytesPerSec; 52 | UINT16 nBlockAlign; 53 | UINT16 wBitsPerSample; 54 | }; 55 | 56 | #pragma pack(pop) 57 | 58 | class CMFWaveWriter{ 59 | 60 | public: 61 | 62 | CMFWaveWriter() : m_hFile(INVALID_HANDLE_VALUE){} 63 | ~CMFWaveWriter(){ CLOSE_HANDLE_IF(m_hFile); } 64 | 65 | BOOL Initialize(const WCHAR*); 66 | BOOL WriteWaveData(const BYTE*, const DWORD); 67 | BOOL FinalizeHeader(const WAVEFORM&, const UINT32); 68 | 69 | private: 70 | 71 | HANDLE m_hFile; 72 | 73 | BOOL SetWaveHeader(const WAVEFORM&, const UINT32, BYTE*); 74 | }; 75 | 76 | #endif -------------------------------------------------------------------------------- /Mp3Decoding/Mp3Decoding.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Fichiers d%27en-tête 20 | 21 | 22 | Fichiers d%27en-tête 23 | 24 | 25 | 26 | 27 | Fichiers sources 28 | 29 | 30 | Fichiers sources 31 | 32 | 33 | Fichiers sources 34 | 35 | 36 | -------------------------------------------------------------------------------- /Mp3Decoding/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // Stdafx.cpp 3 | //---------------------------------------------------------------------------------------------- 4 | #include "Stdafx.h" -------------------------------------------------------------------------------- /Mp3Decoding/StdAfx.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------------------------- 2 | // StdAfx.h 3 | //---------------------------------------------------------------------------------------------- 4 | #ifndef STDAFX_H 5 | #define STDAFX_H 6 | 7 | #pragma once 8 | #define WIN32_LEAN_AND_MEAN 9 | #define STRICT 10 | 11 | //---------------------------------------------------------------------------------------------- 12 | // Microsoft Windows SDK for Windows 7 13 | #include 14 | #include 15 | #include 16 | 17 | //---------------------------------------------------------------------------------------------- 18 | // Common Project Files 19 | #ifdef _DEBUG 20 | #define MF_USE_LOGGING 1 21 | #else 22 | #define MF_USE_LOGGING 0 23 | #endif 24 | 25 | #include "../Common/MFInclude.h" 26 | 27 | //---------------------------------------------------------------------------------------------- 28 | // Project Files 29 | #include "MFWaveWriter.h" 30 | 31 | #endif --------------------------------------------------------------------------------