├── .gitattributes ├── .gitignore ├── .gitmodules ├── 3rdparty ├── blackmagic_decklink │ ├── BlackMagicDeckLink.vcxproj │ ├── BlackMagicDeckLink.vcxproj.filters │ ├── DeckLinkAPI.idl │ ├── DeckLinkAPIConfiguration.idl │ ├── DeckLinkAPIDeckControl.idl │ ├── DeckLinkAPIDiscovery.idl │ ├── DeckLinkAPIModes.idl │ ├── DeckLinkAPIStreaming.idl │ ├── DeckLinkAPIStreaming_v10_8.idl │ ├── DeckLinkAPITypes.idl │ ├── DeckLinkAPIVersion.h │ ├── DeckLinkAPI_h.h │ ├── DeckLinkAPI_v10_11.idl │ ├── DeckLinkAPI_v10_2.idl │ ├── DeckLinkAPI_v10_4.idl │ ├── DeckLinkAPI_v10_5.idl │ ├── DeckLinkAPI_v10_6.idl │ ├── DeckLinkAPI_v10_8.idl │ ├── DeckLinkAPI_v10_9.idl │ ├── DeckLinkAPI_v11_4.idl │ ├── DeckLinkAPI_v11_5.idl │ ├── DeckLinkAPI_v11_5_1.idl │ ├── DeckLinkAPI_v7_1.idl │ ├── DeckLinkAPI_v7_3.idl │ ├── DeckLinkAPI_v7_6.idl │ ├── DeckLinkAPI_v7_9.idl │ ├── DeckLinkAPI_v8_0.idl │ ├── DeckLinkAPI_v8_1.idl │ ├── DeckLinkAPI_v9_2.idl │ ├── DeckLinkAPI_v9_9.idl │ ├── End User License Agreement.pdf │ └── README.txt ├── ffmpeg │ ├── COPYING.GPLv2 │ ├── CREDITS │ ├── MAINTAINERS │ ├── README.txt │ ├── ffmpeg.vcxproj │ ├── ffmpeg.vcxproj.filters │ ├── include │ │ ├── libavcodec │ │ │ ├── ac3_parser.h │ │ │ ├── adts_parser.h │ │ │ ├── avcodec.h │ │ │ ├── avdct.h │ │ │ ├── avfft.h │ │ │ ├── bsf.h │ │ │ ├── codec.h │ │ │ ├── codec_desc.h │ │ │ ├── codec_id.h │ │ │ ├── codec_par.h │ │ │ ├── d3d11va.h │ │ │ ├── defs.h │ │ │ ├── dirac.h │ │ │ ├── dv_profile.h │ │ │ ├── dxva2.h │ │ │ ├── jni.h │ │ │ ├── mediacodec.h │ │ │ ├── packet.h │ │ │ ├── qsv.h │ │ │ ├── vdpau.h │ │ │ ├── version.h │ │ │ ├── videotoolbox.h │ │ │ ├── vorbis_parser.h │ │ │ └── xvmc.h │ │ ├── libavutil │ │ │ ├── adler32.h │ │ │ ├── aes.h │ │ │ ├── aes_ctr.h │ │ │ ├── attributes.h │ │ │ ├── audio_fifo.h │ │ │ ├── avassert.h │ │ │ ├── avconfig.h │ │ │ ├── avstring.h │ │ │ ├── avutil.h │ │ │ ├── base64.h │ │ │ ├── blowfish.h │ │ │ ├── bprint.h │ │ │ ├── bswap.h │ │ │ ├── buffer.h │ │ │ ├── camellia.h │ │ │ ├── cast5.h │ │ │ ├── channel_layout.h │ │ │ ├── common.h │ │ │ ├── cpu.h │ │ │ ├── crc.h │ │ │ ├── des.h │ │ │ ├── detection_bbox.h │ │ │ ├── dict.h │ │ │ ├── display.h │ │ │ ├── dovi_meta.h │ │ │ ├── downmix_info.h │ │ │ ├── encryption_info.h │ │ │ ├── error.h │ │ │ ├── eval.h │ │ │ ├── ffversion.h │ │ │ ├── fifo.h │ │ │ ├── file.h │ │ │ ├── film_grain_params.h │ │ │ ├── frame.h │ │ │ ├── hash.h │ │ │ ├── hdr_dynamic_metadata.h │ │ │ ├── hmac.h │ │ │ ├── hwcontext.h │ │ │ ├── hwcontext_cuda.h │ │ │ ├── hwcontext_d3d11va.h │ │ │ ├── hwcontext_drm.h │ │ │ ├── hwcontext_dxva2.h │ │ │ ├── hwcontext_mediacodec.h │ │ │ ├── hwcontext_opencl.h │ │ │ ├── hwcontext_qsv.h │ │ │ ├── hwcontext_vaapi.h │ │ │ ├── hwcontext_vdpau.h │ │ │ ├── hwcontext_videotoolbox.h │ │ │ ├── hwcontext_vulkan.h │ │ │ ├── imgutils.h │ │ │ ├── intfloat.h │ │ │ ├── intreadwrite.h │ │ │ ├── lfg.h │ │ │ ├── log.h │ │ │ ├── lzo.h │ │ │ ├── macros.h │ │ │ ├── mastering_display_metadata.h │ │ │ ├── mathematics.h │ │ │ ├── md5.h │ │ │ ├── mem.h │ │ │ ├── motion_vector.h │ │ │ ├── murmur3.h │ │ │ ├── opt.h │ │ │ ├── parseutils.h │ │ │ ├── pixdesc.h │ │ │ ├── pixelutils.h │ │ │ ├── pixfmt.h │ │ │ ├── random_seed.h │ │ │ ├── rational.h │ │ │ ├── rc4.h │ │ │ ├── replaygain.h │ │ │ ├── ripemd.h │ │ │ ├── samplefmt.h │ │ │ ├── sha.h │ │ │ ├── sha512.h │ │ │ ├── spherical.h │ │ │ ├── stereo3d.h │ │ │ ├── tea.h │ │ │ ├── threadmessage.h │ │ │ ├── time.h │ │ │ ├── timecode.h │ │ │ ├── timestamp.h │ │ │ ├── tree.h │ │ │ ├── twofish.h │ │ │ ├── tx.h │ │ │ ├── version.h │ │ │ ├── video_enc_params.h │ │ │ └── xtea.h │ │ └── libswscale │ │ │ ├── swscale.h │ │ │ └── version.h │ └── lib │ │ ├── msvc2019_x64_debug │ │ └── .gitignore │ │ └── msvc2019_x64_release │ │ └── .gitignore ├── lavfilters │ ├── IMediaSideData.h │ ├── LAVFilters.vcxproj │ ├── LAVFilters.vcxproj.filters │ ├── LICENSE.txt │ ├── README.txt │ └── lavfilters.cpp ├── microsoft_directshow_baseclasses │ ├── License.htm │ ├── MicrosoftDirectshowBaseclasses.filters │ ├── MicrosoftDirectshowBaseclasses.vcxproj │ ├── README.txt │ ├── amextra.cpp │ ├── amextra.h │ ├── amfilter.cpp │ ├── amfilter.h │ ├── amvideo.cpp │ ├── arithutil.cpp │ ├── cache.h │ ├── checkbmi.h │ ├── combase.cpp │ ├── combase.h │ ├── cprop.cpp │ ├── cprop.h │ ├── ctlutil.cpp │ ├── ctlutil.h │ ├── ddmm.cpp │ ├── ddmm.h │ ├── dllentry.cpp │ ├── dllsetup.cpp │ ├── dllsetup.h │ ├── dxmperf.h │ ├── fourcc.h │ ├── measure.h │ ├── msgthrd.h │ ├── mtype.cpp │ ├── mtype.h │ ├── outputq.cpp │ ├── outputq.h │ ├── perflog.cpp │ ├── perflog.h │ ├── perfstruct.h │ ├── pstream.cpp │ ├── pstream.h │ ├── pullpin.cpp │ ├── pullpin.h │ ├── refclock.cpp │ ├── refclock.h │ ├── reftime.h │ ├── renbase.cpp │ ├── renbase.h │ ├── schedule.cpp │ ├── schedule.h │ ├── seekpt.cpp │ ├── seekpt.h │ ├── source.cpp │ ├── source.h │ ├── streams.h │ ├── strmctl.cpp │ ├── strmctl.h │ ├── sysclock.cpp │ ├── sysclock.h │ ├── transfrm.cpp │ ├── transfrm.h │ ├── transip.cpp │ ├── transip.h │ ├── videoctl.cpp │ ├── videoctl.h │ ├── vtrans.cpp │ ├── vtrans.h │ ├── winctrl.cpp │ ├── winctrl.h │ ├── winutil.cpp │ ├── winutil.h │ ├── wxdebug.cpp │ ├── wxdebug.h │ ├── wxlist.cpp │ ├── wxlist.h │ ├── wxutil.cpp │ └── wxutil.h └── mpc_video_renderer │ ├── FilterInterfaces.h │ ├── LICENSE │ ├── README.txt │ ├── mpc_video_renderer.cpp │ ├── mpc_video_renderer.filters │ ├── mpc_video_renderer.vcxproj │ └── mpc_video_renderer.vcxproj.filters ├── CHANGELOG.txt ├── DEVELOPERS.md ├── LICENSE.txt ├── README.md ├── TODO.txt ├── VideoProcessor.sln ├── docs ├── Blackmagic DeckLink SDK.pdf ├── Geraint Davies - An Introduction to DirectShow Parser filters.pdf ├── README.txt └── bmd_pixel_formats.pdf ├── images ├── README.txt ├── VideoProcessor.ico ├── cie1932xy.bmp ├── logo.bmp └── vp banner.png ├── src ├── VideoProcessor-GUI │ ├── .gitignore │ ├── CCie1931Control.cpp │ ├── CCie1931Control.h │ ├── FullscreenVideoWindow.cpp │ ├── FullscreenVideoWindow.h │ ├── Resource.h │ ├── VideoProcessor-GUI.vcxproj │ ├── VideoProcessor-GUI.vcxproj.filters │ ├── VideoProcessor.rc │ ├── VideoProcessorApp.cpp │ ├── VideoProcessorApp.h │ ├── VideoProcessorDlg.cpp │ ├── VideoProcessorDlg.h │ ├── WindowedVideoWindow.cpp │ ├── WindowedVideoWindow.h │ ├── framework.h │ ├── pch.cpp │ ├── pch.h │ ├── targetver.h │ └── version.cpp ├── VideoProcessor-Lib │ ├── ACaptureDevice.cpp │ ├── ACaptureDevice.h │ ├── ACaptureDeviceDiscoverer.cpp │ ├── ACaptureDeviceDiscoverer.h │ ├── BitDepth.cpp │ ├── BitDepth.h │ ├── CaptureInput.cpp │ ├── CaptureInput.h │ ├── ColorFormat.cpp │ ├── ColorFormat.h │ ├── ColorSpace.cpp │ ├── ColorSpace.h │ ├── DisplayMode.cpp │ ├── DisplayMode.h │ ├── EOTF.cpp │ ├── EOTF.h │ ├── HDRData.cpp │ ├── HDRData.h │ ├── IRenderer.cpp │ ├── IRenderer.h │ ├── ITimingClock.h │ ├── InputLocked.cpp │ ├── InputLocked.h │ ├── PixelValueRange.cpp │ ├── PixelValueRange.h │ ├── RendererId.cpp │ ├── RendererId.h │ ├── StringUtils.cpp │ ├── StringUtils.h │ ├── TimingClock.cpp │ ├── TimingClock.h │ ├── VideoConversionOverride.cpp │ ├── VideoConversionOverride.h │ ├── VideoFrame.cpp │ ├── VideoFrame.h │ ├── VideoFrameEncoding.cpp │ ├── VideoFrameEncoding.h │ ├── VideoProcessor-Lib.vcxproj │ ├── VideoProcessor-Lib.vcxproj.filters │ ├── VideoState.cpp │ ├── VideoState.h │ ├── WallClock.cpp │ ├── WallClock.h │ ├── blackmagic_decklink │ │ ├── BlackMagicDeckLinkCaptureDevice.cpp │ │ ├── BlackMagicDeckLinkCaptureDevice.h │ │ ├── BlackMagicDeckLinkCaptureDeviceDiscoverer.cpp │ │ ├── BlackMagicDeckLinkCaptureDeviceDiscoverer.h │ │ ├── BlackMagicDeckLinkTranslate.cpp │ │ └── BlackMagicDeckLinkTranslate.h │ ├── cie.cpp │ ├── cie.h │ ├── framework.h │ ├── guid.cpp │ ├── guid.h │ ├── microsoft_directshow │ │ ├── DirectShowDefines.h │ │ ├── DirectShowRendererStartStopTimeMethod.cpp │ │ ├── DirectShowRendererStartStopTimeMethod.h │ │ ├── DirectShowRenderers.cpp │ │ ├── DirectShowRenderers.h │ │ ├── DirectShowTimingClock.cpp │ │ ├── DirectShowTimingClock.h │ │ ├── DirectShowTranslations.cpp │ │ ├── DirectShowTranslations.h │ │ ├── live_source_filter │ │ │ ├── ALiveSourceVideoOutputPin.cpp │ │ │ ├── ALiveSourceVideoOutputPin.h │ │ │ ├── CBufferedLiveSourceVideoOutputPin.cpp │ │ │ ├── CBufferedLiveSourceVideoOutputPin.h │ │ │ ├── CLiveSource.cpp │ │ │ ├── CLiveSource.h │ │ │ ├── CUnbufferedLiveSourceVideoOutputPin.cpp │ │ │ ├── CUnbufferedLiveSourceVideoOutputPin.h │ │ │ └── ILiveSource.h │ │ └── video_renderers │ │ │ ├── DirectShowEnhancedVideoRenderer.cpp │ │ │ ├── DirectShowEnhancedVideoRenderer.h │ │ │ ├── DirectShowGenericHDRVideoRenderer.cpp │ │ │ ├── DirectShowGenericHDRVideoRenderer.h │ │ │ ├── DirectShowGenericVideoRenderer.cpp │ │ │ ├── DirectShowGenericVideoRenderer.h │ │ │ ├── DirectShowMPCVideoRenderer.cpp │ │ │ ├── DirectShowMPCVideoRenderer.h │ │ │ ├── DirectShowVideoRenderer.cpp │ │ │ ├── DirectShowVideoRenderer.h │ │ │ ├── DirectShowVideoRenderers.cpp │ │ │ └── DirectShowVideoRenderers.h │ ├── pch.cpp │ ├── pch.h │ └── video_frame_formatter │ │ ├── CFFMpegDecoderVideoFrameFormatter.cpp │ │ ├── CFFMpegDecoderVideoFrameFormatter.h │ │ ├── CNoopVideoFrameFormatter.cpp │ │ ├── CNoopVideoFrameFormatter.h │ │ ├── CV210toP010VideoFrameFormatter.cpp │ │ ├── CV210toP010VideoFrameFormatter.h │ │ ├── CV210toP210VideoFrameFormatter.cpp │ │ ├── CV210toP210VideoFrameFormatter.h │ │ └── IVideoFrameFormatter.h └── VideoProcessor-Test │ ├── VideoFrameFormatterTests.cpp │ ├── VideoProcessor-Test.vcxproj.filters │ ├── VideoProcessor-Test.vcxproj.user │ ├── VideoProcessor-Test.vcxproj.vcxproj │ ├── VideoProcessor-Test.vcxproj.vcxproj.filters │ ├── VideoProcessor-Test.vcxproj.vcxproj.user │ ├── pch.cpp │ └── pch.h └── tools └── generate_version.ps1 /.gitattributes: -------------------------------------------------------------------------------- 1 | *.bmp binary 2 | *.pdf binary 3 | *.png binary 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # User-specific files 2 | *.suo 3 | *.user 4 | *.userosscache 5 | *.sln.docstates 6 | 7 | # Build results 8 | [Dd]ebug/ 9 | [Dd]ebugPublic/ 10 | [Rr]elease/ 11 | [Rr]eleases/ 12 | x64/ 13 | x86/ 14 | bld/ 15 | [Bb]in/ 16 | [Oo]bj/ 17 | [Ll]og/ 18 | 19 | # Visual Studio 2015 cache/options directory 20 | .vs/ 21 | 22 | # MSTest test Results 23 | [Tt]est[Rr]esult*/ 24 | [Bb]uild[Ll]og.* 25 | 26 | *_i.c 27 | *_p.c 28 | *_i.h 29 | *.ilk 30 | *.meta 31 | *.obj 32 | *.pch 33 | *.pdb 34 | *.pgc 35 | *.pgd 36 | *.rsp 37 | *.sbr 38 | *.tlb 39 | *.tli 40 | *.tlh 41 | *.tmp 42 | *.tmp_proj 43 | *.log 44 | *.vspscc 45 | *.vssscc 46 | .builds 47 | *.pidb 48 | *.svclog 49 | *.scc 50 | 51 | # Visual C++ cache files 52 | ipch/ 53 | *.aps 54 | *.ncb 55 | *.opendb 56 | *.opensdf 57 | *.sdf 58 | *.cachefile 59 | *.VC.db 60 | *.VC.VC.opendb 61 | 62 | # Visual Studio profiler 63 | *.psess 64 | *.vsp 65 | *.vspx 66 | *.sap 67 | 68 | # Visual Studio cache files 69 | # files ending in .cache can be ignored 70 | *.[Cc]ache 71 | # but keep track of directories ending in .cache 72 | !*.[Cc]ache/ 73 | 74 | # Archives 75 | *.7z 76 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defl/videoprocessor/7e6fc67da07ecd3dbcf351c073809869c812a06f/.gitmodules -------------------------------------------------------------------------------- /3rdparty/blackmagic_decklink/BlackMagicDeckLink.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;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 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | 26 | 27 | Resource Files 28 | 29 | 30 | 31 | 32 | Source Files 33 | 34 | 35 | 36 | 37 | Resource Files 38 | 39 | 40 | -------------------------------------------------------------------------------- /3rdparty/blackmagic_decklink/DeckLinkAPIDiscovery.idl: -------------------------------------------------------------------------------- 1 | /* -LICENSE-START- 2 | ** Copyright (c) 2022 Blackmagic Design 3 | ** 4 | ** Permission is hereby granted, free of charge, to any person or organization 5 | ** obtaining a copy of the software and accompanying documentation covered by 6 | ** this license (the "Software") to use, reproduce, display, distribute, 7 | ** execute, and transmit the Software, and to prepare derivative works of the 8 | ** Software, and to permit third-parties to whom the Software is furnished to 9 | ** do so, all subject to the following: 10 | ** 11 | ** The copyright notices in the Software and this entire statement, including 12 | ** the above license grant, this restriction and the following disclaimer, 13 | ** must be included in all copies of the Software, in whole or in part, and 14 | ** all derivative works of the Software, unless such copies or derivative 15 | ** works are solely in the form of machine-executable object code generated by 16 | ** a source language processor. 17 | ** 18 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | ** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | ** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | ** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | ** DEALINGS IN THE SOFTWARE. 25 | ** -LICENSE-END- 26 | */ 27 | 28 | #ifndef BMD_CONST 29 | #if defined(_MSC_VER) 30 | #define BMD_CONST __declspec(selectany) static const 31 | #else 32 | #define BMD_CONST static const 33 | #endif 34 | #endif 35 | 36 | // Type Declarations 37 | 38 | 39 | // Enumeration Mapping 40 | 41 | cpp_quote("#if 0") 42 | cpp_quote("#endif") 43 | 44 | // Forward Declarations 45 | 46 | interface IDeckLink; 47 | 48 | /* Interface IDeckLink - Represents a DeckLink device */ 49 | 50 | [ 51 | object, 52 | uuid(C418FBDD-0587-48ED-8FE5-640F0A14AF91), 53 | helpstring("Represents a DeckLink device") 54 | ] interface IDeckLink : IUnknown 55 | { 56 | HRESULT GetModelName ([out] BSTR* modelName); 57 | HRESULT GetDisplayName ([out] BSTR* displayName); 58 | }; 59 | 60 | /* Coclasses */ 61 | 62 | importlib("stdole2.tlb"); 63 | 64 | -------------------------------------------------------------------------------- /3rdparty/blackmagic_decklink/DeckLinkAPIStreaming_v10_8.idl: -------------------------------------------------------------------------------- 1 | /* -LICENSE-START- 2 | ** Copyright (c) 2016 Blackmagic Design 3 | ** 4 | ** Permission is hereby granted, free of charge, to any person or organization 5 | ** obtaining a copy of the software and accompanying documentation (the 6 | ** "Software") to use, reproduce, display, distribute, sub-license, execute, 7 | ** and transmit the Software, and to prepare derivative works of the Software, 8 | ** and to permit third-parties to whom the Software is furnished to do so, in 9 | ** accordance with: 10 | ** 11 | ** (1) if the Software is obtained from Blackmagic Design, the End User License 12 | ** Agreement for the Software Development Kit (“EULA”) available at 13 | ** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or 14 | ** 15 | ** (2) if the Software is obtained from any third party, such licensing terms 16 | ** as notified by that third party, 17 | ** 18 | ** and all subject to the following: 19 | ** 20 | ** (3) the copyright notices in the Software and this entire statement, 21 | ** including the above license grant, this restriction and the following 22 | ** disclaimer, must be included in all copies of the Software, in whole or in 23 | ** part, and all derivative works of the Software, unless such copies or 24 | ** derivative works are solely in the form of machine-executable object code 25 | ** generated by a source language processor. 26 | ** 27 | ** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 28 | ** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 29 | ** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 30 | ** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 31 | ** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 32 | ** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 33 | ** DEALINGS IN THE SOFTWARE. 34 | ** 35 | ** A copy of the Software is available free of charge at 36 | ** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. 37 | ** 38 | ** -LICENSE-END- 39 | */ 40 | 41 | 42 | 43 | /* Coclasses */ 44 | 45 | importlib("stdole2.tlb"); 46 | 47 | [ 48 | uuid(0CAA31F6-8A26-40B0-86A4-BF58DCCA710C), 49 | helpstring("CBMDStreamingDiscovery Class") 50 | ] coclass CBMDStreamingDiscovery_v10_8 51 | { 52 | [default] interface IBMDStreamingDiscovery; 53 | }; 54 | -------------------------------------------------------------------------------- /3rdparty/blackmagic_decklink/DeckLinkAPIVersion.h: -------------------------------------------------------------------------------- 1 | /* -LICENSE-START- 2 | * ** Copyright (c) 2014 Blackmagic Design 3 | * ** 4 | * ** Permission is hereby granted, free of charge, to any person or organization 5 | * ** obtaining a copy of the software and accompanying documentation (the 6 | * ** "Software") to use, reproduce, display, distribute, sub-license, execute, 7 | * ** and transmit the Software, and to prepare derivative works of the Software, 8 | * ** and to permit third-parties to whom the Software is furnished to do so, in 9 | * ** accordance with: 10 | * ** 11 | * ** (1) if the Software is obtained from Blackmagic Design, the End User License 12 | * ** Agreement for the Software Development Kit (“EULA”) available at 13 | * ** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or 14 | * ** 15 | * ** (2) if the Software is obtained from any third party, such licensing terms 16 | * ** as notified by that third party, 17 | * ** 18 | * ** and all subject to the following: 19 | * ** 20 | * ** (3) the copyright notices in the Software and this entire statement, 21 | * ** including the above license grant, this restriction and the following 22 | * ** disclaimer, must be included in all copies of the Software, in whole or in 23 | * ** part, and all derivative works of the Software, unless such copies or 24 | * ** derivative works are solely in the form of machine-executable object code 25 | * ** generated by a source language processor. 26 | * ** 27 | * ** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 28 | * ** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 29 | * ** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 30 | * ** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 31 | * ** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 32 | * ** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 33 | * ** DEALINGS IN THE SOFTWARE. 34 | * ** 35 | * ** A copy of the Software is available free of charge at 36 | * ** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. 37 | * ** 38 | * ** -LICENSE-END- 39 | * */ 40 | 41 | /* DeckLinkAPIVersion.h */ 42 | 43 | #ifndef __DeckLink_API_Version_h__ 44 | #define __DeckLink_API_Version_h__ 45 | 46 | #define BLACKMAGIC_DECKLINK_API_VERSION 0x0c040000 47 | #define BLACKMAGIC_DECKLINK_API_VERSION_STRING "12.4" 48 | 49 | #endif // __DeckLink_API_Version_h__ 50 | 51 | -------------------------------------------------------------------------------- /3rdparty/blackmagic_decklink/DeckLinkAPI_v10_6.idl: -------------------------------------------------------------------------------- 1 | /* -LICENSE-START- 2 | ** Copyright (c) 2016 Blackmagic Design 3 | ** 4 | ** Permission is hereby granted, free of charge, to any person or organization 5 | ** obtaining a copy of the software and accompanying documentation (the 6 | ** "Software") to use, reproduce, display, distribute, sub-license, execute, 7 | ** and transmit the Software, and to prepare derivative works of the Software, 8 | ** and to permit third-parties to whom the Software is furnished to do so, in 9 | ** accordance with: 10 | ** 11 | ** (1) if the Software is obtained from Blackmagic Design, the End User License 12 | ** Agreement for the Software Development Kit (“EULA”) available at 13 | ** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or 14 | ** 15 | ** (2) if the Software is obtained from any third party, such licensing terms 16 | ** as notified by that third party, 17 | ** 18 | ** and all subject to the following: 19 | ** 20 | ** (3) the copyright notices in the Software and this entire statement, 21 | ** including the above license grant, this restriction and the following 22 | ** disclaimer, must be included in all copies of the Software, in whole or in 23 | ** part, and all derivative works of the Software, unless such copies or 24 | ** derivative works are solely in the form of machine-executable object code 25 | ** generated by a source language processor. 26 | ** 27 | ** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 28 | ** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 29 | ** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 30 | ** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 31 | ** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 32 | ** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 33 | ** DEALINGS IN THE SOFTWARE. 34 | ** 35 | ** A copy of the Software is available free of charge at 36 | ** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. 37 | ** 38 | ** -LICENSE-END- 39 | */ 40 | /* DeckLinkAPI_v10_6.idl */ 41 | 42 | /* Enum BMDDeckLinkAttributeID - DeckLink Attribute ID */ 43 | 44 | typedef [v1_enum] enum _BMDDeckLinkAttributeID_v10_6 { 45 | 46 | /* Flags */ 47 | 48 | BMDDeckLinkSupportsDesktopDisplay_v10_6 = /* 'extd' */ 0x65787464, 49 | 50 | } BMDDeckLinkAttributeID_v10_6; 51 | 52 | typedef [v1_enum] enum _BMDIdleVideoOutputOperation_v10_6 { 53 | bmdIdleVideoOutputDesktop_v10_6 = /* 'desk' */ 0x6465736B 54 | } BMDIdleVideoOutputOperation_v10_6; 55 | -------------------------------------------------------------------------------- /3rdparty/blackmagic_decklink/DeckLinkAPI_v10_8.idl: -------------------------------------------------------------------------------- 1 | /* -LICENSE-START- 2 | ** Copyright (c) 2016 Blackmagic Design 3 | ** 4 | ** Permission is hereby granted, free of charge, to any person or organization 5 | ** obtaining a copy of the software and accompanying documentation (the 6 | ** "Software") to use, reproduce, display, distribute, sub-license, execute, 7 | ** and transmit the Software, and to prepare derivative works of the Software, 8 | ** and to permit third-parties to whom the Software is furnished to do so, in 9 | ** accordance with: 10 | ** 11 | ** (1) if the Software is obtained from Blackmagic Design, the End User License 12 | ** Agreement for the Software Development Kit (“EULA”) available at 13 | ** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or 14 | ** 15 | ** (2) if the Software is obtained from any third party, such licensing terms 16 | ** as notified by that third party, 17 | ** 18 | ** and all subject to the following: 19 | ** 20 | ** (3) the copyright notices in the Software and this entire statement, 21 | ** including the above license grant, this restriction and the following 22 | ** disclaimer, must be included in all copies of the Software, in whole or in 23 | ** part, and all derivative works of the Software, unless such copies or 24 | ** derivative works are solely in the form of machine-executable object code 25 | ** generated by a source language processor. 26 | ** 27 | ** (4) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 28 | ** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 29 | ** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 30 | ** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 31 | ** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 32 | ** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 33 | ** DEALINGS IN THE SOFTWARE. 34 | ** 35 | ** A copy of the Software is available free of charge at 36 | ** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. 37 | ** 38 | ** -LICENSE-END- 39 | */ 40 | /* DeckLinkAPI_v10_8.idl */ 41 | 42 | 43 | importlib("stdole2.tlb"); 44 | 45 | [ 46 | uuid(1F2E109A-8F4F-49E4-9203-135595CB6FA5), 47 | helpstring("CDeckLinkIterator_v10_8 Class") 48 | ] coclass CDeckLinkIterator_v10_8 49 | { 50 | [default] interface IDeckLinkIterator; 51 | }; 52 | 53 | [ 54 | uuid(1073A05C-D885-47E9-B3C6-129B3F9F648B), 55 | helpstring("CDeckLinkDiscovery_v10_8 Class") 56 | ] coclass CDeckLinkDiscovery_v10_8 57 | { 58 | [default] interface IDeckLinkDiscovery; 59 | }; 60 | -------------------------------------------------------------------------------- /3rdparty/blackmagic_decklink/End User License Agreement.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defl/videoprocessor/7e6fc67da07ecd3dbcf351c073809869c812a06f/3rdparty/blackmagic_decklink/End User License Agreement.pdf -------------------------------------------------------------------------------- /3rdparty/blackmagic_decklink/README.txt: -------------------------------------------------------------------------------- 1 | This is a part of the Blackmagic DeckLink SDK version 12 2 | 3 | This directory contains the files from the Win\include directory plus the "End User License Agreement.pdf" 4 | The "Blackmagic DeckLink SDK.pdf" document is in docs/ 5 | 6 | Retrieved from https://sw.blackmagicdesign.com/DeckLink/v12.0/Blackmagic_DeckLink_SDK_12.0.zip on 2021-05-01. 7 | For the license see "End User License Agreement.pdf" 8 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/CREDITS: -------------------------------------------------------------------------------- 1 | See the Git history of the project (git://source.ffmpeg.org/ffmpeg) to 2 | get the names of people who have contributed to FFmpeg. 3 | 4 | To check the log, you can type the command "git log" in the FFmpeg 5 | source directory, or browse the online repository at 6 | http://source.ffmpeg.org. 7 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavcodec/ac3_parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AC-3 parser prototypes 3 | * Copyright (c) 2003 Fabrice Bellard 4 | * Copyright (c) 2003 Michael Niedermayer 5 | * 6 | * This file is part of FFmpeg. 7 | * 8 | * FFmpeg is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2.1 of the License, or (at your option) any later version. 12 | * 13 | * FFmpeg is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with FFmpeg; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | */ 22 | 23 | #ifndef AVCODEC_AC3_PARSER_H 24 | #define AVCODEC_AC3_PARSER_H 25 | 26 | #include 27 | #include 28 | 29 | /** 30 | * Extract the bitstream ID and the frame size from AC-3 data. 31 | */ 32 | int av_ac3_parse_header(const uint8_t *buf, size_t size, 33 | uint8_t *bitstream_id, uint16_t *frame_size); 34 | 35 | 36 | #endif /* AVCODEC_AC3_PARSER_H */ 37 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavcodec/adts_parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVCODEC_ADTS_PARSER_H 20 | #define AVCODEC_ADTS_PARSER_H 21 | 22 | #include 23 | #include 24 | 25 | #define AV_AAC_ADTS_HEADER_SIZE 7 26 | 27 | /** 28 | * Extract the number of samples and frames from AAC data. 29 | * @param[in] buf pointer to AAC data buffer 30 | * @param[out] samples Pointer to where number of samples is written 31 | * @param[out] frames Pointer to where number of frames is written 32 | * @return Returns 0 on success, error code on failure. 33 | */ 34 | int av_adts_header_parse(const uint8_t *buf, uint32_t *samples, 35 | uint8_t *frames); 36 | 37 | #endif /* AVCODEC_ADTS_PARSER_H */ 38 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavcodec/jni.h: -------------------------------------------------------------------------------- 1 | /* 2 | * JNI public API functions 3 | * 4 | * Copyright (c) 2015-2016 Matthieu Bouron 5 | * 6 | * This file is part of FFmpeg. 7 | * 8 | * FFmpeg is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2.1 of the License, or (at your option) any later version. 12 | * 13 | * FFmpeg is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with FFmpeg; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | */ 22 | 23 | #ifndef AVCODEC_JNI_H 24 | #define AVCODEC_JNI_H 25 | 26 | /* 27 | * Manually set a Java virtual machine which will be used to retrieve the JNI 28 | * environment. Once a Java VM is set it cannot be changed afterwards, meaning 29 | * you can call multiple times av_jni_set_java_vm with the same Java VM pointer 30 | * however it will error out if you try to set a different Java VM. 31 | * 32 | * @param vm Java virtual machine 33 | * @param log_ctx context used for logging, can be NULL 34 | * @return 0 on success, < 0 otherwise 35 | */ 36 | int av_jni_set_java_vm(void *vm, void *log_ctx); 37 | 38 | /* 39 | * Get the Java virtual machine which has been set with av_jni_set_java_vm. 40 | * 41 | * @param vm Java virtual machine 42 | * @return a pointer to the Java virtual machine 43 | */ 44 | void *av_jni_get_java_vm(void *log_ctx); 45 | 46 | #endif /* AVCODEC_JNI_H */ 47 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavcodec/vorbis_parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | /** 20 | * @file 21 | * A public API for Vorbis parsing 22 | * 23 | * Determines the duration for each packet. 24 | */ 25 | 26 | #ifndef AVCODEC_VORBIS_PARSER_H 27 | #define AVCODEC_VORBIS_PARSER_H 28 | 29 | #include 30 | 31 | typedef struct AVVorbisParseContext AVVorbisParseContext; 32 | 33 | /** 34 | * Allocate and initialize the Vorbis parser using headers in the extradata. 35 | */ 36 | AVVorbisParseContext *av_vorbis_parse_init(const uint8_t *extradata, 37 | int extradata_size); 38 | 39 | /** 40 | * Free the parser and everything associated with it. 41 | */ 42 | void av_vorbis_parse_free(AVVorbisParseContext **s); 43 | 44 | #define VORBIS_FLAG_HEADER 0x00000001 45 | #define VORBIS_FLAG_COMMENT 0x00000002 46 | #define VORBIS_FLAG_SETUP 0x00000004 47 | 48 | /** 49 | * Get the duration for a Vorbis packet. 50 | * 51 | * If @p flags is @c NULL, 52 | * special frames are considered invalid. 53 | * 54 | * @param s Vorbis parser context 55 | * @param buf buffer containing a Vorbis frame 56 | * @param buf_size size of the buffer 57 | * @param flags flags for special frames 58 | */ 59 | int av_vorbis_parse_frame_flags(AVVorbisParseContext *s, const uint8_t *buf, 60 | int buf_size, int *flags); 61 | 62 | /** 63 | * Get the duration for a Vorbis packet. 64 | * 65 | * @param s Vorbis parser context 66 | * @param buf buffer containing a Vorbis frame 67 | * @param buf_size size of the buffer 68 | */ 69 | int av_vorbis_parse_frame(AVVorbisParseContext *s, const uint8_t *buf, 70 | int buf_size); 71 | 72 | void av_vorbis_parse_reset(AVVorbisParseContext *s); 73 | 74 | #endif /* AVCODEC_VORBIS_PARSER_H */ 75 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/adler32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Mans Rullgard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * @ingroup lavu_adler32 24 | * Public header for Adler-32 hash function implementation. 25 | */ 26 | 27 | #ifndef AVUTIL_ADLER32_H 28 | #define AVUTIL_ADLER32_H 29 | 30 | #include 31 | #include 32 | #include "attributes.h" 33 | 34 | /** 35 | * @defgroup lavu_adler32 Adler-32 36 | * @ingroup lavu_hash 37 | * Adler-32 hash function implementation. 38 | * 39 | * @{ 40 | */ 41 | 42 | typedef uint32_t AVAdler; 43 | 44 | /** 45 | * Calculate the Adler32 checksum of a buffer. 46 | * 47 | * Passing the return value to a subsequent av_adler32_update() call 48 | * allows the checksum of multiple buffers to be calculated as though 49 | * they were concatenated. 50 | * 51 | * @param adler initial checksum value 52 | * @param buf pointer to input buffer 53 | * @param len size of input buffer 54 | * @return updated checksum 55 | */ 56 | AVAdler av_adler32_update(AVAdler adler, const uint8_t *buf, 57 | size_t len) av_pure; 58 | 59 | /** 60 | * @} 61 | */ 62 | 63 | #endif /* AVUTIL_ADLER32_H */ 64 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/aes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2007 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_AES_H 22 | #define AVUTIL_AES_H 23 | 24 | #include 25 | 26 | #include "attributes.h" 27 | 28 | /** 29 | * @defgroup lavu_aes AES 30 | * @ingroup lavu_crypto 31 | * @{ 32 | */ 33 | 34 | extern const int av_aes_size; 35 | 36 | struct AVAES; 37 | 38 | /** 39 | * Allocate an AVAES context. 40 | */ 41 | struct AVAES *av_aes_alloc(void); 42 | 43 | /** 44 | * Initialize an AVAES context. 45 | * @param key_bits 128, 192 or 256 46 | * @param decrypt 0 for encryption, 1 for decryption 47 | */ 48 | int av_aes_init(struct AVAES *a, const uint8_t *key, int key_bits, int decrypt); 49 | 50 | /** 51 | * Encrypt or decrypt a buffer using a previously initialized context. 52 | * @param count number of 16 byte blocks 53 | * @param dst destination array, can be equal to src 54 | * @param src source array, can be equal to dst 55 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used 56 | * @param decrypt 0 for encryption, 1 for decryption 57 | */ 58 | void av_aes_crypt(struct AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); 59 | 60 | /** 61 | * @} 62 | */ 63 | 64 | #endif /* AVUTIL_AES_H */ 65 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/aes_ctr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AES-CTR cipher 3 | * Copyright (c) 2015 Eran Kornblau 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_AES_CTR_H 23 | #define AVUTIL_AES_CTR_H 24 | 25 | #include 26 | 27 | #include "attributes.h" 28 | 29 | #define AES_CTR_KEY_SIZE (16) 30 | #define AES_CTR_IV_SIZE (8) 31 | 32 | struct AVAESCTR; 33 | 34 | /** 35 | * Allocate an AVAESCTR context. 36 | */ 37 | struct AVAESCTR *av_aes_ctr_alloc(void); 38 | 39 | /** 40 | * Initialize an AVAESCTR context. 41 | * @param key encryption key, must have a length of AES_CTR_KEY_SIZE 42 | */ 43 | int av_aes_ctr_init(struct AVAESCTR *a, const uint8_t *key); 44 | 45 | /** 46 | * Release an AVAESCTR context. 47 | */ 48 | void av_aes_ctr_free(struct AVAESCTR *a); 49 | 50 | /** 51 | * Process a buffer using a previously initialized context. 52 | * @param dst destination array, can be equal to src 53 | * @param src source array, can be equal to dst 54 | * @param size the size of src and dst 55 | */ 56 | void av_aes_ctr_crypt(struct AVAESCTR *a, uint8_t *dst, const uint8_t *src, int size); 57 | 58 | /** 59 | * Get the current iv 60 | */ 61 | const uint8_t* av_aes_ctr_get_iv(struct AVAESCTR *a); 62 | 63 | /** 64 | * Generate a random iv 65 | */ 66 | void av_aes_ctr_set_random_iv(struct AVAESCTR *a); 67 | 68 | /** 69 | * Forcefully change the 8-byte iv 70 | */ 71 | void av_aes_ctr_set_iv(struct AVAESCTR *a, const uint8_t* iv); 72 | 73 | /** 74 | * Forcefully change the "full" 16-byte iv, including the counter 75 | */ 76 | void av_aes_ctr_set_full_iv(struct AVAESCTR *a, const uint8_t* iv); 77 | 78 | /** 79 | * Increment the top 64 bit of the iv (performed after each frame) 80 | */ 81 | void av_aes_ctr_increment_iv(struct AVAESCTR *a); 82 | 83 | /** 84 | * @} 85 | */ 86 | 87 | #endif /* AVUTIL_AES_CTR_H */ 88 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/avassert.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2010 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * simple assert() macros that are a bit more flexible than ISO C assert(). 24 | * @author Michael Niedermayer 25 | */ 26 | 27 | #ifndef AVUTIL_AVASSERT_H 28 | #define AVUTIL_AVASSERT_H 29 | 30 | #include 31 | #include "avutil.h" 32 | #include "log.h" 33 | 34 | /** 35 | * assert() equivalent, that is always enabled. 36 | */ 37 | #define av_assert0(cond) do { \ 38 | if (!(cond)) { \ 39 | av_log(NULL, AV_LOG_PANIC, "Assertion %s failed at %s:%d\n", \ 40 | AV_STRINGIFY(cond), __FILE__, __LINE__); \ 41 | abort(); \ 42 | } \ 43 | } while (0) 44 | 45 | 46 | /** 47 | * assert() equivalent, that does not lie in speed critical code. 48 | * These asserts() thus can be enabled without fearing speed loss. 49 | */ 50 | #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0 51 | #define av_assert1(cond) av_assert0(cond) 52 | #else 53 | #define av_assert1(cond) ((void)0) 54 | #endif 55 | 56 | 57 | /** 58 | * assert() equivalent, that does lie in speed critical code. 59 | */ 60 | #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 61 | #define av_assert2(cond) av_assert0(cond) 62 | #define av_assert2_fpu() av_assert0_fpu() 63 | #else 64 | #define av_assert2(cond) ((void)0) 65 | #define av_assert2_fpu() ((void)0) 66 | #endif 67 | 68 | /** 69 | * Assert that floating point operations can be executed. 70 | * 71 | * This will av_assert0() that the cpu is not in MMX state on X86 72 | */ 73 | void av_assert0_fpu(void); 74 | 75 | #endif /* AVUTIL_AVASSERT_H */ 76 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/avconfig.h: -------------------------------------------------------------------------------- 1 | /* Generated by ffmpeg configure */ 2 | #ifndef AVUTIL_AVCONFIG_H 3 | #define AVUTIL_AVCONFIG_H 4 | #define AV_HAVE_BIGENDIAN 0 5 | #define AV_HAVE_FAST_UNALIGNED 1 6 | #endif /* AVUTIL_AVCONFIG_H */ 7 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/base64.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 Ryan Martell. (rdm4@martellventures.com) 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_BASE64_H 22 | #define AVUTIL_BASE64_H 23 | 24 | #include 25 | 26 | /** 27 | * @defgroup lavu_base64 Base64 28 | * @ingroup lavu_crypto 29 | * @{ 30 | */ 31 | 32 | /** 33 | * Decode a base64-encoded string. 34 | * 35 | * @param out buffer for decoded data 36 | * @param in null-terminated input string 37 | * @param out_size size in bytes of the out buffer, must be at 38 | * least 3/4 of the length of in, that is AV_BASE64_DECODE_SIZE(strlen(in)) 39 | * @return number of bytes written, or a negative value in case of 40 | * invalid input 41 | */ 42 | int av_base64_decode(uint8_t *out, const char *in, int out_size); 43 | 44 | /** 45 | * Calculate the output size in bytes needed to decode a base64 string 46 | * with length x to a data buffer. 47 | */ 48 | #define AV_BASE64_DECODE_SIZE(x) ((x) * 3LL / 4) 49 | 50 | /** 51 | * Encode data to base64 and null-terminate. 52 | * 53 | * @param out buffer for encoded data 54 | * @param out_size size in bytes of the out buffer (including the 55 | * null terminator), must be at least AV_BASE64_SIZE(in_size) 56 | * @param in input buffer containing the data to encode 57 | * @param in_size size in bytes of the in buffer 58 | * @return out or NULL in case of error 59 | */ 60 | char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size); 61 | 62 | /** 63 | * Calculate the output size needed to base64-encode x bytes to a 64 | * null-terminated string. 65 | */ 66 | #define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1) 67 | 68 | /** 69 | * @} 70 | */ 71 | 72 | #endif /* AVUTIL_BASE64_H */ 73 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/camellia.h: -------------------------------------------------------------------------------- 1 | /* 2 | * An implementation of the CAMELLIA algorithm as mentioned in RFC3713 3 | * Copyright (c) 2014 Supraja Meedinti 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_CAMELLIA_H 23 | #define AVUTIL_CAMELLIA_H 24 | 25 | #include 26 | 27 | 28 | /** 29 | * @file 30 | * @brief Public header for libavutil CAMELLIA algorithm 31 | * @defgroup lavu_camellia CAMELLIA 32 | * @ingroup lavu_crypto 33 | * @{ 34 | */ 35 | 36 | extern const int av_camellia_size; 37 | 38 | struct AVCAMELLIA; 39 | 40 | /** 41 | * Allocate an AVCAMELLIA context 42 | * To free the struct: av_free(ptr) 43 | */ 44 | struct AVCAMELLIA *av_camellia_alloc(void); 45 | 46 | /** 47 | * Initialize an AVCAMELLIA context. 48 | * 49 | * @param ctx an AVCAMELLIA context 50 | * @param key a key of 16, 24, 32 bytes used for encryption/decryption 51 | * @param key_bits number of keybits: possible are 128, 192, 256 52 | */ 53 | int av_camellia_init(struct AVCAMELLIA *ctx, const uint8_t *key, int key_bits); 54 | 55 | /** 56 | * Encrypt or decrypt a buffer using a previously initialized context 57 | * 58 | * @param ctx an AVCAMELLIA context 59 | * @param dst destination array, can be equal to src 60 | * @param src source array, can be equal to dst 61 | * @param count number of 16 byte blocks 62 | * @paran iv initialization vector for CBC mode, NULL for ECB mode 63 | * @param decrypt 0 for encryption, 1 for decryption 64 | */ 65 | void av_camellia_crypt(struct AVCAMELLIA *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t* iv, int decrypt); 66 | 67 | /** 68 | * @} 69 | */ 70 | #endif /* AVUTIL_CAMELLIA_H */ 71 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/des.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DES encryption/decryption 3 | * Copyright (c) 2007 Reimar Doeffinger 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_DES_H 23 | #define AVUTIL_DES_H 24 | 25 | #include 26 | 27 | /** 28 | * @defgroup lavu_des DES 29 | * @ingroup lavu_crypto 30 | * @{ 31 | */ 32 | 33 | typedef struct AVDES { 34 | uint64_t round_keys[3][16]; 35 | int triple_des; 36 | } AVDES; 37 | 38 | /** 39 | * Allocate an AVDES context. 40 | */ 41 | AVDES *av_des_alloc(void); 42 | 43 | /** 44 | * @brief Initializes an AVDES context. 45 | * 46 | * @param key_bits must be 64 or 192 47 | * @param decrypt 0 for encryption/CBC-MAC, 1 for decryption 48 | * @return zero on success, negative value otherwise 49 | */ 50 | int av_des_init(struct AVDES *d, const uint8_t *key, int key_bits, int decrypt); 51 | 52 | /** 53 | * @brief Encrypts / decrypts using the DES algorithm. 54 | * 55 | * @param count number of 8 byte blocks 56 | * @param dst destination array, can be equal to src, must be 8-byte aligned 57 | * @param src source array, can be equal to dst, must be 8-byte aligned, may be NULL 58 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used, 59 | * must be 8-byte aligned 60 | * @param decrypt 0 for encryption, 1 for decryption 61 | */ 62 | void av_des_crypt(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); 63 | 64 | /** 65 | * @brief Calculates CBC-MAC using the DES algorithm. 66 | * 67 | * @param count number of 8 byte blocks 68 | * @param dst destination array, can be equal to src, must be 8-byte aligned 69 | * @param src source array, can be equal to dst, must be 8-byte aligned, may be NULL 70 | */ 71 | void av_des_mac(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count); 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | #endif /* AVUTIL_DES_H */ 78 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/dovi_meta.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Vacing Fang 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * DOVI configuration 24 | */ 25 | 26 | 27 | #ifndef AVUTIL_DOVI_META_H 28 | #define AVUTIL_DOVI_META_H 29 | 30 | #include 31 | #include 32 | 33 | /* 34 | * DOVI configuration 35 | * ref: dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2.1.2 36 | dolby-vision-bitstreams-in-mpeg-2-transport-stream-multiplex-v1.2 37 | * @code 38 | * uint8_t dv_version_major, the major version number that the stream complies with 39 | * uint8_t dv_version_minor, the minor version number that the stream complies with 40 | * uint8_t dv_profile, the Dolby Vision profile 41 | * uint8_t dv_level, the Dolby Vision level 42 | * uint8_t rpu_present_flag 43 | * uint8_t el_present_flag 44 | * uint8_t bl_present_flag 45 | * uint8_t dv_bl_signal_compatibility_id 46 | * @endcode 47 | * 48 | * @note The struct must be allocated with av_dovi_alloc() and 49 | * its size is not a part of the public ABI. 50 | */ 51 | typedef struct AVDOVIDecoderConfigurationRecord { 52 | uint8_t dv_version_major; 53 | uint8_t dv_version_minor; 54 | uint8_t dv_profile; 55 | uint8_t dv_level; 56 | uint8_t rpu_present_flag; 57 | uint8_t el_present_flag; 58 | uint8_t bl_present_flag; 59 | uint8_t dv_bl_signal_compatibility_id; 60 | } AVDOVIDecoderConfigurationRecord; 61 | 62 | /** 63 | * Allocate a AVDOVIDecoderConfigurationRecord structure and initialize its 64 | * fields to default values. 65 | * 66 | * @return the newly allocated struct or NULL on failure 67 | */ 68 | AVDOVIDecoderConfigurationRecord *av_dovi_alloc(size_t *size); 69 | 70 | #endif /* AVUTIL_DOVI_META_H */ 71 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/ffversion.h: -------------------------------------------------------------------------------- 1 | /* Automatically generated by version.sh, do not manually edit! */ 2 | #ifndef AVUTIL_FFVERSION_H 3 | #define AVUTIL_FFVERSION_H 4 | #define FFMPEG_VERSION "N-102680-g8ed254aeb1" 5 | #endif /* AVUTIL_FFVERSION_H */ 6 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/hwcontext_cuda.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | 20 | #ifndef AVUTIL_HWCONTEXT_CUDA_H 21 | #define AVUTIL_HWCONTEXT_CUDA_H 22 | 23 | #ifndef CUDA_VERSION 24 | #include 25 | #endif 26 | 27 | #include "pixfmt.h" 28 | 29 | /** 30 | * @file 31 | * An API-specific header for AV_HWDEVICE_TYPE_CUDA. 32 | * 33 | * This API supports dynamic frame pools. AVHWFramesContext.pool must return 34 | * AVBufferRefs whose data pointer is a CUdeviceptr. 35 | */ 36 | 37 | typedef struct AVCUDADeviceContextInternal AVCUDADeviceContextInternal; 38 | 39 | /** 40 | * This struct is allocated as AVHWDeviceContext.hwctx 41 | */ 42 | typedef struct AVCUDADeviceContext { 43 | CUcontext cuda_ctx; 44 | CUstream stream; 45 | AVCUDADeviceContextInternal *internal; 46 | } AVCUDADeviceContext; 47 | 48 | /** 49 | * AVHWFramesContext.hwctx is currently not used 50 | */ 51 | 52 | /** 53 | * @defgroup hwcontext_cuda Device context creation flags 54 | * 55 | * Flags for av_hwdevice_ctx_create. 56 | * 57 | * @{ 58 | */ 59 | 60 | /** 61 | * Use primary device context instead of creating a new one. 62 | */ 63 | #define AV_CUDA_USE_PRIMARY_CONTEXT (1 << 0) 64 | 65 | /** 66 | * @} 67 | */ 68 | 69 | #endif /* AVUTIL_HWCONTEXT_CUDA_H */ 70 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/hwcontext_mediacodec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_HWCONTEXT_MEDIACODEC_H 20 | #define AVUTIL_HWCONTEXT_MEDIACODEC_H 21 | 22 | /** 23 | * MediaCodec details. 24 | * 25 | * Allocated as AVHWDeviceContext.hwctx 26 | */ 27 | typedef struct AVMediaCodecDeviceContext { 28 | /** 29 | * android/view/Surface handle, to be filled by the user. 30 | * 31 | * This is the default surface used by decoders on this device. 32 | */ 33 | void *surface; 34 | } AVMediaCodecDeviceContext; 35 | 36 | #endif /* AVUTIL_HWCONTEXT_MEDIACODEC_H */ 37 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/hwcontext_qsv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_HWCONTEXT_QSV_H 20 | #define AVUTIL_HWCONTEXT_QSV_H 21 | 22 | #include 23 | 24 | /** 25 | * @file 26 | * An API-specific header for AV_HWDEVICE_TYPE_QSV. 27 | * 28 | * This API does not support dynamic frame pools. AVHWFramesContext.pool must 29 | * contain AVBufferRefs whose data pointer points to an mfxFrameSurface1 struct. 30 | */ 31 | 32 | /** 33 | * This struct is allocated as AVHWDeviceContext.hwctx 34 | */ 35 | typedef struct AVQSVDeviceContext { 36 | mfxSession session; 37 | } AVQSVDeviceContext; 38 | 39 | /** 40 | * This struct is allocated as AVHWFramesContext.hwctx 41 | */ 42 | typedef struct AVQSVFramesContext { 43 | mfxFrameSurface1 *surfaces; 44 | int nb_surfaces; 45 | 46 | /** 47 | * A combination of MFX_MEMTYPE_* describing the frame pool. 48 | */ 49 | int frame_type; 50 | } AVQSVFramesContext; 51 | 52 | #endif /* AVUTIL_HWCONTEXT_QSV_H */ 53 | 54 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/hwcontext_vdpau.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_HWCONTEXT_VDPAU_H 20 | #define AVUTIL_HWCONTEXT_VDPAU_H 21 | 22 | #include 23 | 24 | /** 25 | * @file 26 | * An API-specific header for AV_HWDEVICE_TYPE_VDPAU. 27 | * 28 | * This API supports dynamic frame pools. AVHWFramesContext.pool must return 29 | * AVBufferRefs whose data pointer is a VdpVideoSurface. 30 | */ 31 | 32 | /** 33 | * This struct is allocated as AVHWDeviceContext.hwctx 34 | */ 35 | typedef struct AVVDPAUDeviceContext { 36 | VdpDevice device; 37 | VdpGetProcAddress *get_proc_address; 38 | } AVVDPAUDeviceContext; 39 | 40 | /** 41 | * AVHWFramesContext.hwctx is currently not used 42 | */ 43 | 44 | #endif /* AVUTIL_HWCONTEXT_VDPAU_H */ 45 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/hwcontext_videotoolbox.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H 20 | #define AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H 21 | 22 | #include 23 | 24 | #include 25 | 26 | #include "pixfmt.h" 27 | 28 | /** 29 | * @file 30 | * An API-specific header for AV_HWDEVICE_TYPE_VIDEOTOOLBOX. 31 | * 32 | * This API supports frame allocation using a native CVPixelBufferPool 33 | * instead of an AVBufferPool. 34 | * 35 | * If the API user sets a custom pool, AVHWFramesContext.pool must return 36 | * AVBufferRefs whose data pointer is a CVImageBufferRef or CVPixelBufferRef. 37 | * Note that the underlying CVPixelBuffer could be retained by OS frameworks 38 | * depending on application usage, so it is preferable to let CoreVideo manage 39 | * the pool using the default implementation. 40 | * 41 | * Currently AVHWDeviceContext.hwctx and AVHWFramesContext.hwctx are always 42 | * NULL. 43 | */ 44 | 45 | /** 46 | * Convert a VideoToolbox (actually CoreVideo) format to AVPixelFormat. 47 | * Returns AV_PIX_FMT_NONE if no known equivalent was found. 48 | */ 49 | enum AVPixelFormat av_map_videotoolbox_format_to_pixfmt(uint32_t cv_fmt); 50 | 51 | /** 52 | * Convert an AVPixelFormat to a VideoToolbox (actually CoreVideo) format. 53 | * Returns 0 if no known equivalent was found. 54 | */ 55 | uint32_t av_map_videotoolbox_format_from_pixfmt(enum AVPixelFormat pix_fmt); 56 | 57 | /** 58 | * Same as av_map_videotoolbox_format_from_pixfmt function, but can map and 59 | * return full range pixel formats via a flag. 60 | */ 61 | uint32_t av_map_videotoolbox_format_from_pixfmt2(enum AVPixelFormat pix_fmt, bool full_range); 62 | 63 | #endif /* AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H */ 64 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/intfloat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Mans Rullgard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_INTFLOAT_H 22 | #define AVUTIL_INTFLOAT_H 23 | 24 | #include 25 | #include "attributes.h" 26 | 27 | union av_intfloat32 { 28 | uint32_t i; 29 | float f; 30 | }; 31 | 32 | union av_intfloat64 { 33 | uint64_t i; 34 | double f; 35 | }; 36 | 37 | /** 38 | * Reinterpret a 32-bit integer as a float. 39 | */ 40 | static av_always_inline float av_int2float(uint32_t i) 41 | { 42 | union av_intfloat32 v; 43 | v.i = i; 44 | return v.f; 45 | } 46 | 47 | /** 48 | * Reinterpret a float as a 32-bit integer. 49 | */ 50 | static av_always_inline uint32_t av_float2int(float f) 51 | { 52 | union av_intfloat32 v; 53 | v.f = f; 54 | return v.i; 55 | } 56 | 57 | /** 58 | * Reinterpret a 64-bit integer as a double. 59 | */ 60 | static av_always_inline double av_int2double(uint64_t i) 61 | { 62 | union av_intfloat64 v; 63 | v.i = i; 64 | return v.f; 65 | } 66 | 67 | /** 68 | * Reinterpret a double as a 64-bit integer. 69 | */ 70 | static av_always_inline uint64_t av_double2int(double f) 71 | { 72 | union av_intfloat64 v; 73 | v.f = f; 74 | return v.i; 75 | } 76 | 77 | #endif /* AVUTIL_INTFLOAT_H */ 78 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/lzo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * LZO 1x decompression 3 | * copyright (c) 2006 Reimar Doeffinger 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_LZO_H 23 | #define AVUTIL_LZO_H 24 | 25 | /** 26 | * @defgroup lavu_lzo LZO 27 | * @ingroup lavu_crypto 28 | * 29 | * @{ 30 | */ 31 | 32 | #include 33 | 34 | /** @name Error flags returned by av_lzo1x_decode 35 | * @{ */ 36 | /// end of the input buffer reached before decoding finished 37 | #define AV_LZO_INPUT_DEPLETED 1 38 | /// decoded data did not fit into output buffer 39 | #define AV_LZO_OUTPUT_FULL 2 40 | /// a reference to previously decoded data was wrong 41 | #define AV_LZO_INVALID_BACKPTR 4 42 | /// a non-specific error in the compressed bitstream 43 | #define AV_LZO_ERROR 8 44 | /** @} */ 45 | 46 | #define AV_LZO_INPUT_PADDING 8 47 | #define AV_LZO_OUTPUT_PADDING 12 48 | 49 | /** 50 | * @brief Decodes LZO 1x compressed data. 51 | * @param out output buffer 52 | * @param outlen size of output buffer, number of bytes left are returned here 53 | * @param in input buffer 54 | * @param inlen size of input buffer, number of bytes left are returned here 55 | * @return 0 on success, otherwise a combination of the error flags above 56 | * 57 | * Make sure all buffers are appropriately padded, in must provide 58 | * AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes. 59 | */ 60 | int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen); 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | #endif /* AVUTIL_LZO_H */ 67 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/macros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | /** 20 | * @file 21 | * @ingroup lavu 22 | * Utility Preprocessor macros 23 | */ 24 | 25 | #ifndef AVUTIL_MACROS_H 26 | #define AVUTIL_MACROS_H 27 | 28 | #include "libavutil/avconfig.h" 29 | 30 | #if AV_HAVE_BIGENDIAN 31 | # define AV_NE(be, le) (be) 32 | #else 33 | # define AV_NE(be, le) (le) 34 | #endif 35 | 36 | /** 37 | * Comparator. 38 | * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0 39 | * if x == y. This is useful for instance in a qsort comparator callback. 40 | * Furthermore, compilers are able to optimize this to branchless code, and 41 | * there is no risk of overflow with signed types. 42 | * As with many macros, this evaluates its argument multiple times, it thus 43 | * must not have a side-effect. 44 | */ 45 | #define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y))) 46 | 47 | #define FFMAX(a,b) ((a) > (b) ? (a) : (b)) 48 | #define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) 49 | #define FFMIN(a,b) ((a) > (b) ? (b) : (a)) 50 | #define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c) 51 | 52 | #define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) 53 | #define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) 54 | 55 | #define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) 56 | #define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) 57 | 58 | /** 59 | * @addtogroup preproc_misc Preprocessor String Macros 60 | * 61 | * String manipulation macros 62 | * 63 | * @{ 64 | */ 65 | 66 | #define AV_STRINGIFY(s) AV_TOSTRING(s) 67 | #define AV_TOSTRING(s) #s 68 | 69 | #define AV_GLUE(a, b) a ## b 70 | #define AV_JOIN(a, b) AV_GLUE(a, b) 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | #define AV_PRAGMA(s) _Pragma(#s) 77 | 78 | #define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1)) 79 | 80 | #endif /* AVUTIL_MACROS_H */ 81 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * @ingroup lavu_md5 24 | * Public header for MD5 hash function implementation. 25 | */ 26 | 27 | #ifndef AVUTIL_MD5_H 28 | #define AVUTIL_MD5_H 29 | 30 | #include 31 | #include 32 | 33 | #include "attributes.h" 34 | 35 | /** 36 | * @defgroup lavu_md5 MD5 37 | * @ingroup lavu_hash 38 | * MD5 hash function implementation. 39 | * 40 | * @{ 41 | */ 42 | 43 | extern const int av_md5_size; 44 | 45 | struct AVMD5; 46 | 47 | /** 48 | * Allocate an AVMD5 context. 49 | */ 50 | struct AVMD5 *av_md5_alloc(void); 51 | 52 | /** 53 | * Initialize MD5 hashing. 54 | * 55 | * @param ctx pointer to the function context (of size av_md5_size) 56 | */ 57 | void av_md5_init(struct AVMD5 *ctx); 58 | 59 | /** 60 | * Update hash value. 61 | * 62 | * @param ctx hash function context 63 | * @param src input data to update hash with 64 | * @param len input data length 65 | */ 66 | void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, size_t len); 67 | 68 | /** 69 | * Finish hashing and output digest value. 70 | * 71 | * @param ctx hash function context 72 | * @param dst buffer where output digest value is stored 73 | */ 74 | void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); 75 | 76 | /** 77 | * Hash an array of data. 78 | * 79 | * @param dst The output buffer to write the digest into 80 | * @param src The data to hash 81 | * @param len The length of the data, in bytes 82 | */ 83 | void av_md5_sum(uint8_t *dst, const uint8_t *src, size_t len); 84 | 85 | /** 86 | * @} 87 | */ 88 | 89 | #endif /* AVUTIL_MD5_H */ 90 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/motion_vector.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_MOTION_VECTOR_H 20 | #define AVUTIL_MOTION_VECTOR_H 21 | 22 | #include 23 | 24 | typedef struct AVMotionVector { 25 | /** 26 | * Where the current macroblock comes from; negative value when it comes 27 | * from the past, positive value when it comes from the future. 28 | * XXX: set exact relative ref frame reference instead of a +/- 1 "direction". 29 | */ 30 | int32_t source; 31 | /** 32 | * Width and height of the block. 33 | */ 34 | uint8_t w, h; 35 | /** 36 | * Absolute source position. Can be outside the frame area. 37 | */ 38 | int16_t src_x, src_y; 39 | /** 40 | * Absolute destination position. Can be outside the frame area. 41 | */ 42 | int16_t dst_x, dst_y; 43 | /** 44 | * Extra flag information. 45 | * Currently unused. 46 | */ 47 | uint64_t flags; 48 | /** 49 | * Motion vector 50 | * src_x = dst_x + motion_x / motion_scale 51 | * src_y = dst_y + motion_y / motion_scale 52 | */ 53 | int32_t motion_x, motion_y; 54 | uint16_t motion_scale; 55 | } AVMotionVector; 56 | 57 | #endif /* AVUTIL_MOTION_VECTOR_H */ 58 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/pixelutils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_PIXELUTILS_H 20 | #define AVUTIL_PIXELUTILS_H 21 | 22 | #include 23 | #include 24 | #include "common.h" 25 | 26 | /** 27 | * Sum of abs(src1[x] - src2[x]) 28 | */ 29 | typedef int (*av_pixelutils_sad_fn)(const uint8_t *src1, ptrdiff_t stride1, 30 | const uint8_t *src2, ptrdiff_t stride2); 31 | 32 | /** 33 | * Get a potentially optimized pointer to a Sum-of-absolute-differences 34 | * function (see the av_pixelutils_sad_fn prototype). 35 | * 36 | * @param w_bits 1< 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_RANDOM_SEED_H 22 | #define AVUTIL_RANDOM_SEED_H 23 | 24 | #include 25 | /** 26 | * @addtogroup lavu_crypto 27 | * @{ 28 | */ 29 | 30 | /** 31 | * Get a seed to use in conjunction with random functions. 32 | * This function tries to provide a good seed at a best effort bases. 33 | * Its possible to call this function multiple times if more bits are needed. 34 | * It can be quite slow, which is why it should only be used as seed for a faster 35 | * PRNG. The quality of the seed depends on the platform. 36 | */ 37 | uint32_t av_get_random_seed(void); 38 | 39 | /** 40 | * @} 41 | */ 42 | 43 | #endif /* AVUTIL_RANDOM_SEED_H */ 44 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/rc4.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RC4 encryption/decryption/pseudo-random number generator 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_RC4_H 22 | #define AVUTIL_RC4_H 23 | 24 | #include 25 | 26 | /** 27 | * @defgroup lavu_rc4 RC4 28 | * @ingroup lavu_crypto 29 | * @{ 30 | */ 31 | 32 | typedef struct AVRC4 { 33 | uint8_t state[256]; 34 | int x, y; 35 | } AVRC4; 36 | 37 | /** 38 | * Allocate an AVRC4 context. 39 | */ 40 | AVRC4 *av_rc4_alloc(void); 41 | 42 | /** 43 | * @brief Initializes an AVRC4 context. 44 | * 45 | * @param key_bits must be a multiple of 8 46 | * @param decrypt 0 for encryption, 1 for decryption, currently has no effect 47 | * @return zero on success, negative value otherwise 48 | */ 49 | int av_rc4_init(struct AVRC4 *d, const uint8_t *key, int key_bits, int decrypt); 50 | 51 | /** 52 | * @brief Encrypts / decrypts using the RC4 algorithm. 53 | * 54 | * @param count number of bytes 55 | * @param dst destination array, can be equal to src 56 | * @param src source array, can be equal to dst, may be NULL 57 | * @param iv not (yet) used for RC4, should be NULL 58 | * @param decrypt 0 for encryption, 1 for decryption, not (yet) used 59 | */ 60 | void av_rc4_crypt(struct AVRC4 *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | #endif /* AVUTIL_RC4_H */ 67 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/replaygain.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_REPLAYGAIN_H 20 | #define AVUTIL_REPLAYGAIN_H 21 | 22 | #include 23 | 24 | /** 25 | * ReplayGain information (see 26 | * http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1.0_specification). 27 | * The size of this struct is a part of the public ABI. 28 | */ 29 | typedef struct AVReplayGain { 30 | /** 31 | * Track replay gain in microbels (divide by 100000 to get the value in dB). 32 | * Should be set to INT32_MIN when unknown. 33 | */ 34 | int32_t track_gain; 35 | /** 36 | * Peak track amplitude, with 100000 representing full scale (but values 37 | * may overflow). 0 when unknown. 38 | */ 39 | uint32_t track_peak; 40 | /** 41 | * Same as track_gain, but for the whole album. 42 | */ 43 | int32_t album_gain; 44 | /** 45 | * Same as track_peak, but for the whole album, 46 | */ 47 | uint32_t album_peak; 48 | } AVReplayGain; 49 | 50 | #endif /* AVUTIL_REPLAYGAIN_H */ 51 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/ripemd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Michael Niedermayer 3 | * Copyright (C) 2013 James Almer 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | /** 23 | * @file 24 | * @ingroup lavu_ripemd 25 | * Public header for RIPEMD hash function implementation. 26 | */ 27 | 28 | #ifndef AVUTIL_RIPEMD_H 29 | #define AVUTIL_RIPEMD_H 30 | 31 | #include 32 | #include 33 | 34 | #include "attributes.h" 35 | 36 | /** 37 | * @defgroup lavu_ripemd RIPEMD 38 | * @ingroup lavu_hash 39 | * RIPEMD hash function implementation. 40 | * 41 | * @{ 42 | */ 43 | 44 | extern const int av_ripemd_size; 45 | 46 | struct AVRIPEMD; 47 | 48 | /** 49 | * Allocate an AVRIPEMD context. 50 | */ 51 | struct AVRIPEMD *av_ripemd_alloc(void); 52 | 53 | /** 54 | * Initialize RIPEMD hashing. 55 | * 56 | * @param context pointer to the function context (of size av_ripemd_size) 57 | * @param bits number of bits in digest (128, 160, 256 or 320 bits) 58 | * @return zero if initialization succeeded, -1 otherwise 59 | */ 60 | int av_ripemd_init(struct AVRIPEMD* context, int bits); 61 | 62 | /** 63 | * Update hash value. 64 | * 65 | * @param context hash function context 66 | * @param data input data to update hash with 67 | * @param len input data length 68 | */ 69 | void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, size_t len); 70 | 71 | /** 72 | * Finish hashing and output digest value. 73 | * 74 | * @param context hash function context 75 | * @param digest buffer where output digest value is stored 76 | */ 77 | void av_ripemd_final(struct AVRIPEMD* context, uint8_t *digest); 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | #endif /* AVUTIL_RIPEMD_H */ 84 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/tea.h: -------------------------------------------------------------------------------- 1 | /* 2 | * A 32-bit implementation of the TEA algorithm 3 | * Copyright (c) 2015 Vesselin Bontchev 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_TEA_H 23 | #define AVUTIL_TEA_H 24 | 25 | #include 26 | 27 | /** 28 | * @file 29 | * @brief Public header for libavutil TEA algorithm 30 | * @defgroup lavu_tea TEA 31 | * @ingroup lavu_crypto 32 | * @{ 33 | */ 34 | 35 | extern const int av_tea_size; 36 | 37 | struct AVTEA; 38 | 39 | /** 40 | * Allocate an AVTEA context 41 | * To free the struct: av_free(ptr) 42 | */ 43 | struct AVTEA *av_tea_alloc(void); 44 | 45 | /** 46 | * Initialize an AVTEA context. 47 | * 48 | * @param ctx an AVTEA context 49 | * @param key a key of 16 bytes used for encryption/decryption 50 | * @param rounds the number of rounds in TEA (64 is the "standard") 51 | */ 52 | void av_tea_init(struct AVTEA *ctx, const uint8_t key[16], int rounds); 53 | 54 | /** 55 | * Encrypt or decrypt a buffer using a previously initialized context. 56 | * 57 | * @param ctx an AVTEA context 58 | * @param dst destination array, can be equal to src 59 | * @param src source array, can be equal to dst 60 | * @param count number of 8 byte blocks 61 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used 62 | * @param decrypt 0 for encryption, 1 for decryption 63 | */ 64 | void av_tea_crypt(struct AVTEA *ctx, uint8_t *dst, const uint8_t *src, 65 | int count, uint8_t *iv, int decrypt); 66 | 67 | /** 68 | * @} 69 | */ 70 | 71 | #endif /* AVUTIL_TEA_H */ 72 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/time.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2003 Fabrice Bellard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_TIME_H 22 | #define AVUTIL_TIME_H 23 | 24 | #include 25 | 26 | /** 27 | * Get the current time in microseconds. 28 | */ 29 | int64_t av_gettime(void); 30 | 31 | /** 32 | * Get the current time in microseconds since some unspecified starting point. 33 | * On platforms that support it, the time comes from a monotonic clock 34 | * This property makes this time source ideal for measuring relative time. 35 | * The returned values may not be monotonic on platforms where a monotonic 36 | * clock is not available. 37 | */ 38 | int64_t av_gettime_relative(void); 39 | 40 | /** 41 | * Indicates with a boolean result if the av_gettime_relative() time source 42 | * is monotonic. 43 | */ 44 | int av_gettime_relative_is_monotonic(void); 45 | 46 | /** 47 | * Sleep for a period of time. Although the duration is expressed in 48 | * microseconds, the actual delay may be rounded to the precision of the 49 | * system timer. 50 | * 51 | * @param usec Number of microseconds to sleep. 52 | * @return zero on success or (negative) error code. 53 | */ 54 | int av_usleep(unsigned usec); 55 | 56 | #endif /* AVUTIL_TIME_H */ 57 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libavutil/twofish.h: -------------------------------------------------------------------------------- 1 | /* 2 | * An implementation of the TwoFish algorithm 3 | * Copyright (c) 2015 Supraja Meedinti 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_TWOFISH_H 23 | #define AVUTIL_TWOFISH_H 24 | 25 | #include 26 | 27 | 28 | /** 29 | * @file 30 | * @brief Public header for libavutil TWOFISH algorithm 31 | * @defgroup lavu_twofish TWOFISH 32 | * @ingroup lavu_crypto 33 | * @{ 34 | */ 35 | 36 | extern const int av_twofish_size; 37 | 38 | struct AVTWOFISH; 39 | 40 | /** 41 | * Allocate an AVTWOFISH context 42 | * To free the struct: av_free(ptr) 43 | */ 44 | struct AVTWOFISH *av_twofish_alloc(void); 45 | 46 | /** 47 | * Initialize an AVTWOFISH context. 48 | * 49 | * @param ctx an AVTWOFISH context 50 | * @param key a key of size ranging from 1 to 32 bytes used for encryption/decryption 51 | * @param key_bits number of keybits: 128, 192, 256 If less than the required, padded with zeroes to nearest valid value; return value is 0 if key_bits is 128/192/256, -1 if less than 0, 1 otherwise 52 | */ 53 | int av_twofish_init(struct AVTWOFISH *ctx, const uint8_t *key, int key_bits); 54 | 55 | /** 56 | * Encrypt or decrypt a buffer using a previously initialized context 57 | * 58 | * @param ctx an AVTWOFISH context 59 | * @param dst destination array, can be equal to src 60 | * @param src source array, can be equal to dst 61 | * @param count number of 16 byte blocks 62 | * @paran iv initialization vector for CBC mode, NULL for ECB mode 63 | * @param decrypt 0 for encryption, 1 for decryption 64 | */ 65 | void av_twofish_crypt(struct AVTWOFISH *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t* iv, int decrypt); 66 | 67 | /** 68 | * @} 69 | */ 70 | #endif /* AVUTIL_TWOFISH_H */ 71 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/include/libswscale/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef SWSCALE_VERSION_H 20 | #define SWSCALE_VERSION_H 21 | 22 | /** 23 | * @file 24 | * swscale version macros 25 | */ 26 | 27 | #include "libavutil/version.h" 28 | 29 | #define LIBSWSCALE_VERSION_MAJOR 6 30 | #define LIBSWSCALE_VERSION_MINOR 0 31 | #define LIBSWSCALE_VERSION_MICRO 100 32 | 33 | #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \ 34 | LIBSWSCALE_VERSION_MINOR, \ 35 | LIBSWSCALE_VERSION_MICRO) 36 | #define LIBSWSCALE_VERSION AV_VERSION(LIBSWSCALE_VERSION_MAJOR, \ 37 | LIBSWSCALE_VERSION_MINOR, \ 38 | LIBSWSCALE_VERSION_MICRO) 39 | #define LIBSWSCALE_BUILD LIBSWSCALE_VERSION_INT 40 | 41 | #define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION) 42 | 43 | /** 44 | * FF_API_* defines may be placed below to indicate public API that will be 45 | * dropped at a future version bump. The defines themselves are not part of 46 | * the public API and may change, break or disappear at any time. 47 | */ 48 | 49 | #endif /* SWSCALE_VERSION_H */ 50 | -------------------------------------------------------------------------------- /3rdparty/ffmpeg/lib/msvc2019_x64_debug/.gitignore: -------------------------------------------------------------------------------- 1 | libavcodec.a 2 | libavutil.a 3 | libswscale.a -------------------------------------------------------------------------------- /3rdparty/ffmpeg/lib/msvc2019_x64_release/.gitignore: -------------------------------------------------------------------------------- 1 | libavcodec.a 2 | libavutil.a 3 | libswscale.a -------------------------------------------------------------------------------- /3rdparty/lavfilters/LAVFilters.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {e5d2c06f-01a4-443c-af62-83584cc38b0c} 6 | 7 | 8 | {68fc017b-9a82-450e-ac71-cb2dd12153e9} 9 | 10 | 11 | 12 | 13 | Header Files 14 | 15 | 16 | 17 | 18 | Source Files 19 | 20 | 21 | -------------------------------------------------------------------------------- /3rdparty/lavfilters/README.txt: -------------------------------------------------------------------------------- 1 | This directory contains the following files from LAVFilters. 2 | - IMediaSideData.h (partially) 3 | 4 | Retrieved from https://github.com/Nevcairiel/LAVFilters on 2021-05-06. 5 | For the license see LICENSE.txt 6 | -------------------------------------------------------------------------------- /3rdparty/lavfilters/lavfilters.cpp: -------------------------------------------------------------------------------- 1 | #define INITGUID 2 | 3 | #include "IMediaSideData.h" 4 | -------------------------------------------------------------------------------- /3rdparty/microsoft_directshow_baseclasses/License.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defl/videoprocessor/7e6fc67da07ecd3dbcf351c073809869c812a06f/3rdparty/microsoft_directshow_baseclasses/License.htm -------------------------------------------------------------------------------- /3rdparty/microsoft_directshow_baseclasses/README.txt: -------------------------------------------------------------------------------- 1 | These files were part of https://github.com/CrendKing/avisynth_filter.git retrieved on 2021-04-24 2 | These files probably stem from the Windows SDK, hence the Microsoft License is in this directory. 3 | -------------------------------------------------------------------------------- /3rdparty/microsoft_directshow_baseclasses/amextra.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // File: AMExtra.h 3 | // 4 | // Desc: DirectShow base classes. 5 | // 6 | // Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. 7 | //------------------------------------------------------------------------------ 8 | 9 | 10 | #ifndef __AMEXTRA__ 11 | #define __AMEXTRA__ 12 | 13 | // Simple rendered input pin 14 | // 15 | // NOTE if your filter queues stuff before rendering then it may not be 16 | // appropriate to use this class 17 | // 18 | // In that case queue the end of stream condition until the last sample 19 | // is actually rendered and flush the condition appropriately 20 | 21 | class CRenderedInputPin : public CBaseInputPin 22 | { 23 | public: 24 | 25 | CRenderedInputPin(__in_opt LPCTSTR pObjectName, 26 | __in CBaseFilter *pFilter, 27 | __in CCritSec *pLock, 28 | __inout HRESULT *phr, 29 | __in_opt LPCWSTR pName); 30 | #ifdef UNICODE 31 | CRenderedInputPin(__in_opt LPCSTR pObjectName, 32 | __in CBaseFilter *pFilter, 33 | __in CCritSec *pLock, 34 | __inout HRESULT *phr, 35 | __in_opt LPCWSTR pName); 36 | #endif 37 | 38 | // Override methods to track end of stream state 39 | STDMETHODIMP EndOfStream(); 40 | STDMETHODIMP EndFlush(); 41 | 42 | HRESULT Active(); 43 | HRESULT Run(REFERENCE_TIME tStart); 44 | 45 | protected: 46 | 47 | // Member variables to track state 48 | BOOL m_bAtEndOfStream; // Set by EndOfStream 49 | BOOL m_bCompleteNotified; // Set when we notify for EC_COMPLETE 50 | 51 | private: 52 | void DoCompleteHandling(); 53 | }; 54 | 55 | #endif // __AMEXTRA__ 56 | 57 | -------------------------------------------------------------------------------- /3rdparty/microsoft_directshow_baseclasses/ddmm.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // File: DDMM.h 3 | // 4 | // Desc: DirectShow base classes - efines routines for using DirectDraw 5 | // on a multimonitor system. 6 | // 7 | // Copyright (c) 1995-2001 Microsoft Corporation. All rights reserved. 8 | //------------------------------------------------------------------------------ 9 | 10 | 11 | #ifdef __cplusplus 12 | extern "C" { /* Assume C declarations for C++ */ 13 | #endif /* __cplusplus */ 14 | 15 | // DDRAW.H might not include these 16 | #ifndef DDENUM_ATTACHEDSECONDARYDEVICES 17 | #define DDENUM_ATTACHEDSECONDARYDEVICES 0x00000001L 18 | #endif 19 | 20 | typedef HRESULT (*PDRAWCREATE)(IID *,LPDIRECTDRAW *,LPUNKNOWN); 21 | typedef HRESULT (*PDRAWENUM)(LPDDENUMCALLBACKA, LPVOID); 22 | 23 | IDirectDraw * DirectDrawCreateFromDevice(__in_opt LPSTR, PDRAWCREATE, PDRAWENUM); 24 | IDirectDraw * DirectDrawCreateFromDeviceEx(__in_opt LPSTR, PDRAWCREATE, LPDIRECTDRAWENUMERATEEXA); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif /* __cplusplus */ 29 | -------------------------------------------------------------------------------- /3rdparty/microsoft_directshow_baseclasses/dllsetup.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // File: DllSetup.h 3 | // 4 | // Desc: DirectShow base classes. 5 | // 6 | // Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. 7 | //------------------------------------------------------------------------------ 8 | 9 | 10 | // To be self registering, OLE servers must 11 | // export functions named DllRegisterServer 12 | // and DllUnregisterServer. To allow use of 13 | // custom and default implementations the 14 | // defaults are named AMovieDllRegisterServer 15 | // and AMovieDllUnregisterServer. 16 | // 17 | // To the use the default implementation you 18 | // must provide stub functions. 19 | // 20 | // i.e. STDAPI DllRegisterServer() 21 | // { 22 | // return AMovieDllRegisterServer(); 23 | // } 24 | // 25 | // STDAPI DllUnregisterServer() 26 | // { 27 | // return AMovieDllUnregisterServer(); 28 | // } 29 | // 30 | // 31 | // AMovieDllRegisterServer calls IAMovieSetup.Register(), and 32 | // AMovieDllUnregisterServer calls IAMovieSetup.Unregister(). 33 | 34 | STDAPI AMovieDllRegisterServer2( BOOL ); 35 | STDAPI AMovieDllRegisterServer(); 36 | STDAPI AMovieDllUnregisterServer(); 37 | 38 | // helper functions 39 | STDAPI EliminateSubKey( HKEY, LPCTSTR ); 40 | 41 | 42 | STDAPI 43 | AMovieSetupRegisterFilter2( const AMOVIESETUP_FILTER * const psetupdata 44 | , IFilterMapper2 * pIFM2 45 | , BOOL bRegister ); 46 | 47 | -------------------------------------------------------------------------------- /3rdparty/microsoft_directshow_baseclasses/fourcc.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // File: FourCC.h 3 | // 4 | // Desc: DirectShow base classes. 5 | // 6 | // Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. 7 | //------------------------------------------------------------------------------ 8 | 9 | 10 | // FOURCCMap 11 | // 12 | // provides a mapping between old-style multimedia format DWORDs 13 | // and new-style GUIDs. 14 | // 15 | // A range of 4 billion GUIDs has been allocated to ensure that this 16 | // mapping can be done straightforwardly one-to-one in both directions. 17 | // 18 | // January 95 19 | 20 | 21 | #ifndef __FOURCC__ 22 | #define __FOURCC__ 23 | 24 | 25 | // Multimedia format types are marked with DWORDs built from four 8-bit 26 | // chars and known as FOURCCs. New multimedia AM_MEDIA_TYPE definitions include 27 | // a subtype GUID. In order to simplify the mapping, GUIDs in the range: 28 | // XXXXXXXX-0000-0010-8000-00AA00389B71 29 | // are reserved for FOURCCs. 30 | 31 | class FOURCCMap : public GUID 32 | { 33 | 34 | public: 35 | FOURCCMap(); 36 | FOURCCMap(DWORD Fourcc); 37 | FOURCCMap(const GUID *); 38 | 39 | 40 | DWORD GetFOURCC(void); 41 | void SetFOURCC(DWORD fourcc); 42 | void SetFOURCC(const GUID *); 43 | 44 | private: 45 | void InitGUID(); 46 | }; 47 | 48 | #define GUID_Data2 0 49 | #define GUID_Data3 0x10 50 | #define GUID_Data4_1 0xaa000080 51 | #define GUID_Data4_2 0x719b3800 52 | 53 | inline void 54 | FOURCCMap::InitGUID() { 55 | Data2 = GUID_Data2; 56 | Data3 = GUID_Data3; 57 | ((DWORD *)Data4)[0] = GUID_Data4_1; 58 | ((DWORD *)Data4)[1] = GUID_Data4_2; 59 | } 60 | 61 | inline 62 | FOURCCMap::FOURCCMap() { 63 | InitGUID(); 64 | SetFOURCC( DWORD(0)); 65 | } 66 | 67 | inline 68 | FOURCCMap::FOURCCMap(DWORD fourcc) 69 | { 70 | InitGUID(); 71 | SetFOURCC(fourcc); 72 | } 73 | 74 | inline 75 | FOURCCMap::FOURCCMap(const GUID * pGuid) 76 | { 77 | InitGUID(); 78 | SetFOURCC(pGuid); 79 | } 80 | 81 | inline void 82 | FOURCCMap::SetFOURCC(const GUID * pGuid) 83 | { 84 | FOURCCMap * p = (FOURCCMap*) pGuid; 85 | SetFOURCC(p->GetFOURCC()); 86 | } 87 | 88 | inline void 89 | FOURCCMap::SetFOURCC(DWORD fourcc) 90 | { 91 | Data1 = fourcc; 92 | } 93 | 94 | inline DWORD 95 | FOURCCMap::GetFOURCC(void) 96 | { 97 | return Data1; 98 | } 99 | 100 | #endif /* __FOURCC__ */ 101 | 102 | -------------------------------------------------------------------------------- /3rdparty/microsoft_directshow_baseclasses/perflog.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // File: perflog.h 3 | // 4 | // Desc: Performance logging framework. 5 | // 6 | // Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. 7 | //------------------------------------------------------------------------------ 8 | 9 | typedef struct _PERFLOG_LOGGING_PARAMS { 10 | GUID ControlGuid; 11 | void (*OnStateChanged)(void); 12 | ULONG NumberOfTraceGuids; 13 | TRACE_GUID_REGISTRATION TraceGuids[ANYSIZE_ARRAY]; 14 | } PERFLOG_LOGGING_PARAMS, *PPERFLOG_LOGGING_PARAMS; 15 | 16 | BOOL 17 | PerflogInitIfEnabled( 18 | IN HINSTANCE hInstance, 19 | __in PPERFLOG_LOGGING_PARAMS LogParams 20 | ); 21 | 22 | BOOL 23 | PerflogInitialize ( 24 | __in PPERFLOG_LOGGING_PARAMS LogParams 25 | ); 26 | 27 | VOID 28 | PerflogShutdown ( 29 | VOID 30 | ); 31 | 32 | VOID 33 | PerflogTraceEvent ( 34 | __in PEVENT_TRACE_HEADER Event 35 | ); 36 | 37 | extern ULONG PerflogEnableFlags; 38 | extern UCHAR PerflogEnableLevel; 39 | extern ULONG PerflogModuleLevel; 40 | extern TRACEHANDLE PerflogTraceHandle; 41 | extern TRACEHANDLE PerflogRegHandle; 42 | 43 | #define PerflogTracingEnabled() (PerflogTraceHandle != 0) 44 | 45 | #define PerflogEvent( _x_ ) PerflogTraceEventLevel _x_ 46 | 47 | VOID 48 | PerflogTraceEventLevel( 49 | ULONG Level, 50 | __in PEVENT_TRACE_HEADER Event 51 | ); 52 | 53 | VOID 54 | PerflogTraceEvent ( 55 | __in PEVENT_TRACE_HEADER Event 56 | ); 57 | -------------------------------------------------------------------------------- /3rdparty/microsoft_directshow_baseclasses/seekpt.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // File: SeekPT.h 3 | // 4 | // Desc: DirectShow base classes. 5 | // 6 | // Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. 7 | //------------------------------------------------------------------------------ 8 | 9 | 10 | #ifndef __seekpt_h__ 11 | #define __seekpt_h__ 12 | 13 | 14 | class CSeekingPassThru : public ISeekingPassThru, public CUnknown 15 | { 16 | public: 17 | static CUnknown *CreateInstance(__inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr); 18 | CSeekingPassThru(__in_opt LPCTSTR pName, __inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr); 19 | ~CSeekingPassThru(); 20 | 21 | DECLARE_IUNKNOWN; 22 | STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void ** ppv); 23 | 24 | STDMETHODIMP Init(BOOL bSupportRendering, IPin *pPin); 25 | 26 | private: 27 | CPosPassThru *m_pPosPassThru; 28 | }; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /3rdparty/microsoft_directshow_baseclasses/sysclock.cpp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // File: SysClock.cpp 3 | // 4 | // Desc: DirectShow base classes - implements a system clock based on 5 | // IReferenceClock. 6 | // 7 | // Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. 8 | //------------------------------------------------------------------------------ 9 | 10 | 11 | #include 12 | #include 13 | 14 | 15 | #ifdef FILTER_DLL 16 | 17 | /* List of class IDs and creator functions for the class factory. This 18 | provides the link between the OLE entry point in the DLL and an object 19 | being created. The class factory will call the static CreateInstance 20 | function when it is asked to create a CLSID_SystemClock object */ 21 | 22 | CFactoryTemplate g_Templates[1] = { 23 | {&CLSID_SystemClock, CSystemClock::CreateInstance} 24 | }; 25 | 26 | int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]); 27 | #endif 28 | 29 | /* This goes in the factory template table to create new instances */ 30 | CUnknown * WINAPI CSystemClock::CreateInstance(__inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr) 31 | { 32 | return new CSystemClock(NAME("System reference clock"),pUnk, phr); 33 | } 34 | 35 | 36 | CSystemClock::CSystemClock(__in_opt LPCTSTR pName, __inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr) : 37 | CBaseReferenceClock(pName, pUnk, phr) 38 | { 39 | } 40 | 41 | STDMETHODIMP CSystemClock::NonDelegatingQueryInterface( 42 | REFIID riid, 43 | __deref_out void ** ppv) 44 | { 45 | if (riid == IID_IPersist) 46 | { 47 | return GetInterface(static_cast(this), ppv); 48 | } 49 | else if (riid == IID_IAMClockAdjust) 50 | { 51 | return GetInterface(static_cast(this), ppv); 52 | } 53 | else 54 | { 55 | return CBaseReferenceClock::NonDelegatingQueryInterface(riid, ppv); 56 | } 57 | } 58 | 59 | /* Return the clock's clsid */ 60 | STDMETHODIMP 61 | CSystemClock::GetClassID(__out CLSID *pClsID) 62 | { 63 | CheckPointer(pClsID,E_POINTER); 64 | ValidateReadWritePtr(pClsID,sizeof(CLSID)); 65 | *pClsID = CLSID_SystemClock; 66 | return NOERROR; 67 | } 68 | 69 | 70 | STDMETHODIMP 71 | CSystemClock::SetClockDelta(REFERENCE_TIME rtDelta) 72 | { 73 | return SetTimeDelta(rtDelta); 74 | } 75 | -------------------------------------------------------------------------------- /3rdparty/microsoft_directshow_baseclasses/sysclock.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // File: SysClock.h 3 | // 4 | // Desc: DirectShow base classes - defines a system clock implementation of 5 | // IReferenceClock. 6 | // 7 | // Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved. 8 | //------------------------------------------------------------------------------ 9 | 10 | 11 | #ifndef __SYSTEMCLOCK__ 12 | #define __SYSTEMCLOCK__ 13 | 14 | // 15 | // Base clock. Uses timeGetTime ONLY 16 | // Uses most of the code in the base reference clock. 17 | // Provides GetTime 18 | // 19 | 20 | class CSystemClock : public CBaseReferenceClock, public IAMClockAdjust, public IPersist 21 | { 22 | public: 23 | // We must be able to create an instance of ourselves 24 | static CUnknown * WINAPI CreateInstance(__inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr); 25 | CSystemClock(__in_opt LPCTSTR pName, __inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr); 26 | 27 | DECLARE_IUNKNOWN 28 | 29 | STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void ** ppv); 30 | 31 | // Yield up our class id so that we can be persisted 32 | // Implement required Ipersist method 33 | STDMETHODIMP GetClassID(__out CLSID *pClsID); 34 | 35 | // IAMClockAdjust methods 36 | STDMETHODIMP SetClockDelta(REFERENCE_TIME rtDelta); 37 | }; //CSystemClock 38 | 39 | #endif /* __SYSTEMCLOCK__ */ 40 | -------------------------------------------------------------------------------- /3rdparty/mpc_video_renderer/README.txt: -------------------------------------------------------------------------------- 1 | This directory contains the following files from MPC Video Renderer. 2 | - FilterInterfaces.h 3 | 4 | Retrieved from https://github.com/Aleksoid1978/VideoRenderer on 2021-07-13 version 0.5.4.1723 5 | For the license see LICENSE.txt 6 | -------------------------------------------------------------------------------- /3rdparty/mpc_video_renderer/mpc_video_renderer.cpp: -------------------------------------------------------------------------------- 1 | #define INITGUID 2 | 3 | #include "FilterInterfaces.h" 4 | -------------------------------------------------------------------------------- /3rdparty/mpc_video_renderer/mpc_video_renderer.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;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 | -------------------------------------------------------------------------------- /3rdparty/mpc_video_renderer/mpc_video_renderer.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {004ea560-9434-48a0-9907-000b34b1d98d} 6 | 7 | 8 | {d5382ef7-d147-4cf9-a419-ecff16355feb} 9 | 10 | 11 | {830a58d2-9380-4ef4-bf5d-85bc5e15cd31} 12 | 13 | 14 | 15 | 16 | Header Files 17 | 18 | 19 | 20 | 21 | Project Files 22 | 23 | 24 | 25 | 26 | Project Files 27 | 28 | 29 | 30 | 31 | Source Files 32 | 33 | 34 | -------------------------------------------------------------------------------- /DEVELOPERS.md: -------------------------------------------------------------------------------- 1 | 2 | # For developers 3 | 4 | Get the source from https://github.com/defl/videoprocessor 5 | 6 | * MSVC 2019 community edition 7 | * Install MFC libraries 8 | * Debug builds require the [Visual Leak Detector](https://kinddragon.github.io/vld/) Visual C++ plugin 9 | * You also need to build a special branch of ffmpeg, instructions to do so are in 3rdparty\ffmpeg 10 | 11 | **Debugging** 12 | 13 | * Directshow call debugging 14 | * Open regedit 15 | * Go to Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectShow\Debug 16 | * Make key (=folder) VideoProcessor.exe 17 | * Set folder rights to user who will run it (or all) 18 | * Close regedit 19 | * Start application 20 | * Open regedit 21 | * Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectShow\Debug\VideoProcessor.exe\ should have a bunch of entries like TRACE and LogToFile 22 | * Set log types to 5 or up 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![VideoProcessor banner](https://github.com/defl/videoprocessor/blob/main/images/vp%20banner.png) 2 | 3 | :film_projector: VideoProcessor turns a computer into a 4k HDR capable live video processor by connecting a video capture card to a renderer and taking care of details such as conversion, timing and HDR metadata. 4 | 5 | This allows advanced renderers to do things like 3D LUT, HDR tone mapping, scaling, deinterlacing and much more which can significantly improve image quality on most displays and beamers. 6 | 7 | _Capture cards cannot capture HDCP protected data, VideoProcessor can only process what can be captured._ 8 | 9 | # Website 10 | 11 | You can find all the static details on [videoprocessor.org](http://videoprocessor.org) 12 | - [Getting started](http://videoprocessor.org/getting_started) 13 | - [Manual](http://videoprocessor.org/manual) 14 | - [FAQ](http://videoprocessor.org/faq) 15 | - [Wiki](https://github.com/defl/videoprocessor/wiki) 16 | 17 | # Screenshot 18 | 19 | ![Screenshot](https://github.com/defl/videoprocessor_website/blob/main/site/static/images/screenshot.png) 20 | 21 | # License & legal 22 | 23 | This application is released under the GNU GPL 3.0 for non-commercial usage, commercial usage to build and sell video processor systems is not allowed, see LICENSE.txt. 24 | 25 | Parts of this code are made and owned by others, for example SDKs; in all such cases there are LICENSE.txt and README.txt files present to point to sources, attributions and licenses. 26 | 27 | ------ 28 | 29 | Copyright 2021 [Dennis Fleurbaaij](mailto:mail@dennisfleurbaaij.com) 30 | -------------------------------------------------------------------------------- /TODO.txt: -------------------------------------------------------------------------------- 1 | Roadmap 2 | ======= 3 | 4 | 1.1.0: Config file 5 | - All settings via config file, remove command line params 6 | 7 | 1.2.0: Constant time delay 8 | - see if we can do frame formatting before queueing (own thread?) 9 | - Determine baseline latency with external meter 10 | - Build aimed-for delay to ensure external lip-sync is spot on 11 | - Write guide on how to DIY this 12 | 13 | 1.3.0: Zoom 14 | - Cropping-zoom in y and x dimensions 15 | - Auto shifting (hwf) 16 | - Non-linear stretch 17 | 18 | 1.4.0: MPV renderer 19 | - Integrate MPV renderer 20 | - Renderer options as own dialogs 21 | 22 | Stuff & ideas to do for later: 23 | - Support for audio 24 | - /fullscreen immediately to fullscreen and show logo + some short status update 25 | - CaptureInput as a first-class citizen rather than a POD (rename to capture device input?) 26 | - Toggelable HDCP on video output through the win32 Output Protection Manager 27 | (This will lead to problems with NVIDIA GRID as it's not allowed to capture) 28 | - Only force settings if none are present (LLDV case mcpherv). Looked at this and it seems little useful without further scripting 29 | or the ability to store config. Both are not yet on the radar. 30 | - Use NVIDIA GRID to get the rendered frame and get the egress timestamp it so that we can build a feedback system going. 31 | This actually seems possible to get us timestamps of point of frame-render. If the egress delay from there is reasonably 32 | constant we can probably get a near constant-time renderer going. 33 | - Build a git version to version.rc generator and use that to set VS_VERSION_INFO version etc 34 | - Make group names clickable and open help page 35 | - Add menu bar with help link 36 | - Support for interlaced modes (don't have hardware which does this) 37 | - If the blackmagic capture thread throws that's never shown a new one is spun up silently, try-catch external calls, make errors visible 38 | - If the CAM thread throws that's never shown, make errors visible 39 | - Replace GDI drawing with MFC 40 | - Make a CIE1931 diagram with the pixels painted into it once a sec or so to see if the video actually getting near it's stated performance (https://www.drastic.tv/productsmenu-56/test-and-measurement/4kscope) 41 | - If a source is SDR change the EDID to be 1080 (as this is likely a native 1080 source), if it's HDR allow everything including to 4k. Switchable behaviour. DeckLink can't do this but an HDFury might be able to. Investigate. 42 | 43 | Open external tickets 44 | - BlackMagic: DEV-4671 Wrong values in HDR display primaries 45 | -------------------------------------------------------------------------------- /docs/Blackmagic DeckLink SDK.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defl/videoprocessor/7e6fc67da07ecd3dbcf351c073809869c812a06f/docs/Blackmagic DeckLink SDK.pdf -------------------------------------------------------------------------------- /docs/Geraint Davies - An Introduction to DirectShow Parser filters.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defl/videoprocessor/7e6fc67da07ecd3dbcf351c073809869c812a06f/docs/Geraint Davies - An Introduction to DirectShow Parser filters.pdf -------------------------------------------------------------------------------- /docs/README.txt: -------------------------------------------------------------------------------- 1 | bmd_pixel_formats.pdf: Retrieved from https://samples.mplayerhq.hu/V-codecs/R210/bmd_pixel_formats.pdf 2021-05-15 2 | Blackmagic DeckLink SDK.pdf: License and attribution in 3rdparty/blackmagic_decklink/README.txt 3 | Geraint Davies - An Introduction to DirectShow Parser filters.pdf: Retrieved from http://www.gdcl.co.uk/articles/Parsers.pdf 2021-05-23 4 | -------------------------------------------------------------------------------- /docs/bmd_pixel_formats.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defl/videoprocessor/7e6fc67da07ecd3dbcf351c073809869c812a06f/docs/bmd_pixel_formats.pdf -------------------------------------------------------------------------------- /images/README.txt: -------------------------------------------------------------------------------- 1 | cie1932xy.bmp: https://en.wikipedia.org/wiki/CIE_1931_color_space#/media/File:CIE1931xy_blank.svg by BenRG, public domain, retrieved on 2021-05-15 2 | -------------------------------------------------------------------------------- /images/VideoProcessor.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defl/videoprocessor/7e6fc67da07ecd3dbcf351c073809869c812a06f/images/VideoProcessor.ico -------------------------------------------------------------------------------- /images/cie1932xy.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defl/videoprocessor/7e6fc67da07ecd3dbcf351c073809869c812a06f/images/cie1932xy.bmp -------------------------------------------------------------------------------- /images/logo.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defl/videoprocessor/7e6fc67da07ecd3dbcf351c073809869c812a06f/images/logo.bmp -------------------------------------------------------------------------------- /images/vp banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defl/videoprocessor/7e6fc67da07ecd3dbcf351c073809869c812a06f/images/vp banner.png -------------------------------------------------------------------------------- /src/VideoProcessor-GUI/.gitignore: -------------------------------------------------------------------------------- 1 | version.h -------------------------------------------------------------------------------- /src/VideoProcessor-GUI/CCie1931Control.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | 18 | /** 19 | * Win32 gui control which draws the CIE1931 XY chart and can plot HDR and colorspace on it 20 | */ 21 | class CCie1931Control: 22 | public CStatic 23 | { 24 | public: 25 | 26 | CCie1931Control(); 27 | virtual ~CCie1931Control(); 28 | 29 | // Set colorspace 30 | void SetColorSpace(ColorSpace); 31 | 32 | // Set HDR data 33 | void SetHDRData(std::shared_ptr); 34 | 35 | protected: 36 | 37 | // Handlers for ON_WM_* messages 38 | void OnPaint(); 39 | 40 | private: 41 | 42 | HBITMAP m_cie1931xyBmp = nullptr; 43 | ColorSpace m_colorSpace = ColorSpace::UNKNOWN; 44 | std::shared_ptr m_hdrData = nullptr; 45 | 46 | DECLARE_MESSAGE_MAP() 47 | }; 48 | -------------------------------------------------------------------------------- /src/VideoProcessor-GUI/FullscreenVideoWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | const wchar_t FULLSCREEN_WINDOW_CLASS_NAME[] = L"Fullscreen Window"; 13 | 14 | 15 | /** 16 | * Window class which can be used for drawing on full screen 17 | */ 18 | class FullscreenVideoWindow 19 | { 20 | public: 21 | 22 | FullscreenVideoWindow(); 23 | ~FullscreenVideoWindow(); 24 | 25 | // Static window procedure 26 | static LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 27 | 28 | // Register and create this window 29 | void Create(HMONITOR hmon, HWND parentWindow); 30 | 31 | // Get the window handler 32 | HWND GetHWND() const { return m_hwnd; } 33 | 34 | protected: 35 | 36 | LRESULT __forceinline HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam); 37 | 38 | HWND m_hwnd = nullptr; 39 | }; 40 | -------------------------------------------------------------------------------- /src/VideoProcessor-GUI/VideoProcessor.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/defl/videoprocessor/7e6fc67da07ecd3dbcf351c073809869c812a06f/src/VideoProcessor-GUI/VideoProcessor.rc -------------------------------------------------------------------------------- /src/VideoProcessor-GUI/VideoProcessorApp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | class CVideoProcessorApp: 13 | public CWinAppEx 14 | { 15 | public: 16 | virtual BOOL InitInstance(); 17 | 18 | DECLARE_MESSAGE_MAP() 19 | }; 20 | 21 | 22 | extern CVideoProcessorApp videoProcessorApp; 23 | -------------------------------------------------------------------------------- /src/VideoProcessor-GUI/WindowedVideoWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | #define BLACK RGB(0, 0, 0) 12 | #define WHITE RGB(255, 255, 255) 13 | 14 | 15 | /** 16 | * This is where in windowed mode the renderer will draw to 17 | */ 18 | class WindowedVideoWindow: 19 | public CStatic 20 | { 21 | public: 22 | 23 | WindowedVideoWindow(); 24 | virtual ~WindowedVideoWindow(); 25 | 26 | // If true will show the logo 27 | void ShowLogo(bool show); 28 | 29 | protected: 30 | 31 | HBITMAP m_logoBmp = nullptr; 32 | CBrush m_brush; 33 | bool m_showLogo = true; 34 | 35 | // Handlers for ON_WM_* messages 36 | afx_msg void OnPaint(); 37 | afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor); 38 | 39 | DECLARE_MESSAGE_MAP() 40 | }; 41 | -------------------------------------------------------------------------------- /src/VideoProcessor-GUI/framework.h: -------------------------------------------------------------------------------- 1 | // header.h : include file for standard system include files, 2 | // or project specific include files 3 | // 4 | 5 | #pragma once 6 | 7 | #include "targetver.h" 8 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 9 | // Windows Header Files 10 | #include 11 | // C RunTime Header Files 12 | #include 13 | #include 14 | #include 15 | #include 16 | -------------------------------------------------------------------------------- /src/VideoProcessor-GUI/pch.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #include "pch.h" 10 | -------------------------------------------------------------------------------- /src/VideoProcessor-GUI/pch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | // Windows define magic 13 | #define NOMINMAX 14 | #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers 15 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 16 | 17 | #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit 18 | #define _AFX_ALL_WARNINGS // turns off MFC's hiding of some common and often safely ignored warning messages 19 | 20 | 21 | #include "targetver.h" 22 | 23 | 24 | #ifdef _DEBUG 25 | // Visual Leak Detector 26 | // https://stackoverflow.com/questions/58439722/how-to-install-visual-leak-detector-vld-on-visual-studio-2019 27 | #include 28 | #endif 29 | 30 | 31 | // Common includes 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | 42 | // Helper macros for HRESULT functions 43 | #define IF_NOT_S_OK(exp) if((exp) != S_OK) 44 | #define IF_S_OK(exp) if((exp) == S_OK) 45 | -------------------------------------------------------------------------------- /src/VideoProcessor-GUI/targetver.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include 13 | 14 | 15 | // Windows 7 is the minimal version needed 16 | // https://docs.microsoft.com/en-us/windows/win32/winprog/using-the-windows-headers?redirectedfrom=MSDN 17 | #define NTDDI_VERSION NTDDI_WIN7 18 | #define _WIN32_WINNT _WIN32_WINNT_WIN7 19 | 20 | 21 | #include 22 | -------------------------------------------------------------------------------- /src/VideoProcessor-GUI/version.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #include 10 | 11 | #include "version.h" 12 | 13 | // In release mode we don't accept dirty versions, sorry 14 | #ifndef _DEBUG 15 | static_assert(!VERSION_DIRTY, "Version cannot be dirty in release builds"); 16 | #endif 17 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/ACaptureDevice.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #include 10 | 11 | #include "ACaptureDevice.h" 12 | 13 | 14 | CaptureDeviceCardState::~CaptureDeviceCardState() 15 | { 16 | if (inputDisplayMode) 17 | inputDisplayMode.reset(); 18 | } 19 | 20 | 21 | HRESULT CaptureDeviceCardState::QueryInterface(REFIID iid, LPVOID* ppv) 22 | { 23 | if (!ppv) 24 | return E_INVALIDARG; 25 | 26 | // Initialise the return result 27 | *ppv = nullptr; 28 | 29 | // Obtain the IUnknown interface and compare it the provided REFIID 30 | if (iid == IID_IUnknown) 31 | { 32 | *ppv = this; 33 | AddRef(); 34 | return S_OK; 35 | } 36 | 37 | return E_NOINTERFACE; 38 | } 39 | 40 | 41 | ULONG CaptureDeviceCardState::AddRef(void) 42 | { 43 | return ++m_refCount; 44 | } 45 | 46 | 47 | ULONG CaptureDeviceCardState::Release(void) 48 | { 49 | ULONG newRefValue = --m_refCount; 50 | if (newRefValue == 0) 51 | delete this; 52 | 53 | return newRefValue; 54 | } 55 | 56 | 57 | const TCHAR* ToString(const CaptureDeviceState eotf) 58 | { 59 | switch (eotf) 60 | { 61 | case CaptureDeviceState::CAPTUREDEVICESTATE_READY: 62 | return TEXT("Ready"); 63 | 64 | case CaptureDeviceState::CAPTUREDEVICESTATE_CAPTURING: 65 | return TEXT("Capturing"); 66 | 67 | case CaptureDeviceState::CAPTUREDEVICESTATE_UNKNOWN: 68 | return TEXT("Unknown"); 69 | 70 | case CaptureDeviceState::CAPTUREDEVICESTATE_STARTING: 71 | return TEXT("Starting"); 72 | 73 | case CaptureDeviceState::CAPTUREDEVICESTATE_STOPPING: 74 | return TEXT("Stopping"); 75 | 76 | case CaptureDeviceState::CAPTUREDEVICESTATE_FAILED: 77 | return TEXT("Failed"); 78 | } 79 | 80 | throw std::runtime_error("CaptureDeviceState ToString() failed, value not recognized"); 81 | } 82 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/ACaptureDeviceDiscoverer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #include 10 | 11 | #include "ACaptureDeviceDiscoverer.h" 12 | 13 | 14 | ACaptureDeviceDiscoverer::ACaptureDeviceDiscoverer(ICaptureDeviceDiscovererCallback& callback): 15 | m_callback(callback) 16 | { 17 | } 18 | 19 | 20 | ACaptureDeviceDiscoverer::~ACaptureDeviceDiscoverer() 21 | { 22 | } 23 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/ACaptureDeviceDiscoverer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include "ACaptureDevice.h" 13 | 14 | 15 | /** 16 | * Callback handler for callbacks from the Device Discover 17 | */ 18 | class ICaptureDeviceDiscovererCallback 19 | { 20 | public: 21 | 22 | // Found a new capture device 23 | // WARNING: Most likely to be called from some internal capture card thread! 24 | virtual void OnCaptureDeviceFound(ACaptureDeviceComPtr& captureDevice) = 0; 25 | 26 | // Lost capture device previously announced through OnCaptureDeviceFound() 27 | // WARNING: Most likely to be called from some internal capture card thread! 28 | virtual void OnCaptureDeviceLost(ACaptureDeviceComPtr& captureDevice) = 0; 29 | }; 30 | 31 | 32 | /** 33 | * This class provides an abstract interface for discovering devices. 34 | * 35 | * Does not auto-Start() you need to call Start() 36 | */ 37 | class ACaptureDeviceDiscoverer: 38 | public IUnknown 39 | { 40 | public: 41 | 42 | ACaptureDeviceDiscoverer(ICaptureDeviceDiscovererCallback& callback); 43 | virtual ~ACaptureDeviceDiscoverer(); 44 | 45 | // Start automatic discovery 46 | virtual void Start() = 0; 47 | 48 | // Stop automatic discovery. 49 | // Upon stopping will send out CaptureDeviceLost() to callback 50 | virtual void Stop() = 0; 51 | 52 | protected: 53 | 54 | ICaptureDeviceDiscovererCallback& m_callback; 55 | }; 56 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/BitDepth.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #include 10 | 11 | #include "BitDepth.h" 12 | 13 | 14 | const TCHAR* ToString(const BitDepth bitDepth) 15 | { 16 | switch (bitDepth) 17 | { 18 | case BitDepth::UNKNOWN: 19 | return TEXT("UNKNOWN"); 20 | 21 | case BitDepth::BITDEPTH_8BIT: 22 | return TEXT("8-bit"); 23 | 24 | case BitDepth::BITDEPTH_10BIT: 25 | return TEXT("10-bit"); 26 | 27 | case BitDepth::BITDEPTH_12BIT: 28 | return TEXT("12-bit"); 29 | } 30 | 31 | throw std::runtime_error("BitDepth ToString() failed, value not recognized"); 32 | } 33 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/BitDepth.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include 13 | 14 | 15 | enum class BitDepth 16 | { 17 | UNKNOWN, 18 | BITDEPTH_8BIT, 19 | BITDEPTH_10BIT, 20 | BITDEPTH_12BIT 21 | }; 22 | 23 | 24 | const TCHAR* ToString(const BitDepth bidDepth); 25 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/CaptureInput.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #include 10 | 11 | #include "CaptureInput.h" 12 | 13 | 14 | CaptureInput::CaptureInput(CaptureInputId c_id, CaptureInputType c_type, CString&& c_name): 15 | id(c_id), 16 | type(c_type), 17 | name(std::move(c_name)) 18 | { 19 | } 20 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/CaptureInput.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | 13 | typedef long long CaptureInputId; 14 | 15 | 16 | #define INVALID_CAPTURE_INPUT_ID (CaptureInputId)-1 17 | 18 | 19 | enum class CaptureInputType 20 | { 21 | HDMI, 22 | SDI_OPTICAL, 23 | SDI_ELECTRICAL, 24 | COMPONENT, 25 | COMPOSITE, 26 | S_VIDEO 27 | }; 28 | 29 | 30 | /** 31 | * Simple data object which represent an input to a capture device 32 | */ 33 | class CaptureInput 34 | { 35 | public: 36 | CaptureInput(CaptureInputId c_id, CaptureInputType c_type, CString&& c_name); 37 | 38 | // This is a unique ID with which the input can be identified. 39 | CaptureInputId id; 40 | 41 | // The type of capture input 42 | CaptureInputType type; 43 | 44 | // Name of the input 45 | CString name; 46 | }; 47 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/ColorFormat.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #include 10 | 11 | #include "ColorFormat.h" 12 | 13 | 14 | const TCHAR* ToString(const ColorFormat encoding) 15 | { 16 | switch (encoding) 17 | { 18 | case ColorFormat::UNKNOWN: 19 | return TEXT("UNKNOWN"); 20 | 21 | case ColorFormat::YCbCr422: 22 | return TEXT("YCbCr 4:2:2"); 23 | 24 | case ColorFormat::RGB444: 25 | return TEXT("RGB 4:4:4"); 26 | } 27 | 28 | throw std::runtime_error("ColorFormat ToString() failed, value not recognized"); 29 | } 30 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/ColorFormat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include 13 | 14 | 15 | // (Color space) encoding of the signal 16 | // TODO: Rename me to something more understandable and fix line above here so give more details 17 | enum class ColorFormat 18 | { 19 | UNKNOWN, 20 | YCbCr422, 21 | RGB444 22 | }; 23 | 24 | 25 | const TCHAR* ToString(const ColorFormat encoding); 26 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/ColorSpace.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include 13 | 14 | 15 | enum class ColorSpace 16 | { 17 | UNKNOWN, 18 | REC_601_525, // NTSC SMPTE C 19 | REC_601_576, // PAL/SECAM (equal to below but used in analog transmission) 20 | REC_601_625, // PAL/SECAM (equal to above but used in digital transmission) 21 | REC_709, 22 | P3_D65, 23 | P3_DCI, 24 | P3_D60, 25 | BT_2020 26 | }; 27 | 28 | 29 | const TCHAR* ToString(const ColorSpace); 30 | 31 | // Convert color sapce to Cie1931 coordinates 32 | double ColorSpaceToCie1931RedX(ColorSpace); 33 | double ColorSpaceToCie1931RedY(ColorSpace); 34 | double ColorSpaceToCie1931GreenX(ColorSpace); 35 | double ColorSpaceToCie1931GreenY(ColorSpace); 36 | double ColorSpaceToCie1931BlueX(ColorSpace); 37 | double ColorSpaceToCie1931BlueY(ColorSpace); 38 | double ColorSpaceToCie1931WpX(ColorSpace); 39 | double ColorSpaceToCie1931WpY(ColorSpace); 40 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/EOTF.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #include 10 | 11 | #include "EOTF.h" 12 | 13 | 14 | const TCHAR* ToString(const EOTF eotf) 15 | { 16 | switch (eotf) 17 | { 18 | case EOTF::UNKNOWN: 19 | return TEXT("UNKNOWN"); 20 | 21 | case EOTF::SDR: 22 | return TEXT("SDR"); 23 | 24 | case EOTF::HDR: 25 | return TEXT("HDR"); 26 | 27 | case EOTF::PQ: 28 | return TEXT("PQ (ST2084)"); 29 | 30 | case EOTF::HLG: 31 | return TEXT("HLG"); 32 | } 33 | 34 | throw std::runtime_error("EOTF ToString() failed, value not recognized"); 35 | } 36 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/EOTF.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include 13 | 14 | 15 | // Electical-Optical Transfer Function 16 | enum EOTF 17 | { 18 | UNKNOWN, 19 | 20 | // Traditional gamma, SDR luminance range (max typically 100 cd/m2) 21 | SDR, 22 | 23 | // Traditional gamma, HDR luminance range (max depends on device) 24 | HDR, 25 | 26 | // SMPTE ST 2084 27 | PQ, 28 | 29 | // Hybrid Log-Gamma, ITU-R BT.2100-0 30 | HLG 31 | }; 32 | 33 | 34 | const TCHAR* ToString(const EOTF eotf); 35 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/HDRData.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | 13 | /** 14 | * HDR data like primaries, whitepoint and masterting luminance 15 | */ 16 | class HDRData 17 | { 18 | public: 19 | 20 | HDRData() {} 21 | HDRData(const HDRData&); 22 | 23 | double displayPrimaryRedX = 0; 24 | double displayPrimaryRedY = 0; 25 | double displayPrimaryGreenX = 0; 26 | double displayPrimaryGreenY = 0; 27 | double displayPrimaryBlueX = 0; 28 | double displayPrimaryBlueY = 0; 29 | 30 | double whitePointX = 0; 31 | double whitePointY = 0; 32 | 33 | double masteringDisplayMaxLuminance = 0; 34 | double masteringDisplayMinLuminance = 0; 35 | 36 | double maxCll = 0; 37 | double maxFall = 0; 38 | 39 | bool operator == (const HDRData& other) const; 40 | bool operator != (const HDRData& other) const; 41 | 42 | // Returns true if all values are populated with valid values 43 | bool IsValid() const; 44 | }; 45 | 46 | 47 | typedef std::shared_ptr HDRDataSharedPtr; 48 | 49 | 50 | // Check if 2 lumen values are effectively equal 51 | bool LumenEqual(double a, double b); 52 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/IRenderer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #include 10 | 11 | #include "IRenderer.h" 12 | 13 | 14 | const TCHAR* ToString(const RendererState rendererState) 15 | { 16 | switch (rendererState) 17 | { 18 | case RendererState::RENDERSTATE_READY: 19 | return TEXT("Ready"); 20 | 21 | case RendererState::RENDERSTATE_RENDERING: 22 | return TEXT("Rendering"); 23 | 24 | case RendererState::RENDERSTATE_STOPPED: 25 | return TEXT("Stopped"); 26 | 27 | case RendererState::RENDERSTATE_UNKNOWN: 28 | return TEXT("Unknown"); 29 | 30 | case RendererState::RENDERSTATE_STOPPING: 31 | return TEXT("Stopping"); 32 | 33 | case RendererState::RENDERSTATE_STARTING: 34 | return TEXT("Stopping"); 35 | 36 | case RendererState::RENDERSTATE_FAILED: 37 | return TEXT("Failed"); 38 | } 39 | 40 | throw std::runtime_error("RendererState ToString() failed, value not recognized"); 41 | } 42 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/ITimingClock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include 13 | 14 | #include 15 | 16 | 17 | /** 18 | * Interface for objects which are a timing clock. Timing clocks are used for 19 | * frame and data timestamping and rendering. 20 | * 21 | * They need to be constant rate and convertable to a second, 22 | * there is no requirement for conversion to wall-clock time. 23 | */ 24 | class ITimingClock 25 | { 26 | public: 27 | 28 | /** 29 | * Get the current time of the timing clock. 30 | */ 31 | virtual timingclocktime_t TimingClockNow() = 0; 32 | 33 | /** 34 | * Get ticks/second from the timing clock 35 | */ 36 | virtual timingclocktime_t TimingClockTicksPerSecond() const = 0; 37 | 38 | /** 39 | * Get a description of what the clock represents. 40 | */ 41 | virtual const TCHAR* TimingClockDescription() = 0; 42 | }; 43 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/InputLocked.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #include 10 | 11 | #include "InputLocked.h" 12 | 13 | 14 | const TCHAR* ToString(const InputLocked inputLocked) 15 | { 16 | switch (inputLocked) 17 | { 18 | case InputLocked::UNKNOWN: 19 | return TEXT("UNKNOWN"); 20 | 21 | case InputLocked::YES: 22 | return TEXT("Yes"); 23 | 24 | case InputLocked::NO: 25 | return TEXT("No"); 26 | } 27 | 28 | throw std::runtime_error("InputLocked ToString() failed, value not recognized"); 29 | } 30 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/InputLocked.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include 13 | 14 | 15 | enum class InputLocked 16 | { 17 | UNKNOWN, 18 | YES, 19 | NO 20 | }; 21 | 22 | 23 | const TCHAR* ToString(const InputLocked inputLocked); 24 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/PixelValueRange.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #include 10 | 11 | #include "PixelValueRange.h" 12 | 13 | 14 | const TCHAR* ToString(const PixelValueRange pixelValueRange) 15 | { 16 | switch (pixelValueRange) 17 | { 18 | case PixelValueRange::PIXELVALUERANGE_UNKNOWN: 19 | return TEXT("UNKNOWN"); 20 | 21 | case PixelValueRange::PIXELVALUERANGE_0_255: 22 | return TEXT("0-255"); 23 | 24 | case PixelValueRange::PIXELVALUERANGE_16_235: 25 | return TEXT("16-235"); 26 | } 27 | 28 | throw std::runtime_error("PixelValueRange ToString() failed, value not recognized"); 29 | } 30 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/PixelValueRange.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include 13 | 14 | 15 | enum PixelValueRange 16 | { 17 | PIXELVALUERANGE_UNKNOWN, 18 | PIXELVALUERANGE_0_255, 19 | PIXELVALUERANGE_16_235 20 | }; 21 | 22 | 23 | const TCHAR* ToString(const PixelValueRange); 24 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/RendererId.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | 10 | #include 11 | 12 | #include "RendererId.h" 13 | 14 | 15 | bool RendererId::operator< (const RendererId& other) const { 16 | return name < other.name; 17 | } 18 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/RendererId.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | /* 13 | * Identifies a renderer by GUID. 14 | * Works great for DirectShow, but will need revising once we get away from it. 15 | */ 16 | struct RendererId 17 | { 18 | CString name; 19 | GUID guid; 20 | 21 | bool operator< (const RendererId& other) const; 22 | }; 23 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/StringUtils.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #include 10 | 11 | #include "StringUtils.h" 12 | 13 | 14 | wchar_t* ToString(const char* c) 15 | { 16 | const size_t size = strlen(c) + 1; 17 | wchar_t* wText = new wchar_t[size]; 18 | 19 | size_t outSize; 20 | mbstowcs_s(&outSize, wText, size, c, size - 1); 21 | 22 | return wText; 23 | } 24 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/StringUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | // Convert a std::string to a wstring and deliver in a smart pointer so it gets deleted 13 | wchar_t* ToString(const char*); 14 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/TimingClock.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | 10 | #include 11 | 12 | #include "TimingClock.h" 13 | 14 | 15 | double TimingClockDiffMs(timingclocktime_t start, timingclocktime_t stop, timingclocktime_t ticksPerSecond) 16 | { 17 | const timingclocktime_t diff = stop - start; 18 | const double ticksPerMs = ticksPerSecond / 1000.0; 19 | 20 | return diff / ticksPerMs; 21 | } 22 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/TimingClock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include 13 | #include 14 | 15 | 16 | typedef int64_t timingclocktime_t; 17 | 18 | 19 | const static timingclocktime_t TIMING_CLOCK_TIME_INVALID = std::numeric_limits::lowest(); 20 | 21 | 22 | // Return the dif in various units of time from a to b and expressed in ms. 23 | // If stop > start then the result will be positive 24 | double TimingClockDiffMs(timingclocktime_t start, timingclocktime_t stop, timingclocktime_t ticksPerSecond); 25 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/VideoConversionOverride.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #include 10 | 11 | #include "VideoConversionOverride.h" 12 | 13 | 14 | const TCHAR* ToString(const VideoConversionOverride videoConversionOverride) 15 | { 16 | switch (videoConversionOverride) 17 | { 18 | case VideoConversionOverride::VIDEOCONVERSION_NONE: 19 | return TEXT("No override"); 20 | 21 | case VideoConversionOverride::VIDEOCONVERSION_V210_TO_P010: 22 | return TEXT("V210 > P010"); 23 | } 24 | 25 | throw std::runtime_error("VideoConversionOverride ToString() failed, value not recognized"); 26 | } 27 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/VideoConversionOverride.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include 13 | 14 | 15 | /** 16 | * This is used by renderers to make specific choices 17 | */ 18 | enum class VideoConversionOverride 19 | { 20 | // No override, let renderer decide 21 | VIDEOCONVERSION_NONE, 22 | 23 | // If the video is v210 (YUV422) convert it to p010 (YUV420) 24 | VIDEOCONVERSION_V210_TO_P010 25 | }; 26 | 27 | 28 | const TCHAR* ToString(const VideoConversionOverride); 29 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/VideoFrame.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #include 10 | 11 | #include "VideoFrame.h" 12 | 13 | 14 | VideoFrame::VideoFrame( 15 | const void* data, uint64_t counter, 16 | timingclocktime_t timingTimestamp, IUnknown* sourceBuffer): 17 | m_data(data), 18 | m_counter(counter), 19 | m_timingTimestamp(timingTimestamp), 20 | m_sourceBuffer(sourceBuffer) 21 | { 22 | assert(data); 23 | } 24 | 25 | VideoFrame::VideoFrame(const VideoFrame& videoFrame) : 26 | m_data(videoFrame.m_data), 27 | m_counter(videoFrame.m_counter), 28 | m_timingTimestamp(videoFrame.m_timingTimestamp), 29 | m_sourceBuffer(videoFrame.m_sourceBuffer) 30 | { 31 | } 32 | 33 | 34 | VideoFrame::~VideoFrame() 35 | { 36 | } 37 | 38 | 39 | void VideoFrame::SourceBufferAddRef() 40 | { 41 | m_sourceBuffer->AddRef(); 42 | } 43 | 44 | 45 | void VideoFrame::SourceBufferRelease() 46 | { 47 | const ULONG refCount = m_sourceBuffer->Release(); 48 | assert(refCount == 0); 49 | } 50 | 51 | 52 | VideoFrame& VideoFrame::operator= (const VideoFrame& videoFrame) 53 | { 54 | assert(this != &videoFrame); 55 | 56 | m_data = videoFrame.m_data; 57 | m_counter = videoFrame.m_counter; 58 | m_timingTimestamp = videoFrame.m_timingTimestamp; 59 | m_sourceBuffer = videoFrame.m_sourceBuffer; 60 | 61 | return *this; 62 | } 63 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/VideoFrame.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | 13 | 14 | /** 15 | * Structure which represents a single video frame 16 | */ 17 | class VideoFrame 18 | { 19 | public: 20 | 21 | /** 22 | * Constructor 23 | * 24 | * This is just a pointer to some data. 25 | * If this data in any way, shape or form might be gone by the time it's used, you can use the 26 | * sourceBuffer argument to have the VideoFrame constr/destr do ref management. 27 | */ 28 | VideoFrame() {} 29 | VideoFrame( 30 | const void* const data, uint64_t counter, 31 | timingclocktime_t timingTimestamp, IUnknown* sourceBuffer); 32 | VideoFrame(const VideoFrame&); 33 | 34 | ~VideoFrame(); 35 | 36 | // Get frame data 37 | // If you're wondering where the size of GetData() is, it can be found by querying 38 | // VideoState::BytesPerFrame() which you should get before this gets delivered. 39 | const void* const GetData() const { return m_data; } 40 | 41 | // Get counter, this is monotoncally increasing from the capture source 42 | uint64_t GetCounter() const { return m_counter; } 43 | 44 | // Timestamp set by the timing clock. 45 | timingclocktime_t GetTimingTimestamp() const { return m_timingTimestamp; } 46 | 47 | // Memory functions to hold onto the video buffer for longer 48 | void SourceBufferAddRef(); 49 | void SourceBufferRelease(); 50 | 51 | VideoFrame& operator= (const VideoFrame& videoFrame); 52 | 53 | private: 54 | const void* m_data; 55 | uint64_t m_counter; 56 | timingclocktime_t m_timingTimestamp; 57 | IUnknown* m_sourceBuffer; 58 | }; 59 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/VideoState.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | 21 | /** 22 | * This describes the video stream 23 | */ 24 | class VideoState: 25 | public IUnknown 26 | { 27 | public: 28 | VideoState() {} 29 | VideoState(const VideoState&); 30 | 31 | // True if valid, else do not interpret other fields 32 | bool valid = false; 33 | 34 | DisplayModeSharedPtr displayMode = nullptr; 35 | VideoFrameEncoding videoFrameEncoding = VideoFrameEncoding::UNKNOWN; 36 | EOTF eotf = EOTF::UNKNOWN; 37 | ColorSpace colorspace = ColorSpace::UNKNOWN; 38 | bool invertedVertical = false; 39 | 40 | // Will be non-null if valid 41 | HDRDataSharedPtr hdrData = nullptr; 42 | 43 | // IUnknown 44 | HRESULT QueryInterface(REFIID iid, LPVOID* ppv) override; 45 | ULONG AddRef() override; 46 | ULONG Release() override; 47 | 48 | // Return the the amount of bytes needed to store a row/line of pixels in this format 49 | uint32_t BytesPerRow() const; 50 | 51 | // Return the the amount of bytes needed to store a full frame of pixels in this format 52 | uint32_t BytesPerFrame() const; 53 | 54 | private: 55 | 56 | std::atomic m_refCount; 57 | }; 58 | 59 | 60 | typedef CComPtr VideoStateComPtr; 61 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/WallClock.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #include 10 | 11 | #include "WallClock.h" 12 | 13 | 14 | timestamp_t GetWallClockTime() 15 | { 16 | // The FILETIME structure contains a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC). 17 | // -- https://zetcode.com/gui/winapi/datetime/ (2020) 18 | FILETIME ft; 19 | 20 | // "High-accuracy function gives you the best of both worlds: Time correlated with real-world clocks, 21 | // but with the accuracy of the system performance counter." 22 | // -- https://devblogs.microsoft.com/oldnewthing/20170921-00/?p=97057 (Raymond Chen, 2017) 23 | GetSystemTimeAsFileTime(&ft); 24 | 25 | timestamp_t t = (timestamp_t)ft.dwHighDateTime << 32 | ft.dwLowDateTime; 26 | t -= 11644473600000000Ui64; // start of the windows time (1601-01-01) to epoch (1970-01-01) 27 | 28 | return t; 29 | } 30 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/WallClock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | 13 | // Time in 100ns since epoch. 14 | typedef int64_t timestamp_t; 15 | 16 | const static timestamp_t MIN_TIMESTAMP = 16228512000000000LL; // 2021-06-05 0Z 17 | const static timestamp_t TICKS_PER_SECOND = 10000000LL; // The smallest unit of representable time(100ns) is called a tick. 18 | 19 | /** 20 | * Current time in 100ns since epoch 21 | */ 22 | timestamp_t GetWallClockTime(); 23 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/blackmagic_decklink/BlackMagicDeckLinkCaptureDeviceDiscoverer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | 19 | 20 | /** 21 | * BlackMagic DeckLink disoverer 22 | */ 23 | class BlackMagicDeckLinkCaptureDeviceDiscoverer: 24 | public ACaptureDeviceDiscoverer, 25 | public IDeckLinkDeviceNotificationCallback 26 | { 27 | public: 28 | 29 | BlackMagicDeckLinkCaptureDeviceDiscoverer(ICaptureDeviceDiscovererCallback& callback); 30 | virtual ~BlackMagicDeckLinkCaptureDeviceDiscoverer(); 31 | 32 | // ACaptureDeviceDiscoverer 33 | virtual void Start() override; 34 | virtual void Stop() override; 35 | 36 | // IDeckLinkDeviceNotificationCallback 37 | HRESULT STDMETHODCALLTYPE DeckLinkDeviceArrived(IDeckLink* deckLinkDevice) override; 38 | HRESULT STDMETHODCALLTYPE DeckLinkDeviceRemoved(IDeckLink* deckLinkDevice) override; 39 | 40 | // IUnknown 41 | HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID* ppv) override; 42 | ULONG STDMETHODCALLTYPE AddRef() override; 43 | ULONG STDMETHODCALLTYPE Release() override; 44 | 45 | private: 46 | 47 | CComPtr m_deckLinkDiscovery = nullptr; 48 | 49 | // Maps between the IDeckLink ptr and the capture device 50 | std::map m_captureDeviceMap; 51 | 52 | std::atomic m_refCount; 53 | }; 54 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/blackmagic_decklink/BlackMagicDeckLinkTranslate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | 22 | ColorFormat TranslateColorFormat(BMDDetectedVideoInputFormatFlags detectedVideoInputFormatFlagsValue); 23 | 24 | BitDepth TranslateBithDepth(BMDDetectedVideoInputFormatFlags detectedVideoInputFormatFlagsValue); 25 | 26 | VideoFrameEncoding Translate(BMDPixelFormat, ColorSpace); 27 | 28 | EOTF TranslateEOTF(LONGLONG electroOpticalTransferFuncValue); 29 | 30 | ColorSpace Translate(BMDColorspace, uint32_t verticalLines); 31 | 32 | DisplayModeSharedPtr Translate(BMDDisplayMode); 33 | 34 | double FPS(BMDDisplayMode displayMode); 35 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/cie.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | // https://en.wikipedia.org/wiki/CIE_1931_color_space 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | 16 | // Return true if the color is a valid value for a CIE color 17 | bool CieValidColor(double color); 18 | 19 | 20 | // Returns true if 2 values are indisinguishable in CIE color space 21 | bool CieEquals(double color1, double color2); 22 | 23 | 24 | // Return the string representation of an XY coordinate 25 | CString CieXYToString(double x, double y); 26 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/framework.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 4 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/guid.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #include 10 | 11 | #define INITGUID 12 | 13 | #include "guid.h" 14 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/microsoft_directshow/DirectShowRendererStartStopTimeMethod.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #include 10 | 11 | #include "DirectShowRendererStartStopTimeMethod.h" 12 | 13 | 14 | const TCHAR* ToString(const DirectShowStartStopTimeMethod rendererTimestamp) 15 | { 16 | switch (rendererTimestamp) 17 | { 18 | case DirectShowStartStopTimeMethod::DS_SSTM_CLOCK_SMART: 19 | return TEXT("Clock-Smart"); 20 | 21 | case DirectShowStartStopTimeMethod::DS_SSTM_CLOCK_THEO: 22 | return TEXT("Clock-Theo"); 23 | 24 | case DirectShowStartStopTimeMethod::DS_SSTM_CLOCK_CLOCK: 25 | return TEXT("Clock-Clock"); 26 | 27 | case DirectShowStartStopTimeMethod::DS_SSTM_THEO_THEO: 28 | return TEXT("Theo-Theo"); 29 | 30 | case DirectShowStartStopTimeMethod::DS_SSTM_CLOCK_NONE: 31 | return TEXT("Clock-None"); 32 | 33 | case DirectShowStartStopTimeMethod::DS_SSTM_THEO_NONE: 34 | return TEXT("Theo-None"); 35 | 36 | case DirectShowStartStopTimeMethod::DS_SSTM_NONE: 37 | return TEXT("None"); 38 | } 39 | 40 | throw std::runtime_error("DirectShowStartStopTimeMethod ToString() failed, value not recognized"); 41 | } 42 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/microsoft_directshow/DirectShowRendererStartStopTimeMethod.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | /** 13 | * This determines how frames are timestamped with a start and a stop time. 14 | * It is specific to DirectShow. 15 | */ 16 | enum DirectShowStartStopTimeMethod 17 | { 18 | // 19 | // Both a start and a stop time 20 | // 21 | 22 | // Smart. Uses the next clock if available else will take theo. 23 | DS_SSTM_CLOCK_SMART, 24 | 25 | // Use the given clock for start plus the theorized frame length for stop 26 | DS_SSTM_CLOCK_THEO, 27 | 28 | // Use the given clock for start plus the start of the next frame for the stop time. 29 | DS_SSTM_CLOCK_CLOCK, 30 | 31 | // Theoretical timestamp based on frame duration 32 | DS_SSTM_THEO_THEO, 33 | 34 | // 35 | // Only a start time, no stop time set 36 | // 37 | 38 | DS_SSTM_CLOCK_NONE, 39 | 40 | 41 | DS_SSTM_THEO_NONE, 42 | 43 | // 44 | // No timestamps 45 | // This will mean to the DirectShow renderer that every timestamp is late. 46 | // 47 | 48 | DS_SSTM_NONE 49 | }; 50 | 51 | 52 | const TCHAR* ToString(const DirectShowStartStopTimeMethod rendererTimestamp); 53 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/microsoft_directshow/DirectShowRenderers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | 18 | // Get all DirectShow video renderers 19 | void DirectShowVideoRendererIds(std::vector& rendererIds); 20 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/microsoft_directshow/DirectShowTimingClock.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | 10 | #include 11 | 12 | #include "DirectShowTimingClock.h" 13 | 14 | 15 | DirectShowTimingClock::DirectShowTimingClock(ITimingClock& timingClock): 16 | CBaseReferenceClock(DIRECTSHOW_TIMING_CLOCK_NAME, nullptr, nullptr, nullptr), 17 | m_timingClock(timingClock), 18 | m_ticksPer100ns(m_timingClock.TimingClockTicksPerSecond() / 10000000.0) 19 | { 20 | DbgLog((LOG_TRACE, 1, TEXT("DirectShowTimingClock::DirectShowTimingClock()"))); 21 | 22 | assert(m_ticksPer100ns > 0); 23 | } 24 | 25 | 26 | DirectShowTimingClock::~DirectShowTimingClock() 27 | { 28 | DbgLog((LOG_TRACE, 1, TEXT("DirectShowTimingClock::~DirectShowTimingClock()"))); 29 | } 30 | 31 | 32 | REFERENCE_TIME DirectShowTimingClock::GetPrivateTime() 33 | { 34 | const REFERENCE_TIME rt = (REFERENCE_TIME)(m_timingClock.TimingClockNow() / m_ticksPer100ns); 35 | assert(rt > 0); 36 | 37 | return rt; 38 | } 39 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/microsoft_directshow/DirectShowTimingClock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include 13 | 14 | #include 15 | 16 | 17 | #define DIRECTSHOW_TIMING_CLOCK_NAME TEXT("TimingClock") 18 | 19 | 20 | /** 21 | * Clock which can get the time from an timingclock interface. 22 | * To be used in Directshow graphs 23 | */ 24 | class DirectShowTimingClock: 25 | public CBaseReferenceClock 26 | { 27 | public: 28 | 29 | DirectShowTimingClock(ITimingClock& timingClock); 30 | virtual ~DirectShowTimingClock(); 31 | 32 | // CBaseReferenceClock 33 | REFERENCE_TIME GetPrivateTime() override; 34 | 35 | private: 36 | ITimingClock& m_timingClock; 37 | const double m_ticksPer100ns; 38 | }; 39 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/microsoft_directshow/DirectShowTranslations.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | 21 | const GUID TranslateToMediaSubType(VideoFrameEncoding); 22 | 23 | DXVA_NominalRange TranslatePixelValueRange(PixelValueRange); 24 | 25 | DXVA_VideoTransferMatrix TranslateVideoTransferMatrix(ColorSpace); 26 | 27 | DXVA_VideoPrimaries TranslateVideoPrimaries(ColorSpace); 28 | 29 | DXVA_VideoTransferFunction TranslateVideoTranferFunction(EOTF, ColorSpace); 30 | 31 | DWORD TranslateVideoFrameEncodingToBiCompression(VideoFrameEncoding); 32 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/microsoft_directshow/live_source_filter/CBufferedLiveSourceVideoOutputPin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include 13 | 14 | #include 15 | #include "ALiveSourceVideoOutputPin.h" 16 | 17 | #include "CLiveSource.h" 18 | 19 | 20 | /** 21 | * This is an buffered output pin, any presented frame will be buffered first 22 | * and then a separate thread will deliver the buffers to the renderer. 23 | * 24 | * This class borrows heavily from DirectShow CSourceStream. 25 | */ 26 | class CBufferedLiveSourceVideoOutputPin: 27 | public ALiveSourceVideoOutputPin, 28 | public CAMThread 29 | { 30 | public: 31 | 32 | CBufferedLiveSourceVideoOutputPin( 33 | CLiveSource* filter, 34 | CCritSec* pLock, 35 | HRESULT* phr); 36 | virtual ~CBufferedLiveSourceVideoOutputPin(); 37 | 38 | // CBaseOutputPin 39 | HRESULT Active() override; 40 | HRESULT Inactive() override; 41 | 42 | // ALiveSourceVideoOutputPin 43 | HRESULT OnVideoFrame(VideoFrame&) override; 44 | void SetFrameQueueMaxSize(size_t) override; 45 | size_t GetFrameQueueSize() override; 46 | void Reset() override; 47 | REFERENCE_TIME NextFrameTimestamp() const override { return m_nextVideoFrameStartTime; } 48 | 49 | private: 50 | 51 | size_t m_frameQueueMaxSize = 0; 52 | 53 | std::deque m_videoFrameQueue; 54 | std::atomic_bool m_isActive = false; 55 | 56 | CCritSec m_filterCritSec; 57 | 58 | REFERENCE_TIME m_nextVideoFrameStartTime = REFERENCE_TIME_INVALID; 59 | 60 | // Thread function, upon return thread exist. 61 | // Return codes > 0 indicate an error occured 62 | DWORD ThreadProc(); 63 | 64 | // Remove all items from the videoFrameQueue 65 | void PurgeQueue(); 66 | }; 67 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/microsoft_directshow/live_source_filter/CUnbufferedLiveSourceVideoOutputPin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #include 10 | 11 | #include "CUnbufferedLiveSourceVideoOutputPin.h" 12 | 13 | 14 | CUnbufferedLiveSourceVideoOutputPin::CUnbufferedLiveSourceVideoOutputPin( 15 | CLiveSource* filter, 16 | CCritSec* pLock, 17 | HRESULT* phr): 18 | ALiveSourceVideoOutputPin(filter, pLock, phr) 19 | { 20 | } 21 | 22 | 23 | CUnbufferedLiveSourceVideoOutputPin::~CUnbufferedLiveSourceVideoOutputPin() 24 | { 25 | 26 | } 27 | 28 | 29 | HRESULT CUnbufferedLiveSourceVideoOutputPin::OnVideoFrame(VideoFrame& videoFrame) 30 | { 31 | BYTE* pData = nullptr; 32 | HRESULT hr; 33 | 34 | // Get buffer for sample 35 | // Note you can fill in start and stop time, but following the code shows that they are unused. 36 | IMediaSample* pSample = nullptr; 37 | hr = this->GetDeliveryBuffer(&pSample, nullptr, nullptr, 0); 38 | if (FAILED(hr)) 39 | { 40 | return hr; 41 | } 42 | 43 | // Render 44 | hr = RenderVideoFrameIntoSample(videoFrame, pSample); 45 | if (FAILED(hr) || hr == S_FRAME_NOT_RENDERED) 46 | { 47 | pSample->Release(); 48 | return hr; 49 | } 50 | 51 | // Deliver to downstream renderer (this will block) 52 | hr = this->Deliver(pSample); 53 | pSample->Release(); 54 | 55 | return hr; 56 | } 57 | 58 | 59 | void CUnbufferedLiveSourceVideoOutputPin::SetFrameQueueMaxSize(size_t frameBufferMaxSize) 60 | { 61 | if (frameBufferMaxSize != 0) 62 | throw std::runtime_error("CUnbufferedLiveSourceVideoOutputPin can only accept zero frame buffers "); 63 | } 64 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/microsoft_directshow/live_source_filter/CUnbufferedLiveSourceVideoOutputPin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include "ALiveSourceVideoOutputPin.h" 13 | 14 | #include "CLiveSource.h" 15 | 16 | 17 | /** 18 | * This is an unbuffered video output pin, any presented frame will go directly to the 19 | * renderer. Problems guaranteed if you use timestamps as that will block the 20 | * renderer for the given duration 21 | */ 22 | class CUnbufferedLiveSourceVideoOutputPin: 23 | public ALiveSourceVideoOutputPin 24 | { 25 | public: 26 | 27 | CUnbufferedLiveSourceVideoOutputPin( 28 | CLiveSource* filter, 29 | CCritSec* pLock, 30 | HRESULT* phr); 31 | virtual ~CUnbufferedLiveSourceVideoOutputPin(); 32 | 33 | // ALiveSourceVideoOutputPin 34 | HRESULT OnVideoFrame(VideoFrame&) override; 35 | void SetFrameQueueMaxSize(size_t) override; 36 | size_t GetFrameQueueSize() override { return 0; } 37 | }; 38 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/microsoft_directshow/live_source_filter/ILiveSource.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | 19 | static const GUID IID_ILiveSource = 20 | { 0x77f36c8d, 0xdab1, 0x4356, { 0x82, 0x73, 0x3f, 0xbe, 0x60, 0x63, 0xf2, 0x57 } }; 21 | 22 | static const GUID CLSID_CLiveSource = 23 | { 0x63ca2ee3, 0x6460, 0x4098, { 0x9b, 0x74, 0x7, 0x9c, 0xe7, 0x40, 0xe4, 0xb5 } }; 24 | 25 | 26 | DECLARE_INTERFACE_(ILiveSource, IUnknown) 27 | { 28 | // Initialize, can only be called once 29 | STDMETHOD(Initialize)( 30 | IVideoFrameFormatter* videoFrameFormatter, 31 | const AM_MEDIA_TYPE& mediaSubType, 32 | timestamp_t frameDuration, 33 | ITimingClock * timingClock, 34 | DirectShowStartStopTimeMethod timestamp, 35 | bool useFrameQueue, 36 | size_t frameQueueMaxSize) PURE; 37 | 38 | // Destroy, can only be called once 39 | STDMETHOD(Destroy)(void) PURE; 40 | 41 | // HDR data can change dynamically on a frame-by-frame basis. If you call 42 | // this then the next frame sent through OnVideoFrame() will carry the information 43 | STDMETHOD(OnHDRData)(HDRDataSharedPtr&) PURE; 44 | 45 | // New video frame to send out. 46 | // OnVideoState() has to have been called before this 47 | STDMETHOD(OnVideoFrame)(VideoFrame&) PURE; 48 | 49 | // Set the video frame queue max size. 50 | // Only valid te be called if the RendererState called back RENDERSTATE_RENDERING 51 | // Queues might not be implemented by all renderers, this will throw if it cannot be set 52 | STDMETHOD(SetFrameQueueMaxSize)(size_t) PURE; 53 | 54 | // Reset the internal state and the video stream. 55 | STDMETHOD(Reset)(void) PURE; 56 | }; 57 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/microsoft_directshow/video_renderers/DirectShowEnhancedVideoRenderer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #include 10 | 11 | #include "DirectShowEnhancedVideoRenderer.h" 12 | 13 | 14 | DirectShowEnhancedVideoRenderer::DirectShowEnhancedVideoRenderer( 15 | IRendererCallback& callback, 16 | HWND videoHwnd, 17 | HWND eventHwnd, 18 | UINT eventMsg, 19 | ITimingClock* timingClock, 20 | DirectShowStartStopTimeMethod timestamp, 21 | bool useFrameQueue, 22 | size_t frameQueueMaxSize, 23 | VideoConversionOverride videoConversionOverride): 24 | DirectShowGenericVideoRenderer( 25 | CLSID_EnhancedVideoRenderer, 26 | callback, 27 | videoHwnd, 28 | eventHwnd, 29 | eventMsg, 30 | timingClock, 31 | timestamp, 32 | useFrameQueue, 33 | frameQueueMaxSize, 34 | videoConversionOverride) 35 | { 36 | callback.OnRendererDetailString(TEXT("DirectShow Enhanced Video Renderer")); 37 | } 38 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/microsoft_directshow/video_renderers/DirectShowEnhancedVideoRenderer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include "DirectShowGenericVideoRenderer.h" 13 | 14 | 15 | /** 16 | * Enhanced Video Renderer 17 | * TODO: This does not work as is, it's incomplete, see https://docs.microsoft.com/en-us/windows/win32/medfound/how-to-write-an-evr-presenter 18 | */ 19 | class DirectShowEnhancedVideoRenderer: 20 | public DirectShowGenericVideoRenderer 21 | { 22 | public: 23 | 24 | DirectShowEnhancedVideoRenderer( 25 | IRendererCallback& callback, 26 | HWND videoHwnd, 27 | HWND eventHwnd, 28 | UINT eventMsg, 29 | ITimingClock* timingClock, 30 | DirectShowStartStopTimeMethod directShowStartStopTimeMethod, 31 | bool useFrameQueue, 32 | size_t frameQueueMaxSize, 33 | VideoConversionOverride videoConversionOverride); 34 | 35 | virtual ~DirectShowEnhancedVideoRenderer() {} 36 | }; 37 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/microsoft_directshow/video_renderers/DirectShowGenericHDRVideoRenderer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include "DirectShowVideoRenderer.h" 13 | 14 | 15 | /** 16 | * DirectShow HDR video renderer. 17 | * 18 | * Will try to build a direct VIDEOINFOHEADER2 connection. 19 | */ 20 | class DirectShowGenericHDRVideoRenderer : 21 | public DirectShowVideoRenderer 22 | { 23 | public: 24 | 25 | DirectShowGenericHDRVideoRenderer( 26 | GUID rendererCLSID, 27 | IRendererCallback& callback, 28 | HWND videoHwnd, 29 | HWND eventHwnd, 30 | UINT eventMsg, 31 | ITimingClock* timingClock, 32 | DirectShowStartStopTimeMethod directShowStartStopTimeMethod, 33 | bool useFrameQueue, 34 | size_t frameQueueMaxSize, 35 | VideoConversionOverride videoConversionOverride, 36 | DXVA_NominalRange forceNominalRange, 37 | DXVA_VideoTransferFunction forceVideoTransferFunction, 38 | DXVA_VideoTransferMatrix forceVideoTransferMatrix, 39 | DXVA_VideoPrimaries forceVideoPrimaries); 40 | 41 | virtual ~DirectShowGenericHDRVideoRenderer(); 42 | 43 | // IVideoRenderer 44 | bool OnVideoState(VideoStateComPtr&) override; 45 | void OnPaint() override { /* not implemented */ } 46 | 47 | protected: 48 | 49 | // DirectShowVideoRenderer 50 | void RendererBuild() override; 51 | void MediaTypeGenerate() override; 52 | void RendererConnect() override; 53 | void LiveSourceBuildAndConnect() override; 54 | 55 | private: 56 | 57 | const GUID m_rendererCLSID; 58 | const DXVA_NominalRange m_forceNominalRange; 59 | const DXVA_VideoTransferFunction m_forceVideoTransferFunction; 60 | const DXVA_VideoTransferMatrix m_forceVideoTransferMatrix; 61 | const DXVA_VideoPrimaries m_forceVideoPrimaries; 62 | }; 63 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/microsoft_directshow/video_renderers/DirectShowGenericVideoRenderer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include "DirectShowVideoRenderer.h" 13 | 14 | 15 | /** 16 | * DirectShow generic video renderer. Will try to build something reasonable. 17 | * 18 | * Will try to build a FORMAT_VideoInfo connection, allowing any filter 19 | * in between just to get a connection. 20 | */ 21 | class DirectShowGenericVideoRenderer : 22 | public DirectShowVideoRenderer 23 | { 24 | public: 25 | 26 | DirectShowGenericVideoRenderer( 27 | GUID rendererCLSID, 28 | IRendererCallback& callback, 29 | HWND videoHwnd, 30 | HWND eventHwnd, 31 | UINT eventMsg, 32 | ITimingClock* timingClock, 33 | DirectShowStartStopTimeMethod directShowStartStopTimeMethod, 34 | bool useFrameQueue, 35 | size_t frameQueueMaxSize, 36 | VideoConversionOverride videoConversionOverride); 37 | 38 | virtual ~DirectShowGenericVideoRenderer() {} 39 | 40 | // IVideoRenderer 41 | void OnPaint() override { /* not implemented */ } 42 | 43 | protected: 44 | 45 | // DirectShowVideoRenderer 46 | void RendererBuild() override; 47 | void MediaTypeGenerate() override; 48 | void RendererConnect() override; 49 | 50 | private: 51 | 52 | const GUID m_rendererCLSID; 53 | }; 54 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/microsoft_directshow/video_renderers/DirectShowMPCVideoRenderer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include "DirectShowGenericVideoRenderer.h" 13 | 14 | 15 | /** 16 | * MPC Video Renderer 17 | * https://github.com/Aleksoid1978/VideoRenderer/ 18 | */ 19 | class DirectShowMPCVideoRenderer: 20 | public DirectShowVideoRenderer 21 | { 22 | public: 23 | 24 | DirectShowMPCVideoRenderer( 25 | IRendererCallback& callback, 26 | HWND videoHwnd, 27 | HWND eventHwnd, 28 | UINT eventMsg, 29 | ITimingClock* timingClock, 30 | DirectShowStartStopTimeMethod directShowStartStopTimeMethod, 31 | bool useFrameQueue, 32 | size_t frameQueueMaxSize, 33 | VideoConversionOverride videoConversionOverride, 34 | DXVA_NominalRange forceNominalRange, 35 | DXVA_VideoTransferFunction forceVideoTransferFunction, 36 | DXVA_VideoTransferMatrix forceVideoTransferMatrix, 37 | DXVA_VideoPrimaries forceVideoPrimaries); 38 | 39 | virtual ~DirectShowMPCVideoRenderer() {} 40 | 41 | // IVideoRenderer 42 | bool OnVideoState(VideoStateComPtr&) override; 43 | void OnSize() override; 44 | void OnPaint() override; 45 | 46 | protected: 47 | 48 | // DirectShowVideoRenderer 49 | void WindowSetup() override; 50 | void RendererBuild() override; 51 | void MediaTypeGenerate() override; 52 | void RendererConnect() override; 53 | void LiveSourceBuildAndConnect() override; 54 | 55 | private: 56 | 57 | const DXVA_NominalRange m_forceNominalRange; 58 | const DXVA_VideoTransferFunction m_forceVideoTransferFunction; 59 | const DXVA_VideoTransferMatrix m_forceVideoTransferMatrix; 60 | const DXVA_VideoPrimaries m_forceVideoPrimaries; 61 | }; 62 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/microsoft_directshow/video_renderers/DirectShowVideoRenderers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | 18 | // Get all DirectShow video renderers 19 | void DirectShowVideoRendererIds(std::vector& rendererIds); 20 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/pch.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #include "pch.h" 10 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/pch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | // Windows define magic 13 | #define NOMINMAX 14 | #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers 15 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 16 | 17 | #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit 18 | #define _AFX_ALL_WARNINGS // turns off MFC's hiding of some common and often safely ignored warning messages 19 | 20 | 21 | //#include "targetver.h" 22 | 23 | // TODO: test if this can be safely removed 24 | //#ifdef _DEBUG 25 | // Visual Leak Detector 26 | // https://stackoverflow.com/questions/58439722/how-to-install-visual-leak-detector-vld-on-visual-studio-2019 27 | // #include 28 | //#endif 29 | 30 | 31 | // Common includes 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | 42 | // Helper macros for HRESULT functions 43 | #define IF_NOT_S_OK(exp) if((exp) != S_OK) 44 | #define IF_S_OK(exp) if((exp) == S_OK) 45 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/video_frame_formatter/CFFMpegDecoderVideoFrameFormatter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | extern "C" 13 | { 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | } 20 | 21 | #include 22 | 23 | 24 | /** 25 | * This formatter can convert using an ffmpeg decoder and scaler for a target pixel format 26 | */ 27 | class CFFMpegDecoderVideoFrameFormatter: 28 | public IVideoFrameFormatter 29 | { 30 | public: 31 | 32 | CFFMpegDecoderVideoFrameFormatter( 33 | AVCodecID inputCodecId, 34 | AVPixelFormat targetPixelFormat); 35 | virtual ~CFFMpegDecoderVideoFrameFormatter(); 36 | 37 | // IVideoFrameFormatter 38 | void OnVideoState(VideoStateComPtr& videoState) override; 39 | bool FormatVideoFrame(const VideoFrame& inFrame, BYTE* outBuffer) override; 40 | LONG GetOutFrameSize() const override; 41 | 42 | private: 43 | 44 | const AVPixelFormat mTargetPixelFormat; 45 | const AVCodec* mAVCodecDecoder; 46 | AVCodecContext* mAVCodecContext; 47 | 48 | int mInputBytesPerVideoFrame = 0; 49 | int mHeight = 0; 50 | int mWidth = 0; 51 | LONG mOutFrameSize = 0; 52 | 53 | struct SwsContext* mSws = nullptr; 54 | AVFrame* mInputFrame = nullptr; 55 | AVFrame* mOutputFrame = nullptr; 56 | 57 | AVPacket* mPkt; 58 | 59 | void Cleanup(); 60 | }; 61 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/video_frame_formatter/CNoopVideoFrameFormatter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #include 10 | 11 | #include "CNoopVideoFrameFormatter.h" 12 | 13 | 14 | void CNoopVideoFrameFormatter::OnVideoState(VideoStateComPtr& videoState) 15 | { 16 | if (!videoState) 17 | throw std::runtime_error("Null video state is not allowed"); 18 | 19 | m_bytesPerVideoFrame = videoState->BytesPerFrame(); 20 | assert(m_bytesPerVideoFrame > 0); 21 | } 22 | 23 | 24 | bool CNoopVideoFrameFormatter::FormatVideoFrame( 25 | const VideoFrame& inFrame, 26 | BYTE* outBuffer) 27 | { 28 | if (m_bytesPerVideoFrame == 0) 29 | throw std::runtime_error("bytes per frame not known, call OnVideoState() first"); 30 | 31 | memcpy(outBuffer, inFrame.GetData(), m_bytesPerVideoFrame); 32 | return true; 33 | } 34 | 35 | 36 | LONG CNoopVideoFrameFormatter::GetOutFrameSize() const 37 | { 38 | assert(m_bytesPerVideoFrame > 0); 39 | return m_bytesPerVideoFrame; 40 | } 41 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/video_frame_formatter/CNoopVideoFrameFormatter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include 13 | 14 | 15 | /** 16 | * Video frame formatter which simply does a direct copy 17 | */ 18 | class CNoopVideoFrameFormatter: 19 | public IVideoFrameFormatter 20 | { 21 | public: 22 | 23 | virtual ~CNoopVideoFrameFormatter() {} 24 | 25 | // IVideoFrameFormatter 26 | void OnVideoState(VideoStateComPtr& videoState) override; 27 | bool FormatVideoFrame(const VideoFrame& inFrame, BYTE* outBuffer) override; 28 | LONG GetOutFrameSize() const override; 29 | 30 | private: 31 | int m_bytesPerVideoFrame = 0; 32 | }; 33 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/video_frame_formatter/CV210toP010VideoFrameFormatter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include 13 | 14 | 15 | /** 16 | * Video frame formatter which reads V210 and write to P010 17 | * (that's YUV422 to YUV420 both in 10 bit, all assuming this is running on little endian hardware) 18 | */ 19 | class CV210toP010VideoFrameFormatter: 20 | public IVideoFrameFormatter 21 | { 22 | public: 23 | 24 | virtual ~CV210toP010VideoFrameFormatter() {} 25 | 26 | // IVideoFrameFormatter 27 | void OnVideoState(VideoStateComPtr& videoState) override; 28 | bool FormatVideoFrame(const VideoFrame& inFrame, BYTE* outBuffer) override; 29 | LONG GetOutFrameSize() const override; 30 | 31 | private: 32 | uint32_t m_height = 0; 33 | uint32_t m_width = 0; 34 | }; 35 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/video_frame_formatter/CV210toP210VideoFrameFormatter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include 13 | 14 | 15 | /** 16 | * Video frame formatter which reads V210 and write to P210 17 | * (packed to planar conversion) 18 | */ 19 | class CV210toP210VideoFrameFormatter: 20 | public IVideoFrameFormatter 21 | { 22 | public: 23 | 24 | virtual ~CV210toP210VideoFrameFormatter() {} 25 | 26 | // IVideoFrameFormatter 27 | void OnVideoState(VideoStateComPtr& videoState) override; 28 | bool FormatVideoFrame(const VideoFrame& inFrame, BYTE* outBuffer) override; 29 | LONG GetOutFrameSize() const override; 30 | 31 | private: 32 | uint32_t m_height = 0; 33 | uint32_t m_width = 0; 34 | }; 35 | -------------------------------------------------------------------------------- /src/VideoProcessor-Lib/video_frame_formatter/IVideoFrameFormatter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | #include 13 | #include 14 | 15 | 16 | /** 17 | * Interface for a video frame formatter, this can render from one 18 | * format to another. 19 | */ 20 | class IVideoFrameFormatter 21 | { 22 | public: 23 | 24 | virtual ~IVideoFrameFormatter() {} 25 | 26 | // New video state, must be called before FormatVideoFrame() 27 | virtual void OnVideoState(VideoStateComPtr& videoState) = 0; 28 | 29 | // Handle video frame 30 | // Can only be called after OnVideoState() 31 | // Returns true if something was converted, false if not 32 | virtual bool FormatVideoFrame(const VideoFrame& inFrame, BYTE* outBuffer) = 0; 33 | 34 | // Get size of frame that will be put in FormatVideoFrame()'s outBuffer, in bytes 35 | // Can only be called after OnVideoState() 36 | virtual LONG GetOutFrameSize() const = 0; 37 | }; 38 | -------------------------------------------------------------------------------- /src/VideoProcessor-Test/VideoProcessor-Test.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;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 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | 26 | 27 | Header Files 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/VideoProcessor-Test/VideoProcessor-Test.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /src/VideoProcessor-Test/VideoProcessor-Test.vcxproj.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Resource Files 6 | 7 | 8 | Resource Files 9 | 10 | 11 | 12 | 13 | {94f6e3f6-8990-4cf0-a01b-094935c755c5} 14 | 15 | 16 | {725424ea-6b4c-4692-86e5-00c182b577e2} 17 | 18 | 19 | 20 | 21 | Header Files 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/VideoProcessor-Test/VideoProcessor-Test.vcxproj.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /src/VideoProcessor-Test/pch.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #include "pch.h" 10 | -------------------------------------------------------------------------------- /src/VideoProcessor-Test/pch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(C) 2021 Dennis Fleurbaaij 3 | * 4 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. 5 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 6 | * You should have received a copy of the GNU General Public License along with this program. If not, see < https://www.gnu.org/licenses/>. 7 | */ 8 | 9 | #pragma once 10 | 11 | 12 | // Windows define magic 13 | #define NOMINMAX 14 | #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers 15 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 16 | 17 | #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit 18 | #define _AFX_ALL_WARNINGS // turns off MFC's hiding of some common and often safely ignored warning messages 19 | 20 | 21 | #ifdef _DEBUG 22 | // Visual Leak Detector 23 | // https://stackoverflow.com/questions/58439722/how-to-install-visual-leak-detector-vld-on-visual-studio-2019 24 | #include 25 | #endif 26 | 27 | 28 | // Common includes 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | 39 | // Helper macros for HRESULT functions 40 | #define IF_NOT_S_OK(exp) if((exp) != S_OK) 41 | #define IF_S_OK(exp) if((exp) == S_OK) 42 | -------------------------------------------------------------------------------- /tools/generate_version.ps1: -------------------------------------------------------------------------------- 1 | # From https://blog.didenko.com/2013/11/version-inventory.html 2 | 3 | Param ( 4 | [String]$Project, 5 | [String]$GitRoot, 6 | [String]$HeaderFile="version.h", 7 | [String]$VerPrefix="https://github.com/defl/videoprocessor/commit/" 8 | ) 9 | 10 | Push-Location -LiteralPath $GitRoot 11 | 12 | $VerFileHead = "`#pragma once`n`n`#include `n`n" 13 | $VerFileTail = "`n" 14 | $VerDescribePre = "static const TCHAR* VERSION_DESCRIBE=TEXT(`"" 15 | $VerDescribePost = "`");`n" 16 | 17 | $VerBy = (git log -n 1 --format=format:"static const TCHAR* VERSION_AUTHOR=TEXT(`\`"%an `<%ae`>`\`");%n") | Out-String 18 | $VerUrl = (git log -n 1 --format=format:"static const TCHAR* VERSION_URL=TEXT(`\`"$VerPrefix%H`\`");%n") | Out-String 19 | $VerDate = (git log -n 1 --format=format:"static const TCHAR* VERSION_DATE=TEXT(`\`"%ai`\`");%n") | Out-String 20 | $VerDescribe = (git describe --tags --long).Trim() | Out-String 21 | $VerDescribe = $VerDescribe.TrimEnd() 22 | 23 | $VerChgs = ((git ls-files --exclude-standard -d -m -o -k) | Measure-Object -Line).Lines 24 | 25 | if ($VerChgs -gt 0) { 26 | $VerDirty = "const bool VERSION_DIRTY=true;`n" 27 | } else { 28 | $VerDirty = "const bool VERSION_DIRTY=false;`n" 29 | } 30 | 31 | "Written $Project\" + ( 32 | New-Item -Force -Path "$Project" -Name "$HeaderFile" -ItemType "file" -Value "$VerFileHead$VerUrl$VerDate$VerDescribePre$VerDescribe$VerDescribePost$VerBy$VerDirty$VerFileTail" 33 | ).Name + " as:" 34 | "" 35 | Get-Content "$Project\$HeaderFile" 36 | "" 37 | 38 | Pop-Location 39 | --------------------------------------------------------------------------------