From b03d0a6ccad38210dbfe6bc9aa44265875f33b91 Mon Sep 17 00:00:00 2001 From: ronag Date: Mon, 22 Nov 2010 11:01:29 +0000 Subject: [PATCH] Removed files git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/trunk@253 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d --- casparcg.sln | 27 - server/Application.cpp | 1123 ---- server/Application.h | 170 - server/CLK/CLKCommand.cpp | 94 - server/CLK/CLKCommand.h | 66 - server/CLK/CLKProtocolStrategy.cpp | 144 - server/CLK/CLKProtocolStrategy.h | 64 - server/Channel.cpp | 123 - server/Channel.h | 71 - server/Controller.h | 38 - server/FileInfo.h | 42 - server/Main.cpp | 86 - server/MediaController.h | 41 - server/MediaManager.h | 57 - server/MediaProducer.h | 61 - server/MediaProducerInfo.h | 38 - server/Monitor.cpp | 181 - server/Monitor.h | 85 - server/PlaybackControl.h | 59 - server/Resource.h | 16 - server/Server.vcproj | 3575 ----------- server/Server.vcxproj | 774 --- server/Server.vcxproj.filters | 668 -- server/StdAfx.cpp | 28 - server/StdAfx.h | 79 - server/TransitionInfo.h | 61 - server/VersionNo.h | 29 - server/VideoConsumer.h | 49 - server/Window.cpp | 179 - server/Window.h | 61 - server/amcp/AMCPCommand.h | 112 - server/amcp/AMCPCommandQueue.cpp | 145 - server/amcp/AMCPCommandQueue.h | 62 - server/amcp/AMCPCommandsImpl.cpp | 1214 ---- server/amcp/AMCPCommandsImpl.h | 366 -- server/amcp/AMCPProtocolStrategy.cpp | 431 -- server/amcp/AMCPProtocolStrategy.h | 77 - server/audio/AudioManager.h | 97 - server/audio/DirectSoundManager.cpp | 488 -- server/audio/DirectSoundManager.h | 61 - server/cg/CGControl.h | 47 - server/cg/FlashCGManager.cpp | 184 - server/cg/FlashCGManager.h | 67 - server/cg/FlashCGProxy.cpp | 320 - server/cg/FlashCGProxy.h | 83 - server/cii/CIICommand.h | 41 - server/cii/CIICommandsImpl.cpp | 188 - server/cii/CIICommandsImpl.h | 137 - server/cii/CIIProtocolStrategy.cpp | 296 - server/cii/CIIProtocolStrategy.h | 108 - server/consumers/Audio/AudioConsumer.cpp | 137 - server/consumers/Audio/AudioConsumer.h | 55 - server/consumers/GDI/GDIVideoConsumer.cpp | 152 - server/consumers/GDI/GDIVideoConsumer.h | 56 - server/consumers/OGL/OGLVideoConsumer.cpp | 461 -- server/consumers/OGL/OGLVideoConsumer.h | 69 - .../bluefish/BlueFishVideoConsumer.cpp | 297 - .../bluefish/BlueFishVideoConsumer.h | 99 - server/consumers/bluefish/BluefishException.h | 39 - .../bluefish/BluefishFrameManager.cpp | 180 - .../consumers/bluefish/BluefishFrameManager.h | 164 - server/consumers/bluefish/BluefishMemory.h | 77 - .../bluefish/BluefishPlaybackStrategy.cpp | 207 - .../bluefish/BluefishPlaybackStrategy.h | 43 - server/consumers/bluefish/BluefishUtil.h | 156 - server/consumers/decklink/DeckLinkAPI.idl | 847 --- server/consumers/decklink/DeckLinkAPI_h.h | 5584 ----------------- server/consumers/decklink/DeckLinkAPI_i.c | 190 - .../consumers/decklink/DeckLinkAPI_v7_1.idl | 160 - .../consumers/decklink/DeckLinkAPI_v7_3.idl | 157 - .../decklink/DecklinkVideoConsumer.cpp | 482 -- .../decklink/DecklinkVideoConsumer.h | 58 - server/frame/BitmapFrame.cpp | 81 - server/frame/BitmapFrame.h | 56 - server/frame/BitmapFrameAdapter.cpp | 44 - server/frame/BitmapFrameAdapter.h | 40 - server/frame/BitmapFrameManager.cpp | 127 - server/frame/BitmapFrameManager.h | 52 - server/frame/BitmapFrameManagerAdapter.cpp | 59 - server/frame/BitmapFrameManagerAdapter.h | 47 - server/frame/ClipInfo.h | 81 - server/frame/Frame.cpp | 81 - server/frame/Frame.h | 124 - server/frame/FrameManager.h | 52 - server/frame/FrameMediaController.h | 67 - server/frame/FramePlaybackControl.cpp | 591 -- server/frame/FramePlaybackControl.h | 138 - server/frame/FramePlaybackStrategy.h | 47 - server/frame/SystemFrame.cpp | 52 - server/frame/SystemFrame.h | 49 - server/frame/SystemFrameManager.cpp | 68 - server/frame/SystemFrameManager.h | 66 - server/frame/buffers/FrameBuffer.h | 54 - server/frame/buffers/MotionFrameBuffer.cpp | 167 - server/frame/buffers/MotionFrameBuffer.h | 58 - server/frame/buffers/StaticFrameBuffer.cpp | 69 - server/frame/buffers/StaticFrameBuffer.h | 52 - server/io/AsyncEventServer.cpp | 579 -- server/io/AsyncEventServer.h | 135 - server/io/ClientInfo.h | 51 - server/io/ProtocolStrategy.h | 47 - server/io/SerialPort.cpp | 502 -- server/io/SerialPort.h | 156 - server/io/SocketInfo.cpp | 63 - server/io/SocketInfo.h | 63 - server/producers/color/ColorManager.cpp | 160 - server/producers/color/ColorManager.h | 44 - .../composites/FrameCompositeProducer.cpp | 123 - .../composites/FrameCompositeProducer.h | 73 - .../composites/TransitionProducer.cpp | 532 -- .../producers/composites/TransitionProducer.h | 77 - server/producers/ffmpeg/FFmpegManager.cpp | 92 - .../producers/ffmpeg/audio/audio_decoder.cpp | 83 - server/producers/ffmpeg/audio/audio_decoder.h | 28 - server/producers/ffmpeg/ffmpeg_producer.cpp | 256 - server/producers/ffmpeg/ffmpeg_producer.h | 34 - server/producers/ffmpeg/ffmpegmanager.h | 43 - server/producers/ffmpeg/input.cpp | 242 - server/producers/ffmpeg/input.h | 36 - server/producers/ffmpeg/packet.h | 83 - .../producers/ffmpeg/video/video_decoder.cpp | 20 - server/producers/ffmpeg/video/video_decoder.h | 22 - .../ffmpeg/video/video_transformer.cpp | 96 - .../ffmpeg/video/video_transformer.h | 21 - server/producers/flash/CTManager.cpp | 74 - server/producers/flash/CTManager.h | 40 - server/producers/flash/Flash9e.IDL | 367 -- server/producers/flash/Flash9e_i.c | 103 - server/producers/flash/FlashAxContainer.cpp | 835 --- server/producers/flash/FlashAxContainer.h | 283 - server/producers/flash/FlashCommand.cpp | 87 - server/producers/flash/FlashCommand.h | 91 - server/producers/flash/FlashCommandQueue.cpp | 80 - server/producers/flash/FlashCommandQueue.h | 70 - server/producers/flash/FlashManager.cpp | 76 - server/producers/flash/FlashManager.h | 43 - server/producers/flash/FlashProducer.cpp | 434 -- server/producers/flash/FlashProducer.h | 121 - server/producers/flash/TimerHelper.h | 77 - server/producers/flash/axflash.h | 3156 ---------- server/producers/targa/TargaManager.cpp | 372 -- server/producers/targa/TargaManager.h | 46 - .../targascroll/TargaScrollManager.cpp | 57 - .../targascroll/TargaScrollManager.h | 45 - .../targascroll/TargaScrollProducer.cpp | 293 - .../targascroll/TargaScrollProducer.h | 86 - server/resources/Server.rc | 85 - server/resources/icon2.ico | Bin 3262 -> 0 bytes server/resources/server.rc2 | 25 - server/string_convert.h | 81 - server/utils/Allocator.h | 219 - server/utils/BitmapHolder.cpp | 129 - server/utils/BitmapHolder.h | 61 - server/utils/CPUID.cpp | 158 - server/utils/CPUID.hpp | 110 - server/utils/CommandQueue.h | 152 - server/utils/CritSectLock.h | 48 - server/utils/DCWrapper.cpp | 37 - server/utils/DCWrapper.h | 44 - server/utils/DataBuffer.h | 98 - server/utils/Event.h | 51 - server/utils/FileExists.cpp | 36 - server/utils/FileExists.h | 31 - server/utils/FileInputStream.cpp | 82 - server/utils/FileInputStream.h | 53 - server/utils/FileOutputStream.cpp | 140 - server/utils/FileOutputStream.h | 63 - server/utils/FindWrapper.cpp | 45 - server/utils/FindWrapper.h | 51 - server/utils/ID.cpp | 63 - server/utils/ID.h | 55 - server/utils/InputStream.h | 63 - server/utils/Lockable.h | 74 - server/utils/LogException.cpp | 42 - server/utils/LogException.h | 39 - server/utils/LogLevel.h | 41 - server/utils/LogStream.cpp | 68 - server/utils/LogStream.h | 76 - server/utils/Logger.cpp | 101 - server/utils/Logger.h | 57 - server/utils/Noncopyable.hpp | 40 - server/utils/ObjectPool.h | 87 - server/utils/OutputStream.h | 45 - server/utils/PixmapData.h | 85 - server/utils/Process.cpp | 43 - server/utils/Process.h | 50 - server/utils/Semaphore.cpp | 45 - server/utils/Semaphore.h | 50 - server/utils/TaskQueue.h | 74 - server/utils/Thread.cpp | 123 - server/utils/Thread.h | 71 - server/utils/Types.hpp | 33 - server/utils/UnhandledException.h | 146 - server/utils/Win32Exception.cpp | 64 - server/utils/Win32Exception.h | 77 - server/utils/event.cpp | 53 - server/utils/functiontask.hpp | 77 - server/utils/image/Clear.cpp | 92 - server/utils/image/Clear.hpp | 51 - server/utils/image/Copy.cpp | 97 - server/utils/image/Copy.hpp | 51 - server/utils/image/CopyField.cpp | 105 - server/utils/image/CopyField.hpp | 52 - server/utils/image/Image.cpp | 108 - server/utils/image/Image.hpp | 173 - server/utils/image/Lerp.cpp | 220 - server/utils/image/Lerp.hpp | 45 - server/utils/image/Over.cpp | 246 - server/utils/image/Over.hpp | 45 - server/utils/image/Premultiply.cpp | 255 - server/utils/image/Premultiply.hpp | 52 - server/utils/image/Shuffle.cpp | 210 - server/utils/image/Shuffle.hpp | 45 - server/utils/object_pool.h | 84 - server/utils/runnable.h | 42 - server/utils/scope_exit.h | 41 - 216 files changed, 40757 deletions(-) delete mode 100644 casparcg.sln delete mode 100644 server/Application.cpp delete mode 100644 server/Application.h delete mode 100644 server/CLK/CLKCommand.cpp delete mode 100644 server/CLK/CLKCommand.h delete mode 100644 server/CLK/CLKProtocolStrategy.cpp delete mode 100644 server/CLK/CLKProtocolStrategy.h delete mode 100644 server/Channel.cpp delete mode 100644 server/Channel.h delete mode 100644 server/Controller.h delete mode 100644 server/FileInfo.h delete mode 100644 server/Main.cpp delete mode 100644 server/MediaController.h delete mode 100644 server/MediaManager.h delete mode 100644 server/MediaProducer.h delete mode 100644 server/MediaProducerInfo.h delete mode 100644 server/Monitor.cpp delete mode 100644 server/Monitor.h delete mode 100644 server/PlaybackControl.h delete mode 100644 server/Resource.h delete mode 100644 server/Server.vcproj delete mode 100644 server/Server.vcxproj delete mode 100644 server/Server.vcxproj.filters delete mode 100644 server/StdAfx.cpp delete mode 100644 server/StdAfx.h delete mode 100644 server/TransitionInfo.h delete mode 100644 server/VersionNo.h delete mode 100644 server/VideoConsumer.h delete mode 100644 server/Window.cpp delete mode 100644 server/Window.h delete mode 100644 server/amcp/AMCPCommand.h delete mode 100644 server/amcp/AMCPCommandQueue.cpp delete mode 100644 server/amcp/AMCPCommandQueue.h delete mode 100644 server/amcp/AMCPCommandsImpl.cpp delete mode 100644 server/amcp/AMCPCommandsImpl.h delete mode 100644 server/amcp/AMCPProtocolStrategy.cpp delete mode 100644 server/amcp/AMCPProtocolStrategy.h delete mode 100644 server/audio/AudioManager.h delete mode 100644 server/audio/DirectSoundManager.cpp delete mode 100644 server/audio/DirectSoundManager.h delete mode 100644 server/cg/CGControl.h delete mode 100644 server/cg/FlashCGManager.cpp delete mode 100644 server/cg/FlashCGManager.h delete mode 100644 server/cg/FlashCGProxy.cpp delete mode 100644 server/cg/FlashCGProxy.h delete mode 100644 server/cii/CIICommand.h delete mode 100644 server/cii/CIICommandsImpl.cpp delete mode 100644 server/cii/CIICommandsImpl.h delete mode 100644 server/cii/CIIProtocolStrategy.cpp delete mode 100644 server/cii/CIIProtocolStrategy.h delete mode 100644 server/consumers/Audio/AudioConsumer.cpp delete mode 100644 server/consumers/Audio/AudioConsumer.h delete mode 100644 server/consumers/GDI/GDIVideoConsumer.cpp delete mode 100644 server/consumers/GDI/GDIVideoConsumer.h delete mode 100644 server/consumers/OGL/OGLVideoConsumer.cpp delete mode 100644 server/consumers/OGL/OGLVideoConsumer.h delete mode 100644 server/consumers/bluefish/BlueFishVideoConsumer.cpp delete mode 100644 server/consumers/bluefish/BlueFishVideoConsumer.h delete mode 100644 server/consumers/bluefish/BluefishException.h delete mode 100644 server/consumers/bluefish/BluefishFrameManager.cpp delete mode 100644 server/consumers/bluefish/BluefishFrameManager.h delete mode 100644 server/consumers/bluefish/BluefishMemory.h delete mode 100644 server/consumers/bluefish/BluefishPlaybackStrategy.cpp delete mode 100644 server/consumers/bluefish/BluefishPlaybackStrategy.h delete mode 100644 server/consumers/bluefish/BluefishUtil.h delete mode 100644 server/consumers/decklink/DeckLinkAPI.idl delete mode 100644 server/consumers/decklink/DeckLinkAPI_h.h delete mode 100644 server/consumers/decklink/DeckLinkAPI_i.c delete mode 100644 server/consumers/decklink/DeckLinkAPI_v7_1.idl delete mode 100644 server/consumers/decklink/DeckLinkAPI_v7_3.idl delete mode 100644 server/consumers/decklink/DecklinkVideoConsumer.cpp delete mode 100644 server/consumers/decklink/DecklinkVideoConsumer.h delete mode 100644 server/frame/BitmapFrame.cpp delete mode 100644 server/frame/BitmapFrame.h delete mode 100644 server/frame/BitmapFrameAdapter.cpp delete mode 100644 server/frame/BitmapFrameAdapter.h delete mode 100644 server/frame/BitmapFrameManager.cpp delete mode 100644 server/frame/BitmapFrameManager.h delete mode 100644 server/frame/BitmapFrameManagerAdapter.cpp delete mode 100644 server/frame/BitmapFrameManagerAdapter.h delete mode 100644 server/frame/ClipInfo.h delete mode 100644 server/frame/Frame.cpp delete mode 100644 server/frame/Frame.h delete mode 100644 server/frame/FrameManager.h delete mode 100644 server/frame/FrameMediaController.h delete mode 100644 server/frame/FramePlaybackControl.cpp delete mode 100644 server/frame/FramePlaybackControl.h delete mode 100644 server/frame/FramePlaybackStrategy.h delete mode 100644 server/frame/SystemFrame.cpp delete mode 100644 server/frame/SystemFrame.h delete mode 100644 server/frame/SystemFrameManager.cpp delete mode 100644 server/frame/SystemFrameManager.h delete mode 100644 server/frame/buffers/FrameBuffer.h delete mode 100644 server/frame/buffers/MotionFrameBuffer.cpp delete mode 100644 server/frame/buffers/MotionFrameBuffer.h delete mode 100644 server/frame/buffers/StaticFrameBuffer.cpp delete mode 100644 server/frame/buffers/StaticFrameBuffer.h delete mode 100644 server/io/AsyncEventServer.cpp delete mode 100644 server/io/AsyncEventServer.h delete mode 100644 server/io/ClientInfo.h delete mode 100644 server/io/ProtocolStrategy.h delete mode 100644 server/io/SerialPort.cpp delete mode 100644 server/io/SerialPort.h delete mode 100644 server/io/SocketInfo.cpp delete mode 100644 server/io/SocketInfo.h delete mode 100644 server/producers/color/ColorManager.cpp delete mode 100644 server/producers/color/ColorManager.h delete mode 100644 server/producers/composites/FrameCompositeProducer.cpp delete mode 100644 server/producers/composites/FrameCompositeProducer.h delete mode 100644 server/producers/composites/TransitionProducer.cpp delete mode 100644 server/producers/composites/TransitionProducer.h delete mode 100644 server/producers/ffmpeg/FFmpegManager.cpp delete mode 100644 server/producers/ffmpeg/audio/audio_decoder.cpp delete mode 100644 server/producers/ffmpeg/audio/audio_decoder.h delete mode 100644 server/producers/ffmpeg/ffmpeg_producer.cpp delete mode 100644 server/producers/ffmpeg/ffmpeg_producer.h delete mode 100644 server/producers/ffmpeg/ffmpegmanager.h delete mode 100644 server/producers/ffmpeg/input.cpp delete mode 100644 server/producers/ffmpeg/input.h delete mode 100644 server/producers/ffmpeg/packet.h delete mode 100644 server/producers/ffmpeg/video/video_decoder.cpp delete mode 100644 server/producers/ffmpeg/video/video_decoder.h delete mode 100644 server/producers/ffmpeg/video/video_transformer.cpp delete mode 100644 server/producers/ffmpeg/video/video_transformer.h delete mode 100644 server/producers/flash/CTManager.cpp delete mode 100644 server/producers/flash/CTManager.h delete mode 100644 server/producers/flash/Flash9e.IDL delete mode 100644 server/producers/flash/Flash9e_i.c delete mode 100644 server/producers/flash/FlashAxContainer.cpp delete mode 100644 server/producers/flash/FlashAxContainer.h delete mode 100644 server/producers/flash/FlashCommand.cpp delete mode 100644 server/producers/flash/FlashCommand.h delete mode 100644 server/producers/flash/FlashCommandQueue.cpp delete mode 100644 server/producers/flash/FlashCommandQueue.h delete mode 100644 server/producers/flash/FlashManager.cpp delete mode 100644 server/producers/flash/FlashManager.h delete mode 100644 server/producers/flash/FlashProducer.cpp delete mode 100644 server/producers/flash/FlashProducer.h delete mode 100644 server/producers/flash/TimerHelper.h delete mode 100644 server/producers/flash/axflash.h delete mode 100644 server/producers/targa/TargaManager.cpp delete mode 100644 server/producers/targa/TargaManager.h delete mode 100644 server/producers/targascroll/TargaScrollManager.cpp delete mode 100644 server/producers/targascroll/TargaScrollManager.h delete mode 100644 server/producers/targascroll/TargaScrollProducer.cpp delete mode 100644 server/producers/targascroll/TargaScrollProducer.h delete mode 100644 server/resources/Server.rc delete mode 100644 server/resources/icon2.ico delete mode 100644 server/resources/server.rc2 delete mode 100644 server/string_convert.h delete mode 100644 server/utils/Allocator.h delete mode 100644 server/utils/BitmapHolder.cpp delete mode 100644 server/utils/BitmapHolder.h delete mode 100644 server/utils/CPUID.cpp delete mode 100644 server/utils/CPUID.hpp delete mode 100644 server/utils/CommandQueue.h delete mode 100644 server/utils/CritSectLock.h delete mode 100644 server/utils/DCWrapper.cpp delete mode 100644 server/utils/DCWrapper.h delete mode 100644 server/utils/DataBuffer.h delete mode 100644 server/utils/Event.h delete mode 100644 server/utils/FileExists.cpp delete mode 100644 server/utils/FileExists.h delete mode 100644 server/utils/FileInputStream.cpp delete mode 100644 server/utils/FileInputStream.h delete mode 100644 server/utils/FileOutputStream.cpp delete mode 100644 server/utils/FileOutputStream.h delete mode 100644 server/utils/FindWrapper.cpp delete mode 100644 server/utils/FindWrapper.h delete mode 100644 server/utils/ID.cpp delete mode 100644 server/utils/ID.h delete mode 100644 server/utils/InputStream.h delete mode 100644 server/utils/Lockable.h delete mode 100644 server/utils/LogException.cpp delete mode 100644 server/utils/LogException.h delete mode 100644 server/utils/LogLevel.h delete mode 100644 server/utils/LogStream.cpp delete mode 100644 server/utils/LogStream.h delete mode 100644 server/utils/Logger.cpp delete mode 100644 server/utils/Logger.h delete mode 100644 server/utils/Noncopyable.hpp delete mode 100644 server/utils/ObjectPool.h delete mode 100644 server/utils/OutputStream.h delete mode 100644 server/utils/PixmapData.h delete mode 100644 server/utils/Process.cpp delete mode 100644 server/utils/Process.h delete mode 100644 server/utils/Semaphore.cpp delete mode 100644 server/utils/Semaphore.h delete mode 100644 server/utils/TaskQueue.h delete mode 100644 server/utils/Thread.cpp delete mode 100644 server/utils/Thread.h delete mode 100644 server/utils/Types.hpp delete mode 100644 server/utils/UnhandledException.h delete mode 100644 server/utils/Win32Exception.cpp delete mode 100644 server/utils/Win32Exception.h delete mode 100644 server/utils/event.cpp delete mode 100644 server/utils/functiontask.hpp delete mode 100644 server/utils/image/Clear.cpp delete mode 100644 server/utils/image/Clear.hpp delete mode 100644 server/utils/image/Copy.cpp delete mode 100644 server/utils/image/Copy.hpp delete mode 100644 server/utils/image/CopyField.cpp delete mode 100644 server/utils/image/CopyField.hpp delete mode 100644 server/utils/image/Image.cpp delete mode 100644 server/utils/image/Image.hpp delete mode 100644 server/utils/image/Lerp.cpp delete mode 100644 server/utils/image/Lerp.hpp delete mode 100644 server/utils/image/Over.cpp delete mode 100644 server/utils/image/Over.hpp delete mode 100644 server/utils/image/Premultiply.cpp delete mode 100644 server/utils/image/Premultiply.hpp delete mode 100644 server/utils/image/Shuffle.cpp delete mode 100644 server/utils/image/Shuffle.hpp delete mode 100644 server/utils/object_pool.h delete mode 100644 server/utils/runnable.h delete mode 100644 server/utils/scope_exit.h diff --git a/casparcg.sln b/casparcg.sln deleted file mode 100644 index 9267fc4e0..000000000 --- a/casparcg.sln +++ /dev/null @@ -1,27 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Server", "server\Server.vcxproj", "{79388C20-6499-4BF6-B8B9-D8C33D7D4DDD}" -EndProject -Global - GlobalSection(SubversionScc) = preSolution - Svn-Managed = True - Manager = AnkhSVN - Subversion Support for Visual Studio - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - no bluefish|Win32 = no bluefish|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {79388C20-6499-4BF6-B8B9-D8C33D7D4DDD}.Debug|Win32.ActiveCfg = Debug|Win32 - {79388C20-6499-4BF6-B8B9-D8C33D7D4DDD}.Debug|Win32.Build.0 = Debug|Win32 - {79388C20-6499-4BF6-B8B9-D8C33D7D4DDD}.no bluefish|Win32.ActiveCfg = no bluefish|Win32 - {79388C20-6499-4BF6-B8B9-D8C33D7D4DDD}.no bluefish|Win32.Build.0 = no bluefish|Win32 - {79388C20-6499-4BF6-B8B9-D8C33D7D4DDD}.Release|Win32.ActiveCfg = Release|Win32 - {79388C20-6499-4BF6-B8B9-D8C33D7D4DDD}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/server/Application.cpp b/server/Application.cpp deleted file mode 100644 index 603834ac5..000000000 --- a/server/Application.cpp +++ /dev/null @@ -1,1123 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "stdafx.h" - -#ifdef _DEBUG - #define _CRTDBG_MAP_ALLOC - #include - #include -#endif - -#include "Application.h" - -#include -#include -#include -#include -#include - -#include "Window.h" -#include "Channel.h" - -#include "amcp\AMCPProtocolStrategy.h" -#include "cii\CIIProtocolStrategy.h" -#include "CLK\CLKProtocolStrategy.h" -#include "io\AsyncEventServer.h" -#include "io\SerialPort.h" - -#include "cg\flashcgproxy.h" - -#include "utils\FindWrapper.h" -#include "utils\FileExists.h" -#include "utils\FileOutputStream.h" -#include "utils\Thread.h" - -#include "FileInfo.h" -#include "consumers\decklink\DecklinkVideoConsumer.h" -#include "consumers\OGL\OGLVideoConsumer.h" -#include "consumers\GDI\GDIVideoConsumer.h" -#include "consumers\audio\AudioConsumer.h" - -#ifndef DISABLE_BLUEFISH -#include "consumers\bluefish\BlueFishVideoConsumer.h" -#endif - -#include "audio\DirectSoundManager.h" - -#include "producers\flash\FlashManager.h" -#include "producers\flash\CTManager.h" -#include "producers\flash\FlashAxContainer.h" -#include "producers\targa\TargaManager.h" -#include "producers\targascroll\TargaScrollManager.h" -#include "producers\ffmpeg\FFmpegManager.h" -#include "producers\color\ColorManager.h" - -WTL::CAppModule _Module; - -void WINAPI SvcMain(DWORD argsCount, LPTSTR* ppArgs) { - //caspar::GetApplication()->ServiceMain(); -} -void WINAPI SvcCtrlHandler(DWORD dwCtrl) { - //caspar::GetApplication()->ServiceCtrlHandler(dwCtrl); -} - - -LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { - return caspar::GetApplication()->WndProc(hWnd, message, wParam, lParam); -} - -namespace caspar { - -using namespace utils; - -enum ControllerTransports { TCP, Serial, TransportsCount }; -enum ControllerProtocols { AMCP, CII, CLOCK, ProtocolsCount }; - -const TCHAR* Application::versionString_(TEXT("CG 1.8.1.2")); -const TCHAR* Application::serviceName_(TEXT("Caspar service")); - -Application::Application(const tstring& cmdline, HINSTANCE hInstance) : hInstance_(hInstance), logLevel_(2), logDir_(TEXT("log")), - videoDir_(TEXT("media")), - templateDir_(TEXT("templates")), - dataDir_(TEXT("data")), - colorManagerIndex_(-1), - pAudioManager_(0), - terminateEvent_(FALSE, FALSE), - commandline_(cmdline) - //svcStatusHandle_(0) -{ -#ifdef _DEBUG - _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_ALWAYS_DF ); - _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_DEBUG ); - _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_DEBUG ); - _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_DEBUG ); - -// _CrtSetBreakAlloc(1393); - Thread::EnableWin32ExceptionHandler(false); -#else - Thread::EnableWin32ExceptionHandler(true); -#endif - - HRESULT hResult = ::OleInitialize(NULL); - _Module.Init(NULL, hInstance, &LIBID_ATLLib); -} - -Application::~Application() -{ - Destroy(); - - _Module.Term(); - ::OleUninitialize(); -} - -////////////////////// -// Run as service -void Application::RunAsService() { - SERVICE_TABLE_ENTRY dispatchTable[] = - { - { TEXT(""), (LPSERVICE_MAIN_FUNCTION) SvcMain }, - { NULL, NULL } - }; - - // This call returns when the service has stopped. - // The process should simply terminate when the call returns. -// if(!StartServiceCtrlDispatcher(dispatchTable)) { - //SvcReportEvent(TEXT("StartServiceCtrlDispatcher")); -// } -} - -//void Application::ServiceMain() { -// // Register the handler function for the service -// svcStatusHandle_ = RegisterServiceCtrlHandler(serviceName_, SvcCtrlHandler); -// if(!svcStatusHandle_) { -// //SvcReportEvent(TEXT("RegisterServiceCtrlHandler")); -// return; -// } -// -// //These SERVICE_STATUS members remain as set here -// serviceStatus_.dwServiceType = SERVICE_WIN32_OWN_PROCESS; -// serviceStatus_.dwServiceSpecificExitCode = 0; -// -// // Report initial status to the SCM -// ServiceReportStatus(SERVICE_START_PENDING, NO_ERROR, 3000); -// -// if(Initialize()) { -// ReportSvcStatus(SERVICE_RUNNING, NO_ERROR, 0); -// -// MSG msg; -// bool bQuit = false; -// int errorCode = 0; -// -// while(!bQuit) { -// const HANDLE waitEvents[] = {stopEvent_, terminateEvent_ }; -// HRESULT waitResult = MsgWaitForMultipleObjects(1, &waitEvents, FALSE, 2500, QS_ALLEVENTS); -// switch(waitResult) -// { -// case WAIT_OBJECT_0: -// bQuit = true; -// errorCode = NO_ERROR; -// break; -// -// case WAIT_OBJECT_0 + 1: -// bQuit = true; -// errorCode = 42; -// break; -// -// case WAIT_OBJECT_0+2: -// if(GetMessage(&msg, NULL, 0, 0)) -// { -// TranslateMessage(&msg); -// DispatchMessage(&msg); -// } -// else { -// bQuit = true; -// errorCode = msg.wParam; -// } -// break; -// -// case WAIT_TIMEOUT: -// break; -// -// case WAIT_FAILED: -// LOG << LogLevel::Critical << "Wait failed in main thread. Exiting"; -// default: -// bQuit = true; -// errorCode = 42; -// break; -// } -// } -// -// Destroy(); -// ServiceReportStatus(SERVICE_STOPPED, errorCode, 0); -// } -// else { -// ServiceReportStatus(SERVICE_STOPPED, NO_ERROR, 0); -// } -//} -// -//void Application::ServiceCtrlHandler(DWORD dwCtrl) { -// switch(dwCtrl) { -// case SERVICE_CONTROL_STOP: -// ServiceReportStatus(SERVICE_STOP_PENDING, NO_ERROR, 0); -// this->GetShutdownEvent().Set(); -// return; -// -// case SERVICE_CONTROL_INTERROGATE: -// break; -// default: -// break; -// } -// ServiceReportStatus(serviceStatus_.dwCurrentState, NO_ERROR, 0); -//} -//void Application::ServiceReportStatus(DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint) { -// static DWORD dwCheckPoint = 1; -// -// // Fill in the SERVICE_STATUS structure. -// serviceStatus_.dwCurrentState = dwCurrentState; -// serviceStatus_.dwWin32ExitCode = dwWin32ExitCode; -// serviceStatus_.dwWaitHint = dwWaitHint; -// -// if (dwCurrentState == SERVICE_START_PENDING) -// serviceStatus_.dwControlsAccepted = 0; -// else serviceStatus_.dwControlsAccepted = SERVICE_ACCEPT_STOP; -// -// if ( (dwCurrentState == SERVICE_RUNNING) || -// (dwCurrentState == SERVICE_STOPPED) ) -// serviceStatus_.dwCheckPoint = 0; -// else serviceStatus_.dwCheckPoint = dwCheckPoint++; -// -// // Report the status of the service to the SCM. -// SetServiceStatus(svcStatusHandle_, &serviceStatus_); -//} - -/////////////////// -// Run as window -int Application::RunAsWindow() { - if(Initialize() && pWindow_ != 0) { - MSG msg; - - while (GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - return (int)msg.wParam; - - // bool bQuit = false; - - // while(!bQuit) { - // const HANDLE terminateEvent = terminateEvent_; - // HRESULT waitResult = MsgWaitForMultipleObjects(1, &terminateEvent, FALSE, 2500, QS_ALLEVENTS); - // switch(waitResult) - // { - // case WAIT_OBJECT_0: - // return 42; - - // case WAIT_OBJECT_0+1: - // if(GetMessage(&msg, NULL, 0, 0)) - // { - // TranslateMessage(&msg); - // DispatchMessage(&msg); - // } - // else - // return msg.wParam; - - // case WAIT_TIMEOUT: - // break; - - // case WAIT_FAILED: - // LOG << LogLevel::Critical << "Wait failed in main thread. Exiting"; - // default: - // return 99; - // } - // } - // return 0; - } - return -1; -} - -LRESULT Application::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - PAINTSTRUCT ps; - TCHAR timeString[256]; - static int oldyday = 0; - static UINT_PTR timerID = 0; - - switch (message) - { - case WM_PAINT: - BeginPaint(hWnd, &ps); - EndPaint(hWnd, &ps); - break; - - case WM_CREATE: - { - timerID = SetTimer(hWnd,1,1000,NULL); - InvalidateRect(hWnd,NULL,true); - - __time64_t timevalue = _time64(NULL); - tm timeStruct; - _localtime64_s(&timeStruct, &timevalue); - - oldyday = timeStruct.tm_yday; - - TCHAR logFile[512]; - _stprintf_s<>(logFile, TEXT("%slog %04d-%02d-%02d.log"), logDir_.c_str(), timeStruct.tm_year + 1900, timeStruct.tm_mon + 1, timeStruct.tm_mday); - Logger::GetInstance().SetOutputStream(OutputStreamPtr(new FileOutputStream(logFile, true))); - } - break; - - case WM_TIMER: - if(wParam == timerID) - { - __time64_t timevalue = _time64(NULL); - tm timeStruct; - _localtime64_s(&timeStruct, &timevalue); - - if(timeStruct.tm_yday != oldyday) - { - LOG << "new day"; - - TCHAR logFile[512]; - - oldyday = timeStruct.tm_yday; - _stprintf_s<>(logFile, TEXT("%slog %04d-%02d-%02d.log"), logDir_.c_str(), timeStruct.tm_year + 1900, timeStruct.tm_mon + 1, timeStruct.tm_mday); - Logger::GetInstance().SetOutputStream(OutputStreamPtr(new FileOutputStream(logFile, true))); - } - -#ifdef DISABLE_BLUEFISH - const TCHAR* strCompability = TEXT(" (No bluefish)"); -#else - const TCHAR* strCompability = TEXT(""); -#endif - _stprintf_s<>(timeString, TEXT("Caspar %s%s - %02d:%02d:%02d"), GetVersionString(), strCompability, timeStruct.tm_hour, timeStruct.tm_min, timeStruct.tm_sec); - SetWindowText(pWindow_->getHwnd(), timeString); - } - break; - - case WM_ENDSESSION: - if(wParam == TRUE) { - LOG << TEXT("APPLICATION: User shutdown or rebooting system.\r\n\r\n"); - if(timerID != 0) - KillTimer(hWnd, timerID); - - Destroy(); - } - else { - LOG << TEXT("APPLICATION: Received ENDSESSION notification."); - } - break; - - case WM_SETFOCUS: - break; - - case WM_CHAR: - break; - - case WM_SIZE: - break; - - case WM_DESTROY: - if(timerID != 0) - KillTimer(hWnd, timerID); - - PostQuitMessage(0); - break; - default: - return DefWindowProc(hWnd, message, wParam, lParam); - } - return 0; -} - -///////////////////////////// -// Application::Initialize -// PARAMS: hinstance(processens instans. Forwardad från WinMain) -// RETURNS: true if every component was successfully initialized. -// COMMENT: Initializes all the components -///////////////////////////// -bool Application::Initialize() -{ -#ifdef _DEBUG - MessageBox(NULL, TEXT("Now is the time to connect for remote debugging..."), TEXT("Debug"), MB_OK | MB_TOPMOST); -#endif - - try - { - _configthreadlocale(_DISABLE_PER_THREAD_LOCALE); - std::locale::global(std::locale("")); - - //Hämtar inställningar - LoadSettings10(); - LoadSettings15(); - LoadSettings17(); - ParseCommandline(); - - if(!CheckDirectories()) - return false; - - - Logger::GetInstance().SetLevel(static_cast(logLevel_ + 1)); - - pWindow_ = WindowPtr(new Window()); - pWindow_->Initialize(hInstance_, TEXT("Caspar"), TEXT("SVT_CASPAR")); - - if(caspar::flash::FlashAxContainer::CheckForFlashSupport()) - caspar::CG::FlashCGProxy::SetCGVersion(); - else { - LOG << LogLevel::Critical << TEXT("No flashplayer activex-control installed. Flash support will be disabled"); - } - - caspar::directsound::DirectSoundManager::GetInstance()->Initialize(pWindow_->getHwnd(), 2, 48000, 16); - pAudioManager_ = caspar::directsound::DirectSoundManager::GetInstance(); - - sourceMediaManagers_.push_back(MediaManagerPtr(new FlashManager())); - sourceMediaManagers_.push_back(MediaManagerPtr(new CTManager())); - sourceMediaManagers_.push_back(MediaManagerPtr(new TargaManager())); - sourceMediaManagers_.push_back(MediaManagerPtr(new TargaScrollMediaManager())); - sourceMediaManagers_.push_back(MediaManagerPtr(new ffmpeg::FFMPEGManager())); - sourceMediaManagers_.push_back(MediaManagerPtr(new ColorManager())); - - colorManagerIndex_ = static_cast(sourceMediaManagers_.size()-1); - - //////////////////////////// - // SETUP VideoOut Channels - int videoChannelIndex = 1; -#ifndef DISABLE_BLUEFISH - int videoDeviceCount = caspar::bluefish::BlueFishVideoConsumer::EnumerateDevices(); - LOG << TEXT("BLUEFISH: Found ") << videoDeviceCount << TEXT(" video cards."); - - for(int bluefishIndex = 1; bluefishIndex<=videoDeviceCount; ++bluefishIndex, ++videoChannelIndex) { - CreateVideoChannel(videoChannelIndex, caspar::bluefish::BlueFishVideoConsumer::Create(bluefishIndex)); - } -#endif - - //Decklink - if(GetSetting(TEXT("nodecklink")) != TEXT("true")) { - VideoConsumerPtr pDecklinkConsumer(caspar::decklink::DecklinkVideoConsumer::Create()); - if(pDecklinkConsumer) - CreateVideoChannel(videoChannelIndex++, pDecklinkConsumer); - } - - if(GetSetting(TEXT("gdichannel")) == TEXT("true") && pWindow_ != 0) { - CreateVideoChannel(videoChannelIndex++, VideoConsumerPtr(new gdi::GDIVideoConsumer(pWindow_->getHwnd(), FrameFormatDescription::FormatDescriptions[FFormat576p2500]))); - } - else if(GetSetting(TEXT("oglchannel")) == TEXT("true") && pWindow_ != 0) - { - ogl::Stretch stretch = ogl::Fill; - tstring stretchStr = GetSetting(TEXT("stretch")); - if(stretchStr == TEXT("none")) - stretch = ogl::None; - else if(stretchStr == TEXT("uniform")) - stretch = ogl::Uniform; - else if(stretchStr == TEXT("uniformtofill")) - stretch = ogl::UniformToFill; - - tstring screenStr = GetSetting(TEXT("displaydevice")).c_str(); - int screen = 0; - if(screenStr != TEXT("")) - screen = _wtoi(screenStr.c_str()); - - tstring strVideoMode = GetSetting(TEXT("oglvideomode")); - if(strVideoMode == TEXT("")) - strVideoMode = GetSetting(TEXT("videomode")); - - FrameFormat casparVideoFormat = FFormat576p2500; - if(strVideoMode != TEXT("")) - casparVideoFormat = caspar::GetVideoFormat(strVideoMode); - - CreateVideoChannel(videoChannelIndex++, VideoConsumerPtr(new ogl::OGLVideoConsumer(pWindow_->getHwnd(), FrameFormatDescription::FormatDescriptions[casparVideoFormat], screen, stretch))); - } - - CreateVideoChannel(videoChannelIndex++, VideoConsumerPtr(new audio::AudioConsumer(FrameFormatDescription::FormatDescriptions[FFormat576p2500]))); - CreateVideoChannel(videoChannelIndex++, VideoConsumerPtr(new audio::AudioConsumer(FrameFormatDescription::FormatDescriptions[FFormat576p2500]))); - - if(videoChannels_.size() < 1) - { - LOG << TEXT("No channels found, quitting"); - return false; - } - - ////////////////////// - // Setup controllers - SetupControllers(); - - /////////////////////////// - // Initiate videochannels - for(unsigned int i=0;iClear(); - } - } - } - catch(const std::exception& ex) { - LOG << LogLevel::Critical << TEXT("Initialization exception: ") << ex.what(); - MessageBoxA(NULL, ex.what(), "Error", MB_OK | MB_TOPMOST); - return false; - } - - LOG << TEXT("Successful initialization."); - return true; -} - -///////////////////////////////////////// -// Application::Destroy -// COMMENT: shuts down all the components in the correct order -void Application::Destroy() { - //First kill all possibilities for new commands to arrive... - controllers_.clear(); - - //...Then shutdown all channels, stopping playback etc... - videoChannels_.clear(); - - //...finally delete all mediamanagers - sourceMediaManagers_.clear(); - - LOG << TEXT("Shutdown complete.\r\n\r\n"); -} - -///////////////////////////////////// -// Application::CreateVideoChannel -// PARAMS: index(each channel has to have a unique index), videoConsumer(the consumer) -// COMMENT: Creates a channel and connects a consumer to it -void Application::CreateVideoChannel(int index, VideoConsumerPtr pVideoConsumer) { - if(pVideoConsumer != 0) { - ChannelPtr pChannel(new Channel(index, pVideoConsumer)); - if(pChannel != 0 && pChannel->Initialize()) { - videoChannels_.push_back(pChannel); - } - else { - LOG << TEXT("Failed to create channel ") << index; - } - } - else { - LOG << TEXT("Failed to create consumer for channel ") << index << TEXT(". Removing channel completely."); - } -} - -////////////////////////////////// -// Application::GetChannel -// PARAM: deviceIndex(the index of the requested channel) -// RETURNS: a (smart)pointer to the requested channel. -ChannelPtr Application::GetChannel(unsigned int deviceIndex) { - ChannelPtr result; - if(deviceIndex < videoChannels_.size()) - result = videoChannels_[deviceIndex]; - - return result; -} - -///////////////////////////// -// Application::FindFile -// PARAM: filename(fileame without the ending), pFileInfo(pointer to a structure that should be populated with info about the file) -// RETURNS: (smart)pointer to the MediaManager that handles the specified file -// COMMENT: Checks if the file exists and if it can be opened by any of the active mediamanagers. -MediaManagerPtr Application::FindMediaFile(const tstring& filename, FileInfo* pFileInfo) -{ - for(unsigned int index=0;index* pExtensions; - int extensionCount = sourceMediaManagers_[index]->GetSupportedExtensions(pExtensions); - for(int extensionIndex=0; extensionIndex 0) { - fullFilename += TEXT('.'); - fullFilename += (*pExtensions)[extensionIndex]; - } - - WIN32_FIND_DATA findInfo; - FindWrapper findWrapper(fullFilename, &findInfo); - if(findWrapper.Success()) { - if(pFileInfo != 0) { - pFileInfo->filename = filename; - pFileInfo->filetype = (*pExtensions)[extensionIndex]; - - unsigned __int64 fileSize = findInfo.nFileSizeHigh; - fileSize *= 0x100000000; - fileSize += findInfo.nFileSizeLow; - - pFileInfo->size = fileSize; - } - - return sourceMediaManagers_[index]; - } - } - } - - return MediaManagerPtr(); -} - -bool Application::FindTemplate(const tstring& templateName, tstring* pExtension) { - bool bResult = exists(templateName + TEXT(".ft")); - if(bResult) { - if(pExtension != NULL) - *pExtension = TEXT(".ft"); - } - else { - bResult = exists(templateName + TEXT(".ct")); - if(bResult && pExtension != NULL) - *pExtension = TEXT(".ct"); - } - return bResult; -} - -void Application::SetupControllers() -{ - HKEY hKey = 0; - HKEY hSubkey = 0; - try { - if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Sveriges Television AB\\Caspar CG\\Controllers"), 0,KEY_READ, &hKey) == ERROR_SUCCESS) - { - DWORD keyCount = 0; - if(RegQueryInfoKey(hKey, NULL, NULL, NULL, &keyCount, NULL, NULL, NULL, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { - tstring subkeyName = TEXT("0"); - for(DWORD keyIndex = 0; keyIndex < min(keyCount, 10); ++keyIndex) { - subkeyName[0] = TEXT('0')+static_cast(keyIndex); - - if(RegOpenKeyEx(hKey, subkeyName.c_str(), 0, KEY_READ, &hSubkey) == ERROR_SUCCESS) { - DWORD protocolIndex = 0, transportIndex = 0; - DWORD size = 0; - LONG returnValue = 0; - - size = sizeof(DWORD); - returnValue = RegQueryValueEx(hSubkey, TEXT("transport"), 0, 0, (BYTE*)&transportIndex, &size); - if(returnValue != ERROR_SUCCESS || transportIndex >= TransportsCount) - continue; - - size = sizeof(DWORD); - returnValue = RegQueryValueEx(hSubkey, TEXT("protocol"), 0, 0, (BYTE*)&protocolIndex, &size); - if(returnValue != ERROR_SUCCESS || protocolIndex >= ProtocolsCount) - continue; - - //Setup controller - ControllerPtr pController; - switch(transportIndex) { - case TCP: - pController = CreateTCPController(hSubkey); - break; - case Serial: - pController = CreateSerialController(hSubkey); - break; - } - - if(pController != 0) { - //there is a Controller, create ProtocolStrategy - caspar::IO::ProtocolStrategyPtr pProtocol; - switch(protocolIndex) { - case AMCP: - pProtocol = caspar::IO::ProtocolStrategyPtr(new caspar::amcp::AMCPProtocolStrategy()); - break; - case CII: - pProtocol = caspar::IO::ProtocolStrategyPtr(new caspar::cii::CIIProtocolStrategy()); - break; - case CLOCK: - pProtocol = caspar::IO::ProtocolStrategyPtr(new caspar::CLK::CLKProtocolStrategy()); - break; - } - - if(pProtocol != 0) { - //Both Controller and ProtocolStrategy created. Initialize! - pController->SetProtocolStrategy(pProtocol); - if(pController->Start()) - controllers_.push_back(pController); - else { - LOG << TEXT("Failed to start controller."); - } - } - else { - LOG << TEXT("failed to create protocol."); - } - } - else { - LOG << TEXT("Failed to create controller."); - } - - RegCloseKey(hSubkey); - hSubkey = 0; - } - else { - LOG << TEXT("Failed to read controller-settings."); - } - } - } - RegCloseKey(hKey); - } - else { - LOG << TEXT("Failed to read controller-settings."); - } - } - catch(std::exception&) { - if(hSubkey != 0) - RegCloseKey(hSubkey); - - if(hKey != 0) - RegCloseKey(hKey); - } -} - -ControllerPtr Application::CreateTCPController(HKEY hSubkey) { - DWORD port = 5250; - - //read port setting - DWORD size = sizeof(DWORD); - RegQueryValueEx(hSubkey, TEXT("TCPPort"), 0, 0, (BYTE*)&port, &size); - - ControllerPtr pAsyncEventServer(new caspar::IO::AsyncEventServer(port)); - dynamic_cast(pAsyncEventServer.get())->SetClientDisconnectHandler(std::tr1::bind(&Application::OnClientDisconnected, this, std::tr1::placeholders::_1)); - - return pAsyncEventServer; -} - -ControllerPtr Application::CreateSerialController(HKEY hSubkey) -{ - DWORD baudRate = 19200; - DWORD dataBits = 8; - DWORD parity = NOPARITY; - DWORD stopBits = ONESTOPBIT; - tstring portName; - TCHAR pPortname[256]; - ZeroMemory(pPortname, sizeof(pPortname)); - - //read baudrate setting - DWORD size = sizeof(DWORD); - RegQueryValueEx(hSubkey, TEXT("SerialBaudrate"), 0, 0, (BYTE*)&baudRate, &size); - - //read databits setting - size = sizeof(DWORD); - RegQueryValueEx(hSubkey, TEXT("SerialDatabits"), 0, 0, (BYTE*)&dataBits, &size); - - //read parity setting - size = sizeof(DWORD); - RegQueryValueEx(hSubkey, TEXT("SerialParity"), 0, 0, (BYTE*)&parity, &size); - - //read stopbits setting - size = sizeof(DWORD); - RegQueryValueEx(hSubkey, TEXT("SerialStopbits"), 0, 0, (BYTE*)&stopBits, &size); - - //read portname setting - size = sizeof(pPortname) - sizeof(TCHAR); - LONG returnValue = RegQueryValueEx(hSubkey, TEXT("SerialPortname"), 0, 0, (BYTE*)pPortname, &size); - if(returnValue == ERROR_SUCCESS && size > 0) - portName = pPortname; - - return ControllerPtr(new caspar::IO::SerialPort(baudRate, static_cast(parity), static_cast(dataBits), static_cast(stopBits), portName)); -} - -void Application::OnClientDisconnected(caspar::IO::SocketInfoPtr pClient) -{ - Monitor::ClearListener(pClient); -} - -////////////////////////////////// -// Application::LoadSetting10 -bool Application::LoadSettings10() -{ - HKEY hKey; - if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Sveriges Television AB\\Caspar CG\\1.0"), 0,KEY_READ, &hKey) == ERROR_SUCCESS) - { - TCHAR pString[512]; - - //read media-folder setting - DWORD size = sizeof(pString) - sizeof(TCHAR); - LONG returnValue = RegQueryValueEx(hKey, TEXT("MediaFolder"), 0, 0, (BYTE*)pString, &size); - if(returnValue == ERROR_SUCCESS && size > 0) - videoDir_ = pString; - - //read log-folder setting - size = sizeof(pString) - sizeof(TCHAR); - returnValue = RegQueryValueEx(hKey, TEXT("LogFolder"), 0, 0, (BYTE*)pString, &size); - if(returnValue == ERROR_SUCCESS && size > 0) - logDir_ = pString; - - //read loglevel - size = sizeof(int); - returnValue = RegQueryValueEx(hKey, TEXT("LogLevel"), 0, 0, (BYTE*)&logLevel_, &size); - - //close handle after all settings have been saved - RegCloseKey(hKey); - } - else { - LOG << TEXT("No 1.0 settings defined. Using defaults."); - } - - return true; -} - -////////////////////////////////// -// Application::LoadSetting15 -bool Application::LoadSettings15() -{ - HKEY hKey; - if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Sveriges Television AB\\Caspar CG\\1.5"), 0,KEY_READ, &hKey) == ERROR_SUCCESS) - { - TCHAR pString[512]; - - //read template-folder setting - DWORD size = sizeof(pString) - sizeof(TCHAR); - LONG returnValue = RegQueryValueEx(hKey, TEXT("TemplateFolder"), 0, 0, (BYTE*)pString, &size); - if(returnValue == ERROR_SUCCESS && size > 0) - templateDir_ = pString; - - //close handle after all settings have been saved - RegCloseKey(hKey); - } - else { - LOG << TEXT("No 1.5 settings defined. Using defaults."); - } - - return true; -} - -////////////////////////////////// -// Application::LoadSetting17 -bool Application::LoadSettings17() -{ - HKEY hKey; - if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Sveriges Television AB\\Caspar CG\\1.7"), 0,KEY_READ, &hKey) == ERROR_SUCCESS) - { - TCHAR pString[512]; - - //read data-folder setting - DWORD size = sizeof(pString) - sizeof(TCHAR); - LONG returnValue = RegQueryValueEx(hKey, TEXT("DataFolder"), 0, 0, (BYTE*)pString, &size); - if(returnValue == ERROR_SUCCESS && size > 0) - dataDir_ = pString; - - //close handle after all settings have been saved - RegCloseKey(hKey); - } - else { - LOG << TEXT("No 1.7 settings defined. Using defaults."); - } - - return true; -} - -bool Application::CheckDirectories() -{ - bool returnValue = true; - - if(logDir_.size() == 0) { - TCHAR pString[512]; - if(_tgetcwd(pString, _MAX_PATH+1)) { - logDir_ = pString; - logDir_ += TEXT("\\log"); - _tmkdir(logDir_.c_str()); - } - } - - if(!CheckDirectory(logDir_)) { - LOG << TEXT("Failed to aquire log-folder, logging to c:\\"); - logDir_ = TEXT("c:\\"); - } - - if(!CheckDirectory(videoDir_)) { - LOG << TEXT("Media-folder does not exists"); - tstring error = TEXT("Kunde inte hitta mediafolder. "); - error += videoDir_; - MessageBox(NULL, error.c_str(), TEXT("Kritiskt fel"), MB_OK); - returnValue = false; - } - - if(!CheckDirectory(templateDir_)) { - LOG << TEXT("Template-folder does not exists"); - tstring error = TEXT("Kunde inte hitta templatefolder. "); - error += templateDir_; - MessageBox(NULL, error.c_str(), TEXT("Kritiskt fel"), MB_OK); - returnValue = false; - } - - if(returnValue) { - if(!CheckDirectory(dataDir_)) { - LOG << TEXT("Data-folder does not exists, default to same as media-folder"); - dataDir_ = videoDir_; - } - } - - LOG << TEXT("Media-folder: ") << videoDir_.c_str(); - LOG << TEXT("Template-folder: ") << templateDir_.c_str(); - LOG << TEXT("Log-folder: ") << logDir_.c_str(); - LOG << TEXT("Data-folder: ") << dataDir_.c_str(); - - return returnValue; -} - -bool Application::CheckDirectory(tstring& directory) { - if(directory.size() == 0 || !exists(directory, true)) - return false; - - bool bIsRelative = false; - if(directory.size() >= 2) { - if(directory[1] != TEXT(':')) { - bIsRelative = true; - } - } - else - bIsRelative = true; - - if(bIsRelative) { - TCHAR pCurrentWorkingDirectory[_MAX_PATH+1]; - if(_tgetcwd(pCurrentWorkingDirectory, _MAX_PATH)) { - tstring fullPath = pCurrentWorkingDirectory; - fullPath.push_back(TEXT('\\')); - fullPath.append(directory); - directory = fullPath; - } - } - - if(directory[directory.size()-1] != TEXT('\\')) - directory += '\\'; - - return true; -} - -/////////////////////////// -// -// Commandline parameters -// -// hd=[720p50, 1080i50] chooses hd-mode for videochannels if availible -// spy{=true} instructs the serialport to NOT SEND ANYTHING -// internalkey(=true) instructs the videochannels to perform internal keying if availible -void Application::ParseCommandline() { - tstring currentToken = TEXT(""); - tstring lastKey = TEXT(""); - - bool inValue=false, inQuote=false; - - unsigned int charIndex = 0; - for(charIndex = 0; charIndex < commandline_.size(); ++charIndex) { - TCHAR ch = commandline_[charIndex]; - switch(ch) { - case TEXT('\"'): - inQuote = !inQuote; - if(currentToken.size() > 0) { - if(inValue) { - settings_.insert(SettingsMap::value_type(lastKey, currentToken)); - lastKey.clear(); - inValue = false; - } - else { - settings_.insert(SettingsMap::value_type(currentToken, TEXT("true"))); - } - - currentToken.clear(); - } - break; - - case TEXT('='): - if(currentToken.size() > 0) { - lastKey = currentToken; - currentToken.clear(); - inValue = true; - } - break; - - case TEXT(' '): - if(inQuote) - currentToken += ch; - else { - if(currentToken.size() > 0) { - if(inValue) { - settings_.insert(SettingsMap::value_type(lastKey, currentToken)); - lastKey.clear(); - inValue = false; - } - else { - settings_.insert(SettingsMap::value_type(currentToken, TEXT("true"))); - } - - currentToken.clear(); - } - } - break; - - default: - currentToken += ch; - break; - } - } - - if(currentToken.size() > 0) { - if(inValue) { - settings_.insert(SettingsMap::value_type(lastKey, currentToken)); - } - else { - settings_.insert(SettingsMap::value_type(currentToken, TEXT("true"))); - } - } -} - -tstring Application::GetSetting(const tstring& key) { - SettingsMap::iterator it = settings_.find(key); - if(it != settings_.end()) - return (*it).second; - else - return TEXT(""); -} - -////////////////////////////// -// ServiceHelpers - -void Application::InstallService() -{ - tstringstream message; - SC_HANDLE schSCManager; - SC_HANDLE schService; - TCHAR szPath[MAX_PATH]; - - if(!GetModuleFileName(NULL, szPath, MAX_PATH)) { - message << TEXT("Error: ") << GetLastError(); - MessageBox(NULL, message.str().c_str(), TEXT("Cannot install service"), MB_OK); - return; - } - - // Get a handle to the SCM database. - schSCManager = OpenSCManager( - NULL, // local computer - NULL, // ServicesActive database - SC_MANAGER_ALL_ACCESS); // full access rights - - if(schSCManager == NULL) { - message << TEXT("OpenSCManager failed. Error: ") << GetLastError(); - MessageBox(NULL, message.str().c_str(), TEXT("Cannot install service"), MB_OK); - return; - } - - // Create the service - tstring imagePath(szPath); - imagePath.append(TEXT(" service")); - - schService = CreateService( - schSCManager, // SCM database - serviceName_, // name of service - serviceName_, // service name to display - SERVICE_ALL_ACCESS, // desired access - SERVICE_WIN32_OWN_PROCESS, // service type - SERVICE_DEMAND_START, // start type - SERVICE_ERROR_NORMAL, // error control type - imagePath.c_str(), // path to service's binary - NULL, // no load ordering group - NULL, // no tag identifier - NULL, // no dependencies - NULL, // LocalSystem account - NULL); // no password - - if(schService == NULL) { - message << TEXT("CreateService failed. Error: ") << GetLastError(); - CloseServiceHandle(schSCManager); - MessageBox(NULL, message.str().c_str(), TEXT("Cannot install service"), MB_OK); - return; - } - else - MessageBox(NULL, TEXT("Service installed successfully"), TEXT("Done!"), MB_OK); - - CloseServiceHandle(schService); - CloseServiceHandle(schSCManager); -} - -void Application::UninstallService() -{ - tstringstream message; - SC_HANDLE schSCManager; - SC_HANDLE schService; - - // Get a handle to the SCM database. - schSCManager = OpenSCManager( - NULL, // local computer - NULL, // ServicesActive database - SC_MANAGER_ALL_ACCESS); // full access rights - - if(schSCManager == NULL){ - message << TEXT("OpenSCManager failed. Error: ") << GetLastError(); - MessageBox(NULL, message.str().c_str(), TEXT("Cannot uninstall service"), MB_OK); - return; - } - - // Get a handle to the service. - schService = OpenService( - schSCManager, // SCM database - serviceName_, // name of service - DELETE); // need delete access - - if (schService == NULL) - { - message << TEXT("OpenService failed. Error: ") << GetLastError(); - MessageBox(NULL, message.str().c_str(), TEXT("Cannot uninstall service"), MB_OK); - CloseServiceHandle(schSCManager); - return; - } - - // Delete the service. - if (!DeleteService(schService)) - { - message << TEXT("DeleteService failed. Error: ") << GetLastError(); - MessageBox(NULL, message.str().c_str(), TEXT("Cannot uninstall service"), MB_OK); - } - else - MessageBox(NULL, TEXT("Service uninstalled successfully"), TEXT("Done!"), MB_OK); - - CloseServiceHandle(schService); - CloseServiceHandle(schSCManager); -} - -} \ No newline at end of file diff --git a/server/Application.h b/server/Application.h deleted file mode 100644 index 739c1dc38..000000000 --- a/server/Application.h +++ /dev/null @@ -1,170 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _CASPAR_APPLICATION_H__ -#define _CASPAR_APPLICATION_H__ - -#pragma once - -#include "Window.h" -#include "Controller.h" -#include "MediaManager.h" -#include "audio\audiomanager.h" -#include "utils\event.h" -#include "io\socketInfo.h" - -#include -#include -#include -#include - -#include - -namespace caspar { - - class Channel; - typedef std::tr1::shared_ptr ChannelPtr; - - class IVideoConsumer; - typedef std::tr1::shared_ptr VideoConsumerPtr; - - class FileInfo; - - class Application - { - public: - explicit Application(const tstring& cmdline, HINSTANCE); - ~Application(); - - static void InstallService(); - static void UninstallService(); - - void RunAsService(); - int RunAsWindow(); - - //void ServiceMain(); - //void ServiceCtrlHandler(DWORD dwCtrl); - - LRESULT WndProc(HWND, UINT, WPARAM, LPARAM); - - const TCHAR* GetVersionString() const { - return versionString_; - } - WindowPtr& GetMainWindow() { - return pWindow_; - } - caspar::audio::IAudioManager* GetAudioManager() { - return pAudioManager_; - } - const tstring& GetMediaFolder() { - return videoDir_; - } - const tstring& GetTemplateFolder() { - return templateDir_; - } - const tstring& GetDataFolder() { - return dataDir_; - } - - ChannelPtr GetChannel(unsigned int deviceIndex); - - bool FindTemplate(const tstring& templateName, tstring* pExtension = NULL); - MediaManagerPtr FindMediaFile(const tstring& filename, FileInfo* pFileInfo=0); - MediaManagerPtr GetColorMediaManager() { - if(colorManagerIndex_ != -1) - return sourceMediaManagers_[colorManagerIndex_]; - else - return MediaManagerPtr(); - } - - tstring GetSetting(const tstring& key); - - template - T GetSetting(const std::wstring& key, T defaultValue) - { - try - { - std::wstring str = GetSetting(key); - if(!str.empty()) - return boost::lexical_cast(str); - } - catch(...){} - return defaultValue; - } - - utils::Event& GetTerminateEvent() { return terminateEvent_; } - //utils::Event& GetStopEvent() { return stopEvent_; } - - private: - bool Initialize(); - void Destroy(); - - typedef std::map SettingsMap; - - void CreateVideoChannel(int index, VideoConsumerPtr videoConsumer); - ControllerPtr CreateTCPController(HKEY); - ControllerPtr CreateSerialController(HKEY); - - bool LoadSettings10(); - bool LoadSettings15(); - bool LoadSettings17(); - void ParseCommandline(); - - bool CheckDirectories(); - bool CheckDirectory(tstring& directory); - - void SetupControllers(); - void OnClientDisconnected(caspar::IO::SocketInfoPtr); - - WindowPtr pWindow_; - - std::vector videoChannels_; - std::vector sourceMediaManagers_; - std::vector controllers_; - - caspar::audio::IAudioManager* pAudioManager_; - - //Once the program is initiated, these directories are guaranteed to have a trailing '\' - tstring videoDir_; - tstring templateDir_; - tstring logDir_; - tstring dataDir_; - - int logLevel_; - static const TCHAR* versionString_; - - static const TCHAR* serviceName_; - //SERVICE_STATUS_HANDLE svcStatusHandle_; - //SERVICE_STATUS serviceStatus_; - //void ServiceReportStatus(DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint); - - int colorManagerIndex_; - utils::Event terminateEvent_; - //utils::Event stopEvent_; - - HINSTANCE hInstance_; - tstring commandline_; - SettingsMap settings_; - - }; - -} //namespace caspar - -#endif //_CASPAR_APPLICATION_H__ \ No newline at end of file diff --git a/server/CLK/CLKCommand.cpp b/server/CLK/CLKCommand.cpp deleted file mode 100644 index 254e86631..000000000 --- a/server/CLK/CLKCommand.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\stdafx.h" -#include -#include -#include "CLKCommand.h" - -namespace caspar { -namespace CLK { - -CLKCommand::CLKCommand() : clockID_(0), command_(CLKInvalidCommand) { -} - -CLKCommand::~CLKCommand() { -} - -const tstring& CLKCommand::GetData() { - tstringstream dataStream; - - dataStream << TEXT(""); - dataStream << TEXT(""); - dataStream << TEXT(""); - - std::vector::const_iterator it = parameters_.begin(); - std::vector::const_iterator end = parameters_.end(); - for(; it != end; ++it) { - dataStream << TEXT("") << (*it) << TEXT(""); - } - - dataStream << TEXT(""); - dataStream << TEXT(""); - dataStream << TEXT(""); - - dataCache_ = dataStream.str(); - return dataCache_; -} - -bool CLKCommand::SetCommand() { - bool bResult = true; - std::transform(commandString_.begin(), commandString_.end(), commandString_.begin(), toupper); - - if(commandString_ == TEXT("DUR")) - command_ = CLKDuration; - else if(commandString_ == TEXT("NEWDUR")) - command_ = CLKNewDuration; - else if(commandString_ == TEXT("NEXTEVENT")) - command_ = CLKNextEvent; - else if(commandString_ == TEXT("STOP")) - command_ = CLKStop; - else if(commandString_ == TEXT("UNTIL")) - command_ = CLKUntil; - else if(commandString_ == TEXT("ADD")) - command_ = CLKAdd; - else if(commandString_ == TEXT("SUB")) - command_ = CLKSub; - else if(commandString_ == TEXT("RESET")) - command_ = CLKReset; - else { - command_ = CLKInvalidCommand; - bResult = false; - } - - return bResult; -} - -void CLKCommand::Clear() { - dataCache_.clear(); - commandString_.clear(); - time_.clear(); - command_ = CLKDuration; - clockID_ = 0; - parameters_.clear(); -} - -} //namespace CLK -} //namespace caspar \ No newline at end of file diff --git a/server/CLK/CLKCommand.h b/server/CLK/CLKCommand.h deleted file mode 100644 index 20cc543a4..000000000 --- a/server/CLK/CLKCommand.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -#include -#include - -namespace caspar { -namespace CLK { - -class CLKCommand -{ -public: - enum CLKCommands { - CLKDuration, - CLKNewDuration, - CLKNextEvent, - CLKStop, - CLKUntil, - CLKAdd, - CLKSub, - CLKReset, - CLKInvalidCommand - }; - - CLKCommand(); - virtual ~CLKCommand(); - - bool SetCommand(); - bool NeedsTime() const { - return !(command_ == CLKNextEvent || command_ == CLKStop); - } - void Clear(); - const tstring& GetData(); - - tstring dataCache_; - tstring commandString_; - CLKCommands command_; - int clockID_; - tstring time_; - std::vector parameters_; - - - -}; - -} //namespace CLK -} //namespace caspar \ No newline at end of file diff --git a/server/CLK/CLKProtocolStrategy.cpp b/server/CLK/CLKProtocolStrategy.cpp deleted file mode 100644 index 40903b333..000000000 --- a/server/CLK/CLKProtocolStrategy.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\StdAfx.h" - -#include -#include -#include -#include "CLKProtocolStrategy.h" -#include "..\CG\CGControl.h" -#include "..\producers\flash\FlashManager.h" -#include "..\application.h" -#include "..\fileinfo.h" - -namespace caspar { -namespace CLK { - -using namespace utils; - -CLKProtocolStrategy::CLKProtocolStrategy() : currentState_(ExpectingNewCommand), bClockLoaded_(false) { - pChannel_ = GetApplication()->GetChannel(0); - pCGControl_ = pChannel_->GetCGControl(); -} - -CLKProtocolStrategy::~CLKProtocolStrategy() { -} - -void CLKProtocolStrategy::Parse(const TCHAR* pData, int charCount, caspar::IO::ClientInfoPtr pClientInfo) { - for(int index=0; index < charCount; ++index) { - if(currentState_ == ExpectingNewCommand) - currentCommandString_.str(TEXT("")); - - TCHAR currentByte = pData[index]; - if(currentByte < 32) - currentCommandString_ << TEXT("<") << (int)currentByte << TEXT(">"); - else - currentCommandString_ << currentByte; - - if(currentByte != 0) { - switch(currentState_) { - case ExpectingNewCommand: - if(currentByte == 1) { - currentState_ = ExpectingCommand; - } - //just throw anything else away - break; - - case ExpectingCommand: - if(currentByte == 2) { - if(!currentCommand_.SetCommand()) { - LOG << TEXT("CLK: Failed to interpret command"); - currentState_ = ExpectingNewCommand; - currentCommand_.Clear(); - } - else { - currentState_ = ExpectingClockID; - } - } - else - currentCommand_.commandString_ += currentByte; - break; - - case ExpectingClockID: - if(currentByte == 2) - currentState_ = currentCommand_.NeedsTime() ? ExpectingTime : ExpectingParameter; - else - currentCommand_.clockID_ = currentByte - TCHAR('0'); - break; - - case ExpectingTime: - if(currentByte == 2) - currentState_ = ExpectingParameter; - else - currentCommand_.time_ += currentByte; - break; - - case ExpectingParameter: - //allocate new parameter - if(currentCommand_.parameters_.size() == 0 || currentByte == 2) - currentCommand_.parameters_.push_back(tstring()); - - //add the character to end end of the last parameter - if(currentByte == TEXT('<')) - currentCommand_.parameters_[currentCommand_.parameters_.size()-1] += TEXT("<"); - else if(currentByte == TEXT('>')) - currentCommand_.parameters_[currentCommand_.parameters_.size()-1] += TEXT(">"); - else if(currentByte == TEXT('\"')) - currentCommand_.parameters_[currentCommand_.parameters_.size()-1] += TEXT("""); - else - currentCommand_.parameters_[currentCommand_.parameters_.size()-1] += currentByte; - - break; - } - } - else { - if(currentState_ == ExpectingCommand) { - if(!currentCommand_.SetCommand()) - LOG << TEXT("CLK: Failed to interpret command"); - } - - if(currentCommand_.command_ == CLKCommand::CLKReset) { - pCGControl_->Clear(); - bClockLoaded_ = false; - - LOG << TEXT("CLK: Recieved and executed reset-command"); - } - else if(currentCommand_.command_ != CLKCommand::CLKInvalidCommand) { - if(!bClockLoaded_) { - pCGControl_->Add(0, TEXT("hawrysklocka/clock"), true, TEXT(""), currentCommand_.GetData()); - bClockLoaded_ = true; - } - else { - pCGControl_->Update(0, currentCommand_.GetData()); - } - - LOG << LogLevel::Debug << TEXT("CLK: Clockdata sent: ") << currentCommand_.GetData(); - LOG << TEXT("CLK: Executed valid command: ") << currentCommandString_.str(); - } - - currentState_ = ExpectingNewCommand; - currentCommand_.Clear(); - } - } -} - -} //namespace CLK -} //namespace caspar \ No newline at end of file diff --git a/server/CLK/CLKProtocolStrategy.h b/server/CLK/CLKProtocolStrategy.h deleted file mode 100644 index 2e051867f..000000000 --- a/server/CLK/CLKProtocolStrategy.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once -#include - -#include "CLKCommand.h" -#include "..\io\ProtocolStrategy.h" -#include "..\channel.h" -#include "..\MediaManager.h" -#include "..\Application.h" - -namespace caspar { - namespace CG { class ICGControl; } -namespace CLK { - -class CLKProtocolStrategy : public caspar::IO::IProtocolStrategy -{ -public: - CLKProtocolStrategy(); - virtual ~CLKProtocolStrategy(); - - virtual void Parse(const TCHAR* pData, int charCount, caspar::IO::ClientInfoPtr pClientInfo); - virtual UINT GetCodepage() { return GetApplication()->GetSetting(L"clk-encoding") == L"latin1" ? 28591 : CP_UTF8; } //28591 = ISO 8859-1, Latin1 - -private: - enum ParserState { - ExpectingNewCommand, - ExpectingCommand, - ExpectingClockID, - ExpectingTime, - ExpectingParameter - }; - - ParserState currentState_; - CLKCommand currentCommand_; - tstringstream currentCommandString_; - - caspar::MediaManagerPtr pFlashManager_; - caspar::CG::ICGControl* pCGControl_; - ChannelPtr pChannel_; - - bool bClockLoaded_; -}; - -} //namespace CLK -} //namespace caspar diff --git a/server/Channel.cpp b/server/Channel.cpp deleted file mode 100644 index af9d9317a..000000000 --- a/server/Channel.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "stdAfx.h" - -#include "Application.h" -#include "utils\critsectlock.h" -#include "Channel.h" -#include - -using namespace std; - -namespace caspar { - -using namespace caspar::utils; - -Channel::Channel(int index, VideoConsumerPtr pConsumer) : pConsumer_(pConsumer), index_(index), monitor_(index) -{ -} - -Channel::~Channel() { - Destroy(); -} - -bool Channel::Initialize() { - pConsumer_->GetPlaybackControl()->SetMonitor(&monitor_); - return true; -} - -void Channel::Destroy() { - pConsumer_.reset(); -} - -const TCHAR* Channel::GetFormatDescription() const -{ - return pConsumer_->GetFormatDescription(); -} - -bool Channel::IsPlaybackRunning() const -{ - return pConsumer_->GetPlaybackControl()->IsRunning(); -} - -CG::ICGControl* Channel::GetCGControl() { - return pConsumer_->GetPlaybackControl()->GetCGControl(); -} - -//////////////// -// LOAD -bool Channel::Load(MediaProducerPtr pFP, bool loop) -{ - return pConsumer_->GetPlaybackControl()->Load(pFP, loop); -} - -//////////////// -// LOADBG -bool Channel::LoadBackground(MediaProducerPtr pFP, const TransitionInfo& transitionInfo, bool loop) -{ - return pConsumer_->GetPlaybackControl()->LoadBackground(pFP, transitionInfo, loop); -} - -//////////////// -// PLAY -bool Channel::Play() -{ - return pConsumer_->GetPlaybackControl()->Play(); -} - -//////////////// -// STOP -bool Channel::Stop(bool block) -{ - return pConsumer_->GetPlaybackControl()->StopPlayback(block); -} - -bool Channel::SetVideoFormat(const tstring& strDesiredFrameFormat) -{ - tstring strDesiredFrameFormatUpper = strDesiredFrameFormat; - tstring strFmtDescUpper = this->pConsumer_->GetFormatDescription(); - - std::transform(strDesiredFrameFormatUpper.begin(), strDesiredFrameFormatUpper.end(), strDesiredFrameFormatUpper.begin(), toupper); - std::transform(strFmtDescUpper.begin(), strFmtDescUpper.end(), strFmtDescUpper.begin(), toupper); - - if(strDesiredFrameFormatUpper == strFmtDescUpper) - return true; - - bool stopped = this->Stop(true); - bool formatSet = stopped && this->pConsumer_->SetVideoFormat(strDesiredFrameFormat); - bool cleared = formatSet && this->Clear(); - - return stopped && formatSet && cleared; -} - - - -bool Channel::Clear() -{ - pConsumer_->GetPlaybackControl()->LoadEmpty(); - return true; -} - -bool Channel::Param(const tstring& str) { - return pConsumer_->GetPlaybackControl()->Param(str); -} - -} //namespace caspar \ No newline at end of file diff --git a/server/Channel.h b/server/Channel.h deleted file mode 100644 index c4437a95f..000000000 --- a/server/Channel.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -#include "VideoConsumer.h" -#include "MediaProducer.h" -#include "PlaybackControl.h" -#include "producers\composites\TransitionProducer.h" -#include "TransitionInfo.h" -#include "frame\clipinfo.h" - -#include "monitor.h" - -namespace caspar { - -class Channel -{ -public: - explicit Channel(int index, VideoConsumerPtr pVideoConsumer); - ~Channel(); - - bool Initialize(); //call from app in main-thread - void Destroy(); //call from app in main-thread - - const TCHAR* GetFormatDescription() const; - bool IsPlaybackRunning() const; - - int GetIndex() const { - return index_; - } - - CG::ICGControl* GetCGControl(); - Monitor& GetMonitor() { - return monitor_; - } - - bool Load(MediaProducerPtr, bool loop=false); //call from misc IO threads - bool LoadBackground(MediaProducerPtr, const TransitionInfo& transitionInfo, bool loop=false); //call from misc IO threads - bool Play(); //call from misc IO threads - bool Stop(bool block = false); //call from misc IO threads - bool Param(const tstring& str); //call from misc IO threads - bool Clear(); - bool SetVideoFormat(const tstring& strDesiredFrameFormat); - - -private: - Monitor monitor_; - int index_; - VideoConsumerPtr pConsumer_; -}; -typedef std::tr1::shared_ptr ChannelPtr; - -} //namespace caspar \ No newline at end of file diff --git a/server/Controller.h b/server/Controller.h deleted file mode 100644 index 1db59c4c8..000000000 --- a/server/Controller.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -#include "io\protocolStrategy.h" - -namespace caspar { - -class IController { -public: - virtual ~IController() { - } - - virtual bool Start() = 0; - virtual void Stop() = 0; - virtual void SetProtocolStrategy(caspar::IO::ProtocolStrategyPtr) = 0; -}; -typedef std::tr1::shared_ptr ControllerPtr; - -} //namespace caspar \ No newline at end of file diff --git a/server/FileInfo.h b/server/FileInfo.h deleted file mode 100644 index 1976b0234..000000000 --- a/server/FileInfo.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef __FILEINFO_H__ -#define __FILEINFO_H__ - -namespace caspar { - -class FileInfo -{ -public: - FileInfo() : length(0), resolution(0), size(0), filetype(TEXT("")), filename(TEXT("")), encoding(TEXT("")), type(TEXT("")) - {} - tstring filename; - tstring filetype; - tstring encoding; - tstring type; - int length; - int resolution; - unsigned long long size; -}; - -} //namespace caspar - -#endif __FILEINFO_H__ \ No newline at end of file diff --git a/server/Main.cpp b/server/Main.cpp deleted file mode 100644 index c6e0c9fbe..000000000 --- a/server/Main.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "StdAfx.h" -#include "Application.h" -#include "utils\FileOutputStream.h" -#include -#include -#include "utils\Win32Exception.h" - -//the easy way to make it possible to forward WndProc messages into the application-object -caspar::Application* pGlobal_Application = 0; - -namespace caspar { - Application* GetApplication() - { - return pGlobal_Application; - } -} - -class win32_handler_tbb_installer : public tbb::task_scheduler_observer -{ -public: - win32_handler_tbb_installer() {observe(true);} - void on_scheduler_entry(bool is_worker) - { - Win32Exception::InstallHandler(); - } -}; - -int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int) -{ - int returnValue = 0; - tstring commandline(lpCmdLine); - - win32_handler_tbb_installer win32_handler_tbb_installer; - tbb::task_scheduler_init task_scheduler(max(2, tbb::task_scheduler_init::default_num_threads())); - - //if(commandline == TEXT("install")) - //{ - // caspar::Application::InstallService(); - //} - //else if(commandline == TEXT("uninstall")) - //{ - // caspar::Application::UninstallService(); - //} - //else { - try - { - caspar::utils::OutputStreamPtr pOutputStream(new caspar::utils::FileOutputStream(TEXT("startup.log"))); - caspar::utils::Logger::GetInstance().SetOutputStream(pOutputStream); - caspar::utils::Logger::GetInstance().SetTimestamp(true); - - caspar::Application app(lpCmdLine, hInstance); - pGlobal_Application = &app; - - //if(commandline.find(TEXT("service")) != tstring::npos) - // app.RunAsService(); - //else - returnValue = app.RunAsWindow(); - } - catch(const std::exception& ex) - { - LOG << caspar::utils::LogLevel::Critical << TEXT("UNHANDLED EXCEPTION in main thread. Message: ") << ex.what(); - } -// } - - return returnValue; -} diff --git a/server/MediaController.h b/server/MediaController.h deleted file mode 100644 index 46ea95f1b..000000000 --- a/server/MediaController.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _CASPAR_MEDIACONTROLLER_H__ -#define _CASPAR_MEDIACONTROLLER_H__ - -namespace caspar { - -class IMediaController -{ - IMediaController(const IMediaController&); - IMediaController& operator=(const IMediaController&); - -protected: - IMediaController() {} - -public: - virtual ~IMediaController() {} - -}; - -} //namespace caspar - -#endif //_CASPAR_MEDIACONTROLLER_H__ \ No newline at end of file diff --git a/server/MediaManager.h b/server/MediaManager.h deleted file mode 100644 index c17c4c452..000000000 --- a/server/MediaManager.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -#include -#include -#include "fileinfo.h" - -namespace caspar { - -class FileInfo; - -class MediaProducer; -typedef std::tr1::shared_ptr MediaProducerPtr; - -class IMediaManager -{ -public: - - IMediaManager() - {} - - virtual ~IMediaManager() - {} - virtual MediaProducerPtr CreateProducer(const tstring& filename) = 0; - - unsigned short GetSupportedExtensions(const std::vector*& extensions) - { - extensions = &_extensions; - return (unsigned short)_extensions.size(); - } - - virtual bool getFileInfo(FileInfo* pFileInfo) = 0; -protected: - std::vector _extensions; -}; -typedef std::tr1::shared_ptr MediaManagerPtr; - -} //namespace caspar \ No newline at end of file diff --git a/server/MediaProducer.h b/server/MediaProducer.h deleted file mode 100644 index 9462f7bfa..000000000 --- a/server/MediaProducer.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -namespace caspar { - -class IMediaController; - -class MediaProducer; -typedef std::tr1::shared_ptr MediaProducerPtr; - -class MediaProducer -{ - MediaProducer(const MediaProducer&); - MediaProducer& operator=(const MediaProducer&); - -public: - MediaProducer() : bLoop_(false) - {} - virtual ~MediaProducer() - {} - - virtual IMediaController* QueryController(const tstring&) = 0; - - virtual bool Param(const tstring&) { return false; } - virtual bool IsEmpty() const { return false; } - - virtual MediaProducerPtr GetFollowingProducer() { - return MediaProducerPtr(); - } - - virtual void SetLoop(bool bLoop) { - bLoop_ = bLoop; - } - bool GetLoop() { - return bLoop_; - } - -private: - bool bLoop_; -}; - -} //namespace caspar \ No newline at end of file diff --git a/server/MediaProducerInfo.h b/server/MediaProducerInfo.h deleted file mode 100644 index a6edccb49..000000000 --- a/server/MediaProducerInfo.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -namespace caspar { - -struct MediaProducerInfo { - - MediaProducerInfo() : HaveAudio(false), HaveVideo(false), AudioSamplesPerSec(0), AudioChannels(0), BitsPerAudioSample(0) - {} - - bool HaveAudio; - bool HaveVideo; - - unsigned int AudioSamplesPerSec; - unsigned short AudioChannels; - unsigned short BitsPerAudioSample; -}; - -} //namespace caspar \ No newline at end of file diff --git a/server/Monitor.cpp b/server/Monitor.cpp deleted file mode 100644 index 12a459fce..000000000 --- a/server/Monitor.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "stdAfx.h" - -#include "Monitor.h" -#include "io/AsyncEventServer.h" -#include - -namespace caspar { - -using namespace std; - -const int Monitor::ResponseCodeNoParam = 102; -const int Monitor::ResponseCodeWithParam = 101; - -Monitor::MonitorList Monitor::monitors_; - -Monitor::Monitor(int channelIndex) : channelIndex_(channelIndex) { - monitors_.push_back(this); -} -Monitor::~Monitor() { - monitors_.remove(this); -} - -void Monitor::ClearListener(const caspar::IO::ClientInfoPtr& pClient) { - MonitorList::iterator it = monitors_.begin(); - MonitorList::iterator end = monitors_.end(); - - for(; it != end; ++it) { - (*it)->RemoveListener(pClient); - } -} - -void Monitor::Inform(MonitorEventType type, const tstring& parameter, MonitorParameterFormatter formatter) -{ - taskSeraializer_.enqueue(bind(&Monitor::internal_Inform, this, type, parameter, formatter)); -} - -void Monitor::internal_Inform(MonitorEventType type, const tstring parameter, MonitorParameterFormatter formatter) -{ - //lock the list and make a local copy - ListenerList localListeners; - { - Lock lock(*this); - localListeners = listeners_; - } - - if(localListeners.size() == 0) - return; - - tstringstream msg; - int code = ResponseCodeNoParam; - if(parameter.size() > 0) - code = ResponseCodeWithParam; - - msg << code << TEXT(' '); - - FormatInfo(msg, type); - - if(parameter.size() > 0) { - if(formatter) - msg << formatter(parameter) << TEXT("\r\n"); - else - msg << parameter << TEXT("\r\n"); - } - - tstring message(msg.str()); - - //iterate over the local copy - ListenerList::iterator it = localListeners.begin(); - ListenerList::iterator end = localListeners.end(); - for(; it != end; ++it) { - (*it)->Send(message); - } - -// LOG << utils::LogLevel::Debug << TEXT("MONITOR: ") << msg.str(); -} - -void Monitor::FormatInfo(tstringstream& msg, MonitorEventType type) -{ - switch(type) - { - case LOADBG: - msg << TEXT("LOADBG"); - break; - case LOAD: - msg << TEXT("LOAD"); - break; - case PLAY: - msg << TEXT("PLAY"); - break; - case STOPPED: - msg << TEXT("STOP"); - break; - case CLEAR: - msg << TEXT("CLEAR"); - break; - - case CG_ADD: - case CG_CLEAR: - case CG_PLAY: - case CG_STOP: - case CG_NEXT: - case CG_REMOVE: - case CG_UPDATE: - case CG_INVOKE: - msg << TEXT("CG"); - break; - - default: - break; - } - - if(channelIndex_ > 0) - msg << TEXT(' ') << channelIndex_; - - switch(type) - { - case CG_ADD: - msg << TEXT(" ADD"); - break; - case CG_CLEAR: - msg << TEXT(" CLEAR"); - break; - case CG_PLAY: - msg << TEXT(" PLAY"); - break; - case CG_STOP: - msg << TEXT(" STOP"); - break; - case CG_NEXT: - msg << TEXT(" NEXT"); - break; - case CG_REMOVE: - msg << TEXT(" REMOVE"); - break; - case CG_UPDATE: - msg << TEXT(" UPDATE"); - break; - case CG_INVOKE: - msg << TEXT(" INVOKE"); - break; - default: - break; - } - msg << TEXT("\r\n"); -} - -void Monitor::AddListener(caspar::IO::ClientInfoPtr& pClient) { - Lock lock(*this); - ListenerList::iterator it = std::find(listeners_.begin(), listeners_.end(), pClient); - if(it == listeners_.end()) { - LOG << utils::LogLevel::Debug << TEXT("Added a client as listener"); - listeners_.push_back(pClient); - } -} - -void Monitor::RemoveListener(const caspar::IO::ClientInfoPtr& pClient) { - Lock lock(*this); - listeners_.remove(pClient); -} - -} //namespace caspar \ No newline at end of file diff --git a/server/Monitor.h b/server/Monitor.h deleted file mode 100644 index 062b05f42..000000000 --- a/server/Monitor.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -#include "utils/noncopyable.hpp" -#include "utils/lockable.h" -#include "io/clientinfo.h" -#include -#include - -#include "utils/functiontask.hpp" - -namespace caspar { - -typedef std::function MonitorParameterFormatter; - -enum MonitorEventType -{ - LOADBG, - LOAD, - PLAY, - STOPPED, - CLEAR, - - CG_ADD, - CG_CLEAR, - CG_PLAY, - CG_STOP, - CG_NEXT, - CG_REMOVE, - CG_UPDATE, - CG_INVOKE -}; - -class Monitor : private utils::LockableObject, private utils::Noncopyable -{ -public: - static const int ResponseCodeNoParam; - static const int ResponseCodeWithParam; - - //removes the client from all monitors - static void ClearListener(const caspar::IO::ClientInfoPtr& pClient); - - explicit Monitor(int channelIndex); - virtual ~Monitor(); - - void Inform(MonitorEventType type, const tstring& parameter = TEXT(""), MonitorParameterFormatter formatter = 0); - - void AddListener(caspar::IO::ClientInfoPtr& pClient); - void RemoveListener(const caspar::IO::ClientInfoPtr& pClient); - -private: - void internal_Inform(MonitorEventType type, const tstring parameter, MonitorParameterFormatter formatter); - - void FormatInfo(tstringstream& sstream, MonitorEventType type); - - int channelIndex_; - typedef std::list ListenerList; - typedef std::list MonitorList; - - function_task_serializer taskSeraializer_; - - ListenerList listeners_; - static MonitorList monitors_; -}; - -} //namespace caspar \ No newline at end of file diff --git a/server/PlaybackControl.h b/server/PlaybackControl.h deleted file mode 100644 index 5f15f4c7e..000000000 --- a/server/PlaybackControl.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -#include "MediaProducer.h" -#include "TransitionInfo.h" - -namespace caspar -{ - namespace CG - { - class ICGControl; - } - - class Monitor; - - class IPlaybackControl - { - IPlaybackControl(IPlaybackControl&); - const IPlaybackControl& operator=(const IPlaybackControl&); - - public: - IPlaybackControl() {} - virtual ~IPlaybackControl() {} - - virtual void SetMonitor(Monitor* pMonitor) = 0; - - virtual bool Load(MediaProducerPtr pFP, bool loop) = 0; - virtual bool LoadBackground(MediaProducerPtr pFP, const TransitionInfo& transitionInfo, bool loop) = 0; - virtual bool Play() = 0; - virtual void LoadEmpty() = 0; - //virtual bool Pause() = 0; - virtual bool StopPlayback(bool block = false) = 0; - virtual bool IsRunning() = 0; - virtual bool Param(const tstring& param) = 0; - - virtual CG::ICGControl* GetCGControl() = 0; - }; - - typedef std::tr1::shared_ptr PlaybackControlPtr; -} \ No newline at end of file diff --git a/server/Resource.h b/server/Resource.h deleted file mode 100644 index 4693e04ae..000000000 --- a/server/Resource.h +++ /dev/null @@ -1,16 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by Server.rc -// -#define IDI_ICON1 101 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 102 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/server/Server.vcproj b/server/Server.vcproj deleted file mode 100644 index 3dfce93e1..000000000 --- a/server/Server.vcproj +++ /dev/null @@ -1,3575 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/server/Server.vcxproj b/server/Server.vcxproj deleted file mode 100644 index 56aad01a3..000000000 --- a/server/Server.vcxproj +++ /dev/null @@ -1,774 +0,0 @@ - - - - - Debug - Win32 - - - no bluefish - Win32 - - - Release - Win32 - - - - {79388C20-6499-4BF6-B8B9-D8C33D7D4DDD} - Server - Win32Proj - - - - Application - Unicode - - - Application - Unicode - - - Application - Unicode - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(ProjectDir)build\ - debug\ - false - $(ProjectDir)build\ - release\ - false - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - ..\..\dependencies\BluefishSDK_V5_8_0_31\Inc\;..\..\..\dependencies\BluefishSDK_V5_8_0_31\Inc\;..\..\dependencies\boost_1_44_0\;..\..\..\dependencies\boost_1_44_0\;..\..\dependencies\ffmpeg 0.6\include\;..\..\..\dependencies\ffmpeg 0.6\include\;..\..\dependencies\FreeImage\Dist\;..\..\..\dependencies\FreeImage\Dist\;..\..\dependencies\GLee5_4\;..\..\..\dependencies\GLee5_4\;..\..\dependencies\SFML-1.6\include\;..\..\..\dependencies\SFML-1.6\include\;..\..\dependencies\tbb30_20100406oss\include\;..\..\..\dependencies\tbb30_20100406oss\include\;..\..\dependencies\wtl80\include\;..\..\..\dependencies\wtl80\include\;$(IncludePath) - ..\..\dependencies\BluefishSDK_V5_8_0_31\Lib\;..\..\..\dependencies\BluefishSDK_V5_8_0_31\Lib\;..\..\dependencies\boost_1_44_0\stage\lib\;..\..\..\dependencies\boost_1_44_0\stage\lib\;..\..\dependencies\ffmpeg 0.6\lib\;..\..\..\dependencies\ffmpeg 0.6\lib\;..\..\dependencies\FreeImage\Dist\;..\..\..\dependencies\FreeImage\Dist\;..\..\dependencies\GLee5_4\;..\..\..\dependencies\GLee5_4\;..\..\dependencies\SFML-1.6\lib\;..\..\..\dependencies\SFML-1.6\lib\;..\..\dependencies\tbb30_20100406oss\lib\ia32\vc10\;..\..\..\dependencies\tbb30_20100406oss\lib\ia32\vc10\;C:\Program Files\Microsoft DirectX SDK (June 2010)\Lib\x86;C:\Program\Microsoft DirectX SDK (June 2010)\Lib\x86;$(LibraryPath) - ..\..\dependencies\BluefishSDK_V5_8_0_31\Inc\;..\..\..\dependencies\BluefishSDK_V5_8_0_31\Inc\;..\..\dependencies\boost_1_44_0\;..\..\..\dependencies\boost_1_44_0\;..\..\dependencies\ffmpeg 0.6\include\;..\..\..\dependencies\ffmpeg 0.6\include\;..\..\dependencies\FreeImage\Dist\;..\..\..\dependencies\FreeImage\Dist\;..\..\dependencies\GLee5_4\;..\..\..\dependencies\GLee5_4\;..\..\dependencies\SFML-1.6\include\;..\..\..\dependencies\SFML-1.6\include\;..\..\dependencies\tbb30_20100406oss\include\;..\..\..\dependencies\tbb30_20100406oss\include\;..\..\dependencies\wtl80\include\;..\..\..\dependencies\wtl80\include\;$(IncludePath) - ..\..\dependencies\BluefishSDK_V5_8_0_31\Lib\;..\..\..\dependencies\BluefishSDK_V5_8_0_31\Lib\;..\..\dependencies\boost_1_44_0\stage\lib\;..\..\..\dependencies\boost_1_44_0\stage\lib\;..\..\dependencies\ffmpeg 0.6\lib\;..\..\..\dependencies\ffmpeg 0.6\lib\;..\..\dependencies\FreeImage\Dist\;..\..\..\dependencies\FreeImage\Dist\;..\..\dependencies\GLee5_4\;..\..\..\dependencies\GLee5_4\;..\..\dependencies\SFML-1.6\lib\;..\..\..\dependencies\SFML-1.6\lib\;..\..\dependencies\tbb30_20100406oss\lib\ia32\vc10\;..\..\..\dependencies\tbb30_20100406oss\lib\ia32\vc10\;C:\Program Files\Microsoft DirectX SDK (June 2010)\Lib\x86;$(LibraryPath) - ..\..\dependencies\BluefishSDK_V5_8_0_31\Inc\;..\..\..\dependencies\BluefishSDK_V5_8_0_31\Inc\;..\..\dependencies\boost_1_44_0\;..\..\..\dependencies\boost_1_44_0\;..\..\dependencies\ffmpeg 0.6\include\;..\..\..\dependencies\ffmpeg 0.6\include\;..\..\dependencies\FreeImage\Dist\;..\..\..\dependencies\FreeImage\Dist\;..\..\dependencies\GLee5_4\;..\..\..\dependencies\GLee5_4\;..\..\dependencies\SFML-1.6\include\;..\..\..\dependencies\SFML-1.6\include\;..\..\dependencies\tbb30_20100406oss\include\;..\..\..\dependencies\tbb30_20100406oss\include\;..\..\dependencies\wtl80\include\;..\..\..\dependencies\wtl80\include\;$(IncludePath) - ..\..\dependencies\BluefishSDK_V5_8_0_31\Lib\;..\..\..\dependencies\BluefishSDK_V5_8_0_31\Lib\;..\..\dependencies\boost_1_44_0\stage\lib\;..\..\..\dependencies\boost_1_44_0\stage\lib\;..\..\dependencies\ffmpeg 0.6\lib\;..\..\..\dependencies\ffmpeg 0.6\lib\;..\..\dependencies\FreeImage\Dist\;..\..\..\dependencies\FreeImage\Dist\;..\..\dependencies\GLee5_4\;..\..\..\dependencies\GLee5_4\;..\..\dependencies\SFML-1.6\lib\;..\..\..\dependencies\SFML-1.6\lib\;..\..\dependencies\tbb30_20100406oss\lib\ia32\vc10\;..\..\..\dependencies\tbb30_20100406oss\lib\ia32\vc10\;C:\Program\Microsoft DirectX SDK (June 2010)\Lib\x86;C:\Program Files\Microsoft DirectX SDK (June 2010)\Lib\x86;$(LibraryPath) - - - - - - - - Disabled - %(AdditionalIncludeDirectories) - true - Async - EnableFastChecks - true - MultiThreadedDebugDLL - NotSet - true - Use - true - Level3 - EditAndContinue - - - BlueHancUtils_d.lib;GLee.lib;Dxguid.lib;Dsound.lib;Winmm.lib;Ws2_32.lib;BlueVelvet3_d.lib;avformat-52.lib;avcodec-52.lib;avutil-50.lib;swscale-0.lib;%(AdditionalDependencies) - - - %(AdditionalLibraryDirectories) - LIBC.LIB;%(IgnoreSpecificDefaultLibraries) - true - $(TargetDir)$(TargetName).pdb - true - - - Windows - false - - - MachineX86 - - - - - - - - - - - - - MaxSpeed - AnySuitable - true - Speed - %(AdditionalIncludeDirectories) - Async - MultiThreadedDLL - StreamingSIMDExtensions2 - true - Use - Level3 - ProgramDatabase - true - true - %(PreprocessorDefinitions) - - - - - - - BlueHancUtils.lib;Dxguid.lib;Dsound.lib;Winmm.lib;Ws2_32.lib;Bluevelvet3.lib;avformat-52.lib;avcodec-52.lib;avutil-50.lib;swscale-0.lib;tbb.lib;Glee.lib;%(AdditionalDependencies) - - - %(AdditionalLibraryDirectories) - LIBC.lib;%(IgnoreSpecificDefaultLibraries) - true - true - true - Windows - - - - - false - false - - - MachineX86 - - - - - - - - - - - - - Disabled - AnySuitable - true - Speed - %(AdditionalIncludeDirectories) - DISABLE_BLUEFISH;%(PreprocessorDefinitions) - Async - MultiThreadedDLL - StreamingSIMDExtensions2 - true - Use - Level3 - ProgramDatabase - - - - - - - Dxguid.lib;Dsound.lib;Winmm.lib;Ws2_32.lib;avformat-52.lib;avcodec-52.lib;avutil-50.lib;swscale-0.lib;GLee.lib;tbb.lib;%(AdditionalDependencies) - - - %(AdditionalLibraryDirectories) - LIBC.lib;%(IgnoreSpecificDefaultLibraries) - true - true - true - Windows - - - - - false - false - - - MachineX86 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ..\..\StdAfx.h - ..\..\StdAfx.h - ..\..\StdAfx.h - - - ..\..\StdAfx.h - ..\..\StdAfx.h - ..\..\StdAfx.h - - - ../../../StdAfx.h - ../../../StdAfx.h - ../../../StdAfx.h - - - ../../StdAfx.h - ../../StdAfx.h - ../../StdAfx.h - - - ../../StdAfx.h - ../../StdAfx.h - ../../StdAfx.h - - - ../../StdAfx.h - ../../StdAfx.h - ../../StdAfx.h - - - ../../../StdAfx.h - ../../../StdAfx.h - ../../../StdAfx.h - - - ../../../StdAfx.h - ../../../StdAfx.h - ../../../StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - - - - - - - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - Use - ..\StdAfx.h - Use - ..\StdAfx.h - Use - ..\StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - Use - ..\StdAfx.h - Use - ..\StdAfx.h - Use - ..\StdAfx.h - - - Use - ..\StdAfx.h - Use - ..\StdAfx.h - Use - ..\StdAfx.h - - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - ..\..\StdAfx.h - ..\..\StdAfx.h - ..\..\StdAfx.h - - - ..\..\StdAfx.h - ..\..\StdAfx.h - ..\..\StdAfx.h - - - ..\..\StdAfx.h - ..\..\StdAfx.h - ..\..\StdAfx.h - - - Use - ..\..\StdAfx.h - Use - ..\..\StdAfx.h - Use - ..\..\StdAfx.h - - - Use - ..\..\StdAfx.h - Use - ..\..\StdAfx.h - Use - ..\..\StdAfx.h - - - Use - ..\..\StdAfx.h - Use - ..\..\StdAfx.h - Use - ..\..\StdAfx.h - - - Use - ..\..\StdAfx.h - Use - ..\..\StdAfx.h - Use - ..\..\StdAfx.h - - - Use - ..\..\StdAfx.h - Use - ..\..\StdAfx.h - Use - ..\..\StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - ..\..\stdafx.h - ..\..\stdafx.h - true - ..\..\stdafx.h - - - ..\..\stdafx.h - ..\..\stdafx.h - true - ..\..\stdafx.h - - - ..\..\StdAfx.h - ..\..\StdAfx.h - ..\..\StdAfx.h - - - ..\..\StdAfx.h - ..\..\StdAfx.h - ..\..\StdAfx.h - - - ..\..\StdAfx.h - ..\..\StdAfx.h - ..\..\StdAfx.h - - - - - - - - - - - ..\..\StdAfx.h - ..\..\StdAfx.h - ..\..\StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - ..\..\StdAfx.h - ..\..\StdAfx.h - ..\..\StdAfx.h - - - - - - - - - - - ..\..\StdAfx.h - ..\..\StdAfx.h - ..\..\StdAfx.h - - - ..\..\StdAfx.h - ..\..\StdAfx.h - ..\..\StdAfx.h - - - ..\..\StdAfx.h - ..\..\StdAfx.h - ..\..\StdAfx.h - - - ..\..\StdAfx.h - ..\..\StdAfx.h - ..\..\StdAfx.h - - - ..\..\StdAfx.h - ..\..\StdAfx.h - ..\..\StdAfx.h - - - ..\..\StdAfx.h - ..\..\StdAfx.h - ..\..\StdAfx.h - - - ..\..\StdAfx.h - ..\..\StdAfx.h - ..\..\StdAfx.h - - - true - ..\..\StdAfx.h - true - ..\..\StdAfx.h - true - ..\..\StdAfx.h - - - ..\..\StdAfx.h - ..\..\StdAfx.h - ..\..\StdAfx.h - - - ..\..\StdAfx.h - ..\..\StdAfx.h - ..\..\StdAfx.h - - - ..\..\StdAfx.h - ..\..\StdAfx.h - ..\..\StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - ..\StdAfx.h - ../StdAfx.h - ..\StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - ..\StdAfx.h - ../StdAfx.h - ../StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - ..\StdAfx.h - ..\StdAfx.h - ..\StdAfx.h - - - - - - - Create - Create - Create - - - - - - true - true - true - - - true - true - true - - - true - true - true - - - true - true - true - - - - - - \ No newline at end of file diff --git a/server/Server.vcxproj.filters b/server/Server.vcxproj.filters deleted file mode 100644 index 6f528bcca..000000000 --- a/server/Server.vcxproj.filters +++ /dev/null @@ -1,668 +0,0 @@ - - - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx - - - {de65234e-d9fe-4005-af84-09ea8eeda314} - - - {5322381c-6ced-444c-8f53-ae02ebdd1cd5} - - - {5782c398-5fef-43f1-b52e-0b099f648a93} - - - {de0e92f0-d699-4302-9362-d3bee8f8621d} - - - {4461591f-a286-4c8d-9f0a-303befed0603} - - - {d87ea4f0-ef3f-4647-9655-ac378bb21224} - - - {8454244b-d974-4c5c-8c8f-eb024eb304fe} - - - {642f599a-19a8-4082-acf5-e74e8666c4ac} - - - {f7d3bde2-2d03-4bac-808c-93ff623d7279} - - - {ff78e1a7-a8d8-4660-91f6-f374f0124d72} - - - {6f75412d-3d6d-4603-a638-c03d08598942} - - - {bbdb38a3-e939-426f-824c-13665bafdce1} - - - {b97c7904-7f85-4930-9966-8b00c0686a3b} - - - {442348e2-9459-42b2-b688-965775724270} - - - {73ab2334-4260-4806-86c5-d04316b05706} - - - {5f667ffb-04d6-4bdf-be40-47277b4aba35} - - - {ac3a349b-4646-4fc1-bdb1-2a3ea9c6e89d} - - - {d33e8ddc-ccb4-4f4f-ad20-e788a796bb7b} - - - {69627759-fb18-42fa-8339-66ce27062c90} - - - {8355a891-c4db-4a0e-8ecc-795314127cdc} - - - {a94bc00a-4753-4bce-a777-6a3ea2ceca59} - - - {5f57e8d6-78fb-4784-9dea-91e0c95d8aec} - - - {3d3dff86-9539-4103-9f5b-2feb7300782f} - - - {52231829-a35a-42e0-b828-84fc8088adb4} - - - - - resources - - - resources - - - - - resources - - - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils\image - - - utils\image - - - utils\image - - - utils\image - - - utils\image - - - utils\image - - - utils\image - - - utils\image - - - io - - - io - - - io - - - io - - - io - - - consumers\gdi - - - consumers\ogl - - - consumers\audio - - - consumers\decklink - - - consumers\decklink - - - cg - - - cg - - - producers\flash - - - producers\flash - - - producers\flash - - - producers\flash - - - producers\flash - - - producers\flash - - - producers\flash - - - producers\flash - - - producers\color - - - producers\targa - - - producers\composites - - - producers\composites - - - producers\targascroll - - - producers\targascroll - - - amcp - - - amcp - - - amcp - - - amcp - - - consumers\audio - - - consumers\audio - - - frame - - - frame - - - frame - - - frame - - - frame - - - frame - - - frame - - - frame - - - frame - - - frame - - - frame - - - frame - - - CLK - - - CLK - - - cii - - - cii - - - cii - - - - - - - - - - - - - - - - - - frame\buffers - - - frame\buffers - - - frame\buffers - - - - utils - - - utils - - - utils - - - utils - - - producers\ffmpeg - - - producers\ffmpeg - - - producers\ffmpeg - - - producers\ffmpeg\video - - - producers\ffmpeg\video - - - producers\ffmpeg\audio - - - producers\ffmpeg - - - consumers\bluefish - - - consumers\bluefish - - - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils - - - utils\image - - - utils\image - - - utils\image - - - utils\image - - - utils\image - - - utils\image - - - utils\image - - - utils\image - - - io - - - io - - - io - - - consumers\bluefish - - - consumers\bluefish - - - consumers\gdi - - - consumers\ogl - - - consumers\audio - - - consumers\decklink - - - consumers\decklink - - - cg - - - producers\flash - - - producers\flash - - - producers\flash - - - producers\flash - - - producers\flash - - - producers\flash - - - producers\flash - - - producers\color - - - producers\targa - - - producers\composites - - - producers\composites - - - producers\targascroll - - - producers\targascroll - - - amcp - - - amcp - - - amcp - - - consumers\audio - - - frame - - - frame - - - frame - - - frame - - - frame - - - frame - - - frame - - - frame - - - CLK - - - CLK - - - cii - - - cii - - - - - - - - - frame\buffers - - - frame\buffers - - - producers\ffmpeg - - - producers\ffmpeg - - - producers\ffmpeg\video - - - producers\ffmpeg\video - - - producers\ffmpeg\audio - - - producers\ffmpeg - - - - - consumers\decklink - - - consumers\decklink - - - consumers\decklink - - - producers\flash - - - - - consumers\bluefish - - - consumers\bluefish - - - consumers\bluefish - - - - \ No newline at end of file diff --git a/server/StdAfx.cpp b/server/StdAfx.cpp deleted file mode 100644 index 2bd615bcd..000000000 --- a/server/StdAfx.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -// stdafx.cpp : source file that includes just the standard includes -// dma.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/server/StdAfx.h b/server/StdAfx.h deleted file mode 100644 index 3e14200e1..000000000 --- a/server/StdAfx.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) -#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#ifdef _DEBUG -#include -#endif - -#include -#include -#include -#include - -#ifndef TEMPLATEHOST_VERSION -#define TEMPLATEHOST_VERSION 1700 -#endif - - -#ifndef _UNICODE -typedef std::ostringstream tstringstream; -typedef std::string tstring; -#else -typedef std::wostringstream tstringstream; -typedef std::wstring tstring; -#endif - -#include - -#include "utils\Logger.h" -#define LOG caspar::utils::Logger::GetInstance().GetStream(caspar::utils::LogLevel::Release) - - - #include - #include - - extern WTL::CAppModule _Module; - - #include - #include - - extern LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); - -namespace caspar -{ - class Application; - Application* GetApplication(); -}; -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/server/TransitionInfo.h b/server/TransitionInfo.h deleted file mode 100644 index ffe4a3145..000000000 --- a/server/TransitionInfo.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -#include - -namespace caspar { - -enum TransitionType -{ - Cut = 1, - Mix, - Push, - Slide, - Wipe -}; - -enum TransitionDirection -{ - FromLeft = 1, - FromRight, - FromTop, - FromBottom -}; - -class TransitionInfo -{ -public: - TransitionInfo() : type_(Cut), duration_(0), borderWidth_(0), borderColor_(TEXT("#00000000")), direction_(FromLeft) - {} - - ~TransitionInfo() - {} - - TransitionType type_; - unsigned short duration_; - unsigned short borderWidth_; - tstring borderImage_; - tstring borderColor_; - TransitionDirection direction_; -}; - -} //namespace caspar \ No newline at end of file diff --git a/server/VersionNo.h b/server/VersionNo.h deleted file mode 100644 index bd137335a..000000000 --- a/server/VersionNo.h +++ /dev/null @@ -1,29 +0,0 @@ -/*----------------------------------------------------------- - VERSION CONTROL BUILD SYSTEM - This header file was created by VERBUILD v1.0.1 - ----------------------------------------------------------- - help : verbuild -? - info : http://www.yeamaec.com - yeamaec@hanafos.com ,krkim@yeamaec.com ------------------------------------------------------------*/ - -#ifndef VERSIONNO__H -#define VERSIONNO__H - -#define VERSION_FULL 1.8.10082.884 - -#define VERSION_BASEYEAR 2000 -#define VERSION_DATE "2010-03-24" -#define VERSION_TIME "14:59:28" - -#define VERSION_MAJOR 1 -#define VERSION_MINOR 8 -#define VERSION_BUILDNO 10082 -#define VERSION_EXTEND 884 - -#define VERSION_FILE 1,8,10082,884 -#define VERSION_PRODUCT 1,5,7340,5 -#define VERSION_FILESTR "1,8,10082,884" -#define VERSION_PRODUCTSTR "1,8,0\0" - -#endif diff --git a/server/VideoConsumer.h b/server/VideoConsumer.h deleted file mode 100644 index 217e13a77..000000000 --- a/server/VideoConsumer.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef __VIDEO_CONSUMER_H__ -#define __VIDEO_CONSUMER_H__ - -namespace caspar { - -class IPlaybackControl; -class MediaProducer; - -class IVideoConsumer -{ -public: - virtual ~IVideoConsumer() {} - virtual IPlaybackControl* GetPlaybackControl() const = 0; - virtual void EnableVideoOutput() = 0; - virtual void DisableVideoOutput() = 0; - virtual bool SetupDevice(unsigned int deviceIndex) = 0; - virtual bool ReleaseDevice() = 0; - virtual const TCHAR* GetFormatDescription() const = 0; - - virtual bool SetVideoFormat(const tstring& strDesiredFrameFormat) - { - LOG << TEXT("SetVideoFormat is no supported"); - return false; - } -}; -typedef std::tr1::shared_ptr VideoConsumerPtr; - -} //namespace caspar -#endif //__VIDEO_CONSUMER_H__ \ No newline at end of file diff --git a/server/Window.cpp b/server/Window.cpp deleted file mode 100644 index d7e1856fe..000000000 --- a/server/Window.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "stdafx.h" - -#include "window.h" -#include "resource.h" - -namespace caspar { - -using namespace utils; - -Window::Window() : _hwnd(NULL), _hinstance(NULL), _hdc(NULL) -{ -} - -Window::~Window() -{ - Destroy(); -} - -bool Window::Initialize(HINSTANCE hinstance, const TCHAR* windowTitle, const TCHAR* className) -{ - _hinstance = hinstance; - _classname = className; - - WNDCLASSEX wndClass; // Window class - ZeroMemory(&wndClass, sizeof(wndClass)); // Clear the window class structure - wndClass.cbSize = sizeof(WNDCLASSEX); - wndClass.style = CS_HREDRAW | CS_VREDRAW | CS_CLASSDC; - wndClass.lpfnWndProc = (WNDPROC)WndProc; - wndClass.cbClsExtra = 0; - wndClass.cbWndExtra = 0; - wndClass.hInstance = _hinstance; - wndClass.hIcon = LoadIcon(_hinstance, MAKEINTRESOURCE(IDI_ICON1)); - wndClass.hCursor = LoadCursor(NULL, IDC_ARROW); - wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); - wndClass.lpszMenuName = NULL;//MAKEINTRESOURCE(IDR_MAINMENU); - wndClass.lpszClassName = _classname.c_str(); - wndClass.hIconSm = 0; - - if (RegisterClassEx(&wndClass) == 0)// Attemp to register the window class - { - LOG << TEXT("WINDOW ERROR: Failed to register the window class!") << LogStream::Flush; - return false; - } - DWORD dwStyle; // Window styles - DWORD dwExStyle; // Extended window styles - - dwStyle = WS_OVERLAPPEDWINDOW | // Creates an overlapping window - WS_CLIPCHILDREN | // Doesn"t draw within child windows - WS_CLIPSIBLINGS; // Doesn"t draw within sibling windows - dwExStyle = WS_EX_APPWINDOW | // Top level window - WS_EX_WINDOWEDGE; // Border with a raised edge - - //adjust window size - RECT rMain; - rMain.left = 0; - rMain.right = 720; - rMain.top = 0; - rMain.bottom = 576; - - AdjustWindowRect(&rMain, dwStyle, 0); - - // Attempt to create the actual window - _hwnd = CreateWindowEx( dwExStyle, // Extended window styles - _classname.c_str(), // Class name - windowTitle, // Window title (caption) - dwStyle, // Window styles - 0, 0, // Window position - rMain.right - rMain.left, - rMain.bottom - rMain.top, // Size of window - 0, // No parent window - 0, // No menu - _hinstance, // Instance - 0); // Pass nothing to WM_CREATE - - if(_hwnd == 0) - { - Destroy(); - LOG << TEXT("WINDOW ERROR: Unable to create window!") << LogStream::Flush; - return false; - } - - ShowWindow(_hwnd, SW_SHOW); - SetForegroundWindow(_hwnd); - SetFocus(_hwnd); - - - //TEST: select a more appropriate pixelformat - _hdc = ::GetDC(_hwnd); - - PIXELFORMATDESCRIPTOR pfd = - { - sizeof(PIXELFORMATDESCRIPTOR), //size of struct - 1, //version number - //PFD_DRAW_TO_WINDOW | //Format must support draw to window - PFD_DRAW_TO_BITMAP | //Format must support draw to bitmap - PFD_DOUBLEBUFFER_DONTCARE | //Format does not have to support doublebuffer - PFD_DEPTH_DONTCARE, //Formet does not have to support depthbuffer - PFD_TYPE_RGBA, //Request RGBA format - 24, //Color depth - 0,0,0,0,0,0, //colorbits ignored - 8, //8-bit alpha-buffer - 0, //shift bit ignored - 0, //no accumulation-buffer - 0,0,0,0, //Accumulation bits ignored - 0, //no depth-buffer - 0, //no stencil-buffer - 0, //no auxiliary-buffer - PFD_MAIN_PLANE, //Main drawing layer - 0, //RESERVED - 0,0,0 //Layer masks ignored - }; - - unsigned int nPixelFormat = ChoosePixelFormat(_hdc, &pfd); - if(nPixelFormat) { - if(!SetPixelFormat(_hdc, nPixelFormat, &pfd)) { - ; - } - } - //END TEST: select a more appropriate pixelformat -/* - //TEST: give flash access to a directdraw device - IDirectDrawFactory* pDDF = NULL; - pDD_ = NULL; - CComBSTR ddfGUID(_T("{4FD2A832-86C8-11d0-8FCA-00C04FD9189D}")); - CLSID clsid; - HRESULT hr = CLSIDFromString((LPOLESTR)ddfGUID, &clsid); - - hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, GUID_DDFactory, (void **)&pDDF); - if(pDDF != 0) { - pDDF->CreateDirectDraw(NULL, _hwnd, DDSCL_NORMAL, NULL, NULL, &pDD_); - pDDF->Release(); - } - //END TEST: give flash access to a directdraw device -*/ - return true; -} - -void Window::Destroy() -{ -/* if(pDD_ != 0) { - pDD_->Release(); - pDD_ = 0; - } -*/ - // Attempts to destroy the window - if(_hwnd) { - DestroyWindow(_hwnd); - _hwnd = NULL; - } - - // Attempts to unregister the window class - if (!UnregisterClass(_classname.c_str(), _hinstance)) - { - LOG << TEXT("WINDOW ERROR: Unable to unregister window class!") << LogStream::Flush; - _hinstance = NULL; - } -} - -} \ No newline at end of file diff --git a/server/Window.h b/server/Window.h deleted file mode 100644 index b98cdd151..000000000 --- a/server/Window.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - - -#pragma once - -#include -#include -//struct IDirectDraw; - -//extern const GUID GUID_DDFactory; -//extern const GUID GUID_DD3; - -namespace caspar -{ - class Window - { - public: - Window(); - virtual ~Window(); - - bool Initialize(HINSTANCE, const TCHAR* windowTitle, const TCHAR* className); - void Destroy(); - - HWND getHwnd() - { - return _hwnd; - } - HINSTANCE getInstance() - { - return _hinstance; - } - -// IDirectDraw* pDD_; - private: - HDC _hdc; - HWND _hwnd; - HINSTANCE _hinstance; - tstring _classname; - }; - - typedef std::tr1::shared_ptr WindowPtr; - -} //namespace caspar \ No newline at end of file diff --git a/server/amcp/AMCPCommand.h b/server/amcp/AMCPCommand.h deleted file mode 100644 index 3e7cc3246..000000000 --- a/server/amcp/AMCPCommand.h +++ /dev/null @@ -1,112 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef __AMCPCOMMAND_H__ -#define __AMCPCOMMAND_H__ - -#include "..\Channel.h" -#include "..\io\clientinfo.h" -#include -#include - -namespace caspar { -namespace amcp { - - enum AMCPCommandCondition { - ConditionGood = 1, - ConditionTemporarilyBad, - ConditionPermanentlyBad - }; - - enum AMCPCommandScheduling - { - Default = 0, - AddToQueue, - ImmediatelyAndClear - }; - - class AMCPCommand - { - AMCPCommand(const AMCPCommand&); - AMCPCommand& operator=(const AMCPCommand&); - public: - AMCPCommand(); - virtual ~AMCPCommand() {} - virtual bool Execute() = 0; - virtual AMCPCommandCondition CheckConditions() = 0; - - virtual bool NeedChannel() = 0; - virtual AMCPCommandScheduling GetDefaultScheduling() = 0; - virtual int GetMinimumParameters() = 0; - - void SendReply(); - - void AddParameter(const tstring& param) { - _parameters.push_back(param); - } - void SetClientInfo(caspar::IO::ClientInfoPtr& s) { - pClientInfo_ = s; - } - caspar::IO::ClientInfoPtr GetClientInfo() { - return pClientInfo_; - } - void SetChannel(const ChannelPtr& pChannel) { - pChannel_ = pChannel; - } - ChannelPtr GetChannel() { - return pChannel_; - } - void SetChannelIndex(unsigned int channelIndex) { - channelIndex_ = channelIndex; - } - unsigned int GetChannelIndex() { - return channelIndex_; - } - virtual void Clear(); - - AMCPCommandScheduling GetScheduling() - { - return scheduling_ == Default ? GetDefaultScheduling() : scheduling_; - } - void SetScheduling(AMCPCommandScheduling s) - { - scheduling_ = s; - } - - protected: - void SetReplyString(const tstring& str) { - replyString_ = str; - } - std::vector _parameters; - - private: - unsigned int channelIndex_; - caspar::IO::ClientInfoPtr pClientInfo_; - ChannelPtr pChannel_; - AMCPCommandScheduling scheduling_; - tstring replyString_; - }; - - typedef std::tr1::shared_ptr AMCPCommandPtr; - -} //namespace amcp -} //namespace caspar - -#endif //__AMCPCOMMAND_H__ \ No newline at end of file diff --git a/server/amcp/AMCPCommandQueue.cpp b/server/amcp/AMCPCommandQueue.cpp deleted file mode 100644 index 152b06baa..000000000 --- a/server/amcp/AMCPCommandQueue.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\stdafx.h" - -#include "AMCPCommandQueue.h" - -namespace caspar { -namespace amcp { - -using namespace utils; - -AMCPCommandQueue::AMCPCommandQueue() : newCommandEvent_(FALSE, FALSE) { -} - -AMCPCommandQueue::~AMCPCommandQueue() { - Stop(); -} - -bool AMCPCommandQueue::Start() { - if(commandPump_.IsRunning()) - return false; - - return commandPump_.Start(this); -} - -void AMCPCommandQueue::Stop() { - commandPump_.Stop(); -} - -void AMCPCommandQueue::AddCommand(AMCPCommandPtr pNewCommand) -{ - { - Lock lock(*this); - - if(pNewCommand->GetScheduling() == ImmediatelyAndClear) { - //Clears the queue, objects are deleted automatically - commands_.clear(); - - commands_.push_back(pNewCommand); - LOG << LogLevel::Verbose << TEXT("Cleared queue and added command"); - } - else { - commands_.push_back(pNewCommand); - LOG << LogLevel::Verbose << TEXT("Added command to end of queue"); - } - } - - SetEvent(newCommandEvent_); -} - -void AMCPCommandQueue::Run(HANDLE stopEvent) -{ - bool logTemporarilyBadState = true; - AMCPCommandPtr pCurrentCommand; - - LOG << LogLevel::Verbose << TEXT("CommandPump started"); - - while(WaitForSingleObject(stopEvent, 0) != WAIT_OBJECT_0) { - DWORD waitResult = WaitForSingleObject(newCommandEvent_, 50); - if(waitResult == WAIT_OBJECT_0) { - Lock lock(*this); - - if(commands_.size() > 0) { - LOG << LogLevel::Debug << TEXT("Found ") << commands_.size() << TEXT(" commands in queue"); - - AMCPCommandPtr pNextCommand = commands_.front(); - - if(pCurrentCommand == 0 || pNextCommand->GetScheduling() == ImmediatelyAndClear) { - pCurrentCommand = pNextCommand; - commands_.pop_front(); - } - } - } - - if(pCurrentCommand != 0) { - AMCPCommandCondition condition = pCurrentCommand->CheckConditions(); - if(condition == ConditionTemporarilyBad) { - if(logTemporarilyBadState) { - LOG << LogLevel::Debug << TEXT("Cound not execute command right now, waiting a sec"); - logTemporarilyBadState = false; - } - - //don't fail, just wait for a while and then try again - continue; - } - else if(condition == ConditionGood) { - if(pCurrentCommand->Execute()) { - LOG << LogLevel::Verbose << TEXT("Executed command"); - } - else { - LOG << LogLevel::Verbose << TEXT("Failed to executed command"); - } - } - else { //condition == ConditionPermanentlyBad - LOG << TEXT("Invalid commandobject"); - } - - pCurrentCommand->SendReply(); - pCurrentCommand.reset(); - - newCommandEvent_.Set(); - logTemporarilyBadState = true; - - LOG << LogLevel::Debug << TEXT("Ready for a new command"); - } - } - - LOG << LogLevel::Verbose << TEXT("CommandPump ended"); -} - -bool AMCPCommandQueue::OnUnhandledException(const std::exception& ex) throw() { - bool bDoRestart = true; - - try - { - LOG << LogLevel::Critical << TEXT("UNHANDLED EXCEPTION in commandqueue. Message: ") << ex.what(); - } - catch(...) - { - bDoRestart = false; - } - - return bDoRestart; -} - -} //namespace amcp -} //namespace caspar \ No newline at end of file diff --git a/server/amcp/AMCPCommandQueue.h b/server/amcp/AMCPCommandQueue.h deleted file mode 100644 index 934004dec..000000000 --- a/server/amcp/AMCPCommandQueue.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _AMCPCOMMANDQUEUE_H__ -#define _AMCPCOMMANDQUEUE_H__ - -#pragma once - -#include -#include "..\utils\thread.h" -#include "..\utils\Lockable.h" - -#include "AMCPCommand.h" - -namespace caspar { -namespace amcp { - -class AMCPCommandQueue : public utils::IRunnable, private utils::LockableObject -{ - AMCPCommandQueue(const AMCPCommandQueue&); - AMCPCommandQueue& operator=(const AMCPCommandQueue&); -public: - AMCPCommandQueue(); - ~AMCPCommandQueue(); - - bool Start(); - void Stop(); - void AddCommand(AMCPCommandPtr pCommand); - -private: - utils::Thread commandPump_; - virtual void Run(HANDLE stopEvent); - virtual bool OnUnhandledException(const std::exception& ex) throw(); - - utils::Event newCommandEvent_; - - //Needs synro-protection - std::list commands_; -}; -typedef std::tr1::shared_ptr AMCPCommandQueuePtr; - -} //namespace amcp -} //namespace caspar - -#endif //_AMCPCOMMANDQUEUE_H__ \ No newline at end of file diff --git a/server/amcp/AMCPCommandsImpl.cpp b/server/amcp/AMCPCommandsImpl.cpp deleted file mode 100644 index 63f854ea4..000000000 --- a/server/amcp/AMCPCommandsImpl.cpp +++ /dev/null @@ -1,1214 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\StdAfx.h" -#include "AMCPCommandsImpl.h" -#include "AMCPProtocolStrategy.h" -#include "..\MediaManager.h" -#include "..\Application.h" -#include "..\channel.h" -#include "..\FileInfo.h" -#include "..\utils\findwrapper.h" -#include "..\utils\fileexists.h" -#include "..\cg\cgcontrol.h" - -#include -#include -#include -#include -#include - -/* Return codes - -100 [action] Information om att något har hänt -101 [action] Information om att något har hänt, en rad data skickas - -202 [kommando] OK Kommandot har utförts -201 [kommando] OK Kommandot har utförts, och en rad data skickas tillbaka -200 [kommando] OK Kommandot har utförts, och flera rader data skickas tillbaka. Avslutas med tomrad - -400 ERROR Kommandot kunde inte förstås -401 [kommando] ERROR Ogiltig kanal -402 [kommando] ERROR Parameter saknas -403 [kommando] ERROR Ogiltig parameter -404 [kommando] ERROR Mediafilen hittades inte - -500 FAILED Internt serverfel -501 [kommando] FAILED Internt serverfel -502 [kommando] FAILED Oläslig mediafil - -600 [kommando] FAILED funktion ej implementerad -*/ - -namespace caspar { -namespace amcp { - -using namespace utils; - -AMCPCommand::AMCPCommand() : channelIndex_(0), scheduling_(Default) -{} - -void AMCPCommand::SendReply() { - if(pClientInfo_) { - if(replyString_.length() > 0) { - pClientInfo_->Send(replyString_); - } - } -} - -void AMCPCommand::Clear() { - pChannel_.reset(); - pClientInfo_.reset(); - channelIndex_ = 0; - _parameters.clear(); -} - -////////// -// LOAD -AMCPCommandCondition LoadCommand::CheckConditions() -{ - return ConditionGood; -} - -bool LoadCommand::Execute() -{ - if(!GetChannel()) - return false; - if(_parameters.size() < 1) - return false; - - bool bLoop = false; - FileInfo fileInfo; - MediaManagerPtr pMediaManager; - - tstring fullFilename = _parameters[0]; - - if(_parameters.size()>1) - { - transform(_parameters[1].begin(), _parameters[1].end(), _parameters[1].begin(), toupper); - if(_parameters[1] == TEXT("LOOP")) - bLoop = true; - } - - if(fullFilename[0] == TEXT('#')) - pMediaManager = GetApplication()->GetColorMediaManager(); - else - pMediaManager = GetApplication()->FindMediaFile(GetApplication()->GetMediaFolder()+fullFilename, &fileInfo); - - for(unsigned int i=0;i<_parameters.size();++i) - transform(_parameters[i].begin(), _parameters[i].end(), _parameters[i].begin(), toupper); - - if(pMediaManager != 0) - { - if(fileInfo.filetype.length()>0) - { - fullFilename += TEXT("."); - fullFilename += fileInfo.filetype; - } - - MediaProducerPtr pFP; - if(fullFilename[0] == TEXT('#')) - pFP = pMediaManager->CreateProducer(fullFilename); - else - pFP = pMediaManager->CreateProducer(GetApplication()->GetMediaFolder()+fullFilename); - - if(GetChannel()->Load(pFP, bLoop)) - { - LOG << LogLevel::Verbose << TEXT("Loaded ") << fullFilename << TEXT(" successfully"); - - SetReplyString(TEXT("202 LOAD OK\r\n")); - - GetChannel()->GetMonitor().Inform(LOAD, _parameters[0]); - return true; - } - else - { - LOG << LogLevel::Verbose << TEXT("Failed to load ") << fullFilename << TEXT(". It might be corrupt"); - - SetReplyString(TEXT("502 LOAD FAILED\r\n")); - return false; - } - } - //else - LOG << LogLevel::Verbose << TEXT("Could not find ") << fullFilename; - - SetReplyString(TEXT("404 LOAD ERROR\r\n")); - return false; - -} - -////////// -// LOADBG -AMCPCommandCondition LoadbgCommand::CheckConditions() -{ - return ConditionGood; -} - -bool LoadbgCommand::Execute() -{ - if(!GetChannel()) - return false; - if(_parameters.size() < 1) - return false; - - TransitionInfo transitionInfo; - - FileInfo fileInfo; - MediaManagerPtr pMediaManager; - - tstring fullFilename = _parameters[0]; - - bool bLoop = false; - unsigned short transitionParameterIndex = 1; - - if(_parameters.size()>1) - { - transform(_parameters[1].begin(), _parameters[1].end(), _parameters[1].begin(), toupper); - if(_parameters[1] == TEXT("LOOP")) - { - ++transitionParameterIndex; - bLoop = true; - } - } - - if(fullFilename[0] == TEXT('#')) - pMediaManager = GetApplication()->GetColorMediaManager(); - else - pMediaManager = GetApplication()->FindMediaFile(GetApplication()->GetMediaFolder()+fullFilename, &fileInfo); - - //Setup transition info - if(_parameters.size()>transitionParameterIndex) //type - { - tstring transitionType = _parameters[transitionParameterIndex]; - transform(transitionType.begin(), transitionType.end(), transitionType.begin(), toupper); - - if(transitionType == TEXT("CUT")) - transitionInfo.type_ = Cut; - else if(transitionType == TEXT("MIX")) - transitionInfo.type_ = Mix; - else if(transitionType == TEXT("PUSH")) - transitionInfo.type_ = Push; - else if(transitionType == TEXT("SLIDE")) - transitionInfo.type_ = Slide; - else if(transitionType == TEXT("WIPE")) - transitionInfo.type_ = Wipe; - - if(_parameters.size() > static_cast(transitionParameterIndex+1)) //duration - { - int duration = _ttoi(_parameters[transitionParameterIndex+1].c_str()); - if(duration > 0) - transitionInfo.duration_ = duration; - - if(_parameters.size() > static_cast(transitionParameterIndex+2)) //direction - { - tstring direction = _parameters[transitionParameterIndex+2]; - transform(direction.begin(), direction.end(), direction.begin(), toupper); - - if(direction == TEXT("FROMLEFT")) - transitionInfo.direction_ = FromLeft; - else if(direction == TEXT("FROMRIGHT")) - transitionInfo.direction_ = FromRight; - else if(direction == TEXT("LEFT")) - transitionInfo.direction_ = FromRight; - else if(direction == TEXT("RIGHT")) - transitionInfo.direction_ = FromLeft; - - if(_parameters.size() > static_cast(transitionParameterIndex+3)) //border - { - tstring border = _parameters[transitionParameterIndex+3]; - if(border.size()>0) - { - if(border[0] == TEXT('#')) - transitionInfo.borderColor_ = border; - else - transitionInfo.borderImage_ = border; - } - - if(_parameters.size() > static_cast(transitionParameterIndex+4)) //border width - { - transitionInfo.borderWidth_ = _ttoi(_parameters[transitionParameterIndex+4].c_str()); - } - } - } - } - } - - //Perform loading of the clip - if(pMediaManager != 0) - { - if(fileInfo.filetype.length()>0) - { - fullFilename += TEXT("."); - fullFilename += fileInfo.filetype; - } - - MediaProducerPtr pFP; - if(fullFilename[0] == TEXT('#')) - pFP = pMediaManager->CreateProducer(fullFilename); - else - pFP = pMediaManager->CreateProducer(GetApplication()->GetMediaFolder()+fullFilename); - - if(GetChannel()->LoadBackground(pFP, transitionInfo, bLoop)) - { - LOG << LogLevel::Verbose << TEXT("Loaded ") << fullFilename << TEXT(" successfully to background"); - SetReplyString(TEXT("202 LOADBG OK\r\n")); - - GetChannel()->GetMonitor().Inform(LOADBG, _parameters[0]); - return true; - } - else - { - LOG << LogLevel::Verbose << TEXT("Failed to load ") << fullFilename << TEXT(" to background. It might be corrupt"); - SetReplyString(TEXT("502 LOADBG FAILED\r\n")); - return false; - } - } - //else - LOG << LogLevel::Verbose << TEXT("Could not find ") << fullFilename; - SetReplyString(TEXT("404 LOADBG ERROR\r\n")); - return false; - -} - -////////// -// PLAY -AMCPCommandCondition PlayCommand::CheckConditions() -{ - return ConditionGood; -} - -bool PlayCommand::Execute() -{ - if(!GetChannel()) - return false; - - if(GetChannel()->Play()) - { - SetReplyString(TEXT("202 PLAY OK\r\n")); - return true; - } - - SetReplyString(TEXT("501 PLAY FAILED\r\n")); - return false; -} - -////////// -// STOP -AMCPCommandCondition StopCommand::CheckConditions() -{ - return ConditionGood; -} - -bool StopCommand::Execute() -{ - if(!GetChannel()) - return false; - - if(GetChannel()->Stop()) - { - SetReplyString(TEXT("202 STOP OK\r\n")); - return true; - } - - SetReplyString(TEXT("501 STOP FAILED\r\n")); - return false; -} - -////////// -// CLEAR -AMCPCommandCondition ClearCommand::CheckConditions() -{ - return ConditionGood; -} - -bool ClearCommand::Execute() -{ - if(!GetChannel()) - return false; - - if(GetChannel()->Clear()) - { - SetReplyString(TEXT("202 CLEAR OK\r\n")); - - GetChannel()->GetMonitor().Inform(CLEAR); - return true; - } - - SetReplyString(TEXT("501 CLEAR FAILED\r\n")); - return false; -} - -////////// -// PARAM -AMCPCommandCondition ParamCommand::CheckConditions() -{ - return ConditionGood; -} - -bool ParamCommand::Execute() -{ - if(_parameters.size() < 1) - return false; - - if(!GetChannel()) - return false; - - if(GetChannel()->Param(_parameters[0])) - { - SetReplyString(TEXT("202 PARAM OK\r\n")); - return true; - } - - SetReplyString(TEXT("501 PARAM FAILED\r\n")); - return true; -} - -////////// -// CG -AMCPCommandCondition CGCommand::CheckConditions() -{ - return ConditionGood; -} - -bool CGCommand::Execute() -{ - if(_parameters.size() < 1) - return false; - if(!GetChannel()) - return false; - - tstring command = _parameters[0]; - std::transform(command.begin(), command.end(), command.begin(), toupper); - if(command == TEXT("ADD")) - return ExecuteAdd(); - else if(command == TEXT("PLAY")) - return ExecutePlay(); - else if(command == TEXT("STOP")) - return ExecuteStop(); - else if(command == TEXT("NEXT")) - return ExecuteNext(); - else if(command == TEXT("REMOVE")) - return ExecuteRemove(); - else if(command == TEXT("CLEAR")) - return ExecuteClear(); - else if(command == TEXT("UPDATE")) - return ExecuteUpdate(); - else if(command == TEXT("INVOKE")) - return ExecuteInvoke(); - else if(command == TEXT("INFO")) - return ExecuteInfo(); - - SetReplyString(TEXT("403 CG ERROR\r\n")); - return false; -} - -bool CGCommand::ValidateLayer(const tstring& layerstring) { - int length = layerstring.length(); - for(int i = 0; i < length; ++i) { - if(!_istdigit(layerstring[i])) { - return false; - } - } - - return true; -} - -bool CGCommand::ExecuteAdd() { - //CG 1 ADD 0 "templatefolder/templatename" [STARTLABEL] 0/1 [DATA] - - int layer = 0; //_parameters[1] -// tstring templateName; //_parameters[2] - tstring label; //_parameters[3] - bool bDoStart = false; //_parameters[3] alt. _parameters[4] -// tstring data; //_parameters[4] alt. _parameters[5] - - if(_parameters.size() < 4) { - SetReplyString(TEXT("402 CG ERROR\r\n")); - return false; - } - unsigned int dataIndex = 4; - - if(!ValidateLayer(_parameters[1])) { - SetReplyString(TEXT("403 CG ERROR\r\n")); - return false; - } - - layer = _ttoi(_parameters[1].c_str()); - - if(_parameters[3].length() > 1) { //read label - label = _parameters[3]; - ++dataIndex; - - if(_parameters.size() > 4 && _parameters[4].length() > 0) //read play-on-load-flag - bDoStart = (_parameters[4][0]==TEXT('1')) ? true : false; - else { - SetReplyString(TEXT("402 CG ERROR\r\n")); - return false; - } - } - else if(_parameters[3].length() > 0) { //read play-on-load-flag - bDoStart = (_parameters[3][0]==TEXT('1')) ? true : false; - } - else { - SetReplyString(TEXT("403 CG ERROR\r\n")); - return false; - } - - const TCHAR* pDataString = 0; - tstringstream data; - tstring dataFromFile; - if(_parameters.size() > dataIndex) { //read data - const tstring& dataString = _parameters[dataIndex]; - - if(dataString[0] == TEXT('<')) { - //the data is an XML-string - pDataString = dataString.c_str(); - } - else { - //The data is not an XML-string, it must be a filename - tstring filename = GetApplication()->GetDataFolder(); - filename.append(dataString); - filename.append(TEXT(".ftd")); - - //open file - std::wifstream datafile(filename.c_str()); - if(datafile) { - //read all data - data << datafile.rdbuf(); - datafile.close(); - - //extract data to _parameters - dataFromFile = data.str(); - pDataString = dataFromFile.c_str(); - } - } - } - - tstring fullFilename = GetApplication()->GetTemplateFolder() + _parameters[2]; - tstring extension; - if(GetApplication()->FindTemplate(fullFilename, &extension)) - { - tstring filename = _parameters[2]; - filename.append(extension); - - GetChannel()->GetCGControl()->Add(layer, filename, bDoStart, label, (pDataString!=0) ? pDataString : TEXT("")); - SetReplyString(TEXT("202 CG OK\r\n")); - - GetChannel()->GetMonitor().Inform(CG_ADD, _parameters[2]); - } - else - { - LOG << LogLevel::Verbose << TEXT("Could not find template ") << _parameters[2]; - SetReplyString(TEXT("404 CG ERROR\r\n")); - } - return true; -} - -bool CGCommand::ExecutePlay() { - if(_parameters.size() > 1) { - if(!ValidateLayer(_parameters[1])) { - SetReplyString(TEXT("403 CG ERROR\r\n")); - return false; - } - int layer = _ttoi(_parameters[1].c_str()); - GetChannel()->GetCGControl()->Play(layer); - } - else { - SetReplyString(TEXT("402 CG ERROR\r\n")); - return true; - } - - SetReplyString(TEXT("202 CG OK\r\n")); - return true; -} - -bool CGCommand::ExecuteStop() { - if(_parameters.size() > 1) { - if(!ValidateLayer(_parameters[1])) { - SetReplyString(TEXT("403 CG ERROR\r\n")); - return false; - } - int layer = _ttoi(_parameters[1].c_str()); - GetChannel()->GetCGControl()->Stop(layer, 0); - } - else { - SetReplyString(TEXT("402 CG ERROR\r\n")); - return true; - } - - SetReplyString(TEXT("202 CG OK\r\n")); - return true; -} - -bool CGCommand::ExecuteNext() { - if(_parameters.size() > 1) { - if(!ValidateLayer(_parameters[1])) { - SetReplyString(TEXT("403 CG ERROR\r\n")); - return false; - } - int layer = _ttoi(_parameters[1].c_str()); - GetChannel()->GetCGControl()->Next(layer); - } - else { - SetReplyString(TEXT("402 CG ERROR\r\n")); - return true; - } - - SetReplyString(TEXT("202 CG OK\r\n")); - return true; -} - -bool CGCommand::ExecuteRemove() { - if(_parameters.size() > 1) { - if(!ValidateLayer(_parameters[1])) { - SetReplyString(TEXT("403 CG ERROR\r\n")); - return false; - } - int layer = _ttoi(_parameters[1].c_str()); - GetChannel()->GetCGControl()->Remove(layer); - } - else { - SetReplyString(TEXT("402 CG ERROR\r\n")); - return true; - } - - SetReplyString(TEXT("202 CG OK\r\n")); - return true; -} - -bool CGCommand::ExecuteClear() { - GetChannel()->GetCGControl()->Clear(); - SetReplyString(TEXT("202 CG OK\r\n")); - GetChannel()->GetMonitor().Inform(CG_CLEAR); - return true; -} - -bool CGCommand::ExecuteUpdate() { - if(_parameters.size() > 2) { - if(!ValidateLayer(_parameters[1])) { - SetReplyString(TEXT("403 CG ERROR\r\n")); - return false; - } - int layer = _ttoi(_parameters[1].c_str()); - //TODO: Implement indirect data loading from file. Same as in Add - GetChannel()->GetCGControl()->Update(layer, _parameters[2]); - } - else { - SetReplyString(TEXT("402 CG ERROR\r\n")); - return true; - } - - SetReplyString(TEXT("202 CG OK\r\n")); - return true; -} - -bool CGCommand::ExecuteInvoke() { - if(_parameters.size() > 2) { - if(!ValidateLayer(_parameters[1])) { - SetReplyString(TEXT("403 CG ERROR\r\n")); - return false; - } - int layer = _ttoi(_parameters[1].c_str()); - GetChannel()->GetCGControl()->Invoke(layer, _parameters[2]); - } - else { - SetReplyString(TEXT("402 CG ERROR\r\n")); - return true; - } - - SetReplyString(TEXT("202 CG OK\r\n")); - return true; -} - -bool CGCommand::ExecuteInfo() { -// GetChannel()->GetCGControl()->Info(); - SetReplyString(TEXT("600 CG FAILED\r\n")); - return true; -} - -////////// -// DATA -AMCPCommandCondition DataCommand::CheckConditions() -{ - return ConditionGood; -} - -bool DataCommand::Execute() -{ - if(_parameters.size() < 1) - return false; - - tstring command = _parameters[0]; - std::transform(command.begin(), command.end(), command.begin(), toupper); - if(command == TEXT("STORE")) - return ExecuteStore(); - else if(command == TEXT("RETRIEVE")) - return ExecuteRetrieve(); - else if(command == TEXT("LIST")) - return ExecuteList(); - - SetReplyString(TEXT("403 DATA ERROR\r\n")); - return false; -} - -bool DataCommand::ExecuteStore() { - if(_parameters.size() < 3) { - SetReplyString(TEXT("402 DATA STORE ERROR\r\n")); - return false; - } - - tstring filename = GetApplication()->GetDataFolder(); - filename.append(_parameters[1]); - filename.append(TEXT(".ftd")); - - std::wofstream datafile(filename.c_str()); - if(!datafile) { - SetReplyString(TEXT("501 DATA STORE FAILED\r\n")); - return false; - } - - datafile << _parameters[2]; - datafile.close(); - - tstring replyString = TEXT("202 DATA STORE OK\r\n"); - SetReplyString(replyString); - return true; -} - -bool DataCommand::ExecuteRetrieve() { - if(_parameters.size() < 2) { - SetReplyString(TEXT("402 DATA RETRIEVE ERROR\r\n")); - return false; - } - - tstring filename = GetApplication()->GetDataFolder(); - filename.append(_parameters[1]); - filename.append(TEXT(".ftd")); - - std::wifstream datafile(filename.c_str()); - if(!datafile) { - SetReplyString(TEXT("404 DATA RETRIEVE ERROR\r\n")); - return false; - } - - tstringstream reply(TEXT("201 DATA RETRIEVE OK\r\n")); - tstring line; - bool bFirstLine = true; - while(std::getline(datafile, line)) { - if(!bFirstLine) - reply << "\\n"; - else - bFirstLine = false; - - reply << line; - } - datafile.close(); - - reply << "\r\n"; - SetReplyString(reply.str()); - return true; -} - -bool DataCommand::ExecuteList() { - tstringstream replyString; - replyString << TEXT("200 DATA LIST OK\r\n"); - - WIN32_FIND_DATA fileInfo; - caspar::utils::FindWrapper findWrapper(GetApplication()->GetDataFolder() + TEXT("*.ftd"), &fileInfo); - if(findWrapper.Success()) - { - do - { - tstring filename = fileInfo.cFileName; - transform(filename.begin(), filename.end(), filename.begin(), toupper); - - tstring::size_type pos = filename.rfind(TEXT(".")); - if(pos != tstring::npos) - { - TCHAR numBuffer[32]; - TCHAR timeBuffer[32]; - TCHAR dateBuffer[32]; - - unsigned __int64 fileSize = fileInfo.nFileSizeHigh; - fileSize *= 0x100000000; - fileSize += fileInfo.nFileSizeLow; - - _ui64tot_s(fileSize, numBuffer, 32, 10); - - SYSTEMTIME lastWriteTime; - FileTimeToSystemTime(&(fileInfo.ftLastWriteTime), &lastWriteTime); - GetDateFormat(LOCALE_USER_DEFAULT, 0, &lastWriteTime, _T("yyyyMMdd"), dateBuffer, sizeof(dateBuffer)); - GetTimeFormat(LOCALE_USER_DEFAULT, 0, &lastWriteTime, _T("HHmmss"), timeBuffer, sizeof(timeBuffer)); - - replyString << TEXT("\"") << filename.substr(0, pos) << TEXT("\" ") << numBuffer << TEXT(" ") << dateBuffer << timeBuffer << TEXT("\r\n"); - } - } - while(findWrapper.FindNext(&fileInfo)); - } - replyString << TEXT("\r\n"); - - SetReplyString(replyString.str()); - return true; -} - -////////// -// CINF -AMCPCommandCondition CinfCommand::CheckConditions() -{ - return ConditionGood; -} - -bool CinfCommand::Execute() -{ - tstringstream replyString; - - if(_parameters.size() < 1) - return false; - - tstring filename = GetApplication()->GetMediaFolder()+_parameters[0]; - - FileInfo fileInfo; - - MediaManagerPtr pMediaManager = GetApplication()->FindMediaFile(filename, &fileInfo); - if(pMediaManager != 0 && fileInfo.filetype.length() >0) //File was found - { - if(pMediaManager->getFileInfo(&fileInfo)) - { - TCHAR numBuffer[32]; - _ui64tot_s(fileInfo.size, numBuffer, 32, 10); - - replyString << TEXT("201 CINF OK\r\n\"") << fileInfo.filename << TEXT("\" ") << fileInfo.type << TEXT("/") << fileInfo.filetype << TEXT("/") << fileInfo.encoding << TEXT(" ") << numBuffer << TEXT("\r\n"); - - SetReplyString(replyString.str()); - return true; - } - } - - SetReplyString(TEXT("404 CINF ERROR\r\n")); - return false; -} - -////////// -// INFO -AMCPCommandCondition InfoCommand::CheckConditions() -{ - return ConditionGood; -} - -bool InfoCommand::Execute() -{ - tstringstream replyString; - - if(_parameters.size() >= 1) - { - int channelIndex = _ttoi(_parameters[0].c_str())-1; - ChannelPtr pChannel = GetApplication()->GetChannel(static_cast(channelIndex)); - - if(pChannel != 0) - { - replyString << TEXT("201 INFO OK\r\n"); - GenerateChannelInfo(pChannel, replyString); - } - else - { - SetReplyString(TEXT("401 INFO ERROR\r\n")); - return false; - } - } - else - { - replyString << TEXT("200 INFO OK\r\n"); - - ChannelPtr pChannel; - unsigned int channelIndex = 0; - while((pChannel = GetApplication()->GetChannel(channelIndex++)) != 0) - { - GenerateChannelInfo(pChannel, replyString); - } - replyString << TEXT("\r\n"); - } - - SetReplyString(replyString.str()); - return true; -} - -void InfoCommand::GenerateChannelInfo(ChannelPtr& pChannel, tstringstream& replyString) -{ - replyString << pChannel->GetIndex() << TEXT(" ") << pChannel->GetFormatDescription() << (pChannel->IsPlaybackRunning() ? TEXT(" PLAYING") : TEXT(" STOPPED")) << TEXT("\r\n"); -} - -////////// -// CLS -AMCPCommandCondition ClsCommand::CheckConditions() -{ - return ConditionGood; -} - -bool ClsCommand::Execute() -{ - /* - wav = audio - mp3 = audio - swf = movie - dv = movie - tga = still - col = still - */ - tstring cliptype[4] = { _T(" N/A "), _T(" AUDIO "), _T(" MOVIE "), _T(" STILL ") }; - - - tstringstream replyString; - replyString << TEXT("200 CLS OK\r\n"); - - WIN32_FIND_DATA fileInfo; - caspar::utils::FindWrapper findWrapper(GetApplication()->GetMediaFolder() + TEXT("*.*"), &fileInfo); - if(findWrapper.Success()) - { - unsigned char cliptypeindex = 0; - bool bGood = false; - - do - { - tstring filename = fileInfo.cFileName; - - transform(filename.begin(), filename.end(), filename.begin(), toupper); - - tstring::size_type pos = filename.rfind(TEXT(".")); - if(pos != tstring::npos) - { - tstring extension = filename.substr(pos+1); - if(extension == TEXT("TGA") || extension == TEXT("COL")) - { - cliptypeindex = 3; - bGood = true; - } - else if(extension == TEXT("SWF") || extension == TEXT("CT") || extension == TEXT("DV") || extension == TEXT("MOV") || extension == TEXT("MPG") || extension == TEXT("AVI")) - { - cliptypeindex = 2; - bGood = true; - } - else if(extension == TEXT("WAV") || extension == TEXT("MP3")) - { - cliptypeindex = 1; - bGood = true; - } - - if(bGood) - { - TCHAR numBuffer[32]; - TCHAR timeBuffer[32]; - TCHAR dateBuffer[32]; - - unsigned __int64 fileSize = fileInfo.nFileSizeHigh; - fileSize *= 0x100000000; - fileSize += fileInfo.nFileSizeLow; - - _ui64tot_s(fileSize, numBuffer, 32, 10); - - SYSTEMTIME lastWriteTime; - FileTimeToSystemTime(&(fileInfo.ftLastWriteTime), &lastWriteTime); - GetDateFormat(LOCALE_USER_DEFAULT, 0, &lastWriteTime, _T("yyyyMMdd"), dateBuffer, sizeof(dateBuffer)); - GetTimeFormat(LOCALE_USER_DEFAULT, 0, &lastWriteTime, _T("HHmmss"), timeBuffer, sizeof(timeBuffer)); - - replyString << TEXT("\"") << filename.substr(0, pos) << TEXT("\" ") << cliptype[cliptypeindex] << TEXT(" ") << numBuffer << TEXT(" ") << dateBuffer << timeBuffer << TEXT("\r\n"); - - cliptypeindex = 0; - bGood = false; - } - } - } - while(findWrapper.FindNext(&fileInfo)); - } - replyString << TEXT("\r\n"); - - SetReplyString(replyString.str()); - return true; -} - -////////// -// TLS -AMCPCommandCondition TlsCommand::CheckConditions() -{ - return ConditionGood; -} - -bool TlsCommand::Execute() -{ - tstringstream replyString; - replyString << TEXT("200 TLS OK\r\n"); - - FindInDirectory(TEXT(""), replyString); - replyString << TEXT("\r\n"); - - SetReplyString(replyString.str()); - return true; -} - -void TlsCommand::FindInDirectory(const tstring& dir, tstringstream& replyString) { - { //Find files in directory - WIN32_FIND_DATA fileInfo; - caspar::utils::FindWrapper findWrapper(GetApplication()->GetTemplateFolder() + dir + TEXT("*.ft"), &fileInfo); - if(findWrapper.Success()) - { - do - { - if(((fileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY) && ((fileInfo.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) != FILE_ATTRIBUTE_HIDDEN)) { - tstring filename = fileInfo.cFileName; - - transform(filename.begin(), filename.end(), filename.begin(), toupper); - - TCHAR numBuffer[32]; - TCHAR timeBuffer[32]; - TCHAR dateBuffer[32]; - - unsigned __int64 fileSize = fileInfo.nFileSizeHigh; - fileSize *= 0x100000000; - fileSize += fileInfo.nFileSizeLow; - - _ui64tot_s(fileSize, numBuffer, 32, 10); - - SYSTEMTIME lastWriteTime; - FileTimeToSystemTime(&(fileInfo.ftLastWriteTime), &lastWriteTime); - GetDateFormat(LOCALE_USER_DEFAULT, 0, &lastWriteTime, _T("yyyyMMdd"), dateBuffer, sizeof(dateBuffer)); - GetTimeFormat(LOCALE_USER_DEFAULT, 0, &lastWriteTime, _T("HHmmss"), timeBuffer, sizeof(timeBuffer)); - - replyString << TEXT("\"") << dir << filename.substr(0, filename.size()-3) << TEXT("\" ") << numBuffer << TEXT(" ") << dateBuffer << timeBuffer << TEXT("\r\n"); - } - } - while(findWrapper.FindNext(&fileInfo)); - } - } - - { //Find subdirectories in directory - WIN32_FIND_DATA fileInfo; - caspar::utils::FindWrapper findWrapper(GetApplication()->GetTemplateFolder() + dir + TEXT("*"), &fileInfo); - if(findWrapper.Success()) - { - do - { - if((fileInfo.cFileName[0] != TEXT('.')) && ((fileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) && ((fileInfo.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) != FILE_ATTRIBUTE_HIDDEN)) { - FindInDirectory(dir + fileInfo.cFileName + TEXT('\\'), replyString); - } - } - while(findWrapper.FindNext(&fileInfo)); - } - } -} - -////////// -// VERSION -AMCPCommandCondition VersionCommand::CheckConditions() -{ - return ConditionGood; -} - -bool VersionCommand::Execute() -{ - tstringstream replyString; - replyString << TEXT("201 VERSION OK\r\n") << GetApplication()->GetVersionString() << TEXT("\r\n"); - - SetReplyString(replyString.str()); - return true; -} - -////////// -// BYE -AMCPCommandCondition ByeCommand::CheckConditions() -{ - return ConditionGood; -} - -bool ByeCommand::Execute() -{ - GetClientInfo()->Disconnect(); - return true; -} - - -////////// -// SET - -AMCPCommandCondition SetCommand::CheckConditions() -{ - return ConditionGood; -} - -bool SetCommand::Execute() -{ - tstring name = _parameters[0]; - std::transform(name.begin(), name.end(), name.begin(), toupper); - - tstring value = _parameters[1]; - std::transform(value.begin(), value.end(), value.begin(), toupper); - - if(name == TEXT("MODE")) - { - if(this->GetChannel()->SetVideoFormat(value)) - this->SetReplyString(TEXT("202 SET MODE OK\r\n")); - else - this->SetReplyString(TEXT("501 SET MODE FAILED\r\n")); - } - else - { - this->SetReplyString(TEXT("403 SET ERROR\r\n")); - } - - return true; -} - -/////////// -// MONITOR -AMCPCommandCondition MonitorCommand::CheckConditions() -{ - return ConditionGood; -} - -bool MonitorCommand::Execute() -{ - if(!GetChannel()) - return false; - - tstring cmd = _parameters[0]; - std::transform(cmd.begin(), cmd.end(), cmd.begin(), toupper); - - if(cmd == TEXT("START")) { - GetChannel()->GetMonitor().AddListener(GetClientInfo()); - SetReplyString(TEXT("202 MONITOR START OK\r\n")); - } - else if(cmd == TEXT("STOP")) { - GetChannel()->GetMonitor().RemoveListener(GetClientInfo()); - SetReplyString(TEXT("202 MONITOR STOP OK\r\n")); - } - else - SetReplyString(TEXT("403 MONITOR ERROR\r\n")); - - return true; -} - -////////// -// KILL -//AMCPCommandCondition KillCommand::CheckConditions() -//{ -// return ConditionGood; -//} -// -//bool KillCommand::Execute() -//{ -// //int* pS = 0; -// //*pS = 42; -// caspar::GetApplication()->GetTerminateEvent().Set(); -// return true; -//} - -/* -////////// -// FLS -AMCPCommandCondition FlsCommand::CheckConditions() -{ - return ConditionGood; -} - -bool FlsCommand::Execute() -{ - tstring returnMessage = "200 FLS OK"; - returnMessage += "\r\n"; - - tstring searchPattern = "*.*"; - tstring directory = ""; - - if(_parameters.size() >= 1) { - tstring::size_type separatorIndex = _parameters[0].find_last_of('\\'); - if(separatorIndex != tstring::npos) { - directory = _parameters[0].substr(0, separatorIndex+1); - if(_parameters[0].length() > (separatorIndex+1)) - searchPattern = _parameters[0].substr(separatorIndex+1); - } - else - searchPattern = _parameters[0]; - } - - FindFilesInDirectory(directory, searchPattern, returnMessage); - SetReplyString(returnMessage); - - return true; -} - -void FlsCommand::FindFilesInDirectory(const tstring& dir, const tstring& pattern, tstring& result) -{ - WIN32_FIND_DATA fileInfo; - - tstring searchPattern = pattern; - if(dir.length() > 0) { - searchPattern = dir + '\\' + pattern; - } - HANDLE hFile = FindFirstFile(searchPattern.c_str(), &fileInfo); - if(hFile != INVALID_HANDLE_VALUE) - { - do - { - if((fileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) { - if(fileInfo.cFileName[0] != '.') { - tstring completeDir = fileInfo.cFileName; - if(dir.length() > 0) { - completeDir = dir + '\\' + completeDir; - } - - FindFilesInDirectory(completeDir, pattern, result); - } - } - else { - tstring filename = fileInfo.cFileName; - if(dir.length() > 0) { - filename = dir + '\\' + filename; - } - - transform(filename.begin(), filename.end(), filename.begin(), toupper); - - char numBuffer[32]; - TCHAR timeBuffer[32]; - TCHAR dateBuffer[32]; - - _itoa_s(fileInfo.nFileSizeLow, numBuffer, sizeof(numBuffer), 10); - - SYSTEMTIME lastWriteTime; - FileTimeToSystemTime(&(fileInfo.ftLastWriteTime), &lastWriteTime); - GetDateFormat(LOCALE_USER_DEFAULT, 0, &lastWriteTime, _T("yyyyMMdd"), dateBuffer, sizeof(dateBuffer)); - GetTimeFormat(LOCALE_USER_DEFAULT, 0, &lastWriteTime, _T("HHmmss"), timeBuffer, sizeof(timeBuffer)); - - result += "\""; - result += filename; - result += "\" "; - - result += numBuffer; - result += " "; - result += dateBuffer; - result += timeBuffer; - result += "\r\n"; - } - } - while(FindNextFile(hFile, &fileInfo)); - } - FindClose(hFile); -} - -*/ - -} //namespace amcp -} //namespace caspar \ No newline at end of file diff --git a/server/amcp/AMCPCommandsImpl.h b/server/amcp/AMCPCommandsImpl.h deleted file mode 100644 index 85fec8daf..000000000 --- a/server/amcp/AMCPCommandsImpl.h +++ /dev/null @@ -1,366 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef __AMCPCOMMANDSIMPL_H__ -#define __AMCPCOMMANDSIMPL_H__ - -#include "AMCPCommand.h" - -namespace caspar { -namespace amcp { - - -class LoadCommand : public AMCPCommand -{ -public: - LoadCommand() {} - virtual bool Execute(); - virtual AMCPCommandCondition CheckConditions(); - virtual bool NeedChannel() { - return true; - } - virtual AMCPCommandScheduling GetDefaultScheduling() { - return ImmediatelyAndClear; - } - virtual int GetMinimumParameters() { - return 1; - } -}; - -class LoadbgCommand : public AMCPCommand -{ -public: - LoadbgCommand() {} - virtual bool Execute(); - virtual AMCPCommandCondition CheckConditions(); - - virtual bool NeedChannel() { - return true; - } - virtual AMCPCommandScheduling GetDefaultScheduling() { - return AddToQueue; - } - virtual int GetMinimumParameters() { - return 1; - } -}; - -class PlayCommand : public AMCPCommand -{ -public: - PlayCommand() {} - virtual bool Execute(); - virtual AMCPCommandCondition CheckConditions(); - - virtual bool NeedChannel() { - return true; - } - virtual AMCPCommandScheduling GetDefaultScheduling() { - return AddToQueue; - } - virtual int GetMinimumParameters() { - return 0; - } -}; - -class StopCommand : public AMCPCommand -{ -public: - StopCommand() {} - virtual bool Execute(); - virtual AMCPCommandCondition CheckConditions(); - - virtual bool NeedChannel() { - return true; - } - virtual AMCPCommandScheduling GetDefaultScheduling() { - return ImmediatelyAndClear; - } - virtual int GetMinimumParameters() { - return 0; - } -}; - -class ClearCommand : public AMCPCommand -{ -public: - ClearCommand() {} - virtual bool Execute(); - virtual AMCPCommandCondition CheckConditions(); - - virtual bool NeedChannel() { - return true; - } - virtual AMCPCommandScheduling GetDefaultScheduling() { - return ImmediatelyAndClear; - } - virtual int GetMinimumParameters() { - return 0; - } -}; - -class ParamCommand : public AMCPCommand -{ -public: - ParamCommand() {} - virtual bool Execute(); - virtual AMCPCommandCondition CheckConditions(); - - virtual bool NeedChannel() { - return true; - } - virtual AMCPCommandScheduling GetDefaultScheduling() { - return AddToQueue; - } - virtual int GetMinimumParameters() { - return 1; - } -}; - -class CGCommand : public AMCPCommand -{ -public: - CGCommand() {} - virtual bool Execute(); - virtual AMCPCommandCondition CheckConditions(); - - virtual bool NeedChannel() { - return true; - } - virtual AMCPCommandScheduling GetDefaultScheduling() { - return AddToQueue; - } - virtual int GetMinimumParameters() { - return 1; - } - -private: - bool ValidateLayer(const tstring& layerstring); - - bool ExecuteAdd(); - bool ExecutePlay(); - bool ExecuteStop(); - bool ExecuteNext(); - bool ExecuteRemove(); - bool ExecuteClear(); - bool ExecuteUpdate(); - bool ExecuteInvoke(); - bool ExecuteInfo(); -}; - -class DataCommand : public AMCPCommand -{ -public: - DataCommand() {} - virtual bool Execute(); - virtual AMCPCommandCondition CheckConditions(); - - virtual bool NeedChannel() { - return false; - } - virtual AMCPCommandScheduling GetDefaultScheduling() { - return AddToQueue; - } - virtual int GetMinimumParameters() { - return 1; - } - -private: - bool ExecuteStore(); - bool ExecuteRetrieve(); - bool ExecuteList(); -}; - -class ClsCommand : public AMCPCommand -{ -public: - ClsCommand() {} - virtual bool Execute(); - virtual AMCPCommandCondition CheckConditions(); - - virtual bool NeedChannel() { - return false; - } - virtual AMCPCommandScheduling GetDefaultScheduling() { - return AddToQueue; - } - virtual int GetMinimumParameters() { - return 0; - } -}; - -class TlsCommand : public AMCPCommand -{ -public: - TlsCommand() {} - virtual bool Execute(); - virtual AMCPCommandCondition CheckConditions(); - - virtual bool NeedChannel() { - return false; - } - virtual AMCPCommandScheduling GetDefaultScheduling() { - return AddToQueue; - } - virtual int GetMinimumParameters() { - return 0; - } - -private: - void FindInDirectory(const tstring& dir, tstringstream&); -}; - -class CinfCommand : public AMCPCommand -{ -public: - CinfCommand() {} - virtual bool Execute(); - virtual AMCPCommandCondition CheckConditions(); - - virtual bool NeedChannel() { - return false; - } - virtual AMCPCommandScheduling GetDefaultScheduling() { - return AddToQueue; - } - virtual int GetMinimumParameters() { - return 1; - } -}; - -class InfoCommand : public AMCPCommand -{ -public: - InfoCommand() {} - virtual bool Execute(); - virtual AMCPCommandCondition CheckConditions(); - - virtual bool NeedChannel() { - return false; - } - virtual AMCPCommandScheduling GetDefaultScheduling() { - return AddToQueue; - } - virtual int GetMinimumParameters() { - return 0; - } - -private: - void GenerateChannelInfo(ChannelPtr&, tstringstream&); -}; - -class VersionCommand : public AMCPCommand -{ -public: - VersionCommand() {} - virtual bool Execute(); - virtual AMCPCommandCondition CheckConditions(); - - virtual bool NeedChannel() { - return false; - } - virtual AMCPCommandScheduling GetDefaultScheduling() { - return AddToQueue; - } - virtual int GetMinimumParameters() { - return 0; - } -}; - -class ByeCommand : public AMCPCommand -{ -public: - ByeCommand() {} - virtual bool Execute(); - virtual AMCPCommandCondition CheckConditions(); - - virtual bool NeedChannel() { - return false; - } - virtual AMCPCommandScheduling GetDefaultScheduling() { - return AddToQueue; - } - virtual int GetMinimumParameters() { - return 0; - } -}; - -class SetCommand : public AMCPCommand -{ -public: - SetCommand() - {} - - virtual bool Execute(); - virtual AMCPCommandCondition CheckConditions(); - - virtual bool NeedChannel() { - return true; - } - virtual AMCPCommandScheduling GetDefaultScheduling() { - return AddToQueue; - } - virtual int GetMinimumParameters() { - return 2; - } -}; - -class MonitorCommand : public AMCPCommand -{ -public: - MonitorCommand() - {} - - virtual bool Execute(); - virtual AMCPCommandCondition CheckConditions(); - - virtual bool NeedChannel() { - return true; - } - virtual AMCPCommandScheduling GetDefaultScheduling() { - return AddToQueue; - } - virtual int GetMinimumParameters() { - return 1; - } -}; - -//class KillCommand : public AMCPCommand -//{ -//public: -// KillCommand() {} -// virtual bool Execute(); -// virtual AMCPCommandCondition CheckConditions(); -// -// virtual bool NeedChannel() { -// return false; -// } -// virtual AMCPCommandScheduling GetDefaultScheduling() { -// return AddToQueue; -// } -// virtual int GetMinimumParameters() { -// return 0; -// } -//}; - -} //namespace amcp -} //namespace caspar - -#endif //__AMCPCOMMANDSIMPL_H__ \ No newline at end of file diff --git a/server/amcp/AMCPProtocolStrategy.cpp b/server/amcp/AMCPProtocolStrategy.cpp deleted file mode 100644 index adb9903d9..000000000 --- a/server/amcp/AMCPProtocolStrategy.cpp +++ /dev/null @@ -1,431 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\StdAfx.h" -#include "..\Application.h" - -#include "AMCPProtocolStrategy.h" - -#include "..\io\AsyncEventServer.h" -#include "AMCPCommandsImpl.h" -#include "..\Channel.h" - -#include -#include -#include -#include -#include - -namespace caspar { -namespace amcp { - -using namespace utils; -using IO::ClientInfoPtr; - -const tstring AMCPProtocolStrategy::MessageDelimiter = TEXT("\r\n"); - -AMCPProtocolStrategy::AMCPProtocolStrategy() { - AMCPCommandQueuePtr pGeneralCommandQueue(new AMCPCommandQueue()); - if(!pGeneralCommandQueue->Start()) { - LOG << TEXT("Failed to start the general command-queue"); - - //TODO: THROW! - } - else - commandQueues_.push_back(pGeneralCommandQueue); - - - ChannelPtr pChannel; - unsigned int index = -1; - //Create a commandpump for each channel - while((pChannel = GetApplication()->GetChannel(++index)) != 0) { - AMCPCommandQueuePtr pChannelCommandQueue(new AMCPCommandQueue()); - tstring title = TEXT("CHANNEL "); - - //HACK: Perform real conversion from int to string - TCHAR num = TEXT('1')+static_cast(index); - title += num; - - if(!pChannelCommandQueue->Start()) { - tstring logString = TEXT("Failed to start command-queue for "); - logString += title; - LOG << logString; - - //TODO: THROW! - } - else - commandQueues_.push_back(pChannelCommandQueue); - } -} - -AMCPProtocolStrategy::~AMCPProtocolStrategy() { -} - -void AMCPProtocolStrategy::Parse(const TCHAR* pData, int charCount, ClientInfoPtr pClientInfo) -{ - size_t pos; - tstring recvData(pData, charCount); - tstring availibleData = pClientInfo->currentMessage_ + recvData; - - while(true) { - pos = availibleData.find(MessageDelimiter); - if(pos != tstring::npos) - { - tstring message = availibleData.substr(0,pos); - - //This is where a complete message gets taken care of - if(message.length() > 0) { - ProcessMessage(message, pClientInfo); - } - - std::size_t nextStartPos = pos + MessageDelimiter.length(); - if(nextStartPos < availibleData.length()) - availibleData = availibleData.substr(nextStartPos); - else { - availibleData.clear(); - break; - } - } - else - { - break; - } - } - pClientInfo->currentMessage_ = availibleData; -} - -void AMCPProtocolStrategy::ProcessMessage(const tstring& message, ClientInfoPtr& pClientInfo) -{ - bool bError = true; - MessageParserState state = New; - - AMCPCommandPtr pCommand; - - pCommand = InterpretCommandString(message, &state); - - if(pCommand != 0) { - pCommand->SetClientInfo(pClientInfo); - if(QueueCommand(pCommand)) - bError = false; - else - state = GetChannel; - } - - if(bError == true) { - tstringstream answer; - switch(state) - { - case GetCommand: - answer << TEXT("400 ERROR\r\n") + message << "\r\n"; - break; - case GetChannel: - answer << TEXT("401 ERROR\r\n"); - break; - case GetParameters: - answer << TEXT("402 ERROR\r\n"); - break; - default: - answer << TEXT("500 FAILED\r\n"); - break; - } - pClientInfo->Send(answer.str()); - } -} - -AMCPCommandPtr AMCPProtocolStrategy::InterpretCommandString(const tstring& message, MessageParserState* pOutState) -{ - std::vector tokens; - unsigned int currentToken = 0; - tstring commandSwitch; - - AMCPCommandPtr pCommand; - MessageParserState state = New; - - LOG << message; - - std::size_t tokensInMessage = TokenizeMessage(message, &tokens); - - //parse the message one token at the time - while(currentToken < tokensInMessage) - { - switch(state) - { - case New: - if(tokens[currentToken][0] == TEXT('/')) - state = GetSwitch; - else - state = GetCommand; - break; - - case GetSwitch: - commandSwitch = tokens[currentToken]; - state = GetCommand; - ++currentToken; - break; - - case GetCommand: - pCommand = CommandFactory(tokens[currentToken]); - if(pCommand == 0) { - goto ParseFinnished; - } - else - { - //Set scheduling - if(commandSwitch.size() > 0) { - transform(commandSwitch.begin(), commandSwitch.end(), commandSwitch.begin(), toupper); - - if(commandSwitch == TEXT("/APP")) - pCommand->SetScheduling(AddToQueue); - else if(commandSwitch == TEXT("/IMMF")) - pCommand->SetScheduling(ImmediatelyAndClear); - } - - if(pCommand->NeedChannel()) - state = GetChannel; - else - state = GetParameters; - } - ++currentToken; - break; - - case GetParameters: - { - _ASSERTE(pCommand != 0); - int parameterCount=0; - while(currentTokenAddParameter(tokens[currentToken++]); - ++parameterCount; - } - if(parameterCount < pCommand->GetMinimumParameters()) { - goto ParseFinnished; - } - - state = Done; - break; - } - - case GetChannel: - { -// assert(pCommand != 0); - - int channelIndex = _ttoi(tokens[currentToken].c_str())-1; - - ChannelPtr pChannel = GetApplication()->GetChannel(channelIndex); - if(pChannel == 0) { - goto ParseFinnished; - } - - pCommand->SetChannel(pChannel); - pCommand->SetChannelIndex(channelIndex); - - state = GetParameters; - ++currentToken; - break; - } - - default: //Done and unexpected - goto ParseFinnished; - } - } - -ParseFinnished: - if(state == GetParameters && pCommand->GetMinimumParameters()==0) - state = Done; - - if(state != Done) { - pCommand.reset(); - } - - if(pOutState != 0) { - *pOutState = state; - } - - return pCommand; -} - -bool AMCPProtocolStrategy::QueueCommand(AMCPCommandPtr pCommand) { - if(pCommand->NeedChannel()) { - unsigned int channelIndex = pCommand->GetChannelIndex() + 1; - if(commandQueues_.size() > channelIndex) { - commandQueues_[channelIndex]->AddCommand(pCommand); - } - else - return false; - } - else { - commandQueues_[0]->AddCommand(pCommand); - } - return true; -} - -AMCPCommandPtr AMCPProtocolStrategy::CommandFactory(const tstring& str) -{ - tstring s = str; - transform(s.begin(), s.end(), s.begin(), toupper); - - AMCPCommandPtr result; - - if(s == TEXT("LOAD")) - { - result = AMCPCommandPtr(new LoadCommand()); - } - else if(s == TEXT("LOADBG")) - { - result = AMCPCommandPtr(new LoadbgCommand()); - } - else if(s == TEXT("PLAY")) - { - result = AMCPCommandPtr(new PlayCommand()); - } - else if(s == TEXT("STOP")) - { - result = AMCPCommandPtr(new StopCommand()); - } - else if(s == TEXT("CLEAR")) - { - result = AMCPCommandPtr(new ClearCommand()); - } - else if(s == TEXT("PARAM")) - { - result = AMCPCommandPtr(new ParamCommand()); - } - else if(s == TEXT("CG")) - { - result = AMCPCommandPtr(new CGCommand()); - } - else if(s == TEXT("DATA")) - { - result = AMCPCommandPtr(new DataCommand()); - } - else if(s == TEXT("CINF")) - { - result = AMCPCommandPtr(new CinfCommand()); - } - else if(s == TEXT("INFO")) - { - result = AMCPCommandPtr(new InfoCommand()); - } - else if(s == TEXT("CLS")) - { - result = AMCPCommandPtr(new ClsCommand()); - } - else if(s == TEXT("TLS")) - { - result = AMCPCommandPtr(new TlsCommand()); - } - else if(s == TEXT("VERSION")) - { - result = AMCPCommandPtr(new VersionCommand()); - } - else if(s == TEXT("BYE")) - { - result = AMCPCommandPtr(new ByeCommand()); - } - else if(s == TEXT("SET")) - { - result = AMCPCommandPtr(new SetCommand()); - } - //else if(s == TEXT("MONITOR")) - //{ - // result = AMCPCommandPtr(new MonitorCommand()); - //} - //else if(s == TEXT("KILL")) - //{ - // result = AMCPCommandPtr(new KillCommand()); - //} - return result; -} - -std::size_t AMCPProtocolStrategy::TokenizeMessage(const tstring& message, std::vector* pTokenVector) -{ - //split on whitespace but keep strings within quotationmarks - //treat \ as the start of an escape-sequence: the following char will indicate what to actually put in the string - - tstring currentToken; - - char inQuote = 0; - bool getSpecialCode = false; - - for(unsigned int charIndex=0; charIndex0) - { - pTokenVector->push_back(currentToken); - currentToken.clear(); - } - continue; - } - - if(message[charIndex]==TEXT('\"')) - { - inQuote ^= 1; - - if(currentToken.size()>0) - { - pTokenVector->push_back(currentToken); - currentToken.clear(); - } - continue; - } - - currentToken += message[charIndex]; - } - - if(currentToken.size()>0) - { - pTokenVector->push_back(currentToken); - currentToken.clear(); - } - - return pTokenVector->size(); -} - -} //namespace amcp -} //namespace caspar \ No newline at end of file diff --git a/server/amcp/AMCPProtocolStrategy.h b/server/amcp/AMCPProtocolStrategy.h deleted file mode 100644 index e13c3447d..000000000 --- a/server/amcp/AMCPProtocolStrategy.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _AMCPMESSAGEHANDLER_H__ -#define _AMCPMESSAGEHANDLER_H__ -#pragma once - -#include -#include - -#include "..\io\protocolstrategy.h" -#include "AMCPCommand.h" -#include "AMCPCommandQueue.h" - -namespace caspar { -namespace amcp { - - -class AMCPProtocolStrategy : public caspar::IO::IProtocolStrategy -{ - enum MessageParserState { - New = 0, - GetSwitch, - GetCommand, - GetParameters, - GetChannel, - Done - }; - - AMCPProtocolStrategy(const AMCPProtocolStrategy&); - AMCPProtocolStrategy& operator=(const AMCPProtocolStrategy&); - -public: - AMCPProtocolStrategy(); - virtual ~AMCPProtocolStrategy(); - - virtual void Parse(const TCHAR* pData, int charCount, caspar::IO::ClientInfoPtr pClientInfo); - virtual UINT GetCodepage() { - return CP_UTF8; - } - - static AMCPCommandPtr InterpretCommandString(const tstring& str, MessageParserState* pOutState=0); - -private: - friend class AMCPCommand; - - void ProcessMessage(const tstring& message, caspar::IO::ClientInfoPtr& pClientInfo); - static std::size_t TokenizeMessage(const tstring& message, std::vector* pTokenVector); - static AMCPCommandPtr CommandFactory(const tstring& str); - - bool QueueCommand(AMCPCommandPtr); - - std::vector commandQueues_; - static const tstring MessageDelimiter; -}; - -} //namespace amcp -} //namespace caspar - -#endif //_AMCPMESSAGEHANDLER_H__ \ No newline at end of file diff --git a/server/audio/AudioManager.h b/server/audio/AudioManager.h deleted file mode 100644 index 79ac49072..000000000 --- a/server/audio/AudioManager.h +++ /dev/null @@ -1,97 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -#include "..\frame\Frame.h" - -namespace caspar { - -class FrameMediaController; -struct MediaProducerInfo; - -namespace audio { - -class AudioDataChunk -{ -public: - AudioDataChunk(int len) : length_(len), pData_(new char[len]), volume_(1.0f) - {} - - ~AudioDataChunk() { - if(pData_ != 0) - delete[] pData_; - - pData_ = 0; - length_ = 0; - } - - char* GetDataPtr() { - return pData_; - } - int GetLength() { - return length_; - } - - void SetVolume(float value) - { - volume_ = value; - } - - float GetVolume() const - { - return volume_; - } - -private: - float volume_; - char* pData_; - int length_; -}; -typedef std::tr1::shared_ptr AudioDataChunkPtr; - -class ISoundBufferWorker -{ -public: - virtual ~ISoundBufferWorker() - {} - - virtual void Start() = 0; - virtual void Stop() = 0; - - virtual bool PushChunk(AudioDataChunkPtr) = 0; - virtual HANDLE GetWaitHandle() = 0; -}; -typedef std::tr1::shared_ptr SoundBufferWorkerPtr; - -class IAudioManager -{ -public: - virtual ~IAudioManager() - {} - - virtual bool CueAudio(FrameMediaController*) = 0; - virtual bool StartAudio(FrameMediaController*) = 0; - virtual bool StopAudio(FrameMediaController*) = 0; - virtual bool PushAudioData(FrameMediaController*, FramePtr) = 0; -}; - -} //namespace audio -} //namespace caspar \ No newline at end of file diff --git a/server/audio/DirectSoundManager.cpp b/server/audio/DirectSoundManager.cpp deleted file mode 100644 index 09f865f29..000000000 --- a/server/audio/DirectSoundManager.cpp +++ /dev/null @@ -1,488 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\StdAfx.h" - -#include "..\utils\thread.h" -#include "..\utils\lockable.h" -#include - -#include -#include - -#include "..\MediaProducerInfo.h" -#include "..\frame\FrameMediaController.h" -#include "DirectSoundManager.h" - -namespace caspar { -namespace directsound { - -using namespace audio; -using namespace utils; - -/////////////////////////////// -// DirectSoundBufferWorker -/////////////////////////////// -class DirectSoundBufferWorker : public caspar::audio::ISoundBufferWorker, private utils::IRunnable, private utils::LockableObject -{ - friend class DirectSoundManager; - - DirectSoundBufferWorker(const DirectSoundBufferWorker&); - DirectSoundBufferWorker& operator=(const DirectSoundBufferWorker&); - -public: - static const int BufferLengthInFrames; - - virtual ~DirectSoundBufferWorker(); - - void Start() { - worker_.Start(this); - } - void Stop() { - worker_.Stop(); - } - - bool PushChunk(AudioDataChunkPtr); - - HANDLE GetWaitHandle() { - return writeEvent_; - } - -private: - AudioDataChunkPtr GetNextChunk(); - -private: - explicit DirectSoundBufferWorker(LPDIRECTSOUNDBUFFER8 pDirectSound); - HRESULT InitSoundBuffer(WORD channels, WORD bits, DWORD samplesPerSec, DWORD fps); - - virtual void Run(HANDLE stopEvent); - virtual bool OnUnhandledException(const std::exception&) throw(); - utils::Thread worker_; - - - void WriteChunkToBuffer(int offset, AudioDataChunkPtr pChunk); - int IncreaseFrameIndex(int frameIndex) { - return (frameIndex+1)%BufferLengthInFrames; - } - - HANDLE notificationEvents_[2]; - - int bytesPerFrame_; - bool bIsRunning_; - - LPDIRECTSOUNDBUFFER8 pSoundBuffer_; - - std::queue chunkQueue_; - utils::Event writeEvent_; - utils::Event startPlayback_; - - int soundBufferLoadIndex_; - int lastPlayIndex_; -}; -typedef std::tr1::shared_ptr DirectSoundBufferWorkerPtr; - - -/////////////////////////////// -// -// DirectSoundManager -// -/////////////////////////////// -DirectSoundManager::DirectSoundManager() : pDirectSound_(0) -{ -} - -DirectSoundManager::~DirectSoundManager() -{ - Destroy(); -} - -bool DirectSoundManager::Initialize(HWND hWnd, DWORD channels, DWORD samplesPerSec, DWORD bitsPerSample) { -#ifndef DISABLE_AUDIO - HRESULT hr = E_FAIL; - hr = DirectSoundCreate8(NULL, &pDirectSound_, NULL); - if(FAILED(hr)) { - LOG << TEXT("DirectSound: Failed to create device."); - return false; - } - - hr = pDirectSound_->SetCooperativeLevel(hWnd, DSSCL_PRIORITY); - if(FAILED(hr)) { - LOG << TEXT("DirectSound: Failed to set CooperativeLevel."); - return false; - } - - hr = SetPrimaryBufferFormat(channels, samplesPerSec, bitsPerSample); - if(FAILED(hr)) { - LOG << TEXT("DirectSound: Failed to set Primarybuffer format."); - return false; - } -#endif - return true; -} - -void DirectSoundManager::Destroy() { - if(pDirectSound_ != 0) { - pDirectSound_->Release(); - pDirectSound_ = 0; - } -} - -bool DirectSoundManager::CueAudio(FrameMediaController* pController) -{ - MediaProducerInfo clipInfo; -#ifndef DISABLE_AUDIO - if(pController->GetProducerInfo(&clipInfo) && clipInfo.HaveAudio) { - caspar::audio::SoundBufferWorkerPtr pSBW = CreateSoundBufferWorker(clipInfo.AudioChannels, clipInfo.BitsPerAudioSample, clipInfo.AudioSamplesPerSec, 25); - if(pSBW) { - pController->AddSoundBufferWorker(pSBW); - return true; - } - } -#endif - return false; -} - -bool DirectSoundManager::StartAudio(FrameMediaController* pController) -{ -#ifndef DISABLE_AUDIO - SoundBufferWorkerList& sbwList = pController->GetSoundBufferWorkers(); - SoundBufferWorkerList::iterator it = sbwList.begin(); - SoundBufferWorkerList::iterator end = sbwList.end(); - for(;it != end; ++it) - { - (*it)->Start(); - } -#endif - return true; -} - -bool DirectSoundManager::StopAudio(FrameMediaController* pController) -{ -#ifndef DISABLE_AUDIO - SoundBufferWorkerList& sbwList = pController->GetSoundBufferWorkers(); - SoundBufferWorkerList::iterator it = sbwList.begin(); - SoundBufferWorkerList::iterator end = sbwList.end(); - for(;it != end; ++it) - { - (*it)->Stop(); - } -#endif - return true; -} - -bool DirectSoundManager::PushAudioData(FrameMediaController* pController, FramePtr pFrame) -{ -#ifndef DISABLE_AUDIO - SoundBufferWorkerList& sbwList = pController->GetSoundBufferWorkers(); - AudioDataChunkList data = pFrame->GetAudioData(); - - SoundBufferWorkerList::iterator it = sbwList.begin(); - SoundBufferWorkerList::iterator end = sbwList.end(); - - for(int dataIndex = 0;it != end && dataIndex < data.size(); ++it, ++dataIndex) { - if(dataIndex < pFrame->GetAudioData().size()) - (*it)->PushChunk(pFrame->GetAudioData()[dataIndex]); - else - break; - } -#endif - return true; -} - -SoundBufferWorkerPtr DirectSoundManager::CreateSoundBufferWorker(WORD channels, WORD bits, DWORD samplesPerSec, DWORD fps) { - SoundBufferWorkerPtr result; - - if(pDirectSound_ != 0) { - WAVEFORMATEX wfx; - DSBUFFERDESC bufferDesc; - LPDIRECTSOUNDBUFFER pSoundBuffer; - LPDIRECTSOUNDBUFFER8 pSoundBuffer8; - - HRESULT hr; - - ZeroMemory(&wfx, sizeof(wfx)); - wfx.cbSize = sizeof(wfx); - wfx.wFormatTag = WAVE_FORMAT_PCM; - wfx.nChannels = channels; - wfx.wBitsPerSample = bits; - wfx.nSamplesPerSec = samplesPerSec; - wfx.nBlockAlign = (wfx.nChannels * wfx.wBitsPerSample) / 8; - wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign; - - int bytesPerFrame = wfx.nAvgBytesPerSec / fps; - - ZeroMemory(&bufferDesc, sizeof(bufferDesc)); - bufferDesc.dwSize = sizeof(bufferDesc); - bufferDesc.dwFlags = DSBCAPS_GLOBALFOCUS | DSBCAPS_CTRLPOSITIONNOTIFY | DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLVOLUME; - bufferDesc.dwBufferBytes = bytesPerFrame * DirectSoundBufferWorker::BufferLengthInFrames; - bufferDesc.lpwfxFormat = &wfx; - - hr = pDirectSound_->CreateSoundBuffer(&bufferDesc, &pSoundBuffer, NULL); - if(SUCCEEDED(hr)) { - hr = pSoundBuffer->QueryInterface(IID_IDirectSoundBuffer8, (LPVOID*) &pSoundBuffer8); - pSoundBuffer->Release(); - if(FAILED(hr)) { - LOG << TEXT("DirectSound: Failed to create SoundBuffer."); - return result; - } - } - else { - LOG << TEXT("DirectSound: Failed to create SoundBuffer."); - return result; - } - - DirectSoundBufferWorkerPtr pSBW(new DirectSoundBufferWorker(pSoundBuffer8)); - if(FAILED(pSBW->InitSoundBuffer(channels, bits, samplesPerSec, fps))) { - LOG << TEXT("DirectSound: Failed to init SoundBuffer."); - return result; - } - pSBW->Start(); - result = pSBW; - } - - return result; -} - -HRESULT DirectSoundManager::SetPrimaryBufferFormat(DWORD dwPrimaryChannels, DWORD dwPrimaryFreq, DWORD dwPrimaryBitRate) -{ - HRESULT hr; - LPDIRECTSOUNDBUFFER pDSBPrimary = NULL; - - if(pDirectSound_ == NULL ) - return CO_E_NOTINITIALIZED; - - // Get the primary buffer - DSBUFFERDESC dsbd; - ZeroMemory( &dsbd, sizeof(DSBUFFERDESC) ); - dsbd.dwSize = sizeof(DSBUFFERDESC); - dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER; - dsbd.dwBufferBytes = 0; - dsbd.lpwfxFormat = NULL; - - hr = pDirectSound_->CreateSoundBuffer( &dsbd, &pDSBPrimary, NULL ); - if(FAILED(hr)) - return hr; - - WAVEFORMATEX wfx; - ZeroMemory( &wfx, sizeof(WAVEFORMATEX) ); - wfx.wFormatTag = (WORD) WAVE_FORMAT_PCM; - wfx.nChannels = (WORD) dwPrimaryChannels; - wfx.nSamplesPerSec = (DWORD) dwPrimaryFreq; - wfx.wBitsPerSample = (WORD) dwPrimaryBitRate; - wfx.nBlockAlign = (WORD) (wfx.wBitsPerSample / 8 * wfx.nChannels); - wfx.nAvgBytesPerSec = (DWORD) (wfx.nSamplesPerSec * wfx.nBlockAlign); - - hr = pDSBPrimary->SetFormat(&wfx); - if(FAILED(hr)) { - pDSBPrimary->Release(); - pDSBPrimary = 0; - return hr; - } - - pDSBPrimary->Release(); - pDSBPrimary = 0; - - return S_OK; -} - -///////////////////////////////// -// -// DirectSoundBufferWorker Impl -// -///////////////////////////////// -const int DirectSoundBufferWorker::BufferLengthInFrames = 3; - -DirectSoundBufferWorker::DirectSoundBufferWorker(LPDIRECTSOUNDBUFFER8 pSoundBuffer) : writeEvent_(TRUE, TRUE), bytesPerFrame_(0), pSoundBuffer_(pSoundBuffer), bIsRunning_(false), startPlayback_(FALSE, FALSE), soundBufferLoadIndex_(0), lastPlayIndex_(0) -{ - //reserve the first event for the stopEvent - notificationEvents_[0] = 0; - notificationEvents_[1] = CreateEvent(NULL, FALSE, FALSE, NULL); -} - -DirectSoundBufferWorker::~DirectSoundBufferWorker(void) { - Stop(); - - pSoundBuffer_->Release(); - pSoundBuffer_ = 0; - - CloseHandle(notificationEvents_[1]); - notificationEvents_[1] = 0; -} - -void DirectSoundBufferWorker::Run(HANDLE stopEvent) { - bool bQuit = false; - notificationEvents_[0] = stopEvent; - - { - HANDLE waitEvents[2] = {stopEvent, startPlayback_}; - HRESULT waitResult = WAIT_TIMEOUT; - while(waitResult == WAIT_TIMEOUT || waitResult == WAIT_OBJECT_0) - { - waitResult = WaitForMultipleObjects(2, waitEvents, FALSE, 2500); - if(waitResult == WAIT_OBJECT_0) - goto workerloop_end; - } - } - - bIsRunning_ = true; - HRESULT hr = pSoundBuffer_->Play(0, 0, DSBPLAY_LOOPING); - while(!bQuit) { - DWORD waitResult = WaitForMultipleObjects(2, notificationEvents_, FALSE, 2500); - switch(waitResult) { - case WAIT_OBJECT_0: //stopEvent - bQuit = true; - break; - - case WAIT_TIMEOUT: - break; - - case WAIT_FAILED: - bQuit = true; - break; - - default: - { - DWORD currentPlayCursor = 0, currentWriteCursor = 0; - HRESULT hr = pSoundBuffer_->GetCurrentPosition(¤tPlayCursor, ¤tWriteCursor); - if(SUCCEEDED(hr)) { - int currentPlayCursorIndex = currentPlayCursor / bytesPerFrame_; - if(currentPlayCursorIndex != lastPlayIndex_) { - AudioDataChunkPtr pChunk = GetNextChunk(); - int offset = lastPlayIndex_ * bytesPerFrame_; - - WriteChunkToBuffer(offset, pChunk); - - lastPlayIndex_ = currentPlayCursorIndex; - } - } - } - break; - } - } - -workerloop_end: - pSoundBuffer_->Stop(); - bIsRunning_ = false; -} - -bool DirectSoundBufferWorker::OnUnhandledException(const std::exception&) throw() { - try { - if(pSoundBuffer_ != 0) - pSoundBuffer_->Stop(); - - LOG << TEXT("UNEXPECTED EXCEPTION in SoundBufferWorker."); - } - catch(...) - {} - - return false; -} - -void DirectSoundBufferWorker::WriteChunkToBuffer(int offset, AudioDataChunkPtr pChunk) { - void* pPtr; - DWORD len; - - HRESULT hr = pSoundBuffer_->Lock(offset, bytesPerFrame_, &pPtr, &len, NULL, NULL, 0); - if(SUCCEEDED(hr)) { - if(pChunk != 0) { - //len and pChunk-length SHOULD be the same, but better safe than sorry - memcpy(pPtr, pChunk->GetDataPtr(), min(len, pChunk->GetLength())); - } - else { - memset(pPtr, 0, len); - } - - pSoundBuffer_->Unlock(pPtr, len, NULL, 0); - } -} - -bool DirectSoundBufferWorker::PushChunk(AudioDataChunkPtr pChunk) { - Lock lock(*this); - - //WaitForSingleObject(writeEvent_, 200); - - if(!bIsRunning_) { - if(soundBufferLoadIndex_ < 3) { - WriteChunkToBuffer(bytesPerFrame_ * soundBufferLoadIndex_, pChunk); - ++soundBufferLoadIndex_; - return true; - } - else - startPlayback_.Set(); - } - - chunkQueue_.push(pChunk); - - if(chunkQueue_.size() >= 5) - writeEvent_.Reset(); - - return true; -} - -AudioDataChunkPtr DirectSoundBufferWorker::GetNextChunk() { - Lock lock(*this); - AudioDataChunkPtr pChunk; - - if(chunkQueue_.size() > 0) { - pChunk = chunkQueue_.front(); - chunkQueue_.pop(); - } - - if(chunkQueue_.size() < 5) - writeEvent_.Set(); - - return pChunk; -} - -HRESULT DirectSoundBufferWorker::InitSoundBuffer(WORD channels, WORD bits, DWORD samplesPerSec, DWORD fps) { - - bytesPerFrame_ = samplesPerSec * channels * (bits/8) / fps; - DWORD bufferSize = bytesPerFrame_ * BufferLengthInFrames; - - LPDIRECTSOUNDNOTIFY8 pBufferNotify; - HRESULT hr = pSoundBuffer_->QueryInterface(IID_IDirectSoundNotify8, (LPVOID*) &pBufferNotify); - if(SUCCEEDED(hr)) { - DSBPOSITIONNOTIFY pPositionNotifies[BufferLengthInFrames]; - - for(int i=0; i < BufferLengthInFrames; ++i) { - pPositionNotifies[i].dwOffset = (i+1)*bytesPerFrame_ - 1; - pPositionNotifies[i].hEventNotify = notificationEvents_[1]; - } - - hr = pBufferNotify->SetNotificationPositions(BufferLengthInFrames, &(pPositionNotifies[0])); - pBufferNotify->Release(); - } - else - return hr; - - //Init the buffer to silence - void* pPtr = 0; - DWORD len = 0; - hr = pSoundBuffer_->Lock(0, bufferSize, &pPtr, &len, NULL, NULL, 0); - if(SUCCEEDED(hr) && pPtr != 0) { - memset(pPtr, 0, len); - pSoundBuffer_->Unlock(pPtr, len, NULL, 0); - } - - return hr; -} - -} //namespace directsound -} //namespace caspar \ No newline at end of file diff --git a/server/audio/DirectSoundManager.h b/server/audio/DirectSoundManager.h deleted file mode 100644 index f67c1f34a..000000000 --- a/server/audio/DirectSoundManager.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -#include "AudioManager.h" - -struct IDirectSound8; -typedef IDirectSound8* LPDIRECTSOUND8; - -namespace caspar { -namespace directsound { - -class DirectSoundManager : public caspar::audio::IAudioManager -{ - DirectSoundManager(const DirectSoundManager&); - DirectSoundManager& operator=(const DirectSoundManager&); - DirectSoundManager(); - -public: - static DirectSoundManager* GetInstance() { - static DirectSoundManager instance; - return &instance; - } - - ~DirectSoundManager(); - - bool Initialize(HWND hWnd, DWORD channels, DWORD samplesPerSec, DWORD bitsPerSample); - void Destroy(); - - virtual bool CueAudio(FrameMediaController*); - virtual bool StartAudio(FrameMediaController*); - virtual bool StopAudio(FrameMediaController*); - virtual bool PushAudioData(FrameMediaController*, FramePtr); - -private: - caspar::audio::SoundBufferWorkerPtr CreateSoundBufferWorker(WORD channels, WORD bits, DWORD samplesPerSec, DWORD fps); - HRESULT SetPrimaryBufferFormat(DWORD dwPrimaryChannels, DWORD dwPrimaryFreq, DWORD dwPrimaryBitRate); - - IDirectSound8* pDirectSound_; -}; - -} //namespace directsound -} //namespace caspar \ No newline at end of file diff --git a/server/cg/CGControl.h b/server/cg/CGControl.h deleted file mode 100644 index 97ded378a..000000000 --- a/server/cg/CGControl.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _CASPAR_CGCONTROL_H__ -#define _CASPAR_CGCONTROL_H__ - -#pragma once - -namespace caspar { -namespace CG { - -class ICGControl -{ -public: - virtual ~ICGControl() {} - - virtual void Add(int layer, const tstring& templateName, bool playOnLoad, const tstring& label, const tstring& data) = 0; - virtual void Remove(int layer) = 0; - virtual void Clear() = 0; - virtual void Play(int layer) = 0; - virtual void Stop(int layer, unsigned int mixOutDuration) = 0; - virtual void Next(int layer) = 0; - virtual void Update(int layer, const tstring& data) = 0; - virtual void Invoke(int layer, const tstring& label) = 0; -}; - -} -} - -#endif //_CASPAR_CGCONTROL_H__ \ No newline at end of file diff --git a/server/cg/FlashCGManager.cpp b/server/cg/FlashCGManager.cpp deleted file mode 100644 index 9d59c5b50..000000000 --- a/server/cg/FlashCGManager.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\StdAfx.h" - -#include "..\Producers\flash\FlashManager.h" -#include "..\Producers\flash\FlashProducer.h" - -#include "..\Application.h" -#include "..\transitioninfo.h" - -#include "FlashCGManager.h" - -namespace caspar { -namespace CG { - -using namespace utils; - -FlashCGManager::FlashCGManager(caspar::Channel* pChannel) : pChannel_(pChannel), pFlashManager_(new caspar::FlashManager()) { -} - -FlashCGManager::~FlashCGManager() { - if(pFlashManager_ != 0) { - delete pFlashManager_; - pFlashManager_ = 0; - } -} - -void FlashCGManager::DisplayActive() { -/* if(pChannel_->GetActiveProducer() != activeCGProducer_) { - LOG << LogLevel::Debug << TEXT("Had to display active cg-producer"); - - caspar::TransitionInfo transition; - if(pChannel_->LoadBackground(activeCGProducer_, transition)){ - pChannel_->Play(); - } - else { - LOG << TEXT("Failed to display active cg-producer"); - } - }*/ -} -FlashProducerPtr FlashCGManager::CreateNewProducer() -{ -#if TEMPLATEHOST_VERSION < 1700 - return std::tr1::dynamic_pointer_cast(pFlashManager_->CreateProducer(GetApplication()->GetTemplateFolder()+TEXT("CG.fth"))); -#else - return std::tr1::dynamic_pointer_cast(pFlashManager_->CreateProducer(GetApplication()->GetTemplateFolder()+TEXT("CG.fth.17"))); -#endif -} - -void FlashCGManager::Add(int layer, const tstring& templateName, unsigned int mixInDuration, bool playOnLoad, const tstring& startFromLabel, const tstring& data) { - if(activeCGProducer_ == 0 || activeCGProducer_->IsEmpty()) { - activeCGProducer_ = CreateNewProducer(); - - LOG << TEXT("Created new flashproducer"); - } - - if(activeCGProducer_ != 0) { - tstringstream flashParam; - flashParam << TEXT("") << layer << TEXT("") << templateName << TEXT("") << mixInDuration << TEXT("") << (playOnLoad?TEXT(""):TEXT("")) << TEXT("") << startFromLabel << TEXT(""); - DisplayActive(); - activeCGProducer_->Param(flashParam.str()); - LOG << LogLevel::Debug << TEXT("Invoked add-command"); - } -} - -void FlashCGManager::Remove(int layer) { - if(activeCGProducer_ != 0) { - tstringstream flashParam; -#if TEMPLATEHOST_VERSION < 1700 - flashParam << TEXT("") << layer << TEXT(""); -#else - flashParam << TEXT("") << layer << TEXT(""); -#endif - activeCGProducer_->Param(flashParam.str()); - DisplayActive(); - } -} - -void FlashCGManager::Clear() { - activeCGProducer_ = CreateNewProducer(); - DisplayActive(); -} - -void FlashCGManager::Play(int layer) { - if(activeCGProducer_ != 0) { - tstringstream flashParam; -#if TEMPLATEHOST_VERSION < 1700 - flashParam << TEXT("") << layer << TEXT(""); -#else - flashParam << TEXT("") << layer << TEXT(""); -#endif - - activeCGProducer_->Param(flashParam.str()); - LOG << LogLevel::Debug << TEXT("Invoked play-command"); - DisplayActive(); - } -} - -void FlashCGManager::Stop(int layer, unsigned int mixOutDuration) { - if(activeCGProducer_ != 0) { - tstringstream flashParam; -#if TEMPLATEHOST_VERSION < 1700 - flashParam << TEXT("") << layer << TEXT("") << mixOutDuration << TEXT(""); -#else - flashParam << TEXT("") << layer << TEXT("") << mixOutDuration << TEXT(""); -#endif - activeCGProducer_->Param(flashParam.str()); - LOG << LogLevel::Debug << TEXT("Invoked stop-command"); - DisplayActive(); - } -} - -void FlashCGManager::Next(int layer) { - if(activeCGProducer_ != 0) { - tstringstream flashParam; -#if TEMPLATEHOST_VERSION < 1700 - flashParam << TEXT("") << layer << TEXT(""); -#else - flashParam << TEXT("") << layer << TEXT(""); -#endif - activeCGProducer_->Param(flashParam.str()); - DisplayActive(); - } -} - -void FlashCGManager::Goto(int layer, const tstring& label) { - if(activeCGProducer_ != 0) { - tstringstream flashParam; -#if TEMPLATEHOST_VERSION < 1700 - flashParam << TEXT("") << layer << TEXT("") << label << TEXT(""); -#else - flashParam << TEXT("") << layer << TEXT("") << label << TEXT(""); -#endif - activeCGProducer_->Param(flashParam.str()); - DisplayActive(); - } -} - -void FlashCGManager::Update(int layer, const tstring& data) { - if(activeCGProducer_ != 0) { - tstringstream flashParam; -#if TEMPLATEHOST_VERSION < 1700 - flashParam << TEXT("") << layer << TEXT(""); -#else - flashParam << TEXT("") << layer << TEXT(""); -#endif - activeCGProducer_->Param(flashParam.str()); - DisplayActive(); - } -} - -void FlashCGManager::Invoke(int layer, const tstring& methodSpec) { - if(activeCGProducer_ != 0) { - tstringstream flashParam; -#if TEMPLATEHOST_VERSION < 1700 - flashParam << TEXT("") << layer << TEXT("") << methodSpec << TEXT(""); -#else - flashParam << TEXT("") << layer << TEXT("") << methodSpec << TEXT(""); -#endif - activeCGProducer_->Param(flashParam.str()); - DisplayActive(); - } -} - -} //namespace CG -} //namespace caspar \ No newline at end of file diff --git a/server/cg/FlashCGManager.h b/server/cg/FlashCGManager.h deleted file mode 100644 index e49086156..000000000 --- a/server/cg/FlashCGManager.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -#include "..\channel.h" -#include "..\MediaManager.h" -#include -#include - -namespace caspar { - class Channel; - class FlashManager; - class FlashProducer; - typedef std::tr1::shared_ptr FlashProducerPtr; - -namespace CG { - -class FlashCGManager -{ -public: - explicit FlashCGManager(caspar::Channel*); -public: - virtual ~FlashCGManager(); - - void Add(int layer, const tstring& templateName, unsigned int mixInDuration, bool playOnLoad, const tstring& startFromLabel, const tstring& data); - void Remove(int layer); - void Clear(); - void Play(int layer); - void Stop(int layer, unsigned int mixOutDuration); - void Next(int layer); - void Goto(int layer, const tstring& label); - void Update(int layer, const tstring& data); - void Invoke(int layer, const tstring& methodSpec); - - -private: - void DisplayActive(); - FlashProducerPtr CreateNewProducer(); - - caspar::Channel* pChannel_; - - caspar::FlashManager* pFlashManager_; - FlashProducerPtr activeCGProducer_; -}; - -typedef std::tr1::shared_ptr FlashCGManagerPtr; - -} //namespace CG -} //namespace caspar \ No newline at end of file diff --git a/server/cg/FlashCGProxy.cpp b/server/cg/FlashCGProxy.cpp deleted file mode 100644 index 78f5d3193..000000000 --- a/server/cg/FlashCGProxy.cpp +++ /dev/null @@ -1,320 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\StdAfx.h" - -#include "../producers/flash/flashproducer.h" -#include "../application.h" -#include "../utils/fileexists.h" -#include "FlashCGProxy.h" - -namespace caspar { -namespace CG { - -using namespace utils; - -int FlashCGProxy::cgVersion_ = 0; - -class FlashCGProxy16 : public FlashCGProxy -{ -public: - FlashCGProxy16::FlashCGProxy16() - { - pFlashProducer_ = FlashProducer::Create(GetApplication()->GetTemplateFolder()+TEXT("CG.fth")); - if(!pFlashProducer_) - throw std::exception("Failed to create flashproducer for templatehost"); - } - - virtual void Add(int layer, const tstring& templateName, bool playOnLoad, const tstring& label, const tstring& data) { - tstringstream flashParam; - - tstring::size_type pos = templateName.find('.'); - tstring filename = (pos != tstring::npos) ? templateName.substr(0, pos) : templateName; - - flashParam << TEXT("") << layer << TEXT("") << filename << TEXT("0") << (playOnLoad?TEXT(""):TEXT("")) << TEXT("") << label << TEXT(""); - LOG << LogLevel::Debug << TEXT("Invoking add-command"); - pFlashProducer_->Param(flashParam.str()); - } - virtual void Remove(int layer) { - tstringstream flashParam; - flashParam << TEXT("") << layer << TEXT(""); - LOG << LogLevel::Debug << TEXT("Invoking remove-command"); - pFlashProducer_->Param(flashParam.str()); - } - virtual void Play(int layer) { - tstringstream flashParam; - flashParam << TEXT("") << layer << TEXT(""); - LOG << LogLevel::Debug << TEXT("Invoking play-command"); - pFlashProducer_->Param(flashParam.str()); - } - virtual void Stop(int layer, unsigned int mixOutDuration) { - tstringstream flashParam; - flashParam << TEXT("") << layer << TEXT("") << mixOutDuration << TEXT(""); - LOG << LogLevel::Debug << TEXT("Invoking stop-command"); - pFlashProducer_->Param(flashParam.str()); - } - virtual void Next(int layer) { - tstringstream flashParam; - flashParam << TEXT("") << layer << TEXT(""); - LOG << LogLevel::Debug << TEXT("Invoking next-command"); - pFlashProducer_->Param(flashParam.str()); - } - virtual void Update(int layer, const tstring& data) { - tstringstream flashParam; - flashParam << TEXT("") << layer << TEXT(""); - LOG << LogLevel::Debug << TEXT("Invoking update-command"); - pFlashProducer_->Param(flashParam.str()); - } - virtual void Invoke(int layer, const tstring& label) { - tstringstream flashParam; - flashParam << TEXT("") << layer << TEXT("") << label << TEXT(""); - LOG << LogLevel::Debug << TEXT("Invoking invoke-command"); - pFlashProducer_->Param(flashParam.str()); - } -}; - -class FlashCGProxy17 : public FlashCGProxy -{ -public: - FlashCGProxy17::FlashCGProxy17() - { - pFlashProducer_ = FlashProducer::Create(GetApplication()->GetTemplateFolder()+TEXT("CG.fth.17")); - if(!pFlashProducer_) - throw std::exception("Failed to create flashproducer for templatehost"); - } - - virtual void Add(int layer, const tstring& templateName, bool playOnLoad, const tstring& label, const tstring& data) { - tstringstream flashParam; - - tstring::size_type pos = templateName.find('.'); - tstring filename = (pos != tstring::npos) ? templateName.substr(0, pos) : templateName; - - flashParam << TEXT("") << layer << TEXT("") << filename << TEXT("") << (playOnLoad?TEXT(""):TEXT("")) << TEXT("") << label << TEXT(""); - LOG << LogLevel::Debug << TEXT("Invoking add-command"); - pFlashProducer_->Param(flashParam.str()); - } - virtual void Remove(int layer) { - tstringstream flashParam; - flashParam << TEXT("") << layer << TEXT(""); - LOG << LogLevel::Debug << TEXT("Invoking remove-command"); - pFlashProducer_->Param(flashParam.str()); - } - virtual void Play(int layer) { - tstringstream flashParam; - flashParam << TEXT("") << layer << TEXT(""); - LOG << LogLevel::Debug << TEXT("Invoking play-command"); - pFlashProducer_->Param(flashParam.str()); - } - virtual void Stop(int layer, unsigned int mixOutDuration) { - tstringstream flashParam; - flashParam << TEXT("") << layer << TEXT("") << mixOutDuration << TEXT(""); - LOG << LogLevel::Debug << TEXT("Invoking stop-command"); - pFlashProducer_->Param(flashParam.str()); - } - virtual void Next(int layer) { - tstringstream flashParam; - flashParam << TEXT("") << layer << TEXT(""); - LOG << LogLevel::Debug << TEXT("Invoking next-command"); - pFlashProducer_->Param(flashParam.str()); - } - virtual void Update(int layer, const tstring& data) { - tstringstream flashParam; - flashParam << TEXT("") << layer << TEXT(""); - LOG << LogLevel::Debug << TEXT("Invoking update-command"); - pFlashProducer_->Param(flashParam.str()); - } - virtual void Invoke(int layer, const tstring& label) { - tstringstream flashParam; - flashParam << TEXT("") << layer << TEXT("") << label << TEXT(""); - LOG << LogLevel::Debug << TEXT("Invoking invoke-command"); - pFlashProducer_->Param(flashParam.str()); - } -}; - -class FlashCGProxy18 : public FlashCGProxy17 -{ -public: - FlashCGProxy18::FlashCGProxy18(Monitor* pMonitor) - { - pFlashProducer_ = FlashProducer::Create(GetApplication()->GetTemplateFolder()+TEXT("CG.fth.18"), pMonitor); - if(!pFlashProducer_) - throw std::exception("Failed to create flashproducer for templatehost"); - } - - virtual void Add(int layer, const tstring& templateName, bool playOnLoad, const tstring& label, const tstring& data) { - tstringstream flashParam; - flashParam << TEXT("") << layer << TEXT("") << templateName << TEXT("") << (playOnLoad?TEXT(""):TEXT("")) << TEXT("") << label << TEXT(""); - LOG << LogLevel::Debug << TEXT("Invoking add-command"); - pFlashProducer_->Param(flashParam.str()); - } -}; - -FlashCGProxy::FlashCGProxy() -{} - -FlashCGProxy::~FlashCGProxy() -{} - -FlashCGProxyPtr FlashCGProxy::Create(Monitor* pMonitor) -{ - FlashCGProxyPtr result; - switch(cgVersion_) { - case 18: - result.reset(new FlashCGProxy18(pMonitor)); - break; - case 17: - result.reset(new FlashCGProxy17()); - break; - case 16: - result.reset(new FlashCGProxy16()); - break; - - default: - break; - } - - return result; -} - -void FlashCGProxy::SetCGVersion() { - if(exists(GetApplication()->GetTemplateFolder()+TEXT("cg.fth.18"))) { - LOG << TEXT("Running version 1.8 template graphics."); - cgVersion_ = 18; - } - else if(exists(GetApplication()->GetTemplateFolder()+TEXT("cg.fth.17"))) { - LOG << TEXT("Running version 1.7 template graphics."); - cgVersion_ = 17; - } - else if(exists(GetApplication()->GetTemplateFolder()+TEXT("cg.fth"))) { - LOG << TEXT("Running version 1.6 template graphics."); - cgVersion_ = 16; - } - else { - LOG << TEXT("No templatehost found. Template graphics will be disabled"); - cgVersion_ = 0; - } -} - -bool FlashCGProxy::Initialize(FrameManagerPtr pFrameManager) { - return pFlashProducer_->Initialize(pFrameManager); -} - -FrameBuffer& FlashCGProxy::GetFrameBuffer() { - return pFlashProducer_->GetFrameBuffer(); -} - -bool FlashCGProxy::IsEmpty() const { - return pFlashProducer_->IsEmpty(); -} -void FlashCGProxy::SetEmptyAlert(EmptyCallback callback) { - pFlashProducer_->SetEmptyAlert(callback); -} -void FlashCGProxy::Stop() { - pFlashProducer_->Stop(); -} - -void FlashCGProxy::Clear() { - pFlashProducer_->Stop(); -} - -/* -void FlashCGProxy::Add(int layer, const tstring& templateName, bool playOnLoad, const tstring& label, const tstring& data) { - tstringstream flashParam; - -#if TEMPLATEHOST_VERSION < 1700 - flashParam << TEXT("") << layer << TEXT("") << templateName << TEXT("0") << (playOnLoad?TEXT(""):TEXT("")) << TEXT("") << label << TEXT(""); -#else - flashParam << TEXT("") << layer << TEXT("") << templateName << TEXT("") << (playOnLoad?TEXT(""):TEXT("")) << TEXT("") << label << TEXT(""); -#endif - - LOG << LogLevel::Debug << TEXT("Invoking add-command"); - pFlashProducer_->Param(flashParam.str()); -} - -void FlashCGProxy::Remove(int layer) { - tstringstream flashParam; -#if TEMPLATEHOST_VERSION < 1700 - flashParam << TEXT("") << layer << TEXT(""); -#else - flashParam << TEXT("") << layer << TEXT(""); -#endif - LOG << LogLevel::Debug << TEXT("Invoking remove-command"); - pFlashProducer_->Param(flashParam.str()); -} - - -void FlashCGProxy::Play(int layer) { - tstringstream flashParam; -#if TEMPLATEHOST_VERSION < 1700 - flashParam << TEXT("") << layer << TEXT(""); -#else - flashParam << TEXT("") << layer << TEXT(""); -#endif - - LOG << LogLevel::Debug << TEXT("Invoking play-command"); - pFlashProducer_->Param(flashParam.str()); -} - -void FlashCGProxy::Stop(int layer, unsigned int mixOutDuration) { - tstringstream flashParam; -#if TEMPLATEHOST_VERSION < 1700 - flashParam << TEXT("") << layer << TEXT("") << mixOutDuration << TEXT(""); -#else - flashParam << TEXT("") << layer << TEXT("") << mixOutDuration << TEXT(""); -#endif - LOG << LogLevel::Debug << TEXT("Invoking stop-command"); - pFlashProducer_->Param(flashParam.str()); -} - -void FlashCGProxy::Next(int layer) { - tstringstream flashParam; -#if TEMPLATEHOST_VERSION < 1700 - flashParam << TEXT("") << layer << TEXT(""); -#else - flashParam << TEXT("") << layer << TEXT(""); -#endif - LOG << LogLevel::Debug << TEXT("Invoking next-command"); - pFlashProducer_->Param(flashParam.str()); -} - -void FlashCGProxy::Update(int layer, const tstring& data) { - tstringstream flashParam; -#if TEMPLATEHOST_VERSION < 1700 - flashParam << TEXT("") << layer << TEXT(""); -#else - flashParam << TEXT("") << layer << TEXT(""); -#endif - LOG << LogLevel::Debug << TEXT("Invoking update-command"); - pFlashProducer_->Param(flashParam.str()); -} - -void FlashCGProxy::Invoke(int layer, const tstring& label) { - tstringstream flashParam; -#if TEMPLATEHOST_VERSION < 1700 - flashParam << TEXT("") << layer << TEXT("") << label << TEXT(""); -#else - flashParam << TEXT("") << layer << TEXT("") << label << TEXT(""); -#endif - LOG << LogLevel::Debug << TEXT("Invoking invoke-command"); - pFlashProducer_->Param(flashParam.str()); -} -*/ -} //namespace CG -} //namespace caspar \ No newline at end of file diff --git a/server/cg/FlashCGProxy.h b/server/cg/FlashCGProxy.h deleted file mode 100644 index d23a563f6..000000000 --- a/server/cg/FlashCGProxy.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _CASPAR_FLASHCGPROXY_H__ -#define _CASPAR_FLASHCGPROXY_H__ - -#pragma once - -#include "CGControl.h" - -namespace caspar { - -class Monitor; - -class FlashProducer; -typedef std::tr1::shared_ptr FlashProducerPtr; - -typedef std::tr1::function EmptyCallback; - -namespace CG { - -class FlashCGProxy; -typedef std::tr1::shared_ptr FlashCGProxyPtr; - -class FlashCGProxy : public ICGControl -{ - static int cgVersion_; - -protected: - FlashCGProxy(); - -public: - virtual ~FlashCGProxy(); - - static FlashCGProxyPtr Create(Monitor* pMonitor = 0); - - static void SetCGVersion(); - - bool Initialize(FrameManagerPtr pFrameManager); - FrameBuffer& GetFrameBuffer(); - bool IsEmpty() const; - void SetEmptyAlert(EmptyCallback callback); - void Stop(); - - //ICGControl - virtual void Clear(); - virtual void Add(int layer, const tstring& templateName, bool playOnLoad, const tstring& startFromLabel = TEXT(""), const tstring& data = TEXT("")) {} - virtual void Remove(int layer) {} - virtual void Play(int layer) {} - virtual void Stop(int layer, unsigned int mixOutDuration) {} - virtual void Next(int layer) {} - virtual void Update(int layer, const tstring& data) {} - virtual void Invoke(int layer, const tstring& label) {} - - FlashProducerPtr GetFlashProducer() { - return pFlashProducer_; - } -protected: - FlashProducerPtr pFlashProducer_; -}; - - -} //namespace CG -} //namespace caspar - -#endif //_CASPAR_FLASHCGPROXY_H__ \ No newline at end of file diff --git a/server/cii/CIICommand.h b/server/cii/CIICommand.h deleted file mode 100644 index 53b9700bc..000000000 --- a/server/cii/CIICommand.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -#include -#include - -namespace caspar { -namespace cii { - -class ICIICommand -{ -public: - virtual ~ICIICommand() {} - virtual int GetMinimumParameters() = 0; - virtual void Setup(const std::vector& parameters) = 0; - - virtual void Execute() = 0; -}; -typedef std::tr1::shared_ptr CIICommandPtr; - -} //namespace cii -} //namespace caspar \ No newline at end of file diff --git a/server/cii/CIICommandsImpl.cpp b/server/cii/CIICommandsImpl.cpp deleted file mode 100644 index bcb3336f2..000000000 --- a/server/cii/CIICommandsImpl.cpp +++ /dev/null @@ -1,188 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\StdAfx.h" - -#include "CIIProtocolStrategy.h" -#include "..\channel.h" -#include "..\cg\cgcontrol.h" -#include "CIICommandsImpl.h" -#include -#include - -namespace caspar { -namespace cii { - -///////////////// -// MediaCommand -void MediaCommand::Setup(const std::vector& parameters) { - graphicProfile_ = parameters[1].substr(2); -} - -void MediaCommand::Execute() { - pCIIStrategy_->SetProfile(graphicProfile_); -} - - -///////////////// -// WriteCommand -void WriteCommand::Setup(const std::vector& parameters) { - try { - if(parameters.size()>2) { - targetName_ = parameters[1]; - templateName_ = parameters[2]; - - tstringstream dataStream; - - dataStream << TEXT(""); - - std::vector::size_type end = parameters.size(); - for(std::vector::size_type i = 3; i < end; ++i) { - dataStream << TEXT(""); - } - - dataStream << TEXT(""); - xmlData_ = dataStream.str(); - } - } - catch(std::exception) { - } -} - -void WriteCommand::Execute() { - pCIIStrategy_->WriteTemplateData(templateName_, targetName_, xmlData_); -} - - -////////////////////// -// ImagestoreCommand -void ImagestoreCommand::Setup(const std::vector& parameters) { - if(parameters[1] == TEXT("7") && parameters.size() > 2) { - titleName_ = parameters[2].substr(0, 4); - } -} - -void ImagestoreCommand::Execute() { - pCIIStrategy_->DisplayTemplate(titleName_); -} - - -////////////////////// -// MiscellaneousCommand -void MiscellaneousCommand::Setup(const std::vector& parameters) { - //HAWRYS: V\5\3\1\1\namn.tga\1 - // Display still - if((parameters.size() > 5) && parameters[1] == TEXT("5") && parameters[2] == TEXT("3")) { - filename_ = parameters[5]; - filename_ = filename_.substr(0, filename_.find_last_of(TEXT('.'))); - state_ = 0; - return; - } - - //NEPTUNE: V\5\13\1\X\Template\0\TabField1\TabField2... - // Add Template to layer X in the active templatehost - if((parameters.size() > 5) && parameters[1] == TEXT("5") && parameters[2] == TEXT("13")) - { - layer_ = _ttoi(parameters[4].c_str()); - filename_ = parameters[5]; - state_ = 1; - if(parameters.size() > 7) { - tstringstream dataStream; - - dataStream << TEXT(""); - std::vector::size_type end = parameters.size(); - for(std::vector::size_type i = 7; i < end; ++i) { - dataStream << TEXT(""); - } - dataStream << TEXT(""); - - xmlData_ = dataStream.str(); - } - } - - // VIDEO MODE V\5\14\MODE - if((parameters.size() > 3) && parameters[1] == TEXT("5") && parameters[2] == TEXT("14")) - { - tstring value = parameters[3]; - std::transform(value.begin(), value.end(), value.begin(), toupper); - - this->pCIIStrategy_->GetChannel()->SetVideoFormat(value); - } -} - -void MiscellaneousCommand::Execute() { - if(state_ == 0) - { - pCIIStrategy_->DisplayMediaFile(filename_); - } - - //TODO: Need to be checked for validity - else if(state_ == 1) - pCIIStrategy_->GetCGControl()->Add(layer_, filename_, false, TEXT(""), xmlData_); -} - - -/////////////////// -// KeydataCommand -void KeydataCommand::Execute() { - if(state_ == 0) - { - pCIIStrategy_->DisplayTemplate(titleName_); - } - - //TODO: Need to be checked for validity - else if(state_ == 1) - pCIIStrategy_->GetCGControl()->Stop(layer_, 0); - else if(state_ == 2) - pCIIStrategy_->GetCGControl()->Clear(); - else if(state_ == 3) - pCIIStrategy_->GetCGControl()->Play(layer_); -} - -void KeydataCommand::Setup(const std::vector& parameters) { - //HAWRYS: Y\<205><247><202><196><192><192><200><248> - //parameter[1] looks like this: "=g:XXXXh" where XXXX is the name that we want - if(parameters[1].size() > 6) { - titleName_.resize(4); - for(int i=0;i<4;++i) { - if(parameters[1][i+3] < 176) { - titleName_ = TEXT(""); - break; - } - titleName_[i] = parameters[1][i+3]-144; - } - state_ = 0; - } - - if(parameters.size() > 2) - { - layer_ = _ttoi(parameters[2].c_str()); - } - - if(parameters[1].at(0) == 27) //NEPTUNE: Y\<27>\X Stop layer X. - state_ = 1; - else if(static_cast(parameters[1].at(0)) == 254) //NEPTUNE: Y\<254> Clear Canvas. - state_ = 2; - else if(static_cast(parameters[1].at(0)) == 213) //NEPTUNE: Y\<213><243>\X Play layer X. - state_ = 3; -} - -} //namespace cii -} //namespace caspar \ No newline at end of file diff --git a/server/cii/CIICommandsImpl.h b/server/cii/CIICommandsImpl.h deleted file mode 100644 index b7a2f4b7d..000000000 --- a/server/cii/CIICommandsImpl.h +++ /dev/null @@ -1,137 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -#include -#include - -#include "ciicommand.h" - -namespace caspar { - -namespace cii { - -class CIIProtocolStrategy; - -class MediaCommand : public ICIICommand -{ -public: - MediaCommand(CIIProtocolStrategy* pPS) : pCIIStrategy_(pPS) - {} - - virtual int GetMinimumParameters() { - return 1; - } - - virtual void Setup(const std::vector& parameters); - virtual void Execute(); - -private: - tstring graphicProfile_; - - CIIProtocolStrategy* pCIIStrategy_; -}; - -class WriteCommand : public ICIICommand -{ -public: - WriteCommand(CIIProtocolStrategy* pPS) : pCIIStrategy_(pPS) - {} - - virtual int GetMinimumParameters() { - return 2; - } - - virtual void Setup(const std::vector& parameters); - virtual void Execute(); - -private: - tstring targetName_; - tstring templateName_; - tstring xmlData_; - - CIIProtocolStrategy* pCIIStrategy_; -}; - -class MiscellaneousCommand : public ICIICommand -{ -public: - MiscellaneousCommand(CIIProtocolStrategy* pPS) : pCIIStrategy_(pPS), state_(-1), layer_(0) - {} - - virtual int GetMinimumParameters() { - return 5; - } - - virtual void Setup(const std::vector& parameters); - virtual void Execute(); - -private: - tstring filename_; - tstring xmlData_; - int state_; - int layer_; - - CIIProtocolStrategy* pCIIStrategy_; -}; - -class ImagestoreCommand : public ICIICommand -{ -public: - ImagestoreCommand(CIIProtocolStrategy* pPS) : pCIIStrategy_(pPS) - {} - - virtual int GetMinimumParameters() { - return 1; - } - - virtual void Setup(const std::vector& parameters); - virtual void Execute(); - -private: - tstring titleName_; - - CIIProtocolStrategy* pCIIStrategy_; -}; - -class KeydataCommand : public ICIICommand -{ -public: - KeydataCommand(CIIProtocolStrategy* pPS) : pCIIStrategy_(pPS), state_(-1), layer_(0) - {} - - virtual int GetMinimumParameters() { - return 1; - } - - virtual void Setup(const std::vector& parameters); - virtual void Execute(); - -private: - tstring titleName_; - int state_; - int layer_; - - CIIProtocolStrategy* pCIIStrategy_; -}; - -} //namespace cii -} //namespace caspar \ No newline at end of file diff --git a/server/cii/CIIProtocolStrategy.cpp b/server/cii/CIIProtocolStrategy.cpp deleted file mode 100644 index 92a6b9cd9..000000000 --- a/server/cii/CIIProtocolStrategy.cpp +++ /dev/null @@ -1,296 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\StdAfx.h" - -#include -#include -#include -#include "CIIProtocolStrategy.h" -#include "CIICommandsimpl.h" -#include "..\producers\flash\FlashManager.h" -#include "..\application.h" -#include "..\fileinfo.h" - -namespace caspar { -namespace cii { - -using namespace utils; - -const tstring CIIProtocolStrategy::MessageDelimiter = TEXT("\r\n"); -const TCHAR CIIProtocolStrategy::TokenDelimiter = TEXT('\\'); - -CIIProtocolStrategy::CIIProtocolStrategy() { - pChannel_ = GetApplication()->GetChannel(0); - pCGControl_ = pChannel_->GetCGControl(); - - if(!commandQueue_.Start()) { - //throw - } -} - -CIIProtocolStrategy::~CIIProtocolStrategy() { -} - -void CIIProtocolStrategy::Parse(const TCHAR* pData, int charCount, caspar::IO::ClientInfoPtr pClientInfo) { - std::size_t pos; - tstring msg(pData, charCount); - tstring availibleData = currentMessage_ + msg; - - while(true) { - pos = availibleData.find(MessageDelimiter); - if(pos != tstring::npos) - { - tstring message = availibleData.substr(0,pos); - - if(message.length() > 0) { - ProcessMessage(message); - if(pClientInfo != 0) - pClientInfo->Send(TEXT("*\r\n")); - } - - std::size_t nextStartPos = pos + MessageDelimiter.length(); - if(nextStartPos < availibleData.length()) - availibleData = availibleData.substr(nextStartPos); - else { - availibleData.clear(); - break; - } - } - else - break; - } - currentMessage_ = availibleData; -} - -void CIIProtocolStrategy::ProcessMessage(const tstring& message) { - LOG << message.c_str() << LogStream::Flush; - - std::vector tokens; - int tokenCount = TokenizeMessage(message, &tokens); - - CIICommandPtr pCommand = Create(tokens[0]); - if((pCommand != 0) && (tokenCount-1) >= pCommand->GetMinimumParameters()) { - pCommand->Setup(tokens); - commandQueue_.AddCommand(pCommand); - } - else { - //report error - } -} - -int CIIProtocolStrategy::TokenizeMessage(const tstring& message, std::vector* pTokenVector) -{ - tstringstream currentToken; - - for(unsigned int charIndex=0; charIndexpush_back(currentToken.str()); - currentToken.str(TEXT("")); - continue; - } - - if(message[charIndex] == TEXT('\"')) { - currentToken << TEXT("""); - } - else if(message[charIndex] == TEXT('<')) { - currentToken << TEXT("<"); - } - else if(message[charIndex] == TEXT('>')) { - currentToken << TEXT(">"); - } - else - currentToken << message[charIndex]; - } - - if(currentToken.str().size() > 0) { - pTokenVector->push_back(currentToken.str()); - } - - return (int)pTokenVector->size(); -} - -/************ -// Examples ( = ASCIICHAR X) - -I\25\3\VII\\ sätter outputtype till 'vii' -I\25\4\1\\ enablar framebuffer (ignore this) - -M\C/SVTNEWS\\ pekar ut vilken grafisk profil som skall användas - -W\4009\4067\Jonas Björkman\\ Skriver "Jonas Björkman" till första textfältet i template 4067 och sparar den färdiga skylten som 4009 - -T\7\4009.VII\A\\ lägger ut skylt 4009 - -Y\<205><247><202><196><192><192><200><248>\\ lägger ut skylten 4008 (<205><247><202><196><192><192><200><248> = "=g:4008h" om man drar bort 144 från varje asciivärde) - -V\5\3\1\1\namn.tga\1\\ lägger ut bilden namn.tga -V\0\1\D\C\10\0\0\0\\ gör någon inställning som har med föregående kommando att göra. - -*************/ - -/********************** -New Commands to support the Netupe automation system -V\5\13\1\1\Template\0\TabField1\TabField2...\\ Build. Ettan före Template indikerar vilket lager den nya templaten skall laddas in i. OBS. Skall inte visas efter det här steget -Y\<27>\\ Stop. Här kommer ett lagerID också att skickas med (<27> = ESC) -Y\<254>\\ Clear Canvas. Här kommer ett lagerID också att skickas med, utan det skall allt tömmas -Y\<213><243>\\ Play. Här kommer ett lagerID också att skickas med - -**********************/ -CIICommandPtr CIIProtocolStrategy::Create(const tstring& name) { - CIICommandPtr result; - - switch(name[0]) { - case TEXT('M'): - result = CIICommandPtr(new MediaCommand(this)); - break; - case TEXT('W'): - result = CIICommandPtr(new WriteCommand(this)); - break; - case TEXT('T'): - result = CIICommandPtr(new ImagestoreCommand(this)); - break; - case TEXT('V'): - result = CIICommandPtr(new MiscellaneousCommand(this)); - break; - case TEXT('Y'): - result = CIICommandPtr(new KeydataCommand(this)); - break; - - default: - break; - } - - return result; -} - -void CIIProtocolStrategy::WriteTemplateData(const tstring& templateName, const tstring& titleName, const tstring& xmlData) { - tstring fullTemplateFilename = GetApplication()->GetTemplateFolder(); - if(currentProfile_.size() > 0) - { - fullTemplateFilename += currentProfile_; - fullTemplateFilename += TEXT("\\"); - } - fullTemplateFilename += templateName; - - if(!GetApplication()->FindTemplate(fullTemplateFilename)) - { - LOG << TEXT("Failed to save instance of ") << templateName << TEXT(" as ") << titleName << TEXT(", template ") << fullTemplateFilename << TEXT(" not found") << LogStream::Flush; - return; - } - - MediaProducerPtr pFP = pFlashManager_->CreateProducer(GetApplication()->GetTemplateFolder()+TEXT("CG.fth")); - if(pFP != 0) - { - //TODO: Initialize with valid FrameFactory -// pFP->Initialize(0, false); - - tstringstream flashParam; - flashParam << TEXT("1") << currentProfile_ << '/' << templateName << TEXT("0 "); - pFP->Param(flashParam.str()); - - LOG << LogLevel::Verbose << TEXT("Saved an instance of ") << templateName << TEXT(" as ") << titleName << LogStream::Flush; - - PutPreparedTemplate(titleName, pFP); - } -} - -void CIIProtocolStrategy::DisplayTemplate(const tstring& titleName) { - MediaProducerPtr pFP = GetPreparedTemplate(titleName); - if(pFP != 0) - { - TransitionInfo transition; - if(pChannel_->LoadBackground(pFP, transition)) { - pChannel_->Play(); - - LOG << LogLevel::Verbose << TEXT("Displayed title ") << titleName << LogStream::Flush; - return; - } - } - LOG << TEXT("Failed to display title ") << titleName << LogStream::Flush; -} - -void CIIProtocolStrategy::DisplayMediaFile(const tstring& filename) { - caspar::FileInfo fileInfo; - MediaManagerPtr pMediaManager = GetApplication()->FindMediaFile(GetApplication()->GetMediaFolder()+filename, &fileInfo); - if(pMediaManager != 0) - { - tstring fullFilename = filename; - if(fileInfo.filetype.length()>0) - { - fullFilename += TEXT("."); - fullFilename += fileInfo.filetype; - } - - MediaProducerPtr pFP = pMediaManager->CreateProducer(GetApplication()->GetMediaFolder()+fullFilename); - if(pFP != 0) - { - caspar::TransitionInfo transition; - transition.type_ = Mix; - transition.duration_ = 12; - if(pChannel_->LoadBackground(pFP, transition)){ - pChannel_->Play(); - - LOG << LogLevel::Verbose << TEXT("Displayed ") << fullFilename << LogStream::Flush; - return; - } - } - } - LOG << TEXT("Failed to display ") << filename << LogStream::Flush; -} - -MediaProducerPtr CIIProtocolStrategy::GetPreparedTemplate(const tstring& titleName) { - MediaProducerPtr result; - - TitleList::iterator it = std::find(titles_.begin(), titles_.end(), titleName); - if(it != titles_.end()) { - LOG << LogLevel::Debug << TEXT("Found title with name ") << (*it).titleName << LogStream::Flush; - result = (*it).pMediaProducer; - } - else { - LOG << TEXT("Could not find title with name ") << titleName << LogStream::Flush; - } - - return result; -} - -void CIIProtocolStrategy::PutPreparedTemplate(const tstring& titleName, MediaProducerPtr& pFP) { - LOG << LogLevel::Debug << TEXT("Saved title with name ") << titleName << LogStream::Flush; - - TitleList::iterator it = std::find(titles_.begin(), titles_.end(), titleName); - if(it != titles_.end()) { - titles_.remove((*it)); - } - - titles_.push_front(TitleHolder(titleName, pFP)); - - if(titles_.size() >= 6) - titles_.resize(5); -} - -bool operator==(const CIIProtocolStrategy::TitleHolder& lhs, const tstring& rhs) { - return lhs.titleName == rhs; -} -bool operator==(const tstring& lhs, const CIIProtocolStrategy::TitleHolder& rhs) { - return lhs == rhs.titleName; -} - -} //namespace cii -} //namespace caspar diff --git a/server/cii/CIIProtocolStrategy.h b/server/cii/CIIProtocolStrategy.h deleted file mode 100644 index 9310886de..000000000 --- a/server/cii/CIIProtocolStrategy.h +++ /dev/null @@ -1,108 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once -#include -#include "..\io\ProtocolStrategy.h" -#include "..\utils\commandqueue.h" -#include "..\channel.h" -#include "..\MediaManager.h" -#include "CIICommand.h" - -namespace caspar { - namespace CG { class ICGControl; } -namespace cii { - -class CIIProtocolStrategy : public caspar::IO::IProtocolStrategy -{ -public: - CIIProtocolStrategy(); - virtual ~CIIProtocolStrategy(); - - virtual void Parse(const TCHAR* pData, int charCount, caspar::IO::ClientInfoPtr pClientInfo); - virtual UINT GetCodepage() { - return 28591; //ISO 8859-1 - } - - void SetProfile(const tstring& profile) { - currentProfile_ = profile; - } - caspar::CG::ICGControl* GetCGControl() const { - return pCGControl_; - } - - caspar::ChannelPtr GetChannel() const - { - return this->pChannel_; - } - - void DisplayMediaFile(const tstring& filename); - void DisplayTemplate(const tstring& titleName); - void WriteTemplateData(const tstring& templateName, const tstring& titleName, const tstring& xmlData); - -public: - struct TitleHolder - { - TitleHolder() : titleName(TEXT("")) - {} - TitleHolder(const tstring& name, MediaProducerPtr pFP) : titleName(name), pMediaProducer(pFP) - {} - TitleHolder(const TitleHolder& th) : titleName(th.titleName), pMediaProducer(th.pMediaProducer) - {} - const TitleHolder& operator=(const TitleHolder& th) { - titleName = th.titleName; - pMediaProducer = th.pMediaProducer; - } - bool operator==(const TitleHolder& rhs) { - return pMediaProducer == rhs.pMediaProducer; - } - - tstring titleName; - MediaProducerPtr pMediaProducer; - friend CIIProtocolStrategy; - }; -private: - friend TitleHolder; - friend bool operator==(const TitleHolder& lhs, const tstring& rhs); - friend bool operator==(const tstring& lhs, const TitleHolder& rhs); - - typedef std::list TitleList; - TitleList titles_; - MediaProducerPtr GetPreparedTemplate(const tstring& name); - void PutPreparedTemplate(const tstring& name, MediaProducerPtr& pMediaProducer); - - static const TCHAR TokenDelimiter; - static const tstring MessageDelimiter; - - void ProcessMessage(const tstring& message); - int TokenizeMessage(const tstring& message, std::vector* pTokenVector); - CIICommandPtr Create(const tstring& name); - - caspar::utils::CommandQueue commandQueue_; - tstring currentMessage_; - - tstring currentProfile_; - caspar::MediaManagerPtr pFlashManager_; - caspar::CG::ICGControl* pCGControl_; - ChannelPtr pChannel_; -}; - -} //namespace cii -} //namespace caspar diff --git a/server/consumers/Audio/AudioConsumer.cpp b/server/consumers/Audio/AudioConsumer.cpp deleted file mode 100644 index fa4335a9f..000000000 --- a/server/consumers/Audio/AudioConsumer.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\stdafx.h" - -#include "AudioConsumer.h" -#include "..\..\frame\FramePlaybackControl.h" -#include "..\..\frame\SystemFrameManager.h" -#include "..\..\frame\Frame.h" -#include "..\..\frame\FramePlaybackStrategy.h" -#include "..\..\utils\image\Image.hpp" - -namespace caspar { -namespace audio { - - -struct AudioConsumer::Implementation -{ - struct AudioPlaybackStrategy : public IFramePlaybackStrategy - { - explicit AudioPlaybackStrategy(Implementation* pConsumerImpl) : pConsumerImpl_(pConsumerImpl) - { - lastTime_ = timeGetTime(); - } - - FrameManagerPtr GetFrameManager() - { - return pConsumerImpl_->pFrameManager_; - } - FramePtr GetReservedFrame() - { - return pConsumerImpl_->pFrameManager_->CreateFrame(); - } - - void DisplayFrame(Frame* pFrame) - { - DWORD timediff = timeGetTime() - lastTime_; - if(timediff < 30) { - Sleep(40 - timediff); - lastTime_ += 40; - } - else - lastTime_ = timeGetTime(); - - if(pFrame == NULL || pFrame->ID() == lastFrameID_) - return; - - lastFrameID_ = pFrame->ID(); - } - - Implementation* pConsumerImpl_; - DWORD lastTime_; - utils::ID lastFrameID_; - }; - - explicit Implementation(const FrameFormatDescription& fmtDesc) : fmtDesc_(fmtDesc) - { - SetupDevice(); - } - - ~Implementation() - { - ReleaseDevice(); - } - - bool SetupDevice() - { - pFrameManager_.reset(new SystemFrameManager(fmtDesc_)); - pPlaybackControl_.reset(new FramePlaybackControl(FramePlaybackStrategyPtr(new AudioPlaybackStrategy(this)))); - - pPlaybackControl_->Start(); - return true; - } - - bool ReleaseDevice() - { - pPlaybackControl_->Stop(); - return true; - } - - FramePlaybackControlPtr pPlaybackControl_; - SystemFrameManagerPtr pFrameManager_; - - FrameFormatDescription fmtDesc_; -}; - -AudioConsumer::AudioConsumer(const FrameFormatDescription& fmtDesc) : pImpl_(new Implementation(fmtDesc)) -{} - -AudioConsumer::~AudioConsumer() -{} - -IPlaybackControl* AudioConsumer::GetPlaybackControl() const -{ - return pImpl_->pPlaybackControl_.get(); -} - -bool AudioConsumer::SetupDevice(unsigned int deviceIndex) -{ - return pImpl_->SetupDevice(); -} - -bool AudioConsumer::ReleaseDevice() -{ - return pImpl_->ReleaseDevice(); -} - -void AudioConsumer::EnableVideoOutput(){} -void AudioConsumer::DisableVideoOutput(){} - -const FrameFormatDescription& AudioConsumer::GetFrameFormatDescription() const { - return pImpl_->fmtDesc_; -} -const TCHAR* AudioConsumer::GetFormatDescription() const { - return pImpl_->fmtDesc_.name; -} - - -} //namespace audio -} //namespace caspar \ No newline at end of file diff --git a/server/consumers/Audio/AudioConsumer.h b/server/consumers/Audio/AudioConsumer.h deleted file mode 100644 index 5253935d4..000000000 --- a/server/consumers/Audio/AudioConsumer.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once -#include "..\..\VideoConsumer.h" -#include "..\..\MediaProducer.h" - -#include "..\..\utils\thread.h" -#include "..\..\utils\lockable.h" -#include "..\..\utils\Noncopyable.hpp" - -#include "..\..\frame\Frame.h" - -namespace caspar { -namespace audio { - -class AudioConsumer : public IVideoConsumer, private utils::LockableObject, utils::Noncopyable -{ -public: - explicit AudioConsumer(const FrameFormatDescription& fmtDesc); - virtual ~AudioConsumer(); - - virtual IPlaybackControl* GetPlaybackControl() const; - - virtual void EnableVideoOutput(); - virtual void DisableVideoOutput(); - virtual bool SetupDevice(unsigned int deviceIndex); - virtual bool ReleaseDevice(); - virtual const FrameFormatDescription& GetFrameFormatDescription() const; - virtual const TCHAR* GetFormatDescription() const; - -private: - struct Implementation; - std::tr1::shared_ptr pImpl_; -}; - -} //namespace audio -} //namespace caspar \ No newline at end of file diff --git a/server/consumers/GDI/GDIVideoConsumer.cpp b/server/consumers/GDI/GDIVideoConsumer.cpp deleted file mode 100644 index 936fc0c60..000000000 --- a/server/consumers/GDI/GDIVideoConsumer.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\stdafx.h" - -#include "GDIVideoConsumer.h" -#include "..\..\frame\FramePlaybackControl.h" -#include "..\..\frame\BitmapFrameManager.h" -#include "..\..\frame\Frame.h" -#include "..\..\frame\FramePlaybackStrategy.h" -#include "..\..\utils\DCWrapper.h" -#include "..\..\utils\BitmapHolder.h" -#include "..\..\utils\image\Image.hpp" - -namespace caspar { -namespace gdi { - - -struct GDIVideoConsumer::Implementation -{ - struct GDIPlaybackStrategy : public IFramePlaybackStrategy - { - GDIPlaybackStrategy(Implementation* pConsumerImpl) : pConsumerImpl_(pConsumerImpl), pTempBitmapData_(new BitmapHolder(pConsumerImpl_->hWnd_, pConsumerImpl_->fmtDesc_.width, pConsumerImpl_->fmtDesc_.height)) - { - lastTime_ = timeGetTime(); - } - - FrameManagerPtr GetFrameManager() - { - return pConsumerImpl_->pFrameManager_; - } - FramePtr GetReservedFrame() - { - return pConsumerImpl_->pFrameManager_->CreateFrame(); - } - - void DisplayFrame(Frame* pFrame) - { - DWORD timediff = timeGetTime() - lastTime_; - if(timediff < 30) { - Sleep(40 - timediff); - lastTime_ += 40; - } - else - lastTime_ = timeGetTime(); - - if(pFrame == NULL || pFrame->ID() == lastFrameID_) - return; - - DCWrapper hDC(pConsumerImpl_->hWnd_); - - RECT rect; - GetClientRect(pConsumerImpl_->hWnd_, &rect); - if(this->GetFrameManager()->Owns(*pFrame)) - BitBlt(hDC, rect.left, rect.top, rect.right, rect.bottom, reinterpret_cast(pFrame->GetMetadata()), 0, 0, SRCCOPY); - else { - utils::image::Copy(pTempBitmapData_->GetPtr(), pFrame->GetDataPtr(), pFrame->GetDataSize()); - BitBlt(hDC, rect.left, rect.top, rect.right, rect.bottom, pTempBitmapData_->GetDC(), 0, 0, SRCCOPY); - } - - lastFrameID_ = pFrame->ID(); - } - - Implementation* pConsumerImpl_; - BitmapHolderPtr pTempBitmapData_; - DWORD lastTime_; - utils::ID lastFrameID_; - }; - - Implementation(HWND hWnd, const FrameFormatDescription& fmtDesc) : hWnd_(hWnd), fmtDesc_(fmtDesc) - { - SetupDevice(); - } - - ~Implementation() - { - ReleaseDevice(); - } - - bool SetupDevice() - { - pFrameManager_.reset(new BitmapFrameManager(fmtDesc_, hWnd_)); - pPlaybackControl_.reset(new FramePlaybackControl(FramePlaybackStrategyPtr(new GDIPlaybackStrategy(this)))); - - pPlaybackControl_->Start(); - return true; - } - - bool ReleaseDevice() - { - pPlaybackControl_->Stop(); - return true; - } - - FramePlaybackControlPtr pPlaybackControl_; - BitmapFrameManagerPtr pFrameManager_; - - HWND hWnd_; - FrameFormatDescription fmtDesc_; -}; - -GDIVideoConsumer::GDIVideoConsumer(HWND hWnd, const FrameFormatDescription& fmtDesc) : pImpl_(new Implementation(hWnd, fmtDesc)) -{} - -GDIVideoConsumer::~GDIVideoConsumer() -{} - -IPlaybackControl* GDIVideoConsumer::GetPlaybackControl() const -{ - return pImpl_->pPlaybackControl_.get(); -} - -bool GDIVideoConsumer::SetupDevice(unsigned int deviceIndex) -{ - return pImpl_->SetupDevice(); -} - -bool GDIVideoConsumer::ReleaseDevice() -{ - return pImpl_->ReleaseDevice(); -} - -void GDIVideoConsumer::EnableVideoOutput(){} -void GDIVideoConsumer::DisableVideoOutput(){} - -const FrameFormatDescription& GDIVideoConsumer::GetFrameFormatDescription() const { - return pImpl_->fmtDesc_; -} -const TCHAR* GDIVideoConsumer::GetFormatDescription() const { - return pImpl_->fmtDesc_.name; -} - - -} //namespace gdi -} //namespace caspar \ No newline at end of file diff --git a/server/consumers/GDI/GDIVideoConsumer.h b/server/consumers/GDI/GDIVideoConsumer.h deleted file mode 100644 index 3327686ba..000000000 --- a/server/consumers/GDI/GDIVideoConsumer.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once -#include "..\..\VideoConsumer.h" -#include "..\..\MediaProducer.h" - -#include "..\..\utils\thread.h" -#include "..\..\utils\lockable.h" -#include "..\..\utils\Noncopyable.hpp" - -#include "..\..\frame\BitmapFrameManager.h" -#include "..\..\frame\Frame.h" - -namespace caspar { -namespace gdi { - -class GDIVideoConsumer : public IVideoConsumer, private utils::LockableObject, utils::Noncopyable -{ -public: - GDIVideoConsumer(HWND hwnd, const FrameFormatDescription& fmtDesc); - virtual ~GDIVideoConsumer(); - - virtual IPlaybackControl* GetPlaybackControl() const; - - virtual void EnableVideoOutput(); - virtual void DisableVideoOutput(); - virtual bool SetupDevice(unsigned int deviceIndex); - virtual bool ReleaseDevice(); - virtual const FrameFormatDescription& GetFrameFormatDescription() const; - virtual const TCHAR* GetFormatDescription() const; - -private: - struct Implementation; - std::tr1::shared_ptr pImpl_; -}; - -} //namespace gdi -} //namespace caspar \ No newline at end of file diff --git a/server/consumers/OGL/OGLVideoConsumer.cpp b/server/consumers/OGL/OGLVideoConsumer.cpp deleted file mode 100644 index f8437c412..000000000 --- a/server/consumers/OGL/OGLVideoConsumer.cpp +++ /dev/null @@ -1,461 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\StdAfx.h" -#include "OGLVideoConsumer.h" -#include "..\..\frame\FramePlaybackControl.h" -#include "..\..\frame\FramePlaybackStrategy.h" - -#include - -namespace caspar { -namespace ogl { - -struct OGLVideoConsumer::Implementation -{ - struct OGLDevice - { - OGLDevice(HWND hWnd, Stretch stretch, int screenWidth, int screenHeight) - : hDC(NULL), - hRC(NULL), - width_(0), - height_(0), - size_(0), - texture_(0), - stretch_(stretch), - screenWidth_(screenWidth), - screenHeight_(screenHeight), - pboIndex_(0), - firstFrame_(true) - { - static PIXELFORMATDESCRIPTOR pfd = - { - sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor - 1, // Version Number - PFD_SUPPORT_OPENGL | // Format Must Support OpenGL - PFD_DOUBLEBUFFER, // Must Support Double Buffering - PFD_TYPE_RGBA, // Request An RGBA Format - 32, // Select Our Color Depth - 0, 0, 0, 0, 0, 0, // Color Bits Ignored - 0, // No Alpha Buffer - 0, // Shift Bit Ignored - 0, // No Accumulation Buffer - 0, 0, 0, 0, // Accumulation Bits Ignored - 0, // 16Bit Z-Buffer (Depth Buffer) - 0, // No Stencil Buffer - 0, // No Auxiliary Buffer - PFD_MAIN_PLANE, // Main Drawing Layer - 0, // Reserved - 0, 0, 0 // Layer Masks Ignored - }; - - ; - if(!(hDC = GetDC(hWnd))) - throw std::exception("Failed To Get Device Context"); - - if(!SetPixelFormat(hDC, ChoosePixelFormat(hDC, &pfd),&pfd)) - throw std::exception("Failed To Set Pixel Format"); - - if(!(hRC = wglCreateContext(hDC))) - throw std::exception("Failed To Create Render Context"); - - if(!wglMakeCurrent(hDC, hRC)) - throw std::exception("Failed To Activate Render Context"); - - glClearColor(0.0f, 0.0f, 0.0f, 0.0f); - glEnable(GL_TEXTURE_2D); - - dlist_ = glGenLists(1); - - if(glGetError() != GL_NO_ERROR) - throw std::exception("Failed To Initialize OpenGL"); - } - - ~OGLDevice() - { - if (hRC) - { - wglMakeCurrent(NULL, NULL); - wglDeleteContext(hRC); - hRC = NULL; - } - - if(texture_) - { - glDeleteTextures( 1, &texture_); - texture_ = 0; - } - glDeleteBuffers(2, pbos_); - } - - GLvoid ReSizeGLScene(GLsizei width, GLsizei height) - { - width_ = width; - height_ = height; - size_ = width_*height_*4; - - glViewport(0, 0, screenWidth_, screenHeight_); - - if(glGetError() != GL_NO_ERROR) - throw std::exception("Failed To Update Viewport"); - - float wratio = (float)width_/(float)width_; - float hratio = (float)height_/(float)height_; - - std::pair targetRatio = None(); - if(stretch_ == ogl::Fill) - targetRatio = Fill(); - else if(stretch_ == ogl::Uniform) - targetRatio = Uniform(); - else if(stretch_ == ogl::UniformToFill) - targetRatio = UniformToFill(); - - float wSize = targetRatio.first; - float hSize = targetRatio.second; - - glNewList(dlist_, GL_COMPILE); - glBegin(GL_QUADS); - glTexCoord2f(0.0f, hratio); glVertex2f(-wSize, -hSize); - glTexCoord2f(wratio, hratio); glVertex2f( wSize, -hSize); - glTexCoord2f(wratio, 0.0f); glVertex2f( wSize, hSize); - glTexCoord2f(0.0f, 0.0f); glVertex2f(-wSize, hSize); - glEnd(); - glEndList(); - - if(texture_ != 0) - { - glDeleteTextures( 1, &texture_); - texture_ = 0; - } - - glDeleteBuffers(2, pbos_); - - glGenTextures(1, &texture_); - glBindTexture( GL_TEXTURE_2D, texture_); - - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); - glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); - - glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, width_, height_, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL); - - if(glGetError() != GL_NO_ERROR) - throw std::exception("Failed To Create Texture"); - - glGenBuffersARB(2, pbos_); - GLenum error = glGetError(); - glBindBuffer(GL_PIXEL_PACK_BUFFER, pbos_[0]); - error = glGetError(); - glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, size_, 0, GL_STREAM_DRAW); - error = glGetError(); - glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, pbos_[1]); - glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, size_, 0, GL_STREAM_DRAW); - - error = glGetError(); - if(error != GL_NO_ERROR) - throw std::exception("Failed To Create PBOs"); - - pboIndex_ = 0; - } - - std::pair None() - { - float width = (float)width_/(float)screenWidth_; - float height = (float)height_/(float)screenHeight_; - - return std::make_pair(width, height); - } - - std::pair Uniform() - { - float aspect = (float)width_/(float)height_; - float width = min(1.0f, (float)screenHeight_*aspect/(float)screenWidth_); - float height = (float)(screenWidth_*width)/(float)(screenHeight_*aspect); - - return std::make_pair(width, height); - } - - std::pair Fill() - { - return std::make_pair(1.0f, 1.0f); - } - - std::pair UniformToFill() - { - float aspect = (float)width_/(float)height_; - - float wr = (float)width_/(float)screenWidth_; - float hr = (float)height_/(float)screenHeight_; - float r_inv = 1.0f/min(wr, hr); - - float width = wr*r_inv; - float height = hr*r_inv; - - return std::make_pair(width, height); - } - - void Render(unsigned char* data) - { - // RENDER - - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glClearColor(0.0f, 0.0f, 0.0f, 0.0f); - glLoadIdentity(); - - glBindTexture(GL_TEXTURE_2D, texture_); - glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbos_[pboIndex_]); - - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width_, height_, GL_BGRA, GL_UNSIGNED_BYTE, 0); - - if(!firstFrame_) - glCallList(dlist_); - - // UPDATE - - int nextPboIndex = pboIndex_ ^ 1; - - glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbos_[nextPboIndex]); - glBufferData(GL_PIXEL_UNPACK_BUFFER, size_, NULL, GL_STREAM_DRAW); - GLubyte* ptr = (GLubyte*)glMapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY); - - if(ptr != NULL) - { - memcpy(ptr, data, size_); - glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER); - } - - // SWAP - - pboIndex_ = nextPboIndex; - SwapBuffers(hDC); - - if(firstFrame_) - { - firstFrame_ = false; - Render(data); - } - } - - int screenWidth_; - int screenHeight_; - - bool firstFrame_; - - GLuint dlist_; - GLuint texture_; - - int width_; - int height_; - int size_; - - HDC hDC; - HGLRC hRC; - - Stretch stretch_; - GLuint pbos_[2]; - int pboIndex_; - }; - - typedef std::tr1::shared_ptr OGLDevicePtr; - - struct OGLPlaybackStrategy: public IFramePlaybackStrategy - { - OGLPlaybackStrategy(Implementation* pConsumerImpl) : pConsumerImpl_(pConsumerImpl), lastTime_(timeGetTime()), lastFrameCount_(0) - {} - - FrameManagerPtr GetFrameManager() - { - return pConsumerImpl_->pFrameManager_; - } - FramePtr GetReservedFrame() - { - return pConsumerImpl_->pFrameManager_->CreateFrame(); - } - - void DisplayFrame(Frame* pFrame) - { - DWORD timediff = timeGetTime() - lastTime_; - if(timediff < 35) - Sleep(40 - timediff); - lastTime_ = timeGetTime(); - - // Check if frame is valid and if it has already been rendered - if(pFrame == NULL || (pFrame->ID() == lastFrameID_ && lastFrameCount_ > 1)) // Potential problem is that if the HDC is invalidated by external application it will stay that way, (R.N), keep or remove? - return; - - lastFrameCount_ = pFrame->ID() == lastFrameID_ ? ++lastFrameCount_ : 0; // Cant stop rendering until 2 frames are pushed due to doublebuffering - - if(!pOGLDevice_) - { - pOGLDevice_.reset(new OGLDevice(pConsumerImpl_->hWnd_, pConsumerImpl_->stretch_, pConsumerImpl_->screenWidth_, pConsumerImpl_->screenHeight_)); - pOGLDevice_->ReSizeGLScene(pConsumerImpl_->fmtDesc_.width, pConsumerImpl_->fmtDesc_.height); - } - - pOGLDevice_->Render(pFrame->GetDataPtr()); - - lastFrameID_ = pFrame->ID(); - } - - int lastFrameCount_; - utils::ID lastFrameID_; - OGLDevicePtr pOGLDevice_; - Implementation* pConsumerImpl_; - DWORD lastTime_; - }; - - Implementation(HWND hWnd, const FrameFormatDescription& fmtDesc, unsigned int screenIndex, Stretch stretch) - : hWnd_(hWnd), fmtDesc_(fmtDesc), pFrameManager_(new SystemFrameManager(fmtDesc_)), stretch_(stretch), screenIndex_(screenIndex) - { - bool succeeded = SetupDevice(); - assert(succeeded); - } - - ~Implementation() - { - bool succeeded = ReleaseDevice(); - assert(succeeded); - } - - bool SetupDevice() - { - DISPLAY_DEVICE dDevice; - memset(&dDevice,0,sizeof(dDevice)); - dDevice.cb = sizeof(dDevice); - - std::vector displayDevices; - for(int n = 0; EnumDisplayDevices(NULL, n, &dDevice, NULL); ++n) - { - displayDevices.push_back(dDevice); - memset(&dDevice,0,sizeof(dDevice)); - dDevice.cb = sizeof(dDevice); - } - - if(screenIndex_ >= displayDevices.size()) - return false; - - if(!GetWindowRect(hWnd_, &prevRect_)) - throw std::exception("Failed to get Window Rectangle."); - - DEVMODE devmode; - memset(&devmode,0,sizeof(devmode)); - - if(!EnumDisplaySettings(displayDevices[screenIndex_].DeviceName, ENUM_CURRENT_SETTINGS, &devmode)) - { - std::stringstream msg; - msg << "Failed to enumerate Display Settings for DisplayDevice " << screenIndex_ << "."; - throw std::exception(msg.str().c_str()); - } - - prevMode_ = devmode; - - screenWidth_ = devmode.dmPelsWidth; - screenHeight_ = devmode.dmPelsHeight; - - ChangeDisplaySettings(&devmode, CDS_FULLSCREEN); - - //if(result != DISP_CHANGE_SUCCESSFUL) - // throw std::exception("Failed to change Display Settings."); - - prevStyle_ = GetWindowLong(hWnd_, GWL_STYLE); - prevExStyle_ = GetWindowLong(hWnd_, GWL_EXSTYLE); - - if(!(SetWindowLong(hWnd_, GWL_STYLE, WS_POPUP) && SetWindowLong(hWnd_, GWL_EXSTYLE, WS_EX_APPWINDOW | WS_EX_TOPMOST))) - throw std::exception("Failed to change window style."); - - if(!MoveWindow(hWnd_, devmode.dmPosition.x, devmode.dmPosition.y, screenWidth_, screenHeight_, TRUE)) - throw std::exception("Failed to move window to display device."); - - ShowWindow(hWnd_,SW_SHOW); // Show The Window - SetForegroundWindow(hWnd_); // Slightly Higher Priority - - - pPlaybackControl_.reset(new FramePlaybackControl(FramePlaybackStrategyPtr(new OGLPlaybackStrategy(this)))); - pPlaybackControl_->Start(); - - LOG << TEXT("OGL INFO: Successfully initialized device "); - return true; - } - - bool ReleaseDevice() - { - pPlaybackControl_->Stop(); - pPlaybackControl_.reset(); - - SetWindowLong(hWnd_, GWL_STYLE, prevStyle_); - SetWindowLong(hWnd_, GWL_EXSTYLE, prevExStyle_); - - ChangeDisplaySettings(&prevMode_, 0); - - MoveWindow(hWnd_, prevRect_.bottom, prevRect_.left, (prevRect_.right - prevRect_.left), (prevRect_.top-prevRect_.bottom), TRUE); - - LOG << TEXT("OGL INFO: Successfully released device ") << utils::LogStream::Flush; - return true; - } - - unsigned int screenIndex_; - int screenWidth_; - int screenHeight_; - - DEVMODE prevMode_; - RECT prevRect_; - DWORD prevExStyle_; - DWORD prevStyle_; - - Stretch stretch_; - FrameFormatDescription fmtDesc_; - HWND hWnd_; - SystemFrameManagerPtr pFrameManager_; - FramePlaybackControlPtr pPlaybackControl_; -}; - -OGLVideoConsumer::OGLVideoConsumer(HWND hWnd, const FrameFormatDescription& fmtDesc, unsigned int screenIndex, Stretch stretch) -: pImpl_(new Implementation(hWnd, fmtDesc, screenIndex, stretch)) -{ -} - -OGLVideoConsumer::~OGLVideoConsumer(void) -{ -} - -IPlaybackControl* OGLVideoConsumer::GetPlaybackControl() const -{ - return pImpl_->pPlaybackControl_.get(); -} - -void OGLVideoConsumer::EnableVideoOutput(){} - -void OGLVideoConsumer::DisableVideoOutput(){} - -bool OGLVideoConsumer::SetupDevice(unsigned int deviceIndex) -{ - return pImpl_->SetupDevice(); -} - -bool OGLVideoConsumer::ReleaseDevice() -{ - return pImpl_->ReleaseDevice(); -} - -const TCHAR* OGLVideoConsumer::GetFormatDescription() const -{ - return pImpl_->fmtDesc_.name; -} - -} -} \ No newline at end of file diff --git a/server/consumers/OGL/OGLVideoConsumer.h b/server/consumers/OGL/OGLVideoConsumer.h deleted file mode 100644 index 5a9267c2c..000000000 --- a/server/consumers/OGL/OGLVideoConsumer.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _OGL_CONSUMER_H_ -#define _OGL_CONSUMER_H_ - -#include "..\..\VideoConsumer.h" -#include "..\..\MediaProducer.h" -#include "..\..\frame\BitmapFrameManager.h" - -#include "..\..\utils\thread.h" -#include "..\..\utils\lockable.h" - -#include - -namespace caspar { -namespace ogl { - -enum Stretch -{ - None, - Uniform, - Fill, - UniformToFill -}; - -class OGLVideoConsumer : public IVideoConsumer, private utils::LockableObject -{ -public: - - OGLVideoConsumer(HWND hWnd, const FrameFormatDescription& fmtDesc, unsigned int screenIndex = 0, Stretch stretch = Fill); - ~OGLVideoConsumer(void); - - IPlaybackControl* GetPlaybackControl() const; - void EnableVideoOutput(); - void DisableVideoOutput(); - bool SetupDevice(unsigned int deviceIndex); - bool ReleaseDevice(); - const TCHAR* GetFormatDescription() const; - -private: - struct Implementation; - std::tr1::shared_ptr pImpl_; -}; - -typedef std::tr1::shared_ptr OGLVideoConsumerPtr; - - -} -} - -#endif \ No newline at end of file diff --git a/server/consumers/bluefish/BlueFishVideoConsumer.cpp b/server/consumers/bluefish/BlueFishVideoConsumer.cpp deleted file mode 100644 index 22f03826d..000000000 --- a/server/consumers/bluefish/BlueFishVideoConsumer.cpp +++ /dev/null @@ -1,297 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\StdAfx.h" - -#include -#include "..\..\application.h" -#include "BlueFishVideoConsumer.h" -#include "..\..\frame\FramePlaybackControl.h" -#include "BluefishPlaybackStrategy.h" - -#include -#include - -namespace caspar { namespace bluefish { - -int BlueFishVideoConsumer::EnumerateDevices() -{ - LOG << TEXT("Bluefish SDK version: ") << BlueVelvetVersion(); - BlueVelvetPtr pSDK(BlueVelvetFactory4()); - - if(pSDK != 0) - { - int deviceCount = 0; - pSDK->device_enumerate(deviceCount); - return deviceCount; - } - else - return 0; -} - -VideoConsumerPtr BlueFishVideoConsumer::Create(unsigned int deviceIndex) -{ - BlueFishVideoConsumerPtr card(new BlueFishVideoConsumer()); - if(card != 0 && card->SetupDevice(deviceIndex) == false) - card.reset(); - - return card; -} - -BlueFishVideoConsumer::BlueFishVideoConsumer() : pSDK_(BlueVelvetFactory4()), currentFormat_(FFormatPAL), _deviceIndex(0) -{} - -BlueFishVideoConsumer::~BlueFishVideoConsumer() -{ - ReleaseDevice(); -} - -IPlaybackControl* BlueFishVideoConsumer::GetPlaybackControl() const -{ - return pPlaybackControl_.get(); -} - -bool BlueFishVideoConsumer::SetupDevice(unsigned int deviceIndex) -{ - tstring strDesiredFrameFormat = caspar::GetApplication()->GetSetting(TEXT("videomode")); - return this->DoSetupDevice(deviceIndex, strDesiredFrameFormat); -} - -unsigned long BlueFishVideoConsumer::BlueSetVideoFormat(tstring strDesiredFrameFormat) -{ - unsigned long vidFmt = VID_FMT_PAL; - unsigned long desiredVideoFormat = VID_FMT_PAL; - - if(strDesiredFrameFormat.size() == 0) - strDesiredFrameFormat = TEXT("PAL"); - - FrameFormat casparVideoFormat = caspar::GetVideoFormat(strDesiredFrameFormat); - desiredVideoFormat = bluefish::VidFmtFromFrameFormat(casparVideoFormat); - currentFormat_ = casparVideoFormat != FFormatInvalid ? casparVideoFormat : FFormatPAL; - if(desiredVideoFormat == ULONG_MAX) - { - LOG << TEXT("BLUECARD ERROR: Unsupported videomode: ") << strDesiredFrameFormat << TEXT(". (device ") << _deviceIndex << TEXT(")"); - return ULONG_MAX; - } - - if(desiredVideoFormat != VID_FMT_PAL) - { - int videoModeCount = pSDK_->count_video_mode(); - for(int videoModeIndex=1; videoModeIndex <= videoModeCount; ++videoModeIndex) - { - EVideoMode videoMode = pSDK_->enum_video_mode(videoModeIndex); - if(videoMode == desiredVideoFormat) - vidFmt = videoMode; - } - } - - if(vidFmt != desiredVideoFormat) - LOG << TEXT("BLUECARD ERROR: Failed to set desired videomode: ") << strDesiredFrameFormat << TEXT(". (device ") << _deviceIndex << TEXT(")"); - - if(vidFmt == VID_FMT_PAL) - { - strDesiredFrameFormat = TEXT("PAL"); - currentFormat_ = FFormatPAL; - } - return vidFmt; -} - -bool BlueFishVideoConsumer::DoSetupDevice(unsigned int deviceIndex, tstring strDesiredFrameFormat) -{ - memFmt_ = MEM_FMT_ARGB_PC; - updFmt_ = UPD_FMT_FRAME; - vidFmt_ = VID_FMT_PAL; - resFmt_ = RES_FMT_NORMAL; - engineMode_ = VIDEO_ENGINE_FRAMESTORE; - - _deviceIndex = deviceIndex; - - if(BLUE_FAIL(pSDK_->device_attach(_deviceIndex, FALSE))) - { - LOG << TEXT("BLUECARD ERROR: Failed to attach device. (device ") << _deviceIndex << TEXT(")");; - return false; - } - - int videoCardType = pSDK_->has_video_cardtype(); - LOG << TEXT("BLUECARD INFO: Card type: ") << GetBluefishCardDesc(videoCardType) << TEXT(". (device ") << _deviceIndex << TEXT(")");; - - //void* pBlueDevice = blue_attach_to_device(1); - //EBlueConnectorPropertySetting video_routing[1]; - //auto channel = BLUE_VIDEO_OUTPUT_CHANNEL_A; - //video_routing[0].channel = channel; - //video_routing[0].propType = BLUE_CONNECTOR_PROP_SINGLE_LINK; - //video_routing[0].connector = channel == BLUE_VIDEO_OUTPUT_CHANNEL_A ? BLUE_CONNECTOR_SDI_OUTPUT_A : BLUE_CONNECTOR_SDI_OUTPUT_B; - //blue_set_connector_property(pBlueDevice, 1, video_routing); - //blue_detach_from_device(&pBlueDevice); - - vidFmt_ = BlueSetVideoFormat(strDesiredFrameFormat); - if(vidFmt_ == ULONG_MAX) - return false; - - // Set default video output channel - //if(BLUE_FAIL(SetCardProperty(pSDK_, DEFAULT_VIDEO_OUTPUT_CHANNEL, channel))) - // LOG << TEXT("BLUECARD ERROR: Failed to set default channel. (device ") << _deviceIndex << TEXT(")"); - - //Setting output Video mode - if(BLUE_FAIL(SetCardProperty(pSDK_, VIDEO_MODE, vidFmt_))) - { - LOG << TEXT("BLUECARD ERROR: Failed to set videomode. (device ") << _deviceIndex << TEXT(")"); - return false; - } - - //Select Update Mode for output - if(BLUE_FAIL(SetCardProperty(pSDK_, VIDEO_UPDATE_TYPE, updFmt_))) - { - LOG << TEXT("BLUECARD ERROR: Failed to set update type. (device ") << _deviceIndex << TEXT(")"); - return false; - } - - DisableVideoOutput(); - - //Enable dual link output - if(BLUE_FAIL(SetCardProperty(pSDK_, VIDEO_DUAL_LINK_OUTPUT, 1))) - { - LOG << TEXT("BLUECARD ERROR: Failed to enable dual link. (device ") << _deviceIndex << TEXT(")"); - return false; - } - - if(BLUE_FAIL(SetCardProperty(pSDK_, VIDEO_DUAL_LINK_OUTPUT_SIGNAL_FORMAT_TYPE, Signal_FormatType_4224))) - { - LOG << TEXT("BLUECARD ERROR: Failed to set dual link format type to 4:2:2:4. (device ") << _deviceIndex << TEXT(")"); - return false; - } - - - //Select output memory format - if(BLUE_FAIL(SetCardProperty(pSDK_, VIDEO_MEMORY_FORMAT, memFmt_))) - { - LOG << TEXT("BLUECARD ERROR: Failed to set memory format. (device ") << _deviceIndex << TEXT(")"); - return false; - } - - //Select image orientation - if(BLUE_FAIL(SetCardProperty(pSDK_, VIDEO_IMAGE_ORIENTATION, ImageOrientation_Normal))) - LOG << TEXT("BLUECARD ERROR: Failed to set image orientation to normal. (device ") << _deviceIndex << TEXT(")"); - - // Select data range - if(BLUE_FAIL(SetCardProperty(pSDK_, VIDEO_RGB_DATA_RANGE, CGR_RANGE))) - LOG << TEXT("BLUECARD ERROR: Failed to set RGB data range to CGR. (device ") << _deviceIndex << TEXT(")"); - - if(BLUE_FAIL(SetCardProperty(pSDK_, VIDEO_PREDEFINED_COLOR_MATRIX, vidFmt_ == VID_FMT_PAL ? MATRIX_601_CGR : MATRIX_709_CGR))) - LOG << TEXT("BLUECARD ERROR: Failed to set colormatrix to ") << (vidFmt_ == VID_FMT_PAL ? TEXT("601 CGR") : TEXT("709 CGR")) << TEXT(". (device ") << _deviceIndex << TEXT(")"); - - //if(BLUE_FAIL(SetCardProperty(pSDK_, EMBEDDED_AUDIO_OUTPUT, 0))) - // LOG << TEXT("BLUECARD ERROR: Failed to enable embedded audio. (device ") << _deviceIndex << TEXT(")"); - //else - //{ - // LOG << TEXT("BLUECARD INFO: Enabled embedded audio. (device ") << _deviceIndex << TEXT(")"); - // hasEmbeddedAudio_ = true; - //} - - LOG << TEXT("BLUECARD INFO: Successfully configured bluecard for ") << strDesiredFrameFormat << TEXT(". (device ") << _deviceIndex << TEXT(")"); - - if (pSDK_->has_output_key()) - { - int dummy = TRUE; - int v4444 = FALSE; - int invert = FALSE; - int white = FALSE; - pSDK_->set_output_key(dummy, v4444, invert, white); - } - - if(pSDK_->GetHDCardType(_deviceIndex) != CRD_HD_INVALID) - pSDK_->Set_DownConverterSignalType(vidFmt_ == VID_FMT_PAL ? SD_SDI : HD_SDI); - - if(BLUE_FAIL(pSDK_->set_video_engine(engineMode_))) - { - LOG << TEXT("BLUECARD ERROR: Failed to set vido engine. (device ") << _deviceIndex << TEXT(")"); - return false; - } - - EnableVideoOutput(); - - LOG << TEXT("BLUECARD INFO: Successfully initialized device ") << _deviceIndex; - - pFrameManager_ = std::make_shared(FrameFormatDescription::FormatDescriptions[FFormatPAL]); - - pPlaybackControl_ = std::make_shared(FramePlaybackStrategyPtr(new BluefishPlaybackStrategy(this))); - pPlaybackControl_->Start(); - - return true; -} - -bool BlueFishVideoConsumer::ReleaseDevice() -{ - pPlaybackControl_.reset(); - pFrameManager_.reset(); - - DisableVideoOutput(); - - if(pSDK_) - pSDK_->device_detach(); - - LOG << TEXT("BLUECARD INFO: Successfully released device ") << _deviceIndex; - return true; -} - -void BlueFishVideoConsumer::EnableVideoOutput() -{ - if(pSDK_) - { - if(BLUE_FAIL(SetCardProperty(pSDK_, VIDEO_BLACKGENERATOR, 0))) - LOG << TEXT("BLUECARD ERROR: Failed to disable video output. (device ") << _deviceIndex << TEXT(")"); - } -} - -void BlueFishVideoConsumer::DisableVideoOutput() -{ - if(pSDK_) - { - if(BLUE_FAIL(SetCardProperty(pSDK_, VIDEO_BLACKGENERATOR, 1))) - LOG << TEXT("BLUECARD ERROR: Failed to disable video output. (device ") << _deviceIndex << TEXT(")"); - } -} - -bool BlueFishVideoConsumer::SetVideoFormat(const tstring& strDesiredFrameFormat) -{ - tstring prevFrameFormat = this->GetFormatDescription(); - - unsigned long desiredVideoFormat = bluefish::VidFmtFromFrameFormat(caspar::GetVideoFormat(strDesiredFrameFormat)); - if(desiredVideoFormat == ULONG_MAX) - { - LOG << TEXT("BLUECARD INFO: Unsupported video format. Ignored ") << strDesiredFrameFormat; - return false; - } - - this->ReleaseDevice(); - - if(!this->DoSetupDevice(this->_deviceIndex, strDesiredFrameFormat)) - { - LOG << TEXT("BLUECARD ERROR: Failed to set video format. Trying to revert to previous format ") << prevFrameFormat; - DoSetupDevice(this->_deviceIndex, prevFrameFormat); - return false; - } - - LOG << TEXT("BLUECARD INFO: Successfully set video format ") << strDesiredFrameFormat; - - return true; -} - -}} diff --git a/server/consumers/bluefish/BlueFishVideoConsumer.h b/server/consumers/bluefish/BlueFishVideoConsumer.h deleted file mode 100644 index a86aae2ef..000000000 --- a/server/consumers/bluefish/BlueFishVideoConsumer.h +++ /dev/null @@ -1,99 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _CASPAR_BLUEFISHVIDEOCONSUMER_H__ -#define _CASPAR_BLUEFISHVIDEOCONSUMER_H__ - -#pragma once - -#include "..\..\utils\thread.h" -#include "BluefishException.h" -#include "BluefishUtil.h" -#include "..\..\VideoConsumer.h" - -#define TIMEOUT 1000 - -class CBlueVelvet4; - -namespace caspar { - -class FramePlaybackControl; -typedef std::tr1::shared_ptr FramePlaybackControlPtr; - -namespace bluefish { - -typedef std::tr1::shared_ptr BlueVelvetPtr; - -class BlueFishVideoConsumer : public IVideoConsumer -{ - friend class BluefishPlaybackStrategy; - - BlueFishVideoConsumer(); - BlueFishVideoConsumer(const BlueFishVideoConsumer&); - const BlueFishVideoConsumer& operator=(const BlueFishVideoConsumer&); - -public: - virtual ~BlueFishVideoConsumer(); - - static int EnumerateDevices(); - static VideoConsumerPtr Create(unsigned int deviceIndex); - - virtual IPlaybackControl* GetPlaybackControl() const; - - void EnableVideoOutput(); - void DisableVideoOutput(); - bool SetupDevice(unsigned int deviceIndex); - bool ReleaseDevice(); - const TCHAR* GetFormatDescription() const - { - return FrameFormatDescription::FormatDescriptions[currentFormat_].name; - } - bool SetVideoFormat(const tstring& strDesiredFrameFormat); - -private: - - unsigned long BlueSetVideoFormat(tstring strDesiredFrameFormat); - - bool DoSetupDevice(unsigned int deviceIndex, tstring strDesiredFrameFormat); - - BlueVelvetPtr pSDK_; - FramePlaybackControlPtr pPlaybackControl_; - FrameManagerPtr pFrameManager_; - unsigned long m_bufferCount; - unsigned long m_length; - unsigned long m_actual; - unsigned long m_golden; - - FrameFormat currentFormat_; - unsigned int _deviceIndex; - - unsigned long memFmt_; - unsigned long updFmt_; - unsigned long vidFmt_; - unsigned long resFmt_; - unsigned long engineMode_; -}; -typedef std::tr1::shared_ptr BlueFishVideoConsumerPtr; - -} //namespace bluefish -} //namespace caspar - - -#endif //_CASPAR_BLUEFISHVIDEOCONSUMER_H__ diff --git a/server/consumers/bluefish/BluefishException.h b/server/consumers/bluefish/BluefishException.h deleted file mode 100644 index 4ea18ebd9..000000000 --- a/server/consumers/bluefish/BluefishException.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _CASPAR_BLUEFISHEXCEPTION_H__ -#define _CASPAR_BLUEFISHEXCEPTION_H__ - -#include - -namespace caspar { -namespace bluefish { - -class BluefishException : public std::exception -{ -public: - explicit BluefishException(const char* msg) : std::exception(msg) {} - ~BluefishException() {} -}; - -} //namespace bluefish -} //namespace caspar - -#endif //_CASPAR_BLUEFISHEXCEPTION_H__ \ No newline at end of file diff --git a/server/consumers/bluefish/BluefishFrameManager.cpp b/server/consumers/bluefish/BluefishFrameManager.cpp deleted file mode 100644 index 01d0053f2..000000000 --- a/server/consumers/bluefish/BluefishFrameManager.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\StdAfx.h" - -#include -#include "..\..\utils\Process.h" -#include "BluefishFrameManager.h" - -#define BUFFER_ID_USER_BASE (6) - -namespace caspar { -namespace bluefish { - -////////////////////// -// CardFrameInfo -// -CardFrameInfo::CardFrameInfo(BlueVelvetPtr pSDK, int dataSize, int bufferID) : pSDK_(pSDK), dataSize_(dataSize), pData_(0), bufferID_(bufferID) -{ - if(BLUE_FAIL(pSDK->system_buffer_map(reinterpret_cast(&pData_), bufferID))) - { - throw BluefishException("Failed to map buffer"); - } -} - -CardFrameInfo::~CardFrameInfo() -{ - try - { - if(pSDK_ != 0 && pData_ != 0) - pSDK_->system_buffer_unmap(pData_); - } - catch(...) {} -} - - -////////////////////// -// SystemFrameInfo -// -SystemFrameInfo::SystemFrameInfo(int dataSize, int bufferID) : dataSize_(dataSize), pData_(0), bufferID_(bufferID) -{ - pData_ = static_cast(::VirtualAlloc(NULL, dataSize_, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE)); - if(pData_ == 0) - { - throw BluefishException("Failed to allocate memory for frame"); - } - if(::VirtualLock(pData_, dataSize_) == 0) - { - throw BluefishException("Failed to lock memory for frame"); - } -} - -SystemFrameInfo::~SystemFrameInfo() -{ - try - { - if(pData_ != 0) - ::VirtualFree(pData_, 0, MEM_RELEASE); - } - catch(...) {} -} - -//////////////////////// -// BluefishVideoFrame -// -BluefishVideoFrame::BluefishVideoFrame(BluefishFrameManager* pFrameManager) : pFrameManager_(pFrameManager) -{ - if(pFrameManager_ != 0) - { - factoryID_ = pFrameManager_->ID(); - pInfo_ = pFrameManager_->GetBuffer(); - } -} - -BluefishVideoFrame::~BluefishVideoFrame() -{ - if(pFrameManager_ != 0 && pInfo_ != 0) - pFrameManager_->ReturnBuffer(pInfo_); -} - -////////////////////////////// -// BluefishVideoFrameFactory -// -BluefishFrameManager::BluefishFrameManager(BlueVelvetPtr pSDK, FrameFormat fmt, unsigned long optimalLength) : pSDK_(pSDK), format_(fmt) -{ - const FrameFormatDescription& fmtDesc = FrameFormatDescription::FormatDescriptions[fmt]; - pBackupFrameManager_.reset(new SystemFrameManager(fmtDesc)); - - SIZE_T workingSetMinSize = 0, workingSetMaxSize = 0; - if(utils::Process::GetCurrentProcess().GetWorkingSetSize(workingSetMinSize, workingSetMaxSize)) - { - LOG << utils::LogLevel::Debug << TEXT("WorkingSet size: min = ") << workingSetMinSize << TEXT(", max = ") << workingSetMaxSize; - - workingSetMinSize += optimalLength * 6; - workingSetMaxSize += optimalLength * 6; - - if(!utils::Process::GetCurrentProcess().SetWorkingSetSize(workingSetMinSize, workingSetMaxSize)) - { - LOG << utils::LogLevel::Critical << TEXT("Failed to set workingset: min = ") << workingSetMinSize << TEXT(", max = ") << workingSetMaxSize; - } - } - - //for(int cardBufferIndex = 0; cardBufferIndex < 4; ++cardBufferIndex) - //{ - // frameBuffers_.push_back(VideoFrameInfoPtr(new CardFrameInfo(pSDK, optimalLength, BUFFER_ID_VIDEO0 + cardBufferIndex))); - //} - for(int systemBufferIndex = 0; systemBufferIndex < 6; ++systemBufferIndex) - { - frameBuffers_.push_back(VideoFrameInfoPtr(new SystemFrameInfo(optimalLength, BUFFER_ID_USER_BASE + systemBufferIndex))); - } - - FrameInfoList::const_iterator it = frameBuffers_.begin(); - FrameInfoList::const_iterator end = frameBuffers_.end(); - for(; it != end; ++it) - { - if(BLUE_FAIL(pSDK_->system_buffer_assign((*it)->GetPtr(), (*it)->GetBufferID(), (*it)->GetDataSize(), BUFFER_TYPE_VIDEO))) - { - throw BluefishException("Failed to assign buffer"); - } - } -} - -BluefishFrameManager::~BluefishFrameManager() -{ -} - -FramePtr BluefishFrameManager::CreateFrame() -{ - FramePtr pBluefishFrame(new BluefishVideoFrame(this)); - if(pBluefishFrame->HasValidDataPtr()) - return pBluefishFrame; - else - return pBackupFrameManager_->CreateFrame(); -} - -const FrameFormatDescription& BluefishFrameManager::GetFrameFormatDescription() const -{ - return FrameFormatDescription::FormatDescriptions[format_]; -} - -VideoFrameInfoPtr BluefishFrameManager::GetBuffer() -{ - Lock lock(*this); - VideoFrameInfoPtr pInfo; - - if(frameBuffers_.size() > 0) - { - pInfo = frameBuffers_.front(); - frameBuffers_.pop_front(); - } - - return pInfo; -} - -void BluefishFrameManager::ReturnBuffer(VideoFrameInfoPtr pInfo) -{ - Lock lock(*this); - if(pInfo != 0) - frameBuffers_.push_back(pInfo); -} - -} //namespace bluefish -} //namespace caspar \ No newline at end of file diff --git a/server/consumers/bluefish/BluefishFrameManager.h b/server/consumers/bluefish/BluefishFrameManager.h deleted file mode 100644 index 3f9daa867..000000000 --- a/server/consumers/bluefish/BluefishFrameManager.h +++ /dev/null @@ -1,164 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _CASPAR_BLUEFISHVIDEOFRAMEFACTORY_H__ -#define _CASPAR_BLUEFISHVIDEOFRAMEFACTORY_H__ - -#pragma once - -#include "..\..\utils\Lockable.h" -#include "..\..\frame\FrameManager.h" -#include "..\..\frame\SystemFrameManager.h" -#include "..\..\frame\Frame.h" -#include -#include -#include "BluefishException.h" - -class CBlueVelvet4; - -namespace caspar { -namespace bluefish { - -typedef std::tr1::shared_ptr BlueVelvetPtr; - -class VideoFrameInfo -{ -public: - VideoFrameInfo() {} - virtual ~VideoFrameInfo() {} - - virtual unsigned char* GetPtr() const = 0; - virtual int GetBufferID() const = 0; - virtual int GetDataSize() const = 0; -}; -typedef std::tr1::shared_ptr VideoFrameInfoPtr; - -class CardFrameInfo : public VideoFrameInfo -{ -public: - CardFrameInfo(BlueVelvetPtr pSDK, int dataSize, int bufferID); - ~CardFrameInfo(); - - unsigned char* GetPtr() const { - return pData_; - } - int GetBufferID() const { - return bufferID_; - } - int GetDataSize() const { - return dataSize_; - } - -private: - BlueVelvetPtr pSDK_; - unsigned char* pData_; - int bufferID_; - int dataSize_; -}; - -class SystemFrameInfo : public VideoFrameInfo -{ -public: - SystemFrameInfo(int dataSize, int bufferID); - ~SystemFrameInfo(); - - unsigned char* GetPtr() const { - return pData_; - } - int GetBufferID() const { - return bufferID_; - } - int GetDataSize() const { - return dataSize_; - } - -private: - unsigned char* pData_; - int bufferID_; - int dataSize_; -}; - -class BluefishFrameManager : public FrameManager, private utils::LockableObject -{ - friend class BluefishVideoFrame; - typedef std::list FrameInfoList; - - BluefishFrameManager(const BluefishFrameManager&); - const BluefishFrameManager& operator=(const BluefishFrameManager&); - -public: - BluefishFrameManager(BlueVelvetPtr pSDK, FrameFormat fmt, unsigned long optimalLength); - virtual ~BluefishFrameManager(); - - virtual FramePtr CreateFrame(); - virtual const FrameFormatDescription& GetFrameFormatDescription() const; - -private: - VideoFrameInfoPtr GetBuffer(); - void ReturnBuffer(VideoFrameInfoPtr); - - BlueVelvetPtr pSDK_; - FrameFormat format_; - FrameInfoList frameBuffers_; - SystemFrameManagerPtr pBackupFrameManager_; -}; -typedef std::tr1::shared_ptr BluefishFrameManagerPtr; - - -class BluefishVideoFrame : public Frame -{ - friend class BluefishFrameManager; - explicit BluefishVideoFrame(BluefishFrameManager* pFrameManager); - -public: - virtual ~BluefishVideoFrame(); - - virtual unsigned char* GetDataPtr() const { - if(pInfo_ != 0) { - HasVideo(true); - return pInfo_->GetPtr(); - } - return 0; - } - virtual bool HasValidDataPtr() const { - return (pInfo_ != 0 && pInfo_->GetPtr() != 0); - } - - virtual unsigned int GetDataSize() const { - return (pInfo_ != 0) ? pInfo_->GetDataSize() : 0; - } - virtual FrameMetadata GetMetadata() const { - return (pInfo_ != 0) ? reinterpret_cast(pInfo_->GetBufferID()) : 0; - } - const utils::ID& FactoryID() const { - return factoryID_; - } - -private: - VideoFrameInfoPtr pInfo_; - BluefishFrameManager* pFrameManager_; - utils::ID factoryID_; -}; - - -} //namespace bluefish -} //namespace caspar - -#endif //_CASPAR_BLUEFISHVIDEOFRAMEFACTORY_H__ \ No newline at end of file diff --git a/server/consumers/bluefish/BluefishMemory.h b/server/consumers/bluefish/BluefishMemory.h deleted file mode 100644 index 8361b7aef..000000000 --- a/server/consumers/bluefish/BluefishMemory.h +++ /dev/null @@ -1,77 +0,0 @@ -#pragma once - -#include -#include "../../frame/Frame.h" -#include "BluefishException.h" -#include "../../utils/Process.h" - -namespace caspar { namespace bluefish { - -static const size_t MAX_HANC_BUFFER_SIZE = 256*1024; -static const size_t MAX_VBI_BUFFER_SIZE = 36*1920*4; - -struct page_locked_buffer -{ -public: - page_locked_buffer(size_t size) : size_(size), data_(static_cast(::VirtualAlloc(NULL, size_, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE))) - { - if(!data_) - throw BluefishException("Failed to allocate memory for paged locked buffer."); - if(::VirtualLock(data_.get(), size_) == 0) - throw BluefishException("Failed to lock memory for paged locked buffer."); - } - - static void reserve_working_size(size_t size) - { - SIZE_T workingSetMinSize = 0, workingSetMaxSize = 0; - if(utils::Process::GetCurrentProcess().GetWorkingSetSize(workingSetMinSize, workingSetMaxSize)) - { - LOG << utils::LogLevel::Debug << TEXT("WorkingSet size: min = ") << workingSetMinSize << TEXT(", max = ") << workingSetMaxSize; - - workingSetMinSize += size; - workingSetMaxSize += size; - - if(!utils::Process::GetCurrentProcess().SetWorkingSetSize(workingSetMinSize, workingSetMaxSize)) - LOG << utils::LogLevel::Critical << TEXT("Failed to set workingset: min = ") << workingSetMinSize << TEXT(", max = ") << workingSetMaxSize; - } - } - - PBYTE data() const { return data_.get(); } - size_t size() const { return size_; } -private: - - struct virtual_free - { - void operator()(LPVOID lpAddress) - { - if(lpAddress != nullptr) - try{::VirtualFree(lpAddress, 0, MEM_RELEASE);}catch(...){} - } - }; - - size_t size_; - std::unique_ptr data_; -}; -typedef std::shared_ptr page_locked_buffer_ptr; - -struct blue_dma_buffer -{ -public: - blue_dma_buffer(int image_size, int id) : id_(id), image_buffer_(image_size), hanc_buffer_(256*1024){} - - int id() const {return id_;} - - PBYTE image_data() const { return image_buffer_.data(); } - PBYTE hanc_data() const { return hanc_buffer_.data(); } - - size_t image_size() const { return image_buffer_.size(); } - size_t hanc_size() const { return hanc_buffer_.size(); } - -private: - int id_; - page_locked_buffer image_buffer_; - page_locked_buffer hanc_buffer_; -}; -typedef std::shared_ptr blue_dma_buffer_ptr; - -}} \ No newline at end of file diff --git a/server/consumers/bluefish/BluefishPlaybackStrategy.cpp b/server/consumers/bluefish/BluefishPlaybackStrategy.cpp deleted file mode 100644 index 3b83f165e..000000000 --- a/server/consumers/bluefish/BluefishPlaybackStrategy.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\StdAfx.h" - -#include "..\..\utils\image\Image.hpp" -#include "..\..\audio\AudioManager.h" -#include "..\..\utils\Process.h" -#include "..\..\Application.h" -#include "BluefishUtil.h" -#include "BluefishMemory.h" -#include -#include - -#include -#include -#include - -#include "BluefishPlaybackStrategy.h" -#include "BluefishVideoConsumer.h" - -namespace caspar { namespace bluefish { - -using namespace caspar::utils; - -struct BluefishPlaybackStrategy::Implementation -{ - Implementation(BlueFishVideoConsumer* pConsumer) : pConsumer_(pConsumer), currentReservedFrameIndex_(0), log_(true), pSDK_(pConsumer->pSDK_) - { - auto golden = BlueVelvetGolden(pConsumer_->vidFmt_, pConsumer_->memFmt_, pConsumer_->updFmt_); // 5 196 248 - auto num_frames = 3; - - page_locked_buffer::reserve_working_size((golden + MAX_HANC_BUFFER_SIZE) * num_frames + MAX_HANC_BUFFER_SIZE); - - for(int n = 0; n < num_frames; ++n) - reservedFrames_.push_back(std::make_shared(pConsumer_->pFrameManager_->GetFrameFormatDescription().size, n)); - - audio_buffer_ = std::make_shared(MAX_HANC_BUFFER_SIZE); - - if(GetApplication()->GetSetting(L"embedded-audio") == L"true") - render_func_ = std::bind(&BluefishPlaybackStrategy::Implementation::DoRenderEmbAudio, this, std::placeholders::_1, std::placeholders::_2); - else - render_func_ = std::bind(&BluefishPlaybackStrategy::Implementation::DoRender, this, std::placeholders::_1, std::placeholders::_2); - } - - FramePtr GetReservedFrame() - { - return pConsumer_->pFrameManager_->CreateFrame(); - } - - FrameManagerPtr GetFrameManager() - { - return pConsumer_->pFrameManager_; - } - - void DisplayFrame(Frame* pFrame) - { - if(!pFrame->HasValidDataPtr() || pFrame->GetDataSize() != pConsumer_->pFrameManager_->GetFrameFormatDescription().size) - { - LOG << TEXT("BLUEFISH: Tried to render frame with no data or invalid data size"); - return; - } - - auto buffer = reservedFrames_[currentReservedFrameIndex_]; - utils::image::Copy(buffer->image_data(), pFrame->GetDataPtr(), buffer->image_size()); - - currentReservedFrameIndex_ = (currentReservedFrameIndex_+1) % reservedFrames_.size(); - - render_func_(buffer, pFrame->GetAudioData()); - } - - void DoRender(const blue_dma_buffer_ptr& buffer, const AudioDataChunkList& frame_audio_data) - { - unsigned long fieldCount = 0; - pSDK_->wait_output_video_synch(UPD_FMT_FRAME, fieldCount); - - pSDK_->system_buffer_write_async(buffer->image_data(), buffer->image_size(), 0, buffer->id(), 0); - if(BLUE_FAIL(pSDK_->render_buffer_update(buffer->id()))) - { - if(log_) - { - LOG << TEXT("BLUEFISH: render_buffer_update failed"); - log_ = false; - } - } - else - log_ = true; - } - - void DoRenderEmbAudio(const blue_dma_buffer_ptr& buffer, const AudioDataChunkList& frame_audio_data) - { - unsigned long fieldCount = 0; - pSDK_->wait_output_video_synch(UPD_FMT_FRAME, fieldCount); - - static size_t audio_samples = 1920; - static size_t audio_nchannels = 2; - - MixAudio(reinterpret_cast(audio_buffer_->data()), frame_audio_data, audio_samples, audio_nchannels); - EncodeHANC(reinterpret_cast(buffer->hanc_data()), audio_buffer_->data(), audio_samples, audio_nchannels); - - pSDK_->system_buffer_write_async(buffer->image_data(), - buffer->image_size(), - nullptr, - BlueImage_HANC_DMABuffer(buffer->id(), BLUE_DATA_IMAGE)); - - pSDK_->system_buffer_write_async(buffer->hanc_data(), - buffer->hanc_size(), - nullptr, - BlueImage_HANC_DMABuffer(buffer->id(), BLUE_DATA_HANC)); - - if(BLUE_FAIL(pSDK_->render_buffer_update(BlueBuffer_Image_HANC(buffer->id())))) - { - if(log_) - { - LOG << TEXT("BLUEFISH: render_buffer_update failed"); - log_ = false; - } - } - else - log_ = true; - } - - void EncodeHANC(BLUE_UINT32* hanc_data, void* audio_data, size_t audio_samples, size_t audio_nchannels) - { - auto card_type = pSDK_->has_video_cardtype(); - auto vid_fmt = pConsumer_->vidFmt_; - auto sample_type = (AUDIO_CHANNEL_16BIT | AUDIO_CHANNEL_LITTLEENDIAN); - - hanc_stream_info_struct hanc_stream_info; - memset(&hanc_stream_info, 0, sizeof(hanc_stream_info)); - - hanc_stream_info.AudioDBNArray[0] = -1; - hanc_stream_info.AudioDBNArray[1] = -1; - hanc_stream_info.AudioDBNArray[2] = -1; - hanc_stream_info.AudioDBNArray[3] = -1; - hanc_stream_info.hanc_data_ptr = hanc_data; - hanc_stream_info.video_mode = vid_fmt; - - auto emb_audio_flag = (blue_emb_audio_enable | blue_emb_audio_group1_enable); - - if (!is_epoch_card(card_type)) - { - encode_hanc_frame(&hanc_stream_info, - audio_data, - audio_nchannels, - audio_samples, - sample_type, - emb_audio_flag); - } - else - { - encode_hanc_frame_ex(card_type, - &hanc_stream_info, - audio_data, - audio_nchannels, - audio_samples, - sample_type, - emb_audio_flag); - } - } - - void MixAudio(BLUE_UINT16* dest, const AudioDataChunkList& frame_audio_data, size_t audio_samples, size_t audio_nchannels) - { - size_t size = audio_samples*audio_nchannels; - memset(dest, 0, size*2); - std::for_each(frame_audio_data.begin(), frame_audio_data.end(), [&](const audio::AudioDataChunkPtr& chunk) - { - BLUE_UINT16* src = reinterpret_cast(chunk->GetDataPtr()); - for(int n = 0; n < size; ++n) - dest[n] = static_cast(static_cast(dest[n])+static_cast(src[n])); - }); - } - - std::function render_func_; - BlueVelvetPtr pSDK_; - - bool log_; - BlueFishVideoConsumer* pConsumer_; - std::vector reservedFrames_; - int currentReservedFrameIndex_; - - page_locked_buffer_ptr audio_buffer_; -}; - -BluefishPlaybackStrategy::BluefishPlaybackStrategy(BlueFishVideoConsumer* pConsumer) : pImpl_(new Implementation(pConsumer)){} -IVideoConsumer* BluefishPlaybackStrategy::GetConsumer(){return pImpl_->pConsumer_;} -FramePtr BluefishPlaybackStrategy::GetReservedFrame(){return pImpl_->GetReservedFrame();} -FrameManagerPtr BluefishPlaybackStrategy::GetFrameManager(){return pImpl_->GetFrameManager();} -void BluefishPlaybackStrategy::DisplayFrame(Frame* pFrame){return pImpl_->DisplayFrame(pFrame);} -}} \ No newline at end of file diff --git a/server/consumers/bluefish/BluefishPlaybackStrategy.h b/server/consumers/bluefish/BluefishPlaybackStrategy.h deleted file mode 100644 index b727924cf..000000000 --- a/server/consumers/bluefish/BluefishPlaybackStrategy.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -#include "..\..\frame\FramePlaybackStrategy.h" - -namespace caspar { namespace bluefish { - -class BlueFishVideoConsumer; - -class BluefishPlaybackStrategy : public IFramePlaybackStrategy -{ - struct Implementation; - std::shared_ptr pImpl_; - -public: - explicit BluefishPlaybackStrategy(BlueFishVideoConsumer* pConsumer); - - virtual void DisplayFrame(Frame*); - virtual IVideoConsumer* GetConsumer(); - virtual FrameManagerPtr GetFrameManager(); - virtual FramePtr GetReservedFrame(); -}; - -}} diff --git a/server/consumers/bluefish/BluefishUtil.h b/server/consumers/bluefish/BluefishUtil.h deleted file mode 100644 index 4a0efa9b9..000000000 --- a/server/consumers/bluefish/BluefishUtil.h +++ /dev/null @@ -1,156 +0,0 @@ -#pragma once - -#include -#include "../../frame/Frame.h" - -namespace caspar { namespace bluefish { - -inline bool is_epoch_card(int card_type) -{ - return card_type == CRD_BLUE_EPOCH_2K || - card_type == CRD_BLUE_EPOCH_HORIZON || - card_type == CRD_BLUE_EPOCH_2K_CORE || - card_type == CRD_BLUE_EPOCH_2K_ULTRA || - card_type == CRD_BLUE_EPOCH_CORE || - card_type == CRD_BLUE_EPOCH_ULTRA; -} - -inline unsigned long VidFmtFromFrameFormat(FrameFormat fmt) -{ - switch(fmt) - { - case FFormatPAL: return VID_FMT_PAL; - case FFormatNTSC: return VID_FMT_NTSC; - case FFormat576p2500: return ULONG_MAX; //not supported - case FFormat720p5000: return VID_FMT_720P_5000; - case FFormat720p5994: return VID_FMT_720P_5994; - case FFormat720p6000: return VID_FMT_720P_6000; - case FFormat1080p2397: return VID_FMT_1080P_2397; - case FFormat1080p2400: return VID_FMT_1080P_2400; - case FFormat1080i5000: return VID_FMT_1080I_5000; - case FFormat1080i5994: return VID_FMT_1080I_5994; - case FFormat1080i6000: return VID_FMT_1080I_6000; - case FFormat1080p2500: return VID_FMT_1080P_2500; - case FFormat1080p2997: return VID_FMT_1080P_2997; - case FFormat1080p3000: return VID_FMT_1080P_3000; - default: return ULONG_MAX; - } -} - -inline TCHAR* GetBluefishCardDesc(int cardType) -{ - switch(cardType) - { - case CRD_BLUEDEEP_LT: return TEXT("Deepblue LT");// D64 Lite - case CRD_BLUEDEEP_SD: return TEXT("Iridium SD");// Iridium SD - case CRD_BLUEDEEP_AV: return TEXT("Iridium AV");// Iridium AV - case CRD_BLUEDEEP_IO: return TEXT("Deepblue IO");// D64 Full - case CRD_BLUEWILD_AV: return TEXT("Wildblue AV");// D64 AV - case CRD_IRIDIUM_HD: return TEXT("Iridium HD");// * Iridium HD - case CRD_BLUEWILD_RT: return TEXT("Wildblue RT");// D64 RT - case CRD_BLUEWILD_HD: return TEXT("Wildblue HD");// * BadAss G2 - case CRD_REDDEVIL: return TEXT("Iridium Full");// Iridium Full - case CRD_BLUEDEEP_HD: - case CRD_BLUEDEEP_HDS: return TEXT("Reserved for \"BasAss G2");// * BadAss G2 variant, proposed, reserved - case CRD_BLUE_ENVY: return TEXT("Blue envy"); // Mini Din - case CRD_BLUE_PRIDE: return TEXT("Blue pride");//Mini Din Output - case CRD_BLUE_GREED: return TEXT("Blue greed"); - case CRD_BLUE_INGEST: return TEXT("Blue ingest"); - case CRD_BLUE_SD_DUALLINK: return TEXT("Blue SD duallink"); - case CRD_BLUE_CATALYST: return TEXT("Blue catalyst"); - case CRD_BLUE_SD_DUALLINK_PRO: return TEXT("Blue SD duallink pro"); - case CRD_BLUE_SD_INGEST_PRO: return TEXT("Blue SD ingest pro"); - case CRD_BLUE_SD_DEEPBLUE_LITE_PRO: return TEXT("Blue SD deepblue lite pro"); - case CRD_BLUE_SD_SINGLELINK_PRO: return TEXT("Blue SD singlelink pro"); - case CRD_BLUE_SD_IRIDIUM_AV_PRO: return TEXT("Blue SD iridium AV pro"); - case CRD_BLUE_SD_FIDELITY: return TEXT("Blue SD fidelity"); - case CRD_BLUE_SD_FOCUS: return TEXT("Blue SD focus"); - case CRD_BLUE_SD_PRIME: return TEXT("Blue SD prime"); - case CRD_BLUE_EPOCH_2K_CORE: return TEXT("Blue epoch 2k core"); - case CRD_BLUE_EPOCH_2K_ULTRA: return TEXT("Blue epoch 2k ultra"); - case CRD_BLUE_EPOCH_HORIZON: return TEXT("Blue epoch horizon"); - case CRD_BLUE_EPOCH_CORE: return TEXT("Blue epoch core"); - case CRD_BLUE_EPOCH_ULTRA: return TEXT("Blue epoch ultra"); - case CRD_BLUE_CREATE_HD: return TEXT("Blue create HD"); - case CRD_BLUE_CREATE_2K: return TEXT("Blue create 2k"); - case CRD_BLUE_CREATE_2K_ULTRA: return TEXT("Blue create 2k ultra"); - default: return TEXT("Unknown"); - } -} - -inline unsigned int GetAudioSamplesPerFrame(unsigned int nVideoSignal,unsigned int frame_no) -{ - unsigned int samples_to_read = 1920; - UINT32 NTSC_frame_seq[]={1602,1601,1602,1601,1602}; - UINT32 p59_frame_seq[]={801,800,801,801,801}; - UINT32 p23_frame_seq[]={2002,2002,2002,2002,2002}; - - switch (nVideoSignal) - { - case VID_FMT_1080PSF_2397: - case VID_FMT_1080P_2397: - case VID_FMT_2048_1080PSF_2397: - case VID_FMT_2048_1080P_2397: - samples_to_read = p23_frame_seq[frame_no%5]; - break; - case VID_FMT_NTSC: - case VID_FMT_1080I_5994: - case VID_FMT_1080P_2997: - case VID_FMT_1080PSF_2997: - samples_to_read = NTSC_frame_seq[frame_no%5]; - break; - case VID_FMT_720P_5994: - samples_to_read = p59_frame_seq[frame_no%5]; - break; - case VID_FMT_1080PSF_2400: - case VID_FMT_1080P_2400: - case VID_FMT_2048_1080PSF_2400: - case VID_FMT_2048_1080P_2400: - samples_to_read = 2000; - break; - case VID_FMT_1080I_6000: - case VID_FMT_1080P_3000: - case VID_FMT_1080PSF_3000: - samples_to_read = 1600; - break; - case VID_FMT_720P_6000: - samples_to_read = 800; - break; - case VID_FMT_720P_5000: - samples_to_read = 960; - break; - case VID_FMT_PAL: - case VID_FMT_1080I_5000: - case VID_FMT_1080P_2500: - case VID_FMT_1080PSF_2500: - default: - samples_to_read = 1920; - break; - } - return samples_to_read; -} - -inline int SetCardProperty(CBlueVelvet4 * pSdk,ULONG prop, ULONG value) -{ - VARIANT variantValue; - variantValue.vt = VT_UI4; - variantValue.ulVal = value; - return (pSdk->SetCardProperty(prop,variantValue)); -} - -inline int SetCardProperty(const std::shared_ptr pSdk, ULONG prop, ULONG value) -{ - return SetCardProperty(pSdk.get(), prop, value); -} - -inline int GetCardProperty(CBlueVelvet4 * pSdk,ULONG prop,ULONG & value) -{ - VARIANT variantValue; - int errorCode; - variantValue.vt = VT_UI4; - errorCode = pSdk->QueryCardProperty(prop,variantValue); - value = variantValue.ulVal; - return (errorCode); -} - -}} \ No newline at end of file diff --git a/server/consumers/decklink/DeckLinkAPI.idl b/server/consumers/decklink/DeckLinkAPI.idl deleted file mode 100644 index 0c055f70d..000000000 --- a/server/consumers/decklink/DeckLinkAPI.idl +++ /dev/null @@ -1,847 +0,0 @@ -/* -LICENSE-START- -** Copyright (c) 2009 Blackmagic Design -** -** Permission is hereby granted, free of charge, to any person or organization -** obtaining a copy of the software and accompanying documentation covered by -** this license (the "Software") to use, reproduce, display, distribute, -** execute, and transmit the Software, and to prepare derivative works of the -** Software, and to permit third-parties to whom the Software is furnished to -** do so, all subject to the following: -** -** The copyright notices in the Software and this entire statement, including -** the above license grant, this restriction and the following disclaimer, -** must be included in all copies of the Software, in whole or in part, and -** all derivative works of the Software, unless such copies or derivative -** works are solely in the form of machine-executable object code generated by -** a source language processor. -** -** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -** DEALINGS IN THE SOFTWARE. -** -LICENSE-END- -*/ - -/* DeckLinkAPI.idl */ - -import "unknwn.idl"; - -[uuid(D864517A-EDD5-466D-867D-C819F1C052BB), -version(1.0), helpstring("DeckLink API Library")] -library DeckLinkAPI -{ - -/* Type Declarations */ - -typedef LONGLONG BMDTimeValue; -typedef LONGLONG BMDTimeScale; -typedef unsigned long BMDTimecodeBCD; - -/* End Type Declarations */ - -/* Enumeration Mapping */ - -cpp_quote("typedef unsigned long BMDFrameFlags;") -cpp_quote("typedef unsigned long BMDVideoInputFlags;") -cpp_quote("typedef unsigned long BMDVideoInputFormatChangedEvents;") -cpp_quote("typedef unsigned long BMDDetectedVideoInputFormatFlags;") -cpp_quote("typedef unsigned long BMDTimecodeFlags;") -cpp_quote("typedef unsigned long BMDAnalogVideoFlags;") -cpp_quote("#if 0") -typedef enum _BMDFrameFlags BMDFrameFlags; -typedef enum _BMDVideoInputFlags BMDVideoInputFlags; -typedef enum _BMDVideoInputFormatChangedEvents BMDVideoInputFormatChangedEvents; -typedef enum _BMDDetectedVideoInputFormatFlags BMDDetectedVideoInputFormatFlags; -typedef enum _BMDTimecodeFlags BMDTimecodeFlags; -typedef enum _BMDAnalogVideoFlags BMDAnalogVideoFlags; -cpp_quote("#endif") - -/* End Enumeration Mapping */ - -/* Enum BMDDisplayMode - Video display modes */ - -typedef [v1_enum] enum _BMDDisplayMode { - bmdModeNTSC = /* 'ntsc' */ 0x6E747363, - bmdModeNTSC2398 = /* 'nt23' */ 0x6E743233, // 3:2 pulldown - bmdModePAL = /* 'pal ' */ 0x70616C20, - - /* HD 1080 Modes */ - - bmdModeHD1080p2398 = /* '23ps' */ 0x32337073, - bmdModeHD1080p24 = /* '24ps' */ 0x32347073, - bmdModeHD1080p25 = /* 'Hp25' */ 0x48703235, - bmdModeHD1080p2997 = /* 'Hp29' */ 0x48703239, - bmdModeHD1080p30 = /* 'Hp30' */ 0x48703330, - bmdModeHD1080i50 = /* 'Hi50' */ 0x48693530, - bmdModeHD1080i5994 = /* 'Hi59' */ 0x48693539, - bmdModeHD1080i6000 = /* 'Hi60' */ 0x48693630, // N.B. This _really_ is 60.00 Hz. - bmdModeHD1080p50 = /* 'Hp50' */ 0x48703530, - bmdModeHD1080p5994 = /* 'Hp59' */ 0x48703539, - bmdModeHD1080p6000 = /* 'Hp60' */ 0x48703630, // N.B. This _really_ is 60.00 Hz. - - /* HD 720 Modes */ - - bmdModeHD720p50 = /* 'hp50' */ 0x68703530, - bmdModeHD720p5994 = /* 'hp59' */ 0x68703539, - bmdModeHD720p60 = /* 'hp60' */ 0x68703630, - - /* 2k Modes */ - - bmdMode2k2398 = /* '2k23' */ 0x326B3233, - bmdMode2k24 = /* '2k24' */ 0x326B3234, - bmdMode2k25 = /* '2k25' */ 0x326B3235 -} BMDDisplayMode; - -/* End Enum BMDDisplayMode */ - -/* Enum BMDFieldDominance - Video field dominance */ - -typedef [v1_enum] enum _BMDFieldDominance { - bmdUnknownFieldDominance = 0, - bmdLowerFieldFirst = /* 'lowr' */ 0x6C6F7772, - bmdUpperFieldFirst = /* 'uppr' */ 0x75707072, - bmdProgressiveFrame = /* 'prog' */ 0x70726F67, - bmdProgressiveSegmentedFrame = /* 'psf ' */ 0x70736620 -} BMDFieldDominance; - -/* End Enum BMDFieldDominance */ - -/* Enum BMDPixelFormat - Video pixel formats supported for output/input */ - -typedef [v1_enum] enum _BMDPixelFormat { - bmdFormat8BitYUV = /* '2vuy' */ 0x32767579, - bmdFormat10BitYUV = /* 'v210' */ 0x76323130, - bmdFormat8BitARGB = 0x20, - bmdFormat8BitBGRA = /* 'BGRA' */ 0x42475241, - bmdFormat10BitRGB = /* 'r210' */ 0x72323130 -} BMDPixelFormat; - -/* End Enum BMDPixelFormat */ - -/* Enum BMDVideoOutputFlags - Flags to control the output of ancillary data along with video. */ - -typedef [v1_enum] enum _BMDVideoOutputFlags { - bmdVideoOutputFlagDefault = 0, - bmdVideoOutputRP188 = 1 << 0, - bmdVideoOutputVANC = 1 << 1 -} BMDVideoOutputFlags; - -/* End Enum BMDVideoOutputFlags */ - -/* Enum BMDFrameFlags - Frame flags */ - -[v1_enum] enum _BMDFrameFlags { - bmdFrameFlagDefault = 0, - bmdFrameFlagFlipVertical = 1 << 0, - - /* Flags that are valid only for frames returned through IDeckLinkInput */ - - bmdFrameHasNoInputSource = 1 << 31 -}; - -/* End Enum BMDFrameFlags */ - -/* Enum BMDVideoInputFlags - Flags applicable to video input */ - -[v1_enum] enum _BMDVideoInputFlags { - bmdVideoInputFlagDefault = 0, - bmdVideoInputEnableFormatDetection = 1 << 0 -}; - -/* End Enum BMDVideoInputFlags */ - -/* Enum BMDVideoInputFormatChangedEvents - Bitmask passed to the VideoInputFormatChanged notification to identify the properties of the input signal that have changed */ - -[v1_enum] enum _BMDVideoInputFormatChangedEvents { - bmdVideoInputDisplayModeChanged = 1 << 0, - bmdVideoInputFieldDominanceChanged = 1 << 1, - bmdVideoInputColorspaceChanged = 1 << 2 -}; - -/* End Enum BMDVideoInputFormatChangedEvents */ - -/* Enum BMDDetectedVideoInputFormatFlags - Flags passed to the VideoInputFormatChanged notification to describe the detected video input signal */ - -[v1_enum] enum _BMDDetectedVideoInputFormatFlags { - bmdDetectedVideoInputYCbCr422 = 1 << 0, - bmdDetectedVideoInputRGB444 = 1 << 1 -}; - -/* End Enum BMDDetectedVideoInputFormatFlags */ - -/* Enum BMDOutputFrameCompletionResult - Frame Completion Callback */ - -typedef [v1_enum] enum _BMDOutputFrameCompletionResult { - bmdOutputFrameCompleted, - bmdOutputFrameDisplayedLate, - bmdOutputFrameDropped, - bmdOutputFrameFlushed -} BMDOutputFrameCompletionResult; - -/* End Enum BMDOutputFrameCompletionResult */ - -/* Enum BMDAudioSampleRate - Audio sample rates supported for output/input */ - -typedef [v1_enum] enum _BMDAudioSampleRate { - bmdAudioSampleRate48kHz = 48000 -} BMDAudioSampleRate; - -/* End Enum BMDAudioSampleRate */ - -/* Enum BMDAudioSampleType - Audio sample sizes supported for output/input */ - -typedef [v1_enum] enum _BMDAudioSampleType { - bmdAudioSampleType16bitInteger = 16, - bmdAudioSampleType32bitInteger = 32 -} BMDAudioSampleType; - -/* End Enum BMDAudioSampleType */ - -/* Enum BMDAudioOutputStreamType - Audio output stream type */ - -typedef [v1_enum] enum _BMDAudioOutputStreamType { - bmdAudioOutputStreamContinuous, - bmdAudioOutputStreamContinuousDontResample, - bmdAudioOutputStreamTimestamped -} BMDAudioOutputStreamType; - -/* End Enum BMDAudioOutputStreamType */ - -/* Enum BMDDisplayModeSupport - Output mode supported flags */ - -typedef [v1_enum] enum _BMDDisplayModeSupport { - bmdDisplayModeNotSupported = 0, - bmdDisplayModeSupported, - bmdDisplayModeSupportedWithConversion -} BMDDisplayModeSupport; - -/* End Enum BMDDisplayModeSupport */ - -/* Enum BMDTimecodeFormat - Timecode formats for frame metadata */ - -typedef [v1_enum] enum _BMDTimecodeFormat { - bmdTimecodeRP188 = /* 'rp18' */ 0x72703138, - bmdTimecodeVITC = /* 'vitc' */ 0x76697463, - bmdTimecodeSerial = /* 'seri' */ 0x73657269 -} BMDTimecodeFormat; - -/* End Enum BMDTimecodeFormat */ - -/* Enum BMDTimecodeFlags - Timecode flags */ - -[v1_enum] enum _BMDTimecodeFlags { - bmdTimecodeFlagDefault = 0, - bmdTimecodeIsDropFrame = 1 << 0 -}; - -/* End Enum BMDTimecodeFlags */ - -/* Enum BMDVideoConnection - Video connection types */ - -typedef [v1_enum] enum _BMDVideoConnection { - bmdVideoConnectionSDI = /* 'sdi ' */ 0x73646920, - bmdVideoConnectionHDMI = /* 'hdmi' */ 0x68646D69, - bmdVideoConnectionOpticalSDI = /* 'opti' */ 0x6F707469, - bmdVideoConnectionComponent = /* 'cpnt' */ 0x63706E74, - bmdVideoConnectionComposite = /* 'cmst' */ 0x636D7374, - bmdVideoConnectionSVideo = /* 'svid' */ 0x73766964 -} BMDVideoConnection; - -/* End Enum BMDVideoConnection */ - -/* Enum BMDAnalogVideoFlags - Analog video display flags */ - -[v1_enum] enum _BMDAnalogVideoFlags { - bmdAnalogVideoFlagCompositeSetup75 = 1 << 0, - bmdAnalogVideoFlagComponentBetacamLevels = 1 << 1 -}; - -/* End Enum BMDAnalogVideoFlags */ - -/* Enum BMDAudioConnection - Audio connection types */ - -typedef [v1_enum] enum _BMDAudioConnection { - bmdAudioConnectionEmbedded = /* 'embd' */ 0x656D6264, - bmdAudioConnectionAESEBU = /* 'aes ' */ 0x61657320, - bmdAudioConnectionAnalog = /* 'anlg' */ 0x616E6C67 -} BMDAudioConnection; - -/* End Enum BMDAudioConnection */ - -/* Enum BMDVideoOutputConversionMode - Video/audio conversion mode */ - -typedef [v1_enum] enum _BMDVideoOutputConversionMode { - bmdNoVideoOutputConversion = /* 'none' */ 0x6E6F6E65, - bmdVideoOutputLetterboxDownonversion = /* 'ltbx' */ 0x6C746278, - bmdVideoOutputAnamorphicDownonversion = /* 'amph' */ 0x616D7068, - bmdVideoOutputHD720toHD1080Conversion = /* '720c' */ 0x37323063, - bmdVideoOutputHardwareLetterboxDownconversion = /* 'HWlb' */ 0x48576C62, - bmdVideoOutputHardwareAnamorphicDownconversion = /* 'HWam' */ 0x4857616D, - bmdVideoOutputHardwareCenterCutDownconversion = /* 'HWcc' */ 0x48576363 -} BMDVideoOutputConversionMode; - -/* End Enum BMDVideoOutputConversionMode */ - -/* Enum BMDVideoInputConversionMode - Video input conversion mode */ - -typedef [v1_enum] enum _BMDVideoInputConversionMode { - bmdNoVideoInputConversion = /* 'none' */ 0x6E6F6E65, - bmdVideoInputLetterboxDownconversionFromHD1080 = /* '10lb' */ 0x31306C62, - bmdVideoInputAnamorphicDownconversionFromHD1080 = /* '10am' */ 0x3130616D, - bmdVideoInputLetterboxDownconversionFromHD720 = /* '72lb' */ 0x37326C62, - bmdVideoInputAnamorphicDownconversionFromHD720 = /* '72am' */ 0x3732616D, - bmdVideoInputLetterboxUpconversion = /* 'lbup' */ 0x6C627570, - bmdVideoInputAnamorphicUpconversion = /* 'amup' */ 0x616D7570 -} BMDVideoInputConversionMode; - -/* End Enum BMDVideoInputConversionMode */ - -/* Enum BMDDeckLinkAttributeID - DeckLink Atribute ID */ - -typedef [v1_enum] enum _BMDDeckLinkAttributeID { - - /* Flags */ - - BMDDeckLinkSupportsInternalKeying = /* 'keyi' */ 0x6B657969, - BMDDeckLinkSupportsExternalKeying = /* 'keye' */ 0x6B657965, - BMDDeckLinkSupportsHDKeying = /* 'keyh' */ 0x6B657968, - BMDDeckLinkSupportsInputFormatDetection = /* 'infd' */ 0x696E6664, - BMDDeckLinkHasSerialPort = /* 'hspt' */ 0x68737074, - - /* Integers */ - - BMDDeckLinkMaximumAudioChannels = /* 'mach' */ 0x6D616368, - - /* Strings */ - - BMDDeckLinkSerialPortDeviceName = /* 'slpn' */ 0x736C706E -} BMDDeckLinkAttributeID; - -/* End Enum BMDDeckLinkAttributeID */ - -/* Enum BMDDeckLinkAPIInformationID - DeckLinkAPI information ID */ - -typedef [v1_enum] enum _BMDDeckLinkAPIInformationID { - BMDDeckLinkAPIVersion = /* 'vers' */ 0x76657273 -} BMDDeckLinkAPIInformationID; - -/* End Enum BMDDeckLinkAPIInformationID */ - -/* Forward Declarations */ - -interface IDeckLinkVideoOutputCallback; -interface IDeckLinkInputCallback; -interface IDeckLinkMemoryAllocator; -interface IDeckLinkAudioOutputCallback; -interface IDeckLinkIterator; -interface IDeckLinkAPIInformation; -interface IDeckLinkDisplayModeIterator; -interface IDeckLinkDisplayMode; -interface IDeckLink; -interface IDeckLinkOutput; -interface IDeckLinkInput; -interface IDeckLinkTimecode; -interface IDeckLinkVideoFrame; -interface IDeckLinkMutableVideoFrame; -interface IDeckLinkVideoInputFrame; -interface IDeckLinkVideoFrameAncillary; -interface IDeckLinkAudioInputPacket; -interface IDeckLinkScreenPreviewCallback; -interface IDeckLinkGLScreenPreviewHelper; -interface IDeckLinkConfiguration; -interface IDeckLinkAttributes; -interface IDeckLinkKeyer; - -/* End Forward Declarations */ - -/* Interface IDeckLinkVideoOutputCallback - Frame completion callback. */ - -[ - object, - uuid(E763A626-4A3C-49D1-BF13-E7AD3692AE52), - helpstring("Frame completion callback.") -] interface IDeckLinkVideoOutputCallback : IUnknown -{ - HRESULT ScheduledFrameCompleted([in] IDeckLinkVideoFrame *completedFrame, [in] BMDOutputFrameCompletionResult result); - HRESULT ScheduledPlaybackHasStopped(void); -}; - -/* End Interface IDeckLinkVideoOutputCallback */ - -/* Interface IDeckLinkInputCallback - Frame arrival callback. */ - -[ - object, - uuid(31D28EE7-88B6-4CB1-897A-CDBF79A26414), - helpstring("Frame arrival callback.") -] interface IDeckLinkInputCallback : IUnknown -{ - HRESULT VideoInputFormatChanged([in] BMDVideoInputFormatChangedEvents notificationEvents, [in] IDeckLinkDisplayMode *newDisplayMode, [in] BMDDetectedVideoInputFormatFlags detectedSignalFlags); - HRESULT VideoInputFrameArrived([in] IDeckLinkVideoInputFrame *videoFrame, [in] IDeckLinkAudioInputPacket *audioPacket); -}; - -/* End Interface IDeckLinkInputCallback */ - -/* Interface IDeckLinkMemoryAllocator - Memory allocator for video frames. */ - -[ - object, - uuid(B36EB6E7-9D29-4AA8-92EF-843B87A289E8), - local, - helpstring("Memory allocator for video frames.") -] interface IDeckLinkMemoryAllocator : IUnknown -{ - HRESULT AllocateBuffer(unsigned long bufferSize, [out] void **allocatedBuffer); - HRESULT ReleaseBuffer([in] void *buffer); - - HRESULT Commit(void); - HRESULT Decommit(void); -}; - -/* End Interface IDeckLinkMemoryAllocator */ - -/* Interface IDeckLinkAudioOutputCallback - Optional callback to allow audio samples to be pulled as required. */ - -[ - object, - uuid(403C681B-7F46-4A12-B993-2BB127084EE6), - local, - helpstring("Optional callback to allow audio samples to be pulled as required.") -] interface IDeckLinkAudioOutputCallback : IUnknown -{ - HRESULT RenderAudioSamples(BOOL preroll); -}; - -/* End Interface IDeckLinkAudioOutputCallback */ - -/* Interface IDeckLinkIterator - enumerates installed DeckLink hardware */ - -[ - object, - uuid(74E936FC-CC28-4A67-81A0-1E94E52D4E69), - helpstring("enumerates installed DeckLink hardware") -] interface IDeckLinkIterator : IUnknown -{ - HRESULT Next([out] IDeckLink **deckLinkInstance); -}; - -/* End Interface IDeckLinkIterator */ - -/* Interface IDeckLinkAPIInformation - DeckLinkAPI attribute interface */ - -[ - object, - uuid(7BEA3C68-730D-4322-AF34-8A7152B532A4), - helpstring("DeckLinkAPI attribute interface") -] interface IDeckLinkAPIInformation : IUnknown -{ - HRESULT GetFlag([in] BMDDeckLinkAPIInformationID cfgID, [out] BOOL *value); - HRESULT GetInt([in] BMDDeckLinkAPIInformationID cfgID, [out] LONGLONG *value); - HRESULT GetFloat([in] BMDDeckLinkAPIInformationID cfgID, [out] double *value); - HRESULT GetString([in] BMDDeckLinkAPIInformationID cfgID, [out] BSTR *value); -}; - -/* End Interface IDeckLinkAPIInformation */ - -/* Interface IDeckLinkDisplayModeIterator - enumerates over supported input/output display modes. */ - -[ - object, - uuid(455D741F-1779-4800-86F5-0B5D13D79751), - helpstring("enumerates over supported input/output display modes.") -] interface IDeckLinkDisplayModeIterator : IUnknown -{ - HRESULT Next([out] IDeckLinkDisplayMode **deckLinkDisplayMode); -}; - -/* End Interface IDeckLinkDisplayModeIterator */ - -/* Interface IDeckLinkDisplayMode - represents a display mode */ - -[ - object, - uuid(87451E84-2B7E-439E-A629-4393EA4A8550), - helpstring("represents a display mode") -] interface IDeckLinkDisplayMode : IUnknown -{ - HRESULT GetName([out] BSTR *name); - BMDDisplayMode GetDisplayMode(void); - long GetWidth(void); - long GetHeight(void); - HRESULT GetFrameRate([out] BMDTimeValue *frameDuration, [out] BMDTimeScale *timeScale); - BMDFieldDominance GetFieldDominance(void); -}; - -/* End Interface IDeckLinkDisplayMode */ - -/* Interface IDeckLink - represents a DeckLink device */ - -[ - object, - uuid(62BFF75D-6569-4E55-8D4D-66AA03829ABC), - helpstring("represents a DeckLink device") -] interface IDeckLink : IUnknown -{ - HRESULT GetModelName([out] BSTR *modelName); -}; - -/* End Interface IDeckLink */ - -/* Interface IDeckLinkOutput - Created by QueryInterface from IDeckLink. */ - -[ - object, - uuid(29228142-EB8C-4141-A621-F74026450955), - local, - helpstring("Created by QueryInterface from IDeckLink.") -] interface IDeckLinkOutput : IUnknown -{ - HRESULT DoesSupportVideoMode(BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, [out] BMDDisplayModeSupport *result); - HRESULT GetDisplayModeIterator([out] IDeckLinkDisplayModeIterator **iterator); - - HRESULT SetScreenPreviewCallback([in] IDeckLinkScreenPreviewCallback *previewCallback); - - /* Video Output */ - - HRESULT EnableVideoOutput(BMDDisplayMode displayMode, BMDVideoOutputFlags flags); - HRESULT DisableVideoOutput(void); - - HRESULT SetVideoOutputFrameMemoryAllocator([in] IDeckLinkMemoryAllocator *theAllocator); - HRESULT CreateVideoFrame(long width, long height, long rowBytes, BMDPixelFormat pixelFormat, BMDFrameFlags flags, [out] IDeckLinkMutableVideoFrame **outFrame); - HRESULT CreateAncillaryData(BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, [out] IDeckLinkVideoFrameAncillary **outBuffer); - - HRESULT DisplayVideoFrameSync([in] IDeckLinkVideoFrame *theFrame); - HRESULT ScheduleVideoFrame([in] IDeckLinkVideoFrame *theFrame, BMDTimeValue displayTime, BMDTimeValue displayDuration, BMDTimeScale timeScale); - HRESULT SetScheduledFrameCompletionCallback([in] IDeckLinkVideoOutputCallback *theCallback); - HRESULT GetBufferedVideoFrameCount([out] unsigned long *bufferedFrameCount); - - /* Audio Output */ - - HRESULT EnableAudioOutput(BMDAudioSampleRate sampleRate, BMDAudioSampleType sampleType, unsigned long channelCount, BMDAudioOutputStreamType streamType); - HRESULT DisableAudioOutput(void); - - HRESULT WriteAudioSamplesSync([in] void *buffer, unsigned long sampleFrameCount, [out] unsigned long *sampleFramesWritten); - - HRESULT BeginAudioPreroll(void); - HRESULT EndAudioPreroll(void); - HRESULT ScheduleAudioSamples([in] void *buffer, unsigned long sampleFrameCount, BMDTimeValue streamTime, BMDTimeScale timeScale, [out] unsigned long *sampleFramesWritten); - - HRESULT GetBufferedAudioSampleFrameCount([out] unsigned long *bufferedSampleFrameCount); - HRESULT FlushBufferedAudioSamples(void); - - HRESULT SetAudioCallback([in] IDeckLinkAudioOutputCallback *theCallback); - - /* Output Control */ - - HRESULT StartScheduledPlayback(BMDTimeValue playbackStartTime, BMDTimeScale timeScale, double playbackSpeed); - HRESULT StopScheduledPlayback(BMDTimeValue stopPlaybackAtTime, [out] BMDTimeValue *actualStopTime, BMDTimeScale timeScale); - HRESULT IsScheduledPlaybackRunning([out] BOOL *active); - HRESULT GetScheduledStreamTime(BMDTimeScale desiredTimeScale, [out] BMDTimeValue *streamTime, [out] double *playbackSpeed); - - /* Hardware Timing */ - - HRESULT GetHardwareReferenceClock(BMDTimeScale desiredTimeScale, [out] BMDTimeValue *hardwareTime, [out] BMDTimeValue *timeInFrame, [out] BMDTimeValue *ticksPerFrame); -}; - -/* End Interface IDeckLinkOutput */ - -/* Interface IDeckLinkInput - Created by QueryInterface from IDeckLink. */ - -[ - object, - uuid(300C135A-9F43-48E2-9906-6D7911D93CF1), - helpstring("Created by QueryInterface from IDeckLink.") -] interface IDeckLinkInput : IUnknown -{ - HRESULT DoesSupportVideoMode(BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, [out] BMDDisplayModeSupport *result); - HRESULT GetDisplayModeIterator([out] IDeckLinkDisplayModeIterator **iterator); - - HRESULT SetScreenPreviewCallback([in] IDeckLinkScreenPreviewCallback *previewCallback); - - /* Video Input */ - - HRESULT EnableVideoInput(BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, BMDVideoInputFlags flags); - HRESULT DisableVideoInput(void); - HRESULT GetAvailableVideoFrameCount([out] unsigned long *availableFrameCount); - - /* Audio Input */ - - HRESULT EnableAudioInput(BMDAudioSampleRate sampleRate, BMDAudioSampleType sampleType, unsigned long channelCount); - HRESULT DisableAudioInput(void); - HRESULT GetAvailableAudioSampleFrameCount([out] unsigned long *availableSampleFrameCount); - - /* Input Control */ - - HRESULT StartStreams(void); - HRESULT StopStreams(void); - HRESULT PauseStreams(void); - HRESULT FlushStreams(void); - HRESULT SetCallback([in] IDeckLinkInputCallback *theCallback); - - /* Hardware Timing */ - - HRESULT GetHardwareReferenceClock(BMDTimeScale desiredTimeScale, [out] BMDTimeValue *hardwareTime, [out] BMDTimeValue *timeInFrame, [out] BMDTimeValue *ticksPerFrame); -}; - -/* End Interface IDeckLinkInput */ - -/* Interface IDeckLinkTimecode - Used for video frame timecode representation. */ - -[ - object, - uuid(EFB9BCA6-A521-44F7-BD69-2332F24D9EE6), - helpstring("Used for video frame timecode representation.") -] interface IDeckLinkTimecode : IUnknown -{ - BMDTimecodeBCD GetBCD(void); - HRESULT GetComponents([out] unsigned char *hours, [out] unsigned char *minutes, [out] unsigned char *seconds, [out] unsigned char *frames); - HRESULT GetString([out] BSTR *timecode); - BMDTimecodeFlags GetFlags(void); -}; - -/* End Interface IDeckLinkTimecode */ - -/* Interface IDeckLinkVideoFrame - Interface to encapsulate a video frame; can be caller-implemented. */ - -[ - object, - uuid(A8D8238E-6B18-4196-99E1-5AF717B83D32), - local, - helpstring("Interface to encapsulate a video frame; can be caller-implemented.") -] interface IDeckLinkVideoFrame : IUnknown -{ - long GetWidth(void); - long GetHeight(void); - long GetRowBytes(void); - BMDPixelFormat GetPixelFormat(void); - BMDFrameFlags GetFlags(void); - HRESULT GetBytes([out] void **buffer); - - HRESULT GetTimecode(BMDTimecodeFormat format, [out] IDeckLinkTimecode **timecode); - HRESULT GetAncillaryData([out] IDeckLinkVideoFrameAncillary **ancillary); -}; - -/* End Interface IDeckLinkVideoFrame */ - -/* Interface IDeckLinkMutableVideoFrame - Created by IDeckLinkOutput::CreateVideoFrame. */ - -[ - object, - uuid(46FCEE00-B4E6-43D0-91C0-023A7FCEB34F), - local, - helpstring("Created by IDeckLinkOutput::CreateVideoFrame.") -] interface IDeckLinkMutableVideoFrame : IDeckLinkVideoFrame -{ - HRESULT SetFlags(BMDFrameFlags newFlags); - - HRESULT SetTimecode(BMDTimecodeFormat format, [in] IDeckLinkTimecode *timecode); - HRESULT SetTimecodeFromComponents(BMDTimecodeFormat format, unsigned char hours, unsigned char minutes, unsigned char seconds, unsigned char frames, BMDTimecodeFlags flags); - HRESULT SetAncillaryData([in] IDeckLinkVideoFrameAncillary *ancillary); -}; - -/* End Interface IDeckLinkMutableVideoFrame */ - -/* Interface IDeckLinkVideoInputFrame - Provided by the IDeckLinkVideoInput frame arrival callback. */ - -[ - object, - uuid(9A74FA41-AE9F-47AC-8CF4-01F42DD59965), - local, - helpstring("Provided by the IDeckLinkVideoInput frame arrival callback.") -] interface IDeckLinkVideoInputFrame : IDeckLinkVideoFrame -{ - HRESULT GetStreamTime([out] BMDTimeValue *frameTime, [out] BMDTimeValue *frameDuration, BMDTimeScale timeScale); - HRESULT GetHardwareReferenceTimestamp(BMDTimeScale timeScale, [out] BMDTimeValue *frameTime, [out] BMDTimeValue *frameDuration); -}; - -/* End Interface IDeckLinkVideoInputFrame */ - -/* Interface IDeckLinkVideoFrameAncillary - Obtained through QueryInterface() on an IDeckLinkVideoFrame object. */ - -[ - object, - uuid(732E723C-D1A4-4E29-9E8E-4A88797A0004), - local, - helpstring("Obtained through QueryInterface() on an IDeckLinkVideoFrame object.") -] interface IDeckLinkVideoFrameAncillary : IUnknown -{ - - HRESULT GetBufferForVerticalBlankingLine(unsigned long lineNumber, [out] void **buffer); - BMDPixelFormat GetPixelFormat(void); - BMDDisplayMode GetDisplayMode(void); -}; - -/* End Interface IDeckLinkVideoFrameAncillary */ - -/* Interface IDeckLinkAudioInputPacket - Provided by the IDeckLinkInput callback. */ - -[ - object, - uuid(E43D5870-2894-11DE-8C30-0800200C9A66), - local, - helpstring("Provided by the IDeckLinkInput callback.") -] interface IDeckLinkAudioInputPacket : IUnknown -{ - long GetSampleFrameCount(void); - HRESULT GetBytes([out] void **buffer); - HRESULT GetPacketTime([out] BMDTimeValue *packetTime, BMDTimeScale timeScale); -}; - -/* End Interface IDeckLinkAudioInputPacket */ - -/* Interface IDeckLinkScreenPreviewCallback - Screen preview callback */ - -[ - object, - uuid(373F499D-4B4D-4518-AD22-6354E5A5825E), - local, - helpstring("Screen preview callback") -] interface IDeckLinkScreenPreviewCallback : IUnknown -{ - HRESULT DrawFrame([in] IDeckLinkVideoFrame *theFrame); -}; - -/* End Interface IDeckLinkScreenPreviewCallback */ - -/* Interface IDeckLinkGLScreenPreviewHelper - Created with CoCreateInstance(). */ - -[ - object, - uuid(BA575CD9-A15E-497B-B2C2-F9AFE7BE4EBA), - local, - helpstring("Created with CoCreateInstance().") -] interface IDeckLinkGLScreenPreviewHelper : IUnknown -{ - - /* Methods must be called with OpenGL context set */ - - HRESULT InitializeGL(void); - HRESULT PaintGL(void); - HRESULT SetFrame([in] IDeckLinkVideoFrame *theFrame); -}; - -/* End Interface IDeckLinkGLScreenPreviewHelper */ - -/* Interface IDeckLinkConfiguration - Created by QueryInterface from IDeckLink. */ - -[ - object, - uuid(B8EAD569-B764-47F0-A73F-AE40DF6CBF10), - helpstring("Created by QueryInterface from IDeckLink.") -] interface IDeckLinkConfiguration : IUnknown -{ - HRESULT GetConfigurationValidator([out] IDeckLinkConfiguration **configObject); - HRESULT WriteConfigurationToPreferences(void); - - /* Video Output Configuration */ - - HRESULT SetVideoOutputFormat(BMDVideoConnection videoOutputConnection); - HRESULT IsVideoOutputActive(BMDVideoConnection videoOutputConnection, [out] BOOL *active); - - HRESULT SetAnalogVideoOutputFlags(BMDAnalogVideoFlags analogVideoFlags); - HRESULT GetAnalogVideoOutputFlags([out] BMDAnalogVideoFlags *analogVideoFlags); - - HRESULT EnableFieldFlickerRemovalWhenPaused(BOOL enable); - HRESULT IsEnabledFieldFlickerRemovalWhenPaused([out] BOOL *enabled); - - HRESULT Set444And3GBpsVideoOutput(BOOL enable444VideoOutput, BOOL enable3GbsOutput); - HRESULT Get444And3GBpsVideoOutput([out] BOOL *is444VideoOutputEnabled, [out] BOOL *threeGbsOutputEnabled); - - HRESULT SetVideoOutputConversionMode(BMDVideoOutputConversionMode conversionMode); - HRESULT GetVideoOutputConversionMode([out] BMDVideoOutputConversionMode *conversionMode); - - HRESULT Set_HD1080p24_to_HD1080i5994_Conversion(BOOL enable); - HRESULT Get_HD1080p24_to_HD1080i5994_Conversion([out] BOOL *enabled); - - /* Video Input Configuration */ - - HRESULT SetVideoInputFormat(BMDVideoConnection videoInputFormat); - HRESULT GetVideoInputFormat([out] BMDVideoConnection *videoInputFormat); - - HRESULT SetAnalogVideoInputFlags(BMDAnalogVideoFlags analogVideoFlags); - HRESULT GetAnalogVideoInputFlags([out] BMDAnalogVideoFlags *analogVideoFlags); - - HRESULT SetVideoInputConversionMode(BMDVideoInputConversionMode conversionMode); - HRESULT GetVideoInputConversionMode([out] BMDVideoInputConversionMode *conversionMode); - - HRESULT SetBlackVideoOutputDuringCapture(BOOL blackOutInCapture); - HRESULT GetBlackVideoOutputDuringCapture([out] BOOL *blackOutInCapture); - - HRESULT Set32PulldownSequenceInitialTimecodeFrame(unsigned long aFrameTimecode); - HRESULT Get32PulldownSequenceInitialTimecodeFrame([out] unsigned long *aFrameTimecode); - - HRESULT SetVancSourceLineMapping(unsigned long activeLine1VANCsource, unsigned long activeLine2VANCsource, unsigned long activeLine3VANCsource); - HRESULT GetVancSourceLineMapping([out] unsigned long *activeLine1VANCsource, [out] unsigned long *activeLine2VANCsource, [out] unsigned long *activeLine3VANCsource); - - /* Audio Input Configuration */ - - HRESULT SetAudioInputFormat(BMDAudioConnection audioInputFormat); - HRESULT GetAudioInputFormat([out] BMDAudioConnection *audioInputFormat); -}; - -/* End Interface IDeckLinkConfiguration */ - -/* Interface IDeckLinkAttributes - DeckLink Attribute interface */ - -[ - object, - uuid(ABC11843-D966-44CB-96E2-A1CB5D3135C4), - local, - helpstring("DeckLink Attribute interface") -] interface IDeckLinkAttributes : IUnknown -{ - HRESULT GetFlag([in] BMDDeckLinkAttributeID cfgID, [out] BOOL *value); - HRESULT GetInt([in] BMDDeckLinkAttributeID cfgID, [out] LONGLONG *value); - HRESULT GetFloat([in] BMDDeckLinkAttributeID cfgID, [out] double *value); - HRESULT GetString([in] BMDDeckLinkAttributeID cfgID, [out] BSTR *value); -}; - -/* End Interface IDeckLinkAttributes */ - -/* Interface IDeckLinkKeyer - DeckLink Keyer interface */ - -[ - object, - uuid(89AFCAF5-65F8-421E-98F7-96FE5F5BFBA3), - local, - helpstring("DeckLink Keyer interface") -] interface IDeckLinkKeyer : IUnknown -{ - HRESULT Enable([in] BOOL isExternal); - HRESULT SetLevel([in] unsigned char level); - HRESULT RampUp([in] unsigned long numberOfFrames); - HRESULT RampDown([in] unsigned long numberOfFrames); - HRESULT Disable(void); -}; - -/* End Interface IDeckLinkKeyer */ - -/* Coclasses */ - -importlib("stdole2.tlb"); - -[ - uuid(D9EDA3B3-2887-41FA-B724-017CF1EB1D37), - helpstring("CDeckLinkIterator Class") -] coclass CDeckLinkIterator -{ - [default] interface IDeckLinkIterator; -}; - -[ - uuid(D398CEE7-4434-4CA3-9BA6-5AE34556B905), - helpstring("CDeckLinkGLScreenPreviewHelper Class") -] coclass CDeckLinkGLScreenPreviewHelper -{ - [default] interface IDeckLinkGLScreenPreviewHelper; -}; - -/* End Coclasses */ - -// import deprecated interfaces -#include "DeckLinkAPI_v7_1.idl" -#include "DeckLinkAPI_v7_3.idl" -}; diff --git a/server/consumers/decklink/DeckLinkAPI_h.h b/server/consumers/decklink/DeckLinkAPI_h.h deleted file mode 100644 index 1321b0768..000000000 --- a/server/consumers/decklink/DeckLinkAPI_h.h +++ /dev/null @@ -1,5584 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 7.00.0500 */ -/* at Wed Jan 13 09:58:01 2010 - */ -/* Compiler settings for .\consumers\declink\DeckLinkAPI.idl: - Oicf, W1, Zp8, env=Win32 (32b run) - protocol : dce , ms_ext, c_ext, robust - error checks: allocation ref bounds_check enum stub_data - VC __declspec() decoration level: - __declspec(uuid()), __declspec(selectany), __declspec(novtable) - DECLSPEC_UUID(), MIDL_INTERFACE() -*/ -//@@MIDL_FILE_HEADING( ) - -#pragma warning( disable: 4049 ) /* more than 64k source lines */ - - -/* verify that the version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 475 -#endif - -#include "rpc.h" -#include "rpcndr.h" - -#ifndef __RPCNDR_H_VERSION__ -#error this stub requires an updated version of -#endif // __RPCNDR_H_VERSION__ - - -#ifndef __DeckLinkAPI_h_h__ -#define __DeckLinkAPI_h_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __IDeckLinkVideoOutputCallback_FWD_DEFINED__ -#define __IDeckLinkVideoOutputCallback_FWD_DEFINED__ -typedef interface IDeckLinkVideoOutputCallback IDeckLinkVideoOutputCallback; -#endif /* __IDeckLinkVideoOutputCallback_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkInputCallback_FWD_DEFINED__ -#define __IDeckLinkInputCallback_FWD_DEFINED__ -typedef interface IDeckLinkInputCallback IDeckLinkInputCallback; -#endif /* __IDeckLinkInputCallback_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkMemoryAllocator_FWD_DEFINED__ -#define __IDeckLinkMemoryAllocator_FWD_DEFINED__ -typedef interface IDeckLinkMemoryAllocator IDeckLinkMemoryAllocator; -#endif /* __IDeckLinkMemoryAllocator_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkAudioOutputCallback_FWD_DEFINED__ -#define __IDeckLinkAudioOutputCallback_FWD_DEFINED__ -typedef interface IDeckLinkAudioOutputCallback IDeckLinkAudioOutputCallback; -#endif /* __IDeckLinkAudioOutputCallback_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkIterator_FWD_DEFINED__ -#define __IDeckLinkIterator_FWD_DEFINED__ -typedef interface IDeckLinkIterator IDeckLinkIterator; -#endif /* __IDeckLinkIterator_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkAPIInformation_FWD_DEFINED__ -#define __IDeckLinkAPIInformation_FWD_DEFINED__ -typedef interface IDeckLinkAPIInformation IDeckLinkAPIInformation; -#endif /* __IDeckLinkAPIInformation_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkDisplayModeIterator_FWD_DEFINED__ -#define __IDeckLinkDisplayModeIterator_FWD_DEFINED__ -typedef interface IDeckLinkDisplayModeIterator IDeckLinkDisplayModeIterator; -#endif /* __IDeckLinkDisplayModeIterator_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkDisplayMode_FWD_DEFINED__ -#define __IDeckLinkDisplayMode_FWD_DEFINED__ -typedef interface IDeckLinkDisplayMode IDeckLinkDisplayMode; -#endif /* __IDeckLinkDisplayMode_FWD_DEFINED__ */ - - -#ifndef __IDeckLink_FWD_DEFINED__ -#define __IDeckLink_FWD_DEFINED__ -typedef interface IDeckLink IDeckLink; -#endif /* __IDeckLink_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkOutput_FWD_DEFINED__ -#define __IDeckLinkOutput_FWD_DEFINED__ -typedef interface IDeckLinkOutput IDeckLinkOutput; -#endif /* __IDeckLinkOutput_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkInput_FWD_DEFINED__ -#define __IDeckLinkInput_FWD_DEFINED__ -typedef interface IDeckLinkInput IDeckLinkInput; -#endif /* __IDeckLinkInput_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkTimecode_FWD_DEFINED__ -#define __IDeckLinkTimecode_FWD_DEFINED__ -typedef interface IDeckLinkTimecode IDeckLinkTimecode; -#endif /* __IDeckLinkTimecode_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoFrame_FWD_DEFINED__ -#define __IDeckLinkVideoFrame_FWD_DEFINED__ -typedef interface IDeckLinkVideoFrame IDeckLinkVideoFrame; -#endif /* __IDeckLinkVideoFrame_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkMutableVideoFrame_FWD_DEFINED__ -#define __IDeckLinkMutableVideoFrame_FWD_DEFINED__ -typedef interface IDeckLinkMutableVideoFrame IDeckLinkMutableVideoFrame; -#endif /* __IDeckLinkMutableVideoFrame_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoInputFrame_FWD_DEFINED__ -#define __IDeckLinkVideoInputFrame_FWD_DEFINED__ -typedef interface IDeckLinkVideoInputFrame IDeckLinkVideoInputFrame; -#endif /* __IDeckLinkVideoInputFrame_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoFrameAncillary_FWD_DEFINED__ -#define __IDeckLinkVideoFrameAncillary_FWD_DEFINED__ -typedef interface IDeckLinkVideoFrameAncillary IDeckLinkVideoFrameAncillary; -#endif /* __IDeckLinkVideoFrameAncillary_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkAudioInputPacket_FWD_DEFINED__ -#define __IDeckLinkAudioInputPacket_FWD_DEFINED__ -typedef interface IDeckLinkAudioInputPacket IDeckLinkAudioInputPacket; -#endif /* __IDeckLinkAudioInputPacket_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkScreenPreviewCallback_FWD_DEFINED__ -#define __IDeckLinkScreenPreviewCallback_FWD_DEFINED__ -typedef interface IDeckLinkScreenPreviewCallback IDeckLinkScreenPreviewCallback; -#endif /* __IDeckLinkScreenPreviewCallback_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkGLScreenPreviewHelper_FWD_DEFINED__ -#define __IDeckLinkGLScreenPreviewHelper_FWD_DEFINED__ -typedef interface IDeckLinkGLScreenPreviewHelper IDeckLinkGLScreenPreviewHelper; -#endif /* __IDeckLinkGLScreenPreviewHelper_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkConfiguration_FWD_DEFINED__ -#define __IDeckLinkConfiguration_FWD_DEFINED__ -typedef interface IDeckLinkConfiguration IDeckLinkConfiguration; -#endif /* __IDeckLinkConfiguration_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkAttributes_FWD_DEFINED__ -#define __IDeckLinkAttributes_FWD_DEFINED__ -typedef interface IDeckLinkAttributes IDeckLinkAttributes; -#endif /* __IDeckLinkAttributes_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkKeyer_FWD_DEFINED__ -#define __IDeckLinkKeyer_FWD_DEFINED__ -typedef interface IDeckLinkKeyer IDeckLinkKeyer; -#endif /* __IDeckLinkKeyer_FWD_DEFINED__ */ - - -#ifndef __CDeckLinkIterator_FWD_DEFINED__ -#define __CDeckLinkIterator_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class CDeckLinkIterator CDeckLinkIterator; -#else -typedef struct CDeckLinkIterator CDeckLinkIterator; -#endif /* __cplusplus */ - -#endif /* __CDeckLinkIterator_FWD_DEFINED__ */ - - -#ifndef __CDeckLinkGLScreenPreviewHelper_FWD_DEFINED__ -#define __CDeckLinkGLScreenPreviewHelper_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class CDeckLinkGLScreenPreviewHelper CDeckLinkGLScreenPreviewHelper; -#else -typedef struct CDeckLinkGLScreenPreviewHelper CDeckLinkGLScreenPreviewHelper; -#endif /* __cplusplus */ - -#endif /* __CDeckLinkGLScreenPreviewHelper_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkDisplayModeIterator_v7_1_FWD_DEFINED__ -#define __IDeckLinkDisplayModeIterator_v7_1_FWD_DEFINED__ -typedef interface IDeckLinkDisplayModeIterator_v7_1 IDeckLinkDisplayModeIterator_v7_1; -#endif /* __IDeckLinkDisplayModeIterator_v7_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkDisplayMode_v7_1_FWD_DEFINED__ -#define __IDeckLinkDisplayMode_v7_1_FWD_DEFINED__ -typedef interface IDeckLinkDisplayMode_v7_1 IDeckLinkDisplayMode_v7_1; -#endif /* __IDeckLinkDisplayMode_v7_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoFrame_v7_1_FWD_DEFINED__ -#define __IDeckLinkVideoFrame_v7_1_FWD_DEFINED__ -typedef interface IDeckLinkVideoFrame_v7_1 IDeckLinkVideoFrame_v7_1; -#endif /* __IDeckLinkVideoFrame_v7_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoInputFrame_v7_1_FWD_DEFINED__ -#define __IDeckLinkVideoInputFrame_v7_1_FWD_DEFINED__ -typedef interface IDeckLinkVideoInputFrame_v7_1 IDeckLinkVideoInputFrame_v7_1; -#endif /* __IDeckLinkVideoInputFrame_v7_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkAudioInputPacket_v7_1_FWD_DEFINED__ -#define __IDeckLinkAudioInputPacket_v7_1_FWD_DEFINED__ -typedef interface IDeckLinkAudioInputPacket_v7_1 IDeckLinkAudioInputPacket_v7_1; -#endif /* __IDeckLinkAudioInputPacket_v7_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoOutputCallback_v7_1_FWD_DEFINED__ -#define __IDeckLinkVideoOutputCallback_v7_1_FWD_DEFINED__ -typedef interface IDeckLinkVideoOutputCallback_v7_1 IDeckLinkVideoOutputCallback_v7_1; -#endif /* __IDeckLinkVideoOutputCallback_v7_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkInputCallback_v7_1_FWD_DEFINED__ -#define __IDeckLinkInputCallback_v7_1_FWD_DEFINED__ -typedef interface IDeckLinkInputCallback_v7_1 IDeckLinkInputCallback_v7_1; -#endif /* __IDeckLinkInputCallback_v7_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkOutput_v7_1_FWD_DEFINED__ -#define __IDeckLinkOutput_v7_1_FWD_DEFINED__ -typedef interface IDeckLinkOutput_v7_1 IDeckLinkOutput_v7_1; -#endif /* __IDeckLinkOutput_v7_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkInput_v7_1_FWD_DEFINED__ -#define __IDeckLinkInput_v7_1_FWD_DEFINED__ -typedef interface IDeckLinkInput_v7_1 IDeckLinkInput_v7_1; -#endif /* __IDeckLinkInput_v7_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkInputCallback_v7_3_FWD_DEFINED__ -#define __IDeckLinkInputCallback_v7_3_FWD_DEFINED__ -typedef interface IDeckLinkInputCallback_v7_3 IDeckLinkInputCallback_v7_3; -#endif /* __IDeckLinkInputCallback_v7_3_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkOutput_v7_3_FWD_DEFINED__ -#define __IDeckLinkOutput_v7_3_FWD_DEFINED__ -typedef interface IDeckLinkOutput_v7_3 IDeckLinkOutput_v7_3; -#endif /* __IDeckLinkOutput_v7_3_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkInput_v7_3_FWD_DEFINED__ -#define __IDeckLinkInput_v7_3_FWD_DEFINED__ -typedef interface IDeckLinkInput_v7_3 IDeckLinkInput_v7_3; -#endif /* __IDeckLinkInput_v7_3_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoInputFrame_v7_3_FWD_DEFINED__ -#define __IDeckLinkVideoInputFrame_v7_3_FWD_DEFINED__ -typedef interface IDeckLinkVideoInputFrame_v7_3 IDeckLinkVideoInputFrame_v7_3; -#endif /* __IDeckLinkVideoInputFrame_v7_3_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "unknwn.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - - -#ifndef __DeckLinkAPI_LIBRARY_DEFINED__ -#define __DeckLinkAPI_LIBRARY_DEFINED__ - -/* library DeckLinkAPI */ -/* [helpstring][version][uuid] */ - -typedef LONGLONG BMDTimeValue; - -typedef LONGLONG BMDTimeScale; - -typedef unsigned long BMDTimecodeBCD; - -typedef unsigned long BMDFrameFlags; -typedef unsigned long BMDVideoInputFlags; -typedef unsigned long BMDVideoInputFormatChangedEvents; -typedef unsigned long BMDDetectedVideoInputFormatFlags; -typedef unsigned long BMDTimecodeFlags; -typedef unsigned long BMDAnalogVideoFlags; -#if 0 -typedef enum _BMDFrameFlags BMDFrameFlags; - -typedef enum _BMDVideoInputFlags BMDVideoInputFlags; - -typedef enum _BMDVideoInputFormatChangedEvents BMDVideoInputFormatChangedEvents; - -typedef enum _BMDDetectedVideoInputFormatFlags BMDDetectedVideoInputFormatFlags; - -typedef enum _BMDTimecodeFlags BMDTimecodeFlags; - -typedef enum _BMDAnalogVideoFlags BMDAnalogVideoFlags; - -#endif -typedef /* [v1_enum] */ -enum _BMDDisplayMode - { bmdModeNTSC = 0x6e747363, - bmdModeNTSC2398 = 0x6e743233, - bmdModePAL = 0x70616c20, - bmdModeHD1080p2398 = 0x32337073, - bmdModeHD1080p24 = 0x32347073, - bmdModeHD1080p25 = 0x48703235, - bmdModeHD1080p2997 = 0x48703239, - bmdModeHD1080p30 = 0x48703330, - bmdModeHD1080i50 = 0x48693530, - bmdModeHD1080i5994 = 0x48693539, - bmdModeHD1080i6000 = 0x48693630, - bmdModeHD1080p50 = 0x48703530, - bmdModeHD1080p5994 = 0x48703539, - bmdModeHD1080p6000 = 0x48703630, - bmdModeHD720p50 = 0x68703530, - bmdModeHD720p5994 = 0x68703539, - bmdModeHD720p60 = 0x68703630, - bmdMode2k2398 = 0x326b3233, - bmdMode2k24 = 0x326b3234, - bmdMode2k25 = 0x326b3235 - } BMDDisplayMode; - -typedef /* [v1_enum] */ -enum _BMDFieldDominance - { bmdUnknownFieldDominance = 0, - bmdLowerFieldFirst = 0x6c6f7772, - bmdUpperFieldFirst = 0x75707072, - bmdProgressiveFrame = 0x70726f67, - bmdProgressiveSegmentedFrame = 0x70736620 - } BMDFieldDominance; - -typedef /* [v1_enum] */ -enum _BMDPixelFormat - { bmdFormat8BitYUV = 0x32767579, - bmdFormat10BitYUV = 0x76323130, - bmdFormat8BitARGB = 0x20, - bmdFormat8BitBGRA = 0x42475241, - bmdFormat10BitRGB = 0x72323130 - } BMDPixelFormat; - -typedef /* [v1_enum] */ -enum _BMDVideoOutputFlags - { bmdVideoOutputFlagDefault = 0, - bmdVideoOutputRP188 = ( 1 << 0 ) , - bmdVideoOutputVANC = ( 1 << 1 ) - } BMDVideoOutputFlags; - -/* [v1_enum] */ -enum _BMDFrameFlags - { bmdFrameFlagDefault = 0, - bmdFrameFlagFlipVertical = ( 1 << 0 ) , - bmdFrameHasNoInputSource = ( 1 << 31 ) - } ; -/* [v1_enum] */ -enum _BMDVideoInputFlags - { bmdVideoInputFlagDefault = 0, - bmdVideoInputEnableFormatDetection = ( 1 << 0 ) - } ; -/* [v1_enum] */ -enum _BMDVideoInputFormatChangedEvents - { bmdVideoInputDisplayModeChanged = ( 1 << 0 ) , - bmdVideoInputFieldDominanceChanged = ( 1 << 1 ) , - bmdVideoInputColorspaceChanged = ( 1 << 2 ) - } ; -/* [v1_enum] */ -enum _BMDDetectedVideoInputFormatFlags - { bmdDetectedVideoInputYCbCr422 = ( 1 << 0 ) , - bmdDetectedVideoInputRGB444 = ( 1 << 1 ) - } ; -typedef /* [v1_enum] */ -enum _BMDOutputFrameCompletionResult - { bmdOutputFrameCompleted = 0, - bmdOutputFrameDisplayedLate = ( bmdOutputFrameCompleted + 1 ) , - bmdOutputFrameDropped = ( bmdOutputFrameDisplayedLate + 1 ) , - bmdOutputFrameFlushed = ( bmdOutputFrameDropped + 1 ) - } BMDOutputFrameCompletionResult; - -typedef /* [v1_enum] */ -enum _BMDAudioSampleRate - { bmdAudioSampleRate48kHz = 48000 - } BMDAudioSampleRate; - -typedef /* [v1_enum] */ -enum _BMDAudioSampleType - { bmdAudioSampleType16bitInteger = 16, - bmdAudioSampleType32bitInteger = 32 - } BMDAudioSampleType; - -typedef /* [v1_enum] */ -enum _BMDAudioOutputStreamType - { bmdAudioOutputStreamContinuous = 0, - bmdAudioOutputStreamContinuousDontResample = ( bmdAudioOutputStreamContinuous + 1 ) , - bmdAudioOutputStreamTimestamped = ( bmdAudioOutputStreamContinuousDontResample + 1 ) - } BMDAudioOutputStreamType; - -typedef /* [v1_enum] */ -enum _BMDDisplayModeSupport - { bmdDisplayModeNotSupported = 0, - bmdDisplayModeSupported = ( bmdDisplayModeNotSupported + 1 ) , - bmdDisplayModeSupportedWithConversion = ( bmdDisplayModeSupported + 1 ) - } BMDDisplayModeSupport; - -typedef /* [v1_enum] */ -enum _BMDTimecodeFormat - { bmdTimecodeRP188 = 0x72703138, - bmdTimecodeVITC = 0x76697463, - bmdTimecodeSerial = 0x73657269 - } BMDTimecodeFormat; - -/* [v1_enum] */ -enum _BMDTimecodeFlags - { bmdTimecodeFlagDefault = 0, - bmdTimecodeIsDropFrame = ( 1 << 0 ) - } ; -typedef /* [v1_enum] */ -enum _BMDVideoConnection - { bmdVideoConnectionSDI = 0x73646920, - bmdVideoConnectionHDMI = 0x68646d69, - bmdVideoConnectionOpticalSDI = 0x6f707469, - bmdVideoConnectionComponent = 0x63706e74, - bmdVideoConnectionComposite = 0x636d7374, - bmdVideoConnectionSVideo = 0x73766964 - } BMDVideoConnection; - -/* [v1_enum] */ -enum _BMDAnalogVideoFlags - { bmdAnalogVideoFlagCompositeSetup75 = ( 1 << 0 ) , - bmdAnalogVideoFlagComponentBetacamLevels = ( 1 << 1 ) - } ; -typedef /* [v1_enum] */ -enum _BMDAudioConnection - { bmdAudioConnectionEmbedded = 0x656d6264, - bmdAudioConnectionAESEBU = 0x61657320, - bmdAudioConnectionAnalog = 0x616e6c67 - } BMDAudioConnection; - -typedef /* [v1_enum] */ -enum _BMDVideoOutputConversionMode - { bmdNoVideoOutputConversion = 0x6e6f6e65, - bmdVideoOutputLetterboxDownonversion = 0x6c746278, - bmdVideoOutputAnamorphicDownonversion = 0x616d7068, - bmdVideoOutputHD720toHD1080Conversion = 0x37323063, - bmdVideoOutputHardwareLetterboxDownconversion = 0x48576c62, - bmdVideoOutputHardwareAnamorphicDownconversion = 0x4857616d, - bmdVideoOutputHardwareCenterCutDownconversion = 0x48576363 - } BMDVideoOutputConversionMode; - -typedef /* [v1_enum] */ -enum _BMDVideoInputConversionMode - { bmdNoVideoInputConversion = 0x6e6f6e65, - bmdVideoInputLetterboxDownconversionFromHD1080 = 0x31306c62, - bmdVideoInputAnamorphicDownconversionFromHD1080 = 0x3130616d, - bmdVideoInputLetterboxDownconversionFromHD720 = 0x37326c62, - bmdVideoInputAnamorphicDownconversionFromHD720 = 0x3732616d, - bmdVideoInputLetterboxUpconversion = 0x6c627570, - bmdVideoInputAnamorphicUpconversion = 0x616d7570 - } BMDVideoInputConversionMode; - -typedef /* [v1_enum] */ -enum _BMDDeckLinkAttributeID - { BMDDeckLinkSupportsInternalKeying = 0x6b657969, - BMDDeckLinkSupportsExternalKeying = 0x6b657965, - BMDDeckLinkSupportsHDKeying = 0x6b657968, - BMDDeckLinkSupportsInputFormatDetection = 0x696e6664, - BMDDeckLinkHasSerialPort = 0x68737074, - BMDDeckLinkMaximumAudioChannels = 0x6d616368, - BMDDeckLinkSerialPortDeviceName = 0x736c706e - } BMDDeckLinkAttributeID; - -typedef /* [v1_enum] */ -enum _BMDDeckLinkAPIInformationID - { BMDDeckLinkAPIVersion = 0x76657273 - } BMDDeckLinkAPIInformationID; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -EXTERN_C const IID LIBID_DeckLinkAPI; - -#ifndef __IDeckLinkVideoOutputCallback_INTERFACE_DEFINED__ -#define __IDeckLinkVideoOutputCallback_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoOutputCallback */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoOutputCallback; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("E763A626-4A3C-49D1-BF13-E7AD3692AE52") - IDeckLinkVideoOutputCallback : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted( - /* [in] */ IDeckLinkVideoFrame *completedFrame, - /* [in] */ BMDOutputFrameCompletionResult result) = 0; - - virtual HRESULT STDMETHODCALLTYPE ScheduledPlaybackHasStopped( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkVideoOutputCallbackVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoOutputCallback * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoOutputCallback * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoOutputCallback * This); - - HRESULT ( STDMETHODCALLTYPE *ScheduledFrameCompleted )( - IDeckLinkVideoOutputCallback * This, - /* [in] */ IDeckLinkVideoFrame *completedFrame, - /* [in] */ BMDOutputFrameCompletionResult result); - - HRESULT ( STDMETHODCALLTYPE *ScheduledPlaybackHasStopped )( - IDeckLinkVideoOutputCallback * This); - - END_INTERFACE - } IDeckLinkVideoOutputCallbackVtbl; - - interface IDeckLinkVideoOutputCallback - { - CONST_VTBL struct IDeckLinkVideoOutputCallbackVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoOutputCallback_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoOutputCallback_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoOutputCallback_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoOutputCallback_ScheduledFrameCompleted(This,completedFrame,result) \ - ( (This)->lpVtbl -> ScheduledFrameCompleted(This,completedFrame,result) ) - -#define IDeckLinkVideoOutputCallback_ScheduledPlaybackHasStopped(This) \ - ( (This)->lpVtbl -> ScheduledPlaybackHasStopped(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoOutputCallback_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkInputCallback_INTERFACE_DEFINED__ -#define __IDeckLinkInputCallback_INTERFACE_DEFINED__ - -/* interface IDeckLinkInputCallback */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkInputCallback; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("31D28EE7-88B6-4CB1-897A-CDBF79A26414") - IDeckLinkInputCallback : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged( - /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents, - /* [in] */ IDeckLinkDisplayMode *newDisplayMode, - /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived( - /* [in] */ IDeckLinkVideoInputFrame *videoFrame, - /* [in] */ IDeckLinkAudioInputPacket *audioPacket) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkInputCallbackVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkInputCallback * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkInputCallback * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkInputCallback * This); - - HRESULT ( STDMETHODCALLTYPE *VideoInputFormatChanged )( - IDeckLinkInputCallback * This, - /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents, - /* [in] */ IDeckLinkDisplayMode *newDisplayMode, - /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags); - - HRESULT ( STDMETHODCALLTYPE *VideoInputFrameArrived )( - IDeckLinkInputCallback * This, - /* [in] */ IDeckLinkVideoInputFrame *videoFrame, - /* [in] */ IDeckLinkAudioInputPacket *audioPacket); - - END_INTERFACE - } IDeckLinkInputCallbackVtbl; - - interface IDeckLinkInputCallback - { - CONST_VTBL struct IDeckLinkInputCallbackVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkInputCallback_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkInputCallback_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkInputCallback_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkInputCallback_VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags) \ - ( (This)->lpVtbl -> VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags) ) - -#define IDeckLinkInputCallback_VideoInputFrameArrived(This,videoFrame,audioPacket) \ - ( (This)->lpVtbl -> VideoInputFrameArrived(This,videoFrame,audioPacket) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkInputCallback_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkMemoryAllocator_INTERFACE_DEFINED__ -#define __IDeckLinkMemoryAllocator_INTERFACE_DEFINED__ - -/* interface IDeckLinkMemoryAllocator */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkMemoryAllocator; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("B36EB6E7-9D29-4AA8-92EF-843B87A289E8") - IDeckLinkMemoryAllocator : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE AllocateBuffer( - unsigned long bufferSize, - /* [out] */ void **allocatedBuffer) = 0; - - virtual HRESULT STDMETHODCALLTYPE ReleaseBuffer( - /* [in] */ void *buffer) = 0; - - virtual HRESULT STDMETHODCALLTYPE Commit( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE Decommit( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkMemoryAllocatorVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkMemoryAllocator * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkMemoryAllocator * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkMemoryAllocator * This); - - HRESULT ( STDMETHODCALLTYPE *AllocateBuffer )( - IDeckLinkMemoryAllocator * This, - unsigned long bufferSize, - /* [out] */ void **allocatedBuffer); - - HRESULT ( STDMETHODCALLTYPE *ReleaseBuffer )( - IDeckLinkMemoryAllocator * This, - /* [in] */ void *buffer); - - HRESULT ( STDMETHODCALLTYPE *Commit )( - IDeckLinkMemoryAllocator * This); - - HRESULT ( STDMETHODCALLTYPE *Decommit )( - IDeckLinkMemoryAllocator * This); - - END_INTERFACE - } IDeckLinkMemoryAllocatorVtbl; - - interface IDeckLinkMemoryAllocator - { - CONST_VTBL struct IDeckLinkMemoryAllocatorVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkMemoryAllocator_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkMemoryAllocator_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkMemoryAllocator_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkMemoryAllocator_AllocateBuffer(This,bufferSize,allocatedBuffer) \ - ( (This)->lpVtbl -> AllocateBuffer(This,bufferSize,allocatedBuffer) ) - -#define IDeckLinkMemoryAllocator_ReleaseBuffer(This,buffer) \ - ( (This)->lpVtbl -> ReleaseBuffer(This,buffer) ) - -#define IDeckLinkMemoryAllocator_Commit(This) \ - ( (This)->lpVtbl -> Commit(This) ) - -#define IDeckLinkMemoryAllocator_Decommit(This) \ - ( (This)->lpVtbl -> Decommit(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkMemoryAllocator_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkAudioOutputCallback_INTERFACE_DEFINED__ -#define __IDeckLinkAudioOutputCallback_INTERFACE_DEFINED__ - -/* interface IDeckLinkAudioOutputCallback */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkAudioOutputCallback; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("403C681B-7F46-4A12-B993-2BB127084EE6") - IDeckLinkAudioOutputCallback : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE RenderAudioSamples( - BOOL preroll) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkAudioOutputCallbackVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkAudioOutputCallback * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkAudioOutputCallback * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkAudioOutputCallback * This); - - HRESULT ( STDMETHODCALLTYPE *RenderAudioSamples )( - IDeckLinkAudioOutputCallback * This, - BOOL preroll); - - END_INTERFACE - } IDeckLinkAudioOutputCallbackVtbl; - - interface IDeckLinkAudioOutputCallback - { - CONST_VTBL struct IDeckLinkAudioOutputCallbackVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkAudioOutputCallback_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkAudioOutputCallback_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkAudioOutputCallback_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkAudioOutputCallback_RenderAudioSamples(This,preroll) \ - ( (This)->lpVtbl -> RenderAudioSamples(This,preroll) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkAudioOutputCallback_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkIterator_INTERFACE_DEFINED__ -#define __IDeckLinkIterator_INTERFACE_DEFINED__ - -/* interface IDeckLinkIterator */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkIterator; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("74E936FC-CC28-4A67-81A0-1E94E52D4E69") - IDeckLinkIterator : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Next( - /* [out] */ IDeckLink **deckLinkInstance) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkIteratorVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkIterator * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkIterator * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkIterator * This); - - HRESULT ( STDMETHODCALLTYPE *Next )( - IDeckLinkIterator * This, - /* [out] */ IDeckLink **deckLinkInstance); - - END_INTERFACE - } IDeckLinkIteratorVtbl; - - interface IDeckLinkIterator - { - CONST_VTBL struct IDeckLinkIteratorVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkIterator_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkIterator_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkIterator_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkIterator_Next(This,deckLinkInstance) \ - ( (This)->lpVtbl -> Next(This,deckLinkInstance) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkIterator_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkAPIInformation_INTERFACE_DEFINED__ -#define __IDeckLinkAPIInformation_INTERFACE_DEFINED__ - -/* interface IDeckLinkAPIInformation */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkAPIInformation; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("7BEA3C68-730D-4322-AF34-8A7152B532A4") - IDeckLinkAPIInformation : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetFlag( - /* [in] */ BMDDeckLinkAPIInformationID cfgID, - /* [out] */ BOOL *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetInt( - /* [in] */ BMDDeckLinkAPIInformationID cfgID, - /* [out] */ LONGLONG *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFloat( - /* [in] */ BMDDeckLinkAPIInformationID cfgID, - /* [out] */ double *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetString( - /* [in] */ BMDDeckLinkAPIInformationID cfgID, - /* [out] */ BSTR *value) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkAPIInformationVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkAPIInformation * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkAPIInformation * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkAPIInformation * This); - - HRESULT ( STDMETHODCALLTYPE *GetFlag )( - IDeckLinkAPIInformation * This, - /* [in] */ BMDDeckLinkAPIInformationID cfgID, - /* [out] */ BOOL *value); - - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IDeckLinkAPIInformation * This, - /* [in] */ BMDDeckLinkAPIInformationID cfgID, - /* [out] */ LONGLONG *value); - - HRESULT ( STDMETHODCALLTYPE *GetFloat )( - IDeckLinkAPIInformation * This, - /* [in] */ BMDDeckLinkAPIInformationID cfgID, - /* [out] */ double *value); - - HRESULT ( STDMETHODCALLTYPE *GetString )( - IDeckLinkAPIInformation * This, - /* [in] */ BMDDeckLinkAPIInformationID cfgID, - /* [out] */ BSTR *value); - - END_INTERFACE - } IDeckLinkAPIInformationVtbl; - - interface IDeckLinkAPIInformation - { - CONST_VTBL struct IDeckLinkAPIInformationVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkAPIInformation_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkAPIInformation_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkAPIInformation_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkAPIInformation_GetFlag(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) - -#define IDeckLinkAPIInformation_GetInt(This,cfgID,value) \ - ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) - -#define IDeckLinkAPIInformation_GetFloat(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) - -#define IDeckLinkAPIInformation_GetString(This,cfgID,value) \ - ( (This)->lpVtbl -> GetString(This,cfgID,value) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkAPIInformation_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkDisplayModeIterator_INTERFACE_DEFINED__ -#define __IDeckLinkDisplayModeIterator_INTERFACE_DEFINED__ - -/* interface IDeckLinkDisplayModeIterator */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkDisplayModeIterator; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("455D741F-1779-4800-86F5-0B5D13D79751") - IDeckLinkDisplayModeIterator : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Next( - /* [out] */ IDeckLinkDisplayMode **deckLinkDisplayMode) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkDisplayModeIteratorVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkDisplayModeIterator * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkDisplayModeIterator * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkDisplayModeIterator * This); - - HRESULT ( STDMETHODCALLTYPE *Next )( - IDeckLinkDisplayModeIterator * This, - /* [out] */ IDeckLinkDisplayMode **deckLinkDisplayMode); - - END_INTERFACE - } IDeckLinkDisplayModeIteratorVtbl; - - interface IDeckLinkDisplayModeIterator - { - CONST_VTBL struct IDeckLinkDisplayModeIteratorVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkDisplayModeIterator_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkDisplayModeIterator_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkDisplayModeIterator_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkDisplayModeIterator_Next(This,deckLinkDisplayMode) \ - ( (This)->lpVtbl -> Next(This,deckLinkDisplayMode) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkDisplayModeIterator_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkDisplayMode_INTERFACE_DEFINED__ -#define __IDeckLinkDisplayMode_INTERFACE_DEFINED__ - -/* interface IDeckLinkDisplayMode */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkDisplayMode; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("87451E84-2B7E-439E-A629-4393EA4A8550") - IDeckLinkDisplayMode : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetName( - /* [out] */ BSTR *name) = 0; - - virtual BMDDisplayMode STDMETHODCALLTYPE GetDisplayMode( void) = 0; - - virtual long STDMETHODCALLTYPE GetWidth( void) = 0; - - virtual long STDMETHODCALLTYPE GetHeight( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFrameRate( - /* [out] */ BMDTimeValue *frameDuration, - /* [out] */ BMDTimeScale *timeScale) = 0; - - virtual BMDFieldDominance STDMETHODCALLTYPE GetFieldDominance( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkDisplayModeVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkDisplayMode * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkDisplayMode * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkDisplayMode * This); - - HRESULT ( STDMETHODCALLTYPE *GetName )( - IDeckLinkDisplayMode * This, - /* [out] */ BSTR *name); - - BMDDisplayMode ( STDMETHODCALLTYPE *GetDisplayMode )( - IDeckLinkDisplayMode * This); - - long ( STDMETHODCALLTYPE *GetWidth )( - IDeckLinkDisplayMode * This); - - long ( STDMETHODCALLTYPE *GetHeight )( - IDeckLinkDisplayMode * This); - - HRESULT ( STDMETHODCALLTYPE *GetFrameRate )( - IDeckLinkDisplayMode * This, - /* [out] */ BMDTimeValue *frameDuration, - /* [out] */ BMDTimeScale *timeScale); - - BMDFieldDominance ( STDMETHODCALLTYPE *GetFieldDominance )( - IDeckLinkDisplayMode * This); - - END_INTERFACE - } IDeckLinkDisplayModeVtbl; - - interface IDeckLinkDisplayMode - { - CONST_VTBL struct IDeckLinkDisplayModeVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkDisplayMode_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkDisplayMode_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkDisplayMode_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkDisplayMode_GetName(This,name) \ - ( (This)->lpVtbl -> GetName(This,name) ) - -#define IDeckLinkDisplayMode_GetDisplayMode(This) \ - ( (This)->lpVtbl -> GetDisplayMode(This) ) - -#define IDeckLinkDisplayMode_GetWidth(This) \ - ( (This)->lpVtbl -> GetWidth(This) ) - -#define IDeckLinkDisplayMode_GetHeight(This) \ - ( (This)->lpVtbl -> GetHeight(This) ) - -#define IDeckLinkDisplayMode_GetFrameRate(This,frameDuration,timeScale) \ - ( (This)->lpVtbl -> GetFrameRate(This,frameDuration,timeScale) ) - -#define IDeckLinkDisplayMode_GetFieldDominance(This) \ - ( (This)->lpVtbl -> GetFieldDominance(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkDisplayMode_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLink_INTERFACE_DEFINED__ -#define __IDeckLink_INTERFACE_DEFINED__ - -/* interface IDeckLink */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLink; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("62BFF75D-6569-4E55-8D4D-66AA03829ABC") - IDeckLink : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetModelName( - /* [out] */ BSTR *modelName) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLink * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLink * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLink * This); - - HRESULT ( STDMETHODCALLTYPE *GetModelName )( - IDeckLink * This, - /* [out] */ BSTR *modelName); - - END_INTERFACE - } IDeckLinkVtbl; - - interface IDeckLink - { - CONST_VTBL struct IDeckLinkVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLink_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLink_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLink_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLink_GetModelName(This,modelName) \ - ( (This)->lpVtbl -> GetModelName(This,modelName) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLink_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkOutput_INTERFACE_DEFINED__ -#define __IDeckLinkOutput_INTERFACE_DEFINED__ - -/* interface IDeckLinkOutput */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkOutput; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("29228142-EB8C-4141-A621-F74026450955") - IDeckLinkOutput : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - /* [out] */ BMDDisplayModeSupport *result) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( - /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( - /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableVideoOutput( - BMDDisplayMode displayMode, - BMDVideoOutputFlags flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableVideoOutput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFrameMemoryAllocator( - /* [in] */ IDeckLinkMemoryAllocator *theAllocator) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateVideoFrame( - long width, - long height, - long rowBytes, - BMDPixelFormat pixelFormat, - BMDFrameFlags flags, - /* [out] */ IDeckLinkMutableVideoFrame **outFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateAncillaryData( - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisplayVideoFrameSync( - /* [in] */ IDeckLinkVideoFrame *theFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE ScheduleVideoFrame( - /* [in] */ IDeckLinkVideoFrame *theFrame, - BMDTimeValue displayTime, - BMDTimeValue displayDuration, - BMDTimeScale timeScale) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetScheduledFrameCompletionCallback( - /* [in] */ IDeckLinkVideoOutputCallback *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBufferedVideoFrameCount( - /* [out] */ unsigned long *bufferedFrameCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableAudioOutput( - BMDAudioSampleRate sampleRate, - BMDAudioSampleType sampleType, - unsigned long channelCount, - BMDAudioOutputStreamType streamType) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableAudioOutput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE WriteAudioSamplesSync( - /* [in] */ void *buffer, - unsigned long sampleFrameCount, - /* [out] */ unsigned long *sampleFramesWritten) = 0; - - virtual HRESULT STDMETHODCALLTYPE BeginAudioPreroll( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE EndAudioPreroll( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE ScheduleAudioSamples( - /* [in] */ void *buffer, - unsigned long sampleFrameCount, - BMDTimeValue streamTime, - BMDTimeScale timeScale, - /* [out] */ unsigned long *sampleFramesWritten) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( - /* [out] */ unsigned long *bufferedSampleFrameCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE FlushBufferedAudioSamples( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetAudioCallback( - /* [in] */ IDeckLinkAudioOutputCallback *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE StartScheduledPlayback( - BMDTimeValue playbackStartTime, - BMDTimeScale timeScale, - double playbackSpeed) = 0; - - virtual HRESULT STDMETHODCALLTYPE StopScheduledPlayback( - BMDTimeValue stopPlaybackAtTime, - /* [out] */ BMDTimeValue *actualStopTime, - BMDTimeScale timeScale) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsScheduledPlaybackRunning( - /* [out] */ BOOL *active) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetScheduledStreamTime( - BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *streamTime, - /* [out] */ double *playbackSpeed) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( - BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkOutputVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkOutput * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkOutput * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkOutput * This); - - HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( - IDeckLinkOutput * This, - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - /* [out] */ BMDDisplayModeSupport *result); - - HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( - IDeckLinkOutput * This, - /* [out] */ IDeckLinkDisplayModeIterator **iterator); - - HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( - IDeckLinkOutput * This, - /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback); - - HRESULT ( STDMETHODCALLTYPE *EnableVideoOutput )( - IDeckLinkOutput * This, - BMDDisplayMode displayMode, - BMDVideoOutputFlags flags); - - HRESULT ( STDMETHODCALLTYPE *DisableVideoOutput )( - IDeckLinkOutput * This); - - HRESULT ( STDMETHODCALLTYPE *SetVideoOutputFrameMemoryAllocator )( - IDeckLinkOutput * This, - /* [in] */ IDeckLinkMemoryAllocator *theAllocator); - - HRESULT ( STDMETHODCALLTYPE *CreateVideoFrame )( - IDeckLinkOutput * This, - long width, - long height, - long rowBytes, - BMDPixelFormat pixelFormat, - BMDFrameFlags flags, - /* [out] */ IDeckLinkMutableVideoFrame **outFrame); - - HRESULT ( STDMETHODCALLTYPE *CreateAncillaryData )( - IDeckLinkOutput * This, - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer); - - HRESULT ( STDMETHODCALLTYPE *DisplayVideoFrameSync )( - IDeckLinkOutput * This, - /* [in] */ IDeckLinkVideoFrame *theFrame); - - HRESULT ( STDMETHODCALLTYPE *ScheduleVideoFrame )( - IDeckLinkOutput * This, - /* [in] */ IDeckLinkVideoFrame *theFrame, - BMDTimeValue displayTime, - BMDTimeValue displayDuration, - BMDTimeScale timeScale); - - HRESULT ( STDMETHODCALLTYPE *SetScheduledFrameCompletionCallback )( - IDeckLinkOutput * This, - /* [in] */ IDeckLinkVideoOutputCallback *theCallback); - - HRESULT ( STDMETHODCALLTYPE *GetBufferedVideoFrameCount )( - IDeckLinkOutput * This, - /* [out] */ unsigned long *bufferedFrameCount); - - HRESULT ( STDMETHODCALLTYPE *EnableAudioOutput )( - IDeckLinkOutput * This, - BMDAudioSampleRate sampleRate, - BMDAudioSampleType sampleType, - unsigned long channelCount, - BMDAudioOutputStreamType streamType); - - HRESULT ( STDMETHODCALLTYPE *DisableAudioOutput )( - IDeckLinkOutput * This); - - HRESULT ( STDMETHODCALLTYPE *WriteAudioSamplesSync )( - IDeckLinkOutput * This, - /* [in] */ void *buffer, - unsigned long sampleFrameCount, - /* [out] */ unsigned long *sampleFramesWritten); - - HRESULT ( STDMETHODCALLTYPE *BeginAudioPreroll )( - IDeckLinkOutput * This); - - HRESULT ( STDMETHODCALLTYPE *EndAudioPreroll )( - IDeckLinkOutput * This); - - HRESULT ( STDMETHODCALLTYPE *ScheduleAudioSamples )( - IDeckLinkOutput * This, - /* [in] */ void *buffer, - unsigned long sampleFrameCount, - BMDTimeValue streamTime, - BMDTimeScale timeScale, - /* [out] */ unsigned long *sampleFramesWritten); - - HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( - IDeckLinkOutput * This, - /* [out] */ unsigned long *bufferedSampleFrameCount); - - HRESULT ( STDMETHODCALLTYPE *FlushBufferedAudioSamples )( - IDeckLinkOutput * This); - - HRESULT ( STDMETHODCALLTYPE *SetAudioCallback )( - IDeckLinkOutput * This, - /* [in] */ IDeckLinkAudioOutputCallback *theCallback); - - HRESULT ( STDMETHODCALLTYPE *StartScheduledPlayback )( - IDeckLinkOutput * This, - BMDTimeValue playbackStartTime, - BMDTimeScale timeScale, - double playbackSpeed); - - HRESULT ( STDMETHODCALLTYPE *StopScheduledPlayback )( - IDeckLinkOutput * This, - BMDTimeValue stopPlaybackAtTime, - /* [out] */ BMDTimeValue *actualStopTime, - BMDTimeScale timeScale); - - HRESULT ( STDMETHODCALLTYPE *IsScheduledPlaybackRunning )( - IDeckLinkOutput * This, - /* [out] */ BOOL *active); - - HRESULT ( STDMETHODCALLTYPE *GetScheduledStreamTime )( - IDeckLinkOutput * This, - BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *streamTime, - /* [out] */ double *playbackSpeed); - - HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( - IDeckLinkOutput * This, - BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame); - - END_INTERFACE - } IDeckLinkOutputVtbl; - - interface IDeckLinkOutput - { - CONST_VTBL struct IDeckLinkOutputVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkOutput_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkOutput_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkOutput_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkOutput_DoesSupportVideoMode(This,displayMode,pixelFormat,result) \ - ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,result) ) - -#define IDeckLinkOutput_GetDisplayModeIterator(This,iterator) \ - ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) - -#define IDeckLinkOutput_SetScreenPreviewCallback(This,previewCallback) \ - ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) - -#define IDeckLinkOutput_EnableVideoOutput(This,displayMode,flags) \ - ( (This)->lpVtbl -> EnableVideoOutput(This,displayMode,flags) ) - -#define IDeckLinkOutput_DisableVideoOutput(This) \ - ( (This)->lpVtbl -> DisableVideoOutput(This) ) - -#define IDeckLinkOutput_SetVideoOutputFrameMemoryAllocator(This,theAllocator) \ - ( (This)->lpVtbl -> SetVideoOutputFrameMemoryAllocator(This,theAllocator) ) - -#define IDeckLinkOutput_CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) \ - ( (This)->lpVtbl -> CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) ) - -#define IDeckLinkOutput_CreateAncillaryData(This,displayMode,pixelFormat,outBuffer) \ - ( (This)->lpVtbl -> CreateAncillaryData(This,displayMode,pixelFormat,outBuffer) ) - -#define IDeckLinkOutput_DisplayVideoFrameSync(This,theFrame) \ - ( (This)->lpVtbl -> DisplayVideoFrameSync(This,theFrame) ) - -#define IDeckLinkOutput_ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) \ - ( (This)->lpVtbl -> ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) ) - -#define IDeckLinkOutput_SetScheduledFrameCompletionCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetScheduledFrameCompletionCallback(This,theCallback) ) - -#define IDeckLinkOutput_GetBufferedVideoFrameCount(This,bufferedFrameCount) \ - ( (This)->lpVtbl -> GetBufferedVideoFrameCount(This,bufferedFrameCount) ) - -#define IDeckLinkOutput_EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) \ - ( (This)->lpVtbl -> EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) ) - -#define IDeckLinkOutput_DisableAudioOutput(This) \ - ( (This)->lpVtbl -> DisableAudioOutput(This) ) - -#define IDeckLinkOutput_WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) \ - ( (This)->lpVtbl -> WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) ) - -#define IDeckLinkOutput_BeginAudioPreroll(This) \ - ( (This)->lpVtbl -> BeginAudioPreroll(This) ) - -#define IDeckLinkOutput_EndAudioPreroll(This) \ - ( (This)->lpVtbl -> EndAudioPreroll(This) ) - -#define IDeckLinkOutput_ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) \ - ( (This)->lpVtbl -> ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) ) - -#define IDeckLinkOutput_GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) \ - ( (This)->lpVtbl -> GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) ) - -#define IDeckLinkOutput_FlushBufferedAudioSamples(This) \ - ( (This)->lpVtbl -> FlushBufferedAudioSamples(This) ) - -#define IDeckLinkOutput_SetAudioCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetAudioCallback(This,theCallback) ) - -#define IDeckLinkOutput_StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) \ - ( (This)->lpVtbl -> StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) ) - -#define IDeckLinkOutput_StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) \ - ( (This)->lpVtbl -> StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) ) - -#define IDeckLinkOutput_IsScheduledPlaybackRunning(This,active) \ - ( (This)->lpVtbl -> IsScheduledPlaybackRunning(This,active) ) - -#define IDeckLinkOutput_GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed) \ - ( (This)->lpVtbl -> GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed) ) - -#define IDeckLinkOutput_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) \ - ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkOutput_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkInput_INTERFACE_DEFINED__ -#define __IDeckLinkInput_INTERFACE_DEFINED__ - -/* interface IDeckLinkInput */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkInput; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("300C135A-9F43-48E2-9906-6D7911D93CF1") - IDeckLinkInput : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - /* [out] */ BMDDisplayModeSupport *result) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( - /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( - /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - BMDVideoInputFlags flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAvailableVideoFrameCount( - /* [out] */ unsigned long *availableFrameCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( - BMDAudioSampleRate sampleRate, - BMDAudioSampleType sampleType, - unsigned long channelCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAvailableAudioSampleFrameCount( - /* [out] */ unsigned long *availableSampleFrameCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE StartStreams( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE StopStreams( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE PauseStreams( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE FlushStreams( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetCallback( - /* [in] */ IDeckLinkInputCallback *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( - BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkInputVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkInput * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkInput * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkInput * This); - - HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( - IDeckLinkInput * This, - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - /* [out] */ BMDDisplayModeSupport *result); - - HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( - IDeckLinkInput * This, - /* [out] */ IDeckLinkDisplayModeIterator **iterator); - - HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( - IDeckLinkInput * This, - /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback); - - HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( - IDeckLinkInput * This, - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - BMDVideoInputFlags flags); - - HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( - IDeckLinkInput * This); - - HRESULT ( STDMETHODCALLTYPE *GetAvailableVideoFrameCount )( - IDeckLinkInput * This, - /* [out] */ unsigned long *availableFrameCount); - - HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( - IDeckLinkInput * This, - BMDAudioSampleRate sampleRate, - BMDAudioSampleType sampleType, - unsigned long channelCount); - - HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( - IDeckLinkInput * This); - - HRESULT ( STDMETHODCALLTYPE *GetAvailableAudioSampleFrameCount )( - IDeckLinkInput * This, - /* [out] */ unsigned long *availableSampleFrameCount); - - HRESULT ( STDMETHODCALLTYPE *StartStreams )( - IDeckLinkInput * This); - - HRESULT ( STDMETHODCALLTYPE *StopStreams )( - IDeckLinkInput * This); - - HRESULT ( STDMETHODCALLTYPE *PauseStreams )( - IDeckLinkInput * This); - - HRESULT ( STDMETHODCALLTYPE *FlushStreams )( - IDeckLinkInput * This); - - HRESULT ( STDMETHODCALLTYPE *SetCallback )( - IDeckLinkInput * This, - /* [in] */ IDeckLinkInputCallback *theCallback); - - HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( - IDeckLinkInput * This, - BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame); - - END_INTERFACE - } IDeckLinkInputVtbl; - - interface IDeckLinkInput - { - CONST_VTBL struct IDeckLinkInputVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkInput_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkInput_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkInput_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkInput_DoesSupportVideoMode(This,displayMode,pixelFormat,result) \ - ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,result) ) - -#define IDeckLinkInput_GetDisplayModeIterator(This,iterator) \ - ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) - -#define IDeckLinkInput_SetScreenPreviewCallback(This,previewCallback) \ - ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) - -#define IDeckLinkInput_EnableVideoInput(This,displayMode,pixelFormat,flags) \ - ( (This)->lpVtbl -> EnableVideoInput(This,displayMode,pixelFormat,flags) ) - -#define IDeckLinkInput_DisableVideoInput(This) \ - ( (This)->lpVtbl -> DisableVideoInput(This) ) - -#define IDeckLinkInput_GetAvailableVideoFrameCount(This,availableFrameCount) \ - ( (This)->lpVtbl -> GetAvailableVideoFrameCount(This,availableFrameCount) ) - -#define IDeckLinkInput_EnableAudioInput(This,sampleRate,sampleType,channelCount) \ - ( (This)->lpVtbl -> EnableAudioInput(This,sampleRate,sampleType,channelCount) ) - -#define IDeckLinkInput_DisableAudioInput(This) \ - ( (This)->lpVtbl -> DisableAudioInput(This) ) - -#define IDeckLinkInput_GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) \ - ( (This)->lpVtbl -> GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) ) - -#define IDeckLinkInput_StartStreams(This) \ - ( (This)->lpVtbl -> StartStreams(This) ) - -#define IDeckLinkInput_StopStreams(This) \ - ( (This)->lpVtbl -> StopStreams(This) ) - -#define IDeckLinkInput_PauseStreams(This) \ - ( (This)->lpVtbl -> PauseStreams(This) ) - -#define IDeckLinkInput_FlushStreams(This) \ - ( (This)->lpVtbl -> FlushStreams(This) ) - -#define IDeckLinkInput_SetCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetCallback(This,theCallback) ) - -#define IDeckLinkInput_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) \ - ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkInput_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkTimecode_INTERFACE_DEFINED__ -#define __IDeckLinkTimecode_INTERFACE_DEFINED__ - -/* interface IDeckLinkTimecode */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkTimecode; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("EFB9BCA6-A521-44F7-BD69-2332F24D9EE6") - IDeckLinkTimecode : public IUnknown - { - public: - virtual BMDTimecodeBCD STDMETHODCALLTYPE GetBCD( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetComponents( - /* [out] */ unsigned char *hours, - /* [out] */ unsigned char *minutes, - /* [out] */ unsigned char *seconds, - /* [out] */ unsigned char *frames) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetString( - /* [out] */ BSTR *timecode) = 0; - - virtual BMDTimecodeFlags STDMETHODCALLTYPE GetFlags( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkTimecodeVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkTimecode * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkTimecode * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkTimecode * This); - - BMDTimecodeBCD ( STDMETHODCALLTYPE *GetBCD )( - IDeckLinkTimecode * This); - - HRESULT ( STDMETHODCALLTYPE *GetComponents )( - IDeckLinkTimecode * This, - /* [out] */ unsigned char *hours, - /* [out] */ unsigned char *minutes, - /* [out] */ unsigned char *seconds, - /* [out] */ unsigned char *frames); - - HRESULT ( STDMETHODCALLTYPE *GetString )( - IDeckLinkTimecode * This, - /* [out] */ BSTR *timecode); - - BMDTimecodeFlags ( STDMETHODCALLTYPE *GetFlags )( - IDeckLinkTimecode * This); - - END_INTERFACE - } IDeckLinkTimecodeVtbl; - - interface IDeckLinkTimecode - { - CONST_VTBL struct IDeckLinkTimecodeVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkTimecode_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkTimecode_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkTimecode_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkTimecode_GetBCD(This) \ - ( (This)->lpVtbl -> GetBCD(This) ) - -#define IDeckLinkTimecode_GetComponents(This,hours,minutes,seconds,frames) \ - ( (This)->lpVtbl -> GetComponents(This,hours,minutes,seconds,frames) ) - -#define IDeckLinkTimecode_GetString(This,timecode) \ - ( (This)->lpVtbl -> GetString(This,timecode) ) - -#define IDeckLinkTimecode_GetFlags(This) \ - ( (This)->lpVtbl -> GetFlags(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkTimecode_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkVideoFrame_INTERFACE_DEFINED__ -#define __IDeckLinkVideoFrame_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoFrame */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoFrame; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("A8D8238E-6B18-4196-99E1-5AF717B83D32") - IDeckLinkVideoFrame : public IUnknown - { - public: - virtual long STDMETHODCALLTYPE GetWidth( void) = 0; - - virtual long STDMETHODCALLTYPE GetHeight( void) = 0; - - virtual long STDMETHODCALLTYPE GetRowBytes( void) = 0; - - virtual BMDPixelFormat STDMETHODCALLTYPE GetPixelFormat( void) = 0; - - virtual BMDFrameFlags STDMETHODCALLTYPE GetFlags( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBytes( - /* [out] */ void **buffer) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetTimecode( - BMDTimecodeFormat format, - /* [out] */ IDeckLinkTimecode **timecode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAncillaryData( - /* [out] */ IDeckLinkVideoFrameAncillary **ancillary) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkVideoFrameVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoFrame * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoFrame * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoFrame * This); - - long ( STDMETHODCALLTYPE *GetWidth )( - IDeckLinkVideoFrame * This); - - long ( STDMETHODCALLTYPE *GetHeight )( - IDeckLinkVideoFrame * This); - - long ( STDMETHODCALLTYPE *GetRowBytes )( - IDeckLinkVideoFrame * This); - - BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( - IDeckLinkVideoFrame * This); - - BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( - IDeckLinkVideoFrame * This); - - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IDeckLinkVideoFrame * This, - /* [out] */ void **buffer); - - HRESULT ( STDMETHODCALLTYPE *GetTimecode )( - IDeckLinkVideoFrame * This, - BMDTimecodeFormat format, - /* [out] */ IDeckLinkTimecode **timecode); - - HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( - IDeckLinkVideoFrame * This, - /* [out] */ IDeckLinkVideoFrameAncillary **ancillary); - - END_INTERFACE - } IDeckLinkVideoFrameVtbl; - - interface IDeckLinkVideoFrame - { - CONST_VTBL struct IDeckLinkVideoFrameVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoFrame_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoFrame_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoFrame_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoFrame_GetWidth(This) \ - ( (This)->lpVtbl -> GetWidth(This) ) - -#define IDeckLinkVideoFrame_GetHeight(This) \ - ( (This)->lpVtbl -> GetHeight(This) ) - -#define IDeckLinkVideoFrame_GetRowBytes(This) \ - ( (This)->lpVtbl -> GetRowBytes(This) ) - -#define IDeckLinkVideoFrame_GetPixelFormat(This) \ - ( (This)->lpVtbl -> GetPixelFormat(This) ) - -#define IDeckLinkVideoFrame_GetFlags(This) \ - ( (This)->lpVtbl -> GetFlags(This) ) - -#define IDeckLinkVideoFrame_GetBytes(This,buffer) \ - ( (This)->lpVtbl -> GetBytes(This,buffer) ) - -#define IDeckLinkVideoFrame_GetTimecode(This,format,timecode) \ - ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) - -#define IDeckLinkVideoFrame_GetAncillaryData(This,ancillary) \ - ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoFrame_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkMutableVideoFrame_INTERFACE_DEFINED__ -#define __IDeckLinkMutableVideoFrame_INTERFACE_DEFINED__ - -/* interface IDeckLinkMutableVideoFrame */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkMutableVideoFrame; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("46FCEE00-B4E6-43D0-91C0-023A7FCEB34F") - IDeckLinkMutableVideoFrame : public IDeckLinkVideoFrame - { - public: - virtual HRESULT STDMETHODCALLTYPE SetFlags( - BMDFrameFlags newFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetTimecode( - BMDTimecodeFormat format, - /* [in] */ IDeckLinkTimecode *timecode) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetTimecodeFromComponents( - BMDTimecodeFormat format, - unsigned char hours, - unsigned char minutes, - unsigned char seconds, - unsigned char frames, - BMDTimecodeFlags flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetAncillaryData( - /* [in] */ IDeckLinkVideoFrameAncillary *ancillary) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkMutableVideoFrameVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkMutableVideoFrame * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkMutableVideoFrame * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkMutableVideoFrame * This); - - long ( STDMETHODCALLTYPE *GetWidth )( - IDeckLinkMutableVideoFrame * This); - - long ( STDMETHODCALLTYPE *GetHeight )( - IDeckLinkMutableVideoFrame * This); - - long ( STDMETHODCALLTYPE *GetRowBytes )( - IDeckLinkMutableVideoFrame * This); - - BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( - IDeckLinkMutableVideoFrame * This); - - BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( - IDeckLinkMutableVideoFrame * This); - - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IDeckLinkMutableVideoFrame * This, - /* [out] */ void **buffer); - - HRESULT ( STDMETHODCALLTYPE *GetTimecode )( - IDeckLinkMutableVideoFrame * This, - BMDTimecodeFormat format, - /* [out] */ IDeckLinkTimecode **timecode); - - HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( - IDeckLinkMutableVideoFrame * This, - /* [out] */ IDeckLinkVideoFrameAncillary **ancillary); - - HRESULT ( STDMETHODCALLTYPE *SetFlags )( - IDeckLinkMutableVideoFrame * This, - BMDFrameFlags newFlags); - - HRESULT ( STDMETHODCALLTYPE *SetTimecode )( - IDeckLinkMutableVideoFrame * This, - BMDTimecodeFormat format, - /* [in] */ IDeckLinkTimecode *timecode); - - HRESULT ( STDMETHODCALLTYPE *SetTimecodeFromComponents )( - IDeckLinkMutableVideoFrame * This, - BMDTimecodeFormat format, - unsigned char hours, - unsigned char minutes, - unsigned char seconds, - unsigned char frames, - BMDTimecodeFlags flags); - - HRESULT ( STDMETHODCALLTYPE *SetAncillaryData )( - IDeckLinkMutableVideoFrame * This, - /* [in] */ IDeckLinkVideoFrameAncillary *ancillary); - - END_INTERFACE - } IDeckLinkMutableVideoFrameVtbl; - - interface IDeckLinkMutableVideoFrame - { - CONST_VTBL struct IDeckLinkMutableVideoFrameVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkMutableVideoFrame_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkMutableVideoFrame_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkMutableVideoFrame_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkMutableVideoFrame_GetWidth(This) \ - ( (This)->lpVtbl -> GetWidth(This) ) - -#define IDeckLinkMutableVideoFrame_GetHeight(This) \ - ( (This)->lpVtbl -> GetHeight(This) ) - -#define IDeckLinkMutableVideoFrame_GetRowBytes(This) \ - ( (This)->lpVtbl -> GetRowBytes(This) ) - -#define IDeckLinkMutableVideoFrame_GetPixelFormat(This) \ - ( (This)->lpVtbl -> GetPixelFormat(This) ) - -#define IDeckLinkMutableVideoFrame_GetFlags(This) \ - ( (This)->lpVtbl -> GetFlags(This) ) - -#define IDeckLinkMutableVideoFrame_GetBytes(This,buffer) \ - ( (This)->lpVtbl -> GetBytes(This,buffer) ) - -#define IDeckLinkMutableVideoFrame_GetTimecode(This,format,timecode) \ - ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) - -#define IDeckLinkMutableVideoFrame_GetAncillaryData(This,ancillary) \ - ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) - - -#define IDeckLinkMutableVideoFrame_SetFlags(This,newFlags) \ - ( (This)->lpVtbl -> SetFlags(This,newFlags) ) - -#define IDeckLinkMutableVideoFrame_SetTimecode(This,format,timecode) \ - ( (This)->lpVtbl -> SetTimecode(This,format,timecode) ) - -#define IDeckLinkMutableVideoFrame_SetTimecodeFromComponents(This,format,hours,minutes,seconds,frames,flags) \ - ( (This)->lpVtbl -> SetTimecodeFromComponents(This,format,hours,minutes,seconds,frames,flags) ) - -#define IDeckLinkMutableVideoFrame_SetAncillaryData(This,ancillary) \ - ( (This)->lpVtbl -> SetAncillaryData(This,ancillary) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkMutableVideoFrame_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkVideoInputFrame_INTERFACE_DEFINED__ -#define __IDeckLinkVideoInputFrame_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoInputFrame */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoInputFrame; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9A74FA41-AE9F-47AC-8CF4-01F42DD59965") - IDeckLinkVideoInputFrame : public IDeckLinkVideoFrame - { - public: - virtual HRESULT STDMETHODCALLTYPE GetStreamTime( - /* [out] */ BMDTimeValue *frameTime, - /* [out] */ BMDTimeValue *frameDuration, - BMDTimeScale timeScale) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceTimestamp( - BMDTimeScale timeScale, - /* [out] */ BMDTimeValue *frameTime, - /* [out] */ BMDTimeValue *frameDuration) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkVideoInputFrameVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoInputFrame * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoInputFrame * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoInputFrame * This); - - long ( STDMETHODCALLTYPE *GetWidth )( - IDeckLinkVideoInputFrame * This); - - long ( STDMETHODCALLTYPE *GetHeight )( - IDeckLinkVideoInputFrame * This); - - long ( STDMETHODCALLTYPE *GetRowBytes )( - IDeckLinkVideoInputFrame * This); - - BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( - IDeckLinkVideoInputFrame * This); - - BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( - IDeckLinkVideoInputFrame * This); - - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IDeckLinkVideoInputFrame * This, - /* [out] */ void **buffer); - - HRESULT ( STDMETHODCALLTYPE *GetTimecode )( - IDeckLinkVideoInputFrame * This, - BMDTimecodeFormat format, - /* [out] */ IDeckLinkTimecode **timecode); - - HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( - IDeckLinkVideoInputFrame * This, - /* [out] */ IDeckLinkVideoFrameAncillary **ancillary); - - HRESULT ( STDMETHODCALLTYPE *GetStreamTime )( - IDeckLinkVideoInputFrame * This, - /* [out] */ BMDTimeValue *frameTime, - /* [out] */ BMDTimeValue *frameDuration, - BMDTimeScale timeScale); - - HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceTimestamp )( - IDeckLinkVideoInputFrame * This, - BMDTimeScale timeScale, - /* [out] */ BMDTimeValue *frameTime, - /* [out] */ BMDTimeValue *frameDuration); - - END_INTERFACE - } IDeckLinkVideoInputFrameVtbl; - - interface IDeckLinkVideoInputFrame - { - CONST_VTBL struct IDeckLinkVideoInputFrameVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoInputFrame_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoInputFrame_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoInputFrame_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoInputFrame_GetWidth(This) \ - ( (This)->lpVtbl -> GetWidth(This) ) - -#define IDeckLinkVideoInputFrame_GetHeight(This) \ - ( (This)->lpVtbl -> GetHeight(This) ) - -#define IDeckLinkVideoInputFrame_GetRowBytes(This) \ - ( (This)->lpVtbl -> GetRowBytes(This) ) - -#define IDeckLinkVideoInputFrame_GetPixelFormat(This) \ - ( (This)->lpVtbl -> GetPixelFormat(This) ) - -#define IDeckLinkVideoInputFrame_GetFlags(This) \ - ( (This)->lpVtbl -> GetFlags(This) ) - -#define IDeckLinkVideoInputFrame_GetBytes(This,buffer) \ - ( (This)->lpVtbl -> GetBytes(This,buffer) ) - -#define IDeckLinkVideoInputFrame_GetTimecode(This,format,timecode) \ - ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) - -#define IDeckLinkVideoInputFrame_GetAncillaryData(This,ancillary) \ - ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) - - -#define IDeckLinkVideoInputFrame_GetStreamTime(This,frameTime,frameDuration,timeScale) \ - ( (This)->lpVtbl -> GetStreamTime(This,frameTime,frameDuration,timeScale) ) - -#define IDeckLinkVideoInputFrame_GetHardwareReferenceTimestamp(This,timeScale,frameTime,frameDuration) \ - ( (This)->lpVtbl -> GetHardwareReferenceTimestamp(This,timeScale,frameTime,frameDuration) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoInputFrame_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkVideoFrameAncillary_INTERFACE_DEFINED__ -#define __IDeckLinkVideoFrameAncillary_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoFrameAncillary */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoFrameAncillary; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("732E723C-D1A4-4E29-9E8E-4A88797A0004") - IDeckLinkVideoFrameAncillary : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetBufferForVerticalBlankingLine( - unsigned long lineNumber, - /* [out] */ void **buffer) = 0; - - virtual BMDPixelFormat STDMETHODCALLTYPE GetPixelFormat( void) = 0; - - virtual BMDDisplayMode STDMETHODCALLTYPE GetDisplayMode( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkVideoFrameAncillaryVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoFrameAncillary * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoFrameAncillary * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoFrameAncillary * This); - - HRESULT ( STDMETHODCALLTYPE *GetBufferForVerticalBlankingLine )( - IDeckLinkVideoFrameAncillary * This, - unsigned long lineNumber, - /* [out] */ void **buffer); - - BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( - IDeckLinkVideoFrameAncillary * This); - - BMDDisplayMode ( STDMETHODCALLTYPE *GetDisplayMode )( - IDeckLinkVideoFrameAncillary * This); - - END_INTERFACE - } IDeckLinkVideoFrameAncillaryVtbl; - - interface IDeckLinkVideoFrameAncillary - { - CONST_VTBL struct IDeckLinkVideoFrameAncillaryVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoFrameAncillary_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoFrameAncillary_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoFrameAncillary_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoFrameAncillary_GetBufferForVerticalBlankingLine(This,lineNumber,buffer) \ - ( (This)->lpVtbl -> GetBufferForVerticalBlankingLine(This,lineNumber,buffer) ) - -#define IDeckLinkVideoFrameAncillary_GetPixelFormat(This) \ - ( (This)->lpVtbl -> GetPixelFormat(This) ) - -#define IDeckLinkVideoFrameAncillary_GetDisplayMode(This) \ - ( (This)->lpVtbl -> GetDisplayMode(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoFrameAncillary_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkAudioInputPacket_INTERFACE_DEFINED__ -#define __IDeckLinkAudioInputPacket_INTERFACE_DEFINED__ - -/* interface IDeckLinkAudioInputPacket */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkAudioInputPacket; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("E43D5870-2894-11DE-8C30-0800200C9A66") - IDeckLinkAudioInputPacket : public IUnknown - { - public: - virtual long STDMETHODCALLTYPE GetSampleFrameCount( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBytes( - /* [out] */ void **buffer) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPacketTime( - /* [out] */ BMDTimeValue *packetTime, - BMDTimeScale timeScale) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkAudioInputPacketVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkAudioInputPacket * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkAudioInputPacket * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkAudioInputPacket * This); - - long ( STDMETHODCALLTYPE *GetSampleFrameCount )( - IDeckLinkAudioInputPacket * This); - - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IDeckLinkAudioInputPacket * This, - /* [out] */ void **buffer); - - HRESULT ( STDMETHODCALLTYPE *GetPacketTime )( - IDeckLinkAudioInputPacket * This, - /* [out] */ BMDTimeValue *packetTime, - BMDTimeScale timeScale); - - END_INTERFACE - } IDeckLinkAudioInputPacketVtbl; - - interface IDeckLinkAudioInputPacket - { - CONST_VTBL struct IDeckLinkAudioInputPacketVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkAudioInputPacket_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkAudioInputPacket_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkAudioInputPacket_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkAudioInputPacket_GetSampleFrameCount(This) \ - ( (This)->lpVtbl -> GetSampleFrameCount(This) ) - -#define IDeckLinkAudioInputPacket_GetBytes(This,buffer) \ - ( (This)->lpVtbl -> GetBytes(This,buffer) ) - -#define IDeckLinkAudioInputPacket_GetPacketTime(This,packetTime,timeScale) \ - ( (This)->lpVtbl -> GetPacketTime(This,packetTime,timeScale) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkAudioInputPacket_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkScreenPreviewCallback_INTERFACE_DEFINED__ -#define __IDeckLinkScreenPreviewCallback_INTERFACE_DEFINED__ - -/* interface IDeckLinkScreenPreviewCallback */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkScreenPreviewCallback; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("373F499D-4B4D-4518-AD22-6354E5A5825E") - IDeckLinkScreenPreviewCallback : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DrawFrame( - /* [in] */ IDeckLinkVideoFrame *theFrame) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkScreenPreviewCallbackVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkScreenPreviewCallback * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkScreenPreviewCallback * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkScreenPreviewCallback * This); - - HRESULT ( STDMETHODCALLTYPE *DrawFrame )( - IDeckLinkScreenPreviewCallback * This, - /* [in] */ IDeckLinkVideoFrame *theFrame); - - END_INTERFACE - } IDeckLinkScreenPreviewCallbackVtbl; - - interface IDeckLinkScreenPreviewCallback - { - CONST_VTBL struct IDeckLinkScreenPreviewCallbackVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkScreenPreviewCallback_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkScreenPreviewCallback_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkScreenPreviewCallback_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkScreenPreviewCallback_DrawFrame(This,theFrame) \ - ( (This)->lpVtbl -> DrawFrame(This,theFrame) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkScreenPreviewCallback_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkGLScreenPreviewHelper_INTERFACE_DEFINED__ -#define __IDeckLinkGLScreenPreviewHelper_INTERFACE_DEFINED__ - -/* interface IDeckLinkGLScreenPreviewHelper */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkGLScreenPreviewHelper; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("BA575CD9-A15E-497B-B2C2-F9AFE7BE4EBA") - IDeckLinkGLScreenPreviewHelper : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE InitializeGL( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE PaintGL( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFrame( - /* [in] */ IDeckLinkVideoFrame *theFrame) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkGLScreenPreviewHelperVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkGLScreenPreviewHelper * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkGLScreenPreviewHelper * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkGLScreenPreviewHelper * This); - - HRESULT ( STDMETHODCALLTYPE *InitializeGL )( - IDeckLinkGLScreenPreviewHelper * This); - - HRESULT ( STDMETHODCALLTYPE *PaintGL )( - IDeckLinkGLScreenPreviewHelper * This); - - HRESULT ( STDMETHODCALLTYPE *SetFrame )( - IDeckLinkGLScreenPreviewHelper * This, - /* [in] */ IDeckLinkVideoFrame *theFrame); - - END_INTERFACE - } IDeckLinkGLScreenPreviewHelperVtbl; - - interface IDeckLinkGLScreenPreviewHelper - { - CONST_VTBL struct IDeckLinkGLScreenPreviewHelperVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkGLScreenPreviewHelper_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkGLScreenPreviewHelper_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkGLScreenPreviewHelper_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkGLScreenPreviewHelper_InitializeGL(This) \ - ( (This)->lpVtbl -> InitializeGL(This) ) - -#define IDeckLinkGLScreenPreviewHelper_PaintGL(This) \ - ( (This)->lpVtbl -> PaintGL(This) ) - -#define IDeckLinkGLScreenPreviewHelper_SetFrame(This,theFrame) \ - ( (This)->lpVtbl -> SetFrame(This,theFrame) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkGLScreenPreviewHelper_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkConfiguration_INTERFACE_DEFINED__ -#define __IDeckLinkConfiguration_INTERFACE_DEFINED__ - -/* interface IDeckLinkConfiguration */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkConfiguration; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("B8EAD569-B764-47F0-A73F-AE40DF6CBF10") - IDeckLinkConfiguration : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetConfigurationValidator( - /* [out] */ IDeckLinkConfiguration **configObject) = 0; - - virtual HRESULT STDMETHODCALLTYPE WriteConfigurationToPreferences( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFormat( - BMDVideoConnection videoOutputConnection) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsVideoOutputActive( - BMDVideoConnection videoOutputConnection, - /* [out] */ BOOL *active) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetAnalogVideoOutputFlags( - BMDAnalogVideoFlags analogVideoFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAnalogVideoOutputFlags( - /* [out] */ BMDAnalogVideoFlags *analogVideoFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableFieldFlickerRemovalWhenPaused( - BOOL enable) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsEnabledFieldFlickerRemovalWhenPaused( - /* [out] */ BOOL *enabled) = 0; - - virtual HRESULT STDMETHODCALLTYPE Set444And3GBpsVideoOutput( - BOOL enable444VideoOutput, - BOOL enable3GbsOutput) = 0; - - virtual HRESULT STDMETHODCALLTYPE Get444And3GBpsVideoOutput( - /* [out] */ BOOL *is444VideoOutputEnabled, - /* [out] */ BOOL *threeGbsOutputEnabled) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetVideoOutputConversionMode( - BMDVideoOutputConversionMode conversionMode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetVideoOutputConversionMode( - /* [out] */ BMDVideoOutputConversionMode *conversionMode) = 0; - - virtual HRESULT STDMETHODCALLTYPE Set_HD1080p24_to_HD1080i5994_Conversion( - BOOL enable) = 0; - - virtual HRESULT STDMETHODCALLTYPE Get_HD1080p24_to_HD1080i5994_Conversion( - /* [out] */ BOOL *enabled) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetVideoInputFormat( - BMDVideoConnection videoInputFormat) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetVideoInputFormat( - /* [out] */ BMDVideoConnection *videoInputFormat) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetAnalogVideoInputFlags( - BMDAnalogVideoFlags analogVideoFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAnalogVideoInputFlags( - /* [out] */ BMDAnalogVideoFlags *analogVideoFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetVideoInputConversionMode( - BMDVideoInputConversionMode conversionMode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetVideoInputConversionMode( - /* [out] */ BMDVideoInputConversionMode *conversionMode) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetBlackVideoOutputDuringCapture( - BOOL blackOutInCapture) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBlackVideoOutputDuringCapture( - /* [out] */ BOOL *blackOutInCapture) = 0; - - virtual HRESULT STDMETHODCALLTYPE Set32PulldownSequenceInitialTimecodeFrame( - unsigned long aFrameTimecode) = 0; - - virtual HRESULT STDMETHODCALLTYPE Get32PulldownSequenceInitialTimecodeFrame( - /* [out] */ unsigned long *aFrameTimecode) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetVancSourceLineMapping( - unsigned long activeLine1VANCsource, - unsigned long activeLine2VANCsource, - unsigned long activeLine3VANCsource) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetVancSourceLineMapping( - /* [out] */ unsigned long *activeLine1VANCsource, - /* [out] */ unsigned long *activeLine2VANCsource, - /* [out] */ unsigned long *activeLine3VANCsource) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetAudioInputFormat( - BMDAudioConnection audioInputFormat) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAudioInputFormat( - /* [out] */ BMDAudioConnection *audioInputFormat) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkConfigurationVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkConfiguration * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkConfiguration * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkConfiguration * This); - - HRESULT ( STDMETHODCALLTYPE *GetConfigurationValidator )( - IDeckLinkConfiguration * This, - /* [out] */ IDeckLinkConfiguration **configObject); - - HRESULT ( STDMETHODCALLTYPE *WriteConfigurationToPreferences )( - IDeckLinkConfiguration * This); - - HRESULT ( STDMETHODCALLTYPE *SetVideoOutputFormat )( - IDeckLinkConfiguration * This, - BMDVideoConnection videoOutputConnection); - - HRESULT ( STDMETHODCALLTYPE *IsVideoOutputActive )( - IDeckLinkConfiguration * This, - BMDVideoConnection videoOutputConnection, - /* [out] */ BOOL *active); - - HRESULT ( STDMETHODCALLTYPE *SetAnalogVideoOutputFlags )( - IDeckLinkConfiguration * This, - BMDAnalogVideoFlags analogVideoFlags); - - HRESULT ( STDMETHODCALLTYPE *GetAnalogVideoOutputFlags )( - IDeckLinkConfiguration * This, - /* [out] */ BMDAnalogVideoFlags *analogVideoFlags); - - HRESULT ( STDMETHODCALLTYPE *EnableFieldFlickerRemovalWhenPaused )( - IDeckLinkConfiguration * This, - BOOL enable); - - HRESULT ( STDMETHODCALLTYPE *IsEnabledFieldFlickerRemovalWhenPaused )( - IDeckLinkConfiguration * This, - /* [out] */ BOOL *enabled); - - HRESULT ( STDMETHODCALLTYPE *Set444And3GBpsVideoOutput )( - IDeckLinkConfiguration * This, - BOOL enable444VideoOutput, - BOOL enable3GbsOutput); - - HRESULT ( STDMETHODCALLTYPE *Get444And3GBpsVideoOutput )( - IDeckLinkConfiguration * This, - /* [out] */ BOOL *is444VideoOutputEnabled, - /* [out] */ BOOL *threeGbsOutputEnabled); - - HRESULT ( STDMETHODCALLTYPE *SetVideoOutputConversionMode )( - IDeckLinkConfiguration * This, - BMDVideoOutputConversionMode conversionMode); - - HRESULT ( STDMETHODCALLTYPE *GetVideoOutputConversionMode )( - IDeckLinkConfiguration * This, - /* [out] */ BMDVideoOutputConversionMode *conversionMode); - - HRESULT ( STDMETHODCALLTYPE *Set_HD1080p24_to_HD1080i5994_Conversion )( - IDeckLinkConfiguration * This, - BOOL enable); - - HRESULT ( STDMETHODCALLTYPE *Get_HD1080p24_to_HD1080i5994_Conversion )( - IDeckLinkConfiguration * This, - /* [out] */ BOOL *enabled); - - HRESULT ( STDMETHODCALLTYPE *SetVideoInputFormat )( - IDeckLinkConfiguration * This, - BMDVideoConnection videoInputFormat); - - HRESULT ( STDMETHODCALLTYPE *GetVideoInputFormat )( - IDeckLinkConfiguration * This, - /* [out] */ BMDVideoConnection *videoInputFormat); - - HRESULT ( STDMETHODCALLTYPE *SetAnalogVideoInputFlags )( - IDeckLinkConfiguration * This, - BMDAnalogVideoFlags analogVideoFlags); - - HRESULT ( STDMETHODCALLTYPE *GetAnalogVideoInputFlags )( - IDeckLinkConfiguration * This, - /* [out] */ BMDAnalogVideoFlags *analogVideoFlags); - - HRESULT ( STDMETHODCALLTYPE *SetVideoInputConversionMode )( - IDeckLinkConfiguration * This, - BMDVideoInputConversionMode conversionMode); - - HRESULT ( STDMETHODCALLTYPE *GetVideoInputConversionMode )( - IDeckLinkConfiguration * This, - /* [out] */ BMDVideoInputConversionMode *conversionMode); - - HRESULT ( STDMETHODCALLTYPE *SetBlackVideoOutputDuringCapture )( - IDeckLinkConfiguration * This, - BOOL blackOutInCapture); - - HRESULT ( STDMETHODCALLTYPE *GetBlackVideoOutputDuringCapture )( - IDeckLinkConfiguration * This, - /* [out] */ BOOL *blackOutInCapture); - - HRESULT ( STDMETHODCALLTYPE *Set32PulldownSequenceInitialTimecodeFrame )( - IDeckLinkConfiguration * This, - unsigned long aFrameTimecode); - - HRESULT ( STDMETHODCALLTYPE *Get32PulldownSequenceInitialTimecodeFrame )( - IDeckLinkConfiguration * This, - /* [out] */ unsigned long *aFrameTimecode); - - HRESULT ( STDMETHODCALLTYPE *SetVancSourceLineMapping )( - IDeckLinkConfiguration * This, - unsigned long activeLine1VANCsource, - unsigned long activeLine2VANCsource, - unsigned long activeLine3VANCsource); - - HRESULT ( STDMETHODCALLTYPE *GetVancSourceLineMapping )( - IDeckLinkConfiguration * This, - /* [out] */ unsigned long *activeLine1VANCsource, - /* [out] */ unsigned long *activeLine2VANCsource, - /* [out] */ unsigned long *activeLine3VANCsource); - - HRESULT ( STDMETHODCALLTYPE *SetAudioInputFormat )( - IDeckLinkConfiguration * This, - BMDAudioConnection audioInputFormat); - - HRESULT ( STDMETHODCALLTYPE *GetAudioInputFormat )( - IDeckLinkConfiguration * This, - /* [out] */ BMDAudioConnection *audioInputFormat); - - END_INTERFACE - } IDeckLinkConfigurationVtbl; - - interface IDeckLinkConfiguration - { - CONST_VTBL struct IDeckLinkConfigurationVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkConfiguration_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkConfiguration_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkConfiguration_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkConfiguration_GetConfigurationValidator(This,configObject) \ - ( (This)->lpVtbl -> GetConfigurationValidator(This,configObject) ) - -#define IDeckLinkConfiguration_WriteConfigurationToPreferences(This) \ - ( (This)->lpVtbl -> WriteConfigurationToPreferences(This) ) - -#define IDeckLinkConfiguration_SetVideoOutputFormat(This,videoOutputConnection) \ - ( (This)->lpVtbl -> SetVideoOutputFormat(This,videoOutputConnection) ) - -#define IDeckLinkConfiguration_IsVideoOutputActive(This,videoOutputConnection,active) \ - ( (This)->lpVtbl -> IsVideoOutputActive(This,videoOutputConnection,active) ) - -#define IDeckLinkConfiguration_SetAnalogVideoOutputFlags(This,analogVideoFlags) \ - ( (This)->lpVtbl -> SetAnalogVideoOutputFlags(This,analogVideoFlags) ) - -#define IDeckLinkConfiguration_GetAnalogVideoOutputFlags(This,analogVideoFlags) \ - ( (This)->lpVtbl -> GetAnalogVideoOutputFlags(This,analogVideoFlags) ) - -#define IDeckLinkConfiguration_EnableFieldFlickerRemovalWhenPaused(This,enable) \ - ( (This)->lpVtbl -> EnableFieldFlickerRemovalWhenPaused(This,enable) ) - -#define IDeckLinkConfiguration_IsEnabledFieldFlickerRemovalWhenPaused(This,enabled) \ - ( (This)->lpVtbl -> IsEnabledFieldFlickerRemovalWhenPaused(This,enabled) ) - -#define IDeckLinkConfiguration_Set444And3GBpsVideoOutput(This,enable444VideoOutput,enable3GbsOutput) \ - ( (This)->lpVtbl -> Set444And3GBpsVideoOutput(This,enable444VideoOutput,enable3GbsOutput) ) - -#define IDeckLinkConfiguration_Get444And3GBpsVideoOutput(This,is444VideoOutputEnabled,threeGbsOutputEnabled) \ - ( (This)->lpVtbl -> Get444And3GBpsVideoOutput(This,is444VideoOutputEnabled,threeGbsOutputEnabled) ) - -#define IDeckLinkConfiguration_SetVideoOutputConversionMode(This,conversionMode) \ - ( (This)->lpVtbl -> SetVideoOutputConversionMode(This,conversionMode) ) - -#define IDeckLinkConfiguration_GetVideoOutputConversionMode(This,conversionMode) \ - ( (This)->lpVtbl -> GetVideoOutputConversionMode(This,conversionMode) ) - -#define IDeckLinkConfiguration_Set_HD1080p24_to_HD1080i5994_Conversion(This,enable) \ - ( (This)->lpVtbl -> Set_HD1080p24_to_HD1080i5994_Conversion(This,enable) ) - -#define IDeckLinkConfiguration_Get_HD1080p24_to_HD1080i5994_Conversion(This,enabled) \ - ( (This)->lpVtbl -> Get_HD1080p24_to_HD1080i5994_Conversion(This,enabled) ) - -#define IDeckLinkConfiguration_SetVideoInputFormat(This,videoInputFormat) \ - ( (This)->lpVtbl -> SetVideoInputFormat(This,videoInputFormat) ) - -#define IDeckLinkConfiguration_GetVideoInputFormat(This,videoInputFormat) \ - ( (This)->lpVtbl -> GetVideoInputFormat(This,videoInputFormat) ) - -#define IDeckLinkConfiguration_SetAnalogVideoInputFlags(This,analogVideoFlags) \ - ( (This)->lpVtbl -> SetAnalogVideoInputFlags(This,analogVideoFlags) ) - -#define IDeckLinkConfiguration_GetAnalogVideoInputFlags(This,analogVideoFlags) \ - ( (This)->lpVtbl -> GetAnalogVideoInputFlags(This,analogVideoFlags) ) - -#define IDeckLinkConfiguration_SetVideoInputConversionMode(This,conversionMode) \ - ( (This)->lpVtbl -> SetVideoInputConversionMode(This,conversionMode) ) - -#define IDeckLinkConfiguration_GetVideoInputConversionMode(This,conversionMode) \ - ( (This)->lpVtbl -> GetVideoInputConversionMode(This,conversionMode) ) - -#define IDeckLinkConfiguration_SetBlackVideoOutputDuringCapture(This,blackOutInCapture) \ - ( (This)->lpVtbl -> SetBlackVideoOutputDuringCapture(This,blackOutInCapture) ) - -#define IDeckLinkConfiguration_GetBlackVideoOutputDuringCapture(This,blackOutInCapture) \ - ( (This)->lpVtbl -> GetBlackVideoOutputDuringCapture(This,blackOutInCapture) ) - -#define IDeckLinkConfiguration_Set32PulldownSequenceInitialTimecodeFrame(This,aFrameTimecode) \ - ( (This)->lpVtbl -> Set32PulldownSequenceInitialTimecodeFrame(This,aFrameTimecode) ) - -#define IDeckLinkConfiguration_Get32PulldownSequenceInitialTimecodeFrame(This,aFrameTimecode) \ - ( (This)->lpVtbl -> Get32PulldownSequenceInitialTimecodeFrame(This,aFrameTimecode) ) - -#define IDeckLinkConfiguration_SetVancSourceLineMapping(This,activeLine1VANCsource,activeLine2VANCsource,activeLine3VANCsource) \ - ( (This)->lpVtbl -> SetVancSourceLineMapping(This,activeLine1VANCsource,activeLine2VANCsource,activeLine3VANCsource) ) - -#define IDeckLinkConfiguration_GetVancSourceLineMapping(This,activeLine1VANCsource,activeLine2VANCsource,activeLine3VANCsource) \ - ( (This)->lpVtbl -> GetVancSourceLineMapping(This,activeLine1VANCsource,activeLine2VANCsource,activeLine3VANCsource) ) - -#define IDeckLinkConfiguration_SetAudioInputFormat(This,audioInputFormat) \ - ( (This)->lpVtbl -> SetAudioInputFormat(This,audioInputFormat) ) - -#define IDeckLinkConfiguration_GetAudioInputFormat(This,audioInputFormat) \ - ( (This)->lpVtbl -> GetAudioInputFormat(This,audioInputFormat) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkConfiguration_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkAttributes_INTERFACE_DEFINED__ -#define __IDeckLinkAttributes_INTERFACE_DEFINED__ - -/* interface IDeckLinkAttributes */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkAttributes; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("ABC11843-D966-44CB-96E2-A1CB5D3135C4") - IDeckLinkAttributes : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetFlag( - /* [in] */ BMDDeckLinkAttributeID cfgID, - /* [out] */ BOOL *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetInt( - /* [in] */ BMDDeckLinkAttributeID cfgID, - /* [out] */ LONGLONG *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFloat( - /* [in] */ BMDDeckLinkAttributeID cfgID, - /* [out] */ double *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetString( - /* [in] */ BMDDeckLinkAttributeID cfgID, - /* [out] */ BSTR *value) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkAttributesVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkAttributes * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkAttributes * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkAttributes * This); - - HRESULT ( STDMETHODCALLTYPE *GetFlag )( - IDeckLinkAttributes * This, - /* [in] */ BMDDeckLinkAttributeID cfgID, - /* [out] */ BOOL *value); - - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IDeckLinkAttributes * This, - /* [in] */ BMDDeckLinkAttributeID cfgID, - /* [out] */ LONGLONG *value); - - HRESULT ( STDMETHODCALLTYPE *GetFloat )( - IDeckLinkAttributes * This, - /* [in] */ BMDDeckLinkAttributeID cfgID, - /* [out] */ double *value); - - HRESULT ( STDMETHODCALLTYPE *GetString )( - IDeckLinkAttributes * This, - /* [in] */ BMDDeckLinkAttributeID cfgID, - /* [out] */ BSTR *value); - - END_INTERFACE - } IDeckLinkAttributesVtbl; - - interface IDeckLinkAttributes - { - CONST_VTBL struct IDeckLinkAttributesVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkAttributes_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkAttributes_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkAttributes_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkAttributes_GetFlag(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) - -#define IDeckLinkAttributes_GetInt(This,cfgID,value) \ - ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) - -#define IDeckLinkAttributes_GetFloat(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) - -#define IDeckLinkAttributes_GetString(This,cfgID,value) \ - ( (This)->lpVtbl -> GetString(This,cfgID,value) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkAttributes_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkKeyer_INTERFACE_DEFINED__ -#define __IDeckLinkKeyer_INTERFACE_DEFINED__ - -/* interface IDeckLinkKeyer */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkKeyer; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("89AFCAF5-65F8-421E-98F7-96FE5F5BFBA3") - IDeckLinkKeyer : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Enable( - /* [in] */ BOOL isExternal) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetLevel( - /* [in] */ unsigned char level) = 0; - - virtual HRESULT STDMETHODCALLTYPE RampUp( - /* [in] */ unsigned long numberOfFrames) = 0; - - virtual HRESULT STDMETHODCALLTYPE RampDown( - /* [in] */ unsigned long numberOfFrames) = 0; - - virtual HRESULT STDMETHODCALLTYPE Disable( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkKeyerVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkKeyer * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkKeyer * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkKeyer * This); - - HRESULT ( STDMETHODCALLTYPE *Enable )( - IDeckLinkKeyer * This, - /* [in] */ BOOL isExternal); - - HRESULT ( STDMETHODCALLTYPE *SetLevel )( - IDeckLinkKeyer * This, - /* [in] */ unsigned char level); - - HRESULT ( STDMETHODCALLTYPE *RampUp )( - IDeckLinkKeyer * This, - /* [in] */ unsigned long numberOfFrames); - - HRESULT ( STDMETHODCALLTYPE *RampDown )( - IDeckLinkKeyer * This, - /* [in] */ unsigned long numberOfFrames); - - HRESULT ( STDMETHODCALLTYPE *Disable )( - IDeckLinkKeyer * This); - - END_INTERFACE - } IDeckLinkKeyerVtbl; - - interface IDeckLinkKeyer - { - CONST_VTBL struct IDeckLinkKeyerVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkKeyer_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkKeyer_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkKeyer_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkKeyer_Enable(This,isExternal) \ - ( (This)->lpVtbl -> Enable(This,isExternal) ) - -#define IDeckLinkKeyer_SetLevel(This,level) \ - ( (This)->lpVtbl -> SetLevel(This,level) ) - -#define IDeckLinkKeyer_RampUp(This,numberOfFrames) \ - ( (This)->lpVtbl -> RampUp(This,numberOfFrames) ) - -#define IDeckLinkKeyer_RampDown(This,numberOfFrames) \ - ( (This)->lpVtbl -> RampDown(This,numberOfFrames) ) - -#define IDeckLinkKeyer_Disable(This) \ - ( (This)->lpVtbl -> Disable(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkKeyer_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_CDeckLinkIterator; - -#ifdef __cplusplus - -class DECLSPEC_UUID("D9EDA3B3-2887-41FA-B724-017CF1EB1D37") -CDeckLinkIterator; -#endif - -EXTERN_C const CLSID CLSID_CDeckLinkGLScreenPreviewHelper; - -#ifdef __cplusplus - -class DECLSPEC_UUID("D398CEE7-4434-4CA3-9BA6-5AE34556B905") -CDeckLinkGLScreenPreviewHelper; -#endif - -#ifndef __IDeckLinkDisplayModeIterator_v7_1_INTERFACE_DEFINED__ -#define __IDeckLinkDisplayModeIterator_v7_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkDisplayModeIterator_v7_1 */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkDisplayModeIterator_v7_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("B28131B6-59AC-4857-B5AC-CD75D5883E2F") - IDeckLinkDisplayModeIterator_v7_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Next( - /* [out] */ IDeckLinkDisplayMode_v7_1 **deckLinkDisplayMode) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkDisplayModeIterator_v7_1Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkDisplayModeIterator_v7_1 * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkDisplayModeIterator_v7_1 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkDisplayModeIterator_v7_1 * This); - - HRESULT ( STDMETHODCALLTYPE *Next )( - IDeckLinkDisplayModeIterator_v7_1 * This, - /* [out] */ IDeckLinkDisplayMode_v7_1 **deckLinkDisplayMode); - - END_INTERFACE - } IDeckLinkDisplayModeIterator_v7_1Vtbl; - - interface IDeckLinkDisplayModeIterator_v7_1 - { - CONST_VTBL struct IDeckLinkDisplayModeIterator_v7_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkDisplayModeIterator_v7_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkDisplayModeIterator_v7_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkDisplayModeIterator_v7_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkDisplayModeIterator_v7_1_Next(This,deckLinkDisplayMode) \ - ( (This)->lpVtbl -> Next(This,deckLinkDisplayMode) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkDisplayModeIterator_v7_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkDisplayMode_v7_1_INTERFACE_DEFINED__ -#define __IDeckLinkDisplayMode_v7_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkDisplayMode_v7_1 */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkDisplayMode_v7_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("AF0CD6D5-8376-435E-8433-54F9DD530AC3") - IDeckLinkDisplayMode_v7_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetName( - /* [out] */ BSTR *name) = 0; - - virtual BMDDisplayMode STDMETHODCALLTYPE GetDisplayMode( void) = 0; - - virtual long STDMETHODCALLTYPE GetWidth( void) = 0; - - virtual long STDMETHODCALLTYPE GetHeight( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFrameRate( - /* [out] */ BMDTimeValue *frameDuration, - /* [out] */ BMDTimeScale *timeScale) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkDisplayMode_v7_1Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkDisplayMode_v7_1 * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkDisplayMode_v7_1 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkDisplayMode_v7_1 * This); - - HRESULT ( STDMETHODCALLTYPE *GetName )( - IDeckLinkDisplayMode_v7_1 * This, - /* [out] */ BSTR *name); - - BMDDisplayMode ( STDMETHODCALLTYPE *GetDisplayMode )( - IDeckLinkDisplayMode_v7_1 * This); - - long ( STDMETHODCALLTYPE *GetWidth )( - IDeckLinkDisplayMode_v7_1 * This); - - long ( STDMETHODCALLTYPE *GetHeight )( - IDeckLinkDisplayMode_v7_1 * This); - - HRESULT ( STDMETHODCALLTYPE *GetFrameRate )( - IDeckLinkDisplayMode_v7_1 * This, - /* [out] */ BMDTimeValue *frameDuration, - /* [out] */ BMDTimeScale *timeScale); - - END_INTERFACE - } IDeckLinkDisplayMode_v7_1Vtbl; - - interface IDeckLinkDisplayMode_v7_1 - { - CONST_VTBL struct IDeckLinkDisplayMode_v7_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkDisplayMode_v7_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkDisplayMode_v7_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkDisplayMode_v7_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkDisplayMode_v7_1_GetName(This,name) \ - ( (This)->lpVtbl -> GetName(This,name) ) - -#define IDeckLinkDisplayMode_v7_1_GetDisplayMode(This) \ - ( (This)->lpVtbl -> GetDisplayMode(This) ) - -#define IDeckLinkDisplayMode_v7_1_GetWidth(This) \ - ( (This)->lpVtbl -> GetWidth(This) ) - -#define IDeckLinkDisplayMode_v7_1_GetHeight(This) \ - ( (This)->lpVtbl -> GetHeight(This) ) - -#define IDeckLinkDisplayMode_v7_1_GetFrameRate(This,frameDuration,timeScale) \ - ( (This)->lpVtbl -> GetFrameRate(This,frameDuration,timeScale) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkDisplayMode_v7_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkVideoFrame_v7_1_INTERFACE_DEFINED__ -#define __IDeckLinkVideoFrame_v7_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoFrame_v7_1 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoFrame_v7_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("333F3A10-8C2D-43CF-B79D-46560FEEA1CE") - IDeckLinkVideoFrame_v7_1 : public IUnknown - { - public: - virtual long STDMETHODCALLTYPE GetWidth( void) = 0; - - virtual long STDMETHODCALLTYPE GetHeight( void) = 0; - - virtual long STDMETHODCALLTYPE GetRowBytes( void) = 0; - - virtual BMDPixelFormat STDMETHODCALLTYPE GetPixelFormat( void) = 0; - - virtual BMDFrameFlags STDMETHODCALLTYPE GetFlags( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBytes( - void **buffer) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkVideoFrame_v7_1Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoFrame_v7_1 * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoFrame_v7_1 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoFrame_v7_1 * This); - - long ( STDMETHODCALLTYPE *GetWidth )( - IDeckLinkVideoFrame_v7_1 * This); - - long ( STDMETHODCALLTYPE *GetHeight )( - IDeckLinkVideoFrame_v7_1 * This); - - long ( STDMETHODCALLTYPE *GetRowBytes )( - IDeckLinkVideoFrame_v7_1 * This); - - BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( - IDeckLinkVideoFrame_v7_1 * This); - - BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( - IDeckLinkVideoFrame_v7_1 * This); - - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IDeckLinkVideoFrame_v7_1 * This, - void **buffer); - - END_INTERFACE - } IDeckLinkVideoFrame_v7_1Vtbl; - - interface IDeckLinkVideoFrame_v7_1 - { - CONST_VTBL struct IDeckLinkVideoFrame_v7_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoFrame_v7_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoFrame_v7_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoFrame_v7_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoFrame_v7_1_GetWidth(This) \ - ( (This)->lpVtbl -> GetWidth(This) ) - -#define IDeckLinkVideoFrame_v7_1_GetHeight(This) \ - ( (This)->lpVtbl -> GetHeight(This) ) - -#define IDeckLinkVideoFrame_v7_1_GetRowBytes(This) \ - ( (This)->lpVtbl -> GetRowBytes(This) ) - -#define IDeckLinkVideoFrame_v7_1_GetPixelFormat(This) \ - ( (This)->lpVtbl -> GetPixelFormat(This) ) - -#define IDeckLinkVideoFrame_v7_1_GetFlags(This) \ - ( (This)->lpVtbl -> GetFlags(This) ) - -#define IDeckLinkVideoFrame_v7_1_GetBytes(This,buffer) \ - ( (This)->lpVtbl -> GetBytes(This,buffer) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoFrame_v7_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkVideoInputFrame_v7_1_INTERFACE_DEFINED__ -#define __IDeckLinkVideoInputFrame_v7_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoInputFrame_v7_1 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoInputFrame_v7_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("C8B41D95-8848-40EE-9B37-6E3417FB114B") - IDeckLinkVideoInputFrame_v7_1 : public IDeckLinkVideoFrame_v7_1 - { - public: - virtual HRESULT STDMETHODCALLTYPE GetFrameTime( - BMDTimeValue *frameTime, - BMDTimeValue *frameDuration, - BMDTimeScale timeScale) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkVideoInputFrame_v7_1Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoInputFrame_v7_1 * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoInputFrame_v7_1 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoInputFrame_v7_1 * This); - - long ( STDMETHODCALLTYPE *GetWidth )( - IDeckLinkVideoInputFrame_v7_1 * This); - - long ( STDMETHODCALLTYPE *GetHeight )( - IDeckLinkVideoInputFrame_v7_1 * This); - - long ( STDMETHODCALLTYPE *GetRowBytes )( - IDeckLinkVideoInputFrame_v7_1 * This); - - BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( - IDeckLinkVideoInputFrame_v7_1 * This); - - BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( - IDeckLinkVideoInputFrame_v7_1 * This); - - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IDeckLinkVideoInputFrame_v7_1 * This, - void **buffer); - - HRESULT ( STDMETHODCALLTYPE *GetFrameTime )( - IDeckLinkVideoInputFrame_v7_1 * This, - BMDTimeValue *frameTime, - BMDTimeValue *frameDuration, - BMDTimeScale timeScale); - - END_INTERFACE - } IDeckLinkVideoInputFrame_v7_1Vtbl; - - interface IDeckLinkVideoInputFrame_v7_1 - { - CONST_VTBL struct IDeckLinkVideoInputFrame_v7_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoInputFrame_v7_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoInputFrame_v7_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoInputFrame_v7_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoInputFrame_v7_1_GetWidth(This) \ - ( (This)->lpVtbl -> GetWidth(This) ) - -#define IDeckLinkVideoInputFrame_v7_1_GetHeight(This) \ - ( (This)->lpVtbl -> GetHeight(This) ) - -#define IDeckLinkVideoInputFrame_v7_1_GetRowBytes(This) \ - ( (This)->lpVtbl -> GetRowBytes(This) ) - -#define IDeckLinkVideoInputFrame_v7_1_GetPixelFormat(This) \ - ( (This)->lpVtbl -> GetPixelFormat(This) ) - -#define IDeckLinkVideoInputFrame_v7_1_GetFlags(This) \ - ( (This)->lpVtbl -> GetFlags(This) ) - -#define IDeckLinkVideoInputFrame_v7_1_GetBytes(This,buffer) \ - ( (This)->lpVtbl -> GetBytes(This,buffer) ) - - -#define IDeckLinkVideoInputFrame_v7_1_GetFrameTime(This,frameTime,frameDuration,timeScale) \ - ( (This)->lpVtbl -> GetFrameTime(This,frameTime,frameDuration,timeScale) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoInputFrame_v7_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkAudioInputPacket_v7_1_INTERFACE_DEFINED__ -#define __IDeckLinkAudioInputPacket_v7_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkAudioInputPacket_v7_1 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkAudioInputPacket_v7_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("C86DE4F6-A29F-42E3-AB3A-1363E29F0788") - IDeckLinkAudioInputPacket_v7_1 : public IUnknown - { - public: - virtual long STDMETHODCALLTYPE GetSampleCount( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBytes( - void **buffer) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAudioPacketTime( - BMDTimeValue *packetTime, - BMDTimeScale timeScale) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkAudioInputPacket_v7_1Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkAudioInputPacket_v7_1 * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkAudioInputPacket_v7_1 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkAudioInputPacket_v7_1 * This); - - long ( STDMETHODCALLTYPE *GetSampleCount )( - IDeckLinkAudioInputPacket_v7_1 * This); - - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IDeckLinkAudioInputPacket_v7_1 * This, - void **buffer); - - HRESULT ( STDMETHODCALLTYPE *GetAudioPacketTime )( - IDeckLinkAudioInputPacket_v7_1 * This, - BMDTimeValue *packetTime, - BMDTimeScale timeScale); - - END_INTERFACE - } IDeckLinkAudioInputPacket_v7_1Vtbl; - - interface IDeckLinkAudioInputPacket_v7_1 - { - CONST_VTBL struct IDeckLinkAudioInputPacket_v7_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkAudioInputPacket_v7_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkAudioInputPacket_v7_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkAudioInputPacket_v7_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkAudioInputPacket_v7_1_GetSampleCount(This) \ - ( (This)->lpVtbl -> GetSampleCount(This) ) - -#define IDeckLinkAudioInputPacket_v7_1_GetBytes(This,buffer) \ - ( (This)->lpVtbl -> GetBytes(This,buffer) ) - -#define IDeckLinkAudioInputPacket_v7_1_GetAudioPacketTime(This,packetTime,timeScale) \ - ( (This)->lpVtbl -> GetAudioPacketTime(This,packetTime,timeScale) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkAudioInputPacket_v7_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkVideoOutputCallback_v7_1_INTERFACE_DEFINED__ -#define __IDeckLinkVideoOutputCallback_v7_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoOutputCallback_v7_1 */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoOutputCallback_v7_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("EBD01AFA-E4B0-49C6-A01D-EDB9D1B55FD9") - IDeckLinkVideoOutputCallback_v7_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted( - /* [in] */ IDeckLinkVideoFrame_v7_1 *completedFrame, - /* [in] */ BMDOutputFrameCompletionResult result) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkVideoOutputCallback_v7_1Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoOutputCallback_v7_1 * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoOutputCallback_v7_1 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoOutputCallback_v7_1 * This); - - HRESULT ( STDMETHODCALLTYPE *ScheduledFrameCompleted )( - IDeckLinkVideoOutputCallback_v7_1 * This, - /* [in] */ IDeckLinkVideoFrame_v7_1 *completedFrame, - /* [in] */ BMDOutputFrameCompletionResult result); - - END_INTERFACE - } IDeckLinkVideoOutputCallback_v7_1Vtbl; - - interface IDeckLinkVideoOutputCallback_v7_1 - { - CONST_VTBL struct IDeckLinkVideoOutputCallback_v7_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoOutputCallback_v7_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoOutputCallback_v7_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoOutputCallback_v7_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoOutputCallback_v7_1_ScheduledFrameCompleted(This,completedFrame,result) \ - ( (This)->lpVtbl -> ScheduledFrameCompleted(This,completedFrame,result) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoOutputCallback_v7_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkInputCallback_v7_1_INTERFACE_DEFINED__ -#define __IDeckLinkInputCallback_v7_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkInputCallback_v7_1 */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkInputCallback_v7_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("7F94F328-5ED4-4E9F-9729-76A86BDC99CC") - IDeckLinkInputCallback_v7_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived( - /* [in] */ IDeckLinkVideoInputFrame_v7_1 *videoFrame, - /* [in] */ IDeckLinkAudioInputPacket_v7_1 *audioPacket) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkInputCallback_v7_1Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkInputCallback_v7_1 * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkInputCallback_v7_1 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkInputCallback_v7_1 * This); - - HRESULT ( STDMETHODCALLTYPE *VideoInputFrameArrived )( - IDeckLinkInputCallback_v7_1 * This, - /* [in] */ IDeckLinkVideoInputFrame_v7_1 *videoFrame, - /* [in] */ IDeckLinkAudioInputPacket_v7_1 *audioPacket); - - END_INTERFACE - } IDeckLinkInputCallback_v7_1Vtbl; - - interface IDeckLinkInputCallback_v7_1 - { - CONST_VTBL struct IDeckLinkInputCallback_v7_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkInputCallback_v7_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkInputCallback_v7_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkInputCallback_v7_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkInputCallback_v7_1_VideoInputFrameArrived(This,videoFrame,audioPacket) \ - ( (This)->lpVtbl -> VideoInputFrameArrived(This,videoFrame,audioPacket) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkInputCallback_v7_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkOutput_v7_1_INTERFACE_DEFINED__ -#define __IDeckLinkOutput_v7_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkOutput_v7_1 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkOutput_v7_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("AE5B3E9B-4E1E-4535-B6E8-480FF52F6CE5") - IDeckLinkOutput_v7_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - /* [out] */ BMDDisplayModeSupport *result) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( - /* [out] */ IDeckLinkDisplayModeIterator_v7_1 **iterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableVideoOutput( - BMDDisplayMode displayMode) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableVideoOutput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFrameMemoryAllocator( - /* [in] */ IDeckLinkMemoryAllocator *theAllocator) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateVideoFrame( - long width, - long height, - long rowBytes, - BMDPixelFormat pixelFormat, - BMDFrameFlags flags, - IDeckLinkVideoFrame_v7_1 **outFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateVideoFrameFromBuffer( - void *buffer, - long width, - long height, - long rowBytes, - BMDPixelFormat pixelFormat, - BMDFrameFlags flags, - IDeckLinkVideoFrame_v7_1 **outFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisplayVideoFrameSync( - IDeckLinkVideoFrame_v7_1 *theFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE ScheduleVideoFrame( - IDeckLinkVideoFrame_v7_1 *theFrame, - BMDTimeValue displayTime, - BMDTimeValue displayDuration, - BMDTimeScale timeScale) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetScheduledFrameCompletionCallback( - /* [in] */ IDeckLinkVideoOutputCallback_v7_1 *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableAudioOutput( - BMDAudioSampleRate sampleRate, - BMDAudioSampleType sampleType, - unsigned long channelCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableAudioOutput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE WriteAudioSamplesSync( - void *buffer, - unsigned long sampleFrameCount, - /* [out] */ unsigned long *sampleFramesWritten) = 0; - - virtual HRESULT STDMETHODCALLTYPE BeginAudioPreroll( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE EndAudioPreroll( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE ScheduleAudioSamples( - void *buffer, - unsigned long sampleFrameCount, - BMDTimeValue streamTime, - BMDTimeScale timeScale, - /* [out] */ unsigned long *sampleFramesWritten) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( - /* [out] */ unsigned long *bufferedSampleCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE FlushBufferedAudioSamples( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetAudioCallback( - /* [in] */ IDeckLinkAudioOutputCallback *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE StartScheduledPlayback( - BMDTimeValue playbackStartTime, - BMDTimeScale timeScale, - double playbackSpeed) = 0; - - virtual HRESULT STDMETHODCALLTYPE StopScheduledPlayback( - BMDTimeValue stopPlaybackAtTime, - BMDTimeValue *actualStopTime, - BMDTimeScale timeScale) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( - BMDTimeScale desiredTimeScale, - BMDTimeValue *elapsedTimeSinceSchedulerBegan) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkOutput_v7_1Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkOutput_v7_1 * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkOutput_v7_1 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkOutput_v7_1 * This); - - HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( - IDeckLinkOutput_v7_1 * This, - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - /* [out] */ BMDDisplayModeSupport *result); - - HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( - IDeckLinkOutput_v7_1 * This, - /* [out] */ IDeckLinkDisplayModeIterator_v7_1 **iterator); - - HRESULT ( STDMETHODCALLTYPE *EnableVideoOutput )( - IDeckLinkOutput_v7_1 * This, - BMDDisplayMode displayMode); - - HRESULT ( STDMETHODCALLTYPE *DisableVideoOutput )( - IDeckLinkOutput_v7_1 * This); - - HRESULT ( STDMETHODCALLTYPE *SetVideoOutputFrameMemoryAllocator )( - IDeckLinkOutput_v7_1 * This, - /* [in] */ IDeckLinkMemoryAllocator *theAllocator); - - HRESULT ( STDMETHODCALLTYPE *CreateVideoFrame )( - IDeckLinkOutput_v7_1 * This, - long width, - long height, - long rowBytes, - BMDPixelFormat pixelFormat, - BMDFrameFlags flags, - IDeckLinkVideoFrame_v7_1 **outFrame); - - HRESULT ( STDMETHODCALLTYPE *CreateVideoFrameFromBuffer )( - IDeckLinkOutput_v7_1 * This, - void *buffer, - long width, - long height, - long rowBytes, - BMDPixelFormat pixelFormat, - BMDFrameFlags flags, - IDeckLinkVideoFrame_v7_1 **outFrame); - - HRESULT ( STDMETHODCALLTYPE *DisplayVideoFrameSync )( - IDeckLinkOutput_v7_1 * This, - IDeckLinkVideoFrame_v7_1 *theFrame); - - HRESULT ( STDMETHODCALLTYPE *ScheduleVideoFrame )( - IDeckLinkOutput_v7_1 * This, - IDeckLinkVideoFrame_v7_1 *theFrame, - BMDTimeValue displayTime, - BMDTimeValue displayDuration, - BMDTimeScale timeScale); - - HRESULT ( STDMETHODCALLTYPE *SetScheduledFrameCompletionCallback )( - IDeckLinkOutput_v7_1 * This, - /* [in] */ IDeckLinkVideoOutputCallback_v7_1 *theCallback); - - HRESULT ( STDMETHODCALLTYPE *EnableAudioOutput )( - IDeckLinkOutput_v7_1 * This, - BMDAudioSampleRate sampleRate, - BMDAudioSampleType sampleType, - unsigned long channelCount); - - HRESULT ( STDMETHODCALLTYPE *DisableAudioOutput )( - IDeckLinkOutput_v7_1 * This); - - HRESULT ( STDMETHODCALLTYPE *WriteAudioSamplesSync )( - IDeckLinkOutput_v7_1 * This, - void *buffer, - unsigned long sampleFrameCount, - /* [out] */ unsigned long *sampleFramesWritten); - - HRESULT ( STDMETHODCALLTYPE *BeginAudioPreroll )( - IDeckLinkOutput_v7_1 * This); - - HRESULT ( STDMETHODCALLTYPE *EndAudioPreroll )( - IDeckLinkOutput_v7_1 * This); - - HRESULT ( STDMETHODCALLTYPE *ScheduleAudioSamples )( - IDeckLinkOutput_v7_1 * This, - void *buffer, - unsigned long sampleFrameCount, - BMDTimeValue streamTime, - BMDTimeScale timeScale, - /* [out] */ unsigned long *sampleFramesWritten); - - HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( - IDeckLinkOutput_v7_1 * This, - /* [out] */ unsigned long *bufferedSampleCount); - - HRESULT ( STDMETHODCALLTYPE *FlushBufferedAudioSamples )( - IDeckLinkOutput_v7_1 * This); - - HRESULT ( STDMETHODCALLTYPE *SetAudioCallback )( - IDeckLinkOutput_v7_1 * This, - /* [in] */ IDeckLinkAudioOutputCallback *theCallback); - - HRESULT ( STDMETHODCALLTYPE *StartScheduledPlayback )( - IDeckLinkOutput_v7_1 * This, - BMDTimeValue playbackStartTime, - BMDTimeScale timeScale, - double playbackSpeed); - - HRESULT ( STDMETHODCALLTYPE *StopScheduledPlayback )( - IDeckLinkOutput_v7_1 * This, - BMDTimeValue stopPlaybackAtTime, - BMDTimeValue *actualStopTime, - BMDTimeScale timeScale); - - HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( - IDeckLinkOutput_v7_1 * This, - BMDTimeScale desiredTimeScale, - BMDTimeValue *elapsedTimeSinceSchedulerBegan); - - END_INTERFACE - } IDeckLinkOutput_v7_1Vtbl; - - interface IDeckLinkOutput_v7_1 - { - CONST_VTBL struct IDeckLinkOutput_v7_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkOutput_v7_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkOutput_v7_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkOutput_v7_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkOutput_v7_1_DoesSupportVideoMode(This,displayMode,pixelFormat,result) \ - ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,result) ) - -#define IDeckLinkOutput_v7_1_GetDisplayModeIterator(This,iterator) \ - ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) - -#define IDeckLinkOutput_v7_1_EnableVideoOutput(This,displayMode) \ - ( (This)->lpVtbl -> EnableVideoOutput(This,displayMode) ) - -#define IDeckLinkOutput_v7_1_DisableVideoOutput(This) \ - ( (This)->lpVtbl -> DisableVideoOutput(This) ) - -#define IDeckLinkOutput_v7_1_SetVideoOutputFrameMemoryAllocator(This,theAllocator) \ - ( (This)->lpVtbl -> SetVideoOutputFrameMemoryAllocator(This,theAllocator) ) - -#define IDeckLinkOutput_v7_1_CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) \ - ( (This)->lpVtbl -> CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) ) - -#define IDeckLinkOutput_v7_1_CreateVideoFrameFromBuffer(This,buffer,width,height,rowBytes,pixelFormat,flags,outFrame) \ - ( (This)->lpVtbl -> CreateVideoFrameFromBuffer(This,buffer,width,height,rowBytes,pixelFormat,flags,outFrame) ) - -#define IDeckLinkOutput_v7_1_DisplayVideoFrameSync(This,theFrame) \ - ( (This)->lpVtbl -> DisplayVideoFrameSync(This,theFrame) ) - -#define IDeckLinkOutput_v7_1_ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) \ - ( (This)->lpVtbl -> ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) ) - -#define IDeckLinkOutput_v7_1_SetScheduledFrameCompletionCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetScheduledFrameCompletionCallback(This,theCallback) ) - -#define IDeckLinkOutput_v7_1_EnableAudioOutput(This,sampleRate,sampleType,channelCount) \ - ( (This)->lpVtbl -> EnableAudioOutput(This,sampleRate,sampleType,channelCount) ) - -#define IDeckLinkOutput_v7_1_DisableAudioOutput(This) \ - ( (This)->lpVtbl -> DisableAudioOutput(This) ) - -#define IDeckLinkOutput_v7_1_WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) \ - ( (This)->lpVtbl -> WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) ) - -#define IDeckLinkOutput_v7_1_BeginAudioPreroll(This) \ - ( (This)->lpVtbl -> BeginAudioPreroll(This) ) - -#define IDeckLinkOutput_v7_1_EndAudioPreroll(This) \ - ( (This)->lpVtbl -> EndAudioPreroll(This) ) - -#define IDeckLinkOutput_v7_1_ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) \ - ( (This)->lpVtbl -> ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) ) - -#define IDeckLinkOutput_v7_1_GetBufferedAudioSampleFrameCount(This,bufferedSampleCount) \ - ( (This)->lpVtbl -> GetBufferedAudioSampleFrameCount(This,bufferedSampleCount) ) - -#define IDeckLinkOutput_v7_1_FlushBufferedAudioSamples(This) \ - ( (This)->lpVtbl -> FlushBufferedAudioSamples(This) ) - -#define IDeckLinkOutput_v7_1_SetAudioCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetAudioCallback(This,theCallback) ) - -#define IDeckLinkOutput_v7_1_StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) \ - ( (This)->lpVtbl -> StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) ) - -#define IDeckLinkOutput_v7_1_StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) \ - ( (This)->lpVtbl -> StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) ) - -#define IDeckLinkOutput_v7_1_GetHardwareReferenceClock(This,desiredTimeScale,elapsedTimeSinceSchedulerBegan) \ - ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,elapsedTimeSinceSchedulerBegan) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkOutput_v7_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkInput_v7_1_INTERFACE_DEFINED__ -#define __IDeckLinkInput_v7_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkInput_v7_1 */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkInput_v7_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("2B54EDEF-5B32-429F-BA11-BB990596EACD") - IDeckLinkInput_v7_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - /* [out] */ BMDDisplayModeSupport *result) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( - /* [out] */ IDeckLinkDisplayModeIterator_v7_1 **iterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - BMDVideoInputFlags flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( - BMDAudioSampleRate sampleRate, - BMDAudioSampleType sampleType, - unsigned long channelCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE ReadAudioSamples( - void *buffer, - unsigned long sampleFrameCount, - /* [out] */ unsigned long *sampleFramesRead, - /* [out] */ BMDTimeValue *audioPacketTime, - BMDTimeScale timeScale) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( - /* [out] */ unsigned long *bufferedSampleCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE StartStreams( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE StopStreams( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE PauseStreams( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetCallback( - /* [in] */ IDeckLinkInputCallback_v7_1 *theCallback) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkInput_v7_1Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkInput_v7_1 * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkInput_v7_1 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkInput_v7_1 * This); - - HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( - IDeckLinkInput_v7_1 * This, - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - /* [out] */ BMDDisplayModeSupport *result); - - HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( - IDeckLinkInput_v7_1 * This, - /* [out] */ IDeckLinkDisplayModeIterator_v7_1 **iterator); - - HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( - IDeckLinkInput_v7_1 * This, - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - BMDVideoInputFlags flags); - - HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( - IDeckLinkInput_v7_1 * This); - - HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( - IDeckLinkInput_v7_1 * This, - BMDAudioSampleRate sampleRate, - BMDAudioSampleType sampleType, - unsigned long channelCount); - - HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( - IDeckLinkInput_v7_1 * This); - - HRESULT ( STDMETHODCALLTYPE *ReadAudioSamples )( - IDeckLinkInput_v7_1 * This, - void *buffer, - unsigned long sampleFrameCount, - /* [out] */ unsigned long *sampleFramesRead, - /* [out] */ BMDTimeValue *audioPacketTime, - BMDTimeScale timeScale); - - HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( - IDeckLinkInput_v7_1 * This, - /* [out] */ unsigned long *bufferedSampleCount); - - HRESULT ( STDMETHODCALLTYPE *StartStreams )( - IDeckLinkInput_v7_1 * This); - - HRESULT ( STDMETHODCALLTYPE *StopStreams )( - IDeckLinkInput_v7_1 * This); - - HRESULT ( STDMETHODCALLTYPE *PauseStreams )( - IDeckLinkInput_v7_1 * This); - - HRESULT ( STDMETHODCALLTYPE *SetCallback )( - IDeckLinkInput_v7_1 * This, - /* [in] */ IDeckLinkInputCallback_v7_1 *theCallback); - - END_INTERFACE - } IDeckLinkInput_v7_1Vtbl; - - interface IDeckLinkInput_v7_1 - { - CONST_VTBL struct IDeckLinkInput_v7_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkInput_v7_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkInput_v7_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkInput_v7_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkInput_v7_1_DoesSupportVideoMode(This,displayMode,pixelFormat,result) \ - ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,result) ) - -#define IDeckLinkInput_v7_1_GetDisplayModeIterator(This,iterator) \ - ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) - -#define IDeckLinkInput_v7_1_EnableVideoInput(This,displayMode,pixelFormat,flags) \ - ( (This)->lpVtbl -> EnableVideoInput(This,displayMode,pixelFormat,flags) ) - -#define IDeckLinkInput_v7_1_DisableVideoInput(This) \ - ( (This)->lpVtbl -> DisableVideoInput(This) ) - -#define IDeckLinkInput_v7_1_EnableAudioInput(This,sampleRate,sampleType,channelCount) \ - ( (This)->lpVtbl -> EnableAudioInput(This,sampleRate,sampleType,channelCount) ) - -#define IDeckLinkInput_v7_1_DisableAudioInput(This) \ - ( (This)->lpVtbl -> DisableAudioInput(This) ) - -#define IDeckLinkInput_v7_1_ReadAudioSamples(This,buffer,sampleFrameCount,sampleFramesRead,audioPacketTime,timeScale) \ - ( (This)->lpVtbl -> ReadAudioSamples(This,buffer,sampleFrameCount,sampleFramesRead,audioPacketTime,timeScale) ) - -#define IDeckLinkInput_v7_1_GetBufferedAudioSampleFrameCount(This,bufferedSampleCount) \ - ( (This)->lpVtbl -> GetBufferedAudioSampleFrameCount(This,bufferedSampleCount) ) - -#define IDeckLinkInput_v7_1_StartStreams(This) \ - ( (This)->lpVtbl -> StartStreams(This) ) - -#define IDeckLinkInput_v7_1_StopStreams(This) \ - ( (This)->lpVtbl -> StopStreams(This) ) - -#define IDeckLinkInput_v7_1_PauseStreams(This) \ - ( (This)->lpVtbl -> PauseStreams(This) ) - -#define IDeckLinkInput_v7_1_SetCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetCallback(This,theCallback) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkInput_v7_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkInputCallback_v7_3_INTERFACE_DEFINED__ -#define __IDeckLinkInputCallback_v7_3_INTERFACE_DEFINED__ - -/* interface IDeckLinkInputCallback_v7_3 */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkInputCallback_v7_3; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("FD6F311D-4D00-444B-9ED4-1F25B5730AD0") - IDeckLinkInputCallback_v7_3 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged( - /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents, - /* [in] */ IDeckLinkDisplayMode *newDisplayMode, - /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived( - /* [in] */ IDeckLinkVideoInputFrame_v7_3 *videoFrame, - /* [in] */ IDeckLinkAudioInputPacket *audioPacket) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkInputCallback_v7_3Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkInputCallback_v7_3 * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkInputCallback_v7_3 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkInputCallback_v7_3 * This); - - HRESULT ( STDMETHODCALLTYPE *VideoInputFormatChanged )( - IDeckLinkInputCallback_v7_3 * This, - /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents, - /* [in] */ IDeckLinkDisplayMode *newDisplayMode, - /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags); - - HRESULT ( STDMETHODCALLTYPE *VideoInputFrameArrived )( - IDeckLinkInputCallback_v7_3 * This, - /* [in] */ IDeckLinkVideoInputFrame_v7_3 *videoFrame, - /* [in] */ IDeckLinkAudioInputPacket *audioPacket); - - END_INTERFACE - } IDeckLinkInputCallback_v7_3Vtbl; - - interface IDeckLinkInputCallback_v7_3 - { - CONST_VTBL struct IDeckLinkInputCallback_v7_3Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkInputCallback_v7_3_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkInputCallback_v7_3_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkInputCallback_v7_3_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkInputCallback_v7_3_VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags) \ - ( (This)->lpVtbl -> VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags) ) - -#define IDeckLinkInputCallback_v7_3_VideoInputFrameArrived(This,videoFrame,audioPacket) \ - ( (This)->lpVtbl -> VideoInputFrameArrived(This,videoFrame,audioPacket) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkInputCallback_v7_3_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkOutput_v7_3_INTERFACE_DEFINED__ -#define __IDeckLinkOutput_v7_3_INTERFACE_DEFINED__ - -/* interface IDeckLinkOutput_v7_3 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkOutput_v7_3; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("271C65E3-C323-4344-A30F-D908BCB20AA3") - IDeckLinkOutput_v7_3 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - /* [out] */ BMDDisplayModeSupport *result) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( - /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( - /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableVideoOutput( - BMDDisplayMode displayMode, - BMDVideoOutputFlags flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableVideoOutput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFrameMemoryAllocator( - /* [in] */ IDeckLinkMemoryAllocator *theAllocator) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateVideoFrame( - long width, - long height, - long rowBytes, - BMDPixelFormat pixelFormat, - BMDFrameFlags flags, - /* [out] */ IDeckLinkMutableVideoFrame **outFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateAncillaryData( - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisplayVideoFrameSync( - /* [in] */ IDeckLinkVideoFrame *theFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE ScheduleVideoFrame( - /* [in] */ IDeckLinkVideoFrame *theFrame, - BMDTimeValue displayTime, - BMDTimeValue displayDuration, - BMDTimeScale timeScale) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetScheduledFrameCompletionCallback( - /* [in] */ IDeckLinkVideoOutputCallback *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBufferedVideoFrameCount( - /* [out] */ unsigned long *bufferedFrameCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableAudioOutput( - BMDAudioSampleRate sampleRate, - BMDAudioSampleType sampleType, - unsigned long channelCount, - BMDAudioOutputStreamType streamType) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableAudioOutput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE WriteAudioSamplesSync( - /* [in] */ void *buffer, - unsigned long sampleFrameCount, - /* [out] */ unsigned long *sampleFramesWritten) = 0; - - virtual HRESULT STDMETHODCALLTYPE BeginAudioPreroll( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE EndAudioPreroll( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE ScheduleAudioSamples( - /* [in] */ void *buffer, - unsigned long sampleFrameCount, - BMDTimeValue streamTime, - BMDTimeScale timeScale, - /* [out] */ unsigned long *sampleFramesWritten) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( - /* [out] */ unsigned long *bufferedSampleFrameCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE FlushBufferedAudioSamples( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetAudioCallback( - /* [in] */ IDeckLinkAudioOutputCallback *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE StartScheduledPlayback( - BMDTimeValue playbackStartTime, - BMDTimeScale timeScale, - double playbackSpeed) = 0; - - virtual HRESULT STDMETHODCALLTYPE StopScheduledPlayback( - BMDTimeValue stopPlaybackAtTime, - /* [out] */ BMDTimeValue *actualStopTime, - BMDTimeScale timeScale) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsScheduledPlaybackRunning( - /* [out] */ BOOL *active) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( - BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *elapsedTimeSinceSchedulerBegan) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkOutput_v7_3Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkOutput_v7_3 * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkOutput_v7_3 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkOutput_v7_3 * This); - - HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( - IDeckLinkOutput_v7_3 * This, - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - /* [out] */ BMDDisplayModeSupport *result); - - HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( - IDeckLinkOutput_v7_3 * This, - /* [out] */ IDeckLinkDisplayModeIterator **iterator); - - HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( - IDeckLinkOutput_v7_3 * This, - /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback); - - HRESULT ( STDMETHODCALLTYPE *EnableVideoOutput )( - IDeckLinkOutput_v7_3 * This, - BMDDisplayMode displayMode, - BMDVideoOutputFlags flags); - - HRESULT ( STDMETHODCALLTYPE *DisableVideoOutput )( - IDeckLinkOutput_v7_3 * This); - - HRESULT ( STDMETHODCALLTYPE *SetVideoOutputFrameMemoryAllocator )( - IDeckLinkOutput_v7_3 * This, - /* [in] */ IDeckLinkMemoryAllocator *theAllocator); - - HRESULT ( STDMETHODCALLTYPE *CreateVideoFrame )( - IDeckLinkOutput_v7_3 * This, - long width, - long height, - long rowBytes, - BMDPixelFormat pixelFormat, - BMDFrameFlags flags, - /* [out] */ IDeckLinkMutableVideoFrame **outFrame); - - HRESULT ( STDMETHODCALLTYPE *CreateAncillaryData )( - IDeckLinkOutput_v7_3 * This, - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer); - - HRESULT ( STDMETHODCALLTYPE *DisplayVideoFrameSync )( - IDeckLinkOutput_v7_3 * This, - /* [in] */ IDeckLinkVideoFrame *theFrame); - - HRESULT ( STDMETHODCALLTYPE *ScheduleVideoFrame )( - IDeckLinkOutput_v7_3 * This, - /* [in] */ IDeckLinkVideoFrame *theFrame, - BMDTimeValue displayTime, - BMDTimeValue displayDuration, - BMDTimeScale timeScale); - - HRESULT ( STDMETHODCALLTYPE *SetScheduledFrameCompletionCallback )( - IDeckLinkOutput_v7_3 * This, - /* [in] */ IDeckLinkVideoOutputCallback *theCallback); - - HRESULT ( STDMETHODCALLTYPE *GetBufferedVideoFrameCount )( - IDeckLinkOutput_v7_3 * This, - /* [out] */ unsigned long *bufferedFrameCount); - - HRESULT ( STDMETHODCALLTYPE *EnableAudioOutput )( - IDeckLinkOutput_v7_3 * This, - BMDAudioSampleRate sampleRate, - BMDAudioSampleType sampleType, - unsigned long channelCount, - BMDAudioOutputStreamType streamType); - - HRESULT ( STDMETHODCALLTYPE *DisableAudioOutput )( - IDeckLinkOutput_v7_3 * This); - - HRESULT ( STDMETHODCALLTYPE *WriteAudioSamplesSync )( - IDeckLinkOutput_v7_3 * This, - /* [in] */ void *buffer, - unsigned long sampleFrameCount, - /* [out] */ unsigned long *sampleFramesWritten); - - HRESULT ( STDMETHODCALLTYPE *BeginAudioPreroll )( - IDeckLinkOutput_v7_3 * This); - - HRESULT ( STDMETHODCALLTYPE *EndAudioPreroll )( - IDeckLinkOutput_v7_3 * This); - - HRESULT ( STDMETHODCALLTYPE *ScheduleAudioSamples )( - IDeckLinkOutput_v7_3 * This, - /* [in] */ void *buffer, - unsigned long sampleFrameCount, - BMDTimeValue streamTime, - BMDTimeScale timeScale, - /* [out] */ unsigned long *sampleFramesWritten); - - HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( - IDeckLinkOutput_v7_3 * This, - /* [out] */ unsigned long *bufferedSampleFrameCount); - - HRESULT ( STDMETHODCALLTYPE *FlushBufferedAudioSamples )( - IDeckLinkOutput_v7_3 * This); - - HRESULT ( STDMETHODCALLTYPE *SetAudioCallback )( - IDeckLinkOutput_v7_3 * This, - /* [in] */ IDeckLinkAudioOutputCallback *theCallback); - - HRESULT ( STDMETHODCALLTYPE *StartScheduledPlayback )( - IDeckLinkOutput_v7_3 * This, - BMDTimeValue playbackStartTime, - BMDTimeScale timeScale, - double playbackSpeed); - - HRESULT ( STDMETHODCALLTYPE *StopScheduledPlayback )( - IDeckLinkOutput_v7_3 * This, - BMDTimeValue stopPlaybackAtTime, - /* [out] */ BMDTimeValue *actualStopTime, - BMDTimeScale timeScale); - - HRESULT ( STDMETHODCALLTYPE *IsScheduledPlaybackRunning )( - IDeckLinkOutput_v7_3 * This, - /* [out] */ BOOL *active); - - HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( - IDeckLinkOutput_v7_3 * This, - BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *elapsedTimeSinceSchedulerBegan); - - END_INTERFACE - } IDeckLinkOutput_v7_3Vtbl; - - interface IDeckLinkOutput_v7_3 - { - CONST_VTBL struct IDeckLinkOutput_v7_3Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkOutput_v7_3_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkOutput_v7_3_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkOutput_v7_3_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkOutput_v7_3_DoesSupportVideoMode(This,displayMode,pixelFormat,result) \ - ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,result) ) - -#define IDeckLinkOutput_v7_3_GetDisplayModeIterator(This,iterator) \ - ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) - -#define IDeckLinkOutput_v7_3_SetScreenPreviewCallback(This,previewCallback) \ - ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) - -#define IDeckLinkOutput_v7_3_EnableVideoOutput(This,displayMode,flags) \ - ( (This)->lpVtbl -> EnableVideoOutput(This,displayMode,flags) ) - -#define IDeckLinkOutput_v7_3_DisableVideoOutput(This) \ - ( (This)->lpVtbl -> DisableVideoOutput(This) ) - -#define IDeckLinkOutput_v7_3_SetVideoOutputFrameMemoryAllocator(This,theAllocator) \ - ( (This)->lpVtbl -> SetVideoOutputFrameMemoryAllocator(This,theAllocator) ) - -#define IDeckLinkOutput_v7_3_CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) \ - ( (This)->lpVtbl -> CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) ) - -#define IDeckLinkOutput_v7_3_CreateAncillaryData(This,displayMode,pixelFormat,outBuffer) \ - ( (This)->lpVtbl -> CreateAncillaryData(This,displayMode,pixelFormat,outBuffer) ) - -#define IDeckLinkOutput_v7_3_DisplayVideoFrameSync(This,theFrame) \ - ( (This)->lpVtbl -> DisplayVideoFrameSync(This,theFrame) ) - -#define IDeckLinkOutput_v7_3_ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) \ - ( (This)->lpVtbl -> ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) ) - -#define IDeckLinkOutput_v7_3_SetScheduledFrameCompletionCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetScheduledFrameCompletionCallback(This,theCallback) ) - -#define IDeckLinkOutput_v7_3_GetBufferedVideoFrameCount(This,bufferedFrameCount) \ - ( (This)->lpVtbl -> GetBufferedVideoFrameCount(This,bufferedFrameCount) ) - -#define IDeckLinkOutput_v7_3_EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) \ - ( (This)->lpVtbl -> EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) ) - -#define IDeckLinkOutput_v7_3_DisableAudioOutput(This) \ - ( (This)->lpVtbl -> DisableAudioOutput(This) ) - -#define IDeckLinkOutput_v7_3_WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) \ - ( (This)->lpVtbl -> WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) ) - -#define IDeckLinkOutput_v7_3_BeginAudioPreroll(This) \ - ( (This)->lpVtbl -> BeginAudioPreroll(This) ) - -#define IDeckLinkOutput_v7_3_EndAudioPreroll(This) \ - ( (This)->lpVtbl -> EndAudioPreroll(This) ) - -#define IDeckLinkOutput_v7_3_ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) \ - ( (This)->lpVtbl -> ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) ) - -#define IDeckLinkOutput_v7_3_GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) \ - ( (This)->lpVtbl -> GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) ) - -#define IDeckLinkOutput_v7_3_FlushBufferedAudioSamples(This) \ - ( (This)->lpVtbl -> FlushBufferedAudioSamples(This) ) - -#define IDeckLinkOutput_v7_3_SetAudioCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetAudioCallback(This,theCallback) ) - -#define IDeckLinkOutput_v7_3_StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) \ - ( (This)->lpVtbl -> StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) ) - -#define IDeckLinkOutput_v7_3_StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) \ - ( (This)->lpVtbl -> StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) ) - -#define IDeckLinkOutput_v7_3_IsScheduledPlaybackRunning(This,active) \ - ( (This)->lpVtbl -> IsScheduledPlaybackRunning(This,active) ) - -#define IDeckLinkOutput_v7_3_GetHardwareReferenceClock(This,desiredTimeScale,elapsedTimeSinceSchedulerBegan) \ - ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,elapsedTimeSinceSchedulerBegan) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkOutput_v7_3_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkInput_v7_3_INTERFACE_DEFINED__ -#define __IDeckLinkInput_v7_3_INTERFACE_DEFINED__ - -/* interface IDeckLinkInput_v7_3 */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkInput_v7_3; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("4973F012-9925-458C-871C-18774CDBBECB") - IDeckLinkInput_v7_3 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - /* [out] */ BMDDisplayModeSupport *result) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( - /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( - /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - BMDVideoInputFlags flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAvailableVideoFrameCount( - /* [out] */ unsigned long *availableFrameCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( - BMDAudioSampleRate sampleRate, - BMDAudioSampleType sampleType, - unsigned long channelCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAvailableAudioSampleFrameCount( - /* [out] */ unsigned long *availableSampleFrameCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE StartStreams( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE StopStreams( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE PauseStreams( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE FlushStreams( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetCallback( - /* [in] */ IDeckLinkInputCallback_v7_3 *theCallback) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkInput_v7_3Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkInput_v7_3 * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkInput_v7_3 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkInput_v7_3 * This); - - HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( - IDeckLinkInput_v7_3 * This, - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - /* [out] */ BMDDisplayModeSupport *result); - - HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( - IDeckLinkInput_v7_3 * This, - /* [out] */ IDeckLinkDisplayModeIterator **iterator); - - HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( - IDeckLinkInput_v7_3 * This, - /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback); - - HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( - IDeckLinkInput_v7_3 * This, - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - BMDVideoInputFlags flags); - - HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( - IDeckLinkInput_v7_3 * This); - - HRESULT ( STDMETHODCALLTYPE *GetAvailableVideoFrameCount )( - IDeckLinkInput_v7_3 * This, - /* [out] */ unsigned long *availableFrameCount); - - HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( - IDeckLinkInput_v7_3 * This, - BMDAudioSampleRate sampleRate, - BMDAudioSampleType sampleType, - unsigned long channelCount); - - HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( - IDeckLinkInput_v7_3 * This); - - HRESULT ( STDMETHODCALLTYPE *GetAvailableAudioSampleFrameCount )( - IDeckLinkInput_v7_3 * This, - /* [out] */ unsigned long *availableSampleFrameCount); - - HRESULT ( STDMETHODCALLTYPE *StartStreams )( - IDeckLinkInput_v7_3 * This); - - HRESULT ( STDMETHODCALLTYPE *StopStreams )( - IDeckLinkInput_v7_3 * This); - - HRESULT ( STDMETHODCALLTYPE *PauseStreams )( - IDeckLinkInput_v7_3 * This); - - HRESULT ( STDMETHODCALLTYPE *FlushStreams )( - IDeckLinkInput_v7_3 * This); - - HRESULT ( STDMETHODCALLTYPE *SetCallback )( - IDeckLinkInput_v7_3 * This, - /* [in] */ IDeckLinkInputCallback_v7_3 *theCallback); - - END_INTERFACE - } IDeckLinkInput_v7_3Vtbl; - - interface IDeckLinkInput_v7_3 - { - CONST_VTBL struct IDeckLinkInput_v7_3Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkInput_v7_3_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkInput_v7_3_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkInput_v7_3_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkInput_v7_3_DoesSupportVideoMode(This,displayMode,pixelFormat,result) \ - ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,result) ) - -#define IDeckLinkInput_v7_3_GetDisplayModeIterator(This,iterator) \ - ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) - -#define IDeckLinkInput_v7_3_SetScreenPreviewCallback(This,previewCallback) \ - ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) - -#define IDeckLinkInput_v7_3_EnableVideoInput(This,displayMode,pixelFormat,flags) \ - ( (This)->lpVtbl -> EnableVideoInput(This,displayMode,pixelFormat,flags) ) - -#define IDeckLinkInput_v7_3_DisableVideoInput(This) \ - ( (This)->lpVtbl -> DisableVideoInput(This) ) - -#define IDeckLinkInput_v7_3_GetAvailableVideoFrameCount(This,availableFrameCount) \ - ( (This)->lpVtbl -> GetAvailableVideoFrameCount(This,availableFrameCount) ) - -#define IDeckLinkInput_v7_3_EnableAudioInput(This,sampleRate,sampleType,channelCount) \ - ( (This)->lpVtbl -> EnableAudioInput(This,sampleRate,sampleType,channelCount) ) - -#define IDeckLinkInput_v7_3_DisableAudioInput(This) \ - ( (This)->lpVtbl -> DisableAudioInput(This) ) - -#define IDeckLinkInput_v7_3_GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) \ - ( (This)->lpVtbl -> GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) ) - -#define IDeckLinkInput_v7_3_StartStreams(This) \ - ( (This)->lpVtbl -> StartStreams(This) ) - -#define IDeckLinkInput_v7_3_StopStreams(This) \ - ( (This)->lpVtbl -> StopStreams(This) ) - -#define IDeckLinkInput_v7_3_PauseStreams(This) \ - ( (This)->lpVtbl -> PauseStreams(This) ) - -#define IDeckLinkInput_v7_3_FlushStreams(This) \ - ( (This)->lpVtbl -> FlushStreams(This) ) - -#define IDeckLinkInput_v7_3_SetCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetCallback(This,theCallback) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkInput_v7_3_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkVideoInputFrame_v7_3_INTERFACE_DEFINED__ -#define __IDeckLinkVideoInputFrame_v7_3_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoInputFrame_v7_3 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoInputFrame_v7_3; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("CF317790-2894-11DE-8C30-0800200C9A66") - IDeckLinkVideoInputFrame_v7_3 : public IDeckLinkVideoFrame - { - public: - virtual HRESULT STDMETHODCALLTYPE GetStreamTime( - /* [out] */ BMDTimeValue *frameTime, - /* [out] */ BMDTimeValue *frameDuration, - BMDTimeScale timeScale) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDeckLinkVideoInputFrame_v7_3Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoInputFrame_v7_3 * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoInputFrame_v7_3 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoInputFrame_v7_3 * This); - - long ( STDMETHODCALLTYPE *GetWidth )( - IDeckLinkVideoInputFrame_v7_3 * This); - - long ( STDMETHODCALLTYPE *GetHeight )( - IDeckLinkVideoInputFrame_v7_3 * This); - - long ( STDMETHODCALLTYPE *GetRowBytes )( - IDeckLinkVideoInputFrame_v7_3 * This); - - BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( - IDeckLinkVideoInputFrame_v7_3 * This); - - BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( - IDeckLinkVideoInputFrame_v7_3 * This); - - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IDeckLinkVideoInputFrame_v7_3 * This, - /* [out] */ void **buffer); - - HRESULT ( STDMETHODCALLTYPE *GetTimecode )( - IDeckLinkVideoInputFrame_v7_3 * This, - BMDTimecodeFormat format, - /* [out] */ IDeckLinkTimecode **timecode); - - HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( - IDeckLinkVideoInputFrame_v7_3 * This, - /* [out] */ IDeckLinkVideoFrameAncillary **ancillary); - - HRESULT ( STDMETHODCALLTYPE *GetStreamTime )( - IDeckLinkVideoInputFrame_v7_3 * This, - /* [out] */ BMDTimeValue *frameTime, - /* [out] */ BMDTimeValue *frameDuration, - BMDTimeScale timeScale); - - END_INTERFACE - } IDeckLinkVideoInputFrame_v7_3Vtbl; - - interface IDeckLinkVideoInputFrame_v7_3 - { - CONST_VTBL struct IDeckLinkVideoInputFrame_v7_3Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoInputFrame_v7_3_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoInputFrame_v7_3_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoInputFrame_v7_3_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoInputFrame_v7_3_GetWidth(This) \ - ( (This)->lpVtbl -> GetWidth(This) ) - -#define IDeckLinkVideoInputFrame_v7_3_GetHeight(This) \ - ( (This)->lpVtbl -> GetHeight(This) ) - -#define IDeckLinkVideoInputFrame_v7_3_GetRowBytes(This) \ - ( (This)->lpVtbl -> GetRowBytes(This) ) - -#define IDeckLinkVideoInputFrame_v7_3_GetPixelFormat(This) \ - ( (This)->lpVtbl -> GetPixelFormat(This) ) - -#define IDeckLinkVideoInputFrame_v7_3_GetFlags(This) \ - ( (This)->lpVtbl -> GetFlags(This) ) - -#define IDeckLinkVideoInputFrame_v7_3_GetBytes(This,buffer) \ - ( (This)->lpVtbl -> GetBytes(This,buffer) ) - -#define IDeckLinkVideoInputFrame_v7_3_GetTimecode(This,format,timecode) \ - ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) - -#define IDeckLinkVideoInputFrame_v7_3_GetAncillaryData(This,ancillary) \ - ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) - - -#define IDeckLinkVideoInputFrame_v7_3_GetStreamTime(This,frameTime,frameDuration,timeScale) \ - ( (This)->lpVtbl -> GetStreamTime(This,frameTime,frameDuration,timeScale) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoInputFrame_v7_3_INTERFACE_DEFINED__ */ - -#endif /* __DeckLinkAPI_LIBRARY_DEFINED__ */ - -/* Additional Prototypes for ALL interfaces */ - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - diff --git a/server/consumers/decklink/DeckLinkAPI_i.c b/server/consumers/decklink/DeckLinkAPI_i.c deleted file mode 100644 index b2e87a93f..000000000 --- a/server/consumers/decklink/DeckLinkAPI_i.c +++ /dev/null @@ -1,190 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the IIDs and CLSIDs */ - -/* link this file in with the server and any clients */ - - - /* File created by MIDL compiler version 7.00.0500 */ -/* at Wed Jan 13 09:58:01 2010 - */ -/* Compiler settings for .\consumers\declink\DeckLinkAPI.idl: - Oicf, W1, Zp8, env=Win32 (32b run) - protocol : dce , ms_ext, c_ext, robust - error checks: allocation ref bounds_check enum stub_data - VC __declspec() decoration level: - __declspec(uuid()), __declspec(selectany), __declspec(novtable) - DECLSPEC_UUID(), MIDL_INTERFACE() -*/ -//@@MIDL_FILE_HEADING( ) - -#pragma warning( disable: 4049 ) /* more than 64k source lines */ - - -#ifdef __cplusplus -extern "C"{ -#endif - - -#include -#include - -#ifdef _MIDL_USE_GUIDDEF_ - -#ifndef INITGUID -#define INITGUID -#include -#undef INITGUID -#else -#include -#endif - -#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ - DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) - -#else // !_MIDL_USE_GUIDDEF_ - -#ifndef __IID_DEFINED__ -#define __IID_DEFINED__ - -typedef struct _IID -{ - unsigned long x; - unsigned short s1; - unsigned short s2; - unsigned char c[8]; -} IID; - -#endif // __IID_DEFINED__ - -#ifndef CLSID_DEFINED -#define CLSID_DEFINED -typedef IID CLSID; -#endif // CLSID_DEFINED - -#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ - const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} - -#endif !_MIDL_USE_GUIDDEF_ - -MIDL_DEFINE_GUID(IID, LIBID_DeckLinkAPI,0xD864517A,0xEDD5,0x466D,0x86,0x7D,0xC8,0x19,0xF1,0xC0,0x52,0xBB); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoOutputCallback,0xE763A626,0x4A3C,0x49D1,0xBF,0x13,0xE7,0xAD,0x36,0x92,0xAE,0x52); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkInputCallback,0x31D28EE7,0x88B6,0x4CB1,0x89,0x7A,0xCD,0xBF,0x79,0xA2,0x64,0x14); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkMemoryAllocator,0xB36EB6E7,0x9D29,0x4AA8,0x92,0xEF,0x84,0x3B,0x87,0xA2,0x89,0xE8); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkAudioOutputCallback,0x403C681B,0x7F46,0x4A12,0xB9,0x93,0x2B,0xB1,0x27,0x08,0x4E,0xE6); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkIterator,0x74E936FC,0xCC28,0x4A67,0x81,0xA0,0x1E,0x94,0xE5,0x2D,0x4E,0x69); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkAPIInformation,0x7BEA3C68,0x730D,0x4322,0xAF,0x34,0x8A,0x71,0x52,0xB5,0x32,0xA4); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkDisplayModeIterator,0x455D741F,0x1779,0x4800,0x86,0xF5,0x0B,0x5D,0x13,0xD7,0x97,0x51); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkDisplayMode,0x87451E84,0x2B7E,0x439E,0xA6,0x29,0x43,0x93,0xEA,0x4A,0x85,0x50); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLink,0x62BFF75D,0x6569,0x4E55,0x8D,0x4D,0x66,0xAA,0x03,0x82,0x9A,0xBC); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkOutput,0x29228142,0xEB8C,0x4141,0xA6,0x21,0xF7,0x40,0x26,0x45,0x09,0x55); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkInput,0x300C135A,0x9F43,0x48E2,0x99,0x06,0x6D,0x79,0x11,0xD9,0x3C,0xF1); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkTimecode,0xEFB9BCA6,0xA521,0x44F7,0xBD,0x69,0x23,0x32,0xF2,0x4D,0x9E,0xE6); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrame,0xA8D8238E,0x6B18,0x4196,0x99,0xE1,0x5A,0xF7,0x17,0xB8,0x3D,0x32); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkMutableVideoFrame,0x46FCEE00,0xB4E6,0x43D0,0x91,0xC0,0x02,0x3A,0x7F,0xCE,0xB3,0x4F); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoInputFrame,0x9A74FA41,0xAE9F,0x47AC,0x8C,0xF4,0x01,0xF4,0x2D,0xD5,0x99,0x65); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrameAncillary,0x732E723C,0xD1A4,0x4E29,0x9E,0x8E,0x4A,0x88,0x79,0x7A,0x00,0x04); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkAudioInputPacket,0xE43D5870,0x2894,0x11DE,0x8C,0x30,0x08,0x00,0x20,0x0C,0x9A,0x66); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkScreenPreviewCallback,0x373F499D,0x4B4D,0x4518,0xAD,0x22,0x63,0x54,0xE5,0xA5,0x82,0x5E); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkGLScreenPreviewHelper,0xBA575CD9,0xA15E,0x497B,0xB2,0xC2,0xF9,0xAF,0xE7,0xBE,0x4E,0xBA); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkConfiguration,0xB8EAD569,0xB764,0x47F0,0xA7,0x3F,0xAE,0x40,0xDF,0x6C,0xBF,0x10); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkAttributes,0xABC11843,0xD966,0x44CB,0x96,0xE2,0xA1,0xCB,0x5D,0x31,0x35,0xC4); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkKeyer,0x89AFCAF5,0x65F8,0x421E,0x98,0xF7,0x96,0xFE,0x5F,0x5B,0xFB,0xA3); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkIterator,0xD9EDA3B3,0x2887,0x41FA,0xB7,0x24,0x01,0x7C,0xF1,0xEB,0x1D,0x37); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkGLScreenPreviewHelper,0xD398CEE7,0x4434,0x4CA3,0x9B,0xA6,0x5A,0xE3,0x45,0x56,0xB9,0x05); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkDisplayModeIterator_v7_1,0xB28131B6,0x59AC,0x4857,0xB5,0xAC,0xCD,0x75,0xD5,0x88,0x3E,0x2F); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkDisplayMode_v7_1,0xAF0CD6D5,0x8376,0x435E,0x84,0x33,0x54,0xF9,0xDD,0x53,0x0A,0xC3); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrame_v7_1,0x333F3A10,0x8C2D,0x43CF,0xB7,0x9D,0x46,0x56,0x0F,0xEE,0xA1,0xCE); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoInputFrame_v7_1,0xC8B41D95,0x8848,0x40EE,0x9B,0x37,0x6E,0x34,0x17,0xFB,0x11,0x4B); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkAudioInputPacket_v7_1,0xC86DE4F6,0xA29F,0x42E3,0xAB,0x3A,0x13,0x63,0xE2,0x9F,0x07,0x88); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoOutputCallback_v7_1,0xEBD01AFA,0xE4B0,0x49C6,0xA0,0x1D,0xED,0xB9,0xD1,0xB5,0x5F,0xD9); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkInputCallback_v7_1,0x7F94F328,0x5ED4,0x4E9F,0x97,0x29,0x76,0xA8,0x6B,0xDC,0x99,0xCC); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkOutput_v7_1,0xAE5B3E9B,0x4E1E,0x4535,0xB6,0xE8,0x48,0x0F,0xF5,0x2F,0x6C,0xE5); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkInput_v7_1,0x2B54EDEF,0x5B32,0x429F,0xBA,0x11,0xBB,0x99,0x05,0x96,0xEA,0xCD); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkInputCallback_v7_3,0xFD6F311D,0x4D00,0x444B,0x9E,0xD4,0x1F,0x25,0xB5,0x73,0x0A,0xD0); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkOutput_v7_3,0x271C65E3,0xC323,0x4344,0xA3,0x0F,0xD9,0x08,0xBC,0xB2,0x0A,0xA3); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkInput_v7_3,0x4973F012,0x9925,0x458C,0x87,0x1C,0x18,0x77,0x4C,0xDB,0xBE,0xCB); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoInputFrame_v7_3,0xCF317790,0x2894,0x11DE,0x8C,0x30,0x08,0x00,0x20,0x0C,0x9A,0x66); - -#undef MIDL_DEFINE_GUID - -#ifdef __cplusplus -} -#endif - - - diff --git a/server/consumers/decklink/DeckLinkAPI_v7_1.idl b/server/consumers/decklink/DeckLinkAPI_v7_1.idl deleted file mode 100644 index 20d4e5ff8..000000000 --- a/server/consumers/decklink/DeckLinkAPI_v7_1.idl +++ /dev/null @@ -1,160 +0,0 @@ -/* -LICENSE-START- -** Copyright (c) 2009 Blackmagic Design -** -** Permission is hereby granted, free of charge, to any person or organization -** obtaining a copy of the software and accompanying documentation covered by -** this license (the "Software") to use, reproduce, display, distribute, -** execute, and transmit the Software, and to prepare derivative works of the -** Software, and to permit third-parties to whom the Software is furnished to -** do so, all subject to the following: -** -** The copyright notices in the Software and this entire statement, including -** the above license grant, this restriction and the following disclaimer, -** must be included in all copies of the Software, in whole or in part, and -** all derivative works of the Software, unless such copies or derivative -** works are solely in the form of machine-executable object code generated by -** a source language processor. -** -** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -** DEALINGS IN THE SOFTWARE. -** -LICENSE-END- -*/ -/* DeckLinkAPI_v7_1.idl */ - - interface IDeckLinkDisplayModeIterator_v7_1; - interface IDeckLinkDisplayMode_v7_1; - interface IDeckLinkVideoFrame_v7_1; - interface IDeckLinkVideoInputFrame_v7_1; - interface IDeckLinkAudioInputPacket_v7_1; - - [object, uuid(B28131B6-59AC-4857-B5AC-CD75D5883E2F), - helpstring("IDeckLinkDisplayModeIterator_v7_1 enumerates over supported input/output display modes.")] - interface IDeckLinkDisplayModeIterator_v7_1 : IUnknown - { - HRESULT Next ([out] IDeckLinkDisplayMode_v7_1** deckLinkDisplayMode); - }; - - - [object, uuid(AF0CD6D5-8376-435E-8433-54F9DD530AC3), - helpstring("IDeckLinkDisplayMode_v7_1 represents a display mode")] - interface IDeckLinkDisplayMode_v7_1 : IUnknown - { - HRESULT GetName ([out] BSTR* name); - BMDDisplayMode GetDisplayMode (); - long GetWidth (); - long GetHeight (); - HRESULT GetFrameRate ([out] BMDTimeValue *frameDuration, [out] BMDTimeScale *timeScale); - }; - - [object, uuid(EBD01AFA-E4B0-49C6-A01D-EDB9D1B55FD9), - helpstring("IDeckLinkVideoOutputCallback. Frame completion callback.")] - interface IDeckLinkVideoOutputCallback_v7_1 : IUnknown - { - HRESULT ScheduledFrameCompleted ([in] IDeckLinkVideoFrame_v7_1* completedFrame, [in] BMDOutputFrameCompletionResult result); - }; - - [object, uuid(7F94F328-5ED4-4E9F-9729-76A86BDC99CC), - helpstring("IDeckLinkInputCallback_v7_1. Frame arrival callback.")] - interface IDeckLinkInputCallback_v7_1 : IUnknown - { - HRESULT VideoInputFrameArrived ([in] IDeckLinkVideoInputFrame_v7_1* videoFrame, [in] IDeckLinkAudioInputPacket_v7_1* audioPacket); - }; - - - [object, uuid(AE5B3E9B-4E1E-4535-B6E8-480FF52F6CE5), local, - helpstring("IDeckLinkOutput_v7_1. Created by QueryInterface from IDeckLink.")] - interface IDeckLinkOutput_v7_1 : IUnknown - { - HRESULT DoesSupportVideoMode (BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, [out] BMDDisplayModeSupport *result); - HRESULT GetDisplayModeIterator ([out] IDeckLinkDisplayModeIterator_v7_1 **iterator); - - // Video output - HRESULT EnableVideoOutput (BMDDisplayMode displayMode); - HRESULT DisableVideoOutput (); - - HRESULT SetVideoOutputFrameMemoryAllocator ([in] IDeckLinkMemoryAllocator* theAllocator); - HRESULT CreateVideoFrame (long width, long height, long rowBytes, BMDPixelFormat pixelFormat, BMDFrameFlags flags, IDeckLinkVideoFrame_v7_1** outFrame); - HRESULT CreateVideoFrameFromBuffer (void* buffer, long width, long height, long rowBytes, BMDPixelFormat pixelFormat, BMDFrameFlags flags, IDeckLinkVideoFrame_v7_1** outFrame); - - HRESULT DisplayVideoFrameSync (IDeckLinkVideoFrame_v7_1* theFrame); - HRESULT ScheduleVideoFrame (IDeckLinkVideoFrame_v7_1* theFrame, BMDTimeValue displayTime, BMDTimeValue displayDuration, BMDTimeScale timeScale); - HRESULT SetScheduledFrameCompletionCallback ([in] IDeckLinkVideoOutputCallback_v7_1* theCallback); - - // Audio output - HRESULT EnableAudioOutput (BMDAudioSampleRate sampleRate, BMDAudioSampleType sampleType, unsigned long channelCount); - HRESULT DisableAudioOutput (); - - HRESULT WriteAudioSamplesSync (void* buffer, unsigned long sampleFrameCount, [out] unsigned long *sampleFramesWritten); - - HRESULT BeginAudioPreroll (); - HRESULT EndAudioPreroll (); - HRESULT ScheduleAudioSamples (void* buffer, unsigned long sampleFrameCount, BMDTimeValue streamTime, BMDTimeScale timeScale, [out] unsigned long *sampleFramesWritten); - - HRESULT GetBufferedAudioSampleFrameCount ( [out] unsigned long *bufferedSampleCount); - HRESULT FlushBufferedAudioSamples (); - - HRESULT SetAudioCallback ( [in] IDeckLinkAudioOutputCallback* theCallback); - - // Output control - HRESULT StartScheduledPlayback (BMDTimeValue playbackStartTime, BMDTimeScale timeScale, double playbackSpeed); - HRESULT StopScheduledPlayback (BMDTimeValue stopPlaybackAtTime, BMDTimeValue *actualStopTime, BMDTimeScale timeScale); - HRESULT GetHardwareReferenceClock (BMDTimeScale desiredTimeScale, BMDTimeValue *elapsedTimeSinceSchedulerBegan); - }; - - [object, uuid(2B54EDEF-5B32-429F-BA11-BB990596EACD), - helpstring("IDeckLinkInput_v7_1. Created by QueryInterface from IDeckLink.")] - interface IDeckLinkInput_v7_1 : IUnknown - { - HRESULT DoesSupportVideoMode (BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, [out] BMDDisplayModeSupport *result); - HRESULT GetDisplayModeIterator ([out] IDeckLinkDisplayModeIterator_v7_1 **iterator); - - // Video input - HRESULT EnableVideoInput (BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, BMDVideoInputFlags flags); - HRESULT DisableVideoInput (); - - // Audio input - HRESULT EnableAudioInput (BMDAudioSampleRate sampleRate, BMDAudioSampleType sampleType, unsigned long channelCount); - HRESULT DisableAudioInput (); - HRESULT ReadAudioSamples (void* buffer, unsigned long sampleFrameCount, [out] unsigned long *sampleFramesRead, [out] BMDTimeValue *audioPacketTime, BMDTimeScale timeScale); - HRESULT GetBufferedAudioSampleFrameCount ( [out] unsigned long *bufferedSampleCount); - - // Input control - HRESULT StartStreams (); - HRESULT StopStreams (); - HRESULT PauseStreams (); - HRESULT SetCallback ([in] IDeckLinkInputCallback_v7_1* theCallback); - }; - - [object, uuid(333F3A10-8C2D-43CF-B79D-46560FEEA1CE), local, - helpstring("IDeckLinkVideoFrame_v7_1. Created by IDeckLinkVideoOutput::CreateVideoFrame.")] - interface IDeckLinkVideoFrame_v7_1 : IUnknown - { - long GetWidth (); - long GetHeight (); - long GetRowBytes (); - BMDPixelFormat GetPixelFormat (); - BMDFrameFlags GetFlags (); - HRESULT GetBytes (void* *buffer); - }; - - [object, uuid(C8B41D95-8848-40EE-9B37-6E3417FB114B), local, - helpstring("IDeckLinkVideoInputFrame_v7_1. Provided by the IDeckLinkVideoInput frame arrival callback.")] - interface IDeckLinkVideoInputFrame_v7_1 : IDeckLinkVideoFrame_v7_1 - { - HRESULT GetFrameTime (BMDTimeValue *frameTime, BMDTimeValue *frameDuration, BMDTimeScale timeScale); - }; - - [object, uuid(C86DE4F6-A29F-42E3-AB3A-1363E29F0788), local, - helpstring("IDeckLinkAudioInputPacket_v7_1. Provided by the IDeckLinkInput callback.")] - interface IDeckLinkAudioInputPacket_v7_1 : IUnknown - { - long GetSampleCount (); - HRESULT GetBytes (void* *buffer); - HRESULT GetAudioPacketTime (BMDTimeValue *packetTime, BMDTimeScale timeScale); - }; - diff --git a/server/consumers/decklink/DeckLinkAPI_v7_3.idl b/server/consumers/decklink/DeckLinkAPI_v7_3.idl deleted file mode 100644 index 682b2007b..000000000 --- a/server/consumers/decklink/DeckLinkAPI_v7_3.idl +++ /dev/null @@ -1,157 +0,0 @@ -/* -LICENSE-START- -** Copyright (c) 2009 Blackmagic Design -** -** Permission is hereby granted, free of charge, to any person or organization -** obtaining a copy of the software and accompanying documentation covered by -** this license (the "Software") to use, reproduce, display, distribute, -** execute, and transmit the Software, and to prepare derivative works of the -** Software, and to permit third-parties to whom the Software is furnished to -** do so, all subject to the following: -** -** The copyright notices in the Software and this entire statement, including -** the above license grant, this restriction and the following disclaimer, -** must be included in all copies of the Software, in whole or in part, and -** all derivative works of the Software, unless such copies or derivative -** works are solely in the form of machine-executable object code generated by -** a source language processor. -** -** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -** DEALINGS IN THE SOFTWARE. -** -LICENSE-END- -*/ - -/* Forward Declarations */ - -interface IDeckLinkInputCallback_v7_3; -interface IDeckLinkOutput_v7_3; -interface IDeckLinkInput_v7_3; -interface IDeckLinkVideoInputFrame_v7_3; - -/* End Forward Declarations */ - - -/* Interface IDeckLinkInputCallback - Frame arrival callback. */ - -[ - object, - uuid(FD6F311D-4D00-444B-9ED4-1F25B5730AD0), - helpstring("Frame arrival callback.") -] interface IDeckLinkInputCallback_v7_3 : IUnknown -{ - HRESULT VideoInputFormatChanged([in] BMDVideoInputFormatChangedEvents notificationEvents, [in] IDeckLinkDisplayMode *newDisplayMode, [in] BMDDetectedVideoInputFormatFlags detectedSignalFlags); - HRESULT VideoInputFrameArrived([in] IDeckLinkVideoInputFrame_v7_3 *videoFrame, [in] IDeckLinkAudioInputPacket *audioPacket); -}; - -/* End Interface IDeckLinkInputCallback */ - - -/* Interface IDeckLinkOutput - Created by QueryInterface from IDeckLink. */ - -[ - object, - uuid(271C65E3-C323-4344-A30F-D908BCB20AA3), - local, - helpstring("Created by QueryInterface from IDeckLink.") -] interface IDeckLinkOutput_v7_3 : IUnknown -{ - HRESULT DoesSupportVideoMode(BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, [out] BMDDisplayModeSupport *result); - HRESULT GetDisplayModeIterator([out] IDeckLinkDisplayModeIterator **iterator); - - HRESULT SetScreenPreviewCallback([in] IDeckLinkScreenPreviewCallback *previewCallback); - - /* Video Output */ - - HRESULT EnableVideoOutput(BMDDisplayMode displayMode, BMDVideoOutputFlags flags); - HRESULT DisableVideoOutput(void); - - HRESULT SetVideoOutputFrameMemoryAllocator([in] IDeckLinkMemoryAllocator *theAllocator); - HRESULT CreateVideoFrame(long width, long height, long rowBytes, BMDPixelFormat pixelFormat, BMDFrameFlags flags, [out] IDeckLinkMutableVideoFrame **outFrame); - HRESULT CreateAncillaryData(BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, [out] IDeckLinkVideoFrameAncillary **outBuffer); - - HRESULT DisplayVideoFrameSync([in] IDeckLinkVideoFrame *theFrame); - HRESULT ScheduleVideoFrame([in] IDeckLinkVideoFrame *theFrame, BMDTimeValue displayTime, BMDTimeValue displayDuration, BMDTimeScale timeScale); - HRESULT SetScheduledFrameCompletionCallback([in] IDeckLinkVideoOutputCallback *theCallback); - HRESULT GetBufferedVideoFrameCount([out] unsigned long *bufferedFrameCount); - - /* Audio Output */ - - HRESULT EnableAudioOutput(BMDAudioSampleRate sampleRate, BMDAudioSampleType sampleType, unsigned long channelCount, BMDAudioOutputStreamType streamType); - HRESULT DisableAudioOutput(void); - - HRESULT WriteAudioSamplesSync([in] void *buffer, unsigned long sampleFrameCount, [out] unsigned long *sampleFramesWritten); - - HRESULT BeginAudioPreroll(void); - HRESULT EndAudioPreroll(void); - HRESULT ScheduleAudioSamples([in] void *buffer, unsigned long sampleFrameCount, BMDTimeValue streamTime, BMDTimeScale timeScale, [out] unsigned long *sampleFramesWritten); - - HRESULT GetBufferedAudioSampleFrameCount([out] unsigned long *bufferedSampleFrameCount); - HRESULT FlushBufferedAudioSamples(void); - - HRESULT SetAudioCallback([in] IDeckLinkAudioOutputCallback *theCallback); - - /* Output Control */ - - HRESULT StartScheduledPlayback(BMDTimeValue playbackStartTime, BMDTimeScale timeScale, double playbackSpeed); - HRESULT StopScheduledPlayback(BMDTimeValue stopPlaybackAtTime, [out] BMDTimeValue *actualStopTime, BMDTimeScale timeScale); - HRESULT IsScheduledPlaybackRunning([out] BOOL *active); - HRESULT GetHardwareReferenceClock(BMDTimeScale desiredTimeScale, [out] BMDTimeValue *elapsedTimeSinceSchedulerBegan); -}; - -/* End Interface IDeckLinkOutput */ - -/* Interface IDeckLinkInput - Created by QueryInterface from IDeckLink. */ - -[ - object, - uuid(4973F012-9925-458C-871C-18774CDBBECB), - helpstring("Created by QueryInterface from IDeckLink.") -] interface IDeckLinkInput_v7_3 : IUnknown -{ - HRESULT DoesSupportVideoMode(BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, [out] BMDDisplayModeSupport *result); - HRESULT GetDisplayModeIterator([out] IDeckLinkDisplayModeIterator **iterator); - - HRESULT SetScreenPreviewCallback([in] IDeckLinkScreenPreviewCallback *previewCallback); - - /* Video Input */ - - HRESULT EnableVideoInput(BMDDisplayMode displayMode, BMDPixelFormat pixelFormat, BMDVideoInputFlags flags); - HRESULT DisableVideoInput(void); - HRESULT GetAvailableVideoFrameCount([out] unsigned long *availableFrameCount); - - /* Audio Input */ - - HRESULT EnableAudioInput(BMDAudioSampleRate sampleRate, BMDAudioSampleType sampleType, unsigned long channelCount); - HRESULT DisableAudioInput(void); - HRESULT GetAvailableAudioSampleFrameCount([out] unsigned long *availableSampleFrameCount); - - /* Input Control */ - - HRESULT StartStreams(void); - HRESULT StopStreams(void); - HRESULT PauseStreams(void); - HRESULT FlushStreams(void); - HRESULT SetCallback([in] IDeckLinkInputCallback_v7_3 *theCallback); -}; - -/* End Interface IDeckLinkInput */ - - -/* Interface IDeckLinkVideoInputFrame - Provided by the IDeckLinkVideoInput frame arrival callback. */ - -[ - object, - uuid(CF317790-2894-11DE-8C30-0800200C9A66), - local, - helpstring("Provided by the IDeckLinkVideoInput frame arrival callback.") -] interface IDeckLinkVideoInputFrame_v7_3 : IDeckLinkVideoFrame -{ - HRESULT GetStreamTime([out] BMDTimeValue *frameTime, [out] BMDTimeValue *frameDuration, BMDTimeScale timeScale); -}; - -/* End Interface IDeckLinkVideoInputFrame */ - diff --git a/server/consumers/decklink/DecklinkVideoConsumer.cpp b/server/consumers/decklink/DecklinkVideoConsumer.cpp deleted file mode 100644 index f29767aff..000000000 --- a/server/consumers/decklink/DecklinkVideoConsumer.cpp +++ /dev/null @@ -1,482 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\stdafx.h" - -#include "..\..\Application.h" -#include "DecklinkVideoConsumer.h" -#include "..\..\frame\FramePlaybackControl.h" -#include "..\..\frame\Frame.h" -#include "..\..\frame\FramePlaybackStrategy.h" -#include "DeckLinkAPI_h.h" -#include "..\..\utils\image\Image.hpp" -#include "..\..\utils\event.h" - -#include - -namespace caspar { -namespace decklink { - - -struct DecklinkVideoConsumer::Implementation : public IDeckLinkVideoOutputCallback -{ - //struct DecklinkFrameQueue : private caspar::utils::LockableObject - //{ - // std::queue availibleFrames; - // std::queue scheduledFrames; - - // void add_free(FramePtr pFrame) { - // availibleFrames.push(pFrame); - // } - //}; - - struct DecklinkFrameManager; - struct DecklinkVideoFrame : public Frame { - explicit DecklinkVideoFrame(DecklinkFrameManager* pFactory) : factoryID_(pFactory->ID()) { - IDeckLinkMutableVideoFrame* pFrame = NULL; - const FrameFormatDescription& fmtDesc = pFactory->pConsumerImpl_->GetFrameFormatDescription(); - if(pFactory->pConsumerImpl_->pDecklinkOutput_->CreateVideoFrame(fmtDesc.width, fmtDesc.height, fmtDesc.size/fmtDesc.height, bmdFormat8BitBGRA, bmdFrameFlagDefault, &pFrame) != S_OK) { - throw std::exception("DECKLINK: Failed to create frame"); - } - pDecklinkFrame_ = pFrame; - pFrame->Release(); - - if(pDecklinkFrame_->GetBytes((void**)&pBytes_) != S_OK) - throw std::exception("DECKLINK: Failed to get bytes to frame"); - } - virtual unsigned char* GetDataPtr() const { - HasVideo(true); - return pBytes_; - } - virtual bool HasValidDataPtr() const { - return true; - } - - virtual unsigned int GetDataSize() const { - return pDecklinkFrame_->GetRowBytes() * pDecklinkFrame_->GetHeight(); - } - virtual FrameMetadata GetMetadata() const { - IDeckLinkMutableVideoFrame* pFramePtr = pDecklinkFrame_; - return reinterpret_cast(pFramePtr); - } - const utils::ID& FactoryID() const { - return factoryID_; - } - - utils::ID factoryID_; - CComPtr pDecklinkFrame_; - unsigned char* pBytes_; - }; - - struct DecklinkPlaybackStrategy : public IFramePlaybackStrategy - { - explicit DecklinkPlaybackStrategy(Implementation* pConsumerImpl) : pConsumerImpl_(pConsumerImpl), currentReservedFrameIndex_(0), totalFramesScheduled_(0) - { - for(int i = 0; i<4; ++i) { - reservedFrames_.push_back(pConsumerImpl_->pFrameManager_->CreateReservedFrame()); - } - } - - FrameManagerPtr GetFrameManager() - { - return pConsumerImpl_->pFrameManager_; - } - - FramePtr GetReservedFrame() - { - FramePtr pResult; - if(reservedFrames_.size() > currentReservedFrameIndex_) { - pResult = reservedFrames_[currentReservedFrameIndex_]; - currentReservedFrameIndex_ = (currentReservedFrameIndex_+1) & 3; - } - return pResult; - } - - void DisplayFrame(Frame* pFrame) - { - if(pFrame != NULL && pFrame->HasValidDataPtr()) { - if(GetFrameManager()->Owns(*pFrame)) { - DoRender(pFrame); - } - else { - FramePtr pTempFrame = GetReservedFrame(); - if(pTempFrame && pFrame->GetDataSize() == pTempFrame->GetDataSize()) { - utils::image::Copy(pTempFrame->GetDataPtr(), pFrame->GetDataPtr(), pTempFrame->GetDataSize()); - DoRender(pTempFrame.get()); - } - else - LOG << TEXT("DECKLINK: Failed to get reserved frame"); - } - } - else { - LOG << TEXT("DECKLINK: Tried to render frame with no data"); - } - } - void DoRender(Frame* pFrame) { - static DWORD lastTime = 0; - static bool bDoLog = true; - DWORD timediff = timeGetTime() - lastTime; - if(timediff < 30) { - Sleep(40 - timediff); - lastTime += 40; - } - else - lastTime = timeGetTime(); - - if(pConsumerImpl_->pDecklinkOutput_->DisplayVideoFrameSync(reinterpret_cast(pFrame->GetMetadata())) != S_OK) { - if(bDoLog) { - LOG << TEXT("DECKLINK: Failed to render frame"); - bDoLog = false; - } - } - else { - bDoLog = true; - } -// lastFrameID_ = pFrame->ID(); - } - - int totalFramesScheduled_; - std::vector reservedFrames_; - unsigned int currentReservedFrameIndex_; - Implementation* pConsumerImpl_; - }; - friend struct DecklinkPlaybackStrategy; - - struct DecklinkFrameManager : public caspar::FrameManager - { - explicit DecklinkFrameManager(Implementation* pConsumerImpl) : pConsumerImpl_(pConsumerImpl) - { - pFrameManager_.reset(new SystemFrameManager(pConsumerImpl_->GetFrameFormatDescription())); - } - - FramePtr CreateFrame() { - return pFrameManager_->CreateFrame(); - } - - FramePtr CreateReservedFrame() { - return FramePtr(new DecklinkVideoFrame(this)); - } - - const FrameFormatDescription& GetFrameFormatDescription() const { - return pConsumerImpl_->GetFrameFormatDescription(); - } - - Implementation* pConsumerImpl_; - SystemFrameManagerPtr pFrameManager_; - }; - - typedef std::tr1::shared_ptr DecklinkFrameManagerPtr; - - CComPtr pDecklink_; - CComQIPtr pDecklinkOutput_; - CComQIPtr pDecklinkKeyer_; - - FramePlaybackControlPtr pPlaybackControl_; - DecklinkFrameManagerPtr pFrameManager_; - FrameFormat currentFormat_; - -// IDeckLinkMutableVideoFrame* pNextFrame_; - - explicit Implementation(CComPtr pDecklink) : pDecklink_(pDecklink), currentFormat_(FFormatPAL)//, pNextFrame_(NULL) - {} - - ~Implementation() - { - ReleaseDevice(); - } - - bool SetupDevice() - { - if(!pDecklink_) - return false; - - BSTR pModelName; - pDecklink_->GetModelName(&pModelName); - if(pModelName != NULL) - LOG << TEXT("DECKLINK: Modelname: ") << pModelName; - - pDecklinkOutput_ = pDecklink_; - if(pDecklinkOutput_ == NULL) { - LOG << TEXT("DECKLINK: Failed to get IDecklinkOutput interface"); - return false; - } - - tstring strDesiredFrameFormat = caspar::GetApplication()->GetSetting(TEXT("videomode")); - if(strDesiredFrameFormat.size() == 0) - strDesiredFrameFormat = TEXT("PAL"); - FrameFormat casparVideoFormat = caspar::GetVideoFormat(strDesiredFrameFormat); - unsigned long decklinkVideoFormat = GetDecklinkVideoFormat(casparVideoFormat); - if(decklinkVideoFormat == ULONG_MAX) { - LOG << "DECKLINK: Card does not support requested videoformat: " << strDesiredFrameFormat; - return false; - } - - currentFormat_ = casparVideoFormat; - - BMDDisplayModeSupport displayModeSupport; - if(FAILED(pDecklinkOutput_->DoesSupportVideoMode((BMDDisplayMode)decklinkVideoFormat, bmdFormat8BitBGRA, &displayModeSupport))) { - LOG << TEXT("DECKLINK: Card does not support requested videoformat"); - return false; - } - - pDecklinkOutput_->DisableAudioOutput(); - if(FAILED(pDecklinkOutput_->EnableVideoOutput((BMDDisplayMode)decklinkVideoFormat, bmdVideoOutputFlagDefault))) { - LOG << TEXT("DECKLINK: Could not enable video output"); - return false; - } - - pFrameManager_.reset(new DecklinkFrameManager(this)); - - if(GetApplication()->GetSetting(TEXT("internalkey")) == TEXT("true")) { - pDecklinkKeyer_ = pDecklink_; - if(pDecklinkKeyer_) { - bool bSuccess = true; - if(FAILED(pDecklinkKeyer_->Enable(FALSE))) { - LOG << TEXT("DECKLINK: Failed to enable internal keyer"); - bSuccess = false; - } - if(FAILED(pDecklinkKeyer_->SetLevel(255))) { - LOG << TEXT("DECKLINK: Keyer - Failed to set blend-level to max"); - bSuccess = false; - } - - if(bSuccess) - LOG << TEXT("DECKLINK: Successfully configured internal keyer"); - } - else { - LOG << TEXT("DECKLINK: Failed to get keyer-interface"); - } - } - else - { - pDecklinkKeyer_ = pDecklink_; - if(pDecklinkKeyer_) { - bool bSuccess = true; - if(FAILED(pDecklinkKeyer_->Enable(TRUE))) { - LOG << TEXT("DECKLINK: Failed to enable external keyer"); - bSuccess = false; - } - - if(bSuccess) - LOG << TEXT("DECKLINK: Successfully configured external keyer"); - } - else { - LOG << TEXT("DECKLINK: Failed to get keyer-interface"); - } - } - - pPlaybackControl_.reset(new FramePlaybackControl(FramePlaybackStrategyPtr(new DecklinkPlaybackStrategy(this)))); - pPlaybackControl_->Start(); - - LOG << TEXT("DECKLINK: Successfully initialized decklink for ") << strDesiredFrameFormat; - return true; - } - - bool ReleaseDevice() - { - if(pPlaybackControl_) - pPlaybackControl_->Stop(); - - if(pDecklinkKeyer_) { - pDecklinkKeyer_.Release(); - } - - if(pDecklinkOutput_) { - BOOL bIsRunning = FALSE; - pDecklinkOutput_->IsScheduledPlaybackRunning(&bIsRunning); - if(bIsRunning) - pDecklinkOutput_->StopScheduledPlayback(0, NULL, 0); - - pDecklinkOutput_->DisableVideoOutput(); - } - - return true; - } - - //void DoScheduleNextFrame() { - // static int frame = 0; - // static bool bLog = true; - // if(pDecklinkOutput_->ScheduleVideoFrame(pNextFrame_, frame++, 1, 25) != S_OK) { - // if(bLog) { - // LOG << TEXT("DECKLINK: Failed to display frame"); - // bLog = false; - // } - // } - // else { - // if(((frame-1) % 25) == 0) - // LOG << TEXT("DECKLINK: Scheduled frame ") << (frame-1); - // bLog = true; - // } - //} - - // IUnknown needs o a dummy implementation - virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) - { - if(ppv != NULL) { - if(iid == IID_IUnknown) { - (*ppv) = this; - return S_OK; - } - if(iid == IID_IDeckLinkVideoOutputCallback_v7_1) { - (*ppv) = (IDeckLinkVideoOutputCallback_v7_1*)this; - return S_OK; - } - if(iid == IID_IDeckLinkVideoOutputCallback) { - (*ppv) = (IDeckLinkVideoOutputCallback*)this; - return S_OK; - } - } - return E_NOINTERFACE; - } - virtual ULONG STDMETHODCALLTYPE AddRef() {return 1;} - virtual ULONG STDMETHODCALLTYPE Release() {return 1;} - - virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted(IDeckLinkVideoFrame* completedFrame, BMDOutputFrameCompletionResult result) { - //DoScheduleNextFrame(); - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE ScheduledPlaybackHasStopped() { - return S_OK; - } - - const FrameFormatDescription& GetFrameFormatDescription() const { - return FrameFormatDescription::FormatDescriptions[currentFormat_]; - } - - unsigned long GetDecklinkVideoFormat(FrameFormat fmt) { - switch(fmt) - { - case FFormatPAL: - return bmdModePAL; - - case FFormatNTSC: - return bmdModeNTSC; - - case FFormat576p2500: - return ULONG_MAX; //not supported - - case FFormat720p5000: - return bmdModeHD720p50; - - case FFormat720p5994: - return bmdModeHD720p5994; - - case FFormat720p6000: - return bmdModeHD720p60; - - case FFormat1080p2397: - return bmdModeHD1080p2398; - - case FFormat1080p2400: - return bmdModeHD1080p24; - - case FFormat1080i5000: - return bmdModeHD1080i50; - - case FFormat1080i5994: - return bmdModeHD1080i5994; - - case FFormat1080i6000: - return bmdModeHD1080i6000; - - case FFormat1080p2500: - return bmdModeHD1080p25; - - case FFormat1080p2997: - return bmdModeHD1080p2997; - - case FFormat1080p3000: - return bmdModeHD1080p30; - } - - return ULONG_MAX; - } -}; - -DecklinkVideoConsumer::DecklinkVideoConsumer(ImplementationPtr pImpl) : pImpl_(pImpl) -{} - -DecklinkVideoConsumer::~DecklinkVideoConsumer() -{} - -VideoConsumerPtr DecklinkVideoConsumer::Create() { - VideoConsumerPtr pResult; - - CComPtr pDecklinkIterator; - HRESULT result = pDecklinkIterator.CoCreateInstance(CLSID_CDeckLinkIterator); - if(FAILED(result)) { - LOG << TEXT("No Decklink drivers installed"); - return pResult; - } - - CComPtr pDecklink; - IDeckLink* pTempDecklink = NULL; - while(pDecklinkIterator->Next(&pTempDecklink) == S_OK) { - if(pDecklink == NULL) - pDecklink = pTempDecklink; - - if(pTempDecklink) - pTempDecklink->Release(); - pTempDecklink = NULL; - } - - if(pDecklink == NULL) { - LOG << TEXT("No Decklink card found"); - return pResult; - } - - ImplementationPtr pImpl(new Implementation(pDecklink)); - pResult.reset(new DecklinkVideoConsumer(pImpl)); - - if(pResult != 0 && pResult->SetupDevice(0) == false) - pResult.reset(); - - return pResult; -} - -IPlaybackControl* DecklinkVideoConsumer::GetPlaybackControl() const -{ - return pImpl_->pPlaybackControl_.get(); -} - -bool DecklinkVideoConsumer::SetupDevice(unsigned int deviceIndex) -{ - return (pImpl_) ? pImpl_->SetupDevice() : false; -} - -bool DecklinkVideoConsumer::ReleaseDevice() -{ - return (pImpl_) ? pImpl_->ReleaseDevice() : false; -} - -void DecklinkVideoConsumer::EnableVideoOutput(){} -void DecklinkVideoConsumer::DisableVideoOutput(){} - -const FrameFormatDescription& DecklinkVideoConsumer::GetFrameFormatDescription() const { - return pImpl_->GetFrameFormatDescription(); -} -const TCHAR* DecklinkVideoConsumer::GetFormatDescription() const { - return pImpl_->GetFrameFormatDescription().name; -} - - -} //namespace decklink -} //namespace caspar \ No newline at end of file diff --git a/server/consumers/decklink/DecklinkVideoConsumer.h b/server/consumers/decklink/DecklinkVideoConsumer.h deleted file mode 100644 index b4f94ae17..000000000 --- a/server/consumers/decklink/DecklinkVideoConsumer.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once -#include "..\..\VideoConsumer.h" -#include "..\..\MediaProducer.h" - -#include "..\..\utils\thread.h" -#include "..\..\utils\lockable.h" -#include "..\..\utils\Noncopyable.hpp" - -#include "..\..\frame\Frame.h" - -namespace caspar { -namespace decklink { - -class DecklinkVideoConsumer : public IVideoConsumer, private utils::LockableObject, utils::Noncopyable -{ - struct Implementation; - typedef std::tr1::shared_ptr ImplementationPtr; - ImplementationPtr pImpl_; - - explicit DecklinkVideoConsumer(ImplementationPtr pImpl); - -public: - virtual ~DecklinkVideoConsumer(); - - static VideoConsumerPtr Create(); - - virtual IPlaybackControl* GetPlaybackControl() const; - - virtual void EnableVideoOutput(); - virtual void DisableVideoOutput(); - virtual bool SetupDevice(unsigned int deviceIndex); - virtual bool ReleaseDevice(); - virtual const FrameFormatDescription& GetFrameFormatDescription() const; - virtual const TCHAR* GetFormatDescription() const; -}; - -} //namespace gdi -} //namespace caspar \ No newline at end of file diff --git a/server/frame/BitmapFrame.cpp b/server/frame/BitmapFrame.cpp deleted file mode 100644 index e8b6dd71a..000000000 --- a/server/frame/BitmapFrame.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\StdAfx.h" -#include "BitmapFrame.h" -#include "BitmapFrameManager.h" - -namespace caspar{ - -BitmapFrame::BitmapFrame(BitmapHolderPtr pBitmap, const utils::ID& factoryID) - : pBitmap_(pBitmap), factoryID_(factoryID) -{ -} - -BitmapFrame::BitmapFrame(const utils::ID& factoryID, HWND hWnd, size_t height, size_t width, void* memory) - : pBitmap_(new BitmapHolder(hWnd, height, width, memory)), factoryID_(factoryID) -{ -} - -BitmapFrame::~BitmapFrame() -{ -} - -unsigned int BitmapFrame::GetDataSize() const -{ - return pBitmap_->Size(); -} - -unsigned char* BitmapFrame::GetDataPtr() const -{ - if(pBitmap_ != 0) - { - HasVideo(true); - return pBitmap_->GetPtr(); - } - return 0; -} - -BitmapHolderPtr BitmapFrame::GetBitmap() const -{ - return pBitmap_; -} - -bool BitmapFrame::HasValidDataPtr() const -{ - return (pBitmap_ != 0 && pBitmap_->GetPtr() != 0); -} - -FrameMetadata BitmapFrame::GetMetadata() const -{ - return (pBitmap_ != 0) ? reinterpret_cast(pBitmap_->GetDC()) : 0; -} - -const utils::ID& BitmapFrame::FactoryID() const -{ - return factoryID_; -} - -HDC BitmapFrame::GetDC() const -{ - return pBitmap_->GetDC(); -} - -} \ No newline at end of file diff --git a/server/frame/BitmapFrame.h b/server/frame/BitmapFrame.h deleted file mode 100644 index 0bee32e28..000000000 --- a/server/frame/BitmapFrame.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _BITMAP_FRAME_ -#define _BITMAP_FRAME_ - -#include "..\utils\BitmapHolder.h" -#include "Frame.h" - -namespace caspar{ - -class BitmapFrame : public Frame -{ -public: - explicit BitmapFrame(BitmapHolderPtr bitmap, const utils::ID& factoryID); - BitmapFrame(const utils::ID& factoryID, HWND hWnd, size_t height, size_t width, void* memory = NULL); - virtual ~BitmapFrame(); - - virtual unsigned char* GetDataPtr() const; - virtual bool HasValidDataPtr() const; - virtual unsigned int GetDataSize() const; - virtual FrameMetadata GetMetadata() const; - - HDC GetDC() const; - BitmapHolderPtr GetBitmap() const; - - const utils::ID& FactoryID() const; - -private: - size_t size_; - BitmapHolderPtr pBitmap_; - utils::ID factoryID_; -}; -typedef std::tr1::shared_ptr BitmapFramePtr; - -} - -#endif - diff --git a/server/frame/BitmapFrameAdapter.cpp b/server/frame/BitmapFrameAdapter.cpp deleted file mode 100644 index 1ceb77063..000000000 --- a/server/frame/BitmapFrameAdapter.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\StdAfx.h" -#include "BitmapFrameAdapter.h" -#include "BitmapFrameManager.h" - -namespace caspar{ - -struct BitmapHolderAdapter : public caspar::BitmapHolder -{ - BitmapHolderAdapter(HWND hWnd, unsigned int width, unsigned int height, FramePtr pFrame) : BitmapHolder(hWnd, width, height, pFrame->GetDataPtr()), pFrame_(pFrame) - { - assert(pFrame->GetDataSize() == width*height*4); - } - FramePtr pFrame_; -}; - -BitmapFrameAdapter::BitmapFrameAdapter(HWND hWnd, unsigned int width, unsigned int height, FramePtr pFrame, const utils::ID& factoryID) : BitmapFrame(BitmapHolderPtr(new BitmapHolderAdapter(hWnd, width, height, pFrame)), factoryID) -{ -} - -BitmapFrameAdapter::~BitmapFrameAdapter() -{ -} - -} \ No newline at end of file diff --git a/server/frame/BitmapFrameAdapter.h b/server/frame/BitmapFrameAdapter.h deleted file mode 100644 index 5714fcfa6..000000000 --- a/server/frame/BitmapFrameAdapter.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _BITMAPADAPTER_FRAME_ -#define _BITMAPADAPTER_FRAME_ - -#include "..\utils\BitmapHolder.h" -#include "BitmapFrame.h" - -namespace caspar{ - -class BitmapFrameAdapter : public BitmapFrame -{ -public: - BitmapFrameAdapter(HWND hWnd, unsigned int width, unsigned int height, FramePtr pFrame, const utils::ID& factoryID); - virtual ~BitmapFrameAdapter(); -}; -typedef std::tr1::shared_ptr BitmapFrameAdapterPtr; - -} - -#endif - diff --git a/server/frame/BitmapFrameManager.cpp b/server/frame/BitmapFrameManager.cpp deleted file mode 100644 index 186a19b28..000000000 --- a/server/frame/BitmapFrameManager.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\stdafx.h" -#include "BitmapFrameManager.h" -#include "BitmapFrame.h" - -#include "..\utils\Lockable.h" -#include "..\utils\BitmapHolder.h" - -#include - -namespace caspar { - -struct BitmapFrameManager::Implementation -{ - - Implementation(BitmapFrameManager* self, const FrameFormatDescription& fmtDesc, HWND hWnd) : self_(self), fmtDesc_(fmtDesc), hWnd_(hWnd), pBitmaps_(new LockableBitmapVector()) - { - features_.push_back("BITMAP_FRAME"); - } - - FramePtr CreateFrame() - { - BitmapFramePtr pBitmapFrame; - { - LockableObject::Lock lock(*pBitmaps_); - if(!pBitmaps_->empty()) - { - pBitmapFrame = pBitmaps_->back(); - pBitmaps_->pop_back(); - } - } - - if(!pBitmapFrame) - pBitmapFrame = self_->CreateBitmapFrame(); - - class FrameDeallocator - { - public: - FrameDeallocator(BitmapFramePtr pBitmapFrame, const LockableBitmapVectorPtr pBitmaps) : pBitmapFrame_(pBitmapFrame), pBitmaps_(pBitmaps){} - void operator()(BitmapFrame*) - { - LockableObject::Lock lock(*pBitmaps_); - pBitmaps_->push_back(BitmapFramePtr(new BitmapFrame(pBitmapFrame_->GetBitmap(), pBitmapFrame_->FactoryID()))); - } - private: - LockableBitmapVectorPtr pBitmaps_; - BitmapFramePtr pBitmapFrame_; - }; - - return BitmapFramePtr(pBitmapFrame.get(), FrameDeallocator(pBitmapFrame, pBitmaps_)); - } - - const FrameFormatDescription& GetFrameFormatDescription() const - { - return fmtDesc_; - } - - bool HasFeature(const std::string& feature) const - { - return std::find(features_.begin(), features_.end(), feature) != features_.end(); - } - - BitmapFramePtr CreateBitmapFrame() - { - return BitmapFramePtr(new BitmapFrame(self_->ID(), hWnd_, fmtDesc_.width, fmtDesc_.height)); - } - - // TODO: need proper threading tools (R.N) - struct LockableBitmapVector : public std::vector, public LockableObject{}; - typedef std::tr1::shared_ptr LockableBitmapVectorPtr; - - LockableBitmapVectorPtr pBitmaps_; - - std::vector features_; - - const FrameFormatDescription fmtDesc_; - const HWND hWnd_; - - BitmapFrameManager* self_; -}; - -BitmapFrameManager::BitmapFrameManager(const FrameFormatDescription& fmtDesc, HWND hWnd) : pImpl_(new Implementation(this, fmtDesc, hWnd)) -{} - -BitmapFrameManager::~BitmapFrameManager() -{} - -FramePtr BitmapFrameManager::CreateFrame() -{ - return pImpl_->CreateFrame(); -} - -const FrameFormatDescription& BitmapFrameManager::GetFrameFormatDescription() const -{ - return pImpl_->GetFrameFormatDescription(); -} - -bool BitmapFrameManager::HasFeature(const std::string& feature) const -{ - return pImpl_->HasFeature(feature); -} - -BitmapFramePtr BitmapFrameManager::CreateBitmapFrame() -{ - return pImpl_->CreateBitmapFrame(); -} - -} //namespace caspar \ No newline at end of file diff --git a/server/frame/BitmapFrameManager.h b/server/frame/BitmapFrameManager.h deleted file mode 100644 index a30b3e14b..000000000 --- a/server/frame/BitmapFrameManager.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _CASPAR_BITMAPFRAMEMANAGER_H__ -#define _CASPAR_BITMAPFRAMEMANAGER_H__ - -#include "..\utils\Noncopyable.hpp" - -#include "FrameManager.h" -#include "BitmapFrame.h" - -namespace caspar { - -class BitmapFrameManager : public FrameManager, public utils::LockableObject, private utils::Noncopyable -{ -public: - BitmapFrameManager(const FrameFormatDescription& fmtDesc, HWND hWnd); - virtual ~BitmapFrameManager(); - - virtual FramePtr CreateFrame(); - virtual const FrameFormatDescription& GetFrameFormatDescription() const; - - virtual bool HasFeature(const std::string& feature) const; - -private: - - virtual BitmapFramePtr CreateBitmapFrame(); - - struct Implementation; - std::tr1::shared_ptr pImpl_; -}; -typedef std::tr1::shared_ptr BitmapFrameManagerPtr; - -} //namespace caspar -#endif \ No newline at end of file diff --git a/server/frame/BitmapFrameManagerAdapter.cpp b/server/frame/BitmapFrameManagerAdapter.cpp deleted file mode 100644 index 509c648d4..000000000 --- a/server/frame/BitmapFrameManagerAdapter.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\stdafx.h" -#include "BitmapFrameManagerAdapter.h" -#include "BitmapFrameAdapter.h" - -#include "..\utils\Lockable.h" -#include "..\utils\BitmapHolder.h" - -#include - -namespace caspar { - -struct BitmapFrameManagerAdapter::Implementation -{ - Implementation(BitmapFrameManagerAdapter* self, FrameManagerPtr pFrameManager, HWND hWnd) : self_(self), pFrameManager_(pFrameManager), hWnd_(hWnd) - { - } - - BitmapFramePtr CreateBitmapFrame() - { - return BitmapFramePtr(new BitmapFrameAdapter(hWnd_, pFrameManager_->GetFrameFormatDescription().width, pFrameManager_->GetFrameFormatDescription().height, pFrameManager_->CreateFrame(), self_->ID())); - } - - BitmapFrameManagerAdapter* self_; - const HWND hWnd_; - const FrameManagerPtr pFrameManager_; -}; - -BitmapFrameManagerAdapter::BitmapFrameManagerAdapter(FrameManagerPtr pFrameManager, HWND hWnd) : BitmapFrameManager(pFrameManager->GetFrameFormatDescription(), hWnd), pImpl_(new Implementation(this, pFrameManager, hWnd)) -{} - -BitmapFrameManagerAdapter::~BitmapFrameManagerAdapter() -{} - -BitmapFramePtr BitmapFrameManagerAdapter::CreateBitmapFrame() -{ - return pImpl_->CreateBitmapFrame(); -} - -} //namespace caspar \ No newline at end of file diff --git a/server/frame/BitmapFrameManagerAdapter.h b/server/frame/BitmapFrameManagerAdapter.h deleted file mode 100644 index 2d64ced60..000000000 --- a/server/frame/BitmapFrameManagerAdapter.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _CASPAR_BITMAPFRAMEMANAGERADAPTER_H__ -#define _CASPAR_BITMAPFRAMEMANAGERADAPTER_H__ - -#include "..\utils\Noncopyable.hpp" - -#include "BitmapFrameManager.h" - -namespace caspar { - -class BitmapFrameManagerAdapter : public BitmapFrameManager -{ -public: - BitmapFrameManagerAdapter(FrameManagerPtr pFrameManager, HWND hWnd); - - virtual ~BitmapFrameManagerAdapter(); - -private: - - virtual BitmapFramePtr CreateBitmapFrame(); - - struct Implementation; - std::tr1::shared_ptr pImpl_; -}; -typedef std::tr1::shared_ptr BitmapFrameManagerAdapterPtr; - -} //namespace caspar -#endif \ No newline at end of file diff --git a/server/frame/ClipInfo.h b/server/frame/ClipInfo.h deleted file mode 100644 index cc58811a6..000000000 --- a/server/frame/ClipInfo.h +++ /dev/null @@ -1,81 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\MediaProducer.h" -#include "frame.h" -#include "buffers/FrameBuffer.h" - -#pragma once - -namespace caspar { - -class FrameMediaController; -class ITransitionController; - -class ClipInfo -{ -public: - ClipInfo() : pFrameController_(0), pTransitionController_(0), lastFetchResult_(FetchWait), bStopped_(false) - {} - ClipInfo(MediaProducerPtr pFP, FrameMediaController* pController) : pFP_(pFP), pFrameController_(pController), pTransitionController_(0), lastFetchResult_(FetchWait), bStopped_(false) - {} - ClipInfo(MediaProducerPtr pFP, FrameMediaController* pController, ITransitionController* pTransitionController) : pFP_(pFP), pFrameController_(pController), pTransitionController_(pTransitionController), lastFetchResult_(FetchWait), bStopped_(false) - {} - - ClipInfo(const ClipInfo& clipInfo) : pFP_(clipInfo.pFP_), pFrameController_(clipInfo.pFrameController_), pTransitionController_(clipInfo.pTransitionController_), pLastFrame_(clipInfo.pLastFrame_), lastFetchResult_(clipInfo.lastFetchResult_), bStopped_(clipInfo.bStopped_) - {} - - ClipInfo& operator=(const ClipInfo& clipInfo) { - pFP_ = clipInfo.pFP_; - pFrameController_ = clipInfo.pFrameController_; - pTransitionController_ = clipInfo.pTransitionController_; - pLastFrame_ = clipInfo.pLastFrame_; - lastFetchResult_ = clipInfo.lastFetchResult_; - bStopped_ = clipInfo.bStopped_; - - return *this; - } - - bool IsEmpty() { - return (pFrameController_ == 0); - } - - ~ClipInfo() { - Clear(); - } - - void Clear() { - pFP_.reset(); - pFrameController_ = 0; - pTransitionController_ = 0; - pLastFrame_.reset(); - lastFetchResult_ = FetchWait; - bStopped_ = false; - } - - MediaProducerPtr pFP_; - FrameMediaController* pFrameController_; - ITransitionController* pTransitionController_; - FramePtr pLastFrame_; - FrameBufferFetchResult lastFetchResult_; - bool bStopped_; -}; - -} //namespace caspar \ No newline at end of file diff --git a/server/frame/Frame.cpp b/server/frame/Frame.cpp deleted file mode 100644 index 8cf282cff..000000000 --- a/server/frame/Frame.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\StdAfx.h" -#include "Frame.h" -#include "..\utils\allocator.h" -#include "..\utils\ID.h" -#include "..\utils\image\Image.hpp" -#include "FrameManager.h" -#include - -#include -#pragma intrinsic(__movsd, __stosd) - -#define DEFINE_VIDEOFORMATDESC(w, h, m, f, s) { (w), (h), (m), (f), (w)*(h)*4, s } - -namespace caspar { - -const FrameFormatDescription FrameFormatDescription::FormatDescriptions[FrameFormatCount] = { - DEFINE_VIDEOFORMATDESC(720, 576, Interlaced, 50, TEXT("PAL")), - DEFINE_VIDEOFORMATDESC(720, 486, Interlaced, 60/1.001, TEXT("NTSC")), - DEFINE_VIDEOFORMATDESC(720, 576, Progressive, 25, TEXT("576p2500")), - DEFINE_VIDEOFORMATDESC(1280, 720, Progressive, 50, TEXT("720p5000")), - DEFINE_VIDEOFORMATDESC(1280, 720, Progressive, 60/1.001, TEXT("720p5994")), - DEFINE_VIDEOFORMATDESC(1280, 720, Progressive, 60, TEXT("720p6000")), - DEFINE_VIDEOFORMATDESC(1920, 1080, Progressive, 24/1.001, TEXT("1080p2397")), - DEFINE_VIDEOFORMATDESC(1920, 1080, Progressive, 24, TEXT("1080p2400")), - DEFINE_VIDEOFORMATDESC(1920, 1080, Interlaced, 50, TEXT("1080i5000")), - DEFINE_VIDEOFORMATDESC(1920, 1080, Interlaced, 60/1.001, TEXT("1080i5994")), - DEFINE_VIDEOFORMATDESC(1920, 1080, Interlaced, 60, TEXT("1080i6000")), - DEFINE_VIDEOFORMATDESC(1920, 1080, Progressive, 25, TEXT("1080p2500")), - DEFINE_VIDEOFORMATDESC(1920, 1080, Progressive, 30/1.001, TEXT("1080p2997")), - DEFINE_VIDEOFORMATDESC(1920, 1080, Progressive, 30, TEXT("1080p3000")) -}; - - -FrameFormat GetVideoFormat(const tstring& strVideoMode) -{ - for(int index = 0; index < FrameFormatCount; ++index) - { - const FrameFormatDescription& fmtDesc = FrameFormatDescription::FormatDescriptions[index]; - - tstring strVideoModeUpper = strVideoMode; - tstring strFmtDescUpper = fmtDesc.name; - - std::transform(strVideoModeUpper.begin(), strVideoModeUpper.end(), strVideoModeUpper.begin(), toupper); - std::transform(strFmtDescUpper.begin(), strFmtDescUpper.end(), strFmtDescUpper.begin(), toupper); - - if(strVideoModeUpper == strFmtDescUpper) { - return (FrameFormat)index; - } - } - return FFormatInvalid; -} - -/////////////// -// Frame -Frame::Frame() : bHasVideo_(false) -{} - -Frame::~Frame() { -} - -} //namespace caspar \ No newline at end of file diff --git a/server/frame/Frame.h b/server/frame/Frame.h deleted file mode 100644 index b0928e7b2..000000000 --- a/server/frame/Frame.h +++ /dev/null @@ -1,124 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -#include "..\utils\event.h" -#include "..\utils\semaphore.h" -#include "..\utils\lockable.h" -#include "..\utils\ID.h" -#include "..\utils\Noncopyable.hpp" - -#include -#include - -namespace caspar { - - namespace audio { - class AudioDataChunk; - typedef std::tr1::shared_ptr AudioDataChunkPtr; - } - -enum VideoUpdateMode { - Interlaced = 0, - Progressive -}; - -enum FrameFormat { - FFormatPAL = 0, - FFormatNTSC, - FFormat576p2500, - FFormat720p5000, - FFormat720p5994, - FFormat720p6000, - FFormat1080p2397, - FFormat1080p2400, - FFormat1080i5000, - FFormat1080i5994, - FFormat1080i6000, - FFormat1080p2500, - FFormat1080p2997, - FFormat1080p3000, - FrameFormatCount, - FFormatInvalid -}; - -struct FrameFormatDescription -{ - int width; - int height; - VideoUpdateMode mode; - double fps; - unsigned int size; - const TCHAR* name; - - static const FrameFormatDescription FormatDescriptions[FrameFormatCount]; -}; - -FrameFormat GetVideoFormat(const tstring& strVideoMode); - -class Frame; -typedef std::tr1::shared_ptr FramePtr; - -class FrameManager; -typedef std::tr1::shared_ptr FrameManagerPtr; - -/////////////// -// Frame -typedef unsigned int* FrameMetadata; -typedef std::vector AudioDataChunkList; - -class Frame : public utils::Identifiable, private utils::Noncopyable -{ -protected: - Frame(); - virtual void HasVideo(bool bHasVideo) const { - bHasVideo_ = bHasVideo; - } - -public: - virtual ~Frame(); - - virtual unsigned char* GetDataPtr() const = 0; - virtual bool HasValidDataPtr() const = 0; - virtual unsigned int GetDataSize() const = 0; - virtual FrameMetadata GetMetadata() const { - return 0; - } - - virtual void AddAudioDataChunk(caspar::audio::AudioDataChunkPtr pChunk) { - audioData_.push_back(pChunk); - } - virtual AudioDataChunkList& GetAudioData() { - return audioData_; - } - - virtual bool HasVideo() const { - return bHasVideo_; - } - - virtual const utils::ID& FactoryID() const = 0; - -private: - mutable bool bHasVideo_; - AudioDataChunkList audioData_; -}; - -} //namespace caspar \ No newline at end of file diff --git a/server/frame/FrameManager.h b/server/frame/FrameManager.h deleted file mode 100644 index 972930931..000000000 --- a/server/frame/FrameManager.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _CASPAR_FRAMEMANAGER_H__ -#define _CASPAR_FRAMEMANAGER_H__ - -#include "Frame.h" - -#include -#include - -#include "..\utils\ID.h" - -namespace caspar { - -class FrameManager : public utils::Identifiable -{ -public: - virtual ~FrameManager() {} - virtual FramePtr CreateFrame() = 0; - virtual const FrameFormatDescription& GetFrameFormatDescription() const = 0; - virtual bool HasFeature(const std::string& feature) const - { - return false; - } - bool Owns(const Frame& frame) const - { - return (frame.FactoryID() == ID()); - } -}; -typedef std::tr1::shared_ptr FrameManagerPtr; - -} //namespace caspar - -#endif //_CASPAR_FRAMEMANAGER_H__ \ No newline at end of file diff --git a/server/frame/FrameMediaController.h b/server/frame/FrameMediaController.h deleted file mode 100644 index 7048e538e..000000000 --- a/server/frame/FrameMediaController.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _CASPAR_FRAMEMEDIACONTROLLER_H__ -#define _CASPAR_FRAMEMEDIACONTROLLER_H__ - -#include "..\MediaController.h" -#include "FrameManager.h" -#include "..\audio\AudioManager.h" - -#include - -namespace caspar { - -class FrameBuffer; -struct MediaProducerInfo; - -typedef std::vector SoundBufferWorkerList; - -class FrameMediaController : public IMediaController -{ - FrameMediaController(const FrameMediaController&); - FrameMediaController& operator=(const FrameMediaController&); - -public: - FrameMediaController() {} - virtual ~FrameMediaController() {} - - virtual bool Initialize(FrameManagerPtr pFrameManager) = 0; - - virtual FrameBuffer& GetFrameBuffer() = 0; - virtual bool GetProducerInfo(MediaProducerInfo*) { - return false; - } - - SoundBufferWorkerList& GetSoundBufferWorkers() { - return soundBufferWorkers_; - } - - void AddSoundBufferWorker(caspar::audio::SoundBufferWorkerPtr pSoundBufferWorker) { - soundBufferWorkers_.push_back(pSoundBufferWorker); - } - -private: - SoundBufferWorkerList soundBufferWorkers_; -}; - -} //namespace caspar - -#endif //_CASPAR_FRAMEMEDIACONTROLLER_H__ \ No newline at end of file diff --git a/server/frame/FramePlaybackControl.cpp b/server/frame/FramePlaybackControl.cpp deleted file mode 100644 index 3bef0120a..000000000 --- a/server/frame/FramePlaybackControl.cpp +++ /dev/null @@ -1,591 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\stdafx.h" -#include "..\VideoConsumer.h" -#include "FrameMediaController.h" -#include "FramePlaybackStrategy.h" -#include "FramePlaybackControl.h" -#include "..\cg\flashcgproxy.h" -#include "..\producers\composites\TransitionProducer.h" -#include "..\Application.h" -#include "..\MediaProducerInfo.h" -#include "..\utils\image\image.hpp" - -#include "..\monitor.h" - -namespace caspar { - -using namespace caspar::utils; - -using std::tr1::cref; -using std::tr1::bind; - -FramePlaybackControl::FramePlaybackControl(FramePlaybackStrategyPtr pStrategy) : pStrategy_(pStrategy), bPlaybackRunning_(false), isCGEmpty_(TRUE), -eventLoad_(FALSE, FALSE), eventRender_(FALSE, FALSE), eventStartPlayback_(FALSE, FALSE), eventPausePlayback_(FALSE, FALSE), eventStopPlayback_(FALSE, FALSE), eventStoppedPlayback_(FALSE, FALSE), pMonitor_(0) -{ - if(pStrategy_ == 0) - throw std::exception("No valid FramePlaybackStrategy provided"); - - pSystemFrameManager_.reset(new SystemFrameManager(pStrategy_->GetFrameManager()->GetFrameFormatDescription())); - if(pSystemFrameManager_ == 0) - throw std::exception("Failed to create SystemFrameManager"); -} - -FramePlaybackControl::~FramePlaybackControl() -{ - Stop(); -} - -void FramePlaybackControl::Start() -{ - worker_.Start(this); -} - -void FramePlaybackControl::Stop() -{ - worker_.Stop(); - backgroundClip_.Clear(); -} - - -//////////////////////////// -// IPlaybackControl methods -bool FramePlaybackControl::Load(MediaProducerPtr pFP, bool loop) -{ - if(pFP == 0) - return false; - - pFP->SetLoop(loop); - - FrameMediaController* pMediaController = dynamic_cast(pFP->QueryController(TEXT("FrameController"))); - if(pMediaController == 0) - return false; - - if(!pMediaController->Initialize(pStrategy_->GetFrameManager())) - return false; - - GetApplication()->GetAudioManager()->CueAudio(pMediaController); - - eventStopPlayback_.Set(); - - { - Lock lock(*this); - backgroundClip_ = ClipInfo(pFP, pMediaController); - eventLoad_.Set(); - } - - return true; -} - -bool FramePlaybackControl::LoadBackground(MediaProducerPtr pFP, const TransitionInfo& transitionInfo, bool loop) -{ - MediaProducerPtr pMediaProducer; - if(pFP == 0) - return false; - - pFP->SetLoop(loop); - - ITransitionController* pTransitionController = 0; - if(transitionInfo.type_ != Cut && transitionInfo.duration_ > 0) { - //prepare transition - TransitionProducerPtr pTransitionProducer(new TransitionProducer(pFP, transitionInfo, pStrategy_->GetFrameManager()->GetFrameFormatDescription())); - pTransitionController = pTransitionProducer.get(); - pMediaProducer = pTransitionProducer; - } - else { - pMediaProducer = pFP; - } - - FrameMediaController* pMediaController = dynamic_cast(pMediaProducer->QueryController(TEXT("FrameController"))); - if(pMediaController == 0) - return false; - - if(!pMediaController->Initialize(pStrategy_->GetFrameManager())) - return false; - - GetApplication()->GetAudioManager()->CueAudio(pMediaController); - - { - Lock lock(*this); - backgroundClip_ = ClipInfo(pMediaProducer, pMediaController, pTransitionController); - } - - return true; -} - -bool FramePlaybackControl::Play() -{ - if(!backgroundClip_.IsEmpty()) { - eventStartPlayback_.Set(); - } - else { - if(!bPlaybackRunning_) { - LOG << LogLevel::Verbose << TEXT("Playing active clip"); - eventStartPlayback_.Set(); - } - else { - LOG << LogLevel::Verbose << TEXT("Failed to play. Already playing"); - return false; - } - } - - return true; -} - -//bool FramePlaybackControl::Pause() -//{ -// eventPausePlayback_.Set(); -// return true; -//} - -bool FramePlaybackControl::StopPlayback(bool block) -{ - eventStopPlayback_.Set(); - - if(block) - { - if(::WaitForSingleObject(this->eventStoppedPlayback_, 1000) != WAIT_OBJECT_0) - return false; - } - - if(pMonitor_) - pMonitor_->Inform(STOPPED); - - return true; -} - -bool FramePlaybackControl::IsRunning() -{ - return bPlaybackRunning_; -} - -bool FramePlaybackControl::Param(const tstring& param) -{ - return false; -} - - -//////////////////////////// -// ICGControl methods -void FramePlaybackControl::Add(int layer, const tstring& templateName, bool playOnLoad, const tstring& label, const tstring& data) { - if(isCGEmpty_ != FALSE) { - CG::FlashCGProxyPtr pNewCGProducer = CG::FlashCGProxy::Create(pMonitor_); - if(pNewCGProducer) { - if(pNewCGProducer->Initialize(pSystemFrameManager_)) { - taskQueue_.push_back(bind(&FramePlaybackControl::DoResetCGProducer, this, pNewCGProducer)); - } - else { - LOG << "Frameplayback: Failed to initialize new CGProducer"; - return; - } - } - } - - //TODO: don't use bind to generate functor with string-arguments. Does it even work with const-reference parameters? - taskQueue_.push_back(bind(&FramePlaybackControl::DoAdd, this, layer, tstring(templateName), playOnLoad, tstring(label), tstring(data))); -} -void FramePlaybackControl::Remove(int layer) { - taskQueue_.push_back(bind(&FramePlaybackControl::DoRemove, this, layer)); -} -void FramePlaybackControl::Clear() { - taskQueue_.push_back(bind(&FramePlaybackControl::DoClear, this)); -} -void FramePlaybackControl::LoadEmpty() { - taskQueue_.push_back(bind(&FramePlaybackControl::DoLoadEmpty, this)); -} -void FramePlaybackControl::Play(int layer) { - taskQueue_.push_back(bind(&FramePlaybackControl::DoPlay, this, layer)); -} -void FramePlaybackControl::Stop(int layer, unsigned int mixOutDuration) { - taskQueue_.push_back(bind(&FramePlaybackControl::DoStop, this, layer, mixOutDuration)); -} -void FramePlaybackControl::Next(int layer) { - taskQueue_.push_back(bind(&FramePlaybackControl::DoNext, this, layer)); -} -void FramePlaybackControl::Update(int layer, const tstring& data) { - //NOTE: don't use bind to generate functor with string-arguments. Does it even work with const-reference parameters? - taskQueue_.push_back(bind(&FramePlaybackControl::DoUpdate, this, layer, tstring(data))); -} -void FramePlaybackControl::Invoke(int layer, const tstring& label) { - //NOTE: don't use bind to generate functor with string-arguments. Does it even work with const-reference parameters? - taskQueue_.push_back(bind(&FramePlaybackControl::DoInvoke, this, layer, tstring(label))); -} - -//////////////////////////// -// IRunnable methods -void FramePlaybackControl::Run(HANDLE stopEvent) -{ - const int WaitHandleCount = 8; - - HANDLE waitHandles[WaitHandleCount] = { stopEvent, eventStopPlayback_, eventStartPlayback_, eventPausePlayback_, eventLoad_, taskQueue_.GetWaitEvent(), eventRender_, 0 }; - - bool bQuit = false, bSingleFrame = false, bPureCG = false; - while(!bQuit) - { - if((bPlaybackRunning_ || bSingleFrame) && !activeClip_.IsEmpty()) { - waitHandles[WaitHandleCount - 1] = activeClip_.pFrameController_->GetFrameBuffer().GetWaitHandle(); - bPureCG = false; - } - else if(pCGProducer_) { - waitHandles[WaitHandleCount - 1] = pCGProducer_->GetFrameBuffer().GetWaitHandle(); - bPureCG = true; - } - else - waitHandles[WaitHandleCount - 1] = 0; - - int realWaitHandleCount = (WaitHandleCount-1); - if(waitHandles[WaitHandleCount - 1] != 0) - ++realWaitHandleCount; - - DWORD waitResult = WaitForMultipleObjects(realWaitHandleCount, waitHandles, FALSE, 2500); - switch(waitResult) { - case WAIT_OBJECT_0: //stopEvent - bQuit = true; - break; - - case WAIT_OBJECT_0 + 1: //stopPlayback - DoStopPlayback(waitHandles[WaitHandleCount - 1]); - break; - - case WAIT_OBJECT_0 + 2: //startPlayback - if(DoStartPlayback(waitHandles[WaitHandleCount - 1])) - bSingleFrame = true; - break; - - case WAIT_OBJECT_0 + 3: //pausePlayback - //DoPausePlayback(); - break; - - case WAIT_OBJECT_0 + 4: //load - if(DoLoad(waitHandles[WaitHandleCount - 1])) - bSingleFrame = true; - break; - - case WAIT_OBJECT_0 + 5: //cgtask waitEvent - { - Task task; - taskQueue_.pop_front(task); - if(task) - task(); - } - break; - - case WAIT_OBJECT_0 + 6: //render - DoRender(waitHandles[WaitHandleCount - 1], false); - break; - - case WAIT_OBJECT_0 + 7: //frame availible - if(!bPureCG) { - if(DoGetFrame(waitHandles[WaitHandleCount - 1], bSingleFrame)) - DoRender(waitHandles[WaitHandleCount - 1], false); - bSingleFrame = false; - } - else { - DoRender(waitHandles[WaitHandleCount - 1], true); - } - break; - - case WAIT_TIMEOUT: - break; - - case WAIT_FAILED: - bQuit = true; - LOG << LogLevel::Critical << TEXT("Wait failed in FramePlayback. Aborting"); - break; - } - } - - activeClip_.Clear(); -} - -bool FramePlaybackControl::DoStartPlayback(HANDLE& handle) -{ - bool bForceUpdate = false; - - { - Lock lock(*this); - - bPlaybackRunning_ = true; - if(!backgroundClip_.IsEmpty()) - { - if(backgroundClip_.pTransitionController_ != 0) { - if(!backgroundClip_.pTransitionController_->Start(activeClip_)) { - backgroundClip_.lastFetchResult_ = FetchEOF; - bForceUpdate = true; - } - } - activeClip_ = backgroundClip_; - backgroundClip_.Clear(); - } - } - - if(pMonitor_) - pMonitor_->Inform(PLAY); - - return bForceUpdate; -} - -void FramePlaybackControl::DoStopPlayback(HANDLE& handle) -{ - activeClip_.lastFetchResult_ = FetchEOF; - if(!activeClip_.IsEmpty()) - GetApplication()->GetAudioManager()->StopAudio(activeClip_.pFrameController_); - - while(!frameQueue_.empty()) - frameQueue_.pop(); - - bPlaybackRunning_ = false; - this->eventStoppedPlayback_.Set(); -} - -bool FramePlaybackControl::DoLoad(HANDLE& handle) -{ - Lock lock(*this); - - if(!backgroundClip_.IsEmpty()) - { - activeClip_ = backgroundClip_; - backgroundClip_.Clear(); - return true; - } - - return false; -} - -void FramePlaybackControl::DoLoadEmpty() -{ - this->emptyProducer_ = GetApplication()->GetColorMediaManager()->CreateProducer(TEXT("#00000000")); - this->Load(this->emptyProducer_, false); -} - -void FramePlaybackControl::OnCGEmpty() { - InterlockedExchange(&isCGEmpty_, TRUE); - LOG << LogLevel::Debug << TEXT("Frameplayback: Flagged CGProducer as empty"); -} - -void FramePlaybackControl::DoResetCGProducer(CG::FlashCGProxyPtr pNewCGProducer) { - if(isCGEmpty_ != FALSE) { - LOG << LogLevel::Debug << TEXT("Frameplayback: Using new CGProducer"); - pCGProducer_ = pNewCGProducer; - if(pCGProducer_) { - InterlockedExchange(&isCGEmpty_, FALSE); - pCGProducer_->SetEmptyAlert(bind(&FramePlaybackControl::OnCGEmpty, this)); - } - } -} - -void FramePlaybackControl::DoAdd(int layer, tstring templateName, bool playOnLoad, tstring label, tstring data) { - if(pCGProducer_) - pCGProducer_->Add(layer, templateName, playOnLoad, label, data); -} - -void FramePlaybackControl::DoRemove(int layer) { - if(pCGProducer_) - pCGProducer_->Remove(layer); -} - - -void FramePlaybackControl::DoClear() { - if(pCGProducer_) - pCGProducer_->Stop(); - else { - OnCGEmpty(); - } -} - -void FramePlaybackControl::DoPlay(int layer) { - if(pCGProducer_) - pCGProducer_->Play(layer); -} - -void FramePlaybackControl::DoStop(int layer, unsigned int mixOutDuration) { - if(pCGProducer_) - pCGProducer_->Stop(layer, mixOutDuration); -} - -void FramePlaybackControl::DoNext(int layer) { - if(pCGProducer_) - pCGProducer_->Next(layer); -} - -void FramePlaybackControl::DoUpdate(int layer, tstring data) { - if(pCGProducer_) - pCGProducer_->Update(layer, data); -} - -void FramePlaybackControl::DoInvoke(int layer, tstring label) { - if(pCGProducer_) - pCGProducer_->Invoke(layer, label); -} - -bool FramePlaybackControl::DoGetFrame(HANDLE& handle, bool bSingleFrame) -{ - bool bDoRender = false; - if(!activeClip_.IsEmpty()) - { - bool bEOF = false; - FramePtr pFrame = activeClip_.pFrameController_->GetFrameBuffer().front(); - - if(pFrame != 0) - { - activeClip_.pLastFrame_ = pFrame; - - frameQueue_.push(pFrame); - if(frameQueue_.size() >= 3) - bDoRender = true; - - //Queue audio in the audioplayback-worker - if(!bSingleFrame) { - GetApplication()->GetAudioManager()->PushAudioData(activeClip_.pFrameController_, pFrame); - - //check for end of file - activeClip_.lastFetchResult_ = activeClip_.pFrameController_->GetFrameBuffer().pop_front(); - if(activeClip_.lastFetchResult_ == FetchEOF) { - bEOF = true; - } - } - else - bDoRender = true; - } - else { - activeClip_.lastFetchResult_ = FetchEOF; - bEOF = true; - } - - if(bEOF) { - //this producer is finnished, check if we should continue with another - bPlaybackRunning_ = false; - activeClip_.bStopped_ = true; - - MediaProducerPtr pFollowingProducer(activeClip_.pFP_->GetFollowingProducer()); - if(pFollowingProducer != 0) { - FrameMediaController* pMediaController = dynamic_cast(pFollowingProducer->QueryController(TEXT("FrameController"))); - if(pMediaController != 0) - { - //reinitialize following producer with the correct framemanager - if(pMediaController->Initialize(pStrategy_->GetFrameManager())) - { - //make following producer current - activeClip_ = ClipInfo(pFollowingProducer, pMediaController); - activeClip_.pLastFrame_ = pFrame; - handle = activeClip_.pFrameController_->GetFrameBuffer().GetWaitHandle(); - bPlaybackRunning_ = true; - return bDoRender; - } - } - } - - if(pMonitor_) - pMonitor_->Inform(STOPPED); - - bDoRender = true; - } - } - - return bDoRender; -} - -void FramePlaybackControl::DoRender(HANDLE& handle, bool bPureCG) -{ - //Get next CG-frame if we have a CGProducer - FramePtr pCGFrame; - if(pCGProducer_) { - pCGFrame = pCGProducer_->GetFrameBuffer().front(); - FrameBufferFetchResult fetchResult = pCGProducer_->GetFrameBuffer().pop_front(); - if(pCGFrame != 0) { - pLastCGFrame_ = pCGFrame; - } - else if(fetchResult != FetchEOF) { - pCGFrame = pLastCGFrame_; - } - else { - pCGProducer_.reset(); - LOG << LogLevel::Debug << TEXT("Frameplayback: Cleared CGProducer"); - OnCGEmpty(); - pLastCGFrame_.reset(); - } - } - - //Get next video frame unless we're in PureCG-mode - FramePtr pVideoFrame; - if(!bPureCG || activeClip_.bStopped_) { - if(frameQueue_.size() > 0) { - pVideoFrame = frameQueue_.front(); - frameQueue_.pop(); - - if(pVideoFrame != 0) { - pLastVideoFrame_ = pVideoFrame; - } - } - else { - pVideoFrame = pLastVideoFrame_; - } - - if(activeClip_.bStopped_ && !frameQueue_.empty()) - eventRender_.Set(); - } - else { - pVideoFrame = pLastVideoFrame_; - } - - //combine and send to consumer - FramePtr pResultFrame; - if(pCGFrame) { - if(pVideoFrame && this->activeClip_.pFP_ != this->emptyProducer_) { - pResultFrame = pStrategy_->GetReservedFrame(); - if(pResultFrame) { - utils::image::PreOver(pResultFrame->GetDataPtr(), pVideoFrame->GetDataPtr(), pCGFrame->GetDataPtr(), pResultFrame->GetDataSize()); - } - } - else - pResultFrame = pCGFrame; - } - else - pResultFrame = pVideoFrame; - - if(pResultFrame) - pStrategy_->DisplayFrame(pResultFrame.get()); - else if(bPureCG) { - pResultFrame = pStrategy_->GetReservedFrame(); - if(pResultFrame) { - utils::image::Clear(pResultFrame->GetDataPtr(), pResultFrame->GetDataSize()); - pStrategy_->DisplayFrame(pResultFrame.get()); - } - } -} - -bool FramePlaybackControl::OnUnhandledException(const std::exception& ex) throw() -{ - bool bDoRestart = true; - - try - { - LOG << LogLevel::Critical << TEXT("UNHANDLED EXCEPTION in frameplayback thread. Message: ") << ex.what(); - } - catch(...) - { - bDoRestart = false; - } - - return bDoRestart; -} - -} //namespace caspar \ No newline at end of file diff --git a/server/frame/FramePlaybackControl.h b/server/frame/FramePlaybackControl.h deleted file mode 100644 index 6f50c6132..000000000 --- a/server/frame/FramePlaybackControl.h +++ /dev/null @@ -1,138 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _CASPAR_FRAMEPLAYBACKCONTROL_H__ -#define _CASPAR_FRAMEPLAYBACKCONTROL_H__ - -#pragma once - -#include -#include -#include "..\PlaybackControl.h" -#include "..\cg\cgcontrol.h" -#include "FramePlaybackStrategy.h" -#include "..\utils\thread.h" -#include "..\utils\lockable.h" -#include "..\utils\taskqueue.h" -#include "ClipInfo.h" -#include "systemframemanager.h" - -namespace caspar { - -namespace CG -{ -class FlashCGProxy; -typedef std::tr1::shared_ptr FlashCGProxyPtr; -} - -class FramePlaybackControl : public IPlaybackControl, public CG::ICGControl, public utils::IRunnable, private utils::LockableObject -{ -public: - explicit FramePlaybackControl(FramePlaybackStrategyPtr); - virtual ~FramePlaybackControl(); - - void Start(); - void Stop(); - - //IPlaybackControl - virtual bool Load(MediaProducerPtr pFP, bool loop); - virtual bool LoadBackground(MediaProducerPtr pFP, const TransitionInfo& transitionInfo, bool loop); - virtual bool Play(); - virtual void LoadEmpty(); - //virtual bool Pause(); - virtual bool StopPlayback(bool block = false); - virtual bool IsRunning(); - virtual bool Param(const tstring& param); - virtual CG::ICGControl* GetCGControl() { - return this; - } - virtual void SetMonitor(Monitor* pMonitor) { - pMonitor_ = pMonitor; - } - - //ICGControl - virtual void Add(int layer, const tstring& templateName, bool playOnLoad, const tstring& label, const tstring& data); - virtual void Remove(int layer); - virtual void Clear(); - virtual void Play(int layer); - virtual void Stop(int layer, unsigned int mixOutDuration); - virtual void Next(int layer); - virtual void Update(int layer, const tstring& data); - virtual void Invoke(int layer, const tstring& label); - - void DoResetCGProducer(CG::FlashCGProxyPtr pNewCGProducer); - void OnCGEmpty(); - - //IRunnable - virtual void Run(HANDLE stopEvent); - virtual bool OnUnhandledException(const std::exception& ex) throw(); - -private: - FramePlaybackStrategyPtr pStrategy_; - SystemFrameManagerPtr pSystemFrameManager_; - - volatile bool bPlaybackRunning_; - volatile LONG isCGEmpty_; - - utils::Thread worker_; - ClipInfo activeClip_; - ClipInfo backgroundClip_; - CG::FlashCGProxyPtr pCGProducer_; - Monitor* pMonitor_; - - utils::Event eventLoad_; - utils::Event eventRender_; - utils::Event eventStartPlayback_; - utils::Event eventPausePlayback_; - utils::Event eventStopPlayback_; - utils::Event eventStoppedPlayback_; - - std::queue frameQueue_; - - FramePtr pLastCGFrame_; - FramePtr pLastVideoFrame_; - - bool DoLoad(HANDLE& handle); - bool DoStartPlayback(HANDLE& handle); - void DoStopPlayback(HANDLE& handle); - void DoRender(HANDLE& handle, bool bPureCG); - bool DoGetFrame(HANDLE& handle, bool bForceVideoOutput); - - //cg-tasks - utils::TaskQueue taskQueue_; - - MediaProducerPtr emptyProducer_; - - void DoLoadEmpty(); - void DoAdd(int layer, tstring templateName, bool playOnLoad, tstring label, tstring data); - void DoRemove(int layer); - void DoClear(); - void DoPlay(int layer); - void DoStop(int layer, unsigned int mixOutDuration); - void DoNext(int layer); - void DoUpdate(int layer, tstring data); - void DoInvoke(int layer, tstring label); -}; - -typedef std::tr1::shared_ptr FramePlaybackControlPtr; - -} //namespace caspar - -#endif //_CASPAR_FRAMEPLAYBACKCONTROL_H__ \ No newline at end of file diff --git a/server/frame/FramePlaybackStrategy.h b/server/frame/FramePlaybackStrategy.h deleted file mode 100644 index 7ca5ee008..000000000 --- a/server/frame/FramePlaybackStrategy.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _CASPAR_FRAMEPLAYBACKSTRATEGY_H__ -#define _CASPAR_FRAMEPLAYBACKSTRATEGY_H__ - -#pragma once - -#include "FrameManager.h" -#include "..\utils\Noncopyable.hpp" - -namespace caspar { - -class Frame; -class IVideoConsumer; - -class IFramePlaybackStrategy : utils::Noncopyable -{ -public: - virtual ~IFramePlaybackStrategy() {} - - virtual FrameManagerPtr GetFrameManager() = 0; - virtual void DisplayFrame(Frame*) = 0; - virtual FramePtr GetReservedFrame() = 0; -}; -typedef std::tr1::shared_ptr FramePlaybackStrategyPtr; - -} //namespace caspar - -#endif //_CASPAR_FRAMEPLAYBACKSTRATEGY_H__ \ No newline at end of file diff --git a/server/frame/SystemFrame.cpp b/server/frame/SystemFrame.cpp deleted file mode 100644 index 1d8a664b8..000000000 --- a/server/frame/SystemFrame.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\stdafx.h" -#include "SystemFrame.h" - -namespace caspar { - - SystemFrame::SystemFrame(unsigned char* pData, unsigned int dataSize, const utils::ID& factoryID) : pData_(pData), dataSize_(dataSize), factoryID_(factoryID) - {} - - SystemFrame::~SystemFrame() - {} - - unsigned char* SystemFrame::GetDataPtr() const - { - if(pData_ != 0) - HasVideo(true); - return pData_; - } - bool SystemFrame::HasValidDataPtr() const - { - return (pData_ != 0); - } - unsigned int SystemFrame::GetDataSize() const - { - return dataSize_; - } - - const utils::ID& SystemFrame::FactoryID() const - { - return factoryID_; - } -} - diff --git a/server/frame/SystemFrame.h b/server/frame/SystemFrame.h deleted file mode 100644 index 923cc1335..000000000 --- a/server/frame/SystemFrame.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _SYSTEMFRAME_H_ -#define _SYSTEMFRAME_H_ - -#include "Frame.h" - -namespace caspar { - -class SystemFrame : public Frame -{ -public: - - SystemFrame(unsigned char* pData, unsigned int dataSize, const utils::ID& factoryID); - virtual ~SystemFrame(); - - virtual unsigned char* GetDataPtr() const; - virtual bool HasValidDataPtr() const; - virtual unsigned int GetDataSize() const; - - const utils::ID& FactoryID() const; - -private: - unsigned char* pData_; - unsigned int dataSize_; - utils::ID factoryID_; -}; - -} - -#endif \ No newline at end of file diff --git a/server/frame/SystemFrameManager.cpp b/server/frame/SystemFrameManager.cpp deleted file mode 100644 index 85e190ac9..000000000 --- a/server/frame/SystemFrameManager.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\stdafx.h" -#include "SystemFrameManager.h" - -#include "Frame.h" -#include "SystemFrame.h" - -namespace caspar { - -SystemFrameManager::LockableAllocatorAssoc SystemFrameManager::allocators; - -class SystemFrameManager::FrameDeallocator -{ -public: - FrameDeallocator(const utils::FixedAllocatorPtr& pAllocator) : pAllocator_(pAllocator){} - void operator()(Frame* frame) - { - pAllocator_->Deallocate(frame->GetDataPtr()); - delete frame; - } -private: - const utils::FixedAllocatorPtr pAllocator_; -}; - -SystemFrameManager::SystemFrameManager(const FrameFormatDescription& fmtDesc) : fmtDesc_(fmtDesc) -{ - utils::LockableObject::Lock lock(allocators); - utils::FixedAllocatorPtr& pAllocator = allocators[fmtDesc_.size]; - if(!pAllocator) - pAllocator.reset(new utils::FixedAllocator<>(fmtDesc_.size)); - pAllocator_ = pAllocator; -} - -SystemFrameManager::~SystemFrameManager() -{} - -FramePtr SystemFrameManager::CreateFrame() -{ - return FramePtr(new SystemFrame(static_cast(pAllocator_->Allocate()), fmtDesc_.size, this->ID()), FrameDeallocator(pAllocator_)); -} - -const FrameFormatDescription& SystemFrameManager::GetFrameFormatDescription() const -{ - return fmtDesc_; -} - - - -} //namespace caspar \ No newline at end of file diff --git a/server/frame/SystemFrameManager.h b/server/frame/SystemFrameManager.h deleted file mode 100644 index 4bd4f78e6..000000000 --- a/server/frame/SystemFrameManager.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _CASPAR_SYSTEMFRAMEMANAGER_H__ -#define _CASPAR_SYSTEMFRAMEMANAGER_H__ - -#pragma once - -#include "..\utils\Allocator.h" -#include "..\utils\Noncopyable.hpp" - -#include "FrameManager.h" - -#include - -namespace caspar { - -class Frame; -typedef std::tr1::shared_ptr FramePtr; - -/* - SystemFrameManager - - Changes: - 2009-06-14 (R.N) : Refactored, note: Is thread-safe since "FixedAllocator" is thread-safe -*/ - -class SystemFrameManager : public FrameManager, private utils::Noncopyable, private utils::LockableObject -{ -public: - explicit SystemFrameManager(const FrameFormatDescription&); - virtual ~SystemFrameManager(); - - virtual FramePtr CreateFrame(); - virtual const FrameFormatDescription& GetFrameFormatDescription() const; - -private: - class FrameDeallocator; - const FrameFormatDescription fmtDesc_; - utils::FixedAllocatorPtr pAllocator_; - - class LockableAllocatorAssoc : public std::tr1::unordered_map, public utils::LockableObject{}; - - static LockableAllocatorAssoc allocators; -}; -typedef std::tr1::shared_ptr SystemFrameManagerPtr; - -} //namespace caspar -#endif //_CASPAR_SYSTEMFRAMEMANAGER_H__ \ No newline at end of file diff --git a/server/frame/buffers/FrameBuffer.h b/server/frame/buffers/FrameBuffer.h deleted file mode 100644 index 858f8564d..000000000 --- a/server/frame/buffers/FrameBuffer.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _FRAME_BUFFER_H_ -#define _FRAME_BUFFER_H_ - -#include "../Frame.h" - -namespace caspar -{ - -enum FrameBufferFetchResult -{ - FetchDataAvailible, - FetchWait, - FetchEOF -}; - -class FrameBuffer -{ -public: - virtual ~FrameBuffer() - {} - - virtual FramePtr front() const = 0; - virtual FrameBufferFetchResult pop_front() = 0; - - virtual void push_back(FramePtr) = 0; - - virtual void clear() = 0; - - virtual HANDLE GetWaitHandle() const = 0; -}; - -} - -#endif \ No newline at end of file diff --git a/server/frame/buffers/MotionFrameBuffer.cpp b/server/frame/buffers/MotionFrameBuffer.cpp deleted file mode 100644 index 3bb04fc11..000000000 --- a/server/frame/buffers/MotionFrameBuffer.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "../../StdAfx.h" - -#include "MotionFrameBuffer.h" - -namespace caspar -{ - -struct MotionFrameBuffer::Implementation : private utils::LockableObject -{ - Implementation() : event_(TRUE, FALSE), writeWaitEvent_(TRUE, TRUE), maxLength_(3) - {} - - Implementation(unsigned int maxQueueLength) : event_(TRUE, FALSE), writeWaitEvent_(TRUE, TRUE), maxLength_(maxQueueLength) - {} - - ~Implementation() - {} - - FramePtr front() const - { - Lock lock(*this); - - FramePtr result; - if(frameQueue_.size() != 0) - result = frameQueue_.front(); - return result; - } - - FrameBufferFetchResult pop_front() - { - Lock lock(*this); - - if(frameQueue_.size() == 0) - { - event_.Reset(); - return FetchWait; - } - - if(frameQueue_.front() != 0) - { - frameQueue_.pop_front(); - - if(frameQueue_.size() < maxLength_) - writeWaitEvent_.Set(); - - if(frameQueue_.size() == 0) - { - event_.Reset(); - return FetchWait; - } - - if(frameQueue_.front() == 0) - return FetchEOF; - - return FetchDataAvailible; - } - return FetchEOF; - } - - void push_back(FramePtr pFrame) - { - Lock lock(*this); - - //assert(frameQueue_.size() <= maxLength_); - - frameQueue_.push_back(pFrame); - event_.Set(); - - if(frameQueue_.size() >= maxLength_) - writeWaitEvent_.Reset(); - } - - void clear() - { - Lock lock(*this); - - frameQueue_.clear(); - writeWaitEvent_.Set(); - event_.Reset(); - } - - HANDLE GetWaitHandle() const - { - return event_; - } - - HANDLE GetWriteWaitHandle() - { - return writeWaitEvent_; - } - - void SetCapacity(size_t capacity) - { - Lock lock(*this); - maxLength_ = capacity; - if(frameQueue_.size() < maxLength_) - writeWaitEvent_.Set(); - } - - unsigned int maxLength_; - utils::Event event_; - std::list frameQueue_; - utils::Event writeWaitEvent_; -}; - -MotionFrameBuffer::MotionFrameBuffer() : pImpl_(new Implementation()) -{} - -MotionFrameBuffer::MotionFrameBuffer(unsigned int maxQueueLength) : pImpl_(new Implementation(maxQueueLength)) -{} - -FramePtr MotionFrameBuffer::front() const -{ - return pImpl_->front(); -} - -FrameBufferFetchResult MotionFrameBuffer::pop_front() -{ - return pImpl_->pop_front(); -} - -void MotionFrameBuffer::push_back(FramePtr pFrame) -{ - pImpl_->push_back(pFrame); -} - -void MotionFrameBuffer::clear() -{ - pImpl_->clear(); -} - -HANDLE MotionFrameBuffer::GetWaitHandle() const -{ - return pImpl_->GetWaitHandle(); -} - -HANDLE MotionFrameBuffer::GetWriteWaitHandle() -{ - return pImpl_->GetWriteWaitHandle(); -} - -void MotionFrameBuffer::SetCapacity(size_t capacity) -{ - pImpl_->SetCapacity(capacity); -} - -} \ No newline at end of file diff --git a/server/frame/buffers/MotionFrameBuffer.h b/server/frame/buffers/MotionFrameBuffer.h deleted file mode 100644 index 0271f8513..000000000 --- a/server/frame/buffers/MotionFrameBuffer.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _MOTION_FRAME_BUFFER_H_ -#define _MOTION_FRAME_BUFFER_H_ - -#include "FrameBuffer.h" -#include "../Frame.h" - -#include "../../utils/event.h" - -#include - -namespace caspar -{ - -class MotionFrameBuffer : public FrameBuffer, private utils::Noncopyable -{ -public: - MotionFrameBuffer(); - explicit MotionFrameBuffer(unsigned int); - virtual ~MotionFrameBuffer(){} - - - virtual FramePtr front() const; - virtual FrameBufferFetchResult pop_front(); - virtual void push_back(FramePtr); - virtual void clear(); - void SetCapacity(size_t capacity); - - HANDLE GetWriteWaitHandle(); - virtual HANDLE GetWaitHandle() const; - -private: - struct Implementation; - std::tr1::shared_ptr pImpl_; -}; - -} - -#endif \ No newline at end of file diff --git a/server/frame/buffers/StaticFrameBuffer.cpp b/server/frame/buffers/StaticFrameBuffer.cpp deleted file mode 100644 index fe427a4ed..000000000 --- a/server/frame/buffers/StaticFrameBuffer.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "../../stdafx.h" - -#include "StaticFrameBuffer.h" - -namespace caspar -{ - -StaticFrameBuffer::StaticFrameBuffer() : event_(TRUE, FALSE) -{ -} -StaticFrameBuffer::~StaticFrameBuffer() -{ -} - -FramePtr StaticFrameBuffer::front() const -{ - tbb::spin_mutex::scoped_lock lock(mutex_); - return pFrame_; -} - -FrameBufferFetchResult StaticFrameBuffer::pop_front() -{ - tbb::spin_mutex::scoped_lock lock(mutex_); - if(pFrame_ == 0) - return FetchWait; - else - return FetchEOF; -} - -void StaticFrameBuffer::push_back(FramePtr pFrame) -{ - tbb::spin_mutex::scoped_lock lock(mutex_); - pFrame_ = pFrame; - event_.Set(); -} - -void StaticFrameBuffer::clear() -{ - tbb::spin_mutex::scoped_lock lock(mutex_); - event_.Reset(); - pFrame_.reset(); -} - -HANDLE StaticFrameBuffer::GetWaitHandle() const -{ - return event_; -} - -} \ No newline at end of file diff --git a/server/frame/buffers/StaticFrameBuffer.h b/server/frame/buffers/StaticFrameBuffer.h deleted file mode 100644 index e5f5b0ea5..000000000 --- a/server/frame/buffers/StaticFrameBuffer.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _STATIC_FRAME_BUFFER_ -#define _STATIC_FRAME_BUFFER_ - -#include "FrameBuffer.h" -#include "../Frame.h" - -#include - -namespace caspar -{ - -class StaticFrameBuffer : public FrameBuffer, private utils::Noncopyable -{ -public: - StaticFrameBuffer(); - virtual ~StaticFrameBuffer(); - - virtual FramePtr front() const; - virtual FrameBufferFetchResult pop_front(); - virtual void push_back(FramePtr); - virtual void clear(); - virtual HANDLE GetWaitHandle() const; - -private: - utils::Event event_; - FramePtr pFrame_; - mutable tbb::spin_mutex mutex_; -}; - -} - -#endif \ No newline at end of file diff --git a/server/io/AsyncEventServer.cpp b/server/io/AsyncEventServer.cpp deleted file mode 100644 index 5fdd76ac9..000000000 --- a/server/io/AsyncEventServer.cpp +++ /dev/null @@ -1,579 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -// AsyncEventServer.cpp: implementation of the AsyncEventServer class. -// -////////////////////////////////////////////////////////////////////// - -#include "..\stdafx.h" - -#include "AsyncEventServer.h" -#include "SocketInfo.h" - -#include -#include - -namespace caspar { -namespace IO { - -using namespace utils; - -#define CASPAR_MAXIMUM_SOCKET_CLIENTS (MAXIMUM_WAIT_OBJECTS-1) - -long AsyncEventServer::instanceCount_ = 0; -////////////////////////////// -// AsyncEventServer constructor -// PARAMS: port(TCP-port the server should listen to) -// COMMENT: Initializes the WinSock2 library -AsyncEventServer::AsyncEventServer(int port) : port_(port) -{ - if(instanceCount_ == 0) { - WSADATA wsaData; - if(WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) - throw std::exception("Error initializing WinSock2"); - else { - LOG << TEXT("WinSock2 Initialized.") << LogStream::Flush; - } - } - - InterlockedIncrement(&instanceCount_); -} - -///////////////////////////// -// AsyncEventServer destructor -AsyncEventServer::~AsyncEventServer() { - Stop(); - - InterlockedDecrement(&instanceCount_); - if(instanceCount_ == 0) - WSACleanup(); -} - -void AsyncEventServer::SetClientDisconnectHandler(ClientDisconnectEvent handler) { - socketInfoCollection_.onSocketInfoRemoved = handler; -} - -////////////////////////////// -// AsyncEventServer::Start -// RETURNS: true at successful startup -bool AsyncEventServer::Start() { - if(listenThread_.IsRunning()) - return false; - - socketInfoCollection_.Clear(); - - sockaddr_in sockAddr; - ZeroMemory(&sockAddr, sizeof(sockAddr)); - sockAddr.sin_family = AF_INET; - sockAddr.sin_addr.s_addr = INADDR_ANY; - sockAddr.sin_port = htons(port_); - - SOCKET listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - if(listenSocket == INVALID_SOCKET) { - LOG << TEXT("Failed to create listenSocket"); - return false; - } - - pListenSocketInfo_ = SocketInfoPtr(new SocketInfo(listenSocket, this)); - - if(WSAEventSelect(pListenSocketInfo_->socket_, pListenSocketInfo_->event_, FD_ACCEPT|FD_CLOSE) == SOCKET_ERROR) { - LOG << TEXT("Failed to enter EventSelect-mode for listenSocket"); - return false; - } - - if(bind(pListenSocketInfo_->socket_, (sockaddr*)&sockAddr, sizeof(sockAddr)) == SOCKET_ERROR) { - LOG << TEXT("Failed to bind listenSocket"); - return false; - } - - if(listen(pListenSocketInfo_->socket_, SOMAXCONN) == SOCKET_ERROR) { - LOG << TEXT("Failed to listen"); - return false; - } - - socketInfoCollection_.AddSocketInfo(pListenSocketInfo_); - - //start thread: the entrypoint is Run(EVENT stopEvent) - if(!listenThread_.Start(this)) { - LOG << TEXT("Failed to create ListenThread"); - return false; - } - - LOG << TEXT("Listener successfully initialized"); - return true; -} - -void AsyncEventServer::Run(HANDLE stopEvent) -{ - WSANETWORKEVENTS networkEvents; - - HANDLE waitHandlesCopy[MAXIMUM_WAIT_OBJECTS]; - waitHandlesCopy[0] = stopEvent; - - while(true) { - //Update local copy of the array of wait-handles if nessecery - if(socketInfoCollection_.IsDirty()) { - socketInfoCollection_.CopyCollectionToArray(&(waitHandlesCopy[1]), CASPAR_MAXIMUM_SOCKET_CLIENTS); - socketInfoCollection_.ClearDirty(); - } - - DWORD waitResult = WSAWaitForMultipleEvents(min(static_cast(socketInfoCollection_.Size()+1), MAXIMUM_WAIT_OBJECTS), waitHandlesCopy, FALSE, 1500, FALSE); - if(waitResult == WAIT_TIMEOUT) - continue; - else if(waitResult == WAIT_FAILED) - break; - else { - DWORD eventIndex = waitResult - WAIT_OBJECT_0; - - HANDLE waitEvent = waitHandlesCopy[eventIndex]; - SocketInfoPtr pSocketInfo; - - if(eventIndex == 0) //stopEvent - break; - else if(socketInfoCollection_.FindSocketInfo(waitEvent, pSocketInfo)) { - WSAEnumNetworkEvents(pSocketInfo->socket_, waitEvent, &networkEvents); - - if(networkEvents.lNetworkEvents & FD_ACCEPT) { - if(networkEvents.iErrorCode[FD_ACCEPT_BIT] == 0) - OnAccept(pSocketInfo); - else { - LOG << LogLevel::Debug << TEXT("OnAccept (ErrorCode: ") << networkEvents.iErrorCode[FD_ACCEPT_BIT] << TEXT(")"); - OnError(waitEvent, networkEvents.iErrorCode[FD_ACCEPT_BIT]); - } - } - - if(networkEvents.lNetworkEvents & FD_CLOSE) { - if(networkEvents.iErrorCode[FD_CLOSE_BIT] == 0) - OnClose(pSocketInfo); - else { - LOG << LogLevel::Debug << TEXT("OnClose (ErrorCode: ") << networkEvents.iErrorCode[FD_CLOSE_BIT] << TEXT(")"); - OnError(waitEvent, networkEvents.iErrorCode[FD_CLOSE_BIT]); - } - continue; - } - - if(networkEvents.lNetworkEvents & FD_READ) { - if(networkEvents.iErrorCode[FD_READ_BIT] == 0) - OnRead(pSocketInfo); - else { - LOG << LogLevel::Debug << TEXT("OnRead (ErrorCode: ") << networkEvents.iErrorCode[FD_READ_BIT] << TEXT(")"); - OnError(waitEvent, networkEvents.iErrorCode[FD_READ_BIT]); - } - } - - if(networkEvents.lNetworkEvents & FD_WRITE) { - if(networkEvents.iErrorCode[FD_WRITE_BIT] == 0) - OnWrite(pSocketInfo); - else { - LOG << LogLevel::Debug << TEXT("OnWrite (ErrorCode: ") << networkEvents.iErrorCode[FD_WRITE_BIT] << TEXT(")"); - OnError(waitEvent, networkEvents.iErrorCode[FD_WRITE_BIT]); - } - } - } - else { - //Could not find the waitHandle in the SocketInfoCollection. - //It must have been removed during the last call to WSAWaitForMultipleEvents - } - } - } -} - -bool AsyncEventServer::OnUnhandledException(const std::exception& ex) throw() { - bool bDoRestart = true; - - try - { - LOG << TEXT("UNHANDLED EXCEPTION in TCPServers listeningthread. Message: ") << ex.what(); - } - catch(...) - { - bDoRestart = false; - } - - return bDoRestart; -} - -/////////////////////////////// -// AsyncEventServer:Stop -// COMMENT: Shuts down -void AsyncEventServer::Stop() -{ - //TODO: initiate shutdown on all clients connected -// for(int i=0; i < _totalActiveSockets; ++i) { -// shutdown(_pSocketInfo[i]->_socket, SD_SEND); -// } - - if(!listenThread_.Stop()) { - LOG << TEXT("Wait for listenThread timed out."); - } - - socketInfoCollection_.Clear(); -} - -//////////////////////////////////////////////////////////////////// -// -// MESSAGE HANDLERS -// -//////////////////////////////////////////////////////////////////// - - -////////////////////////////// -// AsyncEventServer::OnAccept -// PARAMS: ... -// COMMENT: Called when a new client connects -bool AsyncEventServer::OnAccept(SocketInfoPtr& pSI) { - sockaddr_in clientAddr; - int addrSize = sizeof(clientAddr); - SOCKET clientSocket = WSAAccept(pSI->socket_, (sockaddr*)&clientAddr, &addrSize, NULL, NULL); - if(clientSocket == INVALID_SOCKET) { - LogSocketError(TEXT("Accept")); - return false; - } - - SocketInfoPtr pClientSocket(new SocketInfo(clientSocket, this)); - - //Determine if we can handle one more client - if(socketInfoCollection_.Size() >= CASPAR_MAXIMUM_SOCKET_CLIENTS) { - LOG << TEXT("Could not accept (too many connections)."); - return true; - } - - if(WSAEventSelect(pClientSocket->socket_, pClientSocket->event_, FD_READ | FD_WRITE | FD_CLOSE) == SOCKET_ERROR) { - LogSocketError(TEXT("Accept (failed create event for new client)")); - return false; - } - - TCHAR addressBuffer[32]; - MultiByteToWideChar(CP_ACP, 0, inet_ntoa(clientAddr.sin_addr), -1, addressBuffer, 32); - pClientSocket->host_ = addressBuffer; - - socketInfoCollection_.AddSocketInfo(pClientSocket); - - LOG << TEXT("Accepted connection from ") << pClientSocket->host_.c_str(); - - return true; -} - -bool ConvertMultiByteToWideChar(UINT codePage, char* pSource, int sourceLength, caspar::utils::DataBuffer& wideBuffer, int& countLeftovers) -{ - if(codePage == CP_UTF8) { - countLeftovers = 0; - //check from the end of pSource for ev. uncompleted UTF-8 byte sequence - if(pSource[sourceLength-1] & 0x80) { - //The last byte is part of a multibyte sequence. If the sequence is not complete, we need to save the partial sequence - int bytesToCheck = min(4, sourceLength); //a sequence contains a maximum of 4 bytes - int currentLeftoverIndex = sourceLength-1; - for(; bytesToCheck > 0; --bytesToCheck, --currentLeftoverIndex) { - ++countLeftovers; - if(pSource[currentLeftoverIndex] & 0x80) { - if(pSource[currentLeftoverIndex] & 0x40) { //The two high-bits are set, this is the "header" - int expectedSequenceLength = 2; - if(pSource[currentLeftoverIndex] & 0x20) - ++expectedSequenceLength; - if(pSource[currentLeftoverIndex] & 0x10) - ++expectedSequenceLength; - - if(countLeftovers < expectedSequenceLength) { - //The sequence is incomplete. Leave the leftovers to be interpreted with the next call - break; - } - //The sequence is complete, there are no leftovers. - //...OR... - //error. Let the conversion-function take the hit. - countLeftovers = 0; - break; - } - } - else { - //error. Let the conversion-function take the hit. - countLeftovers = 0; - break; - } - } - if(countLeftovers == 4) { - //error. Let the conversion-function take the hit. - countLeftovers = 0; - } - } - } - - int charsWritten = 0; - int sourceBytesToProcess = sourceLength-countLeftovers; - int wideBufferCapacity = MultiByteToWideChar(codePage, 0, pSource, sourceBytesToProcess, NULL, NULL); - if(wideBufferCapacity > 0) - { - wideBuffer.Realloc(wideBufferCapacity); - charsWritten = MultiByteToWideChar(codePage, 0, pSource, sourceBytesToProcess, wideBuffer.GetPtr(), wideBuffer.GetCapacity()); - } - //copy the leftovers to the front of the buffer - if(countLeftovers > 0) { - memcpy(pSource, &(pSource[sourceBytesToProcess]), countLeftovers); - } - - wideBuffer.SetLength(charsWritten); - return (charsWritten > 0); -} - -////////////////////////////// -// AsyncEventServer::OnRead -// PARAMS: ... -// COMMENT: Called then something arrives on the socket that has to be read -bool AsyncEventServer::OnRead(SocketInfoPtr& pSI) { - int recvResult = SOCKET_ERROR; - - int maxRecvLength = sizeof(pSI->recvBuffer_)-pSI->recvLeftoverOffset_; - recvResult = recv(pSI->socket_, pSI->recvBuffer_+pSI->recvLeftoverOffset_, maxRecvLength, 0); - while(recvResult != SOCKET_ERROR) { - if(recvResult == 0) { - LOG << TEXT("Client ") << pSI->host_.c_str() << TEXT(" disconnected"); - - socketInfoCollection_.RemoveSocketInfo(pSI); - return true; - } - - if(pProtocolStrategy_ != 0) { - //Convert to widechar - if(ConvertMultiByteToWideChar(pProtocolStrategy_->GetCodepage(), pSI->recvBuffer_, recvResult + pSI->recvLeftoverOffset_, pSI->wideRecvBuffer_, pSI->recvLeftoverOffset_)) - pProtocolStrategy_->Parse(pSI->wideRecvBuffer_.GetPtr(), pSI->wideRecvBuffer_.GetLength(), pSI); - else - { - LOG << TEXT("Read from ") << pSI->host_.c_str() << TEXT(" failed, could not convert command to UNICODE"); - } - } - - maxRecvLength = sizeof(pSI->recvBuffer_)-pSI->recvLeftoverOffset_; - recvResult = recv(pSI->socket_, pSI->recvBuffer_+pSI->recvLeftoverOffset_, maxRecvLength, 0); - } - - if(recvResult == SOCKET_ERROR) { - int errorCode = WSAGetLastError(); - if(errorCode == WSAEWOULDBLOCK) - return true; - else { - LogSocketError(TEXT("Read"), errorCode); - OnError(pSI->event_, errorCode); - } - } - - return false; -} - -////////////////////////////// -// AsyncEventServer::OnWrite -// PARAMS: ... -// COMMENT: Called when the socket is ready to send more data -void AsyncEventServer::OnWrite(SocketInfoPtr& pSI) { - DoSend(*pSI); -} - -bool ConvertWideCharToMultiByte(UINT codePage, const std::wstring& wideString, caspar::utils::DataBuffer& destBuffer) -{ - int bytesWritten = 0; - int multibyteBufferCapacity = WideCharToMultiByte(codePage, 0, wideString.c_str(), static_cast(wideString.length()), 0, 0, NULL, NULL); - if(multibyteBufferCapacity > 0) - { - destBuffer.Realloc(multibyteBufferCapacity); - bytesWritten = WideCharToMultiByte(codePage, 0, wideString.c_str(), static_cast(wideString.length()), destBuffer.GetPtr(), destBuffer.GetCapacity(), NULL, NULL); - } - destBuffer.SetLength(bytesWritten); - return (bytesWritten > 0); -} - -void AsyncEventServer::DoSend(SocketInfo& socketInfo) { - //Locks the socketInfo-object so that no one else tampers with the sendqueue at the same time - SocketInfo::Lock lock(socketInfo); - - while(!socketInfo.sendQueue_.empty() || socketInfo.currentlySending_.GetLength() > 0) { - if(socketInfo.currentlySending_.GetLength() == 0) { - //Read the next string in the queue and convert to UTF-8 - if(!ConvertWideCharToMultiByte(pProtocolStrategy_->GetCodepage(), socketInfo.sendQueue_.front(), socketInfo.currentlySending_)) - { - LOG << TEXT("Send to ") << socketInfo.host_.c_str() << TEXT(" failed, could not convert response to UTF-8"); - } - socketInfo.currentlySendingOffset_ = 0; - } - - if(socketInfo.currentlySending_.GetLength() > 0) { - int bytesToSend = static_cast(socketInfo.currentlySending_.GetLength()-socketInfo.currentlySendingOffset_); - int sentBytes = send(socketInfo.socket_, socketInfo.currentlySending_.GetPtr(socketInfo.currentlySendingOffset_), bytesToSend, 0); - if(sentBytes == SOCKET_ERROR) { - int errorCode = WSAGetLastError(); - if(errorCode == WSAEWOULDBLOCK) { - LOG << LogLevel::Debug << TEXT("Send to ") << socketInfo.host_.c_str() << TEXT(" would block, sending later"); - break; - } - else { - LogSocketError(TEXT("Send"), errorCode); - OnError(socketInfo.event_, errorCode); - - socketInfo.currentlySending_.SetLength(0); - socketInfo.currentlySendingOffset_ = 0; - socketInfo.sendQueue_.pop(); - break; - } - } - else { - if(sentBytes == bytesToSend) { - if(sentBytes < 200) - LOG << LogLevel::Verbose << TEXT("Sent ") << socketInfo.sendQueue_.front().c_str() << TEXT(" to ") << socketInfo.host_.c_str(); - else - LOG << LogLevel::Verbose << TEXT("Sent more than 200 bytes to ") << socketInfo.host_.c_str(); - - socketInfo.currentlySending_.SetLength(0); - socketInfo.currentlySendingOffset_ = 0; - socketInfo.sendQueue_.pop(); - } - else { - socketInfo.currentlySendingOffset_ += sentBytes; - LOG << LogLevel::Verbose << TEXT("Sent partial message to ") << socketInfo.host_.c_str(); - } - } - } - else - socketInfo.sendQueue_.pop(); - } -} - -////////////////////////////// -// AsyncEventServer::OnClose -// PARAMS: ... -// COMMENT: Called when a client disconnects / is disconnected -void AsyncEventServer::OnClose(SocketInfoPtr& pSI) { - LOG << TEXT("Client ") << pSI->host_.c_str() << TEXT(" was disconnected"); - - socketInfoCollection_.RemoveSocketInfo(pSI); -} - -////////////////////////////// -// AsyncEventServer::OnError -// PARAMS: ... -// COMMENT: Called when an errorcode is recieved -void AsyncEventServer::OnError(HANDLE waitEvent, int errorCode) { - if(errorCode == WSAENETDOWN || errorCode == WSAECONNABORTED || errorCode == WSAECONNRESET || errorCode == WSAESHUTDOWN || errorCode == WSAETIMEDOUT || errorCode == WSAENOTCONN || errorCode == WSAENETRESET) { - SocketInfoPtr pSocketInfo; - if(socketInfoCollection_.FindSocketInfo(waitEvent, pSocketInfo)) { - LOG << TEXT("Client ") << pSocketInfo->host_.c_str() << TEXT(" was disconnected, Errorcode ") << errorCode; - } - - socketInfoCollection_.RemoveSocketInfo(waitEvent); - } -} - -////////////////////////////// -// AsyncEventServer::DisconnectClient -// PARAMS: ... -// COMMENT: The client is removed from the actual client-list when an FD_CLOSE notification is recieved -void AsyncEventServer::DisconnectClient(SocketInfo& socketInfo) { - int result = shutdown(socketInfo.socket_, SD_SEND); - if(result == SOCKET_ERROR) - OnError(socketInfo.event_, result); -} - -////////////////////////////// -// AsyncEventServer::LogSocketError -void AsyncEventServer::LogSocketError(const TCHAR* pStr, int socketError) { - if(socketError == 0) - socketError = WSAGetLastError(); - - LOG << TEXT("Failed to ") << pStr << TEXT(" Errorcode: ") << socketError; -} - - -////////////////////////////// -// SocketInfoCollection -////////////////////////////// - -AsyncEventServer::SocketInfoCollection::SocketInfoCollection() : bDirty_(false) { -} - -AsyncEventServer::SocketInfoCollection::~SocketInfoCollection() { -} - -bool AsyncEventServer::SocketInfoCollection::AddSocketInfo(SocketInfoPtr& pSocketInfo) { - Lock lock(*this); - - waitEvents_.resize(waitEvents_.size()+1); - bool bSuccess = socketInfoMap_.insert(SocketInfoMap::value_type(pSocketInfo->event_, pSocketInfo)).second; - if(bSuccess) { - waitEvents_[waitEvents_.size()-1] = pSocketInfo->event_; - bDirty_ = true; - } - - return bSuccess; -} - -void AsyncEventServer::SocketInfoCollection::RemoveSocketInfo(SocketInfoPtr& pSocketInfo) { - if(pSocketInfo != 0) { - RemoveSocketInfo(pSocketInfo->event_); - } -} -void AsyncEventServer::SocketInfoCollection::RemoveSocketInfo(HANDLE waitEvent) { - Lock lock(*this); - - //Find instance - SocketInfoPtr pSocketInfo; - SocketInfoMap::iterator it = socketInfoMap_.find(waitEvent); - SocketInfoMap::iterator end = socketInfoMap_.end(); - if(it != end) - pSocketInfo = it->second; - - if(pSocketInfo) { - pSocketInfo->pServer_ = NULL; - - socketInfoMap_.erase(waitEvent); - - HandleVector::iterator it = std::find(waitEvents_.begin(), waitEvents_.end(), waitEvent); - if(it != waitEvents_.end()) { - std::swap((*it), waitEvents_.back()); - waitEvents_.resize(waitEvents_.size()-1); - - bDirty_ = true; - } - } - if(onSocketInfoRemoved) - onSocketInfoRemoved(pSocketInfo); -} - -bool AsyncEventServer::SocketInfoCollection::FindSocketInfo(HANDLE key, SocketInfoPtr& pResult) { - Lock lock(*this); - - SocketInfoMap::iterator it = socketInfoMap_.find(key); - SocketInfoMap::iterator end = socketInfoMap_.end(); - if(it != end) - pResult = it->second; - - return (it != end); -} - -void AsyncEventServer::SocketInfoCollection::CopyCollectionToArray(HANDLE* pDest, int maxCount) { - Lock lock(*this); - - memcpy(pDest, &(waitEvents_[0]), min( maxCount, static_cast(waitEvents_.size()) ) * sizeof(HANDLE) ); -} - -void AsyncEventServer::SocketInfoCollection::Clear() { - Lock lock(*this); - - socketInfoMap_.clear(); - waitEvents_.clear(); -} - -} //namespace IO -} //namespace caspar \ No newline at end of file diff --git a/server/io/AsyncEventServer.h b/server/io/AsyncEventServer.h deleted file mode 100644 index 70f4338b8..000000000 --- a/server/io/AsyncEventServer.h +++ /dev/null @@ -1,135 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -// AsyncEventServer.h: interface for the AsyncServer class. -////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_ASYNCEVENTSERVER_H__0BFA29CB_BE4C_46A0_9CAE_E233ED27A8EC__INCLUDED_) -#define AFX_ASYNCEVENTSERVER_H__0BFA29CB_BE4C_46A0_9CAE_E233ED27A8EC__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include -#include -#include -#include - -#include "..\utils\thread.h" -#include "..\utils\lockable.h" - -#include "ProtocolStrategy.h" -#include "..\controller.h" -#include "SocketInfo.h" - -namespace caspar { -namespace IO { - -typedef std::function ClientDisconnectEvent; - -class AsyncEventServer : public utils::IRunnable, public caspar::IController -{ - static long instanceCount_; - - AsyncEventServer(); - AsyncEventServer(const AsyncEventServer&); - AsyncEventServer& operator=(const AsyncEventServer&); - -public: - explicit AsyncEventServer(int port); - ~AsyncEventServer(); - - bool Start(); - void SetProtocolStrategy(ProtocolStrategyPtr pPS) { - pProtocolStrategy_ = pPS; - } - - void Stop(); - - void SetClientDisconnectHandler(ClientDisconnectEvent handler); - -private: - utils::Thread listenThread_; - void Run(HANDLE stopEvent); - bool OnUnhandledException(const std::exception&) throw(); - - bool OnAccept(SocketInfoPtr&); - bool OnRead(SocketInfoPtr&); - void OnWrite(SocketInfoPtr&); - void OnClose(SocketInfoPtr&); - void OnError(HANDLE waitEvent, int errorCode); - - SocketInfoPtr pListenSocketInfo_; - ProtocolStrategyPtr pProtocolStrategy_; - int port_; - - friend class SocketInfo; - void DoSend(SocketInfo&); - void DisconnectClient(SocketInfo&); - - void LogSocketError(const TCHAR* pStr, int socketError = 0); - - class SocketInfoCollection : private utils::LockableObject - { - SocketInfoCollection(const SocketInfoCollection&); - SocketInfoCollection& operator=(const SocketInfoCollection&); - - typedef std::map SocketInfoMap; - typedef std::vector HandleVector; - - public: - SocketInfoCollection(); - ~SocketInfoCollection(); - - bool AddSocketInfo(SocketInfoPtr& pSocketInfo); - void RemoveSocketInfo(SocketInfoPtr& pSocketInfo); - void RemoveSocketInfo(HANDLE); - void CopyCollectionToArray(HANDLE*, int maxCount); - - bool FindSocketInfo(HANDLE, SocketInfoPtr& pResult); - - bool IsDirty() { - return bDirty_; - } - void ClearDirty() { - bDirty_ = false; - } - - std::size_t Size() { - return waitEvents_.size(); - } - void Clear(); - - ClientDisconnectEvent onSocketInfoRemoved; - - private: - SocketInfoMap socketInfoMap_; - HandleVector waitEvents_; - bool bDirty_; - }; - SocketInfoCollection socketInfoCollection_; -}; -typedef std::tr1::shared_ptr AsyncEventServerPtr; - -} //namespace IO -} //namespace caspar - -#endif // !defined(AFX_ASYNCEVENTSERVER_H__0BFA29CB_BE4C_46A0_9CAE_E233ED27A8EC__INCLUDED_) diff --git a/server/io/ClientInfo.h b/server/io/ClientInfo.h deleted file mode 100644 index dcae66cf7..000000000 --- a/server/io/ClientInfo.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _CLIENTINFO_H__ -#define _CLIENTINFO_H__ - -#pragma once - -#include - -namespace caspar { -namespace IO { - -class ClientInfo -{ -protected: - ClientInfo() - {} - -public: - virtual ~ClientInfo() { - } - - virtual void Send(const tstring& data) = 0; - virtual void Disconnect() = 0; - - tstring currentMessage_; -}; -typedef std::tr1::shared_ptr ClientInfoPtr; - -} //namespace IO -} //namespace caspar - -#endif //_CLIENTINFO_H__ \ No newline at end of file diff --git a/server/io/ProtocolStrategy.h b/server/io/ProtocolStrategy.h deleted file mode 100644 index 9c7ea637d..000000000 --- a/server/io/ProtocolStrategy.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _PROTOCOLSTRATEGY_H__ -#define _PROTOCOLSTRATEGY_H__ - -#pragma once - -#include -#include "clientInfo.h" - -namespace caspar { -namespace IO { - -class IProtocolStrategy -{ -public: - virtual ~IProtocolStrategy() - {} - - virtual void Parse(const TCHAR* pData, int charCount, ClientInfoPtr pClientInfo) = 0; - virtual UINT GetCodepage() = 0; -}; - -typedef std::tr1::shared_ptr ProtocolStrategyPtr; - -} //namespace IO -} //namespace caspar - -#endif //_PROTOCOLSTRATEGY_H__ \ No newline at end of file diff --git a/server/io/SerialPort.cpp b/server/io/SerialPort.cpp deleted file mode 100644 index 294badeff..000000000 --- a/server/io/SerialPort.cpp +++ /dev/null @@ -1,502 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\StdAfx.h" - -#include "SerialPort.h" - -#include "..\application.h" - - -namespace caspar { -namespace IO { - -using namespace utils; - -void LogCommError(const tstring& msg, int errorCode); - - -/* From winbase.h -#define NOPARITY 0 -#define ODDPARITY 1 -#define EVENPARITY 2 -#define MARKPARITY 3 -#define SPACEPARITY 4 - -#define ONESTOPBIT 0 -#define ONE5STOPBITS 1 -#define TWOSTOPBITS 2 -*/ - -SerialPort::SerialPort(DWORD baudRate, BYTE parity, BYTE dataBits, BYTE stopBits, const tstring& portName) : hPort_(0), portName_(portName) -{ - pClientInfo_ = SerialPortClientInfoPtr(new SerialPortClientInfo(this)); - ZeroMemory(&commSettings_, sizeof(DCB)); - commSettings_.DCBlength = sizeof(commSettings_); - commSettings_.BaudRate = baudRate; - commSettings_.fBinary = TRUE; - commSettings_.Parity = parity; - if(parity != 0) - commSettings_.fParity = TRUE; - - commSettings_.ByteSize = dataBits; - commSettings_.StopBits = stopBits; - commSettings_.fNull = TRUE; -} - -SerialPort::~SerialPort() { - Stop(); -} - - -bool SerialPort::Start() { - if(pProtocolStrategy_ == 0) - return false; - - pListener_ = ListenerPtr(new Listener(this, pProtocolStrategy_)); - - if(hPort_ == 0) { - - //Open the port - HANDLE port = CreateFile(portName_.c_str(), GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0); - if(port == INVALID_HANDLE_VALUE) { - //TODO: Throw Win32ErrorException - LogCommError(TEXT("Failed to open port. Error: "), GetLastError()); - - return false; - } - - //Setup port - if(!SetCommState(port, &commSettings_)) { - //TODO: Throw Win32ErrorException - LogCommError(TEXT("Failed to set com-settings. Error: "), GetLastError()); - - CloseHandle(port); - return false; - } - - COMMTIMEOUTS timeouts; - ZeroMemory(&timeouts, sizeof(timeouts)); - timeouts.ReadIntervalTimeout = MAXDWORD; - SetCommTimeouts(port, &timeouts); - - hPort_ = port; - - if(listenerThread_.Start(pListener_.get())) { - if(GetApplication()->GetSetting(TEXT("spy")) == TEXT("true")) { - //don't send anything if we're spying, it would most likely trash the incomming data - return true; - } - else { - pWriter_ = WriterPtr(new Writer(hPort_)); - return writerThread_.Start(pWriter_.get()); - } - } - } - - return false; -} - -void SerialPort::Stop() { - if(hPort_ != 0) { - if(listenerThread_.IsRunning()) - listenerThread_.Stop(); - - if(writerThread_.IsRunning()) - writerThread_.Stop(); - - CloseHandle(hPort_); - hPort_ = 0; - } -} - - -/// Listener -////////////// -const int SerialPort::Listener::WaitTimeout = 1000; -const int SerialPort::Listener::InputBufferSize = 256; - -SerialPort::Listener::Listener(SerialPort* port, ProtocolStrategyPtr pPS) : pPort_(port), pProtocolStrategy_(pPS), overlappedReadEvent_(TRUE, FALSE), bWaitingOnRead_(false), pInputBuffer_(new char[InputBufferSize]), queuedChars_(0) { - ZeroMemory(&overlappedRead_, sizeof(OVERLAPPED)); - overlappedRead_.hEvent = overlappedReadEvent_; - - ZeroMemory(pInputBuffer_, InputBufferSize); -} - -SerialPort::Listener::~Listener() { - if(pInputBuffer_ != 0) { - delete[] pInputBuffer_; - pInputBuffer_ = 0; - } -} - -void SerialPort::Listener::Run(HANDLE eventStop) { - OVERLAPPED overlappedStatus; - ZeroMemory(&overlappedStatus, sizeof(OVERLAPPED)); - - utils::Event eventStatus(TRUE, FALSE); - overlappedStatus.hEvent = eventStatus; - - SetCommMask(pPort_->hPort_, EV_BREAK | EV_CTS | EV_DSR | EV_ERR | EV_RING | EV_RLSD | EV_RXCHAR | EV_RXFLAG | EV_TXEMPTY); - - const int StopEvent = 0; - const int StatusEvent = 1; - const int ReadEvent = 2; - - HANDLE waitEvents[3] = { eventStop, eventStatus, overlappedReadEvent_ }; - - DWORD resultEventMask = 0; - bool bContinue = true, bWaitingOnStatusEvent = false; - while(bContinue) { - if(!bWaitingOnStatusEvent) { - if(WaitCommEvent(pPort_->hPort_, &resultEventMask, &overlappedStatus)) { - ProcessStatusEvent(resultEventMask); - } - else { - //WaitCommEvent did not complete. Is it pending or did an error occur? - DWORD errorCode = GetLastError(); - if(errorCode == ERROR_IO_PENDING) { - bWaitingOnStatusEvent = true; - } - else { - //error in WaitCommEvent - LogCommError(TEXT("Error in WaitCommEvent. Error: "), errorCode); - bContinue = false; - } - } - } - - if(bWaitingOnStatusEvent) { - HRESULT waitResult = WaitForMultipleObjects((bWaitingOnRead_ ? 3 : 2), waitEvents, FALSE, WaitTimeout); - switch(waitResult) { - case WAIT_TIMEOUT: - { - break; - } - - case WAIT_FAILED: - { - LOG << TEXT("WaitForMultipleObjects Failed.") << LogStream::Flush; - bContinue = false; - break; - } - - default: - { - int alertObject = waitResult - WAIT_OBJECT_0; - - if(alertObject == StopEvent) { - LOG << TEXT("Got stopEvent. Stopping listener-thread.") << LogStream::Flush; - bContinue = false; - } - else if(alertObject == StatusEvent) { - DWORD numBytes = 0; - if(GetOverlappedResult(pPort_->hPort_, &overlappedStatus, &numBytes, FALSE)) { - ProcessStatusEvent(resultEventMask); - } - else { - LogCommError(TEXT("GetOverlappedResult Failed (StatusEvent). Error: "), GetLastError()); - } - bWaitingOnStatusEvent = false; - } - else if(alertObject == ReadEvent) { - overlappedReadEvent_.Reset(); - DWORD numBytesRead = 0; - if(GetOverlappedResult(pPort_->hPort_, &overlappedRead_, &numBytesRead, FALSE)) { - bWaitingOnRead_ = false; - LOG << TEXT("Overlapped completion sucessful.") << LogStream::Flush; - OnRead(numBytesRead); - } - else { - LogCommError(TEXT("GetOverlappedResult Failed (ReadEvent). Error: "), GetLastError()); - } - } - else { - //unexpected error - LogCommError(TEXT("Unexpected wait-result. Result: "), waitResult); - bContinue = false; - } - break; - } - } - } - } -} - -bool SerialPort::Listener::OnUnhandledException(const std::exception& ex) throw() { - bool bDoRestart = true; - - try - { - LOG << LogLevel::Critical << TEXT("UNHANDLED EXCEPTION in serialport listener. Message: ") << ex.what() << LogStream::Flush; - - //TODO: Cleanup and prepare for restart - } - catch(...) - { - bDoRestart = false; - } - - return bDoRestart; -} - - -void SerialPort::Listener::ProcessStatusEvent(DWORD eventMask) { - DWORD errors = 0; - COMSTAT commStat; - ZeroMemory(&commStat, sizeof(COMSTAT)); - - ClearCommError(pPort_->hPort_, &errors, &commStat); - - if((eventMask & EV_RXCHAR) && (commStat.cbInQue > 0)) { - queuedChars_ += static_cast(commStat.cbInQue); - if(!bWaitingOnRead_) { - DoRead(); - } - else { - LOG << TEXT("Could not read, already waiting on overlapped completion") << LogStream::Flush; - } - } -} - -void SerialPort::Listener::DoRead() { - bool bContinue; - do { - bContinue = false; - DWORD numBytesRead = 0; - int bytesToRead = min(InputBufferSize, queuedChars_); - if(ReadFile(pPort_->hPort_, pInputBuffer_, bytesToRead, &numBytesRead, &overlappedRead_)) { - bContinue = OnRead(numBytesRead); - } else { - DWORD errorCode = GetLastError(); - if(errorCode == ERROR_IO_PENDING) { - LOG << TEXT("Could not complete read. Mark as waiting for overlapped completion") << LogStream::Flush; - bWaitingOnRead_ = true; - } - else - LogCommError(TEXT("ReadFile Failed. Error: "), errorCode); - } - } - while(bContinue); -} - -bool ConvertMultiByteToWideChar(char* pSource, int sourceLength, caspar::utils::DataBuffer& wideBuffer) -{ - //28591 = ISO 8859-1 Latin I - int charsWritten = 0; - int wideBufferCapacity = MultiByteToWideChar(28591, 0, pSource, sourceLength, NULL, NULL); - if(wideBufferCapacity > 0) - { - wideBuffer.Realloc(wideBufferCapacity); - charsWritten = MultiByteToWideChar(28591, 0, pSource, sourceLength, wideBuffer.GetPtr(), wideBuffer.GetCapacity()); - } - - wideBuffer.SetLength(charsWritten); - return (charsWritten > 0); -} - -bool SerialPort::Listener::OnRead(int numBytesRead) { - queuedChars_ -= numBytesRead; - _ASSERT(queuedChars_ >= 0); - - //just to be safe - queuedChars_ = max(queuedChars_, 0); - - if(pProtocolStrategy_ != 0) { - //TODO: Convert from LATIN-1 codepage to wide chars - if(ConvertMultiByteToWideChar(pInputBuffer_, numBytesRead, wideRecvBuffer_)) { - pProtocolStrategy_->Parse(wideRecvBuffer_.GetPtr(), wideRecvBuffer_.GetLength(), pPort_->pClientInfo_); - } - else { - LOG << TEXT("Read failed, could not convert command to UNICODE") << LogStream::Flush; - } - } - - ZeroMemory(pInputBuffer_, InputBufferSize); - - return (queuedChars_ > 0); -} - -void SerialPort::Write(const tstring& str) { - if(pWriter_ != 0) - pWriter_->push_back(str); -} - -void SerialPort::SerialPortClientInfo::Send(const tstring& data) { - pSerialPort_->Write(data); -} - -SerialPort::Writer::Writer(HANDLE port) : port_(port), newStringEvent_(FALSE, FALSE) { -} - -void SerialPort::Writer::push_back(const tstring& str) { - Lock lock(*this); - - sendQueue_.push(str); - newStringEvent_.Set(); -} - -bool ConvertWideCharToLatin1(const std::wstring& wideString, caspar::utils::DataBuffer& destBuffer) -{ - //28591 = ISO 8859-1 Latin I - int bytesWritten = 0; - int multibyteBufferCapacity = WideCharToMultiByte(28591, 0, wideString.c_str(), static_cast(wideString.length()), 0, 0, NULL, NULL); - if(multibyteBufferCapacity > 0) - { - destBuffer.Realloc(multibyteBufferCapacity); - bytesWritten = WideCharToMultiByte(28591, 0, wideString.c_str(), static_cast(wideString.length()), destBuffer.GetPtr(), destBuffer.GetCapacity(), NULL, NULL); - } - destBuffer.SetLength(bytesWritten); - return (bytesWritten > 0); -} - -void SerialPort::Writer::Run(HANDLE stopEvent) { - OVERLAPPED overlappedWrite; - ZeroMemory(&overlappedWrite, sizeof(OVERLAPPED)); - utils::Event overlappedWriteEvent(TRUE, FALSE); - overlappedWrite.hEvent = overlappedWriteEvent; - bool writePending = false; - int bytesToSend = 0; - - caspar::utils::DataBuffer currentlySending; - tstring currentlySendingString; - unsigned int currentlySendingOffset = 0; - - HANDLE waitHandles[3] = { stopEvent, newStringEvent_, overlappedWriteEvent }; - - while(true) { - HRESULT waitResult = WaitForMultipleObjects(3, waitHandles, FALSE, 2500); - if(waitResult == WAIT_TIMEOUT) - continue; - else if(waitResult == WAIT_FAILED) - break; - - HRESULT currentEvent = waitResult - WAIT_OBJECT_0; - if(currentEvent == 0) { //stopEvent - //TODO: Cancel ev. pending write? - break; - } - else if(currentEvent == 1) { //newStringEvent_ - if(!writePending) { - if(currentlySending.GetLength() == 0) - { - Lock lock(*this); - //Read the next string in the queue and convert to ISO 8859-1 LATIN-1 - currentlySendingString = sendQueue_.front(); - sendQueue_.pop(); - if(!ConvertWideCharToLatin1(currentlySendingString, currentlySending)) - { - LOG << TEXT("Send failed, could not convert response to ISO 8859-1") << LogStream::Flush; - } - currentlySendingOffset = 0; - } - - if(currentlySending.GetLength() > 0) { - bytesToSend = static_cast(currentlySending.GetLength()-currentlySendingOffset); - DWORD bytesWritten = 0; - if(!WriteFile(port_, currentlySending.GetPtr(currentlySendingOffset), bytesToSend, &bytesWritten, &overlappedWrite)) { - DWORD errorCode = GetLastError(); - if(errorCode == ERROR_IO_PENDING) { - writePending = true; - } - else { - //TODO: Log and handle critical error - LOG << TEXT("Failed to send, errorcode: ") << errorCode << LogStream::Flush; - - currentlySending.SetLength(0); - currentlySendingOffset = 0; - break; - } - } - else { //WriteFile completed successfully - if(bytesToSend == bytesWritten) { - currentlySending.SetLength(0); - currentlySendingOffset = 0; - - LOG << LogLevel::Debug << TEXT("Sent serialdata (imediately): ") << currentlySendingString.c_str() << LogStream::Flush; - } - else { - currentlySendingOffset += bytesWritten; - newStringEvent_.Set(); - } - } - } - } - } - else if(currentEvent == 2) { //overlappedWriteEvent - overlappedWriteEvent.Reset(); - DWORD bytesWritten = 0; - if(!GetOverlappedResult(port_, &overlappedWrite, &bytesWritten, FALSE)) { - DWORD errorCode = GetLastError(); - LOG << TEXT("Failed to send, errorcode: ") << errorCode << LogStream::Flush; - - currentlySending.SetLength(0); - currentlySendingOffset = 0; - break; - } - else { - writePending = false; - if(bytesToSend == bytesWritten) { - currentlySending.SetLength(0); - currentlySendingOffset = 0; - - LOG << LogLevel::Debug << TEXT("Sent serialdata (overlapped): ") << currentlySendingString.c_str() << LogStream::Flush; - { - Lock lock(*this); - if(sendQueue_.size() > 0) - newStringEvent_.Set(); - } - } - else { - currentlySendingOffset += bytesWritten; - newStringEvent_.Set(); - } - } - } - } -} - -bool SerialPort::Writer::OnUnhandledException(const std::exception& ex) throw() { - bool bDoRestart = true; - - try - { - LOG << LogLevel::Critical << TEXT("UNHANDLED EXCEPTION in serialport writer. Message: ") << ex.what() << LogStream::Flush; - - //TODO: Cleanup and prepare for restart - } - catch(...) - { - bDoRestart = false; - } - - return bDoRestart; -} - -void LogCommError(const tstring& msg, int errorCode) { - TCHAR strNumber[65]; - _itot_s(errorCode, strNumber, 10); - tstring error = msg; - error.append(strNumber); - LOG << error << LogStream::Flush; -} - -} //namespace IO -} //namespace caspar \ No newline at end of file diff --git a/server/io/SerialPort.h b/server/io/SerialPort.h deleted file mode 100644 index b8996396d..000000000 --- a/server/io/SerialPort.h +++ /dev/null @@ -1,156 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -#include -#include -#include "..\utils\thread.h" -#include "..\utils\lockable.h" -#include "ProtocolStrategy.h" -#include "..\controller.h" -#include "..\utils\databuffer.h" - -namespace caspar { -namespace IO { - -class SerialPort : public caspar::IController -{ - class SerialPortClientInfo; - typedef std::tr1::shared_ptr SerialPortClientInfoPtr; - friend class SerialPortClientInfo; - - class Listener; - typedef std::tr1::shared_ptr ListenerPtr; - friend class Listener; - - class Writer; - typedef std::tr1::shared_ptr WriterPtr; - friend class Writer; - - SerialPort(const SerialPort&); - SerialPort& operator=(const SerialPort&); - -public: - explicit SerialPort(DWORD baudRate, BYTE parity, BYTE dataBits, BYTE stopBits, const tstring& portName); - virtual ~SerialPort(); - - bool Start(); - void Stop(); - - void SetProtocolStrategy(ProtocolStrategyPtr pPS) { - pProtocolStrategy_ = pPS; - } - -private: - void Setup(); - void Write(const tstring&); - - ProtocolStrategyPtr pProtocolStrategy_; - tstring portName_; - HANDLE hPort_; - DCB commSettings_; - - utils::Thread listenerThread_; - ListenerPtr pListener_; - - utils::Thread writerThread_; - WriterPtr pWriter_; - - SerialPortClientInfoPtr pClientInfo_; - -// Listener -///////////// - class Listener : public utils::IRunnable - { - friend SerialPort; - - Listener(const Listener&); - Listener& operator=(const Listener&); - - public: - explicit Listener(SerialPort* pSerialPort, ProtocolStrategyPtr pPS); - virtual ~Listener(); - - void Run(HANDLE stopEvent); - bool OnUnhandledException(const std::exception& ex) throw(); - - private: - void ProcessStatusEvent(DWORD eventMask); - void DoRead(); - bool OnRead(int numBytesRead); - - static const int WaitTimeout; - static const int InputBufferSize; - - SerialPort* pPort_; - ProtocolStrategyPtr pProtocolStrategy_; - - utils::Event overlappedReadEvent_; - OVERLAPPED overlappedRead_; - bool bWaitingOnRead_; - - char* pInputBuffer_; - int queuedChars_; - utils::DataBuffer wideRecvBuffer_; - }; - -// Writer -///////////// - class Writer : public utils::IRunnable, private utils::LockableObject - { - public: - Writer(HANDLE port); - virtual ~Writer() - {} - - public: - void push_back(const tstring&); - - void Run(HANDLE stopEvent); - bool OnUnhandledException(const std::exception& ex) throw(); - - private: - utils::Event newStringEvent_; - std::queue sendQueue_; - HANDLE port_; - }; - -// ClientInfo -/////////////// - class SerialPortClientInfo : public caspar::IO::ClientInfo - { - SerialPort* pSerialPort_; - public: - SerialPortClientInfo(SerialPort* pSP) : pSerialPort_(pSP) { - } - virtual ~SerialPortClientInfo() - {} - - void Send(const tstring& data); - void Disconnect() - {} - }; -}; - -typedef std::tr1::shared_ptr SerialPortPtr; - -} //namespace IO -} //namespace caspar \ No newline at end of file diff --git a/server/io/SocketInfo.cpp b/server/io/SocketInfo.cpp deleted file mode 100644 index 73878527a..000000000 --- a/server/io/SocketInfo.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\stdafx.h" -#include "SocketInfo.h" -#include "AsyncEventServer.h" - -namespace caspar { -namespace IO { - -SocketInfo::SocketInfo(SOCKET socket, AsyncEventServer* pServer) : socket_(socket), pServer_(pServer), recvLeftoverOffset_(0), currentlySendingOffset_(0) -{ - event_ = WSACreateEvent(); - if(event_ == WSA_INVALID_EVENT) { - throw std::exception("Failed to create WSAEvent"); - } -} - -SocketInfo::~SocketInfo() { - - WSACloseEvent(event_); - event_ = 0; - - closesocket(socket_); - socket_ = 0; -} - -void SocketInfo::Send(const tstring& data) { - if(pServer_ != 0 && data.length() > 0) { - { - //The lock has to be let go before DoSend is called since that too tries to lock to object - Lock lock(*this); - sendQueue_.push(data); - } - - pServer_->DoSend(*this); - } -} - -void SocketInfo::Disconnect() { - if(pServer_) - pServer_->DisconnectClient(*this); -} - -} //namespace IO -} //namespace caspar \ No newline at end of file diff --git a/server/io/SocketInfo.h b/server/io/SocketInfo.h deleted file mode 100644 index 7c8693d5f..000000000 --- a/server/io/SocketInfo.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -#include "..\utils\lockable.h" -#include "ClientInfo.h" -#include -#include -#include "..\utils\databuffer.h" - -namespace caspar { -namespace IO { - -class AsyncEventServer; -class SocketInfo : public ClientInfo, private utils::LockableObject -{ - SocketInfo(const SocketInfo&); - SocketInfo& operator=(const SocketInfo&); - -public: - SocketInfo(SOCKET, AsyncEventServer*); - virtual ~SocketInfo(); - - void Send(const tstring& data); - void Disconnect(); - - SOCKET socket_; - HANDLE event_; - tstring host_; -private: - friend class AsyncEventServer; - std::queue sendQueue_; - AsyncEventServer* pServer_; - - caspar::utils::DataBuffer currentlySending_; - unsigned int currentlySendingOffset_; - - caspar::utils::DataBuffer wideRecvBuffer_; - char recvBuffer_[512]; - int recvLeftoverOffset_; -}; -typedef std::tr1::shared_ptr SocketInfoPtr; - -} //namespace IO -} //namespace caspar \ No newline at end of file diff --git a/server/producers/color/ColorManager.cpp b/server/producers/color/ColorManager.cpp deleted file mode 100644 index 406ff5f19..000000000 --- a/server/producers/color/ColorManager.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\stdafx.h" - -#include "ColorManager.h" -#include "..\..\frame\FrameManager.h" -#include "..\..\frame\buffers\StaticFrameBuffer.h" -#include "..\..\frame\FrameMediaController.h" -#include "..\..\utils\FileInputStream.h" -#include "..\..\FileInfo.h" - -#include -#pragma intrinsic(__movsd, __stosd) -#pragma intrinsic(__movsw, __stosw) - -void memset_w(unsigned short* pBuffer, unsigned short value, std::size_t count) -{ - __stosw(pBuffer, value, count); -} - -void memset_d(unsigned long* pBuffer, unsigned long value, std::size_t count) -{ - __stosd(pBuffer, value, count); -} - -namespace caspar { - -/////////////////////////////// -// ColorProducer declaration -// -class ColorProducer : public MediaProducer, FrameMediaController -{ -public: - explicit ColorProducer(unsigned long colorValue); - virtual ~ColorProducer(); - - virtual IMediaController* QueryController(const tstring& id); - - virtual bool Initialize(FrameManagerPtr pFrameManager); - virtual FrameBuffer& GetFrameBuffer() { - return frameBuffer_; - } - - virtual bool IsEmpty() const - { - return colorValue_ == 0; - } - -private: - StaticFrameBuffer frameBuffer_; - unsigned long colorValue_; -}; - -union Color { - struct Components { - unsigned char a; - unsigned char r; - unsigned char g; - unsigned char b; - } comp; - - unsigned long value; -}; - -////////////////////////////// -// ColorManager definition -// -MediaProducerPtr ColorManager::CreateProducer(const tstring& parameter) -{ - MediaProducerPtr result; - if(parameter[0] == '#') { - unsigned long value; - if(GetPixelColorValueFromString(parameter, &value)) - result = MediaProducerPtr(new ColorProducer(value)); - } - - return result; -} - -bool ColorManager::getFileInfo(FileInfo* pFileInfo) -{ - if(pFileInfo != 0) { - pFileInfo->length = 1; - pFileInfo->type = TEXT("still"); - pFileInfo->encoding = TEXT("NA"); - return true; - } - return false; -} - -bool ColorManager::GetPixelColorValueFromString(const tstring& parameter, unsigned long* outValue) -{ - tstring colorCode; - if(parameter.length() == 9 && parameter[0] == '#') - { - colorCode = parameter.substr(1); - - Color theCol; - theCol.value = _tcstoul(colorCode.c_str(),0,16); - unsigned char temp = theCol.comp.a; - theCol.comp.a = theCol.comp.b; - theCol.comp.b = temp; - temp = theCol.comp.r; - theCol.comp.r = theCol.comp.g; - theCol.comp.g = temp; - - *outValue = theCol.value; - return true; - } - return false; -} - - -/////////////////////////////// -// ColorProducer definition -// -ColorProducer::ColorProducer(unsigned long colorValue) : colorValue_(colorValue) { -} - -ColorProducer::~ColorProducer() { -} - -IMediaController* ColorProducer::QueryController(const tstring& id) { - if(id == TEXT("FrameController")) - return this; - - return 0; -} - -bool ColorProducer::Initialize(FrameManagerPtr pFrameManager) { - if(pFrameManager != 0) { - FramePtr pFrame = pFrameManager->CreateFrame(); - if(pFrame != 0) { - memset_d(reinterpret_cast(pFrame->GetDataPtr()), colorValue_, pFrame->GetDataSize() / sizeof(unsigned long)); - frameBuffer_.push_back(pFrame); - return true; - } - } - return false; -} - -} \ No newline at end of file diff --git a/server/producers/color/ColorManager.h b/server/producers/color/ColorManager.h deleted file mode 100644 index 8a0154205..000000000 --- a/server/producers/color/ColorManager.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -#include "..\..\MediaManager.h" -#include "..\..\MediaProducer.h" - -#include - -namespace caspar { - -class FileInfo; - -class ColorManager : public IMediaManager -{ -public: - ColorManager() {} - virtual ~ColorManager() {} - - virtual MediaProducerPtr CreateProducer(const tstring& parameter); - virtual bool getFileInfo(FileInfo* pFileInfo); - - static bool GetPixelColorValueFromString(const tstring& parameter, unsigned long* outValue); -}; - -} //namespace caspar diff --git a/server/producers/composites/FrameCompositeProducer.cpp b/server/producers/composites/FrameCompositeProducer.cpp deleted file mode 100644 index 536274501..000000000 --- a/server/producers/composites/FrameCompositeProducer.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\StdAfx.h" - -#include "FrameCompositeProducer.h" -#include "..\..\SystemFrameManager.h" -#include "..\..\transitioninfo.h" - -namespace caspar { - -FrameCompositeProducer::FrameCompositeProducer() : pCompositionStrategy_(0), currentFrameIndex_(0) { - pIntermediateFrameManager_.reset(new SystemFrameManager(fmtDesc)); -} - -FrameCompositeProducerPtr FrameCompositeProducer::CreateOverlayComposite() { - FrameCompositeProducerPtr result; - return result; -} - -FrameCompositeProducerPtr FrameCompositeProducer::CreateTransitionComposite(const TransitionInfo& transitionInfo) { - FrameCompositeProducerPtr result; - return result; -} - -FrameCompositeProducer::~FrameCompositeProducer() { - worker_.Stop(); - - if(pCompositionStrategy_ != 0) { - delete pCompositionStrategy_; - pCompositionStrategy_ = 0; - } -} - -//MediaProducer -IMediaController* FrameCompositeProducer::QueryController(const tstring& id) { - if(id == TEXT("FrameController")) { - return this; - } - return 0; -} - -MediaProducerPtr FrameCompositeProducer::GetFollowingProducer() { -} - -//FrameMediaController -bool FrameCompositeProducer::Initialize(FrameManagerPtr pFrameManager) { -} - - -//IRunnable -void FrameCompositeProducer::Run(HANDLE stopEvent) { - LOG << LogLevel::Verbose << TEXT("Composition: readAhead thread started"); - - const DWORD waitHandlesCount = 2; - HANDLE waitHandles[waitHandlesCount] = { stopEvent, frameBuffer_.GetWriteWaitHandle() }; - - bool bQuit = false; - while(!bQuit) { - HRESULT waitResult = WaitForMultipleObjects(waitHandlesCount, waitHandles, FALSE, 2000); - switch(waitResult) - { - //stopEvent - case (WAIT_OBJECT_0): - bQuit = true; - break; - - //write possible - case (WAIT_OBJECT_O+1): - if(pCompositionStrategy_ != 0) { - if(pCompositionStrategy_->GenerateFrame(stopEvent, currentFrameIndex_)) { - ++currentFrameIndex_; - } - } - break; - - case (WAIT_TIMEOUT): - break; - - default: - LOG << LogLevel::Critical << TEXT("Composition: write-wait failed. Aborting"); - bQuit = true; - break: - } - } - - FramePtr pNullFrame; - frameBuffer_.push_back(pNullFrame); - LOG << LogLevel::Verbose << TEXT("Composition: readAhead thread ended"); -} - -bool FrameCompositeProducer::OnUnhandledException(const std::exception& ex) throw() { - try - { - FramePtr pNullFrame; - frameBuffer_.push_back(pNullFrame); - - LOG << LogLevel::Critical << TEXT("UNHANDLED EXCEPTION in compositionthread. Message: ") << ex.what(); - } - catch(...) - {} - - return false; -} - -} //namespace caspar \ No newline at end of file diff --git a/server/producers/composites/FrameCompositeProducer.h b/server/producers/composites/FrameCompositeProducer.h deleted file mode 100644 index 2b6a5572e..000000000 --- a/server/producers/composites/FrameCompositeProducer.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -#include "..\..\MediaProducer.h" -#include "..\..\FrameManager.h" -#include "..\..\FrameMediaController.h" -#include "..\..\SystemFrameManager.h" -#include "..\..\utils\thread.h" - -namespace caspar { - -class TransitionInfo; - -class IFrameCompositionStrategy -{ -public: - bool GenerateFrame(HANDLE stopEvent, unsigned int frameIndex) = 0; -}; - -class FrameCompositeProducer : public MediaProducer, public FrameMediaController, public utils::IRunnable -{ - FrameCompositeProducer(); - -public: - static FrameCompositeProducerPtr CreateOverlayComposite(); - static FrameCompositeProducerPtr CreateTransitionComposite(const TransitionInfo& transitionInfo); - virtual ~FrameCompositeProducer(); - - //MediaProducer - virtual IMediaController* QueryController(const tstring& id); - virtual MediaProducerPtr GetFollowingProducer(); - - //FrameMediaController - virtual bool Initialize(FrameManagerPtr pFrameManager); - virtual FrameBuffer& GetFrameBuffer() { - return frameBuffer_; - } - - //IRunnable - virtual void Run(HANDLE stopEvent); - virtual bool OnUnhandledException(const std::exception& ex) throw(); - -private: - IFrameCompositionStrategy* pCompositionStrategy_; - unsigned int currentFrameIndex_; - - FrameManagerPtr pResultFrameManager_; - SystemFrameManagerPtr pIntermediateFrameManager_; - - utils::Thread worker_; - MotionFrameBuffer frameBuffer_; -}; - -} //namespace caspar \ No newline at end of file diff --git a/server/producers/composites/TransitionProducer.cpp b/server/producers/composites/TransitionProducer.cpp deleted file mode 100644 index d760ef614..000000000 --- a/server/producers/composites/TransitionProducer.cpp +++ /dev/null @@ -1,532 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\stdafx.h" - -#include -#include -#include - -#include "TransitionProducer.h" -#include "..\..\application.h" -#include "..\..\utils\pixmapdata.h" -#include "..\..\utils\image\image.hpp" -#include "..\..\utils\thread.h" -#include "..\..\frame\clipinfo.h" -#include "..\..\transitioninfo.h" -#include "..\..\utils\taskqueue.h" -#include "..\..\frame\buffers\MotionFrameBuffer.h" - -namespace caspar -{ - -using namespace utils; - -struct TransitionProducer::Implementation -{ - TransitionProducer* self_; - - FrameManagerPtr pResultFrameManager_; - SystemFrameManagerPtr pIntermediateFrameManager_; - ClipInfo sourceClip_; - ClipInfo destinationClip_; - std::vector readWaitHandles_; - - unsigned short totalFrames_, currentFrame_; - - std::tr1::function generateFrameFun_; - - TransitionInfo transitionInfo_; - unsigned long borderColorValue_; - utils::PixmapDataPtr pBorderImage_; - - utils::Thread worker_; - utils::TaskQueue taskQueue_; - MotionFrameBuffer frameBuffer_; - - Implementation(TransitionProducer* self, MediaProducerPtr pDest, const TransitionInfo& transitionInfo, const FrameFormatDescription& fmtDesc) - : - self_(self), - totalFrames_(transitionInfo.duration_+1), - currentFrame_(1), - transitionInfo_(transitionInfo), - borderColorValue_(0) - { - pIntermediateFrameManager_.reset(new SystemFrameManager(fmtDesc)); - - if(pDest != 0) { - FrameMediaController* pDestFrameController = dynamic_cast(pDest->QueryController(TEXT("FrameController"))); - destinationClip_ = ClipInfo(pDest, pDestFrameController); - if(!destinationClip_.IsEmpty()) - readWaitHandles_.push_back(destinationClip_.pFrameController_->GetFrameBuffer().GetWaitHandle()); - } - - switch(transitionInfo_.type_) { - case Slide: - case Push: - case Wipe: - generateFrameFun_ = &Implementation::GenerateWipeFrame; - break; - case Mix: - default: - generateFrameFun_ = &Implementation::GenerateMixFrame; - break; - }; - } - - ~Implementation() - { - worker_.Stop(); - } - - - IMediaController* QueryController(const tstring& id) - { - //The transition only supports FrameController if its destination also supports it - if(!destinationClip_.IsEmpty()) { - if(id == TEXT("FrameController")) { - return self_; - } - } - return NULL; - } - - MediaProducerPtr GetFollowingProducer() - { - return destinationClip_.pFP_; - } - - bool Initialize(FrameManagerPtr pFrameManager) - { - if(pFrameManager) { - if(!worker_.IsRunning()) { - pResultFrameManager_ = pFrameManager; - if(pResultFrameManager_ != 0 && !destinationClip_.IsEmpty()) { - //Cue audio for destination clip - GetApplication()->GetAudioManager()->CueAudio(destinationClip_.pFrameController_); - - return destinationClip_.pFrameController_->Initialize(pIntermediateFrameManager_); - } - } - else { - //Create a task that replace pResultFrameManager_ but is executed in the worker thread - taskQueue_.push_back(bind(&TransitionProducer::Implementation::DoUpdateFrameManager, this, pFrameManager)); - return true; - } - } - return false; - } - - void DoUpdateFrameManager(FrameManagerPtr pFrameManager) { - pResultFrameManager_ = pFrameManager; - } - - FrameBuffer& GetFrameBuffer() - { - return frameBuffer_; - } - - bool Start(const ClipInfo& srcClipInfo) - { - sourceClip_ = srcClipInfo; - if(!sourceClip_.IsEmpty() && !destinationClip_.IsEmpty()) { - if(sourceClip_.pFrameController_->Initialize(pIntermediateFrameManager_)) { - readWaitHandles_.push_back(sourceClip_.pFrameController_->GetFrameBuffer().GetWaitHandle()); - - //AUDIO - { - //copy all workers from the source to this - self_->GetSoundBufferWorkers().insert(self_->GetSoundBufferWorkers().end(), sourceClip_.pFrameController_->GetSoundBufferWorkers().begin(), sourceClip_.pFrameController_->GetSoundBufferWorkers().end()); - - //copy all workers from the destination to this - self_->GetSoundBufferWorkers().insert(self_->GetSoundBufferWorkers().end(), destinationClip_.pFrameController_->GetSoundBufferWorkers().begin(), destinationClip_.pFrameController_->GetSoundBufferWorkers().end()); - } - - return worker_.Start(self_); - } - } - return false; - } - - void Run(HANDLE stopEvent) - { - LOG << LogLevel::Verbose << TEXT("Transition: readAhead thread started"); - currentFrame_ = 1; - - HANDLE waitHandles[3] = { stopEvent, taskQueue_.GetWaitEvent(), frameBuffer_.GetWriteWaitHandle() }; - DWORD waitHandlesCount = sizeof(waitHandles) / sizeof(HANDLE); - - bool bQuit = false; - while(bQuit == false && currentFrame_ <= totalFrames_) { - HRESULT waitResult = WaitForMultipleObjects(waitHandlesCount, waitHandles, FALSE, 2000); - switch(waitResult) { - case WAIT_OBJECT_0: - LOG << LogLevel::Debug << TEXT("Transition: Recieved stopEvent"); - bQuit = true; - break; - - case WAIT_OBJECT_0+1: - taskQueue_.pop_and_execute_front(); - break; - - case WAIT_OBJECT_0+2: - { - bool bWriteSuccess = false; - if(WriteFrame(bWriteSuccess)) { - if(bWriteSuccess) - ++currentFrame_; - } - else { - LOG << TEXT("Transition: WriteFrame returned false. Abort transition"); - bQuit = true; - } - } - break; - - case WAIT_TIMEOUT: - break; - - default: - LOG << LogLevel::Critical << TEXT("Transition: write-wait failed. Aborting"); - bQuit = true; - break; - } - } - - //ALMOST SAME BUT OLD: This does not include a complete frame from the destination as the last frame -/* for(currentFrame_ = 1; currentFrame_< totalFrames_; ++currentFrame_) { - HRESULT waitResult = WaitForMultipleObjects(waitHandlesCount, waitHandles, FALSE, 2000); - if(waitResult == (WAIT_OBJECT_0+2)) { - if(!WriteFrame()) { - LOG << LogLevel::Debug << TEXT("Transition: WriteFrame returned false. Abort transition"); - break; - } - } - else if(waitResult == WAIT_OBJECT_0 + 1) { - --currentFrame_; - - Task task; - taskQueue_.pop_front(task); - if(task) - task(); - } - else if(waitResult == WAIT_OBJECT_0) { - LOG << LogLevel::Debug << TEXT("Transition: Recieved stopEvent"); - break; - } - else if(waitResult == WAIT_TIMEOUT) { - //retry the same frame - --currentFrame_; - } - else { - //Iiik, Critical error - LOG << LogLevel::Critical << TEXT("Transition: write-wait failed. Aborting"); - break; - } - }*/ - - FramePtr pNullFrame; - frameBuffer_.push_back(pNullFrame); - LOG << LogLevel::Verbose << TEXT("Transition: readAhead thread ended"); - } - - bool OnUnhandledException(const std::exception& ex) throw() - { - try - { - FramePtr pNullFrame; - frameBuffer_.push_back(pNullFrame); - - LOG << LogLevel::Critical << TEXT("UNHANDLED EXCEPTION in transitionthread. Message: ") << ex.what(); - } - catch(...) - {} - - return false; - } - - bool WriteFrame(bool &bWriteSuccess) - { - //Wait for source-feeds - HRESULT waitResult = WAIT_OBJECT_0; - if(readWaitHandles_.size() > 0) - waitResult = WaitForMultipleObjects(static_cast(readWaitHandles_.size()), &(readWaitHandles_[0]), TRUE, 250); - - switch(waitResult) - { - case WAIT_OBJECT_0: - if(DoWriteFrame()) - bWriteSuccess = true; - else - return false; - break; - - case WAIT_TIMEOUT: - Sleep(0); - break; - - default: //An error occured - LOG << LogLevel::Critical << TEXT("Transition: read-wait failed. Aborting"); - return false; - } - - return true; - } - - bool DoWriteFrame() - { - FrameBuffer& srcFrameBuffer = sourceClip_.pFrameController_->GetFrameBuffer(); - FrameBuffer& destFrameBuffer = destinationClip_.pFrameController_->GetFrameBuffer(); - - //Make member of ClipInfo - FramePtr pSrcFrame = (sourceClip_.lastFetchResult_ == FetchEOF) ? sourceClip_.pLastFrame_ : srcFrameBuffer.front(); - FramePtr pDestFrame = (destinationClip_.lastFetchResult_ == FetchEOF)? destinationClip_.pLastFrame_ : destFrameBuffer.front(); - - //Bail if no data is availible - if(pSrcFrame == 0 || pDestFrame == 0) - { - LOG << LogLevel::Debug << TEXT("Transition: WriteFrame(): GetFrameBuffer().front() returned null"); - return false; - } - - FramePtr pResultFrame = pResultFrameManager_->CreateFrame(); - if(pResultFrame != 0 && pResultFrame->GetDataPtr() != 0) - { - generateFrameFun_(this, pResultFrame->GetDataPtr(), pSrcFrame->GetDataPtr(), pDestFrame->GetDataPtr()); - //AUDIO - { - float alpha = static_cast(currentFrame_)/static_cast(totalFrames_); - //copy all sounddatachunks from source - std::for_each(pSrcFrame->GetAudioData().begin(), pSrcFrame->GetAudioData().end(), std::bind(&audio::AudioDataChunk::SetVolume, std::placeholders::_1, 1.0f-alpha)); - pResultFrame->GetAudioData().insert(pResultFrame->GetAudioData().end(), pSrcFrame->GetAudioData().begin(), pSrcFrame->GetAudioData().end()); - - //copy sounddatachunk from destination - std::for_each(pDestFrame->GetAudioData().begin(), pDestFrame->GetAudioData().end(), std::bind(&audio::AudioDataChunk::SetVolume, std::placeholders::_1, alpha)); - pResultFrame->GetAudioData().insert(pResultFrame->GetAudioData().end(), pDestFrame->GetAudioData().begin(), pDestFrame->GetAudioData().end()); - } - - frameBuffer_.push_back(pResultFrame); - - if(sourceClip_.lastFetchResult_ != FetchEOF) - { - sourceClip_.pLastFrame_ = pSrcFrame; - sourceClip_.lastFetchResult_ = srcFrameBuffer.pop_front(); - - //remove from readWaitHandles - if(sourceClip_.lastFetchResult_ == FetchEOF) - readWaitHandles_.erase(std::find(readWaitHandles_.begin(), readWaitHandles_.end(), srcFrameBuffer.GetWaitHandle())); - } - - if(destinationClip_.lastFetchResult_ != FetchEOF) - { - destinationClip_.pLastFrame_ = pDestFrame; - destinationClip_.lastFetchResult_ = destFrameBuffer.pop_front(); - - //remove from readWaitHandles - if(destinationClip_.lastFetchResult_ == FetchEOF) - readWaitHandles_.erase(std::find(readWaitHandles_.begin(), readWaitHandles_.end(), destFrameBuffer.GetWaitHandle())); - } - } - else - { - Sleep(0); - } - - return true; - } - - ///////////////////////////// - // Frame-generating functions - void GenerateMixFrame(unsigned char* pResultData, unsigned char* pSourceData, unsigned char* pDestData) - { - image::Lerp(pResultData, pSourceData, pDestData, 1.0f-static_cast(currentFrame_)/static_cast(totalFrames_), pResultFrameManager_->GetFrameFormatDescription().size); - } - - // TODO: Move into "image" library, seperate push, slide, wipe? (R.N) - void GenerateWipeFrame(unsigned char* pResultData, unsigned char* pSourceData, unsigned char* pDestData) - { - const FrameFormatDescription& fmtDesc = pResultFrameManager_->GetFrameFormatDescription(); - - if(currentFrame_ < totalFrames_) { - int totalWidth = fmtDesc.width + transitionInfo_.borderWidth_; - - float fStep = totalWidth / (float)totalFrames_; - float fOffset = fStep * (float)currentFrame_; - - int halfStep = static_cast(fStep/2.0); - int offset = static_cast(fOffset+0.5f); - - //read source to buffer - for(int row = 0, even = 0; row < fmtDesc.height; ++row, even ^= 1) - { - int fieldCorrectedOffset = offset + (halfStep*even); - if(fieldCorrectedOffset < fmtDesc.width) - { - if(transitionInfo_.direction_ != FromLeft) - { - if(transitionInfo_.type_ == Push) - memcpy(&(pResultData[4*row*fmtDesc.width]), &(pSourceData[4*(row*fmtDesc.width+fieldCorrectedOffset)]), (fmtDesc.width-fieldCorrectedOffset)*4); - else //Slide | Wipe - memcpy(&(pResultData[4*row*fmtDesc.width]), &(pSourceData[4*row*fmtDesc.width]), (fmtDesc.width-fieldCorrectedOffset)*4); - } - else // if (direction == LEFT) - { - if(transitionInfo_.type_ == Push) - memcpy(&(pResultData[4*(row*fmtDesc.width+fieldCorrectedOffset)]), &(pSourceData[4*(row*fmtDesc.width)]), (fmtDesc.width-fieldCorrectedOffset)*4); - else //slide eller wipe - memcpy(&(pResultData[4*(row*fmtDesc.width+fieldCorrectedOffset)]), &(pSourceData[4*(row*fmtDesc.width+fieldCorrectedOffset)]), (fmtDesc.width-fieldCorrectedOffset)*4); - } - } - } - - //write border to buffer - if(transitionInfo_.borderWidth_ > 0) - { - for(int row = 0, even = 0; row < fmtDesc.height; ++row, even ^= 1) - { - int fieldCorrectedOffset = offset + (halfStep*even); - int length = transitionInfo_.borderWidth_; - int start = 0; - - if(transitionInfo_.direction_ != FromLeft) - { - if(fieldCorrectedOffset > fmtDesc.width) - { - length -= fieldCorrectedOffset-fmtDesc.width; - start += fieldCorrectedOffset-fmtDesc.width; - fieldCorrectedOffset = fmtDesc.width; - } - else if(fieldCorrectedOffset < length) - { - length = fieldCorrectedOffset; - } - - if(pBorderImage_ != 0) - { - unsigned char* pBorderImageData = pBorderImage_->GetDataPtr(); - memcpy(&(pResultData[4*(row*fmtDesc.width+fmtDesc.width-fieldCorrectedOffset)]), &(pBorderImageData[4*(row*pBorderImage_->width+start)]), length*4); - } - else - { - for(int i=0;i fmtDesc.width) - { - length -= fieldCorrectedOffset-fmtDesc.width; - start = 0; - fieldCorrectedOffset -= transitionInfo_.borderWidth_-length; - } - else if(fieldCorrectedOffset < length) - { - length = fieldCorrectedOffset; - start = transitionInfo_.borderWidth_-fieldCorrectedOffset; - } - - if(pBorderImage_ != 0 && length > 0) - { - unsigned char* pBorderImageData = pBorderImage_->GetDataPtr(); - memcpy(&(pResultData[4*(row*fmtDesc.width+fieldCorrectedOffset-length)]), &(pBorderImageData[4*(row*pBorderImage_->width+start)]), length*4); - } - else - { - for(int i=0;i 0) - { - for(int row = 0, even = 0; row < fmtDesc.height; ++row, even ^= 1) - { - int fieldCorrectedOffset = offset + (halfStep*even); - - if(transitionInfo_.direction_ != FromLeft) - { - if(transitionInfo_.type_ == Wipe) - memcpy(&(pResultData[4*(row*fmtDesc.width+fmtDesc.width-fieldCorrectedOffset)]), &(pDestData[4*(row*fmtDesc.width+fmtDesc.width-fieldCorrectedOffset)]), fieldCorrectedOffset*4); - else - memcpy(&(pResultData[4*(row*fmtDesc.width+fmtDesc.width-fieldCorrectedOffset)]), &(pDestData[4*row*fmtDesc.width]), fieldCorrectedOffset*4); - } - else // if (direction == LEFT) - { - if(transitionInfo_.type_ == Wipe) - memcpy(&(pResultData[4*(row*fmtDesc.width)]), &(pDestData[4*(row*fmtDesc.width)]), fieldCorrectedOffset*4); - else - memcpy(&(pResultData[4*(row*fmtDesc.width)]), &(pDestData[4*(row*fmtDesc.width+fmtDesc.width-fieldCorrectedOffset)]), fieldCorrectedOffset*4); - } - } - } - } - else { - //currentFrame_ == totalFrames_ - image::Copy(pResultData, pDestData, fmtDesc.size); - } - } -}; - - -TransitionProducer::TransitionProducer(MediaProducerPtr pDest, const TransitionInfo& transitionInfo, const FrameFormatDescription& fmtDesc) : pImpl_(new Implementation(this, pDest, transitionInfo, fmtDesc)){} -TransitionProducer::~TransitionProducer() {} - -IMediaController* TransitionProducer::QueryController(const tstring& id) -{ - return pImpl_->QueryController(id); -} - -MediaProducerPtr TransitionProducer::GetFollowingProducer() -{ - return pImpl_->GetFollowingProducer(); -} - -bool TransitionProducer::Initialize(FrameManagerPtr pFrameManager) -{ - return pImpl_->Initialize(pFrameManager); -} - -FrameBuffer& TransitionProducer::GetFrameBuffer() -{ - return pImpl_->GetFrameBuffer(); -} - -bool TransitionProducer::Start(const ClipInfo& srcClipInfo) -{ - return pImpl_->Start(srcClipInfo); -} - -void TransitionProducer::Run(HANDLE stopEvent) -{ - pImpl_->Run(stopEvent); -} - -bool TransitionProducer::OnUnhandledException(const std::exception& ex) throw() -{ - return pImpl_->OnUnhandledException(ex); -} - -} //namespace caspar \ No newline at end of file diff --git a/server/producers/composites/TransitionProducer.h b/server/producers/composites/TransitionProducer.h deleted file mode 100644 index d06007c71..000000000 --- a/server/producers/composites/TransitionProducer.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -#include "..\..\MediaProducer.h" -#include "..\..\frame\FrameManager.h" -#include "..\..\frame\FrameMediaController.h" -#include "..\..\frame\SystemFrameManager.h" -#include "..\..\utils\runnable.h" -#include "..\..\utils\Noncopyable.hpp" - -#include - -namespace caspar { - - class ClipInfo; - class TransitionInfo; - -namespace utils { - class PixmapData; - typedef std::tr1::shared_ptr PixmapDataPtr; -} - -// TODO: Put into its own header? (R.N) -class ITransitionController -{ -public: - virtual bool Start(const ClipInfo& srcClipInfo) = 0; -}; - -class TransitionProducer : public MediaProducer, public FrameMediaController, public ITransitionController, public utils::IRunnable, private utils::Noncopyable -{ -public: - TransitionProducer(MediaProducerPtr pDestination, const TransitionInfo& transitionInfo, const FrameFormatDescription& fmtDesc); - virtual ~TransitionProducer(); - - //MediaProducer - virtual IMediaController* QueryController(const tstring& id); - virtual MediaProducerPtr GetFollowingProducer(); - - //FrameMediaController - virtual bool Initialize(FrameManagerPtr pFrameManager); - virtual FrameBuffer& GetFrameBuffer(); - - //ITransitionController - virtual bool Start(const ClipInfo& srcClipInfo); - - //IRunnable - virtual void Run(HANDLE stopEvent); - virtual bool OnUnhandledException(const std::exception& ex) throw(); - -private: - - struct Implementation; - std::tr1::shared_ptr pImpl_; -}; -typedef std::tr1::shared_ptr TransitionProducerPtr; - -} //namespace caspar \ No newline at end of file diff --git a/server/producers/ffmpeg/FFmpegManager.cpp b/server/producers/ffmpeg/FFmpegManager.cpp deleted file mode 100644 index 3d7900f2b..000000000 --- a/server/producers/ffmpeg/FFmpegManager.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "../../stdafx.h" - -#include "FFMPEGManager.h" -#include "ffmpeg_producer.h" - -#include "../../MediaProducerInfo.h" -#include "../../frame/FrameManager.h" -#include "../../frame/FrameMediaController.h" -#include "../../utils/UnhandledException.h" - -#include -#include - -extern "C" -{ - #define __STDC_CONSTANT_MACROS - #define __STDC_LIMIT_MACROS - #include - #include - #include - #include -} - -namespace caspar { -namespace ffmpeg { - -using namespace utils; -using namespace boost::assign; - -FFMPEGManager::FFMPEGManager() -{ - static boost::once_flag flag = BOOST_ONCE_INIT; - boost::call_once(av_register_all, flag); - - _extensions += TEXT("mpg"), TEXT("avi"), TEXT("mov"), TEXT("dv"), TEXT("wav"), TEXT("mp3"), TEXT("mp4"), TEXT("f4v"), TEXT("flv"); -} - -MediaProducerPtr FFMPEGManager::CreateProducer(const tstring& filename) -{ - CASPAR_TRY - { - return std::make_shared(filename); - } - CASPAR_CATCH_AND_LOG("[FFMPEGManager::CreateProducer]") - - return nullptr; -} - -bool FFMPEGManager::getFileInfo(FileInfo* pFileInfo) -{ - if(pFileInfo == nullptr) - return false; - - auto movie = list_of(TEXT("avi"))(TEXT("mpg"))(TEXT("mov"))(TEXT("dv"))(TEXT("flv"))(TEXT("f4v"))(TEXT("mp4")); - auto audio = list_of(TEXT("wav"))(TEXT("mp3")); - - if(std::find(movie.begin(), movie.end(), pFileInfo->filetype) != movie.end()) - { - pFileInfo->length = 0; //get real length from file - pFileInfo->type = TEXT("movie"); - pFileInfo->encoding = TEXT("codec"); - } - else if(std::find(audio.begin(), audio.end(), pFileInfo->filetype) != audio.end()) - { - pFileInfo->length = 0; //get real length from file - pFileInfo->type = TEXT("audio"); - pFileInfo->encoding = TEXT("NA"); - } - return true; -} - -}} \ No newline at end of file diff --git a/server/producers/ffmpeg/audio/audio_decoder.cpp b/server/producers/ffmpeg/audio/audio_decoder.cpp deleted file mode 100644 index 201bd8c95..000000000 --- a/server/producers/ffmpeg/audio/audio_decoder.cpp +++ /dev/null @@ -1,83 +0,0 @@ -#include "../../../stdafx.h" - -#include "audio_decoder.h" - -#include - -namespace caspar{ namespace ffmpeg{ - -struct audio_decoder::implementation : boost::noncopyable -{ - implementation() : discard_bytes_(0), current_audio_chunk_offset_(0) - { - audio_decomp_buffer_.resize(audio_decoder::AUDIO_DECOMP_BUFFER_SIZE); - int alignment_offset_ = static_cast(audio_decoder::ALIGNMENT - (reinterpret_cast(&audio_decomp_buffer_.front()) % audio_decoder::ALIGNMENT)); - aligned_audio_decomp_addr_ = &audio_decomp_buffer_.front() + alignment_offset_; - } - - audio_packet_ptr execute(const audio_packet_ptr& audio_packet) - { - int max_chunk_length = min(audio_packet->audio_frame_size, audio_packet->src_audio_frame_size); - - int written_bytes = audio_decoder::AUDIO_DECOMP_BUFFER_SIZE - audio_decoder::ALIGNMENT; - int result = avcodec_decode_audio2(audio_packet->codec_context, reinterpret_cast(aligned_audio_decomp_addr_), &written_bytes, audio_packet->data.data(), audio_packet->size); - - if(result <= 0) - return audio_packet; - - unsigned char* pDecomp = aligned_audio_decomp_addr_; - - //if there are bytes to discard, do that first - while(written_bytes > 0 && discard_bytes_ != 0) - { - int bytesToDiscard = min(written_bytes, static_cast(discard_bytes_)); - pDecomp += bytesToDiscard; - - discard_bytes_ -= bytesToDiscard; - written_bytes -= bytesToDiscard; - } - - while(written_bytes > 0) - { - //if we're starting on a new chunk, allocate it - if(current_chunk_ == nullptr) - { - current_chunk_ = std::make_shared(audio_packet->audio_frame_size); - current_audio_chunk_offset_ = 0; - } - - //either fill what's left of the chunk or copy all written_bytes that are left - int targetLength = min((max_chunk_length - current_audio_chunk_offset_), written_bytes); - memcpy(current_chunk_->GetDataPtr() + current_audio_chunk_offset_, pDecomp, targetLength); - written_bytes -= targetLength; - - current_audio_chunk_offset_ += targetLength; - pDecomp += targetLength; - - if(current_audio_chunk_offset_ >= max_chunk_length) - { - if(max_chunk_length < static_cast(audio_packet->audio_frame_size)) - memset(current_chunk_->GetDataPtr() + max_chunk_length, audio_packet->audio_frame_size-max_chunk_length, 0); - else if(audio_packet->audio_frame_size < audio_packet->src_audio_frame_size) - discard_bytes_ = audio_packet->src_audio_frame_size-audio_packet->audio_frame_size; - - audio_packet->audio_chunks.push_back(current_chunk_); - current_chunk_.reset(); - } - } - - return audio_packet; - } - - int discard_bytes_; - - std::vector audio_decomp_buffer_; - unsigned char* aligned_audio_decomp_addr_; - - audio::AudioDataChunkPtr current_chunk_; - int current_audio_chunk_offset_; -}; - -audio_decoder::audio_decoder() : impl_(new implementation()){} -audio_packet_ptr audio_decoder::execute(const audio_packet_ptr& audio_packet){return impl_->execute(audio_packet);} -}} \ No newline at end of file diff --git a/server/producers/ffmpeg/audio/audio_decoder.h b/server/producers/ffmpeg/audio/audio_decoder.h deleted file mode 100644 index cb3d10b55..000000000 --- a/server/producers/ffmpeg/audio/audio_decoder.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once - -#include "../packet.h" - -#include - -namespace caspar{ namespace ffmpeg { - -class audio_decoder : boost::noncopyable -{ -public: - audio_decoder(); - audio_packet_ptr execute(const audio_packet_ptr& audio_packet); - - /// The alignment - /// Four sec of 16 bit stereo 48kHz should be enough - static const int ALIGNMENT = 16 ; - - /// Size of the audio decomp buffer - static const int AUDIO_DECOMP_BUFFER_SIZE = 4*48000*4+ALIGNMENT; -private: - struct implementation; - std::shared_ptr impl_; -}; -typedef std::shared_ptr audio_decoder_ptr; -typedef std::unique_ptr audio_decoder_uptr; - -}} \ No newline at end of file diff --git a/server/producers/ffmpeg/ffmpeg_producer.cpp b/server/producers/ffmpeg/ffmpeg_producer.cpp deleted file mode 100644 index 20e7d6211..000000000 --- a/server/producers/ffmpeg/ffmpeg_producer.cpp +++ /dev/null @@ -1,256 +0,0 @@ -#include "../../stdafx.h" - -#include "ffmpeg_producer.h" - -#if defined(_MSC_VER) -#pragma warning (push) -#pragma warning (disable : 4244) -#endif - -extern "C" -{ - #define __STDC_CONSTANT_MACROS - #define __STDC_LIMIT_MACROS - #include - #include - #include - #include -} - -#if defined(_MSC_VER) -#pragma warning (pop) -#endif - -#include "input.h" - -#include "audio/audio_decoder.h" -#include "video/video_decoder.h" -#include "video/video_transformer.h" - -#include "../../Application.h" -#include "../../MediaProducerInfo.h" -#include "../../string_convert.h" -#include "../../frame/buffers/MotionFrameBuffer.h" -#include "../../frame/FrameManager.h" -#include "../../frame/FrameMediaController.h" -#include "../../audio/audiomanager.h" -#include "../../utils/Logger.h" -#include "../../utils/Win32Exception.h" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -using namespace boost::assign; - -namespace caspar{ namespace ffmpeg{ - -struct FFMPEGProducer::Implementation : public FrameMediaController, boost::noncopyable -{ -public: - Implementation(const std::wstring& filename) - : filename_(filename) - { - if(!boost::filesystem::exists(filename)) - throw std::runtime_error("File not found"); - - frameBuffer_.SetCapacity(2); - - input_.reset(new input()); - input_->load(utils::narrow(filename_)); - input_->set_loop(loop_); - has_audio_ = input_->get_audio_codec_context() != nullptr; - } - - ~Implementation() - { - input_->stop(); - frameBuffer_.clear(); - frameBuffer_.push_back(nullptr); - thread_.join(); - } - - FramePtr get_frame() - { - while(ouput_channel_.empty() && !input_->is_eof()) - { - input_->wait_for_packet(); - - audio_packet_ptr audio_packet; - if(audio_chunk_channel_.size() < 25) - audio_packet = input_->get_audio_packet(); - - video_packet_ptr video_packet; - if(video_frame_channel_.size() < 25) - video_packet = input_->get_video_packet(); - - tbb::parallel_invoke( - [&] - { // Video Decoding and Scaling - if(video_packet) - { - video_packet = video_decoder_.execute(video_packet); - auto frame = video_transformer_.execute(video_packet)->frame; - video_frame_channel_.push_back(std::move(frame)); - } - }, - [&] - { // Audio Decoding - if(audio_packet) - { - auto audio_chunks = audio_decoder_.execute(audio_packet); - audio_chunk_channel_.insert(audio_chunk_channel_.end(), audio_packet->audio_chunks.begin(), audio_packet->audio_chunks.end()); - } - }); - - while(!video_frame_channel_.empty() && (!audio_chunk_channel_.empty() || !has_audio_)) - { - if(has_audio_) - { - video_frame_channel_.front()->GetAudioData().push_back(audio_chunk_channel_.front()); - audio_chunk_channel_.pop_front(); - } - - FramePtr frame = video_frame_channel_.front(); - video_frame_channel_.pop_front(); - ouput_channel_.push(std::move(frame)); - } - } - - FramePtr frame; - if(!ouput_channel_.empty()) - { - frame = ouput_channel_.front(); - ouput_channel_.pop(); - } - - return frame; - } - - bool Initialize(FrameManagerPtr pFrameManager) - { - try - { - video_transformer_.set_factory(pFrameManager); - if(!thread_.joinable()) - thread_ = boost::thread([=]{run();}); - } - catch(std::exception& ex) - { - LOG << "FFMPEGProducer::Initialize Exception what: " << ex.what(); - return false; - } - catch(...) - { - LOG << "FFMPEGProducer::Initialize Exception"; - return false; - } - - return true; - } - - void SetLoop(bool value) - { - loop_ = value; - if(input_) - input_->set_loop(value); - } - - FrameBuffer& GetFrameBuffer() - { - return frameBuffer_; - } - - bool GetProducerInfo(MediaProducerInfo* pInfo) - { - if(pInfo == nullptr) - return false; - - pInfo->HaveVideo = input_->get_video_codec_context() != nullptr; - pInfo->HaveAudio = input_->get_audio_codec_context() != nullptr; - if(pInfo->HaveAudio) - { - pInfo->AudioChannels = input_->get_audio_codec_context()->channels; - pInfo->AudioSamplesPerSec = input_->get_audio_codec_context()->sample_rate; - pInfo->BitsPerAudioSample = 16; - } - - return true; - } - - void run() - { - Win32Exception::InstallHandler(); - LOG << "Started FFMPEGProducer thread"; - - try - { - while(!input_->is_eof() && WaitForSingleObject(frameBuffer_.GetWriteWaitHandle(), INFINITE) == WAIT_OBJECT_0) - frameBuffer_.push_back(get_frame()); - } - catch(std::exception& ex) - { - LOG << "Exception in FFMPEGProducer thread. Message:" << ex.what(); - } - catch(...) - { - LOG << "Exception in FFMPEGProducer thread"; - } - - frameBuffer_.push_back(nullptr); - - LOG << "Ended FFMPEGProducer thread"; - } - - boost::thread thread_; - - bool loop_; - bool has_audio_; - - // Filter 1 : Input - input_uptr input_; - - // Filter 2 : Video Decoding and Scaling - video_decoder video_decoder_; - video_transformer video_transformer_; - std::deque video_frame_channel_; - - // Filter 3 : Audio Decoding - audio_decoder audio_decoder_; - std::deque audio_chunk_channel_; - - // Filter 4 : Merge Video and Audio - std::queue ouput_channel_; - - std::wstring filename_; - - MotionFrameBuffer frameBuffer_; -}; - -FFMPEGProducer::FFMPEGProducer(const tstring& filename) : pImpl_(new Implementation(filename)) -{ -} - -IMediaController* FFMPEGProducer::QueryController(const tstring& id) -{ - return id == TEXT("FrameController") ? pImpl_.get() : nullptr; -} - -bool FFMPEGProducer::GetProducerInfo(MediaProducerInfo* pInfo) -{ - return pImpl_->GetProducerInfo(pInfo); -} - -void FFMPEGProducer::SetLoop(bool loop) -{ - pImpl_->SetLoop(loop); -} - -}} \ No newline at end of file diff --git a/server/producers/ffmpeg/ffmpeg_producer.h b/server/producers/ffmpeg/ffmpeg_producer.h deleted file mode 100644 index 278eedfa1..000000000 --- a/server/producers/ffmpeg/ffmpeg_producer.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include -#include - -#include "../../MediaProducer.h" -#include "../../MediaManager.h" -#include "../../MediaProducerInfo.h" - -namespace caspar { namespace ffmpeg { - -class FFMPEGProducer : public MediaProducer -{ -public: - FFMPEGProducer(const tstring& filename); - - IMediaController* QueryController(const tstring&); - bool GetProducerInfo(MediaProducerInfo* pInfo); - - void SetLoop(bool loop); - - static const size_t MAX_TOKENS = 5; - static const size_t MIN_BUFFER_SIZE = 2; - static const size_t DEFAULT_BUFFER_SIZE = 16; - static const size_t MAX_BUFFER_SIZE = 64; - static const size_t LOAD_TARGET_BUFFER_SIZE = 8; - static const size_t THREAD_TIMEOUT_MS = 1000; - -private: - struct Implementation; - std::shared_ptr pImpl_; -}; -typedef std::tr1::shared_ptr FFMPEGProducerPtr; -}} \ No newline at end of file diff --git a/server/producers/ffmpeg/ffmpegmanager.h b/server/producers/ffmpeg/ffmpegmanager.h deleted file mode 100644 index 1d1f4f473..000000000 --- a/server/producers/ffmpeg/ffmpegmanager.h +++ /dev/null @@ -1,43 +0,0 @@ -#pragma once - -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -#include - -#include "..\..\MediaProducer.h" -#include "..\..\MediaManager.h" - -namespace caspar { -namespace ffmpeg { - -class FFMPEGManager : public IMediaManager -{ -public: - FFMPEGManager(); - - MediaProducerPtr CreateProducer(const tstring& filename); - bool getFileInfo(FileInfo* pFileInfo); -}; - -} //namespace ffmpeg -} //namespace caspar \ No newline at end of file diff --git a/server/producers/ffmpeg/input.cpp b/server/producers/ffmpeg/input.cpp deleted file mode 100644 index aa046abab..000000000 --- a/server/producers/ffmpeg/input.cpp +++ /dev/null @@ -1,242 +0,0 @@ -#include "..\..\stdafx.h" - -#include "input.h" - -#include "../../utils/Win32Exception.h" - - -#include - -#include -#include -#include - -#include -#include - -#pragma warning(disable : 4482) - -namespace caspar{ namespace ffmpeg{ - -struct input::implementation : boost::noncopyable -{ - implementation() - : video_frame_rate_(25.0), video_s_index_(-1), audio_s_index_(-1), video_codec_(nullptr), audio_codec_a(nullptr) - { - loop_ = false; - file_buffer_size_ = 0; - } - - ~implementation() - { - stop(); - } - - void stop() - { - is_running_ = false; - video_packet_buffer_.clear(); - audio_packet_buffer_.clear(); - file_buffer_size_cond_.notify_all(); - packet_wait_cond_.notify_all(); - io_thread_.join(); - } - - void load(const std::string& filename) - { - try - { - int errn; - AVFormatContext* weak_format_context; - if((errn = -av_open_input_file(&weak_format_context, filename.c_str(), nullptr, 0, nullptr)) > 0) - throw std::runtime_error("File read error"); - format_context.reset(weak_format_context, av_close_input_file); - - if((errn = -av_find_stream_info(format_context.get())) > 0) - throw std::runtime_error("File read error"); - - video_codec_context_ = open_video_stream(); - if(!video_codec_context_) - LOG << "No video stream found."; - - audio_codex_context = open_audio_stream(); - if(!audio_codex_context) - LOG << "No audio stream found."; - - if(!video_codec_context_ && !audio_codex_context) - throw std::runtime_error("No video or audio codec found."); - - video_frame_rate_ = static_cast(video_codec_context_->time_base.den) / static_cast(video_codec_context_->time_base.num); - - is_running_ = true; - io_thread_ = boost::thread([=]{read_file();}); - } - catch(...) - { - video_codec_context_.reset(); - audio_codex_context.reset(); - format_context.reset(); - video_frame_rate_ = 25.0; - video_s_index_ = -1; - audio_s_index_ = -1; - throw; - } - filename_ = filename; - } - - std::shared_ptr open_video_stream() - { - AVStream** streams_end = format_context->streams+format_context->nb_streams; - AVStream** video_stream = std::find_if(format_context->streams, streams_end, - [](AVStream* stream) { return stream != nullptr && stream->codec->codec_type == CODEC_TYPE_VIDEO ;}); - - video_s_index_ = video_stream != streams_end ? (*video_stream)->index : -1; - if(video_s_index_ == -1) - return nullptr; - - video_codec_ = avcodec_find_decoder((*video_stream)->codec->codec_id); - if(video_codec_ == nullptr) - return nullptr; - - if((-avcodec_open((*video_stream)->codec, video_codec_)) > 0) - return nullptr; - - return std::shared_ptr((*video_stream)->codec, avcodec_close); - } - - std::shared_ptr open_audio_stream() - { - AVStream** streams_end = format_context->streams+format_context->nb_streams; - AVStream** audio_stream = std::find_if(format_context->streams, streams_end, - [](AVStream* stream) { return stream != nullptr && stream->codec->codec_type == CODEC_TYPE_AUDIO;}); - - audio_s_index_ = audio_stream != streams_end ? (*audio_stream)->index : -1; - if(audio_s_index_ == -1) - return nullptr; - - audio_codec_a = avcodec_find_decoder((*audio_stream)->codec->codec_id); - if(audio_codec_a == nullptr) - return nullptr; - - if((-avcodec_open((*audio_stream)->codec, audio_codec_a)) > 0) - return nullptr; - - return std::shared_ptr((*audio_stream)->codec, avcodec_close); - } - - void read_file() - { - LOG << "Started ffmpeg_producer::read_file Thread for " << filename_.c_str(); - Win32Exception::InstallHandler(); - - while(is_running_) - { - AVPacket packet; - - if (av_read_frame(format_context.get(), &packet) >= 0) // NOTE: Packet is only valid until next call of av_read_frame or av_close_input_file - { - if(packet.stream_index == video_s_index_) - { - video_packet_buffer_.push(std::make_shared(packet, nullptr, video_codec_context_.get(), video_codec_)); // NOTE: video_packet makes a copy of AVPacket - file_buffer_size_ += packet.size; - packet_wait_cond_.notify_all(); - } - else if(packet.stream_index == audio_s_index_) - { - audio_packet_buffer_.push(std::make_shared(packet, audio_codex_context.get(), audio_codec_a, video_frame_rate_)); - file_buffer_size_ += packet.size; - packet_wait_cond_.notify_all(); - } - } - else if(!loop_ || av_seek_frame(format_context.get(), -1, 0, AVSEEK_FLAG_BACKWARD) < 0) // TODO: av_seek_frame does not work for all formats - is_running_ = false; - - av_free_packet(&packet); - - boost::unique_lock lock(file_buffer_size_mutex_); - while(is_running_ && file_buffer_size_ > input::FILE_BUFFER_SIZE) - file_buffer_size_cond_.wait(lock); - - boost::this_thread::yield(); - } - - is_running_ = false; - - LOG << " Ended ffmpeg_producer::read_file Thread for " << filename_.c_str(); - } - - video_packet_ptr get_video_packet() - { - video_packet_ptr video_packet; - if(video_packet_buffer_.try_pop(video_packet)) - { - file_buffer_size_ -= video_packet->size; - file_buffer_size_cond_.notify_all(); - } - return video_packet; - } - - audio_packet_ptr get_audio_packet() - { - audio_packet_ptr audio_packet; - if(audio_packet_buffer_.try_pop(audio_packet)) - { - file_buffer_size_ -= audio_packet->size; - file_buffer_size_cond_.notify_all(); - } - return audio_packet; - } - - bool is_eof() const - { - return !is_running_ && video_packet_buffer_.empty() && audio_packet_buffer_.empty(); - } - - void wait_for_packet() - { - boost::unique_lock lock(packet_wait_mutex_); - while(is_running_ && video_packet_buffer_.empty() && audio_packet_buffer_.empty()) - packet_wait_cond_.wait(lock); - } - - int file_buffer_max_size_; - tbb::atomic file_buffer_size_; - boost::condition_variable file_buffer_size_cond_; - boost::mutex file_buffer_size_mutex_; - - boost::condition_variable packet_wait_cond_; - boost::mutex packet_wait_mutex_; - - - std::string filename_; - std::shared_ptr format_context; // Destroy this last - - std::shared_ptr video_codec_context_; - AVCodec* video_codec_; - - std::shared_ptr audio_codex_context; - AVCodec* audio_codec_a; - - tbb::atomic loop_; - int video_s_index_; - int audio_s_index_; - - tbb::concurrent_bounded_queue video_packet_buffer_; - tbb::concurrent_bounded_queue audio_packet_buffer_; - boost::thread io_thread_; - tbb::atomic is_running_; - - double video_frame_rate_; -}; - -input::input() : impl_(new implementation()){} -void input::load(const std::string& filename){impl_->load(filename);} -void input::set_loop(bool value){impl_->loop_ = value;} -const std::shared_ptr& input::get_video_codec_context() const{return impl_->video_codec_context_;} -const std::shared_ptr& input::get_audio_codec_context() const{return impl_->audio_codex_context;} -bool input::is_eof() const{return impl_->is_eof();} -video_packet_ptr input::get_video_packet(){return impl_->get_video_packet();} -audio_packet_ptr input::get_audio_packet(){return impl_->get_audio_packet();} -void input::stop(){impl_->stop();} -void input::wait_for_packet(){impl_->wait_for_packet();} -}} \ No newline at end of file diff --git a/server/producers/ffmpeg/input.h b/server/producers/ffmpeg/input.h deleted file mode 100644 index 948df5319..000000000 --- a/server/producers/ffmpeg/input.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include "packet.h" - -#include - -namespace caspar{ namespace ffmpeg{ - -typedef std::shared_ptr AVFormatContextPtr; - -class input : boost::noncopyable -{ -public: - input(); - void load(const std::string& filename); - const std::shared_ptr& get_video_codec_context() const; - const std::shared_ptr& get_audio_codec_context() const; - - video_packet_ptr get_video_packet(); - audio_packet_ptr get_audio_packet(); - void wait_for_packet(); - - bool is_eof() const; - void set_loop(bool value); - void stop(); - - static const int FILE_BUFFER_SIZE = 2 << 27; -private: - struct implementation; - std::shared_ptr impl_; -}; -typedef std::shared_ptr input_ptr; -typedef std::unique_ptr input_uptr; - - } -} diff --git a/server/producers/ffmpeg/packet.h b/server/producers/ffmpeg/packet.h deleted file mode 100644 index 2bc74813d..000000000 --- a/server/producers/ffmpeg/packet.h +++ /dev/null @@ -1,83 +0,0 @@ -#pragma once - -#include "../../frame/Frame.h" -#include "../../audio/AudioManager.h" - -#include -#include - -#include - -#if defined(_MSC_VER) -#pragma warning (push) -#pragma warning (disable : 4244) -#endif -extern "C" -{ - #define __STDC_CONSTANT_MACROS - #define __STDC_LIMIT_MACROS - #include -} -#if defined(_MSC_VER) -#pragma warning (pop) -#endif - -namespace caspar{ namespace ffmpeg{ - -typedef std::tr1::shared_ptr AVFramePtr; -typedef std::tr1::shared_ptr AVPacketPtr; - -struct video_packet : boost::noncopyable -{ - video_packet(const AVPacket& packet, FramePtr&& frame, AVCodecContext* codec_context, AVCodec* codec) - : size(packet.size), codec_context(codec_context), codec(codec), frame(std::move(frame)), - data(packet.size), decoded_frame(avcodec_alloc_frame(), av_free) - { - memcpy(data.data(), packet.data, packet.size); - } - - const size_t size; - std::vector data; - AVCodecContext* const codec_context; - const AVCodec* const codec; - FramePtr frame; - AVFramePtr decoded_frame; -}; -typedef std::shared_ptr video_packet_ptr; - -struct audio_packet : boost::noncopyable -{ - audio_packet(const AVPacket& packet, AVCodecContext* codec_context, AVCodec* codec, double frame_rate = 25.0) - : - size(packet.size), - codec_context(codec_context), - codec(codec), - data(packet.size) - { - memcpy(data.data(), packet.data, packet.size); - - size_t bytesPerSec = (codec_context->sample_rate * codec_context->channels * 2); - - audio_frame_size = bytesPerSec / 25; - src_audio_frame_size = static_cast(static_cast(bytesPerSec) / frame_rate); - - //make sure the framesize is a multiple of the samplesize - int sourceSizeMod = src_audio_frame_size % (codec_context->channels * 2); - if(sourceSizeMod != 0) - src_audio_frame_size += (codec_context->channels * 2) - sourceSizeMod; - } - - size_t src_audio_frame_size; - size_t audio_frame_size; - - AVCodecContext* const codec_context; - const AVCodec* const codec; - const size_t size; - std::vector data; - - std::vector audio_chunks; -}; -typedef std::shared_ptr audio_packet_ptr; - - } -} diff --git a/server/producers/ffmpeg/video/video_decoder.cpp b/server/producers/ffmpeg/video/video_decoder.cpp deleted file mode 100644 index 6f48f1a5d..000000000 --- a/server/producers/ffmpeg/video/video_decoder.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "../../../stdafx.h" - -#include "video_decoder.h" - -namespace caspar{ namespace ffmpeg{ - -struct video_decoder::implementation : boost::noncopyable -{ - video_packet_ptr execute(const video_packet_ptr& video_packet) - { - int frame_finished = 0; - int result = avcodec_decode_video(video_packet->codec_context, video_packet->decoded_frame.get(), &frame_finished, video_packet->data.data(), video_packet->size); - - return result >= 0 ? video_packet : nullptr; - } -}; - -video_decoder::video_decoder() : impl_(new implementation()){} -video_packet_ptr video_decoder::execute(const video_packet_ptr& video_packet){return impl_->execute(video_packet);} -}} \ No newline at end of file diff --git a/server/producers/ffmpeg/video/video_decoder.h b/server/producers/ffmpeg/video/video_decoder.h deleted file mode 100644 index 303a6f512..000000000 --- a/server/producers/ffmpeg/video/video_decoder.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include "../packet.h" - -namespace caspar{ namespace ffmpeg{ - -typedef std::tr1::shared_ptr AVCodecContextPtr; - -class video_decoder : boost::noncopyable -{ -public: - video_decoder(); - video_packet_ptr execute(const video_packet_ptr& video_packet); -private: - struct implementation; - std::shared_ptr impl_; -}; -typedef std::shared_ptr video_decoder_ptr; -typedef std::unique_ptr video_decoder_uptr; - - } -} \ No newline at end of file diff --git a/server/producers/ffmpeg/video/video_transformer.cpp b/server/producers/ffmpeg/video/video_transformer.cpp deleted file mode 100644 index 98ed33d6d..000000000 --- a/server/producers/ffmpeg/video/video_transformer.cpp +++ /dev/null @@ -1,96 +0,0 @@ -#include "../../../stdafx.h" - -#include "video_transformer.h" - -#include "../../../utils/image/Image.hpp" - -#include -#include -#include -#include -#include - -#if defined(_MSC_VER) -#pragma warning (push) -#pragma warning (disable : 4244) -#endif -extern "C" -{ - #define __STDC_CONSTANT_MACROS - #define __STDC_LIMIT_MACROS - #include -} -#if defined(_MSC_VER) -#pragma warning (pop) -#endif - -namespace caspar { namespace ffmpeg { - -struct fill_frame -{ - fill_frame(size_t width, size_t height) - : frame(avcodec_alloc_frame(), av_free), buffer(static_cast(scalable_aligned_malloc(width*height*4, 16)), scalable_aligned_free) - { - avpicture_fill(reinterpret_cast(frame.get()), buffer.get(), PIX_FMT_BGRA, width, height); - } - const AVFramePtr frame; - const std::shared_ptr buffer; -}; -typedef std::shared_ptr fill_frame_ptr; - -struct video_transformer::implementation : boost::noncopyable -{ - video_packet_ptr execute(const video_packet_ptr video_packet) - { - assert(video_packet); - - size_t width = video_packet->codec_context->width; - size_t height = video_packet->codec_context->height; - PixelFormat src_pix_fmt = video_packet->codec_context->pix_fmt; - PixelFormat dest_pix_fmt = PIX_FMT_BGRA;// PIX_FMT_YUVA420P; // PIX_FMT_BGRA;// - - if(!sws_context_) - sws_context_.reset(sws_getContext(width, height, src_pix_fmt, factory_->GetFrameFormatDescription().width, factory_->GetFrameFormatDescription().height, dest_pix_fmt, SWS_FAST_BILINEAR, nullptr, nullptr, nullptr), sws_freeContext); - - size_t size = size = avpicture_get_size(dest_pix_fmt, width, height); - - { - tbb::spin_mutex::scoped_lock lock(mutex_); - video_packet->frame = factory_->CreateFrame(); - } - - fill_frame fill_frame(factory_->GetFrameFormatDescription().width, factory_->GetFrameFormatDescription().height); - int result = sws_scale(sws_context_.get(), video_packet->decoded_frame->data, video_packet->decoded_frame->linesize, 0, video_packet->codec_context->height, fill_frame.frame->data, fill_frame.frame->linesize); - video_packet->decoded_frame.reset(); // Free memory - - if(video_packet->codec->id == CODEC_ID_DVVIDEO) // Move up one field - { - size_t size = factory_->GetFrameFormatDescription().width * factory_->GetFrameFormatDescription().height * 4; - size_t linesize = factory_->GetFrameFormatDescription().width * 4; - utils::image::Copy(video_packet->frame->GetDataPtr(), fill_frame.buffer.get() + linesize, size - linesize); - utils::image::Clear(video_packet->frame->GetDataPtr() + size - linesize, linesize); - } - else - { - // This copy should be unnecessary. But it seems that when mapping the frame memory to an avframe for scaling there are some artifacts in the picture. See line 59-61. - utils::image::Copy(video_packet->frame->GetDataPtr(), fill_frame.buffer.get(), video_packet->frame->GetDataSize()); - } - - return video_packet; - } - - void set_factory(const FrameManagerPtr& factory) - { - tbb::spin_mutex::scoped_lock lock(mutex_); - factory_ = factory; - } - - tbb::spin_mutex mutex_; - FrameManagerPtr factory_; - std::shared_ptr sws_context_; -}; - -video_transformer::video_transformer() : impl_(new implementation()){} -video_packet_ptr video_transformer::execute(const video_packet_ptr& video_packet){return impl_->execute(video_packet);} -void video_transformer::set_factory(const FrameManagerPtr& factory){ impl_->set_factory(factory); } -}} \ No newline at end of file diff --git a/server/producers/ffmpeg/video/video_transformer.h b/server/producers/ffmpeg/video/video_transformer.h deleted file mode 100644 index f702e420b..000000000 --- a/server/producers/ffmpeg/video/video_transformer.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include "../packet.h" -#include "../../../frame/FrameManager.h" - -namespace caspar{ namespace ffmpeg{ - -class video_transformer : boost::noncopyable -{ -public: - video_transformer(); - video_packet_ptr execute(const video_packet_ptr& video_packet); - void set_factory(const FrameManagerPtr& factory); -private: - struct implementation; - std::shared_ptr impl_; -}; -typedef std::shared_ptr video_transformer_ptr; -typedef std::unique_ptr video_transformer_uptr; - -}} \ No newline at end of file diff --git a/server/producers/flash/CTManager.cpp b/server/producers/flash/CTManager.cpp deleted file mode 100644 index 860a9fe14..000000000 --- a/server/producers/flash/CTManager.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\stdafx.h" - -#include "..\..\frame\FrameManager.h" -#include "..\..\frame\FrameMediaController.h" -#include "..\..\utils\FileInputStream.h" -#include "..\..\fileinfo.h" -#include "CTManager.h" -#include "FlashProducer.h" -#include "..\..\cg\FlashCGProxy.h" - -namespace caspar { - -using namespace caspar::utils; -using namespace caspar::CG; - -////////////////////////////// -// CTManager definition -// -CTManager::CTManager() -{ - _extensions.push_back(TEXT("ct")); -} - -CTManager::~CTManager() -{} - -MediaProducerPtr CTManager::CreateProducer(const tstring& filename) { - tstring fixedFilename = filename; - tstring::size_type pos = 0; - while((pos = fixedFilename.find(TEXT('\\'), pos)) != tstring::npos) { - fixedFilename[pos] = TEXT('/'); - } - MediaProducerPtr result; - FlashCGProxyPtr pCGProxy(FlashCGProxy::Create()); - if(pCGProxy) { - pCGProxy->Add(0, filename, 1); - result = pCGProxy->GetFlashProducer(); - } - - return result; -} - -bool CTManager::getFileInfo(FileInfo* pFileInfo) -{ - if(pFileInfo != 0) { - pFileInfo->length = 1; - pFileInfo->type = TEXT("movie"); - pFileInfo->encoding = TEXT("ct"); - return true; - } - return false; -} - -} //namespace caspar \ No newline at end of file diff --git a/server/producers/flash/CTManager.h b/server/producers/flash/CTManager.h deleted file mode 100644 index 993aace57..000000000 --- a/server/producers/flash/CTManager.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -#include "..\..\frame\Frame.h" -#include "..\..\MediaManager.h" - -namespace caspar { - -class FileInfo; - -class CTManager : public IMediaManager -{ -public: - CTManager(); - virtual ~CTManager(); - - virtual MediaProducerPtr CreateProducer(const tstring& filename); - virtual bool getFileInfo(FileInfo* pFileInfo); -}; - -} //namespace caspar \ No newline at end of file diff --git a/server/producers/flash/Flash9e.IDL b/server/producers/flash/Flash9e.IDL deleted file mode 100644 index c85a3bb3c..000000000 --- a/server/producers/flash/Flash9e.IDL +++ /dev/null @@ -1,367 +0,0 @@ -// Generated .IDL file (by the OLE/COM Object Viewer) -// -// typelib filename: Flash9e.ocx - -[ - uuid(D27CDB6B-AE6D-11CF-96B8-444553540000), - version(1.0), - helpstring("Shockwave Flash"), - custom(DE77BA64-517C-11D1-A2DA-0000F8773CE9, 100663662), - custom(DE77BA63-517C-11D1-A2DA-0000F8773CE9, 1180654890) - -] -library ShockwaveFlashObjects -{ - // TLib : // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046} - importlib("stdole2.tlb"); - - // Forward declare all types defined in this typelib - interface IShockwaveFlash; - dispinterface _IShockwaveFlashEvents; - interface IFlashFactory; - interface IFlashObjectInterface; - interface IDispatchEx; - interface IServiceProvider; - - [ - odl, - uuid(D27CDB6C-AE6D-11CF-96B8-444553540000), - helpstring("Shockwave Flash"), - dual, - oleautomation - ] - interface IShockwaveFlash : IDispatch { - [id(0xfffffdf3), propget, helpstring("property ReadyState")] - HRESULT ReadyState([out, retval] long* pVal); - [id(0x0000007c), propget, helpstring("property TotalFrames")] - HRESULT TotalFrames([out, retval] long* pVal); - [id(0x0000007d), propget, helpstring("property Playing")] - HRESULT Playing([out, retval] VARIANT_BOOL* pVal); - [id(0x0000007d), propput, helpstring("property Playing")] - HRESULT Playing([in] VARIANT_BOOL pVal); - [id(0x00000069), propget, helpstring("property Quality")] - HRESULT Quality([out, retval] int* pVal); - [id(0x00000069), propput, helpstring("property Quality")] - HRESULT Quality([in] int pVal); - [id(0x00000078), propget, helpstring("property ScaleMode")] - HRESULT ScaleMode([out, retval] int* pVal); - [id(0x00000078), propput, helpstring("property ScaleMode")] - HRESULT ScaleMode([in] int pVal); - [id(0x00000079), propget, helpstring("property AlignMode")] - HRESULT AlignMode([out, retval] int* pVal); - [id(0x00000079), propput, helpstring("property AlignMode")] - HRESULT AlignMode([in] int pVal); - [id(0x0000007b), propget, helpstring("property BackgroundColor")] - HRESULT BackgroundColor([out, retval] long* pVal); - [id(0x0000007b), propput, helpstring("property BackgroundColor")] - HRESULT BackgroundColor([in] long pVal); - [id(0x0000006a), propget, helpstring("property Loop")] - HRESULT Loop([out, retval] VARIANT_BOOL* pVal); - [id(0x0000006a), propput, helpstring("property Loop")] - HRESULT Loop([in] VARIANT_BOOL pVal); - [id(0x00000066), propget, helpstring("property Movie")] - HRESULT Movie([out, retval] BSTR* pVal); - [id(0x00000066), propput, helpstring("property Movie")] - HRESULT Movie([in] BSTR pVal); - [id(0x0000006b), propget, helpstring("property FrameNum")] - HRESULT FrameNum([out, retval] long* pVal); - [id(0x0000006b), propput, helpstring("property FrameNum")] - HRESULT FrameNum([in] long pVal); - [id(0x0000006d), helpstring("method SetZoomRect")] - HRESULT SetZoomRect( - [in] long left, - [in] long top, - [in] long right, - [in] long bottom); - [id(0x00000076), helpstring("method Zoom")] - HRESULT Zoom([in] int factor); - [id(0x00000077), helpstring("method Pan")] - HRESULT Pan( - [in] long x, - [in] long y, - [in] int mode); - [id(0x00000070), helpstring("method Play")] - HRESULT Play(); - [id(0x00000071), helpstring("method Stop")] - HRESULT Stop(); - [id(0x00000072), helpstring("method Back")] - HRESULT Back(); - [id(0x00000073), helpstring("method Forward")] - HRESULT Forward(); - [id(0x00000074), helpstring("method Rewind")] - HRESULT Rewind(); - [id(0x0000007e), helpstring("method StopPlay")] - HRESULT StopPlay(); - [id(0x0000007f), helpstring("method GotoFrame")] - HRESULT GotoFrame([in] long FrameNum); - [id(0x00000080), helpstring("method CurrentFrame")] - HRESULT CurrentFrame([out, retval] long* FrameNum); - [id(0x00000081), helpstring("method IsPlaying")] - HRESULT IsPlaying([out, retval] VARIANT_BOOL* Playing); - [id(0x00000082), helpstring("method PercentLoaded")] - HRESULT PercentLoaded([out, retval] long* percent); - [id(0x00000083), helpstring("method FrameLoaded")] - HRESULT FrameLoaded( - [in] long FrameNum, - [out, retval] VARIANT_BOOL* loaded); - [id(0x00000084), helpstring("method FlashVersion")] - HRESULT FlashVersion([out, retval] long* version); - [id(0x00000085), propget, helpstring("property WMode")] - HRESULT WMode([out, retval] BSTR* pVal); - [id(0x00000085), propput, helpstring("property WMode")] - HRESULT WMode([in] BSTR pVal); - [id(0x00000086), propget, helpstring("property SAlign")] - HRESULT SAlign([out, retval] BSTR* pVal); - [id(0x00000086), propput, helpstring("property SAlign")] - HRESULT SAlign([in] BSTR pVal); - [id(0x00000087), propget, helpstring("property Menu")] - HRESULT Menu([out, retval] VARIANT_BOOL* pVal); - [id(0x00000087), propput, helpstring("property Menu")] - HRESULT Menu([in] VARIANT_BOOL pVal); - [id(0x00000088), propget, helpstring("property Base")] - HRESULT Base([out, retval] BSTR* pVal); - [id(0x00000088), propput, helpstring("property Base")] - HRESULT Base([in] BSTR pVal); - [id(0x00000089), propget, helpstring("property Scale")] - HRESULT Scale([out, retval] BSTR* pVal); - [id(0x00000089), propput, helpstring("property Scale")] - HRESULT Scale([in] BSTR pVal); - [id(0x0000008a), propget, helpstring("property DeviceFont")] - HRESULT DeviceFont([out, retval] VARIANT_BOOL* pVal); - [id(0x0000008a), propput, helpstring("property DeviceFont")] - HRESULT DeviceFont([in] VARIANT_BOOL pVal); - [id(0x0000008b), propget, helpstring("property EmbedMovie")] - HRESULT EmbedMovie([out, retval] VARIANT_BOOL* pVal); - [id(0x0000008b), propput, helpstring("property EmbedMovie")] - HRESULT EmbedMovie([in] VARIANT_BOOL pVal); - [id(0x0000008c), propget, helpstring("property BGColor")] - HRESULT BGColor([out, retval] BSTR* pVal); - [id(0x0000008c), propput, helpstring("property BGColor")] - HRESULT BGColor([in] BSTR pVal); - [id(0x0000008d), propget, helpstring("property Quality2")] - HRESULT Quality2([out, retval] BSTR* pVal); - [id(0x0000008d), propput, helpstring("property Quality2")] - HRESULT Quality2([in] BSTR pVal); - [id(0x0000008e), helpstring("method LoadMovie")] - HRESULT LoadMovie( - [in] int layer, - [in] BSTR url); - [id(0x0000008f), helpstring("method TGotoFrame")] - HRESULT TGotoFrame( - [in] BSTR target, - [in] long FrameNum); - [id(0x00000090), helpstring("method TGotoLabel")] - HRESULT TGotoLabel( - [in] BSTR target, - [in] BSTR label); - [id(0x00000091), helpstring("method TCurrentFrame")] - HRESULT TCurrentFrame( - [in] BSTR target, - [out, retval] long* FrameNum); - [id(0x00000092), helpstring("method TCurrentLabel")] - HRESULT TCurrentLabel( - [in] BSTR target, - [out, retval] BSTR* pVal); - [id(0x00000093), helpstring("method TPlay")] - HRESULT TPlay([in] BSTR target); - [id(0x00000094), helpstring("method TStopPlay")] - HRESULT TStopPlay([in] BSTR target); - [id(0x00000097), helpstring("method SetVariable")] - HRESULT SetVariable( - [in] BSTR name, - [in] BSTR value); - [id(0x00000098), helpstring("method GetVariable")] - HRESULT GetVariable( - [in] BSTR name, - [out, retval] BSTR* pVal); - [id(0x00000099), helpstring("method TSetProperty")] - HRESULT TSetProperty( - [in] BSTR target, - [in] int property, - [in] BSTR value); - [id(0x0000009a), helpstring("method TGetProperty")] - HRESULT TGetProperty( - [in] BSTR target, - [in] int property, - [out, retval] BSTR* pVal); - [id(0x0000009b), helpstring("method TCallFrame")] - HRESULT TCallFrame( - [in] BSTR target, - [in] int FrameNum); - [id(0x0000009c), helpstring("method TCallLabel")] - HRESULT TCallLabel( - [in] BSTR target, - [in] BSTR label); - [id(0x0000009d), helpstring("method TSetPropertyNum")] - HRESULT TSetPropertyNum( - [in] BSTR target, - [in] int property, - [in] double value); - [id(0x0000009e), helpstring("method TGetPropertyNum")] - HRESULT TGetPropertyNum( - [in] BSTR target, - [in] int property, - [out, retval] double* pVal); - [id(0x000000ac), helpstring("method TGetPropertyAsNumber")] - HRESULT TGetPropertyAsNumber( - [in] BSTR target, - [in] int property, - [out, retval] double* pVal); - [id(0x0000009f), propget, helpstring("property SWRemote")] - HRESULT SWRemote([out, retval] BSTR* pVal); - [id(0x0000009f), propput, helpstring("property SWRemote")] - HRESULT SWRemote([in] BSTR pVal); - [id(0x000000aa), propget, helpstring("property FlashVars")] - HRESULT FlashVars([out, retval] BSTR* pVal); - [id(0x000000aa), propput, helpstring("property FlashVars")] - HRESULT FlashVars([in] BSTR pVal); - [id(0x000000ab), propget, helpstring("property AllowScriptAccess")] - HRESULT AllowScriptAccess([out, retval] BSTR* pVal); - [id(0x000000ab), propput, helpstring("property AllowScriptAccess")] - HRESULT AllowScriptAccess([in] BSTR pVal); - [id(0x000000be), propget, helpstring("property MovieData")] - HRESULT MovieData([out, retval] BSTR* pVal); - [id(0x000000be), propput, helpstring("property MovieData")] - HRESULT MovieData([in] BSTR pVal); - [id(0x000000bf), propget, helpstring("property inline-data")] - HRESULT InlineData([out, retval] IUnknown** ppIUnknown); - [id(0x000000bf), propput, helpstring("property inline-data")] - HRESULT InlineData([in] IUnknown* ppIUnknown); - [id(0x000000c0), propget, helpstring("property SeamlessTabbing")] - HRESULT SeamlessTabbing([out, retval] VARIANT_BOOL* pVal); - [id(0x000000c0), propput, helpstring("property SeamlessTabbing")] - HRESULT SeamlessTabbing([in] VARIANT_BOOL pVal); - [id(0x000000c1), helpstring("method EnforceLocalSecurity")] - HRESULT EnforceLocalSecurity(); - [id(0x000000c2), propget, helpstring("property Profile")] - HRESULT Profile([out, retval] VARIANT_BOOL* pVal); - [id(0x000000c2), propput, helpstring("property Profile")] - HRESULT Profile([in] VARIANT_BOOL pVal); - [id(0x000000c3), propget, helpstring("property ProfileAddress")] - HRESULT ProfileAddress([out, retval] BSTR* pVal); - [id(0x000000c3), propput, helpstring("property ProfileAddress")] - HRESULT ProfileAddress([in] BSTR pVal); - [id(0x000000c4), propget, helpstring("property ProfilePort")] - HRESULT ProfilePort([out, retval] long* pVal); - [id(0x000000c4), propput, helpstring("property ProfilePort")] - HRESULT ProfilePort([in] long pVal); - [id(0x000000c6), helpstring("method Call")] - HRESULT CallFunction( - [in] BSTR request, - [out, retval] BSTR* response); - [id(0x000000c7), helpstring("method SetReturnValue")] - HRESULT SetReturnValue([in] BSTR returnValue); - [id(0x000000c8), helpstring("method DisableLocalSecurity")] - HRESULT DisableLocalSecurity(); - [id(0x000000c9), propget, helpstring("property AllowNetworking")] - HRESULT AllowNetworking([out, retval] BSTR* pVal); - [id(0x000000c9), propput, helpstring("property AllowNetworking")] - HRESULT AllowNetworking([in] BSTR pVal); - [id(0x000000ca), propget, helpstring("property AllowFullScreen")] - HRESULT AllowFullScreen([out, retval] BSTR* pVal); - [id(0x000000ca), propput, helpstring("property AllowFullScreen")] - HRESULT AllowFullScreen([in] BSTR pVal); - }; - - [ - uuid(D27CDB6D-AE6D-11CF-96B8-444553540000), - helpstring("Event interface for Shockwave Flash"), - hidden - ] - dispinterface _IShockwaveFlashEvents { - properties: - methods: - [id(0xfffffd9f)] - void OnReadyStateChange(long newState); - [id(0x000007a6)] - void OnProgress(long percentDone); - [id(0x00000096)] - void FSCommand( - [in] BSTR command, - [in] BSTR args); - [id(0x000000c5)] - void FlashCall([in] BSTR request); - }; - - [ - uuid(D27CDB6E-AE6D-11CF-96B8-444553540000), - helpstring("Shockwave Flash") - ] - coclass ShockwaveFlash { - [default] interface IShockwaveFlash; - [default, source] dispinterface _IShockwaveFlashEvents; - }; - - [ - odl, - uuid(D27CDB70-AE6D-11CF-96B8-444553540000), - helpstring("IFlashFactory Interface") - ] - interface IFlashFactory : IUnknown { - }; - - [ - odl, - uuid(D27CDB72-AE6D-11CF-96B8-444553540000), - helpstring("IFlashObjectInterface Interface") - ] - interface IFlashObjectInterface : IDispatchEx { - }; - - [ - odl, - uuid(A6EF9860-C720-11D0-9337-00A0C90DCAA9) - ] - interface IDispatchEx : IDispatch { - HRESULT _stdcall GetDispID( - [in] BSTR bstrName, - [in] unsigned long grfdex, - [out] long* pid); - HRESULT _stdcall RemoteInvokeEx( - [in] long id, - [in] unsigned long lcid, - [in] unsigned long dwFlags, - [in] DISPPARAMS* pdp, - [out] VARIANT* pvarRes, - [out] EXCEPINFO* pei, - [in] IServiceProvider* pspCaller, - [in] unsigned int cvarRefArg, - [in] unsigned int* rgiRefArg, - [in, out] VARIANT* rgvarRefArg); - HRESULT _stdcall DeleteMemberByName( - [in] BSTR bstrName, - [in] unsigned long grfdex); - HRESULT _stdcall DeleteMemberByDispID([in] long id); - HRESULT _stdcall GetMemberProperties( - [in] long id, - [in] unsigned long grfdexFetch, - [out] unsigned long* pgrfdex); - HRESULT _stdcall GetMemberName( - [in] long id, - [out] BSTR* pbstrName); - HRESULT _stdcall GetNextDispID( - [in] unsigned long grfdex, - [in] long id, - [out] long* pid); - HRESULT _stdcall GetNameSpaceParent([out] IUnknown** ppunk); - }; - - [ - odl, - uuid(6D5140C1-7436-11CE-8034-00AA006009FA) - ] - interface IServiceProvider : IUnknown { - HRESULT _stdcall RemoteQueryService( - [in] GUID* guidService, - [in] GUID* riid, - [out] IUnknown** ppvObject); - }; - - [ - uuid(D27CDB71-AE6D-11CF-96B8-444553540000), - helpstring("IFlashObjectInterface Interface") - ] - coclass FlashObjectInterface { - [default] interface IFlashObjectInterface; - }; -}; diff --git a/server/producers/flash/Flash9e_i.c b/server/producers/flash/Flash9e_i.c deleted file mode 100644 index 3cc610ec3..000000000 --- a/server/producers/flash/Flash9e_i.c +++ /dev/null @@ -1,103 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the IIDs and CLSIDs */ - -/* link this file in with the server and any clients */ - - - /* File created by MIDL compiler version 6.00.0366 */ -/* at Tue Mar 18 13:05:00 2008 - */ -/* Compiler settings for .\flash\Flash9e.IDL: - Oicf, W4, Zp8, env=Win32 (32b run) - protocol : dce , ms_ext, c_ext, robust - error checks: allocation ref bounds_check enum stub_data - VC __declspec() decoration level: - __declspec(uuid()), __declspec(selectany), __declspec(novtable) - DECLSPEC_UUID(), MIDL_INTERFACE() -*/ -//@@MIDL_FILE_HEADING( ) - -#pragma warning( disable: 4049 ) /* more than 64k source lines */ - - -#ifdef __cplusplus -extern "C"{ -#endif - - -#include -#include - -#ifdef _MIDL_USE_GUIDDEF_ - -#ifndef INITGUID -#define INITGUID -#include -#undef INITGUID -#else -#include -#endif - -#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ - DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) - -#else // !_MIDL_USE_GUIDDEF_ - -#ifndef __IID_DEFINED__ -#define __IID_DEFINED__ - -typedef struct _IID -{ - unsigned long x; - unsigned short s1; - unsigned short s2; - unsigned char c[8]; -} IID; - -#endif // __IID_DEFINED__ - -#ifndef CLSID_DEFINED -#define CLSID_DEFINED -typedef IID CLSID; -#endif // CLSID_DEFINED - -#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ - const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} - -#endif !_MIDL_USE_GUIDDEF_ - -MIDL_DEFINE_GUID(IID, LIBID_ShockwaveFlashObjects,0xD27CDB6B,0xAE6D,0x11CF,0x96,0xB8,0x44,0x45,0x53,0x54,0x00,0x00); - - -MIDL_DEFINE_GUID(IID, IID_IShockwaveFlash,0xD27CDB6C,0xAE6D,0x11CF,0x96,0xB8,0x44,0x45,0x53,0x54,0x00,0x00); - - -MIDL_DEFINE_GUID(IID, DIID__IShockwaveFlashEvents,0xD27CDB6D,0xAE6D,0x11CF,0x96,0xB8,0x44,0x45,0x53,0x54,0x00,0x00); - - -MIDL_DEFINE_GUID(IID, IID_IFlashFactory,0xD27CDB70,0xAE6D,0x11CF,0x96,0xB8,0x44,0x45,0x53,0x54,0x00,0x00); - - -MIDL_DEFINE_GUID(IID, IID_IDispatchEx,0xA6EF9860,0xC720,0x11D0,0x93,0x37,0x00,0xA0,0xC9,0x0D,0xCA,0xA9); - - -MIDL_DEFINE_GUID(IID, IID_IFlashObjectInterface,0xD27CDB72,0xAE6D,0x11CF,0x96,0xB8,0x44,0x45,0x53,0x54,0x00,0x00); - - -MIDL_DEFINE_GUID(IID, IID_IServiceProvider,0x6D5140C1,0x7436,0x11CE,0x80,0x34,0x00,0xAA,0x00,0x60,0x09,0xFA); - - -MIDL_DEFINE_GUID(CLSID, CLSID_ShockwaveFlash,0xD27CDB6E,0xAE6D,0x11CF,0x96,0xB8,0x44,0x45,0x53,0x54,0x00,0x00); - - -MIDL_DEFINE_GUID(CLSID, CLSID_FlashObjectInterface,0xD27CDB71,0xAE6D,0x11CF,0x96,0xB8,0x44,0x45,0x53,0x54,0x00,0x00); - -#undef MIDL_DEFINE_GUID - -#ifdef __cplusplus -} -#endif - - - diff --git a/server/producers/flash/FlashAxContainer.cpp b/server/producers/flash/FlashAxContainer.cpp deleted file mode 100644 index 9f619e2ca..000000000 --- a/server/producers/flash/FlashAxContainer.cpp +++ /dev/null @@ -1,835 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\stdafx.h" - -#include "FlashAxContainer.h" -#include "..\..\application.h" -#include "..\..\window.h" -#include "..\..\monitor.h" -#include "flashproducer.h" -#include "TimerHelper.h" - -using namespace ATL; - -namespace caspar { -namespace flash { - -CComBSTR FlashAxContainer::flashGUID_(_T("{D27CDB6E-AE6D-11CF-96B8-444553540000}")); - -_ATL_FUNC_INFO fnInfoFlashCallEvent = { CC_STDCALL, VT_EMPTY, 1, { VT_BSTR } }; -_ATL_FUNC_INFO fnInfoReadyStateChangeEvent = { CC_STDCALL, VT_EMPTY, 1, { VT_I4 } }; - -FlashAxContainer::FlashAxContainer() : pFlashProducer_(0), bInPlaceActive_(FALSE), pTimerHelper(0), bInvalidRect_(false), bReadyToRender_(false), bHasNewTiming_(false) -{ -} -FlashAxContainer::~FlashAxContainer() -{ -// ReleaseAll(); - - if(pTimerHelper != 0) - delete pTimerHelper; -} - - -/////////////////// -// IObjectWithSite -/////////////////// -HRESULT STDMETHODCALLTYPE FlashAxContainer::SetSite(IUnknown* pUnkSite) -{ - ATLTRACE(_T("IObjectWithSite::SetSite\n")); - HRESULT hr = IObjectWithSiteImpl::SetSite(pUnkSite); - - if (SUCCEEDED(hr) && m_spUnkSite) - { - // Look for "outer" IServiceProvider - hr = m_spUnkSite->QueryInterface(__uuidof(IServiceProvider), (void**)&m_spServices); - ATLASSERT( !hr && _T("No ServiceProvider!") ); - } - - if (pUnkSite == NULL) - m_spServices.Release(); - - return hr; -} - -/////////////////// -// IOleClientSite -/////////////////// -HRESULT STDMETHODCALLTYPE FlashAxContainer::SaveObject() -{ - ATLTRACENOTIMPL(_T("IOleClientSite::SaveObject")); -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::GetMoniker(DWORD dwAssign, DWORD dwWhichMoniker, IMoniker** ppmk) -{ -/* if(*ppmk != NULL) { - if(m_spMyMoniker == NULL) { - ATL::CComObject* pMoniker = NULL; - HRESULT hr = ATL::CComObject::CreateInstance(&pMoniker); - if(SUCCEEDED(hr)) - m_spMyMoniker = pMoniker; - } - - if(m_spMyMoniker != NULL) { - *ppmk = m_spMyMoniker; - (*ppmk)->AddRef(); - return S_OK; - } - } -*/ if(ppmk != NULL) - *ppmk = NULL; - return E_FAIL; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::GetContainer(IOleContainer** ppContainer) -{ - ATLTRACE(_T("IOleClientSite::GetContainer\n")); - (*ppContainer) = NULL; - return E_NOINTERFACE; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::ShowObject() -{ - ATLTRACE(_T("IOleClientSite::ShowObject\n")); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::OnShowWindow(BOOL fShow) -{ - ATLTRACE(_T("IOleClientSite::OnShowWindow")); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::RequestNewObjectLayout() -{ - ATLTRACE(_T("IOleClientSite::RequestNewObjectLayout")); - return S_OK; -} - -/////////////////// -// IOleInPlaceSite -/////////////////// -HRESULT STDMETHODCALLTYPE FlashAxContainer::GetWindow(HWND* pHwnd) -{ - ATLTRACE(_T("IOleInPlaceSite::GetWindow\n")); - (*pHwnd) = NULL;//GetApplication()->GetMainWindow()->getHwnd(); - return E_FAIL; -} -HRESULT STDMETHODCALLTYPE FlashAxContainer::ContextSensitiveHelp(BOOL fEnterMode) -{ - ATLTRACE(_T("IOleInPlaceSite::ContextSensitiveHelp")); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::CanInPlaceActivate() -{ - ATLTRACE(_T("IOleInPlaceSite::CanInPlaceActivate\n")); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::OnInPlaceActivate() -{ - ATLTRACE(_T("IOleInPlaceSite::OnInPlaceActivate")); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::OnUIActivate() -{ - ATLTRACE(_T("IOleInPlaceSite::OnUIActivate\n")); - bUIActive_ = TRUE; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::GetWindowContext(IOleInPlaceFrame** ppFrame, IOleInPlaceUIWindow** ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO pFrameInfo) -{ - ATLTRACE(_T("IOleInPlaceSite::GetWindowContext\n")); - if (ppFrame != NULL) - *ppFrame = NULL; - if (ppDoc != NULL) - *ppDoc = NULL; - - if (ppFrame == NULL || ppDoc == NULL || lprcPosRect == NULL || lprcClipRect == NULL) - return E_POINTER; - - pFrameInfo->fMDIApp = FALSE; - pFrameInfo->haccel = NULL; - pFrameInfo->cAccelEntries = 0; - pFrameInfo->hwndFrame = NULL; - - lprcPosRect->top = m_rcPos.top; - lprcPosRect->left = m_rcPos.left; - lprcPosRect->right = m_rcPos.right; - lprcPosRect->bottom = m_rcPos.bottom; - - lprcClipRect->top = m_rcPos.top; - lprcClipRect->left = m_rcPos.left; - lprcClipRect->right = m_rcPos.right; - lprcClipRect->bottom = m_rcPos.bottom; - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::Scroll(SIZE scrollExtant) -{ - ATLTRACE(_T("IOleInPlaceSite::Scroll")); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::OnUIDeactivate(BOOL fUndoable) -{ - ATLTRACE(_T("IOleInPlaceSite::OnUIDeactivate\n")); - bUIActive_ = FALSE; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::OnInPlaceDeactivate() -{ - ATLTRACE(_T("IOleInPlaceSite::OnInPlaceDeactivate\n")); - bInPlaceActive_ = FALSE; - m_spInPlaceObjectWindowless.Release(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::DiscardUndoState() -{ - ATLTRACE(_T("IOleInPlaceSite::DiscardUndoState")); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::DeactivateAndUndo() -{ - ATLTRACE(_T("IOleInPlaceSite::DeactivateAndUndo")); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::OnPosRectChange(LPCRECT lprcPosRect) -{ - ATLTRACE(_T("IOleInPlaceSite::OnPosRectChange")); - return S_OK; -} - - -///////////////////// -// IOleInPlaceSiteEx -///////////////////// -HRESULT STDMETHODCALLTYPE FlashAxContainer::OnInPlaceActivateEx(BOOL* pfNoRedraw, DWORD dwFlags) -{ - // should only be called once the first time control is inplace-activated - ATLTRACE(_T("IOleInPlaceSiteEx::OnInPlaceActivateEx\n")); - ATLASSERT(bInPlaceActive_ == FALSE); - ATLASSERT(m_spInPlaceObjectWindowless == NULL); - - bInPlaceActive_ = TRUE; - OleLockRunning(m_spOleObject, TRUE, FALSE); - HRESULT hr = E_FAIL; - if (dwFlags & ACTIVATE_WINDOWLESS) - { - hr = m_spOleObject->QueryInterface(__uuidof(IOleInPlaceObjectWindowless), (void**) &m_spInPlaceObjectWindowless); - - if (m_spInPlaceObjectWindowless != NULL) - m_spInPlaceObjectWindowless->SetObjectRects(&m_rcPos, &m_rcPos); - } - - return (m_spInPlaceObjectWindowless != NULL) ? S_OK : E_FAIL; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::OnInPlaceDeactivateEx(BOOL fNoRedraw) -{ - ATLTRACE(_T("IOleInPlaceSiteEx::OnInPlaceDeactivateEx\n")); - bInPlaceActive_ = FALSE; - m_spInPlaceObjectWindowless.Release(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::RequestUIActivate() -{ - ATLTRACE(_T("IOleInPlaceSiteEx::RequestUIActivate\n")); - return S_OK; -} - - -///////////////////////////// -// IOleInPlaceSiteWindowless -///////////////////////////// -HRESULT STDMETHODCALLTYPE FlashAxContainer::CanWindowlessActivate() -{ - ATLTRACE(_T("IOleInPlaceSiteWindowless::CanWindowlessActivate\n")); - return S_OK; -// return S_FALSE; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::GetCapture() -{ - ATLTRACE(_T("IOleInPlaceSiteWindowless::GetCapture\n")); - return bCapture_ ? S_OK : S_FALSE; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::SetCapture(BOOL fCapture) -{ - ATLTRACE(_T("IOleInPlaceSiteWindowless::SetCapture\n")); - bCapture_ = fCapture; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::GetFocus() -{ - ATLTRACE(_T("IOleInPlaceSiteWindowless::GetFocus\n")); - return bHaveFocus_ ? S_OK : S_FALSE; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::SetFocus(BOOL fGotFocus) -{ - ATLTRACE(_T("IOleInPlaceSiteWindowless::SetFocus\n")); - bHaveFocus_ = fGotFocus; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::GetDC(LPCRECT pRect, DWORD grfFlags, HDC* phDC) -{ - ATLTRACE(_T("IOleInPlaceSiteWindowless::GetDC")); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::ReleaseDC(HDC hDC) -{ - ATLTRACE(_T("IOleInPlaceSiteWindowless::ReleaseDC")); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::InvalidateRect(LPCRECT pRect, BOOL fErase) -{ -// ATLTRACE(_T("IOleInPlaceSiteWindowless::InvalidateRect\n")); - - bInvalidRect_ = true; - -/* //Keep a list of dirty rectangles in order to be able to redraw only them - if(pRect != NULL) { - bDirtyRects_.push_back(DirtyRect(*pRect, fErase != 0)); - } - else { - bDirtyRects_.push_back(DirtyRect(true)); - } -*/ return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::InvalidateRgn(HRGN hRGN, BOOL fErase) -{ - ATLTRACE(_T("IOleInPlaceSiteWindowless::InvalidateRng\n")); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::ScrollRect(INT dx, INT dy, LPCRECT pRectScroll, LPCRECT pRectClip) -{ - ATLTRACE(_T("IOleInPlaceSiteWindowless::ScrollRect")); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::AdjustRect(LPRECT prc) -{ - ATLTRACE(_T("IOleInPlaceSiteWindowless::AdjustRect")); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::OnDefWindowMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT* plResult) -{ - ATLTRACE(_T("IOleInPlaceSiteWindowless::OnDefWindowMessage")); - return S_OK; -} - -/////////////////// -// IOleControlSite -/////////////////// -HRESULT STDMETHODCALLTYPE FlashAxContainer::OnControlInfoChanged() -{ - ATLTRACE(_T("IOleControlSite::OnControlInfoChanged")); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::LockInPlaceActive(BOOL fLock) -{ - ATLTRACE(_T("IOleControlSite::LockInPlaceActive")); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::GetExtendedControl(IDispatch** ppDisp) -{ - ATLTRACE(_T("IOleControlSite::GetExtendedControl")); - - if (ppDisp == NULL) - return E_POINTER; - return m_spOleObject.QueryInterface(ppDisp); -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::TransformCoords(POINTL* pPtlHimetric, POINTF* pPtfContainer, DWORD dwFlags) -{ - ATLTRACE(_T("IOleControlSite::TransformCoords")); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::TranslateAccelerator(LPMSG lpMsg, DWORD grfModifiers) -{ - ATLTRACE(_T("IOleControlSite::TranslateAccelerator")); - return S_FALSE; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::OnFocus(BOOL fGotFocus) -{ - bHaveFocus_ = fGotFocus; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::ShowPropertyFrame() -{ - ATLTRACE(_T("IOleControlSite::ShowPropertyFrame")); - return S_OK; -} - - -/////////////////// -// IAdviseSink -/////////////////// -void STDMETHODCALLTYPE FlashAxContainer::OnDataChange(FORMATETC* pFormatetc, STGMEDIUM* pStgmed) -{ - ATLTRACE(_T("IAdviseSink::OnDataChange\n")); -} - -void STDMETHODCALLTYPE FlashAxContainer::OnViewChange(DWORD dwAspect, LONG lindex) -{ - ATLTRACE(_T("IAdviseSink::OnViewChange\n")); -} - -void STDMETHODCALLTYPE FlashAxContainer::OnRename(IMoniker* pmk) -{ - ATLTRACE(_T("IAdviseSink::OnRename\n")); -} - -void STDMETHODCALLTYPE FlashAxContainer::OnSave() -{ - ATLTRACE(_T("IAdviseSink::OnSave\n")); -} - -void STDMETHODCALLTYPE FlashAxContainer::OnClose() -{ - ATLTRACE(_T("IAdviseSink::OnClose\n")); -} - - -/////////////////// -// IServiceProvider -/////////////////// -HRESULT STDMETHODCALLTYPE FlashAxContainer::QueryService( REFGUID rsid, REFIID riid, void** ppvObj) -{ -// ATLTRACE(_T("IServiceProvider::QueryService\n")); - //the flashcontrol asks for an interface {618F8AD4-8B7A-11D0-8FCC-00C04FD9189D}, this is IID for a DirectDraw3 object - - ATLASSERT(ppvObj != NULL); - if (ppvObj == NULL) - return E_POINTER; - *ppvObj = NULL; - - //TODO: The fullscreen-consumer requires that ths does NOT return an ITimerService - HRESULT hr = QueryInterface(riid, ppvObj);//E_NOINTERFACE; - - return hr; -} - - -/////////////////// -// ITimerService -/////////////////// -HRESULT STDMETHODCALLTYPE FlashAxContainer::CreateTimer(ITimer *pReferenceTimer, ITimer **ppNewTimer) -{ - ATLTRACE(_T("ITimerService::CreateTimer\n")); - if(pTimerHelper != 0) - { - delete pTimerHelper; - pTimerHelper = 0; - } - pTimerHelper = new TimerHelper(); - return QueryInterface(__uuidof(ITimer), (void**) ppNewTimer); -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::GetNamedTimer(REFGUID rguidName, ITimer **ppTimer) -{ - ATLTRACE(_T("ITimerService::GetNamedTimer")); - if(ppTimer == NULL) - return E_POINTER; - else - *ppTimer = NULL; - - return E_FAIL; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::SetNamedTimerReference(REFGUID rguidName, ITimer *pReferenceTimer) -{ - ATLTRACE(_T("ITimerService::SetNamedTimerReference")); - return S_OK; -} - -/////////// -// ITimer -/////////// -HRESULT STDMETHODCALLTYPE FlashAxContainer::Advise(VARIANT vtimeMin, VARIANT vtimeMax, VARIANT vtimeInterval, DWORD dwFlags, ITimerSink *pTimerSink, DWORD *pdwCookie) -{ - ATLTRACE(_T("Timer::Advise\n")); - if(pdwCookie == 0) - return E_POINTER; - - if(pTimerHelper != 0) - { - pTimerHelper->Setup(vtimeMin.ulVal, vtimeInterval.ulVal, pTimerSink); - *pdwCookie = pTimerHelper->ID; - bHasNewTiming_ = true; - - return S_OK; - } - else - return E_OUTOFMEMORY; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::Unadvise(/* [in] */ DWORD dwCookie) -{ - ATLTRACE(_T("Timer::Unadvice\n")); - if(pTimerHelper != 0) - { - pTimerHelper->pTimerSink = 0; - return S_OK; - } - else - return E_FAIL; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::Freeze(/* [in] */ BOOL fFreeze) -{ - ATLTRACE(_T("Timer::Freeze\n")); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE FlashAxContainer::GetTime(/* [out] */ VARIANT *pvtime) -{ - ATLTRACE(_T("Timer::GetTime\n")); - if(pvtime == 0) - return E_POINTER; - -// return E_NOTIMPL; - pvtime->lVal = 0; - return S_OK; -} - -int FlashAxContainer::GetFPS() { - if(pTimerHelper != 0 && pTimerHelper->interval > 0) - return (1000 / pTimerHelper->interval); - - return 0; -} - -bool FlashAxContainer::IsReadyToRender() const { - return bReadyToRender_; -} - -void FlashAxContainer::EnterFullscreen() -{ - if(m_spInPlaceObjectWindowless != 0) - { - HRESULT result; - m_spInPlaceObjectWindowless->OnWindowMessage(WM_LBUTTONDOWN, 0, MAKELPARAM(1, 1), &result); - m_spInPlaceObjectWindowless->OnWindowMessage(WM_LBUTTONUP, 0, MAKELPARAM(1, 1), &result); - } -} - -void STDMETHODCALLTYPE FlashAxContainer::OnFlashCall(BSTR request) -{ - tstring str(request); - if(str.find(TEXT("DisplayedTemplate")) != tstring::npos) - { - ATLTRACE(_T("ShockwaveFlash::DisplayedTemplate\n")); - bReadyToRender_ = true; - } - else if(str.find(TEXT("OnCommand")) != tstring::npos) { - //this is how templatehost 1.8 reports that a command has been received - LOG << utils::LogLevel::Verbose << TEXT("TEMPLATEHOST: ") << str; - bCallSuccessful_ = true; - } - else if(str.find(TEXT("Activity")) != tstring::npos) - { - LOG << utils::LogLevel::Verbose << TEXT("TEMPLATEHOST: ") << str; - - //this is how templatehost 1.7 reports that a command has been received - if(str.find(TEXT("Command recieved")) != tstring::npos) - bCallSuccessful_ = true; - - /*if(pFlashProducer_ != 0 && pFlashProducer_->pMonitor_) { - tstring::size_type pos = str.find(TEXT('@')); - if(pos != tstring::npos) - pFlashProducer_->pMonitor_->Inform(str.substr(pos, str.find(TEXT('<'), pos)-pos)); - }*/ - } - else if(str.find(TEXT("OnNotify")) != tstring::npos) - { - LOG << utils::LogLevel::Verbose << TEXT("TEMPLATEHOST: ") << str; - - //if(pFlashProducer_ != 0 && pFlashProducer_->pMonitor_) { - // tstring::size_type pos = str.find(TEXT('@')); - // if(pos != tstring::npos) - // pFlashProducer_->pMonitor_->Inform(str.substr(pos, str.find(TEXT('<'), pos)-pos)); - //} - } - else if(str.find(TEXT("IsEmpty")) != tstring::npos) - { - ATLTRACE(_T("ShockwaveFlash::IsEmpty\n")); - bIsEmpty_ = true; - if(pFlashProducer_ != 0 && pFlashProducer_->emptyCallback) - pFlashProducer_->emptyCallback(); - } - else if(str.find(TEXT("OnError")) != tstring::npos) - { - LOG << "FLASHERROR: " << str; - } - - CComPtr spFlash; - HRESULT hr = m_spOleObject->QueryInterface(__uuidof(IShockwaveFlash), (void**) &spFlash); - if(hr == S_OK && spFlash) - { - hr = spFlash->SetReturnValue(TEXT("")); - } -} - -void STDMETHODCALLTYPE FlashAxContainer::OnReadyStateChange(long newState) -{ - if(newState == 4) - { - bReadyToRender_ = true; - } - else - bReadyToRender_ = false; -} - -void FlashAxContainer::DestroyAxControl() -{ - GetControllingUnknown()->AddRef(); - - if ((!m_spViewObject) == false) - m_spViewObject->SetAdvise(DVASPECT_CONTENT, 0, NULL); - - if ((!m_spOleObject) == false) - { - DispEventUnadvise(m_spOleObject, &DIID__IShockwaveFlashEvents); - m_spOleObject->Unadvise(m_dwOleObject); - m_spOleObject->Close(OLECLOSE_NOSAVE); - m_spOleObject->SetClientSite(NULL); - } - - if ((!m_spUnknown) == false) - { - CComPtr spSite; - m_spUnknown->QueryInterface(__uuidof(IObjectWithSite), (void**)&spSite); - if (spSite != NULL) - spSite->SetSite(NULL); - } - - if ((!m_spViewObject) == false) - m_spViewObject.Release(); - - if ((!m_spInPlaceObjectWindowless) == false) - m_spInPlaceObjectWindowless.Release(); - - if ((!m_spOleObject) == false) - m_spOleObject.Release(); - - if ((!m_spUnknown) == false) - m_spUnknown.Release(); -} - -bool FlashAxContainer::CheckForFlashSupport() -{ - CLSID clsid; - return SUCCEEDED(CLSIDFromString((LPOLESTR)flashGUID_, &clsid)); -} - -HRESULT FlashAxContainer::CreateAxControl() -{ - CLSID clsid; - HRESULT hr = CLSIDFromString((LPOLESTR)flashGUID_, &clsid); - if(SUCCEEDED(hr)) - hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, __uuidof(IUnknown), (void**)&m_spUnknown); - -//Start ActivateAx - if(SUCCEEDED(hr)) - { - m_spUnknown->QueryInterface(__uuidof(IOleObject), (void**)&m_spOleObject); - if(m_spOleObject) - { - m_spOleObject->GetMiscStatus(DVASPECT_CONTENT, &m_dwMiscStatus); - if (m_dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST) - { - CComQIPtr spClientSite(GetControllingUnknown()); - m_spOleObject->SetClientSite(spClientSite); - } - - //Initialize control - CComQIPtr spPSI(m_spOleObject); - if (spPSI) - hr = spPSI->InitNew(); - - if (FAILED(hr)) // If the initialization of the control failed... - { - // Clean up and return - if (m_dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST) - m_spOleObject->SetClientSite(NULL); - - m_dwMiscStatus = 0; - m_spOleObject.Release(); - m_spUnknown.Release(); - - return hr; - } - //end Initialize object - - if (0 == (m_dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST)) - { - CComQIPtr spClientSite(GetControllingUnknown()); - m_spOleObject->SetClientSite(spClientSite); - } - - CComPtr spFlash; - HRESULT hResultQuality; - HRESULT hr2 = m_spOleObject->QueryInterface(__uuidof(IShockwaveFlash), (void**) &spFlash); - if(hr2 == S_OK && spFlash) - { - spFlash->put_WMode(TEXT("Transparent")); - //spFlash->put_WMode(TEXT("GPU")); - hResultQuality = spFlash->put_Quality2(TEXT("Best")); - } - if(SUCCEEDED(DispEventAdvise(spFlash, &DIID__IShockwaveFlashEvents))) - { - } - - HRESULT hrView = m_spOleObject->QueryInterface(__uuidof(IViewObjectEx), (void**) &m_spViewObject); - - CComQIPtr spAdviseSink(GetControllingUnknown()); - m_spOleObject->Advise(spAdviseSink, &m_dwOleObject); - if (m_spViewObject) - m_spViewObject->SetAdvise(DVASPECT_CONTENT, 0, spAdviseSink); - - if ((m_dwMiscStatus & OLEMISC_INVISIBLEATRUNTIME) == 0) - { - //Initialize window to some dummy size - m_rcPos.top = 0; - m_rcPos.left = 0; - m_rcPos.right = 720; - m_rcPos.bottom = 576; - - m_pxSize.cx = m_rcPos.right - m_rcPos.left; - m_pxSize.cy = m_rcPos.bottom - m_rcPos.top; - AtlPixelToHiMetric(&m_pxSize, &m_hmSize); - m_spOleObject->SetExtent(DVASPECT_CONTENT, &m_hmSize); - m_spOleObject->GetExtent(DVASPECT_CONTENT, &m_hmSize); - AtlHiMetricToPixel(&m_hmSize, &m_pxSize); - m_rcPos.right = m_rcPos.left + m_pxSize.cx; - m_rcPos.bottom = m_rcPos.top + m_pxSize.cy; - - CComQIPtr spClientSite(GetControllingUnknown()); - hr = m_spOleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, NULL, spClientSite, 0, NULL, &m_rcPos); - } - } - CComPtr spSite; - m_spUnknown->QueryInterface(__uuidof(IObjectWithSite), (void**)&spSite); - if (spSite != NULL) - spSite->SetSite(GetControllingUnknown()); - } -//End ActivateAx - -// hr = E_FAIL; - if (FAILED(hr) || m_spUnknown == NULL) - { - return E_FAIL; - // We don't have a control or something failed so release -// ReleaseAll(); - } - - return S_OK; -} - -void FlashAxContainer::SetFormat(const caspar::FrameFormatDescription& fmtDesc) { - if(m_spInPlaceObjectWindowless != 0) - { - m_rcPos.top = 0; - m_rcPos.left = 0; - m_rcPos.right = fmtDesc.width; - m_rcPos.bottom = fmtDesc.height; - - m_pxSize.cx = m_rcPos.right - m_rcPos.left; - m_pxSize.cy = m_rcPos.bottom - m_rcPos.top; - AtlPixelToHiMetric(&m_pxSize, &m_hmSize); - m_spOleObject->SetExtent(DVASPECT_CONTENT, &m_hmSize); - m_spOleObject->GetExtent(DVASPECT_CONTENT, &m_hmSize); - AtlHiMetricToPixel(&m_hmSize, &m_pxSize); - m_rcPos.right = m_rcPos.left + m_pxSize.cx; - m_rcPos.bottom = m_rcPos.top + m_pxSize.cy; - - m_spInPlaceObjectWindowless->SetObjectRects(&m_rcPos, &m_rcPos); - bInvalidRect_ = true; - } -} - -HRESULT FlashAxContainer::QueryControl(REFIID iid, void** ppUnk) -{ - ATLASSERT(ppUnk != NULL); - if (ppUnk == NULL) - return E_POINTER; - HRESULT hr; - hr = m_spOleObject->QueryInterface(iid, ppUnk); - return hr; -} - -bool FlashAxContainer::DrawControl(HDC targetDC) -{ -// ATLTRACE(_T("FlashAxContainer::DrawControl\n")); - DVASPECTINFO aspectInfo = {sizeof(DVASPECTINFO), DVASPECTINFOFLAG_CANOPTIMIZE}; - HRESULT hr = S_OK; - - hr = m_spViewObject->Draw(DVASPECT_CONTENT, -1, &aspectInfo, NULL, NULL, targetDC, NULL, NULL, NULL, NULL); - -/* const caspar::FrameFormatDescription& fmtDesc = caspar::FrameFormatDescription::FormatDescriptions[format_]; - - //Trying to redraw just the dirty rectangles. Doesn't seem to work when the movie uses "filters", such as glow, dropshadow etc. - std::vector::iterator it = bDirtyRects_.begin(); - std::vector::iterator end = bDirtyRects_.end(); - for(; it != end; ++it) { - flash::DirtyRect& dirtyRect = (*it); - if(dirtyRect.bWhole || dirtyRect.rect.right >= fmtDesc.width || dirtyRect.rect.bottom >= fmtDesc.height) { - m_spInPlaceObjectWindowless->SetObjectRects(&m_rcPos, &m_rcPos); - hr = m_spViewObject->Draw(DVASPECT_OPAQUE, -1, NULL, NULL, NULL, targetDC, NULL, NULL, NULL, NULL); - break; - } - else { - m_spInPlaceObjectWindowless->SetObjectRects(&m_rcPos, &(dirtyRect.rect)); - hr = m_spViewObject->Draw(DVASPECT_OPAQUE, -1, NULL, NULL, NULL, targetDC, NULL, NULL, NULL, NULL); - } - } - bDirtyRects_.clear(); -*/ - - return (hr == S_OK); -} - -} //namespace flash -} //namespace caspar \ No newline at end of file diff --git a/server/producers/flash/FlashAxContainer.h b/server/producers/flash/FlashAxContainer.h deleted file mode 100644 index 9a956aba9..000000000 --- a/server/producers/flash/FlashAxContainer.h +++ /dev/null @@ -1,283 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _FLASHAXCONTAINER_H__ -#define _FLASHAXCONTAINER_H__ - -#pragma once - -#include -#include -#include - - -#include -#include "..\..\frame\Frame.h" -#include - -#include "axflash.h" -//#import "progid:ShockwaveFlash.ShockwaveFlash.9" no_namespace, named_guids - -namespace caspar { - -class FlashProducer; - -namespace flash { - -class TimerHelper; -struct DirtyRect { - DirtyRect(LONG l, LONG t, LONG r, LONG b, bool e) : bErase(e), bWhole(false) { - rect.left = l; - rect.top = t; - rect.right = r; - rect.bottom = b; - } - DirtyRect(const RECT& rc, bool e) : bErase(e), bWhole(false) { - rect.left = rc.left; - rect.top = rc.top; - rect.right = rc.right; - rect.bottom = rc.bottom; - } - explicit DirtyRect(bool b) : bWhole(b) {} - - RECT rect; - bool bErase; - bool bWhole; -}; - -extern _ATL_FUNC_INFO fnInfoFlashCallEvent; -extern _ATL_FUNC_INFO fnInfoReadyStateChangeEvent; - -class ATL_NO_VTABLE FlashAxContainer : - public ATL::CComCoClass, - public ATL::CComObjectRootEx, - public IOleClientSite, - public IOleContainer, - public IOleControlSite, - public IOleInPlaceSiteWindowless, - public IObjectWithSiteImpl, - public IServiceProvider, - public IAdviseSink, - public ITimerService, - public ITimer, - public IDispatchImpl, - public IDispEventSimpleImpl<0, FlashAxContainer, &DIID__IShockwaveFlashEvents> -{ - -public: - - FlashAxContainer(); - virtual ~FlashAxContainer(); - - DECLARE_NO_REGISTRY() - DECLARE_POLY_AGGREGATABLE(FlashAxContainer) - DECLARE_GET_CONTROLLING_UNKNOWN() - - BEGIN_COM_MAP(FlashAxContainer) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(IOleClientSite) - COM_INTERFACE_ENTRY(IObjectWithSite) - COM_INTERFACE_ENTRY(IOleControlSite) - COM_INTERFACE_ENTRY(IOleContainer) - - COM_INTERFACE_ENTRY(IOleInPlaceSiteWindowless) - COM_INTERFACE_ENTRY(IOleInPlaceSiteEx) - COM_INTERFACE_ENTRY(IOleInPlaceSite) - COM_INTERFACE_ENTRY(IOleWindow) - - COM_INTERFACE_ENTRY(IServiceProvider) - - COM_INTERFACE_ENTRY(IAdviseSink) - - COM_INTERFACE_ENTRY(ITimerService) - - COM_INTERFACE_ENTRY(ITimer) - END_COM_MAP() - - BEGIN_SINK_MAP(FlashAxContainer) - SINK_ENTRY_INFO(0, DIID__IShockwaveFlashEvents, 0xc5, OnFlashCall, &fnInfoFlashCallEvent) - SINK_ENTRY_INFO(0, DIID__IShockwaveFlashEvents, 0xfffffd9f, OnReadyStateChange, &fnInfoReadyStateChangeEvent) - END_SINK_MAP() - - void STDMETHODCALLTYPE OnFlashCall(BSTR request); - void STDMETHODCALLTYPE OnReadyStateChange(long newState); - -// IObjectWithSite - STDMETHOD(SetSite)(IUnknown* pUnkSite); - -// IOleClientSite - STDMETHOD(SaveObject)(); - STDMETHOD(GetMoniker)(DWORD dwAssign, DWORD dwWhichMoniker, IMoniker** ppmk); - STDMETHOD(GetContainer)(IOleContainer** ppContainer); - STDMETHOD(ShowObject)(); - STDMETHOD(OnShowWindow)(BOOL fShow); - STDMETHOD(RequestNewObjectLayout)(); - -// IOleInPlaceSite - STDMETHOD(GetWindow)(HWND* pHwnd); - STDMETHOD(ContextSensitiveHelp)(BOOL fEnterMode); - STDMETHOD(CanInPlaceActivate)(); - STDMETHOD(OnInPlaceActivate)(); - STDMETHOD(OnInPlaceDeactivate)(); - STDMETHOD(OnUIActivate)(); - STDMETHOD(OnUIDeactivate)(BOOL fUndoable); - STDMETHOD(GetWindowContext)(IOleInPlaceFrame** ppFrame, IOleInPlaceUIWindow** ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO pFrameInfo); - STDMETHOD(Scroll)(SIZE scrollExtant); - STDMETHOD(DiscardUndoState)(); - STDMETHOD(DeactivateAndUndo)(); - STDMETHOD(OnPosRectChange)(LPCRECT lprcPosRect); - -// IOleInPlaceSiteEx - STDMETHOD(OnInPlaceActivateEx)(BOOL* pfNoRedraw, DWORD dwFlags); - STDMETHOD(OnInPlaceDeactivateEx)(BOOL fNoRedraw); - STDMETHOD(RequestUIActivate)(); - -// IOleInPlaceSiteWindowless - STDMETHOD(CanWindowlessActivate)(); - STDMETHOD(GetCapture)(); - STDMETHOD(SetCapture)(BOOL fCapture); - STDMETHOD(GetFocus)(); - STDMETHOD(SetFocus)(BOOL fGotFocus); - STDMETHOD(GetDC)(LPCRECT pRect, DWORD grfFlags, HDC* phDC); - STDMETHOD(ReleaseDC)(HDC hDC); - STDMETHOD(InvalidateRect)(LPCRECT pRect, BOOL fErase); - STDMETHOD(InvalidateRgn)(HRGN hRGN, BOOL fErase); - STDMETHOD(ScrollRect)(INT dx, INT dy, LPCRECT pRectScroll, LPCRECT pRectClip); - STDMETHOD(AdjustRect)(LPRECT prc); - STDMETHOD(OnDefWindowMessage)(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT* plResult); - -// IOleControlSite - STDMETHOD(OnControlInfoChanged)(); - STDMETHOD(LockInPlaceActive)(BOOL fLock); - STDMETHOD(GetExtendedControl)(IDispatch** ppDisp); - STDMETHOD(TransformCoords)(POINTL* pPtlHimetric, POINTF* pPtfContainer, DWORD dwFlags); - STDMETHOD(TranslateAccelerator)(LPMSG lpMsg, DWORD grfModifiers); - STDMETHOD(OnFocus)(BOOL fGotFocus); - STDMETHOD(ShowPropertyFrame)(); - -// IAdviseSink - STDMETHOD_(void, OnDataChange)(FORMATETC* pFormatetc, STGMEDIUM* pStgmed); - STDMETHOD_(void, OnViewChange)(DWORD dwAspect, LONG lindex); - STDMETHOD_(void, OnRename)(IMoniker* pmk); - STDMETHOD_(void, OnSave)(); - STDMETHOD_(void, OnClose)(); - -// IServiceProvider - STDMETHOD(QueryService)( REFGUID rsid, REFIID riid, void** ppvObj); - -// IOleContainer - STDMETHOD(ParseDisplayName)(IBindCtx*, LPOLESTR, ULONG*, IMoniker**) - { - ATLTRACENOTIMPL(_T("IOleContainer::ParseDisplayName")); - } - STDMETHOD(EnumObjects)(DWORD, IEnumUnknown** ppenum) - { - if (ppenum == NULL) - return E_POINTER; - *ppenum = NULL; - typedef CComObject > > enumunk; - enumunk* p = NULL; - ATLTRY(p = new enumunk); - if(p == NULL) - return E_OUTOFMEMORY; - IUnknown* pTemp = m_spUnknown; - // There is always only one object. - HRESULT hRes = p->Init(reinterpret_cast(&pTemp), reinterpret_cast(&pTemp + 1), GetControllingUnknown(), AtlFlagCopy); - if (SUCCEEDED(hRes)) - hRes = p->QueryInterface(__uuidof(IEnumUnknown), (void**)ppenum); - if (FAILED(hRes)) - delete p; - return hRes; - } - STDMETHOD(LockContainer)(BOOL) - { - ATLTRACENOTIMPL(_T("IOleContainer::LockContainer")); - } - -//ITimerService - STDMETHOD(CreateTimer)(ITimer *pReferenceTimer, ITimer **ppNewTimer); - STDMETHOD(GetNamedTimer)(REFGUID rguidName, ITimer **ppTimer); - STDMETHOD(SetNamedTimerReference)(REFGUID rguidName, ITimer *pReferenceTimer); - -//ITimer - STDMETHOD(Advise)(VARIANT vtimeMin, VARIANT vtimeMax, VARIANT vtimeInterval, DWORD dwFlags, ITimerSink *pTimerSink, DWORD *pdwCookie); - STDMETHOD(Unadvise)(DWORD dwCookie); - STDMETHOD(Freeze)(BOOL fFreeze); - STDMETHOD(GetTime)(VARIANT *pvtime); - int GetFPS(); - - HRESULT CreateAxControl(); - void DestroyAxControl(); - HRESULT QueryControl(REFIID iid, void** ppUnk); - - template - HRESULT QueryControl(Q** ppUnk) - { - return QueryControl(__uuidof(Q), (void**)ppUnk); - } - -// static ATL::CComObject* CreateInstance(); - - bool DrawControl(HDC targetDC); - - TimerHelper* pTimerHelper; - volatile bool bInvalidRect_; - volatile bool bCallSuccessful_; - volatile bool bReadyToRender_; - volatile bool bIsEmpty_; - volatile bool bHasNewTiming_; - FlashProducer* pFlashProducer_; - std::vector bDirtyRects_; - - void SetFormat(const caspar::FrameFormatDescription&); - bool IsReadyToRender() const; - void EnterFullscreen(); - - static bool CheckForFlashSupport(); - - ATL::CComPtr m_spInPlaceObjectWindowless; - -private: - static CComBSTR flashGUID_; - -// state - bool bUIActive_; - bool bInPlaceActive_; - unsigned long bHaveFocus_ : 1; - unsigned long bCapture_ : 1; - - DWORD m_dwOleObject; - DWORD m_dwMiscStatus; - SIZEL m_hmSize; - SIZEL m_pxSize; - RECT m_rcPos; - - ATL::CComPtr m_spUnknown; - ATL::CComPtr m_spServices; - ATL::CComPtr m_spOleObject; - ATL::CComPtr m_spViewObject; - -// ATL::CComPtr > m_spMyMoniker; -}; - -} //namespace flash -} //namespace caspar - -#endif //_FLASHAXCONTAINER_H__ \ No newline at end of file diff --git a/server/producers/flash/FlashCommand.cpp b/server/producers/flash/FlashCommand.cpp deleted file mode 100644 index 35a959ce2..000000000 --- a/server/producers/flash/FlashCommand.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\stdafx.h" - -#include "FlashCommand.h" -#include "FlashManager.h" -#include "FlashProducer.h" - -namespace caspar -{ - -////////////////////// -// FlashCommand -FlashCommand::FlashCommand(FlashProducer* pHost) : pHost_(pHost), eventDone_(FALSE, FALSE) -{} - -FlashCommand::~FlashCommand() { -} - -void FlashCommand::Execute() -{ - if(pHost_ != 0) - result = DoExecute(); - - eventDone_.Set(); -} - -void FlashCommand::Cancel() { - eventDone_.Set(); -} - -bool FlashCommand::Wait(DWORD timeout) -{ - if(!pHost_->worker_.IsRunning()) - return false; - - HRESULT result = WaitForSingleObject(eventDone_, timeout); - return (result == WAIT_OBJECT_0); -} - -///////////////////////// -// GenericFlashCommand -GenericFlashCommand::GenericFlashCommand(caspar::FlashProducer *pHost, caspar::FlashMemberFnPtr pFunction) : FlashCommand(pHost), pFunction_(pFunction) { -} -GenericFlashCommand::GenericFlashCommand(caspar::FlashProducer *pHost, caspar::FlashMemberFnPtr pFunction, const tstring ¶meter) : FlashCommand(pHost), pFunction_(pFunction), parameter_(parameter) { -} -GenericFlashCommand::~GenericFlashCommand() { -} - -bool GenericFlashCommand::DoExecute() { - if(pFunction_ != 0) - return (GetHost()->*pFunction_)(parameter_); - - return false; -} - -//////////////////////////// -// InitializeFlashCommand -InitializeFlashCommand::InitializeFlashCommand(FlashProducer *pHost, FrameManagerPtr pFrameManager) : FlashCommand(pHost), pFrameManager_(pFrameManager) { -} - -InitializeFlashCommand::~InitializeFlashCommand() { -} - -bool InitializeFlashCommand::DoExecute() { - return GetHost()->DoInitialize(pFrameManager_); -} - -} \ No newline at end of file diff --git a/server/producers/flash/FlashCommand.h b/server/producers/flash/FlashCommand.h deleted file mode 100644 index 2844ae5f6..000000000 --- a/server/producers/flash/FlashCommand.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _FLASHCOMMAND_H_ -#define _FLASHCOMMAND_H_ - -#include "..\..\utils\Event.h" - -namespace caspar -{ - -class FlashProducer; -typedef bool (FlashProducer::*FlashMemberFnPtr)(const tstring&); - -class FrameManager; -typedef std::tr1::shared_ptr FrameManagerPtr; - -class FlashCommand -{ -protected: - explicit FlashCommand(FlashProducer* pHost); - virtual bool DoExecute() = 0; - - FlashProducer* GetHost() { - return pHost_; - } - -public: - virtual ~FlashCommand(); - - void Execute(); - void Cancel(); - bool Wait(DWORD timeout); - - bool GetResult() { - return result; - } - -private: - bool result; - - utils::Event eventDone_; - FlashProducer* pHost_; -}; - -class GenericFlashCommand : public FlashCommand -{ -public: - GenericFlashCommand(FlashProducer* pHost, FlashMemberFnPtr pFunction); - GenericFlashCommand(FlashProducer* pHost, FlashMemberFnPtr pFunction, const tstring& parameter); - virtual ~GenericFlashCommand(); - -private: - typedef std::tr1::shared_ptr FlashCommandPtr; - - virtual bool DoExecute(); - FlashMemberFnPtr pFunction_; - tstring parameter_; -}; - -class InitializeFlashCommand : public FlashCommand -{ -public: - InitializeFlashCommand(FlashProducer* pHost, FrameManagerPtr pFrameManager); - virtual ~InitializeFlashCommand(); - -private: - virtual bool DoExecute(); - FrameManagerPtr pFrameManager_; -}; - -} - -#endif \ No newline at end of file diff --git a/server/producers/flash/FlashCommandQueue.cpp b/server/producers/flash/FlashCommandQueue.cpp deleted file mode 100644 index 254ecb0aa..000000000 --- a/server/producers/flash/FlashCommandQueue.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\stdafx.h" - -#include "FlashCommandQueue.h" -#include "FlashCommand.h" -#include "FlashManager.h" -#include - -namespace caspar { -namespace flash { - -FlashCommandQueue::FlashCommandQueue() : newCommandEvent_(TRUE, FALSE) { -} - -FlashCommandQueue::~FlashCommandQueue() { -} - -void CancelCommand(FlashCommandPtr& pCommand) { - if(pCommand != 0) - pCommand->Cancel(); -} - -void FlashCommandQueue::Clear() -{ - Lock lock(*this); - - std::for_each (commands_.begin(), commands_.end(), CancelCommand); - commands_.clear(); - - newCommandEvent_.Reset(); -} - -void FlashCommandQueue::Push(FlashCommandPtr pNewCommand) -{ - { - Lock lock(*this); - commands_.push_back(pNewCommand); - } - - newCommandEvent_.Set(); -} - -FlashCommandPtr FlashCommandQueue::Pop() -{ - Lock lock(*this); - - FlashCommandPtr result; - if(commands_.size() > 0) - { - result = commands_.front(); - commands_.pop_front(); - - if(commands_.size() == 0) - newCommandEvent_.Reset(); - } - - return result; -} - -} //namespace flash -} //namespace caspar \ No newline at end of file diff --git a/server/producers/flash/FlashCommandQueue.h b/server/producers/flash/FlashCommandQueue.h deleted file mode 100644 index 14bed0f4e..000000000 --- a/server/producers/flash/FlashCommandQueue.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _FLASHCOMMANDQUEUE_H__ -#define _FLASHCOMMANDQUEUE_H__ - -#pragma once - -#include -#include -#include "..\..\utils\Lockable.h" -#include "..\..\utils\event.h" - -namespace caspar { - -class FlashCommand; -typedef std::tr1::shared_ptr FlashCommandPtr; - -namespace flash { - -//LoadCommand - creates axControl and loads it with the swf -//StartCommand - Creates the buffers, DC and BITMAP and starts generating frames -//ParamCommand - Sends a parameter to the swf - - -class FlashCommandQueue : private utils::LockableObject -{ - FlashCommandQueue(const FlashCommandQueue&); - FlashCommandQueue& operator=(const FlashCommandQueue&); -public: - FlashCommandQueue(); - ~FlashCommandQueue(); - - void Push(FlashCommandPtr pCommand); - FlashCommandPtr Pop(); - - void Clear(); - - HANDLE GetWaitHandle() { - return newCommandEvent_; - } - -private: - utils::Event newCommandEvent_; - - //Needs synro-protection - std::list commands_; -}; - -} //namespace flash -} //namespace caspar - -#endif //_FLASHCOMMANDQUEUE_H__ \ No newline at end of file diff --git a/server/producers/flash/FlashManager.cpp b/server/producers/flash/FlashManager.cpp deleted file mode 100644 index db2843250..000000000 --- a/server/producers/flash/FlashManager.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\stdafx.h" - -#include "FlashManager.h" -#include "..\..\frame\FrameManager.h" -#include "..\..\Application.h" -#include "..\..\utils\image\Image.hpp" -#include "TimerHelper.h" - -#include -#include -#pragma intrinsic(__movsd, __stosd) - -#include -#include -#include - -#include "FlashProducer.h" - -namespace caspar { - -using namespace utils; - - -FlashManager::FlashManager() -{ - _extensions.push_back(TEXT("swf")); - - //Check that flash is installed - ATL::CComBSTR flashGUID(_T("{D27CDB6E-AE6D-11CF-96B8-444553540000}")); - CLSID clsid; - if(!SUCCEEDED(CLSIDFromString((LPOLESTR)flashGUID, &clsid))) { - throw std::exception("No Flash activex player installed"); - } -} - -FlashManager::~FlashManager() { -} - -MediaProducerPtr FlashManager::CreateProducer(const tstring& filename) -{ - return FlashProducer::Create(filename); -} - -bool FlashManager::getFileInfo(FileInfo* pFileInfo) -{ - if(pFileInfo->filetype == TEXT("swf")) - { - pFileInfo->length = 0; //get real length from file - pFileInfo->type = TEXT("movie"); - pFileInfo->encoding = TEXT("swf"); - } - return true; -} - - -} //namespace caspar \ No newline at end of file diff --git a/server/producers/flash/FlashManager.h b/server/producers/flash/FlashManager.h deleted file mode 100644 index e7cbde2f4..000000000 --- a/server/producers/flash/FlashManager.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _FLASHMEDIAMANAGER_H__ -#define _FLASHMEDIAMANAGER_H__ - -#include "..\..\MediaManager.h" - -namespace caspar { - -class FlashManager : public IMediaManager -{ -public: - FlashManager(); - virtual ~FlashManager(); - - virtual MediaProducerPtr CreateProducer(const tstring& filename); - virtual bool getFileInfo(FileInfo* pFileInfo); -}; - - - - -} //namespace caspar - -#endif // _FLASHMEDIAMANAGER_H__ diff --git a/server/producers/flash/FlashProducer.cpp b/server/producers/flash/FlashProducer.cpp deleted file mode 100644 index 801d8cf09..000000000 --- a/server/producers/flash/FlashProducer.cpp +++ /dev/null @@ -1,434 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\stdafx.h" - -#include "..\..\Application.h" -#include "TimerHelper.h" -#include "FlashProducer.h" -#include "..\..\utils\Logger.h" -#include "..\..\utils\LogLevel.h" -#include "..\..\utils\image\Image.hpp" -#include "..\..\application.h" -#include "..\..\frame\BitmapFrameManagerAdapter.h" - -namespace caspar { - -using namespace utils; - -////////////////////////////////////////////////////////////////////// -// FlashProducer -////////////////////////////////////////////////////////////////////// -FlashProducer::FlashProducer() : pFlashAxContainer_(0), bRunning_(false), frameBuffer_(2), pFnRenderer_(std::tr1::bind(&FlashProducer::WriteFrame, this)), pMonitor_(0), timerCount_(0) -{ -} - -FlashProducer::~FlashProducer() -{ - worker_.Stop(); -} - -FlashProducerPtr FlashProducer::Create(const tstring& filename, Monitor* pMonitor) -{ - FlashProducerPtr result; - - if(filename.length() > 0) { - result.reset(new FlashProducer()); - result->pMonitor_ = pMonitor; - - if(!(result->Create() && result->Load(filename))) - result.reset(); - } - - return result; -} - -IMediaController* FlashProducer::QueryController(const tstring& id) -{ - return id == TEXT("FrameController") ? this : 0; -} - -void FlashProducer::Stop() -{ - worker_.Stop(false); -} - -void FlashProducer::Run(HANDLE stopEvent) -{ -//#ifdef DEBUG -// srand(timeGetTime()); -// int frameIndex = 0; -// int crashIndex = 200+rand()%200; -//#endif - - ::OleInitialize(NULL); - LOG << LogLevel::Verbose << TEXT("Flash readAhead thread started"); - - HANDLE waitHandles[3] = { stopEvent, commandQueue_.GetWaitHandle(), frameBuffer_.GetWriteWaitHandle() }; - DWORD waitHandlesCount = sizeof(waitHandles) / sizeof(HANDLE) - 1; - - bool bQuit = false; - while(!bQuit) - { - DWORD realWaitHandleCount = waitHandlesCount; - if(bRunning_) - ++realWaitHandleCount; - - HRESULT waitResult = MsgWaitForMultipleObjects(realWaitHandleCount, waitHandles, FALSE, 1000, QS_ALLINPUT); - switch(waitResult) - { - case (WAIT_OBJECT_0+0): //stop - case WAIT_FAILED: //wait failiure - bQuit = true; - continue; - - case (WAIT_OBJECT_0+1): //command - { - FlashCommandPtr pFlashCommand = commandQueue_.Pop(); - if(pFlashCommand != 0) { - pFlashCommand->Execute(); - pFlashCommand.reset(); - } - } - continue; - - case (WAIT_TIMEOUT): //nothing has happened... - continue; - } - - //render next frame - if(bRunning_ && waitResult==(WAIT_OBJECT_0+2)) - { - if(pFlashAxContainer_->bHasNewTiming_) - { - pFlashAxContainer_->bHasNewTiming_ = false; - const caspar::FrameFormatDescription& fmtDesc = pFrameManager_->GetFrameFormatDescription(); - - //render frames if we're playing on a channel with a progressive format OR if the FPS of the flash is half that of the channel - int flashFPS = pFlashAxContainer_->GetFPS(); - bool bFrames = (fmtDesc.mode == Progressive || ((flashFPS - fmtDesc.fps/2) == 0)); - pFnRenderer_ = std::tr1::bind(bFrames ? &FlashProducer::WriteFrame : &FlashProducer::WriteFields, this); - } - - if(pFlashAxContainer_->IsReadyToRender()) - this->pFnRenderer_(); -//#ifdef DEBUG -// ++frameIndex; -// if(frameIndex >= crashIndex) -// { -// //Go down in a ball of fire! -// int* pCrash = 0; -// *pCrash = 42; -// } -//#endif - } - - static int logCount = 0; - //take care of input (windowmessages) - if(waitResult == (WAIT_OBJECT_0 + realWaitHandleCount)) - { - MSG msg; - while(PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE)) - { - if(msg.message != WM_TIMER) - { - if(logCount < 1000) - { - LOG << TEXT("[FlashProducer] ####### Received MSG message: ") << msg.message << TEXT(" lParam: ") << msg.lParam << TEXT(" wParam: ") << msg.wParam; - ++logCount; - } - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } - } - } - - if(pFlashAxContainer_) - { - pFlashAxContainer_->DestroyAxControl(); - - pFlashAxContainer_->Release(); - pFlashAxContainer_ = 0; - } - - commandQueue_.Clear(); - - FramePtr pNullFrame; - frameBuffer_.push_back(pNullFrame); - LOG << LogLevel::Verbose << TEXT("Flash readAhead thread ended"); - ::OleUninitialize(); -} - -bool FlashProducer::OnUnhandledException(const std::exception& ex) throw() -{ - try - { - FramePtr pNullFrame; - frameBuffer_.push_back(pNullFrame); - - LOG << LogLevel::Critical << TEXT("UNHANDLED EXCEPTION in flash readahead-thread. Message: ") << ex.what(); - - if(pFlashAxContainer_) { - pFlashAxContainer_->DestroyAxControl(); - - pFlashAxContainer_->Release(); - pFlashAxContainer_ = 0; - } - - commandQueue_.Clear(); - ::OleUninitialize(); - } - catch(...) - { - try - { - pFlashAxContainer_ = 0; - } - catch(...){} - } - - return false; -} - -void FlashProducer::SetEmptyAlert(EmptyCallback callback) -{ - emptyCallback = callback; -} - -bool FlashProducer::IsEmpty() const -{ - return (pFlashAxContainer_ != 0) ? pFlashAxContainer_->bIsEmpty_ : true; -} - -void FlashProducer::WriteFields() -{ - const caspar::FrameFormatDescription& fmtDesc = pFrameManager_->GetFrameFormatDescription(); - - FramePtr pNextFrame1 = RenderFrame(); - FramePtr pNextFrame2 = RenderFrame(); - - if(pNextFrame1 != pNextFrame2) - utils::image::CopyField(pNextFrame1->GetDataPtr(), pNextFrame2->GetDataPtr(), 1, fmtDesc.width, fmtDesc.height); // TODO: at this point we should spawn work as a task to allow rendering of next frame while copying - - frameBuffer_.push_back(pNextFrame1); -} - -void FlashProducer::WriteFrame() -{ - frameBuffer_.push_back(RenderFrame()); // Consumer always expects frameFramePtr pResultFrame = pFrameManager_->CreateFrame(); -} - -FramePtr FlashProducer::RenderFrame() -{ - if(pFlashAxContainer_->pTimerHelper) - { - DWORD time = pFlashAxContainer_->pTimerHelper->Invoke(); // Tick flash - if(time - timerCount_ >= 400) - { - timerCount_ = time; - HRESULT hr; - pFlashAxContainer_->m_spInPlaceObjectWindowless->OnWindowMessage(WM_TIMER, 3, 0, &hr); - } - } - - if(pFlashAxContainer_->bInvalidRect_ || pCurrentFrame_ == NULL) - { - FramePtr pNewFrame = pFrameManager_->CreateFrame(); - - image::Clear(pNewFrame->GetDataPtr(), pFrameManager_->GetFrameFormatDescription().size); - pFlashAxContainer_->DrawControl(reinterpret_cast(pNewFrame->GetMetadata())); // error handling? - - pFlashAxContainer_->bInvalidRect_ = false; - - pCurrentFrame_ = pNewFrame; - } - assert(pCurrentFrame_); - return pCurrentFrame_; -} - -bool FlashProducer::Create() -{ - //Create worker-thread - worker_.Start(this); - - //dispatch DoCreate-command - FlashCommandPtr pCreateCommand(new GenericFlashCommand(this, &caspar::FlashProducer::DoCreate)); - - commandQueue_.Push(pCreateCommand); - if(pCreateCommand->Wait(INFINITE)) - return pCreateCommand->GetResult(); - - return false; -} - -bool FlashProducer::Load(const tstring& filename) -{ - if(worker_.IsRunning()) - { - //dispatch DoLoad-command - FlashCommandPtr pLoadCommand(new GenericFlashCommand(this, &caspar::FlashProducer::DoLoad, filename)); - - commandQueue_.Push(pLoadCommand); - if(pLoadCommand->Wait(INFINITE)) - return pLoadCommand->GetResult(); - } - return false; -} - -bool FlashProducer::Initialize(FrameManagerPtr pFrameManager) -{ - if(worker_.IsRunning() && pFrameManager != 0) - { - //dispatch Initialize-command - FlashCommandPtr pInitializeCommand(new InitializeFlashCommand(this, pFrameManager)); - commandQueue_.Push(pInitializeCommand); - if(pInitializeCommand->Wait(INFINITE)) - return pInitializeCommand->GetResult(); - } - return false; -} - -bool FlashProducer::Param(const tstring ¶m) -{ - if(worker_.IsRunning()) - { - //dispatch DoParam-command - FlashCommandPtr pParamCommand(new GenericFlashCommand(this, &caspar::FlashProducer::DoParam, param)); - commandQueue_.Push(pParamCommand); - return true; - } - return false; -} - -//This is always run from the worker thread -//This is called when the MediaProducer is created -bool FlashProducer::DoCreate(const tstring&) -{ - HRESULT hr = CComObject::CreateInstance(&pFlashAxContainer_); - if(pFlashAxContainer_) - { - pFlashAxContainer_->pFlashProducer_ = this; - HRESULT hr = pFlashAxContainer_->CreateAxControl(); - if(FAILED(hr)) - return false; - - CComPtr spFlash; - pFlashAxContainer_->QueryControl(&spFlash); - if(spFlash) - spFlash->put_Playing(TRUE); - else - return false; - } - else - return false; - - return true; -} - -//This is always run from the worker thread -//This is called when the MediaProducer is created -bool FlashProducer::DoLoad(const tstring &filename) -{ - filename_ = filename; - if(filename_.length() == 0) - return false; - - CComPtr spFlash; - pFlashAxContainer_->QueryControl(&spFlash); - if(!spFlash) - return false; - - spFlash->put_AllowFullScreen(CComBSTR(TEXT("true"))); - HRESULT hrLoad = spFlash->put_Movie(CComBSTR(filename_.c_str())); - spFlash->put_ScaleMode(2); //Exact fit. Scale without respect to the aspect ratio - return SUCCEEDED(hrLoad); -} - -//This is always run from the worker thread -//This is called från FrameMediaController::Initialize -bool FlashProducer::DoInitialize(FrameManagerPtr pFrameManager) -{ - int oldWidth = 0, oldHeight = 0; - if(pFrameManager_ != 0) - { - const caspar::FrameFormatDescription& oldFmtDesc = pFrameManager_->GetFrameFormatDescription(); - oldWidth = oldFmtDesc.width; - oldHeight = oldFmtDesc.height; - } - - pFrameManager_ = pFrameManager->HasFeature("BITMAP_FRAME") ? pFrameManager : FrameManagerPtr(new BitmapFrameManagerAdapter(pFrameManager, GetApplication()->GetMainWindow()->getHwnd())); - const caspar::FrameFormatDescription& fmtDesc = pFrameManager_->GetFrameFormatDescription(); - - pCurrentFrame_ = FramePtr(); - - if(fmtDesc.width != oldWidth || fmtDesc.height != oldHeight) - pFlashAxContainer_->SetFormat(fmtDesc); - - bRunning_ = true; - return true; -} - -//This is always run from the worker thread -//this can get called at any time after the producer is loaded -bool FlashProducer::DoParam(const tstring& param) -{ - HRESULT hr; - CComPtr spFlash; - pFlashAxContainer_->bIsEmpty_ = false; - pFlashAxContainer_->bCallSuccessful_ = false; - pFlashAxContainer_->QueryControl(&spFlash); - CComBSTR request(param.c_str()); - //ATLTRACE(_T("ShockwaveFlash::CallFuntion\n")); - - if(spFlash) - { - int retries = 0; - bool bSuccess = false; - - while(!bSuccess && retries < 5) - { - CComBSTR result; - //LOG << LogLevel::Debug << TEXT("Calling ExternalInterface: ") << param; - hr = spFlash->CallFunction(request, &result); - bSuccess = (hr == S_OK); - - if(hr != S_OK) - { - //LOG << LogLevel::Debug << TEXT("Flashproducer: ExternalInterface-call failed. (HRESULT = ") << hr << TEXT(")"); - if(pFlashAxContainer_->bCallSuccessful_) - { - bSuccess = true; - } - else - { - ++retries; - LOG << LogLevel::Debug << TEXT("Retrying. Count = ") << retries; - } - } - } - - return (hr == S_OK); - } - - return false; -} - -} \ No newline at end of file diff --git a/server/producers/flash/FlashProducer.h b/server/producers/flash/FlashProducer.h deleted file mode 100644 index dc4f7decb..000000000 --- a/server/producers/flash/FlashProducer.h +++ /dev/null @@ -1,121 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _FLASHPRODUCER_H_ -#define _FLASHPRODUCER_H_ - -//std include -#include -#include -#include - -#include "..\..\MediaProducer.h" -#include "..\..\frame\FrameMediaController.h" -#include "FlashAxContainer.h" -#include "FlashCommandQueue.h" -#include "..\..\frame\BitmapFrame.h" -#include "FlashCommand.h" - -#include "..\..\utils\thread.h" -#include "..\..\frame\buffers\MotionFrameBuffer.h" - -namespace caspar -{ - -class Monitor; - -class FlashProducer; -typedef std::tr1::shared_ptr FlashProducerPtr; - -typedef std::tr1::function EmptyCallback; - -class FlashProducer : public MediaProducer, FrameMediaController, utils::IRunnable -{ - FlashProducer(const FlashProducer&); - -public: - static FlashProducerPtr Create(const tstring& filename, Monitor* pMonitor=0); - - FlashProducer(); - virtual ~FlashProducer(); - - //MediaProducer - virtual IMediaController* QueryController(const tstring& id); - virtual bool Param(const tstring& param); - - //FrameMediaController - virtual bool Initialize(FrameManagerPtr pFrameManager); - virtual FrameBuffer& GetFrameBuffer() { - return frameBuffer_; - } - - bool IsEmpty() const; - - void Stop(); - void SetEmptyAlert(EmptyCallback callback); - - bool Create(); - bool Load(const tstring& filename); - -private: - - friend class FlashCommand; - friend class InitializeFlashCommand; - friend class flash::FlashAxContainer; - friend class FullscreenControllerFlashCommand; - - bool DoCreate(const tstring&); - bool DoLoad(const tstring &); - bool DoInitialize(FrameManagerPtr pFrameManager); - bool DoParam(const tstring&); - - virtual void Run(HANDLE stopEvent); - virtual bool OnUnhandledException(const std::exception& ex) throw(); - - EmptyCallback emptyCallback; - - MotionFrameBuffer frameBuffer_; - - DWORD timerCount_; - - utils::Thread worker_; - - tstring filename_; - bool bRunning_; - CComObject* pFlashAxContainer_; - caspar::flash::FlashCommandQueue commandQueue_; - - FramePtr pCurrentFrame_; - - FramePtr RenderFrame(); - void WriteFields(void); - void WriteFrame(void); - std::tr1::function pFnRenderer_; - - FrameManagerPtr pFrameManager_; - Monitor* pMonitor_; - //void CopyFieldToFrameBuffer(FramePtr frame1, FramePtr frame2, size_t fieldIndex, size_t width, size_t height); -}; - -typedef bool (FlashProducer::*FlashMemberFnPtr)(const tstring&); - -} - -#endif \ No newline at end of file diff --git a/server/producers/flash/TimerHelper.h b/server/producers/flash/TimerHelper.h deleted file mode 100644 index a0de2b19e..000000000 --- a/server/producers/flash/TimerHelper.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _TIMER_HELPER_H__ -#define _TIMER_HELPER_H__ - -#include "FlashAxContainer.h" - -namespace caspar { -namespace flash { - - class TimerHelper - { - TimerHelper(const TimerHelper&); - const TimerHelper& operator=(const TimerHelper&); - - public: - TimerHelper() - {} - TimerHelper(DWORD first, DWORD interv, ITimerSink* pTS) : firstTime(first), interval(interv), currentTime(first), pTimerSink(pTS) - { - ID = first; - } - ~TimerHelper() - { - } - void Setup(DWORD first, DWORD interv, ITimerSink* pTS) - { - firstTime = first; - interval = interv; - currentTime = first; - pTimerSink = pTS; - ID = first; - } - - DWORD Invoke() - { - if(pTimerSink != 0) - { - VARIANT value; - value.vt = VT_UI4; - value.ulVal = currentTime; - - pTimerSink->OnTimer(value); - currentTime += interval; - } - return currentTime; - } - - DWORD firstTime; - DWORD interval; - DWORD currentTime; - ATL::CComPtr pTimerSink; - DWORD ID; - }; - -} //namespace flash -} //namespace caspar - -#endif //_TIMER_HELPER_H__ \ No newline at end of file diff --git a/server/producers/flash/axflash.h b/server/producers/flash/axflash.h deleted file mode 100644 index 4685f3a28..000000000 --- a/server/producers/flash/axflash.h +++ /dev/null @@ -1,3156 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 6.00.0366 */ -/* at Tue Mar 18 13:05:00 2008 - */ -/* Compiler settings for .\flash\Flash9e.IDL: - Oicf, W4, Zp8, env=Win32 (32b run) - protocol : dce , ms_ext, c_ext, robust - error checks: allocation ref bounds_check enum stub_data - VC __declspec() decoration level: - __declspec(uuid()), __declspec(selectany), __declspec(novtable) - DECLSPEC_UUID(), MIDL_INTERFACE() -*/ -//@@MIDL_FILE_HEADING( ) - -#pragma warning( disable: 4049 ) /* more than 64k source lines */ - - -/* verify that the version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 475 -#endif - -#include "rpc.h" -#include "rpcndr.h" -#include - -#ifndef __RPCNDR_H_VERSION__ -#error this stub requires an updated version of -#endif // __RPCNDR_H_VERSION__ - - -#ifndef __axflash_h__ -#define __axflash_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __IShockwaveFlash_FWD_DEFINED__ -#define __IShockwaveFlash_FWD_DEFINED__ -typedef interface IShockwaveFlash IShockwaveFlash; -#endif /* __IShockwaveFlash_FWD_DEFINED__ */ - - -#ifndef ___IShockwaveFlashEvents_FWD_DEFINED__ -#define ___IShockwaveFlashEvents_FWD_DEFINED__ -typedef interface _IShockwaveFlashEvents _IShockwaveFlashEvents; -#endif /* ___IShockwaveFlashEvents_FWD_DEFINED__ */ - - -#ifndef __IFlashFactory_FWD_DEFINED__ -#define __IFlashFactory_FWD_DEFINED__ -typedef interface IFlashFactory IFlashFactory; -#endif /* __IFlashFactory_FWD_DEFINED__ */ - - -#ifndef __IDispatchEx_FWD_DEFINED__ -#define __IDispatchEx_FWD_DEFINED__ -typedef interface IDispatchEx IDispatchEx; -#endif /* __IDispatchEx_FWD_DEFINED__ */ - - -#ifndef __IFlashObjectInterface_FWD_DEFINED__ -#define __IFlashObjectInterface_FWD_DEFINED__ -typedef interface IFlashObjectInterface IFlashObjectInterface; -#endif /* __IFlashObjectInterface_FWD_DEFINED__ */ - - -#ifndef __IServiceProvider_FWD_DEFINED__ -#define __IServiceProvider_FWD_DEFINED__ -typedef interface IServiceProvider IServiceProvider; -#endif /* __IServiceProvider_FWD_DEFINED__ */ - - -#ifndef __ShockwaveFlash_FWD_DEFINED__ -#define __ShockwaveFlash_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class ShockwaveFlash ShockwaveFlash; -#else -typedef struct ShockwaveFlash ShockwaveFlash; -#endif /* __cplusplus */ - -#endif /* __ShockwaveFlash_FWD_DEFINED__ */ - - -#ifndef __FlashObjectInterface_FWD_DEFINED__ -#define __FlashObjectInterface_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class FlashObjectInterface FlashObjectInterface; -#else -typedef struct FlashObjectInterface FlashObjectInterface; -#endif /* __cplusplus */ - -#endif /* __FlashObjectInterface_FWD_DEFINED__ */ - - -#ifdef __cplusplus -extern "C"{ -#endif - -void * __RPC_USER MIDL_user_allocate(size_t); -void __RPC_USER MIDL_user_free( void * ); - - -#ifndef __ShockwaveFlashObjects_LIBRARY_DEFINED__ -#define __ShockwaveFlashObjects_LIBRARY_DEFINED__ - -/* library ShockwaveFlashObjects */ -/* [custom][custom][helpstring][version][uuid] */ - - - - - - - - -EXTERN_C const IID LIBID_ShockwaveFlashObjects; - -#ifndef __IShockwaveFlash_INTERFACE_DEFINED__ -#define __IShockwaveFlash_INTERFACE_DEFINED__ - -/* interface IShockwaveFlash */ -/* [object][oleautomation][dual][helpstring][uuid] */ - - -EXTERN_C const IID IID_IShockwaveFlash; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("D27CDB6C-AE6D-11CF-96B8-444553540000") - IShockwaveFlash : public IDispatch - { - public: - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_ReadyState( - /* [retval][out] */ long *pVal) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_TotalFrames( - /* [retval][out] */ long *pVal) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Playing( - /* [retval][out] */ VARIANT_BOOL *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_Playing( - /* [in] */ VARIANT_BOOL pVal) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Quality( - /* [retval][out] */ int *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_Quality( - /* [in] */ int pVal) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_ScaleMode( - /* [retval][out] */ int *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_ScaleMode( - /* [in] */ int pVal) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_AlignMode( - /* [retval][out] */ int *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_AlignMode( - /* [in] */ int pVal) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_BackgroundColor( - /* [retval][out] */ long *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_BackgroundColor( - /* [in] */ long pVal) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Loop( - /* [retval][out] */ VARIANT_BOOL *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_Loop( - /* [in] */ VARIANT_BOOL pVal) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Movie( - /* [retval][out] */ BSTR *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_Movie( - /* [in] */ BSTR pVal) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_FrameNum( - /* [retval][out] */ long *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_FrameNum( - /* [in] */ long pVal) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetZoomRect( - /* [in] */ long left, - /* [in] */ long top, - /* [in] */ long right, - /* [in] */ long bottom) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Zoom( - /* [in] */ int factor) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Pan( - /* [in] */ long x, - /* [in] */ long y, - /* [in] */ int mode) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Play( void) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Stop( void) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Back( void) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Forward( void) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Rewind( void) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE StopPlay( void) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GotoFrame( - /* [in] */ long FrameNum) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE CurrentFrame( - /* [retval][out] */ long *FrameNum) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IsPlaying( - /* [retval][out] */ VARIANT_BOOL *Playing) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE PercentLoaded( - /* [retval][out] */ long *percent) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE FrameLoaded( - /* [in] */ long FrameNum, - /* [retval][out] */ VARIANT_BOOL *loaded) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE FlashVersion( - /* [retval][out] */ long *version) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_WMode( - /* [retval][out] */ BSTR *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_WMode( - /* [in] */ BSTR pVal) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_SAlign( - /* [retval][out] */ BSTR *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_SAlign( - /* [in] */ BSTR pVal) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Menu( - /* [retval][out] */ VARIANT_BOOL *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_Menu( - /* [in] */ VARIANT_BOOL pVal) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Base( - /* [retval][out] */ BSTR *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_Base( - /* [in] */ BSTR pVal) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Scale( - /* [retval][out] */ BSTR *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_Scale( - /* [in] */ BSTR pVal) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_DeviceFont( - /* [retval][out] */ VARIANT_BOOL *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_DeviceFont( - /* [in] */ VARIANT_BOOL pVal) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_EmbedMovie( - /* [retval][out] */ VARIANT_BOOL *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_EmbedMovie( - /* [in] */ VARIANT_BOOL pVal) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_BGColor( - /* [retval][out] */ BSTR *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_BGColor( - /* [in] */ BSTR pVal) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Quality2( - /* [retval][out] */ BSTR *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_Quality2( - /* [in] */ BSTR pVal) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE LoadMovie( - /* [in] */ int layer, - /* [in] */ BSTR url) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE TGotoFrame( - /* [in] */ BSTR target, - /* [in] */ long FrameNum) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE TGotoLabel( - /* [in] */ BSTR target, - /* [in] */ BSTR label) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE TCurrentFrame( - /* [in] */ BSTR target, - /* [retval][out] */ long *FrameNum) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE TCurrentLabel( - /* [in] */ BSTR target, - /* [retval][out] */ BSTR *pVal) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE TPlay( - /* [in] */ BSTR target) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE TStopPlay( - /* [in] */ BSTR target) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetVariable( - /* [in] */ BSTR name, - /* [in] */ BSTR value) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetVariable( - /* [in] */ BSTR name, - /* [retval][out] */ BSTR *pVal) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE TSetProperty( - /* [in] */ BSTR target, - /* [in] */ int property, - /* [in] */ BSTR value) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE TGetProperty( - /* [in] */ BSTR target, - /* [in] */ int property, - /* [retval][out] */ BSTR *pVal) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE TCallFrame( - /* [in] */ BSTR target, - /* [in] */ int FrameNum) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE TCallLabel( - /* [in] */ BSTR target, - /* [in] */ BSTR label) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE TSetPropertyNum( - /* [in] */ BSTR target, - /* [in] */ int property, - /* [in] */ double value) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE TGetPropertyNum( - /* [in] */ BSTR target, - /* [in] */ int property, - /* [retval][out] */ double *pVal) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE TGetPropertyAsNumber( - /* [in] */ BSTR target, - /* [in] */ int property, - /* [retval][out] */ double *pVal) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_SWRemote( - /* [retval][out] */ BSTR *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_SWRemote( - /* [in] */ BSTR pVal) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_FlashVars( - /* [retval][out] */ BSTR *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_FlashVars( - /* [in] */ BSTR pVal) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_AllowScriptAccess( - /* [retval][out] */ BSTR *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_AllowScriptAccess( - /* [in] */ BSTR pVal) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_MovieData( - /* [retval][out] */ BSTR *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_MovieData( - /* [in] */ BSTR pVal) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_InlineData( - /* [retval][out] */ IUnknown **ppIUnknown) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_InlineData( - /* [in] */ IUnknown *ppIUnknown) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_SeamlessTabbing( - /* [retval][out] */ VARIANT_BOOL *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_SeamlessTabbing( - /* [in] */ VARIANT_BOOL pVal) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE EnforceLocalSecurity( void) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Profile( - /* [retval][out] */ VARIANT_BOOL *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_Profile( - /* [in] */ VARIANT_BOOL pVal) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_ProfileAddress( - /* [retval][out] */ BSTR *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_ProfileAddress( - /* [in] */ BSTR pVal) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_ProfilePort( - /* [retval][out] */ long *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_ProfilePort( - /* [in] */ long pVal) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE CallFunction( - /* [in] */ BSTR request, - /* [retval][out] */ BSTR *response) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetReturnValue( - /* [in] */ BSTR returnValue) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE DisableLocalSecurity( void) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_AllowNetworking( - /* [retval][out] */ BSTR *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_AllowNetworking( - /* [in] */ BSTR pVal) = 0; - - virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_AllowFullScreen( - /* [retval][out] */ BSTR *pVal) = 0; - - virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_AllowFullScreen( - /* [in] */ BSTR pVal) = 0; - - }; - -#else /* C style interface */ - - typedef struct IShockwaveFlashVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IShockwaveFlash * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IShockwaveFlash * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IShockwaveFlash * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - IShockwaveFlash * This, - /* [out] */ UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - IShockwaveFlash * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - IShockwaveFlash * This, - /* [in] */ REFIID riid, - /* [size_is][in] */ LPOLESTR *rgszNames, - /* [in] */ UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IShockwaveFlash * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_ReadyState )( - IShockwaveFlash * This, - /* [retval][out] */ long *pVal); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_TotalFrames )( - IShockwaveFlash * This, - /* [retval][out] */ long *pVal); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Playing )( - IShockwaveFlash * This, - /* [retval][out] */ VARIANT_BOOL *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_Playing )( - IShockwaveFlash * This, - /* [in] */ VARIANT_BOOL pVal); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Quality )( - IShockwaveFlash * This, - /* [retval][out] */ int *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_Quality )( - IShockwaveFlash * This, - /* [in] */ int pVal); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_ScaleMode )( - IShockwaveFlash * This, - /* [retval][out] */ int *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_ScaleMode )( - IShockwaveFlash * This, - /* [in] */ int pVal); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_AlignMode )( - IShockwaveFlash * This, - /* [retval][out] */ int *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_AlignMode )( - IShockwaveFlash * This, - /* [in] */ int pVal); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_BackgroundColor )( - IShockwaveFlash * This, - /* [retval][out] */ long *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_BackgroundColor )( - IShockwaveFlash * This, - /* [in] */ long pVal); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Loop )( - IShockwaveFlash * This, - /* [retval][out] */ VARIANT_BOOL *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_Loop )( - IShockwaveFlash * This, - /* [in] */ VARIANT_BOOL pVal); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Movie )( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_Movie )( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_FrameNum )( - IShockwaveFlash * This, - /* [retval][out] */ long *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_FrameNum )( - IShockwaveFlash * This, - /* [in] */ long pVal); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetZoomRect )( - IShockwaveFlash * This, - /* [in] */ long left, - /* [in] */ long top, - /* [in] */ long right, - /* [in] */ long bottom); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Zoom )( - IShockwaveFlash * This, - /* [in] */ int factor); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Pan )( - IShockwaveFlash * This, - /* [in] */ long x, - /* [in] */ long y, - /* [in] */ int mode); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Play )( - IShockwaveFlash * This); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Stop )( - IShockwaveFlash * This); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Back )( - IShockwaveFlash * This); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Forward )( - IShockwaveFlash * This); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Rewind )( - IShockwaveFlash * This); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *StopPlay )( - IShockwaveFlash * This); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GotoFrame )( - IShockwaveFlash * This, - /* [in] */ long FrameNum); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *CurrentFrame )( - IShockwaveFlash * This, - /* [retval][out] */ long *FrameNum); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *IsPlaying )( - IShockwaveFlash * This, - /* [retval][out] */ VARIANT_BOOL *Playing); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *PercentLoaded )( - IShockwaveFlash * This, - /* [retval][out] */ long *percent); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *FrameLoaded )( - IShockwaveFlash * This, - /* [in] */ long FrameNum, - /* [retval][out] */ VARIANT_BOOL *loaded); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *FlashVersion )( - IShockwaveFlash * This, - /* [retval][out] */ long *version); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_WMode )( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_WMode )( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_SAlign )( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_SAlign )( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Menu )( - IShockwaveFlash * This, - /* [retval][out] */ VARIANT_BOOL *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_Menu )( - IShockwaveFlash * This, - /* [in] */ VARIANT_BOOL pVal); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Base )( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_Base )( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Scale )( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_Scale )( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_DeviceFont )( - IShockwaveFlash * This, - /* [retval][out] */ VARIANT_BOOL *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_DeviceFont )( - IShockwaveFlash * This, - /* [in] */ VARIANT_BOOL pVal); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_EmbedMovie )( - IShockwaveFlash * This, - /* [retval][out] */ VARIANT_BOOL *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_EmbedMovie )( - IShockwaveFlash * This, - /* [in] */ VARIANT_BOOL pVal); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_BGColor )( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_BGColor )( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Quality2 )( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_Quality2 )( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *LoadMovie )( - IShockwaveFlash * This, - /* [in] */ int layer, - /* [in] */ BSTR url); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *TGotoFrame )( - IShockwaveFlash * This, - /* [in] */ BSTR target, - /* [in] */ long FrameNum); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *TGotoLabel )( - IShockwaveFlash * This, - /* [in] */ BSTR target, - /* [in] */ BSTR label); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *TCurrentFrame )( - IShockwaveFlash * This, - /* [in] */ BSTR target, - /* [retval][out] */ long *FrameNum); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *TCurrentLabel )( - IShockwaveFlash * This, - /* [in] */ BSTR target, - /* [retval][out] */ BSTR *pVal); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *TPlay )( - IShockwaveFlash * This, - /* [in] */ BSTR target); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *TStopPlay )( - IShockwaveFlash * This, - /* [in] */ BSTR target); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetVariable )( - IShockwaveFlash * This, - /* [in] */ BSTR name, - /* [in] */ BSTR value); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetVariable )( - IShockwaveFlash * This, - /* [in] */ BSTR name, - /* [retval][out] */ BSTR *pVal); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *TSetProperty )( - IShockwaveFlash * This, - /* [in] */ BSTR target, - /* [in] */ int property, - /* [in] */ BSTR value); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *TGetProperty )( - IShockwaveFlash * This, - /* [in] */ BSTR target, - /* [in] */ int property, - /* [retval][out] */ BSTR *pVal); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *TCallFrame )( - IShockwaveFlash * This, - /* [in] */ BSTR target, - /* [in] */ int FrameNum); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *TCallLabel )( - IShockwaveFlash * This, - /* [in] */ BSTR target, - /* [in] */ BSTR label); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *TSetPropertyNum )( - IShockwaveFlash * This, - /* [in] */ BSTR target, - /* [in] */ int property, - /* [in] */ double value); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *TGetPropertyNum )( - IShockwaveFlash * This, - /* [in] */ BSTR target, - /* [in] */ int property, - /* [retval][out] */ double *pVal); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *TGetPropertyAsNumber )( - IShockwaveFlash * This, - /* [in] */ BSTR target, - /* [in] */ int property, - /* [retval][out] */ double *pVal); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_SWRemote )( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_SWRemote )( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_FlashVars )( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_FlashVars )( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_AllowScriptAccess )( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_AllowScriptAccess )( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_MovieData )( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_MovieData )( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_InlineData )( - IShockwaveFlash * This, - /* [retval][out] */ IUnknown **ppIUnknown); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_InlineData )( - IShockwaveFlash * This, - /* [in] */ IUnknown *ppIUnknown); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_SeamlessTabbing )( - IShockwaveFlash * This, - /* [retval][out] */ VARIANT_BOOL *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_SeamlessTabbing )( - IShockwaveFlash * This, - /* [in] */ VARIANT_BOOL pVal); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *EnforceLocalSecurity )( - IShockwaveFlash * This); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Profile )( - IShockwaveFlash * This, - /* [retval][out] */ VARIANT_BOOL *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_Profile )( - IShockwaveFlash * This, - /* [in] */ VARIANT_BOOL pVal); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_ProfileAddress )( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_ProfileAddress )( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_ProfilePort )( - IShockwaveFlash * This, - /* [retval][out] */ long *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_ProfilePort )( - IShockwaveFlash * This, - /* [in] */ long pVal); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *CallFunction )( - IShockwaveFlash * This, - /* [in] */ BSTR request, - /* [retval][out] */ BSTR *response); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetReturnValue )( - IShockwaveFlash * This, - /* [in] */ BSTR returnValue); - - /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *DisableLocalSecurity )( - IShockwaveFlash * This); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_AllowNetworking )( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_AllowNetworking )( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_AllowFullScreen )( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_AllowFullScreen )( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - END_INTERFACE - } IShockwaveFlashVtbl; - - interface IShockwaveFlash - { - CONST_VTBL struct IShockwaveFlashVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IShockwaveFlash_QueryInterface(This,riid,ppvObject) \ - (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) - -#define IShockwaveFlash_AddRef(This) \ - (This)->lpVtbl -> AddRef(This) - -#define IShockwaveFlash_Release(This) \ - (This)->lpVtbl -> Release(This) - - -#define IShockwaveFlash_GetTypeInfoCount(This,pctinfo) \ - (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) - -#define IShockwaveFlash_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) - -#define IShockwaveFlash_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) - -#define IShockwaveFlash_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) - - -#define IShockwaveFlash_get_ReadyState(This,pVal) \ - (This)->lpVtbl -> get_ReadyState(This,pVal) - -#define IShockwaveFlash_get_TotalFrames(This,pVal) \ - (This)->lpVtbl -> get_TotalFrames(This,pVal) - -#define IShockwaveFlash_get_Playing(This,pVal) \ - (This)->lpVtbl -> get_Playing(This,pVal) - -#define IShockwaveFlash_put_Playing(This,pVal) \ - (This)->lpVtbl -> put_Playing(This,pVal) - -#define IShockwaveFlash_get_Quality(This,pVal) \ - (This)->lpVtbl -> get_Quality(This,pVal) - -#define IShockwaveFlash_put_Quality(This,pVal) \ - (This)->lpVtbl -> put_Quality(This,pVal) - -#define IShockwaveFlash_get_ScaleMode(This,pVal) \ - (This)->lpVtbl -> get_ScaleMode(This,pVal) - -#define IShockwaveFlash_put_ScaleMode(This,pVal) \ - (This)->lpVtbl -> put_ScaleMode(This,pVal) - -#define IShockwaveFlash_get_AlignMode(This,pVal) \ - (This)->lpVtbl -> get_AlignMode(This,pVal) - -#define IShockwaveFlash_put_AlignMode(This,pVal) \ - (This)->lpVtbl -> put_AlignMode(This,pVal) - -#define IShockwaveFlash_get_BackgroundColor(This,pVal) \ - (This)->lpVtbl -> get_BackgroundColor(This,pVal) - -#define IShockwaveFlash_put_BackgroundColor(This,pVal) \ - (This)->lpVtbl -> put_BackgroundColor(This,pVal) - -#define IShockwaveFlash_get_Loop(This,pVal) \ - (This)->lpVtbl -> get_Loop(This,pVal) - -#define IShockwaveFlash_put_Loop(This,pVal) \ - (This)->lpVtbl -> put_Loop(This,pVal) - -#define IShockwaveFlash_get_Movie(This,pVal) \ - (This)->lpVtbl -> get_Movie(This,pVal) - -#define IShockwaveFlash_put_Movie(This,pVal) \ - (This)->lpVtbl -> put_Movie(This,pVal) - -#define IShockwaveFlash_get_FrameNum(This,pVal) \ - (This)->lpVtbl -> get_FrameNum(This,pVal) - -#define IShockwaveFlash_put_FrameNum(This,pVal) \ - (This)->lpVtbl -> put_FrameNum(This,pVal) - -#define IShockwaveFlash_SetZoomRect(This,left,top,right,bottom) \ - (This)->lpVtbl -> SetZoomRect(This,left,top,right,bottom) - -#define IShockwaveFlash_Zoom(This,factor) \ - (This)->lpVtbl -> Zoom(This,factor) - -#define IShockwaveFlash_Pan(This,x,y,mode) \ - (This)->lpVtbl -> Pan(This,x,y,mode) - -#define IShockwaveFlash_Play(This) \ - (This)->lpVtbl -> Play(This) - -#define IShockwaveFlash_Stop(This) \ - (This)->lpVtbl -> Stop(This) - -#define IShockwaveFlash_Back(This) \ - (This)->lpVtbl -> Back(This) - -#define IShockwaveFlash_Forward(This) \ - (This)->lpVtbl -> Forward(This) - -#define IShockwaveFlash_Rewind(This) \ - (This)->lpVtbl -> Rewind(This) - -#define IShockwaveFlash_StopPlay(This) \ - (This)->lpVtbl -> StopPlay(This) - -#define IShockwaveFlash_GotoFrame(This,FrameNum) \ - (This)->lpVtbl -> GotoFrame(This,FrameNum) - -#define IShockwaveFlash_CurrentFrame(This,FrameNum) \ - (This)->lpVtbl -> CurrentFrame(This,FrameNum) - -#define IShockwaveFlash_IsPlaying(This,Playing) \ - (This)->lpVtbl -> IsPlaying(This,Playing) - -#define IShockwaveFlash_PercentLoaded(This,percent) \ - (This)->lpVtbl -> PercentLoaded(This,percent) - -#define IShockwaveFlash_FrameLoaded(This,FrameNum,loaded) \ - (This)->lpVtbl -> FrameLoaded(This,FrameNum,loaded) - -#define IShockwaveFlash_FlashVersion(This,version) \ - (This)->lpVtbl -> FlashVersion(This,version) - -#define IShockwaveFlash_get_WMode(This,pVal) \ - (This)->lpVtbl -> get_WMode(This,pVal) - -#define IShockwaveFlash_put_WMode(This,pVal) \ - (This)->lpVtbl -> put_WMode(This,pVal) - -#define IShockwaveFlash_get_SAlign(This,pVal) \ - (This)->lpVtbl -> get_SAlign(This,pVal) - -#define IShockwaveFlash_put_SAlign(This,pVal) \ - (This)->lpVtbl -> put_SAlign(This,pVal) - -#define IShockwaveFlash_get_Menu(This,pVal) \ - (This)->lpVtbl -> get_Menu(This,pVal) - -#define IShockwaveFlash_put_Menu(This,pVal) \ - (This)->lpVtbl -> put_Menu(This,pVal) - -#define IShockwaveFlash_get_Base(This,pVal) \ - (This)->lpVtbl -> get_Base(This,pVal) - -#define IShockwaveFlash_put_Base(This,pVal) \ - (This)->lpVtbl -> put_Base(This,pVal) - -#define IShockwaveFlash_get_Scale(This,pVal) \ - (This)->lpVtbl -> get_Scale(This,pVal) - -#define IShockwaveFlash_put_Scale(This,pVal) \ - (This)->lpVtbl -> put_Scale(This,pVal) - -#define IShockwaveFlash_get_DeviceFont(This,pVal) \ - (This)->lpVtbl -> get_DeviceFont(This,pVal) - -#define IShockwaveFlash_put_DeviceFont(This,pVal) \ - (This)->lpVtbl -> put_DeviceFont(This,pVal) - -#define IShockwaveFlash_get_EmbedMovie(This,pVal) \ - (This)->lpVtbl -> get_EmbedMovie(This,pVal) - -#define IShockwaveFlash_put_EmbedMovie(This,pVal) \ - (This)->lpVtbl -> put_EmbedMovie(This,pVal) - -#define IShockwaveFlash_get_BGColor(This,pVal) \ - (This)->lpVtbl -> get_BGColor(This,pVal) - -#define IShockwaveFlash_put_BGColor(This,pVal) \ - (This)->lpVtbl -> put_BGColor(This,pVal) - -#define IShockwaveFlash_get_Quality2(This,pVal) \ - (This)->lpVtbl -> get_Quality2(This,pVal) - -#define IShockwaveFlash_put_Quality2(This,pVal) \ - (This)->lpVtbl -> put_Quality2(This,pVal) - -#define IShockwaveFlash_LoadMovie(This,layer,url) \ - (This)->lpVtbl -> LoadMovie(This,layer,url) - -#define IShockwaveFlash_TGotoFrame(This,target,FrameNum) \ - (This)->lpVtbl -> TGotoFrame(This,target,FrameNum) - -#define IShockwaveFlash_TGotoLabel(This,target,label) \ - (This)->lpVtbl -> TGotoLabel(This,target,label) - -#define IShockwaveFlash_TCurrentFrame(This,target,FrameNum) \ - (This)->lpVtbl -> TCurrentFrame(This,target,FrameNum) - -#define IShockwaveFlash_TCurrentLabel(This,target,pVal) \ - (This)->lpVtbl -> TCurrentLabel(This,target,pVal) - -#define IShockwaveFlash_TPlay(This,target) \ - (This)->lpVtbl -> TPlay(This,target) - -#define IShockwaveFlash_TStopPlay(This,target) \ - (This)->lpVtbl -> TStopPlay(This,target) - -#define IShockwaveFlash_SetVariable(This,name,value) \ - (This)->lpVtbl -> SetVariable(This,name,value) - -#define IShockwaveFlash_GetVariable(This,name,pVal) \ - (This)->lpVtbl -> GetVariable(This,name,pVal) - -#define IShockwaveFlash_TSetProperty(This,target,property,value) \ - (This)->lpVtbl -> TSetProperty(This,target,property,value) - -#define IShockwaveFlash_TGetProperty(This,target,property,pVal) \ - (This)->lpVtbl -> TGetProperty(This,target,property,pVal) - -#define IShockwaveFlash_TCallFrame(This,target,FrameNum) \ - (This)->lpVtbl -> TCallFrame(This,target,FrameNum) - -#define IShockwaveFlash_TCallLabel(This,target,label) \ - (This)->lpVtbl -> TCallLabel(This,target,label) - -#define IShockwaveFlash_TSetPropertyNum(This,target,property,value) \ - (This)->lpVtbl -> TSetPropertyNum(This,target,property,value) - -#define IShockwaveFlash_TGetPropertyNum(This,target,property,pVal) \ - (This)->lpVtbl -> TGetPropertyNum(This,target,property,pVal) - -#define IShockwaveFlash_TGetPropertyAsNumber(This,target,property,pVal) \ - (This)->lpVtbl -> TGetPropertyAsNumber(This,target,property,pVal) - -#define IShockwaveFlash_get_SWRemote(This,pVal) \ - (This)->lpVtbl -> get_SWRemote(This,pVal) - -#define IShockwaveFlash_put_SWRemote(This,pVal) \ - (This)->lpVtbl -> put_SWRemote(This,pVal) - -#define IShockwaveFlash_get_FlashVars(This,pVal) \ - (This)->lpVtbl -> get_FlashVars(This,pVal) - -#define IShockwaveFlash_put_FlashVars(This,pVal) \ - (This)->lpVtbl -> put_FlashVars(This,pVal) - -#define IShockwaveFlash_get_AllowScriptAccess(This,pVal) \ - (This)->lpVtbl -> get_AllowScriptAccess(This,pVal) - -#define IShockwaveFlash_put_AllowScriptAccess(This,pVal) \ - (This)->lpVtbl -> put_AllowScriptAccess(This,pVal) - -#define IShockwaveFlash_get_MovieData(This,pVal) \ - (This)->lpVtbl -> get_MovieData(This,pVal) - -#define IShockwaveFlash_put_MovieData(This,pVal) \ - (This)->lpVtbl -> put_MovieData(This,pVal) - -#define IShockwaveFlash_get_InlineData(This,ppIUnknown) \ - (This)->lpVtbl -> get_InlineData(This,ppIUnknown) - -#define IShockwaveFlash_put_InlineData(This,ppIUnknown) \ - (This)->lpVtbl -> put_InlineData(This,ppIUnknown) - -#define IShockwaveFlash_get_SeamlessTabbing(This,pVal) \ - (This)->lpVtbl -> get_SeamlessTabbing(This,pVal) - -#define IShockwaveFlash_put_SeamlessTabbing(This,pVal) \ - (This)->lpVtbl -> put_SeamlessTabbing(This,pVal) - -#define IShockwaveFlash_EnforceLocalSecurity(This) \ - (This)->lpVtbl -> EnforceLocalSecurity(This) - -#define IShockwaveFlash_get_Profile(This,pVal) \ - (This)->lpVtbl -> get_Profile(This,pVal) - -#define IShockwaveFlash_put_Profile(This,pVal) \ - (This)->lpVtbl -> put_Profile(This,pVal) - -#define IShockwaveFlash_get_ProfileAddress(This,pVal) \ - (This)->lpVtbl -> get_ProfileAddress(This,pVal) - -#define IShockwaveFlash_put_ProfileAddress(This,pVal) \ - (This)->lpVtbl -> put_ProfileAddress(This,pVal) - -#define IShockwaveFlash_get_ProfilePort(This,pVal) \ - (This)->lpVtbl -> get_ProfilePort(This,pVal) - -#define IShockwaveFlash_put_ProfilePort(This,pVal) \ - (This)->lpVtbl -> put_ProfilePort(This,pVal) - -#define IShockwaveFlash_CallFunction(This,request,response) \ - (This)->lpVtbl -> CallFunction(This,request,response) - -#define IShockwaveFlash_SetReturnValue(This,returnValue) \ - (This)->lpVtbl -> SetReturnValue(This,returnValue) - -#define IShockwaveFlash_DisableLocalSecurity(This) \ - (This)->lpVtbl -> DisableLocalSecurity(This) - -#define IShockwaveFlash_get_AllowNetworking(This,pVal) \ - (This)->lpVtbl -> get_AllowNetworking(This,pVal) - -#define IShockwaveFlash_put_AllowNetworking(This,pVal) \ - (This)->lpVtbl -> put_AllowNetworking(This,pVal) - -#define IShockwaveFlash_get_AllowFullScreen(This,pVal) \ - (This)->lpVtbl -> get_AllowFullScreen(This,pVal) - -#define IShockwaveFlash_put_AllowFullScreen(This,pVal) \ - (This)->lpVtbl -> put_AllowFullScreen(This,pVal) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_ReadyState_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ long *pVal); - - -void __RPC_STUB IShockwaveFlash_get_ReadyState_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_TotalFrames_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ long *pVal); - - -void __RPC_STUB IShockwaveFlash_get_TotalFrames_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_Playing_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ VARIANT_BOOL *pVal); - - -void __RPC_STUB IShockwaveFlash_get_Playing_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_Playing_Proxy( - IShockwaveFlash * This, - /* [in] */ VARIANT_BOOL pVal); - - -void __RPC_STUB IShockwaveFlash_put_Playing_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_Quality_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ int *pVal); - - -void __RPC_STUB IShockwaveFlash_get_Quality_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_Quality_Proxy( - IShockwaveFlash * This, - /* [in] */ int pVal); - - -void __RPC_STUB IShockwaveFlash_put_Quality_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_ScaleMode_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ int *pVal); - - -void __RPC_STUB IShockwaveFlash_get_ScaleMode_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_ScaleMode_Proxy( - IShockwaveFlash * This, - /* [in] */ int pVal); - - -void __RPC_STUB IShockwaveFlash_put_ScaleMode_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_AlignMode_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ int *pVal); - - -void __RPC_STUB IShockwaveFlash_get_AlignMode_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_AlignMode_Proxy( - IShockwaveFlash * This, - /* [in] */ int pVal); - - -void __RPC_STUB IShockwaveFlash_put_AlignMode_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_BackgroundColor_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ long *pVal); - - -void __RPC_STUB IShockwaveFlash_get_BackgroundColor_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_BackgroundColor_Proxy( - IShockwaveFlash * This, - /* [in] */ long pVal); - - -void __RPC_STUB IShockwaveFlash_put_BackgroundColor_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_Loop_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ VARIANT_BOOL *pVal); - - -void __RPC_STUB IShockwaveFlash_get_Loop_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_Loop_Proxy( - IShockwaveFlash * This, - /* [in] */ VARIANT_BOOL pVal); - - -void __RPC_STUB IShockwaveFlash_put_Loop_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_Movie_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - -void __RPC_STUB IShockwaveFlash_get_Movie_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_Movie_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - -void __RPC_STUB IShockwaveFlash_put_Movie_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_FrameNum_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ long *pVal); - - -void __RPC_STUB IShockwaveFlash_get_FrameNum_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_FrameNum_Proxy( - IShockwaveFlash * This, - /* [in] */ long pVal); - - -void __RPC_STUB IShockwaveFlash_put_FrameNum_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_SetZoomRect_Proxy( - IShockwaveFlash * This, - /* [in] */ long left, - /* [in] */ long top, - /* [in] */ long right, - /* [in] */ long bottom); - - -void __RPC_STUB IShockwaveFlash_SetZoomRect_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_Zoom_Proxy( - IShockwaveFlash * This, - /* [in] */ int factor); - - -void __RPC_STUB IShockwaveFlash_Zoom_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_Pan_Proxy( - IShockwaveFlash * This, - /* [in] */ long x, - /* [in] */ long y, - /* [in] */ int mode); - - -void __RPC_STUB IShockwaveFlash_Pan_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_Play_Proxy( - IShockwaveFlash * This); - - -void __RPC_STUB IShockwaveFlash_Play_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_Stop_Proxy( - IShockwaveFlash * This); - - -void __RPC_STUB IShockwaveFlash_Stop_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_Back_Proxy( - IShockwaveFlash * This); - - -void __RPC_STUB IShockwaveFlash_Back_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_Forward_Proxy( - IShockwaveFlash * This); - - -void __RPC_STUB IShockwaveFlash_Forward_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_Rewind_Proxy( - IShockwaveFlash * This); - - -void __RPC_STUB IShockwaveFlash_Rewind_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_StopPlay_Proxy( - IShockwaveFlash * This); - - -void __RPC_STUB IShockwaveFlash_StopPlay_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_GotoFrame_Proxy( - IShockwaveFlash * This, - /* [in] */ long FrameNum); - - -void __RPC_STUB IShockwaveFlash_GotoFrame_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_CurrentFrame_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ long *FrameNum); - - -void __RPC_STUB IShockwaveFlash_CurrentFrame_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_IsPlaying_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ VARIANT_BOOL *Playing); - - -void __RPC_STUB IShockwaveFlash_IsPlaying_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_PercentLoaded_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ long *percent); - - -void __RPC_STUB IShockwaveFlash_PercentLoaded_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_FrameLoaded_Proxy( - IShockwaveFlash * This, - /* [in] */ long FrameNum, - /* [retval][out] */ VARIANT_BOOL *loaded); - - -void __RPC_STUB IShockwaveFlash_FrameLoaded_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_FlashVersion_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ long *version); - - -void __RPC_STUB IShockwaveFlash_FlashVersion_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_WMode_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - -void __RPC_STUB IShockwaveFlash_get_WMode_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_WMode_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - -void __RPC_STUB IShockwaveFlash_put_WMode_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_SAlign_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - -void __RPC_STUB IShockwaveFlash_get_SAlign_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_SAlign_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - -void __RPC_STUB IShockwaveFlash_put_SAlign_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_Menu_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ VARIANT_BOOL *pVal); - - -void __RPC_STUB IShockwaveFlash_get_Menu_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_Menu_Proxy( - IShockwaveFlash * This, - /* [in] */ VARIANT_BOOL pVal); - - -void __RPC_STUB IShockwaveFlash_put_Menu_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_Base_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - -void __RPC_STUB IShockwaveFlash_get_Base_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_Base_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - -void __RPC_STUB IShockwaveFlash_put_Base_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_Scale_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - -void __RPC_STUB IShockwaveFlash_get_Scale_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_Scale_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - -void __RPC_STUB IShockwaveFlash_put_Scale_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_DeviceFont_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ VARIANT_BOOL *pVal); - - -void __RPC_STUB IShockwaveFlash_get_DeviceFont_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_DeviceFont_Proxy( - IShockwaveFlash * This, - /* [in] */ VARIANT_BOOL pVal); - - -void __RPC_STUB IShockwaveFlash_put_DeviceFont_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_EmbedMovie_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ VARIANT_BOOL *pVal); - - -void __RPC_STUB IShockwaveFlash_get_EmbedMovie_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_EmbedMovie_Proxy( - IShockwaveFlash * This, - /* [in] */ VARIANT_BOOL pVal); - - -void __RPC_STUB IShockwaveFlash_put_EmbedMovie_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_BGColor_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - -void __RPC_STUB IShockwaveFlash_get_BGColor_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_BGColor_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - -void __RPC_STUB IShockwaveFlash_put_BGColor_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_Quality2_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - -void __RPC_STUB IShockwaveFlash_get_Quality2_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_Quality2_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - -void __RPC_STUB IShockwaveFlash_put_Quality2_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_LoadMovie_Proxy( - IShockwaveFlash * This, - /* [in] */ int layer, - /* [in] */ BSTR url); - - -void __RPC_STUB IShockwaveFlash_LoadMovie_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_TGotoFrame_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR target, - /* [in] */ long FrameNum); - - -void __RPC_STUB IShockwaveFlash_TGotoFrame_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_TGotoLabel_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR target, - /* [in] */ BSTR label); - - -void __RPC_STUB IShockwaveFlash_TGotoLabel_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_TCurrentFrame_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR target, - /* [retval][out] */ long *FrameNum); - - -void __RPC_STUB IShockwaveFlash_TCurrentFrame_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_TCurrentLabel_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR target, - /* [retval][out] */ BSTR *pVal); - - -void __RPC_STUB IShockwaveFlash_TCurrentLabel_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_TPlay_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR target); - - -void __RPC_STUB IShockwaveFlash_TPlay_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_TStopPlay_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR target); - - -void __RPC_STUB IShockwaveFlash_TStopPlay_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_SetVariable_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR name, - /* [in] */ BSTR value); - - -void __RPC_STUB IShockwaveFlash_SetVariable_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_GetVariable_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR name, - /* [retval][out] */ BSTR *pVal); - - -void __RPC_STUB IShockwaveFlash_GetVariable_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_TSetProperty_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR target, - /* [in] */ int property, - /* [in] */ BSTR value); - - -void __RPC_STUB IShockwaveFlash_TSetProperty_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_TGetProperty_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR target, - /* [in] */ int property, - /* [retval][out] */ BSTR *pVal); - - -void __RPC_STUB IShockwaveFlash_TGetProperty_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_TCallFrame_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR target, - /* [in] */ int FrameNum); - - -void __RPC_STUB IShockwaveFlash_TCallFrame_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_TCallLabel_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR target, - /* [in] */ BSTR label); - - -void __RPC_STUB IShockwaveFlash_TCallLabel_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_TSetPropertyNum_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR target, - /* [in] */ int property, - /* [in] */ double value); - - -void __RPC_STUB IShockwaveFlash_TSetPropertyNum_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_TGetPropertyNum_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR target, - /* [in] */ int property, - /* [retval][out] */ double *pVal); - - -void __RPC_STUB IShockwaveFlash_TGetPropertyNum_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_TGetPropertyAsNumber_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR target, - /* [in] */ int property, - /* [retval][out] */ double *pVal); - - -void __RPC_STUB IShockwaveFlash_TGetPropertyAsNumber_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_SWRemote_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - -void __RPC_STUB IShockwaveFlash_get_SWRemote_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_SWRemote_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - -void __RPC_STUB IShockwaveFlash_put_SWRemote_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_FlashVars_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - -void __RPC_STUB IShockwaveFlash_get_FlashVars_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_FlashVars_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - -void __RPC_STUB IShockwaveFlash_put_FlashVars_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_AllowScriptAccess_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - -void __RPC_STUB IShockwaveFlash_get_AllowScriptAccess_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_AllowScriptAccess_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - -void __RPC_STUB IShockwaveFlash_put_AllowScriptAccess_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_MovieData_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - -void __RPC_STUB IShockwaveFlash_get_MovieData_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_MovieData_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - -void __RPC_STUB IShockwaveFlash_put_MovieData_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_InlineData_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ IUnknown **ppIUnknown); - - -void __RPC_STUB IShockwaveFlash_get_InlineData_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_InlineData_Proxy( - IShockwaveFlash * This, - /* [in] */ IUnknown *ppIUnknown); - - -void __RPC_STUB IShockwaveFlash_put_InlineData_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_SeamlessTabbing_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ VARIANT_BOOL *pVal); - - -void __RPC_STUB IShockwaveFlash_get_SeamlessTabbing_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_SeamlessTabbing_Proxy( - IShockwaveFlash * This, - /* [in] */ VARIANT_BOOL pVal); - - -void __RPC_STUB IShockwaveFlash_put_SeamlessTabbing_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_EnforceLocalSecurity_Proxy( - IShockwaveFlash * This); - - -void __RPC_STUB IShockwaveFlash_EnforceLocalSecurity_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_Profile_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ VARIANT_BOOL *pVal); - - -void __RPC_STUB IShockwaveFlash_get_Profile_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_Profile_Proxy( - IShockwaveFlash * This, - /* [in] */ VARIANT_BOOL pVal); - - -void __RPC_STUB IShockwaveFlash_put_Profile_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_ProfileAddress_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - -void __RPC_STUB IShockwaveFlash_get_ProfileAddress_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_ProfileAddress_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - -void __RPC_STUB IShockwaveFlash_put_ProfileAddress_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_ProfilePort_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ long *pVal); - - -void __RPC_STUB IShockwaveFlash_get_ProfilePort_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_ProfilePort_Proxy( - IShockwaveFlash * This, - /* [in] */ long pVal); - - -void __RPC_STUB IShockwaveFlash_put_ProfilePort_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_CallFunction_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR request, - /* [retval][out] */ BSTR *response); - - -void __RPC_STUB IShockwaveFlash_CallFunction_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_SetReturnValue_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR returnValue); - - -void __RPC_STUB IShockwaveFlash_SetReturnValue_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_DisableLocalSecurity_Proxy( - IShockwaveFlash * This); - - -void __RPC_STUB IShockwaveFlash_DisableLocalSecurity_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_AllowNetworking_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - -void __RPC_STUB IShockwaveFlash_get_AllowNetworking_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_AllowNetworking_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - -void __RPC_STUB IShockwaveFlash_put_AllowNetworking_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_get_AllowFullScreen_Proxy( - IShockwaveFlash * This, - /* [retval][out] */ BSTR *pVal); - - -void __RPC_STUB IShockwaveFlash_get_AllowFullScreen_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE IShockwaveFlash_put_AllowFullScreen_Proxy( - IShockwaveFlash * This, - /* [in] */ BSTR pVal); - - -void __RPC_STUB IShockwaveFlash_put_AllowFullScreen_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IShockwaveFlash_INTERFACE_DEFINED__ */ - - -#ifndef ___IShockwaveFlashEvents_DISPINTERFACE_DEFINED__ -#define ___IShockwaveFlashEvents_DISPINTERFACE_DEFINED__ - -/* dispinterface _IShockwaveFlashEvents */ -/* [hidden][helpstring][uuid] */ - - -EXTERN_C const IID DIID__IShockwaveFlashEvents; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("D27CDB6D-AE6D-11CF-96B8-444553540000") - _IShockwaveFlashEvents : public IDispatch - { - }; - -#else /* C style interface */ - - typedef struct _IShockwaveFlashEventsVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - _IShockwaveFlashEvents * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - _IShockwaveFlashEvents * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - _IShockwaveFlashEvents * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - _IShockwaveFlashEvents * This, - /* [out] */ UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - _IShockwaveFlashEvents * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - _IShockwaveFlashEvents * This, - /* [in] */ REFIID riid, - /* [size_is][in] */ LPOLESTR *rgszNames, - /* [in] */ UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - _IShockwaveFlashEvents * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - END_INTERFACE - } _IShockwaveFlashEventsVtbl; - - interface _IShockwaveFlashEvents - { - CONST_VTBL struct _IShockwaveFlashEventsVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define _IShockwaveFlashEvents_QueryInterface(This,riid,ppvObject) \ - (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) - -#define _IShockwaveFlashEvents_AddRef(This) \ - (This)->lpVtbl -> AddRef(This) - -#define _IShockwaveFlashEvents_Release(This) \ - (This)->lpVtbl -> Release(This) - - -#define _IShockwaveFlashEvents_GetTypeInfoCount(This,pctinfo) \ - (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) - -#define _IShockwaveFlashEvents_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) - -#define _IShockwaveFlashEvents_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) - -#define _IShockwaveFlashEvents_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - -#endif /* ___IShockwaveFlashEvents_DISPINTERFACE_DEFINED__ */ - - -#ifndef __IFlashFactory_INTERFACE_DEFINED__ -#define __IFlashFactory_INTERFACE_DEFINED__ - -/* interface IFlashFactory */ -/* [object][helpstring][uuid] */ - - -EXTERN_C const IID IID_IFlashFactory; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("D27CDB70-AE6D-11CF-96B8-444553540000") - IFlashFactory : public IUnknown - { - public: - }; - -#else /* C style interface */ - - typedef struct IFlashFactoryVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IFlashFactory * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IFlashFactory * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IFlashFactory * This); - - END_INTERFACE - } IFlashFactoryVtbl; - - interface IFlashFactory - { - CONST_VTBL struct IFlashFactoryVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IFlashFactory_QueryInterface(This,riid,ppvObject) \ - (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) - -#define IFlashFactory_AddRef(This) \ - (This)->lpVtbl -> AddRef(This) - -#define IFlashFactory_Release(This) \ - (This)->lpVtbl -> Release(This) - - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IFlashFactory_INTERFACE_DEFINED__ */ - - -#ifndef __IFlashObjectInterface_INTERFACE_DEFINED__ -#define __IFlashObjectInterface_INTERFACE_DEFINED__ - -/* interface IFlashObjectInterface */ -/* [object][helpstring][uuid] */ - - -EXTERN_C const IID IID_IFlashObjectInterface; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("D27CDB72-AE6D-11CF-96B8-444553540000") - IFlashObjectInterface : public IDispatchEx - { - public: - }; - -#else /* C style interface */ - - typedef struct IFlashObjectInterfaceVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IFlashObjectInterface * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IFlashObjectInterface * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IFlashObjectInterface * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - IFlashObjectInterface * This, - /* [out] */ UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - IFlashObjectInterface * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - IFlashObjectInterface * This, - /* [in] */ REFIID riid, - /* [size_is][in] */ LPOLESTR *rgszNames, - /* [in] */ UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IFlashObjectInterface * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - HRESULT ( __stdcall *GetDispID )( - IFlashObjectInterface * This, - /* [in] */ BSTR bstrName, - /* [in] */ unsigned long grfdex, - /* [out] */ long *pid); - - HRESULT ( __stdcall *RemoteInvokeEx )( - IFlashObjectInterface * This, - /* [in] */ long id, - /* [in] */ unsigned long lcid, - /* [in] */ unsigned long dwFlags, - /* [in] */ DISPPARAMS *pdp, - /* [out] */ VARIANT *pvarRes, - /* [out] */ EXCEPINFO *pei, - /* [in] */ IServiceProvider *pspCaller, - /* [in] */ unsigned int cvarRefArg, - /* [in] */ unsigned int *rgiRefArg, - /* [out][in] */ VARIANT *rgvarRefArg); - - HRESULT ( __stdcall *DeleteMemberByName )( - IFlashObjectInterface * This, - /* [in] */ BSTR bstrName, - /* [in] */ unsigned long grfdex); - - HRESULT ( __stdcall *DeleteMemberByDispID )( - IFlashObjectInterface * This, - /* [in] */ long id); - - HRESULT ( __stdcall *GetMemberProperties )( - IFlashObjectInterface * This, - /* [in] */ long id, - /* [in] */ unsigned long grfdexFetch, - /* [out] */ unsigned long *pgrfdex); - - HRESULT ( __stdcall *GetMemberName )( - IFlashObjectInterface * This, - /* [in] */ long id, - /* [out] */ BSTR *pbstrName); - - HRESULT ( __stdcall *GetNextDispID )( - IFlashObjectInterface * This, - /* [in] */ unsigned long grfdex, - /* [in] */ long id, - /* [out] */ long *pid); - - HRESULT ( __stdcall *GetNameSpaceParent )( - IFlashObjectInterface * This, - /* [out] */ IUnknown **ppunk); - - END_INTERFACE - } IFlashObjectInterfaceVtbl; - - interface IFlashObjectInterface - { - CONST_VTBL struct IFlashObjectInterfaceVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IFlashObjectInterface_QueryInterface(This,riid,ppvObject) \ - (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) - -#define IFlashObjectInterface_AddRef(This) \ - (This)->lpVtbl -> AddRef(This) - -#define IFlashObjectInterface_Release(This) \ - (This)->lpVtbl -> Release(This) - - -#define IFlashObjectInterface_GetTypeInfoCount(This,pctinfo) \ - (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) - -#define IFlashObjectInterface_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) - -#define IFlashObjectInterface_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) - -#define IFlashObjectInterface_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) - - -#define IFlashObjectInterface_GetDispID(This,bstrName,grfdex,pid) \ - (This)->lpVtbl -> GetDispID(This,bstrName,grfdex,pid) - -#define IFlashObjectInterface_RemoteInvokeEx(This,id,lcid,dwFlags,pdp,pvarRes,pei,pspCaller,cvarRefArg,rgiRefArg,rgvarRefArg) \ - (This)->lpVtbl -> RemoteInvokeEx(This,id,lcid,dwFlags,pdp,pvarRes,pei,pspCaller,cvarRefArg,rgiRefArg,rgvarRefArg) - -#define IFlashObjectInterface_DeleteMemberByName(This,bstrName,grfdex) \ - (This)->lpVtbl -> DeleteMemberByName(This,bstrName,grfdex) - -#define IFlashObjectInterface_DeleteMemberByDispID(This,id) \ - (This)->lpVtbl -> DeleteMemberByDispID(This,id) - -#define IFlashObjectInterface_GetMemberProperties(This,id,grfdexFetch,pgrfdex) \ - (This)->lpVtbl -> GetMemberProperties(This,id,grfdexFetch,pgrfdex) - -#define IFlashObjectInterface_GetMemberName(This,id,pbstrName) \ - (This)->lpVtbl -> GetMemberName(This,id,pbstrName) - -#define IFlashObjectInterface_GetNextDispID(This,grfdex,id,pid) \ - (This)->lpVtbl -> GetNextDispID(This,grfdex,id,pid) - -#define IFlashObjectInterface_GetNameSpaceParent(This,ppunk) \ - (This)->lpVtbl -> GetNameSpaceParent(This,ppunk) - - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IFlashObjectInterface_INTERFACE_DEFINED__ */ - - -#ifndef __IDispatchEx_INTERFACE_DEFINED__ -#define __IDispatchEx_INTERFACE_DEFINED__ - -/* interface IDispatchEx */ -/* [object][uuid] */ - - -EXTERN_C const IID IID_IDispatchEx; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("A6EF9860-C720-11D0-9337-00A0C90DCAA9") - IDispatchEx : public IDispatch - { - public: - virtual HRESULT __stdcall GetDispID( - /* [in] */ BSTR bstrName, - /* [in] */ unsigned long grfdex, - /* [out] */ long *pid) = 0; - - virtual HRESULT __stdcall RemoteInvokeEx( - /* [in] */ long id, - /* [in] */ unsigned long lcid, - /* [in] */ unsigned long dwFlags, - /* [in] */ DISPPARAMS *pdp, - /* [out] */ VARIANT *pvarRes, - /* [out] */ EXCEPINFO *pei, - /* [in] */ IServiceProvider *pspCaller, - /* [in] */ unsigned int cvarRefArg, - /* [in] */ unsigned int *rgiRefArg, - /* [out][in] */ VARIANT *rgvarRefArg) = 0; - - virtual HRESULT __stdcall DeleteMemberByName( - /* [in] */ BSTR bstrName, - /* [in] */ unsigned long grfdex) = 0; - - virtual HRESULT __stdcall DeleteMemberByDispID( - /* [in] */ long id) = 0; - - virtual HRESULT __stdcall GetMemberProperties( - /* [in] */ long id, - /* [in] */ unsigned long grfdexFetch, - /* [out] */ unsigned long *pgrfdex) = 0; - - virtual HRESULT __stdcall GetMemberName( - /* [in] */ long id, - /* [out] */ BSTR *pbstrName) = 0; - - virtual HRESULT __stdcall GetNextDispID( - /* [in] */ unsigned long grfdex, - /* [in] */ long id, - /* [out] */ long *pid) = 0; - - virtual HRESULT __stdcall GetNameSpaceParent( - /* [out] */ IUnknown **ppunk) = 0; - - }; - -#else /* C style interface */ - - typedef struct IDispatchExVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDispatchEx * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDispatchEx * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDispatchEx * This); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( - IDispatchEx * This, - /* [out] */ UINT *pctinfo); - - HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( - IDispatchEx * This, - /* [in] */ UINT iTInfo, - /* [in] */ LCID lcid, - /* [out] */ ITypeInfo **ppTInfo); - - HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( - IDispatchEx * This, - /* [in] */ REFIID riid, - /* [size_is][in] */ LPOLESTR *rgszNames, - /* [in] */ UINT cNames, - /* [in] */ LCID lcid, - /* [size_is][out] */ DISPID *rgDispId); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( - IDispatchEx * This, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS *pDispParams, - /* [out] */ VARIANT *pVarResult, - /* [out] */ EXCEPINFO *pExcepInfo, - /* [out] */ UINT *puArgErr); - - HRESULT ( __stdcall *GetDispID )( - IDispatchEx * This, - /* [in] */ BSTR bstrName, - /* [in] */ unsigned long grfdex, - /* [out] */ long *pid); - - HRESULT ( __stdcall *RemoteInvokeEx )( - IDispatchEx * This, - /* [in] */ long id, - /* [in] */ unsigned long lcid, - /* [in] */ unsigned long dwFlags, - /* [in] */ DISPPARAMS *pdp, - /* [out] */ VARIANT *pvarRes, - /* [out] */ EXCEPINFO *pei, - /* [in] */ IServiceProvider *pspCaller, - /* [in] */ unsigned int cvarRefArg, - /* [in] */ unsigned int *rgiRefArg, - /* [out][in] */ VARIANT *rgvarRefArg); - - HRESULT ( __stdcall *DeleteMemberByName )( - IDispatchEx * This, - /* [in] */ BSTR bstrName, - /* [in] */ unsigned long grfdex); - - HRESULT ( __stdcall *DeleteMemberByDispID )( - IDispatchEx * This, - /* [in] */ long id); - - HRESULT ( __stdcall *GetMemberProperties )( - IDispatchEx * This, - /* [in] */ long id, - /* [in] */ unsigned long grfdexFetch, - /* [out] */ unsigned long *pgrfdex); - - HRESULT ( __stdcall *GetMemberName )( - IDispatchEx * This, - /* [in] */ long id, - /* [out] */ BSTR *pbstrName); - - HRESULT ( __stdcall *GetNextDispID )( - IDispatchEx * This, - /* [in] */ unsigned long grfdex, - /* [in] */ long id, - /* [out] */ long *pid); - - HRESULT ( __stdcall *GetNameSpaceParent )( - IDispatchEx * This, - /* [out] */ IUnknown **ppunk); - - END_INTERFACE - } IDispatchExVtbl; - - interface IDispatchEx - { - CONST_VTBL struct IDispatchExVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDispatchEx_QueryInterface(This,riid,ppvObject) \ - (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) - -#define IDispatchEx_AddRef(This) \ - (This)->lpVtbl -> AddRef(This) - -#define IDispatchEx_Release(This) \ - (This)->lpVtbl -> Release(This) - - -#define IDispatchEx_GetTypeInfoCount(This,pctinfo) \ - (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) - -#define IDispatchEx_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ - (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) - -#define IDispatchEx_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ - (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) - -#define IDispatchEx_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ - (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) - - -#define IDispatchEx_GetDispID(This,bstrName,grfdex,pid) \ - (This)->lpVtbl -> GetDispID(This,bstrName,grfdex,pid) - -#define IDispatchEx_RemoteInvokeEx(This,id,lcid,dwFlags,pdp,pvarRes,pei,pspCaller,cvarRefArg,rgiRefArg,rgvarRefArg) \ - (This)->lpVtbl -> RemoteInvokeEx(This,id,lcid,dwFlags,pdp,pvarRes,pei,pspCaller,cvarRefArg,rgiRefArg,rgvarRefArg) - -#define IDispatchEx_DeleteMemberByName(This,bstrName,grfdex) \ - (This)->lpVtbl -> DeleteMemberByName(This,bstrName,grfdex) - -#define IDispatchEx_DeleteMemberByDispID(This,id) \ - (This)->lpVtbl -> DeleteMemberByDispID(This,id) - -#define IDispatchEx_GetMemberProperties(This,id,grfdexFetch,pgrfdex) \ - (This)->lpVtbl -> GetMemberProperties(This,id,grfdexFetch,pgrfdex) - -#define IDispatchEx_GetMemberName(This,id,pbstrName) \ - (This)->lpVtbl -> GetMemberName(This,id,pbstrName) - -#define IDispatchEx_GetNextDispID(This,grfdex,id,pid) \ - (This)->lpVtbl -> GetNextDispID(This,grfdex,id,pid) - -#define IDispatchEx_GetNameSpaceParent(This,ppunk) \ - (This)->lpVtbl -> GetNameSpaceParent(This,ppunk) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -HRESULT __stdcall IDispatchEx_GetDispID_Proxy( - IDispatchEx * This, - /* [in] */ BSTR bstrName, - /* [in] */ unsigned long grfdex, - /* [out] */ long *pid); - - -void __RPC_STUB IDispatchEx_GetDispID_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -HRESULT __stdcall IDispatchEx_RemoteInvokeEx_Proxy( - IDispatchEx * This, - /* [in] */ long id, - /* [in] */ unsigned long lcid, - /* [in] */ unsigned long dwFlags, - /* [in] */ DISPPARAMS *pdp, - /* [out] */ VARIANT *pvarRes, - /* [out] */ EXCEPINFO *pei, - /* [in] */ IServiceProvider *pspCaller, - /* [in] */ unsigned int cvarRefArg, - /* [in] */ unsigned int *rgiRefArg, - /* [out][in] */ VARIANT *rgvarRefArg); - - -void __RPC_STUB IDispatchEx_RemoteInvokeEx_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -HRESULT __stdcall IDispatchEx_DeleteMemberByName_Proxy( - IDispatchEx * This, - /* [in] */ BSTR bstrName, - /* [in] */ unsigned long grfdex); - - -void __RPC_STUB IDispatchEx_DeleteMemberByName_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -HRESULT __stdcall IDispatchEx_DeleteMemberByDispID_Proxy( - IDispatchEx * This, - /* [in] */ long id); - - -void __RPC_STUB IDispatchEx_DeleteMemberByDispID_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -HRESULT __stdcall IDispatchEx_GetMemberProperties_Proxy( - IDispatchEx * This, - /* [in] */ long id, - /* [in] */ unsigned long grfdexFetch, - /* [out] */ unsigned long *pgrfdex); - - -void __RPC_STUB IDispatchEx_GetMemberProperties_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -HRESULT __stdcall IDispatchEx_GetMemberName_Proxy( - IDispatchEx * This, - /* [in] */ long id, - /* [out] */ BSTR *pbstrName); - - -void __RPC_STUB IDispatchEx_GetMemberName_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -HRESULT __stdcall IDispatchEx_GetNextDispID_Proxy( - IDispatchEx * This, - /* [in] */ unsigned long grfdex, - /* [in] */ long id, - /* [out] */ long *pid); - - -void __RPC_STUB IDispatchEx_GetNextDispID_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - -HRESULT __stdcall IDispatchEx_GetNameSpaceParent_Proxy( - IDispatchEx * This, - /* [out] */ IUnknown **ppunk); - - -void __RPC_STUB IDispatchEx_GetNameSpaceParent_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IDispatchEx_INTERFACE_DEFINED__ */ - - -#ifndef __IServiceProvider_INTERFACE_DEFINED__ -#define __IServiceProvider_INTERFACE_DEFINED__ - -/* interface IServiceProvider */ -/* [object][uuid] */ - - -EXTERN_C const IID IID_IServiceProvider; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("6D5140C1-7436-11CE-8034-00AA006009FA") - IServiceProvider : public IUnknown - { - public: - virtual HRESULT __stdcall RemoteQueryService( - /* [in] */ GUID *guidService, - /* [in] */ GUID *riid, - /* [out] */ IUnknown **ppvObject) = 0; - - }; - -#else /* C style interface */ - - typedef struct IServiceProviderVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IServiceProvider * This, - /* [in] */ REFIID riid, - /* [iid_is][out] */ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IServiceProvider * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IServiceProvider * This); - - HRESULT ( __stdcall *RemoteQueryService )( - IServiceProvider * This, - /* [in] */ GUID *guidService, - /* [in] */ GUID *riid, - /* [out] */ IUnknown **ppvObject); - - END_INTERFACE - } IServiceProviderVtbl; - - interface IServiceProvider - { - CONST_VTBL struct IServiceProviderVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IServiceProvider_QueryInterface(This,riid,ppvObject) \ - (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) - -#define IServiceProvider_AddRef(This) \ - (This)->lpVtbl -> AddRef(This) - -#define IServiceProvider_Release(This) \ - (This)->lpVtbl -> Release(This) - - -#define IServiceProvider_RemoteQueryService(This,guidService,riid,ppvObject) \ - (This)->lpVtbl -> RemoteQueryService(This,guidService,riid,ppvObject) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - -HRESULT __stdcall IServiceProvider_RemoteQueryService_Proxy( - IServiceProvider * This, - /* [in] */ GUID *guidService, - /* [in] */ GUID *riid, - /* [out] */ IUnknown **ppvObject); - - -void __RPC_STUB IServiceProvider_RemoteQueryService_Stub( - IRpcStubBuffer *This, - IRpcChannelBuffer *_pRpcChannelBuffer, - PRPC_MESSAGE _pRpcMessage, - DWORD *_pdwStubPhase); - - - -#endif /* __IServiceProvider_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_ShockwaveFlash; - -#ifdef __cplusplus - -class DECLSPEC_UUID("D27CDB6E-AE6D-11CF-96B8-444553540000") -ShockwaveFlash; -#endif - -EXTERN_C const CLSID CLSID_FlashObjectInterface; - -#ifdef __cplusplus - -class DECLSPEC_UUID("D27CDB71-AE6D-11CF-96B8-444553540000") -FlashObjectInterface; -#endif -#endif /* __ShockwaveFlashObjects_LIBRARY_DEFINED__ */ - -/* Additional Prototypes for ALL interfaces */ - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - diff --git a/server/producers/targa/TargaManager.cpp b/server/producers/targa/TargaManager.cpp deleted file mode 100644 index 082b9fd7f..000000000 --- a/server/producers/targa/TargaManager.cpp +++ /dev/null @@ -1,372 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\stdafx.h" - -#include "TargaManager.h" -#include "..\..\frame\FrameManager.h" -#include "..\..\frame\FrameMediaController.h" -#include "..\..\utils\FileInputStream.h" -#include "..\..\fileinfo.h" -#include "..\..\frame\buffers\StaticFrameBuffer.h" - -namespace caspar { - -using namespace caspar::utils; - -/////////////////////////////// -// TargaProducer declaration -// -class TargaProducer : public MediaProducer, public FrameMediaController -{ -public: - explicit TargaProducer(PixmapDataPtr pImage); - virtual ~TargaProducer(); - - virtual IMediaController* QueryController(const tstring& id); - - virtual bool Initialize(FrameManagerPtr pFrameManager); - virtual FrameBuffer& GetFrameBuffer() { - return frameBuffer_; - } - -private: - StaticFrameBuffer frameBuffer_; - caspar::utils::PixmapDataPtr pImage_; -}; - -////////////////////////////// -// TargaManager definition -// -TargaManager::TargaManager() -{ - _extensions.push_back(TEXT("tga")); -} - -TargaManager::~TargaManager() -{} - -MediaProducerPtr TargaManager::CreateProducer(const tstring& filename) { - MediaProducerPtr result; - if(filename.length() > 0) { - utils::InputStreamPtr pTgaFile(new utils::FileInputStream(filename)); - if(pTgaFile->Open()) { - PixmapDataPtr pImage; - if(TargaManager::Load(pTgaFile, pImage)) { - result = MediaProducerPtr(new TargaProducer(pImage)); - } - } - } - return result; -} - -bool TargaManager::getFileInfo(FileInfo* pFileInfo) -{ - if(pFileInfo != 0) { - pFileInfo->length = 1; - pFileInfo->type = TEXT("still"); - pFileInfo->encoding = TEXT("TGA"); - return true; - } - return false; -} - -PixmapDataPtr TargaManager::CropPadToFrameFormat(PixmapDataPtr pSource, const FrameFormatDescription& fmtDesc) -{ - if(pSource->width == fmtDesc.width && pSource->height == fmtDesc.height) - return pSource; - - unsigned short colsToCopy = pSource->width; - unsigned short rowsToCopy = pSource->height; - - int offsetX = 0; - if(pSource->width > fmtDesc.width) - { - offsetX = (pSource->width-fmtDesc.width)/2; - colsToCopy = fmtDesc.width; - } - - int offsetY = 0; - if(pSource->height > fmtDesc.height) - { - offsetY = (pSource->height-fmtDesc.height)/2; - rowsToCopy = fmtDesc.height; - } - - int bytesPerPixel = pSource->bpp; - - PixmapDataPtr pNewImage(new caspar::utils::PixmapData(fmtDesc.width, fmtDesc.height, bytesPerPixel)); - unsigned char* pNewImageData = pNewImage->GetDataPtr(); - - //initialize new buffer with zeroes - memset(pNewImageData, 0, fmtDesc.width*fmtDesc.height*bytesPerPixel); - - for(int i=0;iGetDataPtr()[bytesPerPixel*(pSource->width*(i+offsetY)+offsetX)]), bytesPerPixel*colsToCopy); - - return pNewImage; -} - - -bool TargaManager::Load(utils::InputStreamPtr spTGA, PixmapDataPtr& pResult) -{ - utils::InputStream* pTGA = spTGA.get(); - PixmapDataPtr pImage(new utils::PixmapData()); - - bool returnValue = true; - //correct headers to compare to - char headerUncompressed[12] = {0,0, 2,0,0,0,0,0,0,0,0,0}; - char headerCompressed[12] = {0,0,10,0,0,0,0,0,0,0,0,0}; - - unsigned char header[12]; - unsigned char tgaInfo[6]; - unsigned int nImageSize = 0, nBytesPerPixel = 0; - - unsigned char *pColorBuffer = NULL; - - unsigned int i; - unsigned int nBytesPerRow; - int nCurrentRow = 0; - - char rowDirection = -1; - - pTGA->Read(header, 12); //read header to be able to process compressed files in one way and uncompressed files in another - pTGA->Read(tgaInfo, 6); //read image-info such as height and width - - int width = tgaInfo[1] * 256 + tgaInfo[0]; //extract width - int height = tgaInfo[3] * 256 + tgaInfo[2]; //extract height - int bits = tgaInfo[4]; //extract bits/pixel - - pImage->Set(width, height, 4); - unsigned char* pImageData = pImage->GetDataPtr(); - - rowDirection = -1; - if(tgaInfo[5] & 0x20) - rowDirection = 1; - - //calculate usefull numbers - nBytesPerPixel = bits / 8; - nBytesPerRow = pImage->width * nBytesPerPixel; - - //internal data always have 4 bytes / pixel - nImageSize = pImage->width * pImage->height * 4; - - if(nBytesPerPixel != 3 && nBytesPerPixel != 4) - { - returnValue = false; - goto tgaLoaderExit; - } - - memset(pImageData, 0, nImageSize); - - //Workaround for image identification field problem - { - unsigned char iifSize = header[0]; - unsigned char temp[256]; - if(iifSize > 0) - pTGA->Read(temp, iifSize); - } - header[0] = 0; - header[7] = 0; - //END workaround - - //We've got an uncompressed file on our hands, take care of it - if(memcmp(headerUncompressed, header, 12) == 0) - { - unsigned char* pRowBuffer = new unsigned char[nBytesPerRow]; - - int rowIndex=0; - if(rowDirection == -1) - nCurrentRow = height-1; - else - nCurrentRow = 0; - - for(; rowIndex < height; nCurrentRow+=rowDirection, ++rowIndex) - { - if(pTGA->Read(pRowBuffer, nBytesPerRow) < nBytesPerRow) - { - delete[] pRowBuffer; - returnValue = false; - goto tgaLoaderExit; - } - - //Swap color-channels - for(i=0;iwidth;i++) - { - pImageData[4*(nCurrentRow*width+i)+0] = pRowBuffer[i*nBytesPerPixel+0]; - pImageData[4*(nCurrentRow*width+i)+1] = pRowBuffer[i*nBytesPerPixel+1]; - pImageData[4*(nCurrentRow*width+i)+2] = pRowBuffer[i*nBytesPerPixel+2]; - if(nBytesPerPixel == 4) - pImageData[4*(nCurrentRow*width+i)+3] = pRowBuffer[i*nBytesPerPixel+3]; - else - pImageData[4*(nCurrentRow*width+i)+3] = 255; - } - } - delete[] pRowBuffer; - } - - //wasn't uncompressed, is it compressed? in that case, take care of it! - else if(memcmp(headerCompressed, header, 12) == 0) - { - int rowIndex=0; - if(rowDirection == -1) - nCurrentRow = pImage->height-1; - else - nCurrentRow = 0; - - nBytesPerRow = width * 4; - - int nPixelCount = height * width; - int nCurrentPixel = 0; - int nCurrentByte = 0; - - pColorBuffer = new unsigned char[nBytesPerPixel]; - - do - { - unsigned char chunkHeader = 0; - - //read chunkHeader - exit on error - if(pTGA->Read(&chunkHeader, 1) < 0) - { - returnValue = false; - goto tgaLoaderExit; - } - - if(chunkHeader < 128) //it's a RAW-header - { - chunkHeader++; - - for(unsigned short counter=0; counterRead(pColorBuffer, nBytesPerPixel) < nBytesPerPixel) - { - returnValue = false; - goto tgaLoaderExit; - } - - unsigned int thisByte = nCurrentRow*nBytesPerRow+nCurrentByte; - - - pImageData[thisByte+0] = pColorBuffer[0]; - pImageData[thisByte+1] = pColorBuffer[1]; - pImageData[thisByte+2] = pColorBuffer[2]; - if(nBytesPerPixel == 4) - pImageData[thisByte+3] = pColorBuffer[3]; - else - pImageData[thisByte+3] = 255; - - nCurrentByte += 4; - nCurrentPixel++; - if(nCurrentByte >= nBytesPerRow) - { - nCurrentRow += rowDirection; - ++rowIndex; - nCurrentByte = 0; - } - } - } - else //it's a RLE header - { - chunkHeader -= 127; - - //read pixeldata - exit on error - if(pTGA->Read(pColorBuffer, nBytesPerPixel) < nBytesPerPixel) - { - returnValue = false; - goto tgaLoaderExit; - } - - //repeat this pixel - for(unsigned short counter=0; counter= nBytesPerRow) - { - nCurrentRow += rowDirection; - ++rowIndex; - nCurrentByte = 0; - } - } - } - }while(nCurrentPixelheight); - } - else - returnValue = false; - -tgaLoaderExit: - if(pColorBuffer != NULL) - delete[] pColorBuffer; - - if(returnValue) - pResult = pImage; - - return returnValue; -} - - -/////////////////////////////// -// TargaProducer definition -// -TargaProducer::TargaProducer(PixmapDataPtr pImage) : pImage_(pImage) { -} - -TargaProducer::~TargaProducer() { -} - -IMediaController* TargaProducer::QueryController(const tstring& id) { - if(id == TEXT("FrameController")) - return this; - - return 0; -} - -bool TargaProducer::Initialize(FrameManagerPtr pFrameManager) { - if(pFrameManager != 0) { - FramePtr pFrame = pFrameManager->CreateFrame(); - if(pFrame != 0 && pFrame->GetDataPtr() != 0) { - PixmapDataPtr pResult = TargaManager::CropPadToFrameFormat(pImage_, pFrameManager->GetFrameFormatDescription()); - - unsigned char* pFrameData = pFrame->GetDataPtr(); - unsigned char* pImageData = pResult->GetDataPtr(); - - memcpy(pFrameData, pImageData, pFrame->GetDataSize()); - - frameBuffer_.push_back(pFrame); - return true; - } - } - return false; -} - -} //namespace caspar \ No newline at end of file diff --git a/server/producers/targa/TargaManager.h b/server/producers/targa/TargaManager.h deleted file mode 100644 index bb1e16e90..000000000 --- a/server/producers/targa/TargaManager.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -#include "..\..\frame\Frame.h" -#include "..\..\MediaManager.h" -#include "..\..\MediaProducer.h" -#include "..\..\utils\InputStream.h" -#include "..\..\utils\PixmapData.h" - -namespace caspar { - -class FileInfo; - -class TargaManager : public IMediaManager -{ -public: - TargaManager(); - virtual ~TargaManager(); - - virtual MediaProducerPtr CreateProducer(const tstring& filename); - virtual bool getFileInfo(FileInfo* pFileInfo); - - static utils::PixmapDataPtr CropPadToFrameFormat(utils::PixmapDataPtr pSource, const FrameFormatDescription& fmtDesc); - static bool Load(utils::InputStreamPtr pTGA, utils::PixmapDataPtr& pResult); -}; - -} //namespace caspar \ No newline at end of file diff --git a/server/producers/targascroll/TargaScrollManager.cpp b/server/producers/targascroll/TargaScrollManager.cpp deleted file mode 100644 index b19205ce2..000000000 --- a/server/producers/targascroll/TargaScrollManager.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\StdAfx.h" - -#include "TargaScrollManager.h" -#include "TargaScrollProducer.h" -#include "..\..\FileInfo.h" -#include "..\..\MediaManager.h" - -namespace caspar { - -TargaScrollMediaManager::TargaScrollMediaManager() : IMediaManager() -{ - IMediaManager::_extensions.push_back(TEXT("stga")); -} - -TargaScrollMediaManager::~TargaScrollMediaManager() -{ -} - -MediaProducerPtr TargaScrollMediaManager::CreateProducer(const tstring& filename) -{ - TargaScrollMediaProducerPtr pTargaScrollMediaProducer(new TargaScrollMediaProducer()); - if (!pTargaScrollMediaProducer->Load(filename)) - pTargaScrollMediaProducer.reset(); - - return pTargaScrollMediaProducer; -} - -bool TargaScrollMediaManager::getFileInfo(FileInfo* pFileInfo) -{ - pFileInfo->length = 1; - pFileInfo->type = TEXT("movie"); - pFileInfo->encoding = TEXT("NA"); - - return true; -} - -} \ No newline at end of file diff --git a/server/producers/targascroll/TargaScrollManager.h b/server/producers/targascroll/TargaScrollManager.h deleted file mode 100644 index 13059a662..000000000 --- a/server/producers/targascroll/TargaScrollManager.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef TARGASCROLLMEIDAMANAGER_H -#define TARGASCROLLMEIDAMANAGER_H - -#include "..\..\MediaManager.h" - -namespace caspar { - -class TargaScrollMediaProducer; - -class TargaScrollMediaManager : public IMediaManager -{ - public: - TargaScrollMediaManager(); - virtual ~TargaScrollMediaManager(); - - virtual bool getFileInfo(FileInfo* pFileInfo); - virtual MediaProducerPtr CreateProducer(const tstring& filename); - - private: - typedef std::tr1::shared_ptr TargaScrollMediaProducerPtr; -}; - -} - -#endif \ No newline at end of file diff --git a/server/producers/targascroll/TargaScrollProducer.cpp b/server/producers/targascroll/TargaScrollProducer.cpp deleted file mode 100644 index abc2b7682..000000000 --- a/server/producers/targascroll/TargaScrollProducer.cpp +++ /dev/null @@ -1,293 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\StdAfx.h" - -#include "TargaScrollProducer.h" -#include "..\Targa\TargaManager.h" -#include "..\..\MediaProducer.h" -#include "..\..\FileInfo.h" -#include "..\..\utils\FileInputStream.h" -#include "..\..\utils\PixmapData.h" - -#include - -namespace caspar { -using namespace utils; - -int TargaScrollMediaProducer::DEFAULT_SPEED = 4; - -TargaScrollMediaProducer::TargaScrollMediaProducer() : initializeEvent_(FALSE, FALSE) -{ -} - -TargaScrollMediaProducer::~TargaScrollMediaProducer() -{ - this->workerThread.Stop(); -} - -bool TargaScrollMediaProducer::Load(const tstring& filename) -{ - if (filename.length() > 0) - { - tstring::size_type pos = filename.find_last_of(TEXT('_')); - if(pos != tstring::npos && (pos+1) < filename.size()) { - tstring speedStr = filename.substr(pos + 1); - pos = speedStr.find_first_of(TEXT('.')); - if(pos != tstring::npos) - speedStr = speedStr.substr(0, pos); - - try - { - speed = boost::lexical_cast(speedStr); - } - catch(...) - { - speed = DEFAULT_SPEED; - } - } - - utils::InputStreamPtr pTgaFile(new utils::FileInputStream(filename)); - if (pTgaFile->Open()) - return TargaManager::Load(pTgaFile, this->pImage); - } - - return false; -} - -IMediaController* TargaScrollMediaProducer::QueryController(const tstring& id) { - if(id == TEXT("FrameController")) - return this; - - return 0; -} - -bool TargaScrollMediaProducer::Initialize(FrameManagerPtr pFrameManager) { - if(pFrameManager != this->pFrameManager_) { - if(pFrameManager == 0) - return false; - - if(!workerThread.IsRunning()) { - pFrameManager_ = pFrameManager; - return workerThread.Start(this); - } - else - { - { - Lock lock(*this); - - if(pFrameManager_->GetFrameFormatDescription().width != pFrameManager->GetFrameFormatDescription().width || pFrameManager_->GetFrameFormatDescription().height != pFrameManager->GetFrameFormatDescription().height) { - return false; - } - - pTempFrameManager_ = pFrameManager; - } - - initializeEvent_.Set(); - } - } - - return true; -} - - -void TargaScrollMediaProducer::PadImageToFrameFormat() -{ - const FrameFormatDescription& formatDescription = pFrameManager_->GetFrameFormatDescription(); - - const unsigned int PIXMAP_WIDTH = max(this->pImage->width, formatDescription.width); - const unsigned int PIXMAP_HEIGHT = max(this->pImage->height, formatDescription.height); - - utils::PixmapDataPtr pNewImage(new utils::PixmapData(PIXMAP_WIDTH, PIXMAP_HEIGHT, this->pImage->bpp)); - - unsigned char* pNewImageData = pNewImage->GetDataPtr(); - unsigned char* pImageData = this->pImage->GetDataPtr(); - - memset(pNewImageData, 0, pNewImage->width * pNewImage->height * pNewImage->bpp); - - for (int i = 0; i < this->pImage->height; ++i) - memcpy(&pNewImageData[i* pNewImage->width * pNewImage->bpp], &pImageData[i* this->pImage->width * this->pImage->bpp], this->pImage->width * this->pImage->bpp); - - this->pImage = pNewImage; -} - -FramePtr TargaScrollMediaProducer::FillVideoFrame(FramePtr pFrame) -{ - const FrameFormatDescription& formatDescription = pFrameManager_->GetFrameFormatDescription(); - - const short deltaX = this->direction == DirectionFlag::ScrollLeft ? this->speed : -this->speed; - const short deltaY = this->direction == DirectionFlag::ScrollUp ? this->speed : -this->speed; - - unsigned char* pFrameData = pFrame->GetDataPtr(); - unsigned char* pImageData = this->pImage->GetDataPtr(); - - bool isFirstFrame = false, isLastFrame = false; - if (this->direction == DirectionFlag::ScrollUp || this->direction == DirectionFlag::ScrollDown) - { - for (int i = 0; i < formatDescription.height; ++i) - { - int srcRow = i + this->offset; // Assume progressive. - if (formatDescription.mode == Interlaced) - { - const int nextOffset = this->offset + (deltaY * 2); - isFirstFrame = this->offset == 0 || this->offset == (this->pImage->height - formatDescription.height); - isLastFrame = nextOffset <= 0 || nextOffset >= (this->pImage->height - formatDescription.height); - if (!isFirstFrame && !isLastFrame) - srcRow = (i % 2 == 0) ? i + this->offset : min(i + this->offset + deltaY, this->pImage->height); - } - - int dstInxex = i * formatDescription.width * this->pImage->bpp; - int srcIndex = srcRow * formatDescription.width * this->pImage->bpp; - int size = formatDescription.width * this->pImage->bpp; - - memcpy(&pFrameData[dstInxex], &pImageData[srcIndex], size); - } - - if (formatDescription.mode == Interlaced && !isFirstFrame && !isLastFrame) - this->offset += deltaY * 2; - else - this->offset += deltaY; - } - else - { - for (int i = 0; i < formatDescription.height; ++i) - { - int correctOffset = this->offset; // Assume progressive. - if (formatDescription.mode == Interlaced) - { - const int nextOffset = this->offset + (deltaX * 2); // Next offset. - isFirstFrame = this->offset == 0 || this->offset == (this->pImage->width - formatDescription.width); - isLastFrame = nextOffset <= 0 || nextOffset >= (this->pImage->width - formatDescription.width); - if (!isFirstFrame && !isLastFrame) - correctOffset = (i % 2 == 0) ? this->offset: this->offset + deltaX; - } - - int dstIndex = i * formatDescription.width * this->pImage->bpp; - int srcIndex = (i * this->pImage->width + correctOffset) * this->pImage->bpp; - - int stopOffset = min(correctOffset + formatDescription .width, this->pImage->width); - int size = (stopOffset - correctOffset) * this->pImage->bpp; - - memcpy(&pFrameData[dstIndex], &pImageData[srcIndex], size); - } - - if (formatDescription.mode == Interlaced && !isFirstFrame && !isLastFrame) - this->offset += deltaX * 2; - else - this->offset += deltaX; - } - - return pFrame; -} - -void TargaScrollMediaProducer::Run(HANDLE stopEvent) -{ - LOG << LogLevel::Verbose << TEXT("Targa scroll thread started"); - - const short waitHandleCount = 3; - HANDLE waitHandles[waitHandleCount] = { stopEvent, initializeEvent_, this->frameBuffer.GetWriteWaitHandle() }; - - int formatWidth = 0; - int formatHeight = 0; - { - const FrameFormatDescription& formatDescription = pFrameManager_->GetFrameFormatDescription(); - formatWidth = formatDescription.width; - formatHeight = formatDescription.height; - - //determine whether to scroll horizontally or vertically - if((this->pImage->width - formatWidth) > (pImage->height - formatHeight)) - direction = (speed < 0) ? DirectionFlag::ScrollRight : DirectionFlag::ScrollLeft; - else - direction = (speed < 0) ? DirectionFlag::ScrollDown : DirectionFlag::ScrollUp; - - this->speed = abs(speed / formatDescription.fps); - this->offset = 0; - if (this->direction == DirectionFlag::ScrollDown) - this->offset = this->pImage->height - formatHeight; - else if (this->direction == DirectionFlag::ScrollRight) - this->offset = this->pImage->width - formatWidth; - } - - - if (formatWidth > this->pImage->width || formatHeight > this->pImage->height) - PadImageToFrameFormat(); - - bool quitLoop = false; - while (!quitLoop) - { - HRESULT waitResult = WaitForMultipleObjects(waitHandleCount, waitHandles, FALSE, 1000); - switch(waitResult) - { - case WAIT_OBJECT_0 + 0: // Stop. - case WAIT_FAILED: // Wait failiure. - quitLoop = true; - continue; - case WAIT_TIMEOUT: // Nothing has happened. - continue; - case WAIT_OBJECT_0 + 1: //initialize - { - Lock lock(*this); - pFrameManager_ = pTempFrameManager_; - pTempFrameManager_.reset(); - } - break; - - case WAIT_OBJECT_0 + 2: // Framebuffer is ready to be filled. - { - // Render next frame. - FramePtr pFrame = pFrameManager_->CreateFrame(); - pFrame = FillVideoFrame(pFrame); - this->frameBuffer.push_back(pFrame); - - // Should we stop scrolling? - if ((this->direction == DirectionFlag::ScrollDown || this->direction == DirectionFlag::ScrollRight) && this->offset <= 0) - quitLoop = true; - else if (this->direction == DirectionFlag::ScrollUp && this->offset >= (this->pImage->height - formatHeight)) - quitLoop = true; - else if (this->direction == DirectionFlag::ScrollLeft && this->offset >= (this->pImage->width - formatWidth)) - quitLoop = true; - } - } - } - - // Render a null frame to indicate EOF. - FramePtr pNullFrame; - this->frameBuffer.push_back(pNullFrame); - - LOG << LogLevel::Verbose << TEXT("Targa scroll thread ended"); -} - -bool TargaScrollMediaProducer::OnUnhandledException(const std::exception& ex) throw() -{ - try - { - FramePtr pNullFrame; - this->frameBuffer.push_back(pNullFrame); - - LOG << LogLevel::Critical << TEXT("UNHANDLED EXCEPTION in targa scroll thread. Message: ") << ex.what(); - } - catch (...) - { - } - - return false; -} - -} \ No newline at end of file diff --git a/server/producers/targascroll/TargaScrollProducer.h b/server/producers/targascroll/TargaScrollProducer.h deleted file mode 100644 index 11c5fc459..000000000 --- a/server/producers/targascroll/TargaScrollProducer.h +++ /dev/null @@ -1,86 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef TARGASCROLLMediaProducer_H -#define TARGASCROLLMediaProducer_H - -#include "..\..\MediaProducer.h" -#include "..\..\utils\Thread.h" -#include "..\..\utils\Lockable.h" -#include "..\..\frame\Framemediacontroller.h" -#include "..\..\frame\buffers\MotionFrameBuffer.h" - -namespace caspar { -namespace utils { - class PixmapData; - typedef std::tr1::shared_ptr PixmapDataPtr; -} - -class TargaScrollMediaProducer : public MediaProducer, public FrameMediaController, public utils::IRunnable, utils::LockableObject -{ - static int DEFAULT_SPEED; -public: - explicit TargaScrollMediaProducer(); - TargaScrollMediaProducer(const TargaScrollMediaProducer&); - virtual ~TargaScrollMediaProducer(); - - bool Load(const tstring& filename); - - virtual IMediaController* QueryController(const tstring& id); - virtual bool Initialize(FrameManagerPtr pFrameManager); - virtual FrameBuffer& GetFrameBuffer() { - return frameBuffer; - } - - virtual void Run(HANDLE stopEvent); - virtual bool OnUnhandledException(const std::exception& ex) throw(); - -private: - void PadImageToFrameFormat(); - FramePtr FillVideoFrame(FramePtr pFrame); - - struct DirectionFlag - { - enum DirectionFlagEnum - { - ScrollUp = 1, - ScrollDown, - ScrollLeft, - ScrollRight - }; - }; - - int offset; - short speed; - - utils::Thread workerThread; - utils::PixmapDataPtr pImage; - - MotionFrameBuffer frameBuffer; - DirectionFlag::DirectionFlagEnum direction; - - utils::Event initializeEvent_; - FrameManagerPtr pFrameManager_; - FrameManagerPtr pTempFrameManager_; -}; - -} - -#endif \ No newline at end of file diff --git a/server/resources/Server.rc b/server/resources/Server.rc deleted file mode 100644 index 0a1899dc2..000000000 --- a/server/resources/Server.rc +++ /dev/null @@ -1,85 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" -#include "VersionNo.h" -#include "server.rc2" -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "#include ""VersionNo.h""\r\n" - "#include ""server.rc2\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// Swedish resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_SVE) -#ifdef _WIN32 -LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_ICON1 ICON "icon2.ico" -#endif // Swedish resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/server/resources/icon2.ico b/server/resources/icon2.ico deleted file mode 100644 index 3e6ad48619834044e17146824e51e96cb2224728..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3262 zcmZQzU<5)11qLu!!Nb5H24rafu>ue~05Kzj1ds#*pxh`J4S}H-0@~qjI$^FTC>)gw zmqinYaM1+AT(!eo6N|DT0Z~v>F6(F{V{ZsT4qyafBau?px{_A7k)^J*t-g$d5mdW_ zA<#hogh+__`4uIS=2{Y_nz)d-u{x)y01Fof9>gxd!>=SIX$CXLOv^7i6zcx!av3{) zX&Ypu2j)UZeW2U;6{SFm8G#5`T3|&Wd2T6TDJvbIUKv|`|M&=y5CcO|L$#8hjiQe= zPULH?;AzPvDGWB5fq{t;7h+^(7By5;^s`a&wFyj%g_vL3*{G8dpq=Wko#qcDbt&M1Yopkhl;d8#4n769Y3Nmz1zhW+2dzu)=hR`4tn} z&FfRlYLm=r5`hf8>=5-BcQrH=CSR(Id#l*+Pz{P@sIG8vk1q=!! z__SmhxR~KmOnmGDI`Tk=xy`MUu+wAYVP)iFW0w?gnp*BMvnsKp3SxfK{3)R;d%{-s zSd_)HN%1j>a54z6F$l0iks!OEj=Xt66u+)KlQ1WPGEWQS&=OblFin}>l0CmC3ycbuO=>>4#=Sa~ zO+%DRN0L(;h$N5^ySk`dew0~C0Gqlfho+d2nR4}>Wd%DIht}jzhMM2CWY&b!+xI`X7BQhxHQg(`w`}*Fi~H|i z*?;fKJ`lRR<=QFN`ZU!P59MUH;I865_pcmyczr(*J-7x$`yO07^yF4xM}b_loqUYF zPKM9=>!+bIe*Urvb}ebSOZv_{xpV&6Js>*w6oigFypcGo z$+|wtsy@l9tDtAsidjdt%mkvtn`eO0q73QqPdxeX=JcbR zGmmedactY{6FY!t7MKkbS#{y?na8)MAKluse=QJo?_blkZ*}M1RULa*weMNcx_d?I zuI0@;mo@EJ+P8o0rDyl=y?p^RuxM&0)cwomZn}N;&6iJKetf(8<^|BGQ;%)|(aA?Q zk3R&W8%G~p1F~O!dVluGokRDo9=v;H|J_Ub?_An@=i=Vm7x&!0u>02eUAN93xO@58 z$G0E9eSP)$!`3_J;O6%%o4ft)h0i~}{rdA8h(7=L4paj~AHIEg4?>@T=-t=PKYsoC z{_7`@0o48yh&}<)dmwrNMz6no{PN>FM9qh9Uw7ZTR5T6hexUhFuN}Sp_W6^KZ*ikH zPd?&9k3YV71VJC(0F7F8<3!2yZb -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _STRING_CONVERT_H_ -#define _STRING_CONVERT_H_ - -#include -#include -#include -#include -#include - -namespace caspar { namespace utils { - -std::wstring widen(const std::string& str, const std::locale& locale = std::locale()) -{ - std::wstringstream wsstr ; - wsstr.imbue(locale); - const std::ctype& ctfacet = std::use_facet>(wsstr.getloc()) ; - for(size_t i = 0 ;i < str.size(); ++i) - wsstr << ctfacet.widen(str[i]) ; - return wsstr.str() ; -} - -std::string narrow(const std::wstring& str, const std::locale& locale = std::locale()) -{ - std::stringstream sstr; - sstr.imbue(locale); - const std::ctype& ctfacet = std::use_facet>(sstr.getloc()); - for(size_t i = 0; i < str.size(); ++i) - sstr << ctfacet.narrow(str[i], 0) ; - return sstr.str() ; -} - -std::string narrow_to_latin1(const std::wstring& wideString) -{ - std::string destBuffer; - //28591 = ISO 8859-1 Latin I - int bytesWritten = 0; - int multibyteBufferCapacity = WideCharToMultiByte(28591, 0, wideString.c_str(), -1, 0, 0, nullptr, nullptr); - if(multibyteBufferCapacity > 0) - { - destBuffer.resize(multibyteBufferCapacity); - bytesWritten = WideCharToMultiByte(28591, 0, wideString.c_str(), -1, &destBuffer[0], destBuffer.size(), nullptr, nullptr); - } - destBuffer.resize(bytesWritten); - return destBuffer; -} - -template -T lexical_cast_or_default(const std::wstring str, T defaultValue) -{ - try - { - if(!str.empty()) - return boost::lexical_cast(str); - } - catch(...){} - return defaultValue; -} - -}} - -#endif \ No newline at end of file diff --git a/server/utils/Allocator.h b/server/utils/Allocator.h deleted file mode 100644 index f54706b3c..000000000 --- a/server/utils/Allocator.h +++ /dev/null @@ -1,219 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -#include -#include "lockable.h" - -namespace caspar { -namespace utils { - -// TODO: (R.N) Create a scalable allocator with seperate memory pools for different threads, aka. tbb::scalable_allocator - -template -class FixedAllocator : private utils::LockableObject -{ - struct Chunk - { - void Init(std::size_t blockSize, unsigned char blocks); - void Destroy(); - - void* Allocate(); - void Deallocate(void* p); - - unsigned char blocksAvailable_; - unsigned char* GetDataPtr() const { - return pData_; - } - unsigned char GetAlignmentOffset() const { - return alignmentOffset_; - } - - private: - unsigned char alignmentOffset_; - unsigned char firstAvailableBlock_; - unsigned char* pData_; - unsigned int blockSize_; - }; - typedef std::vector Chunks; - - FixedAllocator(const FixedAllocator&); - FixedAllocator& operator=(const FixedAllocator&); -public: - explicit FixedAllocator(unsigned int blockSize); - - ~FixedAllocator(); - - void* Allocate(); - void Deallocate(void* p); - -private: - bool IsPtrInChunk(void* p, const Chunk& c) { - return (p >= c.GetDataPtr() && p < (c.GetDataPtr() + chunkSize + c.GetAlignmentOffset())); - } - - unsigned int blockSize_; - const std::size_t chunkSize; - Chunks chunks_; - - Chunk* pAllocChunk_; - Chunk* pDeallocChunk_; -}; -typedef std::tr1::shared_ptr > FixedAllocatorPtr; - -template -void FixedAllocator::Chunk::Init(std::size_t blockSize, unsigned char blocks) { - pData_ = new unsigned char[blockSize*blocks + Alignment]; - alignmentOffset_ = static_cast(Alignment - (reinterpret_cast(pData_) % Alignment)); - firstAvailableBlock_ = 0; - blocksAvailable_ = blocks; - blockSize_ = blockSize; - - unsigned char i = 0; - unsigned char* p = pData_ + alignmentOffset_; - while(i < blocks) { - *p = ++i; - p += blockSize; - } -} -template -void FixedAllocator::Chunk::Destroy() { - if(pData_ != 0) { - delete[] pData_; - pData_ = 0; - blocksAvailable_ = 0; - firstAvailableBlock_ = 0; - alignmentOffset_ = 0; - blockSize_ = 0; - } -} - -template -void* FixedAllocator::Chunk::Allocate() { - if(blocksAvailable_ < 1) return 0; - - unsigned char* pResult = pData_ + (firstAvailableBlock_ * blockSize_ + alignmentOffset_); - firstAvailableBlock_ = *pResult; - --blocksAvailable_; - - return pResult; -} - -template -void FixedAllocator::Chunk::Deallocate(void* p) { - _ASSERT(p >= pData_); - - unsigned char* pToRelease = static_cast(p); - _ASSERT((pToRelease - pData_) % blockSize_ == alignmentOffset_); - *pToRelease = firstAvailableBlock_; - - firstAvailableBlock_ = static_cast((pToRelease - pData_) / blockSize_); - _ASSERT(firstAvailableBlock_ == (pToRelease - pData_) / blockSize_); - - ++blocksAvailable_; -} - - -template -FixedAllocator::FixedAllocator(unsigned int blockSize) : blockSize_(blockSize), chunkSize(blockSize*BlocksInChunk), pAllocChunk_(0), pDeallocChunk_(0) { -} - -template -FixedAllocator::~FixedAllocator() { - Chunks::iterator it = chunks_.begin(); - Chunks::iterator end = chunks_.end(); - - for(; it != end; ++it) { - (*it).Destroy(); - } - - chunks_.clear(); -} - -template -void* FixedAllocator::Allocate() { - Lock lock(*this); - - if(pAllocChunk_ == 0 || pAllocChunk_->blocksAvailable_ == 0) { - Chunks::iterator it = chunks_.begin(); - Chunks::iterator end = chunks_.end(); - for(;; ++it) { - if(it == end) { - Chunk newChunk; - newChunk.Init(blockSize_, BlocksInChunk); - chunks_.push_back(newChunk); - pAllocChunk_ = &chunks_.back(); - pDeallocChunk_ = &chunks_.back(); - break; - } - - if(it->blocksAvailable_ > 0) { - pAllocChunk_ = &(*it); - break; - } - } - } - - _ASSERT(pAllocChunk_ != 0); - _ASSERT(pAllocChunk_->blocksAvailable_ > 0); - return pAllocChunk_->Allocate(); -} - -template -void FixedAllocator::Deallocate(void *p) { - Lock lock(*this); - - _ASSERT(pDeallocChunk_ != 0); - - Chunks::iterator end = chunks_.end(); - - if(IsPtrInChunk(p, *pDeallocChunk_)) { - pDeallocChunk_->Deallocate(p); - } - else { - Chunks::iterator it = chunks_.begin(); - for(; it != end; ++it) { - if(IsPtrInChunk(p, (*it))) { - (*it).Deallocate(p); - pDeallocChunk_ = &(*it); - break; - } - } - _ASSERT(it != end); - } - - //If this deallocation emptied the chunk, move it to the end - if(pDeallocChunk_->blocksAvailable_ == BlocksInChunk) { - --end; - //destroy the currently last chunk if the that also is empty - if(&(*end) != pDeallocChunk_ && end->blocksAvailable_ == BlocksInChunk) { - end->Destroy(); - chunks_.erase(end); - } - - std::swap(*pDeallocChunk_, chunks_.back()); - -// ASSERT(pDeallocChunk_->blocksAvailable_ > 0); - } -} - -} //namespace utils -} //namespace caspar \ No newline at end of file diff --git a/server/utils/BitmapHolder.cpp b/server/utils/BitmapHolder.cpp deleted file mode 100644 index 6b2cbb0ab..000000000 --- a/server/utils/BitmapHolder.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\StdAfx.h" - -#include "BitmapHolder.h" -#include "DCWrapper.h" - -namespace caspar{ - -bool CreateBitmap(HDC dc, size_t width, size_t height, HBITMAP& hBitmap, void** pBitmapData, void* memory) -{ - BITMAPINFO bitmapInfo; - bitmapInfo.bmiHeader.biBitCount = 32; - bitmapInfo.bmiHeader.biClrImportant = 0; - bitmapInfo.bmiHeader.biClrUsed = 0; - bitmapInfo.bmiHeader.biCompression = BI_RGB; - bitmapInfo.bmiHeader.biHeight = -height; - bitmapInfo.bmiHeader.biPlanes = 1; - bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFO); - bitmapInfo.bmiHeader.biWidth = width; - bitmapInfo.bmiHeader.biSizeImage = 0; - bitmapInfo.bmiHeader.biXPelsPerMeter = 0; - bitmapInfo.bmiHeader.biYPelsPerMeter = 0; - - if(memory != NULL) - { - HDC memoryDC = CreateCompatibleDC(dc); - if(memoryDC == NULL) - return false; - - HANDLE hMapping = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, width*height*4, NULL); - MapViewOfFileEx(hMapping, FILE_MAP_ALL_ACCESS, 0, 0, 0, memory); - - hBitmap = CreateDIBSection(memoryDC, &bitmapInfo, DIB_RGB_COLORS, pBitmapData, hMapping, 0); - } - else - hBitmap = CreateDIBSection(dc, &bitmapInfo, DIB_RGB_COLORS, pBitmapData, NULL, 0); - - return (hBitmap != 0); -} - -struct BitmapHolder::Implementation -{ - - Implementation(HWND hWnd, size_t width, size_t height, void* memory) - : hDC_(0), hBitmap_(0), pBitmapData_(0), width_(width), height_(height) - { - DCWrapper hDC(hWnd); - - hDC_ = CreateCompatibleDC(hDC); - if(CreateBitmap(hDC_, width_, height_, hBitmap_, reinterpret_cast(&pBitmapData_), memory)) - SelectObject(hDC_, hBitmap_); - else - { - hDC_ = 0; - hBitmap_ = 0; - pBitmapData_ = 0; - throw std::exception("Failed to create bitmap"); - } - } - - ~Implementation() - { - if(hBitmap_ != 0) - { - DeleteObject(hBitmap_); - hBitmap_ = 0; - } - - if(hDC_ != 0) - { - DeleteDC(hDC_); - hDC_ = 0; - } - } - - size_t width_; - size_t height_; - HDC hDC_; - HBITMAP hBitmap_; - unsigned char* pBitmapData_; -}; - -BitmapHolder::BitmapHolder(HWND hWnd, size_t width, size_t height, void* memory): pImpl_(new Implementation(hWnd, width, height, memory)) -{ -} - -HDC BitmapHolder::GetDC() const { - return pImpl_->hDC_; -} - -unsigned char* BitmapHolder::GetPtr() const { - return pImpl_->pBitmapData_; -} - -size_t BitmapHolder::Width() const -{ - return pImpl_->width_; -} - -size_t BitmapHolder::Height() const -{ - return pImpl_->height_; -} - -size_t BitmapHolder::Size() const -{ - return pImpl_->width_*pImpl_->height_*4; -} - -} \ No newline at end of file diff --git a/server/utils/BitmapHolder.h b/server/utils/BitmapHolder.h deleted file mode 100644 index 067376a9d..000000000 --- a/server/utils/BitmapHolder.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _BITMAP_HOLDER_ -#define _BITMAP_HOLDER_ - -#include -#include "..\frame\Frame.h" -#include "Noncopyable.hpp" - -namespace caspar{ - -/* - Class: BitmapHolder - - Changes: - 2010/4/2 (R.N), Refactored - 2010/4/3 (R.N), Implemented functionality to map bitmap to allocated memory - - Author: Niklas P. Andersson, N.A -*/ - -class BitmapHolder : private utils::Noncopyable -{ -public: - BitmapHolder(HWND hWnd, size_t height, size_t width, void* memory = NULL); - - HDC GetDC() const; - unsigned char* GetPtr() const; - size_t Width() const; - size_t Height() const; - size_t Size() const; - -private: - - struct Implementation; - std::tr1::shared_ptr pImpl_; -}; -typedef std::tr1::shared_ptr BitmapHolderPtr; - -} - -#endif - diff --git a/server/utils/CPUID.cpp b/server/utils/CPUID.cpp deleted file mode 100644 index 4b4ef5155..000000000 --- a/server/utils/CPUID.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\stdafx.h" -#include "CPUID.hpp" -#include - -namespace caspar { -namespace utils { - -CPUID::CPUID() : - FPU(0), - VME(0), - DE(0), - PSE(0), - TSC(0), - MSR(0), - PAE(0), - MCE(0), - CX8(0), - APIC(0), - SEP(0), - MTRR(0), - PGE(0), - MCA(0), - CMOV(0), - PAT(0), - PSE_36(0), - PSN(0), - CLFSH(0), - DS(0), - ACPI(0), - MMX(0), - FXSR(0), - SSE(0), - SSE2(0), - SSE3(0), - SSSE3(0), - SSE4_1(0), - SSE4_2(0), - SSE5(0), - SS(0), - HTT(0), - TM(0), - IA_64(0), - Family(0), - Model(0), - ModelEx(0), - Stepping(0), - FamilyEx(0), - Brand(0), - Type(0) -{ - int CPUInfo[4] = {-1}; - __cpuid(CPUInfo, 0); - - int nIds = CPUInfo[0]; - ID.append(reinterpret_cast(&CPUInfo[1]), 4); - ID.append(reinterpret_cast(&CPUInfo[3]), 4); - ID.append(reinterpret_cast(&CPUInfo[2]), 4); - - for (int i = 0; i <= nIds; ++i) - { - __cpuid(CPUInfo, i); - - if (i == 1) - { - Stepping = (CPUInfo[0] ) & 0x0F; - Model = (CPUInfo[0] >> 4 ) & 0x0F; - Family = (CPUInfo[0] >> 8 ) & 0x0F; - Type = (CPUInfo[0] >> 12) & 0x03; - ModelEx = (CPUInfo[0] >> 16) & 0x0F; - FamilyEx = (CPUInfo[0] >> 20) & 0xFF; - Brand = (CPUInfo[1] ) & 0xFF; - - if(ID == "GenuineIntel") - { - FPU = (CPUInfo[3] & (1 << 0)) != 0; - VME = (CPUInfo[3] & (1 << 1)) != 0; - DE = (CPUInfo[3] & (1 << 2)) != 0; - PSE = (CPUInfo[3] & (1 << 3)) != 0; - TSC = (CPUInfo[3] & (1 << 4)) != 0; - MSR = (CPUInfo[3] & (1 << 5)) != 0; - PAE = (CPUInfo[3] & (1 << 6)) != 0; - MCE = (CPUInfo[3] & (1 << 7)) != 0; - CX8 = (CPUInfo[3] & (1 << 8)) != 0; - APIC = (CPUInfo[3] & (1 << 9)) != 0; - // = (CPUInfo[3] & (1 << 10)) != 0; - SEP = (CPUInfo[3] & (1 << 11)) != 0; - MTRR = (CPUInfo[3] & (1 << 12)) != 0; - PGE = (CPUInfo[3] & (1 << 13)) != 0; - MCA = (CPUInfo[3] & (1 << 14)) != 0; - CMOV = (CPUInfo[3] & (1 << 15)) != 0; - PAT = (CPUInfo[3] & (1 << 16)) != 0; - PSE_36 = (CPUInfo[3] & (1 << 17)) != 0; - PSN = (CPUInfo[3] & (1 << 18)) != 0; - CLFSH = (CPUInfo[3] & (1 << 19)) != 0; - // = (CPUInfo[3] & (1 << 20)) != 0; - DS = (CPUInfo[3] & (1 << 21)) != 0; - ACPI = (CPUInfo[3] & (1 << 22)) != 0; - MMX = (CPUInfo[3] & (1 << 23)) != 0; - FXSR = (CPUInfo[3] & (1 << 24)) != 0; - SSE = (CPUInfo[3] & (1 << 25)) != 0; - SSE2 = (CPUInfo[3] & (1 << 26)) != 0; - SS = (CPUInfo[3] & (1 << 27)) != 0; - HTT = (CPUInfo[3] & (1 << 28)) != 0; - TM = (CPUInfo[3] & (1 << 29)) != 0; - // = (CPUInfo[3] & (1 << 30)) != 0; - IA_64 = (CPUInfo[3] & (1 << 31)) != 0; - - SSE3 = (CPUInfo[2] & (1 << 0)) != 0; - SSSE3 = (CPUInfo[2] & (1 << 9)) != 0; - SSE4_1 = (CPUInfo[2] & (1 << 19)) != 0; - SSE4_2 = (CPUInfo[2] & (1 << 20)) != 0; - } - else if(ID == "AuthenticAMD") - { - } - } - } - - if(SSE5) - SIMD = utils::SSE5; - else if(SSE4_2) - SIMD = utils::SSE4_2; - else if(SSE4_1) - SIMD = utils::SSE4_1; - else if(SSSE3) - SIMD = utils::SSSE3; - else if(SSE3) - SIMD = utils::SSE3; - else if(SSE2) - SIMD = utils::SSE2; - else if(SSE) - SIMD = utils::SSE; - else - SIMD = utils::REF; -} - -} -} diff --git a/server/utils/CPUID.hpp b/server/utils/CPUID.hpp deleted file mode 100644 index bb21db891..000000000 --- a/server/utils/CPUID.hpp +++ /dev/null @@ -1,110 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _CPUID_H_ -#define _CPUID_H_ - -#include - -namespace caspar { -namespace utils { - -enum SIMD -{ - AUTO, - REF, - SSE, - SSE2, - SSE3, - SSSE3, - SSE4_1, - SSE4_2, - SSE5 -}; - -/* - Class: CPUID - - Retrieves CPU hardware inforomation. - - Author: Robert Nagy, R.N (SVT 2009) - -*/ -struct CPUID -{ - CPUID(); - - std::string ID; - - bool FPU; //Floating Point Unit - bool VME; //Virtual Mode Extension - bool DE; //Debugging Extension - bool PSE; //Page Size Extension - bool TSC; //Time Stamp Counter - bool MSR; //Model Specific Registers - bool PAE; //Physical Address Extesnion - bool MCE; //Machine Check Extension - bool CX8; //CMPXCHG8 Instruction - bool APIC; //On-chip APIC Hardware - bool SEP; //SYSENTER SYSEXIT - bool MTRR; //Machine Type Range Registers - bool PGE; //Global Paging Extension - bool MCA; //Machine Check Architecture - bool CMOV; //Conditional Move Instrction - bool PAT; //Page Attribute Table - bool PSE_36; //36-bit Page Size Extension - bool PSN; //96-bit Processor Serial Number - bool CLFSH; //CLFLUSH Instruction - bool DS; //Debug Trace Store - bool ACPI; //ACPI Support - bool MMX; //MMX Technology - bool FXSR; //FXSAVE FXRSTOR (Fast save and restore) - bool SSE; //Streaming SIMD Extensions - bool SSE2; //Streaming SIMD Extensions 2 - bool SSE3; - bool SSSE3; - bool SSE4_1; - bool SSE4_2; - bool SSE5; - bool SS; //Self-Snoop - bool HTT; //Hyper-Threading Technology - bool TM; //Thermal Monitor Supported - bool IA_64; //IA-64 capable - - int Family; - int Model; - int ModelEx; - int Stepping; - int FamilyEx; - int Brand; - int Type; - - utils::SIMD SIMD; - - //int CacheLineSize; - //int LogicalProcessorCount; - //int LocalAPICID; - -}; - -} -} - -#endif \ No newline at end of file diff --git a/server/utils/CommandQueue.h b/server/utils/CommandQueue.h deleted file mode 100644 index 2d7b86c33..000000000 --- a/server/utils/CommandQueue.h +++ /dev/null @@ -1,152 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _COMMANDQUEUE_H__ -#define _COMMANDQUEUE_H__ - -#pragma once - -#include -#include "thread.h" -#include "Lockable.h" - -namespace caspar { -namespace utils { - -//TODO: Add idle-processing. preferably as a functor suplied at construction-time - -//CommandQueue is a -template -class CommandQueue -{ - template - class WorkerThread : public utils::IRunnable, private utils::LockableObject - { - public: - WorkerThread() : commandAvailibleEvent_(TRUE, FALSE) - {} - - void AddCommand(U pCommand); - virtual void Run(HANDLE stopEvent); - virtual bool OnUnhandledException(const std::exception& ex) throw(); - - private: - utils::Event commandAvailibleEvent_; - - //Needs synro-protection - std::list commands_; - }; - - CommandQueue(const CommandQueue&); - CommandQueue& operator=(const CommandQueue&); -public: - CommandQueue() : pWorker_(new WorkerThread()) - {} - ~CommandQueue() - {} - - bool Start(); - void Stop(); - void AddCommand(T pCommand); - -private: - utils::Thread commandPump_; - std::tr1::shared_ptr > pWorker_; - -}; - -template -bool CommandQueue::Start() { - return commandPump_.Start(pWorker_.get()); -} - -template -void CommandQueue::Stop() { - commandPump_.Stop(); -} - -template -void CommandQueue::AddCommand(T pCommand) { - pWorker_->AddCommand(pCommand); -} - -template -template -void CommandQueue::WorkerThread::AddCommand(U pCommand) { - Lock lock(*this); - - commands_.push_back(pCommand); - commandAvailibleEvent_.Set(); -} - -template -template -void CommandQueue::WorkerThread::Run(HANDLE stopEvent) -{ - HANDLE events[2] = {commandAvailibleEvent_, stopEvent}; - U pCommand; - - while(true) { - DWORD waitResult = WaitForMultipleObjects(2, events, FALSE, 1000); - int result = waitResult - WAIT_OBJECT_0; - - if(result == 1) { - break; - } - else if(result == 0) { - Lock lock(*this); - - if(commands_.size() > 0) { - pCommand = commands_.front(); - commands_.pop_front(); - - if(commands_.size() == 0) - commandAvailibleEvent_.Reset(); - } - } - - if(pCommand != 0) { - pCommand->Execute(); - pCommand.reset(); - } - } -} - -template -template -bool CommandQueue::WorkerThread::OnUnhandledException(const std::exception& ex) throw() { - bool bDoRestart = true; - - try - { - LOG << LogLevel::Critical << TEXT("UNHANDLED EXCEPTION in commandqueue. Message: ") << ex.what() << LogStream::Flush; - } - catch(...) - { - bDoRestart = false; - } - - return bDoRestart; -} - -} //namespace utils -} //namespace caspar - -#endif //_COMMANDQUEUE_H__ \ No newline at end of file diff --git a/server/utils/CritSectLock.h b/server/utils/CritSectLock.h deleted file mode 100644 index cf5da2052..000000000 --- a/server/utils/CritSectLock.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _CASPAR_CRITSECTLOCK_H__ -#define _CASPAR_CRITSECTLOCK_H__ - -#pragma once - -namespace caspar { -namespace utils { - -class CritSectLock -{ -public: - CritSectLock(CRITICAL_SECTION* pCritSect) : pCriticalSection_(pCritSect) - { - EnterCriticalSection(pCriticalSection_); - } - ~CritSectLock() - { - LeaveCriticalSection(pCriticalSection_); - } - -private: - CRITICAL_SECTION* pCriticalSection_; -}; - -} //namespace utils -} //namespace caspar - -#endif //_CASPAR_CRITSECTLOCK_H__ \ No newline at end of file diff --git a/server/utils/DCWrapper.cpp b/server/utils/DCWrapper.cpp deleted file mode 100644 index b7c1f62c7..000000000 --- a/server/utils/DCWrapper.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\stdafx.h" -#include "DCWrapper.h" - -namespace caspar -{ - -DCWrapper::DCWrapper(HWND hWnd) : hWnd_(hWnd), dc_(::GetDC(hWnd)) -{} - -DCWrapper::~DCWrapper() -{ - if(dc_ != 0) - ::ReleaseDC(hWnd_, dc_); -} - - -} \ No newline at end of file diff --git a/server/utils/DCWrapper.h b/server/utils/DCWrapper.h deleted file mode 100644 index 48efeff31..000000000 --- a/server/utils/DCWrapper.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _DCWRAPPER_H_ -#define _DCWRAPPER_H_ - -namespace caspar -{ - -class DCWrapper -{ -public: - explicit DCWrapper(HWND hWnd); - ~DCWrapper(); - - operator HDC() { - return dc_; - } - -private: - HWND hWnd_; - HDC dc_; -}; - -} - -#endif \ No newline at end of file diff --git a/server/utils/DataBuffer.h b/server/utils/DataBuffer.h deleted file mode 100644 index c855970f3..000000000 --- a/server/utils/DataBuffer.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -namespace caspar { -namespace utils { - -template -class DataBuffer -{ -public: - typedef T DataType; - - DataBuffer() : pData_(0), length_(0), capacity_(0) - {} - DataBuffer(const DataBuffer& b) : pData_(new T[b.capacity_]), capacity_(b.capacity_) - { - memcpy(pData_, b.pData_, b.capacity_*sizeof(T)); - } - const DataBuffer& operator=(const DataBuffer& b) - { - DataBuffer temp(b); - swap(temp); - } - ~DataBuffer() { - FreeData(); - } - - void Fill(const T* pSrc, unsigned int count, unsigned int offset=0) { - int neededCapacity = count + offset; - Realloc(neededCapacity); - - length_ = neededCapacity; - memcpy(pData_+offset, pSrc, count*sizeof(T)); - } - - T* GetPtr(unsigned int offset=0) { - return (pData_+offset); - } - unsigned int GetCapacity() { - return capacity_; - } - void SetLength(unsigned int len) { - length_ = len; - } - unsigned int GetLength() { - return length_; - } - - void Realloc(unsigned int neededCapacity) { - if(neededCapacity > capacity_) { - T* pNewData = new T[neededCapacity]; - FreeData(); - pData_ = pNewData; - capacity_ = neededCapacity; - } - } - -private: - void swap(const DataBuffer& b) throw() - { - std::swap(pData_, b.pData_); - std::swap(capacity_, b.capacity_); - } - - void FreeData() { - if(pData_ != 0) { - delete[] pData_; - pData_ = 0; - } - capacity_ = 0; - } - - T* pData_; - unsigned int capacity_; - unsigned int length_; -}; - -} //namespace utils -} //namespace caspar \ No newline at end of file diff --git a/server/utils/Event.h b/server/utils/Event.h deleted file mode 100644 index e9fbbab76..000000000 --- a/server/utils/Event.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _CASPAR_EVENT_H__ -#define _CASPAR_EVENT_H__ - -#pragma once - -namespace caspar { -namespace utils { - -class Event -{ -public: - Event(bool bManualReset, bool bInitialState); - ~Event(); - - operator const HANDLE() const { - return handle_; - } - - void Set(); - void Reset(); - -private: - HANDLE handle_; -}; - -typedef std::tr1::shared_ptr EventPtr; - -} //namespace utils -} //namespace caspar - -#endif //_CASPAR_EVENT_H__ \ No newline at end of file diff --git a/server/utils/FileExists.cpp b/server/utils/FileExists.cpp deleted file mode 100644 index bacd5e09d..000000000 --- a/server/utils/FileExists.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\stdafx.h" - -#include "FileExists.h" -#include "FindWrapper.h" - -namespace caspar { -namespace utils { - -bool exists(const tstring& name, bool isDirectory) { - WIN32_FIND_DATA findInfo; - FindWrapper findWrapper(name, &findInfo); - return findWrapper.Success() && (!isDirectory || (findInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY); -} - -} //namespace utils -} //namespace caspar \ No newline at end of file diff --git a/server/utils/FileExists.h b/server/utils/FileExists.h deleted file mode 100644 index 379ae2b40..000000000 --- a/server/utils/FileExists.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#pragma once - -#include - -namespace caspar { -namespace utils { - - bool exists(const tstring& name, bool isDirectory = false); - -} //namespace utils -} //namespace caspar \ No newline at end of file diff --git a/server/utils/FileInputStream.cpp b/server/utils/FileInputStream.cpp deleted file mode 100644 index f1ef0d32a..000000000 --- a/server/utils/FileInputStream.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\stdafx.h" -#include "fileinputstream.h" - -namespace caspar { -namespace utils { - -FileInputStream::FileInputStream(const tstring& filename) : filename_(filename) -{ -} - -FileInputStream::~FileInputStream() -{ - Close(); -} - -bool FileInputStream::Open() -{ - ifs_.open(filename_.c_str(), std::ios::in | std::ios::binary); - return !ifs_.fail(); -} - -void FileInputStream::Close() -{ - ifs_.close(); -} - - -unsigned int FileInputStream::Read(unsigned char* buf, size_t length) -{ - if(!ifs_.eof()) - { - ifs_.read(reinterpret_cast(buf), (std::streamsize)length); - return ifs_.gcount(); - } - return 0; -} - -/* removed 2008-03-06 - InputStream should be binary only. Make a separate TextInputStream for text -bool FileInputStream::Readln(tstring& out) -{ - static TCHAR buf[256]; - if(!ifs_.eof()) - { - ifs_.getline(buf, 256, TEXT('\n')); - out = buf; - size_t findPos = out.find_first_of(TEXT('\r')); - if(findPos != tstring::npos) - out = out.substr(0,findPos); - - if(ifs_.peek() == TEXT('\r')) - ifs_.get(); - if(ifs_.peek() == TEXT('\n')) - ifs_.get(); - - return true; - } - return false; -} -*/ - -} //namespace utils -} //namespace caspar diff --git a/server/utils/FileInputStream.h b/server/utils/FileInputStream.h deleted file mode 100644 index 9f630d84e..000000000 --- a/server/utils/FileInputStream.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef CASPAR_FILEINPUTSTREAM_H__ -#define CASPAR_FILEINPUTSTREAM_H__ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include "inputstream.h" -#include - -namespace caspar { -namespace utils { - -class FileInputStream : public InputStream -{ -public: - FileInputStream(const tstring& filename); - virtual ~FileInputStream(); - - virtual bool Open(); - - virtual unsigned int Read(unsigned char*, size_t); - virtual void Close(); - -private: - tstring filename_; - std::ifstream ifs_; -}; - -} //namespace utils -} //namespace caspar - -#endif //CASPAR_FILEINPUTSTREAM_H__ \ No newline at end of file diff --git a/server/utils/FileOutputStream.cpp b/server/utils/FileOutputStream.cpp deleted file mode 100644 index b31404c69..000000000 --- a/server/utils/FileOutputStream.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\StdAfx.h" - -#include "FileOutputStream.h" -#include "LogException.h" - -#include - -namespace caspar { -namespace utils { - -FileOutputStream::FileOutputStream(const TCHAR* filename, bool append) : filename(filename), append(append), timestamp(true) -{ - Open(); -} - -FileOutputStream::~FileOutputStream() -{ - Close(); -} - -bool FileOutputStream::Open() -{ - this->outStream.open(this->filename.c_str(), this->append ? std::ios_base::out | std::ios_base::app : std::ios_base::out | std::ios_base::trunc); - if(this->outStream.fail()) - return false; - - return true; -} - -void FileOutputStream::Close() -{ - this->outStream.close(); -} - -void FileOutputStream::SetTimestamp(bool timestamp) -{ - this->timestamp = timestamp; -} - -void FileOutputStream::WriteTimestamp() -{ - if (this->timestamp) - { - - TCHAR timeBuffer[30]; - __time64_t ltime; - _time64(<ime); - _tctime64_s<30>(timeBuffer, <ime); - - tstring logString = TEXT(""); - logString = TEXT("["); - logString += timeBuffer; - logString.resize(logString.size()-1); - logString += TEXT("] "); - - this->outStream << logString; - } -} - -void FileOutputStream::Println(const tstring& message) -{ - try - { - Lock lock(*this); - if (this->timestamp) - WriteTimestamp(); - - this->outStream << message << TEXT(" (Thread: ") << GetCurrentThreadId() << TEXT(")") << std::endl; - - // HACK: Because not all unicode chars can be converted to the current locale, the above line could cause the stream to be flagged - // as beeing in a "bad"-state. just clear the state and ignore. That particular line won't be logged, but subsequent logging will work. - this->outStream.clear(); - this->outStream.flush(); - } - catch (LogException& ex) - { - new LogException(ex.what()); - } -} - -void FileOutputStream::Print(const tstring& message) -{ - try - { - Lock lock(*this); - if (this->timestamp) - WriteTimestamp(); - - this->outStream << message; - - // HACK: Because not all unicode chars can be converted to the current locale, the above line could cause the stream to be flagged - // as beeing in a "bad"-state. just clear the state and ignore. That particular line won't be logged, but subsequent logging will work. - this->outStream.clear(); - this->outStream.flush(); - } - catch (LogException& ex) - { - new LogException(ex.what()); - } -} - -void FileOutputStream::Write(const void* buffer, size_t size) -{ - try - { - Lock lock(*this); - if (this->timestamp) - WriteTimestamp(); - - this->outStream.write((const TCHAR*)buffer, static_cast(size)); - this->outStream.flush(); - } - catch (LogException& ex) - { - new LogException(ex.what()); - } -} - -} -} \ No newline at end of file diff --git a/server/utils/FileOutputStream.h b/server/utils/FileOutputStream.h deleted file mode 100644 index 229b97b88..000000000 --- a/server/utils/FileOutputStream.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef FILEOUTPUTSTREAM_H -#define FILEOUTPUTSTREAM_H - -#include "OutputStream.h" - -#include -#include - -namespace caspar { -namespace utils { - -class FileOutputStream : public OutputStream, private LockableObject -{ - public: - FileOutputStream(const TCHAR* filename, bool bAppend = false); - virtual ~FileOutputStream(); - - virtual bool Open(); - virtual void Close(); - virtual void SetTimestamp(bool timestamp); - virtual void Print(const tstring& message); - virtual void Println(const tstring& message); - virtual void Write(const void* buffer, size_t); - - private: - void WriteTimestamp(); - - private: - bool append; - bool timestamp; - tstring filename; - - #ifndef _UNICODE - std::ofstream outStream; - #else - std::wofstream outStream; - #endif -}; - -} -} - -#endif \ No newline at end of file diff --git a/server/utils/FindWrapper.cpp b/server/utils/FindWrapper.cpp deleted file mode 100644 index 503fc98e8..000000000 --- a/server/utils/FindWrapper.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\stdafx.h" - -#include "FindWrapper.h" - -namespace caspar { -namespace utils { - - FindWrapper::FindWrapper(const tstring& filename, WIN32_FIND_DATA* pFindData) : hFile_(INVALID_HANDLE_VALUE) { - hFile_ = FindFirstFile(filename.c_str(), pFindData); - } - - FindWrapper::~FindWrapper() { - if(hFile_ != INVALID_HANDLE_VALUE) { - FindClose(hFile_); - hFile_ = INVALID_HANDLE_VALUE; - } - } - - bool FindWrapper::FindNext(WIN32_FIND_DATA* pFindData) - { - return FindNextFile(hFile_, pFindData) != 0; - } - -} //namespace utils -} //namespace caspar \ No newline at end of file diff --git a/server/utils/FindWrapper.h b/server/utils/FindWrapper.h deleted file mode 100644 index b7aff197d..000000000 --- a/server/utils/FindWrapper.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _FINDWRAPPER_H__ -#define _FINDWRAPPER_H__ - -#include -#include - -namespace caspar { -namespace utils { - - class FindWrapper - { - FindWrapper(const FindWrapper&); - FindWrapper& operator=(const FindWrapper&); - public: - FindWrapper(const tstring&, WIN32_FIND_DATA*); - ~FindWrapper(); - - bool FindNext(WIN32_FIND_DATA*); - - bool Success() { - return (hFile_ != INVALID_HANDLE_VALUE); - } - - private: - HANDLE hFile_; - }; - -} //namespace utils -} //namespace caspar - -#endif \ No newline at end of file diff --git a/server/utils/ID.cpp b/server/utils/ID.cpp deleted file mode 100644 index fbf56c403..000000000 --- a/server/utils/ID.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "stdafx.h" -#include "ID.h" - -namespace caspar -{ - namespace utils - { - - ID::ID() : value_(0){} - - const ID::value_type& ID::Value() const - { - return value_; - } - ID ID::Generate(void* ptr) - { - assert(sizeof(value_type) >= sizeof(LARGE_INTEGER)); - ID id; - QueryPerformanceCounter(reinterpret_cast(&id.value_)); - id.value_ <<= 32; - id.value_ |= reinterpret_cast(ptr); - return id; - } - - bool operator ==(const ID& lhs,const ID& rhs) - { - return lhs.Value() == rhs.Value(); - } - - bool operator !=(const ID& lhs,const ID& rhs) - { - return lhs.Value() != rhs.Value(); - } - - Identifiable::Identifiable() : id_(utils::ID::Generate(this)) - {} - - const utils::ID& Identifiable::ID() const - { - return id_; - } - } -} \ No newline at end of file diff --git a/server/utils/ID.h b/server/utils/ID.h deleted file mode 100644 index bee7e30c0..000000000 --- a/server/utils/ID.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _ID_H_ -#define _ID_H_ - -namespace caspar -{ - namespace utils - { - class ID - { - public: - typedef long long value_type; - - ID(); - const value_type& Value() const; - static ID Generate(void* ptr); - private: - value_type value_; - }; - - class Identifiable - { - public: - Identifiable(); - virtual ~Identifiable(){} - const utils::ID& ID() const; - private: - const utils::ID id_; - }; - - bool operator==(const ID& lhs,const ID& rhs); - bool operator!=(const ID& lhs,const ID& rhs); - } -} - -#endif \ No newline at end of file diff --git a/server/utils/InputStream.h b/server/utils/InputStream.h deleted file mode 100644 index fa9959e34..000000000 --- a/server/utils/InputStream.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef CASPAR_INPUTSTREAM_H__ -#define CASPAR_INPUTSTREAM_H__ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -namespace caspar { -namespace utils { - -class InputStream -{ -public: - virtual ~InputStream() {} - - virtual bool Open() = 0; - virtual unsigned int Read(unsigned char*, size_t) = 0; - virtual void Close() = 0; -}; -typedef std::tr1::shared_ptr InputStreamPtr; - -template -class TextInputStream -{ -public: - virtual ~TextInputStream() {} - - virtual bool Open() = 0; - virtual bool Readln(std::basic_string&) = 0; - virtual unsigned int Read(CharType*, size_t) = 0; - virtual void Close() = 0; -}; - -#ifdef UNICODE - typedef std::tr1::shared_ptr > TextInputStreamPtr; -#else - typedef std::tr1::shared_ptr > TextInputStreamPtr; -#endif - -} //namespace utils -} //namespace caspar - -#endif \ No newline at end of file diff --git a/server/utils/Lockable.h b/server/utils/Lockable.h deleted file mode 100644 index e54183db1..000000000 --- a/server/utils/Lockable.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _CASPAR_LOCKABLE_H__ -#define _CASPAR_LOCKABLE_H__ - -#pragma once - -namespace caspar { -namespace utils { - -class LockableObject -{ - mutable CRITICAL_SECTION mtx_; - - LockableObject(const LockableObject&); - LockableObject& operator=(const LockableObject&); - -protected: - LockableObject(unsigned int spincount = 4000) - { - ::InitializeCriticalSectionAndSpinCount(&mtx_, spincount); - } - -public: - ~LockableObject() - { - ::DeleteCriticalSection(&mtx_); - } - - class Lock; - friend class Lock; - - class Lock - { - LockableObject const& host_; - - Lock(const Lock&); - Lock& operator=(const Lock&); - - public: - explicit Lock(const LockableObject& host) : host_(host) - { - ::EnterCriticalSection(&host_.mtx_); - } - - ~Lock() - { - ::LeaveCriticalSection(&host_.mtx_); - } - }; -}; - -} //namespace utils -} //namespace caspar - -#endif //_CASPAR_LOCKABLE_H__ \ No newline at end of file diff --git a/server/utils/LogException.cpp b/server/utils/LogException.cpp deleted file mode 100644 index 5ff461345..000000000 --- a/server/utils/LogException.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\StdAfx.h" - -#include "LogException.h" - -namespace caspar { -namespace utils { - -LogException::LogException(const char* message) : std::runtime_error(message) -{ -} - -LogException::~LogException() -{ -} - -const char* LogException::GetMassage() const -{ - return std::runtime_error::what(); -} - -} -} \ No newline at end of file diff --git a/server/utils/LogException.h b/server/utils/LogException.h deleted file mode 100644 index 9da52bef0..000000000 --- a/server/utils/LogException.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef LOGEXCEPTION_H -#define LOGEXCEPTION_H - -namespace caspar { -namespace utils { - -class LogException : public std::runtime_error -{ - public: - explicit LogException(const char* message = "Caught exception while logging"); - ~LogException(); - - const char* GetMassage() const; -}; - -} -} - -#endif diff --git a/server/utils/LogLevel.h b/server/utils/LogLevel.h deleted file mode 100644 index a04ac0569..000000000 --- a/server/utils/LogLevel.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef LOGLEVEL_H -#define LOGLEVEL_H - -namespace caspar { -namespace utils { - -struct LogLevel -{ - enum LogLevelEnum - { - Debug = 1, - Verbose, - Release, - Critical - }; -}; - -} -} - -#endif diff --git a/server/utils/LogStream.cpp b/server/utils/LogStream.cpp deleted file mode 100644 index 1c9b4fb57..000000000 --- a/server/utils/LogStream.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\StdAfx.h" -#include "LogStream.h" - -namespace caspar { -namespace utils { - -LogStream::LogStream(Logger* pLogger) : pLogger(pLogger), pSstream(0) -{ -} - -LogStream::LogStream(const LogStream& logStream) : pSstream(0), - pLogger(logStream.pLogger), level(logStream.level) -{ - if(logStream.pSstream != 0) - this->pSstream = new tstringstream(logStream.pSstream->str()); -} - -LogStream& LogStream::operator=(const LogStream& rhs) -{ - if(rhs.pSstream != 0) - this->pSstream = new tstringstream(rhs.pSstream->str()); - - this->pLogger = rhs.pLogger; - this->level = rhs.level; - - return *this; -} - -LogStream::~LogStream() -{ - if (this->pSstream != NULL) - { - DoFlush(); - delete this->pSstream; - } -} - -void LogStream::DoFlush() -{ - if(this->pSstream != 0 && this->pSstream->str().length() > 0) - { - this->pLogger->WriteLog(this->pSstream->str()); - this->pSstream->str(TEXT("")); - } -} - -} -} \ No newline at end of file diff --git a/server/utils/LogStream.h b/server/utils/LogStream.h deleted file mode 100644 index 93fada469..000000000 --- a/server/utils/LogStream.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef LOGSTREAM_H -#define LOGSTREAM_H - -#include "LogLevel.h" - -namespace caspar { -namespace utils { - -class Logger; - -class LogStream -{ - public: - enum LogStreamEnum { Flush = 1 }; - - explicit LogStream(Logger* pLogger); - LogStream(const LogStream& logStream); - LogStream& operator=(const LogStream& rhs); - - ~LogStream(); - - template - LogStream& operator<<(const T& rhs) { - if (this->level >= this->pLogger->GetLevel()) { - if(this->pSstream == 0) - this->pSstream = new tstringstream(); - - *pSstream << rhs; - } - - return *this; - } - - template<> LogStream& operator<<(const LogLevel::LogLevelEnum& rhs) { - this->level = rhs; - return *this; - } - - template<> LogStream& operator<<(const LogStream::LogStreamEnum& rhs) { - if (rhs == LogStream::Flush) - DoFlush(); - return *this; - } - - private: - void DoFlush(); - - Logger* pLogger; - tstringstream* pSstream; - LogLevel::LogLevelEnum level; -}; - -} -} - -#endif diff --git a/server/utils/Logger.cpp b/server/utils/Logger.cpp deleted file mode 100644 index 404b7c91b..000000000 --- a/server/utils/Logger.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\StdAfx.h" - -#include "Logger.h" -#include "LogException.h" -#include "LogStream.h" -#include "OutputStream.h" - -namespace caspar { -namespace utils { - -Logger::Logger() : level(LogLevel::Release) -{ -} - -Logger::~Logger() -{ -} - -Logger& Logger::GetInstance() -{ - static Logger logger; - return logger; -} - -LogStream Logger::GetStream(LogLevel::LogLevelEnum level) -{ - LogStream logStream(this); - logStream << level; - return logStream; -} - -void Logger::WriteLog(const tstring& message) -{ - try - { - this->pOutputStream->Println(message); - } - catch(const std::exception& ex) - { - throw LogException(ex.what()); - } -} - -void Logger::SetTimestamp(bool timestamp) -{ - if (pOutputStream != NULL) - this->pOutputStream->SetTimestamp(timestamp); -} - -bool Logger::SetOutputStream(OutputStreamPtr pOutputStream) -{ - try - { - if (pOutputStream != NULL) - { - Lock lock(*this); - this->pOutputStream = pOutputStream; - - return true; - } - - return false; - } - catch(const std::exception& ex) - { - throw LogException(ex.what()); - } -} - -LogLevel::LogLevelEnum Logger::GetLevel() -{ - return this->level; -} - -void Logger::SetLevel(LogLevel::LogLevelEnum level) -{ - this->level = level; -} - -} -} \ No newline at end of file diff --git a/server/utils/Logger.h b/server/utils/Logger.h deleted file mode 100644 index 50e16d73c..000000000 --- a/server/utils/Logger.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef LOGGER_H -#define LOGGER_H - -#include "Lockable.h" -#include "LogStream.h" -#include "LogLevel.h" -#include "OutputStream.h" - -namespace caspar { -namespace utils { - -class Logger : private LockableObject -{ - public: - ~Logger(); - - static Logger& GetInstance(); - - LogLevel::LogLevelEnum GetLevel(); - void SetTimestamp(bool timestamp); - void WriteLog(const tstring& message); - void SetLevel(LogLevel::LogLevelEnum Level); - bool SetOutputStream(OutputStreamPtr pOutputStream); - LogStream GetStream(LogLevel::LogLevelEnum level = LogLevel::Release); - - private: - Logger(); - - private: - OutputStreamPtr pOutputStream; - LogLevel::LogLevelEnum level; -}; - -} -} - -#endif diff --git a/server/utils/Noncopyable.hpp b/server/utils/Noncopyable.hpp deleted file mode 100644 index 83a929945..000000000 --- a/server/utils/Noncopyable.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef __NONCOPYABLE_H__ -#define __NONCOPYABLE_H__ - -namespace caspar { -namespace utils { - -class Noncopyable -{ -protected: - Noncopyable() {} - ~Noncopyable() {} -private: - Noncopyable( const Noncopyable& ); - const Noncopyable& operator=( const Noncopyable& ); -}; - -} // namespace utils -} //namespace caspar - -#endif __NONCOPYABLE_H__ \ No newline at end of file diff --git a/server/utils/ObjectPool.h b/server/utils/ObjectPool.h deleted file mode 100644 index 30cf2b950..000000000 --- a/server/utils/ObjectPool.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef _OBJECTPOOL_H_ -#define _OBJECTPOOL_H_ - -#include -#include -#include - -#include - -namespace caspar -{ - -namespace utils -{ - -template, typename PoolType = tbb::concurrent_queue> -class ObjectPool -{ - static_assert(std::tr1::is_reference::value == false, "Object type cannot be reference type"); -public: - typedef std::shared_ptr PoolTypePtr; - - ObjectPool(const Factory& factory, const std::function& destructor) : factory_(factory) - { - pPool_ = PoolTypePtr(new PoolType(), [=](PoolType* pPool) - { - T* pItem; - while(pPool->try_pop(pItem)) - destructor(pItem); - delete pPool; - }); - } - - ObjectPool(Factory&& factory, std::function&& destructor) : factory_(std::move(factory)) - { - pPool_ = PoolTypePtr(new PoolType(), [=](PoolType* pPool) - { - T* pItem; - while(pPool->try_pop(pItem)) - destructor(pItem); - delete pPool; - }); - } - - std::shared_ptr Create() - { - T* pItem = pPool_->try_pop(pItem) ? pItem : factory_(); - return std::shared_ptr(pItem, [=](T* item){ pPool_->push(item); }); - } - - template - std::shared_ptr Create(P0&& p0) - { - T* pItem = pPool_->try_pop(pItem) ? pItem : factory_(std::forward(p0)); - return std::shared_ptr(pItem, [=](T* item){ pPool_->push(item); }); - } - - template - std::shared_ptr Create(P0&& p0, P1&& p1) - { - T* pItem = pPool_->try_pop(pItem) ? pItem : factory_(std::forward(p0), std::forward(p1)); - return std::shared_ptr(pItem, [=](T* item){ pPool_->push(item); }); - } - - template - std::shared_ptr Create(P0&& p0, P1&& p1, P2&& p2) - { - T* pItem = pPool_->try_pop(pItem) ? pItem : factory_(std::forward(p0), std::forward(p1), std::forward(p2)); - return std::shared_ptr(pItem, [=](T* item){ pPool_->push(item); }); - } - - template - std::shared_ptr Create(P0&& p0, P1&& p1, P2&& p2, P3&& p3) - { - T* pItem = pPool_->try_pop(pItem) ? pItem : factory_(std::forward(p0), std::forward(p1), std::forward(p2), std::forward(p3)); - return std::shared_ptr(pItem, [=](T* item){ pPool_->push(item); }); - } - -private: - PoolTypePtr pPool_; - const Factory factory_; -}; - -} -} - -#endif \ No newline at end of file diff --git a/server/utils/OutputStream.h b/server/utils/OutputStream.h deleted file mode 100644 index 8766eaa1d..000000000 --- a/server/utils/OutputStream.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef OUTPUTSTREAM_H -#define OUTPUTSTREAM_H - -namespace caspar { -namespace utils { - -class OutputStream -{ - public: - virtual ~OutputStream() {} - - virtual bool Open() = 0; - virtual void Close() = 0; - virtual void SetTimestamp(bool timestamp) = 0; - virtual void Write(const void*, size_t) = 0; - virtual void Print(const tstring& message) = 0; - virtual void Println(const tstring& message) = 0; -}; - -typedef std::tr1::shared_ptr OutputStreamPtr; - -} -} - -#endif \ No newline at end of file diff --git a/server/utils/PixmapData.h b/server/utils/PixmapData.h deleted file mode 100644 index 8a1731f05..000000000 --- a/server/utils/PixmapData.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef __IMAGEDATA_H__ -#define __IMAGEDATA_H__ - -#include - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -namespace caspar { -namespace utils { - -class PixmapData -{ - PixmapData(const PixmapData&); - PixmapData& operator=(const PixmapData&); - -public: - PixmapData() : height(0), width(0), bpp(0), pData_(0) - {} - PixmapData(int w, int h, int b) : width(w), height(h), bpp(b), pData_(new unsigned char[w*h*b]) - {} - - ~PixmapData() { - Clear(); - } - - void Set(int w, int h, int b) { - Clear(); - width = w; - height = h; - bpp = b; - pData_ = new unsigned char[w*h*b]; - } - - void Clear() { - height = 0; - width = 0; - bpp = 0; - - if(pData_ != 0) - { - delete[] pData_; - pData_ = 0; - } - } - - unsigned char* GetDataPtr() { - return pData_; - } - - int height; - int width; - int bpp; - -private: - unsigned char *pData_; -}; - -typedef std::tr1::shared_ptr PixmapDataPtr; - -} //namespace utils -} //namespace caspar - -#endif //__IMAGEDATA_H__ diff --git a/server/utils/Process.cpp b/server/utils/Process.cpp deleted file mode 100644 index 4bc40ac09..000000000 --- a/server/utils/Process.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\StdAfx.h" -#include "Process.h" - -namespace caspar { -namespace utils { - -Process::Process() -{ - hProcess_ = ::GetCurrentProcess(); -} - -bool Process::SetWorkingSetSize(SIZE_T minSize, SIZE_T maxSize) -{ - return (::SetProcessWorkingSetSize(hProcess_, minSize, maxSize) != 0); -} - -bool Process::GetWorkingSetSize(SIZE_T& minSize, SIZE_T& maxSize) -{ - return (::GetProcessWorkingSetSize(hProcess_, &minSize, &maxSize) != 0); -} - -} -} \ No newline at end of file diff --git a/server/utils/Process.h b/server/utils/Process.h deleted file mode 100644 index ad51295a1..000000000 --- a/server/utils/Process.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _CASPARUTILS_PROCESS_H__ -#define _CASPARUTILS_PROCESS_H__ - -#pragma once - -namespace caspar { -namespace utils { - -class Process -{ - Process(); - Process(const Process&); - Process& operator=(const Process&); - -public: - static Process& GetCurrentProcess() { - static Process instance; - return instance; - } - - bool SetWorkingSetSize(SIZE_T minSize, SIZE_T maxSize); - bool GetWorkingSetSize(SIZE_T& minSize, SIZE_T& maxSize); - -private: - HANDLE hProcess_; -}; - -} //namespace utils -} //namespace caspar -#endif //_CASPARUTILS_PROCESS_H__ \ No newline at end of file diff --git a/server/utils/Semaphore.cpp b/server/utils/Semaphore.cpp deleted file mode 100644 index 035913b1e..000000000 --- a/server/utils/Semaphore.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\StdAfx.h" - -#include "Semaphore.h" - -namespace caspar { -namespace utils { - -Semaphore::Semaphore(long initialCount, long maximumCount) : handle_(0) -{ - handle_ = CreateSemaphore(0, initialCount, maximumCount, 0); - if(handle_ == 0) { - throw std::exception("Failed to create semaphore"); - } -} -bool Semaphore::Release(long releaseCount, long* pPrevCount) { - return ReleaseSemaphore(handle_, releaseCount, pPrevCount) != 0; -} - -Semaphore::~Semaphore() -{ - CloseHandle(handle_); -} - -} //namespace utils -} //namespace caspar \ No newline at end of file diff --git a/server/utils/Semaphore.h b/server/utils/Semaphore.h deleted file mode 100644 index 7f13931d9..000000000 --- a/server/utils/Semaphore.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _CSAPAR_SEMAPHORE_H__ -#define _CASPAR_SEMAPHORE_H__ - -#pragma once - -namespace caspar { -namespace utils { - -class Semaphore -{ -public: - Semaphore(long initialCount, long maximumCount); - ~Semaphore(); - - bool Semaphore::Release(long releaseCount = 1, long* pPrevCount = 0); - - operator const HANDLE() const { - return handle_; - } - -private: - HANDLE handle_; -}; - -typedef std::tr1::shared_ptr SemaphorePtr; - -} //namespace utils -} //namespace caspar - -#endif //_CASPAR_SEMAPHORE_H__ \ No newline at end of file diff --git a/server/utils/TaskQueue.h b/server/utils/TaskQueue.h deleted file mode 100644 index 157cb64cc..000000000 --- a/server/utils/TaskQueue.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _CASPAR_TASKQUEUE_H__ -#define _CASPAR_TASKQUEUE_H__ - -#pragma once -#include -#include "lockable.h" -#include "noncopyable.hpp" -#include "event.h" - -namespace caspar { -namespace utils { - -typedef std::tr1::function Task; -class TaskQueue : private utils::LockableObject, private utils::Noncopyable { -public: - TaskQueue() : waitEvent_(TRUE, FALSE) {} - ~TaskQueue() {} - void push_back(const Task& task) { - Lock lock(*this); - taskList_.push_back(task); - waitEvent_.Set(); - } - - void pop_front(Task& dest) { - Lock lock(*this); - if(taskList_.size() > 0) { - dest = taskList_.front(); - - taskList_.pop_front(); - if(taskList_.empty()) - waitEvent_.Reset(); - } - } - - void pop_and_execute_front() { - Task task; - pop_front(task); - if(task) - task(); - } - - HANDLE GetWaitEvent() { - return waitEvent_; - } -private: - utils::Event waitEvent_; - std::list taskList_; -}; - - -} //namespace utils -} //namespace caspar - -#endif //_CASPAR_TASKQUEUE_H__ \ No newline at end of file diff --git a/server/utils/Thread.cpp b/server/utils/Thread.cpp deleted file mode 100644 index 7a257da0c..000000000 --- a/server/utils/Thread.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\StdAfx.h" - -#include "thread.h" -#include "win32exception.h" - -/* - -*/ - -namespace caspar { -namespace utils { - -bool Thread::static_bInstallWin32ExceptionHandler_ = true; - -Thread::Thread() : pRunnable_(0), hThread_(0), stopEvent_(TRUE, FALSE), timeout_(10000) { -} - -Thread::~Thread() { - Stop(); -} - -bool Thread::IsRunning() { - if(hThread_ != 0) { - if(WaitForSingleObject(hThread_, 0) == WAIT_OBJECT_0) { - CloseHandle(hThread_); - hThread_ = 0; - pRunnable_ = 0; - } - } - - return (hThread_ != 0); -} - -bool Thread::Start(IRunnable* pRunnable) { - if(hThread_ == 0) { - if(pRunnable != 0) { - pRunnable_ = pRunnable; - stopEvent_.Reset(); - hThread_ = CreateThread(0, 0, ThreadEntrypoint, this, 0, 0); - - if(hThread_ == 0) - pRunnable_ = 0; - - return (hThread_ != 0); - } - } - return false; -} - -bool Thread::Stop(bool bWait) { - bool returnValue = true; - - if(hThread_ != 0) { - stopEvent_.Set(); - - if(bWait) { - DWORD successCode = WaitForSingleObject(hThread_, timeout_); - if(successCode != WAIT_OBJECT_0) - returnValue = false; - } - CloseHandle(hThread_); - - hThread_ = 0; - pRunnable_ = 0; - } - - return returnValue; -} - -void Thread::EnableWin32ExceptionHandler(bool bEnable) { - static_bInstallWin32ExceptionHandler_ = bEnable; -} - -DWORD WINAPI Thread::ThreadEntrypoint(LPVOID pParam) { - Thread* pThis = reinterpret_cast(pParam); - - if(Thread::static_bInstallWin32ExceptionHandler_) - Win32Exception::InstallHandler(); - - _configthreadlocale(_DISABLE_PER_THREAD_LOCALE); - - pThis->Run(); - - return 0; -} - -void Thread::Run() { - bool bDoRestart = false; - - do { - try { - bDoRestart = false; - stopEvent_.Reset(); - pRunnable_->Run(stopEvent_); - } - catch(const std::exception& e) { - bDoRestart = pRunnable_->OnUnhandledException(e); - } - }while(bDoRestart); -} - -} //namespace utils -} //namespace caspar \ No newline at end of file diff --git a/server/utils/Thread.h b/server/utils/Thread.h deleted file mode 100644 index 162914e7e..000000000 --- a/server/utils/Thread.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _CASPAR_THREAD_H__ -#define _CASPAR_THREAD_H__ - -#pragma once - -#include "runnable.h" -#include "event.h" - -namespace caspar { -namespace utils { - -class Thread -{ - Thread(const Thread&); - Thread& operator=(const Thread&); -public: - Thread(); - ~Thread(); - - bool Start(IRunnable*); - bool Stop(bool bWait = true); - - bool IsRunning(); - - static void EnableWin32ExceptionHandler(bool bEnable); - - void SetTimeout(DWORD timeout) { - timeout_ = timeout; - } - DWORD GetTimeout() { - return timeout_; - } - -private: - static DWORD WINAPI ThreadEntrypoint(LPVOID pParam); - void Run(); - - HANDLE hThread_; - IRunnable* pRunnable_; - - Event stopEvent_; - - DWORD timeout_; - static bool static_bInstallWin32ExceptionHandler_; -}; - -} //namespace utils -} //namespace caspar - - -#endif //_CASPAR_THREAD_H__ diff --git a/server/utils/Types.hpp b/server/utils/Types.hpp deleted file mode 100644 index 4f63a6e5c..000000000 --- a/server/utils/Types.hpp +++ /dev/null @@ -1,33 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _TYPES_H_ -#define _TYPES_H_ - -typedef unsigned char u8; -typedef char s8; - -typedef unsigned short u16; -typedef short s16; - -typedef unsigned int u32; -typedef int s32; - -#endif \ No newline at end of file diff --git a/server/utils/UnhandledException.h b/server/utils/UnhandledException.h deleted file mode 100644 index 7484619d1..000000000 --- a/server/utils/UnhandledException.h +++ /dev/null @@ -1,146 +0,0 @@ -#ifndef _UNHANDLED_EXCEPTION_H_ -#define _UNHANDLED_EXCEPTION_H_ - -#include -#include -#include - -#include "Logger.h" -#include "LogLevel.h" -#include "Win32Exception.h" - -#define CASPAR_TRY try -#define CASPAR_CATCH_UNHANDLED(desc) \ - catch(std::system_error& er) \ - { \ - try \ - { \ - LOG << caspar::utils::LogLevel::Critical << desc << TEXT(" UNHANDLED EXCEPTION Message:") << er.code().message().c_str(); \ - } \ - catch(...){} \ - } \ - catch(std::exception& ex) \ - { \ - try \ - { \ - LOG << caspar::utils::LogLevel::Critical << desc << TEXT(" UNHANDLED EXCEPTION Message:") << ex.what(); \ - } \ - catch(...){} \ - } \ - catch(...) \ - { \ - try \ - { \ - LOG << caspar::utils::LogLevel::Critical << desc << TEXT(" UNHANDLED EXCEPTION"); \ - } \ - catch(...){} \ - } - -#define CASPAR_RETHROW_AND_LOG(desc) \ - catch(std::system_error& er) \ - { \ - try \ - { \ - LOG << caspar::utils::LogLevel::Critical << desc << TEXT(" Message:") << er.code().message().c_str(); \ - } \ - catch(...){} \ - throw;\ - } \ - catch(std::exception& ex) \ - { \ - try \ - { \ - LOG << caspar::utils::LogLevel::Critical << desc << TEXT(" Message:") << ex.what(); \ - } \ - catch(...){} \ - throw;\ - } \ - catch(...) \ - { \ - try \ - { \ - LOG << caspar::utils::LogLevel::Critical << desc; \ - } \ - catch(...){} \ - throw;\ - } - -#define CASPAR_CATCH_AND_LOG(desc) \ - catch(std::system_error& er) \ - { \ - try \ - { \ - LOG << caspar::utils::LogLevel::Critical << desc << TEXT(" Message:") << er.code().message().c_str(); \ - } \ - catch(...){} \ - } \ - catch(std::exception& ex) \ - { \ - try \ - { \ - LOG << caspar::utils::LogLevel::Critical << desc << TEXT(" Message:") << ex.what(); \ - } \ - catch(...){} \ - } \ - catch(...) \ - { \ - try \ - { \ - LOG << caspar::utils::LogLevel::Critical << desc; \ - } \ - catch(...){} \ - } - -template -void CASPAR_THREAD_GUARD(const wchar_t* desc, const F& func) -{ - CASPAR_THREAD_GUARD(0, desc, func); -} - -template -void CASPAR_THREAD_GUARD(int restart_count, const std::wstring& desc, const F& func) -{ - LOG << caspar::utils::LogLevel::Verbose << desc << TEXT(" Thread Started"); - -#ifdef WIN32 - Win32Exception::InstallHandler(); - _configthreadlocale(_DISABLE_PER_THREAD_LOCALE); -#endif - for(int n = -1; n < restart_count; ++n) - { - try - { - if(n >= 0) - LOG << caspar::utils::LogLevel::Critical << desc << TEXT(" Restarting Count:") << n+1 << "/" << restart_count; - func(); - n = restart_count; - } - catch(std::system_error& er) - { - try - { - LOG << caspar::utils::LogLevel::Critical << desc << TEXT(" UNHANDLED EXCEPTION Message:") << er.code().message().c_str(); - } - catch(...){} - } - catch(std::exception& ex) - { - try - { - LOG << caspar::utils::LogLevel::Critical << desc << TEXT(" UNHANDLED EXCEPTION Message:") << ex.what(); - } - catch(...){} - } - catch(...) - { - try - { - LOG << caspar::utils::LogLevel::Critical << desc << TEXT(" UNHANDLED EXCEPTION"); - } - catch(...){} - } - } - LOG << caspar::utils::LogLevel::Verbose << desc << TEXT(" Thread Ended"); -} - -#endif \ No newline at end of file diff --git a/server/utils/Win32Exception.cpp b/server/utils/Win32Exception.cpp deleted file mode 100644 index 76831af22..000000000 --- a/server/utils/Win32Exception.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\stdafx.h" -#include "win32exception.h" - -void Win32Exception::InstallHandler() { - _set_se_translator(Win32Exception::Handler); -} - -void Win32Exception::Handler(unsigned int errorCode, EXCEPTION_POINTERS* pInfo) { - switch(errorCode) - { - case EXCEPTION_ACCESS_VIOLATION: - throw Win32AccessViolationException(*(pInfo->ExceptionRecord)); - break; - - default: - throw Win32Exception(*(pInfo->ExceptionRecord)); - } -} - -Win32Exception::Win32Exception(const EXCEPTION_RECORD& info) : message_("Win32 exception"), location_(info.ExceptionAddress), errorCode_(info.ExceptionCode) -{ - switch(info.ExceptionCode) - { - case EXCEPTION_ACCESS_VIOLATION: - message_ = "Access violation"; - break; - case EXCEPTION_FLT_DIVIDE_BY_ZERO: - case EXCEPTION_INT_DIVIDE_BY_ZERO: - message_ = "Divide by zero"; - break; - } -} - -Win32AccessViolationException::Win32AccessViolationException(const EXCEPTION_RECORD& info) : Win32Exception(info), isWrite_(false), badAddress_(0) -{ - isWrite_ = info.ExceptionInformation[0] == 1; - badAddress_ = reinterpret_cast(info.ExceptionInformation[1]); -} - -const char* Win32AccessViolationException::what() const { - sprintf_s<>(messageBuffer_, "Access violation at %p, trying to %s %p", Location(), isWrite_?"write":"read", badAddress_); - - return messageBuffer_; -} \ No newline at end of file diff --git a/server/utils/Win32Exception.h b/server/utils/Win32Exception.h deleted file mode 100644 index 153527662..000000000 --- a/server/utils/Win32Exception.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _CASPAR_WIN32EXCEPTION_H__ -#define _CASPAR_WIN32EXCEPTION_H__ - -#pragma once - -#include - -class Win32Exception : public std::exception -{ -public: - typedef const void* Address; - static void InstallHandler(); - - Address Location() const { - return location_; - } - unsigned int ErrorCode() const { - return errorCode_; - } - virtual const char* what() const { - return message_; - } - -protected: - Win32Exception(const EXCEPTION_RECORD& info); - static void Handler(unsigned int errorCode, EXCEPTION_POINTERS* pInfo); - -private: - const char* message_; - - Address location_; - unsigned int errorCode_; -}; - -class Win32AccessViolationException : public Win32Exception -{ - mutable char messageBuffer_[256]; - -public: - bool IsWrite() const { - return isWrite_; - } - Address BadAddress() const { - return badAddress_; - } - virtual const char* what() const; - -protected: - Win32AccessViolationException(const EXCEPTION_RECORD& info); - friend void Win32Exception::Handler(unsigned int errorCode, EXCEPTION_POINTERS* pInfo); - -private: - bool isWrite_; - Address badAddress_; -}; - -#endif //_CASPAR_WIN32EXCEPTION_H__ \ No newline at end of file diff --git a/server/utils/event.cpp b/server/utils/event.cpp deleted file mode 100644 index 9f69a3b59..000000000 --- a/server/utils/event.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\StdAfx.h" - -#include -#include "Event.h" - -namespace caspar { -namespace utils { - -Event::Event(bool bManualReset, bool bInitialState) : handle_(0) -{ - handle_ = CreateEvent(0, bManualReset, bInitialState, 0); - if(handle_ == 0) { - throw std::exception("Failed to create event"); - } -} - -void Event::Set() { - BOOL res = SetEvent(handle_); - if(res == FALSE) { - DWORD error = GetLastError(); - } -} -void Event::Reset() { - ResetEvent(handle_); -} - -Event::~Event() -{ - CloseHandle(handle_); -} - -} //namespace utils -} //namespace caspar \ No newline at end of file diff --git a/server/utils/functiontask.hpp b/server/utils/functiontask.hpp deleted file mode 100644 index 2f4718707..000000000 --- a/server/utils/functiontask.hpp +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef CASPAR_FUNCTION_TASK_H_ - -#define CASPAR_FUNCTION_TASK_H_ - -#include -#include -#include -#include -#include - -namespace caspar -{ - class function_task : tbb::task - { - public: - function_task(std::function&& func) : func_(std::move(func)) - { - assert(func_); - } - - tbb::task* execute() - { - func_(); - return nullptr; - } - - inline static void enqueue(std::function&& func) - { - tbb::task::enqueue(*new(tbb::task::allocate_root()) function_task(std::forward>(func))); - } - - private: - std::function func_; - }; - - class function_task_serializer - { - public: - function_task_serializer() - { - count_ = 0; - } - - void enqueue(std::function&& func) - { - assert(func); - if(!func) - return; - - queue_.push(std::forward>(func)); - if(++count_ == 1) - function_task::enqueue([=]{execute();}); - } - - private: - void execute() - { - std::function func; - if(queue_.try_pop(func)) - { - func(); - note_completion(); - } - } - - void note_completion() - { - if(--count_ != 0) - function_task::enqueue([=]{execute();}); - } - - tbb::concurrent_bounded_queue> queue_; - tbb::atomic count_; - }; -} - -#endif diff --git a/server/utils/image/Clear.cpp b/server/utils/image/Clear.cpp deleted file mode 100644 index 6d004e4b8..000000000 --- a/server/utils/image/Clear.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\stdafx.h" - -#include "Clear.hpp" - -#include -#include - -#include "../Types.hpp" - -#include "tbb/parallel_for.h" -#include "tbb/blocked_range.h" - -using namespace std::tr1::placeholders; - -namespace caspar{ -namespace utils{ -namespace image{ - -static const size_t STRIDE = sizeof(__m128i)*4; - -void DoClearParallel(const tbb::blocked_range& r, const std::tr1::function& func, void* dest) -{ - size_t offset = r.begin()*STRIDE; - size_t size = r.size()*STRIDE; - func(reinterpret_cast(dest) + offset, size); -} - -void ClearParallel(const std::tr1::function& func, void* dest, size_t size) -{ - tbb::parallel_for(tbb::blocked_range(0, size/STRIDE), std::tr1::bind(&DoClearParallel, _1, func, dest)); -} - -ClearFun GetClearFun(SIMD simd) -{ - if(simd >= SSE2) - return ClearParallel_SSE2; - else - return ClearParallel_REF; -} - -// TODO: (R.N) optimize => prefetch and cacheline loop unroll -void Clear_SSE2(void* dest, size_t size) -{ - __m128i val = _mm_setzero_si128(); - __m128i* ptr = reinterpret_cast<__m128i*>(dest); - - int times = size / 16; - for(int i=0; i < times; ++i) - { - _mm_stream_si128(ptr, val); - ptr++; - } -} - -void ClearParallel_SSE2(void* dest, size_t size) -{ - ClearParallel(&Clear_SSE2, dest, size); -} - -void Clear_REF(void* dest, size_t size) -{ - __stosd(reinterpret_cast(dest), 0, size/4); -} - -void ClearParallel_REF(void* dest, size_t size) -{ - ClearParallel(&Clear_REF, dest, size); -} - -} -} -} \ No newline at end of file diff --git a/server/utils/image/Clear.hpp b/server/utils/image/Clear.hpp deleted file mode 100644 index 7b86b9d19..000000000 --- a/server/utils/image/Clear.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef CLEAR_H_ -#define CLEAR_H_ - -#include "../CPUID.hpp" - -namespace caspar{ -namespace utils{ -namespace image{ - -void Clear_SSE2 (void* dest, size_t size); -void Clear_REF (void* dest, size_t size); -void ClearParallel_SSE2 (void* dest, size_t size); -void ClearParallel_REF (void* dest, size_t size); - -typedef void(*ClearFun)(void*, size_t); -ClearFun GetClearFun(SIMD simd = REF); - - -//void StraightTransform_SSE2(const void* source, void* dest, size_t size); -//void StraightTransform_REF(const void* source, void* dest, size_t size); -// -//typedef void(*StraightTransformFun)(const void*, void*, size_t); -//StraightTransformFun GetStraightTransformFun(SIMD simd = REF); - -} // namespace image -} // namespace utils -} // namespace caspar - -#endif - - diff --git a/server/utils/image/Copy.cpp b/server/utils/image/Copy.cpp deleted file mode 100644 index be78649c4..000000000 --- a/server/utils/image/Copy.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\stdafx.h" - -#include "Copy.hpp" - -#include -#include - -#include "../Types.hpp" - -#include "tbb/parallel_for.h" -#include "tbb/blocked_range.h" - -using namespace std::tr1::placeholders; - -namespace caspar{ -namespace utils{ -namespace image{ - -static const size_t STRIDE = sizeof(__m128i)*4; - -void DoCopyParallel(const tbb::blocked_range& r, const std::tr1::function& func, void* dest, const void* source) -{ - size_t offset = r.begin()*STRIDE; - size_t size = r.size()*STRIDE; - func(reinterpret_cast(dest) + offset, reinterpret_cast(source) + offset, size); -} - -void CopyParallel(const std::tr1::function& func, void* dest, const void* source, size_t size) -{ - tbb::parallel_for(tbb::blocked_range(0, size/STRIDE), std::tr1::bind(&DoCopyParallel, _1, func, dest, source)); -} - -CopyFun GetCopyFun(SIMD simd) -{ - if(simd >= SSE2) - return CopyParallel_SSE2; - else - return CopyParallel_REF; -} - -// TODO: (R.N) optimize => prefetch and cacheline loop unroll -void Copy_SSE2(void* dest, const void* source, size_t size) -{ - __m128i val = _mm_setzero_si128(); - __m128i* pD = reinterpret_cast<__m128i*>(dest); - const __m128i* pS = reinterpret_cast(source); - - int times = size / 16; - for(int i=0; i < times; ++i) - { - val = _mm_load_si128(pS); - _mm_stream_si128(pD, val); - - ++pD; - ++pS; - } - _mm_mfence(); //ensure last WC buffers get flushed to memory -} - -void CopyParallel_SSE2(void* dest, const void* source, size_t size) -{ - CopyParallel(&Copy_SSE2, dest, source, size); -} - -void Copy_REF(void* dest, const void* source, size_t size) -{ - __movsd(reinterpret_cast(dest), reinterpret_cast(source), size/4); -} - -void CopyParallel_REF(void* dest, const void* source, size_t size) -{ - CopyParallel(&Copy_REF, dest, source, size); -} - -} -} -} \ No newline at end of file diff --git a/server/utils/image/Copy.hpp b/server/utils/image/Copy.hpp deleted file mode 100644 index e921d8b05..000000000 --- a/server/utils/image/Copy.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef COPY_H_ -#define COPY_H_ - -#include "../CPUID.hpp" - -namespace caspar{ -namespace utils{ -namespace image{ - -void Copy_SSE2 (void* dest, const void* source, size_t size); -void Copy_REF (void* dest, const void* source, size_t size); - -void CopyParallel_SSE2 (void* dest, const void* source, size_t size); -void CopyParallel_REF (void* dest, const void* source, size_t size); - -typedef void(*CopyFun)(void*, const void*, size_t); -CopyFun GetCopyFun(SIMD simd = REF); - -//void StraightTransform_SSE2(const void* source, void* dest, size_t size); -//void StraightTransform_REF(const void* source, void* dest, size_t size); -// -//typedef void(*StraightTransformFun)(const void*, void*, size_t); -//StraightTransformFun GetStraightTransformFun(SIMD simd = REF); - -} // namespace image -} // namespace utils -} // namespace caspar - -#endif - - diff --git a/server/utils/image/CopyField.cpp b/server/utils/image/CopyField.cpp deleted file mode 100644 index 9c4d6af30..000000000 --- a/server/utils/image/CopyField.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\stdafx.h" - -#include "CopyField.hpp" -#include "Copy.hpp" - -#include -#include - -#include "../Types.hpp" - -#include "tbb/parallel_for.h" -#include "tbb/blocked_range.h" - -using namespace std::tr1::placeholders; - -namespace caspar{ -namespace utils{ -namespace image{ - -void DoCopyFieldParallel(size_t index, const std::tr1::function& func, void* dest, const void* source, size_t width4) -{ - size_t offset = index*width4; - size_t size = width4; - func(reinterpret_cast(dest) + offset, reinterpret_cast(source) + offset, size); -} - -void CopyFieldParallel(const std::tr1::function& func, void* dest, const void* source, size_t fieldIndex, size_t width, size_t height) -{ - tbb::parallel_for(fieldIndex, height, static_cast(2), std::tr1::bind(&DoCopyFieldParallel, _1, func, dest, source, width*4)); // copy for each row -} - -CopyFieldFun GetCopyFieldFun(SIMD simd) -{ - //if(simd >= SSE2) - // return CopyFieldParallel_SSE2; - //else - return CopyFieldParallel_REF; // REF is faster -} - -// TODO: (R.N) optimize => prefetch and cacheline loop unroll -void CopyField_SSE2(unsigned char* pDest, unsigned char* pSrc, size_t fieldIndex, size_t width, size_t height) -{ - for(int rowIndex=fieldIndex; rowIndex < height; rowIndex+=2) - { - int offset = width*4*rowIndex; - - __m128i val = _mm_setzero_si128(); - __m128i* pD = reinterpret_cast<__m128i*>(&(pDest[offset])); - const __m128i* pS = reinterpret_cast(&(pSrc[offset])); - - int times = width / 4; - for(int i=0; i < times; ++i) - { - val = _mm_load_si128(pS); - _mm_stream_si128(pD, val); - - ++pD; - ++pS; - } - } - _mm_mfence(); //ensure last WC buffers get flushed to memory -} - -void CopyFieldParallel_SSE2(unsigned char* dest, unsigned char* source, size_t fieldIndex, size_t width, size_t height) -{ - CopyFieldParallel(&Copy_SSE2, dest, source, fieldIndex, width, height); -} - -void CopyField_REF(unsigned char* pDest, unsigned char* pSrc, size_t fieldIndex, size_t width, size_t height) -{ - for(int rowIndex=fieldIndex; rowIndex < height; rowIndex+=2) - { - int offset = width*4*rowIndex; - __movsd(reinterpret_cast(&(pDest[offset])), reinterpret_cast(&(pSrc[offset])), width); - } -} - -void CopyFieldParallel_REF(unsigned char* dest, unsigned char* source, size_t fieldIndex, size_t width, size_t height) -{ - CopyFieldParallel(&Copy_REF, dest, source, fieldIndex, width, height); -} - -} -} -} \ No newline at end of file diff --git a/server/utils/image/CopyField.hpp b/server/utils/image/CopyField.hpp deleted file mode 100644 index 83c31bc17..000000000 --- a/server/utils/image/CopyField.hpp +++ /dev/null @@ -1,52 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef COPY_FIELD_H_ -#define COPY_FIELD_H_ - -#include "../CPUID.hpp" - -namespace caspar{ -namespace utils{ -namespace image{ - -void CopyField_SSE2 (unsigned char* pDest, unsigned char* pSrc, size_t fieldIndex, size_t width, size_t height); -void CopyField_REF (unsigned char* pDest, unsigned char* pSrc, size_t fieldIndex, size_t width, size_t height); - -void CopyFieldParallel_SSE2 (unsigned char* pDest, unsigned char* pSrc, size_t fieldIndex, size_t width, size_t height); -void CopyFieldParallel_REF (unsigned char* pDest, unsigned char* pSrc, size_t fieldIndex, size_t width, size_t height); - -typedef void(*CopyFieldFun)(unsigned char* pDest, unsigned char* pSrc, size_t fieldIndex, size_t width, size_t height); -CopyFieldFun GetCopyFieldFun(SIMD simd = REF); - - -//void StraightTransform_SSE2(const void* source, void* dest, size_t size); -//void StraightTransform_REF(const void* source, void* dest, size_t size); -// -//typedef void(*StraightTransformFun)(const void*, void*, size_t); -//StraightTransformFun GetStraightTransformFun(SIMD simd = REF); - -} // namespace image -} // namespace utils -} // namespace caspar - -#endif - - diff --git a/server/utils/image/Image.cpp b/server/utils/image/Image.cpp deleted file mode 100644 index c8c155eaa..000000000 --- a/server/utils/image/Image.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\stdafx.h" - -#include "Image.hpp" - -#include "Over.hpp" -#include "Lerp.hpp" -#include "Shuffle.hpp" -#include "Premultiply.hpp" -#include "Copy.hpp" -#include "CopyField.hpp" -#include "Clear.hpp" -//#include "Transition.hpp" - -namespace caspar{ -namespace utils{ -namespace image{ - -namespace detail -{ - ShuffleFun Shuffle = GetShuffleFun(REF); - PreOverFun PreOver = GetPreOverFun(REF); - LerpFun Lerp = GetLerpFun(REF); - PremultiplyFun Premultiply = GetPremultiplyFun(REF); - CopyFun Copy = GetCopyFun(REF); - CopyFieldFun CopyField = GetCopyFieldFun(REF); - ClearFun Clear = GetClearFun(REF); - - const Initializer init; -} - -void Shuffle(void* dest, const void* source, size_t size, const u8 red, const u8 green, const u8 blue, const u8 alpha) -{ - (*detail::Shuffle)(dest, source, size, red, green, blue, alpha); -} - -void PreOver(void* dest, const void* source1, const void* source2, size_t size) -{ - (*detail::PreOver)(dest, source1, source2, size); -} - -void Lerp(void* dest, const void* source1, const void* source2, float alpha, size_t size) -{ - (*detail::Lerp)(dest, source1, source2, alpha, size); -} - -void Premultiply(void* dest, const void* source, size_t size) -{ - (*detail::Premultiply)(dest, source, size); -} - -void Copy(void* dest, const void* source, size_t size) -{ - (*detail::Copy)(dest, source, size); -} - -void CopyField(unsigned char* pDest, unsigned char* pSrc, size_t fieldIndex, size_t width, size_t height) -{ - (*detail::CopyField)(pDest, pSrc, fieldIndex, width, height); -} - -void Clear(void* dest, size_t size) -{ - (*detail::Clear)(dest, size); -} -/* -void Transition(void* dest, const void* source1, const void* source2, int currentFrame, size_t width, size_t height, const TransitionInfo& transitionInfo) -{ - (*detail::Transition)(dest, source1, source2, currentFrame, width, height, transitionInfo); -}*/ - -void SetVersion(SIMD simd) -{ - if(simd == AUTO) - simd = CPUID().SIMD; - - detail::Shuffle = GetShuffleFun(simd); - detail::PreOver = GetPreOverFun(simd); - detail::Lerp = GetLerpFun(simd); - detail::Premultiply = GetPremultiplyFun(simd); - detail::Copy = GetCopyFun(simd); - detail::CopyField = GetCopyFieldFun(simd); - detail::Clear = GetClearFun(simd); - //detail::Transition = GetTransitionFun(simd); -} - -} // namespace image -} // namespace utils -} // namespace caspar \ No newline at end of file diff --git a/server/utils/image/Image.hpp b/server/utils/image/Image.hpp deleted file mode 100644 index d9a36b42f..000000000 --- a/server/utils/image/Image.hpp +++ /dev/null @@ -1,173 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _IMAGE_H_ -#define _IMAGE_H_ - -#include "../Types.hpp" -#include "../CPUID.hpp" - -namespace caspar{ - -class TransitionInfo; - -namespace utils{ -namespace image{ - -/* - Function: SetVersion - - Sets appropriate function pointers for image library functions depending on SIMD version. - - Modified: 2009/4/14 (R.N) - - Parameters: - - simd - SIMD version to use - - Author: Robert Nagy, R.N (SVT 2009) - -*/ -void SetVersion(SIMD simd = AUTO); - -/* - Function: Shuffle - - Shuffles 8 byte channels in image - - Modified: 2009/4/15 (R.N) - - Parameters: - - source1 - Image source - dest - Image destination - size - Size of image in bytes - mask0 - index of first channel - mask1 - index of second channel - mask2 - index of third channel - mask3 - index of fourth channel - - Author: Robert Nagy, R.N (SVT 2009) - - See: Shuffle.hpp -*/ -void Shuffle(void* dest, const void* source, size_t size, const u8 red, const u8 green, const u8 blue, const u8 alpha); - -/* - Function: PreOver - - Blends two images with premultiplied alpha. - Result is put into dest as an image with premultiplied alpha. - - Modified: 2009/4/12 (R.N) - - Parameters: - - source1 - Image above - source2 - Image beneath - dest - Image destination - size - Size of image in bytes - - Author: Robert Nagy, R.N (SVT 2009) - - See: Over.hpp - -*/ -void PreOver(void* dest, const void* source1, const void* source2, size_t size); - -/* - Function: Lerp - - Blends two images based on alpha value; - Result is put into dest as an image with premultiplied alpha. - - Modified: 2009/4/12 (R.N) - 2009/4/20 (R.N) - - Parameters: - - source1 - Image above - source2 - Image beneath - dest - Image destination - size - Size of image in bytes - - Author: Robert Nagy, R.N (SVT 2009) - - See: Lerp.hpp -*/ -void Lerp(void* dest, const void* source1, const void* source2, float alpha, size_t size); - -/* - Function: Premultiply - - Premultiplies color with alpha. - - Modified: 2009/4/20 (R.N) - - Parameters: - - source1 - Image - dest - Image destination - size - Size of image in bytes - - Author: Robert Nagy, R.N (SVT 2009) - - See: Premultiply.hpp -*/ -void Premultiply(void* dest, const void* source, size_t size); - -void Copy(void* dest, const void* source, size_t size); - -void Clear(void* dest, size_t size); - -void CopyField(unsigned char* pDest, unsigned char* pSrc, size_t fieldIndex, size_t width, size_t height); - -//void Transition(void* dest, const void* source1, const void* source2, int currentFrame, size_t width, size_t height, const TransitionInfo& transitionInfo); - -//void Wipe(void* dest, const void* source1, const void* source2, u32 offset, u32 halfStep, Direction dir, size_t width, size_t height, size_t borderWidth, const void* border = NULL, u32 borderColor = 0); - -namespace detail -{ - typedef void(*PreOverFun) (void*, const void*, const void*, size_t); - typedef void(*ShuffleFun) (void*, const void*, size_t, const u8, const u8, const u8, const u8); - typedef void(*LerpFun) (void*, const void*, const void*, float, size_t); - typedef void(*PremultiplyFun) (void*, const void*, size_t); - typedef void(*CopyFun) (void*, const void*, size_t); - typedef void(*CopyFieldFun) (unsigned char* pDest, unsigned char* pSrc, size_t fieldIndex, size_t width, size_t height); - typedef void(*ClearFun) (void*, size_t); - //typedef void(*TransitionFun)(void*, const void*, const void*, int, size_t, size_t, const TransitionInfo&); - - extern ShuffleFun Shuffle; - extern PreOverFun PreOver; - extern LerpFun Lerp; - extern PremultiplyFun Premultiply; - extern CopyFun Copy; - extern CopyFieldFun CopyField; - extern ClearFun Clear; - //extern TransitionFun Transition; - - extern const struct Initializer{Initializer(){SetVersion(AUTO);}} init; -} - -} // namespace image -} // namespace utils -} // namespace caspar - -#endif \ No newline at end of file diff --git a/server/utils/image/Lerp.cpp b/server/utils/image/Lerp.cpp deleted file mode 100644 index 8d4d4fb21..000000000 --- a/server/utils/image/Lerp.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\stdafx.h" - -#include "Lerp.hpp" - -#include -#include - -#include "../Types.hpp" - -#include "tbb/parallel_for.h" -#include "tbb/blocked_range.h" - -using namespace std::tr1::placeholders; - -namespace caspar{ -namespace utils{ -namespace image{ - -static const size_t STRIDE = sizeof(__m128i)*4; - -void DoLerpParallel(const tbb::blocked_range& r, const std::tr1::function& func, void* dest, const void* source1, const void* source2, float alpha) -{ - size_t offset = r.begin()*STRIDE; - size_t size = r.size()*STRIDE; - func(reinterpret_cast(dest) + offset, reinterpret_cast(source1) + offset, reinterpret_cast(source2) + offset, alpha, size); -} - -void LerpParallel(const std::tr1::function& func, void* dest, const void* source1, const void* source2, float alpha, size_t size) -{ - tbb::parallel_for(tbb::blocked_range(0, size/STRIDE), std::tr1::bind(&DoLerpParallel, _1, func, dest, source1, source2, alpha)); -} - -LerpFun GetLerpFun(SIMD simd) -{ - if(simd >= SSE2) - return LerpParallel_SSE2; - else - return LerpParallel_REF; -} - -void Lerp_SSE2(void* dest, const void* source1, const void* source2, float alpha, size_t size) -{ - static const u32 PSD = 64; - - static const __m128i lomask = _mm_set1_epi32(0x00FF00FF); - static const __m128i round = _mm_set1_epi16(128); - - assert(source1 != NULL && source2 != NULL && dest != NULL); - assert(size % STRIDE == 0); - assert(alpha >= 0.0 && alpha <= 1.0); - - const __m128i* source128_1 = reinterpret_cast(source1); - const __m128i* source128_2 = reinterpret_cast(source2); - __m128i* dest128 = reinterpret_cast<__m128i*>(dest); - - __m128i s = _mm_setzero_si128(); - __m128i d = _mm_setzero_si128(); - const __m128i a = _mm_set1_epi16(static_cast(alpha*256.0f+0.5f)); - - __m128i drb, dga, srb, sga; - - for (size_t k = 0, length = size/STRIDE; k < length; ++k) - { - _mm_prefetch(reinterpret_cast(source128_1 + PSD), _MM_HINT_NTA); - _mm_prefetch(reinterpret_cast(source128_2 + PSD), _MM_HINT_NTA); - // TODO: assembly optimization use PSHUFD on moves before calculations, lower latency than MOVDQA (R.N) http://software.intel.com/en-us/articles/fast-simd-integer-move-for-the-intel-pentiumr-4-processor/ - - for(int n = 0; n < 4; ++n, ++dest128, ++source128_1, ++source128_2) - { - // r = d + (s-d)*alpha/256 - s = _mm_load_si128(source128_1); // AABBGGRR - d = _mm_load_si128(source128_2); // AABBGGRR - - srb = _mm_and_si128(lomask, s); // 00BB00RR // unpack - sga = _mm_srli_epi16(s, 8); // AA00GG00 // unpack - - drb = _mm_and_si128(lomask, d); // 00BB00RR // unpack - dga = _mm_srli_epi16(d, 8); // AA00GG00 // unpack - - srb = _mm_sub_epi16(srb, drb); // BBBBRRRR // sub - srb = _mm_mullo_epi16(srb, a); // BBBBRRRR // mul - srb = _mm_add_epi16(srb, round); - - sga = _mm_sub_epi16(sga, dga); // AAAAGGGG // sub - sga = _mm_mullo_epi16(sga, a); // AAAAGGGG // mul - sga = _mm_add_epi16(sga, round); - - srb = _mm_srli_epi16(srb, 8); // 00BB00RR // prepack and div - sga = _mm_andnot_si128(lomask, sga);// AA00GG00 // prepack and div - - srb = _mm_or_si128(srb, sga); // AABBGGRR // pack - - srb = _mm_add_epi8(srb, d); // AABBGGRR // add there is no overflow(R.N) - - _mm_stream_si128(dest128, srb); - } - } - _mm_mfence(); //ensure last WC buffers get flushed to memory -} - -void LerpParallel_SSE2(void* dest, const void* source1, const void* source2, float alpha, size_t size) -{ - LerpParallel(&Lerp_SSE2, dest, source1, source2, alpha, size); -} - -void Lerp_REF(void* dest, const void* source1, const void* source2, float alpha, size_t size) -{ - assert(source1 != NULL && source2 != NULL && dest != NULL); - assert(size % 4 == 0); - assert(alpha >= 0.0f && alpha <= 1.0f); - - const u8* source8_1 = reinterpret_cast(source1); - const u8* source8_2 = reinterpret_cast(source2); - u8* dest8 = reinterpret_cast(dest); - - u8 a = static_cast(alpha*256.0f); - for(size_t n = 0; n < size; n+=4) - { - // s - u32 sr = source8_1[n+0]; - u32 sg = source8_1[n+1]; - u32 sb = source8_1[n+2]; - u32 sa = source8_1[n+3]; - - // d - u32 dr = source8_2[n+0]; - u32 dg = source8_2[n+1]; - u32 db = source8_2[n+2]; - u32 da = source8_2[n+3]; - - //dest8[n+0] = dr + ((sr-dr)*a)/256; - //dest8[n+1] = dg + ((sg-dg)*a)/256; - //dest8[n+2] = db + ((sb-db)*a)/256; - //dest8[n+3] = da + ((sa-da)*a)/256; - - dest8[n+0] = dr + int(float((sr-dr)*a)/256.0f+0.5f); - dest8[n+1] = dg + int(float((sg-dg)*a)/256.0f+0.5f); - dest8[n+2] = db + int(float((sb-db)*a)/256.0f+0.5f); - dest8[n+3] = da + int(float((sa-da)*a)/256.0f+0.5f); - - } -} - -void LerpParallel_REF(void* dest, const void* source1, const void* source2, float alpha, size_t size) -{ - LerpParallel(&Lerp_REF, dest, source1, source2, alpha, size); -} - -// Author: Niclas P Andersson -void Lerp_OLD(void* dest, const void* source1, const void* source2, float alpha, size_t size) -{ - __m128i ps1, ps2, pd1, pd2, m0, m1, pr1, pr2; - - __m128i* pSource = (__m128i*)source1; - __m128i* pDest = (__m128i*)source2; - __m128i* pResult = (__m128i*)dest; - - __m128i a = _mm_set1_epi16(static_cast(alpha*256.0f+0.5f)); - m0 = _mm_setzero_si128(); - - int count = size/4; - for ( int i = 0; i < count; i+=4 ) - { - ps1 = _mm_load_si128(pSource); //load 4 pixels from source - pd1 = _mm_load_si128(pDest); //load 4 pixels from dest - ps2 = _mm_unpackhi_epi64(ps1, m0); //move the 2 high pixels from source - pd2 = _mm_unpackhi_epi64(pd1, m0); //move the 2 high pixels from dest - - //compute the 2 "lower" pixels - ps1 = _mm_unpacklo_epi8(ps1, m0); //unpack the 2 low pixels from source (bytes -> words) - pd1 = _mm_unpacklo_epi8(pd1, m0); //unpack the 2 low pixels from dest (bytes -> words) - - pr1 = _mm_sub_epi16(ps1, pd1); //x = src - dest - pr1 = _mm_mullo_epi16(pr1, a); //y = x*alpha - pr1 = _mm_srli_epi16(pr1, 8); //w = y/256 - pr1 = _mm_add_epi8(pr1, pd1); //z = w + dest - - //same thing for the 2 "high" pixels - ps2 = _mm_unpacklo_epi8(ps2, m0); - pd2 = _mm_unpacklo_epi8(pd2, m0); - - pr2 = _mm_sub_epi16(ps2, pd2); //x = src - dest - pr2 = _mm_mullo_epi16(pr2, a); //y = x*alpha - pr2 = _mm_srli_epi16(pr2, 8); //w = y/256 - pr2 = _mm_add_epi8(pr2, pd2); //z = w + dest - - m1 = _mm_packus_epi16(pr1, pr2); //pack all 4 together again (words -> bytes) - _mm_store_si128(pResult, m1); - - pSource++; - pDest++; - pResult++; - } -} - -} // namespace image -} // namespace utils -} // namespace caspar - - diff --git a/server/utils/image/Lerp.hpp b/server/utils/image/Lerp.hpp deleted file mode 100644 index 746e387cf..000000000 --- a/server/utils/image/Lerp.hpp +++ /dev/null @@ -1,45 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _LERP_H_ -#define _LERP_H_ - -#include "../CPUID.hpp" - -namespace caspar{ -namespace utils{ -namespace image{ - -void Lerp_SSE2(void* dest, const void* source1, const void* source2, float alpha, size_t size); -void Lerp_REF (void* dest, const void* source1, const void* source2, float alpha, size_t size); -void LerpParallel_SSE2(void* dest, const void* source1, const void* source2, float alpha, size_t size); -void LerpParallel_REF (void* dest, const void* source1, const void* source2, float alpha, size_t size); -void Lerp_OLD (void* dest, const void* source1, const void* source2, float alpha, size_t size); - -typedef void(*LerpFun)(void*, const void*, const void*, float, size_t); -LerpFun GetLerpFun(SIMD simd = REF); - -} // namespace image -} // namespace utils -} // namespace caspar - -#endif - - diff --git a/server/utils/image/Over.cpp b/server/utils/image/Over.cpp deleted file mode 100644 index 79b09d6cb..000000000 --- a/server/utils/image/Over.cpp +++ /dev/null @@ -1,246 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\stdafx.h" - -#include "Over.hpp" - -#include -#include - -#include "../Types.hpp" - -#include "tbb/parallel_for.h" -#include "tbb/blocked_range.h" - -using namespace std::tr1::placeholders; - -namespace caspar{ -namespace utils { -namespace image { - -static const size_t STRIDE = sizeof(__m128i)*4; - -void DoPreOverParallel(const tbb::blocked_range& r, const std::tr1::function& func, void* dest, const void* source1, const void* source2) -{ - size_t offset = r.begin()*STRIDE; - size_t size = r.size()*STRIDE; - func(reinterpret_cast(dest) + offset, reinterpret_cast(source1) + offset, reinterpret_cast(source2) + offset, size); -} - -void PreOverParallel(const std::tr1::function& func, void* dest, const void* source1, const void* source2, size_t size) -{ - tbb::parallel_for(tbb::blocked_range(0, size/STRIDE), std::tr1::bind(&DoPreOverParallel, _1, func, dest, source1, source2)); -} - -PreOverFun GetPreOverFun(SIMD simd) -{ - if(simd >= SSE2) - return PreOverParallel_SSE2; - else - return PreOverParallel_REF; -} - -// this function performs precise calculations -void PreOver_SSE2(void* dest, const void* source1, const void* source2, size_t size) -{ - static const u32 PSD = 64; - - static const __m128i round = _mm_set1_epi16(128); - static const __m128i lomask = _mm_set1_epi32(0x00FF00FF); - - assert(source1 != NULL && source2 != NULL && dest != NULL); - assert(size % STRIDE == 0); - - const __m128i* source128_1 = reinterpret_cast(source1); - const __m128i* source128_2 = reinterpret_cast(source2); - __m128i* dest128 = reinterpret_cast<__m128i*>(dest); - - __m128i d, s, a, rb, ag, t; - - // TODO: dynamic prefetch schedluing distance? needs to be optimized (R.N) - - for(size_t k = 0, length = size/STRIDE; k < length; ++k) - { - // TODO: put prefetch between calculations?(R.N) - _mm_prefetch(reinterpret_cast(source128_1+PSD), _MM_HINT_NTA); - _mm_prefetch(reinterpret_cast(source128_2+PSD), _MM_HINT_NTA); - - // work on entire cacheline before next prefetch - for(int n = 0; n < 4; ++n, ++dest128, ++source128_1, ++source128_2) - { - // TODO: assembly optimization use PSHUFD on moves before calculations, lower latency than MOVDQA (R.N) http://software.intel.com/en-us/articles/fast-simd-integer-move-for-the-intel-pentiumr-4-processor/ - - // TODO: load entire cacheline at the same time? are there enough registers? 32 bit mode (special compile for 64bit?) (R.N) - s = _mm_load_si128(source128_1); // AABGGRR - d = _mm_load_si128(source128_2); // AABGGRR - - // PRELERP(S, D) = S+D - ((S*D[A]+0x80)>>8)+(S*D[A]+0x80))>>8 - // T = S*D[A]+0x80 => PRELERP(S,D) = S+D - ((T>>8)+T)>>8 - - // set alpha to lo16 from dest_ - a = _mm_srli_epi32(d, 24); // 000000AA - rb = _mm_slli_epi32(a, 16); // 00AA0000 - a = _mm_or_si128(rb, a); // 00AA00AA - - rb = _mm_and_si128(lomask, s); // 00BB00RR - rb = _mm_mullo_epi16(rb, a); // BBBBRRRR - rb = _mm_add_epi16(rb, round); // BBBBRRRR - t = _mm_srli_epi16(rb, 8); - t = _mm_add_epi16(t, rb); - rb = _mm_srli_epi16(t, 8); // 00BB00RR - - ag = _mm_srli_epi16(s, 8); // 00AA00GG - ag = _mm_mullo_epi16(ag, a); // AAAAGGGG - ag = _mm_add_epi16(ag, round); - t = _mm_srli_epi16(ag, 8); - t = _mm_add_epi16(t, ag); - ag = _mm_andnot_si128(lomask, t); // AA00GG00 - - rb = _mm_or_si128(rb, ag); // AABGGRR pack - - rb = _mm_sub_epi8(s, rb); // sub S-[(D[A]*S)/255] - d = _mm_add_epi8(d, rb); // add D+[S-(D[A]*S)/255] - - _mm_stream_si128(dest128, d); - } - } - _mm_mfence(); //ensure last WC buffers get flushed to memory -} - -void PreOverParallel_SSE2(void* dest, const void* source1, const void* source2, size_t size) -{ - PreOverParallel(&PreOver_SSE2, dest, source1, source2, size); -} - -void PreOver_FastSSE2(void* dest, const void* source1, const void* source2, size_t size) -{ - static const u32 PSD = 64; - - static const __m128i lomask = _mm_set1_epi32(0x00FF00FF); - - assert(source1 != NULL && source2 != NULL && dest != NULL); - assert(size % STRIDE == 0); - - const __m128i* source128_1 = reinterpret_cast(source1); - const __m128i* source128_2 = reinterpret_cast(source2); - __m128i* dest128 = reinterpret_cast<__m128i*>(dest); - - __m128i d, s, a, rb, ag; - - // TODO: dynamic prefetch schedluing distance? needs to be optimized (R.N) - for(int k = 0, length = size/STRIDE; k < length; ++k) - { - // TODO: put prefetch between calculations?(R.N) - _mm_prefetch(reinterpret_cast(source128_1+PSD), _MM_HINT_NTA); - _mm_prefetch(reinterpret_cast(source128_2+PSD), _MM_HINT_NTA); - - //work on entire cacheline before next prefetch - for(int n = 0; n < 4; ++n, ++dest128, ++source128_1, ++source128_2) - { - // TODO: assembly optimization use PSHUFD on moves before calculations, lower latency than MOVDQA (R.N) http://software.intel.com/en-us/articles/fast-simd-integer-move-for-the-intel-pentiumr-4-processor/ - - s = _mm_load_si128(source128_1); // AABGGRR - d = _mm_load_si128(source128_2); // AABGGRR - - // set alpha to lo16 from dest_ - rb = _mm_srli_epi32(d, 24); // 000000AA - a = _mm_slli_epi32(rb, 16); // 00AA0000 - a = _mm_or_si128(rb, a); // 00AA00AA - - // fix alpha a = a > 127 ? a+1 : a - // NOTE: If removed an *overflow* will occur with large values (R.N) - rb = _mm_srli_epi16(a, 7); - a = _mm_add_epi16(a, rb); - - rb = _mm_and_si128(lomask, s); // 00B00RR unpack - rb = _mm_mullo_epi16(rb, a); // BBRRRR mul (D[A]*S) - rb = _mm_srli_epi16(rb, 8); // 00B00RR prepack and div [(D[A]*S)]/255 - - ag = _mm_srli_epi16(s, 8); // 00AA00GG unpack - ag = _mm_mullo_epi16(ag, a); // AAAAGGGG mul (D[A]*S) - ag = _mm_andnot_si128(lomask, ag); // AA00GG00 prepack and div [(D[A]*S)]/255 - - rb = _mm_or_si128(rb, ag); // AABGGRR pack - - rb = _mm_sub_epi8(s, rb); // sub S-[(D[A]*S)/255] - d = _mm_add_epi8(d, rb); // add D+[S-(D[A]*S)/255] - - _mm_stream_si128(dest128, d); - } - } - _mm_mfence(); //ensure last WC buffers get flushed to memory -} - -// TODO: optimize -void PreOver_REF(void* dest, const void* source1, const void* source2, size_t size) -{ - assert(source1 != NULL && source2 != NULL && dest != NULL); - assert(size % 4 == 0); - - const u8* source8_1 = reinterpret_cast(source1); - const u8* source8_2 = reinterpret_cast(source2); - u8* dest8 = reinterpret_cast(dest); - - for(size_t n = 0; n < size; n+=4) - { - u32 r1 = source8_1[n+0]; - u32 g1 = source8_1[n+1]; - u32 b1 = source8_1[n+2]; - u32 a1 = source8_1[n+3]; - - u32 r2 = source8_2[n+0]; - u32 g2 = source8_2[n+1]; - u32 b2 = source8_2[n+2]; - u32 a2 = source8_2[n+3]; - - dest8[n+0] = r2 + r1 - (a2*r1)/255; - dest8[n+1] = g2 + g1 - (a2*g1)/255; - dest8[n+2] = b2 + b1 - (a2*b1)/255; - dest8[n+3] = a2 + a1 - (a2*a1)/255; - - // PRECISE - //if(a2 > 0) - //{ - // dest8[n+0] = r2 + r1 - int(float(a2*r1)/255.0f+0.5f); - // dest8[n+1] = g2 + g1 - int(float(a2*g1)/255.0f+0.5f); - // dest8[n+2] = b2 + b1 - int(float(a2*b1)/255.0f+0.5f); - // dest8[n+3] = a2 + a1 - int(float(a2*a1)/255.0f+0.5f); - //} - //else - //{ - // dest8[n+0] = r1; - // dest8[n+1] = g1; - // dest8[n+2] = b1; - // dest8[n+3] = a1; - //} - } -} - -void PreOverParallel_REF(void* dest, const void* source1, const void* source2, size_t size) -{ - PreOverParallel(&PreOver_REF, dest, source1, source2, size); -} - -} // namespace image -} // namespace utils -} // namespace caspar - - diff --git a/server/utils/image/Over.hpp b/server/utils/image/Over.hpp deleted file mode 100644 index ea7a7c4f9..000000000 --- a/server/utils/image/Over.hpp +++ /dev/null @@ -1,45 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef OVER_H_ -#define OVER_H_ - -#include "../CPUID.hpp" - -namespace caspar{ -namespace utils{ -namespace image{ - -void PreOver_SSE2(void* dest, const void* source1, const void* source2, size_t size); -void PreOverParallel_SSE2(void* dest, const void* source1, const void* source2, size_t size); -void PreOver_FastSSE2(void* dest, const void* source1, const void* source2, size_t size); -void PreOver_REF(void* dest, const void* source1, const void* source2, size_t size); -void PreOverParallel_REF(void* dest, const void* source1, const void* source2, size_t size); - -typedef void(*PreOverFun)(void*, const void*, const void*, size_t); -PreOverFun GetPreOverFun(SIMD simd = REF); - -} // namespace image -} // namespace utils -} // namespace caspar - -#endif - - diff --git a/server/utils/image/Premultiply.cpp b/server/utils/image/Premultiply.cpp deleted file mode 100644 index 9b5239a73..000000000 --- a/server/utils/image/Premultiply.cpp +++ /dev/null @@ -1,255 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\stdafx.h" - -#include "Premultiply.hpp" - -#include -#include - -#include "../Types.hpp" - -#include "tbb/parallel_for.h" -#include "tbb/blocked_range.h" - -using namespace std::tr1::placeholders; - -namespace caspar{ -namespace utils{ -namespace image{ - -static const size_t STRIDE = sizeof(__m128i)*4; - -void DoPreMultiplyParallel(const tbb::blocked_range& r, const std::tr1::function& func, void* dest, const void* source) -{ - size_t offset = r.begin()*STRIDE; - size_t size = r.size()*STRIDE; - func(reinterpret_cast(dest) + offset, reinterpret_cast(source) + offset, size); -} - -void PreMultiplyParallel(const std::tr1::function& func, void* dest, const void* source, size_t size) -{ - tbb::parallel_for(tbb::blocked_range(0, size/STRIDE), std::tr1::bind(&DoPreMultiplyParallel, _1, func, dest, source)); -} - -PremultiplyFun GetPremultiplyFun(SIMD simd) -{ - if(simd >= SSE2) - return PremultiplyParallel_SSE2; - else - return PremultiplyParallel_REF; -} - -// this function performs precise calculations -void Premultiply_SSE2(void* dest, const void* source, size_t size) -{ - static const u32 PSD = 64; - - static const __m128i lomask = _mm_set1_epi32(0x00FF00FF); - static const __m128i amask = _mm_set1_epi32(0xFF000000); - static const __m128i round = _mm_set1_epi16(128); - - assert(source != NULL && dest != NULL); - assert(size % STRIDE == 0); - - const __m128i* source128 = reinterpret_cast(source); - __m128i* dest128 = reinterpret_cast<__m128i*>(dest); - - __m128i s, rb, ag, a, t; - - for(size_t k = 0, length = size/STRIDE; k != length; ++k) - { - // TODO: put prefetch between calculations?(R.N) - _mm_prefetch(reinterpret_cast(source128 + PSD), _MM_HINT_NTA); - - // prefetch fetches entire cacheline (512bit). work on entire cacheline before next prefetch. 512/128 = 4, unroll four times = 16 pixels - - // TODO: assembly optimization use PSHUFD on moves before calculations, lower latency than MOVDQA (R.N) http://software.intel.com/en-us/articles/fast-simd-integer-move-for-the-intel-pentiumr-4-processor/ - - for(int n = 0; n < 4; ++n, ++dest128, ++source128) - { - s = _mm_load_si128(source128); // AABBGGRR - - // set alpha to lo16 from source - rb = _mm_srli_epi32(s, 24); // 000000AA - a = _mm_slli_epi32(rb, 16); // 00AA0000 - a = _mm_or_si128(rb, a); // 00AA00AA - - rb = _mm_and_si128(lomask, s); // 00BB00RR - rb = _mm_mullo_epi16(rb, a); // BBBBRRRR - rb = _mm_add_epi16(rb, round); // BBBBRRRR - t = _mm_srli_epi16(rb, 8); // 00BB00RR - t = _mm_add_epi16(t, rb); - rb = _mm_srli_epi16(t, 8); - - ag = _mm_srli_epi16(s, 8); // 00AA00GG - ag = _mm_mullo_epi16(ag, a); // AAAAGGGG - ag = _mm_add_epi16(ag, round); - t = _mm_srli_epi16(ag, 8); - t = _mm_add_epi16(t, ag); - ag = _mm_andnot_si128(lomask, t); // AA00GG00 - - a = _mm_or_si128(rb, ag); // XXBBGGRR - a = _mm_andnot_si128(amask, a); // 00BBGGRR - - s = _mm_and_si128(amask, s); // AA000000 - - s = _mm_or_si128(a, s); // AABBGGRR pack - - // TODO: store entire cache line at the same time (write-combining => burst)? are there enough registers? 32 bit mode (special compile for 64bit?) (R.N) - _mm_stream_si128(dest128, s); - } - } - _mm_mfence(); //ensure last WC buffers get flushed to memory -} - -void PremultiplyParallel_SSE2(void* dest, const void* source1, size_t size) -{ - PreMultiplyParallel(&Premultiply_SSE2, dest, source1, size); -} - -void Premultiply_FastSSE2(void* dest, const void* source, size_t size) -{ - static const size_t stride = sizeof(__m128i)*4; - static const u32 PSD = 64; - - static const __m128i lomask = _mm_set1_epi32(0x00FF00FF); - static const __m128i amask = _mm_set1_epi32(0xFF000000); - - - assert(source != NULL && dest != NULL); - assert(size % stride == 0); - - const __m128i* source128 = reinterpret_cast(source); - __m128i* dest128 = reinterpret_cast<__m128i*>(dest); - - __m128i s = _mm_setzero_si128(); - __m128i rb = _mm_setzero_si128(); - __m128i ag = _mm_setzero_si128(); - __m128i a = _mm_setzero_si128(); - - for(size_t k = 0, length = size/stride; k != length; ++k) - { - // TODO: put prefetch between calculations?(R.N) - _mm_prefetch(reinterpret_cast(source128 + PSD), _MM_HINT_NTA); - - //work on entire cacheline before next prefetch - - // TODO: assembly optimization use PSHUFD on moves before calculations, lower latency than MOVDQA (R.N) http://software.intel.com/en-us/articles/fast-simd-integer-move-for-the-intel-pentiumr-4-processor/ - - for(int n = 0; n < 4; ++n, ++dest128, ++source128) - { - s = _mm_load_si128(source128); // AABBGGRR - - // set alpha to lo16 from source - rb = _mm_srli_epi32(s, 24); // 000000AA - a = _mm_slli_epi32(rb, 16); // 00AA0000 - a = _mm_or_si128(rb, a); // 00AA00AA - - // fix alpha a = a > 127 ? a+1 : a - rb = _mm_srli_epi16(a, 7); - a = _mm_add_epi16(a, rb); - - rb = _mm_and_si128(lomask, s); // 00BB00RR unpack - rb = _mm_mullo_epi16(rb, a); // BBBBRRRR mul (D[A]*S) - rb = _mm_srli_epi16(rb, 8); // 00BB00RR prepack and div [(D[A]*S)]/255 - - ag = _mm_srli_epi16(s, 8); // 00AA00GG unpack - ag = _mm_mullo_epi16(ag, a); // XXXXGGGG mul (D[A]*S) - ag = _mm_andnot_si128(lomask, ag); // XX00GG00 prepack and div [(D[A]*S)]/255 - - a = _mm_or_si128(rb, ag); // XXBBGGRR - a = _mm_andnot_si128(amask, a); // 00BBGGRR - - s = _mm_and_si128(amask, s); // AA000000 - - s = _mm_or_si128(a, s); // AABBGGRR pack - - // TODO: store entire cache line at the same time (write-combining => burst)? are there enough registers? 32 bit mode (special compile for 64bit?) (R.N) - _mm_store_si128(dest128, s); - } - } -} - -void Premultiply_REF(void* dest, const void* source, size_t size) -{ - assert(source != NULL && dest != NULL); - assert(size % 4 == 0); - - const u8* source8 = reinterpret_cast(source); - u8* dest8 = reinterpret_cast(dest); - - for(size_t n = 0; n < size; n+=4) - { - u32 r = source8[n+0]; - u32 g = source8[n+1]; - u32 b = source8[n+2]; - u32 a = source8[n+3]; - - dest8[n+0] = (r*a)/255; - dest8[n+1] = (g*a)/255; - dest8[n+2] = (b*a)/255; - dest8[n+3] = a; - } -} - -void PremultiplyParallel_REF(void* dest, const void* source1, size_t size) -{ - PreMultiplyParallel(&Premultiply_REF, dest, source1, size); -} - - -//void StraightTransform_REF(const void* source, void* dest, size_t size) -//{ -// assert(source != NULL && dest != NULL); -// assert((size % 4) == 0); -// -// const u8* source8 = reinterpret_cast(source); -// u8* dest8 = reinterpret_cast(dest); -// -// for(int n = 0; n < size; n+=4) -// { -// u32 r = source8[n+0]; -// u32 g = source8[n+1]; -// u32 b = source8[n+2]; -// u32 a = source8[n+3]; -// -// if(a > 0) -// { -// dest8[n+0] = (r*255)/a; -// dest8[n+1] = (g*255)/a; -// dest8[n+2] = (b*255)/a; -// dest8[n+3] = a; -// } -// else -// { -// dest8[n+0] = 0; -// dest8[n+1] = 0; -// dest8[n+2] = 0; -// dest8[n+3] = 0; -// } -// } -//} - - -} // namespace image -} // namespace utils -} // namespace caspar diff --git a/server/utils/image/Premultiply.hpp b/server/utils/image/Premultiply.hpp deleted file mode 100644 index 7b3d146e6..000000000 --- a/server/utils/image/Premultiply.hpp +++ /dev/null @@ -1,52 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef PREMULTIPLY_H_ -#define PREMULTIPLY_H_ - -#include "../CPUID.hpp" - -namespace caspar{ -namespace utils{ -namespace image{ - -void Premultiply_SSE2 (void* dest, const void* source, size_t size); -void PremultiplyParallel_SSE2 (void* dest, const void* source, size_t size); -void Premultiply_FastSSE2(void* dest, const void* source, size_t size); -void Premultiply_REF (void* dest, const void* source, size_t size); -void PremultiplyParallel_REF (void* dest, const void* source, size_t size); - -typedef void(*PremultiplyFun)(void*, const void*, size_t); -PremultiplyFun GetPremultiplyFun(SIMD simd = REF); - - -//void StraightTransform_SSE2(const void* source, void* dest, size_t size); -//void StraightTransform_REF(const void* source, void* dest, size_t size); -// -//typedef void(*StraightTransformFun)(const void*, void*, size_t); -//StraightTransformFun GetStraightTransformFun(SIMD simd = REF); - -} // namespace image -} // namespace utils -} // namespace caspar - -#endif - - diff --git a/server/utils/image/Shuffle.cpp b/server/utils/image/Shuffle.cpp deleted file mode 100644 index 5633b6dc3..000000000 --- a/server/utils/image/Shuffle.cpp +++ /dev/null @@ -1,210 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#include "..\..\stdafx.h" - -#include "Shuffle.hpp" - -#include -#include - -#include "../Types.hpp" - -#include "tbb/parallel_for.h" -#include "tbb/blocked_range.h" - -using namespace std::tr1::placeholders; - -namespace caspar{ -namespace utils{ -namespace image{ - -static const size_t STRIDE = sizeof(__m128i)*4; - -void DoShuffleParallel(const tbb::blocked_range& r, const std::tr1::function& func, void* dest, const void* source, const u8 red, const u8 green, const u8 blue, const u8 alpha) -{ - size_t offset = r.begin()*STRIDE; - size_t size = r.size()*STRIDE; - func(reinterpret_cast(dest) + offset, reinterpret_cast(source) + offset, size, red, green, blue, alpha); -} - -void ShuffleParallel(const std::tr1::function& func, void* dest, const void* source, size_t size, const u8 red, const u8 green, const u8 blue, const u8 alpha) -{ - tbb::parallel_for(tbb::blocked_range(0, size/STRIDE), std::tr1::bind(&DoShuffleParallel, _1, func, dest, source, red, green, blue, alpha)); -} - -ShuffleFun GetShuffleFun(SIMD simd) -{ - if(simd >= SSSE3) - return ShuffleParallel_SSSE3; - else if(simd >= SSE2) - return ShuffleParallel_SSE2; - else - return ShuffleParallel_REF; -} - -void Shuffle_SSSE3(void* dest, const void* source, size_t size, const u8 red, const u8 green, const u8 blue, const u8 alpha) -{ - static const unsigned int PSD = 64; - - assert(source != NULL && dest != NULL); - assert(red > -1 && red < 4 && green > -1 && green < 4 && blue > -1 && blue < 4 && alpha > -1 && alpha < 4 && "Invalid mask"); - assert(size % STRIDE == 0); - - const __m128i* source128 = reinterpret_cast(source); - __m128i* dest128 = reinterpret_cast<__m128i*>(dest); - - __m128i reg0 = _mm_setzero_si128(); - __m128i reg1 = _mm_setzero_si128(); - __m128i reg2 = _mm_setzero_si128(); - __m128i reg3 = _mm_setzero_si128(); - - const __m128i mask128 = _mm_set_epi8(alpha+12, blue+12, green+12, red+12, alpha+8, blue+8, green+8, red+8, alpha+4, blue+4, green+4, red+4, alpha, blue, green, red); - - for(size_t k = 0, length = size/STRIDE; k < length; ++k) - { - // TODO: put prefetch between calculations?(R.N) - _mm_prefetch(reinterpret_cast(source128 + PSD), _MM_HINT_NTA); - - // work on entire cacheline before next prefetch - - // TODO: assembly optimization use PSHUFD on moves before calculations, lower latency than MOVDQA (R.N) http://software.intel.com/en-us/articles/fast-simd-integer-move-for-the-intel-pentiumr-4-processor/ - - reg0 = _mm_load_si128(source128++); - reg1 = _mm_load_si128(source128++); - - _mm_stream_si128(dest128++, _mm_shuffle_epi8(reg0, mask128)); - - reg2 = _mm_load_si128(source128++); - - _mm_stream_si128(dest128++, _mm_shuffle_epi8(reg1, mask128)); - - reg3 = _mm_load_si128(source128++); - - _mm_stream_si128(dest128++, _mm_shuffle_epi8(reg2, mask128)); - _mm_stream_si128(dest128++, _mm_shuffle_epi8(reg3, mask128)); - } - _mm_mfence(); //ensure last WC buffers get flushed to memory -} - -void ShuffleParallel_SSSE3(void* dest, const void* source, size_t size, const u8 red, const u8 green, const u8 blue, const u8 alpha) -{ - ShuffleParallel(&Shuffle_SSSE3, dest, source, size, red, green, blue, alpha); -} - -// TODO: should be optimized for different combinations (R.N) -void Shuffle_SSE2(void* dest, const void* source, size_t size, const u8 red, const u8 green, const u8 blue, const u8 alpha) -{ - static const size_t stride = sizeof(__m128i)*4; - static const u32 PSD = 64; - - static const __m128i himask = _mm_set1_epi32(0xFF000000); - static const __m128i lomask = _mm_set1_epi32(0x000000FF); - - assert(source != NULL && dest != NULL); - assert(red > -1 && red < 4 && green > -1 && green < 4 && blue > -1 && blue < 4 && alpha > -1 && alpha < 4); - assert(size % stride == 0); - - const __m128i* source128 = reinterpret_cast(source); - __m128i* dest128 = reinterpret_cast<__m128i*>(dest); - - __m128i s, m0, m1, r; - - const int shft0 = (red)*8; - const int shft1 = (green)*8; - const int shft2 = (3-blue)*8; - const int shft3 = (3-alpha)*8; - - for(int k = 0, length = size/stride; k < length; ++k) - { - // TODO: dynamic prefetch schedluing distance? needs to be optimized (R.N) - // TODO: put prefetch between calculations?(R.N) - _mm_prefetch(reinterpret_cast(source128 + PSD), _MM_HINT_NTA); - - // work on entire cacheline before next prefetch - - // TODO: assembly optimization use PSHUFD on moves before calculations, lower latency than MOVDQA (R.N) http://software.intel.com/en-us/articles/fast-simd-integer-move-for-the-intel-pentiumr-4-processor/ - - for(int n = 0; n < 4; ++n, ++dest128, ++source128) - { - s = _mm_load_si128(source128); - - m0 = _mm_srli_epi32(s, shft0); - m0 = _mm_and_si128(m0, lomask); - - m1 = _mm_srli_epi32(s, shft1); - m1 = _mm_and_si128(m1, lomask); - m1 = _mm_slli_epi32(m1, 8); - - r = _mm_or_si128(m0, m1); - - m0 = _mm_slli_epi32(s, shft2); - m0 = _mm_and_si128(m0, himask); - m0 = _mm_srli_epi32(m0, 8); - - m1 = _mm_slli_epi32(s, shft3); - m1 = _mm_and_si128(m1, himask); - - m0 = _mm_or_si128(m0, m1); - - r = _mm_or_si128(r, m0); - - _mm_stream_si128(dest128, r); - } - } - _mm_mfence(); //ensure last WC buffers get flushed to memory -} - -void ShuffleParallel_SSE2(void* dest, const void* source, size_t size, const u8 red, const u8 green, const u8 blue, const u8 alpha) -{ - ShuffleParallel(&Shuffle_SSE2, dest, source, size, red, green, blue, alpha); -} - -void Shuffle_REF(void* dest, const void* source, size_t size, const u8 red, const u8 green, const u8 blue, const u8 alpha) -{ - assert(source != NULL && dest != NULL); - assert(red > -1 && red < 4 && green > -1 && green < 4 && blue > -1 && blue < 4 && alpha > -1 && alpha < 4); - assert(size % 4 == 0); - - const u8* source8 = reinterpret_cast(source); - u8* dest8 = reinterpret_cast(dest); - - for(size_t n = 0; n < size; n+=4) - { - u8 r = source8[n+red]; - u8 g = source8[n+green]; - u8 b = source8[n+blue]; - u8 a = source8[n+alpha]; - - dest8[n+0] = r; - dest8[n+1] = g; - dest8[n+2] = b; - dest8[n+3] = a; - } -} - -void ShuffleParallel_REF(void* dest, const void* source, size_t size, const u8 red, const u8 green, const u8 blue, const u8 alpha) -{ - ShuffleParallel(&Shuffle_REF, dest, source, size, red, green, blue, alpha); -} - -} // namespace image -} // namespace utils -} // namespace caspar diff --git a/server/utils/image/Shuffle.hpp b/server/utils/image/Shuffle.hpp deleted file mode 100644 index c7973fe9e..000000000 --- a/server/utils/image/Shuffle.hpp +++ /dev/null @@ -1,45 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _SHUFFLE_ -#define _SHUFFLE_ - -#include "../CPUID.hpp" -#include "../Types.hpp" - -namespace caspar{ -namespace utils{ -namespace image{ - -void Shuffle_SSSE3(void* dest, const void* source, size_t size, const u8 red, const u8 green, const u8 blue, const u8 alpha); -void Shuffle_SSE2 (void* dest, const void* source, size_t size, const u8 red, const u8 green, const u8 blue, const u8 alpha); -void Shuffle_REF (void* dest, const void* source, size_t size, const u8 red, const u8 green, const u8 blue, const u8 alpha); -void ShuffleParallel_SSSE3(void* dest, const void* source, size_t size, const u8 red, const u8 green, const u8 blue, const u8 alpha); -void ShuffleParallel_SSE2 (void* dest, const void* source, size_t size, const u8 red, const u8 green, const u8 blue, const u8 alpha); -void ShuffleParallel_REF (void* dest, const void* source, size_t size, const u8 red, const u8 green, const u8 blue, const u8 alpha); - -typedef void(*ShuffleFun)(void*, const void*, size_t, const u8, const u8, const u8, const u8); -ShuffleFun GetShuffleFun(SIMD simd = REF); - -} // namespace image -} // namespace utils -} // namespace caspar - -#endif \ No newline at end of file diff --git a/server/utils/object_pool.h b/server/utils/object_pool.h deleted file mode 100644 index 4368c48a0..000000000 --- a/server/utils/object_pool.h +++ /dev/null @@ -1,84 +0,0 @@ -#ifndef _OBJECTPOOL_H_ -#define _OBJECTPOOL_H_ - -#include -#include -#include - -#include - -namespace caspar -{ - -namespace utils -{ - -template -struct default_new_delete_allocator -{ - static T* construct() - { return new T(); } - - - template - static T* construct(P0&& p0) - { return new T(std::forward(p0)); } - - template - static T* construct(P0&& p0, P1&& p1) - { return new T(std::forward(p0), std::forward(p1)); } - - template - static T* construct(P0&& p0, P1&& p1, P2&& p2) - { return new T(std::forward(p0), std::forward(p1), std::forward(p2)); } - - static void destroy(T* const block) - { delete block; } -}; - -template> -class object_pool -{ - typedef std::shared_ptr Ptr; -public: - - ~object_pool() - { - T* item; - while(pool_.try_pop(item)) - allocator::destroy(item); - } - - Ptr construct() - { - T* item = pool_.try_pop(item) ? item : allocator::construct(); - return Ptr(item, [&](T* item){ pool_.push(item); }); - } - - template - Ptr construct(P0&& p0) - { - T* item = pool_.try_pop(item) ? item : allocator::construct(std::forward(p0)); - return Ptr(item, [&](T* item){ pool_.push(item); }); - } - - template - Ptr construct(P0&& p0, P1&& p1) - { - T* item = pool_.try_pop(item) ? item : allocator::construct(std::forward(p0), std::forward(p1)); - return Ptr(item, [&](T* item){ pool_.push(item); }); - } - - template - Ptr construct(P0&& p0, P1&& p1, P1&& p2) - { - T* item = pool_.try_pop(item) ? item : allocator::construct(std::forward(p0), std::forward(p1), std::forward(p2)); - return Ptr(item, [&](T* item){ pool_.push(item); }); - } -private: - tbb::concurrent_queue pool_; -}; - -}} - -#endif \ No newline at end of file diff --git a/server/utils/runnable.h b/server/utils/runnable.h deleted file mode 100644 index 935cf3564..000000000 --- a/server/utils/runnable.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -* copyright (c) 2010 Sveriges Television AB -* -* This file is part of CasparCG. -* -* CasparCG 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, either version 3 of the License, or -* (at your option) any later version. -* -* CasparCG 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. - -* You should have received a copy of the GNU General Public License -* along with CasparCG. If not, see . -* -*/ - -#ifndef _CASPAR_RUNNABLE_H__ -#define _CASPAR_RUNNABLE_H__ - -#pragma once - -namespace caspar { -namespace utils { - -class IRunnable -{ -public: - virtual ~IRunnable() {} - virtual void Run(HANDLE stopEvent) = 0; - virtual bool OnUnhandledException(const std::exception&) throw() = 0; -}; - -typedef std::tr1::shared_ptr RunnablePtr; - -} //namespace utils -} //namespace caspar - -#endif //_CASPAR_RUNNABLE_H__ \ No newline at end of file diff --git a/server/utils/scope_exit.h b/server/utils/scope_exit.h deleted file mode 100644 index 24de34e76..000000000 --- a/server/utils/scope_exit.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef _CASPAR_SCOPE_EXIT_H_ -#define _CASPAR_SCOPE_EXIT_H_ - -#include -#include -#include "Noncopyable.hpp" - -namespace caspar -{ - namespace utils - { - class scope_exit - { - scope_exit( const scope_exit& ); - const scope_exit& operator=( const scope_exit& ); - public: - - template - explicit scope_exit(T& obj, const F& func) : exitScope_(std::bind(func, obj)) - {} - - explicit scope_exit(std::function&& exitScope) : exitScope_(std::move(exitScope)) - {} - - ~scope_exit() - { - exitScope_(); - } - - private: - std::function exitScope_; - }; - - } -} - -#define _CASPAR_EXIT_SCOPE_LINENAME_CAT(name, line) name##line -#define _CASPAR_EXIT_SCOPE_LINENAME(name, line) _CASPAR_EXIT_SCOPE_LINENAME_CAT(name, line) -#define CASPAR_SCOPE_EXIT caspar::utils::scope_exit _CASPAR_EXIT_SCOPE_LINENAME(EXIT, __LINE__) - -#endif \ No newline at end of file -- 2.39.5