diff --git a/apps/DeckLinkRenderCadenceProbe/DeckLinkRenderCadenceProbe.cpp b/apps/DeckLinkRenderCadenceProbe/DeckLinkRenderCadenceProbe.cpp deleted file mode 100644 index 2942e31..0000000 --- a/apps/DeckLinkRenderCadenceProbe/DeckLinkRenderCadenceProbe.cpp +++ /dev/null @@ -1,920 +0,0 @@ -#include "DeckLinkSession.h" -#include "GLExtensions.h" -#include "VideoIOFormat.h" -#include "VideoPlayoutPolicy.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace -{ -constexpr unsigned kDefaultWidth = 1920; -constexpr unsigned kDefaultHeight = 1080; -constexpr std::size_t kSystemFrameSlots = 12; -constexpr std::size_t kPboDepth = 6; -constexpr std::size_t kWarmupFrames = 4; -constexpr std::size_t kDeckLinkTargetBufferedFrames = 4; - -enum class ProbeSlotState -{ - Free, - Rendering, - Completed, - Scheduled -}; - -struct ProbeFrame -{ - void* bytes = nullptr; - long rowBytes = 0; - unsigned width = 0; - unsigned height = 0; - VideoIOPixelFormat pixelFormat = VideoIOPixelFormat::Bgra8; - std::size_t index = 0; - uint64_t generation = 0; - uint64_t frameIndex = 0; -}; - -struct ProbeMetrics -{ - uint64_t renderedFrames = 0; - uint64_t completedFrames = 0; - uint64_t scheduledFrames = 0; - uint64_t completedDrops = 0; - uint64_t acquireMisses = 0; - uint64_t scheduleUnderruns = 0; - uint64_t pboQueueMisses = 0; - std::size_t freeCount = 0; - std::size_t renderingCount = 0; - std::size_t completedCount = 0; - std::size_t scheduledCount = 0; -}; - -class LatestFrameStore -{ -public: - LatestFrameStore(unsigned width, unsigned height, std::size_t capacity) : - mWidth(width), - mHeight(height), - mRowBytes(VideoIORowBytes(VideoIOPixelFormat::Bgra8, width)) - { - mSlots.resize(capacity); - const std::size_t byteCount = static_cast(mRowBytes) * static_cast(mHeight); - for (Slot& slot : mSlots) - { - slot.bytes.resize(byteCount); - slot.generation = 1; - } - } - - bool AcquireForRender(ProbeFrame& frame) - { - std::lock_guard lock(mMutex); - if (!AcquireFreeLocked(frame)) - { - if (!DropOldestCompletedLocked() || !AcquireFreeLocked(frame)) - { - ++mMetrics.acquireMisses; - return false; - } - } - return true; - } - - bool PublishCompleted(const ProbeFrame& frame) - { - std::lock_guard lock(mMutex); - if (!IsValidLocked(frame)) - return false; - Slot& slot = mSlots[frame.index]; - if (slot.state != ProbeSlotState::Rendering) - return false; - slot.state = ProbeSlotState::Completed; - slot.frameIndex = frame.frameIndex; - mCompletedIndices.push_back(frame.index); - ++mMetrics.completedFrames; - mCondition.notify_all(); - return true; - } - - bool ConsumeCompleted(ProbeFrame& frame) - { - std::lock_guard lock(mMutex); - while (!mCompletedIndices.empty()) - { - const std::size_t index = mCompletedIndices.front(); - mCompletedIndices.pop_front(); - if (index >= mSlots.size() || mSlots[index].state != ProbeSlotState::Completed) - continue; - mSlots[index].state = ProbeSlotState::Scheduled; - FillFrameLocked(index, frame); - ++mMetrics.scheduledFrames; - return true; - } - ++mMetrics.scheduleUnderruns; - return false; - } - - bool ReleaseByBytes(void* bytes) - { - if (bytes == nullptr) - return false; - std::lock_guard lock(mMutex); - for (std::size_t index = 0; index < mSlots.size(); ++index) - { - if (mSlots[index].bytes.data() != bytes) - continue; - mSlots[index].state = ProbeSlotState::Free; - ++mSlots[index].generation; - RemoveCompletedIndexLocked(index); - mCondition.notify_all(); - return true; - } - return false; - } - - bool WaitForCompletedDepth(std::size_t targetDepth, std::chrono::milliseconds timeout) - { - std::unique_lock lock(mMutex); - return mCondition.wait_for(lock, timeout, [&]() { - return CompletedCountLocked() >= targetDepth; - }); - } - - ProbeMetrics Metrics() const - { - std::lock_guard lock(mMutex); - ProbeMetrics metrics = mMetrics; - for (const Slot& slot : mSlots) - { - switch (slot.state) - { - case ProbeSlotState::Free: - ++metrics.freeCount; - break; - case ProbeSlotState::Rendering: - ++metrics.renderingCount; - break; - case ProbeSlotState::Completed: - ++metrics.completedCount; - break; - case ProbeSlotState::Scheduled: - ++metrics.scheduledCount; - break; - } - } - return metrics; - } - - void CountRenderedFrame() - { - std::lock_guard lock(mMutex); - ++mMetrics.renderedFrames; - } - - void CountPboQueueMiss() - { - std::lock_guard lock(mMutex); - ++mMetrics.pboQueueMisses; - } - -private: - struct Slot - { - std::vector bytes; - ProbeSlotState state = ProbeSlotState::Free; - uint64_t generation = 1; - uint64_t frameIndex = 0; - }; - - bool AcquireFreeLocked(ProbeFrame& frame) - { - for (std::size_t index = 0; index < mSlots.size(); ++index) - { - if (mSlots[index].state != ProbeSlotState::Free) - continue; - mSlots[index].state = ProbeSlotState::Rendering; - ++mSlots[index].generation; - FillFrameLocked(index, frame); - return true; - } - return false; - } - - bool DropOldestCompletedLocked() - { - while (!mCompletedIndices.empty()) - { - const std::size_t index = mCompletedIndices.front(); - mCompletedIndices.pop_front(); - if (index >= mSlots.size() || mSlots[index].state != ProbeSlotState::Completed) - continue; - mSlots[index].state = ProbeSlotState::Free; - ++mSlots[index].generation; - ++mMetrics.completedDrops; - return true; - } - return false; - } - - void FillFrameLocked(std::size_t index, ProbeFrame& frame) const - { - const Slot& slot = mSlots[index]; - frame.bytes = const_cast(slot.bytes.data()); - frame.rowBytes = static_cast(mRowBytes); - frame.width = mWidth; - frame.height = mHeight; - frame.pixelFormat = VideoIOPixelFormat::Bgra8; - frame.index = index; - frame.generation = slot.generation; - frame.frameIndex = slot.frameIndex; - } - - bool IsValidLocked(const ProbeFrame& frame) const - { - return frame.index < mSlots.size() && mSlots[frame.index].generation == frame.generation; - } - - void RemoveCompletedIndexLocked(std::size_t index) - { - mCompletedIndices.erase(std::remove(mCompletedIndices.begin(), mCompletedIndices.end(), index), mCompletedIndices.end()); - } - - std::size_t CompletedCountLocked() const - { - std::size_t count = 0; - for (const Slot& slot : mSlots) - { - if (slot.state == ProbeSlotState::Completed) - ++count; - } - return count; - } - - unsigned mWidth = 0; - unsigned mHeight = 0; - unsigned mRowBytes = 0; - std::vector mSlots; - std::deque mCompletedIndices; - mutable std::mutex mMutex; - std::condition_variable mCondition; - ProbeMetrics mMetrics; -}; - -LRESULT CALLBACK ProbeWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - return DefWindowProc(hwnd, message, wParam, lParam); -} - -class HiddenOpenGLContext -{ -public: - ~HiddenOpenGLContext() - { - Destroy(); - } - - bool Create(unsigned width, unsigned height, std::string& error) - { - mInstance = GetModuleHandle(nullptr); - WNDCLASSA wc = {}; - wc.style = CS_OWNDC; - wc.lpfnWndProc = ProbeWindowProc; - wc.hInstance = mInstance; - wc.lpszClassName = "DeckLinkRenderCadenceProbeWindow"; - RegisterClassA(&wc); - - mWindow = CreateWindowA( - wc.lpszClassName, - "DeckLink Render Cadence Probe", - WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, - CW_USEDEFAULT, - static_cast(width), - static_cast(height), - nullptr, - nullptr, - mInstance, - nullptr); - if (!mWindow) - { - error = "CreateWindowA failed."; - return false; - } - - mDc = GetDC(mWindow); - if (!mDc) - { - error = "GetDC failed."; - return false; - } - - PIXELFORMATDESCRIPTOR pfd = {}; - pfd.nSize = sizeof(pfd); - pfd.nVersion = 1; - pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; - pfd.iPixelType = PFD_TYPE_RGBA; - pfd.cColorBits = 32; - pfd.cDepthBits = 0; - pfd.iLayerType = PFD_MAIN_PLANE; - - const int pixelFormat = ChoosePixelFormat(mDc, &pfd); - if (pixelFormat == 0 || !SetPixelFormat(mDc, pixelFormat, &pfd)) - { - error = "Could not choose/set a pixel format."; - return false; - } - - mGlrc = wglCreateContext(mDc); - if (!mGlrc) - { - error = "wglCreateContext failed."; - return false; - } - return true; - } - - bool MakeCurrent() - { - return mDc && mGlrc && wglMakeCurrent(mDc, mGlrc); - } - - void ClearCurrent() - { - wglMakeCurrent(nullptr, nullptr); - } - - void Destroy() - { - ClearCurrent(); - if (mGlrc) - { - wglDeleteContext(mGlrc); - mGlrc = nullptr; - } - if (mWindow && mDc) - { - ReleaseDC(mWindow, mDc); - mDc = nullptr; - } - if (mWindow) - { - DestroyWindow(mWindow); - mWindow = nullptr; - } - } - -private: - HINSTANCE mInstance = nullptr; - HWND mWindow = nullptr; - HDC mDc = nullptr; - HGLRC mGlrc = nullptr; -}; - -class RenderCadenceProbe -{ -public: - RenderCadenceProbe(LatestFrameStore& frameStore, unsigned width, unsigned height, double frameDurationMs) : - mFrameStore(frameStore), - mWidth(width), - mHeight(height), - mFrameDuration(std::chrono::duration_cast(std::chrono::duration(frameDurationMs))) - { - if (mFrameDuration <= Clock::duration::zero()) - mFrameDuration = std::chrono::milliseconds(16); - } - - bool Start(std::string& error) - { - mStopping = false; - mThread = std::thread([this]() { ThreadMain(); }); - std::unique_lock lock(mStartupMutex); - if (!mStartupCondition.wait_for(lock, std::chrono::seconds(3), [this]() { return mStarted || !mStartupError.empty(); })) - { - error = "Timed out starting render thread."; - return false; - } - if (!mStartupError.empty()) - { - error = mStartupError; - return false; - } - return true; - } - - void Stop() - { - mStopping = true; - if (mThread.joinable()) - mThread.join(); - } - -private: - struct PboSlot - { - GLuint pbo = 0; - GLsync fence = nullptr; - bool inFlight = false; - uint64_t frameIndex = 0; - }; - - using Clock = std::chrono::steady_clock; - - void ThreadMain() - { - std::string error; - HiddenOpenGLContext context; - if (!context.Create(mWidth, mHeight, error) || !context.MakeCurrent()) - { - SignalStartupFailure(error.empty() ? "OpenGL context creation failed." : error); - return; - } - if (!ResolveGLExtensions()) - { - SignalStartupFailure("OpenGL extension resolution failed."); - return; - } - if (!CreateRenderTargets()) - { - SignalStartupFailure("OpenGL render target creation failed."); - return; - } - CreatePbos(); - SignalStarted(); - - auto nextRenderTime = Clock::now(); - while (!mStopping) - { - ConsumeCompletedPbos(); - - const auto now = Clock::now(); - if (now < nextRenderTime) - { - std::this_thread::sleep_for((std::min)(std::chrono::milliseconds(1), std::chrono::duration_cast(nextRenderTime - now))); - continue; - } - - RenderPattern(mFrameIndex); - if (!QueueReadback(mFrameIndex)) - mFrameStore.CountPboQueueMiss(); - mFrameStore.CountRenderedFrame(); - ++mFrameIndex; - nextRenderTime += mFrameDuration; - if (Clock::now() - nextRenderTime > mFrameDuration * 4) - nextRenderTime = Clock::now() + mFrameDuration; - } - - FlushPbos(); - DestroyPbos(); - DestroyRenderTargets(); - context.ClearCurrent(); - } - - bool CreateRenderTargets() - { - glGenFramebuffers(1, &mFramebuffer); - glBindFramebuffer(GL_FRAMEBUFFER, mFramebuffer); - glGenTextures(1, &mTexture); - glBindTexture(GL_TEXTURE_2D, mTexture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, static_cast(mWidth), static_cast(mHeight), 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, nullptr); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTexture, 0); - const bool complete = glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE; - glBindTexture(GL_TEXTURE_2D, 0); - glBindFramebuffer(GL_FRAMEBUFFER, 0); - return complete; - } - - void DestroyRenderTargets() - { - if (mFramebuffer != 0) - glDeleteFramebuffers(1, &mFramebuffer); - if (mTexture != 0) - glDeleteTextures(1, &mTexture); - mFramebuffer = 0; - mTexture = 0; - } - - void CreatePbos() - { - mPbos.resize(kPboDepth); - const std::size_t byteCount = static_cast(VideoIORowBytes(VideoIOPixelFormat::Bgra8, mWidth)) * mHeight; - for (PboSlot& slot : mPbos) - { - glGenBuffers(1, &slot.pbo); - glBindBuffer(GL_PIXEL_PACK_BUFFER, slot.pbo); - glBufferData(GL_PIXEL_PACK_BUFFER, static_cast(byteCount), nullptr, GL_STREAM_READ); - } - glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); - } - - void DestroyPbos() - { - for (PboSlot& slot : mPbos) - { - if (slot.fence) - glDeleteSync(slot.fence); - if (slot.pbo != 0) - glDeleteBuffers(1, &slot.pbo); - slot = {}; - } - mPbos.clear(); - } - - void FlushPbos() - { - for (std::size_t i = 0; i < mPbos.size() * 2; ++i) - ConsumeCompletedPbos(); - } - - void RenderPattern(uint64_t frameIndex) - { - const float t = static_cast(frameIndex) / 60.0f; - const float red = 0.1f + 0.4f * (0.5f + 0.5f * std::sin(t)); - const float green = 0.1f + 0.4f * (0.5f + 0.5f * std::sin(t * 0.73f + 1.0f)); - const float blue = 0.15f + 0.3f * (0.5f + 0.5f * std::sin(t * 0.41f + 2.0f)); - - glBindFramebuffer(GL_FRAMEBUFFER, mFramebuffer); - glViewport(0, 0, static_cast(mWidth), static_cast(mHeight)); - glDisable(GL_SCISSOR_TEST); - glClearColor(red, green, blue, 1.0f); - glClear(GL_COLOR_BUFFER_BIT); - - const int boxWidth = static_cast(mWidth / 6); - const int boxHeight = static_cast(mHeight / 5); - const float phase = 0.5f + 0.5f * std::sin(t * 1.7f); - const int x = static_cast(phase * static_cast(mWidth - boxWidth)); - const int y = static_cast((0.5f + 0.5f * std::sin(t * 1.1f + 0.8f)) * static_cast(mHeight - boxHeight)); - - glEnable(GL_SCISSOR_TEST); - glScissor(x, y, boxWidth, boxHeight); - glClearColor(1.0f - red, 0.85f, 0.15f + blue, 1.0f); - glClear(GL_COLOR_BUFFER_BIT); - glDisable(GL_SCISSOR_TEST); - } - - bool QueueReadback(uint64_t frameIndex) - { - if (mPbos.empty()) - return false; - - PboSlot& slot = mPbos[mWriteIndex]; - if (slot.inFlight) - return false; - - const std::size_t byteCount = static_cast(VideoIORowBytes(VideoIOPixelFormat::Bgra8, mWidth)) * mHeight; - glBindFramebuffer(GL_READ_FRAMEBUFFER, mFramebuffer); - glPixelStorei(GL_PACK_ALIGNMENT, 4); - glPixelStorei(GL_PACK_ROW_LENGTH, 0); - glBindBuffer(GL_PIXEL_PACK_BUFFER, slot.pbo); - glBufferData(GL_PIXEL_PACK_BUFFER, static_cast(byteCount), nullptr, GL_STREAM_READ); - glReadPixels(0, 0, static_cast(mWidth), static_cast(mHeight), GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, nullptr); - slot.fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); - slot.inFlight = slot.fence != nullptr; - slot.frameIndex = frameIndex; - glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); - mWriteIndex = (mWriteIndex + 1) % mPbos.size(); - return slot.inFlight; - } - - void ConsumeCompletedPbos() - { - for (std::size_t checked = 0; checked < mPbos.size(); ++checked) - { - PboSlot& slot = mPbos[mReadIndex]; - if (!slot.inFlight || slot.fence == nullptr) - { - mReadIndex = (mReadIndex + 1) % mPbos.size(); - continue; - } - - const GLenum waitResult = glClientWaitSync(slot.fence, 0, 0); - if (waitResult != GL_ALREADY_SIGNALED && waitResult != GL_CONDITION_SATISFIED) - return; - - ProbeFrame frame; - if (mFrameStore.AcquireForRender(frame)) - { - glBindBuffer(GL_PIXEL_PACK_BUFFER, slot.pbo); - void* mapped = glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY); - if (mapped) - { - const std::size_t byteCount = static_cast(frame.rowBytes) * frame.height; - std::memcpy(frame.bytes, mapped, byteCount); - glUnmapBuffer(GL_PIXEL_PACK_BUFFER); - frame.frameIndex = slot.frameIndex; - mFrameStore.PublishCompleted(frame); - } - glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); - } - - glDeleteSync(slot.fence); - slot.fence = nullptr; - slot.inFlight = false; - mReadIndex = (mReadIndex + 1) % mPbos.size(); - } - } - - void SignalStarted() - { - std::lock_guard lock(mStartupMutex); - mStarted = true; - mStartupCondition.notify_all(); - } - - void SignalStartupFailure(const std::string& error) - { - std::lock_guard lock(mStartupMutex); - mStartupError = error; - mStartupCondition.notify_all(); - } - - LatestFrameStore& mFrameStore; - unsigned mWidth = 0; - unsigned mHeight = 0; - Clock::duration mFrameDuration; - std::thread mThread; - std::atomic mStopping{ false }; - std::mutex mStartupMutex; - std::condition_variable mStartupCondition; - bool mStarted = false; - std::string mStartupError; - GLuint mFramebuffer = 0; - GLuint mTexture = 0; - std::vector mPbos; - std::size_t mWriteIndex = 0; - std::size_t mReadIndex = 0; - uint64_t mFrameIndex = 0; -}; - -class DeckLinkProbePlayout -{ -public: - DeckLinkProbePlayout(DeckLinkSession& session, LatestFrameStore& frameStore) : - mSession(session), - mFrameStore(frameStore) - { - } - - bool Start() - { - mStopping = false; - mThread = std::thread([this]() { ThreadMain(); }); - return true; - } - - void Stop() - { - mStopping = true; - if (mThread.joinable()) - mThread.join(); - } - - void ThreadMain() - { - while (!mStopping) - { - const ProbeMetrics metrics = mFrameStore.Metrics(); - if (metrics.scheduledCount >= kDeckLinkTargetBufferedFrames) - { - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - continue; - } - - ProbeFrame frame; - if (!mFrameStore.ConsumeCompleted(frame)) - { - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - continue; - } - - VideoIOOutputFrame outputFrame; - outputFrame.bytes = frame.bytes; - outputFrame.nativeBuffer = frame.bytes; - outputFrame.rowBytes = frame.rowBytes; - outputFrame.width = frame.width; - outputFrame.height = frame.height; - outputFrame.pixelFormat = frame.pixelFormat; - - if (!mSession.ScheduleOutputFrame(outputFrame)) - { - mFrameStore.ReleaseByBytes(frame.bytes); - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - } - } - } - -private: - DeckLinkSession& mSession; - LatestFrameStore& mFrameStore; - std::thread mThread; - std::atomic mStopping{ false }; -}; - -std::string CompletionResultToString(VideoIOCompletionResult result) -{ - switch (result) - { - case VideoIOCompletionResult::Completed: - return "completed"; - case VideoIOCompletionResult::DisplayedLate: - return "late"; - case VideoIOCompletionResult::Dropped: - return "dropped"; - case VideoIOCompletionResult::Flushed: - return "flushed"; - case VideoIOCompletionResult::Unknown: - default: - return "unknown"; - } -} - -void PrintUsage() -{ - std::cout << "DeckLinkRenderCadenceProbe\n" - << " Renders a simple OpenGL BGRA8 motion pattern on one GL thread,\n" - << " copies completed PBO readbacks into latest-N system memory slots,\n" - << " warms up rendered frames, then feeds DeckLink scheduled playback.\n\n" - << "Press Enter to stop.\n"; -} - -class ComInitGuard -{ -public: - ~ComInitGuard() - { - if (mInitialized) - CoUninitialize(); - } - - bool Initialize() - { - const HRESULT result = CoInitialize(nullptr); - mInitialized = SUCCEEDED(result); - mResult = result; - return mInitialized; - } - - HRESULT Result() const { return mResult; } - -private: - bool mInitialized = false; - HRESULT mResult = S_OK; -}; -} - -int main() -{ - PrintUsage(); - - ComInitGuard com; - if (!com.Initialize()) - { - std::cerr << "COM initialization failed: 0x" << std::hex << com.Result() << std::dec << "\n"; - return 1; - } - - LatestFrameStore frameStore(kDefaultWidth, kDefaultHeight, kSystemFrameSlots); - DeckLinkSession deckLink; - std::atomic completions{ 0 }; - std::atomic late{ 0 }; - std::atomic dropped{ 0 }; - - VideoFormatSelection formats; - std::string error; - if (!deckLink.DiscoverDevicesAndModes(formats, error)) - { - std::cerr << "DeckLink discovery failed: " << error << "\n"; - return 1; - } - if (!deckLink.SelectPreferredFormats(formats, false, error)) - { - std::cerr << "DeckLink format selection failed: " << error << "\n"; - return 1; - } - if (!deckLink.ConfigureOutput( - [&](const VideoIOCompletion& completion) { - frameStore.ReleaseByBytes(completion.outputFrameBuffer); - ++completions; - if (completion.result == VideoIOCompletionResult::DisplayedLate) - ++late; - else if (completion.result == VideoIOCompletionResult::Dropped) - ++dropped; - }, - formats.output, - false, - error)) - { - std::cerr << "DeckLink output configuration failed: " << error << "\n"; - return 1; - } - if (!deckLink.PrepareOutputSchedule()) - { - std::cerr << "DeckLink schedule preparation failed.\n"; - return 1; - } - - const VideoIOState& state = deckLink.State(); - if (state.outputFrameSize.width != kDefaultWidth || state.outputFrameSize.height != kDefaultHeight) - { - std::cerr << "This probe currently expects 1920x1080 output. Selected mode is " - << state.outputFrameSize.width << "x" << state.outputFrameSize.height << ".\n"; - return 1; - } - - RenderCadenceProbe renderer(frameStore, state.outputFrameSize.width, state.outputFrameSize.height, state.frameBudgetMilliseconds); - if (!renderer.Start(error)) - { - std::cerr << "Render thread start failed: " << error << "\n"; - return 1; - } - - std::cout << "Warming up " << kWarmupFrames << " rendered frames at cadence...\n"; - if (!frameStore.WaitForCompletedDepth(kWarmupFrames, std::chrono::seconds(3))) - { - std::cerr << "Timed out waiting for rendered warmup frames.\n"; - renderer.Stop(); - return 1; - } - - DeckLinkProbePlayout playout(deckLink, frameStore); - playout.Start(); - - const auto prerollDeadline = std::chrono::steady_clock::now() + std::chrono::seconds(3); - while (std::chrono::steady_clock::now() < prerollDeadline) - { - if (frameStore.Metrics().scheduledCount >= kDeckLinkTargetBufferedFrames) - break; - std::this_thread::sleep_for(std::chrono::milliseconds(2)); - } - - if (!deckLink.StartScheduledPlayback()) - { - std::cerr << "DeckLink scheduled playback failed to start.\n"; - playout.Stop(); - renderer.Stop(); - return 1; - } - - std::atomic metricsStopping{ false }; - std::thread metricsThread([&]() { - uint64_t lastRendered = 0; - uint64_t lastScheduled = 0; - auto lastTime = std::chrono::steady_clock::now(); - while (!metricsStopping) - { - std::this_thread::sleep_for(std::chrono::seconds(1)); - const auto now = std::chrono::steady_clock::now(); - const double seconds = std::chrono::duration_cast>(now - lastTime).count(); - const ProbeMetrics metrics = frameStore.Metrics(); - const double renderFps = seconds > 0.0 ? static_cast(metrics.renderedFrames - lastRendered) / seconds : 0.0; - const double scheduleFps = seconds > 0.0 ? static_cast(metrics.scheduledFrames - lastScheduled) / seconds : 0.0; - lastRendered = metrics.renderedFrames; - lastScheduled = metrics.scheduledFrames; - lastTime = now; - - std::cout << std::fixed << std::setprecision(1) - << "renderFps=" << renderFps - << " scheduleFps=" << scheduleFps - << " free=" << metrics.freeCount - << " completed=" << metrics.completedCount - << " scheduled=" << metrics.scheduledCount - << " drops=" << metrics.completedDrops - << " pboMiss=" << metrics.pboQueueMisses - << " completions=" << completions.load() - << " late=" << late.load() - << " dropped=" << dropped.load() - << " decklinkBuffered=" << deckLink.State().actualDeckLinkBufferedFrames - << "\n"; - } - }); - - std::string line; - std::getline(std::cin, line); - - metricsStopping = true; - if (metricsThread.joinable()) - metricsThread.join(); - playout.Stop(); - deckLink.Stop(); - renderer.Stop(); - deckLink.ReleaseResources(); - return 0; -} diff --git a/apps/DeckLinkRenderCadenceProbe/README.md b/apps/DeckLinkRenderCadenceProbe/README.md deleted file mode 100644 index 6823074..0000000 --- a/apps/DeckLinkRenderCadenceProbe/README.md +++ /dev/null @@ -1,113 +0,0 @@ -# DeckLink Render Cadence Probe - -This is a deliberately small architecture probe for the Phase 7.7 playout model. - -It is not the main app and does not use the main runtime, shader stack, preview path, input upload path, or render engine. - -## What It Tests - -The probe validates the clean playout spine: - -```text -single OpenGL render thread - owns its own hidden GL context - renders a simple moving BGRA8 pattern at output cadence - queues GPU readback through a PBO ring - copies completed readbacks into latest-N system-memory slots - -system-memory frame store - owns free / rendering / completed / scheduled slots - drops old completed unscheduled frames when render cadence needs space - protects scheduled frames until DeckLink completion - -DeckLink playout thread - consumes completed system-memory frames - keeps a small scheduled buffer filled - does not render -``` - -Startup warms up rendered frames before starting DeckLink scheduled playback. - -## How To Build - -```powershell -cmake --build --preset build-debug --target DeckLinkRenderCadenceProbe -- /m:1 -``` - -The executable is: - -```text -build\vs2022-x64-debug\Debug\DeckLinkRenderCadenceProbe.exe -``` - -## How To Run - -Run it from a terminal so you can see the telemetry: - -```powershell -build\vs2022-x64-debug\Debug\DeckLinkRenderCadenceProbe.exe -``` - -Press Enter to stop. - -The first version assumes `1080p59.94` / `1920x1080` output and BGRA8 system-memory frames. - -## What To Watch - -The probe prints one line per second: - -- `renderFps`: cadence render throughput -- `scheduleFps`: DeckLink scheduling throughput -- `free`: free system-memory slots -- `completed`: rendered, unscheduled slots -- `scheduled`: slots currently owned by DeckLink -- `drops`: old completed unscheduled frames recycled by the latest-N cache -- `pboMiss`: PBO ring was full when trying to queue readback -- `late`: DeckLink displayed-late completions -- `dropped`: DeckLink dropped completions -- `decklinkBuffered`: actual DeckLink buffered-frame count when available - -For a healthy architecture proof, expect: - -- `renderFps` close to the selected output cadence -- `scheduleFps` close to the selected output cadence after warmup -- `scheduled` hovering near the target buffer depth -- `late` and `dropped` not increasing continuously -- visible motion that is smooth on the DeckLink output - -## Interpretation - -If this probe is smooth at 59.94/60, the broad architecture is viable and the main app's remaining stutters are likely caused by integration details such as input upload, shared render-thread work, preview/screenshot work, or runtime/render-state coupling. - -If this probe is not smooth, the problem is lower level: DeckLink scheduling, OpenGL readback, Windows scheduling, or hardware/driver behavior. - -## Initial Result - -Date: 2026-05-12 - -User-visible result: - -- output looked smooth - -Representative telemetry: - -```text -renderFps=59.9 scheduleFps=59.9 free=7 completed=1 scheduled=4 drops=0 pboMiss=0 completions=119 late=0 dropped=0 decklinkBuffered=4 -renderFps=59.9 scheduleFps=59.9 free=7 completed=1 scheduled=4 drops=0 pboMiss=0 completions=179 late=0 dropped=0 decklinkBuffered=4 -renderFps=59.8 scheduleFps=59.8 free=7 completed=1 scheduled=4 drops=0 pboMiss=0 completions=239 late=0 dropped=0 decklinkBuffered=4 -renderFps=60.8 scheduleFps=59.8 free=7 completed=1 scheduled=4 drops=0 pboMiss=0 completions=299 late=0 dropped=0 decklinkBuffered=4 -renderFps=59.9 scheduleFps=59.9 free=7 completed=1 scheduled=4 drops=0 pboMiss=0 completions=360 late=0 dropped=0 decklinkBuffered=4 -renderFps=59.8 scheduleFps=60.8 free=8 completed=0 scheduled=4 drops=0 pboMiss=0 completions=420 late=0 dropped=0 decklinkBuffered=4 -``` - -Read: - -- the clean architecture can sustain the selected output cadence on the test machine -- BGRA8 PBO readback is viable when isolated from the main app's other render-thread work -- latest-N system-memory buffering stayed stable -- DeckLink actual buffered depth stayed at 4 -- there were no late frames, dropped frames, completed-frame drops, or PBO misses in the sampled output - -Implication: - -The main app's remaining stutters are likely integration/ownership issues rather than a fundamental DeckLink/OpenGL/BGRA8 readback limit. The highest-value suspects are input upload before output render, shared render-thread queue contention, preview/screenshot work, and runtime/render-state work on the output path. diff --git a/apps/LoopThroughWithOpenGLCompositing/LoopThroughWithOpenGLCompositing.cpp b/apps/LoopThroughWithOpenGLCompositing/LoopThroughWithOpenGLCompositing.cpp deleted file mode 100644 index fa9484c..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/LoopThroughWithOpenGLCompositing.cpp +++ /dev/null @@ -1,542 +0,0 @@ -#include "stdafx.h" -#include "resource.h" -#include "OpenGLComposite.h" - -#include -#include -#include - -#ifndef WGL_CONTEXT_MAJOR_VERSION_ARB -#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 -#endif -#ifndef WGL_CONTEXT_MINOR_VERSION_ARB -#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 -#endif -#ifndef WGL_CONTEXT_PROFILE_MASK_ARB -#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 -#endif -#ifndef WGL_CONTEXT_CORE_PROFILE_BIT_ARB -#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 -#endif - -#define MAX_LOADSTRING 100 - -// Declaration for Window procedure -LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); -typedef HGLRC (WINAPI* PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC hdc, HGLRC hShareContext, const int* attribList); - -namespace -{ -const int kStatusPanelWidth = 680; -const int kStatusPanelHeight = 92; -const int kStatusPadding = 8; -const int kStatusLabelWidth = 58; -const int kStatusButtonWidth = 86; -const int kStatusRowHeight = 24; -const int kStatusGap = 6; -const UINT kCreateStatusStripMessage = WM_APP + 1; - -enum StatusControlId -{ - kControlUrlEditId = 2001, - kDocsUrlEditId = 2002, - kOscAddressEditId = 2003, - kOpenControlButtonId = 2004, - kOpenDocsButtonId = 2005 -}; - -struct StatusStripControls -{ - HWND panel = NULL; - HWND controlLabel = NULL; - HWND controlUrl = NULL; - HWND openControl = NULL; - HWND docsLabel = NULL; - HWND docsUrl = NULL; - HWND openDocs = NULL; - HWND oscLabel = NULL; - HWND oscAddress = NULL; -}; - -bool StatusStripCreated(const StatusStripControls& controls) -{ - return controls.panel != NULL; -} - -HWND CreateStatusChild(HWND parent, const char* className, const char* text, DWORD style, DWORD exStyle, int controlId) -{ - return CreateWindowExA( - exStyle, - className, - text, - WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | style, - 0, - 0, - 0, - 0, - parent, - reinterpret_cast(static_cast(controlId)), - reinterpret_cast(GetWindowLongPtr(parent, GWLP_HINSTANCE)), - NULL); -} - -void CreateStatusStrip(HWND hWnd, StatusStripControls& controls) -{ - controls.panel = CreateStatusChild(hWnd, "STATIC", "", SS_LEFT, WS_EX_CLIENTEDGE, 0); - controls.controlLabel = CreateStatusChild(hWnd, "STATIC", "Control", SS_LEFT, 0, 0); - controls.controlUrl = CreateStatusChild(hWnd, "EDIT", "", ES_AUTOHSCROLL | ES_READONLY | WS_TABSTOP, WS_EX_CLIENTEDGE, kControlUrlEditId); - controls.openControl = CreateStatusChild(hWnd, "BUTTON", "Open", BS_PUSHBUTTON | WS_TABSTOP, 0, kOpenControlButtonId); - controls.docsLabel = CreateStatusChild(hWnd, "STATIC", "Docs", SS_LEFT, 0, 0); - controls.docsUrl = CreateStatusChild(hWnd, "EDIT", "", ES_AUTOHSCROLL | ES_READONLY | WS_TABSTOP, WS_EX_CLIENTEDGE, kDocsUrlEditId); - controls.openDocs = CreateStatusChild(hWnd, "BUTTON", "Open", BS_PUSHBUTTON | WS_TABSTOP, 0, kOpenDocsButtonId); - controls.oscLabel = CreateStatusChild(hWnd, "STATIC", "OSC", SS_LEFT, 0, 0); - controls.oscAddress = CreateStatusChild(hWnd, "EDIT", "", ES_AUTOHSCROLL | ES_READONLY | WS_TABSTOP, WS_EX_CLIENTEDGE, kOscAddressEditId); - - HFONT guiFont = reinterpret_cast(GetStockObject(DEFAULT_GUI_FONT)); - HWND children[] = { - controls.controlLabel, - controls.controlUrl, - controls.openControl, - controls.docsLabel, - controls.docsUrl, - controls.openDocs, - controls.oscLabel, - controls.oscAddress - }; - for (HWND child : children) - { - if (child) - SendMessage(child, WM_SETFONT, reinterpret_cast(guiFont), TRUE); - } - - SetWindowTextA(controls.controlUrl, "Starting control server..."); - SetWindowTextA(controls.docsUrl, "Starting API docs..."); - SetWindowTextA(controls.oscAddress, "Starting OSC listener..."); -} - -void RaiseStatusControls(const StatusStripControls& controls) -{ - if (!StatusStripCreated(controls)) - return; - - SetWindowPos(controls.panel, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - - HWND interactiveControls[] = { - controls.controlLabel, - controls.controlUrl, - controls.openControl, - controls.docsLabel, - controls.docsUrl, - controls.openDocs, - controls.oscLabel, - controls.oscAddress - }; - for (HWND control : interactiveControls) - { - if (control) - SetWindowPos(control, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - } -} - -void LayoutStatusStrip(HWND hWnd, const StatusStripControls& controls) -{ - RECT clientRect = {}; - if (!GetClientRect(hWnd, &clientRect) || !controls.panel) - return; - - const int clientWidth = static_cast(clientRect.right - clientRect.left); - const int clientHeight = static_cast(clientRect.bottom - clientRect.top); - const int panelWidth = std::max(280, std::min(kStatusPanelWidth, clientWidth - (kStatusPadding * 2))); - const int panelHeight = kStatusPanelHeight; - const int panelLeft = kStatusPadding; - const int panelTop = std::max(kStatusPadding, clientHeight - panelHeight - kStatusPadding); - MoveWindow(controls.panel, panelLeft, panelTop, panelWidth, panelHeight, TRUE); - - const int rowX = panelLeft + kStatusPadding; - const int editX = rowX + kStatusLabelWidth + kStatusGap; - const int buttonX = panelLeft + panelWidth - kStatusPadding - kStatusButtonWidth; - const int editWidth = std::max(80, buttonX - editX - kStatusGap); - const int oscWidth = std::max(80, panelLeft + panelWidth - editX - kStatusPadding); - const int row1 = panelTop + kStatusPadding; - const int row2 = row1 + kStatusRowHeight + kStatusGap; - const int row3 = row2 + kStatusRowHeight + kStatusGap; - - MoveWindow(controls.controlLabel, rowX, row1 + 3, kStatusLabelWidth, kStatusRowHeight, TRUE); - MoveWindow(controls.controlUrl, editX, row1, editWidth, kStatusRowHeight, TRUE); - MoveWindow(controls.openControl, buttonX, row1, kStatusButtonWidth, kStatusRowHeight, TRUE); - MoveWindow(controls.docsLabel, rowX, row2 + 3, kStatusLabelWidth, kStatusRowHeight, TRUE); - MoveWindow(controls.docsUrl, editX, row2, editWidth, kStatusRowHeight, TRUE); - MoveWindow(controls.openDocs, buttonX, row2, kStatusButtonWidth, kStatusRowHeight, TRUE); - MoveWindow(controls.oscLabel, rowX, row3 + 3, kStatusLabelWidth, kStatusRowHeight, TRUE); - MoveWindow(controls.oscAddress, editX, row3, oscWidth, kStatusRowHeight, TRUE); - RaiseStatusControls(controls); -} - -void UpdateStatusStrip(const StatusStripControls& controls, const OpenGLComposite& composite) -{ - if (!StatusStripCreated(controls)) - return; - - SetWindowTextA(controls.controlUrl, composite.GetControlUrl().c_str()); - SetWindowTextA(controls.docsUrl, composite.GetDocsUrl().c_str()); - SetWindowTextA(controls.oscAddress, composite.GetOscAddress().c_str()); -} - -void OpenUrl(const char* url) -{ - ShellExecuteA(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL); -} -} - -void ShowUnhandledExceptionMessage(const char* prefix) -{ - try - { - throw; - } - catch (const std::exception& exception) - { - std::string message = std::string(prefix) + "\n\n" + exception.what(); - MessageBoxA(NULL, message.c_str(), "Unhandled exception", MB_OK | MB_ICONERROR); - } - catch (...) - { - MessageBoxA(NULL, prefix, "Unhandled exception", MB_OK | MB_ICONERROR); - } -} - -// Select the pixel format for a given device context -void SetDCPixelFormat(HDC hDC) -{ - int nPixelFormat; - - static PIXELFORMATDESCRIPTOR pfd = { - sizeof(PIXELFORMATDESCRIPTOR), // Size of this structure - 1, // Version of this structure - PFD_DRAW_TO_WINDOW | // Draw to Window (not to bitmap) - PFD_SUPPORT_OPENGL | // Support OpenGL calls in window - PFD_DOUBLEBUFFER, // Double buffered mode - PFD_TYPE_RGBA, // RGBA Color mode - 32, // Want 32 bit color - 0,0,0,0,0,0, // Not used to select mode - 0,0, // Not used to select mode - 0,0,0,0,0, // Not used to select mode - 16, // Size of depth buffer - 0, // Not used - 0, // Not used - 0, // Not used - 0, // Not used - 0,0,0 }; // Not used - - // Choose a pixel format that best matches that described in pfd - nPixelFormat = ChoosePixelFormat(hDC, &pfd); - - // Set the pixel format for the device context - SetPixelFormat(hDC, nPixelFormat, &pfd); -} - -HGLRC CreateModernOpenGLContext(HDC hDC) -{ - PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = - reinterpret_cast(wglGetProcAddress("wglCreateContextAttribsARB")); - if (!wglCreateContextAttribsARB) - return NULL; - - const int versionCandidates[][2] = - { - { 4, 5 }, - { 4, 3 }, - { 3, 3 } - }; - - for (const auto& version : versionCandidates) - { - const int attribs[] = - { - WGL_CONTEXT_MAJOR_VERSION_ARB, version[0], - WGL_CONTEXT_MINOR_VERSION_ARB, version[1], - WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB, - 0 - }; - - HGLRC modernContext = wglCreateContextAttribsARB(hDC, 0, attribs); - if (modernContext != NULL) - return modernContext; - } - - return NULL; -} - -int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) -{ - MSG msg; // Windows message structure - WNDCLASS wc; // Windows class structure - HWND hWnd; // Storeage for window handle - TCHAR szTitle[MAX_LOADSTRING]; // The title bar text - TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name - - // Initialize global strings - LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); - LoadString(hInstance, IDC_OPENGLOUTPUT, szWindowClass, MAX_LOADSTRING); - - // Register Window style - wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; - wc.lpfnWndProc = (WNDPROC) WndProc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = hInstance; - wc.hIcon = NULL; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - - // No need for background brush for OpenGL window - wc.hbrBackground = NULL; - wc.lpszMenuName = NULL; - wc.lpszClassName = szWindowClass; - - // Register the window class - if (RegisterClass(&wc) == 0) - return FALSE; - - // Create the main application window - hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, - CW_USEDEFAULT, 0, 250, 250, NULL, NULL, hInstance, NULL); - - // If window was not created, quit - if (hWnd == NULL) - return FALSE; - - // Display the window - ShowWindow(hWnd,SW_SHOW); - UpdateWindow(hWnd); - - // Process application messages until the application closes - while (GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - return (int)msg.wParam; -} - -// Window procedure, handles all messages for this program -LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - static HGLRC hRC = NULL; // Permenant Rendering context - static HDC hDC = NULL; // Private GDI Device context - static OpenGLComposite* pOpenGLComposite = NULL; - static bool sInteractiveResize = false; - static StatusStripControls sStatusStrip; - - switch (message) - { - // Window creation, setup for OpenGL context - case WM_CREATE: - { - try - { - // Store the device context - hDC = GetDC(hWnd); - - // Select the pixel format - SetDCPixelFormat(hDC); - - // Create the rendering context and make it current - hRC = wglCreateContext(hDC); - wglMakeCurrent(hDC, hRC); - - HGLRC modernRC = CreateModernOpenGLContext(hDC); - if (modernRC == NULL) - { - MessageBox(NULL, _T("This application requires an OpenGL 3.3+ core profile context."), _T("OpenGL initialization Error."), MB_OK); - PostMessage(hWnd, WM_CLOSE, 0, 0); - break; - } - - wglMakeCurrent(NULL, NULL); - wglDeleteContext(hRC); - hRC = modernRC; - wglMakeCurrent(hDC, hRC); - - // Initialize COM - HRESULT result; - result = CoInitialize(NULL); - if (FAILED(result)) - { - MessageBox(NULL, _T("Initialization of COM failed."), _T("Application initialization Error."),MB_OK); - PostMessage(hWnd, WM_CLOSE, 0, 0); - break; - } - - // Setup OpenGL and DeckLink capture and playout object - pOpenGLComposite = new OpenGLComposite(hWnd, hDC, hRC); - - if (pOpenGLComposite->InitDeckLink()) - { - wglMakeCurrent( NULL, NULL ); - if (pOpenGLComposite->Start()) - { - PostMessage(hWnd, kCreateStatusStripMessage, 0, 0); - break; // success - } - MessageBoxA(NULL, "The OpenGL/DeckLink runtime initialized, but playout failed to start. See the previous DeckLink start message for the failing call.", "Startup failed", MB_OK | MB_ICONERROR); - } - else - { - MessageBoxA(NULL, "The OpenGL/DeckLink runtime failed to initialize. See the previous initialization message for the failing call.", "Startup failed", MB_OK | MB_ICONERROR); - } - - // Failed to initialize - cleanup - delete pOpenGLComposite; - pOpenGLComposite = NULL; - PostMessage(hWnd, WM_CLOSE, 0, 0); - break; - } - catch (...) - { - ShowUnhandledExceptionMessage("Startup failed while creating the OpenGL/DeckLink runtime."); - PostMessage(hWnd, WM_CLOSE, 0, 0); - break; - } - } - - case kCreateStatusStripMessage: - if (pOpenGLComposite) - { - if (!StatusStripCreated(sStatusStrip)) - CreateStatusStrip(hWnd, sStatusStrip); - - UpdateStatusStrip(sStatusStrip, *pOpenGLComposite); - LayoutStatusStrip(hWnd, sStatusStrip); - RECT clientRect = {}; - if (GetClientRect(hWnd, &clientRect)) - { - pOpenGLComposite->resizeGL( - static_cast(clientRect.right - clientRect.left), - static_cast(clientRect.bottom - clientRect.top)); - } - InvalidateRect(hWnd, NULL, FALSE); - } - break; - - case WM_DESTROY: - try - { - if (pOpenGLComposite) - { - pOpenGLComposite->Stop(); - delete pOpenGLComposite; - } - } - catch (...) - { - ShowUnhandledExceptionMessage("Shutdown failed while tearing down the OpenGL/DeckLink runtime."); - } - - // Deselect the current rendering context and delete it - wglMakeCurrent(NULL, NULL); - wglDeleteContext(hRC); - - // Tell the application to terminate after the window is gone - PostQuitMessage(0); - break; - - case WM_ENTERSIZEMOVE: - sInteractiveResize = true; - break; - - case WM_EXITSIZEMOVE: - sInteractiveResize = false; - if (pOpenGLComposite) - { - RECT clientRect = {}; - if (GetClientRect(hWnd, &clientRect)) - { - pOpenGLComposite->resizeGL( - static_cast(clientRect.right - clientRect.left), - static_cast(clientRect.bottom - clientRect.top)); - } - } - InvalidateRect(hWnd, NULL, FALSE); - break; - - case WM_SIZE: - try - { - if (StatusStripCreated(sStatusStrip)) - LayoutStatusStrip(hWnd, sStatusStrip); - if (pOpenGLComposite) - pOpenGLComposite->resizeGL(LOWORD(lParam), HIWORD(lParam)); - } - catch (...) - { - ShowUnhandledExceptionMessage("Resize failed inside the OpenGL runtime."); - } - break; - - case WM_ERASEBKGND: - return 1; - - case WM_PAINT: - try - { - PAINTSTRUCT paint = {}; - BeginPaint(hWnd, &paint); - EndPaint(hWnd, &paint); - - if (!sInteractiveResize && pOpenGLComposite) - { - pOpenGLComposite->paintGL(true); - RaiseStatusControls(sStatusStrip); - } - } - catch (...) - { - ShowUnhandledExceptionMessage("Paint failed inside the OpenGL runtime."); - } - break; - - case WM_KEYDOWN: - try - { - if (pOpenGLComposite && (wParam == 'R' || wParam == 'r')) - { - pOpenGLComposite->ReloadShader(); - InvalidateRect(hWnd, NULL, FALSE); - } - } - catch (...) - { - ShowUnhandledExceptionMessage("Shader reload failed inside the OpenGL runtime."); - } - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case kOpenControlButtonId: - if (pOpenGLComposite) - { - std::string url = pOpenGLComposite->GetControlUrl(); - OpenUrl(url.c_str()); - } - break; - case kOpenDocsButtonId: - if (pOpenGLComposite) - { - std::string url = pOpenGLComposite->GetDocsUrl(); - OpenUrl(url.c_str()); - } - break; - default: - return DefWindowProc(hWnd, message, wParam, lParam); - } - break; - - default: - return (DefWindowProc(hWnd, message, wParam, lParam)); - } - - return (0L); -} - diff --git a/apps/LoopThroughWithOpenGLCompositing/LoopThroughWithOpenGLCompositing.h b/apps/LoopThroughWithOpenGLCompositing/LoopThroughWithOpenGLCompositing.h deleted file mode 100644 index d00d47e..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/LoopThroughWithOpenGLCompositing.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -#include "resource.h" diff --git a/apps/LoopThroughWithOpenGLCompositing/LoopThroughWithOpenGLCompositing.ico b/apps/LoopThroughWithOpenGLCompositing/LoopThroughWithOpenGLCompositing.ico deleted file mode 100644 index d551aa3..0000000 Binary files a/apps/LoopThroughWithOpenGLCompositing/LoopThroughWithOpenGLCompositing.ico and /dev/null differ diff --git a/apps/LoopThroughWithOpenGLCompositing/LoopThroughWithOpenGLCompositing.rc b/apps/LoopThroughWithOpenGLCompositing/LoopThroughWithOpenGLCompositing.rc deleted file mode 100644 index 9b4097f..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/LoopThroughWithOpenGLCompositing.rc +++ /dev/null @@ -1,95 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#ifndef APSTUDIO_INVOKED -#include "targetver.h" -#endif -#define APSTUDIO_HIDDEN_SYMBOLS -#include "windows.h" -#undef APSTUDIO_HIDDEN_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -#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 - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_OPENGLOUTPUT ICON "LoopThroughWithOpenGLCompositing.ico" -IDI_SMALL ICON "small.ico" - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#ifndef APSTUDIO_INVOKED\r\n" - "#include ""targetver.h""\r\n" - "#endif\r\n" - "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" - "#include ""windows.h""\r\n" - "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_APP_TITLE "Video Shader Toys" - IDC_OPENGLOUTPUT "OPENGLOUTPUT" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/apps/LoopThroughWithOpenGLCompositing/control/ControlServer.cpp b/apps/LoopThroughWithOpenGLCompositing/control/ControlServer.cpp deleted file mode 100644 index d6dd653..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/control/ControlServer.cpp +++ /dev/null @@ -1,648 +0,0 @@ -#include "stdafx.h" -#include "ControlServer.h" - -#include "RuntimeJson.h" - -#include -#include - -#include -#include -#include - -#pragma comment(lib, "Ws2_32.lib") -#pragma comment(lib, "Crypt32.lib") -#pragma comment(lib, "Advapi32.lib") - -namespace -{ -constexpr DWORD kStateBroadcastIntervalMs = 250; -constexpr DWORD kStateBroadcastThrottleMs = 50; - -bool InitializeWinsock(std::string& error) -{ - WSADATA wsaData = {}; - int result = WSAStartup(MAKEWORD(2, 2), &wsaData); - if (result != 0) - { - error = "WSAStartup failed."; - return false; - } - return true; -} - -std::string ToLower(std::string text) -{ - std::transform(text.begin(), text.end(), text.begin(), - [](unsigned char ch) { return static_cast(std::tolower(ch)); }); - return text; -} - -bool IsSafeUiPath(const std::filesystem::path& relativePath) -{ - for (const std::filesystem::path& part : relativePath) - { - if (part == "..") - return false; - } - return !relativePath.empty(); -} - -std::string GuessContentType(const std::filesystem::path& assetPath) -{ - const std::string extension = ToLower(assetPath.extension().string()); - if (extension == ".js" || extension == ".mjs") - return "text/javascript"; - if (extension == ".css") - return "text/css"; - if (extension == ".json") - return "application/json"; - if (extension == ".yaml" || extension == ".yml") - return "application/yaml"; - if (extension == ".svg") - return "image/svg+xml"; - if (extension == ".png") - return "image/png"; - if (extension == ".jpg" || extension == ".jpeg") - return "image/jpeg"; - if (extension == ".ico") - return "image/x-icon"; - if (extension == ".map") - return "application/json"; - if (extension == ".md") - return "text/markdown"; - return "text/html"; -} -} - -ControlServer::ControlServer() - : mPort(0), mRunning(false), mBroadcastPending(false) -{ -} - -ControlServer::~ControlServer() -{ - Stop(); -} - -bool ControlServer::Start(const std::filesystem::path& uiRoot, const std::filesystem::path& docsRoot, unsigned short preferredPort, const Callbacks& callbacks, std::string& error) -{ - mUiRoot = uiRoot; - mDocsRoot = docsRoot; - mCallbacks = callbacks; - - if (!InitializeWinsock(error)) - return false; - - mListenSocket.reset(socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)); - if (!mListenSocket.valid()) - { - error = "Could not create listening socket."; - return false; - } - - u_long nonBlocking = 1; - ioctlsocket(mListenSocket.get(), FIONBIO, &nonBlocking); - - sockaddr_in address = {}; - address.sin_family = AF_INET; - address.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - - bool bound = false; - for (unsigned short offset = 0; offset < 20; ++offset) - { - address.sin_port = htons(static_cast(preferredPort + offset)); - if (bind(mListenSocket.get(), reinterpret_cast(&address), sizeof(address)) == 0) - { - mPort = preferredPort + offset; - bound = true; - break; - } - } - - if (!bound) - { - error = "Could not bind the local control server to any port in the preferred range."; - mListenSocket.reset(); - return false; - } - - if (listen(mListenSocket.get(), SOMAXCONN) != 0) - { - error = "Could not start listening on the local control server socket."; - mListenSocket.reset(); - return false; - } - - mRunning = true; - mThread = std::thread(&ControlServer::ServerLoop, this); - return true; -} - -void ControlServer::Stop() -{ - const bool wasActive = mRunning || mListenSocket.valid() || mThread.joinable(); - mRunning = false; - - { - std::lock_guard lock(mMutex); - for (ClientConnection& client : mClients) - client.socket.reset(); - mClients.clear(); - } - - mListenSocket.reset(); - - if (mThread.joinable()) - mThread.join(); - - if (wasActive) - WSACleanup(); -} - -void ControlServer::BroadcastState() -{ - mBroadcastPending = false; - std::lock_guard lock(mMutex); - BroadcastStateLocked(); -} - -void ControlServer::RequestBroadcastState() -{ - mBroadcastPending = true; -} - -void ControlServer::ServerLoop() -{ - DWORD lastStateBroadcastMs = GetTickCount(); - while (mRunning) - { - TryAcceptClient(); - - const DWORD nowMs = GetTickCount(); - if (mBroadcastPending && nowMs - lastStateBroadcastMs >= kStateBroadcastThrottleMs) - { - BroadcastState(); - lastStateBroadcastMs = nowMs; - } - else if (nowMs - lastStateBroadcastMs >= kStateBroadcastIntervalMs) - { - BroadcastState(); - lastStateBroadcastMs = nowMs; - } - - Sleep(25); - } -} - -bool ControlServer::HandleHttpClient(UniqueSocket clientSocket) -{ - std::string request; - char buffer[8192]; - int received = recv(clientSocket.get(), buffer, sizeof(buffer), 0); - if (received <= 0) - return false; - - request.assign(buffer, buffer + received); - return HandleHttpRequest(std::move(clientSocket), request); -} - -bool ControlServer::TryAcceptClient() -{ - sockaddr_in clientAddress = {}; - int addressSize = sizeof(clientAddress); - UniqueSocket clientSocket(accept(mListenSocket.get(), reinterpret_cast(&clientAddress), &addressSize)); - if (!clientSocket.valid()) - return false; - - return HandleHttpClient(std::move(clientSocket)); -} - -bool ControlServer::SendHttpResponse(SOCKET clientSocket, const std::string& status, const std::string& contentType, const std::string& body) -{ - std::ostringstream response; - response << "HTTP/1.1 " << status << "\r\n"; - response << "Content-Type: " << contentType << "\r\n"; - response << "Content-Length: " << body.size() << "\r\n"; - response << "Connection: close\r\n\r\n"; - response << body; - - const std::string payload = response.str(); - return send(clientSocket, payload.c_str(), static_cast(payload.size()), 0) == static_cast(payload.size()); -} - -bool ControlServer::SendHttpResponse(SOCKET clientSocket, const HttpResponse& response) -{ - return SendHttpResponse(clientSocket, response.status, response.contentType, response.body); -} - -bool ControlServer::HandleHttpRequest(UniqueSocket clientSocket, const std::string& request) -{ - HttpRequest httpRequest; - if (!ParseHttpRequest(request, httpRequest)) - { - SendHttpResponse(clientSocket.get(), "400 Bad Request", "text/plain", "Bad Request"); - return true; - } - - if (ToLower(GetHeaderValue(httpRequest, "Upgrade")) == "websocket") - return HandleWebSocketUpgrade(std::move(clientSocket), httpRequest); - - const HttpResponse response = RouteHttpRequest(httpRequest); - SendHttpResponse(clientSocket.get(), response); - if (response.broadcastState) - BroadcastState(); - return true; -} - -ControlServer::HttpResponse ControlServer::RouteHttpRequest(const HttpRequest& request) -{ - if (request.method == "GET") - return ServeGetRequest(request); - - if (request.method == "POST") - return HandleApiPost(request); - - return { "404 Not Found", "text/plain", "Not Found" }; -} - -ControlServer::HttpResponse ControlServer::ServeGetRequest(const HttpRequest& request) const -{ - if (request.path == "/" || request.path == "/index.html") - return ServeUiAsset("index.html"); - - if (request.path == "/api/state") - return { "200 OK", "application/json", mCallbacks.getStateJson ? mCallbacks.getStateJson() : "{}" }; - - if (request.path == "/openapi.yaml" || request.path == "/docs/openapi.yaml") - return ServeOpenApiSpec(); - - if (request.path == "/docs" || request.path == "/docs/") - return ServeSwaggerDocs(); - - const std::string docsPrefix = "/docs/"; - if (request.path.rfind(docsPrefix, 0) == 0) - return ServeDocsAsset(request.path.substr(docsPrefix.size())); - - if (request.path.size() > 1) - { - const HttpResponse assetResponse = ServeUiAsset(request.path.substr(1)); - if (!assetResponse.body.empty()) - return assetResponse; - } - - return { "404 Not Found", "text/plain", "Not Found" }; -} - -ControlServer::HttpResponse ControlServer::ServeUiAsset(const std::string& relativePath) const -{ - std::string contentType; - const std::string body = LoadUiAsset(relativePath, contentType); - return body.empty() - ? HttpResponse{ "404 Not Found", "text/plain", "Not Found" } - : HttpResponse{ "200 OK", contentType, body }; -} - -ControlServer::HttpResponse ControlServer::ServeDocsAsset(const std::string& relativePath) const -{ - const std::filesystem::path sanitizedPath = std::filesystem::path(relativePath).lexically_normal(); - if (!IsSafeUiPath(sanitizedPath)) - return { "404 Not Found", "text/plain", "Not Found" }; - - const std::filesystem::path docsPath = mDocsRoot / sanitizedPath; - const std::string body = LoadTextFile(docsPath); - return body.empty() - ? HttpResponse{ "404 Not Found", "text/plain", "Not Found" } - : HttpResponse{ "200 OK", GuessContentType(docsPath), body }; -} - -ControlServer::HttpResponse ControlServer::ServeOpenApiSpec() const -{ - const std::filesystem::path specPath = mDocsRoot / "openapi.yaml"; - const std::string body = LoadTextFile(specPath); - return body.empty() - ? HttpResponse{ "404 Not Found", "text/plain", "OpenAPI spec not found" } - : HttpResponse{ "200 OK", GuessContentType(specPath), body }; -} - -ControlServer::HttpResponse ControlServer::ServeSwaggerDocs() const -{ - std::ostringstream html; - html << "\n" - << "\n" - << "\n" - << " \n" - << " \n" - << " Video Shader Toys API Docs\n" - << " \n" - << "\n" - << "\n" - << "
\n" - << " \n" - << " \n" - << "\n" - << "\n"; - return { "200 OK", "text/html", html.str() }; -} - -ControlServer::HttpResponse ControlServer::HandleApiPost(const HttpRequest& request) -{ - JsonValue root; - std::string parseError; - if (!ParseJson(request.body, root, parseError)) - return { "400 Bad Request", "application/json", BuildJsonResponse(false, parseError) }; - - std::string actionError; - const bool success = InvokePostRoute(request.path, root, actionError); - return { - success ? "200 OK" : "400 Bad Request", - "application/json", - BuildJsonResponse(success, actionError), - success - }; -} - -bool ControlServer::InvokePostRoute(const std::string& path, const JsonValue& root, std::string& actionError) -{ - using PostHandler = std::function; - const std::map postRoutes = - { - { "/api/layers/add", [this](const JsonValue& json, std::string& error) - { - const JsonValue* shaderId = json.find("shaderId"); - return shaderId && mCallbacks.addLayer && mCallbacks.addLayer(shaderId->asString(), error); - } - }, - { "/api/layers/remove", [this](const JsonValue& json, std::string& error) - { - const JsonValue* layerId = json.find("layerId"); - return layerId && mCallbacks.removeLayer && mCallbacks.removeLayer(layerId->asString(), error); - } - }, - { "/api/layers/move", [this](const JsonValue& json, std::string& error) - { - const JsonValue* layerId = json.find("layerId"); - const JsonValue* direction = json.find("direction"); - return layerId && direction && mCallbacks.moveLayer && - mCallbacks.moveLayer(layerId->asString(), static_cast(direction->asNumber()), error); - } - }, - { "/api/layers/reorder", [this](const JsonValue& json, std::string& error) - { - const JsonValue* layerId = json.find("layerId"); - const JsonValue* targetIndex = json.find("targetIndex"); - return layerId && targetIndex && mCallbacks.moveLayerToIndex && - mCallbacks.moveLayerToIndex(layerId->asString(), static_cast(targetIndex->asNumber()), error); - } - }, - { "/api/layers/set-bypass", [this](const JsonValue& json, std::string& error) - { - const JsonValue* layerId = json.find("layerId"); - const JsonValue* bypass = json.find("bypass"); - return layerId && bypass && mCallbacks.setLayerBypass && - mCallbacks.setLayerBypass(layerId->asString(), bypass->asBoolean(), error); - } - }, - { "/api/layers/set-shader", [this](const JsonValue& json, std::string& error) - { - const JsonValue* layerId = json.find("layerId"); - const JsonValue* shaderId = json.find("shaderId"); - return layerId && shaderId && mCallbacks.setLayerShader && - mCallbacks.setLayerShader(layerId->asString(), shaderId->asString(), error); - } - }, - { "/api/layers/update-parameter", [this](const JsonValue& json, std::string& error) - { - const JsonValue* layerId = json.find("layerId"); - const JsonValue* parameterId = json.find("parameterId"); - const JsonValue* value = json.find("value"); - return layerId && parameterId && value && mCallbacks.updateLayerParameter && - mCallbacks.updateLayerParameter(layerId->asString(), parameterId->asString(), SerializeJson(*value, false), error); - } - }, - { "/api/layers/reset-parameters", [this](const JsonValue& json, std::string& error) - { - const JsonValue* layerId = json.find("layerId"); - return layerId && mCallbacks.resetLayerParameters && - mCallbacks.resetLayerParameters(layerId->asString(), error); - } - }, - { "/api/stack-presets/save", [this](const JsonValue& json, std::string& error) - { - const JsonValue* presetName = json.find("presetName"); - return presetName && mCallbacks.saveStackPreset && - mCallbacks.saveStackPreset(presetName->asString(), error); - } - }, - { "/api/stack-presets/load", [this](const JsonValue& json, std::string& error) - { - const JsonValue* presetName = json.find("presetName"); - return presetName && mCallbacks.loadStackPreset && - mCallbacks.loadStackPreset(presetName->asString(), error); - } - }, - { "/api/reload", [this](const JsonValue&, std::string& error) - { - return mCallbacks.reloadShader && mCallbacks.reloadShader(error); - } - }, - { "/api/screenshot", [this](const JsonValue&, std::string& error) - { - return mCallbacks.requestScreenshot && mCallbacks.requestScreenshot(error); - } - } - }; - - const auto route = postRoutes.find(path); - return route != postRoutes.end() && route->second(root, actionError); -} - -bool ControlServer::HandleWebSocketUpgrade(UniqueSocket clientSocket, const HttpRequest& request) -{ - const std::string clientKey = GetHeaderValue(request, "Sec-WebSocket-Key"); - if (clientKey.empty()) - { - SendHttpResponse(clientSocket.get(), "400 Bad Request", "text/plain", "Missing Sec-WebSocket-Key"); - return true; - } - - std::ostringstream response; - response << "HTTP/1.1 101 Switching Protocols\r\n"; - response << "Upgrade: websocket\r\n"; - response << "Connection: Upgrade\r\n"; - response << "Sec-WebSocket-Accept: " << ComputeWebSocketAcceptKey(clientKey) << "\r\n\r\n"; - - const std::string payload = response.str(); - send(clientSocket.get(), payload.c_str(), static_cast(payload.size()), 0); - - { - std::lock_guard lock(mMutex); - ClientConnection client; - client.socket.reset(clientSocket.release()); - client.websocket = true; - mClients.push_back(std::move(client)); - mBroadcastPending = false; - BroadcastStateLocked(); - } - return true; -} - -bool ControlServer::SendWebSocketText(SOCKET clientSocket, const std::string& payload) -{ - std::string frame; - frame.push_back(static_cast(0x81)); - if (payload.size() <= 125) - { - frame.push_back(static_cast(payload.size())); - } - else if (payload.size() <= 65535) - { - frame.push_back(126); - frame.push_back(static_cast((payload.size() >> 8) & 0xFF)); - frame.push_back(static_cast(payload.size() & 0xFF)); - } - else - { - frame.push_back(127); - for (int shift = 56; shift >= 0; shift -= 8) - frame.push_back(static_cast((payload.size() >> shift) & 0xFF)); - } - frame.append(payload); - - return send(clientSocket, frame.data(), static_cast(frame.size()), 0) == static_cast(frame.size()); -} - -void ControlServer::BroadcastStateLocked() -{ - if (mClients.empty()) - return; - - const std::string stateMessage = mCallbacks.getStateJson ? mCallbacks.getStateJson() : "{}"; - for (auto it = mClients.begin(); it != mClients.end();) - { - if (!SendWebSocketText(it->socket.get(), stateMessage)) - { - it = mClients.erase(it); - } - else - { - ++it; - } - } -} - -std::string ControlServer::LoadUiAsset(const std::string& relativePath, std::string& contentType) const -{ - const std::filesystem::path sanitizedPath = std::filesystem::path(relativePath).lexically_normal(); - if (!IsSafeUiPath(sanitizedPath)) - return std::string(); - - const std::filesystem::path assetPath = mUiRoot / sanitizedPath; - contentType = GuessContentType(assetPath); - return LoadTextFile(assetPath); -} - -std::string ControlServer::LoadTextFile(const std::filesystem::path& path) const -{ - std::ifstream input(path, std::ios::binary); - if (!input) - return std::string(); - - std::ostringstream buffer; - buffer << input.rdbuf(); - return buffer.str(); -} - -std::string ControlServer::BuildJsonResponse(bool success, const std::string& error) const -{ - JsonValue response = JsonValue::MakeObject(); - response.set("ok", JsonValue(success)); - if (!error.empty()) - response.set("error", JsonValue(error)); - return SerializeJson(response, false); -} - -std::string ControlServer::Base64Encode(const unsigned char* data, DWORD dataLength) -{ - DWORD outputLength = 0; - CryptBinaryToStringA(data, dataLength, CRYPT_STRING_BASE64 | CRYPT_STRING_NOCRLF, NULL, &outputLength); - std::string encoded(outputLength, '\0'); - CryptBinaryToStringA(data, dataLength, CRYPT_STRING_BASE64 | CRYPT_STRING_NOCRLF, &encoded[0], &outputLength); - if (!encoded.empty() && encoded.back() == '\0') - encoded.pop_back(); - return encoded; -} - -std::string ControlServer::ComputeWebSocketAcceptKey(const std::string& clientKey) -{ - const std::string combined = clientKey + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; - HCRYPTPROV provider = 0; - HCRYPTHASH hash = 0; - BYTE digest[20] = {}; - DWORD digestLength = sizeof(digest); - - CryptAcquireContext(&provider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT); - CryptCreateHash(provider, CALG_SHA1, 0, 0, &hash); - CryptHashData(hash, reinterpret_cast(combined.data()), static_cast(combined.size()), 0); - CryptGetHashParam(hash, HP_HASHVAL, digest, &digestLength, 0); - - if (hash) - CryptDestroyHash(hash); - if (provider) - CryptReleaseContext(provider, 0); - - return Base64Encode(digest, digestLength); -} - -std::string ControlServer::GetHeaderValue(const HttpRequest& request, const std::string& headerName) -{ - const auto header = request.headers.find(ToLower(headerName)); - return header == request.headers.end() ? std::string() : header->second; -} - -bool ControlServer::ParseHttpRequest(const std::string& rawRequest, HttpRequest& request) -{ - const std::size_t requestLineEnd = rawRequest.find("\r\n"); - if (requestLineEnd == std::string::npos) - return false; - - const std::string requestLine = rawRequest.substr(0, requestLineEnd); - const std::size_t methodEnd = requestLine.find(' '); - if (methodEnd == std::string::npos) - return false; - - const std::size_t pathEnd = requestLine.find(' ', methodEnd + 1); - if (pathEnd == std::string::npos) - return false; - - request.method = requestLine.substr(0, methodEnd); - request.path = requestLine.substr(methodEnd + 1, pathEnd - methodEnd - 1); - request.headers.clear(); - - const std::size_t headersStart = requestLineEnd + 2; - const std::size_t bodySeparator = rawRequest.find("\r\n\r\n", headersStart); - const std::size_t headersEnd = bodySeparator == std::string::npos ? rawRequest.size() : bodySeparator; - - for (std::size_t lineStart = headersStart; lineStart < headersEnd;) - { - const std::size_t lineEnd = rawRequest.find("\r\n", lineStart); - const std::size_t currentLineEnd = lineEnd == std::string::npos ? headersEnd : std::min(lineEnd, headersEnd); - const std::string line = rawRequest.substr(lineStart, currentLineEnd - lineStart); - const std::size_t separator = line.find(':'); - if (separator != std::string::npos) - { - const std::string key = ToLower(line.substr(0, separator)); - std::string value = line.substr(separator + 1); - const std::size_t first = value.find_first_not_of(" \t"); - const std::size_t last = value.find_last_not_of(" \t"); - request.headers[key] = first == std::string::npos ? std::string() : value.substr(first, last - first + 1); - } - - if (lineEnd == std::string::npos || lineEnd >= headersEnd) - break; - lineStart = lineEnd + 2; - } - - request.body = bodySeparator == std::string::npos ? std::string() : rawRequest.substr(bodySeparator + 4); - return !request.method.empty() && !request.path.empty(); -} diff --git a/apps/LoopThroughWithOpenGLCompositing/control/ControlServer.h b/apps/LoopThroughWithOpenGLCompositing/control/ControlServer.h deleted file mode 100644 index 51bca6b..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/control/ControlServer.h +++ /dev/null @@ -1,107 +0,0 @@ -#pragma once - -#include "NativeSockets.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -class JsonValue; - -class ControlServer -{ -public: - struct Callbacks - { - std::function getStateJson; - std::function addLayer; - std::function removeLayer; - std::function moveLayer; - std::function moveLayerToIndex; - std::function setLayerBypass; - std::function setLayerShader; - std::function updateLayerParameter; - std::function resetLayerParameters; - std::function saveStackPreset; - std::function loadStackPreset; - std::function reloadShader; - std::function requestScreenshot; - }; - - ControlServer(); - ~ControlServer(); - - bool Start(const std::filesystem::path& uiRoot, const std::filesystem::path& docsRoot, unsigned short preferredPort, const Callbacks& callbacks, std::string& error); - void Stop(); - void BroadcastState(); - void RequestBroadcastState(); - - unsigned short GetPort() const { return mPort; } - -private: - struct ClientConnection - { - UniqueSocket socket; - bool websocket = false; - }; - - struct HttpRequest - { - std::string method; - std::string path; - std::map headers; - std::string body; - }; - - struct HttpResponse - { - std::string status; - std::string contentType; - std::string body; - bool broadcastState = false; - }; - - void ServerLoop(); - bool HandleHttpClient(UniqueSocket clientSocket); - bool TryAcceptClient(); - bool SendHttpResponse(SOCKET clientSocket, const HttpResponse& response); - bool SendHttpResponse(SOCKET clientSocket, const std::string& status, const std::string& contentType, const std::string& body); - bool HandleHttpRequest(UniqueSocket clientSocket, const std::string& request); - bool HandleWebSocketUpgrade(UniqueSocket clientSocket, const HttpRequest& request); - HttpResponse RouteHttpRequest(const HttpRequest& request); - HttpResponse ServeGetRequest(const HttpRequest& request) const; - HttpResponse ServeUiAsset(const std::string& relativePath) const; - HttpResponse ServeDocsAsset(const std::string& relativePath) const; - HttpResponse ServeOpenApiSpec() const; - HttpResponse ServeSwaggerDocs() const; - HttpResponse HandleApiPost(const HttpRequest& request); - bool InvokePostRoute(const std::string& path, const JsonValue& root, std::string& actionError); - bool SendWebSocketText(SOCKET clientSocket, const std::string& payload); - void BroadcastStateLocked(); - std::string LoadUiAsset(const std::string& relativePath, std::string& contentType) const; - std::string LoadTextFile(const std::filesystem::path& path) const; - std::string BuildJsonResponse(bool success, const std::string& error = std::string()) const; - static std::string Base64Encode(const unsigned char* data, DWORD dataLength); - static std::string ComputeWebSocketAcceptKey(const std::string& clientKey); - static std::string GetHeaderValue(const HttpRequest& request, const std::string& headerName); - static bool ParseHttpRequest(const std::string& rawRequest, HttpRequest& request); - -private: - std::filesystem::path mUiRoot; - std::filesystem::path mDocsRoot; - Callbacks mCallbacks; - UniqueSocket mListenSocket; - unsigned short mPort; - std::thread mThread; - std::atomic mRunning; - std::atomic mBroadcastPending; - mutable std::mutex mMutex; - std::vector mClients; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/control/ControlServices.cpp b/apps/LoopThroughWithOpenGLCompositing/control/ControlServices.cpp deleted file mode 100644 index 96923e8..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/control/ControlServices.cpp +++ /dev/null @@ -1,343 +0,0 @@ -#include "ControlServices.h" - -#include "ControlServer.h" -#include "OscServer.h" -#include "RuntimeControlBridge.h" -#include "RuntimeEventDispatcher.h" -#include "RuntimeStore.h" -#include - -namespace -{ -constexpr auto kCompatibilityPollFallbackInterval = std::chrono::milliseconds(250); -} - -ControlServices::ControlServices(RuntimeEventDispatcher& runtimeEventDispatcher) : - mControlServer(std::make_unique()), - mOscServer(std::make_unique()), - mRuntimeEventDispatcher(runtimeEventDispatcher), - mPollRunning(false) -{ -} - -ControlServices::~ControlServices() -{ - Stop(); -} - -bool ControlServices::Start(OpenGLComposite& composite, RuntimeStore& runtimeStore, std::string& error) -{ - Stop(); - - if (!StartControlServicesBoundary(composite, runtimeStore, *this, *mControlServer, *mOscServer, error)) - { - Stop(); - return false; - } - - return true; -} - -void ControlServices::BeginPolling(RuntimeCoordinator& runtimeCoordinator) -{ - StartPolling(runtimeCoordinator); -} - -void ControlServices::Stop() -{ - StopPolling(); - - if (mOscServer) - mOscServer->Stop(); - - if (mControlServer) - mControlServer->Stop(); -} - -void ControlServices::BroadcastState() -{ - if (mControlServer) - mControlServer->BroadcastState(); -} - -void ControlServices::RequestBroadcastState() -{ - PublishRuntimeStateBroadcastRequested("control-service-request"); - - if (mControlServer) - mControlServer->RequestBroadcastState(); -} - -bool ControlServices::QueueOscUpdate(const std::string& layerKey, const std::string& parameterKey, const std::string& valueJson, std::string& error) -{ - (void)error; - - PendingOscUpdate update; - update.layerKey = layerKey; - update.parameterKey = parameterKey; - update.valueJson = valueJson; - - const std::string routeKey = layerKey + "\n" + parameterKey; - { - std::lock_guard lock(mPendingOscMutex); - mPendingOscUpdates[routeKey] = std::move(update); - } - return true; -} - -bool ControlServices::ApplyPendingOscUpdates(std::vector& appliedUpdates, std::string& error) -{ - appliedUpdates.clear(); - - std::map pending; - { - std::lock_guard lock(mPendingOscMutex); - if (mPendingOscUpdates.empty()) - return true; - pending.swap(mPendingOscUpdates); - } - - for (const auto& entry : pending) - { - JsonValue targetValue; - std::string parseError; - if (!ParseJson(entry.second.valueJson, targetValue, parseError)) - { - OutputDebugStringA(("OSC queued value parse failed: " + parseError + "\n").c_str()); - continue; - } - - AppliedOscUpdate appliedUpdate; - appliedUpdate.routeKey = entry.first; - appliedUpdate.layerKey = entry.second.layerKey; - appliedUpdate.parameterKey = entry.second.parameterKey; - appliedUpdate.targetValue = targetValue; - appliedUpdates.push_back(std::move(appliedUpdate)); - PublishOscValueReceived(entry.second, entry.first); - } - - (void)error; - return true; -} - -bool ControlServices::QueueOscCommit(const std::string& routeKey, const std::string& layerKey, const std::string& parameterKey, const JsonValue& value, uint64_t generation, std::string& error) -{ - (void)error; - - PendingOscCommit commit; - commit.routeKey = routeKey; - commit.layerKey = layerKey; - commit.parameterKey = parameterKey; - commit.value = value; - commit.generation = generation; - - { - std::lock_guard lock(mPendingOscCommitMutex); - mPendingOscCommits[routeKey] = std::move(commit); - } - WakePolling(); - return true; -} - -void ControlServices::ClearOscState() -{ - { - std::lock_guard lock(mPendingOscMutex); - mPendingOscUpdates.clear(); - } - { - std::lock_guard lock(mPendingOscCommitMutex); - mPendingOscCommits.clear(); - } - { - std::lock_guard lock(mCompletedOscCommitMutex); - mCompletedOscCommits.clear(); - } -} - -void ControlServices::ClearOscStateForLayerKey(const std::string& layerKey) -{ - { - std::lock_guard lock(mPendingOscMutex); - for (auto it = mPendingOscUpdates.begin(); it != mPendingOscUpdates.end();) - { - if (it->second.layerKey == layerKey) - it = mPendingOscUpdates.erase(it); - else - ++it; - } - } - { - std::lock_guard lock(mPendingOscCommitMutex); - for (auto it = mPendingOscCommits.begin(); it != mPendingOscCommits.end();) - { - if (it->second.layerKey == layerKey) - it = mPendingOscCommits.erase(it); - else - ++it; - } - } - { - std::lock_guard lock(mCompletedOscCommitMutex); - for (auto it = mCompletedOscCommits.begin(); it != mCompletedOscCommits.end();) - { - if (it->routeKey.rfind(layerKey + "\n", 0) == 0) - it = mCompletedOscCommits.erase(it); - else - ++it; - } - } -} - -void ControlServices::ConsumeCompletedOscCommits(std::vector& completedCommits) -{ - completedCommits.clear(); - - std::lock_guard lock(mCompletedOscCommitMutex); - if (mCompletedOscCommits.empty()) - return; - - completedCommits.swap(mCompletedOscCommits); -} - -void ControlServices::StartPolling(RuntimeCoordinator& runtimeCoordinator) -{ - if (mPollRunning.exchange(true)) - return; - - mPollThread = std::thread([this, &runtimeCoordinator]() { PollLoop(runtimeCoordinator); }); -} - -void ControlServices::StopPolling() -{ - if (!mPollRunning.exchange(false)) - return; - - WakePolling(); - if (mPollThread.joinable()) - mPollThread.join(); -} - -void ControlServices::PollLoop(RuntimeCoordinator& runtimeCoordinator) -{ - while (mPollRunning) - { - std::map pendingCommits; - { - std::lock_guard lock(mPendingOscCommitMutex); - pendingCommits.swap(mPendingOscCommits); - } - for (const auto& entry : pendingCommits) - { - PublishOscCommitRequested(entry.second); - const RuntimeCoordinatorResult result = runtimeCoordinator.CommitOscParameterByControlKey( - entry.second.layerKey, - entry.second.parameterKey, - entry.second.value); - if (result.accepted) - { - CompletedOscCommit completedCommit; - completedCommit.routeKey = entry.second.routeKey; - completedCommit.generation = entry.second.generation; - std::lock_guard lock(mCompletedOscCommitMutex); - mCompletedOscCommits.push_back(std::move(completedCommit)); - PublishOscOverlaySettled(entry.second); - } - else if (!result.errorMessage.empty()) - { - OutputDebugStringA(("OSC commit failed: " + result.errorMessage + "\n").c_str()); - } - } - - bool registryChanged = false; - const RuntimeCoordinatorResult pollResult = runtimeCoordinator.PollRuntimeStoreChanges(registryChanged); - if (pollResult.compileStatusChanged && !pollResult.compileStatusSucceeded && !pollResult.compileStatusMessage.empty()) - OutputDebugStringA(("Runtime poll failed: " + pollResult.compileStatusMessage + "\n").c_str()); - - std::unique_lock wakeLock(mPollWakeMutex); - mPollWakeCondition.wait_for(wakeLock, kCompatibilityPollFallbackInterval, [this]() { - return !mPollRunning.load() || mPollWakeRequested; - }); - mPollWakeRequested = false; - } -} - -void ControlServices::WakePolling() -{ - { - std::lock_guard lock(mPollWakeMutex); - mPollWakeRequested = true; - } - mPollWakeCondition.notify_one(); -} - -void ControlServices::PublishRuntimeStateBroadcastRequested(const std::string& reason) -{ - try - { - RuntimeStateBroadcastRequestedEvent event; - event.reason = reason; - if (!mRuntimeEventDispatcher.PublishPayload(event, "ControlServices")) - OutputDebugStringA("RuntimeStateBroadcastRequested event publish failed.\n"); - } - catch (...) - { - OutputDebugStringA("RuntimeStateBroadcastRequested event publish threw.\n"); - } -} - -void ControlServices::PublishOscValueReceived(const PendingOscUpdate& update, const std::string& routeKey) -{ - try - { - OscValueReceivedEvent event; - event.routeKey = routeKey; - event.layerKey = update.layerKey; - event.parameterKey = update.parameterKey; - event.valueJson = update.valueJson; - if (!mRuntimeEventDispatcher.PublishPayload(event, "ControlServices")) - OutputDebugStringA("OscValueReceived event publish failed.\n"); - } - catch (...) - { - OutputDebugStringA("OscValueReceived event publish threw.\n"); - } -} - -void ControlServices::PublishOscCommitRequested(const PendingOscCommit& commit) -{ - try - { - OscCommitRequestedEvent event; - event.routeKey = commit.routeKey; - event.layerKey = commit.layerKey; - event.parameterKey = commit.parameterKey; - event.valueJson = SerializeJson(commit.value, false); - event.generation = commit.generation; - if (!mRuntimeEventDispatcher.PublishPayload(event, "ControlServices")) - OutputDebugStringA("OscCommitRequested event publish failed.\n"); - } - catch (...) - { - OutputDebugStringA("OscCommitRequested event publish threw.\n"); - } -} - -void ControlServices::PublishOscOverlaySettled(const PendingOscCommit& commit) -{ - try - { - OscOverlayEvent event; - event.routeKey = commit.routeKey; - event.layerKey = commit.layerKey; - event.parameterKey = commit.parameterKey; - event.generation = commit.generation; - event.settled = true; - if (!mRuntimeEventDispatcher.PublishPayload(event, "ControlServices")) - OutputDebugStringA("OscOverlaySettled event publish failed.\n"); - } - catch (...) - { - OutputDebugStringA("OscOverlaySettled event publish threw.\n"); - } -} diff --git a/apps/LoopThroughWithOpenGLCompositing/control/ControlServices.h b/apps/LoopThroughWithOpenGLCompositing/control/ControlServices.h deleted file mode 100644 index 991916d..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/control/ControlServices.h +++ /dev/null @@ -1,95 +0,0 @@ -#pragma once - -#include "RuntimeJson.h" -#include "RuntimeCoordinator.h" -#include "ShaderTypes.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class ControlServer; -class OpenGLComposite; -class OscServer; -class RuntimeEventDispatcher; -class RuntimeStore; - -class ControlServices -{ -public: - struct AppliedOscUpdate - { - std::string routeKey; - std::string layerKey; - std::string parameterKey; - JsonValue targetValue; - }; - - struct CompletedOscCommit - { - std::string routeKey; - uint64_t generation = 0; - }; - - explicit ControlServices(RuntimeEventDispatcher& runtimeEventDispatcher); - ~ControlServices(); - - bool Start(OpenGLComposite& composite, RuntimeStore& runtimeStore, std::string& error); - void BeginPolling(RuntimeCoordinator& runtimeCoordinator); - void Stop(); - void BroadcastState(); - void RequestBroadcastState(); - bool QueueOscUpdate(const std::string& layerKey, const std::string& parameterKey, const std::string& valueJson, std::string& error); - bool ApplyPendingOscUpdates(std::vector& appliedUpdates, std::string& error); - bool QueueOscCommit(const std::string& routeKey, const std::string& layerKey, const std::string& parameterKey, const JsonValue& value, uint64_t generation, std::string& error); - void ClearOscState(); - void ClearOscStateForLayerKey(const std::string& layerKey); - void ConsumeCompletedOscCommits(std::vector& completedCommits); - -private: - struct PendingOscUpdate - { - std::string layerKey; - std::string parameterKey; - std::string valueJson; - }; - - struct PendingOscCommit - { - std::string routeKey; - std::string layerKey; - std::string parameterKey; - JsonValue value; - uint64_t generation = 0; - }; - - void StartPolling(RuntimeCoordinator& runtimeCoordinator); - void StopPolling(); - void PollLoop(RuntimeCoordinator& runtimeCoordinator); - void WakePolling(); - void PublishRuntimeStateBroadcastRequested(const std::string& reason); - void PublishOscValueReceived(const PendingOscUpdate& update, const std::string& routeKey); - void PublishOscCommitRequested(const PendingOscCommit& commit); - void PublishOscOverlaySettled(const PendingOscCommit& commit); - - std::unique_ptr mControlServer; - std::unique_ptr mOscServer; - RuntimeEventDispatcher& mRuntimeEventDispatcher; - std::thread mPollThread; - std::atomic mPollRunning; - std::mutex mPollWakeMutex; - std::condition_variable mPollWakeCondition; - bool mPollWakeRequested = false; - std::mutex mPendingOscMutex; - std::map mPendingOscUpdates; - std::mutex mPendingOscCommitMutex; - std::map mPendingOscCommits; - std::mutex mCompletedOscCommitMutex; - std::vector mCompletedOscCommits; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/control/OscServer.cpp b/apps/LoopThroughWithOpenGLCompositing/control/OscServer.cpp deleted file mode 100644 index 4cbd039..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/control/OscServer.cpp +++ /dev/null @@ -1,336 +0,0 @@ -#include "stdafx.h" -#include "OscServer.h" - -#include - -#include -#include -#include -#include -#include - -#pragma comment(lib, "Ws2_32.lib") - -namespace -{ -bool InitializeWinsock(std::string& error) -{ - WSADATA wsaData = {}; - const int result = WSAStartup(MAKEWORD(2, 2), &wsaData); - if (result != 0) - { - error = "WSAStartup failed."; - return false; - } - return true; -} - -std::vector SplitAddress(const std::string& address) -{ - std::vector parts; - std::size_t start = !address.empty() && address[0] == '/' ? 1 : 0; - - while (start <= address.size()) - { - const std::size_t slash = address.find('/', start); - const std::size_t end = slash == std::string::npos ? address.size() : slash; - if (end > start) - parts.push_back(address.substr(start, end - start)); - if (slash == std::string::npos) - break; - start = slash + 1; - } - return parts; -} - -} - -OscServer::OscServer() - : mPort(0), mRunning(false) -{ -} - -OscServer::~OscServer() -{ - Stop(); -} - -bool OscServer::Start(const std::string& bindAddress, unsigned short port, const Callbacks& callbacks, std::string& error) -{ - if (port == 0) - return true; - - mCallbacks = callbacks; - mPort = port; - - if (!InitializeWinsock(error)) - return false; - - mSocket.reset(socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)); - if (!mSocket.valid()) - { - error = "Could not create OSC UDP socket."; - return false; - } - - DWORD timeoutMilliseconds = 100; - setsockopt(mSocket.get(), SOL_SOCKET, SO_RCVTIMEO, reinterpret_cast(&timeoutMilliseconds), sizeof(timeoutMilliseconds)); - - sockaddr_in address = {}; - address.sin_family = AF_INET; - if (!TryParseBindAddress(bindAddress, address.sin_addr, error)) - { - mSocket.reset(); - return false; - } - address.sin_port = htons(static_cast(port)); - if (bind(mSocket.get(), reinterpret_cast(&address), sizeof(address)) != 0) - { - error = "Could not bind OSC listener to " + bindAddress + ":" + std::to_string(port) + "."; - mSocket.reset(); - return false; - } - - mRunning = true; - mThread = std::thread(&OscServer::ServerLoop, this); - return true; -} - -bool OscServer::TryParseBindAddress(const std::string& bindAddress, in_addr& address, std::string& error) -{ - if (bindAddress.empty()) - { - error = "OSC bind address must not be empty."; - return false; - } - - address = {}; - if (InetPtonA(AF_INET, bindAddress.c_str(), &address) != 1) - { - error = "Invalid OSC bind address '" + bindAddress + "'. Use an IPv4 address such as 127.0.0.1 or 0.0.0.0."; - return false; - } - - return true; -} - -void OscServer::Stop() -{ - mRunning = false; - mSocket.reset(); - if (mThread.joinable()) - mThread.join(); -} - -void OscServer::ServerLoop() -{ - std::array buffer = {}; - while (mRunning) - { - sockaddr_in sender = {}; - int senderLength = sizeof(sender); - const int byteCount = recvfrom(mSocket.get(), buffer.data(), static_cast(buffer.size()), 0, - reinterpret_cast(&sender), &senderLength); - if (byteCount <= 0) - continue; - - OscMessage message; - std::string error; - if (DecodeMessage(buffer.data(), byteCount, message, error)) - { - if (!DispatchMessage(message, error) && !error.empty()) - OutputDebugStringA(("OSC dispatch failed: " + error + "\n").c_str()); - } - else if (!error.empty()) - { - OutputDebugStringA(("OSC decode failed: " + error + "\n").c_str()); - } - } -} - -bool OscServer::DecodeMessage(const char* data, int byteCount, OscMessage& message, std::string& error) const -{ - int offset = 0; - if (!ReadPaddedString(data, byteCount, offset, message.address) || message.address.empty() || message.address[0] != '/') - { - error = "Invalid OSC address."; - return false; - } - - std::string typeTags; - if (!ReadPaddedString(data, byteCount, offset, typeTags) || typeTags.empty() || typeTags[0] != ',') - { - error = "Invalid OSC type tag string."; - return false; - } - - if (typeTags.size() < 2) - { - error = "OSC message has no parameter value."; - return false; - } - - std::vector values; - for (std::size_t index = 1; index < typeTags.size(); ++index) - { - std::string valueJson; - if (!DecodeArgument(data, byteCount, offset, typeTags[index], valueJson)) - { - error = "Unsupported or malformed OSC value type."; - return false; - } - values.push_back(valueJson); - } - - if (values.size() == 1) - { - message.valueJson = values.front(); - return true; - } - - std::ostringstream arrayJson; - arrayJson << "["; - for (std::size_t index = 0; index < values.size(); ++index) - { - if (index > 0) - arrayJson << ","; - arrayJson << values[index]; - } - arrayJson << "]"; - message.valueJson = arrayJson.str(); - return true; -} - -bool OscServer::DispatchMessage(const OscMessage& message, std::string& error) const -{ - const std::vector parts = SplitAddress(message.address); - if (parts.size() != 3 || parts[0] != "VideoShaderToys") - { - error = "Unsupported OSC address: " + message.address; - return false; - } - - return mCallbacks.updateParameter && - mCallbacks.updateParameter(parts[1], parts[2], message.valueJson, error); -} - -bool OscServer::DecodeArgument(const char* data, int byteCount, int& offset, char valueType, std::string& valueJson) -{ - if (valueType == 'f') - { - double value = 0.0; - if (!ReadFloat32(data, byteCount, offset, value)) - return false; - std::ostringstream stream; - stream << std::setprecision(9) << value; - valueJson = stream.str(); - return true; - } - - if (valueType == 'd') - { - double value = 0.0; - if (!ReadFloat64(data, byteCount, offset, value)) - return false; - std::ostringstream stream; - stream << std::setprecision(17) << value; - valueJson = stream.str(); - return true; - } - - if (valueType == 'i') - { - int value = 0; - if (!ReadInt32(data, byteCount, offset, value)) - return false; - valueJson = std::to_string(value); - return true; - } - - if (valueType == 's') - { - std::string value; - if (!ReadPaddedString(data, byteCount, offset, value)) - return false; - valueJson = BuildJsonString(value); - return true; - } - - if (valueType == 'T' || valueType == 'F') - { - valueJson = valueType == 'T' ? "true" : "false"; - return true; - } - - return false; -} - -bool OscServer::ReadPaddedString(const char* data, int byteCount, int& offset, std::string& value) -{ - if (offset < 0 || offset >= byteCount) - return false; - - const int start = offset; - while (offset < byteCount && data[offset] != '\0') - ++offset; - if (offset >= byteCount) - return false; - - value.assign(data + start, data + offset); - ++offset; - while (offset % 4 != 0) - ++offset; - return offset <= byteCount; -} - -bool OscServer::ReadInt32(const char* data, int byteCount, int& offset, int& value) -{ - if (offset + 4 > byteCount) - return false; - const unsigned char* bytes = reinterpret_cast(data + offset); - value = static_cast((bytes[0] << 24) | (bytes[1] << 16) | (bytes[2] << 8) | bytes[3]); - offset += 4; - return true; -} - -bool OscServer::ReadFloat32(const char* data, int byteCount, int& offset, double& value) -{ - int bits = 0; - if (!ReadInt32(data, byteCount, offset, bits)) - return false; - - float floatValue = 0.0f; - const unsigned int unsignedBits = static_cast(bits); - std::memcpy(&floatValue, &unsignedBits, sizeof(floatValue)); - value = static_cast(floatValue); - return true; -} - -bool OscServer::ReadFloat64(const char* data, int byteCount, int& offset, double& value) -{ - if (offset + 8 > byteCount) - return false; - - const unsigned char* bytes = reinterpret_cast(data + offset); - uint64_t bits = 0; - for (int index = 0; index < 8; ++index) - bits = (bits << 8) | static_cast(bytes[index]); - - std::memcpy(&value, &bits, sizeof(value)); - offset += 8; - return true; -} - -std::string OscServer::BuildJsonString(const std::string& value) -{ - std::ostringstream stream; - stream << '"'; - for (char ch : value) - { - if (ch == '"' || ch == '\\') - stream << '\\'; - stream << ch; - } - stream << '"'; - return stream.str(); -} diff --git a/apps/LoopThroughWithOpenGLCompositing/control/OscServer.h b/apps/LoopThroughWithOpenGLCompositing/control/OscServer.h deleted file mode 100644 index c98392e..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/control/OscServer.h +++ /dev/null @@ -1,53 +0,0 @@ -#pragma once - -#include "NativeSockets.h" - -#include - -#include -#include -#include -#include - -class OscServer -{ -public: - struct Callbacks - { - std::function updateParameter; - }; - - OscServer(); - ~OscServer(); - - bool Start(const std::string& bindAddress, unsigned short port, const Callbacks& callbacks, std::string& error); - void Stop(); - - unsigned short GetPort() const { return mPort; } - -private: - friend struct OscServerTestAccess; - - struct OscMessage - { - std::string address; - std::string valueJson; - }; - - void ServerLoop(); - bool DecodeMessage(const char* data, int byteCount, OscMessage& message, std::string& error) const; - bool DispatchMessage(const OscMessage& message, std::string& error) const; - static bool TryParseBindAddress(const std::string& bindAddress, in_addr& address, std::string& error); - static bool DecodeArgument(const char* data, int byteCount, int& offset, char valueType, std::string& valueJson); - static bool ReadPaddedString(const char* data, int byteCount, int& offset, std::string& value); - static bool ReadInt32(const char* data, int byteCount, int& offset, int& value); - static bool ReadFloat32(const char* data, int byteCount, int& offset, double& value); - static bool ReadFloat64(const char* data, int byteCount, int& offset, double& value); - static std::string BuildJsonString(const std::string& value); - - Callbacks mCallbacks; - UniqueSocket mSocket; - unsigned short mPort; - std::thread mThread; - std::atomic mRunning; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/control/RuntimeControlBridge.cpp b/apps/LoopThroughWithOpenGLCompositing/control/RuntimeControlBridge.cpp deleted file mode 100644 index 6530d16..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/control/RuntimeControlBridge.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include "RuntimeControlBridge.h" - -#include "ControlServices.h" -#include "ControlServer.h" -#include "OpenGLComposite.h" -#include "OscServer.h" -#include "RuntimeStore.h" - -bool StartControlServicesBoundary( - OpenGLComposite& composite, - RuntimeStore& runtimeStore, - ControlServices& controlServices, - ControlServer& controlServer, - OscServer& oscServer, - std::string& error) -{ - ControlServer::Callbacks callbacks; - callbacks.getStateJson = [&composite]() { return composite.GetRuntimeStateJson(); }; - callbacks.addLayer = [&composite](const std::string& shaderId, std::string& actionError) { return composite.AddLayer(shaderId, actionError); }; - callbacks.removeLayer = [&composite](const std::string& layerId, std::string& actionError) { return composite.RemoveLayer(layerId, actionError); }; - callbacks.moveLayer = [&composite](const std::string& layerId, int direction, std::string& actionError) { return composite.MoveLayer(layerId, direction, actionError); }; - callbacks.moveLayerToIndex = [&composite](const std::string& layerId, std::size_t targetIndex, std::string& actionError) { return composite.MoveLayerToIndex(layerId, targetIndex, actionError); }; - callbacks.setLayerBypass = [&composite](const std::string& layerId, bool bypassed, std::string& actionError) { return composite.SetLayerBypass(layerId, bypassed, actionError); }; - callbacks.setLayerShader = [&composite](const std::string& layerId, const std::string& shaderId, std::string& actionError) { return composite.SetLayerShader(layerId, shaderId, actionError); }; - callbacks.updateLayerParameter = [&composite](const std::string& layerId, const std::string& parameterId, const std::string& valueJson, std::string& actionError) { - return composite.UpdateLayerParameterJson(layerId, parameterId, valueJson, actionError); - }; - callbacks.resetLayerParameters = [&composite](const std::string& layerId, std::string& actionError) { return composite.ResetLayerParameters(layerId, actionError); }; - callbacks.saveStackPreset = [&composite](const std::string& presetName, std::string& actionError) { return composite.SaveStackPreset(presetName, actionError); }; - callbacks.loadStackPreset = [&composite](const std::string& presetName, std::string& actionError) { return composite.LoadStackPreset(presetName, actionError); }; - callbacks.requestScreenshot = [&composite](std::string& actionError) { return composite.RequestScreenshot(actionError); }; - callbacks.reloadShader = [&composite](std::string& actionError) { - if (!composite.ReloadShader()) - { - actionError = "Shader reload failed. See native app status for details."; - return false; - } - return true; - }; - - if (!controlServer.Start(runtimeStore.GetRuntimeUiRoot(), runtimeStore.GetRuntimeDocsRoot(), runtimeStore.GetConfiguredControlServerPort(), callbacks, error)) - return false; - runtimeStore.SetBoundControlServerPort(controlServer.GetPort()); - - OscServer::Callbacks oscCallbacks; - oscCallbacks.updateParameter = [&controlServices](const std::string& layerKey, const std::string& parameterKey, const std::string& valueJson, std::string& actionError) { - return controlServices.QueueOscUpdate(layerKey, parameterKey, valueJson, actionError); - }; - if (runtimeStore.GetConfiguredOscPort() > 0 && - !oscServer.Start(runtimeStore.GetConfiguredOscBindAddress(), runtimeStore.GetConfiguredOscPort(), oscCallbacks, error)) - return false; - - return true; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/control/RuntimeControlBridge.h b/apps/LoopThroughWithOpenGLCompositing/control/RuntimeControlBridge.h deleted file mode 100644 index 8fb1b0f..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/control/RuntimeControlBridge.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include - -class ControlServer; -class ControlServices; -class OpenGLComposite; -class OscServer; -class RuntimeStore; - -bool StartControlServicesBoundary( - OpenGLComposite& composite, - RuntimeStore& runtimeStore, - ControlServices& controlServices, - ControlServer& controlServer, - OscServer& oscServer, - std::string& error); diff --git a/apps/LoopThroughWithOpenGLCompositing/control/RuntimeServiceLiveBridge.cpp b/apps/LoopThroughWithOpenGLCompositing/control/RuntimeServiceLiveBridge.cpp deleted file mode 100644 index 6c9dffa..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/control/RuntimeServiceLiveBridge.cpp +++ /dev/null @@ -1,72 +0,0 @@ -#include "RuntimeServiceLiveBridge.h" - -#include "RenderEngine.h" -#include "RuntimeServices.h" - -#include - -namespace -{ -void DrainServiceEvents(RuntimeServices& runtimeServices, RenderEngine& renderEngine) -{ - std::vector appliedOscUpdates; - std::vector completedOscCommits; - - std::string oscError; - if (!runtimeServices.ApplyPendingOscUpdates(appliedOscUpdates, oscError) && !oscError.empty()) - OutputDebugStringA(("OSC apply failed: " + oscError + "\n").c_str()); - runtimeServices.ConsumeCompletedOscCommits(completedOscCommits); - - std::vector overlayUpdates; - overlayUpdates.reserve(appliedOscUpdates.size()); - for (const RuntimeServices::AppliedOscUpdate& update : appliedOscUpdates) - { - overlayUpdates.push_back({ update.routeKey, update.layerKey, update.parameterKey, update.targetValue }); - } - - std::vector overlayCommitCompletions; - overlayCommitCompletions.reserve(completedOscCommits.size()); - for (const RuntimeServices::CompletedOscCommit& completedCommit : completedOscCommits) - { - overlayCommitCompletions.push_back({ completedCommit.routeKey, completedCommit.generation }); - } - - renderEngine.UpdateOscOverlayState(overlayUpdates, overlayCommitCompletions); -} - -void QueueServiceCommitRequests( - RuntimeServices& runtimeServices, - const std::vector& commitRequests) -{ - for (const RenderEngine::OscOverlayCommitRequest& commitRequest : commitRequests) - { - std::string commitError; - if (!runtimeServices.QueueOscCommit( - commitRequest.routeKey, - commitRequest.layerKey, - commitRequest.parameterKey, - commitRequest.value, - commitRequest.generation, - commitError) && - !commitError.empty()) - { - OutputDebugStringA(("OSC commit queue failed: " + commitError + "\n").c_str()); - } - } -} -} - -bool RuntimeServiceLiveBridge::PrepareLiveRenderFrameState( - RuntimeServices& runtimeServices, - RenderEngine& renderEngine, - const RenderFrameInput& input, - RenderFrameState& frameState) -{ - DrainServiceEvents(runtimeServices, renderEngine); - - std::vector commitRequests; - const bool resolved = renderEngine.ResolveRenderFrameState(input, &commitRequests, frameState); - - QueueServiceCommitRequests(runtimeServices, commitRequests); - return resolved; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/control/RuntimeServiceLiveBridge.h b/apps/LoopThroughWithOpenGLCompositing/control/RuntimeServiceLiveBridge.h deleted file mode 100644 index 983bf84..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/control/RuntimeServiceLiveBridge.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "RenderFrameState.h" - -#include - -class RenderEngine; -class RuntimeServices; - -class RuntimeServiceLiveBridge -{ -public: - static bool PrepareLiveRenderFrameState( - RuntimeServices& runtimeServices, - RenderEngine& renderEngine, - const RenderFrameInput& input, - RenderFrameState& frameState); -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/control/RuntimeServices.cpp b/apps/LoopThroughWithOpenGLCompositing/control/RuntimeServices.cpp deleted file mode 100644 index 1b2bf8c..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/control/RuntimeServices.cpp +++ /dev/null @@ -1,86 +0,0 @@ -#include "RuntimeServices.h" - -#include "RuntimeStore.h" - -RuntimeServices::RuntimeServices(RuntimeEventDispatcher& runtimeEventDispatcher) : - mControlServices(std::make_unique(runtimeEventDispatcher)) -{ -} - -RuntimeServices::~RuntimeServices() -{ - Stop(); -} - -bool RuntimeServices::Start(OpenGLComposite& composite, RuntimeStore& runtimeStore, std::string& error) -{ - return mControlServices && mControlServices->Start(composite, runtimeStore, error); -} - -void RuntimeServices::BeginPolling(RuntimeCoordinator& runtimeCoordinator) -{ - if (mControlServices) - mControlServices->BeginPolling(runtimeCoordinator); -} - -void RuntimeServices::Stop() -{ - if (mControlServices) - mControlServices->Stop(); -} - -void RuntimeServices::BroadcastState() -{ - if (mControlServices) - mControlServices->BroadcastState(); -} - -void RuntimeServices::RequestBroadcastState() -{ - if (mControlServices) - mControlServices->RequestBroadcastState(); -} - -bool RuntimeServices::QueueOscUpdate(const std::string& layerKey, const std::string& parameterKey, const std::string& valueJson, std::string& error) -{ - return mControlServices && mControlServices->QueueOscUpdate(layerKey, parameterKey, valueJson, error); -} - -bool RuntimeServices::ApplyPendingOscUpdates(std::vector& appliedUpdates, std::string& error) -{ - if (!mControlServices) - { - appliedUpdates.clear(); - return true; - } - - return mControlServices->ApplyPendingOscUpdates(appliedUpdates, error); -} - -bool RuntimeServices::QueueOscCommit(const std::string& routeKey, const std::string& layerKey, const std::string& parameterKey, const JsonValue& value, uint64_t generation, std::string& error) -{ - return mControlServices && mControlServices->QueueOscCommit(routeKey, layerKey, parameterKey, value, generation, error); -} - -void RuntimeServices::ClearOscState() -{ - if (mControlServices) - mControlServices->ClearOscState(); -} - -void RuntimeServices::ClearOscStateForLayerKey(const std::string& layerKey) -{ - if (mControlServices) - mControlServices->ClearOscStateForLayerKey(layerKey); -} - -void RuntimeServices::ConsumeCompletedOscCommits(std::vector& completedCommits) -{ - if (!mControlServices) - { - completedCommits.clear(); - return; - } - - mControlServices->ConsumeCompletedOscCommits(completedCommits); -} diff --git a/apps/LoopThroughWithOpenGLCompositing/control/RuntimeServices.h b/apps/LoopThroughWithOpenGLCompositing/control/RuntimeServices.h deleted file mode 100644 index 80d79f7..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/control/RuntimeServices.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -#include "ControlServices.h" - -#include -#include -class OpenGLComposite; -class RuntimeCoordinator; -class RuntimeEventDispatcher; -class RuntimeStore; - -class RuntimeServices -{ -public: - using AppliedOscUpdate = ControlServices::AppliedOscUpdate; - using CompletedOscCommit = ControlServices::CompletedOscCommit; - - explicit RuntimeServices(RuntimeEventDispatcher& runtimeEventDispatcher); - ~RuntimeServices(); - - bool Start(OpenGLComposite& composite, RuntimeStore& runtimeStore, std::string& error); - void BeginPolling(RuntimeCoordinator& runtimeCoordinator); - void Stop(); - void BroadcastState(); - void RequestBroadcastState(); - bool QueueOscUpdate(const std::string& layerKey, const std::string& parameterKey, const std::string& valueJson, std::string& error); - bool ApplyPendingOscUpdates(std::vector& appliedUpdates, std::string& error); - bool QueueOscCommit(const std::string& routeKey, const std::string& layerKey, const std::string& parameterKey, const JsonValue& value, uint64_t generation, std::string& error); - void ClearOscState(); - void ClearOscStateForLayerKey(const std::string& layerKey); - void ConsumeCompletedOscCommits(std::vector& completedCommits); - -private: - std::unique_ptr mControlServices; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/RenderEngine.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/RenderEngine.cpp deleted file mode 100644 index 281080a..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/RenderEngine.cpp +++ /dev/null @@ -1,668 +0,0 @@ -#include "RenderEngine.h" - -#include - -#include -#include -#include - -RenderEngine::RenderEngine( - RuntimeSnapshotProvider& runtimeSnapshotProvider, - HealthTelemetry& healthTelemetry, - HDC hdc, - HGLRC hglrc, - RenderEffectCallback renderEffect, - ScreenshotCallback screenshotReady, - PreviewPaintCallback previewPaint) : - mRenderer(), - mRenderPass(mRenderer), - mRenderPipeline(mRenderer, runtimeSnapshotProvider, healthTelemetry, std::move(renderEffect), std::move(screenshotReady), std::move(previewPaint)), - mShaderPrograms(mRenderer, runtimeSnapshotProvider), - mHealthTelemetry(healthTelemetry), - mHdc(hdc), - mHglrc(hglrc), - mFrameStateResolver(runtimeSnapshotProvider) -{ -} - -RenderEngine::~RenderEngine() -{ - StopRenderThread(); - if (!mResourcesDestroyed) - { - mRenderer.DestroyResources(); - mResourcesDestroyed = true; - } -} - -bool RenderEngine::StartRenderThread() -{ - if (mRenderThreadRunning) - return true; - - { - std::lock_guard lock(mRenderThreadMutex); - mRenderThreadStopping = false; - } - - std::promise ready; - std::future readyResult = ready.get_future(); - mRenderThread = std::thread(&RenderEngine::RenderThreadMain, this, std::move(ready)); - if (!readyResult.get()) - { - if (mRenderThread.joinable()) - mRenderThread.join(); - return false; - } - - return true; -} - -void RenderEngine::StopRenderThread() -{ - if (mRenderThreadRunning) - { - InvokeOnRenderThread([this]() { - if (!mResourcesDestroyed) - { - mRenderer.DestroyResources(); - mResourcesDestroyed = true; - } - }); - } - - { - std::lock_guard lock(mRenderThreadMutex); - mRenderThreadStopping = true; - } - mRenderThreadCondition.notify_one(); - - if (mRenderThread.joinable()) - mRenderThread.join(); -} - -void RenderEngine::RenderThreadMain(std::promise ready) -{ - mRenderThreadId = GetCurrentThreadId(); - if (!wglMakeCurrent(mHdc, mHglrc)) - { - mRenderThreadId = 0; - ready.set_value(false); - return; - } - - mRenderThreadRunning = true; - ready.set_value(true); - - for (;;) - { - std::function task; - { - std::unique_lock lock(mRenderThreadMutex); - mRenderThreadCondition.wait(lock, [this]() { - return mRenderThreadStopping || !mRenderThreadTasks.empty(); - }); - - if (mRenderThreadStopping && mRenderThreadTasks.empty()) - break; - - task = std::move(mRenderThreadTasks.front()); - mRenderThreadTasks.pop(); - } - - try - { - task(); - } - catch (...) - { - OutputDebugStringA("Render thread task failed with an unhandled exception.\n"); - } - } - - wglMakeCurrent(NULL, NULL); - mRenderThreadRunning = false; - mRenderThreadId = 0; -} - -void RenderEngine::ReportRenderThreadRequestFailure(const char* operationName, const char* reason) -{ - std::ostringstream message; - message << "Render thread request failed"; - if (operationName && operationName[0] != '\0') - message << " [" << operationName << "]"; - if (reason && reason[0] != '\0') - message << ": " << reason; - message << ".\n"; - OutputDebugStringA(message.str().c_str()); -} - -bool RenderEngine::IsRenderThreadAccessExpected() const -{ - return !mRenderThreadRunning || GetCurrentThreadId() == mRenderThreadId; -} - -void RenderEngine::ReportWrongThreadRenderAccess(const char* operationName) const -{ - if (IsRenderThreadAccessExpected()) - return; - - std::ostringstream message; - message << "Wrong-thread render access detected"; - if (operationName && operationName[0] != '\0') - message << " [" << operationName << "]"; - message << ".\n"; - OutputDebugStringA(message.str().c_str()); -} - -bool RenderEngine::CompileDecodeShader(int errorMessageSize, char* errorMessage) -{ - return InvokeOnRenderThread([this, errorMessageSize, errorMessage]() { - return mShaderPrograms.CompileDecodeShader(errorMessageSize, errorMessage); - }); -} - -bool RenderEngine::CompileOutputPackShader(int errorMessageSize, char* errorMessage) -{ - return InvokeOnRenderThread([this, errorMessageSize, errorMessage]() { - return mShaderPrograms.CompileOutputPackShader(errorMessageSize, errorMessage); - }); -} - -bool RenderEngine::InitializeResources( - unsigned inputFrameWidth, - unsigned inputFrameHeight, - unsigned captureTextureWidth, - unsigned outputFrameWidth, - unsigned outputFrameHeight, - unsigned outputPackTextureWidth, - std::string& error) -{ - return InvokeOnRenderThread([this, inputFrameWidth, inputFrameHeight, captureTextureWidth, outputFrameWidth, outputFrameHeight, outputPackTextureWidth, &error]() { - return mRenderer.InitializeResources( - inputFrameWidth, - inputFrameHeight, - captureTextureWidth, - outputFrameWidth, - outputFrameHeight, - outputPackTextureWidth, - error); - }); -} - -bool RenderEngine::CompileLayerPrograms(unsigned inputFrameWidth, unsigned inputFrameHeight, int errorMessageSize, char* errorMessage) -{ - return InvokeOnRenderThread([this, inputFrameWidth, inputFrameHeight, errorMessageSize, errorMessage]() { - return mShaderPrograms.CompileLayerPrograms(inputFrameWidth, inputFrameHeight, errorMessageSize, errorMessage); - }); -} - -bool RenderEngine::CommitPreparedLayerPrograms(const PreparedShaderBuild& preparedBuild, unsigned inputFrameWidth, unsigned inputFrameHeight, int errorMessageSize, char* errorMessage) -{ - return InvokeOnRenderThread([this, &preparedBuild, inputFrameWidth, inputFrameHeight, errorMessageSize, errorMessage]() { - return mShaderPrograms.CommitPreparedLayerPrograms(preparedBuild, inputFrameWidth, inputFrameHeight, errorMessageSize, errorMessage); - }); -} - -bool RenderEngine::ApplyPreparedShaderBuild( - const PreparedShaderBuild& preparedBuild, - unsigned inputFrameWidth, - unsigned inputFrameHeight, - bool preserveFeedbackState, - int errorMessageSize, - char* errorMessage) -{ - if (!CommitPreparedLayerPrograms(preparedBuild, inputFrameWidth, inputFrameHeight, errorMessageSize, errorMessage)) - return false; - - mFrameStateResolver.StoreCommittedSnapshot(preparedBuild.renderSnapshot, mShaderPrograms.CommittedLayerStates()); - ResetTemporalHistoryState(); - if (!preserveFeedbackState) - ResetShaderFeedbackState(); - return true; -} - -void RenderEngine::ResetTemporalHistoryState() -{ - InvokeOnRenderThread([this]() { - mRenderCommandQueue.RequestRenderReset(RenderCommandResetScope::TemporalHistoryOnly); - ProcessRenderResetCommandsOnRenderThread(); - }); -} - -void RenderEngine::ResetShaderFeedbackState() -{ - InvokeOnRenderThread([this]() { - mRenderCommandQueue.RequestRenderReset(RenderCommandResetScope::ShaderFeedbackOnly); - ProcessRenderResetCommandsOnRenderThread(); - }); -} - -void RenderEngine::ApplyRuntimeCoordinatorRenderReset(RuntimeCoordinatorRenderResetScope resetScope) -{ - InvokeOnRenderThread([this, resetScope]() { - switch (resetScope) - { - case RuntimeCoordinatorRenderResetScope::TemporalHistoryOnly: - mRenderCommandQueue.RequestRenderReset(RenderCommandResetScope::TemporalHistoryOnly); - ProcessRenderResetCommandsOnRenderThread(); - break; - case RuntimeCoordinatorRenderResetScope::TemporalHistoryAndFeedback: - mRenderCommandQueue.RequestRenderReset(RenderCommandResetScope::TemporalHistoryAndFeedback); - ProcessRenderResetCommandsOnRenderThread(); - break; - case RuntimeCoordinatorRenderResetScope::None: - default: - break; - } - }); -} - -void RenderEngine::ResetTemporalHistoryStateOnRenderThread() -{ - ReportWrongThreadRenderAccess("reset-temporal-history"); - mShaderPrograms.ResetTemporalHistoryState(); -} - -void RenderEngine::ResetShaderFeedbackStateOnRenderThread() -{ - ReportWrongThreadRenderAccess("reset-shader-feedback"); - mShaderPrograms.ResetShaderFeedbackState(); -} - -void RenderEngine::ApplyRenderResetOnRenderThread(RenderCommandResetScope resetScope) -{ - switch (resetScope) - { - case RenderCommandResetScope::ShaderFeedbackOnly: - ResetShaderFeedbackStateOnRenderThread(); - break; - case RenderCommandResetScope::TemporalHistoryOnly: - ResetTemporalHistoryStateOnRenderThread(); - break; - case RenderCommandResetScope::TemporalHistoryAndFeedback: - ResetTemporalHistoryStateOnRenderThread(); - ResetShaderFeedbackStateOnRenderThread(); - break; - case RenderCommandResetScope::None: - default: - break; - } -} - -void RenderEngine::ProcessRenderResetCommandsOnRenderThread() -{ - RenderCommandResetScope resetScope = RenderCommandResetScope::None; - while (mRenderCommandQueue.TryTakeRenderReset(resetScope)) - ApplyRenderResetOnRenderThread(resetScope); -} - -void RenderEngine::EnqueuePreviewPresentWake() -{ - if (!mRenderThreadRunning) - return; - - bool shouldNotify = false; - { - std::lock_guard lock(mRenderThreadMutex); - if (!mRenderThreadStopping && !mPreviewPresentWakePending) - { - mPreviewPresentWakePending = true; - mRenderThreadTasks.push([this]() { - { - std::lock_guard lock(mRenderThreadMutex); - mPreviewPresentWakePending = false; - } - ProcessPreviewPresentCommandsOnRenderThread(); - }); - shouldNotify = true; - } - } - - if (shouldNotify) - mRenderThreadCondition.notify_one(); -} - -void RenderEngine::ProcessPreviewPresentCommandsOnRenderThread() -{ - RenderPreviewPresentRequest request; - if (mRenderCommandQueue.TryTakePreviewPresent(request)) - PresentPreviewOnRenderThread(request.outputFrameWidth, request.outputFrameHeight); -} - -void RenderEngine::EnqueueInputUploadWake() -{ - if (!mRenderThreadRunning || GetCurrentThreadId() == mRenderThreadId) - return; - - bool shouldNotify = false; - { - std::lock_guard lock(mRenderThreadMutex); - if (!mRenderThreadStopping && !mInputUploadWakePending) - { - mInputUploadWakePending = true; - mRenderThreadTasks.push([this]() { - { - std::lock_guard lock(mRenderThreadMutex); - mInputUploadWakePending = false; - } - ProcessInputUploadCommandsOnRenderThread(); - }); - shouldNotify = true; - } - } - - if (shouldNotify) - mRenderThreadCondition.notify_one(); -} - -void RenderEngine::ProcessInputUploadCommandsOnRenderThread() -{ - RenderInputUploadRequest request; - while (mRenderCommandQueue.TryTakeInputUpload(request)) - { - if (request.ownedBytes.empty()) - continue; - - request.inputFrame.bytes = request.ownedBytes.data(); - UploadInputFrameOnRenderThread(request.inputFrame, request.videoState); - } -} - -void RenderEngine::EnqueueScreenshotCaptureWake() -{ - if (!mRenderThreadRunning || GetCurrentThreadId() == mRenderThreadId) - return; - - bool shouldNotify = false; - { - std::lock_guard lock(mRenderThreadMutex); - if (!mRenderThreadStopping && !mScreenshotCaptureWakePending) - { - mScreenshotCaptureWakePending = true; - mRenderThreadTasks.push([this]() { - { - std::lock_guard lock(mRenderThreadMutex); - mScreenshotCaptureWakePending = false; - } - ProcessScreenshotCaptureCommandsOnRenderThread(); - }); - shouldNotify = true; - } - } - - if (shouldNotify) - mRenderThreadCondition.notify_one(); -} - -void RenderEngine::ProcessScreenshotCaptureCommandsOnRenderThread() -{ - RenderScreenshotCaptureRequest request; - ScreenshotCaptureCallback completion; - { - std::lock_guard lock(mRenderThreadMutex); - completion = mScreenshotCaptureCompletion; - } - - while (mRenderCommandQueue.TryTakeScreenshotCapture(request)) - { - if (!completion) - continue; - - std::vector topDownPixels; - if (CaptureOutputFrameRgbaTopDownOnRenderThread(request.width, request.height, topDownPixels)) - completion(request.width, request.height, std::move(topDownPixels)); - } -} - -void RenderEngine::ClearOscOverlayState() -{ - InvokeOnRenderThread([this]() { - mRuntimeLiveState.Clear(); - }); -} - -void RenderEngine::ClearOscOverlayStateForLayerKey(const std::string& layerKey) -{ - InvokeOnRenderThread([this, layerKey]() { - mRuntimeLiveState.ClearForLayerKey(layerKey); - }); -} - -void RenderEngine::UpdateOscOverlayState( - const std::vector& updates, - const std::vector& completedCommits) -{ - std::vector liveCompletions; - liveCompletions.reserve(completedCommits.size()); - for (const OscOverlayCommitCompletion& completedCommit : completedCommits) - liveCompletions.push_back({ completedCommit.routeKey, completedCommit.generation }); - mRuntimeLiveState.ApplyOscCommitCompletions(liveCompletions); - - std::vector liveUpdates; - liveUpdates.reserve(updates.size()); - for (const OscOverlayUpdate& update : updates) - liveUpdates.push_back({ update.routeKey, update.layerKey, update.parameterKey, update.targetValue }); - mRuntimeLiveState.ApplyOscUpdates(liveUpdates); -} - -void RenderEngine::ResizeView(int width, int height) -{ - InvokeOnRenderThread([this, width, height]() { - mRenderer.ResizeView(width, height); - }); -} - -bool RenderEngine::TryPresentPreview(bool force, unsigned previewFps, unsigned outputFrameWidth, unsigned outputFrameHeight) -{ - if (!force) - { - if (previewFps == 0) - return false; - - const auto now = std::chrono::steady_clock::now(); - const auto minimumInterval = std::chrono::microseconds(1000000 / (previewFps == 0 ? 1u : previewFps)); - if (mLastPreviewPresentTime != std::chrono::steady_clock::time_point() && - now - mLastPreviewPresentTime < minimumInterval) - { - return false; - } - } - - if (mRenderThreadRunning) - { - mRenderCommandQueue.RequestPreviewPresent({ outputFrameWidth, outputFrameHeight }); - EnqueuePreviewPresentWake(); - return true; - } - - ReportRenderThreadRequestFailure("preview-present", "render thread is not running"); - return false; -} - -bool RenderEngine::PresentPreviewOnRenderThread(unsigned outputFrameWidth, unsigned outputFrameHeight) -{ - ReportWrongThreadRenderAccess("preview-present"); - mRenderer.PresentToWindow(mHdc, outputFrameWidth, outputFrameHeight); - mLastPreviewPresentTime = std::chrono::steady_clock::now(); - return true; -} - -bool RenderEngine::RequestScreenshotCapture(unsigned width, unsigned height, ScreenshotCaptureCallback completion) -{ - if (width == 0 || height == 0 || !completion) - return false; - if (!mRenderThreadRunning) - return false; - - { - std::lock_guard lock(mRenderThreadMutex); - mScreenshotCaptureCompletion = std::move(completion); - } - mRenderCommandQueue.RequestScreenshotCapture({ width, height }); - EnqueueScreenshotCaptureWake(); - return true; -} - -bool RenderEngine::QueueInputFrame(const VideoIOFrame& inputFrame, const VideoIOState& videoState) -{ - if (inputFrame.hasNoInputSource || inputFrame.bytes == nullptr) - return true; - if (inputFrame.rowBytes <= 0 || inputFrame.height == 0) - return false; - - const std::size_t byteCount = static_cast(inputFrame.rowBytes) * inputFrame.height; - RenderInputUploadRequest request; - request.inputFrame = inputFrame; - request.videoState = videoState; - request.ownedBytes.resize(byteCount); - std::memcpy(request.ownedBytes.data(), inputFrame.bytes, byteCount); - request.inputFrame.bytes = nullptr; - - mRenderCommandQueue.RequestInputUpload(request); - EnqueueInputUploadWake(); - return true; -} - -bool RenderEngine::UploadInputFrameOnRenderThread(const VideoIOFrame& inputFrame, const VideoIOState& videoState) -{ - ReportWrongThreadRenderAccess("input-upload"); - const long textureSize = inputFrame.rowBytes * static_cast(inputFrame.height); - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - glBindBuffer(GL_PIXEL_UNPACK_BUFFER, mRenderer.TextureUploadBuffer()); - glBufferData(GL_PIXEL_UNPACK_BUFFER, textureSize, inputFrame.bytes, GL_DYNAMIC_DRAW); - glBindTexture(GL_TEXTURE_2D, mRenderer.CaptureTexture()); - if (inputFrame.pixelFormat == VideoIOPixelFormat::V210) - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, videoState.captureTextureWidth, videoState.inputFrameSize.height, GL_RGBA, GL_UNSIGNED_BYTE, NULL); - else - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, videoState.captureTextureWidth, videoState.inputFrameSize.height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL); - glBindTexture(GL_TEXTURE_2D, 0); - glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); - - return true; -} - -bool RenderEngine::RequestOutputFrame(const RenderPipelineFrameContext& context, VideoIOOutputFrame& outputFrame) -{ - if (mRenderThreadRunning) - { - const auto queuedAt = std::chrono::steady_clock::now(); - return TryInvokeOnRenderThread("output-render", [this, &context, &outputFrame, queuedAt]() { - const auto startedAt = std::chrono::steady_clock::now(); - const double queueWaitMilliseconds = std::chrono::duration_cast>(startedAt - queuedAt).count(); - mHealthTelemetry.TryRecordOutputRenderQueueWait(queueWaitMilliseconds); - mRenderCommandQueue.RequestOutputFrame({ context.videoState, context.completion }); - RenderOutputFrameRequest request; - return mRenderCommandQueue.TryTakeOutputFrame(request) && - RenderOutputFrameOnRenderThread({ request.videoState, request.completion }, outputFrame); - }); - } - - ReportRenderThreadRequestFailure("output-render", "render thread is not running"); - return false; -} - -bool RenderEngine::RenderOutputFrameOnRenderThread(const RenderPipelineFrameContext& context, VideoIOOutputFrame& outputFrame) -{ - ReportWrongThreadRenderAccess("output-render"); - ProcessRenderResetCommandsOnRenderThread(); - ProcessInputUploadCommandsOnRenderThread(); - return mRenderPipeline.RenderFrame(context, outputFrame); -} - -bool RenderEngine::ResolveRenderFrameState( - const RenderFrameInput& input, - std::vector* commitRequests, - RenderFrameState& frameState) -{ - std::vector liveCommitRequests; - const bool resolved = mFrameStateResolver.Resolve( - input, - mShaderPrograms.CommittedLayerStates(), - mRuntimeLiveState, - commitRequests ? &liveCommitRequests : nullptr, - frameState); - - if (commitRequests) - { - for (const RuntimeLiveOscCommitRequest& request : liveCommitRequests) - commitRequests->push_back({ request.routeKey, request.layerKey, request.parameterKey, request.value, request.generation }); - } - return resolved; -} - -void RenderEngine::RenderPreparedFrame(const RenderFrameState& frameState) -{ - RenderLayerStack( - frameState.hasInputSource, - frameState.layerStates, - frameState.inputFrameWidth, - frameState.inputFrameHeight, - frameState.captureTextureWidth, - frameState.inputPixelFormat, - frameState.historyCap); -} - -void RenderEngine::RenderLayerStack( - bool hasInputSource, - const std::vector& layerStates, - unsigned inputFrameWidth, - unsigned inputFrameHeight, - unsigned captureTextureWidth, - VideoIOPixelFormat inputPixelFormat, - unsigned historyCap) -{ - ReportWrongThreadRenderAccess("render-layer-stack"); - mRenderPass.Render( - hasInputSource, - layerStates, - inputFrameWidth, - inputFrameHeight, - captureTextureWidth, - inputPixelFormat, - historyCap, - [this](const RuntimeRenderState& state, OpenGLRenderer::LayerProgram::TextBinding& textBinding, std::string& error) { - return mShaderPrograms.UpdateTextBindingTexture(state, textBinding, error); - }, - [this](const RuntimeRenderState& state, unsigned availableSourceHistoryLength, unsigned availableTemporalHistoryLength, bool feedbackAvailable) { - return mShaderPrograms.UpdateGlobalParamsBuffer(state, availableSourceHistoryLength, availableTemporalHistoryLength, feedbackAvailable); - }); -} - -bool RenderEngine::ReadOutputFrameRgbaOnRenderThread(unsigned width, unsigned height, std::vector& bottomUpPixels) -{ - ReportWrongThreadRenderAccess("read-output-frame-rgba"); - if (width == 0 || height == 0) - return false; - - bottomUpPixels.resize(static_cast(width) * height * 4); - glBindFramebuffer(GL_READ_FRAMEBUFFER, mRenderer.OutputFramebuffer()); - glReadBuffer(GL_COLOR_ATTACHMENT0); - glPixelStorei(GL_PACK_ALIGNMENT, 1); - glPixelStorei(GL_PACK_ROW_LENGTH, 0); - glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, bottomUpPixels.data()); - glPixelStorei(GL_PACK_ALIGNMENT, 4); - - return true; -} - -bool RenderEngine::CaptureOutputFrameRgbaTopDownOnRenderThread(unsigned width, unsigned height, std::vector& topDownPixels) -{ - std::vector bottomUpPixels; - if (!ReadOutputFrameRgbaOnRenderThread(width, height, bottomUpPixels)) - return false; - - topDownPixels.resize(bottomUpPixels.size()); - const std::size_t rowBytes = static_cast(width) * 4; - for (unsigned y = 0; y < height; ++y) - { - const unsigned sourceY = height - 1 - y; - std::copy( - bottomUpPixels.begin() + static_cast(sourceY * rowBytes), - bottomUpPixels.begin() + static_cast((sourceY + 1) * rowBytes), - topDownPixels.begin() + static_cast(y * rowBytes)); - } - - return true; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/RenderEngine.h b/apps/LoopThroughWithOpenGLCompositing/gl/RenderEngine.h deleted file mode 100644 index 72ee54d..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/RenderEngine.h +++ /dev/null @@ -1,232 +0,0 @@ -#pragma once - -#include "OpenGLRenderPass.h" -#include "OpenGLRenderPipeline.h" -#include "OpenGLRenderer.h" -#include "OpenGLShaderPrograms.h" -#include "RenderCommandQueue.h" -#include "RenderFrameState.h" -#include "RenderFrameStateResolver.h" -#include "HealthTelemetry.h" -#include "RuntimeCoordinator.h" -#include "RuntimeSnapshotProvider.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class RenderEngine -{ -public: - using RenderEffectCallback = std::function; - using ScreenshotCallback = std::function; - using ScreenshotCaptureCallback = std::function)>; - using PreviewPaintCallback = std::function; - - struct OscOverlayUpdate - { - std::string routeKey; - std::string layerKey; - std::string parameterKey; - JsonValue targetValue; - }; - - struct OscOverlayCommitCompletion - { - std::string routeKey; - uint64_t generation = 0; - }; - - struct OscOverlayCommitRequest - { - std::string routeKey; - std::string layerKey; - std::string parameterKey; - JsonValue value; - uint64_t generation = 0; - }; - - RenderEngine( - RuntimeSnapshotProvider& runtimeSnapshotProvider, - HealthTelemetry& healthTelemetry, - HDC hdc, - HGLRC hglrc, - RenderEffectCallback renderEffect, - ScreenshotCallback screenshotReady, - PreviewPaintCallback previewPaint); - ~RenderEngine(); - - bool StartRenderThread(); - void StopRenderThread(); - - bool CompileDecodeShader(int errorMessageSize, char* errorMessage); - bool CompileOutputPackShader(int errorMessageSize, char* errorMessage); - bool InitializeResources( - unsigned inputFrameWidth, - unsigned inputFrameHeight, - unsigned captureTextureWidth, - unsigned outputFrameWidth, - unsigned outputFrameHeight, - unsigned outputPackTextureWidth, - std::string& error); - bool CompileLayerPrograms(unsigned inputFrameWidth, unsigned inputFrameHeight, int errorMessageSize, char* errorMessage); - bool ApplyPreparedShaderBuild( - const PreparedShaderBuild& preparedBuild, - unsigned inputFrameWidth, - unsigned inputFrameHeight, - bool preserveFeedbackState, - int errorMessageSize, - char* errorMessage); - - void ResetTemporalHistoryState(); - void ResetShaderFeedbackState(); - void ApplyRuntimeCoordinatorRenderReset(RuntimeCoordinatorRenderResetScope resetScope); - void ClearOscOverlayState(); - void ClearOscOverlayStateForLayerKey(const std::string& layerKey); - void UpdateOscOverlayState( - const std::vector& updates, - const std::vector& completedCommits); - void ResizeView(int width, int height); - bool TryPresentPreview(bool force, unsigned previewFps, unsigned outputFrameWidth, unsigned outputFrameHeight); - bool RequestScreenshotCapture(unsigned width, unsigned height, ScreenshotCaptureCallback completion); - bool QueueInputFrame(const VideoIOFrame& inputFrame, const VideoIOState& videoState); - bool RequestOutputFrame(const RenderPipelineFrameContext& context, VideoIOOutputFrame& outputFrame); - bool ResolveRenderFrameState( - const RenderFrameInput& input, - std::vector* commitRequests, - RenderFrameState& frameState); - void RenderPreparedFrame(const RenderFrameState& frameState); - -private: - static constexpr std::chrono::milliseconds kRenderThreadRequestTimeout{ 250 }; - - struct RenderThreadTaskState - { - std::atomic started = false; - std::atomic cancelled = false; - }; - - template - auto InvokeOnRenderThread(Func&& func) -> decltype(func()) - { - using Result = decltype(func()); - if (!mRenderThreadRunning || GetCurrentThreadId() == mRenderThreadId) - return func(); - - auto task = std::make_shared>(std::forward(func)); - std::future result = task->get_future(); - { - std::lock_guard lock(mRenderThreadMutex); - mRenderThreadTasks.push([task]() { (*task)(); }); - } - mRenderThreadCondition.notify_one(); - return result.get(); - } - - template - bool TryInvokeOnRenderThread(const char* operationName, Func&& func) - { - if (!mRenderThreadRunning || GetCurrentThreadId() == mRenderThreadId) - return func(); - - auto state = std::make_shared(); - auto task = std::make_shared>( - [state, func = std::forward(func)]() mutable { - state->started = true; - if (state->cancelled) - return false; - - return func(); - }); - std::future result = task->get_future(); - { - std::lock_guard lock(mRenderThreadMutex); - if (mRenderThreadStopping) - { - ReportRenderThreadRequestFailure(operationName, "render thread is stopping"); - return false; - } - mRenderThreadTasks.push([task]() { (*task)(); }); - } - mRenderThreadCondition.notify_one(); - - if (result.wait_for(kRenderThreadRequestTimeout) == std::future_status::ready) - return result.get(); - - if (!state->started) - { - state->cancelled = true; - ReportRenderThreadRequestFailure(operationName, "timed out before execution"); - return false; - } - - ReportRenderThreadRequestFailure(operationName, "exceeded timeout while executing; waiting for safe completion"); - return result.get(); - } - - void RenderThreadMain(std::promise ready); - void ReportRenderThreadRequestFailure(const char* operationName, const char* reason); - bool IsRenderThreadAccessExpected() const; - void ReportWrongThreadRenderAccess(const char* operationName) const; - bool CommitPreparedLayerPrograms(const PreparedShaderBuild& preparedBuild, unsigned inputFrameWidth, unsigned inputFrameHeight, int errorMessageSize, char* errorMessage); - void RenderLayerStack( - bool hasInputSource, - const std::vector& layerStates, - unsigned inputFrameWidth, - unsigned inputFrameHeight, - unsigned captureTextureWidth, - VideoIOPixelFormat inputPixelFormat, - unsigned historyCap); - void ResetTemporalHistoryStateOnRenderThread(); - void ResetShaderFeedbackStateOnRenderThread(); - void ApplyRenderResetOnRenderThread(RenderCommandResetScope resetScope); - void ProcessRenderResetCommandsOnRenderThread(); - void EnqueuePreviewPresentWake(); - void ProcessPreviewPresentCommandsOnRenderThread(); - void EnqueueInputUploadWake(); - void ProcessInputUploadCommandsOnRenderThread(); - void EnqueueScreenshotCaptureWake(); - void ProcessScreenshotCaptureCommandsOnRenderThread(); - bool PresentPreviewOnRenderThread(unsigned outputFrameWidth, unsigned outputFrameHeight); - bool UploadInputFrameOnRenderThread(const VideoIOFrame& inputFrame, const VideoIOState& videoState); - bool RenderOutputFrameOnRenderThread(const RenderPipelineFrameContext& context, VideoIOOutputFrame& outputFrame); - bool ReadOutputFrameRgbaOnRenderThread(unsigned width, unsigned height, std::vector& bottomUpPixels); - bool CaptureOutputFrameRgbaTopDownOnRenderThread(unsigned width, unsigned height, std::vector& topDownPixels); - - OpenGLRenderer mRenderer; - OpenGLRenderPass mRenderPass; - OpenGLRenderPipeline mRenderPipeline; - OpenGLShaderPrograms mShaderPrograms; - HealthTelemetry& mHealthTelemetry; - HDC mHdc; - HGLRC mHglrc; - - std::chrono::steady_clock::time_point mLastPreviewPresentTime; - RenderCommandQueue mRenderCommandQueue; - RenderFrameStateResolver mFrameStateResolver; - RuntimeLiveState mRuntimeLiveState; - std::thread mRenderThread; - std::atomic mRenderThreadId = 0; - std::mutex mRenderThreadMutex; - std::condition_variable mRenderThreadCondition; - std::queue> mRenderThreadTasks; - std::atomic mRenderThreadRunning = false; - bool mRenderThreadStopping = false; - bool mPreviewPresentWakePending = false; - bool mInputUploadWakePending = false; - bool mScreenshotCaptureWakePending = false; - ScreenshotCaptureCallback mScreenshotCaptureCompletion; - bool mResourcesDestroyed = false; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLComposite.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLComposite.cpp deleted file mode 100644 index 0978a9d..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLComposite.cpp +++ /dev/null @@ -1,428 +0,0 @@ -#include "DeckLinkDisplayMode.h" -#include "OpenGLComposite.h" -#include "GLExtensions.h" -#include "PngScreenshotWriter.h" -#include "RenderEngine.h" -#include "RuntimeCoordinator.h" -#include "RuntimeEventDispatcher.h" -#include "RuntimeServiceLiveBridge.h" -#include "RuntimeServices.h" -#include "RuntimeSnapshotProvider.h" -#include "RuntimeStore.h" -#include "RuntimeUpdateController.h" -#include "ShaderBuildQueue.h" -#include "VideoBackend.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -OpenGLComposite::OpenGLComposite(HWND hWnd, HDC hDC, HGLRC hRC) : - hGLWnd(hWnd), hGLDC(hDC), hGLRC(hRC) -{ - mRuntimeStore = std::make_unique(); - mRuntimeEventDispatcher = std::make_unique(); - mRuntimeSnapshotProvider = std::make_unique(mRuntimeStore->GetRenderSnapshotBuilder(), *mRuntimeEventDispatcher); - mRuntimeCoordinator = std::make_unique(*mRuntimeStore, *mRuntimeEventDispatcher); - mRenderEngine = std::make_unique( - *mRuntimeSnapshotProvider, - mRuntimeStore->GetHealthTelemetry(), - hGLDC, - hGLRC, - [this]() { renderEffect(); }, - []() {}, - [this]() { paintGL(false); }); - mVideoBackend = std::make_unique(*mRenderEngine, mRuntimeStore->GetHealthTelemetry(), *mRuntimeEventDispatcher); - mShaderBuildQueue = std::make_unique(*mRuntimeSnapshotProvider, *mRuntimeEventDispatcher); - mRuntimeServices = std::make_unique(*mRuntimeEventDispatcher); - mRuntimeUpdateController = std::make_unique( - *mRuntimeStore, - *mRuntimeCoordinator, - *mRuntimeEventDispatcher, - *mRuntimeServices, - *mRenderEngine, - *mShaderBuildQueue, - *mVideoBackend); -} - -OpenGLComposite::~OpenGLComposite() -{ - if (mRuntimeServices) - mRuntimeServices->Stop(); - if (mShaderBuildQueue) - mShaderBuildQueue->Stop(); - if (mVideoBackend) - mVideoBackend->ReleaseResources(); - if (mRuntimeStore) - { - std::string persistenceError; - if (!mRuntimeStore->FlushPersistenceForShutdown(std::chrono::seconds(2), persistenceError)) - OutputDebugStringA((std::string("Persistence shutdown flush failed: ") + persistenceError + "\n").c_str()); - } -} - -bool OpenGLComposite::InitDeckLink() -{ - return InitVideoIO(); -} - -bool OpenGLComposite::InitVideoIO() -{ - VideoFormatSelection videoModes; - std::string initFailureReason; - - if (mRuntimeStore && mRuntimeStore->GetRuntimeRepositoryRoot().empty()) - { - std::string runtimeError; - if (!mRuntimeStore->InitializeStore(runtimeError)) - { - MessageBoxA(NULL, runtimeError.c_str(), "Runtime host failed to initialize", MB_OK); - return false; - } - } - - if (mRuntimeStore) - { - if (!ResolveConfiguredVideoFormats( - mRuntimeStore->GetConfiguredInputVideoFormat(), - mRuntimeStore->GetConfiguredInputFrameRate(), - mRuntimeStore->GetConfiguredOutputVideoFormat(), - mRuntimeStore->GetConfiguredOutputFrameRate(), - videoModes, - initFailureReason)) - { - MessageBoxA(NULL, initFailureReason.c_str(), "DeckLink mode configuration error", MB_OK); - return false; - } - } - - if (!mVideoBackend->DiscoverDevicesAndModes(videoModes, initFailureReason)) - { - const char* title = initFailureReason == "Please install the Blackmagic DeckLink drivers to use the features of this application." - ? "This application requires the DeckLink drivers installed." - : "DeckLink initialization failed"; - MessageBoxA(NULL, initFailureReason.c_str(), title, MB_OK | MB_ICONERROR); - return false; - } - const bool outputAlphaRequired = mRuntimeStore && mRuntimeStore->IsExternalKeyingConfigured(); - if (!mVideoBackend->SelectPreferredFormats(videoModes, outputAlphaRequired, initFailureReason)) - goto error; - - if (! CheckOpenGLExtensions()) - { - initFailureReason = "OpenGL extension checks failed."; - goto error; - } - - if (! InitOpenGLState()) - { - initFailureReason = "OpenGL state initialization failed."; - goto error; - } - - mVideoBackend->PublishStatus( - mRuntimeStore && mRuntimeStore->IsExternalKeyingConfigured(), - mVideoBackend->OutputModelName().empty() - ? "DeckLink output device selected." - : ("Selected output device: " + mVideoBackend->OutputModelName())); - - // Resize window to match output video frame, but scale large formats down by half for viewing. - if (mVideoBackend->OutputFrameWidth() < 1920) - resizeWindow(mVideoBackend->OutputFrameWidth(), mVideoBackend->OutputFrameHeight()); - else - resizeWindow(mVideoBackend->OutputFrameWidth() / 2, mVideoBackend->OutputFrameHeight() / 2); - - if (!mVideoBackend->ConfigureInput(videoModes.input, initFailureReason)) - { - goto error; - } - if (!mVideoBackend->HasInputDevice()) - mVideoBackend->ReportNoInputDeviceSignalStatus(); - - if (!mVideoBackend->ConfigureOutput(videoModes.output, mRuntimeStore && mRuntimeStore->IsExternalKeyingConfigured(), initFailureReason)) - { - goto error; - } - - mVideoBackend->PublishStatus( - mRuntimeStore && mRuntimeStore->IsExternalKeyingConfigured(), - mVideoBackend->StatusMessage()); - - return true; - -error: - if (!initFailureReason.empty()) - MessageBoxA(NULL, initFailureReason.c_str(), "DeckLink initialization failed", MB_OK | MB_ICONERROR); - mVideoBackend->ReleaseResources(); - return false; -} - -void OpenGLComposite::paintGL(bool force) -{ - if (mRuntimeUpdateController) - mRuntimeUpdateController->ProcessRuntimeWork(); - - if (!force) - { - if (IsIconic(hGLWnd)) - return; - } - - const unsigned previewFps = mRuntimeStore ? mRuntimeStore->GetConfiguredPreviewFps() : 30u; - if (!force && mVideoBackend && mVideoBackend->ShouldPrioritizeOutputOverPreview()) - { - ValidateRect(hGLWnd, NULL); - return; - } - - if (!mRenderEngine->TryPresentPreview(force, previewFps, mVideoBackend->OutputFrameWidth(), mVideoBackend->OutputFrameHeight())) - { - ValidateRect(hGLWnd, NULL); - return; - } - - ValidateRect(hGLWnd, NULL); -} - -void OpenGLComposite::resizeGL(WORD width, WORD height) -{ - // We don't set the project or model matrices here since the window data is copied directly from - // an off-screen FBO in paintGL(). Just save the width and height for use in paintGL(). - mRenderEngine->ResizeView(width, height); -} - -void OpenGLComposite::resizeWindow(int width, int height) -{ - RECT r; - if (GetWindowRect(hGLWnd, &r)) - { - SetWindowPos(hGLWnd, HWND_TOP, r.left, r.top, r.left + width, r.top + height, 0); - } -} - -bool OpenGLComposite::InitOpenGLState() -{ - if (! ResolveGLExtensions()) - return false; - - std::string runtimeError; - if (mRuntimeStore->GetRuntimeRepositoryRoot().empty() && !mRuntimeStore->InitializeStore(runtimeError)) - { - MessageBoxA(NULL, runtimeError.c_str(), "Runtime host failed to initialize", MB_OK); - return false; - } - - if (!mRuntimeServices->Start(*this, *mRuntimeStore, runtimeError)) - { - MessageBoxA(NULL, runtimeError.c_str(), "Runtime control services failed to start", MB_OK); - return false; - } - - // Prepare the runtime shader program generated from the active shader package. - char compilerErrorMessage[1024]; - if (!mRenderEngine->CompileDecodeShader(sizeof(compilerErrorMessage), compilerErrorMessage)) - { - MessageBoxA(NULL, compilerErrorMessage, "OpenGL decode shader failed to load or compile", MB_OK); - return false; - } - if (!mRenderEngine->CompileOutputPackShader(sizeof(compilerErrorMessage), compilerErrorMessage)) - { - MessageBoxA(NULL, compilerErrorMessage, "OpenGL output pack shader failed to load or compile", MB_OK); - return false; - } - - std::string rendererError; - if (!mRenderEngine->InitializeResources( - mVideoBackend->InputFrameWidth(), - mVideoBackend->InputFrameHeight(), - mVideoBackend->CaptureTextureWidth(), - mVideoBackend->OutputFrameWidth(), - mVideoBackend->OutputFrameHeight(), - mVideoBackend->OutputPackTextureWidth(), - rendererError)) - { - MessageBoxA(NULL, rendererError.c_str(), "OpenGL initialization error.", MB_OK); - return false; - } - - if (!mRenderEngine->CompileLayerPrograms(mVideoBackend->InputFrameWidth(), mVideoBackend->InputFrameHeight(), sizeof(compilerErrorMessage), compilerErrorMessage)) - { - MessageBoxA(NULL, compilerErrorMessage, "OpenGL shader failed to load or compile", MB_OK); - return false; - } - mRuntimeStore->SetCompileStatus(true, "Shader layers compiled successfully."); - - mRenderEngine->ResetTemporalHistoryState(); - mRenderEngine->ResetShaderFeedbackState(); - - mRuntimeUpdateController->BroadcastRuntimeState(); - mRuntimeServices->BeginPolling(*mRuntimeCoordinator); - return true; -} - -bool OpenGLComposite::Start() -{ - if (!mRenderEngine->StartRenderThread()) - return false; - - if (mRuntimeUpdateController) - mRuntimeUpdateController->ProcessRuntimeWork(); - - if (mVideoBackend->Start()) - return true; - - mRenderEngine->StopRenderThread(); - return false; -} - -bool OpenGLComposite::Stop() -{ - if (mRuntimeServices) - mRuntimeServices->Stop(); - - const bool wasExternalKeyingActive = mVideoBackend->ExternalKeyingActive(); - mVideoBackend->Stop(); - if (wasExternalKeyingActive) - mVideoBackend->PublishStatus( - mRuntimeStore && mRuntimeStore->IsExternalKeyingConfigured(), - "External keying has been disabled."); - - if (mRenderEngine) - mRenderEngine->StopRenderThread(); - - if (mRuntimeStore) - { - std::string persistenceError; - if (!mRuntimeStore->FlushPersistenceForShutdown(std::chrono::seconds(2), persistenceError)) - OutputDebugStringA((std::string("Persistence shutdown flush failed: ") + persistenceError + "\n").c_str()); - } - - return true; -} - -bool OpenGLComposite::ReloadShader(bool preserveFeedbackState) -{ - return mRuntimeCoordinator && - mRuntimeUpdateController && - mRuntimeUpdateController->ApplyRuntimeCoordinatorResult(mRuntimeCoordinator->RequestShaderReload(preserveFeedbackState)); -} - -bool OpenGLComposite::RequestScreenshot(std::string& error) -{ - if (!mRenderEngine || !mVideoBackend) - { - error = "The render engine is not ready."; - return false; - } - - const unsigned width = mVideoBackend->OutputFrameWidth(); - const unsigned height = mVideoBackend->OutputFrameHeight(); - if (width == 0 || height == 0) - { - error = "The output frame size is not available."; - return false; - } - - std::filesystem::path outputPath; - try - { - outputPath = BuildScreenshotPath(); - std::filesystem::create_directories(outputPath.parent_path()); - } - catch (const std::exception& exception) - { - error = exception.what(); - return false; - } - - if (!mRenderEngine->RequestScreenshotCapture( - width, - height, - [outputPath](unsigned captureWidth, unsigned captureHeight, std::vector topDownPixels) { - try - { - WritePngFileAsync(outputPath, captureWidth, captureHeight, std::move(topDownPixels)); - } - catch (const std::exception& exception) - { - OutputDebugStringA((std::string("Screenshot request failed: ") + exception.what() + "\n").c_str()); - } - })) - { - error = "Screenshot capture request failed."; - return false; - } - - return true; -} - -void OpenGLComposite::renderEffect() -{ - const RenderFrameInput frameInput = BuildRenderFrameInput(); - RenderFrame(frameInput); -} - -RenderFrameInput OpenGLComposite::BuildRenderFrameInput() const -{ - RenderFrameInput frameInput; - frameInput.useCommittedLayerStates = mRuntimeCoordinator && mRuntimeCoordinator->UseCommittedLayerStates(); - frameInput.hasInputSource = mVideoBackend->HasInputSource(); - frameInput.renderWidth = mVideoBackend->InputFrameWidth(); - frameInput.renderHeight = mVideoBackend->InputFrameHeight(); - frameInput.inputFrameWidth = mVideoBackend->InputFrameWidth(); - frameInput.inputFrameHeight = mVideoBackend->InputFrameHeight(); - frameInput.captureTextureWidth = mVideoBackend->CaptureTextureWidth(); - frameInput.inputPixelFormat = mVideoBackend->InputPixelFormat(); - frameInput.historyCap = mRuntimeStore ? mRuntimeStore->GetConfiguredMaxTemporalHistoryFrames() : 0; - frameInput.oscSmoothing = mRuntimeStore ? mRuntimeStore->GetConfiguredOscSmoothing() : 0.0; - return frameInput; -} - -void OpenGLComposite::RenderFrame(const RenderFrameInput& frameInput) -{ - RenderFrameState frameState; - if (mRuntimeServices) - { - RuntimeServiceLiveBridge::PrepareLiveRenderFrameState( - *mRuntimeServices, - *mRenderEngine, - frameInput, - frameState); - } - else - { - mRenderEngine->ResolveRenderFrameState(frameInput, nullptr, frameState); - } - mRenderEngine->RenderPreparedFrame(frameState); -} - -std::filesystem::path OpenGLComposite::BuildScreenshotPath() const -{ - const std::filesystem::path root = mRuntimeStore && !mRuntimeStore->GetRuntimeDataRoot().empty() - ? mRuntimeStore->GetRuntimeDataRoot() - : std::filesystem::current_path(); - - const auto now = std::chrono::system_clock::now(); - const auto milliseconds = std::chrono::duration_cast(now.time_since_epoch()) % 1000; - const std::time_t nowTime = std::chrono::system_clock::to_time_t(now); - std::tm localTime = {}; - localtime_s(&localTime, &nowTime); - - std::ostringstream filename; - filename << "video-shader-toys-" - << std::put_time(&localTime, "%Y%m%d-%H%M%S") - << "-" << std::setw(3) << std::setfill('0') << milliseconds.count() - << ".png"; - - return root / "screenshots" / filename.str(); -} - -bool OpenGLComposite::CheckOpenGLExtensions() -{ - return true; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLComposite.h b/apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLComposite.h deleted file mode 100644 index 1e0ca4d..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLComposite.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef __OPENGL_COMPOSITE_H__ -#define __OPENGL_COMPOSITE_H__ - -#include -#include - -#include "RenderFrameState.h" - -#include -#include -#include - -class RenderEngine; -class RuntimeCoordinator; -class RuntimeEventDispatcher; -class RuntimeSnapshotProvider; -class RuntimeServices; -class RuntimeStore; -class RuntimeUpdateController; -class ShaderBuildQueue; -class VideoBackend; - - -class OpenGLComposite -{ -public: - OpenGLComposite(HWND hWnd, HDC hDC, HGLRC hRC); - ~OpenGLComposite(); - - bool InitDeckLink(); - bool InitVideoIO(); - bool Start(); - bool Stop(); - bool ReloadShader(bool preserveFeedbackState = false); - std::string GetRuntimeStateJson() const; - bool AddLayer(const std::string& shaderId, std::string& error); - bool RemoveLayer(const std::string& layerId, std::string& error); - bool MoveLayer(const std::string& layerId, int direction, std::string& error); - bool MoveLayerToIndex(const std::string& layerId, std::size_t targetIndex, std::string& error); - bool SetLayerBypass(const std::string& layerId, bool bypassed, std::string& error); - bool SetLayerShader(const std::string& layerId, const std::string& shaderId, std::string& error); - bool UpdateLayerParameterJson(const std::string& layerId, const std::string& parameterId, const std::string& valueJson, std::string& error); - bool UpdateLayerParameterByControlKeyJson(const std::string& layerKey, const std::string& parameterKey, const std::string& valueJson, std::string& error); - bool ResetLayerParameters(const std::string& layerId, std::string& error); - bool SaveStackPreset(const std::string& presetName, std::string& error); - bool LoadStackPreset(const std::string& presetName, std::string& error); - bool RequestScreenshot(std::string& error); - unsigned short GetControlServerPort() const; - unsigned short GetOscPort() const; - std::string GetOscBindAddress() const; - std::string GetControlUrl() const; - std::string GetDocsUrl() const; - std::string GetOscAddress() const; - - void resizeGL(WORD width, WORD height); - void paintGL(bool force = false); - -private: - void resizeWindow(int width, int height); - bool CheckOpenGLExtensions(); - - HWND hGLWnd; - HDC hGLDC; - HGLRC hGLRC; - - std::unique_ptr mRuntimeStore; - std::unique_ptr mRuntimeCoordinator; - std::unique_ptr mRuntimeSnapshotProvider; - std::unique_ptr mRuntimeEventDispatcher; - std::unique_ptr mRenderEngine; - std::unique_ptr mShaderBuildQueue; - std::unique_ptr mRuntimeServices; - std::unique_ptr mRuntimeUpdateController; - std::unique_ptr mVideoBackend; - - bool InitOpenGLState(); - void renderEffect(); - RenderFrameInput BuildRenderFrameInput() const; - void RenderFrame(const RenderFrameInput& frameInput); - std::filesystem::path BuildScreenshotPath() const; -}; - -#endif // __OPENGL_COMPOSITE_H__ diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLCompositeRuntimeControls.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLCompositeRuntimeControls.cpp deleted file mode 100644 index df49ff5..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/composite/OpenGLCompositeRuntimeControls.cpp +++ /dev/null @@ -1,126 +0,0 @@ -#include "OpenGLComposite.h" -#include "RuntimeCoordinator.h" -#include "RuntimeJson.h" -#include "RuntimeServices.h" -#include "RuntimeStore.h" -#include "RuntimeUpdateController.h" - -std::string OpenGLComposite::GetRuntimeStateJson() const -{ - return mRuntimeStore ? mRuntimeStore->BuildPersistentStateJson() : "{}"; -} - -unsigned short OpenGLComposite::GetControlServerPort() const -{ - return mRuntimeStore ? mRuntimeStore->GetConfiguredControlServerPort() : 0; -} - -unsigned short OpenGLComposite::GetOscPort() const -{ - return mRuntimeStore ? mRuntimeStore->GetConfiguredOscPort() : 0; -} - -std::string OpenGLComposite::GetOscBindAddress() const -{ - return mRuntimeStore ? mRuntimeStore->GetConfiguredOscBindAddress() : "127.0.0.1"; -} - -std::string OpenGLComposite::GetControlUrl() const -{ - return "http://127.0.0.1:" + std::to_string(GetControlServerPort()) + "/"; -} - -std::string OpenGLComposite::GetDocsUrl() const -{ - return "http://127.0.0.1:" + std::to_string(GetControlServerPort()) + "/docs"; -} - -std::string OpenGLComposite::GetOscAddress() const -{ - return "udp://" + GetOscBindAddress() + ":" + std::to_string(GetOscPort()) + " /VideoShaderToys/{Layer}/{Parameter}"; -} - -bool OpenGLComposite::AddLayer(const std::string& shaderId, std::string& error) -{ - return mRuntimeCoordinator && - mRuntimeUpdateController && - mRuntimeUpdateController->ApplyRuntimeCoordinatorResult(mRuntimeCoordinator->AddLayer(shaderId), &error); -} - -bool OpenGLComposite::RemoveLayer(const std::string& layerId, std::string& error) -{ - return mRuntimeCoordinator && - mRuntimeUpdateController && - mRuntimeUpdateController->ApplyRuntimeCoordinatorResult(mRuntimeCoordinator->RemoveLayer(layerId), &error); -} - -bool OpenGLComposite::MoveLayer(const std::string& layerId, int direction, std::string& error) -{ - return mRuntimeCoordinator && - mRuntimeUpdateController && - mRuntimeUpdateController->ApplyRuntimeCoordinatorResult(mRuntimeCoordinator->MoveLayer(layerId, direction), &error); -} - -bool OpenGLComposite::MoveLayerToIndex(const std::string& layerId, std::size_t targetIndex, std::string& error) -{ - return mRuntimeCoordinator && - mRuntimeUpdateController && - mRuntimeUpdateController->ApplyRuntimeCoordinatorResult(mRuntimeCoordinator->MoveLayerToIndex(layerId, targetIndex), &error); -} - -bool OpenGLComposite::SetLayerBypass(const std::string& layerId, bool bypassed, std::string& error) -{ - return mRuntimeCoordinator && - mRuntimeUpdateController && - mRuntimeUpdateController->ApplyRuntimeCoordinatorResult(mRuntimeCoordinator->SetLayerBypass(layerId, bypassed), &error); -} - -bool OpenGLComposite::SetLayerShader(const std::string& layerId, const std::string& shaderId, std::string& error) -{ - return mRuntimeCoordinator && - mRuntimeUpdateController && - mRuntimeUpdateController->ApplyRuntimeCoordinatorResult(mRuntimeCoordinator->SetLayerShader(layerId, shaderId), &error); -} - -bool OpenGLComposite::UpdateLayerParameterJson(const std::string& layerId, const std::string& parameterId, const std::string& valueJson, std::string& error) -{ - JsonValue parsedValue; - if (!ParseJson(valueJson, parsedValue, error)) - return false; - - return mRuntimeCoordinator && - mRuntimeUpdateController && - mRuntimeUpdateController->ApplyRuntimeCoordinatorResult(mRuntimeCoordinator->UpdateLayerParameter(layerId, parameterId, parsedValue), &error); -} - -bool OpenGLComposite::UpdateLayerParameterByControlKeyJson(const std::string& layerKey, const std::string& parameterKey, const std::string& valueJson, std::string& error) -{ - JsonValue parsedValue; - if (!ParseJson(valueJson, parsedValue, error)) - return false; - - return mRuntimeCoordinator && - mRuntimeUpdateController && - mRuntimeUpdateController->ApplyRuntimeCoordinatorResult(mRuntimeCoordinator->UpdateLayerParameterByControlKey(layerKey, parameterKey, parsedValue), &error); -} - -bool OpenGLComposite::ResetLayerParameters(const std::string& layerId, std::string& error) -{ - return mRuntimeCoordinator && - mRuntimeUpdateController && - mRuntimeUpdateController->ApplyRuntimeCoordinatorResult(mRuntimeCoordinator->ResetLayerParameters(layerId), &error); -} - -bool OpenGLComposite::SaveStackPreset(const std::string& presetName, std::string& error) -{ - return mRuntimeCoordinator && - mRuntimeUpdateController && - mRuntimeUpdateController->ApplyRuntimeCoordinatorResult(mRuntimeCoordinator->SaveStackPreset(presetName), &error); -} - -bool OpenGLComposite::LoadStackPreset(const std::string& presetName, std::string& error) -{ - return mRuntimeCoordinator && - mRuntimeUpdateController && - mRuntimeUpdateController->ApplyRuntimeCoordinatorResult(mRuntimeCoordinator->LoadStackPreset(presetName), &error); -} diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/frame/RenderFrameState.h b/apps/LoopThroughWithOpenGLCompositing/gl/frame/RenderFrameState.h deleted file mode 100644 index f497ac3..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/frame/RenderFrameState.h +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#include "ShaderTypes.h" -#include "VideoIOTypes.h" - -#include - -struct RenderFrameInput -{ - bool useCommittedLayerStates = false; - bool hasInputSource = false; - unsigned renderWidth = 0; - unsigned renderHeight = 0; - unsigned inputFrameWidth = 0; - unsigned inputFrameHeight = 0; - unsigned captureTextureWidth = 0; - VideoIOPixelFormat inputPixelFormat = VideoIOPixelFormat::Uyvy8; - unsigned historyCap = 0; - double oscSmoothing = 0.0; -}; - -struct RenderFrameState -{ - bool hasInputSource = false; - unsigned inputFrameWidth = 0; - unsigned inputFrameHeight = 0; - unsigned captureTextureWidth = 0; - VideoIOPixelFormat inputPixelFormat = VideoIOPixelFormat::Uyvy8; - unsigned historyCap = 0; - std::vector layerStates; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/frame/RenderFrameStateResolver.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/frame/RenderFrameStateResolver.cpp deleted file mode 100644 index 4f42148..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/frame/RenderFrameStateResolver.cpp +++ /dev/null @@ -1,119 +0,0 @@ -#include "RenderFrameStateResolver.h" - -#include - -namespace -{ -constexpr auto kOscOverlayCommitDelay = std::chrono::milliseconds(150); -} - -RenderFrameStateResolver::RenderFrameStateResolver(RuntimeSnapshotProvider& runtimeSnapshotProvider) : - mRuntimeSnapshotProvider(runtimeSnapshotProvider) -{ -} - -void RenderFrameStateResolver::StoreCommittedSnapshot( - const RuntimeRenderStateSnapshot& snapshot, - const std::vector& committedLayerStates) -{ - mCachedLayerRenderStates = committedLayerStates; - mCachedRenderStateVersion = snapshot.versions.renderStateVersion; - mCachedParameterStateVersion = snapshot.versions.parameterStateVersion; - mCachedRenderStateWidth = snapshot.outputWidth; - mCachedRenderStateHeight = snapshot.outputHeight; -} - -bool RenderFrameStateResolver::Resolve( - const RenderFrameInput& input, - const std::vector& committedLayerStates, - RuntimeLiveState& liveState, - std::vector* commitRequests, - RenderFrameState& frameState) -{ - frameState.hasInputSource = input.hasInputSource; - frameState.inputFrameWidth = input.inputFrameWidth; - frameState.inputFrameHeight = input.inputFrameHeight; - frameState.captureTextureWidth = input.captureTextureWidth; - frameState.inputPixelFormat = input.inputPixelFormat; - frameState.historyCap = input.historyCap; - frameState.layerStates.clear(); - - if (input.useCommittedLayerStates) - { - frameState.layerStates = ComposeLayerStates(committedLayerStates, liveState, false, input.oscSmoothing, commitRequests); - mRuntimeSnapshotProvider.RefreshDynamicRenderStateFields(frameState.layerStates); - return true; - } - - const RuntimeSnapshotVersions versions = mRuntimeSnapshotProvider.GetVersions(); - const bool renderStateCacheValid = - !mCachedLayerRenderStates.empty() && - mCachedRenderStateVersion == versions.renderStateVersion && - mCachedRenderStateWidth == input.renderWidth && - mCachedRenderStateHeight == input.renderHeight; - - if (renderStateCacheValid) - { - RuntimeRenderStateSnapshot renderSnapshot; - renderSnapshot.outputWidth = input.renderWidth; - renderSnapshot.outputHeight = input.renderHeight; - renderSnapshot.versions.renderStateVersion = mCachedRenderStateVersion; - renderSnapshot.versions.parameterStateVersion = mCachedParameterStateVersion; - renderSnapshot.states = mCachedLayerRenderStates; - - renderSnapshot.states = ComposeLayerStates(renderSnapshot.states, liveState, true, input.oscSmoothing, commitRequests); - if (mCachedParameterStateVersion != versions.parameterStateVersion && - mRuntimeSnapshotProvider.TryRefreshPublishedSnapshotParameters(renderSnapshot)) - { - mCachedParameterStateVersion = renderSnapshot.versions.parameterStateVersion; - renderSnapshot.states = ComposeLayerStates(renderSnapshot.states, liveState, true, input.oscSmoothing, commitRequests); - } - - mCachedLayerRenderStates = renderSnapshot.states; - frameState.layerStates = renderSnapshot.states; - mRuntimeSnapshotProvider.RefreshDynamicRenderStateFields(frameState.layerStates); - return true; - } - - RuntimeRenderStateSnapshot renderSnapshot; - if (mRuntimeSnapshotProvider.TryPublishRenderStateSnapshot(input.renderWidth, input.renderHeight, renderSnapshot)) - { - mCachedLayerRenderStates = renderSnapshot.states; - mCachedRenderStateVersion = renderSnapshot.versions.renderStateVersion; - mCachedParameterStateVersion = renderSnapshot.versions.parameterStateVersion; - mCachedRenderStateWidth = renderSnapshot.outputWidth; - mCachedRenderStateHeight = renderSnapshot.outputHeight; - mCachedLayerRenderStates = ComposeLayerStates(mCachedLayerRenderStates, liveState, true, input.oscSmoothing, commitRequests); - frameState.layerStates = mCachedLayerRenderStates; - return true; - } - - frameState.layerStates = ComposeLayerStates(mCachedLayerRenderStates, liveState, true, input.oscSmoothing, commitRequests); - mRuntimeSnapshotProvider.RefreshDynamicRenderStateFields(frameState.layerStates); - return !frameState.layerStates.empty(); -} - -std::vector RenderFrameStateResolver::ComposeLayerStates( - const std::vector& baseStates, - RuntimeLiveState& liveState, - bool allowCommit, - double smoothing, - std::vector* commitRequests) const -{ - LayeredRenderStateInput input; - input.committedLiveLayerStates = &baseStates; - input.transientAutomationOverlay = &liveState; - input.allowTransientAutomationCommits = allowCommit; - input.collectTransientAutomationCommitRequests = commitRequests != nullptr; - input.transientAutomationSmoothing = smoothing; - input.transientAutomationCommitDelay = kOscOverlayCommitDelay; - input.now = std::chrono::steady_clock::now(); - const RenderStateCompositionResult result = mRenderStateComposer.BuildFrameState(input); - - if (commitRequests) - { - for (const RuntimeLiveOscCommitRequest& request : result.commitRequests) - commitRequests->push_back(request); - } - return result.layerStates; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/frame/RenderFrameStateResolver.h b/apps/LoopThroughWithOpenGLCompositing/gl/frame/RenderFrameStateResolver.h deleted file mode 100644 index f77ea1f..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/frame/RenderFrameStateResolver.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once - -#include "RenderFrameState.h" -#include "RenderStateComposer.h" -#include "RuntimeSnapshotProvider.h" - -#include -#include - -class RenderFrameStateResolver -{ -public: - explicit RenderFrameStateResolver(RuntimeSnapshotProvider& runtimeSnapshotProvider); - - void StoreCommittedSnapshot( - const RuntimeRenderStateSnapshot& snapshot, - const std::vector& committedLayerStates); - bool Resolve( - const RenderFrameInput& input, - const std::vector& committedLayerStates, - RuntimeLiveState& liveState, - std::vector* commitRequests, - RenderFrameState& frameState); - -private: - std::vector ComposeLayerStates( - const std::vector& baseStates, - RuntimeLiveState& liveState, - bool allowCommit, - double smoothing, - std::vector* commitRequests) const; - - RuntimeSnapshotProvider& mRuntimeSnapshotProvider; - RenderStateComposer mRenderStateComposer; - std::vector mCachedLayerRenderStates; - uint64_t mCachedRenderStateVersion = 0; - uint64_t mCachedParameterStateVersion = 0; - unsigned mCachedRenderStateWidth = 0; - unsigned mCachedRenderStateHeight = 0; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/frame/RuntimeUpdateController.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/frame/RuntimeUpdateController.cpp deleted file mode 100644 index b8a2c45..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/frame/RuntimeUpdateController.cpp +++ /dev/null @@ -1,378 +0,0 @@ -#include "RuntimeUpdateController.h" - -#include "RenderEngine.h" -#include "RuntimeEventDispatcher.h" -#include "RuntimeServices.h" -#include "RuntimeStore.h" -#include "ShaderBuildQueue.h" -#include "VideoBackend.h" - -#include - -namespace -{ -RuntimeCoordinatorRenderResetScope ToRuntimeCoordinatorRenderResetScope(RuntimeEventRenderResetScope scope) -{ - switch (scope) - { - case RuntimeEventRenderResetScope::TemporalHistoryOnly: - return RuntimeCoordinatorRenderResetScope::TemporalHistoryOnly; - case RuntimeEventRenderResetScope::TemporalHistoryAndFeedback: - return RuntimeCoordinatorRenderResetScope::TemporalHistoryAndFeedback; - case RuntimeEventRenderResetScope::None: - default: - return RuntimeCoordinatorRenderResetScope::None; - } -} -} - -RuntimeUpdateController::RuntimeUpdateController( - RuntimeStore& runtimeStore, - RuntimeCoordinator& runtimeCoordinator, - RuntimeEventDispatcher& runtimeEventDispatcher, - RuntimeServices& runtimeServices, - RenderEngine& renderEngine, - ShaderBuildQueue& shaderBuildQueue, - VideoBackend& videoBackend) : - mRuntimeStore(runtimeStore), - mRuntimeCoordinator(runtimeCoordinator), - mRuntimeEventDispatcher(runtimeEventDispatcher), - mRuntimeServices(runtimeServices), - mRenderEngine(renderEngine), - mShaderBuildQueue(shaderBuildQueue), - mVideoBackend(videoBackend) -{ - mRuntimeEventDispatcher.Subscribe( - RuntimeEventType::RuntimeStateBroadcastRequested, - [this](const RuntimeEvent& event) { HandleRuntimeStateBroadcastRequested(event); }); - mRuntimeEventDispatcher.Subscribe( - RuntimeEventType::RuntimeReloadRequested, - [this](const RuntimeEvent& event) { HandleRuntimeReloadRequested(event); }); - mRuntimeEventDispatcher.Subscribe( - RuntimeEventType::RuntimePersistenceRequested, - [this](const RuntimeEvent& event) { HandleRuntimePersistenceRequested(event); }); - mRuntimeEventDispatcher.Subscribe( - RuntimeEventType::ShaderBuildRequested, - [this](const RuntimeEvent& event) { HandleShaderBuildRequested(event); }); - mRuntimeEventDispatcher.Subscribe( - RuntimeEventType::ShaderBuildPrepared, - [this](const RuntimeEvent& event) { HandleShaderBuildPrepared(event); }); - mRuntimeEventDispatcher.Subscribe( - RuntimeEventType::ShaderBuildFailed, - [this](const RuntimeEvent& event) { HandleShaderBuildFailed(event); }); - mRuntimeEventDispatcher.Subscribe( - RuntimeEventType::CompileStatusChanged, - [this](const RuntimeEvent& event) { HandleCompileStatusChanged(event); }); - mRuntimeEventDispatcher.Subscribe( - RuntimeEventType::RenderResetRequested, - [this](const RuntimeEvent& event) { HandleRenderResetRequested(event); }); -} - -bool RuntimeUpdateController::ApplyRuntimeCoordinatorResult(const RuntimeCoordinatorResult& result, std::string* error) -{ - if (!result.accepted) - { - if (error) - *error = result.errorMessage; - return false; - } - - if (result.compileStatusChanged) - { - mRuntimeStore.SetCompileStatus(result.compileStatusSucceeded, result.compileStatusMessage); - ++mPendingCoordinatorCompileStatusEvents; - } - - if (result.clearReloadRequest) - mRuntimeStore.ClearReloadRequest(); - - mRuntimeCoordinator.ApplyCommittedStateMode(result.committedStateMode); - - switch (result.transientOscInvalidation) - { - case RuntimeCoordinatorTransientOscInvalidation::All: - mRenderEngine.ClearOscOverlayState(); - mRuntimeServices.ClearOscState(); - break; - case RuntimeCoordinatorTransientOscInvalidation::Layer: - mRenderEngine.ClearOscOverlayStateForLayerKey(result.transientOscLayerKey); - mRuntimeServices.ClearOscStateForLayerKey(result.transientOscLayerKey); - break; - case RuntimeCoordinatorTransientOscInvalidation::None: - default: - break; - } - - mRenderEngine.ApplyRuntimeCoordinatorRenderReset(result.renderResetScope); - if (result.renderResetScope != RuntimeCoordinatorRenderResetScope::None) - ++mPendingCoordinatorRenderResetEvents; - - if (result.shaderBuildRequested) - { - RequestShaderBuild(); - ++mPendingCoordinatorShaderBuildEvents; - } - - if (result.runtimeStateBroadcastRequired) - BroadcastRuntimeState(); - - return true; -} - -bool RuntimeUpdateController::ProcessRuntimeWork() -{ - DispatchRuntimeEvents(); - - return ConsumeReadyShaderBuild(0, true, true); -} - -void RuntimeUpdateController::RequestShaderBuild() -{ - mShaderBuildQueue.RequestBuild(mVideoBackend.InputFrameWidth(), mVideoBackend.InputFrameHeight()); -} - -void RuntimeUpdateController::BroadcastRuntimeState() -{ - RuntimeStateBroadcastRequestedEvent event; - event.reason = "runtime-state-changed"; - if (!mRuntimeEventDispatcher.PublishPayload(event, "RuntimeUpdateController")) - { - mRuntimeServices.BroadcastState(); - return; - } - - DispatchRuntimeEvents(); -} - -void RuntimeUpdateController::HandleRuntimeStateBroadcastRequested(const RuntimeEvent& event) -{ - if (event.source == "ControlServices") - return; - - mRuntimeServices.BroadcastState(); -} - -void RuntimeUpdateController::HandleRuntimeReloadRequested(const RuntimeEvent& event) -{ - const RuntimeReloadRequestedEvent* payload = std::get_if(&event.payload); - if (!payload) - return; - - mRuntimeStore.ClearReloadRequest(); -} - -void RuntimeUpdateController::HandleRuntimePersistenceRequested(const RuntimeEvent& event) -{ - const RuntimePersistenceRequestedEvent* payload = std::get_if(&event.payload); - if (!payload) - return; - - std::string error; - mRuntimeStore.RequestPersistence(payload->request, error); -} - -void RuntimeUpdateController::HandleShaderBuildRequested(const RuntimeEvent& event) -{ - const ShaderBuildEvent* payload = std::get_if(&event.payload); - if (!payload || payload->phase != RuntimeEventShaderBuildPhase::Requested) - return; - if (ShouldSuppressCoordinatorFollowUp(event, mPendingCoordinatorShaderBuildEvents)) - return; - - RequestShaderBuild(); -} - -void RuntimeUpdateController::HandleShaderBuildPrepared(const RuntimeEvent& event) -{ - const ShaderBuildEvent* payload = std::get_if(&event.payload); - if (!payload || payload->phase != RuntimeEventShaderBuildPhase::Prepared) - return; - - ConsumeReadyShaderBuild(payload->generation, false, true); -} - -void RuntimeUpdateController::HandleShaderBuildFailed(const RuntimeEvent& event) -{ - const ShaderBuildEvent* payload = std::get_if(&event.payload); - if (!payload || payload->phase != RuntimeEventShaderBuildPhase::Failed) - return; - - ConsumeReadyShaderBuild(payload->generation, false, false); -} - -void RuntimeUpdateController::HandleCompileStatusChanged(const RuntimeEvent& event) -{ - const CompileStatusChangedEvent* payload = std::get_if(&event.payload); - if (!payload) - return; - if (ShouldSuppressCoordinatorFollowUp(event, mPendingCoordinatorCompileStatusEvents)) - return; - - mRuntimeStore.SetCompileStatus(payload->succeeded, payload->message); -} - -void RuntimeUpdateController::HandleRenderResetRequested(const RuntimeEvent& event) -{ - const RenderResetEvent* payload = std::get_if(&event.payload); - if (!payload || payload->applied) - return; - if (ShouldSuppressCoordinatorFollowUp(event, mPendingCoordinatorRenderResetEvents)) - return; - - mRenderEngine.ApplyRuntimeCoordinatorRenderReset(ToRuntimeCoordinatorRenderResetScope(payload->scope)); -} - -bool RuntimeUpdateController::ConsumeReadyShaderBuild(uint64_t expectedGeneration, bool publishPreparedEvent, bool publishFailureEvent) -{ - PreparedShaderBuild readyBuild; - const bool consumed = expectedGeneration == 0 - ? mShaderBuildQueue.TryConsumeReadyBuild(readyBuild) - : mShaderBuildQueue.TryConsumeReadyBuild(expectedGeneration, readyBuild); - if (!consumed) - return true; - - const unsigned inputWidth = mVideoBackend.InputFrameWidth(); - const unsigned inputHeight = mVideoBackend.InputFrameHeight(); - if (!readyBuild.succeeded) - { - if (publishFailureEvent) - { - PublishShaderBuildLifecycleEvent( - RuntimeEventShaderBuildPhase::Failed, - readyBuild.generation, - inputWidth, - inputHeight, - false, - readyBuild.message); - DispatchRuntimeEvents(); - } - ApplyRuntimeCoordinatorResult(mRuntimeCoordinator.HandlePreparedShaderBuildFailure(readyBuild.message)); - return false; - } - - if (publishPreparedEvent) - { - PublishShaderBuildLifecycleEvent( - RuntimeEventShaderBuildPhase::Prepared, - readyBuild.generation, - inputWidth, - inputHeight, - true, - readyBuild.message); - DispatchRuntimeEvents(); - } - - char compilerErrorMessage[1024] = {}; - if (!mRenderEngine.ApplyPreparedShaderBuild( - readyBuild, - inputWidth, - inputHeight, - mRuntimeCoordinator.PreserveFeedbackOnNextShaderBuild(), - sizeof(compilerErrorMessage), - compilerErrorMessage)) - { - const std::string errorMessage = compilerErrorMessage; - if (publishFailureEvent) - { - PublishShaderBuildLifecycleEvent( - RuntimeEventShaderBuildPhase::Failed, - readyBuild.generation, - inputWidth, - inputHeight, - false, - errorMessage); - DispatchRuntimeEvents(); - } - ApplyRuntimeCoordinatorResult(mRuntimeCoordinator.HandlePreparedShaderBuildFailure(errorMessage)); - return false; - } - - PublishShaderBuildLifecycleEvent( - RuntimeEventShaderBuildPhase::Applied, - readyBuild.generation, - inputWidth, - inputHeight, - true, - "Shader layers applied successfully."); - ApplyRuntimeCoordinatorResult(mRuntimeCoordinator.HandlePreparedShaderBuildSuccess()); - return true; -} - -void RuntimeUpdateController::PublishShaderBuildLifecycleEvent( - RuntimeEventShaderBuildPhase phase, - uint64_t generation, - unsigned inputWidth, - unsigned inputHeight, - bool succeeded, - const std::string& message) -{ - ShaderBuildEvent event; - event.phase = phase; - event.generation = generation; - event.inputWidth = inputWidth; - event.inputHeight = inputHeight; - event.preserveFeedbackState = mRuntimeCoordinator.PreserveFeedbackOnNextShaderBuild(); - event.succeeded = succeeded; - event.message = message; - mRuntimeEventDispatcher.PublishPayload(event, "RuntimeUpdateController"); -} - -bool RuntimeUpdateController::ShouldSuppressCoordinatorFollowUp(const RuntimeEvent& event, std::size_t& pendingSuppressions) -{ - if (event.source != "RuntimeCoordinator") - return false; - - if (pendingSuppressions > 0) - --pendingSuppressions; - return true; -} - -RuntimeEventDispatchResult RuntimeUpdateController::DispatchRuntimeEvents(std::size_t maxEvents) -{ - RuntimeEventDispatchResult result = mRuntimeEventDispatcher.DispatchPending(maxEvents); - const RuntimeEventQueueMetrics queueMetrics = mRuntimeEventDispatcher.GetQueueMetrics(); - HealthTelemetry& telemetry = mRuntimeStore.GetHealthTelemetry(); - telemetry.TryRecordRuntimeEventDispatchStats( - result.dispatchedEvents, - result.handlerInvocations, - result.handlerFailures, - result.dispatchDurationMilliseconds); - telemetry.TryRecordRuntimeEventQueueMetrics( - "runtime-events", - queueMetrics.depth, - queueMetrics.capacity, - static_cast(queueMetrics.droppedCount), - queueMetrics.oldestEventAgeMilliseconds); - PublishRuntimeEventHealthObservations(result); - return result; -} - -void RuntimeUpdateController::PublishRuntimeEventHealthObservations(const RuntimeEventDispatchResult& result) -{ - const RuntimeEventQueueMetrics queueMetrics = mRuntimeEventDispatcher.GetQueueMetrics(); - if (queueMetrics.depth != mLastReportedRuntimeEventQueueDepth || - queueMetrics.droppedCount != mLastReportedRuntimeEventDroppedCount || - queueMetrics.coalescedCount != mLastReportedRuntimeEventCoalescedCount) - { - QueueDepthChangedEvent queueDepth; - queueDepth.queueName = "runtime-events"; - queueDepth.depth = queueMetrics.depth; - queueDepth.capacity = queueMetrics.capacity; - queueDepth.droppedCount = queueMetrics.droppedCount; - queueDepth.coalescedCount = queueMetrics.coalescedCount; - mRuntimeEventDispatcher.PublishPayload(queueDepth, "HealthTelemetry"); - mLastReportedRuntimeEventQueueDepth = queueMetrics.depth; - mLastReportedRuntimeEventDroppedCount = queueMetrics.droppedCount; - mLastReportedRuntimeEventCoalescedCount = queueMetrics.coalescedCount; - } - - if (result.handlerInvocations == 0 && result.handlerFailures == 0) - return; - - TimingSampleRecordedEvent timing; - timing.subsystem = "RuntimeEventDispatcher"; - timing.metric = "dispatchDuration"; - timing.value = result.dispatchDurationMilliseconds; - timing.unit = "ms"; - mRuntimeEventDispatcher.PublishPayload(timing, "HealthTelemetry"); -} diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/frame/RuntimeUpdateController.h b/apps/LoopThroughWithOpenGLCompositing/gl/frame/RuntimeUpdateController.h deleted file mode 100644 index 69428a4..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/frame/RuntimeUpdateController.h +++ /dev/null @@ -1,70 +0,0 @@ -#pragma once - -#include "RuntimeCoordinator.h" -#include "RuntimeEventPayloads.h" - -#include -#include -#include - -class RenderEngine; -struct RuntimeEvent; -struct RuntimeEventDispatchResult; -class RuntimeEventDispatcher; -class RuntimeServices; -class RuntimeStore; -class ShaderBuildQueue; -class VideoBackend; - -class RuntimeUpdateController -{ -public: - RuntimeUpdateController( - RuntimeStore& runtimeStore, - RuntimeCoordinator& runtimeCoordinator, - RuntimeEventDispatcher& runtimeEventDispatcher, - RuntimeServices& runtimeServices, - RenderEngine& renderEngine, - ShaderBuildQueue& shaderBuildQueue, - VideoBackend& videoBackend); - - bool ApplyRuntimeCoordinatorResult(const RuntimeCoordinatorResult& result, std::string* error = nullptr); - bool ProcessRuntimeWork(); - void RequestShaderBuild(); - void BroadcastRuntimeState(); - -private: - void HandleRuntimeStateBroadcastRequested(const RuntimeEvent& event); - void HandleRuntimeReloadRequested(const RuntimeEvent& event); - void HandleRuntimePersistenceRequested(const RuntimeEvent& event); - void HandleShaderBuildRequested(const RuntimeEvent& event); - void HandleShaderBuildPrepared(const RuntimeEvent& event); - void HandleShaderBuildFailed(const RuntimeEvent& event); - void HandleCompileStatusChanged(const RuntimeEvent& event); - void HandleRenderResetRequested(const RuntimeEvent& event); - bool ConsumeReadyShaderBuild(uint64_t expectedGeneration, bool publishPreparedEvent, bool publishFailureEvent); - void PublishShaderBuildLifecycleEvent( - RuntimeEventShaderBuildPhase phase, - uint64_t generation, - unsigned inputWidth, - unsigned inputHeight, - bool succeeded, - const std::string& message); - bool ShouldSuppressCoordinatorFollowUp(const RuntimeEvent& event, std::size_t& pendingSuppressions); - RuntimeEventDispatchResult DispatchRuntimeEvents(std::size_t maxEvents = 0); - void PublishRuntimeEventHealthObservations(const RuntimeEventDispatchResult& result); - - RuntimeStore& mRuntimeStore; - RuntimeCoordinator& mRuntimeCoordinator; - RuntimeEventDispatcher& mRuntimeEventDispatcher; - RuntimeServices& mRuntimeServices; - RenderEngine& mRenderEngine; - ShaderBuildQueue& mShaderBuildQueue; - VideoBackend& mVideoBackend; - std::size_t mPendingCoordinatorShaderBuildEvents = 0; - std::size_t mPendingCoordinatorCompileStatusEvents = 0; - std::size_t mPendingCoordinatorRenderResetEvents = 0; - std::size_t mLastReportedRuntimeEventQueueDepth = static_cast(-1); - std::size_t mLastReportedRuntimeEventDroppedCount = static_cast(-1); - std::size_t mLastReportedRuntimeEventCoalescedCount = static_cast(-1); -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/OpenGLRenderPass.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/OpenGLRenderPass.cpp deleted file mode 100644 index d65cddb..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/OpenGLRenderPass.cpp +++ /dev/null @@ -1,288 +0,0 @@ -#include "OpenGLRenderPass.h" - -#include "GlRenderConstants.h" - -#include - -OpenGLRenderPass::OpenGLRenderPass(OpenGLRenderer& renderer) : - mRenderer(renderer) -{ -} - -void OpenGLRenderPass::Render( - bool hasInputSource, - const std::vector& layerStates, - unsigned inputFrameWidth, - unsigned inputFrameHeight, - unsigned captureTextureWidth, - VideoIOPixelFormat inputPixelFormat, - unsigned historyCap, - const TextBindingUpdater& updateTextBinding, - const GlobalParamsUpdater& updateGlobalParams) -{ - glDisable(GL_SCISSOR_TEST); - glDisable(GL_BLEND); - glDisable(GL_DEPTH_TEST); - if (hasInputSource) - { - RenderDecodePass(inputFrameWidth, inputFrameHeight, captureTextureWidth, inputPixelFormat); - } - else - { - glBindFramebuffer(GL_FRAMEBUFFER, mRenderer.DecodeFramebuffer()); - glViewport(0, 0, inputFrameWidth, inputFrameHeight); - glClearColor(0.0f, 0.0f, 0.0f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT); - } - - std::vector& layerPrograms = mRenderer.LayerPrograms(); - if (layerStates.empty() || layerPrograms.empty()) - { - glBindFramebuffer(GL_READ_FRAMEBUFFER, mRenderer.DecodeFramebuffer()); - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mRenderer.CompositeFramebuffer()); - glBlitFramebuffer(0, 0, inputFrameWidth, inputFrameHeight, 0, 0, inputFrameWidth, inputFrameHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR); - glBindFramebuffer(GL_FRAMEBUFFER, mRenderer.CompositeFramebuffer()); - } - else - { - const std::vector& passes = BuildLayerPassDescriptors(layerStates, layerPrograms); - for (const RenderPassDescriptor& pass : passes) - { - RenderLayerPass( - pass, - inputFrameWidth, - inputFrameHeight, - historyCap, - updateTextBinding, - updateGlobalParams); - } - } - - mRenderer.TemporalHistory().PushSourceFramebuffer(mRenderer.DecodeFramebuffer(), inputFrameWidth, inputFrameHeight); - mRenderer.FeedbackBuffers().FinalizeFrame(); -} - -void OpenGLRenderPass::RenderDecodePass(unsigned inputFrameWidth, unsigned inputFrameHeight, unsigned captureTextureWidth, VideoIOPixelFormat inputPixelFormat) -{ - glBindFramebuffer(GL_FRAMEBUFFER, mRenderer.DecodeFramebuffer()); - glViewport(0, 0, inputFrameWidth, inputFrameHeight); - glClear(GL_COLOR_BUFFER_BIT); - glActiveTexture(GL_TEXTURE0 + kPackedVideoTextureUnit); - glBindTexture(GL_TEXTURE_2D, mRenderer.CaptureTexture()); - glBindVertexArray(mRenderer.FullscreenVertexArray()); - glUseProgram(mRenderer.DecodeProgram()); - - const GLint packedResolutionLocation = mRenderer.DecodePackedResolutionLocation(); - const GLint decodedResolutionLocation = mRenderer.DecodeDecodedResolutionLocation(); - const GLint inputPixelFormatLocation = mRenderer.DecodeInputPixelFormatLocation(); - if (packedResolutionLocation >= 0) - glUniform2f(packedResolutionLocation, static_cast(captureTextureWidth), static_cast(inputFrameHeight)); - if (decodedResolutionLocation >= 0) - glUniform2f(decodedResolutionLocation, static_cast(inputFrameWidth), static_cast(inputFrameHeight)); - if (inputPixelFormatLocation >= 0) - glUniform1i(inputPixelFormatLocation, inputPixelFormat == VideoIOPixelFormat::V210 ? 1 : 0); - - glDrawArrays(GL_TRIANGLES, 0, 3); - - glUseProgram(0); - glBindVertexArray(0); - glBindTexture(GL_TEXTURE_2D, 0); - glActiveTexture(GL_TEXTURE0); -} - -std::vector OpenGLRenderPass::BuildLayerPassDescriptors( - const std::vector& layerStates, - std::vector& layerPrograms) const -{ - // Flatten the layer stack into concrete GL passes. A layer may now contain - // several shader passes, but the outer stack still sees one visible output - // per layer. - std::vector& passes = mPassScratch; - passes.clear(); - const std::size_t passCount = layerStates.size() < layerPrograms.size() ? layerStates.size() : layerPrograms.size(); - std::size_t descriptorCount = 0; - for (std::size_t index = 0; index < passCount; ++index) - descriptorCount += layerPrograms[index].passes.size(); - passes.reserve(descriptorCount); - - GLuint sourceTexture = mRenderer.DecodedTexture(); - GLuint sourceFramebuffer = mRenderer.DecodeFramebuffer(); - for (std::size_t index = 0; index < passCount; ++index) - { - const RuntimeRenderState& state = layerStates[index]; - LayerProgram& layerProgram = layerPrograms[index]; - if (layerProgram.passes.empty()) - continue; - - // Preserve the original two-target layer ping-pong. Intermediate passes - // inside this layer are routed through pooled temporary targets instead. - const std::size_t remaining = layerStates.size() - index; - const bool writeToMain = (remaining % 2) == 1; - const GLuint layerOutputTexture = writeToMain ? mRenderer.CompositeTexture() : mRenderer.LayerTempTexture(); - const GLuint layerOutputFramebuffer = writeToMain ? mRenderer.CompositeFramebuffer() : mRenderer.LayerTempFramebuffer(); - const RenderPassOutputTarget layerOutputTarget = writeToMain ? RenderPassOutputTarget::Composite : RenderPassOutputTarget::LayerTemp; - - const GLuint layerInputTexture = sourceTexture; - const GLuint layerInputFramebuffer = sourceFramebuffer; - GLuint previousPassTexture = layerInputTexture; - GLuint previousPassFramebuffer = layerInputFramebuffer; - std::map> namedOutputs; - std::size_t temporaryTargetIndex = 0; - - for (std::size_t passIndex = 0; passIndex < layerProgram.passes.size(); ++passIndex) - { - PassProgram& passProgram = layerProgram.passes[passIndex]; - const bool lastPassForLayer = passIndex + 1 == layerProgram.passes.size(); - const std::string outputName = passProgram.outputName.empty() ? passProgram.passId : passProgram.outputName; - const bool writesLayerOutput = outputName == "layerOutput" || lastPassForLayer; - - GLuint passSourceTexture = previousPassTexture; - GLuint passSourceFramebuffer = previousPassFramebuffer; - if (!passProgram.inputNames.empty()) - { - // v1 multipass uses the first declared input as gVideoInput. - // Later inputs are parsed for forward compatibility. - const std::string& inputName = passProgram.inputNames.front(); - if (inputName == "layerInput") - { - passSourceTexture = layerInputTexture; - passSourceFramebuffer = layerInputFramebuffer; - } - else if (inputName == "previousPass") - { - passSourceTexture = previousPassTexture; - passSourceFramebuffer = previousPassFramebuffer; - } - else - { - auto namedOutputIt = namedOutputs.find(inputName); - if (namedOutputIt != namedOutputs.end()) - { - passSourceTexture = namedOutputIt->second.first; - passSourceFramebuffer = namedOutputIt->second.second; - } - } - } - - GLuint passDestinationTexture = layerOutputTexture; - GLuint passDestinationFramebuffer = layerOutputFramebuffer; - RenderPassOutputTarget outputTarget = layerOutputTarget; - if (!writesLayerOutput) - { - // Temporary targets are reserved when the shader stack is - // committed, avoiding texture allocation during playback. - if (temporaryTargetIndex < mRenderer.TemporaryRenderTargetCount()) - { - const RenderTarget& temporaryTarget = mRenderer.TemporaryRenderTarget(temporaryTargetIndex); - ++temporaryTargetIndex; - passDestinationTexture = temporaryTarget.texture; - passDestinationFramebuffer = temporaryTarget.framebuffer; - outputTarget = RenderPassOutputTarget::Temporary; - } - } - - RenderPassDescriptor pass; - pass.kind = RenderPassKind::LayerEffect; - pass.outputTarget = outputTarget; - pass.passIndex = passes.size(); - pass.passId = passProgram.passId; - pass.layerId = state.layerId; - pass.shaderId = state.shaderId; - pass.layerInputTexture = layerInputTexture; - pass.sourceTexture = passSourceTexture; - pass.sourceFramebuffer = passIndex == 0 ? layerInputFramebuffer : passSourceFramebuffer; - pass.destinationTexture = passDestinationTexture; - pass.destinationFramebuffer = passDestinationFramebuffer; - pass.layerProgram = &layerProgram; - pass.passProgram = &passProgram; - pass.layerState = &state; - pass.capturePreLayerHistory = passIndex == 0 && state.temporalHistorySource == TemporalHistorySource::PreLayerInput; - pass.captureFeedbackWrite = state.feedback.enabled && passProgram.passId == state.feedback.writePassId; - passes.push_back(pass); - - // A later pass can reference either the explicit output name or the - // pass id, which keeps small manifests pleasant to write. - namedOutputs[outputName] = std::make_pair(passDestinationTexture, passDestinationFramebuffer); - namedOutputs[passProgram.passId] = std::make_pair(passDestinationTexture, passDestinationFramebuffer); - previousPassTexture = passDestinationTexture; - previousPassFramebuffer = passDestinationFramebuffer; - } - - sourceTexture = layerOutputTexture; - sourceFramebuffer = layerOutputFramebuffer; - } - - return passes; -} - -void OpenGLRenderPass::RenderLayerPass( - const RenderPassDescriptor& pass, - unsigned inputFrameWidth, - unsigned inputFrameHeight, - unsigned historyCap, - const TextBindingUpdater& updateTextBinding, - const GlobalParamsUpdater& updateGlobalParams) -{ - if (pass.passProgram == nullptr || pass.layerState == nullptr) - return; - - RenderShaderProgram( - pass.layerInputTexture, - pass.sourceTexture, - pass.destinationFramebuffer, - *pass.passProgram, - *pass.layerState, - inputFrameWidth, - inputFrameHeight, - historyCap, - updateTextBinding, - updateGlobalParams); - - if (pass.capturePreLayerHistory) - mRenderer.TemporalHistory().PushPreLayerFramebuffer(pass.layerId, pass.sourceFramebuffer, inputFrameWidth, inputFrameHeight); - if (pass.captureFeedbackWrite) - mRenderer.FeedbackBuffers().CaptureFeedbackFramebuffer(pass.layerId, pass.destinationFramebuffer, inputFrameWidth, inputFrameHeight); -} - -void OpenGLRenderPass::RenderShaderProgram( - GLuint layerInputTexture, - GLuint sourceTexture, - GLuint destinationFrameBuffer, - PassProgram& passProgram, - const RuntimeRenderState& state, - unsigned inputFrameWidth, - unsigned inputFrameHeight, - unsigned historyCap, - const TextBindingUpdater& updateTextBinding, - const GlobalParamsUpdater& updateGlobalParams) -{ - for (LayerProgram::TextBinding& textBinding : passProgram.textBindings) - { - std::string textError; - if (!updateTextBinding(state, textBinding, textError)) - OutputDebugStringA((textError + "\n").c_str()); - } - - glBindFramebuffer(GL_FRAMEBUFFER, destinationFrameBuffer); - glViewport(0, 0, inputFrameWidth, inputFrameHeight); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - const std::vector sourceHistoryTextures = mRenderer.TemporalHistory().ResolveSourceHistoryTextures(sourceTexture, state.isTemporal ? historyCap : 0); - const std::vector temporalHistoryTextures = mRenderer.TemporalHistory().ResolveTemporalHistoryTextures(state, sourceTexture, state.isTemporal ? historyCap : 0); - const GLuint feedbackTexture = mRenderer.FeedbackBuffers().ResolveReadTexture(state); - const ShaderTextureBindings::RuntimeTextureBindingPlan texturePlan = - mTextureBindings.BuildLayerRuntimeBindingPlan(passProgram, sourceTexture, layerInputTexture, state, feedbackTexture, sourceHistoryTextures, temporalHistoryTextures); - mTextureBindings.BindRuntimeTexturePlan(texturePlan); - glBindVertexArray(mRenderer.FullscreenVertexArray()); - glUseProgram(passProgram.program); - // The UBO is shared by every pass in a layer; texture routing is what - // changes from pass to pass. - updateGlobalParams( - state, - mRenderer.TemporalHistory().SourceAvailableCount(), - mRenderer.TemporalHistory().AvailableCountForLayer(state.layerId), - mRenderer.FeedbackBuffers().FeedbackAvailable(state)); - glDrawArrays(GL_TRIANGLES, 0, 3); - glUseProgram(0); - glBindVertexArray(0); - mTextureBindings.UnbindRuntimeTexturePlan(texturePlan); -} diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/OpenGLRenderPass.h b/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/OpenGLRenderPass.h deleted file mode 100644 index 441cfe2..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/OpenGLRenderPass.h +++ /dev/null @@ -1,61 +0,0 @@ -#pragma once - -#include "OpenGLRenderer.h" -#include "RenderPassDescriptor.h" -#include "ShaderTextureBindings.h" -#include "ShaderTypes.h" -#include "VideoIOFormat.h" - -#include -#include -#include - -class OpenGLRenderPass -{ -public: - using LayerProgram = OpenGLRenderer::LayerProgram; - using PassProgram = OpenGLRenderer::LayerProgram::PassProgram; - using TextBindingUpdater = std::function; - using GlobalParamsUpdater = std::function; - - explicit OpenGLRenderPass(OpenGLRenderer& renderer); - - void Render( - bool hasInputSource, - const std::vector& layerStates, - unsigned inputFrameWidth, - unsigned inputFrameHeight, - unsigned captureTextureWidth, - VideoIOPixelFormat inputPixelFormat, - unsigned historyCap, - const TextBindingUpdater& updateTextBinding, - const GlobalParamsUpdater& updateGlobalParams); - -private: - void RenderDecodePass(unsigned inputFrameWidth, unsigned inputFrameHeight, unsigned captureTextureWidth, VideoIOPixelFormat inputPixelFormat); - std::vector BuildLayerPassDescriptors( - const std::vector& layerStates, - std::vector& layerPrograms) const; - void RenderLayerPass( - const RenderPassDescriptor& pass, - unsigned inputFrameWidth, - unsigned inputFrameHeight, - unsigned historyCap, - const TextBindingUpdater& updateTextBinding, - const GlobalParamsUpdater& updateGlobalParams); - void RenderShaderProgram( - GLuint layerInputTexture, - GLuint sourceTexture, - GLuint destinationFrameBuffer, - PassProgram& passProgram, - const RuntimeRenderState& state, - unsigned inputFrameWidth, - unsigned inputFrameHeight, - unsigned historyCap, - const TextBindingUpdater& updateTextBinding, - const GlobalParamsUpdater& updateGlobalParams); - - OpenGLRenderer& mRenderer; - ShaderTextureBindings mTextureBindings; - mutable std::vector mPassScratch; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/OpenGLRenderPipeline.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/OpenGLRenderPipeline.cpp deleted file mode 100644 index 1623b13..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/OpenGLRenderPipeline.cpp +++ /dev/null @@ -1,479 +0,0 @@ -#include "OpenGLRenderPipeline.h" - -#include "HealthTelemetry.h" -#include "OpenGLRenderer.h" -#include "RuntimeSnapshotProvider.h" -#include "VideoIOFormat.h" - -#include - -#include -#include -#include -#include - -OpenGLRenderPipeline::OpenGLRenderPipeline( - OpenGLRenderer& renderer, - RuntimeSnapshotProvider& runtimeSnapshotProvider, - HealthTelemetry& healthTelemetry, - RenderEffectCallback renderEffect, - OutputReadyCallback outputReady, - PaintCallback paint) : - mRenderer(renderer), - mRuntimeSnapshotProvider(runtimeSnapshotProvider), - mHealthTelemetry(healthTelemetry), - mRenderEffect(renderEffect), - mOutputReady(outputReady), - mPaint(paint), - mOutputReadbackMode(ReadOutputReadbackModeFromEnvironment()), - mAsyncReadbackDepth(ReadAsyncReadbackDepthFromEnvironment()) -{ -} - -OpenGLRenderPipeline::~OpenGLRenderPipeline() -{ - ResetAsyncReadbackState(); -} - -bool OpenGLRenderPipeline::RenderFrame(const RenderPipelineFrameContext& context, VideoIOOutputFrame& outputFrame) -{ - const VideoIOState& state = context.videoState; - - const auto renderStartTime = std::chrono::steady_clock::now(); - glBindFramebuffer(GL_FRAMEBUFFER, mRenderer.CompositeFramebuffer()); - mRenderEffect(); - glBindFramebuffer(GL_READ_FRAMEBUFFER, mRenderer.CompositeFramebuffer()); - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mRenderer.OutputFramebuffer()); - glBlitFramebuffer(0, 0, state.inputFrameSize.width, state.inputFrameSize.height, 0, 0, state.outputFrameSize.width, state.outputFrameSize.height, GL_COLOR_BUFFER_BIT, GL_LINEAR); - glBindFramebuffer(GL_FRAMEBUFFER, mRenderer.OutputFramebuffer()); - if (mOutputReady) - mOutputReady(); - if (state.outputPixelFormat == VideoIOPixelFormat::Bgra8) - PackOutputForBgra8(state); - else if (state.outputPixelFormat == VideoIOPixelFormat::V210 || state.outputPixelFormat == VideoIOPixelFormat::Yuva10) - PackOutputFor10Bit(state); - glFlush(); - - const auto renderEndTime = std::chrono::steady_clock::now(); - const double renderMilliseconds = std::chrono::duration_cast>(renderEndTime - renderStartTime).count(); - mHealthTelemetry.TryRecordPerformanceStats(state.frameBudgetMilliseconds, renderMilliseconds); - mRuntimeSnapshotProvider.AdvanceFrame(); - - OutputReadbackTiming readbackTiming = ReadOutputFrame(state, outputFrame); - mHealthTelemetry.TryRecordOutputRenderPipelineTiming( - renderMilliseconds, - readbackTiming.fenceWaitMilliseconds, - readbackTiming.mapMilliseconds, - readbackTiming.copyMilliseconds, - readbackTiming.cachedCopyMilliseconds, - readbackTiming.asyncQueueMilliseconds, - readbackTiming.asyncQueueBufferMilliseconds, - readbackTiming.asyncQueueSetupMilliseconds, - readbackTiming.asyncQueueReadPixelsMilliseconds, - readbackTiming.asyncQueueFenceMilliseconds, - readbackTiming.syncReadMilliseconds, - readbackTiming.asyncReadbackMissed, - readbackTiming.cachedFallbackUsed, - readbackTiming.syncFallbackUsed); - - return true; -} - -void OpenGLRenderPipeline::PackOutputForBgra8(const VideoIOState& state) -{ - glBindFramebuffer(GL_READ_FRAMEBUFFER, mRenderer.OutputFramebuffer()); - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mRenderer.OutputPackFramebuffer()); - glBlitFramebuffer( - 0, - 0, - state.outputFrameSize.width, - state.outputFrameSize.height, - 0, - 0, - state.outputFrameSize.width, - state.outputFrameSize.height, - GL_COLOR_BUFFER_BIT, - GL_NEAREST); - glBindFramebuffer(GL_FRAMEBUFFER, mRenderer.OutputPackFramebuffer()); -} - -void OpenGLRenderPipeline::PackOutputFor10Bit(const VideoIOState& state) -{ - glBindFramebuffer(GL_FRAMEBUFFER, mRenderer.OutputPackFramebuffer()); - glViewport(0, 0, state.outputPackTextureWidth, state.outputFrameSize.height); - glDisable(GL_SCISSOR_TEST); - glDisable(GL_BLEND); - glDisable(GL_DEPTH_TEST); - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, mRenderer.OutputTexture()); - glBindVertexArray(mRenderer.FullscreenVertexArray()); - glUseProgram(mRenderer.OutputPackProgram()); - - const GLint outputResolutionLocation = mRenderer.OutputPackResolutionLocation(); - const GLint activeWordsLocation = mRenderer.OutputPackActiveWordsLocation(); - const GLint packFormatLocation = mRenderer.OutputPackFormatLocation(); - if (outputResolutionLocation >= 0) - glUniform2f(outputResolutionLocation, static_cast(state.outputFrameSize.width), static_cast(state.outputFrameSize.height)); - if (activeWordsLocation >= 0) - glUniform1f(activeWordsLocation, static_cast(ActiveV210WordsForWidth(state.outputFrameSize.width))); - if (packFormatLocation >= 0) - glUniform1i(packFormatLocation, state.outputPixelFormat == VideoIOPixelFormat::Yuva10 ? 2 : 1); - - glDrawArrays(GL_TRIANGLES, 0, 3); - glUseProgram(0); - glBindVertexArray(0); - glBindTexture(GL_TEXTURE_2D, 0); -} - -bool OpenGLRenderPipeline::EnsureAsyncReadbackBuffers(std::size_t requiredBytes) -{ - if (requiredBytes == 0) - return false; - - if (mAsyncReadbackBytes == requiredBytes && - mAsyncReadbackSlots.size() == mAsyncReadbackDepth && - !mAsyncReadbackSlots.empty() && - mAsyncReadbackSlots[0].pixelPackBuffer != 0) - { - return true; - } - - ResetAsyncReadbackState(); - mAsyncReadbackBytes = requiredBytes; - mAsyncReadbackSlots.resize(mAsyncReadbackDepth); - for (AsyncReadbackSlot& slot : mAsyncReadbackSlots) - { - glGenBuffers(1, &slot.pixelPackBuffer); - glBindBuffer(GL_PIXEL_PACK_BUFFER, slot.pixelPackBuffer); - glBufferData(GL_PIXEL_PACK_BUFFER, static_cast(requiredBytes), nullptr, GL_STREAM_READ); - slot.sizeBytes = requiredBytes; - slot.inFlight = false; - } - glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); - mAsyncReadbackWriteIndex = 0; - mAsyncReadbackReadIndex = 0; - return true; -} - -void OpenGLRenderPipeline::ResetAsyncReadbackState() -{ - FlushAsyncReadbackPipeline(); - for (AsyncReadbackSlot& slot : mAsyncReadbackSlots) - slot.sizeBytes = 0; - - if (!mAsyncReadbackSlots.empty() && mAsyncReadbackSlots[0].pixelPackBuffer != 0) - { - for (AsyncReadbackSlot& slot : mAsyncReadbackSlots) - { - if (slot.pixelPackBuffer != 0) - { - glDeleteBuffers(1, &slot.pixelPackBuffer); - slot.pixelPackBuffer = 0; - } - } - } - - mAsyncReadbackWriteIndex = 0; - mAsyncReadbackReadIndex = 0; - mAsyncReadbackBytes = 0; - mAsyncReadbackSlots.clear(); -} - -void OpenGLRenderPipeline::FlushAsyncReadbackPipeline() -{ - for (AsyncReadbackSlot& slot : mAsyncReadbackSlots) - { - if (slot.fence != nullptr) - { - glDeleteSync(slot.fence); - slot.fence = nullptr; - } - slot.inFlight = false; - } - - mAsyncReadbackWriteIndex = 0; - mAsyncReadbackReadIndex = 0; -} - -bool OpenGLRenderPipeline::QueueAsyncReadback(const VideoIOState& state, OutputReadbackTiming& timing) -{ - const auto queueStartTime = std::chrono::steady_clock::now(); - const bool useTenBitPackedOutput = state.outputPixelFormat == VideoIOPixelFormat::V210 || - state.outputPixelFormat == VideoIOPixelFormat::Yuva10; - const bool usePackFramebuffer = state.outputPixelFormat == VideoIOPixelFormat::Bgra8 || useTenBitPackedOutput; - const std::size_t requiredBytes = static_cast(state.outputFrameRowBytes) * state.outputFrameSize.height; - const GLenum format = useTenBitPackedOutput ? GL_RGBA : GL_BGRA; - const GLenum type = useTenBitPackedOutput ? GL_UNSIGNED_BYTE : GL_UNSIGNED_INT_8_8_8_8_REV; - const GLuint framebuffer = usePackFramebuffer ? mRenderer.OutputPackFramebuffer() : mRenderer.OutputFramebuffer(); - const GLsizei readWidth = static_cast(useTenBitPackedOutput ? state.outputPackTextureWidth : state.outputFrameSize.width); - const GLsizei readHeight = static_cast(state.outputFrameSize.height); - - const auto finishTiming = [&timing, queueStartTime]() { - const auto queueEndTime = std::chrono::steady_clock::now(); - timing.asyncQueueMilliseconds += std::chrono::duration_cast>(queueEndTime - queueStartTime).count(); - }; - - if (requiredBytes == 0) - { - finishTiming(); - return false; - } - - if (mAsyncReadbackBytes != requiredBytes - || mAsyncReadbackFormat != format - || mAsyncReadbackType != type - || mAsyncReadbackFramebuffer != framebuffer) - { - mAsyncReadbackFormat = format; - mAsyncReadbackType = type; - mAsyncReadbackFramebuffer = framebuffer; - if (!EnsureAsyncReadbackBuffers(requiredBytes)) - { - finishTiming(); - return false; - } - } - - if (mAsyncReadbackSlots.empty()) - { - finishTiming(); - return false; - } - - AsyncReadbackSlot& slot = mAsyncReadbackSlots[mAsyncReadbackWriteIndex]; - if (slot.inFlight) - { - finishTiming(); - return false; - } - - auto stageStartTime = std::chrono::steady_clock::now(); - glPixelStorei(GL_PACK_ALIGNMENT, 4); - glPixelStorei(GL_PACK_ROW_LENGTH, 0); - glBindFramebuffer(GL_READ_FRAMEBUFFER, framebuffer); - glBindBuffer(GL_PIXEL_PACK_BUFFER, slot.pixelPackBuffer); - auto stageEndTime = std::chrono::steady_clock::now(); - timing.asyncQueueSetupMilliseconds += std::chrono::duration_cast>(stageEndTime - stageStartTime).count(); - - stageStartTime = std::chrono::steady_clock::now(); - glBufferData(GL_PIXEL_PACK_BUFFER, static_cast(requiredBytes), nullptr, GL_STREAM_READ); - stageEndTime = std::chrono::steady_clock::now(); - timing.asyncQueueBufferMilliseconds += std::chrono::duration_cast>(stageEndTime - stageStartTime).count(); - - stageStartTime = std::chrono::steady_clock::now(); - glReadPixels(0, 0, readWidth, readHeight, format, type, nullptr); - stageEndTime = std::chrono::steady_clock::now(); - timing.asyncQueueReadPixelsMilliseconds += std::chrono::duration_cast>(stageEndTime - stageStartTime).count(); - - stageStartTime = std::chrono::steady_clock::now(); - slot.fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); - stageEndTime = std::chrono::steady_clock::now(); - timing.asyncQueueFenceMilliseconds += std::chrono::duration_cast>(stageEndTime - stageStartTime).count(); - slot.inFlight = slot.fence != nullptr; - glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); - - mAsyncReadbackWriteIndex = (mAsyncReadbackWriteIndex + 1) % mAsyncReadbackSlots.size(); - finishTiming(); - return slot.inFlight; -} - -bool OpenGLRenderPipeline::TryConsumeAsyncReadback(VideoIOOutputFrame& outputFrame, GLuint64 timeoutNanoseconds, OutputReadbackTiming& timing) -{ - if (mAsyncReadbackBytes == 0 || outputFrame.bytes == nullptr) - return false; - - AsyncReadbackSlot& slot = mAsyncReadbackSlots[mAsyncReadbackReadIndex]; - if (!slot.inFlight || slot.fence == nullptr || slot.pixelPackBuffer == 0) - return false; - - const GLenum waitFlags = timeoutNanoseconds > 0 ? GL_SYNC_FLUSH_COMMANDS_BIT : 0; - const auto waitStartTime = std::chrono::steady_clock::now(); - const GLenum waitResult = glClientWaitSync(slot.fence, waitFlags, timeoutNanoseconds); - const auto waitEndTime = std::chrono::steady_clock::now(); - timing.fenceWaitMilliseconds += std::chrono::duration_cast>(waitEndTime - waitStartTime).count(); - if (waitResult != GL_ALREADY_SIGNALED && waitResult != GL_CONDITION_SATISFIED) - { - timing.asyncReadbackMissed = true; - return false; - } - - glDeleteSync(slot.fence); - slot.fence = nullptr; - - glBindBuffer(GL_PIXEL_PACK_BUFFER, slot.pixelPackBuffer); - const auto mapStartTime = std::chrono::steady_clock::now(); - void* mappedBytes = glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY); - const auto mapEndTime = std::chrono::steady_clock::now(); - timing.mapMilliseconds += std::chrono::duration_cast>(mapEndTime - mapStartTime).count(); - if (mappedBytes == nullptr) - { - glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); - slot.inFlight = false; - mAsyncReadbackReadIndex = (mAsyncReadbackReadIndex + 1) % mAsyncReadbackSlots.size(); - return false; - } - - const auto copyStartTime = std::chrono::steady_clock::now(); - std::memcpy(outputFrame.bytes, mappedBytes, slot.sizeBytes); - const auto copyEndTime = std::chrono::steady_clock::now(); - timing.copyMilliseconds += std::chrono::duration_cast>(copyEndTime - copyStartTime).count(); - glUnmapBuffer(GL_PIXEL_PACK_BUFFER); - glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); - - slot.inFlight = false; - mAsyncReadbackReadIndex = (mAsyncReadbackReadIndex + 1) % mAsyncReadbackSlots.size(); - CacheOutputFrame(outputFrame); - return true; -} - -void OpenGLRenderPipeline::CacheOutputFrame(const VideoIOOutputFrame& outputFrame) -{ - if (outputFrame.bytes == nullptr || outputFrame.height == 0 || outputFrame.rowBytes <= 0) - return; - - const std::size_t byteCount = static_cast(outputFrame.rowBytes) * outputFrame.height; - mCachedOutputFrame.resize(byteCount); - std::memcpy(mCachedOutputFrame.data(), outputFrame.bytes, byteCount); -} - -bool OpenGLRenderPipeline::TryCopyCachedOutputFrame(VideoIOOutputFrame& outputFrame, OutputReadbackTiming& timing) const -{ - if (outputFrame.bytes == nullptr || outputFrame.height == 0 || outputFrame.rowBytes <= 0) - return false; - - const std::size_t byteCount = static_cast(outputFrame.rowBytes) * outputFrame.height; - if (mCachedOutputFrame.size() != byteCount) - return false; - - const auto copyStartTime = std::chrono::steady_clock::now(); - std::memcpy(outputFrame.bytes, mCachedOutputFrame.data(), byteCount); - const auto copyEndTime = std::chrono::steady_clock::now(); - timing.cachedCopyMilliseconds += std::chrono::duration_cast>(copyEndTime - copyStartTime).count(); - timing.cachedFallbackUsed = true; - return true; -} - -void OpenGLRenderPipeline::ReadOutputFrameSynchronously(const VideoIOState& state, void* destinationBytes, OutputReadbackTiming& timing) -{ - const auto readStartTime = std::chrono::steady_clock::now(); - const bool usePackedOutput = state.outputPixelFormat == VideoIOPixelFormat::V210 || state.outputPixelFormat == VideoIOPixelFormat::Yuva10; - const bool usePackFramebuffer = state.outputPixelFormat == VideoIOPixelFormat::Bgra8 || usePackedOutput; - - glPixelStorei(GL_PACK_ALIGNMENT, 4); - glPixelStorei(GL_PACK_ROW_LENGTH, 0); - if (usePackFramebuffer) - { - glBindFramebuffer(GL_READ_FRAMEBUFFER, mRenderer.OutputPackFramebuffer()); - if (usePackedOutput) - glReadPixels(0, 0, state.outputPackTextureWidth, state.outputFrameSize.height, GL_RGBA, GL_UNSIGNED_BYTE, destinationBytes); - else - glReadPixels(0, 0, state.outputFrameSize.width, state.outputFrameSize.height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, destinationBytes); - } - else - { - glBindFramebuffer(GL_READ_FRAMEBUFFER, mRenderer.OutputFramebuffer()); - glReadPixels(0, 0, state.outputFrameSize.width, state.outputFrameSize.height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, destinationBytes); - } - const auto readEndTime = std::chrono::steady_clock::now(); - timing.syncReadMilliseconds += std::chrono::duration_cast>(readEndTime - readStartTime).count(); - timing.syncFallbackUsed = true; -} - -OpenGLRenderPipeline::OutputReadbackTiming OpenGLRenderPipeline::ReadOutputFrame(const VideoIOState& state, VideoIOOutputFrame& outputFrame) -{ - OutputReadbackTiming timing; - - if (mOutputReadbackMode == OutputReadbackMode::Synchronous) - { - if (outputFrame.bytes != nullptr) - { - ReadOutputFrameSynchronously(state, outputFrame.bytes, timing); - CacheOutputFrame(outputFrame); - } - return timing; - } - - if (mOutputReadbackMode == OutputReadbackMode::CachedOnly) - { - if (TryCopyCachedOutputFrame(outputFrame, timing)) - return timing; - - if (outputFrame.bytes != nullptr) - { - ReadOutputFrameSynchronously(state, outputFrame.bytes, timing); - CacheOutputFrame(outputFrame); - } - return timing; - } - - if (TryConsumeAsyncReadback(outputFrame, 0, timing)) - { - (void)QueueAsyncReadback(state, timing); - return timing; - } - - const bool queued = QueueAsyncReadback(state, timing); - - if (queued && TryConsumeAsyncReadback(outputFrame, 0, timing)) - return timing; - - if (TryCopyCachedOutputFrame(outputFrame, timing)) - { - return timing; - } - - // Bootstrap only: until the first async readback has produced cached output, - // use one synchronous readback so DeckLink has a valid frame to schedule. - if (outputFrame.bytes != nullptr && mCachedOutputFrame.empty()) - { - ReadOutputFrameSynchronously(state, outputFrame.bytes, timing); - CacheOutputFrame(outputFrame); - } - - if (!queued) - (void)QueueAsyncReadback(state, timing); - return timing; -} - -OpenGLRenderPipeline::OutputReadbackMode OpenGLRenderPipeline::ReadOutputReadbackModeFromEnvironment() -{ - char* mode = nullptr; - std::size_t modeSize = 0; - if (_dupenv_s(&mode, &modeSize, "VST_OUTPUT_READBACK_MODE") != 0 || mode == nullptr) - return OutputReadbackMode::AsyncPbo; - - const std::string modeValue(mode); - std::free(mode); - if (modeValue == "async_pbo") - return OutputReadbackMode::AsyncPbo; - if (modeValue == "sync") - return OutputReadbackMode::Synchronous; - if (modeValue == "cached_only") - return OutputReadbackMode::CachedOnly; - - return OutputReadbackMode::AsyncPbo; -} - -std::size_t OpenGLRenderPipeline::ReadAsyncReadbackDepthFromEnvironment() -{ - char* depthValue = nullptr; - std::size_t depthValueSize = 0; - if (_dupenv_s(&depthValue, &depthValueSize, "VST_OUTPUT_READBACK_DEPTH") != 0 || depthValue == nullptr) - return 6; - - const std::string value(depthValue); - std::free(depthValue); - try - { - const unsigned long requestedDepth = std::stoul(value); - if (requestedDepth < 3) - return 3; - if (requestedDepth > 12) - return 12; - return static_cast(requestedDepth); - } - catch (...) - { - return 6; - } -} diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/OpenGLRenderPipeline.h b/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/OpenGLRenderPipeline.h deleted file mode 100644 index 661a0d1..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/OpenGLRenderPipeline.h +++ /dev/null @@ -1,100 +0,0 @@ -#pragma once - -#include "GLExtensions.h" -#include "VideoIOTypes.h" - -#include -#include - -class OpenGLRenderer; -class HealthTelemetry; -class RuntimeSnapshotProvider; - -struct RenderPipelineFrameContext -{ - VideoIOState videoState; - VideoIOCompletion completion; -}; - -class OpenGLRenderPipeline -{ -public: - using RenderEffectCallback = std::function; - using OutputReadyCallback = std::function; - using PaintCallback = std::function; - - OpenGLRenderPipeline( - OpenGLRenderer& renderer, - RuntimeSnapshotProvider& runtimeSnapshotProvider, - HealthTelemetry& healthTelemetry, - RenderEffectCallback renderEffect, - OutputReadyCallback outputReady, - PaintCallback paint); - ~OpenGLRenderPipeline(); - - bool RenderFrame(const RenderPipelineFrameContext& context, VideoIOOutputFrame& outputFrame); - -private: - enum class OutputReadbackMode - { - AsyncPbo, - Synchronous, - CachedOnly - }; - - struct AsyncReadbackSlot - { - GLuint pixelPackBuffer = 0; - GLsync fence = nullptr; - std::size_t sizeBytes = 0; - bool inFlight = false; - }; - - struct OutputReadbackTiming - { - double fenceWaitMilliseconds = 0.0; - double mapMilliseconds = 0.0; - double copyMilliseconds = 0.0; - double cachedCopyMilliseconds = 0.0; - double asyncQueueMilliseconds = 0.0; - double asyncQueueBufferMilliseconds = 0.0; - double asyncQueueSetupMilliseconds = 0.0; - double asyncQueueReadPixelsMilliseconds = 0.0; - double asyncQueueFenceMilliseconds = 0.0; - double syncReadMilliseconds = 0.0; - bool asyncReadbackMissed = false; - bool cachedFallbackUsed = false; - bool syncFallbackUsed = false; - }; - - bool EnsureAsyncReadbackBuffers(std::size_t requiredBytes); - void ResetAsyncReadbackState(); - void FlushAsyncReadbackPipeline(); - bool QueueAsyncReadback(const VideoIOState& state, OutputReadbackTiming& timing); - bool TryConsumeAsyncReadback(VideoIOOutputFrame& outputFrame, GLuint64 timeoutNanoseconds, OutputReadbackTiming& timing); - void CacheOutputFrame(const VideoIOOutputFrame& outputFrame); - bool TryCopyCachedOutputFrame(VideoIOOutputFrame& outputFrame, OutputReadbackTiming& timing) const; - void ReadOutputFrameSynchronously(const VideoIOState& state, void* destinationBytes, OutputReadbackTiming& timing); - void PackOutputForBgra8(const VideoIOState& state); - void PackOutputFor10Bit(const VideoIOState& state); - OutputReadbackTiming ReadOutputFrame(const VideoIOState& state, VideoIOOutputFrame& outputFrame); - static OutputReadbackMode ReadOutputReadbackModeFromEnvironment(); - static std::size_t ReadAsyncReadbackDepthFromEnvironment(); - - OpenGLRenderer& mRenderer; - RuntimeSnapshotProvider& mRuntimeSnapshotProvider; - HealthTelemetry& mHealthTelemetry; - RenderEffectCallback mRenderEffect; - OutputReadyCallback mOutputReady; - PaintCallback mPaint; - OutputReadbackMode mOutputReadbackMode = OutputReadbackMode::AsyncPbo; - std::vector mAsyncReadbackSlots; - std::size_t mAsyncReadbackDepth = 0; - std::size_t mAsyncReadbackWriteIndex = 0; - std::size_t mAsyncReadbackReadIndex = 0; - std::size_t mAsyncReadbackBytes = 0; - GLenum mAsyncReadbackFormat = GL_BGRA; - GLenum mAsyncReadbackType = GL_UNSIGNED_INT_8_8_8_8_REV; - GLuint mAsyncReadbackFramebuffer = 0; - std::vector mCachedOutputFrame; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/OpenGLVideoIOBridge.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/OpenGLVideoIOBridge.cpp deleted file mode 100644 index 50b5ef9..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/OpenGLVideoIOBridge.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "OpenGLVideoIOBridge.h" - -#include "RenderEngine.h" - -OpenGLVideoIOBridge::OpenGLVideoIOBridge(RenderEngine& renderEngine) : - mRenderEngine(renderEngine) -{ -} - -void OpenGLVideoIOBridge::UploadInputFrame(const VideoIOFrame& inputFrame, const VideoIOState& state) -{ - if (inputFrame.hasNoInputSource || inputFrame.bytes == nullptr) - return; // don't transfer texture when there's no input - - mRenderEngine.QueueInputFrame(inputFrame, state); -} - -bool OpenGLVideoIOBridge::RenderScheduledFrame(const VideoIOState& state, const VideoIOCompletion& completion, VideoIOOutputFrame& outputFrame) -{ - RenderPipelineFrameContext frameContext; - frameContext.videoState = state; - frameContext.completion = completion; - - return mRenderEngine.RequestOutputFrame(frameContext, outputFrame); -} diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/OpenGLVideoIOBridge.h b/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/OpenGLVideoIOBridge.h deleted file mode 100644 index 61b0523..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/OpenGLVideoIOBridge.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include "OpenGLRenderPipeline.h" - -class RenderEngine; - -class OpenGLVideoIOBridge -{ -public: - explicit OpenGLVideoIOBridge(RenderEngine& renderEngine); - - void UploadInputFrame(const VideoIOFrame& inputFrame, const VideoIOState& state); - bool RenderScheduledFrame(const VideoIOState& state, const VideoIOCompletion& completion, VideoIOOutputFrame& outputFrame); - -private: - RenderEngine& mRenderEngine; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/PngScreenshotWriter.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/PngScreenshotWriter.cpp deleted file mode 100644 index b1544ea..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/PngScreenshotWriter.cpp +++ /dev/null @@ -1,137 +0,0 @@ -#include "PngScreenshotWriter.h" - -#include -#include -#include - -#include -#include - -namespace -{ -std::string HResultToString(HRESULT hr) -{ - std::ostringstream stream; - stream << "HRESULT 0x" << std::hex << static_cast(hr); - return stream.str(); -} - -bool WritePngFile( - const std::filesystem::path& outputPath, - unsigned width, - unsigned height, - const std::vector& bgraPixels, - std::string& error) -{ - if (width == 0 || height == 0 || bgraPixels.size() < static_cast(width) * height * 4) - { - error = "Invalid screenshot dimensions or pixel buffer."; - return false; - } - - HRESULT initializeResult = CoInitializeEx(nullptr, COINIT_MULTITHREADED); - const bool shouldUninitialize = SUCCEEDED(initializeResult); - if (FAILED(initializeResult) && initializeResult != RPC_E_CHANGED_MODE) - { - error = "CoInitializeEx failed: " + HResultToString(initializeResult); - return false; - } - - CComPtr factory; - HRESULT result = CoCreateInstance( - CLSID_WICImagingFactory, - nullptr, - CLSCTX_INPROC_SERVER, - IID_PPV_ARGS(&factory)); - if (FAILED(result)) - { - error = "Could not create WIC imaging factory: " + HResultToString(result); - if (shouldUninitialize) - CoUninitialize(); - return false; - } - - CComPtr stream; - result = factory->CreateStream(&stream); - if (SUCCEEDED(result)) - result = stream->InitializeFromFilename(outputPath.wstring().c_str(), GENERIC_WRITE); - if (FAILED(result)) - { - error = "Could not open screenshot output file: " + HResultToString(result); - if (shouldUninitialize) - CoUninitialize(); - return false; - } - - CComPtr encoder; - result = factory->CreateEncoder(GUID_ContainerFormatPng, nullptr, &encoder); - if (SUCCEEDED(result)) - result = encoder->Initialize(stream, WICBitmapEncoderNoCache); - if (FAILED(result)) - { - error = "Could not initialize PNG encoder: " + HResultToString(result); - if (shouldUninitialize) - CoUninitialize(); - return false; - } - - CComPtr frame; - CComPtr propertyBag; - result = encoder->CreateNewFrame(&frame, &propertyBag); - if (SUCCEEDED(result)) - result = frame->Initialize(propertyBag); - if (SUCCEEDED(result)) - result = frame->SetSize(width, height); - - WICPixelFormatGUID pixelFormat = GUID_WICPixelFormat32bppBGRA; - if (SUCCEEDED(result)) - result = frame->SetPixelFormat(&pixelFormat); - if (SUCCEEDED(result) && pixelFormat != GUID_WICPixelFormat32bppBGRA) - { - error = "PNG encoder did not accept BGRA pixel format."; - result = E_FAIL; - } - - const UINT stride = width * 4; - const UINT imageSize = stride * height; - if (SUCCEEDED(result)) - result = frame->WritePixels(height, stride, imageSize, const_cast(bgraPixels.data())); - if (SUCCEEDED(result)) - result = frame->Commit(); - if (SUCCEEDED(result)) - result = encoder->Commit(); - - if (shouldUninitialize) - CoUninitialize(); - - if (FAILED(result)) - { - error = "Could not write screenshot PNG: " + HResultToString(result); - std::error_code ignored; - std::filesystem::remove(outputPath, ignored); - return false; - } - - return true; -} -} - -void WritePngFileAsync( - const std::filesystem::path& outputPath, - unsigned width, - unsigned height, - std::vector rgbaPixels) -{ - std::thread( - [outputPath, width, height, pixels = std::move(rgbaPixels)]() mutable - { - for (std::size_t index = 0; index + 3 < pixels.size(); index += 4) - std::swap(pixels[index], pixels[index + 2]); - - std::string error; - if (!WritePngFile(outputPath, width, height, pixels, error)) - OutputDebugStringA(("Screenshot write failed: " + error + "\n").c_str()); - else - OutputDebugStringA(("Screenshot written: " + outputPath.string() + "\n").c_str()); - }).detach(); -} diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/PngScreenshotWriter.h b/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/PngScreenshotWriter.h deleted file mode 100644 index f97ad78..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/PngScreenshotWriter.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include -#include -#include - -void WritePngFileAsync( - const std::filesystem::path& outputPath, - unsigned width, - unsigned height, - std::vector rgbaPixels); - diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/RenderPassDescriptor.h b/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/RenderPassDescriptor.h deleted file mode 100644 index 937ce3e..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/RenderPassDescriptor.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -#include "OpenGLRenderer.h" -#include "ShaderTypes.h" - -#include - -#include -#include - -enum class RenderPassKind -{ - LayerEffect -}; - -enum class RenderPassOutputTarget -{ - Temporary, - LayerTemp, - Composite -}; - -struct RenderPassDescriptor -{ - RenderPassKind kind = RenderPassKind::LayerEffect; - RenderPassOutputTarget outputTarget = RenderPassOutputTarget::Composite; - std::size_t passIndex = 0; - std::string passId; - std::string layerId; - std::string shaderId; - GLuint layerInputTexture = 0; - GLuint sourceTexture = 0; - GLuint sourceFramebuffer = 0; - GLuint destinationTexture = 0; - GLuint destinationFramebuffer = 0; - OpenGLRenderer::LayerProgram* layerProgram = nullptr; - OpenGLRenderer::LayerProgram::PassProgram* passProgram = nullptr; - const RuntimeRenderState* layerState = nullptr; - bool capturePreLayerHistory = false; - bool captureFeedbackWrite = false; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/ShaderFeedbackBuffers.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/ShaderFeedbackBuffers.cpp deleted file mode 100644 index 1d735c3..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/ShaderFeedbackBuffers.cpp +++ /dev/null @@ -1,202 +0,0 @@ -#include "ShaderFeedbackBuffers.h" - -#include - -namespace -{ -void ConfigureFeedbackTexture(unsigned frameWidth, unsigned frameHeight) -{ - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, frameWidth, frameHeight, 0, GL_RGBA, GL_FLOAT, NULL); -} -} - -bool ShaderFeedbackBuffers::EnsureResources(const std::vector& layerStates, unsigned frameWidth, unsigned frameHeight, std::string& error) -{ - if (!EnsureZeroTexture()) - { - error = "Failed to initialize shader feedback fallback texture."; - return false; - } - - std::set requiredLayerIds; - for (const RuntimeRenderState& state : layerStates) - { - if (!state.feedback.enabled) - continue; - - requiredLayerIds.insert(state.layerId); - auto surfaceIt = mSurfacesByLayerId.find(state.layerId); - if (surfaceIt == mSurfacesByLayerId.end() || - surfaceIt->second.width != frameWidth || - surfaceIt->second.height != frameHeight) - { - Surface replacement; - if (!CreateSurface(replacement, frameWidth, frameHeight, error)) - return false; - mSurfacesByLayerId[state.layerId] = std::move(replacement); - } - } - - for (auto it = mSurfacesByLayerId.begin(); it != mSurfacesByLayerId.end();) - { - if (requiredLayerIds.find(it->first) == requiredLayerIds.end()) - { - DestroySurface(it->second); - it = mSurfacesByLayerId.erase(it); - } - else - { - ++it; - } - } - - return true; -} - -void ShaderFeedbackBuffers::DestroyResources() -{ - for (auto& entry : mSurfacesByLayerId) - DestroySurface(entry.second); - mSurfacesByLayerId.clear(); - - if (mZeroTexture != 0) - { - glDeleteTextures(1, &mZeroTexture); - mZeroTexture = 0; - } -} - -void ShaderFeedbackBuffers::ResetState() -{ - for (auto& entry : mSurfacesByLayerId) - ClearSurfaceState(entry.second); -} - -GLuint ShaderFeedbackBuffers::ResolveReadTexture(const RuntimeRenderState& state) const -{ - if (!state.feedback.enabled) - return mZeroTexture; - - auto surfaceIt = mSurfacesByLayerId.find(state.layerId); - if (surfaceIt == mSurfacesByLayerId.end() || !surfaceIt->second.hasData) - return mZeroTexture; - - return surfaceIt->second.slots[surfaceIt->second.readIndex].texture != 0 - ? surfaceIt->second.slots[surfaceIt->second.readIndex].texture - : mZeroTexture; -} - -bool ShaderFeedbackBuffers::FeedbackAvailable(const RuntimeRenderState& state) const -{ - if (!state.feedback.enabled) - return false; - - auto surfaceIt = mSurfacesByLayerId.find(state.layerId); - return surfaceIt != mSurfacesByLayerId.end() && surfaceIt->second.hasData; -} - -void ShaderFeedbackBuffers::CaptureFeedbackFramebuffer(const std::string& layerId, GLuint sourceFramebuffer, unsigned frameWidth, unsigned frameHeight) -{ - auto surfaceIt = mSurfacesByLayerId.find(layerId); - if (surfaceIt == mSurfacesByLayerId.end()) - return; - - Surface& surface = surfaceIt->second; - const unsigned writeIndex = 1u - surface.readIndex; - glBindFramebuffer(GL_READ_FRAMEBUFFER, sourceFramebuffer); - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, surface.slots[writeIndex].framebuffer); - glBlitFramebuffer(0, 0, frameWidth, frameHeight, 0, 0, frameWidth, frameHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR); - surface.pendingWrite = true; -} - -void ShaderFeedbackBuffers::FinalizeFrame() -{ - for (auto& entry : mSurfacesByLayerId) - { - Surface& surface = entry.second; - if (!surface.pendingWrite) - continue; - - surface.readIndex = 1u - surface.readIndex; - surface.hasData = true; - surface.pendingWrite = false; - } -} - -bool ShaderFeedbackBuffers::EnsureZeroTexture() -{ - if (mZeroTexture != 0) - return true; - - glGenTextures(1, &mZeroTexture); - glBindTexture(GL_TEXTURE_2D, mZeroTexture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - const float zeroPixel[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, 1, 1, 0, GL_RGBA, GL_FLOAT, zeroPixel); - glBindTexture(GL_TEXTURE_2D, 0); - return mZeroTexture != 0; -} - -bool ShaderFeedbackBuffers::CreateSurface(Surface& surface, unsigned frameWidth, unsigned frameHeight, std::string& error) -{ - DestroySurface(surface); - - surface.width = frameWidth; - surface.height = frameHeight; - for (Slot& slot : surface.slots) - { - glGenTextures(1, &slot.texture); - glBindTexture(GL_TEXTURE_2D, slot.texture); - ConfigureFeedbackTexture(frameWidth, frameHeight); - - glGenFramebuffers(1, &slot.framebuffer); - glBindFramebuffer(GL_FRAMEBUFFER, slot.framebuffer); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, slot.texture, 0); - if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) - { - error = "Failed to initialize a shader feedback framebuffer."; - glBindFramebuffer(GL_FRAMEBUFFER, 0); - glBindTexture(GL_TEXTURE_2D, 0); - DestroySurface(surface); - return false; - } - } - - glBindFramebuffer(GL_FRAMEBUFFER, 0); - glBindTexture(GL_TEXTURE_2D, 0); - ClearSurfaceState(surface); - return true; -} - -void ShaderFeedbackBuffers::DestroySurface(Surface& surface) -{ - for (Slot& slot : surface.slots) - { - if (slot.framebuffer != 0) - glDeleteFramebuffers(1, &slot.framebuffer); - if (slot.texture != 0) - glDeleteTextures(1, &slot.texture); - slot.framebuffer = 0; - slot.texture = 0; - } - - surface.width = 0; - surface.height = 0; - surface.readIndex = 0; - surface.hasData = false; - surface.pendingWrite = false; -} - -void ShaderFeedbackBuffers::ClearSurfaceState(Surface& surface) -{ - surface.readIndex = 0; - surface.hasData = false; - surface.pendingWrite = false; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/ShaderFeedbackBuffers.h b/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/ShaderFeedbackBuffers.h deleted file mode 100644 index 64beff8..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/ShaderFeedbackBuffers.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once - -#include "GLExtensions.h" -#include "ShaderTypes.h" - -#include -#include -#include - -class ShaderFeedbackBuffers -{ -public: - struct Slot - { - GLuint texture = 0; - GLuint framebuffer = 0; - }; - - struct Surface - { - Slot slots[2]; - unsigned width = 0; - unsigned height = 0; - unsigned readIndex = 0; - bool hasData = false; - bool pendingWrite = false; - }; - - bool EnsureResources(const std::vector& layerStates, unsigned frameWidth, unsigned frameHeight, std::string& error); - void DestroyResources(); - void ResetState(); - GLuint ResolveReadTexture(const RuntimeRenderState& state) const; - bool FeedbackAvailable(const RuntimeRenderState& state) const; - void CaptureFeedbackFramebuffer(const std::string& layerId, GLuint sourceFramebuffer, unsigned frameWidth, unsigned frameHeight); - void FinalizeFrame(); - -private: - bool EnsureZeroTexture(); - bool CreateSurface(Surface& surface, unsigned frameWidth, unsigned frameHeight, std::string& error); - void DestroySurface(Surface& surface); - void ClearSurfaceState(Surface& surface); - -private: - std::map mSurfacesByLayerId; - GLuint mZeroTexture = 0; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/TemporalHistoryBuffers.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/TemporalHistoryBuffers.cpp deleted file mode 100644 index f30a488..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/TemporalHistoryBuffers.cpp +++ /dev/null @@ -1,261 +0,0 @@ -#include "TemporalHistoryBuffers.h" - -#include "GlRenderConstants.h" -#include "ShaderTypes.h" - -#include -#include -#include - -bool TemporalHistoryBuffers::ValidateTextureUnitBudget(const std::vector& layerStates, unsigned historyCap, std::string& error) const -{ - unsigned requiredUnits = kSourceHistoryTextureUnitBase; - for (const RuntimeRenderState& state : layerStates) - { - unsigned textTextureCount = 0; - for (const ShaderParameterDefinition& definition : state.parameterDefinitions) - { - if (definition.type == ShaderParameterType::Text) - ++textTextureCount; - } - const unsigned totalShaderTextures = static_cast(state.textureAssets.size()) + textTextureCount; - const unsigned feedbackTextureCount = state.feedback.enabled ? 1u : 0u; - const unsigned layerRequiredUnits = kSourceHistoryTextureUnitBase + (state.isTemporal ? historyCap + historyCap : 0u) + feedbackTextureCount + totalShaderTextures; - if (layerRequiredUnits > requiredUnits) - requiredUnits = layerRequiredUnits; - } - - GLint maxTextureUnits = 0; - glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &maxTextureUnits); - const unsigned availableUnits = maxTextureUnits > 0 ? static_cast(maxTextureUnits) : 0u; - if (requiredUnits > availableUnits) - { - std::ostringstream message; - message << "The current history and shader texture asset configuration requires " << requiredUnits - << " fragment texture units, but only " << maxTextureUnits << " are available."; - error = message.str(); - return false; - } - return true; -} - -bool TemporalHistoryBuffers::EnsureResources(const std::vector& layerStates, unsigned historyCap, unsigned frameWidth, unsigned frameHeight, std::string& error) -{ - const bool sourceHistoryNeeded = std::any_of(layerStates.begin(), layerStates.end(), - [](const RuntimeRenderState& state) { return state.isTemporal && state.effectiveTemporalHistoryLength > 0; }); - const unsigned sourceHistoryLength = sourceHistoryNeeded ? historyCap : 0; - - if (sourceHistoryRing.effectiveLength != sourceHistoryLength) - { - if (!CreateRing(sourceHistoryRing, sourceHistoryLength, TemporalHistorySource::Source, frameWidth, frameHeight, error)) - return false; - mNeedsReset = true; - } - - std::set requiredPreLayerIds; - for (const RuntimeRenderState& state : layerStates) - { - if (!state.isTemporal || state.temporalHistorySource != TemporalHistorySource::PreLayerInput) - continue; - requiredPreLayerIds.insert(state.layerId); - auto historyIt = preLayerHistoryByLayerId.find(state.layerId); - if (historyIt == preLayerHistoryByLayerId.end() || historyIt->second.effectiveLength != state.effectiveTemporalHistoryLength) - { - Ring replacement; - if (!CreateRing(replacement, state.effectiveTemporalHistoryLength, TemporalHistorySource::PreLayerInput, frameWidth, frameHeight, error)) - return false; - preLayerHistoryByLayerId[state.layerId] = std::move(replacement); - mNeedsReset = true; - } - } - - for (auto it = preLayerHistoryByLayerId.begin(); it != preLayerHistoryByLayerId.end();) - { - if (requiredPreLayerIds.find(it->first) == requiredPreLayerIds.end()) - { - DestroyRing(it->second); - it = preLayerHistoryByLayerId.erase(it); - mNeedsReset = true; - } - else - { - ++it; - } - } - - if (mNeedsReset) - ResetState(); - - return true; -} - -bool TemporalHistoryBuffers::CreateRing(Ring& ring, unsigned effectiveLength, TemporalHistorySource historySource, unsigned frameWidth, unsigned frameHeight, std::string& error) -{ - DestroyRing(ring); - ring.effectiveLength = effectiveLength; - ring.historySource = historySource; - if (effectiveLength == 0) - return true; - - ring.slots.resize(effectiveLength); - for (Slot& slot : ring.slots) - { - glGenTextures(1, &slot.texture); - glBindTexture(GL_TEXTURE_2D, slot.texture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, frameWidth, frameHeight, 0, GL_RGBA, GL_FLOAT, NULL); - - glGenFramebuffers(1, &slot.framebuffer); - glBindFramebuffer(GL_FRAMEBUFFER, slot.framebuffer); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, slot.texture, 0); - const GLenum framebufferStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER); - if (framebufferStatus != GL_FRAMEBUFFER_COMPLETE) - { - error = "Failed to initialize a temporal history framebuffer."; - glBindFramebuffer(GL_FRAMEBUFFER, 0); - glBindTexture(GL_TEXTURE_2D, 0); - DestroyRing(ring); - return false; - } - } - - glBindFramebuffer(GL_FRAMEBUFFER, 0); - glBindTexture(GL_TEXTURE_2D, 0); - return true; -} - -void TemporalHistoryBuffers::DestroyRing(Ring& ring) -{ - for (Slot& slot : ring.slots) - { - if (slot.framebuffer != 0) - glDeleteFramebuffers(1, &slot.framebuffer); - if (slot.texture != 0) - glDeleteTextures(1, &slot.texture); - slot.framebuffer = 0; - slot.texture = 0; - } - ring.slots.clear(); - ring.nextWriteIndex = 0; - ring.filledCount = 0; - ring.effectiveLength = 0; - ring.historySource = TemporalHistorySource::None; -} - -void TemporalHistoryBuffers::DestroyResources() -{ - DestroyRing(sourceHistoryRing); - for (auto& historyEntry : preLayerHistoryByLayerId) - DestroyRing(historyEntry.second); - preLayerHistoryByLayerId.clear(); - mNeedsReset = true; -} - -void TemporalHistoryBuffers::ResetState() -{ - sourceHistoryRing.nextWriteIndex = 0; - sourceHistoryRing.filledCount = 0; - for (auto& historyEntry : preLayerHistoryByLayerId) - { - historyEntry.second.nextWriteIndex = 0; - historyEntry.second.filledCount = 0; - } - mNeedsReset = false; -} - -void TemporalHistoryBuffers::PushFramebuffer(GLuint sourceFramebuffer, Ring& ring, unsigned frameWidth, unsigned frameHeight) -{ - if (ring.effectiveLength == 0 || ring.slots.empty()) - return; - - Slot& targetSlot = ring.slots[ring.nextWriteIndex]; - glBindFramebuffer(GL_READ_FRAMEBUFFER, sourceFramebuffer); - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, targetSlot.framebuffer); - glBlitFramebuffer(0, 0, frameWidth, frameHeight, 0, 0, frameWidth, frameHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR); - ring.nextWriteIndex = (ring.nextWriteIndex + 1) % ring.slots.size(); - ring.filledCount = std::min(ring.filledCount + 1, ring.slots.size()); -} - -void TemporalHistoryBuffers::PushSourceFramebuffer(GLuint sourceFramebuffer, unsigned frameWidth, unsigned frameHeight) -{ - PushFramebuffer(sourceFramebuffer, sourceHistoryRing, frameWidth, frameHeight); -} - -void TemporalHistoryBuffers::PushPreLayerFramebuffer(const std::string& layerId, GLuint sourceFramebuffer, unsigned frameWidth, unsigned frameHeight) -{ - auto historyIt = preLayerHistoryByLayerId.find(layerId); - if (historyIt != preLayerHistoryByLayerId.end()) - PushFramebuffer(sourceFramebuffer, historyIt->second, frameWidth, frameHeight); -} - -void TemporalHistoryBuffers::BindSamplers(const RuntimeRenderState& state, GLuint currentSourceTexture, unsigned historyCap) -{ - for (unsigned index = 0; index < historyCap; ++index) - { - glActiveTexture(GL_TEXTURE0 + kSourceHistoryTextureUnitBase + index); - glBindTexture(GL_TEXTURE_2D, ResolveTexture(sourceHistoryRing, currentSourceTexture, index)); - } - - const GLuint temporalBase = kSourceHistoryTextureUnitBase + historyCap; - const Ring* temporalRing = nullptr; - auto it = preLayerHistoryByLayerId.find(state.layerId); - if (it != preLayerHistoryByLayerId.end()) - temporalRing = &it->second; - - for (unsigned index = 0; index < historyCap; ++index) - { - glActiveTexture(GL_TEXTURE0 + temporalBase + index); - glBindTexture(GL_TEXTURE_2D, temporalRing ? ResolveTexture(*temporalRing, currentSourceTexture, index) : currentSourceTexture); - } - glActiveTexture(GL_TEXTURE0); -} - -std::vector TemporalHistoryBuffers::ResolveSourceHistoryTextures(GLuint fallbackTexture, unsigned historyCap) const -{ - std::vector textures; - textures.reserve(historyCap); - for (unsigned index = 0; index < historyCap; ++index) - textures.push_back(ResolveTexture(sourceHistoryRing, fallbackTexture, index)); - return textures; -} - -std::vector TemporalHistoryBuffers::ResolveTemporalHistoryTextures(const RuntimeRenderState& state, GLuint fallbackTexture, unsigned historyCap) const -{ - const Ring* temporalRing = nullptr; - auto it = preLayerHistoryByLayerId.find(state.layerId); - if (it != preLayerHistoryByLayerId.end()) - temporalRing = &it->second; - - std::vector textures; - textures.reserve(historyCap); - for (unsigned index = 0; index < historyCap; ++index) - textures.push_back(temporalRing ? ResolveTexture(*temporalRing, fallbackTexture, index) : fallbackTexture); - return textures; -} - -GLuint TemporalHistoryBuffers::ResolveTexture(const Ring& ring, GLuint fallbackTexture, std::size_t framesAgo) const -{ - if (ring.filledCount == 0 || ring.slots.empty()) - return fallbackTexture; - - const std::size_t clampedOffset = std::min(framesAgo, ring.filledCount - 1); - const std::size_t newestIndex = (ring.nextWriteIndex + ring.slots.size() - 1) % ring.slots.size(); - const std::size_t slotIndex = (newestIndex + ring.slots.size() - clampedOffset) % ring.slots.size(); - return ring.slots[slotIndex].texture != 0 ? ring.slots[slotIndex].texture : fallbackTexture; -} - -unsigned TemporalHistoryBuffers::SourceAvailableCount() const -{ - return static_cast(sourceHistoryRing.filledCount); -} - -unsigned TemporalHistoryBuffers::AvailableCountForLayer(const std::string& layerId) const -{ - auto it = preLayerHistoryByLayerId.find(layerId); - if (it == preLayerHistoryByLayerId.end()) - return 0; - return static_cast(it->second.filledCount); -} diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/TemporalHistoryBuffers.h b/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/TemporalHistoryBuffers.h deleted file mode 100644 index 960953d..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/pipeline/TemporalHistoryBuffers.h +++ /dev/null @@ -1,53 +0,0 @@ -#pragma once - -#include "GLExtensions.h" -#include "ShaderTypes.h" - -#include - -#include -#include -#include -#include - -struct RuntimeRenderState; - -class TemporalHistoryBuffers -{ -public: - struct Slot - { - GLuint texture = 0; - GLuint framebuffer = 0; - }; - - struct Ring - { - std::vector slots; - std::size_t nextWriteIndex = 0; - std::size_t filledCount = 0; - unsigned effectiveLength = 0; - TemporalHistorySource historySource = TemporalHistorySource::None; - }; - - bool ValidateTextureUnitBudget(const std::vector& layerStates, unsigned historyCap, std::string& error) const; - bool EnsureResources(const std::vector& layerStates, unsigned historyCap, unsigned frameWidth, unsigned frameHeight, std::string& error); - bool CreateRing(Ring& ring, unsigned effectiveLength, TemporalHistorySource historySource, unsigned frameWidth, unsigned frameHeight, std::string& error); - void DestroyRing(Ring& ring); - void DestroyResources(); - void ResetState(); - void PushFramebuffer(GLuint sourceFramebuffer, Ring& ring, unsigned frameWidth, unsigned frameHeight); - void PushSourceFramebuffer(GLuint sourceFramebuffer, unsigned frameWidth, unsigned frameHeight); - void PushPreLayerFramebuffer(const std::string& layerId, GLuint sourceFramebuffer, unsigned frameWidth, unsigned frameHeight); - void BindSamplers(const RuntimeRenderState& state, GLuint currentSourceTexture, unsigned historyCap); - std::vector ResolveSourceHistoryTextures(GLuint fallbackTexture, unsigned historyCap) const; - std::vector ResolveTemporalHistoryTextures(const RuntimeRenderState& state, GLuint fallbackTexture, unsigned historyCap) const; - GLuint ResolveTexture(const Ring& ring, GLuint fallbackTexture, std::size_t framesAgo) const; - unsigned SourceAvailableCount() const; - unsigned AvailableCountForLayer(const std::string& layerId) const; - -private: - Ring sourceHistoryRing; - std::map preLayerHistoryByLayerId; - bool mNeedsReset = true; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/renderer/GLExtensions.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/renderer/GLExtensions.cpp deleted file mode 100644 index f6569ba..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/renderer/GLExtensions.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/* -LICENSE-START- - ** Copyright (c) 2012 Blackmagic Design - ** - ** Permission is hereby granted, free of charge, to any person or organization - ** obtaining a copy of the software and accompanying documentation (the - ** "Software") to use, reproduce, display, distribute, sub-license, 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, in - ** accordance with: - ** - ** (1) if the Software is obtained from Blackmagic Design, the End User License - ** Agreement for the Software Development Kit ("EULA") available at - ** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or - ** - ** (2) if the Software is obtained from any third party, such licensing terms - ** as notified by that third party, - ** - ** and all subject to the following: - ** - ** (3) 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. - ** - ** (4) 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. - ** - ** A copy of the Software is available free of charge at - ** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. - ** - ** -LICENSE-END- - */ -// -// GLExtensions.cpp -// LoopThroughWithOpenGLCompositing -// - -#include "GLExtensions.h" - -PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers; -PFNGLGENRENDERBUFFERSPROC glGenRenderbuffers; -PFNGLBINDRENDERBUFFERPROC glBindRenderbuffer; -PFNGLRENDERBUFFERSTORAGEPROC glRenderbufferStorage; -PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers; -PFNGLDELETERENDERBUFFERSPROC glDeleteRenderbuffers; -PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer; -PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D; -PFNGLFRAMEBUFFERRENDERBUFFERPROC glFramebufferRenderbuffer; -PFNGLCHECKFRAMEBUFFERSTATUSPROC glCheckFramebufferStatus; -PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer; -PFNGLFENCESYNCPROC glFenceSync; -PFNGLCLIENTWAITSYNCPROC glClientWaitSync; -PFNGLDELETESYNCPROC glDeleteSync; -PFNGLGENBUFFERSPROC glGenBuffers; -PFNGLDELETEBUFFERSPROC glDeleteBuffers; -PFNGLBINDBUFFERPROC glBindBuffer; -PFNGLBUFFERDATAPROC glBufferData; -PFNGLMAPBUFFERPROC glMapBuffer; -PFNGLUNMAPBUFFERPROC glUnmapBuffer; -PFNGLBUFFERSUBDATAPROC glBufferSubData; -PFNGLBINDBUFFERBASEPROC glBindBufferBase; -PFNGLACTIVETEXTUREPROC glActiveTexture; -PFNGLGENVERTEXARRAYSPROC glGenVertexArrays; -PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays; -PFNGLBINDVERTEXARRAYPROC glBindVertexArray; -PFNGLCREATESHADERPROC glCreateShader; -PFNGLDELETESHADERPROC glDeleteShader; -PFNGLDELETEPROGRAMPROC glDeleteProgram; -PFNGLSHADERSOURCEPROC glShaderSource; -PFNGLCOMPILESHADERPROC glCompileShader; -PFNGLGETSHADERIVPROC glGetShaderiv; -PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog; -PFNGLCREATEPROGRAMPROC glCreateProgram; -PFNGLATTACHSHADERPROC glAttachShader; -PFNGLLINKPROGRAMPROC glLinkProgram; -PFNGLGETPROGRAMIVPROC glGetProgramiv; -PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog; -PFNGLUSEPROGRAMPROC glUseProgram; -PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation; -PFNGLGETUNIFORMBLOCKINDEXPROC glGetUniformBlockIndex; -PFNGLUNIFORMBLOCKBINDINGPROC glUniformBlockBinding; -PFNGLUNIFORM1IPROC glUniform1i; -PFNGLUNIFORM1FPROC glUniform1f; -PFNGLUNIFORM2FPROC glUniform2f; -PFNGLUNIFORM4FPROC glUniform4f; - -bool ResolveGLExtensions() -{ - glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC) wglGetProcAddress("glGenFramebuffers"); - if (!glGenFramebuffers) - glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC) wglGetProcAddress("glGenFramebuffersEXT"); - glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC) wglGetProcAddress("glGenRenderbuffers"); - if (!glGenRenderbuffers) - glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC) wglGetProcAddress("glGenRenderbuffersEXT"); - glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC) wglGetProcAddress("glBindRenderbuffer"); - if (!glBindRenderbuffer) - glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC) wglGetProcAddress("glBindRenderbufferEXT"); - glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC) wglGetProcAddress("glRenderbufferStorage"); - if (!glRenderbufferStorage) - glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC) wglGetProcAddress("glRenderbufferStorageEXT"); - glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC) wglGetProcAddress("glDeleteFramebuffers"); - if (!glDeleteFramebuffers) - glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC) wglGetProcAddress("glDeleteFramebuffersEXT"); - glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC) wglGetProcAddress("glDeleteRenderbuffers"); - if (!glDeleteRenderbuffers) - glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC) wglGetProcAddress("glDeleteRenderbuffersEXT"); - glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC) wglGetProcAddress("glBindFramebuffer"); - if (!glBindFramebuffer) - glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC) wglGetProcAddress("glBindFramebufferEXT"); - glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC) wglGetProcAddress("glFramebufferTexture2D"); - if (!glFramebufferTexture2D) - glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC) wglGetProcAddress("glFramebufferTexture2DEXT"); - glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC) wglGetProcAddress("glFramebufferRenderbuffer"); - if (!glFramebufferRenderbuffer) - glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC) wglGetProcAddress("glFramebufferRenderbufferEXT"); - glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC) wglGetProcAddress("glCheckFramebufferStatus"); - if (!glCheckFramebufferStatus) - glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC) wglGetProcAddress("glCheckFramebufferStatusEXT"); - glBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC) wglGetProcAddress("glBlitFramebuffer"); - if (!glBlitFramebuffer) - glBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC) wglGetProcAddress("glBlitFramebufferEXT"); - glFenceSync = (PFNGLFENCESYNCPROC) wglGetProcAddress("glFenceSync"); - glClientWaitSync = (PFNGLCLIENTWAITSYNCPROC) wglGetProcAddress("glClientWaitSync"); - glDeleteSync = (PFNGLDELETESYNCPROC) wglGetProcAddress("glDeleteSync"); - glGenBuffers = (PFNGLGENBUFFERSPROC) wglGetProcAddress("glGenBuffers"); - glDeleteBuffers = (PFNGLDELETEBUFFERSPROC) wglGetProcAddress("glDeleteBuffers"); - glBindBuffer = (PFNGLBINDBUFFERPROC) wglGetProcAddress("glBindBuffer"); - glBufferData = (PFNGLBUFFERDATAPROC) wglGetProcAddress("glBufferData"); - glMapBuffer = (PFNGLMAPBUFFERPROC) wglGetProcAddress("glMapBuffer"); - glUnmapBuffer = (PFNGLUNMAPBUFFERPROC) wglGetProcAddress("glUnmapBuffer"); - glBufferSubData = (PFNGLBUFFERSUBDATAPROC) wglGetProcAddress("glBufferSubData"); - glBindBufferBase = (PFNGLBINDBUFFERBASEPROC) wglGetProcAddress("glBindBufferBase"); - glActiveTexture = (PFNGLACTIVETEXTUREPROC) wglGetProcAddress("glActiveTexture"); - glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC) wglGetProcAddress("glGenVertexArrays"); - glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC) wglGetProcAddress("glDeleteVertexArrays"); - glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC) wglGetProcAddress("glBindVertexArray"); - glCreateShader = (PFNGLCREATESHADERPROC) wglGetProcAddress("glCreateShader"); - glDeleteShader = (PFNGLDELETESHADERPROC) wglGetProcAddress("glDeleteShader"); - glDeleteProgram = (PFNGLDELETEPROGRAMPROC) wglGetProcAddress("glDeleteProgram"); - glShaderSource = (PFNGLSHADERSOURCEPROC) wglGetProcAddress("glShaderSource"); - glCompileShader = (PFNGLCOMPILESHADERPROC) wglGetProcAddress("glCompileShader"); - glGetShaderiv = (PFNGLGETSHADERIVPROC) wglGetProcAddress("glGetShaderiv"); - glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC) wglGetProcAddress("glGetShaderInfoLog"); - glCreateProgram = (PFNGLCREATEPROGRAMPROC) wglGetProcAddress("glCreateProgram"); - glAttachShader = (PFNGLATTACHSHADERPROC) wglGetProcAddress("glAttachShader"); - glLinkProgram = (PFNGLLINKPROGRAMPROC) wglGetProcAddress("glLinkProgram"); - glGetProgramiv = (PFNGLGETPROGRAMIVPROC) wglGetProcAddress("glGetProgramiv"); - glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC) wglGetProcAddress("glGetProgramInfoLog"); - glUseProgram = (PFNGLUSEPROGRAMPROC) wglGetProcAddress("glUseProgram"); - glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC) wglGetProcAddress("glGetUniformLocation"); - glGetUniformBlockIndex = (PFNGLGETUNIFORMBLOCKINDEXPROC) wglGetProcAddress("glGetUniformBlockIndex"); - glUniformBlockBinding = (PFNGLUNIFORMBLOCKBINDINGPROC) wglGetProcAddress("glUniformBlockBinding"); - glUniform1i = (PFNGLUNIFORM1IPROC) wglGetProcAddress("glUniform1i"); - glUniform1f = (PFNGLUNIFORM1FPROC) wglGetProcAddress("glUniform1f"); - glUniform2f = (PFNGLUNIFORM2FPROC) wglGetProcAddress("glUniform2f"); - glUniform4f = (PFNGLUNIFORM4FPROC) wglGetProcAddress("glUniform4f"); - - return glGenFramebuffers - && glGenRenderbuffers - && glBindRenderbuffer - && glRenderbufferStorage - && glDeleteFramebuffers - && glDeleteRenderbuffers - && glBindFramebuffer - && glFramebufferTexture2D - && glFramebufferRenderbuffer - && glCheckFramebufferStatus - && glBlitFramebuffer - && glFenceSync - && glClientWaitSync - && glDeleteSync - && glGenBuffers - && glDeleteBuffers - && glBindBuffer - && glBufferData - && glMapBuffer - && glUnmapBuffer - && glBufferSubData - && glBindBufferBase - && glActiveTexture - && glGenVertexArrays - && glDeleteVertexArrays - && glBindVertexArray - && glCreateShader - && glDeleteShader - && glDeleteProgram - && glShaderSource - && glCompileShader - && glGetShaderiv - && glGetShaderInfoLog - && glCreateProgram - && glAttachShader - && glLinkProgram - && glGetProgramiv - && glGetProgramInfoLog - && glUseProgram - && glGetUniformLocation - && glGetUniformBlockIndex - && glUniformBlockBinding - && glUniform1i - && glUniform1f - && glUniform2f - && glUniform4f - ; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/renderer/GLExtensions.h b/apps/LoopThroughWithOpenGLCompositing/gl/renderer/GLExtensions.h deleted file mode 100644 index 0115f7d..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/renderer/GLExtensions.h +++ /dev/null @@ -1,201 +0,0 @@ -/* -LICENSE-START- - ** Copyright (c) 2012 Blackmagic Design - ** - ** Permission is hereby granted, free of charge, to any person or organization - ** obtaining a copy of the software and accompanying documentation (the - ** "Software") to use, reproduce, display, distribute, sub-license, 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, in - ** accordance with: - ** - ** (1) if the Software is obtained from Blackmagic Design, the End User License - ** Agreement for the Software Development Kit ("EULA") available at - ** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or - ** - ** (2) if the Software is obtained from any third party, such licensing terms - ** as notified by that third party, - ** - ** and all subject to the following: - ** - ** (3) 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. - ** - ** (4) 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. - ** - ** A copy of the Software is available free of charge at - ** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. - ** - ** -LICENSE-END- - */ -// -// GLExtensions.h -// LoopThroughWithOpenGLCompositing -// - -#ifndef __GLEXTENSIONS_H__ -#define __GLEXTENSIONS_H__ - -#include -#include - -#ifndef APIENTRYP -#define APIENTRYP APIENTRY * -#endif - -#define GL_BGRA 0x80E1 -#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 -#define GL_STREAM_DRAW 0x88E0 -#define GL_STREAM_READ 0x88E1 -#define GL_STREAM_COPY 0x88E2 -#define GL_DYNAMIC_DRAW 0x88E8 -#define GL_UNIFORM_BUFFER 0x8A11 -#define GL_RGBA8 0x8058 -#define GL_RGBA16F 0x881A -#define GL_TEXTURE0 0x84C0 -#define GL_ACTIVE_TEXTURE 0x84E0 -#define GL_ARRAY_BUFFER 0x8892 -#define GL_PIXEL_PACK_BUFFER 0x88EB -#define GL_PIXEL_UNPACK_BUFFER 0x88EC -#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF -#define GL_FRAGMENT_SHADER 0x8B30 -#define GL_VERTEX_SHADER 0x8B31 -#define GL_COMPILE_STATUS 0x8B81 -#define GL_LINK_STATUS 0x8B82 -#define GL_INVALID_INDEX 0xFFFFFFFFu -#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 -#define GL_RENDERBUFFER_EXT 0x8D41 -#define GL_FRAMEBUFFER_EXT 0x8D40 -#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 -#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 -#define GL_READ_FRAMEBUFFER 0x8CA8 -#define GL_DRAW_FRAMEBUFFER 0x8CA9 -#define GL_RENDERBUFFER 0x8D41 -#define GL_FRAMEBUFFER 0x8D40 -#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 -#define GL_COLOR_ATTACHMENT0 0x8CE0 -#define GL_DEPTH_COMPONENT24 0x81A6 -#define GL_CLAMP_TO_EDGE 0x812F -#define GL_DEPTH_ATTACHMENT_EXT 0x8D00 -#define GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD 0x9160 -#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 -#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 -#define GL_ALREADY_SIGNALED 0x911A -#define GL_TIMEOUT_EXPIRED 0x911B -#define GL_CONDITION_SATISFIED 0x911C -#define GL_WAIT_FAILED 0x911D -#define GL_READ_ONLY 0x88B8 - -typedef struct __GLsync *GLsync; -typedef unsigned __int64 GLuint64; -typedef ptrdiff_t GLintptr; -typedef ptrdiff_t GLsizeiptr; -typedef char GLchar; - -typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); -typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); -typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); -typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); -typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); -typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target); -typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); -typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader); -typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void); -typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type); -typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader); -typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); -typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length); -typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); -typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0); -typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); -typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar* uniformBlockName); -typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); -typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer); -typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data); -typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array); -typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint* arrays); -typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint* arrays); -typedef GLsync (APIENTRYP PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags); -typedef void (APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync); -typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers); -typedef void (APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers); -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer); -typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers); -typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); -typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); - -extern PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers; -extern PFNGLGENRENDERBUFFERSPROC glGenRenderbuffers; -extern PFNGLBINDRENDERBUFFERPROC glBindRenderbuffer; -extern PFNGLRENDERBUFFERSTORAGEPROC glRenderbufferStorage; -extern PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers; -extern PFNGLDELETERENDERBUFFERSPROC glDeleteRenderbuffers; -extern PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer; -extern PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D; -extern PFNGLFRAMEBUFFERRENDERBUFFERPROC glFramebufferRenderbuffer; -extern PFNGLCHECKFRAMEBUFFERSTATUSPROC glCheckFramebufferStatus; -extern PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer; -extern PFNGLFENCESYNCPROC glFenceSync; -extern PFNGLCLIENTWAITSYNCPROC glClientWaitSync; -extern PFNGLDELETESYNCPROC glDeleteSync; -extern PFNGLGENBUFFERSPROC glGenBuffers; -extern PFNGLDELETEBUFFERSPROC glDeleteBuffers; -extern PFNGLBINDBUFFERPROC glBindBuffer; -extern PFNGLBUFFERDATAPROC glBufferData; -extern PFNGLMAPBUFFERPROC glMapBuffer; -extern PFNGLUNMAPBUFFERPROC glUnmapBuffer; -extern PFNGLBUFFERSUBDATAPROC glBufferSubData; -extern PFNGLBINDBUFFERBASEPROC glBindBufferBase; -extern PFNGLACTIVETEXTUREPROC glActiveTexture; -extern PFNGLGENVERTEXARRAYSPROC glGenVertexArrays; -extern PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays; -extern PFNGLBINDVERTEXARRAYPROC glBindVertexArray; -extern PFNGLCREATESHADERPROC glCreateShader; -extern PFNGLDELETESHADERPROC glDeleteShader; -extern PFNGLDELETEPROGRAMPROC glDeleteProgram; -extern PFNGLSHADERSOURCEPROC glShaderSource; -extern PFNGLCOMPILESHADERPROC glCompileShader; -extern PFNGLGETSHADERIVPROC glGetShaderiv; -extern PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog; -extern PFNGLCREATEPROGRAMPROC glCreateProgram; -extern PFNGLATTACHSHADERPROC glAttachShader; -extern PFNGLLINKPROGRAMPROC glLinkProgram; -extern PFNGLGETPROGRAMIVPROC glGetProgramiv; -extern PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog; -extern PFNGLUSEPROGRAMPROC glUseProgram; -extern PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation; -extern PFNGLGETUNIFORMBLOCKINDEXPROC glGetUniformBlockIndex; -extern PFNGLUNIFORMBLOCKBINDINGPROC glUniformBlockBinding; -extern PFNGLUNIFORM1IPROC glUniform1i; -extern PFNGLUNIFORM1FPROC glUniform1f; -extern PFNGLUNIFORM2FPROC glUniform2f; -extern PFNGLUNIFORM4FPROC glUniform4f; - -bool ResolveGLExtensions(); - -#endif // __GLEXTENSIONS_H__ - diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/renderer/GlRenderConstants.h b/apps/LoopThroughWithOpenGLCompositing/gl/renderer/GlRenderConstants.h deleted file mode 100644 index 35c1cb7..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/renderer/GlRenderConstants.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#include - -constexpr GLuint kLayerInputTextureUnit = 0; -constexpr GLuint kDecodedVideoTextureUnit = 1; -constexpr GLuint kSourceHistoryTextureUnitBase = 2; -constexpr GLuint kPackedVideoTextureUnit = 2; -constexpr GLuint kGlobalParamsBindingPoint = 0; diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/renderer/GlScopedObjects.h b/apps/LoopThroughWithOpenGLCompositing/gl/renderer/GlScopedObjects.h deleted file mode 100644 index 420e345..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/renderer/GlScopedObjects.h +++ /dev/null @@ -1,57 +0,0 @@ -#pragma once - -#include - -class ScopedGlShader -{ -public: - explicit ScopedGlShader(GLuint shader = 0) : mShader(shader) {} - ~ScopedGlShader() { reset(); } - - ScopedGlShader(const ScopedGlShader&) = delete; - ScopedGlShader& operator=(const ScopedGlShader&) = delete; - - GLuint get() const { return mShader; } - GLuint release() - { - GLuint shader = mShader; - mShader = 0; - return shader; - } - void reset(GLuint shader = 0) - { - if (mShader != 0) - glDeleteShader(mShader); - mShader = shader; - } - -private: - GLuint mShader; -}; - -class ScopedGlProgram -{ -public: - explicit ScopedGlProgram(GLuint program = 0) : mProgram(program) {} - ~ScopedGlProgram() { reset(); } - - ScopedGlProgram(const ScopedGlProgram&) = delete; - ScopedGlProgram& operator=(const ScopedGlProgram&) = delete; - - GLuint get() const { return mProgram; } - GLuint release() - { - GLuint program = mProgram; - mProgram = 0; - return program; - } - void reset(GLuint program = 0) - { - if (mProgram != 0) - glDeleteProgram(mProgram); - mProgram = program; - } - -private: - GLuint mProgram; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/renderer/OpenGLRenderer.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/renderer/OpenGLRenderer.cpp deleted file mode 100644 index b8e644d..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/renderer/OpenGLRenderer.cpp +++ /dev/null @@ -1,268 +0,0 @@ -#include "OpenGLRenderer.h" - -#include "GlRenderConstants.h" - -namespace -{ - void ConfigureByteFrameTexture(unsigned width, unsigned height) - { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); - } -} - -bool OpenGLRenderer::InitializeResources(unsigned inputFrameWidth, unsigned inputFrameHeight, unsigned captureTextureWidth, unsigned outputFrameWidth, unsigned outputFrameHeight, unsigned outputPackTextureWidth, std::string& error) -{ - glClearColor(0.0f, 0.0f, 0.0f, 0.5f); - glDisable(GL_DEPTH_TEST); - - glGenBuffers(1, &mTextureUploadBuffer); - - glGenTextures(1, &mCaptureTexture); - glBindTexture(GL_TEXTURE_2D, mCaptureTexture); - ConfigureByteFrameTexture(captureTextureWidth, inputFrameHeight); - glBindTexture(GL_TEXTURE_2D, 0); - - glGenRenderbuffers(1, &mIdColorBuf); - glGenRenderbuffers(1, &mIdDepthBuf); - glGenVertexArrays(1, &mFullscreenVAO); - glGenBuffers(1, &mGlobalParamsUBO); - - if (!mRenderTargets.Create(RenderTargetId::Decoded, inputFrameWidth, inputFrameHeight, GL_RGBA16F, GL_RGBA, GL_FLOAT, "decode", error)) - return false; - if (!mRenderTargets.Create(RenderTargetId::LayerTemp, inputFrameWidth, inputFrameHeight, GL_RGBA16F, GL_RGBA, GL_FLOAT, "layer", error)) - return false; - if (!mRenderTargets.Create(RenderTargetId::Composite, inputFrameWidth, inputFrameHeight, GL_RGBA16F, GL_RGBA, GL_FLOAT, "composite", error)) - return false; - - glBindFramebuffer(GL_FRAMEBUFFER, CompositeFramebuffer()); - glBindRenderbuffer(GL_RENDERBUFFER, mIdDepthBuf); - glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, inputFrameWidth, inputFrameHeight); - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER, mIdDepthBuf); - if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) - { - error = "Cannot initialize framebuffer."; - return false; - } - - if (!mRenderTargets.Create(RenderTargetId::Output, outputFrameWidth, outputFrameHeight, GL_RGBA16F, GL_RGBA, GL_FLOAT, "output", error)) - return false; - if (!mRenderTargets.Create(RenderTargetId::OutputPack, outputPackTextureWidth, outputFrameHeight, GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, "output pack", error)) - return false; - - glBindTexture(GL_TEXTURE_2D, 0); - glBindRenderbuffer(GL_RENDERBUFFER, 0); - glBindFramebuffer(GL_FRAMEBUFFER, 0); - glBindVertexArray(mFullscreenVAO); - glBindVertexArray(0); - glBindBuffer(GL_UNIFORM_BUFFER, mGlobalParamsUBO); - glBufferData(GL_UNIFORM_BUFFER, 1024, NULL, GL_DYNAMIC_DRAW); - glBindBufferBase(GL_UNIFORM_BUFFER, kGlobalParamsBindingPoint, mGlobalParamsUBO); - glBindBuffer(GL_UNIFORM_BUFFER, 0); - - mResourcesInitialized = true; - return true; -} - -void OpenGLRenderer::SetDecodeShaderProgram(GLuint program, GLuint vertexShader, GLuint fragmentShader) -{ - mDecodeProgram = program; - mDecodeVertexShader = vertexShader; - mDecodeFragmentShader = fragmentShader; - mDecodePackedResolutionLocation = program != 0 ? glGetUniformLocation(program, "uPackedVideoResolution") : -1; - mDecodeDecodedResolutionLocation = program != 0 ? glGetUniformLocation(program, "uDecodedVideoResolution") : -1; - mDecodeInputPixelFormatLocation = program != 0 ? glGetUniformLocation(program, "uInputPixelFormat") : -1; -} - -void OpenGLRenderer::SetOutputPackShaderProgram(GLuint program, GLuint vertexShader, GLuint fragmentShader) -{ - mOutputPackProgram = program; - mOutputPackVertexShader = vertexShader; - mOutputPackFragmentShader = fragmentShader; - mOutputPackResolutionLocation = program != 0 ? glGetUniformLocation(program, "uOutputVideoResolution") : -1; - mOutputPackActiveWordsLocation = program != 0 ? glGetUniformLocation(program, "uActiveV210Words") : -1; - mOutputPackFormatLocation = program != 0 ? glGetUniformLocation(program, "uOutputPackFormat") : -1; -} - -bool OpenGLRenderer::ReserveTemporaryRenderTargets(std::size_t count, unsigned width, unsigned height, std::string& error) -{ - return mRenderTargets.ReserveTemporaryTargets(count, width, height, GL_RGBA16F, GL_RGBA, GL_FLOAT, error); -} - -void OpenGLRenderer::ResizeView(int width, int height) -{ - mViewWidth = width; - mViewHeight = height; -} - -void OpenGLRenderer::PresentToWindow(HDC hdc, unsigned outputFrameWidth, unsigned outputFrameHeight) -{ - int destWidth = mViewWidth; - int destHeight = mViewHeight; - int destX = 0; - int destY = 0; - - if (outputFrameWidth > 0 && outputFrameHeight > 0 && mViewWidth > 0 && mViewHeight > 0) - { - const double frameAspect = static_cast(outputFrameWidth) / static_cast(outputFrameHeight); - const double viewAspect = static_cast(mViewWidth) / static_cast(mViewHeight); - - if (viewAspect > frameAspect) - { - destHeight = mViewHeight; - destWidth = static_cast(destHeight * frameAspect + 0.5); - destX = (mViewWidth - destWidth) / 2; - } - else - { - destWidth = mViewWidth; - destHeight = static_cast(destWidth / frameAspect + 0.5); - destY = (mViewHeight - destHeight) / 2; - } - } - - glBindFramebuffer(GL_READ_FRAMEBUFFER, OutputFramebuffer()); - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); - glDisable(GL_SCISSOR_TEST); - glViewport(0, 0, mViewWidth, mViewHeight); - glClearColor(0.0f, 0.0f, 0.0f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT); - glBlitFramebuffer(0, 0, outputFrameWidth, outputFrameHeight, destX, destY, destX + destWidth, destY + destHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR); - - SwapBuffers(hdc); -} - -void OpenGLRenderer::DestroyResources() -{ - if (mFullscreenVAO != 0) - glDeleteVertexArrays(1, &mFullscreenVAO); - if (mGlobalParamsUBO != 0) - glDeleteBuffers(1, &mGlobalParamsUBO); - if (mIdColorBuf != 0) - glDeleteRenderbuffers(1, &mIdColorBuf); - if (mIdDepthBuf != 0) - glDeleteRenderbuffers(1, &mIdDepthBuf); - if (mCaptureTexture != 0) - glDeleteTextures(1, &mCaptureTexture); - if (mTextureUploadBuffer != 0) - glDeleteBuffers(1, &mTextureUploadBuffer); - mRenderTargets.Destroy(); - - mFullscreenVAO = 0; - mGlobalParamsUBO = 0; - mIdColorBuf = 0; - mIdDepthBuf = 0; - mCaptureTexture = 0; - mTextureUploadBuffer = 0; - mGlobalParamsUBOSize = 0; - mResourcesInitialized = false; - - mTemporalHistory.DestroyResources(); - mFeedbackBuffers.DestroyResources(); - DestroyLayerPrograms(); - DestroyDecodeShaderProgram(); - DestroyOutputPackShaderProgram(); -} - -void OpenGLRenderer::DestroySingleLayerProgram(LayerProgram& layerProgram) -{ - for (LayerProgram::PassProgram& passProgram : layerProgram.passes) - { - for (LayerProgram::TextureBinding& binding : passProgram.textureBindings) - { - if (binding.texture != 0) - { - glDeleteTextures(1, &binding.texture); - binding.texture = 0; - } - } - passProgram.textureBindings.clear(); - - for (LayerProgram::TextBinding& binding : passProgram.textBindings) - { - if (binding.texture != 0) - { - glDeleteTextures(1, &binding.texture); - binding.texture = 0; - } - } - passProgram.textBindings.clear(); - - if (passProgram.program != 0) - { - glDeleteProgram(passProgram.program); - passProgram.program = 0; - } - - if (passProgram.fragmentShader != 0) - { - glDeleteShader(passProgram.fragmentShader); - passProgram.fragmentShader = 0; - } - - if (passProgram.vertexShader != 0) - { - glDeleteShader(passProgram.vertexShader); - passProgram.vertexShader = 0; - } - } - layerProgram.passes.clear(); -} - -void OpenGLRenderer::DestroyLayerPrograms() -{ - for (LayerProgram& layerProgram : mLayerPrograms) - DestroySingleLayerProgram(layerProgram); - mLayerPrograms.clear(); -} - -void OpenGLRenderer::DestroyDecodeShaderProgram() -{ - if (mDecodeProgram != 0) - { - glDeleteProgram(mDecodeProgram); - mDecodeProgram = 0; - } - mDecodePackedResolutionLocation = -1; - mDecodeDecodedResolutionLocation = -1; - mDecodeInputPixelFormatLocation = -1; - - if (mDecodeFragmentShader != 0) - { - glDeleteShader(mDecodeFragmentShader); - mDecodeFragmentShader = 0; - } - - if (mDecodeVertexShader != 0) - { - glDeleteShader(mDecodeVertexShader); - mDecodeVertexShader = 0; - } -} - -void OpenGLRenderer::DestroyOutputPackShaderProgram() -{ - if (mOutputPackProgram != 0) - { - glDeleteProgram(mOutputPackProgram); - mOutputPackProgram = 0; - } - mOutputPackResolutionLocation = -1; - mOutputPackActiveWordsLocation = -1; - mOutputPackFormatLocation = -1; - - if (mOutputPackFragmentShader != 0) - { - glDeleteShader(mOutputPackFragmentShader); - mOutputPackFragmentShader = 0; - } - - if (mOutputPackVertexShader != 0) - { - glDeleteShader(mOutputPackVertexShader); - mOutputPackVertexShader = 0; - } -} diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/renderer/OpenGLRenderer.h b/apps/LoopThroughWithOpenGLCompositing/gl/renderer/OpenGLRenderer.h deleted file mode 100644 index 8773022..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/renderer/OpenGLRenderer.h +++ /dev/null @@ -1,131 +0,0 @@ -#pragma once - -#include "GLExtensions.h" -#include "RenderTargetPool.h" -#include "ShaderFeedbackBuffers.h" -#include "ShaderTypes.h" -#include "TemporalHistoryBuffers.h" - -#include - -#include -#include -#include -#include - -class OpenGLRenderer -{ -public: - struct LayerProgram - { - struct TextureBinding - { - std::string samplerName; - std::filesystem::path sourcePath; - GLuint texture = 0; - }; - - struct TextBinding - { - std::string parameterId; - std::string samplerName; - std::string fontId; - GLuint texture = 0; - std::string renderedText; - unsigned renderedWidth = 0; - unsigned renderedHeight = 0; - }; - - std::string layerId; - std::string shaderId; - - struct PassProgram - { - std::string passId; - std::vector inputNames; - std::string outputName; - GLuint shaderTextureBase = 0; - GLuint program = 0; - GLuint vertexShader = 0; - GLuint fragmentShader = 0; - std::vector textureBindings; - std::vector textBindings; - }; - - std::vector passes; - }; - - GLuint CaptureTexture() const { return mCaptureTexture; } - GLuint DecodedTexture() const { return mRenderTargets.Texture(RenderTargetId::Decoded); } - GLuint LayerTempTexture() const { return mRenderTargets.Texture(RenderTargetId::LayerTemp); } - GLuint CompositeTexture() const { return mRenderTargets.Texture(RenderTargetId::Composite); } - GLuint OutputTexture() const { return mRenderTargets.Texture(RenderTargetId::Output); } - GLuint OutputPackTexture() const { return mRenderTargets.Texture(RenderTargetId::OutputPack); } - GLuint TextureUploadBuffer() const { return mTextureUploadBuffer; } - GLuint DecodeFramebuffer() const { return mRenderTargets.Framebuffer(RenderTargetId::Decoded); } - GLuint LayerTempFramebuffer() const { return mRenderTargets.Framebuffer(RenderTargetId::LayerTemp); } - GLuint CompositeFramebuffer() const { return mRenderTargets.Framebuffer(RenderTargetId::Composite); } - GLuint OutputFramebuffer() const { return mRenderTargets.Framebuffer(RenderTargetId::Output); } - GLuint OutputPackFramebuffer() const { return mRenderTargets.Framebuffer(RenderTargetId::OutputPack); } - GLuint FullscreenVertexArray() const { return mFullscreenVAO; } - GLuint GlobalParamsUBO() const { return mGlobalParamsUBO; } - GLuint DecodeProgram() const { return mDecodeProgram; } - GLuint OutputPackProgram() const { return mOutputPackProgram; } - GLint DecodePackedResolutionLocation() const { return mDecodePackedResolutionLocation; } - GLint DecodeDecodedResolutionLocation() const { return mDecodeDecodedResolutionLocation; } - GLint DecodeInputPixelFormatLocation() const { return mDecodeInputPixelFormatLocation; } - GLint OutputPackResolutionLocation() const { return mOutputPackResolutionLocation; } - GLint OutputPackActiveWordsLocation() const { return mOutputPackActiveWordsLocation; } - GLint OutputPackFormatLocation() const { return mOutputPackFormatLocation; } - GLsizeiptr GlobalParamsUBOSize() const { return mGlobalParamsUBOSize; } - void SetGlobalParamsUBOSize(GLsizeiptr size) { mGlobalParamsUBOSize = size; } - bool ResourcesInitialized() const { return mResourcesInitialized; } - void ReplaceLayerPrograms(std::vector& newPrograms) { mLayerPrograms.swap(newPrograms); } - std::vector& LayerPrograms() { return mLayerPrograms; } - const std::vector& LayerPrograms() const { return mLayerPrograms; } - bool ReserveTemporaryRenderTargets(std::size_t count, unsigned width, unsigned height, std::string& error); - const RenderTarget& TemporaryRenderTarget(std::size_t index) const { return mRenderTargets.TemporaryTarget(index); } - std::size_t TemporaryRenderTargetCount() const { return mRenderTargets.TemporaryTargetCount(); } - TemporalHistoryBuffers& TemporalHistory() { return mTemporalHistory; } - const TemporalHistoryBuffers& TemporalHistory() const { return mTemporalHistory; } - ShaderFeedbackBuffers& FeedbackBuffers() { return mFeedbackBuffers; } - const ShaderFeedbackBuffers& FeedbackBuffers() const { return mFeedbackBuffers; } - void SetDecodeShaderProgram(GLuint program, GLuint vertexShader, GLuint fragmentShader); - void SetOutputPackShaderProgram(GLuint program, GLuint vertexShader, GLuint fragmentShader); - bool InitializeResources(unsigned inputFrameWidth, unsigned inputFrameHeight, unsigned captureTextureWidth, unsigned outputFrameWidth, unsigned outputFrameHeight, unsigned outputPackTextureWidth, std::string& error); - void ResizeView(int width, int height); - void PresentToWindow(HDC hdc, unsigned outputFrameWidth, unsigned outputFrameHeight); - void DestroyResources(); - void DestroySingleLayerProgram(LayerProgram& layerProgram); - void DestroyLayerPrograms(); - void DestroyDecodeShaderProgram(); - void DestroyOutputPackShaderProgram(); - -private: - GLuint mCaptureTexture = 0; - GLuint mTextureUploadBuffer = 0; - GLuint mIdColorBuf = 0; - GLuint mIdDepthBuf = 0; - GLuint mFullscreenVAO = 0; - GLuint mGlobalParamsUBO = 0; - GLuint mDecodeProgram = 0; - GLuint mDecodeVertexShader = 0; - GLuint mDecodeFragmentShader = 0; - GLint mDecodePackedResolutionLocation = -1; - GLint mDecodeDecodedResolutionLocation = -1; - GLint mDecodeInputPixelFormatLocation = -1; - GLuint mOutputPackProgram = 0; - GLuint mOutputPackVertexShader = 0; - GLuint mOutputPackFragmentShader = 0; - GLint mOutputPackResolutionLocation = -1; - GLint mOutputPackActiveWordsLocation = -1; - GLint mOutputPackFormatLocation = -1; - GLsizeiptr mGlobalParamsUBOSize = 0; - bool mResourcesInitialized = false; - int mViewWidth = 0; - int mViewHeight = 0; - std::vector mLayerPrograms; - RenderTargetPool mRenderTargets; - TemporalHistoryBuffers mTemporalHistory; - ShaderFeedbackBuffers mFeedbackBuffers; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/renderer/RenderTargetPool.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/renderer/RenderTargetPool.cpp deleted file mode 100644 index bbc3cea..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/renderer/RenderTargetPool.cpp +++ /dev/null @@ -1,136 +0,0 @@ -#include "RenderTargetPool.h" - -#include - -namespace -{ - void ConfigureRenderTargetTexture( - unsigned width, - unsigned height, - GLenum internalFormat, - GLenum pixelFormat, - GLenum pixelType) - { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, pixelFormat, pixelType, NULL); - } -} - -bool RenderTargetPool::Create( - RenderTargetId id, - unsigned width, - unsigned height, - GLenum internalFormat, - GLenum pixelFormat, - GLenum pixelType, - const char* errorPrefix, - std::string& error) -{ - RenderTarget& target = mTargets[TargetIndex(id)]; - if (target.texture != 0 || target.framebuffer != 0) - { - error = std::string(errorPrefix) + " render target was already initialized."; - return false; - } - - glGenTextures(1, &target.texture); - glBindTexture(GL_TEXTURE_2D, target.texture); - ConfigureRenderTargetTexture(width, height, internalFormat, pixelFormat, pixelType); - glBindTexture(GL_TEXTURE_2D, 0); - - glGenFramebuffers(1, &target.framebuffer); - glBindFramebuffer(GL_FRAMEBUFFER, target.framebuffer); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, target.texture, 0); - if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) - { - error = std::string("Cannot initialize ") + errorPrefix + " framebuffer."; - glBindFramebuffer(GL_FRAMEBUFFER, 0); - return false; - } - - glBindFramebuffer(GL_FRAMEBUFFER, 0); - target.width = width; - target.height = height; - target.internalFormat = internalFormat; - target.pixelFormat = pixelFormat; - target.pixelType = pixelType; - return true; -} - -bool RenderTargetPool::ReserveTemporaryTargets( - std::size_t count, - unsigned width, - unsigned height, - GLenum internalFormat, - GLenum pixelFormat, - GLenum pixelType, - std::string& error) -{ - if (mTemporaryTargets.size() == count) - return true; - - DestroyTemporaryTargets(); - - mTemporaryTargets.resize(count); - for (std::size_t index = 0; index < mTemporaryTargets.size(); ++index) - { - RenderTarget& target = mTemporaryTargets[index]; - glGenTextures(1, &target.texture); - glBindTexture(GL_TEXTURE_2D, target.texture); - ConfigureRenderTargetTexture(width, height, internalFormat, pixelFormat, pixelType); - glBindTexture(GL_TEXTURE_2D, 0); - - glGenFramebuffers(1, &target.framebuffer); - glBindFramebuffer(GL_FRAMEBUFFER, target.framebuffer); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, target.texture, 0); - if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) - { - error = "Cannot initialize temporary render target."; - glBindFramebuffer(GL_FRAMEBUFFER, 0); - return false; - } - - target.width = width; - target.height = height; - target.internalFormat = internalFormat; - target.pixelFormat = pixelFormat; - target.pixelType = pixelType; - } - - glBindFramebuffer(GL_FRAMEBUFFER, 0); - return true; -} - -void RenderTargetPool::DestroyTemporaryTargets() -{ - for (RenderTarget& target : mTemporaryTargets) - { - if (target.framebuffer != 0) - glDeleteFramebuffers(1, &target.framebuffer); - if (target.texture != 0) - glDeleteTextures(1, &target.texture); - } - mTemporaryTargets.clear(); -} - -void RenderTargetPool::Destroy() -{ - for (RenderTarget& target : mTargets) - { - if (target.framebuffer != 0) - glDeleteFramebuffers(1, &target.framebuffer); - if (target.texture != 0) - glDeleteTextures(1, &target.texture); - target = RenderTarget(); - } - - DestroyTemporaryTargets(); -} - -const RenderTarget& RenderTargetPool::Target(RenderTargetId id) const -{ - return mTargets[TargetIndex(id)]; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/renderer/RenderTargetPool.h b/apps/LoopThroughWithOpenGLCompositing/gl/renderer/RenderTargetPool.h deleted file mode 100644 index ef85d3c..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/renderer/RenderTargetPool.h +++ /dev/null @@ -1,64 +0,0 @@ -#pragma once - -#include "GLExtensions.h" - -#include -#include -#include - -enum class RenderTargetId -{ - Decoded, - LayerTemp, - Composite, - Output, - OutputPack, - Count -}; - -struct RenderTarget -{ - GLuint texture = 0; - GLuint framebuffer = 0; - unsigned width = 0; - unsigned height = 0; - GLenum internalFormat = GL_RGBA8; - GLenum pixelFormat = GL_RGBA; - GLenum pixelType = GL_UNSIGNED_BYTE; -}; - -class RenderTargetPool -{ -public: - bool Create( - RenderTargetId id, - unsigned width, - unsigned height, - GLenum internalFormat, - GLenum pixelFormat, - GLenum pixelType, - const char* errorPrefix, - std::string& error); - bool ReserveTemporaryTargets( - std::size_t count, - unsigned width, - unsigned height, - GLenum internalFormat, - GLenum pixelFormat, - GLenum pixelType, - std::string& error); - void DestroyTemporaryTargets(); - void Destroy(); - - GLuint Texture(RenderTargetId id) const { return Target(id).texture; } - GLuint Framebuffer(RenderTargetId id) const { return Target(id).framebuffer; } - const RenderTarget& Target(RenderTargetId id) const; - const RenderTarget& TemporaryTarget(std::size_t index) const { return mTemporaryTargets[index]; } - std::size_t TemporaryTargetCount() const { return mTemporaryTargets.size(); } - -private: - static std::size_t TargetIndex(RenderTargetId id) { return static_cast(id); } - - std::array(RenderTargetId::Count)> mTargets; - std::vector mTemporaryTargets; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/shader/GlShaderSources.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/shader/GlShaderSources.cpp deleted file mode 100644 index 83d39e6..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/shader/GlShaderSources.cpp +++ /dev/null @@ -1,172 +0,0 @@ -#include "GlShaderSources.h" - -const char* kFullscreenTriangleVertexShaderSource = - "#version 430 core\n" - "out vec2 vTexCoord;\n" - "void main()\n" - "{\n" - " vec2 positions[3] = vec2[3](vec2(-1.0, -1.0), vec2(3.0, -1.0), vec2(-1.0, 3.0));\n" - " vec2 texCoords[3] = vec2[3](vec2(0.0, 0.0), vec2(2.0, 0.0), vec2(0.0, 2.0));\n" - " gl_Position = vec4(positions[gl_VertexID], 0.0, 1.0);\n" - " vTexCoord = texCoords[gl_VertexID];\n" - "}\n"; - -const char* kDecodeFragmentShaderSource = - "#version 430 core\n" - "layout(binding = 2) uniform sampler2D uPackedVideoInput;\n" - "uniform vec2 uPackedVideoResolution;\n" - "uniform vec2 uDecodedVideoResolution;\n" - "uniform int uInputPixelFormat;\n" - "in vec2 vTexCoord;\n" - "layout(location = 0) out vec4 fragColor;\n" - "vec4 rec709YCbCr2rgba(float Y, float Cb, float Cr, float a)\n" - "{\n" - " Y = (Y * 256.0 - 16.0) / 219.0;\n" - " Cb = (Cb * 256.0 - 16.0) / 224.0 - 0.5;\n" - " Cr = (Cr * 256.0 - 16.0) / 224.0 - 0.5;\n" - " return vec4(Y + 1.5748 * Cr, Y - 0.1873 * Cb - 0.4681 * Cr, Y + 1.8556 * Cb, a);\n" - "}\n" - "vec4 rec709YCbCr10_2rgba(float Y, float Cb, float Cr, float a)\n" - "{\n" - " Y = (Y - 64.0) / 876.0;\n" - " Cb = (Cb - 64.0) / 896.0 - 0.5;\n" - " Cr = (Cr - 64.0) / 896.0 - 0.5;\n" - " return vec4(Y + 1.5748 * Cr, Y - 0.1873 * Cb - 0.4681 * Cr, Y + 1.8556 * Cb, a);\n" - "}\n" - "uint loadV210Word(ivec2 coord)\n" - "{\n" - " vec4 b = round(texelFetch(uPackedVideoInput, coord, 0) * 255.0);\n" - " return uint(b.r) | (uint(b.g) << 8) | (uint(b.b) << 16) | (uint(b.a) << 24);\n" - "}\n" - "float v210Component(uint word, int index)\n" - "{\n" - " return float((word >> uint(index * 10)) & 1023u);\n" - "}\n" - "vec4 decodeUyvy8(ivec2 outputCoord, ivec2 packedSize)\n" - "{\n" - " ivec2 packedCoord = ivec2(clamp(outputCoord.x / 2, 0, packedSize.x - 1), clamp(outputCoord.y, 0, packedSize.y - 1));\n" - " vec4 macroPixel = texelFetch(uPackedVideoInput, packedCoord, 0);\n" - " float ySample = (outputCoord.x & 1) != 0 ? macroPixel.a : macroPixel.g;\n" - " return rec709YCbCr2rgba(ySample, macroPixel.b, macroPixel.r, 1.0);\n" - "}\n" - "vec4 decodeV210(ivec2 outputCoord, ivec2 packedSize)\n" - "{\n" - " int group = outputCoord.x / 6;\n" - " int pixel = outputCoord.x - group * 6;\n" - " int wordBase = group * 4;\n" - " ivec2 rowBase = ivec2(wordBase, clamp(outputCoord.y, 0, packedSize.y - 1));\n" - " uint w0 = loadV210Word(ivec2(min(rowBase.x + 0, packedSize.x - 1), rowBase.y));\n" - " uint w1 = loadV210Word(ivec2(min(rowBase.x + 1, packedSize.x - 1), rowBase.y));\n" - " uint w2 = loadV210Word(ivec2(min(rowBase.x + 2, packedSize.x - 1), rowBase.y));\n" - " uint w3 = loadV210Word(ivec2(min(rowBase.x + 3, packedSize.x - 1), rowBase.y));\n" - " float y0 = v210Component(w0, 1);\n" - " float y1 = v210Component(w1, 0);\n" - " float y2 = v210Component(w1, 2);\n" - " float y3 = v210Component(w2, 1);\n" - " float y4 = v210Component(w3, 0);\n" - " float y5 = v210Component(w3, 2);\n" - " float cb0 = v210Component(w0, 0);\n" - " float cr0 = v210Component(w0, 2);\n" - " float cb2 = v210Component(w1, 1);\n" - " float cr2 = v210Component(w2, 0);\n" - " float cb4 = v210Component(w2, 2);\n" - " float cr4 = v210Component(w3, 1);\n" - " float ySample = pixel == 0 ? y0 : pixel == 1 ? y1 : pixel == 2 ? y2 : pixel == 3 ? y3 : pixel == 4 ? y4 : y5;\n" - " float cbSample = pixel < 2 ? cb0 : pixel < 4 ? cb2 : cb4;\n" - " float crSample = pixel < 2 ? cr0 : pixel < 4 ? cr2 : cr4;\n" - " return rec709YCbCr10_2rgba(ySample, cbSample, crSample, 1.0);\n" - "}\n" - "void main()\n" - "{\n" - " vec2 correctedUv = vec2(vTexCoord.x, 1.0 - vTexCoord.y);\n" - " ivec2 decodedSize = ivec2(max(uDecodedVideoResolution, vec2(1.0, 1.0)));\n" - " ivec2 outputCoord = clamp(ivec2(correctedUv * vec2(decodedSize)), ivec2(0, 0), decodedSize - ivec2(1, 1));\n" - " ivec2 packedSize = ivec2(max(uPackedVideoResolution, vec2(1.0, 1.0)));\n" - " fragColor = uInputPixelFormat == 1 ? decodeV210(outputCoord, packedSize) : decodeUyvy8(outputCoord, packedSize);\n" - "}\n"; - -const char* kOutputPackFragmentShaderSource = - "#version 430 core\n" - "layout(binding = 0) uniform sampler2D uOutputRgb;\n" - "uniform vec2 uOutputVideoResolution;\n" - "uniform float uActiveV210Words;\n" - "uniform int uOutputPackFormat;\n" - "in vec2 vTexCoord;\n" - "layout(location = 0) out vec4 fragColor;\n" - "vec4 rgbaAt(int x, int y)\n" - "{\n" - " ivec2 size = ivec2(max(uOutputVideoResolution, vec2(1.0, 1.0)));\n" - " return clamp(texelFetch(uOutputRgb, ivec2(clamp(x, 0, size.x - 1), clamp(y, 0, size.y - 1)), 0), vec4(0.0), vec4(1.0));\n" - "}\n" - "vec3 rgbAt(int x, int y)\n" - "{\n" - " return rgbaAt(x, y).rgb;\n" - "}\n" - "vec3 rgbToLegalYcbcr10(vec3 rgb)\n" - "{\n" - " float y = dot(rgb, vec3(0.2126, 0.7152, 0.0722));\n" - " float cb = (rgb.b - y) / 1.8556 + 0.5;\n" - " float cr = (rgb.r - y) / 1.5748 + 0.5;\n" - " return vec3(clamp(round(64.0 + y * 876.0), 64.0, 940.0), clamp(round(64.0 + cb * 896.0), 64.0, 960.0), clamp(round(64.0 + cr * 896.0), 64.0, 960.0));\n" - "}\n" - "uint makeWord(float a, float b, float c)\n" - "{\n" - " return (uint(a) & 1023u) | ((uint(b) & 1023u) << 10) | ((uint(c) & 1023u) << 20);\n" - "}\n" - "vec4 wordToBytes(uint word)\n" - "{\n" - " return vec4(float(word & 255u), float((word >> 8) & 255u), float((word >> 16) & 255u), float((word >> 24) & 255u)) / 255.0;\n" - "}\n" - "vec4 bigEndianWordToBytes(uint word)\n" - "{\n" - " return vec4(float((word >> 24) & 255u), float((word >> 16) & 255u), float((word >> 8) & 255u), float(word & 255u)) / 255.0;\n" - "}\n" - "vec4 packAy10Word(ivec2 outCoord)\n" - "{\n" - " ivec2 size = ivec2(max(uOutputVideoResolution, vec2(1.0, 1.0)));\n" - " if (outCoord.x >= size.x)\n" - " return vec4(0.0);\n" - " int pixelBase = (outCoord.x / 2) * 2;\n" - " int y = outCoord.y;\n" - " vec4 rgba0 = rgbaAt(pixelBase + 0, y);\n" - " vec4 rgba1 = rgbaAt(pixelBase + 1, y);\n" - " vec3 c0 = rgbToLegalYcbcr10(rgba0.rgb);\n" - " vec3 c1 = rgbToLegalYcbcr10(rgba1.rgb);\n" - " float chroma = (outCoord.x & 1) == 0 ? round((c0.y + c1.y) * 0.5) : round((c0.z + c1.z) * 0.5);\n" - " float alpha = round(clamp(((outCoord.x & 1) == 0 ? rgba0.a : rgba1.a), 0.0, 1.0) * 1023.0);\n" - " float luma = (outCoord.x & 1) == 0 ? c0.x : c1.x;\n" - " uint word = ((uint(luma) & 1023u) << 22) | ((uint(chroma) & 1023u) << 12) | ((uint(alpha) & 1023u) << 2);\n" - " return bigEndianWordToBytes(word);\n" - "}\n" - "void main()\n" - "{\n" - " ivec2 outCoord = ivec2(gl_FragCoord.xy);\n" - " if (uOutputPackFormat == 2)\n" - " {\n" - " fragColor = packAy10Word(outCoord);\n" - " return;\n" - " }\n" - " if (float(outCoord.x) >= uActiveV210Words)\n" - " {\n" - " fragColor = vec4(0.0);\n" - " return;\n" - " }\n" - " int group = outCoord.x / 4;\n" - " int wordIndex = outCoord.x - group * 4;\n" - " int pixelBase = group * 6;\n" - " int y = outCoord.y;\n" - " vec3 c0 = rgbToLegalYcbcr10(rgbAt(pixelBase + 0, y));\n" - " vec3 c1 = rgbToLegalYcbcr10(rgbAt(pixelBase + 1, y));\n" - " vec3 c2 = rgbToLegalYcbcr10(rgbAt(pixelBase + 2, y));\n" - " vec3 c3 = rgbToLegalYcbcr10(rgbAt(pixelBase + 3, y));\n" - " vec3 c4 = rgbToLegalYcbcr10(rgbAt(pixelBase + 4, y));\n" - " vec3 c5 = rgbToLegalYcbcr10(rgbAt(pixelBase + 5, y));\n" - " float cb0 = round((c0.y + c1.y) * 0.5);\n" - " float cr0 = round((c0.z + c1.z) * 0.5);\n" - " float cb2 = round((c2.y + c3.y) * 0.5);\n" - " float cr2 = round((c2.z + c3.z) * 0.5);\n" - " float cb4 = round((c4.y + c5.y) * 0.5);\n" - " float cr4 = round((c4.z + c5.z) * 0.5);\n" - " uint word = wordIndex == 0 ? makeWord(cb0, c0.x, cr0) : wordIndex == 1 ? makeWord(c1.x, cb2, c2.x) : wordIndex == 2 ? makeWord(cr2, c3.x, cb4) : makeWord(c4.x, cr4, c5.x);\n" - " fragColor = wordToBytes(word);\n" - "}\n"; diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/shader/GlShaderSources.h b/apps/LoopThroughWithOpenGLCompositing/gl/shader/GlShaderSources.h deleted file mode 100644 index b7fcd2e..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/shader/GlShaderSources.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -extern const char* kFullscreenTriangleVertexShaderSource; -extern const char* kDecodeFragmentShaderSource; -extern const char* kOutputPackFragmentShaderSource; diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/shader/GlobalParamsBuffer.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/shader/GlobalParamsBuffer.cpp deleted file mode 100644 index 346c04d..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/shader/GlobalParamsBuffer.cpp +++ /dev/null @@ -1,104 +0,0 @@ -#include "GlobalParamsBuffer.h" - -#include "GlRenderConstants.h" -#include "Std140Buffer.h" - -#include - -GlobalParamsBuffer::GlobalParamsBuffer(OpenGLRenderer& renderer) : - mRenderer(renderer) -{ -} - -bool GlobalParamsBuffer::Update(const RuntimeRenderState& state, unsigned availableSourceHistoryLength, unsigned availableTemporalHistoryLength, bool feedbackAvailable) -{ - std::vector& buffer = mScratchBuffer; - buffer.clear(); - buffer.reserve(512); - - AppendStd140Float(buffer, static_cast(state.timeSeconds)); - AppendStd140Vec2(buffer, static_cast(state.inputWidth), static_cast(state.inputHeight)); - AppendStd140Vec2(buffer, static_cast(state.outputWidth), static_cast(state.outputHeight)); - AppendStd140Float(buffer, static_cast(state.utcTimeSeconds)); - AppendStd140Float(buffer, static_cast(state.utcOffsetSeconds)); - AppendStd140Float(buffer, static_cast(state.startupRandom)); - AppendStd140Float(buffer, static_cast(state.frameCount)); - AppendStd140Float(buffer, static_cast(state.mixAmount)); - AppendStd140Float(buffer, static_cast(state.bypass)); - const unsigned effectiveSourceHistoryLength = availableSourceHistoryLength < state.effectiveTemporalHistoryLength - ? availableSourceHistoryLength - : state.effectiveTemporalHistoryLength; - const unsigned effectiveTemporalHistoryLength = (state.temporalHistorySource == TemporalHistorySource::PreLayerInput) - ? (availableTemporalHistoryLength < state.effectiveTemporalHistoryLength ? availableTemporalHistoryLength : state.effectiveTemporalHistoryLength) - : 0u; - AppendStd140Int(buffer, static_cast(effectiveSourceHistoryLength)); - AppendStd140Int(buffer, static_cast(effectiveTemporalHistoryLength)); - AppendStd140Int(buffer, feedbackAvailable ? 1 : 0); - - for (const ShaderParameterDefinition& definition : state.parameterDefinitions) - { - auto valueIt = state.parameterValues.find(definition.id); - const ShaderParameterValue value = valueIt != state.parameterValues.end() - ? valueIt->second - : ShaderParameterValue(); - - switch (definition.type) - { - case ShaderParameterType::Float: - AppendStd140Float(buffer, value.numberValues.empty() ? 0.0f : static_cast(value.numberValues[0])); - break; - case ShaderParameterType::Vec2: - AppendStd140Vec2(buffer, - value.numberValues.size() > 0 ? static_cast(value.numberValues[0]) : 0.0f, - value.numberValues.size() > 1 ? static_cast(value.numberValues[1]) : 0.0f); - break; - case ShaderParameterType::Color: - AppendStd140Vec4(buffer, - value.numberValues.size() > 0 ? static_cast(value.numberValues[0]) : 1.0f, - value.numberValues.size() > 1 ? static_cast(value.numberValues[1]) : 1.0f, - value.numberValues.size() > 2 ? static_cast(value.numberValues[2]) : 1.0f, - value.numberValues.size() > 3 ? static_cast(value.numberValues[3]) : 1.0f); - break; - case ShaderParameterType::Boolean: - AppendStd140Int(buffer, value.booleanValue ? 1 : 0); - break; - case ShaderParameterType::Enum: - { - int selectedIndex = 0; - for (std::size_t optionIndex = 0; optionIndex < definition.enumOptions.size(); ++optionIndex) - { - if (definition.enumOptions[optionIndex].value == value.enumValue) - { - selectedIndex = static_cast(optionIndex); - break; - } - } - AppendStd140Int(buffer, selectedIndex); - break; - } - case ShaderParameterType::Text: - break; - case ShaderParameterType::Trigger: - AppendStd140Int(buffer, value.numberValues.empty() ? 0 : static_cast(value.numberValues[0])); - AppendStd140Float(buffer, value.numberValues.size() > 1 ? static_cast(value.numberValues[1]) : -1000000.0f); - break; - } - } - - buffer.resize(AlignStd140(buffer.size(), 16), 0); - - glBindBuffer(GL_UNIFORM_BUFFER, mRenderer.GlobalParamsUBO()); - if (mRenderer.GlobalParamsUBOSize() != static_cast(buffer.size())) - { - glBufferData(GL_UNIFORM_BUFFER, static_cast(buffer.size()), buffer.data(), GL_DYNAMIC_DRAW); - mRenderer.SetGlobalParamsUBOSize(static_cast(buffer.size())); - } - else - { - glBufferSubData(GL_UNIFORM_BUFFER, 0, static_cast(buffer.size()), buffer.data()); - } - glBindBufferBase(GL_UNIFORM_BUFFER, kGlobalParamsBindingPoint, mRenderer.GlobalParamsUBO()); - glBindBuffer(GL_UNIFORM_BUFFER, 0); - - return true; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/shader/GlobalParamsBuffer.h b/apps/LoopThroughWithOpenGLCompositing/gl/shader/GlobalParamsBuffer.h deleted file mode 100644 index 52c404a..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/shader/GlobalParamsBuffer.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "OpenGLRenderer.h" -#include "ShaderTypes.h" - -#include - -class GlobalParamsBuffer -{ -public: - explicit GlobalParamsBuffer(OpenGLRenderer& renderer); - - bool Update(const RuntimeRenderState& state, unsigned availableSourceHistoryLength, unsigned availableTemporalHistoryLength, bool feedbackAvailable); - -private: - OpenGLRenderer& mRenderer; - std::vector mScratchBuffer; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/shader/OpenGLShaderPrograms.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/shader/OpenGLShaderPrograms.cpp deleted file mode 100644 index 3e67958..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/shader/OpenGLShaderPrograms.cpp +++ /dev/null @@ -1,200 +0,0 @@ -#include "OpenGLShaderPrograms.h" - -#include -#include -#include - -namespace -{ -void CopyErrorMessage(const std::string& message, int errorMessageSize, char* errorMessage) -{ - if (!errorMessage || errorMessageSize <= 0) - return; - - strncpy_s(errorMessage, errorMessageSize, message.c_str(), _TRUNCATE); -} - -std::size_t RequiredTemporaryRenderTargets(const std::vector& layerPrograms) -{ - // Only one layer renders at a time, so the pool needs to cover the widest - // layer, not the sum of every intermediate pass in the stack. - std::size_t requiredTargets = 0; - for (const OpenGLRenderer::LayerProgram& layerProgram : layerPrograms) - { - const std::size_t internalPasses = layerProgram.passes.size() > 0 ? layerProgram.passes.size() - 1 : 0; - if (internalPasses > requiredTargets) - requiredTargets = internalPasses; - } - return requiredTargets; -} -} - -OpenGLShaderPrograms::OpenGLShaderPrograms(OpenGLRenderer& renderer, RuntimeSnapshotProvider& runtimeSnapshotProvider) : - mRenderer(renderer), - mRuntimeSnapshotProvider(runtimeSnapshotProvider), - mGlobalParamsBuffer(renderer), - mCompiler(renderer, runtimeSnapshotProvider, mTextureBindings) -{ -} - -bool OpenGLShaderPrograms::CompileLayerPrograms(unsigned inputFrameWidth, unsigned inputFrameHeight, int errorMessageSize, char* errorMessage) -{ - const RuntimeRenderStateSnapshot renderSnapshot = - mRuntimeSnapshotProvider.PublishRenderStateSnapshot(inputFrameWidth, inputFrameHeight); - const std::vector& layerStates = renderSnapshot.states; - std::string temporalError; - const unsigned historyCap = mRuntimeSnapshotProvider.GetMaxTemporalHistoryFrames(); - if (!mRenderer.TemporalHistory().ValidateTextureUnitBudget(layerStates, historyCap, temporalError)) - { - CopyErrorMessage(temporalError, errorMessageSize, errorMessage); - return false; - } - if (!mRenderer.TemporalHistory().EnsureResources(layerStates, historyCap, inputFrameWidth, inputFrameHeight, temporalError)) - { - CopyErrorMessage(temporalError, errorMessageSize, errorMessage); - return false; - } - if (mRenderer.ResourcesInitialized() && - !mRenderer.FeedbackBuffers().EnsureResources(layerStates, inputFrameWidth, inputFrameHeight, temporalError)) - { - CopyErrorMessage(temporalError, errorMessageSize, errorMessage); - return false; - } - - // Initial startup still compiles synchronously; auto-reload uses the build - // queue so Slang/file work stays off the playback path. - std::vector newPrograms; - newPrograms.reserve(layerStates.size()); - - for (const RuntimeRenderState& state : layerStates) - { - LayerProgram layerProgram; - if (!mCompiler.CompileLayerProgram(state, layerProgram, errorMessageSize, errorMessage)) - { - for (LayerProgram& program : newPrograms) - DestroySingleLayerProgram(program); - return false; - } - newPrograms.push_back(layerProgram); - } - - std::string targetError; - if (!mRenderer.ReserveTemporaryRenderTargets(RequiredTemporaryRenderTargets(newPrograms), inputFrameWidth, inputFrameHeight, targetError)) - { - for (LayerProgram& program : newPrograms) - DestroySingleLayerProgram(program); - CopyErrorMessage(targetError, errorMessageSize, errorMessage); - return false; - } - - DestroyLayerPrograms(); - mRenderer.ReplaceLayerPrograms(newPrograms); - mCommittedLayerStates = renderSnapshot.states; - - return true; -} - -bool OpenGLShaderPrograms::CommitPreparedLayerPrograms(const PreparedShaderBuild& preparedBuild, unsigned inputFrameWidth, unsigned inputFrameHeight, int errorMessageSize, char* errorMessage) -{ - if (!preparedBuild.succeeded) - { - CopyErrorMessage(preparedBuild.message, errorMessageSize, errorMessage); - return false; - } - - std::string temporalError; - const unsigned historyCap = mRuntimeSnapshotProvider.GetMaxTemporalHistoryFrames(); - if (!mRenderer.TemporalHistory().ValidateTextureUnitBudget(preparedBuild.renderSnapshot.states, historyCap, temporalError)) - { - CopyErrorMessage(temporalError, errorMessageSize, errorMessage); - return false; - } - if (!mRenderer.TemporalHistory().EnsureResources(preparedBuild.renderSnapshot.states, historyCap, inputFrameWidth, inputFrameHeight, temporalError)) - { - CopyErrorMessage(temporalError, errorMessageSize, errorMessage); - return false; - } - if (mRenderer.ResourcesInitialized() && - !mRenderer.FeedbackBuffers().EnsureResources(preparedBuild.renderSnapshot.states, inputFrameWidth, inputFrameHeight, temporalError)) - { - CopyErrorMessage(temporalError, errorMessageSize, errorMessage); - return false; - } - - // The prepared build already contains GLSL text for each pass. This commit - // step performs the short GL work on the render thread. - std::vector newPrograms; - newPrograms.reserve(preparedBuild.layers.size()); - - for (const PreparedLayerShader& preparedLayer : preparedBuild.layers) - { - LayerProgram layerProgram; - if (!mCompiler.CompilePreparedLayerProgram(preparedLayer.state, preparedLayer.passes, layerProgram, errorMessageSize, errorMessage)) - { - for (LayerProgram& program : newPrograms) - DestroySingleLayerProgram(program); - return false; - } - newPrograms.push_back(layerProgram); - } - - std::string targetError; - if (!mRenderer.ReserveTemporaryRenderTargets(RequiredTemporaryRenderTargets(newPrograms), inputFrameWidth, inputFrameHeight, targetError)) - { - for (LayerProgram& program : newPrograms) - DestroySingleLayerProgram(program); - CopyErrorMessage(targetError, errorMessageSize, errorMessage); - return false; - } - - DestroyLayerPrograms(); - mRenderer.ReplaceLayerPrograms(newPrograms); - mCommittedLayerStates = preparedBuild.renderSnapshot.states; - - return true; -} - -bool OpenGLShaderPrograms::CompileDecodeShader(int errorMessageSize, char* errorMessage) -{ - return mCompiler.CompileDecodeShader(errorMessageSize, errorMessage); -} - -bool OpenGLShaderPrograms::CompileOutputPackShader(int errorMessageSize, char* errorMessage) -{ - return mCompiler.CompileOutputPackShader(errorMessageSize, errorMessage); -} - -void OpenGLShaderPrograms::DestroySingleLayerProgram(LayerProgram& layerProgram) -{ - mRenderer.DestroySingleLayerProgram(layerProgram); -} - -void OpenGLShaderPrograms::DestroyLayerPrograms() -{ - mRenderer.DestroyLayerPrograms(); -} - -void OpenGLShaderPrograms::DestroyDecodeShaderProgram() -{ - mRenderer.DestroyDecodeShaderProgram(); -} - -void OpenGLShaderPrograms::ResetTemporalHistoryState() -{ - mRenderer.TemporalHistory().ResetState(); -} - -void OpenGLShaderPrograms::ResetShaderFeedbackState() -{ - mRenderer.FeedbackBuffers().ResetState(); -} - -bool OpenGLShaderPrograms::UpdateTextBindingTexture(const RuntimeRenderState& state, LayerProgram::TextBinding& textBinding, std::string& error) -{ - return mTextureBindings.UpdateTextBindingTexture(state, textBinding, error); -} - -bool OpenGLShaderPrograms::UpdateGlobalParamsBuffer(const RuntimeRenderState& state, unsigned availableSourceHistoryLength, unsigned availableTemporalHistoryLength, bool feedbackAvailable) -{ - return mGlobalParamsBuffer.Update(state, availableSourceHistoryLength, availableTemporalHistoryLength, feedbackAvailable); -} diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/shader/OpenGLShaderPrograms.h b/apps/LoopThroughWithOpenGLCompositing/gl/shader/OpenGLShaderPrograms.h deleted file mode 100644 index b1458da..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/shader/OpenGLShaderPrograms.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once - -#include "GlobalParamsBuffer.h" -#include "OpenGLRenderer.h" -#include "RuntimeSnapshotProvider.h" -#include "ShaderBuildQueue.h" -#include "ShaderTypes.h" -#include "ShaderProgramCompiler.h" -#include "ShaderTextureBindings.h" - -#include - -class OpenGLShaderPrograms -{ -public: - using LayerProgram = OpenGLRenderer::LayerProgram; - - OpenGLShaderPrograms(OpenGLRenderer& renderer, RuntimeSnapshotProvider& runtimeSnapshotProvider); - - bool CompileLayerPrograms(unsigned inputFrameWidth, unsigned inputFrameHeight, int errorMessageSize, char* errorMessage); - bool CommitPreparedLayerPrograms(const PreparedShaderBuild& preparedBuild, unsigned inputFrameWidth, unsigned inputFrameHeight, int errorMessageSize, char* errorMessage); - bool CompileDecodeShader(int errorMessageSize, char* errorMessage); - bool CompileOutputPackShader(int errorMessageSize, char* errorMessage); - void DestroyLayerPrograms(); - void DestroySingleLayerProgram(LayerProgram& layerProgram); - void DestroyDecodeShaderProgram(); - void ResetTemporalHistoryState(); - void ResetShaderFeedbackState(); - const std::vector& CommittedLayerStates() const { return mCommittedLayerStates; } - bool UpdateTextBindingTexture(const RuntimeRenderState& state, LayerProgram::TextBinding& textBinding, std::string& error); - bool UpdateGlobalParamsBuffer(const RuntimeRenderState& state, unsigned availableSourceHistoryLength, unsigned availableTemporalHistoryLength, bool feedbackAvailable); - -private: - OpenGLRenderer& mRenderer; - RuntimeSnapshotProvider& mRuntimeSnapshotProvider; - ShaderTextureBindings mTextureBindings; - GlobalParamsBuffer mGlobalParamsBuffer; - ShaderProgramCompiler mCompiler; - std::vector mCommittedLayerStates; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/shader/ShaderBuildQueue.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/shader/ShaderBuildQueue.cpp deleted file mode 100644 index ede2f1d..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/shader/ShaderBuildQueue.cpp +++ /dev/null @@ -1,166 +0,0 @@ -#include "ShaderBuildQueue.h" - -#include "RuntimeEventDispatcher.h" - -#include -#include - -namespace -{ -constexpr auto kShaderBuildDebounce = std::chrono::milliseconds(400); -} - -ShaderBuildQueue::ShaderBuildQueue(RuntimeSnapshotProvider& runtimeSnapshotProvider, RuntimeEventDispatcher& runtimeEventDispatcher) : - mRuntimeSnapshotProvider(runtimeSnapshotProvider), - mRuntimeEventDispatcher(runtimeEventDispatcher), - mWorkerThread([this]() { WorkerLoop(); }) -{ -} - -ShaderBuildQueue::~ShaderBuildQueue() -{ - Stop(); -} - -void ShaderBuildQueue::RequestBuild(unsigned outputWidth, unsigned outputHeight) -{ - { - std::lock_guard lock(mMutex); - mHasRequest = true; - ++mRequestedGeneration; - mRequestedOutputWidth = outputWidth; - mRequestedOutputHeight = outputHeight; - mHasReadyBuild = false; - } - mCondition.notify_one(); -} - -bool ShaderBuildQueue::TryConsumeReadyBuild(PreparedShaderBuild& build) -{ - std::lock_guard lock(mMutex); - if (!mHasReadyBuild) - return false; - - build = std::move(mReadyBuild); - mReadyBuild = PreparedShaderBuild(); - mHasReadyBuild = false; - return true; -} - -bool ShaderBuildQueue::TryConsumeReadyBuild(uint64_t expectedGeneration, PreparedShaderBuild& build) -{ - std::lock_guard lock(mMutex); - if (!mHasReadyBuild || mReadyBuild.generation != expectedGeneration) - return false; - - build = std::move(mReadyBuild); - mReadyBuild = PreparedShaderBuild(); - mHasReadyBuild = false; - return true; -} - -void ShaderBuildQueue::Stop() -{ - { - std::lock_guard lock(mMutex); - if (mStopping) - return; - mStopping = true; - } - mCondition.notify_one(); - if (mWorkerThread.joinable()) - mWorkerThread.join(); -} - -void ShaderBuildQueue::WorkerLoop() -{ - for (;;) - { - uint64_t generation = 0; - unsigned outputWidth = 0; - unsigned outputHeight = 0; - { - std::unique_lock lock(mMutex); - mCondition.wait(lock, [this]() { return mStopping || mHasRequest; }); - if (mStopping) - return; - - generation = mRequestedGeneration; - outputWidth = mRequestedOutputWidth; - outputHeight = mRequestedOutputHeight; - mHasRequest = false; - } - - for (;;) - { - std::unique_lock lock(mMutex); - if (mCondition.wait_for(lock, kShaderBuildDebounce, [this, generation]() { - return mStopping || (mHasRequest && mRequestedGeneration != generation); - })) - { - if (mStopping) - return; - - generation = mRequestedGeneration; - outputWidth = mRequestedOutputWidth; - outputHeight = mRequestedOutputHeight; - mHasRequest = false; - continue; - } - break; - } - - PreparedShaderBuild build = Build(generation, outputWidth, outputHeight); - - bool shouldPublish = false; - { - std::lock_guard lock(mMutex); - if (mStopping) - return; - if (generation != mRequestedGeneration) - continue; - mReadyBuild = build; - mHasReadyBuild = true; - shouldPublish = true; - } - - if (shouldPublish) - PublishBuildLifecycleEvent(build, outputWidth, outputHeight); - } -} - -PreparedShaderBuild ShaderBuildQueue::Build(uint64_t generation, unsigned outputWidth, unsigned outputHeight) -{ - PreparedShaderBuild build; - build.generation = generation; - build.renderSnapshot = mRuntimeSnapshotProvider.PublishRenderStateSnapshot(outputWidth, outputHeight); - build.layers.reserve(build.renderSnapshot.states.size()); - - for (const RuntimeRenderState& state : build.renderSnapshot.states) - { - PreparedLayerShader layer; - layer.state = state; - if (!mRuntimeSnapshotProvider.BuildLayerPassFragmentShaderSources(state.layerId, layer.passes, build.message)) - { - build.succeeded = false; - return build; - } - build.layers.push_back(std::move(layer)); - } - - build.succeeded = true; - build.message = "Shader layers prepared successfully."; - return build; -} - -void ShaderBuildQueue::PublishBuildLifecycleEvent(const PreparedShaderBuild& build, unsigned outputWidth, unsigned outputHeight) const -{ - ShaderBuildEvent event; - event.phase = build.succeeded ? RuntimeEventShaderBuildPhase::Prepared : RuntimeEventShaderBuildPhase::Failed; - event.generation = build.generation; - event.inputWidth = outputWidth; - event.inputHeight = outputHeight; - event.succeeded = build.succeeded; - event.message = build.message; - mRuntimeEventDispatcher.PublishPayload(event, "ShaderBuildQueue"); -} diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/shader/ShaderBuildQueue.h b/apps/LoopThroughWithOpenGLCompositing/gl/shader/ShaderBuildQueue.h deleted file mode 100644 index a4b2092..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/shader/ShaderBuildQueue.h +++ /dev/null @@ -1,61 +0,0 @@ -#pragma once - -#include "RuntimeSnapshotProvider.h" -#include "ShaderTypes.h" - -#include -#include -#include -#include -#include -#include - -class RuntimeEventDispatcher; - -struct PreparedLayerShader -{ - RuntimeRenderState state; - std::vector passes; -}; - -struct PreparedShaderBuild -{ - uint64_t generation = 0; - bool succeeded = false; - std::string message; - RuntimeRenderStateSnapshot renderSnapshot; - std::vector layers; -}; - -class ShaderBuildQueue -{ -public: - ShaderBuildQueue(RuntimeSnapshotProvider& runtimeSnapshotProvider, RuntimeEventDispatcher& runtimeEventDispatcher); - ~ShaderBuildQueue(); - - ShaderBuildQueue(const ShaderBuildQueue&) = delete; - ShaderBuildQueue& operator=(const ShaderBuildQueue&) = delete; - - void RequestBuild(unsigned outputWidth, unsigned outputHeight); - bool TryConsumeReadyBuild(PreparedShaderBuild& build); - bool TryConsumeReadyBuild(uint64_t expectedGeneration, PreparedShaderBuild& build); - void Stop(); - -private: - void WorkerLoop(); - PreparedShaderBuild Build(uint64_t generation, unsigned outputWidth, unsigned outputHeight); - void PublishBuildLifecycleEvent(const PreparedShaderBuild& build, unsigned outputWidth, unsigned outputHeight) const; - - RuntimeSnapshotProvider& mRuntimeSnapshotProvider; - RuntimeEventDispatcher& mRuntimeEventDispatcher; - std::thread mWorkerThread; - std::mutex mMutex; - std::condition_variable mCondition; - bool mStopping = false; - bool mHasRequest = false; - uint64_t mRequestedGeneration = 0; - unsigned mRequestedOutputWidth = 0; - unsigned mRequestedOutputHeight = 0; - bool mHasReadyBuild = false; - PreparedShaderBuild mReadyBuild; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/shader/ShaderProgramCompiler.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/shader/ShaderProgramCompiler.cpp deleted file mode 100644 index 0be6d62..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/shader/ShaderProgramCompiler.cpp +++ /dev/null @@ -1,233 +0,0 @@ -#include "ShaderProgramCompiler.h" - -#include "GlRenderConstants.h" -#include "GlScopedObjects.h" -#include "GlShaderSources.h" - -#include -#include -#include - -namespace -{ -void CopyErrorMessage(const std::string& message, int errorMessageSize, char* errorMessage) -{ - if (!errorMessage || errorMessageSize <= 0) - return; - - strncpy_s(errorMessage, errorMessageSize, message.c_str(), _TRUNCATE); -} -} - -ShaderProgramCompiler::ShaderProgramCompiler(OpenGLRenderer& renderer, RuntimeSnapshotProvider& runtimeSnapshotProvider, ShaderTextureBindings& textureBindings) : - mRenderer(renderer), - mRuntimeSnapshotProvider(runtimeSnapshotProvider), - mTextureBindings(textureBindings) -{ -} - -bool ShaderProgramCompiler::CompileLayerProgram(const RuntimeRenderState& state, LayerProgram& layerProgram, int errorMessageSize, char* errorMessage) -{ - std::vector passSources; - std::string loadError; - - if (!mRuntimeSnapshotProvider.BuildLayerPassFragmentShaderSources(state.layerId, passSources, loadError)) - { - CopyErrorMessage(loadError, errorMessageSize, errorMessage); - return false; - } - - return CompilePreparedLayerProgram(state, passSources, layerProgram, errorMessageSize, errorMessage); -} - -bool ShaderProgramCompiler::CompilePreparedLayerProgram(const RuntimeRenderState& state, const std::vector& passSources, LayerProgram& layerProgram, int errorMessageSize, char* errorMessage) -{ - GLsizei errorBufferSize = 0; - std::string loadError; - const char* vertexSource = kFullscreenTriangleVertexShaderSource; - - layerProgram.layerId = state.layerId; - layerProgram.shaderId = state.shaderId; - layerProgram.passes.clear(); - - for (const auto& passSource : passSources) - { - GLint compileResult = GL_FALSE; - GLint linkResult = GL_FALSE; - const char* fragmentSource = passSource.fragmentShaderSource.c_str(); - - ScopedGlShader newVertexShader(glCreateShader(GL_VERTEX_SHADER)); - glShaderSource(newVertexShader.get(), 1, (const GLchar**)&vertexSource, NULL); - glCompileShader(newVertexShader.get()); - glGetShaderiv(newVertexShader.get(), GL_COMPILE_STATUS, &compileResult); - if (compileResult == GL_FALSE) - { - glGetShaderInfoLog(newVertexShader.get(), errorMessageSize, &errorBufferSize, errorMessage); - mRenderer.DestroySingleLayerProgram(layerProgram); - return false; - } - - ScopedGlShader newFragmentShader(glCreateShader(GL_FRAGMENT_SHADER)); - glShaderSource(newFragmentShader.get(), 1, (const GLchar**)&fragmentSource, NULL); - glCompileShader(newFragmentShader.get()); - glGetShaderiv(newFragmentShader.get(), GL_COMPILE_STATUS, &compileResult); - if (compileResult == GL_FALSE) - { - glGetShaderInfoLog(newFragmentShader.get(), errorMessageSize, &errorBufferSize, errorMessage); - mRenderer.DestroySingleLayerProgram(layerProgram); - return false; - } - - ScopedGlProgram newProgram(glCreateProgram()); - glAttachShader(newProgram.get(), newVertexShader.get()); - glAttachShader(newProgram.get(), newFragmentShader.get()); - glLinkProgram(newProgram.get()); - glGetProgramiv(newProgram.get(), GL_LINK_STATUS, &linkResult); - if (linkResult == GL_FALSE) - { - glGetProgramInfoLog(newProgram.get(), errorMessageSize, &errorBufferSize, errorMessage); - mRenderer.DestroySingleLayerProgram(layerProgram); - return false; - } - - std::vector textureBindings; - for (const ShaderTextureAsset& textureAsset : state.textureAssets) - { - LayerProgram::TextureBinding textureBinding; - textureBinding.samplerName = textureAsset.id; - textureBinding.sourcePath = textureAsset.path; - if (!mTextureBindings.LoadTextureAsset(textureAsset, textureBinding.texture, loadError)) - { - for (LayerProgram::TextureBinding& loadedTexture : textureBindings) - { - if (loadedTexture.texture != 0) - glDeleteTextures(1, &loadedTexture.texture); - } - CopyErrorMessage(loadError, errorMessageSize, errorMessage); - mRenderer.DestroySingleLayerProgram(layerProgram); - return false; - } - textureBindings.push_back(textureBinding); - } - - std::vector textBindings; - mTextureBindings.CreateTextBindings(state, textBindings); - - PassProgram passProgram; - passProgram.passId = passSource.passId; - passProgram.inputNames = passSource.inputNames; - passProgram.outputName = passSource.outputName; - passProgram.shaderTextureBase = mTextureBindings.ResolveShaderTextureBase(state, mRuntimeSnapshotProvider.GetMaxTemporalHistoryFrames()); - passProgram.textureBindings.swap(textureBindings); - passProgram.textBindings.swap(textBindings); - - const GLuint globalParamsIndex = glGetUniformBlockIndex(newProgram.get(), "GlobalParams"); - if (globalParamsIndex != GL_INVALID_INDEX) - glUniformBlockBinding(newProgram.get(), globalParamsIndex, kGlobalParamsBindingPoint); - - const unsigned historyCap = mRuntimeSnapshotProvider.GetMaxTemporalHistoryFrames(); - glUseProgram(newProgram.get()); - mTextureBindings.AssignLayerSamplerUniforms(newProgram.get(), state, passProgram, historyCap); - glUseProgram(0); - - passProgram.program = newProgram.release(); - passProgram.vertexShader = newVertexShader.release(); - passProgram.fragmentShader = newFragmentShader.release(); - layerProgram.passes.push_back(std::move(passProgram)); - } - return true; -} - -bool ShaderProgramCompiler::CompileDecodeShader(int errorMessageSize, char* errorMessage) -{ - GLsizei errorBufferSize = 0; - GLint compileResult = GL_FALSE; - GLint linkResult = GL_FALSE; - const char* vertexSource = kFullscreenTriangleVertexShaderSource; - const char* fragmentSource = kDecodeFragmentShaderSource; - - ScopedGlShader newVertexShader(glCreateShader(GL_VERTEX_SHADER)); - glShaderSource(newVertexShader.get(), 1, (const GLchar**)&vertexSource, NULL); - glCompileShader(newVertexShader.get()); - glGetShaderiv(newVertexShader.get(), GL_COMPILE_STATUS, &compileResult); - if (compileResult == GL_FALSE) - { - glGetShaderInfoLog(newVertexShader.get(), errorMessageSize, &errorBufferSize, errorMessage); - return false; - } - - ScopedGlShader newFragmentShader(glCreateShader(GL_FRAGMENT_SHADER)); - glShaderSource(newFragmentShader.get(), 1, (const GLchar**)&fragmentSource, NULL); - glCompileShader(newFragmentShader.get()); - glGetShaderiv(newFragmentShader.get(), GL_COMPILE_STATUS, &compileResult); - if (compileResult == GL_FALSE) - { - glGetShaderInfoLog(newFragmentShader.get(), errorMessageSize, &errorBufferSize, errorMessage); - return false; - } - - ScopedGlProgram newProgram(glCreateProgram()); - glAttachShader(newProgram.get(), newVertexShader.get()); - glAttachShader(newProgram.get(), newFragmentShader.get()); - glLinkProgram(newProgram.get()); - glGetProgramiv(newProgram.get(), GL_LINK_STATUS, &linkResult); - if (linkResult == GL_FALSE) - { - glGetProgramInfoLog(newProgram.get(), errorMessageSize, &errorBufferSize, errorMessage); - return false; - } - - mRenderer.DestroyDecodeShaderProgram(); - mRenderer.SetDecodeShaderProgram(newProgram.release(), newVertexShader.release(), newFragmentShader.release()); - return true; -} - -bool ShaderProgramCompiler::CompileOutputPackShader(int errorMessageSize, char* errorMessage) -{ - GLsizei errorBufferSize = 0; - GLint compileResult = GL_FALSE; - GLint linkResult = GL_FALSE; - const char* vertexSource = kFullscreenTriangleVertexShaderSource; - const char* fragmentSource = kOutputPackFragmentShaderSource; - - ScopedGlShader newVertexShader(glCreateShader(GL_VERTEX_SHADER)); - glShaderSource(newVertexShader.get(), 1, (const GLchar**)&vertexSource, NULL); - glCompileShader(newVertexShader.get()); - glGetShaderiv(newVertexShader.get(), GL_COMPILE_STATUS, &compileResult); - if (compileResult == GL_FALSE) - { - glGetShaderInfoLog(newVertexShader.get(), errorMessageSize, &errorBufferSize, errorMessage); - return false; - } - - ScopedGlShader newFragmentShader(glCreateShader(GL_FRAGMENT_SHADER)); - glShaderSource(newFragmentShader.get(), 1, (const GLchar**)&fragmentSource, NULL); - glCompileShader(newFragmentShader.get()); - glGetShaderiv(newFragmentShader.get(), GL_COMPILE_STATUS, &compileResult); - if (compileResult == GL_FALSE) - { - glGetShaderInfoLog(newFragmentShader.get(), errorMessageSize, &errorBufferSize, errorMessage); - return false; - } - - ScopedGlProgram newProgram(glCreateProgram()); - glAttachShader(newProgram.get(), newVertexShader.get()); - glAttachShader(newProgram.get(), newFragmentShader.get()); - glLinkProgram(newProgram.get()); - glGetProgramiv(newProgram.get(), GL_LINK_STATUS, &linkResult); - if (linkResult == GL_FALSE) - { - glGetProgramInfoLog(newProgram.get(), errorMessageSize, &errorBufferSize, errorMessage); - return false; - } - - glUseProgram(newProgram.get()); - const GLint outputSamplerLocation = glGetUniformLocation(newProgram.get(), "uOutputRgb"); - if (outputSamplerLocation >= 0) - glUniform1i(outputSamplerLocation, 0); - glUseProgram(0); - - mRenderer.DestroyOutputPackShaderProgram(); - mRenderer.SetOutputPackShaderProgram(newProgram.release(), newVertexShader.release(), newFragmentShader.release()); - return true; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/shader/ShaderProgramCompiler.h b/apps/LoopThroughWithOpenGLCompositing/gl/shader/ShaderProgramCompiler.h deleted file mode 100644 index 82e05af..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/shader/ShaderProgramCompiler.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -#include "OpenGLRenderer.h" -#include "RuntimeSnapshotProvider.h" -#include "ShaderTextureBindings.h" - -#include -#include - -class ShaderProgramCompiler -{ -public: - using LayerProgram = OpenGLRenderer::LayerProgram; - using PassProgram = OpenGLRenderer::LayerProgram::PassProgram; - - ShaderProgramCompiler(OpenGLRenderer& renderer, RuntimeSnapshotProvider& runtimeSnapshotProvider, ShaderTextureBindings& textureBindings); - - bool CompileLayerProgram(const RuntimeRenderState& state, LayerProgram& layerProgram, int errorMessageSize, char* errorMessage); - bool CompilePreparedLayerProgram(const RuntimeRenderState& state, const std::vector& passSources, LayerProgram& layerProgram, int errorMessageSize, char* errorMessage); - bool CompileDecodeShader(int errorMessageSize, char* errorMessage); - bool CompileOutputPackShader(int errorMessageSize, char* errorMessage); - -private: - OpenGLRenderer& mRenderer; - RuntimeSnapshotProvider& mRuntimeSnapshotProvider; - ShaderTextureBindings& mTextureBindings; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/shader/ShaderTextureBindings.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/shader/ShaderTextureBindings.cpp deleted file mode 100644 index 5d9a542..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/shader/ShaderTextureBindings.cpp +++ /dev/null @@ -1,256 +0,0 @@ -#include "ShaderTextureBindings.h" - -#include "GlRenderConstants.h" -#include "TextRasterizer.h" -#include "TextureAssetLoader.h" - -#include -#include - -namespace -{ -std::string TextValueForBinding(const RuntimeRenderState& state, const std::string& parameterId) -{ - auto valueIt = state.parameterValues.find(parameterId); - return valueIt == state.parameterValues.end() ? std::string() : valueIt->second.textValue; -} - -const ShaderFontAsset* FindFontAssetForParameter(const RuntimeRenderState& state, const ShaderParameterDefinition& definition) -{ - if (!definition.fontId.empty()) - { - for (const ShaderFontAsset& fontAsset : state.fontAssets) - { - if (fontAsset.id == definition.fontId) - return &fontAsset; - } - } - return state.fontAssets.empty() ? nullptr : &state.fontAssets.front(); -} -} - -bool ShaderTextureBindings::LoadTextureAsset(const ShaderTextureAsset& textureAsset, GLuint& textureId, std::string& error) -{ - return ::LoadTextureAsset(textureAsset, textureId, error); -} - -void ShaderTextureBindings::CreateTextBindings(const RuntimeRenderState& state, std::vector& textBindings) -{ - for (const ShaderParameterDefinition& definition : state.parameterDefinitions) - { - if (definition.type != ShaderParameterType::Text) - continue; - LayerProgram::TextBinding textBinding; - textBinding.parameterId = definition.id; - textBinding.samplerName = definition.id + "Texture"; - textBinding.fontId = definition.fontId; - glGenTextures(1, &textBinding.texture); - glBindTexture(GL_TEXTURE_2D, textBinding.texture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - std::vector empty(static_cast(kTextTextureWidth) * kTextTextureHeight * 4, 0); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, kTextTextureWidth, kTextTextureHeight, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, empty.data()); - glBindTexture(GL_TEXTURE_2D, 0); - textBindings.push_back(textBinding); - } -} - -bool ShaderTextureBindings::UpdateTextBindingTexture(const RuntimeRenderState& state, LayerProgram::TextBinding& textBinding, std::string& error) -{ - const std::string text = TextValueForBinding(state, textBinding.parameterId); - if (text == textBinding.renderedText && textBinding.renderedWidth == kTextTextureWidth && textBinding.renderedHeight == kTextTextureHeight) - return true; - - auto definitionIt = std::find_if(state.parameterDefinitions.begin(), state.parameterDefinitions.end(), - [&textBinding](const ShaderParameterDefinition& definition) { return definition.id == textBinding.parameterId; }); - if (definitionIt == state.parameterDefinitions.end()) - return true; - - const ShaderFontAsset* fontAsset = FindFontAssetForParameter(state, *definitionIt); - std::filesystem::path fontPath; - if (fontAsset) - fontPath = fontAsset->path; - - std::vector sdf; - if (!RasterizeTextSdf(text, fontPath, sdf, error)) - return false; - - GLint previousActiveTexture = 0; - GLint previousUnpackBuffer = 0; - glGetIntegerv(GL_ACTIVE_TEXTURE, &previousActiveTexture); - glGetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, &previousUnpackBuffer); - glActiveTexture(GL_TEXTURE0); - glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); - glBindTexture(GL_TEXTURE_2D, textBinding.texture); - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, kTextTextureWidth, kTextTextureHeight, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, sdf.data()); - glBindTexture(GL_TEXTURE_2D, 0); - glBindBuffer(GL_PIXEL_UNPACK_BUFFER, static_cast(previousUnpackBuffer)); - glActiveTexture(static_cast(previousActiveTexture)); - - textBinding.renderedText = text; - textBinding.renderedWidth = kTextTextureWidth; - textBinding.renderedHeight = kTextTextureHeight; - return true; -} - -GLint ShaderTextureBindings::FindSamplerUniformLocation(GLuint program, const std::string& samplerName) const -{ - GLint location = glGetUniformLocation(program, samplerName.c_str()); - if (location >= 0) - return location; - return glGetUniformLocation(program, (samplerName + "_0").c_str()); -} - -GLuint ShaderTextureBindings::ResolveFeedbackTextureUnit(const RuntimeRenderState& state, unsigned historyCap) const -{ - return state.isTemporal ? kSourceHistoryTextureUnitBase + historyCap + historyCap : kSourceHistoryTextureUnitBase; -} - -GLuint ShaderTextureBindings::ResolveShaderTextureBase(const RuntimeRenderState& state, unsigned historyCap) const -{ - return ResolveFeedbackTextureUnit(state, historyCap) + (state.feedback.enabled ? 1u : 0u); -} - -void ShaderTextureBindings::AssignLayerSamplerUniforms(GLuint program, const RuntimeRenderState& state, const PassProgram& passProgram, unsigned historyCap) const -{ - const GLuint shaderTextureBase = ResolveShaderTextureBase(state, historyCap); - - const GLint layerInputLocation = FindSamplerUniformLocation(program, "gLayerInput"); - if (layerInputLocation >= 0) - glUniform1i(layerInputLocation, static_cast(kLayerInputTextureUnit)); - - const GLint videoInputLocation = FindSamplerUniformLocation(program, "gVideoInput"); - if (videoInputLocation >= 0) - glUniform1i(videoInputLocation, static_cast(kDecodedVideoTextureUnit)); - - for (unsigned index = 0; index < historyCap; ++index) - { - const std::string sourceSamplerName = "gSourceHistory" + std::to_string(index); - const GLint sourceSamplerLocation = glGetUniformLocation(program, sourceSamplerName.c_str()); - if (sourceSamplerLocation >= 0) - glUniform1i(sourceSamplerLocation, static_cast(kSourceHistoryTextureUnitBase + index)); - - const std::string temporalSamplerName = "gTemporalHistory" + std::to_string(index); - const GLint temporalSamplerLocation = glGetUniformLocation(program, temporalSamplerName.c_str()); - if (temporalSamplerLocation >= 0) - glUniform1i(temporalSamplerLocation, static_cast(kSourceHistoryTextureUnitBase + historyCap + index)); - } - - if (state.feedback.enabled) - { - const GLint feedbackSamplerLocation = FindSamplerUniformLocation(program, "gFeedbackState"); - if (feedbackSamplerLocation >= 0) - glUniform1i(feedbackSamplerLocation, static_cast(ResolveFeedbackTextureUnit(state, historyCap))); - } - - for (std::size_t index = 0; index < passProgram.textureBindings.size(); ++index) - { - const GLint textureSamplerLocation = FindSamplerUniformLocation(program, passProgram.textureBindings[index].samplerName); - if (textureSamplerLocation >= 0) - glUniform1i(textureSamplerLocation, static_cast(shaderTextureBase + static_cast(index))); - } - - const GLuint textTextureBase = shaderTextureBase + static_cast(passProgram.textureBindings.size()); - for (std::size_t index = 0; index < passProgram.textBindings.size(); ++index) - { - const GLint textSamplerLocation = FindSamplerUniformLocation(program, passProgram.textBindings[index].samplerName); - if (textSamplerLocation >= 0) - glUniform1i(textSamplerLocation, static_cast(textTextureBase + static_cast(index))); - } -} - -ShaderTextureBindings::RuntimeTextureBindingPlan ShaderTextureBindings::BuildLayerRuntimeBindingPlan( - const PassProgram& passProgram, - GLuint layerInputTexture, - GLuint originalLayerInputTexture, - const RuntimeRenderState& state, - GLuint feedbackTexture, - const std::vector& sourceHistoryTextures, - const std::vector& temporalHistoryTextures) const -{ - RuntimeTextureBindingPlan plan; - plan.bindings.push_back({ "originalLayerInput", "gLayerInput", originalLayerInputTexture, kLayerInputTextureUnit }); - plan.bindings.push_back({ "layerInput", "gVideoInput", layerInputTexture, kDecodedVideoTextureUnit }); - - for (std::size_t index = 0; index < sourceHistoryTextures.size(); ++index) - { - plan.bindings.push_back({ - "sourceHistory", - "gSourceHistory" + std::to_string(index), - sourceHistoryTextures[index], - kSourceHistoryTextureUnitBase + static_cast(index) - }); - } - - const GLuint temporalBase = kSourceHistoryTextureUnitBase + static_cast(sourceHistoryTextures.size()); - for (std::size_t index = 0; index < temporalHistoryTextures.size(); ++index) - { - plan.bindings.push_back({ - "temporalHistory", - "gTemporalHistory" + std::to_string(index), - temporalHistoryTextures[index], - temporalBase + static_cast(index) - }); - } - - const GLuint feedbackTextureUnit = ResolveFeedbackTextureUnit(state, static_cast(sourceHistoryTextures.size())); - if (state.feedback.enabled) - { - plan.bindings.push_back({ - "feedbackState", - "gFeedbackState", - feedbackTexture, - feedbackTextureUnit - }); - } - - const GLuint shaderTextureBase = passProgram.shaderTextureBase != 0 - ? passProgram.shaderTextureBase - : feedbackTextureUnit + (state.feedback.enabled ? 1u : 0u); - for (std::size_t index = 0; index < passProgram.textureBindings.size(); ++index) - { - const LayerProgram::TextureBinding& textureBinding = passProgram.textureBindings[index]; - plan.bindings.push_back({ - "shaderTexture", - textureBinding.samplerName, - textureBinding.texture, - shaderTextureBase + static_cast(index) - }); - } - - const GLuint textTextureBase = shaderTextureBase + static_cast(passProgram.textureBindings.size()); - for (std::size_t index = 0; index < passProgram.textBindings.size(); ++index) - { - const LayerProgram::TextBinding& textBinding = passProgram.textBindings[index]; - plan.bindings.push_back({ - "textTexture", - textBinding.samplerName, - textBinding.texture, - textTextureBase + static_cast(index) - }); - } - - return plan; -} - -void ShaderTextureBindings::BindRuntimeTexturePlan(const RuntimeTextureBindingPlan& plan) const -{ - for (const RuntimeTextureBinding& binding : plan.bindings) - { - glActiveTexture(GL_TEXTURE0 + binding.textureUnit); - glBindTexture(GL_TEXTURE_2D, binding.texture); - } - glActiveTexture(GL_TEXTURE0); -} - -void ShaderTextureBindings::UnbindRuntimeTexturePlan(const RuntimeTextureBindingPlan& plan) const -{ - for (const RuntimeTextureBinding& binding : plan.bindings) - { - glActiveTexture(GL_TEXTURE0 + binding.textureUnit); - glBindTexture(GL_TEXTURE_2D, 0); - } - glActiveTexture(GL_TEXTURE0); -} diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/shader/ShaderTextureBindings.h b/apps/LoopThroughWithOpenGLCompositing/gl/shader/ShaderTextureBindings.h deleted file mode 100644 index 1f6210a..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/shader/ShaderTextureBindings.h +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -#include "OpenGLRenderer.h" -#include "ShaderTypes.h" - -#include -#include - -class ShaderTextureBindings -{ -public: - using LayerProgram = OpenGLRenderer::LayerProgram; - using PassProgram = OpenGLRenderer::LayerProgram::PassProgram; - - struct RuntimeTextureBinding - { - std::string semanticName; - std::string samplerName; - GLuint texture = 0; - GLuint textureUnit = 0; - }; - - struct RuntimeTextureBindingPlan - { - std::vector bindings; - }; - - bool LoadTextureAsset(const ShaderTextureAsset& textureAsset, GLuint& textureId, std::string& error); - void CreateTextBindings(const RuntimeRenderState& state, std::vector& textBindings); - bool UpdateTextBindingTexture(const RuntimeRenderState& state, LayerProgram::TextBinding& textBinding, std::string& error); - GLint FindSamplerUniformLocation(GLuint program, const std::string& samplerName) const; - GLuint ResolveFeedbackTextureUnit(const RuntimeRenderState& state, unsigned historyCap) const; - GLuint ResolveShaderTextureBase(const RuntimeRenderState& state, unsigned historyCap) const; - void AssignLayerSamplerUniforms(GLuint program, const RuntimeRenderState& state, const PassProgram& passProgram, unsigned historyCap) const; - RuntimeTextureBindingPlan BuildLayerRuntimeBindingPlan( - const PassProgram& passProgram, - GLuint layerInputTexture, - GLuint originalLayerInputTexture, - const RuntimeRenderState& state, - GLuint feedbackTexture, - const std::vector& sourceHistoryTextures, - const std::vector& temporalHistoryTextures) const; - void BindRuntimeTexturePlan(const RuntimeTextureBindingPlan& plan) const; - void UnbindRuntimeTexturePlan(const RuntimeTextureBindingPlan& plan) const; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/shader/Std140Buffer.h b/apps/LoopThroughWithOpenGLCompositing/gl/shader/Std140Buffer.h deleted file mode 100644 index a94ac6d..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/shader/Std140Buffer.h +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once - -#include -#include -#include - -inline std::size_t AlignStd140(std::size_t offset, std::size_t alignment) -{ - const std::size_t mask = alignment - 1; - return (offset + mask) & ~mask; -} - -template -inline void AppendStd140Value(std::vector& buffer, std::size_t alignment, const TValue& value) -{ - const std::size_t offset = AlignStd140(buffer.size(), alignment); - if (buffer.size() < offset + sizeof(TValue)) - buffer.resize(offset + sizeof(TValue), 0); - std::memcpy(buffer.data() + offset, &value, sizeof(TValue)); -} - -inline void AppendStd140Float(std::vector& buffer, float value) -{ - AppendStd140Value(buffer, 4, value); -} - -inline void AppendStd140Int(std::vector& buffer, int value) -{ - AppendStd140Value(buffer, 4, value); -} - -inline void AppendStd140Vec2(std::vector& buffer, float x, float y) -{ - const std::size_t offset = AlignStd140(buffer.size(), 8); - if (buffer.size() < offset + sizeof(float) * 2) - buffer.resize(offset + sizeof(float) * 2, 0); - float values[2] = { x, y }; - std::memcpy(buffer.data() + offset, values, sizeof(values)); -} - -inline void AppendStd140Vec4(std::vector& buffer, float x, float y, float z, float w) -{ - const std::size_t offset = AlignStd140(buffer.size(), 16); - if (buffer.size() < offset + sizeof(float) * 4) - buffer.resize(offset + sizeof(float) * 4, 0); - float values[4] = { x, y, z, w }; - std::memcpy(buffer.data() + offset, values, sizeof(values)); -} diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/shader/TextRasterizer.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/shader/TextRasterizer.cpp deleted file mode 100644 index 8f0535b..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/shader/TextRasterizer.cpp +++ /dev/null @@ -1,243 +0,0 @@ -#include "TextRasterizer.h" - -#include - -#include -#include -#include -#include -#include - -namespace -{ -constexpr int kTextSdfSpread = 20; -constexpr float kTextFontPixelSize = 144.0f; -constexpr float kTextLayoutPadding = 48.0f; -constexpr float kSdfInfinity = 1.0e20f; - -class GdiplusSession -{ -public: - GdiplusSession() - { - Gdiplus::GdiplusStartupInput startupInput; - mStarted = Gdiplus::GdiplusStartup(&mToken, &startupInput, NULL) == Gdiplus::Ok; - } - - ~GdiplusSession() - { - if (mStarted) - Gdiplus::GdiplusShutdown(mToken); - } - - GdiplusSession(const GdiplusSession&) = delete; - GdiplusSession& operator=(const GdiplusSession&) = delete; - - bool started() const { return mStarted; } - -private: - ULONG_PTR mToken = 0; - bool mStarted = false; -}; - -std::wstring Utf8ToWide(const std::string& text) -{ - if (text.empty()) - return std::wstring(); - const int required = MultiByteToWideChar(CP_UTF8, 0, text.c_str(), -1, NULL, 0); - if (required <= 1) - return std::wstring(); - std::wstring wide(static_cast(required - 1), L'\0'); - MultiByteToWideChar(CP_UTF8, 0, text.c_str(), -1, wide.data(), required); - return wide; -} - -void DistanceTransform1D(const std::vector& input, std::vector& output, unsigned count) -{ - std::vector locations(count, 0); - std::vector boundaries(static_cast(count) + 1, 0.0f); - - unsigned segment = 0; - locations[0] = 0; - boundaries[0] = -kSdfInfinity; - boundaries[1] = kSdfInfinity; - - for (unsigned q = 1; q < count; ++q) - { - float intersection = 0.0f; - for (;;) - { - const unsigned location = locations[segment]; - intersection = - ((input[q] + static_cast(q * q)) - (input[location] + static_cast(location * location))) / - (2.0f * static_cast(q) - 2.0f * static_cast(location)); - if (intersection > boundaries[segment] || segment == 0) - break; - --segment; - } - - ++segment; - locations[segment] = q; - boundaries[segment] = intersection; - boundaries[segment + 1] = kSdfInfinity; - } - - segment = 0; - for (unsigned q = 0; q < count; ++q) - { - while (boundaries[segment + 1] < static_cast(q)) - ++segment; - const unsigned location = locations[segment]; - const float delta = static_cast(q) - static_cast(location); - output[q] = delta * delta + input[location]; - } -} - -std::vector DistanceTransform2D(const std::vector& targetMask, unsigned width, unsigned height) -{ - std::vector rowInput(width, 0.0f); - std::vector rowOutput(width, 0.0f); - std::vector columnInput(height, 0.0f); - std::vector columnOutput(height, 0.0f); - std::vector rowDistance(static_cast(width) * height, 0.0f); - std::vector distance(static_cast(width) * height, 0.0f); - - for (unsigned y = 0; y < height; ++y) - { - for (unsigned x = 0; x < width; ++x) - rowInput[x] = targetMask[static_cast(y) * width + x] ? 0.0f : kSdfInfinity; - DistanceTransform1D(rowInput, rowOutput, width); - for (unsigned x = 0; x < width; ++x) - rowDistance[static_cast(y) * width + x] = rowOutput[x]; - } - - for (unsigned x = 0; x < width; ++x) - { - for (unsigned y = 0; y < height; ++y) - columnInput[y] = rowDistance[static_cast(y) * width + x]; - DistanceTransform1D(columnInput, columnOutput, height); - for (unsigned y = 0; y < height; ++y) - distance[static_cast(y) * width + x] = columnOutput[y]; - } - - return distance; -} - -std::vector BuildTextSdfTexture(const std::vector& alpha, unsigned width, unsigned height) -{ - std::vector insideMask(static_cast(width) * height, 0); - std::vector outsideMask(static_cast(width) * height, 0); - for (std::size_t index = 0; index < alpha.size(); ++index) - { - const bool inside = alpha[index] > 127; - insideMask[index] = inside ? 1 : 0; - outsideMask[index] = inside ? 0 : 1; - } - - const std::vector distanceToInside = DistanceTransform2D(insideMask, width, height); - const std::vector distanceToOutside = DistanceTransform2D(outsideMask, width, height); - std::vector sdf(static_cast(width) * height * 4, 0); - - for (unsigned y = 0; y < height; ++y) - { - const unsigned flippedY = height - 1 - y; - for (unsigned x = 0; x < width; ++x) - { - const std::size_t source = static_cast(y) * width + x; - const float signedDistance = std::sqrt(distanceToOutside[source]) - std::sqrt(distanceToInside[source]); - const float normalized = std::clamp( - 0.5f + signedDistance / static_cast(kTextSdfSpread * 2), - 0.0f, - 1.0f); - const unsigned char value = static_cast(normalized * 255.0f + 0.5f); - const std::size_t out = (static_cast(flippedY) * width + x) * 4; - sdf[out + 0] = value; - sdf[out + 1] = value; - sdf[out + 2] = value; - sdf[out + 3] = value; - } - } - - return sdf; -} - -} - -bool RasterizeTextSdf(const std::string& text, const std::filesystem::path& fontPath, std::vector& sdf, std::string& error) -{ - GdiplusSession gdiplus; - if (!gdiplus.started()) - { - error = "Could not start GDI+ for text rendering."; - return false; - } - - Gdiplus::PrivateFontCollection fontCollection; - Gdiplus::FontFamily fallbackFamily(L"Arial"); - Gdiplus::FontFamily* fontFamily = &fallbackFamily; - std::unique_ptr families; - const std::wstring wideFontPath = fontPath.empty() ? std::wstring() : fontPath.wstring(); - if (!wideFontPath.empty()) - { - if (fontCollection.AddFontFile(wideFontPath.c_str()) != Gdiplus::Ok) - { - error = "Could not load packaged font file for text rendering: " + fontPath.string(); - return false; - } - - const INT familyCount = fontCollection.GetFamilyCount(); - if (familyCount <= 0) - { - error = "Packaged font did not contain a usable font family: " + fontPath.string(); - return false; - } - - families.reset(new Gdiplus::FontFamily[familyCount]); - INT found = 0; - if (fontCollection.GetFamilies(familyCount, families.get(), &found) != Gdiplus::Ok || found <= 0) - { - error = "Could not read the packaged font family: " + fontPath.string(); - return false; - } - fontFamily = &families[0]; - } - - Gdiplus::Bitmap bitmap(kTextTextureWidth, kTextTextureHeight, PixelFormat32bppARGB); - Gdiplus::Graphics graphics(&bitmap); - graphics.SetCompositingMode(Gdiplus::CompositingModeSourceCopy); - graphics.Clear(Gdiplus::Color(255, 0, 0, 0)); - graphics.SetCompositingMode(Gdiplus::CompositingModeSourceOver); - graphics.SetTextRenderingHint(Gdiplus::TextRenderingHintAntiAlias); - graphics.SetSmoothingMode(Gdiplus::SmoothingModeHighQuality); - Gdiplus::Font font(fontFamily, kTextFontPixelSize, Gdiplus::FontStyleRegular, Gdiplus::UnitPixel); - Gdiplus::SolidBrush brush(Gdiplus::Color(255, 255, 255, 255)); - Gdiplus::StringFormat format; - format.SetAlignment(Gdiplus::StringAlignmentNear); - format.SetLineAlignment(Gdiplus::StringAlignmentCenter); - format.SetFormatFlags(Gdiplus::StringFormatFlagsNoWrap | Gdiplus::StringFormatFlagsMeasureTrailingSpaces); - const Gdiplus::RectF layout( - kTextLayoutPadding, - 0.0f, - static_cast(kTextTextureWidth) - (kTextLayoutPadding * 2.0f), - static_cast(kTextTextureHeight)); - const std::wstring wideText = Utf8ToWide(text); - graphics.DrawString(wideText.c_str(), -1, &font, layout, &format, &brush); - - std::vector alpha(static_cast(kTextTextureWidth) * kTextTextureHeight, 0); - for (unsigned y = 0; y < kTextTextureHeight; ++y) - { - for (unsigned x = 0; x < kTextTextureWidth; ++x) - { - Gdiplus::Color pixel; - bitmap.GetPixel(x, y, &pixel); - BYTE luminance = pixel.GetRed(); - if (pixel.GetGreen() > luminance) - luminance = pixel.GetGreen(); - if (pixel.GetBlue() > luminance) - luminance = pixel.GetBlue(); - alpha[static_cast(y) * kTextTextureWidth + x] = static_cast(luminance); - } - } - sdf = BuildTextSdfTexture(alpha, kTextTextureWidth, kTextTextureHeight); - return true; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/shader/TextRasterizer.h b/apps/LoopThroughWithOpenGLCompositing/gl/shader/TextRasterizer.h deleted file mode 100644 index 577ca67..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/shader/TextRasterizer.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#include -#include -#include - -constexpr unsigned kTextTextureWidth = 4096; -constexpr unsigned kTextTextureHeight = 512; - -bool RasterizeTextSdf(const std::string& text, const std::filesystem::path& fontPath, std::vector& sdf, std::string& error); diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/shader/TextureAssetLoader.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/shader/TextureAssetLoader.cpp deleted file mode 100644 index 08f26a2..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/shader/TextureAssetLoader.cpp +++ /dev/null @@ -1,222 +0,0 @@ -#include "TextureAssetLoader.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef GL_RGBA32F -#define GL_RGBA32F 0x8814 -#endif - -namespace -{ -std::string LowercaseExtension(const std::filesystem::path& path) -{ - std::string extension = path.extension().string(); - std::transform(extension.begin(), extension.end(), extension.begin(), - [](unsigned char value) { return static_cast(std::tolower(value)); }); - return extension; -} - -bool LoadCubeTextureAsset(const ShaderTextureAsset& textureAsset, GLuint& textureId, std::string& error) -{ - std::ifstream file(textureAsset.path); - if (!file) - { - error = "Could not open shader LUT asset: " + textureAsset.path.string(); - return false; - } - - unsigned lutSize = 0; - std::vector values; - std::string line; - while (std::getline(file, line)) - { - const std::size_t commentStart = line.find('#'); - if (commentStart != std::string::npos) - line.resize(commentStart); - - std::istringstream stream(line); - std::string firstToken; - if (!(stream >> firstToken)) - continue; - - if (firstToken == "TITLE" || firstToken == "DOMAIN_MIN" || firstToken == "DOMAIN_MAX") - continue; - if (firstToken == "LUT_3D_SIZE") - { - stream >> lutSize; - continue; - } - if (firstToken == "LUT_1D_SIZE") - { - error = "Only 3D .cube LUT assets are supported: " + textureAsset.path.string(); - return false; - } - - float red = 0.0f; - float green = 0.0f; - float blue = 0.0f; - try - { - red = std::stof(firstToken); - } - catch (...) - { - error = "Unsupported .cube directive in shader LUT asset: " + firstToken; - return false; - } - if (!(stream >> green >> blue)) - { - error = "Malformed RGB entry in shader LUT asset: " + textureAsset.path.string(); - return false; - } - values.push_back(red); - values.push_back(green); - values.push_back(blue); - values.push_back(1.0f); - } - - if (lutSize == 0) - { - error = "Shader LUT asset is missing LUT_3D_SIZE: " + textureAsset.path.string(); - return false; - } - - const std::size_t expectedFloats = static_cast(lutSize) * lutSize * lutSize * 4; - if (values.size() != expectedFloats) - { - error = "Shader LUT asset entry count does not match LUT_3D_SIZE: " + textureAsset.path.string(); - return false; - } - - const GLsizei atlasWidth = static_cast(lutSize * lutSize); - const GLsizei atlasHeight = static_cast(lutSize); - glGenTextures(1, &textureId); - glBindTexture(GL_TEXTURE_2D, textureId); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, atlasWidth, atlasHeight, 0, GL_RGBA, GL_FLOAT, values.data()); - glBindTexture(GL_TEXTURE_2D, 0); - return true; -} -} - -bool LoadTextureAsset(const ShaderTextureAsset& textureAsset, GLuint& textureId, std::string& error) -{ - textureId = 0; - if (LowercaseExtension(textureAsset.path) == ".cube") - return LoadCubeTextureAsset(textureAsset, textureId, error); - - HRESULT comInitResult = CoInitializeEx(NULL, COINIT_MULTITHREADED); - const bool shouldUninitializeCom = (comInitResult == S_OK || comInitResult == S_FALSE); - if (FAILED(comInitResult) && comInitResult != RPC_E_CHANGED_MODE) - { - error = "Could not initialize COM to load shader texture assets."; - return false; - } - - CComPtr imagingFactory; - HRESULT result = CoCreateInstance(CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&imagingFactory)); - if (FAILED(result) || !imagingFactory) - { - if (shouldUninitializeCom) - CoUninitialize(); - error = "Could not create a WIC imaging factory to load shader texture assets."; - return false; - } - - CComPtr bitmapDecoder; - result = imagingFactory->CreateDecoderFromFilename(textureAsset.path.wstring().c_str(), NULL, GENERIC_READ, WICDecodeMetadataCacheOnLoad, &bitmapDecoder); - if (FAILED(result) || !bitmapDecoder) - { - if (shouldUninitializeCom) - CoUninitialize(); - error = "Could not open shader texture asset: " + textureAsset.path.string(); - return false; - } - - CComPtr bitmapFrame; - result = bitmapDecoder->GetFrame(0, &bitmapFrame); - if (FAILED(result) || !bitmapFrame) - { - if (shouldUninitializeCom) - CoUninitialize(); - error = "Could not decode the first frame of shader texture asset: " + textureAsset.path.string(); - return false; - } - - CComPtr formatConverter; - result = imagingFactory->CreateFormatConverter(&formatConverter); - if (FAILED(result) || !formatConverter) - { - if (shouldUninitializeCom) - CoUninitialize(); - error = "Could not create a WIC format converter for shader texture asset: " + textureAsset.path.string(); - return false; - } - - result = formatConverter->Initialize(bitmapFrame, GUID_WICPixelFormat32bppBGRA, WICBitmapDitherTypeNone, NULL, 0.0, WICBitmapPaletteTypeCustom); - if (FAILED(result)) - { - if (shouldUninitializeCom) - CoUninitialize(); - error = "Could not convert shader texture asset to BGRA: " + textureAsset.path.string(); - return false; - } - - UINT width = 0; - UINT height = 0; - result = formatConverter->GetSize(&width, &height); - if (FAILED(result) || width == 0 || height == 0) - { - if (shouldUninitializeCom) - CoUninitialize(); - error = "Shader texture asset has an invalid size: " + textureAsset.path.string(); - return false; - } - - const UINT stride = width * 4; - std::vector pixels(static_cast(stride) * static_cast(height)); - result = formatConverter->CopyPixels(NULL, stride, static_cast(pixels.size()), pixels.data()); - if (FAILED(result)) - { - if (shouldUninitializeCom) - CoUninitialize(); - error = "Could not read shader texture pixels: " + textureAsset.path.string(); - return false; - } - - std::vector flippedPixels(pixels.size()); - for (UINT row = 0; row < height; ++row) - { - const std::size_t srcOffset = static_cast(row) * stride; - const std::size_t dstOffset = static_cast(height - 1 - row) * stride; - std::memcpy(flippedPixels.data() + dstOffset, pixels.data() + srcOffset, stride); - } - - glGenTextures(1, &textureId); - glBindTexture(GL_TEXTURE_2D, textureId); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, static_cast(width), static_cast(height), 0, GL_BGRA, GL_UNSIGNED_BYTE, flippedPixels.data()); - glBindTexture(GL_TEXTURE_2D, 0); - - if (shouldUninitializeCom) - CoUninitialize(); - - return true; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/shader/TextureAssetLoader.h b/apps/LoopThroughWithOpenGLCompositing/gl/shader/TextureAssetLoader.h deleted file mode 100644 index 5ad385c..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/shader/TextureAssetLoader.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once - -#include "GLExtensions.h" -#include "ShaderTypes.h" - -#include -#include - -#include - -bool LoadTextureAsset(const ShaderTextureAsset& textureAsset, GLuint& textureId, std::string& error); diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/threading/RenderCommandQueue.cpp b/apps/LoopThroughWithOpenGLCompositing/gl/threading/RenderCommandQueue.cpp deleted file mode 100644 index 68ad021..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/threading/RenderCommandQueue.cpp +++ /dev/null @@ -1,160 +0,0 @@ -#include "RenderCommandQueue.h" - -void RenderCommandQueue::RequestPreviewPresent(const RenderPreviewPresentRequest& request) -{ - std::lock_guard lock(mMutex); - if (mHasPreviewPresentRequest) - ++mCoalescedCount; - else - ++mEnqueuedCount; - - mPreviewPresentRequest = request; - mHasPreviewPresentRequest = true; -} - -bool RenderCommandQueue::TryTakePreviewPresent(RenderPreviewPresentRequest& request) -{ - std::lock_guard lock(mMutex); - if (!mHasPreviewPresentRequest) - return false; - - request = mPreviewPresentRequest; - mPreviewPresentRequest = {}; - mHasPreviewPresentRequest = false; - return true; -} - -void RenderCommandQueue::RequestScreenshotCapture(const RenderScreenshotCaptureRequest& request) -{ - std::lock_guard lock(mMutex); - if (mHasScreenshotCaptureRequest) - ++mCoalescedCount; - else - ++mEnqueuedCount; - - mScreenshotCaptureRequest = request; - mHasScreenshotCaptureRequest = true; -} - -bool RenderCommandQueue::TryTakeScreenshotCapture(RenderScreenshotCaptureRequest& request) -{ - std::lock_guard lock(mMutex); - if (!mHasScreenshotCaptureRequest) - return false; - - request = mScreenshotCaptureRequest; - mScreenshotCaptureRequest = {}; - mHasScreenshotCaptureRequest = false; - return true; -} - -void RenderCommandQueue::RequestInputUpload(const RenderInputUploadRequest& request) -{ - std::lock_guard lock(mMutex); - if (mHasInputUploadRequest) - ++mCoalescedCount; - else - ++mEnqueuedCount; - - mInputUploadRequest = request; - mHasInputUploadRequest = true; -} - -bool RenderCommandQueue::TryTakeInputUpload(RenderInputUploadRequest& request) -{ - std::lock_guard lock(mMutex); - if (!mHasInputUploadRequest) - return false; - - request = mInputUploadRequest; - mInputUploadRequest = {}; - mHasInputUploadRequest = false; - return true; -} - -void RenderCommandQueue::RequestOutputFrame(const RenderOutputFrameRequest& request) -{ - std::lock_guard lock(mMutex); - mOutputFrameRequests.push_back(request); - ++mEnqueuedCount; -} - -bool RenderCommandQueue::TryTakeOutputFrame(RenderOutputFrameRequest& request) -{ - std::lock_guard lock(mMutex); - if (mOutputFrameRequests.empty()) - return false; - - request = mOutputFrameRequests.front(); - mOutputFrameRequests.pop_front(); - return true; -} - -void RenderCommandQueue::RequestRenderReset(RenderCommandResetScope scope) -{ - if (scope == RenderCommandResetScope::None) - return; - - std::lock_guard lock(mMutex); - if (mRenderResetScope != RenderCommandResetScope::None) - ++mCoalescedCount; - else - ++mEnqueuedCount; - - mRenderResetScope = MergeResetScopes(mRenderResetScope, scope); -} - -bool RenderCommandQueue::TryTakeRenderReset(RenderCommandResetScope& scope) -{ - std::lock_guard lock(mMutex); - if (mRenderResetScope == RenderCommandResetScope::None) - return false; - - scope = mRenderResetScope; - mRenderResetScope = RenderCommandResetScope::None; - return true; -} - -RenderCommandQueueMetrics RenderCommandQueue::GetMetrics() const -{ - std::lock_guard lock(mMutex); - RenderCommandQueueMetrics metrics; - metrics.depth = - (mHasPreviewPresentRequest ? 1u : 0u) + - (mHasScreenshotCaptureRequest ? 1u : 0u) + - (mHasInputUploadRequest ? 1u : 0u) + - mOutputFrameRequests.size() + - (mRenderResetScope != RenderCommandResetScope::None ? 1u : 0u); - metrics.enqueuedCount = mEnqueuedCount; - metrics.coalescedCount = mCoalescedCount; - return metrics; -} - -RenderCommandResetScope RenderCommandQueue::MergeResetScopes(RenderCommandResetScope current, RenderCommandResetScope requested) -{ - if (current == RenderCommandResetScope::TemporalHistoryAndFeedback || - requested == RenderCommandResetScope::TemporalHistoryAndFeedback) - { - return RenderCommandResetScope::TemporalHistoryAndFeedback; - } - - if ((current == RenderCommandResetScope::TemporalHistoryOnly && requested == RenderCommandResetScope::ShaderFeedbackOnly) || - (current == RenderCommandResetScope::ShaderFeedbackOnly && requested == RenderCommandResetScope::TemporalHistoryOnly)) - { - return RenderCommandResetScope::TemporalHistoryAndFeedback; - } - - if (current == RenderCommandResetScope::TemporalHistoryOnly || - requested == RenderCommandResetScope::TemporalHistoryOnly) - { - return RenderCommandResetScope::TemporalHistoryOnly; - } - - if (current == RenderCommandResetScope::ShaderFeedbackOnly || - requested == RenderCommandResetScope::ShaderFeedbackOnly) - { - return RenderCommandResetScope::ShaderFeedbackOnly; - } - - return RenderCommandResetScope::None; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/gl/threading/RenderCommandQueue.h b/apps/LoopThroughWithOpenGLCompositing/gl/threading/RenderCommandQueue.h deleted file mode 100644 index 14af141..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/gl/threading/RenderCommandQueue.h +++ /dev/null @@ -1,85 +0,0 @@ -#pragma once - -#include "VideoIOTypes.h" - -#include -#include -#include -#include -#include - -enum class RenderCommandResetScope -{ - None, - ShaderFeedbackOnly, - TemporalHistoryOnly, - TemporalHistoryAndFeedback -}; - -struct RenderPreviewPresentRequest -{ - unsigned outputFrameWidth = 0; - unsigned outputFrameHeight = 0; -}; - -struct RenderScreenshotCaptureRequest -{ - unsigned width = 0; - unsigned height = 0; -}; - -struct RenderInputUploadRequest -{ - VideoIOFrame inputFrame; - VideoIOState videoState; - std::vector ownedBytes; -}; - -struct RenderOutputFrameRequest -{ - VideoIOState videoState; - VideoIOCompletion completion; -}; - -struct RenderCommandQueueMetrics -{ - std::size_t depth = 0; - uint64_t enqueuedCount = 0; - uint64_t coalescedCount = 0; -}; - -class RenderCommandQueue -{ -public: - void RequestPreviewPresent(const RenderPreviewPresentRequest& request); - bool TryTakePreviewPresent(RenderPreviewPresentRequest& request); - - void RequestScreenshotCapture(const RenderScreenshotCaptureRequest& request); - bool TryTakeScreenshotCapture(RenderScreenshotCaptureRequest& request); - - void RequestInputUpload(const RenderInputUploadRequest& request); - bool TryTakeInputUpload(RenderInputUploadRequest& request); - - void RequestOutputFrame(const RenderOutputFrameRequest& request); - bool TryTakeOutputFrame(RenderOutputFrameRequest& request); - - void RequestRenderReset(RenderCommandResetScope scope); - bool TryTakeRenderReset(RenderCommandResetScope& scope); - - RenderCommandQueueMetrics GetMetrics() const; - -private: - static RenderCommandResetScope MergeResetScopes(RenderCommandResetScope current, RenderCommandResetScope requested); - - mutable std::mutex mMutex; - bool mHasPreviewPresentRequest = false; - RenderPreviewPresentRequest mPreviewPresentRequest; - bool mHasScreenshotCaptureRequest = false; - RenderScreenshotCaptureRequest mScreenshotCaptureRequest; - bool mHasInputUploadRequest = false; - RenderInputUploadRequest mInputUploadRequest; - std::deque mOutputFrameRequests; - RenderCommandResetScope mRenderResetScope = RenderCommandResetScope::None; - uint64_t mEnqueuedCount = 0; - uint64_t mCoalescedCount = 0; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/platform/NativeHandles.h b/apps/LoopThroughWithOpenGLCompositing/platform/NativeHandles.h deleted file mode 100644 index 7a31d1d..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/platform/NativeHandles.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#include - -class UniqueHandle -{ -public: - explicit UniqueHandle(HANDLE handle = NULL) : mHandle(handle) {} - ~UniqueHandle() { reset(); } - - UniqueHandle(const UniqueHandle&) = delete; - UniqueHandle& operator=(const UniqueHandle&) = delete; - - UniqueHandle(UniqueHandle&& other) noexcept : mHandle(other.release()) {} - - UniqueHandle& operator=(UniqueHandle&& other) noexcept - { - if (this != &other) - reset(other.release()); - return *this; - } - - HANDLE get() const { return mHandle; } - bool valid() const { return mHandle != NULL && mHandle != INVALID_HANDLE_VALUE; } - - HANDLE release() - { - HANDLE handle = mHandle; - mHandle = NULL; - return handle; - } - - void reset(HANDLE handle = NULL) - { - if (valid()) - CloseHandle(mHandle); - mHandle = handle; - } - -private: - HANDLE mHandle; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/platform/NativeSockets.h b/apps/LoopThroughWithOpenGLCompositing/platform/NativeSockets.h deleted file mode 100644 index a9469a2..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/platform/NativeSockets.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#include - -class UniqueSocket -{ -public: - explicit UniqueSocket(SOCKET socket = INVALID_SOCKET) : mSocket(socket) {} - ~UniqueSocket() { reset(); } - - UniqueSocket(const UniqueSocket&) = delete; - UniqueSocket& operator=(const UniqueSocket&) = delete; - - UniqueSocket(UniqueSocket&& other) noexcept : mSocket(other.release()) {} - - UniqueSocket& operator=(UniqueSocket&& other) noexcept - { - if (this != &other) - reset(other.release()); - return *this; - } - - SOCKET get() const { return mSocket; } - bool valid() const { return mSocket != INVALID_SOCKET; } - - SOCKET release() - { - SOCKET socket = mSocket; - mSocket = INVALID_SOCKET; - return socket; - } - - void reset(SOCKET socket = INVALID_SOCKET) - { - if (valid()) - closesocket(mSocket); - mSocket = socket; - } - -private: - SOCKET mSocket; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/resource.h b/apps/LoopThroughWithOpenGLCompositing/resource.h deleted file mode 100644 index 6d8b8e9..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/resource.h +++ /dev/null @@ -1,24 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by LoopThroughWithOpenGLCompositing.rc -// -#define IDC_MYICON 2 -#define IDD_OPENGLOUTPUT_DIALOG 102 -#define IDS_APP_TITLE 103 -#define IDI_OPENGLOUTPUT 107 -#define IDI_SMALL 108 -#define IDC_OPENGLOUTPUT 109 -#define IDR_MAINFRAME 128 -#define IDC_STATIC -1 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NO_MFC 1 -#define _APS_NEXT_RESOURCE_VALUE 129 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 110 -#endif -#endif diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/coordination/RuntimeCoordinator.cpp b/apps/LoopThroughWithOpenGLCompositing/runtime/coordination/RuntimeCoordinator.cpp deleted file mode 100644 index 0ce8ad3..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/coordination/RuntimeCoordinator.cpp +++ /dev/null @@ -1,613 +0,0 @@ -#include "RuntimeCoordinator.h" - -#include "RuntimeEventDispatcher.h" -#include "RuntimeEventPayloads.h" -#include "RuntimeParameterUtils.h" -#include "RuntimeStore.h" - -namespace -{ -RuntimeEventRenderResetScope ToRuntimeEventRenderResetScope(RuntimeCoordinatorRenderResetScope scope) -{ - switch (scope) - { - case RuntimeCoordinatorRenderResetScope::TemporalHistoryOnly: - return RuntimeEventRenderResetScope::TemporalHistoryOnly; - case RuntimeCoordinatorRenderResetScope::TemporalHistoryAndFeedback: - return RuntimeEventRenderResetScope::TemporalHistoryAndFeedback; - case RuntimeCoordinatorRenderResetScope::None: - default: - return RuntimeEventRenderResetScope::None; - } -} -} - -RuntimeCoordinator::RuntimeCoordinator(RuntimeStore& runtimeStore, RuntimeEventDispatcher& runtimeEventDispatcher) : - mRuntimeStore(runtimeStore), - mRuntimeEventDispatcher(runtimeEventDispatcher) -{ -} - -RuntimeCoordinatorResult RuntimeCoordinator::AddLayer(const std::string& shaderId) -{ - std::lock_guard lock(mMutex); - std::string error; - if (!ValidateShaderExists(shaderId, error)) - { - RuntimeCoordinatorResult result = ApplyStoreMutation(false, error, false, false, false); - PublishCoordinatorResult("AddLayer", result); - return result; - } - - RuntimeCoordinatorResult result = ApplyStoreMutation(mRuntimeStore.CreateStoredLayer(shaderId, error), error, true, true, true); - PublishCoordinatorResult("AddLayer", result); - return result; -} - -RuntimeCoordinatorResult RuntimeCoordinator::RemoveLayer(const std::string& layerId) -{ - std::lock_guard lock(mMutex); - std::string error; - if (!ValidateLayerExists(layerId, error)) - { - RuntimeCoordinatorResult result = ApplyStoreMutation(false, error, false, false, false); - PublishCoordinatorResult("RemoveLayer", result); - return result; - } - - RuntimeCoordinatorResult result = ApplyStoreMutation(mRuntimeStore.DeleteStoredLayer(layerId, error), error, true, true, true); - if (result.accepted) - { - result.transientOscInvalidation = RuntimeCoordinatorTransientOscInvalidation::Layer; - result.transientOscLayerKey = layerId; - } - PublishCoordinatorResult("RemoveLayer", result); - return result; -} - -RuntimeCoordinatorResult RuntimeCoordinator::MoveLayer(const std::string& layerId, int direction) -{ - std::lock_guard lock(mMutex); - std::string error; - bool shouldMove = false; - if (!ResolveLayerMove(layerId, direction, shouldMove, error)) - { - RuntimeCoordinatorResult result = ApplyStoreMutation(false, error, false, false, false); - PublishCoordinatorResult("MoveLayer", result); - return result; - } - if (!shouldMove) - { - RuntimeCoordinatorResult result = BuildAcceptedNoReloadResult(); - return result; - } - - RuntimeCoordinatorResult result = ApplyStoreMutation(mRuntimeStore.MoveStoredLayer(layerId, direction, error), error, true, true, true); - PublishCoordinatorResult("MoveLayer", result); - return result; -} - -RuntimeCoordinatorResult RuntimeCoordinator::MoveLayerToIndex(const std::string& layerId, std::size_t targetIndex) -{ - std::lock_guard lock(mMutex); - std::string error; - bool shouldMove = false; - if (!ResolveLayerMoveToIndex(layerId, targetIndex, shouldMove, error)) - { - RuntimeCoordinatorResult result = ApplyStoreMutation(false, error, false, false, false); - PublishCoordinatorResult("MoveLayerToIndex", result); - return result; - } - if (!shouldMove) - { - RuntimeCoordinatorResult result = BuildAcceptedNoReloadResult(); - return result; - } - - RuntimeCoordinatorResult result = ApplyStoreMutation(mRuntimeStore.MoveStoredLayerToIndex(layerId, targetIndex, error), error, true, true, true); - PublishCoordinatorResult("MoveLayerToIndex", result); - return result; -} - -RuntimeCoordinatorResult RuntimeCoordinator::SetLayerBypass(const std::string& layerId, bool bypassed) -{ - std::lock_guard lock(mMutex); - std::string error; - if (!ValidateLayerExists(layerId, error)) - { - RuntimeCoordinatorResult result = ApplyStoreMutation(false, error, false, false, false); - PublishCoordinatorResult("SetLayerBypass", result); - return result; - } - - RuntimeCoordinatorResult result = ApplyStoreMutation(mRuntimeStore.SetStoredLayerBypassState(layerId, bypassed, error), error, true, false, true); - PublishCoordinatorResult("SetLayerBypass", result); - return result; -} - -RuntimeCoordinatorResult RuntimeCoordinator::SetLayerShader(const std::string& layerId, const std::string& shaderId) -{ - std::lock_guard lock(mMutex); - std::string error; - if (!ValidateLayerExists(layerId, error) || !ValidateShaderExists(shaderId, error)) - { - RuntimeCoordinatorResult result = ApplyStoreMutation(false, error, false, false, false); - PublishCoordinatorResult("SetLayerShader", result); - return result; - } - - RuntimeCoordinatorResult result = ApplyStoreMutation(mRuntimeStore.SetStoredLayerShaderSelection(layerId, shaderId, error), error, true, false, true); - PublishCoordinatorResult("SetLayerShader", result); - return result; -} - -RuntimeCoordinatorResult RuntimeCoordinator::UpdateLayerParameter(const std::string& layerId, const std::string& parameterId, const JsonValue& newValue) -{ - std::lock_guard lock(mMutex); - std::string error; - ResolvedParameterMutation mutation; - if (!BuildParameterMutationById(layerId, parameterId, newValue, true, mutation, error)) - { - RuntimeCoordinatorResult result = ApplyStoreMutation(false, error, false, false, false); - PublishCoordinatorResult("UpdateLayerParameter", result); - return result; - } - - RuntimeCoordinatorResult result = ApplyStoreMutation(mRuntimeStore.SetStoredParameterValue(mutation.layerId, mutation.parameterId, mutation.value, mutation.persistState, error), error, false, false, mutation.persistState); - PublishCoordinatorResult("UpdateLayerParameter", result); - return result; -} - -RuntimeCoordinatorResult RuntimeCoordinator::UpdateLayerParameterByControlKey(const std::string& layerKey, const std::string& parameterKey, const JsonValue& newValue) -{ - std::lock_guard lock(mMutex); - std::string error; - ResolvedParameterMutation mutation; - if (!BuildParameterMutationByControlKey(layerKey, parameterKey, newValue, true, mutation, error)) - { - RuntimeCoordinatorResult result = ApplyStoreMutation(false, error, false, false, false); - PublishCoordinatorResult("UpdateLayerParameterByControlKey", result); - return result; - } - - RuntimeCoordinatorResult result = ApplyStoreMutation(mRuntimeStore.SetStoredParameterValue(mutation.layerId, mutation.parameterId, mutation.value, mutation.persistState, error), error, false, false, mutation.persistState); - PublishCoordinatorResult("UpdateLayerParameterByControlKey", result); - return result; -} - -RuntimeCoordinatorResult RuntimeCoordinator::CommitOscParameterByControlKey(const std::string& layerKey, const std::string& parameterKey, const JsonValue& newValue) -{ - std::lock_guard lock(mMutex); - constexpr RuntimeCoordinatorOscCommitPersistence kDefaultOscCommitPersistence = - RuntimeCoordinatorOscCommitPersistence::SessionOnly; - constexpr bool kPersistSettledOscCommits = - kDefaultOscCommitPersistence == RuntimeCoordinatorOscCommitPersistence::Persistent; - - std::string error; - ResolvedParameterMutation mutation; - if (!BuildParameterMutationByControlKey(layerKey, parameterKey, newValue, kPersistSettledOscCommits, mutation, error)) - { - RuntimeCoordinatorResult result = ApplyStoreMutation(false, error, false, false, false); - PublishCoordinatorResult("CommitOscParameterByControlKey", result); - return result; - } - - RuntimeCoordinatorResult result = ApplyStoreMutation(mRuntimeStore.SetStoredParameterValue(mutation.layerId, mutation.parameterId, mutation.value, mutation.persistState, error), error, false, false, mutation.persistState); - PublishCoordinatorResult("CommitOscParameterByControlKey", result); - return result; -} - -RuntimeCoordinatorResult RuntimeCoordinator::ResetLayerParameters(const std::string& layerId) -{ - std::lock_guard lock(mMutex); - std::string error; - if (!ValidateLayerExists(layerId, error)) - { - RuntimeCoordinatorResult result = ApplyStoreMutation(false, error, false, false, false); - PublishCoordinatorResult("ResetLayerParameters", result); - return result; - } - - RuntimeCoordinatorResult result = ApplyStoreMutation(mRuntimeStore.ResetStoredLayerParameterValues(layerId, error), error, false, false, true); - if (!result.accepted) - { - PublishCoordinatorResult("ResetLayerParameters", result); - return result; - } - - result.transientOscInvalidation = RuntimeCoordinatorTransientOscInvalidation::Layer; - result.transientOscLayerKey = layerId; - result.renderResetScope = RuntimeCoordinatorRenderResetScope::TemporalHistoryAndFeedback; - PublishCoordinatorResult("ResetLayerParameters", result); - return result; -} - -RuntimeCoordinatorResult RuntimeCoordinator::SaveStackPreset(const std::string& presetName) -{ - std::lock_guard lock(mMutex); - std::string error; - if (!ValidatePresetName(presetName, error)) - { - RuntimeCoordinatorResult result = ApplyStoreMutation(false, error, false, false, false); - PublishCoordinatorResult("SaveStackPreset", result); - return result; - } - - RuntimeCoordinatorResult result = ApplyStoreMutation(mRuntimeStore.SaveStackPresetSnapshot(presetName, error), error, false, false, true); - PublishCoordinatorResult("SaveStackPreset", result); - return result; -} - -RuntimeCoordinatorResult RuntimeCoordinator::LoadStackPreset(const std::string& presetName) -{ - std::lock_guard lock(mMutex); - std::string error; - if (!ValidatePresetName(presetName, error)) - { - RuntimeCoordinatorResult result = ApplyStoreMutation(false, error, false, false, false); - PublishCoordinatorResult("LoadStackPreset", result); - return result; - } - - RuntimeCoordinatorResult result = ApplyStoreMutation(mRuntimeStore.LoadStackPresetSnapshot(presetName, error), error, true, false, true); - PublishCoordinatorResult("LoadStackPreset", result); - return result; -} - -RuntimeCoordinatorResult RuntimeCoordinator::RequestShaderReload(bool preserveFeedbackState) -{ - std::lock_guard lock(mMutex); - PublishManualReloadRequested(preserveFeedbackState, "RequestShaderReload"); - RuntimeCoordinatorResult result = BuildQueuedReloadResult(preserveFeedbackState); - PublishCoordinatorFollowUpEvents("RequestShaderReload", result); - return result; -} - -RuntimeCoordinatorResult RuntimeCoordinator::PollRuntimeStoreChanges(bool& registryChanged) -{ - std::lock_guard lock(mMutex); - - registryChanged = false; - bool reloadRequested = false; - std::string error; - if (!mRuntimeStore.PollStoredFileChanges(registryChanged, reloadRequested, error)) - { - RuntimeCoordinatorResult result = HandleRuntimePollFailure(error); - return result; - } - - if (reloadRequested) - { - PublishFileChangeDetected("PollRuntimeStoreChanges", registryChanged, reloadRequested); - RuntimeCoordinatorResult result = BuildQueuedReloadResult(false); - PublishCoordinatorFollowUpEvents("PollRuntimeStoreChanges", result); - return result; - } - - if (registryChanged) - { - PublishFileChangeDetected("PollRuntimeStoreChanges", registryChanged, reloadRequested); - RuntimeCoordinatorResult result = BuildAcceptedNoReloadResult(); - PublishCoordinatorFollowUpEvents("PollRuntimeStoreChanges", result); - return result; - } - - RuntimeCoordinatorResult result; - result.accepted = true; - return result; -} - -RuntimeCoordinatorResult RuntimeCoordinator::HandleRuntimePollFailure(const std::string& error) -{ - RuntimeCoordinatorResult result; - result.accepted = true; - result.runtimeStateBroadcastRequired = true; - result.compileStatusChanged = true; - result.compileStatusSucceeded = false; - result.compileStatusMessage = error; - PublishCoordinatorFollowUpEvents("HandleRuntimePollFailure", result); - return result; -} - -RuntimeCoordinatorResult RuntimeCoordinator::HandlePreparedShaderBuildFailure(const std::string& error) -{ - std::lock_guard lock(mMutex); - mPreserveFeedbackOnNextShaderBuild = false; - mUseCommittedLayerStates = true; - - RuntimeCoordinatorResult result; - result.accepted = true; - result.runtimeStateBroadcastRequired = true; - result.compileStatusChanged = true; - result.compileStatusSucceeded = false; - result.compileStatusMessage = error; - result.committedStateMode = RuntimeCoordinatorCommittedStateMode::UseCommittedStates; - PublishCoordinatorFollowUpEvents("HandlePreparedShaderBuildFailure", result); - return result; -} - -RuntimeCoordinatorResult RuntimeCoordinator::HandlePreparedShaderBuildSuccess() -{ - std::lock_guard lock(mMutex); - mUseCommittedLayerStates = false; - - RuntimeCoordinatorResult result; - result.accepted = true; - result.runtimeStateBroadcastRequired = true; - result.compileStatusChanged = true; - result.compileStatusSucceeded = true; - result.compileStatusMessage = "Shader layers compiled successfully."; - result.committedStateMode = RuntimeCoordinatorCommittedStateMode::UseLiveSnapshots; - mPreserveFeedbackOnNextShaderBuild = false; - PublishCoordinatorFollowUpEvents("HandlePreparedShaderBuildSuccess", result); - return result; -} - -RuntimeCoordinatorResult RuntimeCoordinator::HandleRuntimeReloadRequest() -{ - std::lock_guard lock(mMutex); - PublishManualReloadRequested(false, "HandleRuntimeReloadRequest"); - RuntimeCoordinatorResult result = BuildQueuedReloadResult(false); - PublishCoordinatorFollowUpEvents("HandleRuntimeReloadRequest", result); - return result; -} - -void RuntimeCoordinator::ApplyCommittedStateMode(RuntimeCoordinatorCommittedStateMode mode) -{ - std::lock_guard lock(mMutex); - switch (mode) - { - case RuntimeCoordinatorCommittedStateMode::UseCommittedStates: - mUseCommittedLayerStates = true; - break; - case RuntimeCoordinatorCommittedStateMode::UseLiveSnapshots: - mUseCommittedLayerStates = false; - break; - case RuntimeCoordinatorCommittedStateMode::Unchanged: - default: - break; - } -} - -bool RuntimeCoordinator::UseCommittedLayerStates() const -{ - return mUseCommittedLayerStates.load(); -} - -bool RuntimeCoordinator::PreserveFeedbackOnNextShaderBuild() const -{ - std::lock_guard lock(mMutex); - return mPreserveFeedbackOnNextShaderBuild; -} - -bool RuntimeCoordinator::BuildParameterMutationById(const std::string& layerId, const std::string& parameterId, const JsonValue& newValue, - bool persistState, ResolvedParameterMutation& mutation, std::string& error) const -{ - RuntimeStore::StoredParameterSnapshot snapshot; - if (!mRuntimeStore.TryGetStoredParameterById(layerId, parameterId, snapshot, error)) - return false; - - return BuildParameterMutationFromSnapshot(snapshot.layerId, snapshot.definition, snapshot.currentValue, snapshot.hasCurrentValue, - newValue, persistState, mutation, error); -} - -bool RuntimeCoordinator::BuildParameterMutationByControlKey(const std::string& layerKey, const std::string& parameterKey, const JsonValue& newValue, - bool persistState, ResolvedParameterMutation& mutation, std::string& error) const -{ - RuntimeStore::StoredParameterSnapshot snapshot; - if (!mRuntimeStore.TryGetStoredParameterByControlKey(layerKey, parameterKey, snapshot, error)) - return false; - - return BuildParameterMutationFromSnapshot(snapshot.layerId, snapshot.definition, snapshot.currentValue, snapshot.hasCurrentValue, - newValue, persistState, mutation, error); -} - -bool RuntimeCoordinator::BuildParameterMutationFromSnapshot(const std::string& layerId, const ShaderParameterDefinition& definition, - const ShaderParameterValue& currentValue, bool hasCurrentValue, const JsonValue& newValue, - bool persistState, ResolvedParameterMutation& mutation, std::string& error) const -{ - mutation.layerId = layerId; - mutation.parameterId = definition.id; - mutation.persistState = persistState; - - if (definition.type == ShaderParameterType::Trigger) - { - const double previousCount = !hasCurrentValue || currentValue.numberValues.empty() - ? 0.0 - : currentValue.numberValues[0]; - const double triggerTime = mRuntimeStore.GetRuntimeElapsedSeconds(); - mutation.value.numberValues = { previousCount + 1.0, triggerTime }; - mutation.persistState = false; - return true; - } - - return NormalizeAndValidateParameterValue(definition, newValue, mutation.value, error); -} - -bool RuntimeCoordinator::ValidateLayerExists(const std::string& layerId, std::string& error) const -{ - if (mRuntimeStore.HasStoredLayer(layerId)) - return true; - - error = "Unknown layer id: " + layerId; - return false; -} - -bool RuntimeCoordinator::ValidateShaderExists(const std::string& shaderId, std::string& error) const -{ - if (mRuntimeStore.HasStoredShader(shaderId)) - return true; - - error = "Unknown shader id: " + shaderId; - return false; -} - -bool RuntimeCoordinator::ResolveLayerMove(const std::string& layerId, int direction, bool& shouldMove, std::string& error) const -{ - return mRuntimeStore.ResolveStoredLayerMove(layerId, direction, shouldMove, error); -} - -bool RuntimeCoordinator::ResolveLayerMoveToIndex(const std::string& layerId, std::size_t targetIndex, bool& shouldMove, std::string& error) const -{ - return mRuntimeStore.ResolveStoredLayerMoveToIndex(layerId, targetIndex, shouldMove, error); -} - -bool RuntimeCoordinator::ValidatePresetName(const std::string& presetName, std::string& error) const -{ - if (mRuntimeStore.IsValidStackPresetName(presetName)) - return true; - - error = "Preset name must include at least one letter or number."; - return false; -} - -RuntimeCoordinatorResult RuntimeCoordinator::ApplyStoreMutation(bool succeeded, const std::string& errorMessage, bool reloadRequired, bool preserveFeedbackState, bool persistenceRequested) -{ - if (!succeeded) - { - RuntimeCoordinatorResult result; - result.accepted = false; - result.errorMessage = errorMessage; - return result; - } - - if (reloadRequired) - { - RuntimeCoordinatorResult result = BuildQueuedReloadResult(preserveFeedbackState); - result.persistenceRequested = persistenceRequested; - return result; - } - - RuntimeCoordinatorResult result = BuildAcceptedNoReloadResult(); - result.persistenceRequested = persistenceRequested; - return result; -} - -RuntimeCoordinatorResult RuntimeCoordinator::BuildQueuedReloadResult(bool preserveFeedbackState) -{ - mPreserveFeedbackOnNextShaderBuild = preserveFeedbackState; - mUseCommittedLayerStates = true; - - RuntimeCoordinatorResult result; - result.accepted = true; - result.runtimeStateBroadcastRequired = true; - result.shaderBuildRequested = true; - result.compileStatusChanged = true; - result.compileStatusSucceeded = true; - result.compileStatusMessage = "Shader rebuild queued."; - result.clearReloadRequest = true; - result.committedStateMode = RuntimeCoordinatorCommittedStateMode::UseCommittedStates; - return result; -} - -RuntimeCoordinatorResult RuntimeCoordinator::BuildAcceptedNoReloadResult() const -{ - RuntimeCoordinatorResult result; - result.accepted = true; - result.runtimeStateBroadcastRequired = true; - return result; -} - -void RuntimeCoordinator::PublishFileChangeDetected(const std::string& reason, bool registryChanged, bool reloadRequested) const -{ - try - { - FileChangeDetectedEvent event; - event.path = reason; - event.shaderPackageCandidate = registryChanged || reloadRequested; - event.runtimeConfigCandidate = false; - event.presetCandidate = false; - mRuntimeEventDispatcher.PublishPayload(event, "RuntimeCoordinator"); - } - catch (...) - { - } -} - -void RuntimeCoordinator::PublishManualReloadRequested(bool preserveFeedbackState, const std::string& reason) const -{ - try - { - ManualReloadRequestedEvent event; - event.preserveFeedbackState = preserveFeedbackState; - event.reason = reason; - mRuntimeEventDispatcher.PublishPayload(event, "RuntimeCoordinator"); - } - catch (...) - { - } -} - -void RuntimeCoordinator::PublishCoordinatorResult(const std::string& action, const RuntimeCoordinatorResult& result) const -{ - try - { - RuntimeMutationEvent mutation; - mutation.action = action; - mutation.accepted = result.accepted; - mutation.runtimeStateChanged = result.accepted && result.runtimeStateBroadcastRequired; - mutation.runtimeStateBroadcastRequired = result.runtimeStateBroadcastRequired; - mutation.shaderBuildRequested = result.shaderBuildRequested; - mutation.persistenceRequested = result.persistenceRequested; - mutation.clearTransientOscState = result.transientOscInvalidation != RuntimeCoordinatorTransientOscInvalidation::None; - mutation.renderResetScope = ToRuntimeEventRenderResetScope(result.renderResetScope); - mutation.errorMessage = result.errorMessage; - mRuntimeEventDispatcher.PublishPayload(mutation, "RuntimeCoordinator"); - - PublishCoordinatorFollowUpEvents(action, result); - } - catch (...) - { - } -} - -void RuntimeCoordinator::PublishCoordinatorFollowUpEvents(const std::string& action, const RuntimeCoordinatorResult& result) const -{ - try - { - if (!result.accepted) - return; - - if (result.runtimeStateBroadcastRequired) - { - RuntimeStateChangedEvent stateChanged; - stateChanged.reason = action; - stateChanged.renderVisible = result.renderResetScope != RuntimeCoordinatorRenderResetScope::None; - stateChanged.persistenceRequested = result.persistenceRequested; - mRuntimeEventDispatcher.PublishPayload(stateChanged, "RuntimeCoordinator"); - } - - if (result.persistenceRequested) - { - RuntimePersistenceRequestedEvent persistenceRequested; - persistenceRequested.request = PersistenceRequest::RuntimeStateRequest(action); - mRuntimeEventDispatcher.PublishPayload(persistenceRequested, "RuntimeCoordinator"); - } - - if (result.shaderBuildRequested) - { - RuntimeReloadRequestedEvent reloadRequested; - reloadRequested.preserveFeedbackState = mPreserveFeedbackOnNextShaderBuild; - reloadRequested.reason = action; - mRuntimeEventDispatcher.PublishPayload(reloadRequested, "RuntimeCoordinator"); - - ShaderBuildEvent shaderBuild; - shaderBuild.phase = RuntimeEventShaderBuildPhase::Requested; - shaderBuild.preserveFeedbackState = mPreserveFeedbackOnNextShaderBuild; - shaderBuild.succeeded = true; - shaderBuild.message = result.compileStatusMessage; - mRuntimeEventDispatcher.PublishPayload(shaderBuild, "RuntimeCoordinator"); - } - - if (result.compileStatusChanged) - { - CompileStatusChangedEvent compileStatus; - compileStatus.succeeded = result.compileStatusSucceeded; - compileStatus.message = result.compileStatusMessage; - mRuntimeEventDispatcher.PublishPayload(compileStatus, "RuntimeCoordinator"); - } - } - catch (...) - { - } -} diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/coordination/RuntimeCoordinator.h b/apps/LoopThroughWithOpenGLCompositing/runtime/coordination/RuntimeCoordinator.h deleted file mode 100644 index d5af51e..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/coordination/RuntimeCoordinator.h +++ /dev/null @@ -1,120 +0,0 @@ -#pragma once - -#include "RuntimeJson.h" -#include "ShaderTypes.h" - -#include -#include -#include -#include - -class RuntimeStore; -class RuntimeEventDispatcher; - -enum class RuntimeCoordinatorCommittedStateMode -{ - Unchanged, - UseCommittedStates, - UseLiveSnapshots -}; - -enum class RuntimeCoordinatorRenderResetScope -{ - None, - TemporalHistoryOnly, - TemporalHistoryAndFeedback -}; - -enum class RuntimeCoordinatorTransientOscInvalidation -{ - None, - Layer, - All -}; - -enum class RuntimeCoordinatorOscCommitPersistence -{ - SessionOnly, - Persistent -}; - -struct RuntimeCoordinatorResult -{ - bool accepted = false; - bool runtimeStateBroadcastRequired = false; - bool shaderBuildRequested = false; - bool persistenceRequested = false; - bool compileStatusChanged = false; - bool compileStatusSucceeded = false; - bool clearReloadRequest = false; - RuntimeCoordinatorCommittedStateMode committedStateMode = RuntimeCoordinatorCommittedStateMode::Unchanged; - RuntimeCoordinatorRenderResetScope renderResetScope = RuntimeCoordinatorRenderResetScope::None; - RuntimeCoordinatorTransientOscInvalidation transientOscInvalidation = RuntimeCoordinatorTransientOscInvalidation::None; - std::string transientOscLayerKey; - std::string compileStatusMessage; - std::string errorMessage; -}; - -class RuntimeCoordinator -{ -public: - RuntimeCoordinator(RuntimeStore& runtimeStore, RuntimeEventDispatcher& runtimeEventDispatcher); - - RuntimeCoordinatorResult AddLayer(const std::string& shaderId); - RuntimeCoordinatorResult RemoveLayer(const std::string& layerId); - RuntimeCoordinatorResult MoveLayer(const std::string& layerId, int direction); - RuntimeCoordinatorResult MoveLayerToIndex(const std::string& layerId, std::size_t targetIndex); - RuntimeCoordinatorResult SetLayerBypass(const std::string& layerId, bool bypassed); - RuntimeCoordinatorResult SetLayerShader(const std::string& layerId, const std::string& shaderId); - RuntimeCoordinatorResult UpdateLayerParameter(const std::string& layerId, const std::string& parameterId, const JsonValue& newValue); - RuntimeCoordinatorResult UpdateLayerParameterByControlKey(const std::string& layerKey, const std::string& parameterKey, const JsonValue& newValue); - RuntimeCoordinatorResult CommitOscParameterByControlKey(const std::string& layerKey, const std::string& parameterKey, const JsonValue& newValue); - RuntimeCoordinatorResult ResetLayerParameters(const std::string& layerId); - RuntimeCoordinatorResult SaveStackPreset(const std::string& presetName); - RuntimeCoordinatorResult LoadStackPreset(const std::string& presetName); - - RuntimeCoordinatorResult RequestShaderReload(bool preserveFeedbackState = false); - RuntimeCoordinatorResult PollRuntimeStoreChanges(bool& registryChanged); - RuntimeCoordinatorResult HandleRuntimePollFailure(const std::string& error); - RuntimeCoordinatorResult HandlePreparedShaderBuildFailure(const std::string& error); - RuntimeCoordinatorResult HandlePreparedShaderBuildSuccess(); - RuntimeCoordinatorResult HandleRuntimeReloadRequest(); - void ApplyCommittedStateMode(RuntimeCoordinatorCommittedStateMode mode); - bool UseCommittedLayerStates() const; - bool PreserveFeedbackOnNextShaderBuild() const; - -private: - struct ResolvedParameterMutation - { - std::string layerId; - std::string parameterId; - ShaderParameterValue value; - bool persistState = true; - }; - - bool BuildParameterMutationById(const std::string& layerId, const std::string& parameterId, const JsonValue& newValue, - bool persistState, ResolvedParameterMutation& mutation, std::string& error) const; - bool BuildParameterMutationByControlKey(const std::string& layerKey, const std::string& parameterKey, const JsonValue& newValue, - bool persistState, ResolvedParameterMutation& mutation, std::string& error) const; - bool BuildParameterMutationFromSnapshot(const std::string& layerId, const ShaderParameterDefinition& definition, - const ShaderParameterValue& currentValue, bool hasCurrentValue, const JsonValue& newValue, - bool persistState, ResolvedParameterMutation& mutation, std::string& error) const; - bool ValidateLayerExists(const std::string& layerId, std::string& error) const; - bool ValidateShaderExists(const std::string& shaderId, std::string& error) const; - bool ResolveLayerMove(const std::string& layerId, int direction, bool& shouldMove, std::string& error) const; - bool ResolveLayerMoveToIndex(const std::string& layerId, std::size_t targetIndex, bool& shouldMove, std::string& error) const; - bool ValidatePresetName(const std::string& presetName, std::string& error) const; - RuntimeCoordinatorResult ApplyStoreMutation(bool succeeded, const std::string& errorMessage, bool reloadRequired, bool preserveFeedbackState, bool persistenceRequested); - RuntimeCoordinatorResult BuildQueuedReloadResult(bool preserveFeedbackState); - RuntimeCoordinatorResult BuildAcceptedNoReloadResult() const; - void PublishFileChangeDetected(const std::string& reason, bool registryChanged, bool reloadRequested) const; - void PublishManualReloadRequested(bool preserveFeedbackState, const std::string& reason) const; - void PublishCoordinatorResult(const std::string& action, const RuntimeCoordinatorResult& result) const; - void PublishCoordinatorFollowUpEvents(const std::string& action, const RuntimeCoordinatorResult& result) const; - - RuntimeStore& mRuntimeStore; - RuntimeEventDispatcher& mRuntimeEventDispatcher; - mutable std::mutex mMutex; - bool mPreserveFeedbackOnNextShaderBuild = false; - std::atomic mUseCommittedLayerStates{ false }; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/events/RuntimeEvent.h b/apps/LoopThroughWithOpenGLCompositing/runtime/events/RuntimeEvent.h deleted file mode 100644 index 53430f4..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/events/RuntimeEvent.h +++ /dev/null @@ -1,87 +0,0 @@ -#pragma once - -#include "RuntimeEventPayloads.h" - -#include -#include -#include -#include -#include -#include - -using RuntimeEventPayload = std::variant< - std::monostate, - OscValueReceivedEvent, - OscValueCoalescedEvent, - OscCommitRequestedEvent, - HttpControlMutationRequestedEvent, - WebSocketClientConnectedEvent, - RuntimeStateBroadcastRequestedEvent, - FileChangeDetectedEvent, - ManualReloadRequestedEvent, - RuntimeMutationEvent, - RuntimeStateChangedEvent, - RuntimePersistenceRequestedEvent, - RuntimeReloadRequestedEvent, - ShaderPackagesChangedEvent, - RenderSnapshotPublishRequestedEvent, - RuntimeStatePresentationChangedEvent, - ShaderBuildEvent, - CompileStatusChangedEvent, - RenderSnapshotPublishedEvent, - RenderResetEvent, - OscOverlayEvent, - FrameRenderedEvent, - PreviewFrameAvailableEvent, - InputSignalChangedEvent, - InputFrameArrivedEvent, - OutputFrameScheduledEvent, - OutputFrameCompletedEvent, - BackendStateChangedEvent, - SubsystemWarningEvent, - SubsystemRecoveredEvent, - TimingSampleRecordedEvent, - QueueDepthChangedEvent>; - -inline RuntimeEventType RuntimeEventPayloadType(const RuntimeEventPayload& payload) -{ - return std::visit([](const auto& value) -> RuntimeEventType { - using PayloadType = std::decay_t; - if constexpr (std::is_same_v) - return RuntimeEventType::Unknown; - else - return RuntimeEventPayloadType(value); - }, payload); -} - -struct RuntimeEvent -{ - RuntimeEventType type = RuntimeEventType::Unknown; - uint64_t sequence = 0; - std::chrono::steady_clock::time_point createdAt = std::chrono::steady_clock::now(); - std::string source; - RuntimeEventPayload payload; - - bool HasPayload() const - { - return !std::holds_alternative(payload); - } - - bool PayloadMatchesType() const - { - return RuntimeEventPayloadType(payload) == type; - } -}; - -template -RuntimeEvent MakeRuntimeEvent(Payload payload, std::string source = {}, uint64_t sequence = 0, - std::chrono::steady_clock::time_point createdAt = std::chrono::steady_clock::now()) -{ - RuntimeEvent event; - event.type = RuntimeEventPayloadType(payload); - event.sequence = sequence; - event.createdAt = createdAt; - event.source = std::move(source); - event.payload = std::move(payload); - return event; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/events/RuntimeEventCoalescingQueue.h b/apps/LoopThroughWithOpenGLCompositing/runtime/events/RuntimeEventCoalescingQueue.h deleted file mode 100644 index 47cbfa3..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/events/RuntimeEventCoalescingQueue.h +++ /dev/null @@ -1,158 +0,0 @@ -#pragma once - -#include "RuntimeEvent.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct RuntimeEventCoalescingQueueMetrics -{ - std::size_t depth = 0; - std::size_t capacity = 0; - std::size_t droppedCount = 0; - std::size_t coalescedCount = 0; - double oldestEventAgeMilliseconds = 0.0; -}; - -inline std::string RuntimeEventDefaultCoalescingKey(const RuntimeEvent& event) -{ - if (const auto* payload = std::get_if(&event.payload)) - return std::string(RuntimeEventTypeName(event.type)) + ":" + payload->routeKey; - if (const auto* payload = std::get_if(&event.payload)) - return std::string(RuntimeEventTypeName(event.type)) + ":" + payload->routeKey; - if (const auto* payload = std::get_if(&event.payload)) - return std::string(RuntimeEventTypeName(event.type)) + ":" + payload->path; - if (const auto* payload = std::get_if(&event.payload)) - return std::string(RuntimeEventTypeName(event.type)) + ":" + - std::to_string(payload->inputWidth) + "x" + - std::to_string(payload->inputHeight) + ":" + - (payload->preserveFeedbackState ? "preserve" : "reset"); - if (const auto* payload = std::get_if(&event.payload)) - return std::string(RuntimeEventTypeName(event.type)) + ":" + - std::to_string(payload->outputWidth) + "x" + - std::to_string(payload->outputHeight); - if (const auto* payload = std::get_if(&event.payload)) - return std::string(RuntimeEventTypeName(event.type)) + ":" + payload->subsystem + ":" + payload->metric; - if (const auto* payload = std::get_if(&event.payload)) - return std::string(RuntimeEventTypeName(event.type)) + ":" + payload->queueName; - - return std::string(RuntimeEventTypeName(event.type)); -} - -class RuntimeEventCoalescingQueue -{ -public: - using KeySelector = std::function; - - explicit RuntimeEventCoalescingQueue(std::size_t capacity = 256, KeySelector keySelector = RuntimeEventDefaultCoalescingKey) : - mCapacity(capacity), - mKeySelector(std::move(keySelector)) - { - } - - bool Push(RuntimeEvent event) - { - const std::string key = mKeySelector(event); - if (key.empty()) - return false; - - std::lock_guard lock(mMutex); - auto found = mEntries.find(key); - if (found != mEntries.end()) - { - const auto firstCreatedAt = found->second.event.createdAt; - found->second.event = std::move(event); - found->second.event.createdAt = firstCreatedAt; - ++found->second.coalescedCount; - ++mCoalescedCount; - return true; - } - - if (mEntries.size() >= mCapacity) - { - ++mDroppedCount; - return false; - } - - mOrder.push_back(key); - Entry entry; - entry.event = std::move(event); - mEntries.emplace(key, std::move(entry)); - return true; - } - - std::vector Drain(std::size_t maxEvents = 0) - { - std::vector events; - - std::lock_guard lock(mMutex); - const std::size_t count = maxEvents == 0 || maxEvents > mOrder.size() ? mOrder.size() : maxEvents; - events.reserve(count); - - for (std::size_t index = 0; index < count; ++index) - { - const std::string key = std::move(mOrder.front()); - mOrder.pop_front(); - - auto found = mEntries.find(key); - if (found == mEntries.end()) - continue; - - events.push_back(std::move(found->second.event)); - mEntries.erase(found); - } - - return events; - } - - RuntimeEventCoalescingQueueMetrics GetMetrics(std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now()) const - { - std::lock_guard lock(mMutex); - - RuntimeEventCoalescingQueueMetrics metrics; - metrics.depth = mEntries.size(); - metrics.capacity = mCapacity; - metrics.droppedCount = mDroppedCount; - metrics.coalescedCount = mCoalescedCount; - - if (!mOrder.empty()) - { - const auto found = mEntries.find(mOrder.front()); - if (found != mEntries.end()) - { - const auto age = now - found->second.event.createdAt; - metrics.oldestEventAgeMilliseconds = std::chrono::duration(age).count(); - } - } - - return metrics; - } - - std::size_t Depth() const - { - std::lock_guard lock(mMutex); - return mEntries.size(); - } - -private: - struct Entry - { - RuntimeEvent event; - std::size_t coalescedCount = 0; - }; - - mutable std::mutex mMutex; - std::size_t mCapacity = 0; - KeySelector mKeySelector; - std::deque mOrder; - std::map mEntries; - std::size_t mDroppedCount = 0; - std::size_t mCoalescedCount = 0; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/events/RuntimeEventDispatcher.h b/apps/LoopThroughWithOpenGLCompositing/runtime/events/RuntimeEventDispatcher.h deleted file mode 100644 index e85e394..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/events/RuntimeEventDispatcher.h +++ /dev/null @@ -1,170 +0,0 @@ -#pragma once - -#include "RuntimeEventCoalescingQueue.h" -#include "RuntimeEventQueue.h" - -#include -#include -#include -#include -#include -#include - -struct RuntimeEventDispatchResult -{ - std::size_t dispatchedEvents = 0; - std::size_t handlerInvocations = 0; - std::size_t handlerFailures = 0; - double dispatchDurationMilliseconds = 0.0; -}; - -class RuntimeEventDispatcher -{ -public: - using Handler = std::function; - - explicit RuntimeEventDispatcher(std::size_t queueCapacity = 1024) : - mQueue(queueCapacity), - mCoalescingQueue(queueCapacity) - { - } - - bool Publish(RuntimeEvent event) - { - if (!event.PayloadMatchesType()) - return false; - - if (event.sequence == 0) - event.sequence = mNextSequence.fetch_add(1); - - if (ShouldCoalesce(event)) - return mCoalescingQueue.Push(std::move(event)); - - return mQueue.Push(std::move(event)); - } - - template - bool PublishPayload(Payload payload, std::string source = {}) - { - return Publish(MakeRuntimeEvent(std::move(payload), std::move(source))); - } - - void Subscribe(RuntimeEventType type, Handler handler) - { - std::lock_guard lock(mHandlerMutex); - mHandlers[type].push_back(std::move(handler)); - } - - void SubscribeAll(Handler handler) - { - std::lock_guard lock(mHandlerMutex); - mAllHandlers.push_back(std::move(handler)); - } - - RuntimeEventDispatchResult DispatchPending(std::size_t maxEvents = 0) - { - const auto startedAt = std::chrono::steady_clock::now(); - RuntimeEventDispatchResult result; - FlushCoalescedToFifo(maxEvents); - std::vector events = mQueue.Drain(maxEvents); - result.dispatchedEvents = events.size(); - - for (const RuntimeEvent& event : events) - { - std::vector handlers = HandlersFor(event.type); - result.handlerInvocations += handlers.size(); - - for (const Handler& handler : handlers) - { - try - { - handler(event); - } - catch (...) - { - ++result.handlerFailures; - } - } - } - - result.dispatchDurationMilliseconds = - std::chrono::duration(std::chrono::steady_clock::now() - startedAt).count(); - return result; - } - - bool TryPop(RuntimeEvent& event) - { - return mQueue.TryPop(event); - } - - RuntimeEventQueueMetrics GetQueueMetrics(std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now()) const - { - RuntimeEventQueueMetrics metrics = mQueue.GetMetrics(now); - const RuntimeEventCoalescingQueueMetrics coalescingMetrics = mCoalescingQueue.GetMetrics(now); - if (metrics.depth == 0) - metrics.oldestEventAgeMilliseconds = coalescingMetrics.oldestEventAgeMilliseconds; - else if (coalescingMetrics.depth > 0) - metrics.oldestEventAgeMilliseconds = (std::max)(metrics.oldestEventAgeMilliseconds, coalescingMetrics.oldestEventAgeMilliseconds); - metrics.depth += coalescingMetrics.depth; - metrics.capacity += coalescingMetrics.capacity; - metrics.droppedCount += coalescingMetrics.droppedCount; - metrics.coalescedCount = coalescingMetrics.coalescedCount; - return metrics; - } - - std::size_t QueueDepth() const - { - return mQueue.Depth() + mCoalescingQueue.Depth(); - } - -private: - static bool ShouldCoalesce(const RuntimeEvent& event) - { - switch (event.type) - { - case RuntimeEventType::OscValueReceived: - case RuntimeEventType::OscCommitRequested: - case RuntimeEventType::RuntimeStateBroadcastRequested: - case RuntimeEventType::FileChangeDetected: - case RuntimeEventType::RuntimeReloadRequested: - case RuntimeEventType::ShaderBuildRequested: - case RuntimeEventType::RenderSnapshotPublishRequested: - case RuntimeEventType::TimingSampleRecorded: - case RuntimeEventType::QueueDepthChanged: - return true; - default: - return false; - } - } - - void FlushCoalescedToFifo(std::size_t maxEvents) - { - const std::size_t fifoDepth = mQueue.Depth(); - if (maxEvents != 0 && fifoDepth >= maxEvents) - return; - - const std::size_t flushLimit = maxEvents == 0 ? 0 : maxEvents - fifoDepth; - std::vector events = mCoalescingQueue.Drain(flushLimit); - for (RuntimeEvent& event : events) - mQueue.Push(std::move(event)); - } - - std::vector HandlersFor(RuntimeEventType type) const - { - std::lock_guard lock(mHandlerMutex); - std::vector handlers = mAllHandlers; - - const auto found = mHandlers.find(type); - if (found != mHandlers.end()) - handlers.insert(handlers.end(), found->second.begin(), found->second.end()); - - return handlers; - } - - RuntimeEventQueue mQueue; - RuntimeEventCoalescingQueue mCoalescingQueue; - std::atomic mNextSequence{ 1 }; - mutable std::mutex mHandlerMutex; - std::map> mHandlers; - std::vector mAllHandlers; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/events/RuntimeEventPayloads.h b/apps/LoopThroughWithOpenGLCompositing/runtime/events/RuntimeEventPayloads.h deleted file mode 100644 index 9e7d86e..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/events/RuntimeEventPayloads.h +++ /dev/null @@ -1,442 +0,0 @@ -#pragma once - -#include "RuntimeEventType.h" - -#include -#include -#include "PersistenceRequest.h" - -#include - -enum class RuntimeEventSeverity -{ - Debug, - Info, - Warning, - Error -}; - -enum class RuntimeEventRenderResetScope -{ - None, - TemporalHistoryOnly, - TemporalHistoryAndFeedback -}; - -enum class RuntimeEventShaderBuildPhase -{ - Requested, - Prepared, - Applied, - Failed -}; - -struct OscValueReceivedEvent -{ - std::string routeKey; - std::string layerKey; - std::string parameterKey; - std::string valueJson; - uint64_t generation = 0; -}; - -struct OscValueCoalescedEvent -{ - std::string routeKey; - std::size_t coalescedCount = 0; - uint64_t latestGeneration = 0; -}; - -struct OscCommitRequestedEvent -{ - std::string routeKey; - std::string layerKey; - std::string parameterKey; - std::string valueJson; - uint64_t generation = 0; -}; - -struct HttpControlMutationRequestedEvent -{ - std::string method; - std::string path; - std::string bodyJson; -}; - -struct WebSocketClientConnectedEvent -{ - std::string clientId; - std::size_t connectedClientCount = 0; -}; - -struct RuntimeStateBroadcastRequestedEvent -{ - std::string reason; - bool coalescable = true; -}; - -struct FileChangeDetectedEvent -{ - std::string path; - bool shaderPackageCandidate = false; - bool runtimeConfigCandidate = false; - bool presetCandidate = false; -}; - -struct ManualReloadRequestedEvent -{ - bool preserveFeedbackState = false; - std::string reason; -}; - -struct RuntimeMutationEvent -{ - std::string action; - bool accepted = false; - bool runtimeStateChanged = false; - bool runtimeStateBroadcastRequired = false; - bool shaderBuildRequested = false; - bool persistenceRequested = false; - bool clearTransientOscState = false; - RuntimeEventRenderResetScope renderResetScope = RuntimeEventRenderResetScope::None; - std::string errorMessage; -}; - -struct RuntimeStateChangedEvent -{ - std::string reason; - bool renderVisible = false; - bool persistenceRequested = false; -}; - -struct RuntimePersistenceRequestedEvent -{ - PersistenceRequest request; -}; - -struct RuntimeReloadRequestedEvent -{ - bool preserveFeedbackState = false; - std::string reason; -}; - -struct ShaderPackagesChangedEvent -{ - bool registryChanged = false; - std::size_t packageCount = 0; - std::string reason; -}; - -struct RenderSnapshotPublishRequestedEvent -{ - unsigned inputWidth = 0; - unsigned inputHeight = 0; - unsigned outputWidth = 0; - unsigned outputHeight = 0; - std::string reason; -}; - -struct RuntimeStatePresentationChangedEvent -{ - std::string reason; -}; - -struct ShaderBuildEvent -{ - RuntimeEventShaderBuildPhase phase = RuntimeEventShaderBuildPhase::Requested; - uint64_t generation = 0; - unsigned inputWidth = 0; - unsigned inputHeight = 0; - bool preserveFeedbackState = false; - bool succeeded = false; - std::string message; -}; - -struct CompileStatusChangedEvent -{ - bool succeeded = false; - std::string message; -}; - -struct RenderSnapshotPublishedEvent -{ - uint64_t snapshotVersion = 0; - uint64_t structureVersion = 0; - uint64_t parameterVersion = 0; - uint64_t packageVersion = 0; - unsigned outputWidth = 0; - unsigned outputHeight = 0; - std::size_t layerCount = 0; -}; - -struct RenderResetEvent -{ - RuntimeEventRenderResetScope scope = RuntimeEventRenderResetScope::None; - bool applied = false; - std::string reason; -}; - -struct OscOverlayEvent -{ - std::string routeKey; - std::string layerKey; - std::string parameterKey; - uint64_t generation = 0; - bool settled = false; -}; - -struct FrameRenderedEvent -{ - uint64_t frameIndex = 0; - double renderMilliseconds = 0.0; -}; - -struct PreviewFrameAvailableEvent -{ - uint64_t frameIndex = 0; - unsigned width = 0; - unsigned height = 0; -}; - -struct InputSignalChangedEvent -{ - bool hasSignal = false; - unsigned width = 0; - unsigned height = 0; - std::string modeName; -}; - -struct InputFrameArrivedEvent -{ - uint64_t frameIndex = 0; - unsigned width = 0; - unsigned height = 0; - long rowBytes = 0; - std::string pixelFormat; - bool hasNoInputSource = false; -}; - -struct OutputFrameScheduledEvent -{ - uint64_t frameIndex = 0; - int64_t streamTime = 0; - int64_t duration = 0; - int64_t timeScale = 0; -}; - -struct OutputFrameCompletedEvent -{ - uint64_t frameIndex = 0; - std::string result; -}; - -struct BackendStateChangedEvent -{ - std::string backendName; - std::string state; - std::string message; -}; - -struct SubsystemWarningEvent -{ - std::string subsystem; - std::string warningKey; - RuntimeEventSeverity severity = RuntimeEventSeverity::Warning; - std::string message; - bool cleared = false; -}; - -struct SubsystemRecoveredEvent -{ - std::string subsystem; - std::string recoveryKey; - std::string message; -}; - -struct TimingSampleRecordedEvent -{ - std::string subsystem; - std::string metric; - double value = 0.0; - std::string unit; -}; - -struct QueueDepthChangedEvent -{ - std::string queueName; - std::size_t depth = 0; - std::size_t capacity = 0; - std::size_t droppedCount = 0; - std::size_t coalescedCount = 0; -}; - -constexpr RuntimeEventType RuntimeEventPayloadType(const OscValueReceivedEvent&) -{ - return RuntimeEventType::OscValueReceived; -} - -constexpr RuntimeEventType RuntimeEventPayloadType(const OscValueCoalescedEvent&) -{ - return RuntimeEventType::OscValueCoalesced; -} - -constexpr RuntimeEventType RuntimeEventPayloadType(const OscCommitRequestedEvent&) -{ - return RuntimeEventType::OscCommitRequested; -} - -constexpr RuntimeEventType RuntimeEventPayloadType(const HttpControlMutationRequestedEvent&) -{ - return RuntimeEventType::HttpControlMutationRequested; -} - -constexpr RuntimeEventType RuntimeEventPayloadType(const WebSocketClientConnectedEvent&) -{ - return RuntimeEventType::WebSocketClientConnected; -} - -constexpr RuntimeEventType RuntimeEventPayloadType(const RuntimeStateBroadcastRequestedEvent&) -{ - return RuntimeEventType::RuntimeStateBroadcastRequested; -} - -constexpr RuntimeEventType RuntimeEventPayloadType(const FileChangeDetectedEvent&) -{ - return RuntimeEventType::FileChangeDetected; -} - -constexpr RuntimeEventType RuntimeEventPayloadType(const ManualReloadRequestedEvent&) -{ - return RuntimeEventType::ManualReloadRequested; -} - -inline RuntimeEventType RuntimeEventPayloadType(const RuntimeMutationEvent& event) -{ - return event.accepted ? RuntimeEventType::RuntimeMutationAccepted : RuntimeEventType::RuntimeMutationRejected; -} - -constexpr RuntimeEventType RuntimeEventPayloadType(const RuntimeStateChangedEvent&) -{ - return RuntimeEventType::RuntimeStateChanged; -} - -constexpr RuntimeEventType RuntimeEventPayloadType(const RuntimePersistenceRequestedEvent&) -{ - return RuntimeEventType::RuntimePersistenceRequested; -} - -constexpr RuntimeEventType RuntimeEventPayloadType(const RuntimeReloadRequestedEvent&) -{ - return RuntimeEventType::RuntimeReloadRequested; -} - -constexpr RuntimeEventType RuntimeEventPayloadType(const ShaderPackagesChangedEvent&) -{ - return RuntimeEventType::ShaderPackagesChanged; -} - -constexpr RuntimeEventType RuntimeEventPayloadType(const RenderSnapshotPublishRequestedEvent&) -{ - return RuntimeEventType::RenderSnapshotPublishRequested; -} - -constexpr RuntimeEventType RuntimeEventPayloadType(const RuntimeStatePresentationChangedEvent&) -{ - return RuntimeEventType::RuntimeStatePresentationChanged; -} - -inline RuntimeEventType RuntimeEventPayloadType(const ShaderBuildEvent& event) -{ - switch (event.phase) - { - case RuntimeEventShaderBuildPhase::Requested: - return RuntimeEventType::ShaderBuildRequested; - case RuntimeEventShaderBuildPhase::Prepared: - return RuntimeEventType::ShaderBuildPrepared; - case RuntimeEventShaderBuildPhase::Applied: - return RuntimeEventType::ShaderBuildApplied; - case RuntimeEventShaderBuildPhase::Failed: - return RuntimeEventType::ShaderBuildFailed; - } - - return RuntimeEventType::ShaderBuildRequested; -} - -constexpr RuntimeEventType RuntimeEventPayloadType(const CompileStatusChangedEvent&) -{ - return RuntimeEventType::CompileStatusChanged; -} - -constexpr RuntimeEventType RuntimeEventPayloadType(const RenderSnapshotPublishedEvent&) -{ - return RuntimeEventType::RenderSnapshotPublished; -} - -inline RuntimeEventType RuntimeEventPayloadType(const RenderResetEvent& event) -{ - return event.applied ? RuntimeEventType::RenderResetApplied : RuntimeEventType::RenderResetRequested; -} - -inline RuntimeEventType RuntimeEventPayloadType(const OscOverlayEvent& event) -{ - return event.settled ? RuntimeEventType::OscOverlaySettled : RuntimeEventType::OscOverlayApplied; -} - -constexpr RuntimeEventType RuntimeEventPayloadType(const FrameRenderedEvent&) -{ - return RuntimeEventType::FrameRendered; -} - -constexpr RuntimeEventType RuntimeEventPayloadType(const PreviewFrameAvailableEvent&) -{ - return RuntimeEventType::PreviewFrameAvailable; -} - -constexpr RuntimeEventType RuntimeEventPayloadType(const InputSignalChangedEvent&) -{ - return RuntimeEventType::InputSignalChanged; -} - -constexpr RuntimeEventType RuntimeEventPayloadType(const InputFrameArrivedEvent&) -{ - return RuntimeEventType::InputFrameArrived; -} - -constexpr RuntimeEventType RuntimeEventPayloadType(const OutputFrameScheduledEvent&) -{ - return RuntimeEventType::OutputFrameScheduled; -} - -inline RuntimeEventType RuntimeEventPayloadType(const OutputFrameCompletedEvent& event) -{ - if (event.result == "DisplayedLate") - return RuntimeEventType::OutputLateFrameDetected; - if (event.result == "Dropped") - return RuntimeEventType::OutputDroppedFrameDetected; - return RuntimeEventType::OutputFrameCompleted; -} - -constexpr RuntimeEventType RuntimeEventPayloadType(const BackendStateChangedEvent&) -{ - return RuntimeEventType::BackendStateChanged; -} - -inline RuntimeEventType RuntimeEventPayloadType(const SubsystemWarningEvent& event) -{ - return event.cleared ? RuntimeEventType::SubsystemWarningCleared : RuntimeEventType::SubsystemWarningRaised; -} - -constexpr RuntimeEventType RuntimeEventPayloadType(const SubsystemRecoveredEvent&) -{ - return RuntimeEventType::SubsystemRecovered; -} - -constexpr RuntimeEventType RuntimeEventPayloadType(const TimingSampleRecordedEvent&) -{ - return RuntimeEventType::TimingSampleRecorded; -} - -constexpr RuntimeEventType RuntimeEventPayloadType(const QueueDepthChangedEvent&) -{ - return RuntimeEventType::QueueDepthChanged; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/events/RuntimeEventQueue.h b/apps/LoopThroughWithOpenGLCompositing/runtime/events/RuntimeEventQueue.h deleted file mode 100644 index 0b2deaa..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/events/RuntimeEventQueue.h +++ /dev/null @@ -1,100 +0,0 @@ -#pragma once - -#include "RuntimeEvent.h" - -#include -#include -#include -#include -#include - -struct RuntimeEventQueueMetrics -{ - std::size_t depth = 0; - std::size_t capacity = 0; - std::size_t droppedCount = 0; - std::size_t coalescedCount = 0; - double oldestEventAgeMilliseconds = 0.0; -}; - -class RuntimeEventQueue -{ -public: - explicit RuntimeEventQueue(std::size_t capacity = 1024) : - mCapacity(capacity) - { - } - - bool Push(RuntimeEvent event) - { - std::lock_guard lock(mMutex); - if (mEvents.size() >= mCapacity) - { - ++mDroppedCount; - return false; - } - - mEvents.push_back(std::move(event)); - return true; - } - - bool TryPop(RuntimeEvent& event) - { - std::lock_guard lock(mMutex); - if (mEvents.empty()) - return false; - - event = std::move(mEvents.front()); - mEvents.pop_front(); - return true; - } - - std::vector Drain(std::size_t maxEvents = 0) - { - std::vector events; - - std::lock_guard lock(mMutex); - const std::size_t count = maxEvents == 0 || maxEvents > mEvents.size() ? mEvents.size() : maxEvents; - events.reserve(count); - for (std::size_t index = 0; index < count; ++index) - { - events.push_back(std::move(mEvents.front())); - mEvents.pop_front(); - } - - return events; - } - - RuntimeEventQueueMetrics GetMetrics(std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now()) const - { - std::lock_guard lock(mMutex); - - RuntimeEventQueueMetrics metrics; - metrics.depth = mEvents.size(); - metrics.capacity = mCapacity; - metrics.droppedCount = mDroppedCount; - if (!mEvents.empty()) - { - const auto age = now - mEvents.front().createdAt; - metrics.oldestEventAgeMilliseconds = std::chrono::duration(age).count(); - } - return metrics; - } - - std::size_t Depth() const - { - std::lock_guard lock(mMutex); - return mEvents.size(); - } - - std::size_t Capacity() const - { - return mCapacity; - } - -private: - mutable std::mutex mMutex; - std::deque mEvents; - std::size_t mCapacity = 0; - std::size_t mDroppedCount = 0; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/events/RuntimeEventType.h b/apps/LoopThroughWithOpenGLCompositing/runtime/events/RuntimeEventType.h deleted file mode 100644 index cb8739d..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/events/RuntimeEventType.h +++ /dev/null @@ -1,151 +0,0 @@ -#pragma once - -#include - -enum class RuntimeEventType -{ - Unknown = 0, - - // Control ingress. - OscValueReceived, - OscValueCoalesced, - OscCommitRequested, - HttpControlMutationRequested, - WebSocketClientConnected, - RuntimeStateBroadcastRequested, - FileChangeDetected, - ManualReloadRequested, - - // Runtime policy and state. - RuntimeMutationAccepted, - RuntimeMutationRejected, - RuntimeStateChanged, - RuntimePersistenceRequested, - RuntimeReloadRequested, - ShaderPackagesChanged, - RenderSnapshotPublishRequested, - RuntimeStatePresentationChanged, - - // Shader build lifecycle. - ShaderBuildRequested, - ShaderBuildPrepared, - ShaderBuildApplied, - ShaderBuildFailed, - CompileStatusChanged, - - // Render lifecycle. - RenderSnapshotPublished, - RenderResetRequested, - RenderResetApplied, - OscOverlayApplied, - OscOverlaySettled, - FrameRendered, - PreviewFrameAvailable, - - // Video backend lifecycle. - InputSignalChanged, - InputFrameArrived, - OutputFrameScheduled, - OutputFrameCompleted, - OutputLateFrameDetected, - OutputDroppedFrameDetected, - BackendStateChanged, - - // Health and telemetry. - SubsystemWarningRaised, - SubsystemWarningCleared, - SubsystemRecovered, - TimingSampleRecorded, - QueueDepthChanged -}; - -constexpr std::string_view RuntimeEventTypeName(RuntimeEventType type) -{ - switch (type) - { - case RuntimeEventType::Unknown: - return "Unknown"; - case RuntimeEventType::OscValueReceived: - return "OscValueReceived"; - case RuntimeEventType::OscValueCoalesced: - return "OscValueCoalesced"; - case RuntimeEventType::OscCommitRequested: - return "OscCommitRequested"; - case RuntimeEventType::HttpControlMutationRequested: - return "HttpControlMutationRequested"; - case RuntimeEventType::WebSocketClientConnected: - return "WebSocketClientConnected"; - case RuntimeEventType::RuntimeStateBroadcastRequested: - return "RuntimeStateBroadcastRequested"; - case RuntimeEventType::FileChangeDetected: - return "FileChangeDetected"; - case RuntimeEventType::ManualReloadRequested: - return "ManualReloadRequested"; - case RuntimeEventType::RuntimeMutationAccepted: - return "RuntimeMutationAccepted"; - case RuntimeEventType::RuntimeMutationRejected: - return "RuntimeMutationRejected"; - case RuntimeEventType::RuntimeStateChanged: - return "RuntimeStateChanged"; - case RuntimeEventType::RuntimePersistenceRequested: - return "RuntimePersistenceRequested"; - case RuntimeEventType::RuntimeReloadRequested: - return "RuntimeReloadRequested"; - case RuntimeEventType::ShaderPackagesChanged: - return "ShaderPackagesChanged"; - case RuntimeEventType::RenderSnapshotPublishRequested: - return "RenderSnapshotPublishRequested"; - case RuntimeEventType::RuntimeStatePresentationChanged: - return "RuntimeStatePresentationChanged"; - case RuntimeEventType::ShaderBuildRequested: - return "ShaderBuildRequested"; - case RuntimeEventType::ShaderBuildPrepared: - return "ShaderBuildPrepared"; - case RuntimeEventType::ShaderBuildApplied: - return "ShaderBuildApplied"; - case RuntimeEventType::ShaderBuildFailed: - return "ShaderBuildFailed"; - case RuntimeEventType::CompileStatusChanged: - return "CompileStatusChanged"; - case RuntimeEventType::RenderSnapshotPublished: - return "RenderSnapshotPublished"; - case RuntimeEventType::RenderResetRequested: - return "RenderResetRequested"; - case RuntimeEventType::RenderResetApplied: - return "RenderResetApplied"; - case RuntimeEventType::OscOverlayApplied: - return "OscOverlayApplied"; - case RuntimeEventType::OscOverlaySettled: - return "OscOverlaySettled"; - case RuntimeEventType::FrameRendered: - return "FrameRendered"; - case RuntimeEventType::PreviewFrameAvailable: - return "PreviewFrameAvailable"; - case RuntimeEventType::InputSignalChanged: - return "InputSignalChanged"; - case RuntimeEventType::InputFrameArrived: - return "InputFrameArrived"; - case RuntimeEventType::OutputFrameScheduled: - return "OutputFrameScheduled"; - case RuntimeEventType::OutputFrameCompleted: - return "OutputFrameCompleted"; - case RuntimeEventType::OutputLateFrameDetected: - return "OutputLateFrameDetected"; - case RuntimeEventType::OutputDroppedFrameDetected: - return "OutputDroppedFrameDetected"; - case RuntimeEventType::BackendStateChanged: - return "BackendStateChanged"; - case RuntimeEventType::SubsystemWarningRaised: - return "SubsystemWarningRaised"; - case RuntimeEventType::SubsystemWarningCleared: - return "SubsystemWarningCleared"; - case RuntimeEventType::SubsystemRecovered: - return "SubsystemRecovered"; - case RuntimeEventType::TimingSampleRecorded: - return "TimingSampleRecorded"; - case RuntimeEventType::QueueDepthChanged: - return "QueueDepthChanged"; - } - - return "Unknown"; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/live/CommittedLiveState.cpp b/apps/LoopThroughWithOpenGLCompositing/runtime/live/CommittedLiveState.cpp deleted file mode 100644 index e928ab9..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/live/CommittedLiveState.cpp +++ /dev/null @@ -1,144 +0,0 @@ -#include "CommittedLiveState.h" - -bool CommittedLiveState::LoadPersistentStateValue(const JsonValue& root) -{ - return mLayerStack.LoadPersistentStateValue(root); -} - -JsonValue CommittedLiveState::BuildPersistentStateValue(const ShaderPackageCatalog& shaderCatalog) const -{ - return mLayerStack.BuildPersistentStateValue(shaderCatalog); -} - -void CommittedLiveState::NormalizeLayerIds() -{ - mLayerStack.NormalizeLayerIds(); -} - -void CommittedLiveState::EnsureDefaultsForAllLayers(const ShaderPackageCatalog& shaderCatalog) -{ - mLayerStack.EnsureDefaultsForAllLayers(shaderCatalog); -} - -void CommittedLiveState::EnsureDefaultLayer(const ShaderPackageCatalog& shaderCatalog) -{ - mLayerStack.EnsureDefaultLayer(shaderCatalog); -} - -void CommittedLiveState::RemoveLayersWithMissingPackages(const ShaderPackageCatalog& shaderCatalog) -{ - mLayerStack.RemoveLayersWithMissingPackages(shaderCatalog); -} - -bool CommittedLiveState::CreateLayer(const ShaderPackageCatalog& shaderCatalog, const std::string& shaderId, std::string& error) -{ - return mLayerStack.CreateLayer(shaderCatalog, shaderId, error); -} - -bool CommittedLiveState::DeleteLayer(const std::string& layerId, std::string& error) -{ - return mLayerStack.DeleteLayer(layerId, error); -} - -bool CommittedLiveState::MoveLayer(const std::string& layerId, int direction, std::string& error) -{ - return mLayerStack.MoveLayer(layerId, direction, error); -} - -bool CommittedLiveState::MoveLayerToIndex(const std::string& layerId, std::size_t targetIndex, std::string& error) -{ - return mLayerStack.MoveLayerToIndex(layerId, targetIndex, error); -} - -bool CommittedLiveState::SetLayerBypassState(const std::string& layerId, bool bypassed, std::string& error) -{ - return mLayerStack.SetLayerBypassState(layerId, bypassed, error); -} - -bool CommittedLiveState::SetLayerShaderSelection(const ShaderPackageCatalog& shaderCatalog, const std::string& layerId, const std::string& shaderId, std::string& error) -{ - return mLayerStack.SetLayerShaderSelection(shaderCatalog, layerId, shaderId, error); -} - -bool CommittedLiveState::SetParameterValue(const std::string& layerId, const std::string& parameterId, const ShaderParameterValue& value, std::string& error) -{ - return mLayerStack.SetParameterValue(layerId, parameterId, value, error); -} - -bool CommittedLiveState::ResetLayerParameterValues(const ShaderPackageCatalog& shaderCatalog, const std::string& layerId, std::string& error) -{ - return mLayerStack.ResetLayerParameterValues(shaderCatalog, layerId, error); -} - -bool CommittedLiveState::HasLayer(const std::string& layerId) const -{ - return mLayerStack.HasLayer(layerId); -} - -bool CommittedLiveState::TryGetParameterById(const ShaderPackageCatalog& shaderCatalog, const std::string& layerId, const std::string& parameterId, StoredParameterSnapshot& snapshot, std::string& error) const -{ - return mLayerStack.TryGetParameterById(shaderCatalog, layerId, parameterId, snapshot, error); -} - -bool CommittedLiveState::TryGetParameterByControlKey(const ShaderPackageCatalog& shaderCatalog, const std::string& layerKey, const std::string& parameterKey, StoredParameterSnapshot& snapshot, std::string& error) const -{ - return mLayerStack.TryGetParameterByControlKey(shaderCatalog, layerKey, parameterKey, snapshot, error); -} - -bool CommittedLiveState::ResolveLayerMove(const std::string& layerId, int direction, bool& shouldMove, std::string& error) const -{ - return mLayerStack.ResolveLayerMove(layerId, direction, shouldMove, error); -} - -bool CommittedLiveState::ResolveLayerMoveToIndex(const std::string& layerId, std::size_t targetIndex, bool& shouldMove, std::string& error) const -{ - return mLayerStack.ResolveLayerMoveToIndex(layerId, targetIndex, shouldMove, error); -} - -JsonValue CommittedLiveState::BuildStackPresetValue(const ShaderPackageCatalog& shaderCatalog, const std::string& presetName) const -{ - return mLayerStack.BuildStackPresetValue(shaderCatalog, presetName); -} - -bool CommittedLiveState::LoadStackPresetValue(const ShaderPackageCatalog& shaderCatalog, const JsonValue& root, std::string& error) -{ - return mLayerStack.LoadStackPresetValue(shaderCatalog, root, error); -} - -CommittedLiveStateReadModel CommittedLiveState::BuildReadModel(const ShaderPackageCatalog& shaderCatalog) const -{ - CommittedLiveStateReadModel model; - model.layers = mLayerStack.Layers(); - model.packagesById = shaderCatalog.CaptureSnapshot().packagesById; - return model; -} - -std::vector CommittedLiveState::CopyLayerStates() const -{ - return mLayerStack.Layers(); -} - -const std::vector& CommittedLiveState::Layers() const -{ - return mLayerStack.Layers(); -} - -std::vector& CommittedLiveState::Layers() -{ - return mLayerStack.Layers(); -} - -const CommittedLiveState::LayerPersistentState* CommittedLiveState::FindLayerById(const std::string& layerId) const -{ - return mLayerStack.FindLayerById(layerId); -} - -const LayerStackStore& CommittedLiveState::LayerStack() const -{ - return mLayerStack; -} - -LayerStackStore& CommittedLiveState::LayerStack() -{ - return mLayerStack; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/live/CommittedLiveState.h b/apps/LoopThroughWithOpenGLCompositing/runtime/live/CommittedLiveState.h deleted file mode 100644 index 4e9c1aa..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/live/CommittedLiveState.h +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once - -#include "LayerStackStore.h" -#include "RuntimeStoreReadModels.h" -#include "ShaderPackageCatalog.h" - -#include -#include -#include - -class CommittedLiveState -{ -public: - using LayerPersistentState = LayerStackStore::LayerPersistentState; - using StoredParameterSnapshot = LayerStackStore::StoredParameterSnapshot; - - bool LoadPersistentStateValue(const JsonValue& root); - JsonValue BuildPersistentStateValue(const ShaderPackageCatalog& shaderCatalog) const; - void NormalizeLayerIds(); - void EnsureDefaultsForAllLayers(const ShaderPackageCatalog& shaderCatalog); - void EnsureDefaultLayer(const ShaderPackageCatalog& shaderCatalog); - void RemoveLayersWithMissingPackages(const ShaderPackageCatalog& shaderCatalog); - - bool CreateLayer(const ShaderPackageCatalog& shaderCatalog, const std::string& shaderId, std::string& error); - bool DeleteLayer(const std::string& layerId, std::string& error); - bool MoveLayer(const std::string& layerId, int direction, std::string& error); - bool MoveLayerToIndex(const std::string& layerId, std::size_t targetIndex, std::string& error); - bool SetLayerBypassState(const std::string& layerId, bool bypassed, std::string& error); - bool SetLayerShaderSelection(const ShaderPackageCatalog& shaderCatalog, const std::string& layerId, const std::string& shaderId, std::string& error); - bool SetParameterValue(const std::string& layerId, const std::string& parameterId, const ShaderParameterValue& value, std::string& error); - bool ResetLayerParameterValues(const ShaderPackageCatalog& shaderCatalog, const std::string& layerId, std::string& error); - - bool HasLayer(const std::string& layerId) const; - bool TryGetParameterById(const ShaderPackageCatalog& shaderCatalog, const std::string& layerId, const std::string& parameterId, StoredParameterSnapshot& snapshot, std::string& error) const; - bool TryGetParameterByControlKey(const ShaderPackageCatalog& shaderCatalog, const std::string& layerKey, const std::string& parameterKey, StoredParameterSnapshot& snapshot, std::string& error) const; - bool ResolveLayerMove(const std::string& layerId, int direction, bool& shouldMove, std::string& error) const; - bool ResolveLayerMoveToIndex(const std::string& layerId, std::size_t targetIndex, bool& shouldMove, std::string& error) const; - - JsonValue BuildStackPresetValue(const ShaderPackageCatalog& shaderCatalog, const std::string& presetName) const; - bool LoadStackPresetValue(const ShaderPackageCatalog& shaderCatalog, const JsonValue& root, std::string& error); - - CommittedLiveStateReadModel BuildReadModel(const ShaderPackageCatalog& shaderCatalog) const; - std::vector CopyLayerStates() const; - const std::vector& Layers() const; - std::vector& Layers(); - const LayerPersistentState* FindLayerById(const std::string& layerId) const; - const LayerStackStore& LayerStack() const; - LayerStackStore& LayerStack(); - -private: - LayerStackStore mLayerStack; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/live/RenderStateComposer.cpp b/apps/LoopThroughWithOpenGLCompositing/runtime/live/RenderStateComposer.cpp deleted file mode 100644 index 9162cc1..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/live/RenderStateComposer.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "RenderStateComposer.h" - -RenderStateCompositionResult RenderStateComposer::BuildFrameState(const LayeredRenderStateInput& input) const -{ - RenderStateCompositionResult result; - const std::vector* layerStates = - input.committedLiveLayerStates ? input.committedLiveLayerStates : input.basePersistedLayerStates; - if (!layerStates) - return result; - - result.layerStates = *layerStates; - result.hasLayerStates = !result.layerStates.empty(); - if (input.transientAutomationOverlay) - { - RuntimeLiveStateApplyOptions options; - options.allowCommit = input.allowTransientAutomationCommits; - options.smoothing = input.transientAutomationSmoothing; - options.commitDelay = input.transientAutomationCommitDelay; - options.now = input.now; - input.transientAutomationOverlay->ApplyToLayerStates( - result.layerStates, - options, - input.collectTransientAutomationCommitRequests ? &result.commitRequests : nullptr); - } - return result; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/live/RenderStateComposer.h b/apps/LoopThroughWithOpenGLCompositing/runtime/live/RenderStateComposer.h deleted file mode 100644 index 5a96278..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/live/RenderStateComposer.h +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#include "RuntimeLiveState.h" - -#include -#include - -struct LayeredRenderStateInput -{ - const std::vector* basePersistedLayerStates = nullptr; - const std::vector* committedLiveLayerStates = nullptr; - RuntimeLiveState* transientAutomationOverlay = nullptr; - bool allowTransientAutomationCommits = false; - bool collectTransientAutomationCommitRequests = true; - double transientAutomationSmoothing = 0.0; - std::chrono::milliseconds transientAutomationCommitDelay = std::chrono::milliseconds(150); - std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now(); -}; - -struct RenderStateCompositionResult -{ - std::vector layerStates; - std::vector commitRequests; - bool hasLayerStates = false; -}; - -class RenderStateComposer -{ -public: - RenderStateCompositionResult BuildFrameState(const LayeredRenderStateInput& input) const; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/live/RuntimeLiveState.cpp b/apps/LoopThroughWithOpenGLCompositing/runtime/live/RuntimeLiveState.cpp deleted file mode 100644 index 6ee68ef..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/live/RuntimeLiveState.cpp +++ /dev/null @@ -1,329 +0,0 @@ -#include "RuntimeLiveState.h" - -#include "RuntimeParameterUtils.h" - -#include -#include -#include -#include - -namespace -{ -constexpr double kOscSmoothingReferenceFps = 60.0; -constexpr double kOscSmoothingMaxStepSeconds = 0.25; - -std::string SimplifyOscControlKey(const std::string& text) -{ - std::string simplified; - for (unsigned char ch : text) - { - if (std::isalnum(ch)) - simplified.push_back(static_cast(std::tolower(ch))); - } - return simplified; -} - -bool MatchesOscControlKey(const std::string& candidate, const std::string& key) -{ - return candidate == key || SimplifyOscControlKey(candidate) == SimplifyOscControlKey(key); -} - -double ClampOscAlpha(double value) -{ - return (std::max)(0.0, (std::min)(1.0, value)); -} - -double ComputeTimeBasedOscAlpha(double smoothing, double deltaSeconds) -{ - const double clampedSmoothing = ClampOscAlpha(smoothing); - if (clampedSmoothing <= 0.0) - return 0.0; - if (clampedSmoothing >= 1.0) - return 1.0; - - const double clampedDeltaSeconds = (std::max)(0.0, (std::min)(kOscSmoothingMaxStepSeconds, deltaSeconds)); - if (clampedDeltaSeconds <= 0.0) - return 0.0; - - const double frameScale = clampedDeltaSeconds * kOscSmoothingReferenceFps; - return ClampOscAlpha(1.0 - std::pow(1.0 - clampedSmoothing, frameScale)); -} - -JsonValue BuildOscCommitValue(const ShaderParameterDefinition& definition, const ShaderParameterValue& value) -{ - switch (definition.type) - { - case ShaderParameterType::Boolean: - return JsonValue(value.booleanValue); - case ShaderParameterType::Enum: - return JsonValue(value.enumValue); - case ShaderParameterType::Text: - return JsonValue(value.textValue); - case ShaderParameterType::Trigger: - case ShaderParameterType::Float: - return JsonValue(value.numberValues.empty() ? 0.0 : value.numberValues.front()); - case ShaderParameterType::Vec2: - case ShaderParameterType::Color: - { - JsonValue array = JsonValue::MakeArray(); - for (double number : value.numberValues) - array.pushBack(JsonValue(number)); - return array; - } - } - - return JsonValue(); -} - -} - -void RuntimeLiveState::Clear() -{ - mOscOverlayStates.clear(); -} - -void RuntimeLiveState::ClearForLayerKey(const std::string& layerKey) -{ - for (auto it = mOscOverlayStates.begin(); it != mOscOverlayStates.end();) - { - if (OverlayMatchesLayerKey(it->second, layerKey)) - it = mOscOverlayStates.erase(it); - else - ++it; - } -} - -bool RuntimeLiveState::OverlayMatchesLayerKey(const OscOverlayState& overlay, const std::string& layerKey) -{ - return MatchesOscControlKey(overlay.layerKey, layerKey); -} - -bool RuntimeLiveState::TryResolveOverlayTarget( - const OscOverlayState& overlay, - const std::vector& states, - std::vector::const_iterator& stateIt, - std::vector::const_iterator& definitionIt) -{ - stateIt = std::find_if(states.begin(), states.end(), - [&overlay](const RuntimeRenderState& state) - { - return MatchesOscControlKey(state.layerId, overlay.layerKey) || - MatchesOscControlKey(state.shaderId, overlay.layerKey) || - MatchesOscControlKey(state.shaderName, overlay.layerKey); - }); - if (stateIt == states.end()) - return false; - - definitionIt = std::find_if(stateIt->parameterDefinitions.begin(), stateIt->parameterDefinitions.end(), - [&overlay](const ShaderParameterDefinition& definition) - { - return MatchesOscControlKey(definition.id, overlay.parameterKey) || - MatchesOscControlKey(definition.label, overlay.parameterKey); - }); - return definitionIt != stateIt->parameterDefinitions.end(); -} - -std::size_t RuntimeLiveState::OverlayCount() const -{ - return mOscOverlayStates.size(); -} - -void RuntimeLiveState::ApplyOscUpdates(const std::vector& updates) -{ - const auto now = std::chrono::steady_clock::now(); - for (const RuntimeLiveOscUpdate& update : updates) - { - auto overlayIt = mOscOverlayStates.find(update.routeKey); - if (overlayIt == mOscOverlayStates.end()) - { - OscOverlayState overlay; - overlay.layerKey = update.layerKey; - overlay.parameterKey = update.parameterKey; - overlay.targetValue = update.targetValue; - overlay.lastUpdatedTime = now; - overlay.lastAppliedTime = now; - overlay.generation = 1; - mOscOverlayStates[update.routeKey] = std::move(overlay); - } - else - { - overlayIt->second.targetValue = update.targetValue; - overlayIt->second.lastUpdatedTime = now; - overlayIt->second.generation += 1; - overlayIt->second.commitQueued = false; - } - } -} - -void RuntimeLiveState::ApplyOscCommitCompletions(const std::vector& completedCommits) -{ - for (const RuntimeLiveOscCommitCompletion& completedCommit : completedCommits) - { - auto overlayIt = mOscOverlayStates.find(completedCommit.routeKey); - if (overlayIt == mOscOverlayStates.end()) - continue; - - OscOverlayState& overlay = overlayIt->second; - if (overlay.commitQueued && - overlay.pendingCommitGeneration == completedCommit.generation && - overlay.generation == completedCommit.generation) - { - mOscOverlayStates.erase(overlayIt); - } - } -} - -void RuntimeLiveState::PruneIncompatibleOverlays(const std::vector& states) -{ - for (auto it = mOscOverlayStates.begin(); it != mOscOverlayStates.end();) - { - std::vector::const_iterator stateIt; - std::vector::const_iterator definitionIt; - if (TryResolveOverlayTarget(it->second, states, stateIt, definitionIt)) - { - ShaderParameterValue targetValue; - std::string normalizeError; - if (NormalizeAndValidateParameterValue(*definitionIt, it->second.targetValue, targetValue, normalizeError)) - { - ++it; - continue; - } - } - - it = mOscOverlayStates.erase(it); - } -} - -void RuntimeLiveState::ApplyToLayerStates( - std::vector& states, - const RuntimeLiveStateApplyOptions& options, - std::vector* commitRequests) -{ - if (states.empty() || mOscOverlayStates.empty()) - return; - - PruneIncompatibleOverlays(states); - if (mOscOverlayStates.empty()) - return; - - const auto now = options.now; - const double clampedSmoothing = ClampOscAlpha(options.smoothing); - std::vector overlayKeysToRemove; - - for (auto& item : mOscOverlayStates) - { - const std::string& routeKey = item.first; - OscOverlayState& overlay = item.second; - auto stateIt = std::find_if(states.begin(), states.end(), - [&overlay](const RuntimeRenderState& state) - { - return MatchesOscControlKey(state.layerId, overlay.layerKey) || - MatchesOscControlKey(state.shaderId, overlay.layerKey) || - MatchesOscControlKey(state.shaderName, overlay.layerKey); - }); - if (stateIt == states.end()) - continue; - - auto definitionIt = std::find_if(stateIt->parameterDefinitions.begin(), stateIt->parameterDefinitions.end(), - [&overlay](const ShaderParameterDefinition& definition) - { - return MatchesOscControlKey(definition.id, overlay.parameterKey) || - MatchesOscControlKey(definition.label, overlay.parameterKey); - }); - if (definitionIt == stateIt->parameterDefinitions.end()) - continue; - - ShaderParameterValue targetValue; - std::string normalizeError; - if (!NormalizeAndValidateParameterValue(*definitionIt, overlay.targetValue, targetValue, normalizeError)) - continue; - - if (definitionIt->type == ShaderParameterType::Trigger) - { - ShaderParameterValue& value = stateIt->parameterValues[definitionIt->id]; - const double previousCount = value.numberValues.empty() ? 0.0 : value.numberValues[0]; - const double triggerTime = stateIt->timeSeconds; - value.numberValues = { previousCount + 1.0, triggerTime }; - overlayKeysToRemove.push_back(routeKey); - continue; - } - - const bool smoothable = - clampedSmoothing > 0.0 && - (definitionIt->type == ShaderParameterType::Float || - definitionIt->type == ShaderParameterType::Vec2 || - definitionIt->type == ShaderParameterType::Color); - if (!smoothable) - { - overlay.currentValue = targetValue; - overlay.hasCurrentValue = true; - stateIt->parameterValues[definitionIt->id] = overlay.currentValue; - if (options.allowCommit && - !overlay.commitQueued && - now - overlay.lastUpdatedTime >= options.commitDelay && - commitRequests) - { - commitRequests->push_back({ routeKey, overlay.layerKey, overlay.parameterKey, overlay.targetValue, overlay.generation }); - overlay.pendingCommitGeneration = overlay.generation; - overlay.commitQueued = true; - } - continue; - } - - if (!overlay.hasCurrentValue) - { - overlay.currentValue = DefaultValueForDefinition(*definitionIt); - auto currentIt = stateIt->parameterValues.find(definitionIt->id); - if (currentIt != stateIt->parameterValues.end()) - overlay.currentValue = currentIt->second; - overlay.hasCurrentValue = true; - } - - if (overlay.currentValue.numberValues.size() != targetValue.numberValues.size()) - overlay.currentValue.numberValues = targetValue.numberValues; - - double smoothingAlpha = clampedSmoothing; - if (overlay.lastAppliedTime != std::chrono::steady_clock::time_point()) - { - const double deltaSeconds = - std::chrono::duration_cast>(now - overlay.lastAppliedTime).count(); - smoothingAlpha = ComputeTimeBasedOscAlpha(clampedSmoothing, deltaSeconds); - } - overlay.lastAppliedTime = now; - - ShaderParameterValue nextValue = targetValue; - bool converged = true; - for (std::size_t index = 0; index < targetValue.numberValues.size(); ++index) - { - const double currentNumber = overlay.currentValue.numberValues[index]; - const double targetNumber = targetValue.numberValues[index]; - const double delta = targetNumber - currentNumber; - double nextNumber = currentNumber + delta * smoothingAlpha; - if (std::fabs(delta) <= 0.0005) - nextNumber = targetNumber; - else - converged = false; - nextValue.numberValues[index] = nextNumber; - } - - if (converged) - nextValue.numberValues = targetValue.numberValues; - - overlay.currentValue = nextValue; - overlay.hasCurrentValue = true; - stateIt->parameterValues[definitionIt->id] = overlay.currentValue; - if (options.allowCommit && - converged && - !overlay.commitQueued && - now - overlay.lastUpdatedTime >= options.commitDelay && - commitRequests) - { - commitRequests->push_back({ routeKey, overlay.layerKey, overlay.parameterKey, BuildOscCommitValue(*definitionIt, overlay.currentValue), overlay.generation }); - overlay.pendingCommitGeneration = overlay.generation; - overlay.commitQueued = true; - } - } - - for (const std::string& overlayKey : overlayKeysToRemove) - mOscOverlayStates.erase(overlayKey); -} diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/live/RuntimeLiveState.h b/apps/LoopThroughWithOpenGLCompositing/runtime/live/RuntimeLiveState.h deleted file mode 100644 index 65f8edf..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/live/RuntimeLiveState.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include "RuntimeJson.h" -#include "ShaderTypes.h" - -#include -#include -#include -#include -#include - -struct RuntimeLiveOscUpdate -{ - std::string routeKey; - std::string layerKey; - std::string parameterKey; - JsonValue targetValue; -}; - -struct RuntimeLiveOscCommitCompletion -{ - std::string routeKey; - uint64_t generation = 0; -}; - -struct RuntimeLiveOscCommitRequest -{ - std::string routeKey; - std::string layerKey; - std::string parameterKey; - JsonValue value; - uint64_t generation = 0; -}; - -struct RuntimeLiveStateApplyOptions -{ - bool allowCommit = false; - double smoothing = 0.0; - std::chrono::milliseconds commitDelay = std::chrono::milliseconds(150); - std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now(); -}; - -class RuntimeLiveState -{ -public: - void Clear(); - void ClearForLayerKey(const std::string& layerKey); - std::size_t OverlayCount() const; - void ApplyOscUpdates(const std::vector& updates); - void ApplyOscCommitCompletions(const std::vector& completedCommits); - void PruneIncompatibleOverlays(const std::vector& states); - void ApplyToLayerStates( - std::vector& states, - const RuntimeLiveStateApplyOptions& options, - std::vector* commitRequests); - -private: - struct OscOverlayState - { - std::string layerKey; - std::string parameterKey; - JsonValue targetValue; - ShaderParameterValue currentValue; - bool hasCurrentValue = false; - std::chrono::steady_clock::time_point lastUpdatedTime; - std::chrono::steady_clock::time_point lastAppliedTime; - uint64_t generation = 0; - uint64_t pendingCommitGeneration = 0; - bool commitQueued = false; - }; - - static bool OverlayMatchesLayerKey(const OscOverlayState& overlay, const std::string& layerKey); - static bool TryResolveOverlayTarget( - const OscOverlayState& overlay, - const std::vector& states, - std::vector::const_iterator& stateIt, - std::vector::const_iterator& definitionIt); - - std::map mOscOverlayStates; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/live/RuntimeStateLayerModel.cpp b/apps/LoopThroughWithOpenGLCompositing/runtime/live/RuntimeStateLayerModel.cpp deleted file mode 100644 index 5d63152..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/live/RuntimeStateLayerModel.cpp +++ /dev/null @@ -1,229 +0,0 @@ -#include "RuntimeStateLayerModel.h" - -const char* RuntimeStateLayerKindName(RuntimeStateLayerKind kind) -{ - switch (kind) - { - case RuntimeStateLayerKind::BasePersisted: - return "base persisted"; - case RuntimeStateLayerKind::CommittedLive: - return "committed live"; - case RuntimeStateLayerKind::TransientAutomation: - return "transient automation"; - case RuntimeStateLayerKind::RenderLocal: - return "render local"; - case RuntimeStateLayerKind::HealthConfig: - return "health/config"; - default: - return "unknown"; - } -} - -int RuntimeStateLayerCompositionPrecedence(RuntimeStateLayerKind kind) -{ - switch (kind) - { - case RuntimeStateLayerKind::BasePersisted: - return 0; - case RuntimeStateLayerKind::CommittedLive: - return 1; - case RuntimeStateLayerKind::TransientAutomation: - return 2; - case RuntimeStateLayerKind::RenderLocal: - case RuntimeStateLayerKind::HealthConfig: - default: - return -1; - } -} - -bool RuntimeStateLayerIsDurable(RuntimeStateLayerKind kind) -{ - return kind == RuntimeStateLayerKind::BasePersisted; -} - -bool RuntimeStateLayerParticipatesInParameterComposition(RuntimeStateLayerKind kind) -{ - return RuntimeStateLayerCompositionPrecedence(kind) >= 0; -} - -bool RuntimeStateLayerIsRenderLocal(RuntimeStateLayerKind kind) -{ - return kind == RuntimeStateLayerKind::RenderLocal; -} - -RuntimeStateLayerKind ClassifyRuntimeStateField(RuntimeStateField field) -{ - switch (field) - { - case RuntimeStateField::PersistedLayerStack: - case RuntimeStateField::PersistedParameterValues: - case RuntimeStateField::StackPresets: - return RuntimeStateLayerKind::BasePersisted; - case RuntimeStateField::CommittedSessionParameterValues: - case RuntimeStateField::CommittedLayerBypass: - case RuntimeStateField::RuntimeCompileReloadFlags: - return RuntimeStateLayerKind::CommittedLive; - case RuntimeStateField::TransientOscOverlay: - case RuntimeStateField::TransientAutomationCommitState: - return RuntimeStateLayerKind::TransientAutomation; - case RuntimeStateField::RenderLocalTemporalHistory: - case RuntimeStateField::RenderLocalFeedbackState: - case RuntimeStateField::RenderLocalInputFrames: - case RuntimeStateField::RenderLocalOutputFrames: - return RuntimeStateLayerKind::RenderLocal; - case RuntimeStateField::RuntimeConfiguration: - case RuntimeStateField::HealthTelemetry: - default: - return RuntimeStateLayerKind::HealthConfig; - } -} - -std::vector GetRuntimeStateLayerInventory() -{ - return { - { - RuntimeStateLayerKind::BasePersisted, - "Base persisted state", - "RuntimeStore / LayerStackStore", - "Survives restart", - "Written to disk", - "Default layer stack, shader selections, saved parameter values" - }, - { - RuntimeStateLayerKind::CommittedLive, - "Committed live state", - "RuntimeCoordinator / CommittedLiveState", - "Current running session", - "May request persistence depending on mutation policy", - "Operator/session truth until changed again" - }, - { - RuntimeStateLayerKind::TransientAutomation, - "Transient automation overlay", - "RuntimeLiveState / RuntimeServiceLiveBridge", - "High-rate and short-lived", - "Not persisted directly", - "Temporary OSC/automation target applied over committed truth" - }, - { - RuntimeStateLayerKind::RenderLocal, - "Render-local state", - "RenderEngine", - "Render-thread/resource lifetime", - "Not persisted", - "Temporal history, feedback, input/output queues, and GL-local caches" - }, - { - RuntimeStateLayerKind::HealthConfig, - "Health/config state", - "RuntimeConfigStore / HealthTelemetry", - "Config survives restart; health is observational", - "Config is file-backed; health is reported, not composed", - "Does not participate in parameter composition" - } - }; -} - -std::vector GetRuntimeStateFieldInventory() -{ - return { - { - RuntimeStateField::PersistedLayerStack, - ClassifyRuntimeStateField(RuntimeStateField::PersistedLayerStack), - "persisted layer stack", - "LayerStackStore", - "Durable layer order, ids, shader selections, and bypass flags" - }, - { - RuntimeStateField::PersistedParameterValues, - ClassifyRuntimeStateField(RuntimeStateField::PersistedParameterValues), - "persisted parameter values", - "LayerStackStore", - "Saved parameter values used as the baseline for snapshots and presets" - }, - { - RuntimeStateField::StackPresets, - ClassifyRuntimeStateField(RuntimeStateField::StackPresets), - "stack presets", - "RuntimeStore / LayerStackStore", - "Durable preset files and preset serialization shape" - }, - { - RuntimeStateField::CommittedSessionParameterValues, - ClassifyRuntimeStateField(RuntimeStateField::CommittedSessionParameterValues), - "committed session parameter values", - "RuntimeCoordinator policy, CommittedLiveState backing", - "Operator/API truth after accepted mutations" - }, - { - RuntimeStateField::CommittedLayerBypass, - ClassifyRuntimeStateField(RuntimeStateField::CommittedLayerBypass), - "committed layer bypass", - "RuntimeCoordinator policy, CommittedLiveState backing", - "Current operator/API bypass state" - }, - { - RuntimeStateField::RuntimeCompileReloadFlags, - ClassifyRuntimeStateField(RuntimeStateField::RuntimeCompileReloadFlags), - "runtime compile/reload flags", - "RuntimeCoordinator / RuntimeUpdateController", - "Session coordination state used to request snapshot or render rebuild work" - }, - { - RuntimeStateField::TransientOscOverlay, - ClassifyRuntimeStateField(RuntimeStateField::TransientOscOverlay), - "transient OSC overlays", - "RuntimeLiveState", - "High-rate automation values applied above committed state" - }, - { - RuntimeStateField::TransientAutomationCommitState, - ClassifyRuntimeStateField(RuntimeStateField::TransientAutomationCommitState), - "transient automation commit state", - "RuntimeLiveState / RuntimeServiceLiveBridge", - "Generation and completion bookkeeping for settled overlay commits" - }, - { - RuntimeStateField::RenderLocalTemporalHistory, - ClassifyRuntimeStateField(RuntimeStateField::RenderLocalTemporalHistory), - "render-local temporal history", - "RenderEngine", - "GL/resource history that must stay out of parameter layering" - }, - { - RuntimeStateField::RenderLocalFeedbackState, - ClassifyRuntimeStateField(RuntimeStateField::RenderLocalFeedbackState), - "render-local feedback state", - "RenderEngine", - "Feedback buffers and ping-pong resources" - }, - { - RuntimeStateField::RenderLocalInputFrames, - ClassifyRuntimeStateField(RuntimeStateField::RenderLocalInputFrames), - "render-local input frames", - "RenderEngine", - "Latest accepted input frame payloads and upload staging" - }, - { - RuntimeStateField::RenderLocalOutputFrames, - ClassifyRuntimeStateField(RuntimeStateField::RenderLocalOutputFrames), - "render-local output frames", - "RenderEngine", - "Readback, packed output, screenshot, and preview staging" - }, - { - RuntimeStateField::RuntimeConfiguration, - ClassifyRuntimeStateField(RuntimeStateField::RuntimeConfiguration), - "runtime configuration", - "RuntimeConfigStore", - "File-backed config, not a live parameter layer" - }, - { - RuntimeStateField::HealthTelemetry, - ClassifyRuntimeStateField(RuntimeStateField::HealthTelemetry), - "health telemetry", - "HealthTelemetry", - "Operational observations, not source state for render values" - } - }; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/live/RuntimeStateLayerModel.h b/apps/LoopThroughWithOpenGLCompositing/runtime/live/RuntimeStateLayerModel.h deleted file mode 100644 index 802ef9b..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/live/RuntimeStateLayerModel.h +++ /dev/null @@ -1,61 +0,0 @@ -#pragma once - -#include -#include - -enum class RuntimeStateLayerKind -{ - BasePersisted, - CommittedLive, - TransientAutomation, - RenderLocal, - HealthConfig -}; - -enum class RuntimeStateField -{ - PersistedLayerStack, - PersistedParameterValues, - StackPresets, - CommittedSessionParameterValues, - CommittedLayerBypass, - RuntimeCompileReloadFlags, - TransientOscOverlay, - TransientAutomationCommitState, - RenderLocalTemporalHistory, - RenderLocalFeedbackState, - RenderLocalInputFrames, - RenderLocalOutputFrames, - RuntimeConfiguration, - HealthTelemetry -}; - -struct RuntimeStateLayerDescriptor -{ - RuntimeStateLayerKind kind = RuntimeStateLayerKind::BasePersisted; - const char* name = ""; - const char* owner = ""; - const char* lifetime = ""; - const char* persistence = ""; - const char* renderRole = ""; -}; - -struct RuntimeStateFieldDescriptor -{ - RuntimeStateField field = RuntimeStateField::PersistedLayerStack; - RuntimeStateLayerKind layerKind = RuntimeStateLayerKind::BasePersisted; - const char* name = ""; - const char* currentOwner = ""; - const char* notes = ""; -}; - -const char* RuntimeStateLayerKindName(RuntimeStateLayerKind kind); -int RuntimeStateLayerCompositionPrecedence(RuntimeStateLayerKind kind); -bool RuntimeStateLayerIsDurable(RuntimeStateLayerKind kind); -bool RuntimeStateLayerParticipatesInParameterComposition(RuntimeStateLayerKind kind); -bool RuntimeStateLayerIsRenderLocal(RuntimeStateLayerKind kind); - -RuntimeStateLayerKind ClassifyRuntimeStateField(RuntimeStateField field); -std::vector GetRuntimeStateLayerInventory(); -std::vector GetRuntimeStateFieldInventory(); - diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/persistence/PersistenceRequest.h b/apps/LoopThroughWithOpenGLCompositing/runtime/persistence/PersistenceRequest.h deleted file mode 100644 index 455803a..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/persistence/PersistenceRequest.h +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once - -#include -#include -#include - -enum class PersistenceTargetKind -{ - RuntimeState, - StackPreset, - RuntimeConfig -}; - -struct PersistenceRequest -{ - PersistenceTargetKind targetKind = PersistenceTargetKind::RuntimeState; - std::string reason; - std::string debounceKey = "runtime-state"; - bool debounceAllowed = true; - bool flushRequested = false; - uint64_t sequence = 0; - - static PersistenceRequest RuntimeStateRequest(const std::string& reason) - { - PersistenceRequest request; - request.targetKind = PersistenceTargetKind::RuntimeState; - request.reason = reason; - request.debounceKey = "runtime-state"; - request.debounceAllowed = true; - return request; - } -}; - -struct PersistenceSnapshot -{ - PersistenceTargetKind targetKind = PersistenceTargetKind::RuntimeState; - std::filesystem::path targetPath; - std::string contents; - std::string reason; - std::string debounceKey; - bool debounceAllowed = false; - bool flushRequested = false; - uint64_t generation = 0; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/persistence/PersistenceWriter.cpp b/apps/LoopThroughWithOpenGLCompositing/runtime/persistence/PersistenceWriter.cpp deleted file mode 100644 index 5b1887b..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/persistence/PersistenceWriter.cpp +++ /dev/null @@ -1,271 +0,0 @@ -#include "PersistenceWriter.h" - -#include - -#include -#include -#include -#include - -PersistenceWriter::PersistenceWriter(std::chrono::milliseconds debounceDelay, SnapshotSink sink) : - mDebounceDelay(debounceDelay), - mSink(std::move(sink)) -{ -} - -PersistenceWriter::~PersistenceWriter() -{ - std::string error; - StopAndFlush((std::chrono::milliseconds::max)(), error); -} - -void PersistenceWriter::SetResultCallback(ResultCallback callback) -{ - std::lock_guard lock(mMutex); - mResultCallback = std::move(callback); -} - -bool PersistenceWriter::WriteSnapshot(const PersistenceSnapshot& snapshot, std::string& error) -{ - if (!ValidateSnapshot(snapshot, error)) - return false; - - const bool succeeded = WriteSnapshotThroughSink(snapshot, error); - PublishWriteResult(snapshot, succeeded, error, false); - return succeeded; -} - -bool PersistenceWriter::EnqueueSnapshot(const PersistenceSnapshot& snapshot, std::string& error) -{ - if (!ValidateSnapshot(snapshot, error)) - return false; - - std::lock_guard lock(mMutex); - if (!mAcceptingRequests) - { - error = "Persistence writer is stopping."; - return false; - } - - StartWorkerLocked(); - - const auto now = std::chrono::steady_clock::now(); - if (snapshot.debounceAllowed) - { - const std::string debounceKey = snapshot.debounceKey.empty() ? snapshot.targetPath.string() : snapshot.debounceKey; - PendingSnapshot& pending = mDebouncedSnapshots[debounceKey]; - if (!pending.snapshot.targetPath.empty()) - ++mCoalescedCount; - else - ++mEnqueuedCount; - - pending.snapshot = snapshot; - pending.readyAt = snapshot.flushRequested ? now : now + mDebounceDelay; - } - else - { - mImmediateSnapshots.push_back(snapshot); - ++mEnqueuedCount; - } - - mCondition.notify_one(); - return true; -} - -bool PersistenceWriter::StopAndFlush(std::chrono::milliseconds timeout, std::string& error) -{ - { - std::lock_guard lock(mMutex); - mAcceptingRequests = false; - mStopping = true; - const auto now = std::chrono::steady_clock::now(); - for (auto& entry : mDebouncedSnapshots) - entry.second.readyAt = now; - } - mCondition.notify_all(); - - std::unique_lock lock(mMutex); - if (mWorkerRunning) - { - if (timeout == (std::chrono::milliseconds::max)()) - { - mCondition.wait(lock, [this]() { return !mWorkerRunning; }); - } - else - { - const auto deadline = std::chrono::steady_clock::now() + timeout; - if (!mCondition.wait_until(lock, deadline, [this]() { return !mWorkerRunning; })) - { - error = "Timed out while flushing persistence writer."; - return false; - } - } - } - lock.unlock(); - - if (mWorker.joinable()) - mWorker.join(); - return true; -} - -PersistenceWriterMetrics PersistenceWriter::GetMetrics() const -{ - std::lock_guard lock(mMutex); - PersistenceWriterMetrics metrics; - metrics.pendingCount = PendingCountLocked(); - metrics.enqueuedCount = mEnqueuedCount; - metrics.coalescedCount = mCoalescedCount; - metrics.writtenCount = mWrittenCount; - metrics.failedCount = mFailedCount; - return metrics; -} - -bool PersistenceWriter::ValidateSnapshot(const PersistenceSnapshot& snapshot, std::string& error) const -{ - if (snapshot.targetPath.empty()) - { - error = "Persistence snapshot target path is empty."; - return false; - } - - return true; -} - -bool PersistenceWriter::WriteSnapshotThroughSink(const PersistenceSnapshot& snapshot, std::string& error) const -{ - if (mSink) - return mSink(snapshot, error); - - std::error_code fsError; - std::filesystem::create_directories(snapshot.targetPath.parent_path(), fsError); - - const std::filesystem::path temporaryPath = snapshot.targetPath.string() + ".tmp"; - std::ofstream output(temporaryPath, std::ios::binary | std::ios::trunc); - if (!output) - { - error = "Could not write file: " + temporaryPath.string(); - return false; - } - - output << snapshot.contents; - output.close(); - if (!output.good()) - { - error = "Could not finish writing file: " + temporaryPath.string(); - return false; - } - - if (!MoveFileExA(temporaryPath.string().c_str(), snapshot.targetPath.string().c_str(), MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH)) - { - const DWORD lastError = GetLastError(); - std::filesystem::remove(temporaryPath, fsError); - error = "Could not replace file: " + snapshot.targetPath.string() + " (Win32 error " + std::to_string(lastError) + ")"; - return false; - } - - return true; -} - -void PersistenceWriter::PublishWriteResult(const PersistenceSnapshot& snapshot, bool succeeded, const std::string& errorMessage, bool newerRequestPending) -{ - ResultCallback callback; - { - std::lock_guard lock(mMutex); - callback = mResultCallback; - } - - if (!callback) - return; - - PersistenceWriteResult result; - result.targetKind = snapshot.targetKind; - result.targetPath = snapshot.targetPath.string(); - result.reason = snapshot.reason; - result.succeeded = succeeded; - result.errorMessage = errorMessage; - result.newerRequestPending = newerRequestPending; - callback(result); -} - -void PersistenceWriter::StartWorkerLocked() -{ - if (mWorkerRunning) - return; - - mWorkerRunning = true; - mWorker = std::thread([this]() { WorkerMain(); }); -} - -void PersistenceWriter::WorkerMain() -{ - for (;;) - { - PersistenceSnapshot snapshot; - { - std::unique_lock lock(mMutex); - for (;;) - { - if (!mImmediateSnapshots.empty()) - { - snapshot = std::move(mImmediateSnapshots.front()); - mImmediateSnapshots.pop_front(); - break; - } - - if (!mDebouncedSnapshots.empty()) - { - const auto now = std::chrono::steady_clock::now(); - auto readyIt = mDebouncedSnapshots.end(); - auto nextReadyAt = (std::chrono::steady_clock::time_point::max)(); - for (auto it = mDebouncedSnapshots.begin(); it != mDebouncedSnapshots.end(); ++it) - { - if (it->second.readyAt <= now) - { - readyIt = it; - break; - } - if (it->second.readyAt < nextReadyAt) - nextReadyAt = it->second.readyAt; - } - - if (readyIt != mDebouncedSnapshots.end()) - { - snapshot = std::move(readyIt->second.snapshot); - mDebouncedSnapshots.erase(readyIt); - break; - } - - mCondition.wait_until(lock, nextReadyAt); - continue; - } - - if (mStopping) - { - mWorkerRunning = false; - mCondition.notify_all(); - return; - } - - mCondition.wait(lock); - } - } - - std::string error; - const bool succeeded = WriteSnapshotThroughSink(snapshot, error); - bool newerRequestPending = false; - { - std::lock_guard lock(mMutex); - if (succeeded) - ++mWrittenCount; - else - ++mFailedCount; - newerRequestPending = PendingCountLocked() > 0; - } - PublishWriteResult(snapshot, succeeded, error, newerRequestPending); - } -} - -std::size_t PersistenceWriter::PendingCountLocked() const -{ - return mImmediateSnapshots.size() + mDebouncedSnapshots.size(); -} diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/persistence/PersistenceWriter.h b/apps/LoopThroughWithOpenGLCompositing/runtime/persistence/PersistenceWriter.h deleted file mode 100644 index 232ac7e..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/persistence/PersistenceWriter.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include "PersistenceRequest.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct PersistenceWriterMetrics -{ - std::size_t pendingCount = 0; - uint64_t enqueuedCount = 0; - uint64_t coalescedCount = 0; - uint64_t writtenCount = 0; - uint64_t failedCount = 0; -}; - -struct PersistenceWriteResult -{ - PersistenceTargetKind targetKind = PersistenceTargetKind::RuntimeState; - std::string targetPath; - std::string reason; - bool succeeded = false; - std::string errorMessage; - bool newerRequestPending = false; -}; - -class PersistenceWriter -{ -public: - using SnapshotSink = std::function; - using ResultCallback = std::function; - - explicit PersistenceWriter( - std::chrono::milliseconds debounceDelay = std::chrono::milliseconds(50), - SnapshotSink sink = SnapshotSink()); - ~PersistenceWriter(); - - void SetResultCallback(ResultCallback callback); - bool WriteSnapshot(const PersistenceSnapshot& snapshot, std::string& error); - bool EnqueueSnapshot(const PersistenceSnapshot& snapshot, std::string& error); - bool StopAndFlush(std::chrono::milliseconds timeout, std::string& error); - PersistenceWriterMetrics GetMetrics() const; - -private: - struct PendingSnapshot - { - PersistenceSnapshot snapshot; - std::chrono::steady_clock::time_point readyAt; - }; - - bool ValidateSnapshot(const PersistenceSnapshot& snapshot, std::string& error) const; - bool WriteSnapshotThroughSink(const PersistenceSnapshot& snapshot, std::string& error) const; - void PublishWriteResult(const PersistenceSnapshot& snapshot, bool succeeded, const std::string& errorMessage, bool newerRequestPending); - void StartWorkerLocked(); - void WorkerMain(); - std::size_t PendingCountLocked() const; - - std::chrono::milliseconds mDebounceDelay; - SnapshotSink mSink; - ResultCallback mResultCallback; - mutable std::mutex mMutex; - std::condition_variable mCondition; - std::thread mWorker; - bool mWorkerRunning = false; - bool mStopping = false; - bool mAcceptingRequests = true; - std::unordered_map mDebouncedSnapshots; - std::deque mImmediateSnapshots; - uint64_t mEnqueuedCount = 0; - uint64_t mCoalescedCount = 0; - uint64_t mWrittenCount = 0; - uint64_t mFailedCount = 0; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/presentation/RuntimeStateJson.cpp b/apps/LoopThroughWithOpenGLCompositing/runtime/presentation/RuntimeStateJson.cpp deleted file mode 100644 index f947b9b..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/presentation/RuntimeStateJson.cpp +++ /dev/null @@ -1,170 +0,0 @@ -#include "RuntimeStateJson.h" - -#include "RuntimeParameterUtils.h" - -namespace -{ -std::string ShaderParameterTypeToString(ShaderParameterType type) -{ - switch (type) - { - case ShaderParameterType::Float: return "float"; - case ShaderParameterType::Vec2: return "vec2"; - case ShaderParameterType::Color: return "color"; - case ShaderParameterType::Boolean: return "bool"; - case ShaderParameterType::Enum: return "enum"; - case ShaderParameterType::Text: return "text"; - case ShaderParameterType::Trigger: return "trigger"; - } - return "unknown"; -} -} - -JsonValue RuntimeStateJson::SerializeLayerStack(const LayerStackStore& layerStack, const ShaderPackageCatalog& shaderCatalog) -{ - std::map packagesById; - for (const std::string& packageId : shaderCatalog.PackageOrder()) - { - ShaderPackage shaderPackage; - if (shaderCatalog.CopyPackage(packageId, shaderPackage)) - packagesById[packageId] = shaderPackage; - } - return SerializeLayerStack(layerStack.Layers(), packagesById); -} - -JsonValue RuntimeStateJson::SerializeLayerStack(const std::vector& layerStates, const std::map& packagesById) -{ - JsonValue layersValue = JsonValue::MakeArray(); - for (const LayerStackStore::LayerPersistentState& layer : layerStates) - { - auto shaderIt = packagesById.find(layer.shaderId); - if (shaderIt == packagesById.end()) - continue; - const ShaderPackage& shaderPackage = shaderIt->second; - - JsonValue layerValue = JsonValue::MakeObject(); - layerValue.set("id", JsonValue(layer.id)); - layerValue.set("shaderId", JsonValue(layer.shaderId)); - layerValue.set("shaderName", JsonValue(shaderPackage.displayName)); - layerValue.set("bypass", JsonValue(layer.bypass)); - if (shaderPackage.temporal.enabled) - { - JsonValue temporal = JsonValue::MakeObject(); - temporal.set("enabled", JsonValue(true)); - temporal.set("historySource", JsonValue(TemporalHistorySourceToString(shaderPackage.temporal.historySource))); - temporal.set("requestedHistoryLength", JsonValue(static_cast(shaderPackage.temporal.requestedHistoryLength))); - temporal.set("effectiveHistoryLength", JsonValue(static_cast(shaderPackage.temporal.effectiveHistoryLength))); - layerValue.set("temporal", temporal); - } - if (shaderPackage.feedback.enabled) - { - JsonValue feedback = JsonValue::MakeObject(); - feedback.set("enabled", JsonValue(true)); - feedback.set("writePass", JsonValue(shaderPackage.feedback.writePassId)); - layerValue.set("feedback", feedback); - } - - JsonValue parameters = JsonValue::MakeArray(); - for (const ShaderParameterDefinition& definition : shaderPackage.parameters) - { - JsonValue parameter = JsonValue::MakeObject(); - parameter.set("id", JsonValue(definition.id)); - parameter.set("label", JsonValue(definition.label)); - if (!definition.description.empty()) - parameter.set("description", JsonValue(definition.description)); - parameter.set("type", JsonValue(ShaderParameterTypeToString(definition.type))); - parameter.set("defaultValue", SerializeParameterValue(definition, DefaultValueForDefinition(definition))); - - if (!definition.minNumbers.empty()) - { - JsonValue minValue = JsonValue::MakeArray(); - for (double number : definition.minNumbers) - minValue.pushBack(JsonValue(number)); - parameter.set("min", minValue); - } - if (!definition.maxNumbers.empty()) - { - JsonValue maxValue = JsonValue::MakeArray(); - for (double number : definition.maxNumbers) - maxValue.pushBack(JsonValue(number)); - parameter.set("max", maxValue); - } - if (!definition.stepNumbers.empty()) - { - JsonValue stepValue = JsonValue::MakeArray(); - for (double number : definition.stepNumbers) - stepValue.pushBack(JsonValue(number)); - parameter.set("step", stepValue); - } - if (definition.type == ShaderParameterType::Enum) - { - JsonValue options = JsonValue::MakeArray(); - for (const ShaderParameterOption& option : definition.enumOptions) - { - JsonValue optionValue = JsonValue::MakeObject(); - optionValue.set("value", JsonValue(option.value)); - optionValue.set("label", JsonValue(option.label)); - options.pushBack(optionValue); - } - parameter.set("options", options); - } - if (definition.type == ShaderParameterType::Text) - { - parameter.set("maxLength", JsonValue(static_cast(definition.maxLength))); - if (!definition.fontId.empty()) - parameter.set("font", JsonValue(definition.fontId)); - } - - ShaderParameterValue value = DefaultValueForDefinition(definition); - auto valueIt = layer.parameterValues.find(definition.id); - if (valueIt != layer.parameterValues.end()) - value = valueIt->second; - parameter.set("value", SerializeParameterValue(definition, value)); - parameters.pushBack(parameter); - } - - layerValue.set("parameters", parameters); - layersValue.pushBack(layerValue); - } - return layersValue; -} - -JsonValue RuntimeStateJson::SerializeParameterValue(const ShaderParameterDefinition& definition, const ShaderParameterValue& value) -{ - switch (definition.type) - { - case ShaderParameterType::Boolean: - return JsonValue(value.booleanValue); - case ShaderParameterType::Enum: - return JsonValue(value.enumValue); - case ShaderParameterType::Text: - return JsonValue(value.textValue); - case ShaderParameterType::Trigger: - return JsonValue(value.numberValues.empty() ? 0.0 : value.numberValues.front()); - case ShaderParameterType::Float: - return JsonValue(value.numberValues.empty() ? 0.0 : value.numberValues.front()); - case ShaderParameterType::Vec2: - case ShaderParameterType::Color: - { - JsonValue array = JsonValue::MakeArray(); - for (double number : value.numberValues) - array.pushBack(JsonValue(number)); - return array; - } - } - return JsonValue(); -} - -std::string RuntimeStateJson::TemporalHistorySourceToString(TemporalHistorySource source) -{ - switch (source) - { - case TemporalHistorySource::Source: - return "source"; - case TemporalHistorySource::PreLayerInput: - return "preLayerInput"; - case TemporalHistorySource::None: - default: - return "none"; - } -} diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/presentation/RuntimeStateJson.h b/apps/LoopThroughWithOpenGLCompositing/runtime/presentation/RuntimeStateJson.h deleted file mode 100644 index c6a4243..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/presentation/RuntimeStateJson.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include "LayerStackStore.h" -#include "RuntimeJson.h" -#include "ShaderPackageCatalog.h" -#include "ShaderTypes.h" - -#include -#include -#include - -class RuntimeStateJson -{ -public: - static JsonValue SerializeLayerStack(const LayerStackStore& layerStack, const ShaderPackageCatalog& shaderCatalog); - static JsonValue SerializeLayerStack(const std::vector& layers, const std::map& packagesById); - static JsonValue SerializeParameterValue(const ShaderParameterDefinition& definition, const ShaderParameterValue& value); - static std::string TemporalHistorySourceToString(TemporalHistorySource source); -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/presentation/RuntimeStatePresenter.cpp b/apps/LoopThroughWithOpenGLCompositing/runtime/presentation/RuntimeStatePresenter.cpp deleted file mode 100644 index d0fe3c3..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/presentation/RuntimeStatePresenter.cpp +++ /dev/null @@ -1,230 +0,0 @@ -#include "RuntimeStatePresenter.h" - -#include "RuntimeStateJson.h" -#include "RuntimeStore.h" - -std::string RuntimeStatePresenter::BuildRuntimeStateJson(const RuntimeStore& runtimeStore) -{ - return SerializeJson(BuildRuntimeStateValue(runtimeStore), true); -} - -JsonValue RuntimeStatePresenter::BuildRuntimeStateValue(const RuntimeStore& runtimeStore) -{ - const RuntimeStatePresentationReadModel model = runtimeStore.BuildRuntimeStatePresentationReadModel(); - const HealthTelemetry::Snapshot& telemetrySnapshot = model.telemetry; - - JsonValue root = JsonValue::MakeObject(); - - JsonValue app = JsonValue::MakeObject(); - app.set("serverPort", JsonValue(static_cast(model.serverPort))); - app.set("oscPort", JsonValue(static_cast(model.config.oscPort))); - app.set("oscBindAddress", JsonValue(model.config.oscBindAddress)); - app.set("oscSmoothing", JsonValue(model.config.oscSmoothing)); - app.set("autoReload", JsonValue(model.autoReloadEnabled)); - app.set("maxTemporalHistoryFrames", JsonValue(static_cast(model.config.maxTemporalHistoryFrames))); - app.set("previewFps", JsonValue(static_cast(model.config.previewFps))); - app.set("enableExternalKeying", JsonValue(model.config.enableExternalKeying)); - app.set("inputVideoFormat", JsonValue(model.config.inputVideoFormat)); - app.set("inputFrameRate", JsonValue(model.config.inputFrameRate)); - app.set("outputVideoFormat", JsonValue(model.config.outputVideoFormat)); - app.set("outputFrameRate", JsonValue(model.config.outputFrameRate)); - root.set("app", app); - - JsonValue runtime = JsonValue::MakeObject(); - runtime.set("layerCount", JsonValue(static_cast(model.layerStack.LayerCount()))); - runtime.set("compileSucceeded", JsonValue(model.compileSucceeded)); - runtime.set("compileMessage", JsonValue(model.compileMessage)); - root.set("runtime", runtime); - - JsonValue video = JsonValue::MakeObject(); - video.set("hasSignal", JsonValue(telemetrySnapshot.signal.hasSignal)); - video.set("width", JsonValue(static_cast(telemetrySnapshot.signal.width))); - video.set("height", JsonValue(static_cast(telemetrySnapshot.signal.height))); - video.set("modeName", JsonValue(telemetrySnapshot.signal.modeName)); - root.set("video", video); - - JsonValue deckLink = JsonValue::MakeObject(); - deckLink.set("modelName", JsonValue(telemetrySnapshot.videoIO.modelName)); - deckLink.set("supportsInternalKeying", JsonValue(telemetrySnapshot.videoIO.supportsInternalKeying)); - deckLink.set("supportsExternalKeying", JsonValue(telemetrySnapshot.videoIO.supportsExternalKeying)); - deckLink.set("keyerInterfaceAvailable", JsonValue(telemetrySnapshot.videoIO.keyerInterfaceAvailable)); - deckLink.set("externalKeyingRequested", JsonValue(telemetrySnapshot.videoIO.externalKeyingRequested)); - deckLink.set("externalKeyingActive", JsonValue(telemetrySnapshot.videoIO.externalKeyingActive)); - deckLink.set("statusMessage", JsonValue(telemetrySnapshot.videoIO.statusMessage)); - deckLink.set("actualBufferedFramesAvailable", JsonValue(telemetrySnapshot.backendPlayout.actualDeckLinkBufferedFramesAvailable)); - deckLink.set("actualBufferedFrames", JsonValue(static_cast(telemetrySnapshot.backendPlayout.actualDeckLinkBufferedFrames))); - deckLink.set("targetBufferedFrames", JsonValue(static_cast(telemetrySnapshot.backendPlayout.targetDeckLinkBufferedFrames))); - deckLink.set("scheduleCallMs", JsonValue(telemetrySnapshot.backendPlayout.deckLinkScheduleCallMilliseconds)); - deckLink.set("scheduleFailures", JsonValue(static_cast(telemetrySnapshot.backendPlayout.deckLinkScheduleFailureCount))); - root.set("decklink", deckLink); - - JsonValue videoIO = JsonValue::MakeObject(); - videoIO.set("backend", JsonValue(telemetrySnapshot.videoIO.backendName)); - videoIO.set("modelName", JsonValue(telemetrySnapshot.videoIO.modelName)); - videoIO.set("supportsInternalKeying", JsonValue(telemetrySnapshot.videoIO.supportsInternalKeying)); - videoIO.set("supportsExternalKeying", JsonValue(telemetrySnapshot.videoIO.supportsExternalKeying)); - videoIO.set("keyerInterfaceAvailable", JsonValue(telemetrySnapshot.videoIO.keyerInterfaceAvailable)); - videoIO.set("externalKeyingRequested", JsonValue(telemetrySnapshot.videoIO.externalKeyingRequested)); - videoIO.set("externalKeyingActive", JsonValue(telemetrySnapshot.videoIO.externalKeyingActive)); - videoIO.set("statusMessage", JsonValue(telemetrySnapshot.videoIO.statusMessage)); - root.set("videoIO", videoIO); - - JsonValue performance = JsonValue::MakeObject(); - performance.set("frameBudgetMs", JsonValue(telemetrySnapshot.performance.frameBudgetMilliseconds)); - performance.set("renderMs", JsonValue(telemetrySnapshot.performance.renderMilliseconds)); - performance.set("smoothedRenderMs", JsonValue(telemetrySnapshot.performance.smoothedRenderMilliseconds)); - performance.set("budgetUsedPercent", JsonValue( - telemetrySnapshot.performance.frameBudgetMilliseconds > 0.0 - ? (telemetrySnapshot.performance.smoothedRenderMilliseconds / telemetrySnapshot.performance.frameBudgetMilliseconds) * 100.0 - : 0.0)); - performance.set("completionIntervalMs", JsonValue(telemetrySnapshot.performance.completionIntervalMilliseconds)); - performance.set("smoothedCompletionIntervalMs", JsonValue(telemetrySnapshot.performance.smoothedCompletionIntervalMilliseconds)); - performance.set("maxCompletionIntervalMs", JsonValue(telemetrySnapshot.performance.maxCompletionIntervalMilliseconds)); - performance.set("lateFrameCount", JsonValue(static_cast(telemetrySnapshot.performance.lateFrameCount))); - performance.set("droppedFrameCount", JsonValue(static_cast(telemetrySnapshot.performance.droppedFrameCount))); - performance.set("flushedFrameCount", JsonValue(static_cast(telemetrySnapshot.performance.flushedFrameCount))); - root.set("performance", performance); - - JsonValue readyQueue = JsonValue::MakeObject(); - readyQueue.set("depth", JsonValue(static_cast(telemetrySnapshot.backendPlayout.readyQueueDepth))); - readyQueue.set("capacity", JsonValue(static_cast(telemetrySnapshot.backendPlayout.readyQueueCapacity))); - readyQueue.set("minDepth", JsonValue(static_cast(telemetrySnapshot.backendPlayout.minReadyQueueDepth))); - readyQueue.set("maxDepth", JsonValue(static_cast(telemetrySnapshot.backendPlayout.maxReadyQueueDepth))); - readyQueue.set("zeroDepthCount", JsonValue(static_cast(telemetrySnapshot.backendPlayout.readyQueueZeroDepthCount))); - readyQueue.set("pushedCount", JsonValue(static_cast(telemetrySnapshot.backendPlayout.readyQueuePushedCount))); - readyQueue.set("poppedCount", JsonValue(static_cast(telemetrySnapshot.backendPlayout.readyQueuePoppedCount))); - readyQueue.set("droppedCount", JsonValue(static_cast(telemetrySnapshot.backendPlayout.readyQueueDroppedCount))); - readyQueue.set("underrunCount", JsonValue(static_cast(telemetrySnapshot.backendPlayout.readyQueueUnderrunCount))); - - JsonValue systemMemory = JsonValue::MakeObject(); - systemMemory.set("freeFrameCount", JsonValue(static_cast(telemetrySnapshot.backendPlayout.systemFramePoolFree))); - systemMemory.set("readyFrameCount", JsonValue(static_cast(telemetrySnapshot.backendPlayout.systemFramePoolReady))); - systemMemory.set("scheduledFrameCount", JsonValue(static_cast(telemetrySnapshot.backendPlayout.systemFramePoolScheduled))); - systemMemory.set("underrunCount", JsonValue(static_cast(telemetrySnapshot.backendPlayout.systemFrameUnderrunCount))); - systemMemory.set("repeatCount", JsonValue(static_cast(telemetrySnapshot.backendPlayout.systemFrameRepeatCount))); - systemMemory.set("dropCount", JsonValue(static_cast(telemetrySnapshot.backendPlayout.systemFrameDropCount))); - systemMemory.set("ageAtScheduleMs", JsonValue(telemetrySnapshot.backendPlayout.systemFrameAgeAtScheduleMilliseconds)); - systemMemory.set("ageAtCompletionMs", JsonValue(telemetrySnapshot.backendPlayout.systemFrameAgeAtCompletionMilliseconds)); - - JsonValue outputRender = JsonValue::MakeObject(); - outputRender.set("renderMs", JsonValue(telemetrySnapshot.backendPlayout.outputRenderMilliseconds)); - outputRender.set("smoothedRenderMs", JsonValue(telemetrySnapshot.backendPlayout.smoothedOutputRenderMilliseconds)); - outputRender.set("maxRenderMs", JsonValue(telemetrySnapshot.backendPlayout.maxOutputRenderMilliseconds)); - outputRender.set("acquireFrameMs", JsonValue(telemetrySnapshot.backendPlayout.outputFrameAcquireMilliseconds)); - outputRender.set("renderRequestMs", JsonValue(telemetrySnapshot.backendPlayout.outputFrameRenderRequestMilliseconds)); - outputRender.set("endAccessMs", JsonValue(telemetrySnapshot.backendPlayout.outputFrameEndAccessMilliseconds)); - outputRender.set("queueWaitMs", JsonValue(telemetrySnapshot.backendPlayout.outputRenderQueueWaitMilliseconds)); - outputRender.set("drawMs", JsonValue(telemetrySnapshot.backendPlayout.outputRenderDrawMilliseconds)); - outputRender.set("fenceWaitMs", JsonValue(telemetrySnapshot.backendPlayout.outputReadbackFenceWaitMilliseconds)); - outputRender.set("mapMs", JsonValue(telemetrySnapshot.backendPlayout.outputReadbackMapMilliseconds)); - outputRender.set("readbackCopyMs", JsonValue(telemetrySnapshot.backendPlayout.outputReadbackCopyMilliseconds)); - outputRender.set("cachedCopyMs", JsonValue(telemetrySnapshot.backendPlayout.outputCachedCopyMilliseconds)); - outputRender.set("asyncQueueMs", JsonValue(telemetrySnapshot.backendPlayout.outputAsyncQueueMilliseconds)); - outputRender.set("asyncQueueBufferMs", JsonValue(telemetrySnapshot.backendPlayout.outputAsyncQueueBufferMilliseconds)); - outputRender.set("asyncQueueSetupMs", JsonValue(telemetrySnapshot.backendPlayout.outputAsyncQueueSetupMilliseconds)); - outputRender.set("asyncQueueReadPixelsMs", JsonValue(telemetrySnapshot.backendPlayout.outputAsyncQueueReadPixelsMilliseconds)); - outputRender.set("asyncQueueFenceMs", JsonValue(telemetrySnapshot.backendPlayout.outputAsyncQueueFenceMilliseconds)); - outputRender.set("syncReadMs", JsonValue(telemetrySnapshot.backendPlayout.outputSyncReadMilliseconds)); - outputRender.set("asyncReadbackMissCount", JsonValue(static_cast(telemetrySnapshot.backendPlayout.outputAsyncReadbackMissCount))); - outputRender.set("cachedFallbackCount", JsonValue(static_cast(telemetrySnapshot.backendPlayout.outputCachedFallbackCount))); - outputRender.set("syncFallbackCount", JsonValue(static_cast(telemetrySnapshot.backendPlayout.outputSyncFallbackCount))); - - JsonValue recovery = JsonValue::MakeObject(); - recovery.set("completionResult", JsonValue(telemetrySnapshot.backendPlayout.completionResult)); - recovery.set("completedFrameIndex", JsonValue(static_cast(telemetrySnapshot.backendPlayout.completedFrameIndex))); - recovery.set("scheduledFrameIndex", JsonValue(static_cast(telemetrySnapshot.backendPlayout.scheduledFrameIndex))); - recovery.set("scheduledLeadFrames", JsonValue(static_cast(telemetrySnapshot.backendPlayout.scheduledLeadFrames))); - recovery.set("syntheticScheduledLeadFrames", JsonValue(static_cast(telemetrySnapshot.backendPlayout.scheduledLeadFrames))); - recovery.set("measuredLagFrames", JsonValue(static_cast(telemetrySnapshot.backendPlayout.measuredLagFrames))); - recovery.set("catchUpFrames", JsonValue(static_cast(telemetrySnapshot.backendPlayout.catchUpFrames))); - recovery.set("lateStreak", JsonValue(static_cast(telemetrySnapshot.backendPlayout.lateStreak))); - recovery.set("dropStreak", JsonValue(static_cast(telemetrySnapshot.backendPlayout.dropStreak))); - - JsonValue deckLinkPlayout = JsonValue::MakeObject(); - deckLinkPlayout.set("actualBufferedFramesAvailable", JsonValue(telemetrySnapshot.backendPlayout.actualDeckLinkBufferedFramesAvailable)); - deckLinkPlayout.set("actualBufferedFrames", JsonValue(static_cast(telemetrySnapshot.backendPlayout.actualDeckLinkBufferedFrames))); - deckLinkPlayout.set("targetBufferedFrames", JsonValue(static_cast(telemetrySnapshot.backendPlayout.targetDeckLinkBufferedFrames))); - deckLinkPlayout.set("scheduleCallMs", JsonValue(telemetrySnapshot.backendPlayout.deckLinkScheduleCallMilliseconds)); - deckLinkPlayout.set("scheduleFailures", JsonValue(static_cast(telemetrySnapshot.backendPlayout.deckLinkScheduleFailureCount))); - - JsonValue scheduler = JsonValue::MakeObject(); - scheduler.set("syntheticLeadFrames", JsonValue(static_cast(telemetrySnapshot.backendPlayout.scheduledLeadFrames))); - - JsonValue backendPlayout = JsonValue::MakeObject(); - backendPlayout.set("lifecycleState", JsonValue(telemetrySnapshot.backendPlayout.lifecycleState)); - backendPlayout.set("degraded", JsonValue(telemetrySnapshot.backendPlayout.degraded)); - backendPlayout.set("statusMessage", JsonValue(telemetrySnapshot.backendPlayout.statusMessage)); - backendPlayout.set("lateFrameCount", JsonValue(static_cast(telemetrySnapshot.backendPlayout.lateFrameCount))); - backendPlayout.set("droppedFrameCount", JsonValue(static_cast(telemetrySnapshot.backendPlayout.droppedFrameCount))); - backendPlayout.set("flushedFrameCount", JsonValue(static_cast(telemetrySnapshot.backendPlayout.flushedFrameCount))); - backendPlayout.set("readyQueue", readyQueue); - backendPlayout.set("systemMemory", systemMemory); - backendPlayout.set("outputRender", outputRender); - backendPlayout.set("decklink", deckLinkPlayout); - backendPlayout.set("scheduler", scheduler); - backendPlayout.set("recovery", recovery); - root.set("backendPlayout", backendPlayout); - - JsonValue eventQueue = JsonValue::MakeObject(); - eventQueue.set("name", JsonValue(telemetrySnapshot.runtimeEvents.queue.queueName)); - eventQueue.set("depth", JsonValue(static_cast(telemetrySnapshot.runtimeEvents.queue.depth))); - eventQueue.set("capacity", JsonValue(static_cast(telemetrySnapshot.runtimeEvents.queue.capacity))); - eventQueue.set("droppedCount", JsonValue(static_cast(telemetrySnapshot.runtimeEvents.queue.droppedCount))); - eventQueue.set("oldestEventAgeMs", JsonValue(telemetrySnapshot.runtimeEvents.queue.oldestEventAgeMilliseconds)); - - JsonValue eventDispatch = JsonValue::MakeObject(); - eventDispatch.set("dispatchCallCount", JsonValue(static_cast(telemetrySnapshot.runtimeEvents.dispatch.dispatchCallCount))); - eventDispatch.set("dispatchedEventCount", JsonValue(static_cast(telemetrySnapshot.runtimeEvents.dispatch.dispatchedEventCount))); - eventDispatch.set("handlerInvocationCount", JsonValue(static_cast(telemetrySnapshot.runtimeEvents.dispatch.handlerInvocationCount))); - eventDispatch.set("handlerFailureCount", JsonValue(static_cast(telemetrySnapshot.runtimeEvents.dispatch.handlerFailureCount))); - eventDispatch.set("lastDispatchDurationMs", JsonValue(telemetrySnapshot.runtimeEvents.dispatch.lastDispatchDurationMilliseconds)); - eventDispatch.set("maxDispatchDurationMs", JsonValue(telemetrySnapshot.runtimeEvents.dispatch.maxDispatchDurationMilliseconds)); - - JsonValue runtimeEvents = JsonValue::MakeObject(); - runtimeEvents.set("queue", eventQueue); - runtimeEvents.set("dispatch", eventDispatch); - root.set("runtimeEvents", runtimeEvents); - - JsonValue shaderLibrary = JsonValue::MakeArray(); - for (const ShaderPackageStatus& status : model.packageStatuses) - { - JsonValue shader = JsonValue::MakeObject(); - shader.set("id", JsonValue(status.id)); - shader.set("name", JsonValue(status.displayName)); - shader.set("description", JsonValue(status.description)); - shader.set("category", JsonValue(status.category)); - shader.set("available", JsonValue(status.available)); - if (!status.available) - shader.set("error", JsonValue(status.error)); - - auto shaderIt = model.shaderCatalog.packagesById.find(status.id); - if (status.available && shaderIt != model.shaderCatalog.packagesById.end() && shaderIt->second.temporal.enabled) - { - const ShaderPackage& shaderPackage = shaderIt->second; - JsonValue temporal = JsonValue::MakeObject(); - temporal.set("enabled", JsonValue(true)); - temporal.set("historySource", JsonValue(RuntimeStateJson::TemporalHistorySourceToString(shaderPackage.temporal.historySource))); - temporal.set("requestedHistoryLength", JsonValue(static_cast(shaderPackage.temporal.requestedHistoryLength))); - temporal.set("effectiveHistoryLength", JsonValue(static_cast(shaderPackage.temporal.effectiveHistoryLength))); - shader.set("temporal", temporal); - } - if (status.available && shaderIt != model.shaderCatalog.packagesById.end() && shaderIt->second.feedback.enabled) - { - const ShaderPackage& shaderPackage = shaderIt->second; - JsonValue feedback = JsonValue::MakeObject(); - feedback.set("enabled", JsonValue(true)); - feedback.set("writePass", JsonValue(shaderPackage.feedback.writePassId)); - shader.set("feedback", feedback); - } - shaderLibrary.pushBack(shader); - } - root.set("shaders", shaderLibrary); - - JsonValue stackPresets = JsonValue::MakeArray(); - for (const std::string& presetName : model.stackPresetNames) - stackPresets.pushBack(JsonValue(presetName)); - root.set("stackPresets", stackPresets); - - root.set("layers", RuntimeStateJson::SerializeLayerStack(model.layerStack.Layers(), model.shaderCatalog.packagesById)); - return root; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/presentation/RuntimeStatePresenter.h b/apps/LoopThroughWithOpenGLCompositing/runtime/presentation/RuntimeStatePresenter.h deleted file mode 100644 index 8022b15..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/presentation/RuntimeStatePresenter.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include "RuntimeJson.h" - -#include - -class RuntimeStore; - -class RuntimeStatePresenter -{ -public: - static std::string BuildRuntimeStateJson(const RuntimeStore& runtimeStore); - static JsonValue BuildRuntimeStateValue(const RuntimeStore& runtimeStore); -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/snapshot/RenderSnapshotBuilder.cpp b/apps/LoopThroughWithOpenGLCompositing/runtime/snapshot/RenderSnapshotBuilder.cpp deleted file mode 100644 index 14b5826..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/snapshot/RenderSnapshotBuilder.cpp +++ /dev/null @@ -1,193 +0,0 @@ -#include "RenderSnapshotBuilder.h" - -#include "RuntimeClock.h" -#include "RuntimeParameterUtils.h" -#include "RuntimeStore.h" -#include "ShaderCompiler.h" - -#include -#include -#include -#include -#include - -RenderSnapshotBuilder::RenderSnapshotBuilder(RuntimeStore& runtimeStore) : - mRuntimeStore(runtimeStore) -{ -} - -bool RenderSnapshotBuilder::BuildLayerPassFragmentShaderSources(const std::string& layerId, std::vector& passSources, std::string& error) const -{ - try - { - ShaderPackage shaderPackage; - if (!mRuntimeStore.CopyShaderPackageForStoredLayer(layerId, shaderPackage, error)) - return false; - - const ShaderCompilerInputs inputs = mRuntimeStore.GetShaderCompilerInputs(); - - ShaderCompiler compiler( - inputs.repoRoot, - inputs.wrapperPath, - inputs.generatedGlslPath, - inputs.patchedGlslPath, - inputs.maxTemporalHistoryFrames); - passSources.clear(); - passSources.reserve(shaderPackage.passes.size()); - for (const ShaderPassDefinition& pass : shaderPackage.passes) - { - ShaderPassBuildSource passSource; - passSource.passId = pass.id; - passSource.inputNames = pass.inputNames; - passSource.outputName = pass.outputName; - if (!compiler.BuildPassFragmentShaderSource(shaderPackage, pass, passSource.fragmentShaderSource, error)) - return false; - passSources.push_back(std::move(passSource)); - } - return true; - } - catch (const std::exception& exception) - { - error = std::string("RenderSnapshotBuilder::BuildLayerPassFragmentShaderSources exception: ") + exception.what(); - return false; - } - catch (...) - { - error = "RenderSnapshotBuilder::BuildLayerPassFragmentShaderSources threw a non-standard exception."; - return false; - } -} - -unsigned RenderSnapshotBuilder::GetMaxTemporalHistoryFrames() const -{ - return mRuntimeStore.GetConfiguredMaxTemporalHistoryFrames(); -} - -RuntimeSnapshotVersions RenderSnapshotBuilder::GetVersions() const -{ - RuntimeSnapshotVersions versions; - versions.renderStateVersion = mRenderStateVersion.load(std::memory_order_relaxed); - versions.parameterStateVersion = mParameterStateVersion.load(std::memory_order_relaxed); - return versions; -} - -void RenderSnapshotBuilder::AdvanceFrame() -{ - ++mFrameCounter; -} - -void RenderSnapshotBuilder::BuildLayerRenderStates(unsigned outputWidth, unsigned outputHeight, std::vector& states) const -{ - BuildLayerRenderStates(outputWidth, outputHeight, mRuntimeStore.BuildRenderSnapshotReadModel(), states); -} - -bool RenderSnapshotBuilder::TryBuildLayerRenderStates(unsigned outputWidth, unsigned outputHeight, std::vector& states) const -{ - BuildLayerRenderStates(outputWidth, outputHeight, mRuntimeStore.BuildRenderSnapshotReadModel(), states); - return true; -} - -bool RenderSnapshotBuilder::TryRefreshLayerParameters(std::vector& states) const -{ - RefreshLayerParameters(mRuntimeStore.CopyCommittedLiveLayerStates(), states); - return true; -} - -void RenderSnapshotBuilder::RefreshDynamicRenderStateFields(std::vector& states) const -{ - RefreshDynamicRenderStateFields(mRuntimeStore.GetRenderTimingSnapshot(), states); -} - -void RenderSnapshotBuilder::MarkRenderStateDirty() -{ - mRenderStateVersion.fetch_add(1, std::memory_order_relaxed); - mParameterStateVersion.fetch_add(1, std::memory_order_relaxed); -} - -void RenderSnapshotBuilder::MarkParameterStateDirty() -{ - mParameterStateVersion.fetch_add(1, std::memory_order_relaxed); -} - -void RenderSnapshotBuilder::BuildLayerRenderStates(unsigned outputWidth, unsigned outputHeight, const RenderSnapshotReadModel& readModel, std::vector& states) const -{ - states.clear(); - - for (const LayerStackStore::LayerPersistentState& layer : readModel.committedLiveState.layers) - { - auto shaderIt = readModel.committedLiveState.packagesById.find(layer.shaderId); - if (shaderIt == readModel.committedLiveState.packagesById.end()) - continue; - const ShaderPackage& shaderPackage = shaderIt->second; - - RuntimeRenderState state; - state.layerId = layer.id; - state.shaderId = layer.shaderId; - state.shaderName = shaderPackage.displayName; - state.mixAmount = 1.0; - state.bypass = layer.bypass ? 1.0 : 0.0; - state.inputWidth = readModel.signalStatus.width; - state.inputHeight = readModel.signalStatus.height; - state.outputWidth = outputWidth; - state.outputHeight = outputHeight; - state.parameterDefinitions = shaderPackage.parameters; - state.textureAssets = shaderPackage.textureAssets; - state.fontAssets = shaderPackage.fontAssets; - state.isTemporal = shaderPackage.temporal.enabled; - state.temporalHistorySource = shaderPackage.temporal.historySource; - state.requestedTemporalHistoryLength = shaderPackage.temporal.requestedHistoryLength; - state.effectiveTemporalHistoryLength = shaderPackage.temporal.effectiveHistoryLength; - state.feedback = shaderPackage.feedback; - - for (const ShaderParameterDefinition& definition : shaderPackage.parameters) - { - ShaderParameterValue value = DefaultValueForDefinition(definition); - auto valueIt = layer.parameterValues.find(definition.id); - if (valueIt != layer.parameterValues.end()) - value = valueIt->second; - state.parameterValues[definition.id] = value; - } - - states.push_back(state); - } - - RefreshDynamicRenderStateFields(readModel.timing, states); -} - -void RenderSnapshotBuilder::RefreshLayerParameters(const std::vector& layers, std::vector& states) const -{ - for (RuntimeRenderState& state : states) - { - const auto layerIt = std::find_if(layers.begin(), layers.end(), - [&state](const LayerStackStore::LayerPersistentState& layer) { return layer.id == state.layerId; }); - if (layerIt == layers.end()) - continue; - - state.bypass = layerIt->bypass ? 1.0 : 0.0; - state.parameterValues.clear(); - for (const ShaderParameterDefinition& definition : state.parameterDefinitions) - { - ShaderParameterValue value = DefaultValueForDefinition(definition); - auto valueIt = layerIt->parameterValues.find(definition.id); - if (valueIt != layerIt->parameterValues.end()) - value = valueIt->second; - state.parameterValues[definition.id] = value; - } - } -} - -void RenderSnapshotBuilder::RefreshDynamicRenderStateFields(const RenderTimingSnapshot& timing, std::vector& states) const -{ - const RuntimeClockSnapshot clock = GetRuntimeClockSnapshot(); - const double timeSeconds = std::chrono::duration_cast>(std::chrono::steady_clock::now() - timing.startTime).count(); - const double frameCount = static_cast(mFrameCounter.load(std::memory_order_relaxed)); - - for (RuntimeRenderState& state : states) - { - state.timeSeconds = timeSeconds; - state.utcTimeSeconds = clock.utcTimeSeconds; - state.utcOffsetSeconds = clock.utcOffsetSeconds; - state.startupRandom = timing.startupRandom; - state.frameCount = frameCount; - } -} diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/snapshot/RenderSnapshotBuilder.h b/apps/LoopThroughWithOpenGLCompositing/runtime/snapshot/RenderSnapshotBuilder.h deleted file mode 100644 index 37ced39..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/snapshot/RenderSnapshotBuilder.h +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once - -#include "RuntimeStoreReadModels.h" -#include "ShaderTypes.h" - -#include -#include -#include -#include - -class RuntimeStore; - -struct RuntimeSnapshotVersions -{ - uint64_t renderStateVersion = 0; - uint64_t parameterStateVersion = 0; -}; - -class RenderSnapshotBuilder -{ -public: - explicit RenderSnapshotBuilder(RuntimeStore& runtimeStore); - - bool BuildLayerPassFragmentShaderSources(const std::string& layerId, std::vector& passSources, std::string& error) const; - unsigned GetMaxTemporalHistoryFrames() const; - RuntimeSnapshotVersions GetVersions() const; - void AdvanceFrame(); - void BuildLayerRenderStates(unsigned outputWidth, unsigned outputHeight, std::vector& states) const; - bool TryBuildLayerRenderStates(unsigned outputWidth, unsigned outputHeight, std::vector& states) const; - bool TryRefreshLayerParameters(std::vector& states) const; - void RefreshDynamicRenderStateFields(std::vector& states) const; - void MarkRenderStateDirty(); - void MarkParameterStateDirty(); - -private: - void BuildLayerRenderStates(unsigned outputWidth, unsigned outputHeight, const RenderSnapshotReadModel& readModel, std::vector& states) const; - void RefreshLayerParameters(const std::vector& layers, std::vector& states) const; - void RefreshDynamicRenderStateFields(const RenderTimingSnapshot& timing, std::vector& states) const; - - RuntimeStore& mRuntimeStore; - std::atomic mFrameCounter{ 0 }; - std::atomic mRenderStateVersion{ 0 }; - std::atomic mParameterStateVersion{ 0 }; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/snapshot/RuntimeSnapshotProvider.cpp b/apps/LoopThroughWithOpenGLCompositing/runtime/snapshot/RuntimeSnapshotProvider.cpp deleted file mode 100644 index 00e3e89..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/snapshot/RuntimeSnapshotProvider.cpp +++ /dev/null @@ -1,196 +0,0 @@ -#include "RuntimeSnapshotProvider.h" - -#include "RuntimeEventDispatcher.h" - -#include - -#include - -RuntimeSnapshotProvider::RuntimeSnapshotProvider(RenderSnapshotBuilder& renderSnapshotBuilder, RuntimeEventDispatcher& runtimeEventDispatcher) : - mRenderSnapshotBuilder(renderSnapshotBuilder), - mRuntimeEventDispatcher(runtimeEventDispatcher) -{ -} - -bool RuntimeSnapshotProvider::BuildLayerPassFragmentShaderSources(const std::string& layerId, std::vector& passSources, std::string& error) const -{ - try - { - return mRenderSnapshotBuilder.BuildLayerPassFragmentShaderSources(layerId, passSources, error); - } - catch (const std::exception& exception) - { - error = std::string("RuntimeSnapshotProvider::BuildLayerPassFragmentShaderSources exception: ") + exception.what(); - return false; - } - catch (...) - { - error = "RuntimeSnapshotProvider::BuildLayerPassFragmentShaderSources threw a non-standard exception."; - return false; - } -} - -unsigned RuntimeSnapshotProvider::GetMaxTemporalHistoryFrames() const -{ - return mRenderSnapshotBuilder.GetMaxTemporalHistoryFrames(); -} - -RuntimeSnapshotVersions RuntimeSnapshotProvider::GetVersions() const -{ - return mRenderSnapshotBuilder.GetVersions(); -} - -void RuntimeSnapshotProvider::AdvanceFrame() -{ - mRenderSnapshotBuilder.AdvanceFrame(); -} - -RuntimeRenderStateSnapshot RuntimeSnapshotProvider::PublishRenderStateSnapshot(unsigned outputWidth, unsigned outputHeight) const -{ - PublishRenderSnapshotPublishRequested(outputWidth, outputHeight, "publish-render-state-snapshot"); - - for (;;) - { - const RuntimeSnapshotVersions versionsBefore = GetVersions(); - RuntimeRenderStateSnapshot publishedSnapshot; - if (TryGetPublishedRenderStateSnapshot(outputWidth, outputHeight, versionsBefore, publishedSnapshot)) - { - PublishRenderSnapshotPublished(publishedSnapshot); - return publishedSnapshot; - } - - RuntimeRenderStateSnapshot snapshot; - snapshot.outputWidth = outputWidth; - snapshot.outputHeight = outputHeight; - mRenderSnapshotBuilder.BuildLayerRenderStates(outputWidth, outputHeight, snapshot.states); - - const RuntimeSnapshotVersions versionsAfter = GetVersions(); - if (versionsBefore.renderStateVersion == versionsAfter.renderStateVersion && - versionsBefore.parameterStateVersion == versionsAfter.parameterStateVersion) - { - snapshot.versions = versionsAfter; - StorePublishedRenderStateSnapshot(snapshot); - PublishRenderSnapshotPublished(snapshot); - return snapshot; - } - } -} - -bool RuntimeSnapshotProvider::TryPublishRenderStateSnapshot(unsigned outputWidth, unsigned outputHeight, RuntimeRenderStateSnapshot& snapshot) const -{ - PublishRenderSnapshotPublishRequested(outputWidth, outputHeight, "try-publish-render-state-snapshot"); - - const RuntimeSnapshotVersions versionsBefore = GetVersions(); - if (TryGetPublishedRenderStateSnapshot(outputWidth, outputHeight, versionsBefore, snapshot)) - { - PublishRenderSnapshotPublished(snapshot); - return true; - } - - std::vector states; - if (!mRenderSnapshotBuilder.TryBuildLayerRenderStates(outputWidth, outputHeight, states)) - return false; - - const RuntimeSnapshotVersions versionsAfter = GetVersions(); - if (versionsBefore.renderStateVersion != versionsAfter.renderStateVersion || - versionsBefore.parameterStateVersion != versionsAfter.parameterStateVersion) - { - return false; - } - - snapshot.outputWidth = outputWidth; - snapshot.outputHeight = outputHeight; - snapshot.versions = versionsAfter; - snapshot.states = std::move(states); - StorePublishedRenderStateSnapshot(snapshot); - PublishRenderSnapshotPublished(snapshot); - return true; -} - -bool RuntimeSnapshotProvider::TryRefreshPublishedSnapshotParameters(RuntimeRenderStateSnapshot& snapshot) const -{ - const uint64_t expectedRenderStateVersion = snapshot.versions.renderStateVersion; - if (!mRenderSnapshotBuilder.TryRefreshLayerParameters(snapshot.states)) - return false; - - const RuntimeSnapshotVersions versions = GetVersions(); - if (versions.renderStateVersion != expectedRenderStateVersion) - return false; - - snapshot.versions = versions; - StorePublishedRenderStateSnapshot(snapshot); - PublishRenderSnapshotPublished(snapshot); - return true; -} - -void RuntimeSnapshotProvider::RefreshDynamicRenderStateFields(std::vector& states) const -{ - mRenderSnapshotBuilder.RefreshDynamicRenderStateFields(states); -} - -bool RuntimeSnapshotProvider::TryGetPublishedRenderStateSnapshot(unsigned outputWidth, unsigned outputHeight, - const RuntimeSnapshotVersions& versions, RuntimeRenderStateSnapshot& snapshot) const -{ - std::lock_guard lock(mPublishedSnapshotMutex); - if (!mHasPublishedRenderStateSnapshot || - !SnapshotMatches(mPublishedRenderStateSnapshot, outputWidth, outputHeight, versions)) - { - return false; - } - - snapshot = mPublishedRenderStateSnapshot; - return true; -} - -void RuntimeSnapshotProvider::StorePublishedRenderStateSnapshot(const RuntimeRenderStateSnapshot& snapshot) const -{ - std::lock_guard lock(mPublishedSnapshotMutex); - mPublishedRenderStateSnapshot = snapshot; - mHasPublishedRenderStateSnapshot = true; -} - -bool RuntimeSnapshotProvider::SnapshotMatches(const RuntimeRenderStateSnapshot& snapshot, unsigned outputWidth, unsigned outputHeight, - const RuntimeSnapshotVersions& versions) -{ - return snapshot.outputWidth == outputWidth && - snapshot.outputHeight == outputHeight && - snapshot.versions.renderStateVersion == versions.renderStateVersion && - snapshot.versions.parameterStateVersion == versions.parameterStateVersion; -} - -void RuntimeSnapshotProvider::PublishRenderSnapshotPublishRequested(unsigned outputWidth, unsigned outputHeight, const std::string& reason) const -{ - try - { - RenderSnapshotPublishRequestedEvent event; - event.outputWidth = outputWidth; - event.outputHeight = outputHeight; - event.reason = reason; - if (!mRuntimeEventDispatcher.PublishPayload(event, "RuntimeSnapshotProvider")) - OutputDebugStringA("RenderSnapshotPublishRequested event publish failed.\n"); - } - catch (...) - { - OutputDebugStringA("RenderSnapshotPublishRequested event publish threw.\n"); - } -} - -void RuntimeSnapshotProvider::PublishRenderSnapshotPublished(const RuntimeRenderStateSnapshot& snapshot) const -{ - try - { - RenderSnapshotPublishedEvent event; - event.snapshotVersion = snapshot.versions.renderStateVersion; - event.structureVersion = snapshot.versions.renderStateVersion; - event.parameterVersion = snapshot.versions.parameterStateVersion; - event.outputWidth = snapshot.outputWidth; - event.outputHeight = snapshot.outputHeight; - event.layerCount = snapshot.states.size(); - if (!mRuntimeEventDispatcher.PublishPayload(event, "RuntimeSnapshotProvider")) - OutputDebugStringA("RenderSnapshotPublished event publish failed.\n"); - } - catch (...) - { - OutputDebugStringA("RenderSnapshotPublished event publish threw.\n"); - } -} diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/snapshot/RuntimeSnapshotProvider.h b/apps/LoopThroughWithOpenGLCompositing/runtime/snapshot/RuntimeSnapshotProvider.h deleted file mode 100644 index cac112b..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/snapshot/RuntimeSnapshotProvider.h +++ /dev/null @@ -1,47 +0,0 @@ -#pragma once - -#include "RenderSnapshotBuilder.h" - -#include -#include -#include - -class RuntimeEventDispatcher; - -struct RuntimeRenderStateSnapshot -{ - RuntimeSnapshotVersions versions; - unsigned outputWidth = 0; - unsigned outputHeight = 0; - std::vector states; -}; - -class RuntimeSnapshotProvider -{ -public: - RuntimeSnapshotProvider(RenderSnapshotBuilder& renderSnapshotBuilder, RuntimeEventDispatcher& runtimeEventDispatcher); - - bool BuildLayerPassFragmentShaderSources(const std::string& layerId, std::vector& passSources, std::string& error) const; - unsigned GetMaxTemporalHistoryFrames() const; - RuntimeSnapshotVersions GetVersions() const; - void AdvanceFrame(); - RuntimeRenderStateSnapshot PublishRenderStateSnapshot(unsigned outputWidth, unsigned outputHeight) const; - bool TryPublishRenderStateSnapshot(unsigned outputWidth, unsigned outputHeight, RuntimeRenderStateSnapshot& snapshot) const; - bool TryRefreshPublishedSnapshotParameters(RuntimeRenderStateSnapshot& snapshot) const; - void RefreshDynamicRenderStateFields(std::vector& states) const; - -private: - bool TryGetPublishedRenderStateSnapshot(unsigned outputWidth, unsigned outputHeight, - const RuntimeSnapshotVersions& versions, RuntimeRenderStateSnapshot& snapshot) const; - void StorePublishedRenderStateSnapshot(const RuntimeRenderStateSnapshot& snapshot) const; - static bool SnapshotMatches(const RuntimeRenderStateSnapshot& snapshot, unsigned outputWidth, unsigned outputHeight, - const RuntimeSnapshotVersions& versions); - void PublishRenderSnapshotPublishRequested(unsigned outputWidth, unsigned outputHeight, const std::string& reason) const; - void PublishRenderSnapshotPublished(const RuntimeRenderStateSnapshot& snapshot) const; - - RenderSnapshotBuilder& mRenderSnapshotBuilder; - RuntimeEventDispatcher& mRuntimeEventDispatcher; - mutable std::mutex mPublishedSnapshotMutex; - mutable bool mHasPublishedRenderStateSnapshot = false; - mutable RuntimeRenderStateSnapshot mPublishedRenderStateSnapshot; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/store/LayerStackStore.cpp b/apps/LoopThroughWithOpenGLCompositing/runtime/store/LayerStackStore.cpp deleted file mode 100644 index 491fcb6..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/store/LayerStackStore.cpp +++ /dev/null @@ -1,738 +0,0 @@ -#include "LayerStackStore.h" - -#include "RuntimeParameterUtils.h" -#include "RuntimeStateJson.h" - -#include -#include -#include -#include -#include -#include - -namespace -{ -std::string TrimCopy(const std::string& text) -{ - std::size_t start = 0; - while (start < text.size() && std::isspace(static_cast(text[start]))) - ++start; - - std::size_t end = text.size(); - while (end > start && std::isspace(static_cast(text[end - 1]))) - --end; - - return text.substr(start, end - start); -} - -std::string SimplifyControlKey(const std::string& text) -{ - std::string simplified; - for (unsigned char ch : text) - { - if (std::isalnum(ch)) - simplified.push_back(static_cast(std::tolower(ch))); - } - return simplified; -} - -bool MatchesControlKey(const std::string& candidate, const std::string& key) -{ - return candidate == key || SimplifyControlKey(candidate) == SimplifyControlKey(key); -} - -bool TryParseLayerIdNumber(const std::string& layerId, uint64_t& number) -{ - const std::string prefix = "layer-"; - if (layerId.rfind(prefix, 0) != 0 || layerId.size() == prefix.size()) - return false; - - uint64_t parsed = 0; - for (std::size_t index = prefix.size(); index < layerId.size(); ++index) - { - const unsigned char ch = static_cast(layerId[index]); - if (!std::isdigit(ch)) - return false; - parsed = parsed * 10 + static_cast(ch - '0'); - } - - number = parsed; - return true; -} - -} - -bool LayerStackStore::LoadPersistentStateValue(const JsonValue& root) -{ - if (const JsonValue* layersValue = root.find("layers")) - { - for (const JsonValue& layerValue : layersValue->asArray()) - { - if (!layerValue.isObject()) - continue; - LayerPersistentState layer; - if (const JsonValue* idValue = layerValue.find("id")) - layer.id = idValue->asString(); - if (const JsonValue* shaderIdValue = layerValue.find("shaderId")) - layer.shaderId = shaderIdValue->asString(); - if (const JsonValue* bypassValue = layerValue.find("bypass")) - layer.bypass = bypassValue->asBoolean(false); - else if (const JsonValue* enabledValue = layerValue.find("enabled")) - layer.bypass = !enabledValue->asBoolean(true); - - if (const JsonValue* parameterValues = layerValue.find("parameterValues")) - { - for (const auto& parameterItem : parameterValues->asObject()) - { - ShaderParameterValue value; - const JsonValue& jsonValue = parameterItem.second; - if (jsonValue.isBoolean()) - value.booleanValue = jsonValue.asBoolean(); - else if (jsonValue.isString()) - value.enumValue = jsonValue.asString(); - else if (jsonValue.isNumber()) - value.numberValues.push_back(jsonValue.asNumber()); - else if (jsonValue.isArray()) - value.numberValues = JsonArrayToNumbers(jsonValue); - layer.parameterValues[parameterItem.first] = value; - } - } - - if (!layer.shaderId.empty()) - mLayers.push_back(layer); - } - } - else - { - std::string activeShaderId; - if (const JsonValue* activeShaderValue = root.find("activeShaderId")) - activeShaderId = activeShaderValue->asString(); - - if (!activeShaderId.empty()) - { - LayerPersistentState layer; - layer.id = GenerateLayerId(mLayers, mNextLayerId); - layer.shaderId = activeShaderId; - layer.bypass = false; - - if (const JsonValue* valuesByShader = root.find("parameterValuesByShader")) - { - const JsonValue* shaderValues = valuesByShader->find(activeShaderId); - if (shaderValues) - { - for (const auto& parameterItem : shaderValues->asObject()) - { - ShaderParameterValue value; - const JsonValue& jsonValue = parameterItem.second; - if (jsonValue.isBoolean()) - value.booleanValue = jsonValue.asBoolean(); - else if (jsonValue.isString()) - value.enumValue = jsonValue.asString(); - else if (jsonValue.isNumber()) - value.numberValues.push_back(jsonValue.asNumber()); - else if (jsonValue.isArray()) - value.numberValues = JsonArrayToNumbers(jsonValue); - layer.parameterValues[parameterItem.first] = value; - } - } - } - - mLayers.push_back(layer); - } - } - - return true; -} - -JsonValue LayerStackStore::BuildPersistentStateValue(const ShaderPackageCatalog& shaderCatalog) const -{ - JsonValue root = JsonValue::MakeObject(); - JsonValue layers = JsonValue::MakeArray(); - for (const LayerPersistentState& layer : mLayers) - { - JsonValue layerValue = JsonValue::MakeObject(); - layerValue.set("id", JsonValue(layer.id)); - layerValue.set("shaderId", JsonValue(layer.shaderId)); - layerValue.set("bypass", JsonValue(layer.bypass)); - - JsonValue parameterValues = JsonValue::MakeObject(); - const ShaderPackage* shaderPackage = shaderCatalog.FindPackage(layer.shaderId); - for (const auto& parameterItem : layer.parameterValues) - { - const ShaderParameterDefinition* definition = nullptr; - if (shaderPackage) - { - for (const ShaderParameterDefinition& candidate : shaderPackage->parameters) - { - if (candidate.id == parameterItem.first) - { - definition = &candidate; - break; - } - } - } - - if (definition) - parameterValues.set(parameterItem.first, RuntimeStateJson::SerializeParameterValue(*definition, parameterItem.second)); - } - - layerValue.set("parameterValues", parameterValues); - layers.pushBack(layerValue); - } - root.set("layers", layers); - return root; -} - -void LayerStackStore::NormalizeLayerIds() -{ - std::set usedIds; - uint64_t maxLayerNumber = mNextLayerId; - - for (LayerPersistentState& layer : mLayers) - { - uint64_t layerNumber = 0; - const bool hasReusableId = !layer.id.empty() && - usedIds.find(layer.id) == usedIds.end() && - TryParseLayerIdNumber(layer.id, layerNumber); - - if (hasReusableId) - { - usedIds.insert(layer.id); - maxLayerNumber = (std::max)(maxLayerNumber, layerNumber); - continue; - } - - do - { - ++maxLayerNumber; - layer.id = "layer-" + std::to_string(maxLayerNumber); - } - while (usedIds.find(layer.id) != usedIds.end()); - - usedIds.insert(layer.id); - } - - mNextLayerId = maxLayerNumber; -} - -void LayerStackStore::EnsureDefaultsForAllLayers(const ShaderPackageCatalog& shaderCatalog) -{ - for (LayerPersistentState& layer : mLayers) - { - const ShaderPackage* shaderPackage = shaderCatalog.FindPackage(layer.shaderId); - if (shaderPackage) - EnsureLayerDefaults(layer, *shaderPackage); - } -} - -void LayerStackStore::EnsureDefaultLayer(const ShaderPackageCatalog& shaderCatalog) -{ - if (!mLayers.empty() || shaderCatalog.PackageOrder().empty()) - return; - - LayerPersistentState layer; - layer.id = GenerateLayerId(mLayers, mNextLayerId); - layer.shaderId = shaderCatalog.PackageOrder().front(); - layer.bypass = false; - if (const ShaderPackage* shaderPackage = shaderCatalog.FindPackage(layer.shaderId)) - EnsureLayerDefaults(layer, *shaderPackage); - mLayers.push_back(layer); -} - -void LayerStackStore::RemoveLayersWithMissingPackages(const ShaderPackageCatalog& shaderCatalog) -{ - for (auto it = mLayers.begin(); it != mLayers.end();) - { - if (!shaderCatalog.HasPackage(it->shaderId)) - it = mLayers.erase(it); - else - ++it; - } -} - -bool LayerStackStore::CreateLayer(const ShaderPackageCatalog& shaderCatalog, const std::string& shaderId, std::string& error) -{ - const ShaderPackage* shaderPackage = shaderCatalog.FindPackage(shaderId); - if (!shaderPackage) - { - error = "Unknown shader id: " + shaderId; - return false; - } - - LayerPersistentState layer; - layer.id = GenerateLayerId(mLayers, mNextLayerId); - layer.shaderId = shaderId; - layer.bypass = false; - EnsureLayerDefaults(layer, *shaderPackage); - mLayers.push_back(layer); - return true; -} - -bool LayerStackStore::DeleteLayer(const std::string& layerId, std::string& error) -{ - auto it = std::find_if(mLayers.begin(), mLayers.end(), - [&layerId](const LayerPersistentState& layer) { return layer.id == layerId; }); - if (it == mLayers.end()) - { - error = "Unknown layer id: " + layerId; - return false; - } - - mLayers.erase(it); - return true; -} - -bool LayerStackStore::MoveLayer(const std::string& layerId, int direction, std::string& error) -{ - auto it = std::find_if(mLayers.begin(), mLayers.end(), - [&layerId](const LayerPersistentState& layer) { return layer.id == layerId; }); - if (it == mLayers.end()) - { - error = "Unknown layer id: " + layerId; - return false; - } - - const std::ptrdiff_t index = std::distance(mLayers.begin(), it); - const std::ptrdiff_t newIndex = index + direction; - if (newIndex < 0 || newIndex >= static_cast(mLayers.size())) - return true; - - std::swap(mLayers[index], mLayers[newIndex]); - return true; -} - -bool LayerStackStore::MoveLayerToIndex(const std::string& layerId, std::size_t targetIndex, std::string& error) -{ - auto it = std::find_if(mLayers.begin(), mLayers.end(), - [&layerId](const LayerPersistentState& layer) { return layer.id == layerId; }); - if (it == mLayers.end()) - { - error = "Unknown layer id: " + layerId; - return false; - } - - if (mLayers.empty()) - return true; - - if (targetIndex >= mLayers.size()) - targetIndex = mLayers.size() - 1; - - const std::size_t sourceIndex = static_cast(std::distance(mLayers.begin(), it)); - if (sourceIndex == targetIndex) - return true; - - LayerPersistentState movedLayer = *it; - mLayers.erase(mLayers.begin() + static_cast(sourceIndex)); - mLayers.insert(mLayers.begin() + static_cast(targetIndex), movedLayer); - return true; -} - -bool LayerStackStore::SetLayerBypassState(const std::string& layerId, bool bypassed, std::string& error) -{ - LayerPersistentState* layer = FindLayerById(layerId); - if (!layer) - { - error = "Unknown layer id: " + layerId; - return false; - } - - layer->bypass = bypassed; - return true; -} - -bool LayerStackStore::SetLayerShaderSelection(const ShaderPackageCatalog& shaderCatalog, const std::string& layerId, const std::string& shaderId, std::string& error) -{ - LayerPersistentState* layer = FindLayerById(layerId); - if (!layer) - { - error = "Unknown layer id: " + layerId; - return false; - } - - const ShaderPackage* shaderPackage = shaderCatalog.FindPackage(shaderId); - if (!shaderPackage) - { - error = "Unknown shader id: " + shaderId; - return false; - } - - layer->shaderId = shaderId; - layer->parameterValues.clear(); - EnsureLayerDefaults(*layer, *shaderPackage); - return true; -} - -bool LayerStackStore::SetParameterValue(const std::string& layerId, const std::string& parameterId, const ShaderParameterValue& value, std::string& error) -{ - LayerPersistentState* layer = FindLayerById(layerId); - if (!layer) - { - error = "Unknown layer id: " + layerId; - return false; - } - - layer->parameterValues[parameterId] = value; - return true; -} - -bool LayerStackStore::ResetLayerParameterValues(const ShaderPackageCatalog& shaderCatalog, const std::string& layerId, std::string& error) -{ - LayerPersistentState* layer = FindLayerById(layerId); - if (!layer) - { - error = "Unknown layer id: " + layerId; - return false; - } - - const ShaderPackage* shaderPackage = shaderCatalog.FindPackage(layer->shaderId); - if (!shaderPackage) - { - error = "Unknown shader id: " + layer->shaderId; - return false; - } - - layer->parameterValues.clear(); - EnsureLayerDefaults(*layer, *shaderPackage); - return true; -} - -bool LayerStackStore::HasLayer(const std::string& layerId) const -{ - return FindLayerById(layerId) != nullptr; -} - -bool LayerStackStore::TryGetParameterById(const ShaderPackageCatalog& shaderCatalog, const std::string& layerId, const std::string& parameterId, StoredParameterSnapshot& snapshot, std::string& error) const -{ - const LayerPersistentState* layer = FindLayerById(layerId); - if (!layer) - { - error = "Unknown layer id: " + layerId; - return false; - } - - const ShaderPackage* shaderPackage = shaderCatalog.FindPackage(layer->shaderId); - if (!shaderPackage) - { - error = "Unknown shader id: " + layer->shaderId; - return false; - } - - auto parameterIt = std::find_if(shaderPackage->parameters.begin(), shaderPackage->parameters.end(), - [¶meterId](const ShaderParameterDefinition& definition) { return definition.id == parameterId; }); - if (parameterIt == shaderPackage->parameters.end()) - { - error = "Unknown parameter id: " + parameterId; - return false; - } - - snapshot = StoredParameterSnapshot(); - snapshot.layerId = layer->id; - snapshot.definition = *parameterIt; - auto valueIt = layer->parameterValues.find(parameterIt->id); - if (valueIt != layer->parameterValues.end()) - { - snapshot.currentValue = valueIt->second; - snapshot.hasCurrentValue = true; - } - return true; -} - -bool LayerStackStore::TryGetParameterByControlKey(const ShaderPackageCatalog& shaderCatalog, const std::string& layerKey, const std::string& parameterKey, StoredParameterSnapshot& snapshot, std::string& error) const -{ - const LayerPersistentState* matchedLayer = nullptr; - const ShaderPackage* matchedPackage = nullptr; - - for (const LayerPersistentState& layer : mLayers) - { - const ShaderPackage* shaderPackage = shaderCatalog.FindPackage(layer.shaderId); - if (!shaderPackage) - continue; - - if (MatchesControlKey(layer.id, layerKey) || MatchesControlKey(shaderPackage->id, layerKey) || - MatchesControlKey(shaderPackage->displayName, layerKey)) - { - matchedLayer = &layer; - matchedPackage = shaderPackage; - break; - } - } - - if (!matchedLayer || !matchedPackage) - { - error = "Unknown OSC layer key: " + layerKey; - return false; - } - - auto parameterIt = std::find_if(matchedPackage->parameters.begin(), matchedPackage->parameters.end(), - [¶meterKey](const ShaderParameterDefinition& definition) - { - return MatchesControlKey(definition.id, parameterKey) || MatchesControlKey(definition.label, parameterKey); - }); - if (parameterIt == matchedPackage->parameters.end()) - { - error = "Unknown OSC parameter key: " + parameterKey; - return false; - } - - snapshot = StoredParameterSnapshot(); - snapshot.layerId = matchedLayer->id; - snapshot.definition = *parameterIt; - auto valueIt = matchedLayer->parameterValues.find(parameterIt->id); - if (valueIt != matchedLayer->parameterValues.end()) - { - snapshot.currentValue = valueIt->second; - snapshot.hasCurrentValue = true; - } - return true; -} - -bool LayerStackStore::ResolveLayerMove(const std::string& layerId, int direction, bool& shouldMove, std::string& error) const -{ - auto it = std::find_if(mLayers.begin(), mLayers.end(), - [&layerId](const LayerPersistentState& layer) { return layer.id == layerId; }); - if (it == mLayers.end()) - { - error = "Unknown layer id: " + layerId; - return false; - } - - const std::ptrdiff_t index = std::distance(mLayers.begin(), it); - const std::ptrdiff_t newIndex = index + direction; - shouldMove = newIndex >= 0 && newIndex < static_cast(mLayers.size()) && newIndex != index; - return true; -} - -bool LayerStackStore::ResolveLayerMoveToIndex(const std::string& layerId, std::size_t targetIndex, bool& shouldMove, std::string& error) const -{ - auto it = std::find_if(mLayers.begin(), mLayers.end(), - [&layerId](const LayerPersistentState& layer) { return layer.id == layerId; }); - if (it == mLayers.end()) - { - error = "Unknown layer id: " + layerId; - return false; - } - - if (mLayers.empty()) - { - shouldMove = false; - return true; - } - - const std::size_t clampedTargetIndex = (std::min)(targetIndex, mLayers.size() - 1); - const std::size_t sourceIndex = static_cast(std::distance(mLayers.begin(), it)); - shouldMove = sourceIndex != clampedTargetIndex; - return true; -} - -JsonValue LayerStackStore::BuildStackPresetValue(const ShaderPackageCatalog& shaderCatalog, const std::string& presetName) const -{ - JsonValue root = JsonValue::MakeObject(); - root.set("version", JsonValue(1.0)); - root.set("name", JsonValue(TrimCopy(presetName))); - root.set("layers", RuntimeStateJson::SerializeLayerStack(*this, shaderCatalog)); - return root; -} - -bool LayerStackStore::LoadStackPresetValue(const ShaderPackageCatalog& shaderCatalog, const JsonValue& root, std::string& error) -{ - const JsonValue* layersValue = root.find("layers"); - if (!layersValue || !layersValue->isArray()) - { - error = "Preset file is missing a valid 'layers' array."; - return false; - } - - std::vector nextLayers; - uint64_t nextLayerId = mNextLayerId; - if (!DeserializeLayerStack(shaderCatalog, *layersValue, nextLayers, nextLayerId, error)) - return false; - - if (nextLayers.empty()) - { - error = "Preset does not contain any valid layers."; - return false; - } - - mLayers = std::move(nextLayers); - mNextLayerId = nextLayerId; - return true; -} - -std::string LayerStackStore::MakeSafePresetFileStem(const std::string& presetName) -{ - return ::MakeSafePresetFileStem(presetName); -} - -const std::vector& LayerStackStore::Layers() const -{ - return mLayers; -} - -std::vector& LayerStackStore::Layers() -{ - return mLayers; -} - -std::size_t LayerStackStore::LayerCount() const -{ - return mLayers.size(); -} - -const LayerStackStore::LayerPersistentState* LayerStackStore::FindLayerById(const std::string& layerId) const -{ - auto it = std::find_if(mLayers.begin(), mLayers.end(), - [&layerId](const LayerPersistentState& layer) { return layer.id == layerId; }); - return it == mLayers.end() ? nullptr : &*it; -} - -LayerStackStore::LayerPersistentState* LayerStackStore::FindLayerById(const std::string& layerId) -{ - auto it = std::find_if(mLayers.begin(), mLayers.end(), - [&layerId](const LayerPersistentState& layer) { return layer.id == layerId; }); - return it == mLayers.end() ? nullptr : &*it; -} - -ShaderParameterValue LayerStackStore::DefaultValueForDefinition(const ShaderParameterDefinition& definition) -{ - return ::DefaultValueForDefinition(definition); -} - -void LayerStackStore::EnsureLayerDefaults(LayerPersistentState& layerState, const ShaderPackage& shaderPackage) -{ - for (const ShaderParameterDefinition& definition : shaderPackage.parameters) - { - auto valueIt = layerState.parameterValues.find(definition.id); - if (valueIt == layerState.parameterValues.end()) - { - layerState.parameterValues[definition.id] = DefaultValueForDefinition(definition); - continue; - } - - JsonValue valueJson; - bool shouldNormalize = true; - switch (definition.type) - { - case ShaderParameterType::Float: - if (valueIt->second.numberValues.empty()) - shouldNormalize = false; - else - valueJson = JsonValue(valueIt->second.numberValues.front()); - break; - case ShaderParameterType::Vec2: - case ShaderParameterType::Color: - valueJson = JsonValue::MakeArray(); - for (double number : valueIt->second.numberValues) - valueJson.pushBack(JsonValue(number)); - break; - case ShaderParameterType::Boolean: - valueJson = JsonValue(valueIt->second.booleanValue); - break; - case ShaderParameterType::Enum: - valueJson = JsonValue(valueIt->second.enumValue); - break; - case ShaderParameterType::Text: - { - const std::string textValue = !valueIt->second.textValue.empty() - ? valueIt->second.textValue - : valueIt->second.enumValue; - if (textValue.empty()) - { - valueIt->second = DefaultValueForDefinition(definition); - shouldNormalize = false; - } - else - { - valueJson = JsonValue(textValue); - } - break; - } - case ShaderParameterType::Trigger: - if (valueIt->second.numberValues.empty()) - valueJson = JsonValue(0.0); - else - valueJson = JsonValue((std::max)(0.0, std::floor(valueIt->second.numberValues.front()))); - break; - } - - if (!shouldNormalize) - continue; - - ShaderParameterValue normalizedValue; - std::string normalizeError; - if (NormalizeAndValidateParameterValue(definition, valueJson, normalizedValue, normalizeError)) - valueIt->second = normalizedValue; - else - valueIt->second = DefaultValueForDefinition(definition); - } -} - -bool LayerStackStore::DeserializeLayerStack(const ShaderPackageCatalog& shaderCatalog, const JsonValue& layersValue, std::vector& layers, uint64_t& nextLayerId, std::string& error) -{ - for (const JsonValue& layerValue : layersValue.asArray()) - { - if (!layerValue.isObject()) - continue; - - const JsonValue* shaderIdValue = layerValue.find("shaderId"); - if (!shaderIdValue) - continue; - - const std::string shaderId = shaderIdValue->asString(); - const ShaderPackage* shaderPackage = shaderCatalog.FindPackage(shaderId); - if (!shaderPackage) - { - error = "Preset references unknown shader id: " + shaderId; - return false; - } - - LayerPersistentState layer; - layer.id = GenerateLayerId(layers, nextLayerId); - layer.shaderId = shaderId; - if (const JsonValue* bypassValue = layerValue.find("bypass")) - layer.bypass = bypassValue->asBoolean(false); - - if (const JsonValue* parametersValue = layerValue.find("parameters")) - { - for (const JsonValue& parameterValue : parametersValue->asArray()) - { - if (!parameterValue.isObject()) - continue; - - const JsonValue* parameterIdValue = parameterValue.find("id"); - const JsonValue* valueValue = parameterValue.find("value"); - if (!parameterIdValue || !valueValue) - continue; - - const std::string parameterId = parameterIdValue->asString(); - auto definitionIt = std::find_if(shaderPackage->parameters.begin(), shaderPackage->parameters.end(), - [¶meterId](const ShaderParameterDefinition& definition) { return definition.id == parameterId; }); - if (definitionIt == shaderPackage->parameters.end()) - continue; - - ShaderParameterValue normalizedValue; - if (!NormalizeAndValidateParameterValue(*definitionIt, *valueValue, normalizedValue, error)) - return false; - - layer.parameterValues[parameterId] = normalizedValue; - } - } - - EnsureLayerDefaults(layer, *shaderPackage); - layers.push_back(layer); - } - - return true; -} - -std::string LayerStackStore::GenerateLayerId(std::vector& layers, uint64_t& nextLayerId) -{ - while (true) - { - ++nextLayerId; - const std::string candidate = "layer-" + std::to_string(nextLayerId); - auto it = std::find_if(layers.begin(), layers.end(), - [&candidate](const LayerPersistentState& layer) { return layer.id == candidate; }); - if (it == layers.end()) - return candidate; - } -} diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/store/LayerStackStore.h b/apps/LoopThroughWithOpenGLCompositing/runtime/store/LayerStackStore.h deleted file mode 100644 index f291b15..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/store/LayerStackStore.h +++ /dev/null @@ -1,72 +0,0 @@ -#pragma once - -#include "RuntimeJson.h" -#include "ShaderPackageCatalog.h" -#include "ShaderTypes.h" - -#include -#include -#include -#include -#include - -class LayerStackStore -{ -public: - struct LayerPersistentState - { - std::string id; - std::string shaderId; - bool bypass = false; - std::map parameterValues; - }; - - struct StoredParameterSnapshot - { - std::string layerId; - ShaderParameterDefinition definition; - ShaderParameterValue currentValue; - bool hasCurrentValue = false; - }; - - bool LoadPersistentStateValue(const JsonValue& root); - JsonValue BuildPersistentStateValue(const ShaderPackageCatalog& shaderCatalog) const; - void NormalizeLayerIds(); - void EnsureDefaultsForAllLayers(const ShaderPackageCatalog& shaderCatalog); - void EnsureDefaultLayer(const ShaderPackageCatalog& shaderCatalog); - void RemoveLayersWithMissingPackages(const ShaderPackageCatalog& shaderCatalog); - - bool CreateLayer(const ShaderPackageCatalog& shaderCatalog, const std::string& shaderId, std::string& error); - bool DeleteLayer(const std::string& layerId, std::string& error); - bool MoveLayer(const std::string& layerId, int direction, std::string& error); - bool MoveLayerToIndex(const std::string& layerId, std::size_t targetIndex, std::string& error); - bool SetLayerBypassState(const std::string& layerId, bool bypassed, std::string& error); - bool SetLayerShaderSelection(const ShaderPackageCatalog& shaderCatalog, const std::string& layerId, const std::string& shaderId, std::string& error); - bool SetParameterValue(const std::string& layerId, const std::string& parameterId, const ShaderParameterValue& value, std::string& error); - bool ResetLayerParameterValues(const ShaderPackageCatalog& shaderCatalog, const std::string& layerId, std::string& error); - - bool HasLayer(const std::string& layerId) const; - bool TryGetParameterById(const ShaderPackageCatalog& shaderCatalog, const std::string& layerId, const std::string& parameterId, StoredParameterSnapshot& snapshot, std::string& error) const; - bool TryGetParameterByControlKey(const ShaderPackageCatalog& shaderCatalog, const std::string& layerKey, const std::string& parameterKey, StoredParameterSnapshot& snapshot, std::string& error) const; - bool ResolveLayerMove(const std::string& layerId, int direction, bool& shouldMove, std::string& error) const; - bool ResolveLayerMoveToIndex(const std::string& layerId, std::size_t targetIndex, bool& shouldMove, std::string& error) const; - - JsonValue BuildStackPresetValue(const ShaderPackageCatalog& shaderCatalog, const std::string& presetName) const; - bool LoadStackPresetValue(const ShaderPackageCatalog& shaderCatalog, const JsonValue& root, std::string& error); - static std::string MakeSafePresetFileStem(const std::string& presetName); - - const std::vector& Layers() const; - std::vector& Layers(); - std::size_t LayerCount() const; - const LayerPersistentState* FindLayerById(const std::string& layerId) const; - LayerPersistentState* FindLayerById(const std::string& layerId); - -private: - static ShaderParameterValue DefaultValueForDefinition(const ShaderParameterDefinition& definition); - static void EnsureLayerDefaults(LayerPersistentState& layerState, const ShaderPackage& shaderPackage); - static bool DeserializeLayerStack(const ShaderPackageCatalog& shaderCatalog, const JsonValue& layersValue, std::vector& layers, uint64_t& nextLayerId, std::string& error); - static std::string GenerateLayerId(std::vector& layers, uint64_t& nextLayerId); - - std::vector mLayers; - uint64_t mNextLayerId = 0; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/store/RuntimeConfigStore.cpp b/apps/LoopThroughWithOpenGLCompositing/runtime/store/RuntimeConfigStore.cpp deleted file mode 100644 index 1d70151..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/store/RuntimeConfigStore.cpp +++ /dev/null @@ -1,270 +0,0 @@ -#include "RuntimeConfigStore.h" - -#include "RuntimeJson.h" - -#include -#include -#include -#include -#include - -namespace -{ -double Clamp01(double value) -{ - return (std::max)(0.0, (std::min)(1.0, value)); -} - -bool LooksLikePackagedRuntimeRoot(const std::filesystem::path& candidate) -{ - return std::filesystem::exists(candidate / "config" / "runtime-host.json") && - std::filesystem::exists(candidate / "runtime" / "templates" / "shader_wrapper.slang.in") && - std::filesystem::exists(candidate / "shaders"); -} - -bool LooksLikeRepoRoot(const std::filesystem::path& candidate) -{ - return std::filesystem::exists(candidate / "CMakeLists.txt") && - std::filesystem::exists(candidate / "apps" / "LoopThroughWithOpenGLCompositing"); -} - -std::filesystem::path FindRepoRootCandidate() -{ - std::vector rootsToTry; - - char currentDirectory[MAX_PATH] = {}; - if (GetCurrentDirectoryA(MAX_PATH, currentDirectory) > 0) - rootsToTry.push_back(std::filesystem::path(currentDirectory)); - - char modulePath[MAX_PATH] = {}; - DWORD moduleLength = GetModuleFileNameA(NULL, modulePath, MAX_PATH); - if (moduleLength > 0 && moduleLength < MAX_PATH) - rootsToTry.push_back(std::filesystem::path(modulePath).parent_path()); - - for (const std::filesystem::path& startPath : rootsToTry) - { - std::filesystem::path candidate = startPath; - for (int depth = 0; depth < 10 && !candidate.empty(); ++depth) - { - if (LooksLikePackagedRuntimeRoot(candidate) || LooksLikeRepoRoot(candidate)) - return candidate; - - candidate = candidate.parent_path(); - } - } - - return std::filesystem::path(); -} -} - -bool RuntimeConfigStore::Initialize(std::string& error) -{ - if (!ResolvePaths(error)) - return false; - if (!LoadConfig(error)) - return false; - RefreshConfigDependentPaths(); - return true; -} - -const RuntimeConfigStore::AppConfig& RuntimeConfigStore::GetConfig() const -{ - return mConfig; -} - -const std::filesystem::path& RuntimeConfigStore::GetRepoRoot() const -{ - return mRepoRoot; -} - -const std::filesystem::path& RuntimeConfigStore::GetUiRoot() const -{ - return mUiRoot; -} - -const std::filesystem::path& RuntimeConfigStore::GetDocsRoot() const -{ - return mDocsRoot; -} - -const std::filesystem::path& RuntimeConfigStore::GetShaderRoot() const -{ - return mShaderRoot; -} - -const std::filesystem::path& RuntimeConfigStore::GetRuntimeRoot() const -{ - return mRuntimeRoot; -} - -const std::filesystem::path& RuntimeConfigStore::GetPresetRoot() const -{ - return mPresetRoot; -} - -const std::filesystem::path& RuntimeConfigStore::GetRuntimeStatePath() const -{ - return mRuntimeStatePath; -} - -const std::filesystem::path& RuntimeConfigStore::GetWrapperPath() const -{ - return mWrapperPath; -} - -const std::filesystem::path& RuntimeConfigStore::GetGeneratedGlslPath() const -{ - return mGeneratedGlslPath; -} - -const std::filesystem::path& RuntimeConfigStore::GetPatchedGlslPath() const -{ - return mPatchedGlslPath; -} - -void RuntimeConfigStore::SetBoundControlServerPort(unsigned short port) -{ - mConfig.serverPort = port; -} - -bool RuntimeConfigStore::ResolvePaths(std::string& error) -{ - mRepoRoot = FindRepoRootCandidate(); - if (mRepoRoot.empty()) - { - error = "Could not locate the repository root from the current runtime path."; - return false; - } - - const std::filesystem::path builtUiRoot = mRepoRoot / "ui" / "dist"; - mUiRoot = std::filesystem::exists(builtUiRoot) ? builtUiRoot : (mRepoRoot / "ui"); - mDocsRoot = mRepoRoot / "docs"; - mConfigPath = mRepoRoot / "config" / "runtime-host.json"; - mRuntimeRoot = mRepoRoot / "runtime"; - mPresetRoot = mRuntimeRoot / "stack_presets"; - mRuntimeStatePath = mRuntimeRoot / "runtime_state.json"; - RefreshConfigDependentPaths(); - - std::error_code fsError; - std::filesystem::create_directories(mRuntimeRoot / "shader_cache", fsError); - std::filesystem::create_directories(mPresetRoot, fsError); - return true; -} - -bool RuntimeConfigStore::LoadConfig(std::string& error) -{ - if (!std::filesystem::exists(mConfigPath)) - return true; - - std::string configText = ReadTextFile(mConfigPath, error); - if (configText.empty()) - return false; - - JsonValue configJson; - if (!ParseJson(configText, configJson, error)) - return false; - - if (const JsonValue* shaderLibraryValue = configJson.find("shaderLibrary")) - mConfig.shaderLibrary = shaderLibraryValue->asString(); - if (const JsonValue* serverPortValue = configJson.find("serverPort")) - mConfig.serverPort = static_cast(serverPortValue->asNumber(mConfig.serverPort)); - if (const JsonValue* oscPortValue = configJson.find("oscPort")) - mConfig.oscPort = static_cast(oscPortValue->asNumber(mConfig.oscPort)); - if (const JsonValue* oscBindAddressValue = configJson.find("oscBindAddress")) - mConfig.oscBindAddress = oscBindAddressValue->asString(); - if (const JsonValue* oscSmoothingValue = configJson.find("oscSmoothing")) - mConfig.oscSmoothing = Clamp01(oscSmoothingValue->asNumber(mConfig.oscSmoothing)); - if (const JsonValue* autoReloadValue = configJson.find("autoReload")) - mConfig.autoReload = autoReloadValue->asBoolean(mConfig.autoReload); - if (const JsonValue* maxTemporalHistoryFramesValue = configJson.find("maxTemporalHistoryFrames")) - { - const double configuredValue = maxTemporalHistoryFramesValue->asNumber(static_cast(mConfig.maxTemporalHistoryFrames)); - mConfig.maxTemporalHistoryFrames = configuredValue <= 0.0 ? 0u : static_cast(configuredValue); - } - if (const JsonValue* previewFpsValue = configJson.find("previewFps")) - { - const double configuredValue = previewFpsValue->asNumber(static_cast(mConfig.previewFps)); - mConfig.previewFps = configuredValue <= 0.0 ? 0u : static_cast(configuredValue); - } - if (const JsonValue* enableExternalKeyingValue = configJson.find("enableExternalKeying")) - mConfig.enableExternalKeying = enableExternalKeyingValue->asBoolean(mConfig.enableExternalKeying); - if (const JsonValue* videoFormatValue = configJson.find("videoFormat")) - { - if (videoFormatValue->isString() && !videoFormatValue->asString().empty()) - { - mConfig.inputVideoFormat = videoFormatValue->asString(); - mConfig.outputVideoFormat = videoFormatValue->asString(); - } - } - if (const JsonValue* frameRateValue = configJson.find("frameRate")) - { - if (frameRateValue->isString() && !frameRateValue->asString().empty()) - { - mConfig.inputFrameRate = frameRateValue->asString(); - mConfig.outputFrameRate = frameRateValue->asString(); - } - else if (frameRateValue->isNumber()) - { - std::ostringstream stream; - stream << frameRateValue->asNumber(); - mConfig.inputFrameRate = stream.str(); - mConfig.outputFrameRate = stream.str(); - } - } - if (const JsonValue* inputVideoFormatValue = configJson.find("inputVideoFormat")) - { - if (inputVideoFormatValue->isString() && !inputVideoFormatValue->asString().empty()) - mConfig.inputVideoFormat = inputVideoFormatValue->asString(); - } - if (const JsonValue* inputFrameRateValue = configJson.find("inputFrameRate")) - { - if (inputFrameRateValue->isString() && !inputFrameRateValue->asString().empty()) - mConfig.inputFrameRate = inputFrameRateValue->asString(); - else if (inputFrameRateValue->isNumber()) - { - std::ostringstream stream; - stream << inputFrameRateValue->asNumber(); - mConfig.inputFrameRate = stream.str(); - } - } - if (const JsonValue* outputVideoFormatValue = configJson.find("outputVideoFormat")) - { - if (outputVideoFormatValue->isString() && !outputVideoFormatValue->asString().empty()) - mConfig.outputVideoFormat = outputVideoFormatValue->asString(); - } - if (const JsonValue* outputFrameRateValue = configJson.find("outputFrameRate")) - { - if (outputFrameRateValue->isString() && !outputFrameRateValue->asString().empty()) - mConfig.outputFrameRate = outputFrameRateValue->asString(); - else if (outputFrameRateValue->isNumber()) - { - std::ostringstream stream; - stream << outputFrameRateValue->asNumber(); - mConfig.outputFrameRate = stream.str(); - } - } - - return true; -} - -std::string RuntimeConfigStore::ReadTextFile(const std::filesystem::path& path, std::string& error) const -{ - std::ifstream input(path, std::ios::binary); - if (!input) - { - error = "Could not open file: " + path.string(); - return std::string(); - } - - std::ostringstream buffer; - buffer << input.rdbuf(); - return buffer.str(); -} - -void RuntimeConfigStore::RefreshConfigDependentPaths() -{ - mShaderRoot = mRepoRoot / mConfig.shaderLibrary; - mWrapperPath = mRuntimeRoot / "shader_cache" / "active_shader_wrapper.slang"; - mGeneratedGlslPath = mRuntimeRoot / "shader_cache" / "active_shader.raw.frag"; - mPatchedGlslPath = mRuntimeRoot / "shader_cache" / "active_shader.frag"; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/store/RuntimeConfigStore.h b/apps/LoopThroughWithOpenGLCompositing/runtime/store/RuntimeConfigStore.h deleted file mode 100644 index 399b234..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/store/RuntimeConfigStore.h +++ /dev/null @@ -1,59 +0,0 @@ -#pragma once - -#include -#include - -class RuntimeConfigStore -{ -public: - struct AppConfig - { - std::string shaderLibrary = "shaders"; - unsigned short serverPort = 8080; - unsigned short oscPort = 9000; - std::string oscBindAddress = "127.0.0.1"; - double oscSmoothing = 0.18; - bool autoReload = true; - unsigned maxTemporalHistoryFrames = 4; - unsigned previewFps = 30; - bool enableExternalKeying = false; - std::string inputVideoFormat = "1080p"; - std::string inputFrameRate = "59.94"; - std::string outputVideoFormat = "1080p"; - std::string outputFrameRate = "59.94"; - }; - - bool Initialize(std::string& error); - - const AppConfig& GetConfig() const; - const std::filesystem::path& GetRepoRoot() const; - const std::filesystem::path& GetUiRoot() const; - const std::filesystem::path& GetDocsRoot() const; - const std::filesystem::path& GetShaderRoot() const; - const std::filesystem::path& GetRuntimeRoot() const; - const std::filesystem::path& GetPresetRoot() const; - const std::filesystem::path& GetRuntimeStatePath() const; - const std::filesystem::path& GetWrapperPath() const; - const std::filesystem::path& GetGeneratedGlslPath() const; - const std::filesystem::path& GetPatchedGlslPath() const; - void SetBoundControlServerPort(unsigned short port); - -private: - bool ResolvePaths(std::string& error); - bool LoadConfig(std::string& error); - std::string ReadTextFile(const std::filesystem::path& path, std::string& error) const; - void RefreshConfigDependentPaths(); - - AppConfig mConfig; - std::filesystem::path mRepoRoot; - std::filesystem::path mUiRoot; - std::filesystem::path mDocsRoot; - std::filesystem::path mShaderRoot; - std::filesystem::path mRuntimeRoot; - std::filesystem::path mPresetRoot; - std::filesystem::path mRuntimeStatePath; - std::filesystem::path mConfigPath; - std::filesystem::path mWrapperPath; - std::filesystem::path mGeneratedGlslPath; - std::filesystem::path mPatchedGlslPath; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/store/RuntimeStore.cpp b/apps/LoopThroughWithOpenGLCompositing/runtime/store/RuntimeStore.cpp deleted file mode 100644 index 96a4026..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/store/RuntimeStore.cpp +++ /dev/null @@ -1,704 +0,0 @@ -#include "RuntimeStore.h" - -#include "RuntimeStatePresenter.h" - -#include -#include -#include -#include -#include - -namespace -{ -std::string ToLowerCopy(std::string text) -{ - std::transform(text.begin(), text.end(), text.begin(), - [](unsigned char ch) { return static_cast(std::tolower(ch)); }); - return text; -} - -double GenerateStartupRandom() -{ - std::random_device randomDevice; - std::uniform_real_distribution distribution(0.0, 1.0); - return distribution(randomDevice); -} - -std::string PersistenceTargetKindName(PersistenceTargetKind targetKind) -{ - switch (targetKind) - { - case PersistenceTargetKind::RuntimeState: - return "runtime-state"; - case PersistenceTargetKind::StackPreset: - return "stack-preset"; - case PersistenceTargetKind::RuntimeConfig: - return "runtime-config"; - default: - return "unknown"; - } -} - -} - -RuntimeStore::RuntimeStore() : - mRenderSnapshotBuilder(*this), - mReloadRequested(false), - mCompileSucceeded(false), - mStartupRandom(GenerateStartupRandom()), - mServerPort(8080), - mAutoReloadEnabled(true), - mStartTime(std::chrono::steady_clock::now()), - mLastScanTime((std::chrono::steady_clock::time_point::min)()) -{ - mPersistenceWriter.SetResultCallback([this](const PersistenceWriteResult& result) { - mHealthTelemetry.RecordPersistenceWriteResult( - result.succeeded, - PersistenceTargetKindName(result.targetKind), - result.targetPath, - result.reason, - result.errorMessage, - result.newerRequestPending); - }); -} - -HealthTelemetry& RuntimeStore::GetHealthTelemetry() -{ - return mHealthTelemetry; -} - -const HealthTelemetry& RuntimeStore::GetHealthTelemetry() const -{ - return mHealthTelemetry; -} - -RenderSnapshotBuilder& RuntimeStore::GetRenderSnapshotBuilder() -{ - return mRenderSnapshotBuilder; -} - -const RenderSnapshotBuilder& RuntimeStore::GetRenderSnapshotBuilder() const -{ - return mRenderSnapshotBuilder; -} - -bool RuntimeStore::InitializeStore(std::string& error) -{ - try - { - std::lock_guard lock(mMutex); - - if (!mConfigStore.Initialize(error)) - return false; - if (!LoadPersistentState(error)) - return false; - if (!ScanShaderPackages(error)) - return false; - mCommittedLiveState.NormalizeLayerIds(); - mCommittedLiveState.EnsureDefaultsForAllLayers(mShaderCatalog); - mCommittedLiveState.EnsureDefaultLayer(mShaderCatalog); - - mServerPort = mConfigStore.GetConfig().serverPort; - mAutoReloadEnabled = mConfigStore.GetConfig().autoReload; - mReloadRequested = true; - mCompileMessage = "Waiting for shader compile."; - return true; - } - catch (const std::exception& exception) - { - error = std::string("RuntimeStore::InitializeStore exception: ") + exception.what(); - return false; - } - catch (...) - { - error = "RuntimeStore::InitializeStore threw a non-standard exception."; - return false; - } -} - -std::string RuntimeStore::BuildPersistentStateJson() const -{ - return RuntimeStatePresenter::BuildRuntimeStateJson(*this); -} - -PersistenceSnapshot RuntimeStore::BuildRuntimeStatePersistenceSnapshot(const PersistenceRequest& request) const -{ - std::lock_guard lock(mMutex); - return BuildRuntimeStatePersistenceSnapshotLocked(request); -} - -bool RuntimeStore::RequestPersistence(const PersistenceRequest& request, std::string& error) -{ - if (request.targetKind != PersistenceTargetKind::RuntimeState) - { - error = "Unsupported persistence request target: " + PersistenceTargetKindName(request.targetKind); - mHealthTelemetry.RecordPersistenceWriteResult( - false, - PersistenceTargetKindName(request.targetKind), - std::string(), - request.reason, - error, - false); - return false; - } - - const PersistenceSnapshot snapshot = BuildRuntimeStatePersistenceSnapshot(request); - if (mPersistenceWriter.EnqueueSnapshot(snapshot, error)) - return true; - - mHealthTelemetry.RecordPersistenceWriteResult( - false, - PersistenceTargetKindName(request.targetKind), - snapshot.targetPath.string(), - request.reason, - error, - false); - return false; -} - -bool RuntimeStore::FlushPersistenceForShutdown(std::chrono::milliseconds timeout, std::string& error) -{ - if (mPersistenceWriter.StopAndFlush(timeout, error)) - return true; - - mHealthTelemetry.RecordPersistenceWriteResult( - false, - PersistenceTargetKindName(PersistenceTargetKind::RuntimeState), - std::string(), - "shutdown-flush", - error, - true); - return false; -} - -PersistenceSnapshot RuntimeStore::BuildRuntimeStatePersistenceSnapshotLocked(const PersistenceRequest& request) const -{ - PersistenceSnapshot snapshot; - snapshot.targetKind = PersistenceTargetKind::RuntimeState; - snapshot.targetPath = mConfigStore.GetRuntimeStatePath(); - snapshot.contents = SerializeJson(mCommittedLiveState.BuildPersistentStateValue(mShaderCatalog), true); - snapshot.reason = request.reason; - snapshot.debounceKey = request.debounceKey; - snapshot.debounceAllowed = request.debounceAllowed; - snapshot.flushRequested = request.flushRequested; - snapshot.generation = request.sequence; - return snapshot; -} - -bool RuntimeStore::PollStoredFileChanges(bool& registryChanged, bool& reloadRequested, std::string& error) -{ - try - { - std::lock_guard lock(mMutex); - registryChanged = false; - reloadRequested = false; - - if (!mAutoReloadEnabled) - { - reloadRequested = mReloadRequested; - return true; - } - - const auto now = std::chrono::steady_clock::now(); - if (mLastScanTime != (std::chrono::steady_clock::time_point::min)() && - std::chrono::duration_cast(now - mLastScanTime).count() < 250) - { - reloadRequested = mReloadRequested; - return true; - } - - mLastScanTime = now; - - std::string scanError; - const ShaderPackageCatalog::Snapshot previousCatalog = mShaderCatalog.CaptureSnapshot(); - if (!ScanShaderPackages(scanError)) - { - error = scanError; - return false; - } - - registryChanged = mShaderCatalog.HasCatalogChangedSince(previousCatalog); - - mCommittedLiveState.EnsureDefaultsForAllLayers(mShaderCatalog); - for (RuntimeStore::LayerPersistentState& layer : mCommittedLiveState.Layers()) - { - const ShaderPackage* active = mShaderCatalog.FindPackage(layer.shaderId); - if (!active) - continue; - if (mShaderCatalog.HasPackageChangedSince(previousCatalog, layer.shaderId)) - mReloadRequested = true; - } - - reloadRequested = mReloadRequested; - if (registryChanged || reloadRequested) - MarkRenderStateDirtyLocked(); - return true; - } - catch (const std::exception& exception) - { - error = std::string("RuntimeStore::PollStoredFileChanges exception: ") + exception.what(); - return false; - } - catch (...) - { - error = "RuntimeStore::PollStoredFileChanges threw a non-standard exception."; - return false; - } -} - -bool RuntimeStore::CreateStoredLayer(const std::string& shaderId, std::string& error) -{ - std::lock_guard lock(mMutex); - if (!mCommittedLiveState.CreateLayer(mShaderCatalog, shaderId, error)) - return false; - - mReloadRequested = true; - MarkRenderStateDirtyLocked(); - return true; -} - -bool RuntimeStore::DeleteStoredLayer(const std::string& layerId, std::string& error) -{ - std::lock_guard lock(mMutex); - if (!mCommittedLiveState.DeleteLayer(layerId, error)) - return false; - - mReloadRequested = true; - MarkRenderStateDirtyLocked(); - return true; -} - -bool RuntimeStore::MoveStoredLayer(const std::string& layerId, int direction, std::string& error) -{ - std::lock_guard lock(mMutex); - bool shouldMove = false; - if (!mCommittedLiveState.ResolveLayerMove(layerId, direction, shouldMove, error)) - return false; - if (!shouldMove) - return true; - - if (!mCommittedLiveState.MoveLayer(layerId, direction, error)) - return false; - - mReloadRequested = true; - MarkRenderStateDirtyLocked(); - return true; -} - -bool RuntimeStore::MoveStoredLayerToIndex(const std::string& layerId, std::size_t targetIndex, std::string& error) -{ - std::lock_guard lock(mMutex); - bool shouldMove = false; - if (!mCommittedLiveState.ResolveLayerMoveToIndex(layerId, targetIndex, shouldMove, error)) - return false; - if (!shouldMove) - return true; - - if (!mCommittedLiveState.MoveLayerToIndex(layerId, targetIndex, error)) - return false; - - mReloadRequested = true; - MarkRenderStateDirtyLocked(); - return true; -} - -bool RuntimeStore::SetStoredLayerBypassState(const std::string& layerId, bool bypassed, std::string& error) -{ - std::lock_guard lock(mMutex); - if (!mCommittedLiveState.SetLayerBypassState(layerId, bypassed, error)) - return false; - - mReloadRequested = true; - MarkParameterStateDirtyLocked(); - return true; -} - -bool RuntimeStore::SetStoredLayerShaderSelection(const std::string& layerId, const std::string& shaderId, std::string& error) -{ - std::lock_guard lock(mMutex); - if (!mCommittedLiveState.SetLayerShaderSelection(mShaderCatalog, layerId, shaderId, error)) - return false; - - mReloadRequested = true; - MarkRenderStateDirtyLocked(); - return true; -} - -bool RuntimeStore::SetStoredParameterValue(const std::string& layerId, const std::string& parameterId, const ShaderParameterValue& value, bool persistState, std::string& error) -{ - (void)persistState; - std::lock_guard lock(mMutex); - - if (!mCommittedLiveState.SetParameterValue(layerId, parameterId, value, error)) - return false; - - MarkParameterStateDirtyLocked(); - return true; -} - -bool RuntimeStore::ResetStoredLayerParameterValues(const std::string& layerId, std::string& error) -{ - std::lock_guard lock(mMutex); - - if (!mCommittedLiveState.ResetLayerParameterValues(mShaderCatalog, layerId, error)) - return false; - - MarkParameterStateDirtyLocked(); - return true; -} - -bool RuntimeStore::SaveStackPresetSnapshot(const std::string& presetName, std::string& error) const -{ - std::lock_guard lock(mMutex); - const std::string safeStem = LayerStackStore::MakeSafePresetFileStem(presetName); - if (safeStem.empty()) - { - error = "Preset name must include at least one letter or number."; - return false; - } - - return mPersistenceWriter.WriteSnapshot(BuildStackPresetPersistenceSnapshot(presetName), error); -} - -bool RuntimeStore::LoadStackPresetSnapshot(const std::string& presetName, std::string& error) -{ - std::lock_guard lock(mMutex); - const std::string safeStem = LayerStackStore::MakeSafePresetFileStem(presetName); - if (safeStem.empty()) - { - error = "Preset name must include at least one letter or number."; - return false; - } - - const std::filesystem::path presetPath = mConfigStore.GetPresetRoot() / (safeStem + ".json"); - std::string presetText = ReadTextFile(presetPath, error); - if (presetText.empty()) - return false; - - JsonValue root; - if (!ParseJson(presetText, root, error)) - return false; - - if (!mCommittedLiveState.LoadStackPresetValue(mShaderCatalog, root, error)) - return false; - - mReloadRequested = true; - MarkRenderStateDirtyLocked(); - return true; -} - -bool RuntimeStore::HasStoredLayer(const std::string& layerId) const -{ - std::lock_guard lock(mMutex); - return mCommittedLiveState.HasLayer(layerId); -} - -bool RuntimeStore::HasStoredShader(const std::string& shaderId) const -{ - std::lock_guard lock(mMutex); - return mShaderCatalog.HasPackage(shaderId); -} - -bool RuntimeStore::TryGetStoredParameterById(const std::string& layerId, const std::string& parameterId, StoredParameterSnapshot& snapshot, std::string& error) const -{ - std::lock_guard lock(mMutex); - - return mCommittedLiveState.TryGetParameterById(mShaderCatalog, layerId, parameterId, snapshot, error); -} - -bool RuntimeStore::TryGetStoredParameterByControlKey(const std::string& layerKey, const std::string& parameterKey, StoredParameterSnapshot& snapshot, std::string& error) const -{ - std::lock_guard lock(mMutex); - - return mCommittedLiveState.TryGetParameterByControlKey(mShaderCatalog, layerKey, parameterKey, snapshot, error); -} - -bool RuntimeStore::ResolveStoredLayerMove(const std::string& layerId, int direction, bool& shouldMove, std::string& error) const -{ - std::lock_guard lock(mMutex); - return mCommittedLiveState.ResolveLayerMove(layerId, direction, shouldMove, error); -} - -bool RuntimeStore::ResolveStoredLayerMoveToIndex(const std::string& layerId, std::size_t targetIndex, bool& shouldMove, std::string& error) const -{ - std::lock_guard lock(mMutex); - return mCommittedLiveState.ResolveLayerMoveToIndex(layerId, targetIndex, shouldMove, error); -} - -bool RuntimeStore::IsValidStackPresetName(const std::string& presetName) const -{ - return !LayerStackStore::MakeSafePresetFileStem(presetName).empty(); -} - -double RuntimeStore::GetRuntimeElapsedSeconds() const -{ - return std::chrono::duration_cast>( - std::chrono::steady_clock::now() - mStartTime).count(); -} - -const std::filesystem::path& RuntimeStore::GetRuntimeRepositoryRoot() const -{ - return mConfigStore.GetRepoRoot(); -} - -const std::filesystem::path& RuntimeStore::GetRuntimeUiRoot() const -{ - return mConfigStore.GetUiRoot(); -} - -const std::filesystem::path& RuntimeStore::GetRuntimeDocsRoot() const -{ - return mConfigStore.GetDocsRoot(); -} - -const std::filesystem::path& RuntimeStore::GetRuntimeDataRoot() const -{ - return mConfigStore.GetRuntimeRoot(); -} - -unsigned short RuntimeStore::GetConfiguredControlServerPort() const -{ - return mServerPort; -} - -unsigned short RuntimeStore::GetConfiguredOscPort() const -{ - return mConfigStore.GetConfig().oscPort; -} - -const std::string& RuntimeStore::GetConfiguredOscBindAddress() const -{ - return mConfigStore.GetConfig().oscBindAddress; -} - -double RuntimeStore::GetConfiguredOscSmoothing() const -{ - return mConfigStore.GetConfig().oscSmoothing; -} - -unsigned RuntimeStore::GetConfiguredMaxTemporalHistoryFrames() const -{ - return mConfigStore.GetConfig().maxTemporalHistoryFrames; -} - -unsigned RuntimeStore::GetConfiguredPreviewFps() const -{ - return mConfigStore.GetConfig().previewFps; -} - -bool RuntimeStore::IsExternalKeyingConfigured() const -{ - return mConfigStore.GetConfig().enableExternalKeying; -} - -const std::string& RuntimeStore::GetConfiguredInputVideoFormat() const -{ - return mConfigStore.GetConfig().inputVideoFormat; -} - -const std::string& RuntimeStore::GetConfiguredInputFrameRate() const -{ - return mConfigStore.GetConfig().inputFrameRate; -} - -const std::string& RuntimeStore::GetConfiguredOutputVideoFormat() const -{ - return mConfigStore.GetConfig().outputVideoFormat; -} - -const std::string& RuntimeStore::GetConfiguredOutputFrameRate() const -{ - return mConfigStore.GetConfig().outputFrameRate; -} - -void RuntimeStore::SetBoundControlServerPort(unsigned short port) -{ - std::lock_guard lock(mMutex); - mServerPort = port; - mConfigStore.SetBoundControlServerPort(port); -} - -void RuntimeStore::SetCompileStatus(bool succeeded, const std::string& message) -{ - std::lock_guard lock(mMutex); - mCompileSucceeded = succeeded; - mCompileMessage = message; -} - -void RuntimeStore::ClearReloadRequest() -{ - std::lock_guard lock(mMutex); - mReloadRequested = false; -} - -bool RuntimeStore::LoadPersistentState(std::string& error) -{ - if (!std::filesystem::exists(mConfigStore.GetRuntimeStatePath())) - return true; - - std::string stateText = ReadTextFile(mConfigStore.GetRuntimeStatePath(), error); - if (stateText.empty()) - return false; - - JsonValue root; - if (!ParseJson(stateText, root, error)) - return false; - - return mCommittedLiveState.LoadPersistentStateValue(root); -} - -PersistenceSnapshot RuntimeStore::BuildStackPresetPersistenceSnapshot(const std::string& presetName) const -{ - const std::string safeStem = LayerStackStore::MakeSafePresetFileStem(presetName); - - PersistenceSnapshot snapshot; - snapshot.targetKind = PersistenceTargetKind::StackPreset; - snapshot.targetPath = mConfigStore.GetPresetRoot() / (safeStem + ".json"); - snapshot.contents = SerializeJson(mCommittedLiveState.BuildStackPresetValue(mShaderCatalog, presetName), true); - snapshot.reason = "SaveStackPreset"; - snapshot.debounceKey = "stack-preset:" + safeStem; - snapshot.debounceAllowed = false; - snapshot.flushRequested = true; - snapshot.generation = 0; - return snapshot; -} - -bool RuntimeStore::ScanShaderPackages(std::string& error) -{ - if (!mShaderCatalog.Scan(mConfigStore.GetShaderRoot(), mConfigStore.GetConfig().maxTemporalHistoryFrames, error)) - return false; - - mCommittedLiveState.RemoveLayersWithMissingPackages(mShaderCatalog); - - MarkRenderStateDirtyLocked(); - return true; -} - -std::string RuntimeStore::ReadTextFile(const std::filesystem::path& path, std::string& error) const -{ - std::ifstream input(path, std::ios::binary); - if (!input) - { - error = "Could not open file: " + path.string(); - return std::string(); - } - - std::ostringstream buffer; - buffer << input.rdbuf(); - return buffer.str(); -} - -std::vector RuntimeStore::GetStackPresetNamesLocked() const -{ - std::vector presetNames; - std::error_code fsError; - if (!std::filesystem::exists(mConfigStore.GetPresetRoot(), fsError)) - return presetNames; - - for (const auto& entry : std::filesystem::directory_iterator(mConfigStore.GetPresetRoot(), fsError)) - { - if (!entry.is_regular_file()) - continue; - if (ToLowerCopy(entry.path().extension().string()) != ".json") - continue; - presetNames.push_back(entry.path().stem().string()); - } - - std::sort(presetNames.begin(), presetNames.end()); - return presetNames; -} - -bool RuntimeStore::CopyShaderPackageForStoredLayer(const std::string& layerId, ShaderPackage& shaderPackage, std::string& error) const -{ - std::lock_guard lock(mMutex); - const RuntimeStore::LayerPersistentState* layer = mCommittedLiveState.FindLayerById(layerId); - if (!layer) - { - error = "Unknown layer id: " + layerId; - return false; - } - - if (!mShaderCatalog.CopyPackage(layer->shaderId, shaderPackage)) - { - error = "Unknown shader id: " + layer->shaderId; - return false; - } - - return true; -} - -ShaderCompilerInputs RuntimeStore::GetShaderCompilerInputs() const -{ - std::lock_guard lock(mMutex); - ShaderCompilerInputs inputs; - inputs.repoRoot = mConfigStore.GetRepoRoot(); - inputs.wrapperPath = mConfigStore.GetWrapperPath(); - inputs.generatedGlslPath = mConfigStore.GetGeneratedGlslPath(); - inputs.patchedGlslPath = mConfigStore.GetPatchedGlslPath(); - inputs.maxTemporalHistoryFrames = mConfigStore.GetConfig().maxTemporalHistoryFrames; - return inputs; -} - -CommittedLiveStateReadModel RuntimeStore::BuildCommittedLiveStateReadModel() const -{ - std::lock_guard lock(mMutex); - return mCommittedLiveState.BuildReadModel(mShaderCatalog); -} - -RenderSnapshotReadModel RuntimeStore::BuildRenderSnapshotReadModel() const -{ - RenderSnapshotReadModel model; - model.signalStatus = mHealthTelemetry.GetSignalStatusSnapshot(); - model.committedLiveState = BuildCommittedLiveStateReadModel(); - std::lock_guard lock(mMutex); - model.timing.startTime = mStartTime; - model.timing.startupRandom = mStartupRandom; - return model; -} - -std::vector RuntimeStore::CopyCommittedLiveLayerStates() const -{ - std::lock_guard lock(mMutex); - return mCommittedLiveState.CopyLayerStates(); -} - -std::vector RuntimeStore::CopyLayerStates() const -{ - return CopyCommittedLiveLayerStates(); -} - -RenderTimingSnapshot RuntimeStore::GetRenderTimingSnapshot() const -{ - std::lock_guard lock(mMutex); - RenderTimingSnapshot snapshot; - snapshot.startTime = mStartTime; - snapshot.startupRandom = mStartupRandom; - return snapshot; -} - -RuntimeStatePresentationReadModel RuntimeStore::BuildRuntimeStatePresentationReadModel() const -{ - RuntimeStatePresentationReadModel model; - model.telemetry = mHealthTelemetry.GetSnapshot(); - std::lock_guard lock(mMutex); - model.config = mConfigStore.GetConfig(); - model.layerStack = mCommittedLiveState.LayerStack(); - model.shaderCatalog = mShaderCatalog.CaptureSnapshot(); - model.packageStatuses = mShaderCatalog.PackageStatuses(); - model.stackPresetNames = GetStackPresetNamesLocked(); - model.serverPort = mServerPort; - model.autoReloadEnabled = mAutoReloadEnabled; - model.compileSucceeded = mCompileSucceeded; - model.compileMessage = mCompileMessage; - return model; -} - -void RuntimeStore::MarkRenderStateDirtyLocked() -{ - mRenderSnapshotBuilder.MarkRenderStateDirty(); -} - -void RuntimeStore::MarkParameterStateDirtyLocked() -{ - mRenderSnapshotBuilder.MarkParameterStateDirty(); -} diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/store/RuntimeStore.h b/apps/LoopThroughWithOpenGLCompositing/runtime/store/RuntimeStore.h deleted file mode 100644 index 087b10f..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/store/RuntimeStore.h +++ /dev/null @@ -1,111 +0,0 @@ -#pragma once - -#include "HealthTelemetry.h" -#include "CommittedLiveState.h" -#include "LayerStackStore.h" -#include "PersistenceWriter.h" -#include "RenderSnapshotBuilder.h" -#include "RuntimeConfigStore.h" -#include "RuntimeJson.h" -#include "RuntimeStoreReadModels.h" -#include "ShaderPackageCatalog.h" -#include "ShaderTypes.h" - -#include -#include -#include -#include -#include - -class RuntimeStore -{ -public: - using StoredParameterSnapshot = LayerStackStore::StoredParameterSnapshot; - using LayerPersistentState = LayerStackStore::LayerPersistentState; - - RuntimeStore(); - HealthTelemetry& GetHealthTelemetry(); - const HealthTelemetry& GetHealthTelemetry() const; - RenderSnapshotBuilder& GetRenderSnapshotBuilder(); - const RenderSnapshotBuilder& GetRenderSnapshotBuilder() const; - - bool InitializeStore(std::string& error); - std::string BuildPersistentStateJson() const; - PersistenceSnapshot BuildRuntimeStatePersistenceSnapshot(const PersistenceRequest& request) const; - bool RequestPersistence(const PersistenceRequest& request, std::string& error); - bool FlushPersistenceForShutdown(std::chrono::milliseconds timeout, std::string& error); - bool PollStoredFileChanges(bool& registryChanged, bool& reloadRequested, std::string& error); - - bool CreateStoredLayer(const std::string& shaderId, std::string& error); - bool DeleteStoredLayer(const std::string& layerId, std::string& error); - bool MoveStoredLayer(const std::string& layerId, int direction, std::string& error); - bool MoveStoredLayerToIndex(const std::string& layerId, std::size_t targetIndex, std::string& error); - bool SetStoredLayerBypassState(const std::string& layerId, bool bypassed, std::string& error); - bool SetStoredLayerShaderSelection(const std::string& layerId, const std::string& shaderId, std::string& error); - bool SetStoredParameterValue(const std::string& layerId, const std::string& parameterId, const ShaderParameterValue& value, bool persistState, std::string& error); - bool ResetStoredLayerParameterValues(const std::string& layerId, std::string& error); - bool SaveStackPresetSnapshot(const std::string& presetName, std::string& error) const; - bool LoadStackPresetSnapshot(const std::string& presetName, std::string& error); - bool HasStoredLayer(const std::string& layerId) const; - bool HasStoredShader(const std::string& shaderId) const; - bool TryGetStoredParameterById(const std::string& layerId, const std::string& parameterId, StoredParameterSnapshot& snapshot, std::string& error) const; - bool TryGetStoredParameterByControlKey(const std::string& layerKey, const std::string& parameterKey, StoredParameterSnapshot& snapshot, std::string& error) const; - bool ResolveStoredLayerMove(const std::string& layerId, int direction, bool& shouldMove, std::string& error) const; - bool ResolveStoredLayerMoveToIndex(const std::string& layerId, std::size_t targetIndex, bool& shouldMove, std::string& error) const; - bool IsValidStackPresetName(const std::string& presetName) const; - double GetRuntimeElapsedSeconds() const; - - const std::filesystem::path& GetRuntimeRepositoryRoot() const; - const std::filesystem::path& GetRuntimeUiRoot() const; - const std::filesystem::path& GetRuntimeDocsRoot() const; - const std::filesystem::path& GetRuntimeDataRoot() const; - unsigned short GetConfiguredControlServerPort() const; - unsigned short GetConfiguredOscPort() const; - const std::string& GetConfiguredOscBindAddress() const; - double GetConfiguredOscSmoothing() const; - unsigned GetConfiguredMaxTemporalHistoryFrames() const; - unsigned GetConfiguredPreviewFps() const; - bool IsExternalKeyingConfigured() const; - const std::string& GetConfiguredInputVideoFormat() const; - const std::string& GetConfiguredInputFrameRate() const; - const std::string& GetConfiguredOutputVideoFormat() const; - const std::string& GetConfiguredOutputFrameRate() const; - void SetBoundControlServerPort(unsigned short port); - - void SetCompileStatus(bool succeeded, const std::string& message); - void ClearReloadRequest(); - bool CopyShaderPackageForStoredLayer(const std::string& layerId, ShaderPackage& shaderPackage, std::string& error) const; - ::ShaderCompilerInputs GetShaderCompilerInputs() const; - ::CommittedLiveStateReadModel BuildCommittedLiveStateReadModel() const; - ::RenderSnapshotReadModel BuildRenderSnapshotReadModel() const; - std::vector CopyCommittedLiveLayerStates() const; - std::vector CopyLayerStates() const; - ::RenderTimingSnapshot GetRenderTimingSnapshot() const; - ::RuntimeStatePresentationReadModel BuildRuntimeStatePresentationReadModel() const; - -private: - bool LoadPersistentState(std::string& error); - PersistenceSnapshot BuildRuntimeStatePersistenceSnapshotLocked(const PersistenceRequest& request) const; - PersistenceSnapshot BuildStackPresetPersistenceSnapshot(const std::string& presetName) const; - bool ScanShaderPackages(std::string& error); - std::string ReadTextFile(const std::filesystem::path& path, std::string& error) const; - std::vector GetStackPresetNamesLocked() const; - void MarkRenderStateDirtyLocked(); - void MarkParameterStateDirtyLocked(); - - RenderSnapshotBuilder mRenderSnapshotBuilder; - RuntimeConfigStore mConfigStore; - ShaderPackageCatalog mShaderCatalog; - CommittedLiveState mCommittedLiveState; - HealthTelemetry mHealthTelemetry; - mutable PersistenceWriter mPersistenceWriter; - mutable std::mutex mMutex; - bool mReloadRequested; - bool mCompileSucceeded; - std::string mCompileMessage; - double mStartupRandom; - unsigned short mServerPort; - bool mAutoReloadEnabled; - std::chrono::steady_clock::time_point mStartTime; - std::chrono::steady_clock::time_point mLastScanTime; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/store/RuntimeStoreReadModels.h b/apps/LoopThroughWithOpenGLCompositing/runtime/store/RuntimeStoreReadModels.h deleted file mode 100644 index e38af92..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/store/RuntimeStoreReadModels.h +++ /dev/null @@ -1,55 +0,0 @@ -#pragma once - -#include "HealthTelemetry.h" -#include "LayerStackStore.h" -#include "RuntimeConfigStore.h" -#include "ShaderPackageCatalog.h" -#include "ShaderTypes.h" - -#include -#include -#include -#include -#include - -struct ShaderCompilerInputs -{ - std::filesystem::path repoRoot; - std::filesystem::path wrapperPath; - std::filesystem::path generatedGlslPath; - std::filesystem::path patchedGlslPath; - unsigned maxTemporalHistoryFrames = 0; -}; - -struct RenderTimingSnapshot -{ - std::chrono::steady_clock::time_point startTime; - double startupRandom = 0.0; -}; - -struct CommittedLiveStateReadModel -{ - std::vector layers; - std::map packagesById; -}; - -struct RenderSnapshotReadModel -{ - CommittedLiveStateReadModel committedLiveState; - HealthTelemetry::SignalStatusSnapshot signalStatus; - RenderTimingSnapshot timing; -}; - -struct RuntimeStatePresentationReadModel -{ - RuntimeConfigStore::AppConfig config; - HealthTelemetry::Snapshot telemetry; - LayerStackStore layerStack; - ShaderPackageCatalog::Snapshot shaderCatalog; - std::vector packageStatuses; - std::vector stackPresetNames; - unsigned short serverPort = 0; - bool autoReloadEnabled = false; - bool compileSucceeded = false; - std::string compileMessage; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/store/ShaderPackageCatalog.cpp b/apps/LoopThroughWithOpenGLCompositing/runtime/store/ShaderPackageCatalog.cpp deleted file mode 100644 index b7f3153..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/store/ShaderPackageCatalog.cpp +++ /dev/null @@ -1,127 +0,0 @@ -#include "ShaderPackageCatalog.h" - -#include "ShaderPackageRegistry.h" - -bool ShaderPackageCatalog::Scan(const std::filesystem::path& shaderRoot, unsigned maxTemporalHistoryFrames, std::string& error) -{ - std::map packagesById; - std::vector packageOrder; - std::vector packageStatuses; - - ShaderPackageRegistry registry(maxTemporalHistoryFrames); - if (!registry.Scan(shaderRoot, packagesById, packageOrder, packageStatuses, error)) - return false; - - mPackagesById.swap(packagesById); - mPackageOrder.swap(packageOrder); - mPackageStatuses.swap(packageStatuses); - return true; -} - -ShaderPackageCatalog::Snapshot ShaderPackageCatalog::CaptureSnapshot() const -{ - Snapshot snapshot; - snapshot.packagesById = mPackagesById; - snapshot.packageOrder = mPackageOrder; - return snapshot; -} - -bool ShaderPackageCatalog::HasCatalogChangedSince(const Snapshot& snapshot) const -{ - if (snapshot.packageOrder != mPackageOrder || snapshot.packagesById.size() != mPackagesById.size()) - return true; - - for (const auto& item : mPackagesById) - { - auto previous = snapshot.packagesById.find(item.first); - if (previous == snapshot.packagesById.end() || !PackagesEquivalent(previous->second, item.second)) - return true; - } - - return false; -} - -bool ShaderPackageCatalog::HasPackageChangedSince(const Snapshot& snapshot, const std::string& shaderId) const -{ - auto previous = snapshot.packagesById.find(shaderId); - auto current = mPackagesById.find(shaderId); - if (previous == snapshot.packagesById.end() || current == mPackagesById.end()) - return previous != snapshot.packagesById.end() || current != mPackagesById.end(); - - return !PackagesEquivalent(previous->second, current->second); -} - -bool ShaderPackageCatalog::HasPackage(const std::string& shaderId) const -{ - return mPackagesById.find(shaderId) != mPackagesById.end(); -} - -const ShaderPackage* ShaderPackageCatalog::FindPackage(const std::string& shaderId) const -{ - auto it = mPackagesById.find(shaderId); - return it == mPackagesById.end() ? nullptr : &it->second; -} - -bool ShaderPackageCatalog::CopyPackage(const std::string& shaderId, ShaderPackage& shaderPackage) const -{ - const ShaderPackage* package = FindPackage(shaderId); - if (!package) - return false; - - shaderPackage = *package; - return true; -} - -const std::vector& ShaderPackageCatalog::PackageOrder() const -{ - return mPackageOrder; -} - -const std::vector& ShaderPackageCatalog::PackageStatuses() const -{ - return mPackageStatuses; -} - -bool ShaderPackageCatalog::PackagesEquivalent(const ShaderPackage& left, const ShaderPackage& right) -{ - return left.shaderWriteTime == right.shaderWriteTime && - left.manifestWriteTime == right.manifestWriteTime && - TextureAssetsEqual(left.textureAssets, right.textureAssets) && - FontAssetsEqual(left.fontAssets, right.fontAssets); -} - -bool ShaderPackageCatalog::TextureAssetsEqual(const std::vector& left, const std::vector& right) -{ - if (left.size() != right.size()) - return false; - - for (std::size_t index = 0; index < left.size(); ++index) - { - if (left[index].id != right[index].id || - left[index].path != right[index].path || - left[index].writeTime != right[index].writeTime) - { - return false; - } - } - - return true; -} - -bool ShaderPackageCatalog::FontAssetsEqual(const std::vector& left, const std::vector& right) -{ - if (left.size() != right.size()) - return false; - - for (std::size_t index = 0; index < left.size(); ++index) - { - if (left[index].id != right[index].id || - left[index].path != right[index].path || - left[index].writeTime != right[index].writeTime) - { - return false; - } - } - - return true; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/store/ShaderPackageCatalog.h b/apps/LoopThroughWithOpenGLCompositing/runtime/store/ShaderPackageCatalog.h deleted file mode 100644 index d2cfade..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/store/ShaderPackageCatalog.h +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once - -#include "ShaderTypes.h" - -#include -#include -#include -#include - -class ShaderPackageCatalog -{ -public: - struct Snapshot - { - std::map packagesById; - std::vector packageOrder; - }; - - bool Scan(const std::filesystem::path& shaderRoot, unsigned maxTemporalHistoryFrames, std::string& error); - Snapshot CaptureSnapshot() const; - bool HasCatalogChangedSince(const Snapshot& snapshot) const; - bool HasPackageChangedSince(const Snapshot& snapshot, const std::string& shaderId) const; - bool HasPackage(const std::string& shaderId) const; - const ShaderPackage* FindPackage(const std::string& shaderId) const; - bool CopyPackage(const std::string& shaderId, ShaderPackage& shaderPackage) const; - const std::vector& PackageOrder() const; - const std::vector& PackageStatuses() const; - -private: - static bool PackagesEquivalent(const ShaderPackage& left, const ShaderPackage& right); - static bool TextureAssetsEqual(const std::vector& left, const std::vector& right); - static bool FontAssetsEqual(const std::vector& left, const std::vector& right); - - std::map mPackagesById; - std::vector mPackageOrder; - std::vector mPackageStatuses; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/support/RuntimeJson.cpp b/apps/LoopThroughWithOpenGLCompositing/runtime/support/RuntimeJson.cpp deleted file mode 100644 index a2fdbaf..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/support/RuntimeJson.cpp +++ /dev/null @@ -1,674 +0,0 @@ -#include "stdafx.h" -#include "RuntimeJson.h" - -#include -#include -#include -#include -#include -#include -#include - -namespace -{ -int HexDigitValue(char ch) -{ - if (ch >= '0' && ch <= '9') - return ch - '0'; - if (ch >= 'a' && ch <= 'f') - return ch - 'a' + 10; - if (ch >= 'A' && ch <= 'F') - return ch - 'A' + 10; - return -1; -} - -bool IsHighSurrogate(unsigned int codePoint) -{ - return codePoint >= 0xD800 && codePoint <= 0xDBFF; -} - -bool IsLowSurrogate(unsigned int codePoint) -{ - return codePoint >= 0xDC00 && codePoint <= 0xDFFF; -} - -void AppendUtf8(unsigned int codePoint, std::ostringstream& output) -{ - if (codePoint <= 0x7F) - { - output << static_cast(codePoint); - } - else if (codePoint <= 0x7FF) - { - output << static_cast(0xC0 | ((codePoint >> 6) & 0x1F)); - output << static_cast(0x80 | (codePoint & 0x3F)); - } - else if (codePoint <= 0xFFFF) - { - output << static_cast(0xE0 | ((codePoint >> 12) & 0x0F)); - output << static_cast(0x80 | ((codePoint >> 6) & 0x3F)); - output << static_cast(0x80 | (codePoint & 0x3F)); - } - else - { - output << static_cast(0xF0 | ((codePoint >> 18) & 0x07)); - output << static_cast(0x80 | ((codePoint >> 12) & 0x3F)); - output << static_cast(0x80 | ((codePoint >> 6) & 0x3F)); - output << static_cast(0x80 | (codePoint & 0x3F)); - } -} - -void AppendControlEscape(unsigned char ch, std::ostringstream& output) -{ - const char* digits = "0123456789ABCDEF"; - output << "\\u00" << digits[(ch >> 4) & 0x0F] << digits[ch & 0x0F]; -} - -class JsonParser -{ -public: - JsonParser(const std::string& text, std::string& error) - : mText(text), mError(error), mPosition(0) - { - } - - bool parse(JsonValue& value) - { - skipWhitespace(); - if (!parseValue(value)) - return false; - - skipWhitespace(); - if (mPosition != mText.size()) - { - setError("Unexpected trailing characters in JSON input."); - return false; - } - - return true; - } - -private: - bool parseValue(JsonValue& value) - { - if (mPosition >= mText.size()) - { - setError("Unexpected end of JSON input."); - return false; - } - - char ch = mText[mPosition]; - if (ch == '{') - return parseObject(value); - if (ch == '[') - return parseArray(value); - if (ch == '"') - { - std::string stringValue; - if (!parseString(stringValue)) - return false; - value = JsonValue(stringValue); - return true; - } - if (ch == 't') - return parseLiteral("true", JsonValue(true), value); - if (ch == 'f') - return parseLiteral("false", JsonValue(false), value); - if (ch == 'n') - return parseLiteral("null", JsonValue(), value); - if (ch == '-' || std::isdigit(static_cast(ch))) - return parseNumber(value); - - setError("Unexpected token while parsing JSON."); - return false; - } - - bool parseObject(JsonValue& value) - { - value = JsonValue::MakeObject(); - ++mPosition; - skipWhitespace(); - if (consume('}')) - return true; - - while (mPosition < mText.size()) - { - std::string key; - if (!parseString(key)) - return false; - - skipWhitespace(); - if (!consume(':')) - { - setError("Expected ':' after JSON object key."); - return false; - } - - skipWhitespace(); - JsonValue item; - if (!parseValue(item)) - return false; - - value.set(key, item); - - skipWhitespace(); - if (consume('}')) - return true; - if (!consume(',')) - { - setError("Expected ',' or '}' in JSON object."); - return false; - } - skipWhitespace(); - } - - setError("Unexpected end of JSON object."); - return false; - } - - bool parseArray(JsonValue& value) - { - value = JsonValue::MakeArray(); - ++mPosition; - skipWhitespace(); - if (consume(']')) - return true; - - while (mPosition < mText.size()) - { - JsonValue item; - if (!parseValue(item)) - return false; - - value.pushBack(item); - - skipWhitespace(); - if (consume(']')) - return true; - if (!consume(',')) - { - setError("Expected ',' or ']' in JSON array."); - return false; - } - skipWhitespace(); - } - - setError("Unexpected end of JSON array."); - return false; - } - - bool parseString(std::string& value) - { - if (!consume('"')) - { - setError("Expected string literal."); - return false; - } - - std::ostringstream result; - while (mPosition < mText.size()) - { - char ch = mText[mPosition++]; - if (ch == '"') - { - value = result.str(); - return true; - } - - if (ch == '\\') - { - if (mPosition >= mText.size()) - { - setError("Unexpected end of escaped JSON string."); - return false; - } - - char escaped = mText[mPosition++]; - switch (escaped) - { - case '"': result << '"'; break; - case '\\': result << '\\'; break; - case '/': result << '/'; break; - case 'b': result << '\b'; break; - case 'f': result << '\f'; break; - case 'n': result << '\n'; break; - case 'r': result << '\r'; break; - case 't': result << '\t'; break; - case 'u': - if (!parseUnicodeEscape(result)) - return false; - break; - default: - setError("Invalid escape sequence in JSON string."); - return false; - } - } - else - { - if (static_cast(ch) < 0x20) - { - setError("Unescaped control character in JSON string."); - return false; - } - result << ch; - } - } - - setError("Unexpected end of JSON string."); - return false; - } - - bool parseHexCodePoint(unsigned int& codePoint) - { - if (mPosition + 4 > mText.size()) - { - setError("Unexpected end of Unicode escape sequence."); - return false; - } - - codePoint = 0; - for (int i = 0; i < 4; ++i) - { - const int digit = HexDigitValue(mText[mPosition + i]); - if (digit < 0) - { - setError("Invalid Unicode escape sequence in JSON string."); - return false; - } - codePoint = (codePoint << 4) | static_cast(digit); - } - - mPosition += 4; - return true; - } - - bool parseUnicodeEscape(std::ostringstream& result) - { - unsigned int codePoint = 0; - if (!parseHexCodePoint(codePoint)) - return false; - - if (IsHighSurrogate(codePoint)) - { - if (mPosition + 2 > mText.size() || mText[mPosition] != '\\' || mText[mPosition + 1] != 'u') - { - setError("High surrogate Unicode escape must be followed by a low surrogate."); - return false; - } - - mPosition += 2; - unsigned int lowSurrogate = 0; - if (!parseHexCodePoint(lowSurrogate)) - return false; - if (!IsLowSurrogate(lowSurrogate)) - { - setError("High surrogate Unicode escape must be followed by a low surrogate."); - return false; - } - - codePoint = 0x10000 + (((codePoint - 0xD800) << 10) | (lowSurrogate - 0xDC00)); - } - else if (IsLowSurrogate(codePoint)) - { - setError("Low surrogate Unicode escape without preceding high surrogate."); - return false; - } - - AppendUtf8(codePoint, result); - return true; - } - - bool parseNumber(JsonValue& value) - { - std::size_t start = mPosition; - - if (mText[mPosition] == '-') - ++mPosition; - - if (mPosition >= mText.size()) - { - setError("Invalid JSON number."); - return false; - } - - if (mText[mPosition] == '0') - { - ++mPosition; - if (mPosition < mText.size() && std::isdigit(static_cast(mText[mPosition]))) - { - setError("JSON numbers must not contain leading zeroes."); - return false; - } - } - else if (mText[mPosition] >= '1' && mText[mPosition] <= '9') - { - while (mPosition < mText.size() && std::isdigit(static_cast(mText[mPosition]))) - ++mPosition; - } - else - { - setError("Invalid JSON number."); - return false; - } - - if (mPosition < mText.size() && mText[mPosition] == '.') - { - ++mPosition; - if (mPosition >= mText.size() || !std::isdigit(static_cast(mText[mPosition]))) - { - setError("JSON number fraction must contain at least one digit."); - return false; - } - while (mPosition < mText.size() && std::isdigit(static_cast(mText[mPosition]))) - ++mPosition; - } - - if (mPosition < mText.size() && (mText[mPosition] == 'e' || mText[mPosition] == 'E')) - { - ++mPosition; - if (mPosition < mText.size() && (mText[mPosition] == '+' || mText[mPosition] == '-')) - ++mPosition; - if (mPosition >= mText.size() || !std::isdigit(static_cast(mText[mPosition]))) - { - setError("JSON number exponent must contain at least one digit."); - return false; - } - while (mPosition < mText.size() && std::isdigit(static_cast(mText[mPosition]))) - ++mPosition; - } - - std::string token = mText.substr(start, mPosition - start); - char* endPtr = nullptr; - errno = 0; - double parsed = strtod(token.c_str(), &endPtr); - if (endPtr == token.c_str() || *endPtr != '\0' || errno == ERANGE || !std::isfinite(parsed)) - { - setError("Invalid JSON number."); - return false; - } - - value = JsonValue(parsed); - return true; - } - - bool parseLiteral(const char* literal, const JsonValue& literalValue, JsonValue& value) - { - std::size_t length = strlen(literal); - if (mText.compare(mPosition, length, literal) != 0) - { - setError("Invalid JSON literal."); - return false; - } - - mPosition += length; - value = literalValue; - return true; - } - - void skipWhitespace() - { - while (mPosition < mText.size() && std::isspace(static_cast(mText[mPosition]))) - ++mPosition; - } - - bool consume(char expected) - { - if (mPosition < mText.size() && mText[mPosition] == expected) - { - ++mPosition; - return true; - } - return false; - } - - void setError(const std::string& error) - { - if (mError.empty()) - mError = error; - } - - const std::string& mText; - std::string& mError; - std::size_t mPosition; -}; - -void SerializeJsonImpl(const JsonValue& value, std::ostringstream& output, bool pretty, int indentLevel) -{ - auto indent = [&](int level) { - if (!pretty) - return; - for (int i = 0; i < level; ++i) - output << " "; - }; - - switch (value.type()) - { - case JsonValue::Type::Null: - output << "null"; - break; - case JsonValue::Type::Boolean: - output << (value.asBoolean() ? "true" : "false"); - break; - case JsonValue::Type::Number: - { - double number = value.asNumber(); - if (std::isfinite(number)) - { - output << std::setprecision(15) << number; - } - else - { - output << "0"; - } - break; - } - case JsonValue::Type::String: - { - output << '"'; - for (char ch : value.asString()) - { - switch (ch) - { - case '"': output << "\\\""; break; - case '\\': output << "\\\\"; break; - case '\b': output << "\\b"; break; - case '\f': output << "\\f"; break; - case '\n': output << "\\n"; break; - case '\r': output << "\\r"; break; - case '\t': output << "\\t"; break; - default: - if (static_cast(ch) < 0x20) - AppendControlEscape(static_cast(ch), output); - else - output << ch; - break; - } - } - output << '"'; - break; - } - case JsonValue::Type::Array: - { - output << "["; - const std::vector& array = value.asArray(); - if (!array.empty()) - { - if (pretty) - output << "\n"; - for (std::size_t i = 0; i < array.size(); ++i) - { - indent(indentLevel + 1); - SerializeJsonImpl(array[i], output, pretty, indentLevel + 1); - if (i + 1 != array.size()) - output << ","; - if (pretty) - output << "\n"; - } - indent(indentLevel); - } - output << "]"; - break; - } - case JsonValue::Type::Object: - { - output << "{"; - const std::map& object = value.asObject(); - if (!object.empty()) - { - if (pretty) - output << "\n"; - std::size_t index = 0; - for (const auto& item : object) - { - indent(indentLevel + 1); - SerializeJsonImpl(JsonValue(item.first), output, pretty, indentLevel + 1); - output << (pretty ? ": " : ":"); - SerializeJsonImpl(item.second, output, pretty, indentLevel + 1); - if (++index != object.size()) - output << ","; - if (pretty) - output << "\n"; - } - indent(indentLevel); - } - output << "}"; - break; - } - } -} -} - -JsonValue::JsonValue() - : mType(Type::Null), mBooleanValue(false), mNumberValue(0.0) -{ -} - -JsonValue::JsonValue(bool value) - : mType(Type::Boolean), mBooleanValue(value), mNumberValue(0.0) -{ -} - -JsonValue::JsonValue(double value) - : mType(Type::Number), mBooleanValue(false), mNumberValue(value) -{ -} - -JsonValue::JsonValue(const char* value) - : mType(Type::String), mBooleanValue(false), mNumberValue(0.0), mStringValue(value ? value : "") -{ -} - -JsonValue::JsonValue(const std::string& value) - : mType(Type::String), mBooleanValue(false), mNumberValue(0.0), mStringValue(value) -{ -} - -JsonValue JsonValue::MakeArray() -{ - JsonValue value; - value.reset(Type::Array); - return value; -} - -JsonValue JsonValue::MakeObject() -{ - JsonValue value; - value.reset(Type::Object); - return value; -} - -bool JsonValue::asBoolean(bool fallback) const -{ - return mType == Type::Boolean ? mBooleanValue : fallback; -} - -double JsonValue::asNumber(double fallback) const -{ - return mType == Type::Number ? mNumberValue : fallback; -} - -const std::string& JsonValue::asString() const -{ - static const std::string emptyString; - return mType == Type::String ? mStringValue : emptyString; -} - -const std::vector& JsonValue::asArray() const -{ - static const std::vector emptyArray; - return mType == Type::Array ? mArrayValue : emptyArray; -} - -const std::map& JsonValue::asObject() const -{ - static const std::map emptyObject; - return mType == Type::Object ? mObjectValue : emptyObject; -} - -std::vector& JsonValue::array() -{ - if (mType != Type::Array) - reset(Type::Array); - return mArrayValue; -} - -std::map& JsonValue::object() -{ - if (mType != Type::Object) - reset(Type::Object); - return mObjectValue; -} - -void JsonValue::pushBack(const JsonValue& value) -{ - array().push_back(value); -} - -void JsonValue::set(const std::string& key, const JsonValue& value) -{ - object()[key] = value; -} - -const JsonValue* JsonValue::find(const std::string& key) const -{ - if (mType != Type::Object) - return nullptr; - - auto iterator = mObjectValue.find(key); - return iterator != mObjectValue.end() ? &iterator->second : nullptr; -} - -void JsonValue::reset(Type type) -{ - mType = type; - mBooleanValue = false; - mNumberValue = 0.0; - mStringValue.clear(); - mArrayValue.clear(); - mObjectValue.clear(); -} - -bool ParseJson(const std::string& text, JsonValue& value, std::string& error) -{ - error.clear(); - JsonParser parser(text, error); - return parser.parse(value); -} - -std::string SerializeJson(const JsonValue& value, bool pretty) -{ - std::ostringstream output; - SerializeJsonImpl(value, output, pretty, 0); - return output.str(); -} - -std::vector JsonArrayToNumbers(const JsonValue& value) -{ - std::vector numbers; - for (const JsonValue& item : value.asArray()) - { - if (item.isNumber()) - numbers.push_back(item.asNumber()); - } - return numbers; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/support/RuntimeJson.h b/apps/LoopThroughWithOpenGLCompositing/runtime/support/RuntimeJson.h deleted file mode 100644 index 52879d9..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/support/RuntimeJson.h +++ /dev/null @@ -1,65 +0,0 @@ -#pragma once - -#include -#include -#include - -class JsonValue -{ -public: - enum class Type - { - Null, - Boolean, - Number, - String, - Array, - Object - }; - - JsonValue(); - explicit JsonValue(bool value); - explicit JsonValue(double value); - explicit JsonValue(const char* value); - explicit JsonValue(const std::string& value); - - static JsonValue MakeArray(); - static JsonValue MakeObject(); - - Type type() const { return mType; } - - bool isNull() const { return mType == Type::Null; } - bool isBoolean() const { return mType == Type::Boolean; } - bool isNumber() const { return mType == Type::Number; } - bool isString() const { return mType == Type::String; } - bool isArray() const { return mType == Type::Array; } - bool isObject() const { return mType == Type::Object; } - - bool asBoolean(bool fallback = false) const; - double asNumber(double fallback = 0.0) const; - const std::string& asString() const; - const std::vector& asArray() const; - const std::map& asObject() const; - - std::vector& array(); - std::map& object(); - - void pushBack(const JsonValue& value); - void set(const std::string& key, const JsonValue& value); - - const JsonValue* find(const std::string& key) const; - -private: - void reset(Type type); - - Type mType; - bool mBooleanValue; - double mNumberValue; - std::string mStringValue; - std::vector mArrayValue; - std::map mObjectValue; -}; - -bool ParseJson(const std::string& text, JsonValue& value, std::string& error); -std::string SerializeJson(const JsonValue& value, bool pretty = false); -std::vector JsonArrayToNumbers(const JsonValue& value); diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/support/RuntimeParameterUtils.cpp b/apps/LoopThroughWithOpenGLCompositing/runtime/support/RuntimeParameterUtils.cpp deleted file mode 100644 index 9e670fe..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/support/RuntimeParameterUtils.cpp +++ /dev/null @@ -1,196 +0,0 @@ -#include "stdafx.h" -#include "RuntimeParameterUtils.h" - -#include -#include -#include -#include - -namespace -{ -std::string TrimText(const std::string& text) -{ - std::size_t start = 0; - while (start < text.size() && std::isspace(static_cast(text[start]))) - ++start; - - std::size_t end = text.size(); - while (end > start && std::isspace(static_cast(text[end - 1]))) - --end; - - return text.substr(start, end - start); -} - -bool IsFiniteNumber(double value) -{ - return std::isfinite(value) != 0; -} - -std::string NormalizeTextValue(const std::string& text, unsigned maxLength) -{ - std::string normalized; - normalized.reserve(std::min(text.size(), maxLength)); - for (unsigned char ch : text) - { - if (ch < 32 || ch > 126) - continue; - if (normalized.size() >= maxLength) - break; - normalized.push_back(static_cast(ch)); - } - return normalized; -} -} - -std::string MakeSafePresetFileStem(const std::string& presetName) -{ - std::string trimmed = TrimText(presetName); - std::string safe; - safe.reserve(trimmed.size()); - - for (unsigned char ch : trimmed) - { - if (std::isalnum(ch)) - safe.push_back(static_cast(std::tolower(ch))); - else if (ch == ' ' || ch == '-' || ch == '_') - { - if (safe.empty() || safe.back() == '-') - continue; - safe.push_back('-'); - } - } - - while (!safe.empty() && safe.back() == '-') - safe.pop_back(); - - return safe; -} - -ShaderParameterValue DefaultValueForDefinition(const ShaderParameterDefinition& definition) -{ - ShaderParameterValue value; - switch (definition.type) - { - case ShaderParameterType::Float: - value.numberValues = definition.defaultNumbers.empty() ? std::vector{ 0.0 } : definition.defaultNumbers; - break; - case ShaderParameterType::Vec2: - value.numberValues = definition.defaultNumbers.size() == 2 ? definition.defaultNumbers : std::vector{ 0.0, 0.0 }; - break; - case ShaderParameterType::Color: - value.numberValues = definition.defaultNumbers.size() == 4 ? definition.defaultNumbers : std::vector{ 1.0, 1.0, 1.0, 1.0 }; - break; - case ShaderParameterType::Boolean: - value.booleanValue = definition.defaultBoolean; - break; - case ShaderParameterType::Enum: - value.enumValue = definition.defaultEnumValue; - break; - case ShaderParameterType::Text: - value.textValue = NormalizeTextValue(definition.defaultTextValue, definition.maxLength); - break; - case ShaderParameterType::Trigger: - value.numberValues = { 0.0, -1000000.0 }; - break; - } - return value; -} - -bool NormalizeAndValidateParameterValue(const ShaderParameterDefinition& definition, const JsonValue& value, ShaderParameterValue& normalizedValue, std::string& error) -{ - normalizedValue = DefaultValueForDefinition(definition); - - switch (definition.type) - { - case ShaderParameterType::Float: - { - if (!value.isNumber()) - { - error = "Expected numeric value for float parameter '" + definition.id + "'."; - return false; - } - double number = value.asNumber(); - if (!IsFiniteNumber(number)) - { - error = "Float parameter '" + definition.id + "' must be finite."; - return false; - } - if (!definition.minNumbers.empty()) - number = std::max(number, definition.minNumbers.front()); - if (!definition.maxNumbers.empty()) - number = std::min(number, definition.maxNumbers.front()); - normalizedValue.numberValues = { number }; - return true; - } - case ShaderParameterType::Vec2: - case ShaderParameterType::Color: - { - std::vector numbers = JsonArrayToNumbers(value); - const std::size_t expectedSize = definition.type == ShaderParameterType::Vec2 ? 2 : 4; - if (numbers.size() != expectedSize) - { - error = "Expected array value of size " + std::to_string(expectedSize) + " for parameter '" + definition.id + "'."; - return false; - } - for (std::size_t index = 0; index < numbers.size(); ++index) - { - if (!IsFiniteNumber(numbers[index])) - { - error = "Parameter '" + definition.id + "' contains a non-finite value."; - return false; - } - if (index < definition.minNumbers.size()) - numbers[index] = std::max(numbers[index], definition.minNumbers[index]); - if (index < definition.maxNumbers.size()) - numbers[index] = std::min(numbers[index], definition.maxNumbers[index]); - } - normalizedValue.numberValues = numbers; - return true; - } - case ShaderParameterType::Boolean: - if (!value.isBoolean()) - { - error = "Expected boolean value for parameter '" + definition.id + "'."; - return false; - } - normalizedValue.booleanValue = value.asBoolean(); - return true; - case ShaderParameterType::Enum: - { - if (!value.isString()) - { - error = "Expected string value for enum parameter '" + definition.id + "'."; - return false; - } - const std::string selectedValue = value.asString(); - for (const ShaderParameterOption& option : definition.enumOptions) - { - if (option.value == selectedValue) - { - normalizedValue.enumValue = selectedValue; - return true; - } - } - error = "Enum parameter '" + definition.id + "' received unsupported option '" + selectedValue + "'."; - return false; - } - case ShaderParameterType::Text: - if (!value.isString()) - { - error = "Expected string value for text parameter '" + definition.id + "'."; - return false; - } - normalizedValue.textValue = NormalizeTextValue(value.asString(), definition.maxLength); - return true; - case ShaderParameterType::Trigger: - if (!value.isNumber() && !value.isBoolean()) - { - error = "Expected numeric or boolean value for trigger parameter '" + definition.id + "'."; - return false; - } - normalizedValue.numberValues = { value.isNumber() ? std::max(0.0, std::floor(value.asNumber())) : 0.0, -1000000.0 }; - return true; - } - - return false; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/support/RuntimeParameterUtils.h b/apps/LoopThroughWithOpenGLCompositing/runtime/support/RuntimeParameterUtils.h deleted file mode 100644 index d812ea2..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/support/RuntimeParameterUtils.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#include "RuntimeJson.h" -#include "ShaderTypes.h" - -#include - -std::string MakeSafePresetFileStem(const std::string& presetName); -ShaderParameterValue DefaultValueForDefinition(const ShaderParameterDefinition& definition); -bool NormalizeAndValidateParameterValue(const ShaderParameterDefinition& definition, const JsonValue& value, ShaderParameterValue& normalizedValue, std::string& error); diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/telemetry/HealthTelemetry.cpp b/apps/LoopThroughWithOpenGLCompositing/runtime/telemetry/HealthTelemetry.cpp deleted file mode 100644 index f62b764..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/telemetry/HealthTelemetry.cpp +++ /dev/null @@ -1,500 +0,0 @@ -#include "stdafx.h" -#include "HealthTelemetry.h" - -void HealthTelemetry::ReportSignalStatus(bool hasSignal, unsigned width, unsigned height, const std::string& modeName) -{ - std::lock_guard lock(mMutex); - mSignalStatus.hasSignal = hasSignal; - mSignalStatus.width = width; - mSignalStatus.height = height; - mSignalStatus.modeName = modeName; -} - -bool HealthTelemetry::TryReportSignalStatus(bool hasSignal, unsigned width, unsigned height, const std::string& modeName) -{ - std::unique_lock lock(mMutex, std::try_to_lock); - if (!lock.owns_lock()) - return false; - - mSignalStatus.hasSignal = hasSignal; - mSignalStatus.width = width; - mSignalStatus.height = height; - mSignalStatus.modeName = modeName; - return true; -} - -void HealthTelemetry::ReportVideoIOStatus(const std::string& backendName, const std::string& modelName, - bool supportsInternalKeying, bool supportsExternalKeying, bool keyerInterfaceAvailable, - bool externalKeyingRequested, bool externalKeyingActive, const std::string& statusMessage) -{ - std::lock_guard lock(mMutex); - mVideoIOStatus.backendName = backendName; - mVideoIOStatus.modelName = modelName; - mVideoIOStatus.supportsInternalKeying = supportsInternalKeying; - mVideoIOStatus.supportsExternalKeying = supportsExternalKeying; - mVideoIOStatus.keyerInterfaceAvailable = keyerInterfaceAvailable; - mVideoIOStatus.externalKeyingRequested = externalKeyingRequested; - mVideoIOStatus.externalKeyingActive = externalKeyingActive; - mVideoIOStatus.statusMessage = statusMessage; -} - -bool HealthTelemetry::TryReportVideoIOStatus(const std::string& backendName, const std::string& modelName, - bool supportsInternalKeying, bool supportsExternalKeying, bool keyerInterfaceAvailable, - bool externalKeyingRequested, bool externalKeyingActive, const std::string& statusMessage) -{ - std::unique_lock lock(mMutex, std::try_to_lock); - if (!lock.owns_lock()) - return false; - - mVideoIOStatus.backendName = backendName; - mVideoIOStatus.modelName = modelName; - mVideoIOStatus.supportsInternalKeying = supportsInternalKeying; - mVideoIOStatus.supportsExternalKeying = supportsExternalKeying; - mVideoIOStatus.keyerInterfaceAvailable = keyerInterfaceAvailable; - mVideoIOStatus.externalKeyingRequested = externalKeyingRequested; - mVideoIOStatus.externalKeyingActive = externalKeyingActive; - mVideoIOStatus.statusMessage = statusMessage; - return true; -} - -void HealthTelemetry::RecordPerformanceStats(double frameBudgetMilliseconds, double renderMilliseconds) -{ - std::lock_guard lock(mMutex); - mPerformance.frameBudgetMilliseconds = std::max(frameBudgetMilliseconds, 0.0); - mPerformance.renderMilliseconds = std::max(renderMilliseconds, 0.0); - if (mPerformance.smoothedRenderMilliseconds <= 0.0) - mPerformance.smoothedRenderMilliseconds = mPerformance.renderMilliseconds; - else - mPerformance.smoothedRenderMilliseconds = mPerformance.smoothedRenderMilliseconds * 0.9 + mPerformance.renderMilliseconds * 0.1; -} - -bool HealthTelemetry::TryRecordPerformanceStats(double frameBudgetMilliseconds, double renderMilliseconds) -{ - std::unique_lock lock(mMutex, std::try_to_lock); - if (!lock.owns_lock()) - return false; - - mPerformance.frameBudgetMilliseconds = std::max(frameBudgetMilliseconds, 0.0); - mPerformance.renderMilliseconds = std::max(renderMilliseconds, 0.0); - if (mPerformance.smoothedRenderMilliseconds <= 0.0) - mPerformance.smoothedRenderMilliseconds = mPerformance.renderMilliseconds; - else - mPerformance.smoothedRenderMilliseconds = mPerformance.smoothedRenderMilliseconds * 0.9 + mPerformance.renderMilliseconds * 0.1; - return true; -} - -void HealthTelemetry::RecordFramePacingStats(double completionIntervalMilliseconds, double smoothedCompletionIntervalMilliseconds, - double maxCompletionIntervalMilliseconds, uint64_t lateFrameCount, uint64_t droppedFrameCount, uint64_t flushedFrameCount) -{ - std::lock_guard lock(mMutex); - mPerformance.completionIntervalMilliseconds = std::max(completionIntervalMilliseconds, 0.0); - mPerformance.smoothedCompletionIntervalMilliseconds = std::max(smoothedCompletionIntervalMilliseconds, 0.0); - mPerformance.maxCompletionIntervalMilliseconds = std::max(maxCompletionIntervalMilliseconds, 0.0); - mPerformance.lateFrameCount = lateFrameCount; - mPerformance.droppedFrameCount = droppedFrameCount; - mPerformance.flushedFrameCount = flushedFrameCount; -} - -bool HealthTelemetry::TryRecordFramePacingStats(double completionIntervalMilliseconds, double smoothedCompletionIntervalMilliseconds, - double maxCompletionIntervalMilliseconds, uint64_t lateFrameCount, uint64_t droppedFrameCount, uint64_t flushedFrameCount) -{ - std::unique_lock lock(mMutex, std::try_to_lock); - if (!lock.owns_lock()) - return false; - - mPerformance.completionIntervalMilliseconds = std::max(completionIntervalMilliseconds, 0.0); - mPerformance.smoothedCompletionIntervalMilliseconds = std::max(smoothedCompletionIntervalMilliseconds, 0.0); - mPerformance.maxCompletionIntervalMilliseconds = std::max(maxCompletionIntervalMilliseconds, 0.0); - mPerformance.lateFrameCount = lateFrameCount; - mPerformance.droppedFrameCount = droppedFrameCount; - mPerformance.flushedFrameCount = flushedFrameCount; - return true; -} - -void HealthTelemetry::RecordRuntimeEventQueueMetrics(const std::string& queueName, std::size_t depth, std::size_t capacity, - uint64_t droppedCount, double oldestEventAgeMilliseconds) -{ - std::lock_guard lock(mMutex); - mRuntimeEvents.queue.queueName = queueName; - mRuntimeEvents.queue.depth = depth; - mRuntimeEvents.queue.capacity = capacity; - mRuntimeEvents.queue.droppedCount = droppedCount; - mRuntimeEvents.queue.oldestEventAgeMilliseconds = std::max(oldestEventAgeMilliseconds, 0.0); -} - -bool HealthTelemetry::TryRecordRuntimeEventQueueMetrics(const std::string& queueName, std::size_t depth, std::size_t capacity, - uint64_t droppedCount, double oldestEventAgeMilliseconds) -{ - std::unique_lock lock(mMutex, std::try_to_lock); - if (!lock.owns_lock()) - return false; - - mRuntimeEvents.queue.queueName = queueName; - mRuntimeEvents.queue.depth = depth; - mRuntimeEvents.queue.capacity = capacity; - mRuntimeEvents.queue.droppedCount = droppedCount; - mRuntimeEvents.queue.oldestEventAgeMilliseconds = std::max(oldestEventAgeMilliseconds, 0.0); - return true; -} - -void HealthTelemetry::RecordRuntimeEventDispatchStats(std::size_t dispatchedEvents, std::size_t handlerInvocations, - std::size_t handlerFailures, double dispatchDurationMilliseconds) -{ - std::lock_guard lock(mMutex); - ++mRuntimeEvents.dispatch.dispatchCallCount; - mRuntimeEvents.dispatch.dispatchedEventCount += static_cast(dispatchedEvents); - mRuntimeEvents.dispatch.handlerInvocationCount += static_cast(handlerInvocations); - mRuntimeEvents.dispatch.handlerFailureCount += static_cast(handlerFailures); - mRuntimeEvents.dispatch.lastDispatchDurationMilliseconds = std::max(dispatchDurationMilliseconds, 0.0); - mRuntimeEvents.dispatch.maxDispatchDurationMilliseconds = std::max( - mRuntimeEvents.dispatch.maxDispatchDurationMilliseconds, - mRuntimeEvents.dispatch.lastDispatchDurationMilliseconds); -} - -bool HealthTelemetry::TryRecordRuntimeEventDispatchStats(std::size_t dispatchedEvents, std::size_t handlerInvocations, - std::size_t handlerFailures, double dispatchDurationMilliseconds) -{ - std::unique_lock lock(mMutex, std::try_to_lock); - if (!lock.owns_lock()) - return false; - - ++mRuntimeEvents.dispatch.dispatchCallCount; - mRuntimeEvents.dispatch.dispatchedEventCount += static_cast(dispatchedEvents); - mRuntimeEvents.dispatch.handlerInvocationCount += static_cast(handlerInvocations); - mRuntimeEvents.dispatch.handlerFailureCount += static_cast(handlerFailures); - mRuntimeEvents.dispatch.lastDispatchDurationMilliseconds = std::max(dispatchDurationMilliseconds, 0.0); - mRuntimeEvents.dispatch.maxDispatchDurationMilliseconds = std::max( - mRuntimeEvents.dispatch.maxDispatchDurationMilliseconds, - mRuntimeEvents.dispatch.lastDispatchDurationMilliseconds); - return true; -} - -void HealthTelemetry::RecordPersistenceWriteResult(bool succeeded, const std::string& targetKind, const std::string& targetPath, - const std::string& reason, const std::string& errorMessage, bool newerRequestPending) -{ - std::lock_guard lock(mMutex); - if (succeeded) - ++mPersistence.writeSuccessCount; - else - ++mPersistence.writeFailureCount; - mPersistence.lastWriteSucceeded = succeeded; - mPersistence.unsavedChanges = !succeeded || newerRequestPending; - mPersistence.newerRequestPending = newerRequestPending; - mPersistence.lastTargetKind = targetKind; - mPersistence.lastTargetPath = targetPath; - mPersistence.lastReason = reason; - mPersistence.lastErrorMessage = errorMessage; -} - -bool HealthTelemetry::TryRecordPersistenceWriteResult(bool succeeded, const std::string& targetKind, const std::string& targetPath, - const std::string& reason, const std::string& errorMessage, bool newerRequestPending) -{ - std::unique_lock lock(mMutex, std::try_to_lock); - if (!lock.owns_lock()) - return false; - - if (succeeded) - ++mPersistence.writeSuccessCount; - else - ++mPersistence.writeFailureCount; - mPersistence.lastWriteSucceeded = succeeded; - mPersistence.unsavedChanges = !succeeded || newerRequestPending; - mPersistence.newerRequestPending = newerRequestPending; - mPersistence.lastTargetKind = targetKind; - mPersistence.lastTargetPath = targetPath; - mPersistence.lastReason = reason; - mPersistence.lastErrorMessage = errorMessage; - return true; -} - -void HealthTelemetry::RecordBackendPlayoutHealth(const std::string& lifecycleState, const std::string& completionResult, - std::size_t readyQueueDepth, std::size_t readyQueueCapacity, uint64_t readyQueuePushedCount, - std::size_t minReadyQueueDepth, std::size_t maxReadyQueueDepth, uint64_t readyQueueZeroDepthCount, - uint64_t readyQueuePoppedCount, uint64_t readyQueueDroppedCount, uint64_t readyQueueUnderrunCount, - double outputRenderMilliseconds, double smoothedOutputRenderMilliseconds, double maxOutputRenderMilliseconds, - double outputFrameAcquireMilliseconds, double outputFrameRenderRequestMilliseconds, double outputFrameEndAccessMilliseconds, - uint64_t completedFrameIndex, uint64_t scheduledFrameIndex, uint64_t scheduledLeadFrames, - uint64_t measuredLagFrames, uint64_t catchUpFrames, uint64_t lateStreak, uint64_t dropStreak, - uint64_t lateFrameCount, uint64_t droppedFrameCount, uint64_t flushedFrameCount, - bool degraded, const std::string& statusMessage) -{ - std::lock_guard lock(mMutex); - mBackendPlayout.lifecycleState = lifecycleState; - mBackendPlayout.completionResult = completionResult; - mBackendPlayout.readyQueueDepth = readyQueueDepth; - mBackendPlayout.readyQueueCapacity = readyQueueCapacity; - mBackendPlayout.minReadyQueueDepth = minReadyQueueDepth; - mBackendPlayout.maxReadyQueueDepth = maxReadyQueueDepth; - mBackendPlayout.readyQueueZeroDepthCount = readyQueueZeroDepthCount; - mBackendPlayout.readyQueuePushedCount = readyQueuePushedCount; - mBackendPlayout.readyQueuePoppedCount = readyQueuePoppedCount; - mBackendPlayout.readyQueueDroppedCount = readyQueueDroppedCount; - mBackendPlayout.readyQueueUnderrunCount = readyQueueUnderrunCount; - mBackendPlayout.outputRenderMilliseconds = std::max(outputRenderMilliseconds, 0.0); - mBackendPlayout.smoothedOutputRenderMilliseconds = std::max(smoothedOutputRenderMilliseconds, 0.0); - mBackendPlayout.maxOutputRenderMilliseconds = std::max(maxOutputRenderMilliseconds, 0.0); - mBackendPlayout.outputFrameAcquireMilliseconds = std::max(outputFrameAcquireMilliseconds, 0.0); - mBackendPlayout.outputFrameRenderRequestMilliseconds = std::max(outputFrameRenderRequestMilliseconds, 0.0); - mBackendPlayout.outputFrameEndAccessMilliseconds = std::max(outputFrameEndAccessMilliseconds, 0.0); - mBackendPlayout.completedFrameIndex = completedFrameIndex; - mBackendPlayout.scheduledFrameIndex = scheduledFrameIndex; - mBackendPlayout.scheduledLeadFrames = scheduledLeadFrames; - mBackendPlayout.measuredLagFrames = measuredLagFrames; - mBackendPlayout.catchUpFrames = catchUpFrames; - mBackendPlayout.lateStreak = lateStreak; - mBackendPlayout.dropStreak = dropStreak; - mBackendPlayout.lateFrameCount = lateFrameCount; - mBackendPlayout.droppedFrameCount = droppedFrameCount; - mBackendPlayout.flushedFrameCount = flushedFrameCount; - mBackendPlayout.degraded = degraded; - mBackendPlayout.statusMessage = statusMessage; -} - -bool HealthTelemetry::TryRecordBackendPlayoutHealth(const std::string& lifecycleState, const std::string& completionResult, - std::size_t readyQueueDepth, std::size_t readyQueueCapacity, uint64_t readyQueuePushedCount, - std::size_t minReadyQueueDepth, std::size_t maxReadyQueueDepth, uint64_t readyQueueZeroDepthCount, - uint64_t readyQueuePoppedCount, uint64_t readyQueueDroppedCount, uint64_t readyQueueUnderrunCount, - double outputRenderMilliseconds, double smoothedOutputRenderMilliseconds, double maxOutputRenderMilliseconds, - double outputFrameAcquireMilliseconds, double outputFrameRenderRequestMilliseconds, double outputFrameEndAccessMilliseconds, - uint64_t completedFrameIndex, uint64_t scheduledFrameIndex, uint64_t scheduledLeadFrames, - uint64_t measuredLagFrames, uint64_t catchUpFrames, uint64_t lateStreak, uint64_t dropStreak, - uint64_t lateFrameCount, uint64_t droppedFrameCount, uint64_t flushedFrameCount, - bool degraded, const std::string& statusMessage) -{ - std::unique_lock lock(mMutex, std::try_to_lock); - if (!lock.owns_lock()) - return false; - - mBackendPlayout.lifecycleState = lifecycleState; - mBackendPlayout.completionResult = completionResult; - mBackendPlayout.readyQueueDepth = readyQueueDepth; - mBackendPlayout.readyQueueCapacity = readyQueueCapacity; - mBackendPlayout.minReadyQueueDepth = minReadyQueueDepth; - mBackendPlayout.maxReadyQueueDepth = maxReadyQueueDepth; - mBackendPlayout.readyQueueZeroDepthCount = readyQueueZeroDepthCount; - mBackendPlayout.readyQueuePushedCount = readyQueuePushedCount; - mBackendPlayout.readyQueuePoppedCount = readyQueuePoppedCount; - mBackendPlayout.readyQueueDroppedCount = readyQueueDroppedCount; - mBackendPlayout.readyQueueUnderrunCount = readyQueueUnderrunCount; - mBackendPlayout.outputRenderMilliseconds = std::max(outputRenderMilliseconds, 0.0); - mBackendPlayout.smoothedOutputRenderMilliseconds = std::max(smoothedOutputRenderMilliseconds, 0.0); - mBackendPlayout.maxOutputRenderMilliseconds = std::max(maxOutputRenderMilliseconds, 0.0); - mBackendPlayout.outputFrameAcquireMilliseconds = std::max(outputFrameAcquireMilliseconds, 0.0); - mBackendPlayout.outputFrameRenderRequestMilliseconds = std::max(outputFrameRenderRequestMilliseconds, 0.0); - mBackendPlayout.outputFrameEndAccessMilliseconds = std::max(outputFrameEndAccessMilliseconds, 0.0); - mBackendPlayout.completedFrameIndex = completedFrameIndex; - mBackendPlayout.scheduledFrameIndex = scheduledFrameIndex; - mBackendPlayout.scheduledLeadFrames = scheduledLeadFrames; - mBackendPlayout.measuredLagFrames = measuredLagFrames; - mBackendPlayout.catchUpFrames = catchUpFrames; - mBackendPlayout.lateStreak = lateStreak; - mBackendPlayout.dropStreak = dropStreak; - mBackendPlayout.lateFrameCount = lateFrameCount; - mBackendPlayout.droppedFrameCount = droppedFrameCount; - mBackendPlayout.flushedFrameCount = flushedFrameCount; - mBackendPlayout.degraded = degraded; - mBackendPlayout.statusMessage = statusMessage; - return true; -} - -void HealthTelemetry::RecordOutputRenderQueueWait(double queueWaitMilliseconds) -{ - std::lock_guard lock(mMutex); - mBackendPlayout.outputRenderQueueWaitMilliseconds = std::max(queueWaitMilliseconds, 0.0); -} - -bool HealthTelemetry::TryRecordOutputRenderQueueWait(double queueWaitMilliseconds) -{ - std::unique_lock lock(mMutex, std::try_to_lock); - if (!lock.owns_lock()) - return false; - - mBackendPlayout.outputRenderQueueWaitMilliseconds = std::max(queueWaitMilliseconds, 0.0); - return true; -} - -void HealthTelemetry::RecordSystemMemoryPlayoutStats(std::size_t freeFrameCount, std::size_t readyFrameCount, - std::size_t scheduledFrameCount, uint64_t underrunCount, uint64_t repeatCount, uint64_t dropCount, - double frameAgeAtScheduleMilliseconds, double frameAgeAtCompletionMilliseconds) -{ - std::lock_guard lock(mMutex); - mBackendPlayout.systemFramePoolFree = freeFrameCount; - mBackendPlayout.systemFramePoolReady = readyFrameCount; - mBackendPlayout.systemFramePoolScheduled = scheduledFrameCount; - mBackendPlayout.systemFrameUnderrunCount = underrunCount; - mBackendPlayout.systemFrameRepeatCount = repeatCount; - mBackendPlayout.systemFrameDropCount = dropCount; - mBackendPlayout.systemFrameAgeAtScheduleMilliseconds = std::max(frameAgeAtScheduleMilliseconds, 0.0); - mBackendPlayout.systemFrameAgeAtCompletionMilliseconds = std::max(frameAgeAtCompletionMilliseconds, 0.0); -} - -bool HealthTelemetry::TryRecordSystemMemoryPlayoutStats(std::size_t freeFrameCount, std::size_t readyFrameCount, - std::size_t scheduledFrameCount, uint64_t underrunCount, uint64_t repeatCount, uint64_t dropCount, - double frameAgeAtScheduleMilliseconds, double frameAgeAtCompletionMilliseconds) -{ - std::unique_lock lock(mMutex, std::try_to_lock); - if (!lock.owns_lock()) - return false; - - mBackendPlayout.systemFramePoolFree = freeFrameCount; - mBackendPlayout.systemFramePoolReady = readyFrameCount; - mBackendPlayout.systemFramePoolScheduled = scheduledFrameCount; - mBackendPlayout.systemFrameUnderrunCount = underrunCount; - mBackendPlayout.systemFrameRepeatCount = repeatCount; - mBackendPlayout.systemFrameDropCount = dropCount; - mBackendPlayout.systemFrameAgeAtScheduleMilliseconds = std::max(frameAgeAtScheduleMilliseconds, 0.0); - mBackendPlayout.systemFrameAgeAtCompletionMilliseconds = std::max(frameAgeAtCompletionMilliseconds, 0.0); - return true; -} - -void HealthTelemetry::RecordDeckLinkBufferTelemetry(bool actualBufferedFramesAvailable, uint64_t actualBufferedFrames, - std::size_t targetBufferedFrames, double scheduleCallMilliseconds, uint64_t scheduleFailureCount) -{ - std::lock_guard lock(mMutex); - mBackendPlayout.actualDeckLinkBufferedFramesAvailable = actualBufferedFramesAvailable; - mBackendPlayout.actualDeckLinkBufferedFrames = actualBufferedFramesAvailable ? actualBufferedFrames : 0; - mBackendPlayout.targetDeckLinkBufferedFrames = targetBufferedFrames; - mBackendPlayout.deckLinkScheduleCallMilliseconds = std::max(scheduleCallMilliseconds, 0.0); - mBackendPlayout.deckLinkScheduleFailureCount = scheduleFailureCount; -} - -bool HealthTelemetry::TryRecordDeckLinkBufferTelemetry(bool actualBufferedFramesAvailable, uint64_t actualBufferedFrames, - std::size_t targetBufferedFrames, double scheduleCallMilliseconds, uint64_t scheduleFailureCount) -{ - std::unique_lock lock(mMutex, std::try_to_lock); - if (!lock.owns_lock()) - return false; - - mBackendPlayout.actualDeckLinkBufferedFramesAvailable = actualBufferedFramesAvailable; - mBackendPlayout.actualDeckLinkBufferedFrames = actualBufferedFramesAvailable ? actualBufferedFrames : 0; - mBackendPlayout.targetDeckLinkBufferedFrames = targetBufferedFrames; - mBackendPlayout.deckLinkScheduleCallMilliseconds = std::max(scheduleCallMilliseconds, 0.0); - mBackendPlayout.deckLinkScheduleFailureCount = scheduleFailureCount; - return true; -} - -void HealthTelemetry::RecordOutputRenderPipelineTiming( - double drawMilliseconds, - double fenceWaitMilliseconds, - double mapMilliseconds, - double readbackCopyMilliseconds, - double cachedCopyMilliseconds, - double asyncQueueMilliseconds, - double asyncQueueBufferMilliseconds, - double asyncQueueSetupMilliseconds, - double asyncQueueReadPixelsMilliseconds, - double asyncQueueFenceMilliseconds, - double syncReadMilliseconds, - bool asyncReadbackMissed, - bool cachedFallbackUsed, - bool syncFallbackUsed) -{ - std::lock_guard lock(mMutex); - mBackendPlayout.outputRenderDrawMilliseconds = std::max(drawMilliseconds, 0.0); - mBackendPlayout.outputReadbackFenceWaitMilliseconds = std::max(fenceWaitMilliseconds, 0.0); - mBackendPlayout.outputReadbackMapMilliseconds = std::max(mapMilliseconds, 0.0); - mBackendPlayout.outputReadbackCopyMilliseconds = std::max(readbackCopyMilliseconds, 0.0); - mBackendPlayout.outputCachedCopyMilliseconds = std::max(cachedCopyMilliseconds, 0.0); - mBackendPlayout.outputAsyncQueueMilliseconds = std::max(asyncQueueMilliseconds, 0.0); - mBackendPlayout.outputAsyncQueueBufferMilliseconds = std::max(asyncQueueBufferMilliseconds, 0.0); - mBackendPlayout.outputAsyncQueueSetupMilliseconds = std::max(asyncQueueSetupMilliseconds, 0.0); - mBackendPlayout.outputAsyncQueueReadPixelsMilliseconds = std::max(asyncQueueReadPixelsMilliseconds, 0.0); - mBackendPlayout.outputAsyncQueueFenceMilliseconds = std::max(asyncQueueFenceMilliseconds, 0.0); - mBackendPlayout.outputSyncReadMilliseconds = std::max(syncReadMilliseconds, 0.0); - if (asyncReadbackMissed) - ++mBackendPlayout.outputAsyncReadbackMissCount; - if (cachedFallbackUsed) - ++mBackendPlayout.outputCachedFallbackCount; - if (syncFallbackUsed) - ++mBackendPlayout.outputSyncFallbackCount; -} - -bool HealthTelemetry::TryRecordOutputRenderPipelineTiming( - double drawMilliseconds, - double fenceWaitMilliseconds, - double mapMilliseconds, - double readbackCopyMilliseconds, - double cachedCopyMilliseconds, - double asyncQueueMilliseconds, - double asyncQueueBufferMilliseconds, - double asyncQueueSetupMilliseconds, - double asyncQueueReadPixelsMilliseconds, - double asyncQueueFenceMilliseconds, - double syncReadMilliseconds, - bool asyncReadbackMissed, - bool cachedFallbackUsed, - bool syncFallbackUsed) -{ - std::unique_lock lock(mMutex, std::try_to_lock); - if (!lock.owns_lock()) - return false; - - mBackendPlayout.outputRenderDrawMilliseconds = std::max(drawMilliseconds, 0.0); - mBackendPlayout.outputReadbackFenceWaitMilliseconds = std::max(fenceWaitMilliseconds, 0.0); - mBackendPlayout.outputReadbackMapMilliseconds = std::max(mapMilliseconds, 0.0); - mBackendPlayout.outputReadbackCopyMilliseconds = std::max(readbackCopyMilliseconds, 0.0); - mBackendPlayout.outputCachedCopyMilliseconds = std::max(cachedCopyMilliseconds, 0.0); - mBackendPlayout.outputAsyncQueueMilliseconds = std::max(asyncQueueMilliseconds, 0.0); - mBackendPlayout.outputAsyncQueueBufferMilliseconds = std::max(asyncQueueBufferMilliseconds, 0.0); - mBackendPlayout.outputAsyncQueueSetupMilliseconds = std::max(asyncQueueSetupMilliseconds, 0.0); - mBackendPlayout.outputAsyncQueueReadPixelsMilliseconds = std::max(asyncQueueReadPixelsMilliseconds, 0.0); - mBackendPlayout.outputAsyncQueueFenceMilliseconds = std::max(asyncQueueFenceMilliseconds, 0.0); - mBackendPlayout.outputSyncReadMilliseconds = std::max(syncReadMilliseconds, 0.0); - if (asyncReadbackMissed) - ++mBackendPlayout.outputAsyncReadbackMissCount; - if (cachedFallbackUsed) - ++mBackendPlayout.outputCachedFallbackCount; - if (syncFallbackUsed) - ++mBackendPlayout.outputSyncFallbackCount; - return true; -} - -HealthTelemetry::SignalStatusSnapshot HealthTelemetry::GetSignalStatusSnapshot() const -{ - std::lock_guard lock(mMutex); - return mSignalStatus; -} - -HealthTelemetry::VideoIOStatusSnapshot HealthTelemetry::GetVideoIOStatusSnapshot() const -{ - std::lock_guard lock(mMutex); - return mVideoIOStatus; -} - -HealthTelemetry::PerformanceSnapshot HealthTelemetry::GetPerformanceSnapshot() const -{ - std::lock_guard lock(mMutex); - return mPerformance; -} - -HealthTelemetry::RuntimeEventMetricsSnapshot HealthTelemetry::GetRuntimeEventMetricsSnapshot() const -{ - std::lock_guard lock(mMutex); - return mRuntimeEvents; -} - -HealthTelemetry::PersistenceSnapshot HealthTelemetry::GetPersistenceSnapshot() const -{ - std::lock_guard lock(mMutex); - return mPersistence; -} - -HealthTelemetry::BackendPlayoutSnapshot HealthTelemetry::GetBackendPlayoutSnapshot() const -{ - std::lock_guard lock(mMutex); - return mBackendPlayout; -} - -HealthTelemetry::Snapshot HealthTelemetry::GetSnapshot() const -{ - std::lock_guard lock(mMutex); - - Snapshot snapshot; - snapshot.signal = mSignalStatus; - snapshot.videoIO = mVideoIOStatus; - snapshot.performance = mPerformance; - snapshot.runtimeEvents = mRuntimeEvents; - snapshot.persistence = mPersistence; - snapshot.backendPlayout = mBackendPlayout; - return snapshot; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/telemetry/HealthTelemetry.h b/apps/LoopThroughWithOpenGLCompositing/runtime/telemetry/HealthTelemetry.h deleted file mode 100644 index 29be652..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/telemetry/HealthTelemetry.h +++ /dev/null @@ -1,273 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -// HealthTelemetry owns the current operational status snapshot directly, so -// callers can report health without sharing runtime-store state. -class HealthTelemetry -{ -public: - struct SignalStatusSnapshot - { - bool hasSignal = false; - unsigned width = 0; - unsigned height = 0; - std::string modeName; - }; - - struct VideoIOStatusSnapshot - { - std::string backendName = "decklink"; - std::string modelName; - bool supportsInternalKeying = false; - bool supportsExternalKeying = false; - bool keyerInterfaceAvailable = false; - bool externalKeyingRequested = false; - bool externalKeyingActive = false; - std::string statusMessage; - }; - - struct PerformanceSnapshot - { - double frameBudgetMilliseconds = 0.0; - double renderMilliseconds = 0.0; - double smoothedRenderMilliseconds = 0.0; - double completionIntervalMilliseconds = 0.0; - double smoothedCompletionIntervalMilliseconds = 0.0; - double maxCompletionIntervalMilliseconds = 0.0; - uint64_t lateFrameCount = 0; - uint64_t droppedFrameCount = 0; - uint64_t flushedFrameCount = 0; - }; - - struct RuntimeEventQueueSnapshot - { - std::string queueName = "runtime-events"; - std::size_t depth = 0; - std::size_t capacity = 0; - uint64_t droppedCount = 0; - double oldestEventAgeMilliseconds = 0.0; - }; - - struct RuntimeEventDispatchSnapshot - { - uint64_t dispatchCallCount = 0; - uint64_t dispatchedEventCount = 0; - uint64_t handlerInvocationCount = 0; - uint64_t handlerFailureCount = 0; - double lastDispatchDurationMilliseconds = 0.0; - double maxDispatchDurationMilliseconds = 0.0; - }; - - struct RuntimeEventMetricsSnapshot - { - RuntimeEventQueueSnapshot queue; - RuntimeEventDispatchSnapshot dispatch; - }; - - struct PersistenceSnapshot - { - uint64_t writeSuccessCount = 0; - uint64_t writeFailureCount = 0; - bool lastWriteSucceeded = true; - bool unsavedChanges = false; - bool newerRequestPending = false; - std::string lastTargetKind; - std::string lastTargetPath; - std::string lastReason; - std::string lastErrorMessage; - }; - - struct BackendPlayoutSnapshot - { - std::string lifecycleState = "NotStarted"; - std::string completionResult = "Unknown"; - std::size_t readyQueueDepth = 0; - std::size_t readyQueueCapacity = 0; - std::size_t minReadyQueueDepth = 0; - std::size_t maxReadyQueueDepth = 0; - uint64_t readyQueueZeroDepthCount = 0; - uint64_t readyQueuePushedCount = 0; - uint64_t readyQueuePoppedCount = 0; - uint64_t readyQueueDroppedCount = 0; - uint64_t readyQueueUnderrunCount = 0; - std::size_t systemFramePoolFree = 0; - std::size_t systemFramePoolReady = 0; - std::size_t systemFramePoolScheduled = 0; - uint64_t systemFrameUnderrunCount = 0; - uint64_t systemFrameRepeatCount = 0; - uint64_t systemFrameDropCount = 0; - double systemFrameAgeAtScheduleMilliseconds = 0.0; - double systemFrameAgeAtCompletionMilliseconds = 0.0; - double outputRenderMilliseconds = 0.0; - double smoothedOutputRenderMilliseconds = 0.0; - double maxOutputRenderMilliseconds = 0.0; - double outputFrameAcquireMilliseconds = 0.0; - double outputFrameRenderRequestMilliseconds = 0.0; - double outputFrameEndAccessMilliseconds = 0.0; - double outputRenderQueueWaitMilliseconds = 0.0; - double outputRenderDrawMilliseconds = 0.0; - double outputReadbackFenceWaitMilliseconds = 0.0; - double outputReadbackMapMilliseconds = 0.0; - double outputReadbackCopyMilliseconds = 0.0; - double outputCachedCopyMilliseconds = 0.0; - double outputAsyncQueueMilliseconds = 0.0; - double outputAsyncQueueBufferMilliseconds = 0.0; - double outputAsyncQueueSetupMilliseconds = 0.0; - double outputAsyncQueueReadPixelsMilliseconds = 0.0; - double outputAsyncQueueFenceMilliseconds = 0.0; - double outputSyncReadMilliseconds = 0.0; - uint64_t outputAsyncReadbackMissCount = 0; - uint64_t outputCachedFallbackCount = 0; - uint64_t outputSyncFallbackCount = 0; - uint64_t completedFrameIndex = 0; - uint64_t scheduledFrameIndex = 0; - uint64_t scheduledLeadFrames = 0; - bool actualDeckLinkBufferedFramesAvailable = false; - uint64_t actualDeckLinkBufferedFrames = 0; - std::size_t targetDeckLinkBufferedFrames = 0; - double deckLinkScheduleCallMilliseconds = 0.0; - uint64_t deckLinkScheduleFailureCount = 0; - uint64_t measuredLagFrames = 0; - uint64_t catchUpFrames = 0; - uint64_t lateStreak = 0; - uint64_t dropStreak = 0; - uint64_t lateFrameCount = 0; - uint64_t droppedFrameCount = 0; - uint64_t flushedFrameCount = 0; - bool degraded = false; - std::string statusMessage; - }; - - struct Snapshot - { - SignalStatusSnapshot signal; - VideoIOStatusSnapshot videoIO; - PerformanceSnapshot performance; - RuntimeEventMetricsSnapshot runtimeEvents; - PersistenceSnapshot persistence; - BackendPlayoutSnapshot backendPlayout; - }; - - HealthTelemetry() = default; - - void ReportSignalStatus(bool hasSignal, unsigned width, unsigned height, const std::string& modeName); - bool TryReportSignalStatus(bool hasSignal, unsigned width, unsigned height, const std::string& modeName); - - void ReportVideoIOStatus(const std::string& backendName, const std::string& modelName, - bool supportsInternalKeying, bool supportsExternalKeying, bool keyerInterfaceAvailable, - bool externalKeyingRequested, bool externalKeyingActive, const std::string& statusMessage); - bool TryReportVideoIOStatus(const std::string& backendName, const std::string& modelName, - bool supportsInternalKeying, bool supportsExternalKeying, bool keyerInterfaceAvailable, - bool externalKeyingRequested, bool externalKeyingActive, const std::string& statusMessage); - - void RecordPerformanceStats(double frameBudgetMilliseconds, double renderMilliseconds); - bool TryRecordPerformanceStats(double frameBudgetMilliseconds, double renderMilliseconds); - - void RecordFramePacingStats(double completionIntervalMilliseconds, double smoothedCompletionIntervalMilliseconds, - double maxCompletionIntervalMilliseconds, uint64_t lateFrameCount, uint64_t droppedFrameCount, uint64_t flushedFrameCount); - bool TryRecordFramePacingStats(double completionIntervalMilliseconds, double smoothedCompletionIntervalMilliseconds, - double maxCompletionIntervalMilliseconds, uint64_t lateFrameCount, uint64_t droppedFrameCount, uint64_t flushedFrameCount); - - void RecordRuntimeEventQueueMetrics(const std::string& queueName, std::size_t depth, std::size_t capacity, - uint64_t droppedCount, double oldestEventAgeMilliseconds); - bool TryRecordRuntimeEventQueueMetrics(const std::string& queueName, std::size_t depth, std::size_t capacity, - uint64_t droppedCount, double oldestEventAgeMilliseconds); - - void RecordRuntimeEventDispatchStats(std::size_t dispatchedEvents, std::size_t handlerInvocations, - std::size_t handlerFailures, double dispatchDurationMilliseconds); - bool TryRecordRuntimeEventDispatchStats(std::size_t dispatchedEvents, std::size_t handlerInvocations, - std::size_t handlerFailures, double dispatchDurationMilliseconds); - - void RecordPersistenceWriteResult(bool succeeded, const std::string& targetKind, const std::string& targetPath, - const std::string& reason, const std::string& errorMessage, bool newerRequestPending); - bool TryRecordPersistenceWriteResult(bool succeeded, const std::string& targetKind, const std::string& targetPath, - const std::string& reason, const std::string& errorMessage, bool newerRequestPending); - - void RecordBackendPlayoutHealth(const std::string& lifecycleState, const std::string& completionResult, - std::size_t readyQueueDepth, std::size_t readyQueueCapacity, uint64_t readyQueuePushedCount, - std::size_t minReadyQueueDepth, std::size_t maxReadyQueueDepth, uint64_t readyQueueZeroDepthCount, - uint64_t readyQueuePoppedCount, uint64_t readyQueueDroppedCount, uint64_t readyQueueUnderrunCount, - double outputRenderMilliseconds, double smoothedOutputRenderMilliseconds, double maxOutputRenderMilliseconds, - double outputFrameAcquireMilliseconds, double outputFrameRenderRequestMilliseconds, double outputFrameEndAccessMilliseconds, - uint64_t completedFrameIndex, uint64_t scheduledFrameIndex, uint64_t scheduledLeadFrames, - uint64_t measuredLagFrames, uint64_t catchUpFrames, uint64_t lateStreak, uint64_t dropStreak, - uint64_t lateFrameCount, uint64_t droppedFrameCount, uint64_t flushedFrameCount, - bool degraded, const std::string& statusMessage); - bool TryRecordBackendPlayoutHealth(const std::string& lifecycleState, const std::string& completionResult, - std::size_t readyQueueDepth, std::size_t readyQueueCapacity, uint64_t readyQueuePushedCount, - std::size_t minReadyQueueDepth, std::size_t maxReadyQueueDepth, uint64_t readyQueueZeroDepthCount, - uint64_t readyQueuePoppedCount, uint64_t readyQueueDroppedCount, uint64_t readyQueueUnderrunCount, - double outputRenderMilliseconds, double smoothedOutputRenderMilliseconds, double maxOutputRenderMilliseconds, - double outputFrameAcquireMilliseconds, double outputFrameRenderRequestMilliseconds, double outputFrameEndAccessMilliseconds, - uint64_t completedFrameIndex, uint64_t scheduledFrameIndex, uint64_t scheduledLeadFrames, - uint64_t measuredLagFrames, uint64_t catchUpFrames, uint64_t lateStreak, uint64_t dropStreak, - uint64_t lateFrameCount, uint64_t droppedFrameCount, uint64_t flushedFrameCount, - bool degraded, const std::string& statusMessage); - - void RecordOutputRenderQueueWait(double queueWaitMilliseconds); - bool TryRecordOutputRenderQueueWait(double queueWaitMilliseconds); - - void RecordSystemMemoryPlayoutStats(std::size_t freeFrameCount, std::size_t readyFrameCount, - std::size_t scheduledFrameCount, uint64_t underrunCount, uint64_t repeatCount, uint64_t dropCount, - double frameAgeAtScheduleMilliseconds, double frameAgeAtCompletionMilliseconds); - bool TryRecordSystemMemoryPlayoutStats(std::size_t freeFrameCount, std::size_t readyFrameCount, - std::size_t scheduledFrameCount, uint64_t underrunCount, uint64_t repeatCount, uint64_t dropCount, - double frameAgeAtScheduleMilliseconds, double frameAgeAtCompletionMilliseconds); - - void RecordDeckLinkBufferTelemetry(bool actualBufferedFramesAvailable, uint64_t actualBufferedFrames, - std::size_t targetBufferedFrames, double scheduleCallMilliseconds, uint64_t scheduleFailureCount); - bool TryRecordDeckLinkBufferTelemetry(bool actualBufferedFramesAvailable, uint64_t actualBufferedFrames, - std::size_t targetBufferedFrames, double scheduleCallMilliseconds, uint64_t scheduleFailureCount); - - void RecordOutputRenderPipelineTiming( - double drawMilliseconds, - double fenceWaitMilliseconds, - double mapMilliseconds, - double readbackCopyMilliseconds, - double cachedCopyMilliseconds, - double asyncQueueMilliseconds, - double asyncQueueBufferMilliseconds, - double asyncQueueSetupMilliseconds, - double asyncQueueReadPixelsMilliseconds, - double asyncQueueFenceMilliseconds, - double syncReadMilliseconds, - bool asyncReadbackMissed, - bool cachedFallbackUsed, - bool syncFallbackUsed); - bool TryRecordOutputRenderPipelineTiming( - double drawMilliseconds, - double fenceWaitMilliseconds, - double mapMilliseconds, - double readbackCopyMilliseconds, - double cachedCopyMilliseconds, - double asyncQueueMilliseconds, - double asyncQueueBufferMilliseconds, - double asyncQueueSetupMilliseconds, - double asyncQueueReadPixelsMilliseconds, - double asyncQueueFenceMilliseconds, - double syncReadMilliseconds, - bool asyncReadbackMissed, - bool cachedFallbackUsed, - bool syncFallbackUsed); - - SignalStatusSnapshot GetSignalStatusSnapshot() const; - VideoIOStatusSnapshot GetVideoIOStatusSnapshot() const; - PerformanceSnapshot GetPerformanceSnapshot() const; - RuntimeEventMetricsSnapshot GetRuntimeEventMetricsSnapshot() const; - PersistenceSnapshot GetPersistenceSnapshot() const; - BackendPlayoutSnapshot GetBackendPlayoutSnapshot() const; - Snapshot GetSnapshot() const; - -private: - mutable std::mutex mMutex; - SignalStatusSnapshot mSignalStatus; - VideoIOStatusSnapshot mVideoIOStatus; - PerformanceSnapshot mPerformance; - RuntimeEventMetricsSnapshot mRuntimeEvents; - PersistenceSnapshot mPersistence; - BackendPlayoutSnapshot mBackendPlayout; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/telemetry/RuntimeClock.cpp b/apps/LoopThroughWithOpenGLCompositing/runtime/telemetry/RuntimeClock.cpp deleted file mode 100644 index 46678b3..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/telemetry/RuntimeClock.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include "RuntimeClock.h" - -#include - -namespace -{ -bool ToUtcTime(std::time_t time, std::tm& utcTime) -{ - return gmtime_s(&utcTime, &time) == 0; -} - -bool ToLocalTime(std::time_t time, std::tm& localTime) -{ - return localtime_s(&localTime, &time) == 0; -} -} - -RuntimeClockSnapshot GetRuntimeClockSnapshot() -{ - return MakeRuntimeClockSnapshot(std::chrono::system_clock::to_time_t(std::chrono::system_clock::now())); -} - -RuntimeClockSnapshot MakeRuntimeClockSnapshot(std::time_t now) -{ - RuntimeClockSnapshot snapshot; - - std::tm utcTime = {}; - if (!ToUtcTime(now, utcTime)) - return snapshot; - - snapshot.utcTimeSeconds = - static_cast(utcTime.tm_hour * 3600 + utcTime.tm_min * 60 + utcTime.tm_sec); - - std::tm localTime = {}; - if (!ToLocalTime(now, localTime)) - return snapshot; - - utcTime.tm_isdst = localTime.tm_isdst; - const std::time_t localAsTime = std::mktime(&localTime); - const std::time_t utcAsLocalTime = std::mktime(&utcTime); - if (localAsTime != static_cast(-1) && utcAsLocalTime != static_cast(-1)) - snapshot.utcOffsetSeconds = std::difftime(localAsTime, utcAsLocalTime); - - return snapshot; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/runtime/telemetry/RuntimeClock.h b/apps/LoopThroughWithOpenGLCompositing/runtime/telemetry/RuntimeClock.h deleted file mode 100644 index 809fd44..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/runtime/telemetry/RuntimeClock.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include - -struct RuntimeClockSnapshot -{ - double utcTimeSeconds = 0.0; - double utcOffsetSeconds = 0.0; -}; - -RuntimeClockSnapshot GetRuntimeClockSnapshot(); -RuntimeClockSnapshot MakeRuntimeClockSnapshot(std::time_t now); diff --git a/apps/LoopThroughWithOpenGLCompositing/shader/ShaderCompiler.cpp b/apps/LoopThroughWithOpenGLCompositing/shader/ShaderCompiler.cpp deleted file mode 100644 index 2314db9..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/shader/ShaderCompiler.cpp +++ /dev/null @@ -1,326 +0,0 @@ -#include "stdafx.h" -#include "ShaderCompiler.h" - -#include "NativeHandles.h" - -#include -#include -#include -#include -#include - -namespace -{ -std::string ReplaceAll(std::string text, const std::string& from, const std::string& to) -{ - std::size_t offset = 0; - while ((offset = text.find(from, offset)) != std::string::npos) - { - text.replace(offset, from.length(), to); - offset += to.length(); - } - return text; -} - -std::string SlangCBufferTypeForParameter(ShaderParameterType type) -{ - switch (type) - { - case ShaderParameterType::Float: return "float"; - case ShaderParameterType::Vec2: return "float2"; - case ShaderParameterType::Color: return "float4"; - case ShaderParameterType::Boolean: return "bool"; - case ShaderParameterType::Enum: return "int"; - case ShaderParameterType::Text: return ""; - case ShaderParameterType::Trigger: return "int"; - } - return "float"; -} - -std::string CapitalizeIdentifier(const std::string& identifier) -{ - if (identifier.empty()) - return identifier; - std::string text = identifier; - text[0] = static_cast(std::toupper(static_cast(text[0]))); - return text; -} - -std::string BuildParameterUniforms(const std::vector& parameters) -{ - std::ostringstream source; - for (const ShaderParameterDefinition& definition : parameters) - { - if (definition.type == ShaderParameterType::Text) - continue; - if (definition.type == ShaderParameterType::Trigger) - { - source << "\tint " << definition.id << ";\n"; - source << "\tfloat " << definition.id << "Time;\n"; - continue; - } - source << "\t" << SlangCBufferTypeForParameter(definition.type) << " " << definition.id << ";\n"; - } - return source.str(); -} - -std::string BuildHistorySamplerDeclarations(const std::string& samplerPrefix, unsigned historyLength) -{ - std::ostringstream source; - for (unsigned index = 0; index < historyLength; ++index) - source << "Sampler2D " << samplerPrefix << index << ";\n"; - return source.str(); -} - -std::string BuildTextureSamplerDeclarations(const std::vector& textureAssets) -{ - std::ostringstream source; - for (const ShaderTextureAsset& textureAsset : textureAssets) - source << "Sampler2D " << textureAsset.id << ";\n"; - if (!textureAssets.empty()) - source << "\n"; - return source.str(); -} - -std::string BuildTextSamplerDeclarations(const std::vector& parameters) -{ - std::ostringstream source; - for (const ShaderParameterDefinition& definition : parameters) - { - if (definition.type != ShaderParameterType::Text) - continue; - source << "Sampler2D " << definition.id << "Texture;\n"; - } - if (source.tellp() > 0) - source << "\n"; - return source.str(); -} - -std::string BuildTextHelpers(const std::vector& parameters) -{ - std::ostringstream source; - for (const ShaderParameterDefinition& definition : parameters) - { - if (definition.type != ShaderParameterType::Text) - continue; - const std::string suffix = CapitalizeIdentifier(definition.id); - source - << "float sample" << suffix << "(float2 uv)\n" - << "{\n" - << "\tif (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0)\n" - << "\t\treturn 0.0;\n" - << "\treturn " << definition.id << "Texture.Sample(uv).r;\n" - << "}\n\n" - << "float4 draw" << suffix << "(float2 uv, float4 fillColor)\n" - << "{\n" - << "\tfloat alpha = sample" << suffix << "(uv) * fillColor.a;\n" - << "\treturn float4(fillColor.rgb * alpha, alpha);\n" - << "}\n\n"; - } - return source.str(); -} - -std::string BuildHistorySwitchCases(const std::string& samplerPrefix, unsigned historyLength) -{ - std::ostringstream source; - for (unsigned index = 0; index < historyLength; ++index) - source << "\tcase " << index << ": return " << samplerPrefix << index << ".Sample(tc);\n"; - return source.str(); -} -} - -ShaderCompiler::ShaderCompiler( - const std::filesystem::path& repoRoot, - const std::filesystem::path& wrapperPath, - const std::filesystem::path& generatedGlslPath, - const std::filesystem::path& patchedGlslPath, - unsigned maxTemporalHistoryFrames) - : mRepoRoot(repoRoot), - mWrapperPath(wrapperPath), - mGeneratedGlslPath(generatedGlslPath), - mPatchedGlslPath(patchedGlslPath), - mMaxTemporalHistoryFrames(maxTemporalHistoryFrames) -{ -} - -bool ShaderCompiler::BuildPassFragmentShaderSource(const ShaderPackage& shaderPackage, const ShaderPassDefinition& pass, std::string& fragmentShaderSource, std::string& error) const -{ - std::string wrapperSource; - if (!BuildWrapperSlangSource(shaderPackage, pass, wrapperSource, error)) - return false; - if (!WriteTextFile(mWrapperPath, wrapperSource, error)) - return false; - - if (!RunSlangCompiler(mWrapperPath, mGeneratedGlslPath, error)) - return false; - - fragmentShaderSource = ReadTextFile(mGeneratedGlslPath, error); - if (fragmentShaderSource.empty()) - return false; - - if (!PatchGeneratedGlsl(fragmentShaderSource, error)) - return false; - - if (!WriteTextFile(mPatchedGlslPath, fragmentShaderSource, error)) - return false; - - return true; -} - -bool ShaderCompiler::BuildWrapperSlangSource(const ShaderPackage& shaderPackage, const ShaderPassDefinition& pass, std::string& wrapperSource, std::string& error) const -{ - const std::filesystem::path templatePath = mRepoRoot / "runtime" / "templates" / "shader_wrapper.slang.in"; - wrapperSource = ReadTextFile(templatePath, error); - if (wrapperSource.empty()) - return false; - - wrapperSource = ReplaceAll(wrapperSource, "{{PARAMETER_UNIFORMS}}", BuildParameterUniforms(shaderPackage.parameters)); - const unsigned historySamplerCount = shaderPackage.temporal.enabled ? mMaxTemporalHistoryFrames : 0; - wrapperSource = ReplaceAll(wrapperSource, "{{SOURCE_HISTORY_SAMPLERS}}", BuildHistorySamplerDeclarations("gSourceHistory", historySamplerCount)); - wrapperSource = ReplaceAll(wrapperSource, "{{TEMPORAL_HISTORY_SAMPLERS}}", BuildHistorySamplerDeclarations("gTemporalHistory", historySamplerCount)); - wrapperSource = ReplaceAll(wrapperSource, "{{FEEDBACK_SAMPLER}}", shaderPackage.feedback.enabled ? "Sampler2D gFeedbackState;\n" : ""); - wrapperSource = ReplaceAll(wrapperSource, "{{FEEDBACK_HELPER}}", - shaderPackage.feedback.enabled - ? "float4 sampleFeedback(float2 tc)\n{\n\tif (gFeedbackAvailable <= 0)\n\t\treturn float4(0.0, 0.0, 0.0, 0.0);\n\treturn gFeedbackState.Sample(tc);\n}\n" - : "float4 sampleFeedback(float2 tc)\n{\n\treturn float4(0.0, 0.0, 0.0, 0.0);\n}\n"); - wrapperSource = ReplaceAll(wrapperSource, "{{TEXTURE_SAMPLERS}}", BuildTextureSamplerDeclarations(shaderPackage.textureAssets)); - wrapperSource = ReplaceAll(wrapperSource, "{{TEXT_SAMPLERS}}", BuildTextSamplerDeclarations(shaderPackage.parameters)); - wrapperSource = ReplaceAll(wrapperSource, "{{TEXT_HELPERS}}", BuildTextHelpers(shaderPackage.parameters)); - wrapperSource = ReplaceAll(wrapperSource, "{{SOURCE_HISTORY_SWITCH_CASES}}", BuildHistorySwitchCases("gSourceHistory", historySamplerCount)); - wrapperSource = ReplaceAll(wrapperSource, "{{TEMPORAL_HISTORY_SWITCH_CASES}}", BuildHistorySwitchCases("gTemporalHistory", historySamplerCount)); - wrapperSource = ReplaceAll(wrapperSource, "{{USER_SHADER_INCLUDE}}", pass.sourcePath.generic_string()); - wrapperSource = ReplaceAll(wrapperSource, "{{ENTRY_POINT_CALL}}", pass.entryPoint + "(context)"); - return true; -} - -bool ShaderCompiler::FindSlangCompiler(std::filesystem::path& compilerPath, std::string& error) const -{ - char slangRootBuffer[MAX_PATH] = {}; - const DWORD slangRootLength = GetEnvironmentVariableA("SLANG_ROOT", slangRootBuffer, static_cast(sizeof(slangRootBuffer))); - if (slangRootLength > 0 && slangRootLength < sizeof(slangRootBuffer)) - { - std::filesystem::path candidate = std::filesystem::path(slangRootBuffer) / "bin" / "slangc.exe"; - if (std::filesystem::exists(candidate)) - { - compilerPath = candidate; - return true; - } - } - - std::filesystem::path thirdPartyRoot = mRepoRoot / "3rdParty"; - if (!std::filesystem::exists(thirdPartyRoot)) - { - error = "3rdParty directory was not found under the repository root."; - return false; - } - - for (const auto& entry : std::filesystem::directory_iterator(thirdPartyRoot)) - { - if (!entry.is_directory()) - continue; - std::filesystem::path candidate = entry.path() / "bin" / "slangc.exe"; - if (std::filesystem::exists(candidate)) - { - compilerPath = candidate; - return true; - } - } - - error = "Could not find slangc.exe under 3rdParty."; - return false; -} - -bool ShaderCompiler::RunSlangCompiler(const std::filesystem::path& wrapperPath, const std::filesystem::path& outputPath, std::string& error) const -{ - std::filesystem::path compilerPath; - if (!FindSlangCompiler(compilerPath, error)) - return false; - - std::string commandLine = "\"" + compilerPath.string() + "\" \"" + wrapperPath.string() - + "\" -target glsl -profile glsl_430 -entry fragmentMain -stage fragment -o \"" + outputPath.string() + "\""; - - STARTUPINFOA startupInfo = {}; - PROCESS_INFORMATION processInfo = {}; - startupInfo.cb = sizeof(startupInfo); - std::vector mutableCommandLine(commandLine.begin(), commandLine.end()); - mutableCommandLine.push_back('\0'); - - if (!CreateProcessA(NULL, mutableCommandLine.data(), NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, mRepoRoot.string().c_str(), &startupInfo, &processInfo)) - { - error = "Failed to launch slangc.exe."; - return false; - } - - UniqueHandle processHandle(processInfo.hProcess); - UniqueHandle threadHandle(processInfo.hThread); - - WaitForSingleObject(processHandle.get(), INFINITE); - - DWORD exitCode = 0; - GetExitCodeProcess(processHandle.get(), &exitCode); - - if (exitCode != 0) - { - error = "slangc.exe returned a non-zero exit code while compiling the active shader package."; - return false; - } - - return true; -} - -bool ShaderCompiler::PatchGeneratedGlsl(std::string& shaderText, std::string& error) const -{ - if (shaderText.find("#version 450") == std::string::npos) - { - error = "Generated GLSL did not include the expected version header."; - return false; - } - - shaderText = ReplaceAll(shaderText, "#version 450", "#version 430 core"); - shaderText = std::regex_replace(shaderText, std::regex(R"(#extension GL_EXT_samplerless_texture_functions : require\r?\n)"), ""); - shaderText = std::regex_replace(shaderText, std::regex(R"(layout\(row_major\) uniform;\r?\n)"), ""); - shaderText = std::regex_replace(shaderText, std::regex(R"(layout\(row_major\) buffer;\r?\n)"), ""); - shaderText = std::regex_replace(shaderText, std::regex(R"(layout\(location = 0\)\s*in vec2 ([A-Za-z0-9_]+);)"), "in vec2 vTexCoord;"); - shaderText = ReplaceAll(shaderText, "input_texCoord_0", "vTexCoord"); - - std::smatch match; - std::regex outRegex(R"(layout\(location = 0\)\s*out vec4 ([A-Za-z0-9_]+);)"); - if (std::regex_search(shaderText, match, outRegex)) - { - const std::string outputName = match[1].str(); - shaderText = std::regex_replace(shaderText, outRegex, "layout(location = 0) out vec4 fragColor;"); - shaderText = ReplaceAll(shaderText, outputName + " =", "fragColor ="); - } - - return true; -} - -std::string ShaderCompiler::ReadTextFile(const std::filesystem::path& path, std::string& error) const -{ - std::ifstream input(path, std::ios::binary); - if (!input) - { - error = "Could not open file: " + path.string(); - return std::string(); - } - - std::ostringstream buffer; - buffer << input.rdbuf(); - return buffer.str(); -} - -bool ShaderCompiler::WriteTextFile(const std::filesystem::path& path, const std::string& contents, std::string& error) const -{ - std::error_code fsError; - std::filesystem::create_directories(path.parent_path(), fsError); - - std::ofstream output(path, std::ios::binary); - if (!output) - { - error = "Could not write file: " + path.string(); - return false; - } - - output << contents; - return output.good(); -} diff --git a/apps/LoopThroughWithOpenGLCompositing/shader/ShaderCompiler.h b/apps/LoopThroughWithOpenGLCompositing/shader/ShaderCompiler.h deleted file mode 100644 index 9fc8c03..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/shader/ShaderCompiler.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include "ShaderTypes.h" - -#include -#include - -class ShaderCompiler -{ -public: - ShaderCompiler( - const std::filesystem::path& repoRoot, - const std::filesystem::path& wrapperPath, - const std::filesystem::path& generatedGlslPath, - const std::filesystem::path& patchedGlslPath, - unsigned maxTemporalHistoryFrames); - - bool BuildPassFragmentShaderSource(const ShaderPackage& shaderPackage, const ShaderPassDefinition& pass, std::string& fragmentShaderSource, std::string& error) const; - -private: - bool BuildWrapperSlangSource(const ShaderPackage& shaderPackage, const ShaderPassDefinition& pass, std::string& wrapperSource, std::string& error) const; - bool FindSlangCompiler(std::filesystem::path& compilerPath, std::string& error) const; - bool RunSlangCompiler(const std::filesystem::path& wrapperPath, const std::filesystem::path& outputPath, std::string& error) const; - bool PatchGeneratedGlsl(std::string& shaderText, std::string& error) const; - std::string ReadTextFile(const std::filesystem::path& path, std::string& error) const; - bool WriteTextFile(const std::filesystem::path& path, const std::string& contents, std::string& error) const; - -private: - std::filesystem::path mRepoRoot; - std::filesystem::path mWrapperPath; - std::filesystem::path mGeneratedGlslPath; - std::filesystem::path mPatchedGlslPath; - unsigned mMaxTemporalHistoryFrames; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/shader/ShaderPackageRegistry.cpp b/apps/LoopThroughWithOpenGLCompositing/shader/ShaderPackageRegistry.cpp deleted file mode 100644 index 59fecbe..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/shader/ShaderPackageRegistry.cpp +++ /dev/null @@ -1,818 +0,0 @@ -#include "stdafx.h" -#include "ShaderPackageRegistry.h" - -#include "RuntimeJson.h" - -#include -#include -#include -#include -#include - -namespace -{ -std::string Trim(const std::string& text) -{ - std::size_t start = 0; - while (start < text.size() && std::isspace(static_cast(text[start]))) - ++start; - - std::size_t end = text.size(); - while (end > start && std::isspace(static_cast(text[end - 1]))) - --end; - - return text.substr(start, end - start); -} - -bool IsFiniteNumber(double value) -{ - return std::isfinite(value) != 0; -} - -bool ParseShaderParameterType(const std::string& typeName, ShaderParameterType& type) -{ - if (typeName == "float") - { - type = ShaderParameterType::Float; - return true; - } - if (typeName == "vec2") - { - type = ShaderParameterType::Vec2; - return true; - } - if (typeName == "color") - { - type = ShaderParameterType::Color; - return true; - } - if (typeName == "bool") - { - type = ShaderParameterType::Boolean; - return true; - } - if (typeName == "enum") - { - type = ShaderParameterType::Enum; - return true; - } - if (typeName == "text") - { - type = ShaderParameterType::Text; - return true; - } - if (typeName == "trigger") - { - type = ShaderParameterType::Trigger; - return true; - } - return false; -} - -bool ParseTemporalHistorySource(const std::string& sourceName, TemporalHistorySource& source) -{ - if (sourceName == "source") - { - source = TemporalHistorySource::Source; - return true; - } - if (sourceName == "preLayerInput") - { - source = TemporalHistorySource::PreLayerInput; - return true; - } - if (sourceName == "none") - { - source = TemporalHistorySource::None; - return true; - } - return false; -} - -std::string ReadTextFile(const std::filesystem::path& path, std::string& error) -{ - std::ifstream input(path, std::ios::binary); - if (!input) - { - error = "Could not open file: " + path.string(); - return std::string(); - } - - std::ostringstream buffer; - buffer << input.rdbuf(); - return buffer.str(); -} - -std::string ManifestPathMessage(const std::filesystem::path& manifestPath) -{ - return manifestPath.string(); -} - -bool RequireStringField(const JsonValue& object, const char* fieldName, std::string& value, const std::filesystem::path& manifestPath, std::string& error) -{ - const JsonValue* fieldValue = object.find(fieldName); - if (!fieldValue || !fieldValue->isString()) - { - error = "Shader manifest is missing required string '" + std::string(fieldName) + "' field: " + ManifestPathMessage(manifestPath); - return false; - } - - value = fieldValue->asString(); - return true; -} - -bool RequireNonEmptyStringField(const JsonValue& object, const char* fieldName, std::string& value, const std::filesystem::path& manifestPath, std::string& error) -{ - if (!RequireStringField(object, fieldName, value, manifestPath, error)) - return false; - if (Trim(value).empty()) - { - error = "Shader manifest string '" + std::string(fieldName) + "' must not be empty: " + ManifestPathMessage(manifestPath); - return false; - } - return true; -} - -bool OptionalStringField(const JsonValue& object, const char* fieldName, std::string& value, const std::string& fallback, const std::filesystem::path& manifestPath, std::string& error) -{ - const JsonValue* fieldValue = object.find(fieldName); - if (!fieldValue) - { - value = fallback; - return true; - } - if (!fieldValue->isString()) - { - error = "Shader manifest field '" + std::string(fieldName) + "' must be a string in: " + ManifestPathMessage(manifestPath); - return false; - } - value = fieldValue->asString(); - return true; -} - -bool OptionalArrayField(const JsonValue& object, const char* fieldName, const JsonValue*& value, const std::filesystem::path& manifestPath, std::string& error) -{ - value = object.find(fieldName); - if (!value) - return true; - if (!value->isArray()) - { - error = "Shader manifest '" + std::string(fieldName) + "' field must be an array in: " + ManifestPathMessage(manifestPath); - return false; - } - return true; -} - -bool OptionalObjectField(const JsonValue& object, const char* fieldName, const JsonValue*& value, const std::filesystem::path& manifestPath, std::string& error) -{ - value = object.find(fieldName); - if (!value) - return true; - if (!value->isObject()) - { - error = "Shader manifest '" + std::string(fieldName) + "' field must be an object in: " + ManifestPathMessage(manifestPath); - return false; - } - return true; -} - -bool NumberListFromJsonValue(const JsonValue& value, std::vector& numbers, const std::string& fieldName, const std::filesystem::path& manifestPath, std::string& error) -{ - if (value.isNumber()) - { - numbers.push_back(value.asNumber()); - return true; - } - if (value.isArray()) - { - numbers = JsonArrayToNumbers(value); - if (numbers.size() != value.asArray().size()) - { - error = "Shader parameter field '" + fieldName + "' must contain only numbers in: " + ManifestPathMessage(manifestPath); - return false; - } - return true; - } - - error = "Shader parameter field '" + fieldName + "' must be a number or array of numbers in: " + ManifestPathMessage(manifestPath); - return false; -} - -bool ValidateShaderIdentifier(const std::string& identifier, const std::string& fieldName, const std::filesystem::path& manifestPath, std::string& error) -{ - if (identifier.empty() || !(std::isalpha(static_cast(identifier.front())) || identifier.front() == '_')) - { - error = "Shader manifest field '" + fieldName + "' must be a valid shader identifier in: " + ManifestPathMessage(manifestPath); - return false; - } - - for (char ch : identifier) - { - const unsigned char unsignedCh = static_cast(ch); - if (!(std::isalnum(unsignedCh) || ch == '_')) - { - error = "Shader manifest field '" + fieldName + "' must be a valid shader identifier in: " + ManifestPathMessage(manifestPath); - return false; - } - } - - return true; -} - -bool ParseShaderMetadata(const JsonValue& manifestJson, ShaderPackage& shaderPackage, const std::filesystem::path& manifestPath, std::string& error) -{ - if (!RequireStringField(manifestJson, "id", shaderPackage.id, manifestPath, error) || - !RequireStringField(manifestJson, "name", shaderPackage.displayName, manifestPath, error) || - !OptionalStringField(manifestJson, "description", shaderPackage.description, "", manifestPath, error) || - !OptionalStringField(manifestJson, "category", shaderPackage.category, "", manifestPath, error) || - !OptionalStringField(manifestJson, "entryPoint", shaderPackage.entryPoint, "shadeVideo", manifestPath, error)) - { - return false; - } - - if (!ValidateShaderIdentifier(shaderPackage.entryPoint, "entryPoint", manifestPath, error)) - return false; - - shaderPackage.directoryPath = manifestPath.parent_path(); - shaderPackage.shaderPath = shaderPackage.directoryPath / "shader.slang"; - shaderPackage.manifestPath = manifestPath; - return true; -} - -bool ParsePassDefinitions(const JsonValue& manifestJson, ShaderPackage& shaderPackage, const std::filesystem::path& manifestPath, std::string& error) -{ - const JsonValue* passesValue = nullptr; - if (!OptionalArrayField(manifestJson, "passes", passesValue, manifestPath, error)) - return false; - - if (!passesValue) - { - // Existing shader packages are treated as a single implicit pass, so - // multipass support does not require manifest churn. - ShaderPassDefinition pass; - pass.id = "main"; - pass.entryPoint = shaderPackage.entryPoint; - pass.sourcePath = shaderPackage.shaderPath; - pass.outputName = "layerOutput"; - if (!std::filesystem::exists(pass.sourcePath)) - { - error = "Shader source not found for package " + shaderPackage.id + ": " + pass.sourcePath.string(); - return false; - } - pass.sourceWriteTime = std::filesystem::last_write_time(pass.sourcePath); - shaderPackage.passes.push_back(pass); - return true; - } - - if (passesValue->asArray().empty()) - { - error = "Shader manifest 'passes' field must not be empty in: " + ManifestPathMessage(manifestPath); - return false; - } - - for (const JsonValue& passJson : passesValue->asArray()) - { - if (!passJson.isObject()) - { - error = "Shader pass entry must be an object in: " + ManifestPathMessage(manifestPath); - return false; - } - - std::string passId; - std::string sourcePath; - if (!RequireNonEmptyStringField(passJson, "id", passId, manifestPath, error) || - !RequireNonEmptyStringField(passJson, "source", sourcePath, manifestPath, error)) - { - error = "Shader pass is missing required 'id' or 'source' in: " + ManifestPathMessage(manifestPath); - return false; - } - if (!ValidateShaderIdentifier(passId, "passes[].id", manifestPath, error)) - return false; - - for (const ShaderPassDefinition& existingPass : shaderPackage.passes) - { - if (existingPass.id == passId) - { - error = "Duplicate shader pass id '" + passId + "' in: " + ManifestPathMessage(manifestPath); - return false; - } - } - - ShaderPassDefinition pass; - pass.id = passId; - pass.sourcePath = shaderPackage.directoryPath / sourcePath; - if (!OptionalStringField(passJson, "entryPoint", pass.entryPoint, shaderPackage.entryPoint, manifestPath, error) || - !OptionalStringField(passJson, "output", pass.outputName, passId, manifestPath, error)) - { - return false; - } - if (!ValidateShaderIdentifier(pass.entryPoint, "passes[].entryPoint", manifestPath, error)) - return false; - - const JsonValue* inputsValue = nullptr; - if (!OptionalArrayField(passJson, "inputs", inputsValue, manifestPath, error)) - return false; - if (inputsValue) - { - for (const JsonValue& inputValue : inputsValue->asArray()) - { - if (!inputValue.isString()) - { - error = "Shader pass inputs must be strings in: " + ManifestPathMessage(manifestPath); - return false; - } - pass.inputNames.push_back(inputValue.asString()); - } - } - - // Keep source validation in the registry. Bad pass declarations then - // appear as unavailable shaders instead of failing at render time. - if (!std::filesystem::exists(pass.sourcePath)) - { - error = "Shader pass source not found for package " + shaderPackage.id + ": " + pass.sourcePath.string(); - return false; - } - pass.sourceWriteTime = std::filesystem::last_write_time(pass.sourcePath); - shaderPackage.passes.push_back(pass); - } - - shaderPackage.shaderPath = shaderPackage.passes.front().sourcePath; - return true; -} - -bool ParseTextureAssets(const JsonValue& manifestJson, ShaderPackage& shaderPackage, const std::filesystem::path& manifestPath, std::string& error) -{ - const JsonValue* texturesValue = nullptr; - if (!OptionalArrayField(manifestJson, "textures", texturesValue, manifestPath, error)) - return false; - if (!texturesValue) - return true; - - for (const JsonValue& textureJson : texturesValue->asArray()) - { - if (!textureJson.isObject()) - { - error = "Shader texture entry must be an object in: " + ManifestPathMessage(manifestPath); - return false; - } - - std::string textureId; - std::string texturePath; - if (!RequireNonEmptyStringField(textureJson, "id", textureId, manifestPath, error) || - !RequireNonEmptyStringField(textureJson, "path", texturePath, manifestPath, error)) - { - error = "Shader texture is missing required 'id' or 'path' in: " + ManifestPathMessage(manifestPath); - return false; - } - if (!ValidateShaderIdentifier(textureId, "textures[].id", manifestPath, error)) - return false; - - ShaderTextureAsset textureAsset; - textureAsset.id = textureId; - textureAsset.path = shaderPackage.directoryPath / texturePath; - if (!std::filesystem::exists(textureAsset.path)) - { - error = "Shader texture asset not found for package " + shaderPackage.id + ": " + textureAsset.path.string(); - return false; - } - - textureAsset.writeTime = std::filesystem::last_write_time(textureAsset.path); - shaderPackage.textureAssets.push_back(textureAsset); - } - - return true; -} - -bool ParseFontAssets(const JsonValue& manifestJson, ShaderPackage& shaderPackage, const std::filesystem::path& manifestPath, std::string& error) -{ - const JsonValue* fontsValue = nullptr; - if (!OptionalArrayField(manifestJson, "fonts", fontsValue, manifestPath, error)) - return false; - if (!fontsValue) - return true; - - for (const JsonValue& fontJson : fontsValue->asArray()) - { - if (!fontJson.isObject()) - { - error = "Shader font entry must be an object in: " + ManifestPathMessage(manifestPath); - return false; - } - - std::string fontId; - std::string fontPath; - if (!RequireNonEmptyStringField(fontJson, "id", fontId, manifestPath, error) || - !RequireNonEmptyStringField(fontJson, "path", fontPath, manifestPath, error)) - { - error = "Shader font is missing required 'id' or 'path' in: " + ManifestPathMessage(manifestPath); - return false; - } - if (!ValidateShaderIdentifier(fontId, "fonts[].id", manifestPath, error)) - return false; - - ShaderFontAsset fontAsset; - fontAsset.id = fontId; - fontAsset.path = shaderPackage.directoryPath / fontPath; - if (!std::filesystem::exists(fontAsset.path)) - { - error = "Shader font asset not found for package " + shaderPackage.id + ": " + fontAsset.path.string(); - return false; - } - - fontAsset.writeTime = std::filesystem::last_write_time(fontAsset.path); - shaderPackage.fontAssets.push_back(fontAsset); - } - - return true; -} - -bool ParseTemporalSettings(const JsonValue& manifestJson, ShaderPackage& shaderPackage, unsigned maxTemporalHistoryFrames, const std::filesystem::path& manifestPath, std::string& error) -{ - const JsonValue* temporalValue = nullptr; - if (!OptionalObjectField(manifestJson, "temporal", temporalValue, manifestPath, error)) - return false; - if (!temporalValue) - return true; - - const JsonValue* enabledValue = temporalValue->find("enabled"); - if (!enabledValue || !enabledValue->asBoolean(false)) - return true; - - std::string historySourceName; - if (!RequireNonEmptyStringField(*temporalValue, "historySource", historySourceName, manifestPath, error)) - { - error = "Temporal shader is missing required 'historySource' in: " + ManifestPathMessage(manifestPath); - return false; - } - - const JsonValue* historyLengthValue = temporalValue->find("historyLength"); - if (!historyLengthValue || !historyLengthValue->isNumber()) - { - error = "Temporal shader is missing required numeric 'historyLength' in: " + ManifestPathMessage(manifestPath); - return false; - } - - TemporalHistorySource historySource = TemporalHistorySource::None; - if (!ParseTemporalHistorySource(historySourceName, historySource)) - { - error = "Unsupported temporal historySource '" + historySourceName + "' in: " + ManifestPathMessage(manifestPath); - return false; - } - - const double requestedHistoryLength = historyLengthValue->asNumber(); - if (!IsFiniteNumber(requestedHistoryLength) || requestedHistoryLength <= 0.0 || std::floor(requestedHistoryLength) != requestedHistoryLength) - { - error = "Temporal shader 'historyLength' must be a positive integer in: " + ManifestPathMessage(manifestPath); - return false; - } - - shaderPackage.temporal.enabled = true; - shaderPackage.temporal.historySource = historySource; - shaderPackage.temporal.requestedHistoryLength = static_cast(requestedHistoryLength); - shaderPackage.temporal.effectiveHistoryLength = std::min(shaderPackage.temporal.requestedHistoryLength, maxTemporalHistoryFrames); - return true; -} - -bool ParseFeedbackSettings(const JsonValue& manifestJson, ShaderPackage& shaderPackage, const std::filesystem::path& manifestPath, std::string& error) -{ - const JsonValue* feedbackValue = nullptr; - if (!OptionalObjectField(manifestJson, "feedback", feedbackValue, manifestPath, error)) - return false; - if (!feedbackValue) - return true; - - const JsonValue* enabledValue = feedbackValue->find("enabled"); - if (!enabledValue || !enabledValue->asBoolean(false)) - return true; - - shaderPackage.feedback.enabled = true; - if (!OptionalStringField(*feedbackValue, "writePass", shaderPackage.feedback.writePassId, "", manifestPath, error)) - return false; - - if (shaderPackage.feedback.writePassId.empty()) - { - if (shaderPackage.passes.empty()) - { - error = "Feedback-enabled shader has no passes to target in: " + ManifestPathMessage(manifestPath); - return false; - } - shaderPackage.feedback.writePassId = shaderPackage.passes.back().id; - } - - if (!ValidateShaderIdentifier(shaderPackage.feedback.writePassId, "feedback.writePass", manifestPath, error)) - return false; - - const auto passIt = std::find_if(shaderPackage.passes.begin(), shaderPackage.passes.end(), - [&shaderPackage](const ShaderPassDefinition& pass) { return pass.id == shaderPackage.feedback.writePassId; }); - if (passIt == shaderPackage.passes.end()) - { - error = "Feedback writePass '" + shaderPackage.feedback.writePassId + "' does not match any declared pass in: " + ManifestPathMessage(manifestPath); - return false; - } - - return true; -} - -bool ParseParameterNumberField(const JsonValue& parameterJson, const char* fieldName, std::vector& values, const std::filesystem::path& manifestPath, std::string& error) -{ - if (const JsonValue* fieldValue = parameterJson.find(fieldName)) - return NumberListFromJsonValue(*fieldValue, values, fieldName, manifestPath, error); - return true; -} - -bool ParseParameterDefault(const JsonValue& parameterJson, ShaderParameterDefinition& definition, const std::filesystem::path& manifestPath, std::string& error) -{ - const JsonValue* defaultValue = parameterJson.find("default"); - if (!defaultValue) - return true; - - if (definition.type == ShaderParameterType::Boolean) - { - if (!defaultValue->isBoolean()) - { - error = "Boolean parameter default must be a boolean for: " + definition.id; - return false; - } - definition.defaultBoolean = defaultValue->asBoolean(false); - return true; - } - - if (definition.type == ShaderParameterType::Enum) - { - if (!defaultValue->isString()) - { - error = "Enum parameter default must be a string for: " + definition.id; - return false; - } - definition.defaultEnumValue = defaultValue->asString(); - return true; - } - - if (definition.type == ShaderParameterType::Text) - { - if (!defaultValue->isString()) - { - error = "Text parameter default must be a string for: " + definition.id; - return false; - } - definition.defaultTextValue = defaultValue->asString(); - return true; - } - - return NumberListFromJsonValue(*defaultValue, definition.defaultNumbers, "default", manifestPath, error); -} - -bool ParseParameterOptions(const JsonValue& parameterJson, ShaderParameterDefinition& definition, const std::filesystem::path& manifestPath, std::string& error) -{ - const JsonValue* optionsValue = nullptr; - if (!OptionalArrayField(parameterJson, "options", optionsValue, manifestPath, error) || !optionsValue) - { - error = "Enum parameter is missing 'options' in: " + ManifestPathMessage(manifestPath); - return false; - } - - for (const JsonValue& optionJson : optionsValue->asArray()) - { - if (!optionJson.isObject()) - { - error = "Enum parameter option must be an object in: " + ManifestPathMessage(manifestPath); - return false; - } - - ShaderParameterOption option; - if (!RequireStringField(optionJson, "value", option.value, manifestPath, error) || - !RequireStringField(optionJson, "label", option.label, manifestPath, error)) - { - error = "Enum parameter option is missing 'value' or 'label' in: " + ManifestPathMessage(manifestPath); - return false; - } - definition.enumOptions.push_back(option); - } - - bool defaultFound = definition.defaultEnumValue.empty(); - for (const ShaderParameterOption& option : definition.enumOptions) - { - if (option.value == definition.defaultEnumValue) - { - defaultFound = true; - break; - } - } - - if (!defaultFound) - { - error = "Enum parameter default is not present in its option list for: " + definition.id; - return false; - } - - return true; -} - -bool ParseParameterDefinition(const JsonValue& parameterJson, ShaderParameterDefinition& definition, const std::filesystem::path& manifestPath, std::string& error) -{ - if (!parameterJson.isObject()) - { - error = "Shader parameter entry must be an object in: " + ManifestPathMessage(manifestPath); - return false; - } - - std::string typeName; - if (!RequireStringField(parameterJson, "id", definition.id, manifestPath, error) || - !RequireStringField(parameterJson, "label", definition.label, manifestPath, error) || - !RequireStringField(parameterJson, "type", typeName, manifestPath, error)) - { - error = "Shader parameter is missing required fields in: " + ManifestPathMessage(manifestPath); - return false; - } - - if (!ParseShaderParameterType(typeName, definition.type)) - { - error = "Unsupported parameter type '" + typeName + "' in: " + ManifestPathMessage(manifestPath); - return false; - } - if (!ValidateShaderIdentifier(definition.id, "parameters[].id", manifestPath, error)) - return false; - - if (!OptionalStringField(parameterJson, "description", definition.description, "", manifestPath, error)) - return false; - - if (!ParseParameterDefault(parameterJson, definition, manifestPath, error) || - !ParseParameterNumberField(parameterJson, "min", definition.minNumbers, manifestPath, error) || - !ParseParameterNumberField(parameterJson, "max", definition.maxNumbers, manifestPath, error) || - !ParseParameterNumberField(parameterJson, "step", definition.stepNumbers, manifestPath, error)) - { - return false; - } - - if (definition.type == ShaderParameterType::Text) - { - if (const JsonValue* fontValue = parameterJson.find("font")) - { - if (!fontValue->isString()) - { - error = "Text parameter 'font' must be a string for: " + definition.id; - return false; - } - definition.fontId = fontValue->asString(); - if (!definition.fontId.empty() && !ValidateShaderIdentifier(definition.fontId, "parameters[].font", manifestPath, error)) - return false; - } - if (const JsonValue* maxLengthValue = parameterJson.find("maxLength")) - { - if (!maxLengthValue->isNumber() || maxLengthValue->asNumber() < 1.0 || maxLengthValue->asNumber() > 256.0) - { - error = "Text parameter 'maxLength' must be a number from 1 to 256 for: " + definition.id; - return false; - } - definition.maxLength = static_cast(maxLengthValue->asNumber()); - } - } - - if (definition.type == ShaderParameterType::Enum) - return ParseParameterOptions(parameterJson, definition, manifestPath, error); - - return true; -} - -bool ParseParameterDefinitions(const JsonValue& manifestJson, ShaderPackage& shaderPackage, const std::filesystem::path& manifestPath, std::string& error) -{ - const JsonValue* parametersValue = nullptr; - if (!OptionalArrayField(manifestJson, "parameters", parametersValue, manifestPath, error)) - return false; - if (!parametersValue) - return true; - - for (const JsonValue& parameterJson : parametersValue->asArray()) - { - ShaderParameterDefinition definition; - if (!ParseParameterDefinition(parameterJson, definition, manifestPath, error)) - return false; - shaderPackage.parameters.push_back(definition); - } - - return true; -} - -std::string UniqueUnavailableShaderId(const std::filesystem::path& manifestPath, const std::string& parsedId) -{ - const std::string fallbackId = manifestPath.parent_path().filename().string(); - const std::string baseId = parsedId.empty() ? fallbackId : parsedId; - return baseId + "@invalid:" + fallbackId; -} - -ShaderPackageStatus BuildUnavailableStatus(const std::filesystem::path& manifestPath, const ShaderPackage& partialPackage, const std::string& packageError) -{ - ShaderPackageStatus status; - status.id = UniqueUnavailableShaderId(manifestPath, partialPackage.id); - status.displayName = !partialPackage.displayName.empty() ? partialPackage.displayName : manifestPath.parent_path().filename().string(); - status.description = partialPackage.description; - status.category = !partialPackage.category.empty() ? partialPackage.category : "Unavailable"; - status.available = false; - status.error = packageError; - return status; -} - -ShaderPackageStatus BuildAvailableStatus(const ShaderPackage& shaderPackage) -{ - ShaderPackageStatus status; - status.id = shaderPackage.id; - status.displayName = shaderPackage.displayName; - status.description = shaderPackage.description; - status.category = shaderPackage.category; - status.available = true; - return status; -} -} - -ShaderPackageRegistry::ShaderPackageRegistry(unsigned maxTemporalHistoryFrames) - : mMaxTemporalHistoryFrames(maxTemporalHistoryFrames) -{ -} - -bool ShaderPackageRegistry::Scan( - const std::filesystem::path& shaderRoot, - std::map& packagesById, - std::vector& packageOrder, - std::vector& packageStatuses, - std::string& error) const -{ - packagesById.clear(); - packageOrder.clear(); - packageStatuses.clear(); - - if (!std::filesystem::exists(shaderRoot)) - { - error = "Shader library directory does not exist: " + shaderRoot.string(); - return false; - } - - for (const auto& entry : std::filesystem::directory_iterator(shaderRoot)) - { - if (!entry.is_directory()) - continue; - - std::filesystem::path manifestPath = entry.path() / "shader.json"; - if (!std::filesystem::exists(manifestPath)) - continue; - - ShaderPackage shaderPackage; - if (!ParseManifest(manifestPath, shaderPackage, error)) - { - packageStatuses.push_back(BuildUnavailableStatus(manifestPath, shaderPackage, error)); - error.clear(); - continue; - } - - if (packagesById.find(shaderPackage.id) != packagesById.end()) - { - packageStatuses.push_back(BuildUnavailableStatus(manifestPath, shaderPackage, "Duplicate shader id found: " + shaderPackage.id)); - continue; - } - - packageOrder.push_back(shaderPackage.id); - packageStatuses.push_back(BuildAvailableStatus(shaderPackage)); - packagesById[shaderPackage.id] = shaderPackage; - } - - std::sort(packageOrder.begin(), packageOrder.end()); - std::sort(packageStatuses.begin(), packageStatuses.end(), [](const ShaderPackageStatus& left, const ShaderPackageStatus& right) { - return left.displayName < right.displayName; - }); - return true; -} - -bool ShaderPackageRegistry::ParseManifest(const std::filesystem::path& manifestPath, ShaderPackage& shaderPackage, std::string& error) const -{ - const std::string manifestText = ReadTextFile(manifestPath, error); - if (manifestText.empty()) - return false; - - JsonValue manifestJson; - if (!ParseJson(manifestText, manifestJson, error)) - return false; - if (!manifestJson.isObject()) - { - error = "Shader manifest root must be an object: " + manifestPath.string(); - return false; - } - - if (!ParseShaderMetadata(manifestJson, shaderPackage, manifestPath, error)) - return false; - - if (!ParsePassDefinitions(manifestJson, shaderPackage, manifestPath, error)) - return false; - - shaderPackage.shaderWriteTime = shaderPackage.passes.front().sourceWriteTime; - for (const ShaderPassDefinition& pass : shaderPackage.passes) - { - if (pass.sourceWriteTime > shaderPackage.shaderWriteTime) - shaderPackage.shaderWriteTime = pass.sourceWriteTime; - } - shaderPackage.manifestWriteTime = std::filesystem::last_write_time(shaderPackage.manifestPath); - - return ParseTextureAssets(manifestJson, shaderPackage, manifestPath, error) && - ParseFontAssets(manifestJson, shaderPackage, manifestPath, error) && - ParseTemporalSettings(manifestJson, shaderPackage, mMaxTemporalHistoryFrames, manifestPath, error) && - ParseFeedbackSettings(manifestJson, shaderPackage, manifestPath, error) && - ParseParameterDefinitions(manifestJson, shaderPackage, manifestPath, error); -} diff --git a/apps/LoopThroughWithOpenGLCompositing/shader/ShaderPackageRegistry.h b/apps/LoopThroughWithOpenGLCompositing/shader/ShaderPackageRegistry.h deleted file mode 100644 index fc6b864..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/shader/ShaderPackageRegistry.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once - -#include "ShaderTypes.h" - -#include -#include -#include -#include - -class ShaderPackageRegistry -{ -public: - explicit ShaderPackageRegistry(unsigned maxTemporalHistoryFrames); - - bool Scan( - const std::filesystem::path& shaderRoot, - std::map& packagesById, - std::vector& packageOrder, - std::vector& packageStatuses, - std::string& error) const; - bool ParseManifest(const std::filesystem::path& manifestPath, ShaderPackage& shaderPackage, std::string& error) const; - -private: - unsigned mMaxTemporalHistoryFrames; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/shader/ShaderTypes.h b/apps/LoopThroughWithOpenGLCompositing/shader/ShaderTypes.h deleted file mode 100644 index f392e3f..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/shader/ShaderTypes.h +++ /dev/null @@ -1,159 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -enum class ShaderParameterType -{ - Float, - Vec2, - Color, - Boolean, - Enum, - Text, - Trigger -}; - -struct ShaderParameterOption -{ - std::string value; - std::string label; -}; - -struct ShaderParameterDefinition -{ - std::string id; - std::string label; - std::string description; - ShaderParameterType type = ShaderParameterType::Float; - std::vector defaultNumbers; - std::vector minNumbers; - std::vector maxNumbers; - std::vector stepNumbers; - bool defaultBoolean = false; - std::string defaultEnumValue; - std::string defaultTextValue; - std::string fontId; - unsigned maxLength = 64; - std::vector enumOptions; -}; - -struct ShaderParameterValue -{ - std::vector numberValues; - bool booleanValue = false; - std::string enumValue; - std::string textValue; -}; - -enum class TemporalHistorySource -{ - None, - Source, - PreLayerInput -}; - -struct TemporalSettings -{ - bool enabled = false; - TemporalHistorySource historySource = TemporalHistorySource::None; - unsigned requestedHistoryLength = 0; - unsigned effectiveHistoryLength = 0; -}; - -struct FeedbackSettings -{ - bool enabled = false; - std::string writePassId; -}; - -struct ShaderTextureAsset -{ - std::string id; - std::filesystem::path path; - std::filesystem::file_time_type writeTime; -}; - -struct ShaderFontAsset -{ - std::string id; - std::filesystem::path path; - std::filesystem::file_time_type writeTime; -}; - -struct ShaderPassDefinition -{ - std::string id; - std::string entryPoint; - std::filesystem::path sourcePath; - std::filesystem::file_time_type sourceWriteTime; - std::vector inputNames; - std::string outputName; -}; - -struct ShaderPassBuildSource -{ - std::string passId; - std::string fragmentShaderSource; - std::vector inputNames; - std::string outputName; -}; - -struct ShaderPackage -{ - std::string id; - std::string displayName; - std::string description; - std::string category; - std::string entryPoint; - std::filesystem::path directoryPath; - std::filesystem::path shaderPath; - std::filesystem::path manifestPath; - std::vector passes; - std::vector parameters; - std::vector textureAssets; - std::vector fontAssets; - TemporalSettings temporal; - FeedbackSettings feedback; - std::filesystem::file_time_type shaderWriteTime; - std::filesystem::file_time_type manifestWriteTime; -}; - -struct ShaderPackageStatus -{ - std::string id; - std::string displayName; - std::string description; - std::string category; - bool available = false; - std::string error; -}; - -struct RuntimeRenderState -{ - std::string layerId; - std::string shaderId; - std::string shaderName; - std::vector parameterDefinitions; - std::map parameterValues; - std::vector textureAssets; - std::vector fontAssets; - double timeSeconds = 0.0; - double utcTimeSeconds = 0.0; - double utcOffsetSeconds = 0.0; - double startupRandom = 0.0; - double frameCount = 0.0; - double mixAmount = 1.0; - double bypass = 0.0; - unsigned inputWidth = 0; - unsigned inputHeight = 0; - unsigned outputWidth = 0; - unsigned outputHeight = 0; - bool isTemporal = false; - TemporalHistorySource temporalHistorySource = TemporalHistorySource::None; - unsigned requestedTemporalHistoryLength = 0; - unsigned effectiveTemporalHistoryLength = 0; - FeedbackSettings feedback; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/small.ico b/apps/LoopThroughWithOpenGLCompositing/small.ico deleted file mode 100644 index d551aa3..0000000 Binary files a/apps/LoopThroughWithOpenGLCompositing/small.ico and /dev/null differ diff --git a/apps/LoopThroughWithOpenGLCompositing/stdafx.cpp b/apps/LoopThroughWithOpenGLCompositing/stdafx.cpp deleted file mode 100644 index 463afa8..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/stdafx.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* -LICENSE-START- - ** Copyright (c) 2012 Blackmagic Design - ** - ** Permission is hereby granted, free of charge, to any person or organization - ** obtaining a copy of the software and accompanying documentation (the - ** "Software") to use, reproduce, display, distribute, sub-license, 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, in - ** accordance with: - ** - ** (1) if the Software is obtained from Blackmagic Design, the End User License - ** Agreement for the Software Development Kit ("EULA") available at - ** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or - ** - ** (2) if the Software is obtained from any third party, such licensing terms - ** as notified by that third party, - ** - ** and all subject to the following: - ** - ** (3) 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. - ** - ** (4) 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. - ** - ** A copy of the Software is available free of charge at - ** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. - ** - ** -LICENSE-END- - */ -// -// stdafx.cpp : source file that includes just the standard includes -// LoopThroughWithOpenGLCompositing.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - diff --git a/apps/LoopThroughWithOpenGLCompositing/stdafx.h b/apps/LoopThroughWithOpenGLCompositing/stdafx.h deleted file mode 100644 index bc9dfea..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/stdafx.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -LICENSE-START- - ** Copyright (c) 2012 Blackmagic Design - ** - ** Permission is hereby granted, free of charge, to any person or organization - ** obtaining a copy of the software and accompanying documentation (the - ** "Software") to use, reproduce, display, distribute, sub-license, 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, in - ** accordance with: - ** - ** (1) if the Software is obtained from Blackmagic Design, the End User License - ** Agreement for the Software Development Kit ("EULA") available at - ** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or - ** - ** (2) if the Software is obtained from any third party, such licensing terms - ** as notified by that third party, - ** - ** and all subject to the following: - ** - ** (3) 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. - ** - ** (4) 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. - ** - ** A copy of the Software is available free of charge at - ** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. - ** - ** -LICENSE-END- - */ -// -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#pragma once - -#include "targetver.h" - -#ifndef NOMINMAX -#define NOMINMAX -#endif - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -// Windows Header Files: -#include -#include -#include - -// C RunTime Header Files -#include -#include -#include -#include - diff --git a/apps/LoopThroughWithOpenGLCompositing/targetver.h b/apps/LoopThroughWithOpenGLCompositing/targetver.h deleted file mode 100644 index ae55070..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/targetver.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -LICENSE-START- - ** Copyright (c) 2012 Blackmagic Design - ** - ** Permission is hereby granted, free of charge, to any person or organization - ** obtaining a copy of the software and accompanying documentation (the - ** "Software") to use, reproduce, display, distribute, sub-license, 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, in - ** accordance with: - ** - ** (1) if the Software is obtained from Blackmagic Design, the End User License - ** Agreement for the Software Development Kit ("EULA") available at - ** https://www.blackmagicdesign.com/EULA/DeckLinkSDK; or - ** - ** (2) if the Software is obtained from any third party, such licensing terms - ** as notified by that third party, - ** - ** and all subject to the following: - ** - ** (3) 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. - ** - ** (4) 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. - ** - ** A copy of the Software is available free of charge at - ** https://www.blackmagicdesign.com/desktopvideo_sdk under the EULA. - ** - ** -LICENSE-END- - */ -// -#pragma once - -// The following macros define the minimum required platform. The minimum required platform -// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run -// your application. The macros work by enabling all features available on platform versions up to and -// including the version specified. - -// Modify the following defines if you have to target a platform prior to the ones specified below. -// Refer to MSDN for the latest info on corresponding values for different platforms. -#ifndef WINVER // Specifies that the minimum required platform is Windows Vista. -#define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista. -#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98. -#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. -#endif - -#ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0. -#define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE. -#endif diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/OutputProductionController.cpp b/apps/LoopThroughWithOpenGLCompositing/videoio/OutputProductionController.cpp deleted file mode 100644 index 64e4148..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/OutputProductionController.cpp +++ /dev/null @@ -1,89 +0,0 @@ -#include "OutputProductionController.h" - -#include - -namespace -{ -std::size_t ClampReadyLimit(unsigned value, std::size_t capacity) -{ - const std::size_t requested = static_cast(value); - if (capacity == 0) - return requested; - return (std::min)(requested, capacity); -} -} - -OutputProductionController::OutputProductionController(const VideoPlayoutPolicy& policy) : - mPolicy(NormalizeVideoPlayoutPolicy(policy)) -{ -} - -void OutputProductionController::Configure(const VideoPlayoutPolicy& policy) -{ - mPolicy = NormalizeVideoPlayoutPolicy(policy); -} - -OutputProductionDecision OutputProductionController::Decide(const OutputProductionPressure& pressure) const -{ - OutputProductionDecision decision; - - const std::size_t configuredMaxReadyFrames = static_cast(mPolicy.maxReadyFrames); - const std::size_t effectiveMaxReadyFrames = pressure.readyQueueCapacity > 0 - ? (std::min)(configuredMaxReadyFrames, pressure.readyQueueCapacity) - : configuredMaxReadyFrames; - const std::size_t effectiveTargetReadyFrames = (std::min)( - ClampReadyLimit(mPolicy.targetReadyFrames, pressure.readyQueueCapacity), - effectiveMaxReadyFrames); - - decision.targetReadyFrames = effectiveTargetReadyFrames; - decision.maxReadyFrames = effectiveMaxReadyFrames; - - if (effectiveMaxReadyFrames == 0) - { - decision.action = OutputProductionAction::Throttle; - decision.reason = "no-ready-frame-capacity"; - return decision; - } - - if (pressure.readyQueueDepth >= effectiveMaxReadyFrames) - { - decision.action = OutputProductionAction::Throttle; - decision.reason = "ready-queue-full"; - return decision; - } - - if (pressure.readyQueueDepth < effectiveTargetReadyFrames) - { - decision.action = OutputProductionAction::Produce; - decision.requestedFrames = effectiveTargetReadyFrames - pressure.readyQueueDepth; - decision.reason = "ready-queue-below-target"; - return decision; - } - - if ((pressure.lateStreak > 0 || pressure.dropStreak > 0 || pressure.readyQueueUnderrunCount > 0) && - pressure.readyQueueDepth < effectiveMaxReadyFrames) - { - decision.action = OutputProductionAction::Produce; - decision.requestedFrames = 1; - decision.reason = "playout-pressure"; - return decision; - } - - decision.action = OutputProductionAction::Wait; - decision.reason = "ready-queue-at-target"; - return decision; -} - -const char* OutputProductionActionName(OutputProductionAction action) -{ - switch (action) - { - case OutputProductionAction::Produce: - return "Produce"; - case OutputProductionAction::Throttle: - return "Throttle"; - case OutputProductionAction::Wait: - default: - return "Wait"; - } -} diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/OutputProductionController.h b/apps/LoopThroughWithOpenGLCompositing/videoio/OutputProductionController.h deleted file mode 100644 index 13a016c..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/OutputProductionController.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once - -#include "VideoPlayoutPolicy.h" - -#include -#include -#include - -enum class OutputProductionAction -{ - Produce, - Wait, - Throttle -}; - -struct OutputProductionPressure -{ - std::size_t readyQueueDepth = 0; - std::size_t readyQueueCapacity = 0; - uint64_t readyQueueUnderrunCount = 0; - uint64_t lateStreak = 0; - uint64_t dropStreak = 0; -}; - -struct OutputProductionDecision -{ - OutputProductionAction action = OutputProductionAction::Wait; - std::size_t requestedFrames = 0; - std::size_t targetReadyFrames = 0; - std::size_t maxReadyFrames = 0; - std::string reason; -}; - -class OutputProductionController -{ -public: - explicit OutputProductionController(const VideoPlayoutPolicy& policy = VideoPlayoutPolicy()); - - void Configure(const VideoPlayoutPolicy& policy); - OutputProductionDecision Decide(const OutputProductionPressure& pressure) const; - -private: - VideoPlayoutPolicy mPolicy; -}; - -const char* OutputProductionActionName(OutputProductionAction action); diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/RenderCadenceController.cpp b/apps/LoopThroughWithOpenGLCompositing/videoio/RenderCadenceController.cpp deleted file mode 100644 index 7981a36..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/RenderCadenceController.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include "RenderCadenceController.h" - -#include -#include - -void RenderCadenceController::Configure(Duration targetFrameDuration, TimePoint firstRenderTime, const RenderCadencePolicy& policy) -{ - mTargetFrameDuration = IsPositive(targetFrameDuration) ? targetFrameDuration : std::chrono::milliseconds(1); - mPolicy = policy; - if (mPolicy.skipThresholdFrames < 1.0) - mPolicy.skipThresholdFrames = 1.0; - Reset(firstRenderTime); -} - -void RenderCadenceController::Reset(TimePoint firstRenderTime) -{ - mNextRenderTime = firstRenderTime; - mNextFrameIndex = 0; - mMetrics = RenderCadenceMetrics(); -} - -RenderCadenceDecision RenderCadenceController::Tick(TimePoint now) -{ - RenderCadenceDecision decision; - decision.frameIndex = mNextFrameIndex; - decision.renderTargetTime = mNextRenderTime; - decision.nextRenderTime = mNextRenderTime; - - if (now < mNextRenderTime) - { - decision.action = RenderCadenceAction::Wait; - decision.waitDuration = mNextRenderTime - now; - decision.reason = "waiting-for-next-render-tick"; - return decision; - } - - const Duration lateness = now - mNextRenderTime; - const uint64_t skippedTicks = SkippedTicksForLateness(lateness); - if (skippedTicks > 0) - { - decision.skippedTicks = skippedTicks; - decision.frameIndex = mNextFrameIndex + skippedTicks; - decision.renderTargetTime = mNextRenderTime + (mTargetFrameDuration * skippedTicks); - decision.reason = "late-skip-render-ticks"; - mMetrics.skippedTickCount += skippedTicks; - } - else - { - decision.reason = IsPositive(lateness) ? "late-render-now" : "on-time-render"; - } - - decision.action = RenderCadenceAction::Render; - decision.lateness = now > decision.renderTargetTime - ? now - decision.renderTargetTime - : Duration::zero(); - mNextFrameIndex = decision.frameIndex + 1; - mNextRenderTime = decision.renderTargetTime + mTargetFrameDuration; - decision.nextRenderTime = mNextRenderTime; - - ++mMetrics.renderedFrameCount; - mMetrics.nextFrameIndex = mNextFrameIndex; - mMetrics.lastLateness = decision.lateness; - if (IsPositive(decision.lateness)) - { - ++mMetrics.lateFrameCount; - mMetrics.maxLateness = (std::max)(mMetrics.maxLateness, decision.lateness); - } - - return decision; -} - -uint64_t RenderCadenceController::SkippedTicksForLateness(Duration lateness) const -{ - if (!mPolicy.skipLateTicks || !IsPositive(lateness) || !IsPositive(mTargetFrameDuration)) - return 0; - - const double lateFrames = static_cast(lateness.count()) / static_cast(mTargetFrameDuration.count()); - if (lateFrames < mPolicy.skipThresholdFrames) - return 0; - - const uint64_t elapsedTicks = static_cast(std::floor(lateFrames)); - if (elapsedTicks == 0) - return 0; - return (std::min)(elapsedTicks, mPolicy.maxSkippedTicksPerDecision); -} - -bool RenderCadenceController::IsPositive(Duration duration) -{ - return duration > Duration::zero(); -} - -const char* RenderCadenceActionName(RenderCadenceAction action) -{ - switch (action) - { - case RenderCadenceAction::Render: - return "Render"; - case RenderCadenceAction::Wait: - default: - return "Wait"; - } -} diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/RenderCadenceController.h b/apps/LoopThroughWithOpenGLCompositing/videoio/RenderCadenceController.h deleted file mode 100644 index 8eba0ef..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/RenderCadenceController.h +++ /dev/null @@ -1,68 +0,0 @@ -#pragma once - -#include -#include - -enum class RenderCadenceAction -{ - Wait, - Render -}; - -struct RenderCadencePolicy -{ - bool skipLateTicks = true; - uint64_t maxSkippedTicksPerDecision = 4; - double skipThresholdFrames = 2.0; -}; - -struct RenderCadenceDecision -{ - RenderCadenceAction action = RenderCadenceAction::Wait; - uint64_t frameIndex = 0; - uint64_t skippedTicks = 0; - std::chrono::steady_clock::time_point renderTargetTime; - std::chrono::steady_clock::time_point nextRenderTime; - std::chrono::steady_clock::duration waitDuration = std::chrono::steady_clock::duration::zero(); - std::chrono::steady_clock::duration lateness = std::chrono::steady_clock::duration::zero(); - const char* reason = "waiting-for-next-render-tick"; -}; - -struct RenderCadenceMetrics -{ - uint64_t nextFrameIndex = 0; - uint64_t renderedFrameCount = 0; - uint64_t skippedTickCount = 0; - uint64_t lateFrameCount = 0; - std::chrono::steady_clock::duration lastLateness = std::chrono::steady_clock::duration::zero(); - std::chrono::steady_clock::duration maxLateness = std::chrono::steady_clock::duration::zero(); -}; - -class RenderCadenceController -{ -public: - using Clock = std::chrono::steady_clock; - using TimePoint = Clock::time_point; - using Duration = Clock::duration; - - void Configure(Duration targetFrameDuration, TimePoint firstRenderTime, const RenderCadencePolicy& policy = RenderCadencePolicy()); - void Reset(TimePoint firstRenderTime); - RenderCadenceDecision Tick(TimePoint now); - - Duration TargetFrameDuration() const { return mTargetFrameDuration; } - TimePoint NextRenderTime() const { return mNextRenderTime; } - uint64_t NextFrameIndex() const { return mNextFrameIndex; } - const RenderCadenceMetrics& Metrics() const { return mMetrics; } - -private: - uint64_t SkippedTicksForLateness(Duration lateness) const; - static bool IsPositive(Duration duration); - - Duration mTargetFrameDuration = std::chrono::milliseconds(16); - TimePoint mNextRenderTime; - uint64_t mNextFrameIndex = 0; - RenderCadencePolicy mPolicy; - RenderCadenceMetrics mMetrics; -}; - -const char* RenderCadenceActionName(RenderCadenceAction action); diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/RenderOutputQueue.cpp b/apps/LoopThroughWithOpenGLCompositing/videoio/RenderOutputQueue.cpp deleted file mode 100644 index c68660b..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/RenderOutputQueue.cpp +++ /dev/null @@ -1,93 +0,0 @@ -#include "RenderOutputQueue.h" - -RenderOutputQueue::RenderOutputQueue(const VideoPlayoutPolicy& policy) : - mPolicy(NormalizeVideoPlayoutPolicy(policy)) -{ -} - -void RenderOutputQueue::Configure(const VideoPlayoutPolicy& policy) -{ - std::lock_guard lock(mMutex); - mPolicy = NormalizeVideoPlayoutPolicy(policy); - while (mReadyFrames.size() > CapacityLocked()) - { - ReleaseFrame(mReadyFrames.front()); - mReadyFrames.pop_front(); - ++mDroppedCount; - } -} - -bool RenderOutputQueue::Push(RenderOutputFrame frame) -{ - std::lock_guard lock(mMutex); - if (mReadyFrames.size() >= CapacityLocked()) - { - ReleaseFrame(mReadyFrames.front()); - mReadyFrames.pop_front(); - ++mDroppedCount; - } - - mReadyFrames.push_back(frame); - ++mPushedCount; - return true; -} - -bool RenderOutputQueue::TryPop(RenderOutputFrame& frame) -{ - std::lock_guard lock(mMutex); - if (mReadyFrames.empty()) - { - ++mUnderrunCount; - return false; - } - - frame = mReadyFrames.front(); - mReadyFrames.pop_front(); - ++mPoppedCount; - return true; -} - -bool RenderOutputQueue::DropOldestFrame() -{ - std::lock_guard lock(mMutex); - if (mReadyFrames.empty()) - return false; - - ReleaseFrame(mReadyFrames.front()); - mReadyFrames.pop_front(); - ++mDroppedCount; - return true; -} - -void RenderOutputQueue::Clear() -{ - std::lock_guard lock(mMutex); - for (RenderOutputFrame& frame : mReadyFrames) - ReleaseFrame(frame); - mReadyFrames.clear(); -} - -RenderOutputQueueMetrics RenderOutputQueue::GetMetrics() const -{ - std::lock_guard lock(mMutex); - RenderOutputQueueMetrics metrics; - metrics.depth = mReadyFrames.size(); - metrics.capacity = CapacityLocked(); - metrics.pushedCount = mPushedCount; - metrics.poppedCount = mPoppedCount; - metrics.droppedCount = mDroppedCount; - metrics.underrunCount = mUnderrunCount; - return metrics; -} - -std::size_t RenderOutputQueue::CapacityLocked() const -{ - return static_cast(mPolicy.maxReadyFrames); -} - -void RenderOutputQueue::ReleaseFrame(RenderOutputFrame& frame) -{ - if (frame.releaseFrame) - frame.releaseFrame(frame.frame); - frame.releaseFrame = {}; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/RenderOutputQueue.h b/apps/LoopThroughWithOpenGLCompositing/videoio/RenderOutputQueue.h deleted file mode 100644 index 0a9109a..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/RenderOutputQueue.h +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once - -#include "VideoIOTypes.h" -#include "VideoPlayoutPolicy.h" - -#include -#include -#include -#include - -struct RenderOutputFrame -{ - VideoIOOutputFrame frame; - uint64_t frameIndex = 0; - bool stale = false; - std::function releaseFrame; -}; - -struct RenderOutputQueueMetrics -{ - std::size_t depth = 0; - std::size_t capacity = 0; - uint64_t pushedCount = 0; - uint64_t poppedCount = 0; - uint64_t droppedCount = 0; - uint64_t underrunCount = 0; -}; - -class RenderOutputQueue -{ -public: - explicit RenderOutputQueue(const VideoPlayoutPolicy& policy = VideoPlayoutPolicy()); - - void Configure(const VideoPlayoutPolicy& policy); - bool Push(RenderOutputFrame frame); - bool TryPop(RenderOutputFrame& frame); - bool DropOldestFrame(); - void Clear(); - RenderOutputQueueMetrics GetMetrics() const; - -private: - std::size_t CapacityLocked() const; - static void ReleaseFrame(RenderOutputFrame& frame); - - mutable std::mutex mMutex; - VideoPlayoutPolicy mPolicy; - std::deque mReadyFrames; - uint64_t mPushedCount = 0; - uint64_t mPoppedCount = 0; - uint64_t mDroppedCount = 0; - uint64_t mUnderrunCount = 0; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/SystemOutputFramePool.cpp b/apps/LoopThroughWithOpenGLCompositing/videoio/SystemOutputFramePool.cpp deleted file mode 100644 index 8318d28..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/SystemOutputFramePool.cpp +++ /dev/null @@ -1,260 +0,0 @@ -#include "SystemOutputFramePool.h" - -#include - -namespace -{ -SystemOutputFramePoolConfig NormalizeConfig(SystemOutputFramePoolConfig config) -{ - if (config.rowBytes == 0) - config.rowBytes = VideoIORowBytes(config.pixelFormat, config.width); - return config; -} -} - -SystemOutputFramePool::SystemOutputFramePool(const SystemOutputFramePoolConfig& config) -{ - Configure(config); -} - -void SystemOutputFramePool::Configure(const SystemOutputFramePoolConfig& config) -{ - std::lock_guard lock(mMutex); - mConfig = NormalizeConfig(config); - mReadySlots.clear(); - mSlots.clear(); - mSlots.resize(mConfig.capacity); - - const std::size_t byteCount = FrameByteCount(); - for (StoredSlot& slot : mSlots) - { - slot.bytes.resize(byteCount); - slot.state = OutputFrameSlotState::Free; - ++slot.generation; - } - - mAcquireMissCount = 0; - mReadyUnderrunCount = 0; -} - -SystemOutputFramePoolConfig SystemOutputFramePool::Config() const -{ - std::lock_guard lock(mMutex); - return mConfig; -} - -bool SystemOutputFramePool::AcquireFreeSlot(OutputFrameSlot& slot) -{ - std::lock_guard lock(mMutex); - for (std::size_t index = 0; index < mSlots.size(); ++index) - { - if (mSlots[index].state != OutputFrameSlotState::Free) - continue; - - mSlots[index].state = OutputFrameSlotState::Rendering; - ++mSlots[index].generation; - FillOutputSlotLocked(index, slot); - return true; - } - - slot = OutputFrameSlot(); - ++mAcquireMissCount; - return false; -} - -bool SystemOutputFramePool::AcquireRenderingSlot(OutputFrameSlot& slot) -{ - return AcquireFreeSlot(slot); -} - -bool SystemOutputFramePool::PublishReadySlot(const OutputFrameSlot& slot) -{ - std::lock_guard lock(mMutex); - if (!TransitionSlotLocked(slot, OutputFrameSlotState::Rendering, OutputFrameSlotState::Completed)) - return false; - - mReadySlots.push_back(slot.index); - return true; -} - -bool SystemOutputFramePool::PublishCompletedSlot(const OutputFrameSlot& slot) -{ - return PublishReadySlot(slot); -} - -bool SystemOutputFramePool::ConsumeReadySlot(OutputFrameSlot& slot) -{ - std::lock_guard lock(mMutex); - while (!mReadySlots.empty()) - { - const std::size_t index = mReadySlots.front(); - mReadySlots.pop_front(); - if (index >= mSlots.size() || mSlots[index].state != OutputFrameSlotState::Completed) - continue; - - FillOutputSlotLocked(index, slot); - return true; - } - - slot = OutputFrameSlot(); - ++mReadyUnderrunCount; - return false; -} - -bool SystemOutputFramePool::ConsumeCompletedSlot(OutputFrameSlot& slot) -{ - return ConsumeReadySlot(slot); -} - -bool SystemOutputFramePool::MarkScheduled(const OutputFrameSlot& slot) -{ - std::lock_guard lock(mMutex); - if (!IsValidSlotLocked(slot)) - return false; - if (mSlots[slot.index].state != OutputFrameSlotState::Completed) - return false; - - RemoveReadyIndexLocked(slot.index); - mSlots[slot.index].state = OutputFrameSlotState::Scheduled; - return true; -} - -bool SystemOutputFramePool::MarkScheduledByBuffer(void* bytes) -{ - if (bytes == nullptr) - return false; - - std::lock_guard lock(mMutex); - for (std::size_t index = 0; index < mSlots.size(); ++index) - { - if (mSlots[index].bytes.empty() || mSlots[index].bytes.data() != bytes) - continue; - if (mSlots[index].state != OutputFrameSlotState::Completed) - return false; - - RemoveReadyIndexLocked(index); - mSlots[index].state = OutputFrameSlotState::Scheduled; - return true; - } - return false; -} - -bool SystemOutputFramePool::ReleaseSlot(const OutputFrameSlot& slot) -{ - std::lock_guard lock(mMutex); - if (!IsValidSlotLocked(slot) || mSlots[slot.index].state == OutputFrameSlotState::Free) - return false; - - return ReleaseSlotByIndexLocked(slot.index); -} - -bool SystemOutputFramePool::ReleaseScheduledSlot(const OutputFrameSlot& slot) -{ - std::lock_guard lock(mMutex); - return TransitionSlotLocked(slot, OutputFrameSlotState::Scheduled, OutputFrameSlotState::Free); -} - -bool SystemOutputFramePool::ReleaseSlotByBuffer(void* bytes) -{ - if (bytes == nullptr) - return false; - - std::lock_guard lock(mMutex); - for (std::size_t index = 0; index < mSlots.size(); ++index) - { - if (!mSlots[index].bytes.empty() && mSlots[index].bytes.data() == bytes) - return ReleaseSlotByIndexLocked(index); - } - return false; -} - -void SystemOutputFramePool::Clear() -{ - std::lock_guard lock(mMutex); - mReadySlots.clear(); - for (StoredSlot& slot : mSlots) - { - slot.state = OutputFrameSlotState::Free; - ++slot.generation; - } -} - -SystemOutputFramePoolMetrics SystemOutputFramePool::GetMetrics() const -{ - std::lock_guard lock(mMutex); - SystemOutputFramePoolMetrics metrics; - metrics.capacity = mSlots.size(); - metrics.readyCount = mReadySlots.size(); - metrics.acquireMissCount = mAcquireMissCount; - metrics.readyUnderrunCount = mReadyUnderrunCount; - - for (const StoredSlot& slot : mSlots) - { - switch (slot.state) - { - case OutputFrameSlotState::Free: - ++metrics.freeCount; - break; - case OutputFrameSlotState::Rendering: - ++metrics.renderingCount; - ++metrics.acquiredCount; - break; - case OutputFrameSlotState::Completed: - ++metrics.completedCount; - break; - case OutputFrameSlotState::Scheduled: - ++metrics.scheduledCount; - break; - } - } - - return metrics; -} - -bool SystemOutputFramePool::IsValidSlotLocked(const OutputFrameSlot& slot) const -{ - return slot.index < mSlots.size() && mSlots[slot.index].generation == slot.generation; -} - -bool SystemOutputFramePool::TransitionSlotLocked(const OutputFrameSlot& slot, OutputFrameSlotState expectedState, OutputFrameSlotState nextState) -{ - if (!IsValidSlotLocked(slot) || mSlots[slot.index].state != expectedState) - return false; - - mSlots[slot.index].state = nextState; - return true; -} - -void SystemOutputFramePool::FillOutputSlotLocked(std::size_t index, OutputFrameSlot& slot) -{ - StoredSlot& storedSlot = mSlots[index]; - slot.index = index; - slot.generation = storedSlot.generation; - slot.frame.bytes = storedSlot.bytes.empty() ? nullptr : storedSlot.bytes.data(); - slot.frame.rowBytes = static_cast(mConfig.rowBytes); - slot.frame.width = mConfig.width; - slot.frame.height = mConfig.height; - slot.frame.pixelFormat = mConfig.pixelFormat; - slot.frame.nativeFrame = nullptr; - slot.frame.nativeBuffer = slot.frame.bytes; -} - -void SystemOutputFramePool::RemoveReadyIndexLocked(std::size_t index) -{ - mReadySlots.erase(std::remove(mReadySlots.begin(), mReadySlots.end(), index), mReadySlots.end()); -} - -bool SystemOutputFramePool::ReleaseSlotByIndexLocked(std::size_t index) -{ - if (index >= mSlots.size() || mSlots[index].state == OutputFrameSlotState::Free) - return false; - - RemoveReadyIndexLocked(index); - mSlots[index].state = OutputFrameSlotState::Free; - return true; -} - -std::size_t SystemOutputFramePool::FrameByteCount() const -{ - return static_cast(mConfig.rowBytes) * static_cast(mConfig.height); -} diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/SystemOutputFramePool.h b/apps/LoopThroughWithOpenGLCompositing/videoio/SystemOutputFramePool.h deleted file mode 100644 index f0ec666..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/SystemOutputFramePool.h +++ /dev/null @@ -1,94 +0,0 @@ -#pragma once - -#include "VideoIOTypes.h" - -#include -#include -#include -#include -#include - -enum class OutputFrameSlotState -{ - Free, - Rendering, - Completed, - Scheduled -}; - -struct SystemOutputFramePoolConfig -{ - unsigned width = 0; - unsigned height = 0; - VideoIOPixelFormat pixelFormat = VideoIOPixelFormat::Bgra8; - unsigned rowBytes = 0; - std::size_t capacity = 0; -}; - -struct OutputFrameSlot -{ - VideoIOOutputFrame frame; - std::size_t index = 0; - uint64_t generation = 0; -}; - -struct SystemOutputFramePoolMetrics -{ - std::size_t capacity = 0; - std::size_t freeCount = 0; - std::size_t renderingCount = 0; - std::size_t completedCount = 0; - std::size_t scheduledCount = 0; - std::size_t acquiredCount = 0; - std::size_t readyCount = 0; - std::size_t consumedCount = 0; - uint64_t acquireMissCount = 0; - uint64_t readyUnderrunCount = 0; -}; - -class SystemOutputFramePool -{ -public: - SystemOutputFramePool() = default; - explicit SystemOutputFramePool(const SystemOutputFramePoolConfig& config); - - void Configure(const SystemOutputFramePoolConfig& config); - SystemOutputFramePoolConfig Config() const; - - bool AcquireFreeSlot(OutputFrameSlot& slot); - bool AcquireRenderingSlot(OutputFrameSlot& slot); - bool PublishReadySlot(const OutputFrameSlot& slot); - bool PublishCompletedSlot(const OutputFrameSlot& slot); - bool ConsumeReadySlot(OutputFrameSlot& slot); - bool ConsumeCompletedSlot(OutputFrameSlot& slot); - bool MarkScheduled(const OutputFrameSlot& slot); - bool MarkScheduledByBuffer(void* bytes); - bool ReleaseSlot(const OutputFrameSlot& slot); - bool ReleaseScheduledSlot(const OutputFrameSlot& slot); - bool ReleaseSlotByBuffer(void* bytes); - void Clear(); - - SystemOutputFramePoolMetrics GetMetrics() const; - -private: - struct StoredSlot - { - std::vector bytes; - OutputFrameSlotState state = OutputFrameSlotState::Free; - uint64_t generation = 1; - }; - - bool IsValidSlotLocked(const OutputFrameSlot& slot) const; - bool TransitionSlotLocked(const OutputFrameSlot& slot, OutputFrameSlotState expectedState, OutputFrameSlotState nextState); - void FillOutputSlotLocked(std::size_t index, OutputFrameSlot& slot); - void RemoveReadyIndexLocked(std::size_t index); - bool ReleaseSlotByIndexLocked(std::size_t index); - std::size_t FrameByteCount() const; - - mutable std::mutex mMutex; - SystemOutputFramePoolConfig mConfig; - std::vector mSlots; - std::deque mReadySlots; - uint64_t mAcquireMissCount = 0; - uint64_t mReadyUnderrunCount = 0; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/VideoBackend.cpp b/apps/LoopThroughWithOpenGLCompositing/videoio/VideoBackend.cpp deleted file mode 100644 index af03541..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/VideoBackend.cpp +++ /dev/null @@ -1,1095 +0,0 @@ -#include "VideoBackend.h" - -#include "DeckLinkSession.h" -#include "OpenGLVideoIOBridge.h" -#include "HealthTelemetry.h" -#include "RenderEngine.h" -#include "RuntimeEventDispatcher.h" - -#include -#include -#include -#include -#include -#include - -VideoBackend::VideoBackend(RenderEngine& renderEngine, HealthTelemetry& healthTelemetry, RuntimeEventDispatcher& runtimeEventDispatcher) : - mHealthTelemetry(healthTelemetry), - mRuntimeEventDispatcher(runtimeEventDispatcher), - mPlayoutPolicy(NormalizeVideoPlayoutPolicy(VideoPlayoutPolicy())), - mOutputProductionController(mPlayoutPolicy), - mReadyOutputQueue(mPlayoutPolicy), - mVideoIODevice(std::make_unique()), - mBridge(std::make_unique(renderEngine)), - mInputCaptureDisabled(IsEnvironmentFlagEnabled("VST_DISABLE_INPUT_CAPTURE")) -{ -} - -VideoBackend::~VideoBackend() -{ - ReleaseResources(); -} - -void VideoBackend::ReleaseResources() -{ - StopOutputCompletionWorker(); - mReadyOutputQueue.Clear(); - if (mVideoIODevice) - mVideoIODevice->ReleaseResources(); - mSystemOutputFramePool.Clear(); - if (!VideoBackendLifecycle::CanTransition(mLifecycle.State(), VideoBackendLifecycleState::Stopped)) - ApplyLifecycleFailure("Video backend resources released before lifecycle completed."); - ApplyLifecycleTransition(VideoBackendLifecycleState::Stopped, "Video backend resources released."); -} - -VideoBackendLifecycleState VideoBackend::LifecycleState() const -{ - return mLifecycle.State(); -} - -bool VideoBackend::DiscoverDevicesAndModes(const VideoFormatSelection& videoModes, std::string& error) -{ - ApplyLifecycleTransition(VideoBackendLifecycleState::Discovering, "Discovering video backend devices and modes."); - if (mVideoIODevice->DiscoverDevicesAndModes(videoModes, error)) - return ApplyLifecycleTransition(VideoBackendLifecycleState::Discovered, "Video backend devices and modes discovered."); - - ApplyLifecycleFailure(error.empty() ? "Video backend discovery failed." : error); - return false; -} - -bool VideoBackend::SelectPreferredFormats(const VideoFormatSelection& videoModes, bool outputAlphaRequired, std::string& error) -{ - ApplyLifecycleTransition(VideoBackendLifecycleState::Configuring, "Selecting preferred video backend formats."); - if (mVideoIODevice->SelectPreferredFormats(videoModes, outputAlphaRequired, error)) - return true; - - ApplyLifecycleFailure(error.empty() ? "Video backend format selection failed." : error); - return false; -} - -bool VideoBackend::ConfigureInput(const VideoFormat& inputVideoMode, std::string& error) -{ - if (mLifecycle.State() != VideoBackendLifecycleState::Configuring) - ApplyLifecycleTransition(VideoBackendLifecycleState::Configuring, "Configuring video backend input."); - if (mInputCaptureDisabled) - { - MutableState().hasInputSource = false; - MutableState().statusMessage = "DeckLink input capture disabled by VST_DISABLE_INPUT_CAPTURE for output timing isolation."; - return true; - } - if (!mVideoIODevice->ConfigureInput( - [this](const VideoIOFrame& frame) { HandleInputFrame(frame); }, - inputVideoMode, - error)) - { - ApplyLifecycleFailure(error.empty() ? "Video backend input configuration failed." : error); - return false; - } - return true; -} - -bool VideoBackend::ConfigureOutput(const VideoFormat& outputVideoMode, bool externalKeyingEnabled, std::string& error) -{ - mPlayoutPolicy = NormalizeVideoPlayoutPolicy(mPlayoutPolicy); - mOutputProductionController.Configure(mPlayoutPolicy); - mReadyOutputQueue.Configure(mPlayoutPolicy); - if (mLifecycle.State() != VideoBackendLifecycleState::Configuring) - ApplyLifecycleTransition(VideoBackendLifecycleState::Configuring, "Configuring video backend output."); - if (!mVideoIODevice->ConfigureOutput( - [this](const VideoIOCompletion& completion) { HandleOutputFrameCompletion(completion); }, - outputVideoMode, - externalKeyingEnabled, - error)) - { - ApplyLifecycleFailure(error.empty() ? "Video backend output configuration failed." : error); - return false; - } - SystemOutputFramePoolConfig poolConfig; - poolConfig.width = mVideoIODevice->OutputFrameWidth(); - poolConfig.height = mVideoIODevice->OutputFrameHeight(); - poolConfig.pixelFormat = mVideoIODevice->OutputPixelFormat(); - poolConfig.rowBytes = mVideoIODevice->OutputFrameRowBytes(); - poolConfig.capacity = mPlayoutPolicy.outputFramePoolSize; - mSystemOutputFramePool.Configure(poolConfig); - RecordSystemMemoryPlayoutStats(); - return ApplyLifecycleTransition(VideoBackendLifecycleState::Configured, "Video backend configured."); -} - -bool VideoBackend::Start() -{ - ApplyLifecycleTransition(VideoBackendLifecycleState::Prerolling, "Video backend preroll starting."); - if (!mVideoIODevice->PrepareOutputSchedule()) - { - ApplyLifecycleFailure(StatusMessage().empty() ? "Video backend output schedule preparation failed." : StatusMessage()); - return false; - } - - StartOutputCompletionWorker(); - StartOutputProducerWorker(); - - if (!WarmupOutputPreroll()) - { - StopOutputProducerWorker(); - StopOutputCompletionWorker(); - ApplyLifecycleFailure(StatusMessage().empty() ? "Video backend preroll warmup failed." : StatusMessage()); - return false; - } - - if (!mInputCaptureDisabled && !mVideoIODevice->StartInputStreams()) - { - StopOutputProducerWorker(); - StopOutputCompletionWorker(); - ApplyLifecycleFailure(StatusMessage().empty() ? "Video backend input stream start failed." : StatusMessage()); - return false; - } - - if (!mVideoIODevice->StartScheduledPlayback()) - { - StopOutputProducerWorker(); - mVideoIODevice->Stop(); - StopOutputCompletionWorker(); - ApplyLifecycleFailure(StatusMessage().empty() ? "Video backend scheduled playback start failed." : StatusMessage()); - return false; - } - - ApplyLifecycleTransition(VideoBackendLifecycleState::Running, "Video backend started."); - return true; -} - -bool VideoBackend::Stop() -{ - ApplyLifecycleTransition(VideoBackendLifecycleState::Stopping, "Video backend stopping."); - StopOutputProducerWorker(); - const bool stopped = mVideoIODevice->Stop(); - StopOutputCompletionWorker(); - if (stopped) - ApplyLifecycleTransition(VideoBackendLifecycleState::Stopped, "Video backend stopped."); - else - ApplyLifecycleFailure(StatusMessage().empty() ? "Video backend stop failed." : StatusMessage()); - return stopped; -} - -const VideoIOState& VideoBackend::State() const -{ - return mVideoIODevice->State(); -} - -VideoIOState& VideoBackend::MutableState() -{ - return mVideoIODevice->MutableState(); -} - -bool VideoBackend::BeginOutputFrame(VideoIOOutputFrame& frame) -{ - return mVideoIODevice->BeginOutputFrame(frame); -} - -void VideoBackend::EndOutputFrame(VideoIOOutputFrame& frame) -{ - mVideoIODevice->EndOutputFrame(frame); -} - -bool VideoBackend::ScheduleOutputFrame(const VideoIOOutputFrame& frame) -{ - return mVideoIODevice->ScheduleOutputFrame(frame); -} - -VideoPlayoutRecoveryDecision VideoBackend::AccountForCompletionResult(VideoIOCompletionResult result, uint64_t readyQueueDepth) -{ - return mVideoIODevice->AccountForCompletionResult(result, readyQueueDepth); -} - -bool VideoBackend::HasInputDevice() const -{ - return mVideoIODevice->HasInputDevice(); -} - -bool VideoBackend::HasInputSource() const -{ - if (mInputCaptureDisabled) - return false; - return mVideoIODevice->HasInputSource(); -} - -unsigned VideoBackend::InputFrameWidth() const -{ - return mVideoIODevice->InputFrameWidth(); -} - -unsigned VideoBackend::InputFrameHeight() const -{ - return mVideoIODevice->InputFrameHeight(); -} - -unsigned VideoBackend::OutputFrameWidth() const -{ - return mVideoIODevice->OutputFrameWidth(); -} - -unsigned VideoBackend::OutputFrameHeight() const -{ - return mVideoIODevice->OutputFrameHeight(); -} - -unsigned VideoBackend::CaptureTextureWidth() const -{ - return mVideoIODevice->CaptureTextureWidth(); -} - -unsigned VideoBackend::OutputPackTextureWidth() const -{ - return mVideoIODevice->OutputPackTextureWidth(); -} - -VideoIOPixelFormat VideoBackend::InputPixelFormat() const -{ - return mVideoIODevice->InputPixelFormat(); -} - -const std::string& VideoBackend::InputDisplayModeName() const -{ - return mVideoIODevice->InputDisplayModeName(); -} - -const std::string& VideoBackend::OutputModelName() const -{ - return mVideoIODevice->OutputModelName(); -} - -bool VideoBackend::SupportsInternalKeying() const -{ - return mVideoIODevice->SupportsInternalKeying(); -} - -bool VideoBackend::SupportsExternalKeying() const -{ - return mVideoIODevice->SupportsExternalKeying(); -} - -bool VideoBackend::KeyerInterfaceAvailable() const -{ - return mVideoIODevice->KeyerInterfaceAvailable(); -} - -bool VideoBackend::ExternalKeyingActive() const -{ - return mVideoIODevice->ExternalKeyingActive(); -} - -const std::string& VideoBackend::StatusMessage() const -{ - return mVideoIODevice->StatusMessage(); -} - -bool VideoBackend::ShouldPrioritizeOutputOverPreview() const -{ - const RenderOutputQueueMetrics metrics = mReadyOutputQueue.GetMetrics(); - return metrics.depth < static_cast(mPlayoutPolicy.targetReadyFrames); -} - -void VideoBackend::SetStatusMessage(const std::string& message) -{ - mVideoIODevice->SetStatusMessage(message); -} - -void VideoBackend::PublishStatus(bool externalKeyingConfigured, const std::string& statusMessage) -{ - if (!statusMessage.empty()) - SetStatusMessage(statusMessage); - - mHealthTelemetry.ReportVideoIOStatus( - "decklink", - OutputModelName(), - SupportsInternalKeying(), - SupportsExternalKeying(), - KeyerInterfaceAvailable(), - externalKeyingConfigured, - ExternalKeyingActive(), - StatusMessage()); - PublishBackendStateChanged(VideoBackendLifecycle::StateName(mLifecycle.State()), StatusMessage()); -} - -void VideoBackend::ReportNoInputDeviceSignalStatus() -{ - mHealthTelemetry.ReportSignalStatus( - false, - InputFrameWidth(), - InputFrameHeight(), - InputDisplayModeName()); - PublishBackendStateChanged("no-input-device", "No input device is available."); -} - -void VideoBackend::HandleInputFrame(const VideoIOFrame& frame) -{ - if (mInputCaptureDisabled) - return; - - const VideoIOState& state = mVideoIODevice->State(); - mHealthTelemetry.TryReportSignalStatus(!frame.hasNoInputSource, state.inputFrameSize.width, state.inputFrameSize.height, state.inputDisplayModeName); - PublishInputSignalChanged(frame, state); - PublishInputFrameArrived(frame); - - if (mBridge) - mBridge->UploadInputFrame(frame, state); -} - -void VideoBackend::HandleOutputFrameCompletion(const VideoIOCompletion& completion) -{ - { - std::lock_guard lock(mOutputCompletionMutex); - if (!mOutputCompletionWorkerRunning || mOutputCompletionWorkerStopping) - return; - mPendingOutputCompletions.push_back(completion); - } - mOutputCompletionCondition.notify_one(); -} - -void VideoBackend::StartOutputCompletionWorker() -{ - { - std::lock_guard lock(mOutputCompletionMutex); - if (mOutputCompletionWorkerRunning) - return; - - mPendingOutputCompletions.clear(); - mReadyOutputQueue.Clear(); - mNextReadyOutputFrameIndex = 0; - mHasReadyQueueDepthBaseline = false; - mMinReadyQueueDepth = 0; - mMaxReadyQueueDepth = 0; - mReadyQueueZeroDepthCount = 0; - mOutputRenderMilliseconds = 0.0; - mSmoothedOutputRenderMilliseconds = 0.0; - mMaxOutputRenderMilliseconds = 0.0; - mOutputFrameAcquireMilliseconds = 0.0; - mOutputFrameRenderRequestMilliseconds = 0.0; - mOutputFrameEndAccessMilliseconds = 0.0; - mLastLateStreak = 0; - mLastDropStreak = 0; - mOutputCompletionWorkerStopping = false; - mOutputCompletionWorkerRunning = true; - mOutputCompletionWorker = std::thread(&VideoBackend::OutputCompletionWorkerMain, this); - } -} - -void VideoBackend::StopOutputCompletionWorker() -{ - StopOutputProducerWorker(); - - bool shouldJoin = false; - { - std::lock_guard lock(mOutputCompletionMutex); - if (mOutputCompletionWorkerRunning) - mOutputCompletionWorkerStopping = true; - shouldJoin = mOutputCompletionWorker.joinable(); - } - mOutputCompletionCondition.notify_one(); - - if (shouldJoin) - mOutputCompletionWorker.join(); -} - -void VideoBackend::StartOutputProducerWorker() -{ - std::lock_guard lock(mOutputProducerMutex); - if (mOutputProducerWorkerRunning) - return; - - const double frameBudgetMilliseconds = State().frameBudgetMilliseconds; - const auto frameDuration = frameBudgetMilliseconds > 0.0 - ? std::chrono::duration_cast( - std::chrono::duration(frameBudgetMilliseconds)) - : std::chrono::milliseconds(16); - mRenderCadenceController.Configure(frameDuration, std::chrono::steady_clock::now()); - mLastOutputProductionCompletion = VideoIOCompletion(); - mLastOutputProductionTime = std::chrono::steady_clock::time_point(); - mOutputProducerWorkerStopping = false; - mOutputProducerWorkerRunning = true; - mOutputProducerWorker = std::thread(&VideoBackend::OutputProducerWorkerMain, this); - mOutputProducerCondition.notify_one(); -} - -void VideoBackend::StopOutputProducerWorker() -{ - bool shouldJoin = false; - { - std::lock_guard lock(mOutputProducerMutex); - if (mOutputProducerWorkerRunning) - mOutputProducerWorkerStopping = true; - shouldJoin = mOutputProducerWorker.joinable(); - } - mOutputProducerCondition.notify_one(); - - if (shouldJoin) - mOutputProducerWorker.join(); -} - -void VideoBackend::NotifyOutputProducer() -{ - mOutputProducerCondition.notify_one(); -} - -bool VideoBackend::WarmupOutputPreroll() -{ - const VideoPlayoutPolicy policy = NormalizeVideoPlayoutPolicy(mPlayoutPolicy); - const std::size_t targetPrerollFrames = static_cast(policy.targetPrerollFrames); - if (targetPrerollFrames == 0) - return true; - - const double frameBudgetMilliseconds = State().frameBudgetMilliseconds > 0.0 ? State().frameBudgetMilliseconds : 16.0; - const auto estimatedCadenceTime = std::chrono::duration_cast( - std::chrono::duration(frameBudgetMilliseconds * static_cast(targetPrerollFrames + 2))); - const auto timeout = (std::max)(std::chrono::milliseconds(1000), estimatedCadenceTime + std::chrono::milliseconds(500)); - const auto deadline = std::chrono::steady_clock::now() + timeout; - - while (std::chrono::steady_clock::now() < deadline) - { - ScheduleReadyOutputFramesToTarget(); - const SystemOutputFramePoolMetrics metrics = mSystemOutputFramePool.GetMetrics(); - RecordSystemMemoryPlayoutStats(); - if (metrics.scheduledCount >= targetPrerollFrames) - return true; - - NotifyOutputProducer(); - const auto waitDuration = (std::min)(OutputProducerWakeInterval(), std::chrono::milliseconds(5)); - std::unique_lock lock(mOutputProducerMutex); - mOutputProducerCondition.wait_for(lock, waitDuration); - if (mOutputProducerWorkerStopping) - return false; - } - - SetStatusMessage("Timed out warming up DeckLink preroll from rendered system-memory frames."); - return false; -} - -void VideoBackend::OutputCompletionWorkerMain() -{ - for (;;) - { - VideoIOCompletion completion; - { - std::unique_lock lock(mOutputCompletionMutex); - mOutputCompletionCondition.wait(lock, [this]() { - return mOutputCompletionWorkerStopping || !mPendingOutputCompletions.empty(); - }); - - if (mPendingOutputCompletions.empty()) - { - if (mOutputCompletionWorkerStopping) - { - mOutputCompletionWorkerRunning = false; - return; - } - continue; - } - - completion = mPendingOutputCompletions.front(); - mPendingOutputCompletions.pop_front(); - } - - ProcessOutputFrameCompletion(completion); - } -} - -void VideoBackend::OutputProducerWorkerMain() -{ - for (;;) - { - { - std::lock_guard lock(mOutputProducerMutex); - if (mOutputProducerWorkerStopping) - { - mOutputProducerWorkerRunning = false; - return; - } - } - - ScheduleReadyOutputFramesToTarget(); - - const RenderOutputQueueMetrics metrics = mReadyOutputQueue.GetMetrics(); - RecordReadyQueueDepthSample(metrics); - - const auto now = std::chrono::steady_clock::now(); - RenderCadenceDecision cadenceDecision = mRenderCadenceController.Tick(now); - if (cadenceDecision.action == RenderCadenceAction::Wait) - { - const auto waitDuration = (std::min)( - std::chrono::duration_cast(cadenceDecision.waitDuration), - OutputProducerWakeInterval()); - std::unique_lock lock(mOutputProducerMutex); - mOutputProducerCondition.wait_for(lock, waitDuration); - if (mOutputProducerWorkerStopping) - { - mOutputProducerWorkerRunning = false; - return; - } - continue; - } - - VideoIOCompletion completion; - { - std::lock_guard lock(mOutputProducerMutex); - if (mOutputProducerWorkerStopping) - continue; - completion = mLastOutputProductionCompletion; - } - - const std::size_t producedFrames = ProduceReadyOutputFrames(completion, 1); - if (producedFrames > 0) - { - mLastOutputProductionTime = std::chrono::steady_clock::now(); - ScheduleReadyOutputFramesToTarget(); - continue; - } - - { - std::unique_lock lock(mOutputProducerMutex); - mOutputProducerCondition.wait_for(lock, OutputProducerWakeInterval()); - if (mOutputProducerWorkerStopping) - { - mOutputProducerWorkerRunning = false; - return; - } - } - } -} - -std::chrono::milliseconds VideoBackend::OutputProducerWakeInterval() const -{ - const double frameBudgetMilliseconds = State().frameBudgetMilliseconds; - if (frameBudgetMilliseconds <= 0.0) - return std::chrono::milliseconds(8); - - const int intervalMilliseconds = (std::max)(1, static_cast(std::floor(frameBudgetMilliseconds * 0.75))); - return std::chrono::milliseconds(intervalMilliseconds); -} - -void VideoBackend::ProcessOutputFrameCompletion(const VideoIOCompletion& completion) -{ - if (completion.outputFrameBuffer != nullptr) - mSystemOutputFramePool.ReleaseSlotByBuffer(completion.outputFrameBuffer); - RecordFramePacing(completion.result); - PublishOutputFrameCompleted(completion); - const RenderOutputQueueMetrics initialQueueMetrics = mReadyOutputQueue.GetMetrics(); - RecordReadyQueueDepthSample(initialQueueMetrics); - const VideoPlayoutRecoveryDecision recoveryDecision = AccountForCompletionResult(completion.result, initialQueueMetrics.depth); - { - std::lock_guard lock(mOutputMetricsMutex); - mLastLateStreak = recoveryDecision.lateStreak; - mLastDropStreak = recoveryDecision.dropStreak; - } - { - std::lock_guard lock(mOutputProducerMutex); - mLastOutputProductionCompletion = completion; - } - NotifyOutputProducer(); - - RecordBackendPlayoutHealth(completion.result, recoveryDecision); - RecordSystemMemoryPlayoutStats(); -} - -std::size_t VideoBackend::ScheduleReadyOutputFramesToTarget() -{ - const std::size_t targetScheduledFrames = static_cast(mPlayoutPolicy.targetPrerollFrames); - std::size_t scheduledFrames = 0; - for (;;) - { - const SystemOutputFramePoolMetrics poolMetrics = mSystemOutputFramePool.GetMetrics(); - if (poolMetrics.scheduledCount >= targetScheduledFrames) - break; - if (!ScheduleReadyOutputFrame()) - break; - ++scheduledFrames; - } - return scheduledFrames; -} - -void VideoBackend::RecordBackendPlayoutHealth(VideoIOCompletionResult result, const VideoPlayoutRecoveryDecision& recoveryDecision) -{ - const RenderOutputQueueMetrics queueMetrics = mReadyOutputQueue.GetMetrics(); - std::size_t minReadyQueueDepth = 0; - std::size_t maxReadyQueueDepth = 0; - uint64_t readyQueueZeroDepthCount = 0; - double outputRenderMilliseconds = 0.0; - double smoothedOutputRenderMilliseconds = 0.0; - double maxOutputRenderMilliseconds = 0.0; - double outputFrameAcquireMilliseconds = 0.0; - double outputFrameRenderRequestMilliseconds = 0.0; - double outputFrameEndAccessMilliseconds = 0.0; - { - std::lock_guard lock(mOutputMetricsMutex); - minReadyQueueDepth = mMinReadyQueueDepth; - maxReadyQueueDepth = mMaxReadyQueueDepth; - readyQueueZeroDepthCount = mReadyQueueZeroDepthCount; - outputRenderMilliseconds = mOutputRenderMilliseconds; - smoothedOutputRenderMilliseconds = mSmoothedOutputRenderMilliseconds; - maxOutputRenderMilliseconds = mMaxOutputRenderMilliseconds; - outputFrameAcquireMilliseconds = mOutputFrameAcquireMilliseconds; - outputFrameRenderRequestMilliseconds = mOutputFrameRenderRequestMilliseconds; - outputFrameEndAccessMilliseconds = mOutputFrameEndAccessMilliseconds; - } - - mHealthTelemetry.TryRecordBackendPlayoutHealth( - VideoBackendLifecycle::StateName(mLifecycle.State()), - CompletionResultName(result), - queueMetrics.depth, - queueMetrics.capacity, - queueMetrics.pushedCount, - minReadyQueueDepth, - maxReadyQueueDepth, - readyQueueZeroDepthCount, - queueMetrics.poppedCount, - queueMetrics.droppedCount, - queueMetrics.underrunCount, - outputRenderMilliseconds, - smoothedOutputRenderMilliseconds, - maxOutputRenderMilliseconds, - outputFrameAcquireMilliseconds, - outputFrameRenderRequestMilliseconds, - outputFrameEndAccessMilliseconds, - recoveryDecision.completedFrameIndex, - recoveryDecision.scheduledFrameIndex, - recoveryDecision.scheduledLeadFrames, - recoveryDecision.measuredLagFrames, - recoveryDecision.catchUpFrames, - recoveryDecision.lateStreak, - recoveryDecision.dropStreak, - mLateFrameCount, - mDroppedFrameCount, - mFlushedFrameCount, - mLifecycle.State() == VideoBackendLifecycleState::Degraded, - StatusMessage()); -} - -std::size_t VideoBackend::ProduceReadyOutputFrames(const VideoIOCompletion& completion, std::size_t maxFrames) -{ - if (maxFrames == 0) - return 0; - - std::lock_guard productionLock(mOutputProductionMutex); - RenderOutputQueueMetrics metrics = mReadyOutputQueue.GetMetrics(); - std::size_t producedFrames = 0; - while (producedFrames < maxFrames) - { - if (!RenderReadyOutputFrame(mVideoIODevice->State(), completion)) - break; - ++producedFrames; - metrics = mReadyOutputQueue.GetMetrics(); - RecordReadyQueueDepthSample(metrics); - } - return producedFrames; -} - -OutputProductionPressure VideoBackend::BuildOutputProductionPressure(const RenderOutputQueueMetrics& metrics) const -{ - OutputProductionPressure pressure; - pressure.readyQueueDepth = metrics.depth; - pressure.readyQueueCapacity = metrics.capacity; - pressure.readyQueueUnderrunCount = metrics.underrunCount; - { - std::lock_guard lock(mOutputMetricsMutex); - pressure.lateStreak = mLastLateStreak; - pressure.dropStreak = mLastDropStreak; - } - return pressure; -} - -bool VideoBackend::RenderReadyOutputFrame(const VideoIOState& state, const VideoIOCompletion& completion) -{ - const auto renderStart = std::chrono::steady_clock::now(); - OutputFrameSlot outputSlot; - VideoIOOutputFrame outputFrame; - const auto acquireStart = std::chrono::steady_clock::now(); - if (!mSystemOutputFramePool.AcquireFreeSlot(outputSlot)) - { - if (!mReadyOutputQueue.DropOldestFrame() || !mSystemOutputFramePool.AcquireFreeSlot(outputSlot)) - return false; - } - outputFrame = outputSlot.frame; - const auto acquireEnd = std::chrono::steady_clock::now(); - - bool rendered = true; - const auto renderRequestStart = std::chrono::steady_clock::now(); - if (mBridge) - rendered = mBridge->RenderScheduledFrame(state, completion, outputFrame); - const auto renderRequestEnd = std::chrono::steady_clock::now(); - - const auto endAccessStart = std::chrono::steady_clock::now(); - const bool publishedReady = mSystemOutputFramePool.PublishReadySlot(outputSlot); - const auto endAccessEnd = std::chrono::steady_clock::now(); - const double acquireMilliseconds = std::chrono::duration_cast>(acquireEnd - acquireStart).count(); - const double renderRequestMilliseconds = std::chrono::duration_cast>(renderRequestEnd - renderRequestStart).count(); - const double endAccessMilliseconds = std::chrono::duration_cast>(endAccessEnd - endAccessStart).count(); - - if (!rendered) - { - mSystemOutputFramePool.ReleaseSlot(outputSlot); - ApplyLifecycleTransition(VideoBackendLifecycleState::Degraded, "Output frame render request failed; skipping schedule for this frame."); - const double renderMilliseconds = std::chrono::duration_cast>( - std::chrono::steady_clock::now() - renderStart).count(); - RecordOutputRenderDuration(renderMilliseconds, acquireMilliseconds, renderRequestMilliseconds, endAccessMilliseconds); - return false; - } - - if (!publishedReady) - { - mSystemOutputFramePool.ReleaseSlot(outputSlot); - return false; - } - - const double renderMilliseconds = std::chrono::duration_cast>( - std::chrono::steady_clock::now() - renderStart).count(); - RecordOutputRenderDuration(renderMilliseconds, acquireMilliseconds, renderRequestMilliseconds, endAccessMilliseconds); - - RenderOutputFrame readyFrame; - readyFrame.frame = outputFrame; - readyFrame.frameIndex = ++mNextReadyOutputFrameIndex; - readyFrame.releaseFrame = [this](VideoIOOutputFrame& frame) { - mSystemOutputFramePool.ReleaseSlotByBuffer(frame.bytes); - }; - const bool pushed = mReadyOutputQueue.Push(readyFrame); - if (!pushed) - mSystemOutputFramePool.ReleaseSlot(outputSlot); - RecordSystemMemoryPlayoutStats(); - return pushed; -} - -bool VideoBackend::ScheduleReadyOutputFrame() -{ - std::lock_guard schedulingLock(mOutputSchedulingMutex); - RenderOutputFrame readyFrame; - if (!mReadyOutputQueue.TryPop(readyFrame)) - return false; - RecordReadyQueueDepthSample(mReadyOutputQueue.GetMetrics()); - - if (!mSystemOutputFramePool.MarkScheduledByBuffer(readyFrame.frame.bytes)) - { - if (readyFrame.releaseFrame) - readyFrame.releaseFrame(readyFrame.frame); - return false; - } - - if (!ScheduleOutputFrame(readyFrame.frame)) - { - RecordDeckLinkBufferTelemetry(); - mSystemOutputFramePool.ReleaseSlotByBuffer(readyFrame.frame.bytes); - return false; - } - - RecordDeckLinkBufferTelemetry(); - PublishOutputFrameScheduled(readyFrame.frame); - RecordSystemMemoryPlayoutStats(); - return true; -} - -bool VideoBackend::ScheduleBlackUnderrunFrame() -{ - VideoIOOutputFrame outputFrame; - if (!BeginOutputFrame(outputFrame)) - { - ApplyLifecycleTransition(VideoBackendLifecycleState::Degraded, "Output underrun: no output frame was available for fallback scheduling."); - return false; - } - - if (outputFrame.bytes != nullptr && outputFrame.rowBytes > 0 && outputFrame.height > 0) - std::memset(outputFrame.bytes, 0, static_cast(outputFrame.rowBytes) * outputFrame.height); - EndOutputFrame(outputFrame); - - if (!ScheduleOutputFrame(outputFrame)) - { - RecordDeckLinkBufferTelemetry(); - ApplyLifecycleTransition(VideoBackendLifecycleState::Degraded, "Output underrun: black fallback frame scheduling failed."); - return false; - } - - RecordDeckLinkBufferTelemetry(); - ApplyLifecycleTransition(VideoBackendLifecycleState::Degraded, "Output underrun: scheduled black fallback frame."); - PublishOutputFrameScheduled(outputFrame); - return true; -} - -void VideoBackend::RecordFramePacing(VideoIOCompletionResult completionResult) -{ - const auto now = std::chrono::steady_clock::now(); - if (mLastPlayoutCompletionTime != std::chrono::steady_clock::time_point()) - { - mCompletionIntervalMilliseconds = std::chrono::duration_cast>(now - mLastPlayoutCompletionTime).count(); - if (mSmoothedCompletionIntervalMilliseconds <= 0.0) - mSmoothedCompletionIntervalMilliseconds = mCompletionIntervalMilliseconds; - else - mSmoothedCompletionIntervalMilliseconds = mSmoothedCompletionIntervalMilliseconds * 0.9 + mCompletionIntervalMilliseconds * 0.1; - if (mCompletionIntervalMilliseconds > mMaxCompletionIntervalMilliseconds) - mMaxCompletionIntervalMilliseconds = mCompletionIntervalMilliseconds; - } - mLastPlayoutCompletionTime = now; - - if (completionResult == VideoIOCompletionResult::DisplayedLate) - ++mLateFrameCount; - else if (completionResult == VideoIOCompletionResult::Dropped) - ++mDroppedFrameCount; - else if (completionResult == VideoIOCompletionResult::Flushed) - ++mFlushedFrameCount; - - mHealthTelemetry.TryRecordFramePacingStats( - mCompletionIntervalMilliseconds, - mSmoothedCompletionIntervalMilliseconds, - mMaxCompletionIntervalMilliseconds, - mLateFrameCount, - mDroppedFrameCount, - mFlushedFrameCount); - PublishTimingSample("VideoBackend", "completionInterval", mCompletionIntervalMilliseconds, "ms"); - PublishTimingSample("VideoBackend", "smoothedCompletionInterval", mSmoothedCompletionIntervalMilliseconds, "ms"); -} - -void VideoBackend::RecordReadyQueueDepthSample(const RenderOutputQueueMetrics& metrics) -{ - std::lock_guard lock(mOutputMetricsMutex); - if (!mHasReadyQueueDepthBaseline) - { - mHasReadyQueueDepthBaseline = true; - mMinReadyQueueDepth = metrics.depth; - mMaxReadyQueueDepth = metrics.depth; - } - else - { - mMinReadyQueueDepth = (std::min)(mMinReadyQueueDepth, metrics.depth); - mMaxReadyQueueDepth = (std::max)(mMaxReadyQueueDepth, metrics.depth); - } - - if (metrics.depth == 0) - ++mReadyQueueZeroDepthCount; -} - -void VideoBackend::RecordDeckLinkBufferTelemetry() -{ - if (!mVideoIODevice) - return; - - const VideoIOState& state = mVideoIODevice->State(); - mHealthTelemetry.TryRecordDeckLinkBufferTelemetry( - state.actualDeckLinkBufferedFramesAvailable, - state.actualDeckLinkBufferedFrames, - static_cast(mPlayoutPolicy.targetPrerollFrames), - state.deckLinkScheduleCallMilliseconds, - state.deckLinkScheduleFailureCount); -} - -void VideoBackend::RecordSystemMemoryPlayoutStats() -{ - const SystemOutputFramePoolMetrics poolMetrics = mSystemOutputFramePool.GetMetrics(); - const RenderOutputQueueMetrics queueMetrics = mReadyOutputQueue.GetMetrics(); - RecordDeckLinkBufferTelemetry(); - mHealthTelemetry.TryRecordSystemMemoryPlayoutStats( - poolMetrics.freeCount, - poolMetrics.readyCount, - poolMetrics.scheduledCount, - poolMetrics.readyUnderrunCount, - 0, - queueMetrics.droppedCount, - 0.0, - 0.0); -} - -void VideoBackend::RecordOutputRenderDuration(double renderMilliseconds, double acquireMilliseconds, double renderRequestMilliseconds, double endAccessMilliseconds) -{ - std::lock_guard lock(mOutputMetricsMutex); - mOutputRenderMilliseconds = (std::max)(renderMilliseconds, 0.0); - if (mSmoothedOutputRenderMilliseconds <= 0.0) - mSmoothedOutputRenderMilliseconds = mOutputRenderMilliseconds; - else - mSmoothedOutputRenderMilliseconds = mSmoothedOutputRenderMilliseconds * 0.9 + mOutputRenderMilliseconds * 0.1; - mMaxOutputRenderMilliseconds = (std::max)(mMaxOutputRenderMilliseconds, mOutputRenderMilliseconds); - mOutputFrameAcquireMilliseconds = (std::max)(acquireMilliseconds, 0.0); - mOutputFrameRenderRequestMilliseconds = (std::max)(renderRequestMilliseconds, 0.0); - mOutputFrameEndAccessMilliseconds = (std::max)(endAccessMilliseconds, 0.0); - - PublishTimingSample("VideoBackend", "outputRender", mOutputRenderMilliseconds, "ms"); - PublishTimingSample("VideoBackend", "smoothedOutputRender", mSmoothedOutputRenderMilliseconds, "ms"); -} - -bool VideoBackend::ApplyLifecycleTransition(VideoBackendLifecycleState state, const std::string& message) -{ - const VideoBackendLifecycleTransition transition = mLifecycle.TransitionTo(state, message); - if (!transition.accepted) - { - PublishBackendStateChanged(VideoBackendLifecycle::StateName(transition.current), transition.errorMessage); - return false; - } - - PublishBackendStateChanged(VideoBackendLifecycle::StateName(transition.current), message); - return true; -} - -bool VideoBackend::ApplyLifecycleFailure(const std::string& message) -{ - const VideoBackendLifecycleTransition transition = mLifecycle.Fail(message); - if (!transition.accepted) - { - PublishBackendStateChanged(VideoBackendLifecycle::StateName(transition.current), transition.errorMessage); - return false; - } - - PublishBackendStateChanged(VideoBackendLifecycle::StateName(transition.current), message); - return true; -} - -void VideoBackend::PublishBackendStateChanged(const std::string& state, const std::string& message) -{ - try - { - BackendStateChangedEvent event; - event.backendName = "decklink"; - event.state = state; - event.message = message; - if (!mRuntimeEventDispatcher.PublishPayload(event, "VideoBackend")) - OutputDebugStringA("BackendStateChanged event publish failed.\n"); - } - catch (...) - { - OutputDebugStringA("BackendStateChanged event publish threw.\n"); - } -} - -void VideoBackend::PublishInputSignalChanged(const VideoIOFrame& frame, const VideoIOState& state) -{ - const bool hasSignal = !frame.hasNoInputSource; - const unsigned width = state.inputFrameSize.width; - const unsigned height = state.inputFrameSize.height; - if (mHasLastInputSignal && - mLastInputSignal == hasSignal && - mLastInputSignalWidth == width && - mLastInputSignalHeight == height && - mLastInputSignalModeName == state.inputDisplayModeName) - { - return; - } - - mHasLastInputSignal = true; - mLastInputSignal = hasSignal; - mLastInputSignalWidth = width; - mLastInputSignalHeight = height; - mLastInputSignalModeName = state.inputDisplayModeName; - - try - { - InputSignalChangedEvent event; - event.hasSignal = hasSignal; - event.width = width; - event.height = height; - event.modeName = state.inputDisplayModeName; - if (!mRuntimeEventDispatcher.PublishPayload(event, "VideoBackend")) - OutputDebugStringA("InputSignalChanged event publish failed.\n"); - } - catch (...) - { - OutputDebugStringA("InputSignalChanged event publish threw.\n"); - } -} - -void VideoBackend::PublishInputFrameArrived(const VideoIOFrame& frame) -{ - try - { - InputFrameArrivedEvent event; - event.frameIndex = ++mInputFrameIndex; - event.width = frame.width; - event.height = frame.height; - event.rowBytes = frame.rowBytes; - event.pixelFormat = PixelFormatName(frame.pixelFormat); - event.hasNoInputSource = frame.hasNoInputSource; - if (!mRuntimeEventDispatcher.PublishPayload(event, "VideoBackend")) - OutputDebugStringA("InputFrameArrived event publish failed.\n"); - } - catch (...) - { - OutputDebugStringA("InputFrameArrived event publish threw.\n"); - } -} - -void VideoBackend::PublishOutputFrameScheduled(const VideoIOOutputFrame& frame) -{ - try - { - OutputFrameScheduledEvent event; - event.frameIndex = ++mOutputFrameScheduleIndex; - (void)frame; - if (!mRuntimeEventDispatcher.PublishPayload(event, "VideoBackend")) - OutputDebugStringA("OutputFrameScheduled event publish failed.\n"); - } - catch (...) - { - OutputDebugStringA("OutputFrameScheduled event publish threw.\n"); - } -} - -void VideoBackend::PublishOutputFrameCompleted(const VideoIOCompletion& completion) -{ - try - { - OutputFrameCompletedEvent event; - event.frameIndex = ++mOutputFrameCompletionIndex; - event.result = CompletionResultName(completion.result); - if (!mRuntimeEventDispatcher.PublishPayload(event, "VideoBackend")) - OutputDebugStringA("OutputFrameCompleted event publish failed.\n"); - } - catch (...) - { - OutputDebugStringA("OutputFrameCompleted event publish threw.\n"); - } -} - -void VideoBackend::PublishTimingSample(const std::string& subsystem, const std::string& metric, double value, const std::string& unit) -{ - try - { - TimingSampleRecordedEvent event; - event.subsystem = subsystem; - event.metric = metric; - event.value = value; - event.unit = unit; - if (!mRuntimeEventDispatcher.PublishPayload(event, "HealthTelemetry")) - OutputDebugStringA("TimingSampleRecorded event publish failed.\n"); - } - catch (...) - { - OutputDebugStringA("TimingSampleRecorded event publish threw.\n"); - } -} - -std::string VideoBackend::CompletionResultName(VideoIOCompletionResult result) -{ - switch (result) - { - case VideoIOCompletionResult::Completed: - return "Completed"; - case VideoIOCompletionResult::DisplayedLate: - return "DisplayedLate"; - case VideoIOCompletionResult::Dropped: - return "Dropped"; - case VideoIOCompletionResult::Flushed: - return "Flushed"; - case VideoIOCompletionResult::Unknown: - default: - return "Unknown"; - } -} - -std::string VideoBackend::PixelFormatName(VideoIOPixelFormat pixelFormat) -{ - return std::string(VideoIOPixelFormatName(pixelFormat)); -} - -bool VideoBackend::IsEnvironmentFlagEnabled(const char* name) -{ - if (name == nullptr || name[0] == '\0') - return false; - - char* value = nullptr; - std::size_t valueSize = 0; - if (_dupenv_s(&value, &valueSize, name) != 0 || value == nullptr) - return false; - - const std::string flag(value); - std::free(value); - return flag == "1" || flag == "true" || flag == "TRUE" || flag == "yes" || flag == "on"; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/VideoBackend.h b/apps/LoopThroughWithOpenGLCompositing/videoio/VideoBackend.h deleted file mode 100644 index 81eed7f..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/VideoBackend.h +++ /dev/null @@ -1,161 +0,0 @@ -#pragma once - -#include "OutputProductionController.h" -#include "RenderCadenceController.h" -#include "RenderOutputQueue.h" -#include "SystemOutputFramePool.h" -#include "VideoBackendLifecycle.h" -#include "VideoIOTypes.h" -#include "VideoPlayoutPolicy.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -class HealthTelemetry; -class OpenGLVideoIOBridge; -class RenderEngine; -class RuntimeEventDispatcher; -class VideoIODevice; - -class VideoBackend -{ -public: - VideoBackend(RenderEngine& renderEngine, HealthTelemetry& healthTelemetry, RuntimeEventDispatcher& runtimeEventDispatcher); - ~VideoBackend(); - - void ReleaseResources(); - VideoBackendLifecycleState LifecycleState() const; - bool DiscoverDevicesAndModes(const VideoFormatSelection& videoModes, std::string& error); - bool SelectPreferredFormats(const VideoFormatSelection& videoModes, bool outputAlphaRequired, std::string& error); - bool ConfigureInput(const VideoFormat& inputVideoMode, std::string& error); - bool ConfigureOutput(const VideoFormat& outputVideoMode, bool externalKeyingEnabled, std::string& error); - bool Start(); - bool Stop(); - - const VideoIOState& State() const; - VideoIOState& MutableState(); - bool BeginOutputFrame(VideoIOOutputFrame& frame); - void EndOutputFrame(VideoIOOutputFrame& frame); - bool ScheduleOutputFrame(const VideoIOOutputFrame& frame); - VideoPlayoutRecoveryDecision AccountForCompletionResult(VideoIOCompletionResult result, uint64_t readyQueueDepth); - void RecordBackendPlayoutHealth(VideoIOCompletionResult result, const VideoPlayoutRecoveryDecision& recoveryDecision); - - bool HasInputDevice() const; - bool HasInputSource() const; - unsigned InputFrameWidth() const; - unsigned InputFrameHeight() const; - unsigned OutputFrameWidth() const; - unsigned OutputFrameHeight() const; - unsigned CaptureTextureWidth() const; - unsigned OutputPackTextureWidth() const; - VideoIOPixelFormat InputPixelFormat() const; - const std::string& InputDisplayModeName() const; - const std::string& OutputModelName() const; - bool SupportsInternalKeying() const; - bool SupportsExternalKeying() const; - bool KeyerInterfaceAvailable() const; - bool ExternalKeyingActive() const; - const std::string& StatusMessage() const; - bool ShouldPrioritizeOutputOverPreview() const; - void SetStatusMessage(const std::string& message); - void PublishStatus(bool externalKeyingConfigured, const std::string& statusMessage = std::string()); - void ReportNoInputDeviceSignalStatus(); - -private: - void HandleInputFrame(const VideoIOFrame& frame); - void HandleOutputFrameCompletion(const VideoIOCompletion& completion); - void StartOutputCompletionWorker(); - void StopOutputCompletionWorker(); - void OutputCompletionWorkerMain(); - void StartOutputProducerWorker(); - void StopOutputProducerWorker(); - void OutputProducerWorkerMain(); - void NotifyOutputProducer(); - bool WarmupOutputPreroll(); - std::chrono::milliseconds OutputProducerWakeInterval() const; - void ProcessOutputFrameCompletion(const VideoIOCompletion& completion); - std::size_t ProduceReadyOutputFrames(const VideoIOCompletion& completion, std::size_t maxFrames); - OutputProductionPressure BuildOutputProductionPressure(const RenderOutputQueueMetrics& metrics) const; - bool RenderReadyOutputFrame(const VideoIOState& state, const VideoIOCompletion& completion); - std::size_t ScheduleReadyOutputFramesToTarget(); - bool ScheduleReadyOutputFrame(); - bool ScheduleBlackUnderrunFrame(); - void RecordFramePacing(VideoIOCompletionResult completionResult); - void RecordReadyQueueDepthSample(const RenderOutputQueueMetrics& metrics); - void RecordDeckLinkBufferTelemetry(); - void RecordSystemMemoryPlayoutStats(); - void RecordOutputRenderDuration(double renderMilliseconds, double acquireMilliseconds, double renderRequestMilliseconds, double endAccessMilliseconds); - bool ApplyLifecycleTransition(VideoBackendLifecycleState state, const std::string& message); - bool ApplyLifecycleFailure(const std::string& message); - void PublishBackendStateChanged(const std::string& state, const std::string& message); - void PublishInputSignalChanged(const VideoIOFrame& frame, const VideoIOState& state); - void PublishInputFrameArrived(const VideoIOFrame& frame); - void PublishOutputFrameScheduled(const VideoIOOutputFrame& frame); - void PublishOutputFrameCompleted(const VideoIOCompletion& completion); - void PublishTimingSample(const std::string& subsystem, const std::string& metric, double value, const std::string& unit); - static std::string CompletionResultName(VideoIOCompletionResult result); - static std::string PixelFormatName(VideoIOPixelFormat pixelFormat); - static bool IsEnvironmentFlagEnabled(const char* name); - - HealthTelemetry& mHealthTelemetry; - RuntimeEventDispatcher& mRuntimeEventDispatcher; - VideoBackendLifecycle mLifecycle; - VideoPlayoutPolicy mPlayoutPolicy; - OutputProductionController mOutputProductionController; - RenderCadenceController mRenderCadenceController; - RenderOutputQueue mReadyOutputQueue; - SystemOutputFramePool mSystemOutputFramePool; - std::unique_ptr mVideoIODevice; - std::unique_ptr mBridge; - std::mutex mOutputCompletionMutex; - std::condition_variable mOutputCompletionCondition; - std::deque mPendingOutputCompletions; - std::thread mOutputCompletionWorker; - std::mutex mOutputProducerMutex; - std::condition_variable mOutputProducerCondition; - std::thread mOutputProducerWorker; - VideoIOCompletion mLastOutputProductionCompletion; - std::chrono::steady_clock::time_point mLastOutputProductionTime; - std::mutex mOutputProductionMutex; - std::mutex mOutputSchedulingMutex; - mutable std::mutex mOutputMetricsMutex; - bool mOutputCompletionWorkerRunning = false; - bool mOutputCompletionWorkerStopping = false; - bool mOutputProducerWorkerRunning = false; - bool mOutputProducerWorkerStopping = false; - bool mInputCaptureDisabled = false; - uint64_t mNextReadyOutputFrameIndex = 0; - uint64_t mInputFrameIndex = 0; - uint64_t mOutputFrameScheduleIndex = 0; - uint64_t mOutputFrameCompletionIndex = 0; - bool mHasLastInputSignal = false; - bool mLastInputSignal = false; - unsigned mLastInputSignalWidth = 0; - unsigned mLastInputSignalHeight = 0; - std::string mLastInputSignalModeName; - std::chrono::steady_clock::time_point mLastPlayoutCompletionTime; - double mCompletionIntervalMilliseconds = 0.0; - double mSmoothedCompletionIntervalMilliseconds = 0.0; - double mMaxCompletionIntervalMilliseconds = 0.0; - bool mHasReadyQueueDepthBaseline = false; - std::size_t mMinReadyQueueDepth = 0; - std::size_t mMaxReadyQueueDepth = 0; - uint64_t mReadyQueueZeroDepthCount = 0; - double mOutputRenderMilliseconds = 0.0; - double mSmoothedOutputRenderMilliseconds = 0.0; - double mMaxOutputRenderMilliseconds = 0.0; - double mOutputFrameAcquireMilliseconds = 0.0; - double mOutputFrameRenderRequestMilliseconds = 0.0; - double mOutputFrameEndAccessMilliseconds = 0.0; - uint64_t mLastLateStreak = 0; - uint64_t mLastDropStreak = 0; - uint64_t mLateFrameCount = 0; - uint64_t mDroppedFrameCount = 0; - uint64_t mFlushedFrameCount = 0; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/VideoBackendLifecycle.cpp b/apps/LoopThroughWithOpenGLCompositing/videoio/VideoBackendLifecycle.cpp deleted file mode 100644 index 5bfd763..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/VideoBackendLifecycle.cpp +++ /dev/null @@ -1,123 +0,0 @@ -#include "VideoBackendLifecycle.h" - -VideoBackendLifecycleState VideoBackendLifecycle::State() const -{ - return mState; -} - -const std::string& VideoBackendLifecycle::FailureReason() const -{ - return mFailureReason; -} - -VideoBackendLifecycleTransition VideoBackendLifecycle::TransitionTo(VideoBackendLifecycleState next, const std::string& reason) -{ - VideoBackendLifecycleTransition transition; - transition.previous = mState; - transition.current = next; - transition.reason = reason; - transition.accepted = CanTransition(mState, next); - if (!transition.accepted) - { - transition.current = mState; - transition.errorMessage = std::string("Invalid video backend lifecycle transition from ") + - StateName(mState) + " to " + StateName(next) + "."; - return transition; - } - - mState = next; - transition.current = mState; - if (mState != VideoBackendLifecycleState::Failed) - mFailureReason.clear(); - return transition; -} - -VideoBackendLifecycleTransition VideoBackendLifecycle::Fail(const std::string& reason) -{ - VideoBackendLifecycleTransition transition = TransitionTo(VideoBackendLifecycleState::Failed, reason); - if (transition.accepted) - mFailureReason = reason; - return transition; -} - -bool VideoBackendLifecycle::CanTransition(VideoBackendLifecycleState current, VideoBackendLifecycleState next) -{ - if (current == next) - return true; - - switch (current) - { - case VideoBackendLifecycleState::Uninitialized: - return next == VideoBackendLifecycleState::Discovering || - next == VideoBackendLifecycleState::Stopped || - next == VideoBackendLifecycleState::Failed; - case VideoBackendLifecycleState::Discovering: - return next == VideoBackendLifecycleState::Discovered || - next == VideoBackendLifecycleState::Failed; - case VideoBackendLifecycleState::Discovered: - return next == VideoBackendLifecycleState::Configuring || - next == VideoBackendLifecycleState::Stopped || - next == VideoBackendLifecycleState::Failed; - case VideoBackendLifecycleState::Configuring: - return next == VideoBackendLifecycleState::Configured || - next == VideoBackendLifecycleState::Failed; - case VideoBackendLifecycleState::Configured: - return next == VideoBackendLifecycleState::Prerolling || - next == VideoBackendLifecycleState::Stopped || - next == VideoBackendLifecycleState::Failed; - case VideoBackendLifecycleState::Prerolling: - return next == VideoBackendLifecycleState::Running || - next == VideoBackendLifecycleState::Stopping || - next == VideoBackendLifecycleState::Failed; - case VideoBackendLifecycleState::Running: - return next == VideoBackendLifecycleState::Degraded || - next == VideoBackendLifecycleState::Stopping || - next == VideoBackendLifecycleState::Failed; - case VideoBackendLifecycleState::Degraded: - return next == VideoBackendLifecycleState::Running || - next == VideoBackendLifecycleState::Stopping || - next == VideoBackendLifecycleState::Failed; - case VideoBackendLifecycleState::Stopping: - return next == VideoBackendLifecycleState::Stopped || - next == VideoBackendLifecycleState::Failed; - case VideoBackendLifecycleState::Stopped: - return next == VideoBackendLifecycleState::Discovering || - next == VideoBackendLifecycleState::Failed; - case VideoBackendLifecycleState::Failed: - return next == VideoBackendLifecycleState::Stopped || - next == VideoBackendLifecycleState::Discovering; - default: - return false; - } -} - -const char* VideoBackendLifecycle::StateName(VideoBackendLifecycleState state) -{ - switch (state) - { - case VideoBackendLifecycleState::Uninitialized: - return "uninitialized"; - case VideoBackendLifecycleState::Discovering: - return "discovering"; - case VideoBackendLifecycleState::Discovered: - return "discovered"; - case VideoBackendLifecycleState::Configuring: - return "configuring"; - case VideoBackendLifecycleState::Configured: - return "configured"; - case VideoBackendLifecycleState::Prerolling: - return "prerolling"; - case VideoBackendLifecycleState::Running: - return "running"; - case VideoBackendLifecycleState::Degraded: - return "degraded"; - case VideoBackendLifecycleState::Stopping: - return "stopping"; - case VideoBackendLifecycleState::Stopped: - return "stopped"; - case VideoBackendLifecycleState::Failed: - return "failed"; - default: - return "unknown"; - } -} diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/VideoBackendLifecycle.h b/apps/LoopThroughWithOpenGLCompositing/videoio/VideoBackendLifecycle.h deleted file mode 100644 index bc9a5d6..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/VideoBackendLifecycle.h +++ /dev/null @@ -1,43 +0,0 @@ -#pragma once - -#include - -enum class VideoBackendLifecycleState -{ - Uninitialized, - Discovering, - Discovered, - Configuring, - Configured, - Prerolling, - Running, - Degraded, - Stopping, - Stopped, - Failed -}; - -struct VideoBackendLifecycleTransition -{ - VideoBackendLifecycleState previous = VideoBackendLifecycleState::Uninitialized; - VideoBackendLifecycleState current = VideoBackendLifecycleState::Uninitialized; - bool accepted = false; - std::string reason; - std::string errorMessage; -}; - -class VideoBackendLifecycle -{ -public: - VideoBackendLifecycleState State() const; - const std::string& FailureReason() const; - VideoBackendLifecycleTransition TransitionTo(VideoBackendLifecycleState next, const std::string& reason); - VideoBackendLifecycleTransition Fail(const std::string& reason); - - static bool CanTransition(VideoBackendLifecycleState current, VideoBackendLifecycleState next); - static const char* StateName(VideoBackendLifecycleState state); - -private: - VideoBackendLifecycleState mState = VideoBackendLifecycleState::Uninitialized; - std::string mFailureReason; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/VideoIOFormat.cpp b/apps/LoopThroughWithOpenGLCompositing/videoio/VideoIOFormat.cpp deleted file mode 100644 index 90e1a11..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/VideoIOFormat.cpp +++ /dev/null @@ -1,170 +0,0 @@ -#include "VideoIOFormat.h" - -#include -#include - -#ifdef min -#undef min -#endif -#ifdef max -#undef max -#endif - -namespace -{ -uint16_t Clamp10(int value, int minimum, int maximum) -{ - return static_cast(std::max(minimum, std::min(maximum, value))); -} - -uint32_t MakeV210Word(uint16_t a, uint16_t b, uint16_t c) -{ - return (static_cast(a) & 0x3ffu) - | ((static_cast(b) & 0x3ffu) << 10) - | ((static_cast(c) & 0x3ffu) << 20); -} - -void StoreWord(std::array& bytes, std::size_t wordIndex, uint32_t word) -{ - const std::size_t offset = wordIndex * 4; - bytes[offset + 0] = static_cast(word & 0xffu); - bytes[offset + 1] = static_cast((word >> 8) & 0xffu); - bytes[offset + 2] = static_cast((word >> 16) & 0xffu); - bytes[offset + 3] = static_cast((word >> 24) & 0xffu); -} - -uint32_t LoadWord(const std::array& bytes, std::size_t wordIndex) -{ - const std::size_t offset = wordIndex * 4; - return static_cast(bytes[offset + 0]) - | (static_cast(bytes[offset + 1]) << 8) - | (static_cast(bytes[offset + 2]) << 16) - | (static_cast(bytes[offset + 3]) << 24); -} - -uint16_t Component(uint32_t word, unsigned index) -{ - return static_cast((word >> (index * 10)) & 0x3ffu); -} -} - -const char* VideoIOPixelFormatName(VideoIOPixelFormat format) -{ - switch (format) - { - case VideoIOPixelFormat::V210: - return "10-bit YUV v210"; - case VideoIOPixelFormat::Yuva10: - return "10-bit YUVA Ay10"; - case VideoIOPixelFormat::Bgra8: - return "8-bit BGRA"; - case VideoIOPixelFormat::Uyvy8: - default: - return "8-bit YUV UYVY"; - } -} - -bool VideoIOPixelFormatIsTenBit(VideoIOPixelFormat format) -{ - return format == VideoIOPixelFormat::V210 || format == VideoIOPixelFormat::Yuva10; -} - -VideoIOPixelFormat ChoosePreferredVideoIOFormat(bool tenBitSupported) -{ - return tenBitSupported ? VideoIOPixelFormat::V210 : VideoIOPixelFormat::Uyvy8; -} - -unsigned VideoIOBytesPerPixel(VideoIOPixelFormat format) -{ - switch (format) - { - case VideoIOPixelFormat::Uyvy8: - return 2u; - case VideoIOPixelFormat::Bgra8: - return 4u; - case VideoIOPixelFormat::Yuva10: - return 4u; - case VideoIOPixelFormat::V210: - default: - return 0u; - } -} - -unsigned VideoIORowBytes(VideoIOPixelFormat format, unsigned frameWidth) -{ - if (format == VideoIOPixelFormat::V210) - return MinimumV210RowBytes(frameWidth); - if (format == VideoIOPixelFormat::Yuva10) - return MinimumYuva10RowBytes(frameWidth); - return frameWidth * VideoIOBytesPerPixel(format); -} - -unsigned PackedTextureWidthFromRowBytes(unsigned rowBytes) -{ - return (rowBytes + 3u) / 4u; -} - -unsigned MinimumV210RowBytes(unsigned frameWidth) -{ - return ((frameWidth + 5u) / 6u) * 16u; -} - -unsigned MinimumYuva10RowBytes(unsigned frameWidth) -{ - return ((frameWidth + 63u) / 64u) * 256u; -} - -unsigned ActiveV210WordsForWidth(unsigned frameWidth) -{ - return ((frameWidth + 5u) / 6u) * 4u; -} - -V210CodeValues Rec709RgbToLegalV210(float red, float green, float blue) -{ - red = std::max(0.0f, std::min(1.0f, red)); - green = std::max(0.0f, std::min(1.0f, green)); - blue = std::max(0.0f, std::min(1.0f, blue)); - - const float y = 0.2126f * red + 0.7152f * green + 0.0722f * blue; - const float cb = (blue - y) / 1.8556f + 0.5f; - const float cr = (red - y) / 1.5748f + 0.5f; - - V210CodeValues values; - values.y = Clamp10(static_cast(std::lround(64.0f + y * 876.0f)), 64, 940); - values.cb = Clamp10(static_cast(std::lround(64.0f + cb * 896.0f)), 64, 960); - values.cr = Clamp10(static_cast(std::lround(64.0f + cr * 896.0f)), 64, 960); - return values; -} - -std::array PackV210Block(const V210SixPixelBlock& block) -{ - std::array bytes = {}; - StoreWord(bytes, 0, MakeV210Word(block.cb[0], block.y[0], block.cr[0])); - StoreWord(bytes, 1, MakeV210Word(block.y[1], block.cb[1], block.y[2])); - StoreWord(bytes, 2, MakeV210Word(block.cr[1], block.y[3], block.cb[2])); - StoreWord(bytes, 3, MakeV210Word(block.y[4], block.cr[2], block.y[5])); - return bytes; -} - -V210SixPixelBlock UnpackV210Block(const std::array& bytes) -{ - const uint32_t word0 = LoadWord(bytes, 0); - const uint32_t word1 = LoadWord(bytes, 1); - const uint32_t word2 = LoadWord(bytes, 2); - const uint32_t word3 = LoadWord(bytes, 3); - - V210SixPixelBlock block; - block.cb[0] = Component(word0, 0); - block.y[0] = Component(word0, 1); - block.cr[0] = Component(word0, 2); - block.y[1] = Component(word1, 0); - block.cb[1] = Component(word1, 1); - block.y[2] = Component(word1, 2); - block.cr[1] = Component(word2, 0); - block.y[3] = Component(word2, 1); - block.cb[2] = Component(word2, 2); - block.y[4] = Component(word3, 0); - block.cr[2] = Component(word3, 1); - block.y[5] = Component(word3, 2); - return block; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/VideoIOFormat.h b/apps/LoopThroughWithOpenGLCompositing/videoio/VideoIOFormat.h deleted file mode 100644 index 740b39d..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/VideoIOFormat.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include -#include - -enum class VideoIOPixelFormat -{ - Uyvy8, - V210, - Yuva10, - Bgra8 -}; - -struct V210CodeValues -{ - uint16_t y = 64; - uint16_t cb = 512; - uint16_t cr = 512; -}; - -struct V210SixPixelBlock -{ - std::array y = {}; - std::array cb = {}; - std::array cr = {}; -}; - -const char* VideoIOPixelFormatName(VideoIOPixelFormat format); -bool VideoIOPixelFormatIsTenBit(VideoIOPixelFormat format); -VideoIOPixelFormat ChoosePreferredVideoIOFormat(bool tenBitSupported); -unsigned VideoIOBytesPerPixel(VideoIOPixelFormat format); -unsigned VideoIORowBytes(VideoIOPixelFormat format, unsigned frameWidth); -unsigned PackedTextureWidthFromRowBytes(unsigned rowBytes); -unsigned MinimumV210RowBytes(unsigned frameWidth); -unsigned MinimumYuva10RowBytes(unsigned frameWidth); -unsigned ActiveV210WordsForWidth(unsigned frameWidth); -V210CodeValues Rec709RgbToLegalV210(float red, float green, float blue); -std::array PackV210Block(const V210SixPixelBlock& block); -V210SixPixelBlock UnpackV210Block(const std::array& bytes); diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/VideoIOTypes.h b/apps/LoopThroughWithOpenGLCompositing/videoio/VideoIOTypes.h deleted file mode 100644 index 77217bc..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/VideoIOTypes.h +++ /dev/null @@ -1,164 +0,0 @@ -#pragma once - -#include "DeckLinkDisplayMode.h" -#include "VideoIOFormat.h" - -#include -#include -#include - -enum class VideoIOBackend -{ - DeckLink -}; - -enum class VideoIOCompletionResult -{ - Completed, - DisplayedLate, - Dropped, - Flushed, - Unknown -}; - -struct VideoIOConfig -{ - VideoFormatSelection videoModes; - bool externalKeyingEnabled = false; - bool preferTenBit = true; -}; - -struct VideoIOState -{ - FrameSize inputFrameSize; - FrameSize outputFrameSize; - VideoIOPixelFormat inputPixelFormat = VideoIOPixelFormat::Uyvy8; - VideoIOPixelFormat outputPixelFormat = VideoIOPixelFormat::Bgra8; - unsigned inputFrameRowBytes = 0; - unsigned outputFrameRowBytes = 0; - unsigned captureTextureWidth = 0; - unsigned outputPackTextureWidth = 0; - std::string inputDisplayModeName = "1080p59.94"; - std::string outputDisplayModeName = "1080p59.94"; - std::string outputModelName; - std::string statusMessage; - std::string formatStatusMessage; - bool hasInputDevice = false; - bool hasInputSource = false; - bool supportsInternalKeying = false; - bool supportsExternalKeying = false; - bool keyerInterfaceAvailable = false; - bool externalKeyingActive = false; - double frameBudgetMilliseconds = 0.0; - bool actualDeckLinkBufferedFramesAvailable = false; - uint64_t actualDeckLinkBufferedFrames = 0; - double deckLinkScheduleCallMilliseconds = 0.0; - uint64_t deckLinkScheduleFailureCount = 0; - bool deckLinkScheduleLeadAvailable = false; - int64_t deckLinkPlaybackStreamTime = 0; - uint64_t deckLinkPlaybackFrameIndex = 0; - uint64_t deckLinkNextScheduleFrameIndex = 0; - int64_t deckLinkScheduleLeadFrames = 0; - uint64_t deckLinkScheduleRealignmentCount = 0; -}; - -struct VideoIOFrame -{ - void* bytes = nullptr; - long rowBytes = 0; - unsigned width = 0; - unsigned height = 0; - VideoIOPixelFormat pixelFormat = VideoIOPixelFormat::Uyvy8; - bool hasNoInputSource = false; -}; - -struct VideoIOOutputFrame -{ - void* bytes = nullptr; - long rowBytes = 0; - unsigned width = 0; - unsigned height = 0; - VideoIOPixelFormat pixelFormat = VideoIOPixelFormat::Bgra8; - void* nativeFrame = nullptr; - void* nativeBuffer = nullptr; -}; - -struct VideoIOCompletion -{ - VideoIOCompletionResult result = VideoIOCompletionResult::Completed; - void* outputFrameBuffer = nullptr; -}; - -struct VideoIOScheduleTime -{ - int64_t streamTime = 0; - int64_t duration = 0; - int64_t timeScale = 0; - uint64_t frameIndex = 0; -}; - -struct VideoPlayoutRecoveryDecision -{ - VideoIOCompletionResult result = VideoIOCompletionResult::Completed; - uint64_t completedFrameIndex = 0; - uint64_t scheduledFrameIndex = 0; - uint64_t readyQueueDepth = 0; - uint64_t scheduledLeadFrames = 0; - uint64_t measuredLagFrames = 0; - uint64_t catchUpFrames = 0; - uint64_t lateStreak = 0; - uint64_t dropStreak = 0; -}; - -class VideoIODevice -{ -public: - using InputFrameCallback = std::function; - using OutputFrameCallback = std::function; - - virtual ~VideoIODevice() = default; - virtual void ReleaseResources() = 0; - virtual bool DiscoverDevicesAndModes(const VideoFormatSelection& videoModes, std::string& error) = 0; - virtual bool SelectPreferredFormats(const VideoFormatSelection& videoModes, bool outputAlphaRequired, std::string& error) = 0; - virtual bool ConfigureInput(InputFrameCallback callback, const VideoFormat& inputVideoMode, std::string& error) = 0; - virtual bool ConfigureOutput(OutputFrameCallback callback, const VideoFormat& outputVideoMode, bool externalKeyingEnabled, std::string& error) = 0; - virtual bool PrepareOutputSchedule() = 0; - virtual bool StartInputStreams() = 0; - virtual bool StartScheduledPlayback() = 0; - virtual bool Start() = 0; - virtual bool Stop() = 0; - virtual const VideoIOState& State() const = 0; - virtual VideoIOState& MutableState() = 0; - virtual bool BeginOutputFrame(VideoIOOutputFrame& frame) = 0; - virtual void EndOutputFrame(VideoIOOutputFrame& frame) = 0; - virtual bool ScheduleOutputFrame(const VideoIOOutputFrame& frame) = 0; - virtual VideoPlayoutRecoveryDecision AccountForCompletionResult(VideoIOCompletionResult result, uint64_t readyQueueDepth) = 0; - - bool HasInputDevice() const { return State().hasInputDevice; } - bool HasInputSource() const { return State().hasInputSource; } - bool InputOutputDimensionsDiffer() const { return State().inputFrameSize != State().outputFrameSize; } - const FrameSize& InputFrameSize() const { return State().inputFrameSize; } - const FrameSize& OutputFrameSize() const { return State().outputFrameSize; } - unsigned InputFrameWidth() const { return State().inputFrameSize.width; } - unsigned InputFrameHeight() const { return State().inputFrameSize.height; } - unsigned OutputFrameWidth() const { return State().outputFrameSize.width; } - unsigned OutputFrameHeight() const { return State().outputFrameSize.height; } - VideoIOPixelFormat InputPixelFormat() const { return State().inputPixelFormat; } - VideoIOPixelFormat OutputPixelFormat() const { return State().outputPixelFormat; } - bool InputIsTenBit() const { return VideoIOPixelFormatIsTenBit(State().inputPixelFormat); } - bool OutputIsTenBit() const { return VideoIOPixelFormatIsTenBit(State().outputPixelFormat); } - unsigned InputFrameRowBytes() const { return State().inputFrameRowBytes; } - unsigned OutputFrameRowBytes() const { return State().outputFrameRowBytes; } - unsigned CaptureTextureWidth() const { return State().captureTextureWidth; } - unsigned OutputPackTextureWidth() const { return State().outputPackTextureWidth; } - const std::string& FormatStatusMessage() const { return State().formatStatusMessage; } - const std::string& InputDisplayModeName() const { return State().inputDisplayModeName; } - const std::string& OutputModelName() const { return State().outputModelName; } - bool SupportsInternalKeying() const { return State().supportsInternalKeying; } - bool SupportsExternalKeying() const { return State().supportsExternalKeying; } - bool KeyerInterfaceAvailable() const { return State().keyerInterfaceAvailable; } - bool ExternalKeyingActive() const { return State().externalKeyingActive; } - const std::string& StatusMessage() const { return State().statusMessage; } - double FrameBudgetMilliseconds() const { return State().frameBudgetMilliseconds; } - void SetStatusMessage(const std::string& message) { MutableState().statusMessage = message; } -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/VideoPlayoutPolicy.h b/apps/LoopThroughWithOpenGLCompositing/videoio/VideoPlayoutPolicy.h deleted file mode 100644 index 72e5a55..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/VideoPlayoutPolicy.h +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once - -#include - -enum class VideoUnderrunBehavior -{ - ReuseLastCompletedFrame, - BlackFrame -}; - -struct VideoPlayoutPolicy -{ - unsigned outputFramePoolSize = 10; - unsigned targetPrerollFrames = 4; - unsigned targetReadyFrames = 2; - unsigned maxReadyFrames = 4; - unsigned minimumSpareDeviceFrames = 1; - uint64_t lateOrDropCatchUpFrames = 0; - VideoUnderrunBehavior underrunBehavior = VideoUnderrunBehavior::ReuseLastCompletedFrame; - bool adaptiveHeadroomEnabled = false; -}; - -inline VideoPlayoutPolicy NormalizeVideoPlayoutPolicy(VideoPlayoutPolicy policy) -{ - if (policy.outputFramePoolSize == 0) - policy.outputFramePoolSize = 1; - if (policy.targetPrerollFrames == 0) - policy.targetPrerollFrames = 1; - if (policy.targetReadyFrames == 0) - policy.targetReadyFrames = 1; - if (policy.maxReadyFrames < policy.targetReadyFrames) - policy.maxReadyFrames = policy.targetReadyFrames; - const unsigned minimumOutputFramePoolSize = policy.targetPrerollFrames + policy.maxReadyFrames + policy.minimumSpareDeviceFrames; - if (policy.outputFramePoolSize < minimumOutputFramePoolSize) - policy.outputFramePoolSize = minimumOutputFramePoolSize; - return policy; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/VideoPlayoutScheduler.cpp b/apps/LoopThroughWithOpenGLCompositing/videoio/VideoPlayoutScheduler.cpp deleted file mode 100644 index 750e301..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/VideoPlayoutScheduler.cpp +++ /dev/null @@ -1,108 +0,0 @@ -#include "VideoPlayoutScheduler.h" - -void VideoPlayoutScheduler::Configure(int64_t frameDuration, int64_t timeScale) -{ - Configure(frameDuration, timeScale, VideoPlayoutPolicy()); -} - -void VideoPlayoutScheduler::Configure(int64_t frameDuration, int64_t timeScale, const VideoPlayoutPolicy& policy) -{ - mFrameDuration = frameDuration; - mTimeScale = timeScale; - mPolicy = NormalizeVideoPlayoutPolicy(policy); - Reset(); -} - -void VideoPlayoutScheduler::Reset() -{ - mScheduledFrameIndex = 0; - mCompletedFrameIndex = 0; - mLateStreak = 0; - mDropStreak = 0; -} - -VideoIOScheduleTime VideoPlayoutScheduler::NextScheduleTime() -{ - VideoIOScheduleTime time; - time.streamTime = static_cast(mScheduledFrameIndex) * mFrameDuration; - time.duration = mFrameDuration; - time.timeScale = mTimeScale; - time.frameIndex = mScheduledFrameIndex; - ++mScheduledFrameIndex; - return time; -} - -void VideoPlayoutScheduler::AlignNextScheduleTimeToPlayback(int64_t streamTime, uint64_t leadFrames) -{ - if (mFrameDuration <= 0 || streamTime < 0) - return; - - const uint64_t playbackFrameIndex = static_cast(streamTime / mFrameDuration); - const uint64_t minimumScheduleIndex = playbackFrameIndex + leadFrames; - if (minimumScheduleIndex > mScheduledFrameIndex) - mScheduledFrameIndex = minimumScheduleIndex; -} - -VideoPlayoutRecoveryDecision VideoPlayoutScheduler::AccountForCompletionResult(VideoIOCompletionResult result, uint64_t readyQueueDepth) -{ - ++mCompletedFrameIndex; - if (result == VideoIOCompletionResult::DisplayedLate) - ++mLateStreak; - else - mLateStreak = 0; - if (result == VideoIOCompletionResult::Dropped) - ++mDropStreak; - else - mDropStreak = 0; - - const uint64_t measuredLagFrames = MeasureLag(result, readyQueueDepth); - const uint64_t catchUpFrames = measuredLagFrames < mPolicy.lateOrDropCatchUpFrames - ? measuredLagFrames - : mPolicy.lateOrDropCatchUpFrames; - if (catchUpFrames > 0) - mScheduledFrameIndex += catchUpFrames; - - VideoPlayoutRecoveryDecision decision; - decision.result = result; - decision.completedFrameIndex = mCompletedFrameIndex; - decision.scheduledFrameIndex = mScheduledFrameIndex; - decision.readyQueueDepth = readyQueueDepth; - decision.scheduledLeadFrames = mScheduledFrameIndex > mCompletedFrameIndex - ? mScheduledFrameIndex - mCompletedFrameIndex - : 0; - decision.measuredLagFrames = measuredLagFrames; - decision.catchUpFrames = catchUpFrames; - decision.lateStreak = mLateStreak; - decision.dropStreak = mDropStreak; - return decision; -} - -double VideoPlayoutScheduler::FrameBudgetMilliseconds() const -{ - return mTimeScale != 0 - ? (static_cast(mFrameDuration) * 1000.0) / static_cast(mTimeScale) - : 0.0; -} - -uint64_t VideoPlayoutScheduler::MeasureLag(VideoIOCompletionResult result, uint64_t readyQueueDepth) const -{ - if (result != VideoIOCompletionResult::DisplayedLate && result != VideoIOCompletionResult::Dropped) - return 0; - - uint64_t lagFrames = 1; - if (result == VideoIOCompletionResult::DisplayedLate && mLateStreak > lagFrames) - lagFrames = mLateStreak; - if (result == VideoIOCompletionResult::Dropped && mDropStreak * 2 > lagFrames) - lagFrames = mDropStreak * 2; - - if (mCompletedFrameIndex >= mScheduledFrameIndex) - { - const uint64_t scheduleLagFrames = mCompletedFrameIndex - mScheduledFrameIndex + 1; - if (scheduleLagFrames > lagFrames) - lagFrames = scheduleLagFrames; - } - if (readyQueueDepth < mPolicy.targetReadyFrames && mPolicy.targetReadyFrames - readyQueueDepth > lagFrames) - lagFrames = mPolicy.targetReadyFrames - readyQueueDepth; - - return lagFrames; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/VideoPlayoutScheduler.h b/apps/LoopThroughWithOpenGLCompositing/videoio/VideoPlayoutScheduler.h deleted file mode 100644 index a231ea8..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/VideoPlayoutScheduler.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include "VideoIOTypes.h" -#include "VideoPlayoutPolicy.h" - -#include - -class VideoPlayoutScheduler -{ -public: - void Configure(int64_t frameDuration, int64_t timeScale); - void Configure(int64_t frameDuration, int64_t timeScale, const VideoPlayoutPolicy& policy); - void Reset(); - VideoIOScheduleTime NextScheduleTime(); - void AlignNextScheduleTimeToPlayback(int64_t streamTime, uint64_t leadFrames); - VideoPlayoutRecoveryDecision AccountForCompletionResult(VideoIOCompletionResult result, uint64_t readyQueueDepth = 0); - double FrameBudgetMilliseconds() const; - uint64_t ScheduledFrameIndex() const { return mScheduledFrameIndex; } - uint64_t CompletedFrameIndex() const { return mCompletedFrameIndex; } - int64_t FrameDuration() const { return mFrameDuration; } - uint64_t LateStreak() const { return mLateStreak; } - uint64_t DropStreak() const { return mDropStreak; } - int64_t TimeScale() const { return mTimeScale; } - const VideoPlayoutPolicy& Policy() const { return mPolicy; } - -private: - uint64_t MeasureLag(VideoIOCompletionResult result, uint64_t readyQueueDepth) const; - - int64_t mFrameDuration = 0; - int64_t mTimeScale = 0; - uint64_t mScheduledFrameIndex = 0; - uint64_t mCompletedFrameIndex = 0; - uint64_t mLateStreak = 0; - uint64_t mDropStreak = 0; - VideoPlayoutPolicy mPolicy; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkAPI_h.h b/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkAPI_h.h deleted file mode 100644 index a1054c2..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkAPI_h.h +++ /dev/null @@ -1,20433 +0,0 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 8.01.0628 */ -/* at Tue Jan 19 14:14:07 2038 - */ -/* Compiler settings for ..\..\3rdParty\Blackmagic DeckLink SDK 16.0\Win\include\DeckLinkAPI.idl: - Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.01.0628 - protocol : all , 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( ) */ - - - -/* verify that the version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 500 -#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 - -#ifndef DECLSPEC_XFGVIRT -#if defined(_CONTROL_FLOW_GUARD_XFG) -#define DECLSPEC_XFGVIRT(base, func) __declspec(xfg_virtual(base, func)) -#else -#define DECLSPEC_XFGVIRT(base, func) -#endif -#endif - -/* Forward Declarations */ - -#ifndef __IDeckLinkTimecode_FWD_DEFINED__ -#define __IDeckLinkTimecode_FWD_DEFINED__ -typedef interface IDeckLinkTimecode IDeckLinkTimecode; - -#endif /* __IDeckLinkTimecode_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 __IDeckLinkConfiguration_FWD_DEFINED__ -#define __IDeckLinkConfiguration_FWD_DEFINED__ -typedef interface IDeckLinkConfiguration IDeckLinkConfiguration; - -#endif /* __IDeckLinkConfiguration_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkEncoderConfiguration_FWD_DEFINED__ -#define __IDeckLinkEncoderConfiguration_FWD_DEFINED__ -typedef interface IDeckLinkEncoderConfiguration IDeckLinkEncoderConfiguration; - -#endif /* __IDeckLinkEncoderConfiguration_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkDeckControlStatusCallback_FWD_DEFINED__ -#define __IDeckLinkDeckControlStatusCallback_FWD_DEFINED__ -typedef interface IDeckLinkDeckControlStatusCallback IDeckLinkDeckControlStatusCallback; - -#endif /* __IDeckLinkDeckControlStatusCallback_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkDeckControl_FWD_DEFINED__ -#define __IDeckLinkDeckControl_FWD_DEFINED__ -typedef interface IDeckLinkDeckControl IDeckLinkDeckControl; - -#endif /* __IDeckLinkDeckControl_FWD_DEFINED__ */ - - -#ifndef __IBMDStreamingDeviceNotificationCallback_FWD_DEFINED__ -#define __IBMDStreamingDeviceNotificationCallback_FWD_DEFINED__ -typedef interface IBMDStreamingDeviceNotificationCallback IBMDStreamingDeviceNotificationCallback; - -#endif /* __IBMDStreamingDeviceNotificationCallback_FWD_DEFINED__ */ - - -#ifndef __IBMDStreamingH264InputCallback_FWD_DEFINED__ -#define __IBMDStreamingH264InputCallback_FWD_DEFINED__ -typedef interface IBMDStreamingH264InputCallback IBMDStreamingH264InputCallback; - -#endif /* __IBMDStreamingH264InputCallback_FWD_DEFINED__ */ - - -#ifndef __IBMDStreamingDiscovery_FWD_DEFINED__ -#define __IBMDStreamingDiscovery_FWD_DEFINED__ -typedef interface IBMDStreamingDiscovery IBMDStreamingDiscovery; - -#endif /* __IBMDStreamingDiscovery_FWD_DEFINED__ */ - - -#ifndef __IBMDStreamingVideoEncodingMode_FWD_DEFINED__ -#define __IBMDStreamingVideoEncodingMode_FWD_DEFINED__ -typedef interface IBMDStreamingVideoEncodingMode IBMDStreamingVideoEncodingMode; - -#endif /* __IBMDStreamingVideoEncodingMode_FWD_DEFINED__ */ - - -#ifndef __IBMDStreamingMutableVideoEncodingMode_FWD_DEFINED__ -#define __IBMDStreamingMutableVideoEncodingMode_FWD_DEFINED__ -typedef interface IBMDStreamingMutableVideoEncodingMode IBMDStreamingMutableVideoEncodingMode; - -#endif /* __IBMDStreamingMutableVideoEncodingMode_FWD_DEFINED__ */ - - -#ifndef __IBMDStreamingVideoEncodingModePresetIterator_FWD_DEFINED__ -#define __IBMDStreamingVideoEncodingModePresetIterator_FWD_DEFINED__ -typedef interface IBMDStreamingVideoEncodingModePresetIterator IBMDStreamingVideoEncodingModePresetIterator; - -#endif /* __IBMDStreamingVideoEncodingModePresetIterator_FWD_DEFINED__ */ - - -#ifndef __IBMDStreamingDeviceInput_FWD_DEFINED__ -#define __IBMDStreamingDeviceInput_FWD_DEFINED__ -typedef interface IBMDStreamingDeviceInput IBMDStreamingDeviceInput; - -#endif /* __IBMDStreamingDeviceInput_FWD_DEFINED__ */ - - -#ifndef __IBMDStreamingH264NALPacket_FWD_DEFINED__ -#define __IBMDStreamingH264NALPacket_FWD_DEFINED__ -typedef interface IBMDStreamingH264NALPacket IBMDStreamingH264NALPacket; - -#endif /* __IBMDStreamingH264NALPacket_FWD_DEFINED__ */ - - -#ifndef __IBMDStreamingAudioPacket_FWD_DEFINED__ -#define __IBMDStreamingAudioPacket_FWD_DEFINED__ -typedef interface IBMDStreamingAudioPacket IBMDStreamingAudioPacket; - -#endif /* __IBMDStreamingAudioPacket_FWD_DEFINED__ */ - - -#ifndef __IBMDStreamingMPEG2TSPacket_FWD_DEFINED__ -#define __IBMDStreamingMPEG2TSPacket_FWD_DEFINED__ -typedef interface IBMDStreamingMPEG2TSPacket IBMDStreamingMPEG2TSPacket; - -#endif /* __IBMDStreamingMPEG2TSPacket_FWD_DEFINED__ */ - - -#ifndef __IBMDStreamingH264NALParser_FWD_DEFINED__ -#define __IBMDStreamingH264NALParser_FWD_DEFINED__ -typedef interface IBMDStreamingH264NALParser IBMDStreamingH264NALParser; - -#endif /* __IBMDStreamingH264NALParser_FWD_DEFINED__ */ - - -#ifndef __CBMDStreamingDiscovery_FWD_DEFINED__ -#define __CBMDStreamingDiscovery_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class CBMDStreamingDiscovery CBMDStreamingDiscovery; -#else -typedef struct CBMDStreamingDiscovery CBMDStreamingDiscovery; -#endif /* __cplusplus */ - -#endif /* __CBMDStreamingDiscovery_FWD_DEFINED__ */ - - -#ifndef __CBMDStreamingH264NALParser_FWD_DEFINED__ -#define __CBMDStreamingH264NALParser_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class CBMDStreamingH264NALParser CBMDStreamingH264NALParser; -#else -typedef struct CBMDStreamingH264NALParser CBMDStreamingH264NALParser; -#endif /* __cplusplus */ - -#endif /* __CBMDStreamingH264NALParser_FWD_DEFINED__ */ - - -#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 __IDeckLinkEncoderInputCallback_FWD_DEFINED__ -#define __IDeckLinkEncoderInputCallback_FWD_DEFINED__ -typedef interface IDeckLinkEncoderInputCallback IDeckLinkEncoderInputCallback; - -#endif /* __IDeckLinkEncoderInputCallback_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoBufferAllocator_FWD_DEFINED__ -#define __IDeckLinkVideoBufferAllocator_FWD_DEFINED__ -typedef interface IDeckLinkVideoBufferAllocator IDeckLinkVideoBufferAllocator; - -#endif /* __IDeckLinkVideoBufferAllocator_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoBufferAllocatorProvider_FWD_DEFINED__ -#define __IDeckLinkVideoBufferAllocatorProvider_FWD_DEFINED__ -typedef interface IDeckLinkVideoBufferAllocatorProvider IDeckLinkVideoBufferAllocatorProvider; - -#endif /* __IDeckLinkVideoBufferAllocatorProvider_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 __IDeckLinkIPFlowAttributes_FWD_DEFINED__ -#define __IDeckLinkIPFlowAttributes_FWD_DEFINED__ -typedef interface IDeckLinkIPFlowAttributes IDeckLinkIPFlowAttributes; - -#endif /* __IDeckLinkIPFlowAttributes_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkIPFlowStatus_FWD_DEFINED__ -#define __IDeckLinkIPFlowStatus_FWD_DEFINED__ -typedef interface IDeckLinkIPFlowStatus IDeckLinkIPFlowStatus; - -#endif /* __IDeckLinkIPFlowStatus_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkIPFlowSetting_FWD_DEFINED__ -#define __IDeckLinkIPFlowSetting_FWD_DEFINED__ -typedef interface IDeckLinkIPFlowSetting IDeckLinkIPFlowSetting; - -#endif /* __IDeckLinkIPFlowSetting_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkIPFlow_FWD_DEFINED__ -#define __IDeckLinkIPFlow_FWD_DEFINED__ -typedef interface IDeckLinkIPFlow IDeckLinkIPFlow; - -#endif /* __IDeckLinkIPFlow_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkIPFlowIterator_FWD_DEFINED__ -#define __IDeckLinkIPFlowIterator_FWD_DEFINED__ -typedef interface IDeckLinkIPFlowIterator IDeckLinkIPFlowIterator; - -#endif /* __IDeckLinkIPFlowIterator_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 __IDeckLinkIPExtensions_FWD_DEFINED__ -#define __IDeckLinkIPExtensions_FWD_DEFINED__ -typedef interface IDeckLinkIPExtensions IDeckLinkIPExtensions; - -#endif /* __IDeckLinkIPExtensions_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkHDMIInputEDID_FWD_DEFINED__ -#define __IDeckLinkHDMIInputEDID_FWD_DEFINED__ -typedef interface IDeckLinkHDMIInputEDID IDeckLinkHDMIInputEDID; - -#endif /* __IDeckLinkHDMIInputEDID_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkEncoderInput_FWD_DEFINED__ -#define __IDeckLinkEncoderInput_FWD_DEFINED__ -typedef interface IDeckLinkEncoderInput IDeckLinkEncoderInput; - -#endif /* __IDeckLinkEncoderInput_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoBuffer_FWD_DEFINED__ -#define __IDeckLinkVideoBuffer_FWD_DEFINED__ -typedef interface IDeckLinkVideoBuffer IDeckLinkVideoBuffer; - -#endif /* __IDeckLinkVideoBuffer_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 __IDeckLinkVideoFrame3DExtensions_FWD_DEFINED__ -#define __IDeckLinkVideoFrame3DExtensions_FWD_DEFINED__ -typedef interface IDeckLinkVideoFrame3DExtensions IDeckLinkVideoFrame3DExtensions; - -#endif /* __IDeckLinkVideoFrame3DExtensions_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoFrameMetadataExtensions_FWD_DEFINED__ -#define __IDeckLinkVideoFrameMetadataExtensions_FWD_DEFINED__ -typedef interface IDeckLinkVideoFrameMetadataExtensions IDeckLinkVideoFrameMetadataExtensions; - -#endif /* __IDeckLinkVideoFrameMetadataExtensions_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoFrameMutableMetadataExtensions_FWD_DEFINED__ -#define __IDeckLinkVideoFrameMutableMetadataExtensions_FWD_DEFINED__ -typedef interface IDeckLinkVideoFrameMutableMetadataExtensions IDeckLinkVideoFrameMutableMetadataExtensions; - -#endif /* __IDeckLinkVideoFrameMutableMetadataExtensions_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoInputFrame_FWD_DEFINED__ -#define __IDeckLinkVideoInputFrame_FWD_DEFINED__ -typedef interface IDeckLinkVideoInputFrame IDeckLinkVideoInputFrame; - -#endif /* __IDeckLinkVideoInputFrame_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkAncillaryPacket_FWD_DEFINED__ -#define __IDeckLinkAncillaryPacket_FWD_DEFINED__ -typedef interface IDeckLinkAncillaryPacket IDeckLinkAncillaryPacket; - -#endif /* __IDeckLinkAncillaryPacket_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkAncillaryPacketIterator_FWD_DEFINED__ -#define __IDeckLinkAncillaryPacketIterator_FWD_DEFINED__ -typedef interface IDeckLinkAncillaryPacketIterator IDeckLinkAncillaryPacketIterator; - -#endif /* __IDeckLinkAncillaryPacketIterator_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoFrameAncillaryPackets_FWD_DEFINED__ -#define __IDeckLinkVideoFrameAncillaryPackets_FWD_DEFINED__ -typedef interface IDeckLinkVideoFrameAncillaryPackets IDeckLinkVideoFrameAncillaryPackets; - -#endif /* __IDeckLinkVideoFrameAncillaryPackets_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoFrameAncillary_FWD_DEFINED__ -#define __IDeckLinkVideoFrameAncillary_FWD_DEFINED__ -typedef interface IDeckLinkVideoFrameAncillary IDeckLinkVideoFrameAncillary; - -#endif /* __IDeckLinkVideoFrameAncillary_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkEncoderPacket_FWD_DEFINED__ -#define __IDeckLinkEncoderPacket_FWD_DEFINED__ -typedef interface IDeckLinkEncoderPacket IDeckLinkEncoderPacket; - -#endif /* __IDeckLinkEncoderPacket_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkEncoderVideoPacket_FWD_DEFINED__ -#define __IDeckLinkEncoderVideoPacket_FWD_DEFINED__ -typedef interface IDeckLinkEncoderVideoPacket IDeckLinkEncoderVideoPacket; - -#endif /* __IDeckLinkEncoderVideoPacket_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkEncoderAudioPacket_FWD_DEFINED__ -#define __IDeckLinkEncoderAudioPacket_FWD_DEFINED__ -typedef interface IDeckLinkEncoderAudioPacket IDeckLinkEncoderAudioPacket; - -#endif /* __IDeckLinkEncoderAudioPacket_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkH265NALPacket_FWD_DEFINED__ -#define __IDeckLinkH265NALPacket_FWD_DEFINED__ -typedef interface IDeckLinkH265NALPacket IDeckLinkH265NALPacket; - -#endif /* __IDeckLinkH265NALPacket_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 __IDeckLinkDX9ScreenPreviewHelper_FWD_DEFINED__ -#define __IDeckLinkDX9ScreenPreviewHelper_FWD_DEFINED__ -typedef interface IDeckLinkDX9ScreenPreviewHelper IDeckLinkDX9ScreenPreviewHelper; - -#endif /* __IDeckLinkDX9ScreenPreviewHelper_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkWPFDX9ScreenPreviewHelper_FWD_DEFINED__ -#define __IDeckLinkWPFDX9ScreenPreviewHelper_FWD_DEFINED__ -typedef interface IDeckLinkWPFDX9ScreenPreviewHelper IDeckLinkWPFDX9ScreenPreviewHelper; - -#endif /* __IDeckLinkWPFDX9ScreenPreviewHelper_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkNotificationCallback_FWD_DEFINED__ -#define __IDeckLinkNotificationCallback_FWD_DEFINED__ -typedef interface IDeckLinkNotificationCallback IDeckLinkNotificationCallback; - -#endif /* __IDeckLinkNotificationCallback_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkNotification_FWD_DEFINED__ -#define __IDeckLinkNotification_FWD_DEFINED__ -typedef interface IDeckLinkNotification IDeckLinkNotification; - -#endif /* __IDeckLinkNotification_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkProfileAttributes_FWD_DEFINED__ -#define __IDeckLinkProfileAttributes_FWD_DEFINED__ -typedef interface IDeckLinkProfileAttributes IDeckLinkProfileAttributes; - -#endif /* __IDeckLinkProfileAttributes_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkProfileIterator_FWD_DEFINED__ -#define __IDeckLinkProfileIterator_FWD_DEFINED__ -typedef interface IDeckLinkProfileIterator IDeckLinkProfileIterator; - -#endif /* __IDeckLinkProfileIterator_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkProfile_FWD_DEFINED__ -#define __IDeckLinkProfile_FWD_DEFINED__ -typedef interface IDeckLinkProfile IDeckLinkProfile; - -#endif /* __IDeckLinkProfile_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkProfileCallback_FWD_DEFINED__ -#define __IDeckLinkProfileCallback_FWD_DEFINED__ -typedef interface IDeckLinkProfileCallback IDeckLinkProfileCallback; - -#endif /* __IDeckLinkProfileCallback_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkProfileManager_FWD_DEFINED__ -#define __IDeckLinkProfileManager_FWD_DEFINED__ -typedef interface IDeckLinkProfileManager IDeckLinkProfileManager; - -#endif /* __IDeckLinkProfileManager_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkStatistics_FWD_DEFINED__ -#define __IDeckLinkStatistics_FWD_DEFINED__ -typedef interface IDeckLinkStatistics IDeckLinkStatistics; - -#endif /* __IDeckLinkStatistics_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkStatus_FWD_DEFINED__ -#define __IDeckLinkStatus_FWD_DEFINED__ -typedef interface IDeckLinkStatus IDeckLinkStatus; - -#endif /* __IDeckLinkStatus_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkKeyer_FWD_DEFINED__ -#define __IDeckLinkKeyer_FWD_DEFINED__ -typedef interface IDeckLinkKeyer IDeckLinkKeyer; - -#endif /* __IDeckLinkKeyer_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoConversion_FWD_DEFINED__ -#define __IDeckLinkVideoConversion_FWD_DEFINED__ -typedef interface IDeckLinkVideoConversion IDeckLinkVideoConversion; - -#endif /* __IDeckLinkVideoConversion_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkDeviceNotificationCallback_FWD_DEFINED__ -#define __IDeckLinkDeviceNotificationCallback_FWD_DEFINED__ -typedef interface IDeckLinkDeviceNotificationCallback IDeckLinkDeviceNotificationCallback; - -#endif /* __IDeckLinkDeviceNotificationCallback_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkDiscovery_FWD_DEFINED__ -#define __IDeckLinkDiscovery_FWD_DEFINED__ -typedef interface IDeckLinkDiscovery IDeckLinkDiscovery; - -#endif /* __IDeckLinkDiscovery_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 __CDeckLinkAPIInformation_FWD_DEFINED__ -#define __CDeckLinkAPIInformation_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class CDeckLinkAPIInformation CDeckLinkAPIInformation; -#else -typedef struct CDeckLinkAPIInformation CDeckLinkAPIInformation; -#endif /* __cplusplus */ - -#endif /* __CDeckLinkAPIInformation_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 __CDeckLinkGL3ScreenPreviewHelper_FWD_DEFINED__ -#define __CDeckLinkGL3ScreenPreviewHelper_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class CDeckLinkGL3ScreenPreviewHelper CDeckLinkGL3ScreenPreviewHelper; -#else -typedef struct CDeckLinkGL3ScreenPreviewHelper CDeckLinkGL3ScreenPreviewHelper; -#endif /* __cplusplus */ - -#endif /* __CDeckLinkGL3ScreenPreviewHelper_FWD_DEFINED__ */ - - -#ifndef __CDeckLinkDX9ScreenPreviewHelper_FWD_DEFINED__ -#define __CDeckLinkDX9ScreenPreviewHelper_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class CDeckLinkDX9ScreenPreviewHelper CDeckLinkDX9ScreenPreviewHelper; -#else -typedef struct CDeckLinkDX9ScreenPreviewHelper CDeckLinkDX9ScreenPreviewHelper; -#endif /* __cplusplus */ - -#endif /* __CDeckLinkDX9ScreenPreviewHelper_FWD_DEFINED__ */ - - -#ifndef __CDeckLinkWPFDX9ScreenPreviewHelper_FWD_DEFINED__ -#define __CDeckLinkWPFDX9ScreenPreviewHelper_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class CDeckLinkWPFDX9ScreenPreviewHelper CDeckLinkWPFDX9ScreenPreviewHelper; -#else -typedef struct CDeckLinkWPFDX9ScreenPreviewHelper CDeckLinkWPFDX9ScreenPreviewHelper; -#endif /* __cplusplus */ - -#endif /* __CDeckLinkWPFDX9ScreenPreviewHelper_FWD_DEFINED__ */ - - -#ifndef __CDeckLinkVideoConversion_FWD_DEFINED__ -#define __CDeckLinkVideoConversion_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class CDeckLinkVideoConversion CDeckLinkVideoConversion; -#else -typedef struct CDeckLinkVideoConversion CDeckLinkVideoConversion; -#endif /* __cplusplus */ - -#endif /* __CDeckLinkVideoConversion_FWD_DEFINED__ */ - - -#ifndef __CDeckLinkDiscovery_FWD_DEFINED__ -#define __CDeckLinkDiscovery_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class CDeckLinkDiscovery CDeckLinkDiscovery; -#else -typedef struct CDeckLinkDiscovery CDeckLinkDiscovery; -#endif /* __cplusplus */ - -#endif /* __CDeckLinkDiscovery_FWD_DEFINED__ */ - - -#ifndef __CDeckLinkVideoFrameAncillaryPackets_FWD_DEFINED__ -#define __CDeckLinkVideoFrameAncillaryPackets_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class CDeckLinkVideoFrameAncillaryPackets CDeckLinkVideoFrameAncillaryPackets; -#else -typedef struct CDeckLinkVideoFrameAncillaryPackets CDeckLinkVideoFrameAncillaryPackets; -#endif /* __cplusplus */ - -#endif /* __CDeckLinkVideoFrameAncillaryPackets_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkStatus_v15_3_1_FWD_DEFINED__ -#define __IDeckLinkStatus_v15_3_1_FWD_DEFINED__ -typedef interface IDeckLinkStatus_v15_3_1 IDeckLinkStatus_v15_3_1; - -#endif /* __IDeckLinkStatus_v15_3_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkConfiguration_v15_3_1_FWD_DEFINED__ -#define __IDeckLinkConfiguration_v15_3_1_FWD_DEFINED__ -typedef interface IDeckLinkConfiguration_v15_3_1 IDeckLinkConfiguration_v15_3_1; - -#endif /* __IDeckLinkConfiguration_v15_3_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoBuffer_v15_3_1_FWD_DEFINED__ -#define __IDeckLinkVideoBuffer_v15_3_1_FWD_DEFINED__ -typedef interface IDeckLinkVideoBuffer_v15_3_1 IDeckLinkVideoBuffer_v15_3_1; - -#endif /* __IDeckLinkVideoBuffer_v15_3_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoBufferAllocator_v15_3_1_FWD_DEFINED__ -#define __IDeckLinkVideoBufferAllocator_v15_3_1_FWD_DEFINED__ -typedef interface IDeckLinkVideoBufferAllocator_v15_3_1 IDeckLinkVideoBufferAllocator_v15_3_1; - -#endif /* __IDeckLinkVideoBufferAllocator_v15_3_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoBufferAllocatorProvider_v15_3_1_FWD_DEFINED__ -#define __IDeckLinkVideoBufferAllocatorProvider_v15_3_1_FWD_DEFINED__ -typedef interface IDeckLinkVideoBufferAllocatorProvider_v15_3_1 IDeckLinkVideoBufferAllocatorProvider_v15_3_1; - -#endif /* __IDeckLinkVideoBufferAllocatorProvider_v15_3_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkInput_v15_3_1_FWD_DEFINED__ -#define __IDeckLinkInput_v15_3_1_FWD_DEFINED__ -typedef interface IDeckLinkInput_v15_3_1 IDeckLinkInput_v15_3_1; - -#endif /* __IDeckLinkInput_v15_3_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkOutput_v15_3_1_FWD_DEFINED__ -#define __IDeckLinkOutput_v15_3_1_FWD_DEFINED__ -typedef interface IDeckLinkOutput_v15_3_1 IDeckLinkOutput_v15_3_1; - -#endif /* __IDeckLinkOutput_v15_3_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoConversion_v15_3_1_FWD_DEFINED__ -#define __IDeckLinkVideoConversion_v15_3_1_FWD_DEFINED__ -typedef interface IDeckLinkVideoConversion_v15_3_1 IDeckLinkVideoConversion_v15_3_1; - -#endif /* __IDeckLinkVideoConversion_v15_3_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkNotification_v15_3_1_FWD_DEFINED__ -#define __IDeckLinkNotification_v15_3_1_FWD_DEFINED__ -typedef interface IDeckLinkNotification_v15_3_1 IDeckLinkNotification_v15_3_1; - -#endif /* __IDeckLinkNotification_v15_3_1_FWD_DEFINED__ */ - - -#ifndef __CDeckLinkVideoConversion_v15_3_1_FWD_DEFINED__ -#define __CDeckLinkVideoConversion_v15_3_1_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class CDeckLinkVideoConversion_v15_3_1 CDeckLinkVideoConversion_v15_3_1; -#else -typedef struct CDeckLinkVideoConversion_v15_3_1 CDeckLinkVideoConversion_v15_3_1; -#endif /* __cplusplus */ - -#endif /* __CDeckLinkVideoConversion_v15_3_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkProfileAttributes_v15_3_1_FWD_DEFINED__ -#define __IDeckLinkProfileAttributes_v15_3_1_FWD_DEFINED__ -typedef interface IDeckLinkProfileAttributes_v15_3_1 IDeckLinkProfileAttributes_v15_3_1; - -#endif /* __IDeckLinkProfileAttributes_v15_3_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoOutputCallback_v14_2_1_FWD_DEFINED__ -#define __IDeckLinkVideoOutputCallback_v14_2_1_FWD_DEFINED__ -typedef interface IDeckLinkVideoOutputCallback_v14_2_1 IDeckLinkVideoOutputCallback_v14_2_1; - -#endif /* __IDeckLinkVideoOutputCallback_v14_2_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkInputCallback_v14_2_1_FWD_DEFINED__ -#define __IDeckLinkInputCallback_v14_2_1_FWD_DEFINED__ -typedef interface IDeckLinkInputCallback_v14_2_1 IDeckLinkInputCallback_v14_2_1; - -#endif /* __IDeckLinkInputCallback_v14_2_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkMemoryAllocator_v14_2_1_FWD_DEFINED__ -#define __IDeckLinkMemoryAllocator_v14_2_1_FWD_DEFINED__ -typedef interface IDeckLinkMemoryAllocator_v14_2_1 IDeckLinkMemoryAllocator_v14_2_1; - -#endif /* __IDeckLinkMemoryAllocator_v14_2_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkOutput_v14_2_1_FWD_DEFINED__ -#define __IDeckLinkOutput_v14_2_1_FWD_DEFINED__ -typedef interface IDeckLinkOutput_v14_2_1 IDeckLinkOutput_v14_2_1; - -#endif /* __IDeckLinkOutput_v14_2_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkInput_v14_2_1_FWD_DEFINED__ -#define __IDeckLinkInput_v14_2_1_FWD_DEFINED__ -typedef interface IDeckLinkInput_v14_2_1 IDeckLinkInput_v14_2_1; - -#endif /* __IDeckLinkInput_v14_2_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkEncoderInput_v14_2_1_FWD_DEFINED__ -#define __IDeckLinkEncoderInput_v14_2_1_FWD_DEFINED__ -typedef interface IDeckLinkEncoderInput_v14_2_1 IDeckLinkEncoderInput_v14_2_1; - -#endif /* __IDeckLinkEncoderInput_v14_2_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoFrame_v14_2_1_FWD_DEFINED__ -#define __IDeckLinkVideoFrame_v14_2_1_FWD_DEFINED__ -typedef interface IDeckLinkVideoFrame_v14_2_1 IDeckLinkVideoFrame_v14_2_1; - -#endif /* __IDeckLinkVideoFrame_v14_2_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkMutableVideoFrame_v14_2_1_FWD_DEFINED__ -#define __IDeckLinkMutableVideoFrame_v14_2_1_FWD_DEFINED__ -typedef interface IDeckLinkMutableVideoFrame_v14_2_1 IDeckLinkMutableVideoFrame_v14_2_1; - -#endif /* __IDeckLinkMutableVideoFrame_v14_2_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoFrame3DExtensions_v14_2_1_FWD_DEFINED__ -#define __IDeckLinkVideoFrame3DExtensions_v14_2_1_FWD_DEFINED__ -typedef interface IDeckLinkVideoFrame3DExtensions_v14_2_1 IDeckLinkVideoFrame3DExtensions_v14_2_1; - -#endif /* __IDeckLinkVideoFrame3DExtensions_v14_2_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoInputFrame_v14_2_1_FWD_DEFINED__ -#define __IDeckLinkVideoInputFrame_v14_2_1_FWD_DEFINED__ -typedef interface IDeckLinkVideoInputFrame_v14_2_1 IDeckLinkVideoInputFrame_v14_2_1; - -#endif /* __IDeckLinkVideoInputFrame_v14_2_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkScreenPreviewCallback_v14_2_1_FWD_DEFINED__ -#define __IDeckLinkScreenPreviewCallback_v14_2_1_FWD_DEFINED__ -typedef interface IDeckLinkScreenPreviewCallback_v14_2_1 IDeckLinkScreenPreviewCallback_v14_2_1; - -#endif /* __IDeckLinkScreenPreviewCallback_v14_2_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkGLScreenPreviewHelper_v14_2_1_FWD_DEFINED__ -#define __IDeckLinkGLScreenPreviewHelper_v14_2_1_FWD_DEFINED__ -typedef interface IDeckLinkGLScreenPreviewHelper_v14_2_1 IDeckLinkGLScreenPreviewHelper_v14_2_1; - -#endif /* __IDeckLinkGLScreenPreviewHelper_v14_2_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkDX9ScreenPreviewHelper_v14_2_1_FWD_DEFINED__ -#define __IDeckLinkDX9ScreenPreviewHelper_v14_2_1_FWD_DEFINED__ -typedef interface IDeckLinkDX9ScreenPreviewHelper_v14_2_1 IDeckLinkDX9ScreenPreviewHelper_v14_2_1; - -#endif /* __IDeckLinkDX9ScreenPreviewHelper_v14_2_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1_FWD_DEFINED__ -#define __IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1_FWD_DEFINED__ -typedef interface IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1 IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1; - -#endif /* __IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoConversion_v14_2_1_FWD_DEFINED__ -#define __IDeckLinkVideoConversion_v14_2_1_FWD_DEFINED__ -typedef interface IDeckLinkVideoConversion_v14_2_1 IDeckLinkVideoConversion_v14_2_1; - -#endif /* __IDeckLinkVideoConversion_v14_2_1_FWD_DEFINED__ */ - - -#ifndef __CDeckLinkGLScreenPreviewHelper_v14_2_1_FWD_DEFINED__ -#define __CDeckLinkGLScreenPreviewHelper_v14_2_1_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class CDeckLinkGLScreenPreviewHelper_v14_2_1 CDeckLinkGLScreenPreviewHelper_v14_2_1; -#else -typedef struct CDeckLinkGLScreenPreviewHelper_v14_2_1 CDeckLinkGLScreenPreviewHelper_v14_2_1; -#endif /* __cplusplus */ - -#endif /* __CDeckLinkGLScreenPreviewHelper_v14_2_1_FWD_DEFINED__ */ - - -#ifndef __CDeckLinkGL3ScreenPreviewHelper_v14_2_1_FWD_DEFINED__ -#define __CDeckLinkGL3ScreenPreviewHelper_v14_2_1_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class CDeckLinkGL3ScreenPreviewHelper_v14_2_1 CDeckLinkGL3ScreenPreviewHelper_v14_2_1; -#else -typedef struct CDeckLinkGL3ScreenPreviewHelper_v14_2_1 CDeckLinkGL3ScreenPreviewHelper_v14_2_1; -#endif /* __cplusplus */ - -#endif /* __CDeckLinkGL3ScreenPreviewHelper_v14_2_1_FWD_DEFINED__ */ - - -#ifndef __CDeckLinkDX9ScreenPreviewHelper_v14_2_1_FWD_DEFINED__ -#define __CDeckLinkDX9ScreenPreviewHelper_v14_2_1_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class CDeckLinkDX9ScreenPreviewHelper_v14_2_1 CDeckLinkDX9ScreenPreviewHelper_v14_2_1; -#else -typedef struct CDeckLinkDX9ScreenPreviewHelper_v14_2_1 CDeckLinkDX9ScreenPreviewHelper_v14_2_1; -#endif /* __cplusplus */ - -#endif /* __CDeckLinkDX9ScreenPreviewHelper_v14_2_1_FWD_DEFINED__ */ - - -#ifndef __CDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1_FWD_DEFINED__ -#define __CDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class CDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1 CDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1; -#else -typedef struct CDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1 CDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1; -#endif /* __cplusplus */ - -#endif /* __CDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1_FWD_DEFINED__ */ - - -#ifndef __CDeckLinkVideoConversion_v14_2_1_FWD_DEFINED__ -#define __CDeckLinkVideoConversion_v14_2_1_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class CDeckLinkVideoConversion_v14_2_1 CDeckLinkVideoConversion_v14_2_1; -#else -typedef struct CDeckLinkVideoConversion_v14_2_1 CDeckLinkVideoConversion_v14_2_1; -#endif /* __cplusplus */ - -#endif /* __CDeckLinkVideoConversion_v14_2_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkInputCallback_v11_5_1_FWD_DEFINED__ -#define __IDeckLinkInputCallback_v11_5_1_FWD_DEFINED__ -typedef interface IDeckLinkInputCallback_v11_5_1 IDeckLinkInputCallback_v11_5_1; - -#endif /* __IDeckLinkInputCallback_v11_5_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkInput_v11_5_1_FWD_DEFINED__ -#define __IDeckLinkInput_v11_5_1_FWD_DEFINED__ -typedef interface IDeckLinkInput_v11_5_1 IDeckLinkInput_v11_5_1; - -#endif /* __IDeckLinkInput_v11_5_1_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkConfiguration_v10_11_FWD_DEFINED__ -#define __IDeckLinkConfiguration_v10_11_FWD_DEFINED__ -typedef interface IDeckLinkConfiguration_v10_11 IDeckLinkConfiguration_v10_11; - -#endif /* __IDeckLinkConfiguration_v10_11_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkAttributes_v10_11_FWD_DEFINED__ -#define __IDeckLinkAttributes_v10_11_FWD_DEFINED__ -typedef interface IDeckLinkAttributes_v10_11 IDeckLinkAttributes_v10_11; - -#endif /* __IDeckLinkAttributes_v10_11_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkNotification_v10_11_FWD_DEFINED__ -#define __IDeckLinkNotification_v10_11_FWD_DEFINED__ -typedef interface IDeckLinkNotification_v10_11 IDeckLinkNotification_v10_11; - -#endif /* __IDeckLinkNotification_v10_11_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkOutput_v10_11_FWD_DEFINED__ -#define __IDeckLinkOutput_v10_11_FWD_DEFINED__ -typedef interface IDeckLinkOutput_v10_11 IDeckLinkOutput_v10_11; - -#endif /* __IDeckLinkOutput_v10_11_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkInput_v10_11_FWD_DEFINED__ -#define __IDeckLinkInput_v10_11_FWD_DEFINED__ -typedef interface IDeckLinkInput_v10_11 IDeckLinkInput_v10_11; - -#endif /* __IDeckLinkInput_v10_11_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkEncoderInput_v10_11_FWD_DEFINED__ -#define __IDeckLinkEncoderInput_v10_11_FWD_DEFINED__ -typedef interface IDeckLinkEncoderInput_v10_11 IDeckLinkEncoderInput_v10_11; - -#endif /* __IDeckLinkEncoderInput_v10_11_FWD_DEFINED__ */ - - -#ifndef __CDeckLinkIterator_v10_11_FWD_DEFINED__ -#define __CDeckLinkIterator_v10_11_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class CDeckLinkIterator_v10_11 CDeckLinkIterator_v10_11; -#else -typedef struct CDeckLinkIterator_v10_11 CDeckLinkIterator_v10_11; -#endif /* __cplusplus */ - -#endif /* __CDeckLinkIterator_v10_11_FWD_DEFINED__ */ - - -#ifndef __CDeckLinkDiscovery_v10_11_FWD_DEFINED__ -#define __CDeckLinkDiscovery_v10_11_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class CDeckLinkDiscovery_v10_11 CDeckLinkDiscovery_v10_11; -#else -typedef struct CDeckLinkDiscovery_v10_11 CDeckLinkDiscovery_v10_11; -#endif /* __cplusplus */ - -#endif /* __CDeckLinkDiscovery_v10_11_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkConfiguration_v10_9_FWD_DEFINED__ -#define __IDeckLinkConfiguration_v10_9_FWD_DEFINED__ -typedef interface IDeckLinkConfiguration_v10_9 IDeckLinkConfiguration_v10_9; - -#endif /* __IDeckLinkConfiguration_v10_9_FWD_DEFINED__ */ - - -#ifndef __CBMDStreamingDiscovery_v10_8_FWD_DEFINED__ -#define __CBMDStreamingDiscovery_v10_8_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class CBMDStreamingDiscovery_v10_8 CBMDStreamingDiscovery_v10_8; -#else -typedef struct CBMDStreamingDiscovery_v10_8 CBMDStreamingDiscovery_v10_8; -#endif /* __cplusplus */ - -#endif /* __CBMDStreamingDiscovery_v10_8_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkConfiguration_v10_4_FWD_DEFINED__ -#define __IDeckLinkConfiguration_v10_4_FWD_DEFINED__ -typedef interface IDeckLinkConfiguration_v10_4 IDeckLinkConfiguration_v10_4; - -#endif /* __IDeckLinkConfiguration_v10_4_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkConfiguration_v10_2_FWD_DEFINED__ -#define __IDeckLinkConfiguration_v10_2_FWD_DEFINED__ -typedef interface IDeckLinkConfiguration_v10_2 IDeckLinkConfiguration_v10_2; - -#endif /* __IDeckLinkConfiguration_v10_2_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkAncillaryPacket_v15_2_FWD_DEFINED__ -#define __IDeckLinkAncillaryPacket_v15_2_FWD_DEFINED__ -typedef interface IDeckLinkAncillaryPacket_v15_2 IDeckLinkAncillaryPacket_v15_2; - -#endif /* __IDeckLinkAncillaryPacket_v15_2_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkAncillaryPacketIterator_v15_2_FWD_DEFINED__ -#define __IDeckLinkAncillaryPacketIterator_v15_2_FWD_DEFINED__ -typedef interface IDeckLinkAncillaryPacketIterator_v15_2 IDeckLinkAncillaryPacketIterator_v15_2; - -#endif /* __IDeckLinkAncillaryPacketIterator_v15_2_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoFrameAncillaryPackets_v15_2_FWD_DEFINED__ -#define __IDeckLinkVideoFrameAncillaryPackets_v15_2_FWD_DEFINED__ -typedef interface IDeckLinkVideoFrameAncillaryPackets_v15_2 IDeckLinkVideoFrameAncillaryPackets_v15_2; - -#endif /* __IDeckLinkVideoFrameAncillaryPackets_v15_2_FWD_DEFINED__ */ - - -#ifndef __CDeckLinkVideoFrameAncillaryPackets_v15_2_FWD_DEFINED__ -#define __CDeckLinkVideoFrameAncillaryPackets_v15_2_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class CDeckLinkVideoFrameAncillaryPackets_v15_2 CDeckLinkVideoFrameAncillaryPackets_v15_2; -#else -typedef struct CDeckLinkVideoFrameAncillaryPackets_v15_2 CDeckLinkVideoFrameAncillaryPackets_v15_2; -#endif /* __cplusplus */ - -#endif /* __CDeckLinkVideoFrameAncillaryPackets_v15_2_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkVideoFrameMetadataExtensions_v11_5_FWD_DEFINED__ -#define __IDeckLinkVideoFrameMetadataExtensions_v11_5_FWD_DEFINED__ -typedef interface IDeckLinkVideoFrameMetadataExtensions_v11_5 IDeckLinkVideoFrameMetadataExtensions_v11_5; - -#endif /* __IDeckLinkVideoFrameMetadataExtensions_v11_5_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkOutput_v11_4_FWD_DEFINED__ -#define __IDeckLinkOutput_v11_4_FWD_DEFINED__ -typedef interface IDeckLinkOutput_v11_4 IDeckLinkOutput_v11_4; - -#endif /* __IDeckLinkOutput_v11_4_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkInput_v11_4_FWD_DEFINED__ -#define __IDeckLinkInput_v11_4_FWD_DEFINED__ -typedef interface IDeckLinkInput_v11_4 IDeckLinkInput_v11_4; - -#endif /* __IDeckLinkInput_v11_4_FWD_DEFINED__ */ - - -#ifndef __CDeckLinkIterator_v10_8_FWD_DEFINED__ -#define __CDeckLinkIterator_v10_8_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class CDeckLinkIterator_v10_8 CDeckLinkIterator_v10_8; -#else -typedef struct CDeckLinkIterator_v10_8 CDeckLinkIterator_v10_8; -#endif /* __cplusplus */ - -#endif /* __CDeckLinkIterator_v10_8_FWD_DEFINED__ */ - - -#ifndef __CDeckLinkDiscovery_v10_8_FWD_DEFINED__ -#define __CDeckLinkDiscovery_v10_8_FWD_DEFINED__ - -#ifdef __cplusplus -typedef class CDeckLinkDiscovery_v10_8 CDeckLinkDiscovery_v10_8; -#else -typedef struct CDeckLinkDiscovery_v10_8 CDeckLinkDiscovery_v10_8; -#endif /* __cplusplus */ - -#endif /* __CDeckLinkDiscovery_v10_8_FWD_DEFINED__ */ - - -#ifndef __IDeckLinkEncoderConfiguration_v10_5_FWD_DEFINED__ -#define __IDeckLinkEncoderConfiguration_v10_5_FWD_DEFINED__ -typedef interface IDeckLinkEncoderConfiguration_v10_5 IDeckLinkEncoderConfiguration_v10_5; - -#endif /* __IDeckLinkEncoderConfiguration_v10_5_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 int BMDTimecodeBCD; - -typedef unsigned int BMDTimecodeUserBits; - -typedef LONGLONG BMDIPFlowID; - -typedef unsigned int BMDTimecodeFlags; -#if 0 -typedef enum _BMDTimecodeFlags BMDTimecodeFlags; - -#endif -/* [v1_enum] */ -enum _BMDTimecodeFlags - { - bmdTimecodeFlagDefault = 0, - bmdTimecodeIsDropFrame = ( 1 << 0 ) , - bmdTimecodeFieldMark = ( 1 << 1 ) , - bmdTimecodeColorFrame = ( 1 << 2 ) , - bmdTimecodeEmbedRecordingTrigger = ( 1 << 3 ) , - bmdTimecodeRecordingTriggered = ( 1 << 4 ) - } ; -typedef /* [v1_enum] */ -enum _BMDVideoConnection - { - bmdVideoConnectionUnspecified = 0, - bmdVideoConnectionSDI = ( 1 << 0 ) , - bmdVideoConnectionHDMI = ( 1 << 1 ) , - bmdVideoConnectionOpticalSDI = ( 1 << 2 ) , - bmdVideoConnectionComponent = ( 1 << 3 ) , - bmdVideoConnectionComposite = ( 1 << 4 ) , - bmdVideoConnectionSVideo = ( 1 << 5 ) , - bmdVideoConnectionEthernet = ( 1 << 6 ) , - bmdVideoConnectionOpticalEthernet = ( 1 << 7 ) , - bmdVideoConnectionInternal = ( 1 << 8 ) - } BMDVideoConnection; - -typedef /* [v1_enum] */ -enum _BMDAudioConnection - { - bmdAudioConnectionEmbedded = ( 1 << 0 ) , - bmdAudioConnectionAESEBU = ( 1 << 1 ) , - bmdAudioConnectionAnalog = ( 1 << 2 ) , - bmdAudioConnectionAnalogXLR = ( 1 << 3 ) , - bmdAudioConnectionAnalogRCA = ( 1 << 4 ) , - bmdAudioConnectionMicrophone = ( 1 << 5 ) , - bmdAudioConnectionHeadphones = ( 1 << 6 ) - } BMDAudioConnection; - -typedef /* [v1_enum] */ -enum _BMDDeckControlConnection - { - bmdDeckControlConnectionRS422Remote1 = ( 1 << 0 ) , - bmdDeckControlConnectionRS422Remote2 = ( 1 << 1 ) - } BMDDeckControlConnection; - - -typedef unsigned int BMDDisplayModeFlags; -#if 0 -typedef enum _BMDDisplayModeFlags BMDDisplayModeFlags; - -#endif -typedef /* [v1_enum] */ -enum _BMDDisplayMode - { - bmdModeNTSC = 0x6e747363, - bmdModeNTSC2398 = 0x6e743233, - bmdModePAL = 0x70616c20, - bmdModeNTSCp = 0x6e747370, - bmdModePALp = 0x70616c70, - bmdModeHD1080p2398 = 0x32337073, - bmdModeHD1080p24 = 0x32347073, - bmdModeHD1080p25 = 0x48703235, - bmdModeHD1080p2997 = 0x48703239, - bmdModeHD1080p30 = 0x48703330, - bmdModeHD1080p4795 = 0x48703437, - bmdModeHD1080p48 = 0x48703438, - bmdModeHD1080p50 = 0x48703530, - bmdModeHD1080p5994 = 0x48703539, - bmdModeHD1080p6000 = 0x48703630, - bmdModeHD1080p9590 = 0x48703935, - bmdModeHD1080p96 = 0x48703936, - bmdModeHD1080p100 = 0x48703130, - bmdModeHD1080p11988 = 0x48703131, - bmdModeHD1080p120 = 0x48703132, - bmdModeHD1080i50 = 0x48693530, - bmdModeHD1080i5994 = 0x48693539, - bmdModeHD1080i6000 = 0x48693630, - bmdModeHD720p50 = 0x68703530, - bmdModeHD720p5994 = 0x68703539, - bmdModeHD720p60 = 0x68703630, - bmdMode2k2398 = 0x326b3233, - bmdMode2k24 = 0x326b3234, - bmdMode2k25 = 0x326b3235, - bmdMode2kDCI2398 = 0x32643233, - bmdMode2kDCI24 = 0x32643234, - bmdMode2kDCI25 = 0x32643235, - bmdMode2kDCI2997 = 0x32643239, - bmdMode2kDCI30 = 0x32643330, - bmdMode2kDCI4795 = 0x32643437, - bmdMode2kDCI48 = 0x32643438, - bmdMode2kDCI50 = 0x32643530, - bmdMode2kDCI5994 = 0x32643539, - bmdMode2kDCI60 = 0x32643630, - bmdMode2kDCI9590 = 0x32643935, - bmdMode2kDCI96 = 0x32643936, - bmdMode2kDCI100 = 0x32643130, - bmdMode2kDCI11988 = 0x32643131, - bmdMode2kDCI120 = 0x32643132, - bmdMode4K2160p2398 = 0x346b3233, - bmdMode4K2160p24 = 0x346b3234, - bmdMode4K2160p25 = 0x346b3235, - bmdMode4K2160p2997 = 0x346b3239, - bmdMode4K2160p30 = 0x346b3330, - bmdMode4K2160p4795 = 0x346b3437, - bmdMode4K2160p48 = 0x346b3438, - bmdMode4K2160p50 = 0x346b3530, - bmdMode4K2160p5994 = 0x346b3539, - bmdMode4K2160p60 = 0x346b3630, - bmdMode4K2160p9590 = 0x346b3935, - bmdMode4K2160p96 = 0x346b3936, - bmdMode4K2160p100 = 0x346b3130, - bmdMode4K2160p11988 = 0x346b3131, - bmdMode4K2160p120 = 0x346b3132, - bmdMode4kDCI2398 = 0x34643233, - bmdMode4kDCI24 = 0x34643234, - bmdMode4kDCI25 = 0x34643235, - bmdMode4kDCI2997 = 0x34643239, - bmdMode4kDCI30 = 0x34643330, - bmdMode4kDCI4795 = 0x34643437, - bmdMode4kDCI48 = 0x34643438, - bmdMode4kDCI50 = 0x34643530, - bmdMode4kDCI5994 = 0x34643539, - bmdMode4kDCI60 = 0x34643630, - bmdMode4kDCI9590 = 0x34643935, - bmdMode4kDCI96 = 0x34643936, - bmdMode4kDCI100 = 0x34643130, - bmdMode4kDCI11988 = 0x34643131, - bmdMode4kDCI120 = 0x34643132, - bmdMode8K4320p2398 = 0x386b3233, - bmdMode8K4320p24 = 0x386b3234, - bmdMode8K4320p25 = 0x386b3235, - bmdMode8K4320p2997 = 0x386b3239, - bmdMode8K4320p30 = 0x386b3330, - bmdMode8K4320p4795 = 0x386b3437, - bmdMode8K4320p48 = 0x386b3438, - bmdMode8K4320p50 = 0x386b3530, - bmdMode8K4320p5994 = 0x386b3539, - bmdMode8K4320p60 = 0x386b3630, - bmdMode8kDCI2398 = 0x38643233, - bmdMode8kDCI24 = 0x38643234, - bmdMode8kDCI25 = 0x38643235, - bmdMode8kDCI2997 = 0x38643239, - bmdMode8kDCI30 = 0x38643330, - bmdMode8kDCI4795 = 0x38643437, - bmdMode8kDCI48 = 0x38643438, - bmdMode8kDCI50 = 0x38643530, - bmdMode8kDCI5994 = 0x38643539, - bmdMode8kDCI60 = 0x38643630, - bmdMode640x480p60 = 0x76676136, - bmdMode800x600p60 = 0x73766736, - bmdMode1440x900p50 = 0x77786735, - bmdMode1440x900p60 = 0x77786736, - bmdMode1440x1080p50 = 0x73786735, - bmdMode1440x1080p60 = 0x73786736, - bmdMode1600x1200p50 = 0x75786735, - bmdMode1600x1200p60 = 0x75786736, - bmdMode1920x1200p50 = 0x77757835, - bmdMode1920x1200p60 = 0x77757836, - bmdMode1920x1440p50 = 0x31393435, - bmdMode1920x1440p60 = 0x31393436, - bmdMode2560x1440p50 = 0x77716835, - bmdMode2560x1440p60 = 0x77716836, - bmdMode2560x1600p50 = 0x77717835, - bmdMode2560x1600p60 = 0x77717836, - bmdModeUnknown = 0x69756e6b - } BMDDisplayMode; - -typedef /* [v1_enum] */ -enum _BMDFieldDominance - { - bmdUnknownFieldDominance = 0, - bmdLowerFieldFirst = 0x6c6f7772, - bmdUpperFieldFirst = 0x75707072, - bmdProgressiveFrame = 0x70726f67, - bmdProgressiveSegmentedFrame = 0x70736620 - } BMDFieldDominance; - -typedef /* [v1_enum] */ -enum _BMDPixelFormat - { - bmdFormatUnspecified = 0, - bmdFormat8BitYUV = 0x32767579, - bmdFormat10BitYUV = 0x76323130, - bmdFormat10BitYUVA = 0x41793130, - bmdFormat8BitARGB = 32, - bmdFormat8BitBGRA = 0x42475241, - bmdFormat10BitRGB = 0x72323130, - bmdFormat12BitRGB = 0x52313242, - bmdFormat12BitRGBLE = 0x5231324c, - bmdFormat10BitRGBXLE = 0x5231306c, - bmdFormat10BitRGBX = 0x52313062, - bmdFormatH265 = 0x68657631, - bmdFormatDNxHR = 0x41566468 - } BMDPixelFormat; - -/* [v1_enum] */ -enum _BMDDisplayModeFlags - { - bmdDisplayModeSupports3D = ( 1 << 0 ) , - bmdDisplayModeColorspaceRec601 = ( 1 << 1 ) , - bmdDisplayModeColorspaceRec709 = ( 1 << 2 ) , - bmdDisplayModeColorspaceRec2020 = ( 1 << 3 ) - } ; - - -#if 0 -#endif - -#if 0 -#endif -typedef /* [v1_enum] */ -enum _BMDDeckLinkConfigurationID - { - bmdDeckLinkConfigSwapSerialRxTx = 0x73737274, - bmdDeckLinkConfigHDMI3DPackingFormat = 0x33647066, - bmdDeckLinkConfigBypass = 0x62797073, - bmdDeckLinkConfigClockTimingAdjustment = 0x63746164, - bmdDeckLinkConfigAudioMeterType = 0x61756d74, - bmdDeckLinkConfigAnalogAudioConsumerLevels = 0x6161636c, - bmdDeckLinkConfigSwapHDMICh3AndCh4OnInput = 0x68693334, - bmdDeckLinkConfigSwapHDMICh3AndCh4OnOutput = 0x686f3334, - bmdDeckLinkConfigAnalogAudioOutputChannelsMutedByHeadphone = 0x616d6870, - bmdDeckLinkConfigAnalogAudioOutputChannelsMutedBySpeaker = 0x616d7370, - bmdDeckLinkConfigFieldFlickerRemoval = 0x66646672, - bmdDeckLinkConfigHD1080p24ToHD1080i5994Conversion = 0x746f3539, - bmdDeckLinkConfig444SDIVideoOutput = 0x3434346f, - bmdDeckLinkConfigBlackVideoOutputDuringCapture = 0x62766f63, - bmdDeckLinkConfigLowLatencyVideoOutput = 0x6c6c766f, - bmdDeckLinkConfigDownConversionOnAllAnalogOutput = 0x6361616f, - bmdDeckLinkConfigSMPTELevelAOutput = 0x736d7461, - bmdDeckLinkConfigRec2020Output = 0x72656332, - bmdDeckLinkConfigQuadLinkSDIVideoOutputSquareDivisionSplit = 0x53445153, - bmdDeckLinkConfigOutput1080pAsPsF = 0x70667072, - bmdDeckLinkConfigOutputValidateEDIDForDolbyVision = 0x70726564, - bmdDeckLinkConfigExtendedDesktop = 0x65786474, - bmdDeckLinkConfigEthernetVideoOutputIP10 = 0x49503130, - bmdDeckLinkConfigVideoOutputConnection = 0x766f636e, - bmdDeckLinkConfigVideoOutputConversionMode = 0x766f636d, - bmdDeckLinkConfigVideoOutputConversionColorspaceDestination = 0x76636364, - bmdDeckLinkConfigVideoOutputConversionColorspaceSource = 0x76636373, - bmdDeckLinkConfigAnalogVideoOutputFlags = 0x61766f66, - bmdDeckLinkConfigReferenceInputTimingOffset = 0x676c6f74, - bmdDeckLinkConfigReferenceOutputMode = 0x676c4f6d, - bmdDeckLinkConfigVideoOutputIdleOperation = 0x766f696f, - bmdDeckLinkConfigDefaultVideoOutputMode = 0x64766f6d, - bmdDeckLinkConfigDefaultVideoOutputModeFlags = 0x64766f66, - bmdDeckLinkConfigSDIOutputLinkConfiguration = 0x736f6c63, - bmdDeckLinkConfigHDMITimecodePacking = 0x6874706b, - bmdDeckLinkConfigPlaybackGroup = 0x706c6772, - bmdDeckLinkConfigVideoOutputComponentLumaGain = 0x6f636c67, - bmdDeckLinkConfigVideoOutputComponentChromaBlueGain = 0x6f636362, - bmdDeckLinkConfigVideoOutputComponentChromaRedGain = 0x6f636372, - bmdDeckLinkConfigVideoOutputCompositeLumaGain = 0x6f696c67, - bmdDeckLinkConfigVideoOutputCompositeChromaGain = 0x6f696367, - bmdDeckLinkConfigVideoOutputSVideoLumaGain = 0x6f736c67, - bmdDeckLinkConfigVideoOutputSVideoChromaGain = 0x6f736367, - bmdDeckLinkConfigDolbyVisionCMVersion = 0x64767672, - bmdDeckLinkConfigDolbyVisionMasterMinimumNits = 0x6d6e6e74, - bmdDeckLinkConfigDolbyVisionMasterMaximumNits = 0x6d786e74, - bmdDeckLinkConfigVideoInputScanning = 0x76697363, - bmdDeckLinkConfigUseDedicatedLTCInput = 0x646c7463, - bmdDeckLinkConfigSDIInput3DPayloadOverride = 0x33646473, - bmdDeckLinkConfigCapture1080pAsPsF = 0x63667072, - bmdDeckLinkConfigVideoInputConnection = 0x7669636e, - bmdDeckLinkConfigAnalogVideoInputFlags = 0x61766966, - bmdDeckLinkConfigVideoInputConversionMode = 0x7669636d, - bmdDeckLinkConfig32PulldownSequenceInitialTimecodeFrame = 0x70646966, - bmdDeckLinkConfigVANCSourceLine1Mapping = 0x76736c31, - bmdDeckLinkConfigVANCSourceLine2Mapping = 0x76736c32, - bmdDeckLinkConfigVANCSourceLine3Mapping = 0x76736c33, - bmdDeckLinkConfigCapturePassThroughMode = 0x6370746d, - bmdDeckLinkConfigCaptureGroup = 0x63706772, - bmdDeckLinkConfigHANCInputFilter1 = 0x68696631, - bmdDeckLinkConfigHANCInputFilter2 = 0x68696632, - bmdDeckLinkConfigHANCInputFilter3 = 0x68696633, - bmdDeckLinkConfigHANCInputFilter4 = 0x68696634, - bmdDeckLinkConfigVideoInputComponentLumaGain = 0x69636c67, - bmdDeckLinkConfigVideoInputComponentChromaBlueGain = 0x69636362, - bmdDeckLinkConfigVideoInputComponentChromaRedGain = 0x69636372, - bmdDeckLinkConfigVideoInputCompositeLumaGain = 0x69696c67, - bmdDeckLinkConfigVideoInputCompositeChromaGain = 0x69696367, - bmdDeckLinkConfigVideoInputSVideoLumaGain = 0x69736c67, - bmdDeckLinkConfigVideoInputSVideoChromaGain = 0x69736367, - bmdDeckLinkConfigInternalKeyingAncillaryDataSource = 0x696b6173, - bmdDeckLinkConfigMicrophonePhantomPower = 0x6d706870, - bmdDeckLinkConfigAudioInputConnection = 0x6169636e, - bmdDeckLinkConfigAnalogAudioInputScaleChannel1 = 0x61697331, - bmdDeckLinkConfigAnalogAudioInputScaleChannel2 = 0x61697332, - bmdDeckLinkConfigAnalogAudioInputScaleChannel3 = 0x61697333, - bmdDeckLinkConfigAnalogAudioInputScaleChannel4 = 0x61697334, - bmdDeckLinkConfigDigitalAudioInputScale = 0x64616973, - bmdDeckLinkConfigMicrophoneInputGain = 0x6d696367, - bmdDeckLinkConfigAudioOutputXLRDelayFrames = 0x78646672, - bmdDeckLinkConfigAudioOutputAESAnalogSwitch = 0x616f6161, - bmdDeckLinkConfigAudioOutputXLRDelayTime = 0x78646d73, - bmdDeckLinkConfigAudioOutputXLRDelayType = 0x78647479, - bmdDeckLinkConfigAnalogAudioOutputScaleChannel1 = 0x616f7331, - bmdDeckLinkConfigAnalogAudioOutputScaleChannel2 = 0x616f7332, - bmdDeckLinkConfigAnalogAudioOutputScaleChannel3 = 0x616f7333, - bmdDeckLinkConfigAnalogAudioOutputScaleChannel4 = 0x616f7334, - bmdDeckLinkConfigDigitalAudioOutputScale = 0x64616f73, - bmdDeckLinkConfigHeadphoneVolume = 0x68766f6c, - bmdDeckLinkConfigSpeakerVolume = 0x73766f6c, - bmdDeckLinkConfigEthernetPTPFollowerOnly = 0x50545066, - bmdDeckLinkConfigEthernetPTPUseUDPEncapsulation = 0x50545055, - bmdDeckLinkConfigEthernetUseManualNMOSRegistry = 0x6e6d7270, - bmdDeckLinkConfigEthernetPTPPriority1 = 0x50545031, - bmdDeckLinkConfigEthernetPTPPriority2 = 0x50545032, - bmdDeckLinkConfigEthernetPTPDomain = 0x50545044, - bmdDeckLinkConfigEthernetPTPLogAnnounceInterval = 0x50545041, - bmdDeckLinkConfigEthernetAudioOutputChannelOrder = 0x6361636f, - bmdDeckLinkConfigEthernetNMOSRegistryAddress = 0x6e6d7265, - bmdDeckLinkConfigParamEthernetUseDHCP = 0x44484350, - bmdDeckLinkConfigParamEthernetStaticLocalIPAddress = 0x6e736970, - bmdDeckLinkConfigParamEthernetStaticSubnetMask = 0x6e73736d, - bmdDeckLinkConfigParamEthernetStaticGatewayIPAddress = 0x6e736777, - bmdDeckLinkConfigParamEthernetStaticPrimaryDNS = 0x6e737064, - bmdDeckLinkConfigParamEthernetStaticSecondaryDNS = 0x6e737364, - bmdDeckLinkConfigParamEthernetVideoOutputAddress = 0x6e6f6176, - bmdDeckLinkConfigParamEthernetAudioOutputAddress = 0x6e6f6161, - bmdDeckLinkConfigParamEthernetAncillaryOutputAddress = 0x6e6f6141, - bmdDeckLinkConfigDeviceInformationLabel = 0x64696c61, - bmdDeckLinkConfigDeviceInformationSerialNumber = 0x6469736e, - bmdDeckLinkConfigDeviceInformationCompany = 0x6469636f, - bmdDeckLinkConfigDeviceInformationPhone = 0x64697068, - bmdDeckLinkConfigDeviceInformationEmail = 0x6469656d, - bmdDeckLinkConfigDeviceInformationDate = 0x64696461, - bmdDeckLinkConfigDeckControlConnection = 0x6463636f, - bmdDeckLinkConfigDisplayLanguage = 0x6c616e67 - } BMDDeckLinkConfigurationID; - -typedef /* [v1_enum] */ -enum _BMDDeckLinkEncoderConfigurationID - { - bmdDeckLinkEncoderConfigPreferredBitDepth = 0x65706272, - bmdDeckLinkEncoderConfigFrameCodingMode = 0x6566636d, - bmdDeckLinkEncoderConfigH265TargetBitrate = 0x68746272, - bmdDeckLinkEncoderConfigDNxHRCompressionID = 0x64636964, - bmdDeckLinkEncoderConfigDNxHRLevel = 0x646c6576, - bmdDeckLinkEncoderConfigMPEG4SampleDescription = 0x73747345, - bmdDeckLinkEncoderConfigMPEG4CodecSpecificDesc = 0x65736473 - } BMDDeckLinkEncoderConfigurationID; - - - -typedef unsigned int BMDDeckControlStatusFlags; -typedef unsigned int BMDDeckControlExportModeOpsFlags; -#if 0 -typedef enum _BMDDeckControlStatusFlags BMDDeckControlStatusFlags; - -typedef enum _BMDDeckControlExportModeOpsFlags BMDDeckControlExportModeOpsFlags; - -#endif -typedef /* [v1_enum] */ -enum _BMDDeckControlMode - { - bmdDeckControlNotOpened = 0x6e746f70, - bmdDeckControlVTRControlMode = 0x76747263, - bmdDeckControlExportMode = 0x6578706d, - bmdDeckControlCaptureMode = 0x6361706d - } BMDDeckControlMode; - -typedef /* [v1_enum] */ -enum _BMDDeckControlEvent - { - bmdDeckControlAbortedEvent = 0x61627465, - bmdDeckControlPrepareForExportEvent = 0x70666565, - bmdDeckControlExportCompleteEvent = 0x65786365, - bmdDeckControlPrepareForCaptureEvent = 0x70666365, - bmdDeckControlCaptureCompleteEvent = 0x63636576 - } BMDDeckControlEvent; - -typedef /* [v1_enum] */ -enum _BMDDeckControlVTRControlState - { - bmdDeckControlNotInVTRControlMode = 0x6e76636d, - bmdDeckControlVTRControlPlaying = 0x76747270, - bmdDeckControlVTRControlRecording = 0x76747272, - bmdDeckControlVTRControlStill = 0x76747261, - bmdDeckControlVTRControlShuttleForward = 0x76747366, - bmdDeckControlVTRControlShuttleReverse = 0x76747372, - bmdDeckControlVTRControlJogForward = 0x76746a66, - bmdDeckControlVTRControlJogReverse = 0x76746a72, - bmdDeckControlVTRControlStopped = 0x7674726f - } BMDDeckControlVTRControlState; - -/* [v1_enum] */ -enum _BMDDeckControlStatusFlags - { - bmdDeckControlStatusDeckConnected = ( 1 << 0 ) , - bmdDeckControlStatusRemoteMode = ( 1 << 1 ) , - bmdDeckControlStatusRecordInhibited = ( 1 << 2 ) , - bmdDeckControlStatusCassetteOut = ( 1 << 3 ) - } ; -/* [v1_enum] */ -enum _BMDDeckControlExportModeOpsFlags - { - bmdDeckControlExportModeInsertVideo = ( 1 << 0 ) , - bmdDeckControlExportModeInsertAudio1 = ( 1 << 1 ) , - bmdDeckControlExportModeInsertAudio2 = ( 1 << 2 ) , - bmdDeckControlExportModeInsertAudio3 = ( 1 << 3 ) , - bmdDeckControlExportModeInsertAudio4 = ( 1 << 4 ) , - bmdDeckControlExportModeInsertAudio5 = ( 1 << 5 ) , - bmdDeckControlExportModeInsertAudio6 = ( 1 << 6 ) , - bmdDeckControlExportModeInsertAudio7 = ( 1 << 7 ) , - bmdDeckControlExportModeInsertAudio8 = ( 1 << 8 ) , - bmdDeckControlExportModeInsertAudio9 = ( 1 << 9 ) , - bmdDeckControlExportModeInsertAudio10 = ( 1 << 10 ) , - bmdDeckControlExportModeInsertAudio11 = ( 1 << 11 ) , - bmdDeckControlExportModeInsertAudio12 = ( 1 << 12 ) , - bmdDeckControlExportModeInsertTimeCode = ( 1 << 13 ) , - bmdDeckControlExportModeInsertAssemble = ( 1 << 14 ) , - bmdDeckControlExportModeInsertPreview = ( 1 << 15 ) , - bmdDeckControlUseManualExport = ( 1 << 16 ) - } ; -typedef /* [v1_enum] */ -enum _BMDDeckControlError - { - bmdDeckControlNoError = 0x6e6f6572, - bmdDeckControlModeError = 0x6d6f6572, - bmdDeckControlMissedInPointError = 0x6d696572, - bmdDeckControlDeckTimeoutError = 0x64746572, - bmdDeckControlCommandFailedError = 0x63666572, - bmdDeckControlDeviceAlreadyOpenedError = 0x64616c6f, - bmdDeckControlFailedToOpenDeviceError = 0x66646572, - bmdDeckControlInLocalModeError = 0x6c6d6572, - bmdDeckControlEndOfTapeError = 0x65746572, - bmdDeckControlUserAbortError = 0x75616572, - bmdDeckControlNoTapeInDeckError = 0x6e746572, - bmdDeckControlNoVideoFromCardError = 0x6e766663, - bmdDeckControlNoCommunicationError = 0x6e636f6d, - bmdDeckControlBufferTooSmallError = 0x6274736d, - bmdDeckControlBadChecksumError = 0x63686b73, - bmdDeckControlUnknownError = 0x756e6572 - } BMDDeckControlError; - - - -#if 0 -#endif -typedef /* [v1_enum] */ -enum _BMDStreamingDeviceMode - { - bmdStreamingDeviceIdle = 0x69646c65, - bmdStreamingDeviceEncoding = 0x656e636f, - bmdStreamingDeviceStopping = 0x73746f70, - bmdStreamingDeviceUnknown = 0x6d756e6b - } BMDStreamingDeviceMode; - -typedef /* [v1_enum] */ -enum _BMDStreamingEncodingFrameRate - { - bmdStreamingEncodedFrameRate50i = 0x65353069, - bmdStreamingEncodedFrameRate5994i = 0x65353969, - bmdStreamingEncodedFrameRate60i = 0x65363069, - bmdStreamingEncodedFrameRate2398p = 0x65323370, - bmdStreamingEncodedFrameRate24p = 0x65323470, - bmdStreamingEncodedFrameRate25p = 0x65323570, - bmdStreamingEncodedFrameRate2997p = 0x65323970, - bmdStreamingEncodedFrameRate30p = 0x65333070, - bmdStreamingEncodedFrameRate50p = 0x65353070, - bmdStreamingEncodedFrameRate5994p = 0x65353970, - bmdStreamingEncodedFrameRate60p = 0x65363070 - } BMDStreamingEncodingFrameRate; - -typedef /* [v1_enum] */ -enum _BMDStreamingEncodingSupport - { - bmdStreamingEncodingModeNotSupported = 0, - bmdStreamingEncodingModeSupported = ( bmdStreamingEncodingModeNotSupported + 1 ) , - bmdStreamingEncodingModeSupportedWithChanges = ( bmdStreamingEncodingModeSupported + 1 ) - } BMDStreamingEncodingSupport; - -typedef /* [v1_enum] */ -enum _BMDStreamingVideoCodec - { - bmdStreamingVideoCodecH264 = 0x48323634 - } BMDStreamingVideoCodec; - -typedef /* [v1_enum] */ -enum _BMDStreamingH264Profile - { - bmdStreamingH264ProfileHigh = 0x68696768, - bmdStreamingH264ProfileMain = 0x6d61696e, - bmdStreamingH264ProfileBaseline = 0x62617365 - } BMDStreamingH264Profile; - -typedef /* [v1_enum] */ -enum _BMDStreamingH264Level - { - bmdStreamingH264Level12 = 0x6c763132, - bmdStreamingH264Level13 = 0x6c763133, - bmdStreamingH264Level2 = 0x6c763220, - bmdStreamingH264Level21 = 0x6c763231, - bmdStreamingH264Level22 = 0x6c763232, - bmdStreamingH264Level3 = 0x6c763320, - bmdStreamingH264Level31 = 0x6c763331, - bmdStreamingH264Level32 = 0x6c763332, - bmdStreamingH264Level4 = 0x6c763420, - bmdStreamingH264Level41 = 0x6c763431, - bmdStreamingH264Level42 = 0x6c763432 - } BMDStreamingH264Level; - -typedef /* [v1_enum] */ -enum _BMDStreamingH264EntropyCoding - { - bmdStreamingH264EntropyCodingCAVLC = 0x45564c43, - bmdStreamingH264EntropyCodingCABAC = 0x45424143 - } BMDStreamingH264EntropyCoding; - -typedef /* [v1_enum] */ -enum _BMDStreamingAudioCodec - { - bmdStreamingAudioCodecAAC = 0x41414320 - } BMDStreamingAudioCodec; - -typedef /* [v1_enum] */ -enum _BMDStreamingEncodingModePropertyID - { - bmdStreamingEncodingPropertyVideoFrameRate = 0x76667274, - bmdStreamingEncodingPropertyVideoBitRateKbps = 0x76627274, - bmdStreamingEncodingPropertyH264Profile = 0x68707266, - bmdStreamingEncodingPropertyH264Level = 0x686c766c, - bmdStreamingEncodingPropertyH264EntropyCoding = 0x68656e74, - bmdStreamingEncodingPropertyH264HasBFrames = 0x68426672, - bmdStreamingEncodingPropertyAudioCodec = 0x61636463, - bmdStreamingEncodingPropertyAudioSampleRate = 0x61737274, - bmdStreamingEncodingPropertyAudioChannelCount = 0x61636863, - bmdStreamingEncodingPropertyAudioBitRateKbps = 0x61627274 - } BMDStreamingEncodingModePropertyID; - - - - - - - - - - - - -typedef unsigned int BMDBufferAccessFlags; -typedef unsigned int BMDFrameFlags; -typedef unsigned int BMDVideoInputFlags; -typedef unsigned int BMDVideoInputFormatChangedEvents; -typedef unsigned int BMDDetectedVideoInputFormatFlags; -typedef unsigned int BMDDeckLinkCapturePassthroughMode; -typedef unsigned int BMDAnalogVideoFlags; -typedef unsigned int BMDAudioOutputXLRDelayType; -typedef unsigned int BMDFormatFlags; -typedef unsigned int BMDDeviceBusyState; -#if 0 -typedef enum _BMDBufferAccessFlags BMDBufferAccessFlags; - -typedef enum _BMDFrameFlags BMDFrameFlags; - -typedef enum _BMDVideoInputFlags BMDVideoInputFlags; - -typedef enum _BMDVideoInputFormatChangedEvents BMDVideoInputFormatChangedEvents; - -typedef enum _BMDDetectedVideoInputFormatFlags BMDDetectedVideoInputFormatFlags; - -typedef enum _BMDDeckLinkCapturePassthroughMode BMDDeckLinkCapturePassthroughMode; - -typedef enum _BMDAnalogVideoFlags BMDAnalogVideoFlags; - -typedef enum _BMDAudioOutputXLRDelayType BMDAudioOutputXLRDelayType; - -typedef enum _BMDFormatFlags BMDFormatFlags; - -typedef enum _BMDDeviceBusyState BMDDeviceBusyState; - -#endif -/* [v1_enum] */ -enum _BMDBufferAccessFlags - { - bmdBufferAccessReadAndWrite = ( ( 1 << 0 ) | ( 1 << 1 ) ) , - bmdBufferAccessRead = ( 1 << 0 ) , - bmdBufferAccessWrite = ( 1 << 1 ) - } ; -typedef /* [v1_enum] */ -enum _BMDVideoOutputFlags - { - bmdVideoOutputFlagDefault = 0, - bmdVideoOutputVANC = ( 1 << 0 ) , - bmdVideoOutputVITC = ( 1 << 1 ) , - bmdVideoOutputRP188 = ( 1 << 2 ) , - bmdVideoOutputDualStream3D = ( 1 << 4 ) , - bmdVideoOutputSynchronizeToPlaybackGroup = ( 1 << 6 ) , - bmdVideoOutputDolbyVision = ( 1 << 7 ) - } BMDVideoOutputFlags; - -typedef /* [v1_enum] */ -enum _BMDSupportedVideoModeFlags - { - bmdSupportedVideoModeDefault = 0, - bmdSupportedVideoModeKeying = ( 1 << 0 ) , - bmdSupportedVideoModeDualStream3D = ( 1 << 1 ) , - bmdSupportedVideoModeSDISingleLink = ( 1 << 2 ) , - bmdSupportedVideoModeSDIDualLink = ( 1 << 3 ) , - bmdSupportedVideoModeSDIQuadLink = ( 1 << 4 ) , - bmdSupportedVideoModeInAnyProfile = ( 1 << 5 ) , - bmdSupportedVideoModePsF = ( 1 << 6 ) , - bmdSupportedVideoModeDolbyVision = ( 1 << 7 ) , - bmdSupportedVideoModeEthernetIP10 = ( 1 << 8 ) - } BMDSupportedVideoModeFlags; - -typedef /* [v1_enum] */ -enum _BMDPacketType - { - bmdPacketTypeStreamInterruptedMarker = 0x73696e74, - bmdPacketTypeStreamData = 0x73646174 - } BMDPacketType; - -/* [v1_enum] */ -enum _BMDFrameFlags - { - bmdFrameFlagDefault = 0, - bmdFrameFlagFlipVertical = ( 1 << 0 ) , - bmdFrameFlagMonitorOutOnly = ( 1 << 3 ) , - bmdFrameContainsHDRMetadata = ( 1 << 1 ) , - bmdFrameContainsDolbyVisionMetadata = ( 1 << 4 ) , - bmdFrameCapturedAsPsF = ( 1 << 30 ) , - bmdFrameHasNoInputSource = ( 1 << 31 ) - } ; -/* [v1_enum] */ -enum _BMDVideoInputFlags - { - bmdVideoInputFlagDefault = 0, - bmdVideoInputEnableFormatDetection = ( 1 << 0 ) , - bmdVideoInputDualStream3D = ( 1 << 1 ) , - bmdVideoInputSynchronizeToCaptureGroup = ( 1 << 2 ) - } ; -/* [v1_enum] */ -enum _BMDVideoInputFormatChangedEvents - { - bmdVideoInputDisplayModeChanged = ( 1 << 0 ) , - bmdVideoInputFieldDominanceChanged = ( 1 << 1 ) , - bmdVideoInputColorspaceChanged = ( 1 << 2 ) - } ; -/* [v1_enum] */ -enum _BMDDetectedVideoInputFormatFlags - { - bmdDetectedVideoInputYCbCr422 = ( 1 << 0 ) , - bmdDetectedVideoInputRGB444 = ( 1 << 1 ) , - bmdDetectedVideoInputDualStream3D = ( 1 << 2 ) , - bmdDetectedVideoInput12BitDepth = ( 1 << 3 ) , - bmdDetectedVideoInput10BitDepth = ( 1 << 4 ) , - bmdDetectedVideoInput8BitDepth = ( 1 << 5 ) - } ; -/* [v1_enum] */ -enum _BMDDeckLinkCapturePassthroughMode - { - bmdDeckLinkCapturePassthroughModeDisabled = 0x70646973, - bmdDeckLinkCapturePassthroughModeDirect = 0x70646972, - bmdDeckLinkCapturePassthroughModeCleanSwitch = 0x70636c6e - } ; -typedef /* [v1_enum] */ -enum _BMDOutputFrameCompletionResult - { - bmdOutputFrameCompleted = 0, - bmdOutputFrameDisplayedLate = ( bmdOutputFrameCompleted + 1 ) , - bmdOutputFrameDropped = ( bmdOutputFrameDisplayedLate + 1 ) , - bmdOutputFrameFlushed = ( bmdOutputFrameDropped + 1 ) - } BMDOutputFrameCompletionResult; - -typedef /* [v1_enum] */ -enum _BMDReferenceStatus - { - bmdReferenceUnlocked = 0, - bmdReferenceNotSupportedByHardware = ( 1 << 0 ) , - bmdReferenceLocked = ( 1 << 1 ) - } BMDReferenceStatus; - -typedef /* [v1_enum] */ -enum _BMDEthernetNMOSRegistryState - { - bmdEthernetNMOSRegistryConnecting = 0x636f6e6e, - bmdEthernetNMOSRegistryActive = 0x676f6f64, - bmdEthernetNMOSRegistryError = 0x6572726f - } BMDEthernetNMOSRegistryState; - -typedef /* [v1_enum] */ -enum _BMDAudioFormat - { - bmdAudioFormatPCM = 0x6c70636d - } BMDAudioFormat; - -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 _BMDAncillaryPacketFormat - { - bmdAncillaryPacketFormatUInt8 = 0x75693038, - bmdAncillaryPacketFormatUInt16 = 0x75693136, - bmdAncillaryPacketFormatYCbCr10 = 0x76323130 - } BMDAncillaryPacketFormat; - -typedef /* [v1_enum] */ -enum _BMDTimecodeFormat - { - bmdTimecodeRP188VITC1 = 0x72707631, - bmdTimecodeRP188VITC2 = 0x72703132, - bmdTimecodeRP188LTC = 0x72706c74, - bmdTimecodeRP188HighFrameRate = 0x72706872, - bmdTimecodeRP188Any = 0x72703138, - bmdTimecodeVITC = 0x76697463, - bmdTimecodeVITCField2 = 0x76697432, - bmdTimecodeSerial = 0x73657269 - } BMDTimecodeFormat; - -/* [v1_enum] */ -enum _BMDAnalogVideoFlags - { - bmdAnalogVideoFlagCompositeSetup75 = ( 1 << 0 ) , - bmdAnalogVideoFlagComponentBetacamLevels = ( 1 << 1 ) - } ; -typedef /* [v1_enum] */ -enum _BMDAudioOutputAnalogAESSwitch - { - bmdAudioOutputSwitchAESEBU = 0x61657320, - bmdAudioOutputSwitchAnalog = 0x616e6c67 - } BMDAudioOutputAnalogAESSwitch; - -typedef /* [v1_enum] */ -enum _BMDVideoOutputConversionMode - { - bmdNoVideoOutputConversion = 0x6e6f6e65, - bmdVideoOutputLetterboxDownconversion = 0x6c746278, - bmdVideoOutputAnamorphicDownconversion = 0x616d7068, - bmdVideoOutputHD720toHD1080Conversion = 0x37323063, - bmdVideoOutputHardwareLetterboxDownconversion = 0x48576c62, - bmdVideoOutputHardwareAnamorphicDownconversion = 0x4857616d, - bmdVideoOutputHardwareCenterCutDownconversion = 0x48576363, - bmdVideoOutputHardware720p1080pCrossconversion = 0x78636170, - bmdVideoOutputHardwareAnamorphic720pUpconversion = 0x75613770, - bmdVideoOutputHardwareAnamorphic1080iUpconversion = 0x75613169, - bmdVideoOutputHardwareAnamorphic149To720pUpconversion = 0x75343770, - bmdVideoOutputHardwareAnamorphic149To1080iUpconversion = 0x75343169, - bmdVideoOutputHardwarePillarbox720pUpconversion = 0x75703770, - bmdVideoOutputHardwarePillarbox1080iUpconversion = 0x75703169 - } 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 _BMDVideo3DPackingFormat - { - bmdVideo3DPackingSidebySideHalf = 0x73627368, - bmdVideo3DPackingLinebyLine = 0x6c62796c, - bmdVideo3DPackingTopAndBottom = 0x7461626f, - bmdVideo3DPackingFramePacking = 0x6672706b, - bmdVideo3DPackingLeftOnly = 0x6c656674, - bmdVideo3DPackingRightOnly = 0x72696768 - } BMDVideo3DPackingFormat; - -typedef /* [v1_enum] */ -enum _BMDIdleVideoOutputOperation - { - bmdIdleVideoOutputBlack = 0x626c6163, - bmdIdleVideoOutputLastFrame = 0x6c616661 - } BMDIdleVideoOutputOperation; - -typedef /* [v1_enum] */ -enum _BMDVideoEncoderFrameCodingMode - { - bmdVideoEncoderFrameCodingModeInter = 0x696e7465, - bmdVideoEncoderFrameCodingModeIntra = 0x696e7472 - } BMDVideoEncoderFrameCodingMode; - -typedef /* [v1_enum] */ -enum _BMDDNxHRLevel - { - bmdDNxHRLevelSQ = 0x646e7371, - bmdDNxHRLevelLB = 0x646e6c62, - bmdDNxHRLevelHQ = 0x646e6871, - bmdDNxHRLevelHQX = 0x64687178, - bmdDNxHRLevel444 = 0x64343434 - } BMDDNxHRLevel; - -typedef /* [v1_enum] */ -enum _BMDLinkConfiguration - { - bmdLinkConfigurationSingleLink = 0x6c63736c, - bmdLinkConfigurationDualLink = 0x6c63646c, - bmdLinkConfigurationQuadLink = 0x6c63716c - } BMDLinkConfiguration; - -typedef /* [v1_enum] */ -enum _BMDDeviceInterface - { - bmdDeviceInterfacePCI = 0x70636920, - bmdDeviceInterfaceUSB = 0x75736220, - bmdDeviceInterfaceThunderbolt = 0x7468756e - } BMDDeviceInterface; - -typedef /* [v1_enum] */ -enum _BMDColorspace - { - bmdColorspaceRec601 = 0x72363031, - bmdColorspaceRec709 = 0x72373039, - bmdColorspaceRec2020 = 0x32303230, - bmdColorspaceDolbyVisionNative = 0x446f5669, - bmdColorspaceP3D65 = 0x50334436, - bmdColorspaceUnknown = 0x4e636f6c - } BMDColorspace; - -typedef /* [v1_enum] */ -enum _BMDDynamicRange - { - bmdDynamicRangeSDR = 0, - bmdDynamicRangeHDRStaticPQ = ( 1 << 29 ) , - bmdDynamicRangeHDRStaticHLG = ( 1 << 30 ) - } BMDDynamicRange; - -typedef /* [v1_enum] */ -enum _BMDMezzanineType - { - bmdMezzanineTypeNone = 0, - bmdMezzanineTypeHDMI14OpticalSDI = 0x6d7a6131, - bmdMezzanineTypeQuadSDI = 0x6d7a3473, - bmdMezzanineTypeHDMI20OpticalSDI = 0x6d7a6132, - bmdMezzanineTypeHDMI21RS422 = 0x6d7a6872 - } BMDMezzanineType; - -typedef /* [v1_enum] */ -enum _BMDDeckLinkHDMIInputEDIDID - { - bmdDeckLinkHDMIInputEDIDDynamicRange = 0x48494479 - } BMDDeckLinkHDMIInputEDIDID; - -typedef /* [v1_enum] */ -enum _BMDDeckLinkFrameMetadataID - { - bmdDeckLinkFrameMetadataColorspace = 0x63737063, - bmdDeckLinkFrameMetadataHDRElectroOpticalTransferFunc = 0x656f7466, - bmdDeckLinkFrameMetadataRTPTimestamp = 0x72747074, - bmdDeckLinkFrameMetadataDolbyVision = 0x646f7669, - bmdDeckLinkFrameMetadataHDRDisplayPrimariesRedX = 0x68647278, - bmdDeckLinkFrameMetadataHDRDisplayPrimariesRedY = 0x68647279, - bmdDeckLinkFrameMetadataHDRDisplayPrimariesGreenX = 0x68646778, - bmdDeckLinkFrameMetadataHDRDisplayPrimariesGreenY = 0x68646779, - bmdDeckLinkFrameMetadataHDRDisplayPrimariesBlueX = 0x68646278, - bmdDeckLinkFrameMetadataHDRDisplayPrimariesBlueY = 0x68646279, - bmdDeckLinkFrameMetadataHDRWhitePointX = 0x68647778, - bmdDeckLinkFrameMetadataHDRWhitePointY = 0x68647779, - bmdDeckLinkFrameMetadataHDRMaxDisplayMasteringLuminance = 0x68646d6c, - bmdDeckLinkFrameMetadataHDRMinDisplayMasteringLuminance = 0x686d696c, - bmdDeckLinkFrameMetadataHDRMaximumContentLightLevel = 0x6d636c6c, - bmdDeckLinkFrameMetadataHDRMaximumFrameAverageLightLevel = 0x66616c6c - } BMDDeckLinkFrameMetadataID; - -typedef /* [v1_enum] */ -enum _BMDEthernetLinkState - { - bmdEthernetLinkStateDisconnected = 0x656c6473, - bmdEthernetLinkStateConnectedUnbound = 0x656c6375, - bmdEthernetLinkStateConnectedBound = 0x656c6362 - } BMDEthernetLinkState; - -typedef /* [v1_enum] */ -enum _BMDProfileID - { - bmdProfileOneSubDeviceFullDuplex = 0x31646664, - bmdProfileOneSubDeviceHalfDuplex = 0x31646864, - bmdProfileTwoSubDevicesFullDuplex = 0x32646664, - bmdProfileTwoSubDevicesHalfDuplex = 0x32646864, - bmdProfileFourSubDevicesHalfDuplex = 0x34646864 - } BMDProfileID; - -typedef /* [v1_enum] */ -enum _BMDHDMITimecodePacking - { - bmdHDMITimecodePackingIEEEOUI000085 = 0x8500, - bmdHDMITimecodePackingIEEEOUI080046 = 0x8004601, - bmdHDMITimecodePackingIEEEOUI5CF9F0 = 0x5cf9f003 - } BMDHDMITimecodePacking; - -typedef /* [v1_enum] */ -enum _BMDInternalKeyingAncillaryDataSource - { - bmdInternalKeyingUsesAncillaryDataFromInputSignal = 0x696b6169, - bmdInternalKeyingUsesAncillaryDataFromKeyFrame = 0x696b616b - } BMDInternalKeyingAncillaryDataSource; - -/* [v1_enum] */ -enum _BMDAudioOutputXLRDelayType - { - bmdAudioOutputXLRDelayTypeTime = 0x64746d73, - bmdAudioOutputXLRDelayTypeFrames = 0x64746672 - } ; -typedef /* [v1_enum] */ -enum _BMDLanguage - { - bmdLanguageEnglish = 0x656e5553, - bmdLanguageSimplifiedChinese = 0x7a68434e, - bmdLanguageJapanese = 0x6a614a50, - bmdLanguageKorean = 0x6b6f4b52, - bmdLanguageSpanish = 0x65734553, - bmdLanguageGerman = 0x64654445, - bmdLanguageFrench = 0x66724652, - bmdLanguageRussian = 0x72755255, - bmdLanguageItalian = 0x69744954, - bmdLanguagePortuguese = 0x70744252, - bmdLanguageTurkish = 0x74725452, - bmdLanguagePolish = 0x706c504c, - bmdLanguageUkrainian = 0x756b5541 - } BMDLanguage; - -typedef /* [v1_enum] */ -enum _BMDAudioMeterType - { - bmdAudioMeterTypeVUMinus18db = 0x76753138, - bmdAudioMeterTypeVUMinus20db = 0x76753230, - bmdAudioMeterTypePPMMinus18db = 0x706d3138, - bmdAudioMeterTypePPMMinus20db = 0x706d3230 - } BMDAudioMeterType; - -typedef /* [v1_enum] */ -enum _BMDDeckLinkAttributeID - { - BMDDeckLinkSupportsInternalKeying = 0x6b657969, - BMDDeckLinkSupportsExternalKeying = 0x6b657965, - BMDDeckLinkSupportsInputFormatDetection = 0x696e6664, - BMDDeckLinkHasReferenceInput = 0x6872696e, - BMDDeckLinkHasSerialPort = 0x68737074, - BMDDeckLinkHasAnalogVideoOutputGain = 0x61766f67, - BMDDeckLinkCanOnlyAdjustOverallVideoOutputGain = 0x6f766f67, - BMDDeckLinkHasVideoInputAntiAliasingFilter = 0x6161666c, - BMDDeckLinkHasBypass = 0x62797073, - BMDDeckLinkSupportsClockTimingAdjustment = 0x63746164, - BMDDeckLinkSupportsFullFrameReferenceInputTimingOffset = 0x6672696e, - BMDDeckLinkSupportsSMPTELevelAOutput = 0x6c766c61, - BMDDeckLinkSupportsAutoSwitchingPPsFOnInput = 0x61707366, - BMDDeckLinkSupportsDualLinkSDI = 0x73646c73, - BMDDeckLinkSupportsQuadLinkSDI = 0x73716c73, - BMDDeckLinkSupportsIdleOutput = 0x69646f75, - BMDDeckLinkVANCRequires10BitYUVVideoFrames = 0x76696f59, - BMDDeckLinkHasLTCTimecodeInput = 0x686c7463, - BMDDeckLinkSupportsHDRMetadata = 0x6864726d, - BMDDeckLinkSupportsColorspaceMetadata = 0x636d6574, - BMDDeckLinkSupportsHDMITimecode = 0x6874696d, - BMDDeckLinkSupportsHighFrameRateTimecode = 0x48465254, - BMDDeckLinkSupportsSynchronizeToCaptureGroup = 0x73746367, - BMDDeckLinkSupportsSynchronizeToPlaybackGroup = 0x73747067, - BMDDeckLinkHasMonitorOut = 0x666d6f6f, - BMDDeckLinkSupportsExtendedDesktop = 0x64746f70, - BMDDeckLinkHANCRequiresInputFilterConfiguration = 0x68726966, - BMDDeckLinkSupportsHANCOutput = 0x6473686f, - BMDDeckLinkSupportsHANCInput = 0x64736869, - BMDDeckLinkMaximumAudioChannels = 0x6d616368, - BMDDeckLinkMaximumHDMIAudioChannels = 0x6d686368, - BMDDeckLinkMaximumAnalogAudioInputChannels = 0x69616368, - BMDDeckLinkMaximumAnalogAudioOutputChannels = 0x61616368, - BMDDeckLinkNumberOfSubDevices = 0x6e736264, - BMDDeckLinkNumberOfEthernetConnectors = 0x6e657468, - BMDDeckLinkSubDeviceIndex = 0x73756269, - BMDDeckLinkPersistentID = 0x70656964, - BMDDeckLinkDeviceGroupID = 0x64676964, - BMDDeckLinkTopologicalID = 0x746f6964, - BMDDeckLinkVideoOutputConnections = 0x766f636e, - BMDDeckLinkVideoInputConnections = 0x7669636e, - BMDDeckLinkAudioOutputConnections = 0x616f636e, - BMDDeckLinkAudioInputConnections = 0x6169636e, - BMDDeckLinkVideoIOSupport = 0x76696f73, - BMDDeckLinkDeckControlConnections = 0x6463636e, - BMDDeckLinkDeviceInterface = 0x64627573, - BMDDeckLinkAudioInputRCAChannelCount = 0x61697263, - BMDDeckLinkAudioInputXLRChannelCount = 0x61697863, - BMDDeckLinkAudioOutputRCAChannelCount = 0x616f7263, - BMDDeckLinkAudioOutputXLRChannelCount = 0x616f7863, - BMDDeckLinkProfileID = 0x70726964, - BMDDeckLinkDuplex = 0x64757078, - BMDDeckLinkMinimumPrerollFrames = 0x6d707266, - BMDDeckLinkSupportedDynamicRange = 0x73756472, - BMDDeckLinkMezzanineType = 0x6d657a74, - BMDDeckLinkXLRDelayMsMaximum = 0x78647478, - BMDDeckLinkXLRDelayFramesMaximum = 0x78646678, - BMDDeckLinkOutputHANCUserDataWordsLimit = 0x6d686f77, - BMDDeckLinkInputHANCUserDataWordsLimit = 0x6d686977, - BMDDeckLinkVideoInputGainMinimum = 0x7669676d, - BMDDeckLinkVideoInputGainMaximum = 0x76696778, - BMDDeckLinkVideoOutputGainMinimum = 0x766f676d, - BMDDeckLinkVideoOutputGainMaximum = 0x766f6778, - BMDDeckLinkMicrophoneInputGainMinimum = 0x6d69676d, - BMDDeckLinkMicrophoneInputGainMaximum = 0x6d696778, - BMDDeckLinkSerialPortDeviceName = 0x736c706e, - BMDDeckLinkVendorName = 0x766e6472, - BMDDeckLinkDisplayName = 0x6473706e, - BMDDeckLinkModelName = 0x6d646c6e, - BMDDeckLinkDeviceHandle = 0x64657668, - BMDDeckLinkParamEthernetMACAddress = 0x704d4143 - } BMDDeckLinkAttributeID; - -typedef /* [v1_enum] */ -enum _BMDDeckLinkAPIInformationID - { - BMDDeckLinkAPIVersion = 0x76657273 - } BMDDeckLinkAPIInformationID; - -typedef /* [v1_enum] */ -enum _BMDDeckLinkStatisticID - { - bmdDeckLinkStatisticPTPLossOfLock = 0x6e6c6f6c, - bmdDeckLinkStatisticPTPDPLLMarginOfError = 0x70747065, - bmdDeckLinkStatisticDeviceTemperature = 0x53746d70, - bmdDeckLinkStatisticParamEthernetRxPackets = 0x6e747278, - bmdDeckLinkStatisticParamEthernetRxDroppedPackets = 0x6e647278, - bmdDeckLinkStatisticParamEthernetSFPDynamicInfo = 0x73667073 - } BMDDeckLinkStatisticID; - -typedef /* [v1_enum] */ -enum _BMDDeckLinkStatusID - { - bmdDeckLinkStatusDetectedVideoInputMode = 0x6476696d, - bmdDeckLinkStatusCurrentVideoInputMode = 0x6376696d, - bmdDeckLinkStatusCurrentVideoOutputMode = 0x63766f6d, - bmdDeckLinkStatusHDMIOutputActualMode = 0x6869616d, - bmdDeckLinkStatusDetectedVideoInputFormatFlags = 0x64766666, - bmdDeckLinkStatusDetectedVideoInputFieldDominance = 0x64766664, - bmdDeckLinkStatusDetectedVideoInputColorspace = 0x6473636c, - bmdDeckLinkStatusDetectedVideoInputDynamicRange = 0x64736472, - bmdDeckLinkStatusDetectedSDILinkConfiguration = 0x64736c63, - bmdDeckLinkStatusCurrentVideoInputPixelFormat = 0x63766970, - bmdDeckLinkStatusCurrentVideoInputFlags = 0x63766966, - bmdDeckLinkStatusCurrentVideoOutputFlags = 0x63766f66, - bmdDeckLinkStatusPCIExpressLinkWidth = 0x70776964, - bmdDeckLinkStatusPCIExpressLinkSpeed = 0x706c6e6b, - bmdDeckLinkStatusLastVideoOutputPixelFormat = 0x6f706978, - bmdDeckLinkStatusReferenceSignalMode = 0x7265666d, - bmdDeckLinkStatusReferenceSignalFlags = 0x72656666, - bmdDeckLinkStatusBusy = 0x62757379, - bmdDeckLinkStatusInterchangeablePanelType = 0x69637074, - bmdDeckLinkStatusHDMIOutputActualFormatFlags = 0x68696166, - bmdDeckLinkStatusHDMIOutputFRLRate = 0x68696f66, - bmdDeckLinkStatusHDMIInputFRLRate = 0x68696966, - bmdDeckLinkStatusEthernetManualNMOSRegistry = 0x6e6d6d65, - bmdDeckLinkStatusHDMIOutputTMDSLineRate = 0x68696c72, - bmdDeckLinkStatusSinkSupportsDolbyVision = 0x64767672, - bmdDeckLinkStatusVideoInputSignalLocked = 0x7669736c, - bmdDeckLinkStatusAncillaryInputSignalLocked = 0x6169736c, - bmdDeckLinkStatusReferenceSignalLocked = 0x7265666c, - bmdDeckLinkStatusEthernetPTPGrandmasterIdentity = 0x73706964, - bmdDeckLinkStatusEthernetAudioInputChannelOrder = 0x7361636f, - bmdDeckLinkStatusEthernetCurrentNMOSRegistry = 0x6e6d7265, - bmdDeckLinkStatusReceivedEDID = 0x65646964, - bmdDeckLinkStatusParamEthernetLink = 0x73656c73, - bmdDeckLinkStatusParamEthernetLinkMbps = 0x73657370, - bmdDeckLinkStatusParamEthernetLocalIPAddress = 0x73656970, - bmdDeckLinkStatusParamEthernetSubnetMask = 0x7365736d, - bmdDeckLinkStatusParamEthernetGatewayIPAddress = 0x73656777, - bmdDeckLinkStatusParamEthernetPrimaryDNS = 0x73657064, - bmdDeckLinkStatusParamEthernetSecondaryDNS = 0x73657364, - bmdDeckLinkStatusParamEthernetSFPStaticInfo = 0x73667069, - bmdDeckLinkStatusParamEthernetVideoOutputAddress = 0x736f6176, - bmdDeckLinkStatusParamEthernetAudioOutputAddress = 0x736f6161, - bmdDeckLinkStatusParamEthernetAncillaryOutputAddress = 0x736f6141 - } BMDDeckLinkStatusID; - -typedef /* [v1_enum] */ -enum _BMDDeckLinkVideoStatusFlags - { - bmdDeckLinkVideoStatusPsF = ( 1 << 0 ) , - bmdDeckLinkVideoStatusDualStream3D = ( 1 << 1 ) - } BMDDeckLinkVideoStatusFlags; - -typedef /* [v1_enum] */ -enum _BMDDuplexMode - { - bmdDuplexFull = 0x64786675, - bmdDuplexHalf = 0x64786861, - bmdDuplexSimplex = 0x64787370, - bmdDuplexInactive = 0x6478696e - } BMDDuplexMode; - -typedef /* [v1_enum] */ -enum _BMDPanelType - { - bmdPanelNotDetected = 0x6e706e6c, - bmdPanelTeranexMiniSmartPanel = 0x746d736d - } BMDPanelType; - -/* [v1_enum] */ -enum _BMDFormatFlags - { - bmdFormatRGB444 = ( 1 << 0 ) , - bmdFormatYUV444 = ( 1 << 1 ) , - bmdFormatYUV422 = ( 1 << 2 ) , - bmdFormatYUV420 = ( 1 << 3 ) , - bmdFormat8BitDepth = ( 1 << 4 ) , - bmdFormat10BitDepth = ( 1 << 5 ) , - bmdFormat12BitDepth = ( 1 << 6 ) - } ; -/* [v1_enum] */ -enum _BMDDeviceBusyState - { - bmdDeviceCaptureBusy = ( 1 << 0 ) , - bmdDevicePlaybackBusy = ( 1 << 1 ) , - bmdDeviceSerialPortBusy = ( 1 << 2 ) - } ; -typedef /* [v1_enum] */ -enum _BMDVideoIOSupport - { - bmdDeviceSupportsCapture = ( 1 << 0 ) , - bmdDeviceSupportsPlayback = ( 1 << 1 ) - } BMDVideoIOSupport; - -typedef /* [v1_enum] */ -enum _BMD3DPreviewFormat - { - bmd3DPreviewFormatDefault = 0x64656661, - bmd3DPreviewFormatLeftOnly = 0x6c656674, - bmd3DPreviewFormatRightOnly = 0x72696768, - bmd3DPreviewFormatSideBySide = 0x73696465, - bmd3DPreviewFormatTopBottom = 0x746f7062 - } BMD3DPreviewFormat; - -typedef /* [v1_enum] */ -enum _BMDAncillaryDataSpace - { - bmdAncillaryDataSpaceVANC = 0, - bmdAncillaryDataSpaceHANC = 1 - } BMDAncillaryDataSpace; - -typedef /* [v1_enum] */ -enum _BMDIPFlowDirection - { - bmdDeckLinkIPFlowDirectionOutput = 0, - bmdDeckLinkIPFlowDirectionInput = 1 - } BMDIPFlowDirection; - -typedef /* [v1_enum] */ -enum _BMDIPFlowType - { - bmdDeckLinkIPFlowTypeVideo = 0, - bmdDeckLinkIPFlowTypeAudio = 1, - bmdDeckLinkIPFlowTypeAncillary = 2 - } BMDIPFlowType; - -typedef /* [v1_enum] */ -enum _BMDDeckLinkIPFlowAttributeID - { - bmdDeckLinkIPFlowID = 0x32666169, - bmdDeckLinkIPFlowDirection = 0x32666164, - bmdDeckLinkIPFlowType = 0x32666174 - } BMDDeckLinkIPFlowAttributeID; - -typedef /* [v1_enum] */ -enum _BMDDeckLinkIPFlowStatusID - { - bmdDeckLinkIPFlowSDP = 0x32666173 - } BMDDeckLinkIPFlowStatusID; - -typedef /* [v1_enum] */ -enum _BMDDeckLinkIPFlowSettingID - { - bmdDeckLinkIPFlowPeerSDP = 0x32667073 - } BMDDeckLinkIPFlowSettingID; - -typedef /* [v1_enum] */ -enum _BMDNotifications - { - bmdPreferencesChanged = 0x70726566, - bmdStatusChanged = 0x73746174, - bmdIPFlowStatusChanged = 0x62667363, - bmdIPFlowSettingChanged = 0x62666363 - } BMDNotifications; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -typedef /* [v1_enum] */ -enum _BMDDeckLinkStatusID_v15_3_1 - { - bmdDeckLinkStatusDeviceTemperature_v15_3_1 = 0x64746d70, - bmdDeckLinkStatusEthernetLink_v15_3_1 = 0x73656c73, - bmdDeckLinkStatusEthernetLinkMbps_v15_3_1 = 0x73657370, - bmdDeckLinkStatusEthernetLocalIPAddress_v15_3_1 = 0x73656970, - bmdDeckLinkStatusEthernetSubnetMask_v15_3_1 = 0x7365736d, - bmdDeckLinkStatusEthernetGatewayIPAddress_v15_3_1 = 0x73656777, - bmdDeckLinkStatusEthernetPrimaryDNS_v15_3_1 = 0x73657064, - bmdDeckLinkStatusEthernetSecondaryDNS_v15_3_1 = 0x73657364, - bmdDeckLinkStatusEthernetVideoOutputAddress_v15_3_1 = 0x736f6176, - bmdDeckLinkStatusEthernetAudioOutputAddress_v15_3_1 = 0x736f6161, - bmdDeckLinkStatusEthernetAncillaryOutputAddress_v15_3_1 = 0x736f6141 - } BMDDeckLinkStatusID_v15_3_1; - -typedef /* [v1_enum] */ -enum _BMDDeckLinkConfigurationID_v15_3_1 - { - bmdDeckLinkConfigEthernetUseDHCP_v15_3_1 = 0x44484350, - bmdDeckLinkConfigEthernetStaticLocalIPAddress_v15_3_1 = 0x6e736970, - bmdDeckLinkConfigEthernetStaticSubnetMask_v15_3_1 = 0x6e73736d, - bmdDeckLinkConfigEthernetStaticGatewayIPAddress_v15_3_1 = 0x6e736777, - bmdDeckLinkConfigEthernetStaticPrimaryDNS_v15_3_1 = 0x6e737064, - bmdDeckLinkConfigEthernetStaticSecondaryDNS_v15_3_1 = 0x6e737364, - bmdDeckLinkConfigEthernetVideoOutputAddress_v15_3_1 = 0x6e6f6176, - bmdDeckLinkConfigEthernetAudioOutputAddress_v15_3_1 = 0x6e6f6161, - bmdDeckLinkConfigEthernetAncillaryOutputAddress_v15_3_1 = 0x6e6f6141 - } BMDDeckLinkConfigurationID_v15_3_1; - -typedef /* [v1_enum] */ -enum _BMDDeckLinkAttributeID_v15_3_1 - { - BMDDeckLinkEthernetMACAddress_v15_3_1 = 0x654d4143 - } BMDDeckLinkAttributeID_v15_3_1; - - - - - - - - - - - - - - - - - -typedef /* [v1_enum] */ -enum _BMDDeckLinkStatusID_v11_5_1 - { - bmdDeckLinkStatusDetectedVideoInputFlags_v11_5_1 = 0x64766966 - } BMDDeckLinkStatusID_v11_5_1; - -typedef /* [v1_enum] */ -enum _BMDDisplayModeSupport_v10_11 - { - bmdDisplayModeNotSupported_v10_11 = 0, - bmdDisplayModeSupported_v10_11 = ( bmdDisplayModeNotSupported_v10_11 + 1 ) , - bmdDisplayModeSupportedWithConversion_v10_11 = ( bmdDisplayModeSupported_v10_11 + 1 ) - } BMDDisplayModeSupport_v10_11; - -typedef /* [v1_enum] */ -enum _BMDDuplexMode_v10_11 - { - bmdDuplexModeFull_v10_11 = 0x66647570, - bmdDuplexModeHalf_v10_11 = 0x68647570 - } BMDDuplexMode_v10_11; - -typedef /* [v1_enum] */ -enum _BMDDeckLinkConfigurationID_v10_11 - { - bmdDeckLinkConfigDuplexMode_v10_11 = 0x64757078 - } BMDDeckLinkConfigurationID_v10_11; - -typedef /* [v1_enum] */ -enum _BMDDeckLinkAttributeID_v10_11 - { - BMDDeckLinkSupportsDuplexModeConfiguration_v10_11 = 0x64757078, - BMDDeckLinkSupportsHDKeying_v10_11 = 0x6b657968, - BMDDeckLinkPairedDevicePersistentID_v10_11 = 0x70706964, - BMDDeckLinkSupportsFullDuplex_v10_11 = 0x66647570 - } BMDDeckLinkAttributeID_v10_11; - -typedef /* [v1_enum] */ -enum _BMDDeckLinkStatusID_v10_11 - { - bmdDeckLinkStatusDuplexMode_v10_11 = 0x64757078 - } BMDDeckLinkStatusID_v10_11; - -typedef /* [v1_enum] */ -enum _BMDDuplexStatus_v10_11 - { - bmdDuplexFullDuplex_v10_11 = 0x66647570, - bmdDuplexHalfDuplex_v10_11 = 0x68647570, - bmdDuplexSimplex_v10_11 = 0x73706c78, - bmdDuplexInactive_v10_11 = 0x696e6163 - } BMDDuplexStatus_v10_11; - - - - -typedef /* [v1_enum] */ -enum _BMDDeckLinkConfigurationID_v10_9 - { - bmdDeckLinkConfig1080pNotPsF_v10_9 = 0x6670726f - } BMDDeckLinkConfigurationID_v10_9; - - -typedef /* [v1_enum] */ -enum _BMDDeckLinkConfigurationID_v10_4 - { - bmdDeckLinkConfigSingleLinkVideoOutput_v10_4 = 0x73676c6f - } BMDDeckLinkConfigurationID_v10_4; - - -typedef /* [v1_enum] */ -enum _BMDDeckLinkConfigurationID_v10_2 - { - bmdDeckLinkConfig3GBpsVideoOutput_v10_2 = 0x33676273 - } BMDDeckLinkConfigurationID_v10_2; - -typedef /* [v1_enum] */ -enum _BMDAudioConnection_v10_2 - { - bmdAudioConnectionEmbedded_v10_2 = 0x656d6264, - bmdAudioConnectionAESEBU_v10_2 = 0x61657320, - bmdAudioConnectionAnalog_v10_2 = 0x616e6c67, - bmdAudioConnectionAnalogXLR_v10_2 = 0x61786c72, - bmdAudioConnectionAnalogRCA_v10_2 = 0x61726361 - } BMDAudioConnection_v10_2; - - - - - -typedef /* [v1_enum] */ -enum _BMDDeckLinkFrameMetadataID_v11_5 - { - bmdDeckLinkFrameMetadataCintelFilmType_v11_5 = 0x63667479, - bmdDeckLinkFrameMetadataCintelFilmGauge_v11_5 = 0x63666761, - bmdDeckLinkFrameMetadataCintelKeykodeLow_v11_5 = 0x636b6b6c, - bmdDeckLinkFrameMetadataCintelKeykodeHigh_v11_5 = 0x636b6b68, - bmdDeckLinkFrameMetadataCintelTile1Size_v11_5 = 0x63743173, - bmdDeckLinkFrameMetadataCintelTile2Size_v11_5 = 0x63743273, - bmdDeckLinkFrameMetadataCintelTile3Size_v11_5 = 0x63743373, - bmdDeckLinkFrameMetadataCintelTile4Size_v11_5 = 0x63743473, - bmdDeckLinkFrameMetadataCintelImageWidth_v11_5 = 0x49575078, - bmdDeckLinkFrameMetadataCintelImageHeight_v11_5 = 0x49485078, - bmdDeckLinkFrameMetadataCintelLinearMaskingRedInRed_v11_5 = 0x6d726972, - bmdDeckLinkFrameMetadataCintelLinearMaskingGreenInRed_v11_5 = 0x6d676972, - bmdDeckLinkFrameMetadataCintelLinearMaskingBlueInRed_v11_5 = 0x6d626972, - bmdDeckLinkFrameMetadataCintelLinearMaskingRedInGreen_v11_5 = 0x6d726967, - bmdDeckLinkFrameMetadataCintelLinearMaskingGreenInGreen_v11_5 = 0x6d676967, - bmdDeckLinkFrameMetadataCintelLinearMaskingBlueInGreen_v11_5 = 0x6d626967, - bmdDeckLinkFrameMetadataCintelLinearMaskingRedInBlue_v11_5 = 0x6d726962, - bmdDeckLinkFrameMetadataCintelLinearMaskingGreenInBlue_v11_5 = 0x6d676962, - bmdDeckLinkFrameMetadataCintelLinearMaskingBlueInBlue_v11_5 = 0x6d626962, - bmdDeckLinkFrameMetadataCintelLogMaskingRedInRed_v11_5 = 0x6d6c7272, - bmdDeckLinkFrameMetadataCintelLogMaskingGreenInRed_v11_5 = 0x6d6c6772, - bmdDeckLinkFrameMetadataCintelLogMaskingBlueInRed_v11_5 = 0x6d6c6272, - bmdDeckLinkFrameMetadataCintelLogMaskingRedInGreen_v11_5 = 0x6d6c7267, - bmdDeckLinkFrameMetadataCintelLogMaskingGreenInGreen_v11_5 = 0x6d6c6767, - bmdDeckLinkFrameMetadataCintelLogMaskingBlueInGreen_v11_5 = 0x6d6c6267, - bmdDeckLinkFrameMetadataCintelLogMaskingRedInBlue_v11_5 = 0x6d6c7262, - bmdDeckLinkFrameMetadataCintelLogMaskingGreenInBlue_v11_5 = 0x6d6c6762, - bmdDeckLinkFrameMetadataCintelLogMaskingBlueInBlue_v11_5 = 0x6d6c6262, - bmdDeckLinkFrameMetadataCintelFilmFrameRate_v11_5 = 0x63666672, - bmdDeckLinkFrameMetadataCintelOffsetToApplyHorizontal_v11_5 = 0x6f746168, - bmdDeckLinkFrameMetadataCintelOffsetToApplyVertical_v11_5 = 0x6f746176, - bmdDeckLinkFrameMetadataCintelGainRed_v11_5 = 0x4c665264, - bmdDeckLinkFrameMetadataCintelGainGreen_v11_5 = 0x4c664772, - bmdDeckLinkFrameMetadataCintelGainBlue_v11_5 = 0x4c66426c, - bmdDeckLinkFrameMetadataCintelLiftRed_v11_5 = 0x476e5264, - bmdDeckLinkFrameMetadataCintelLiftGreen_v11_5 = 0x476e4772, - bmdDeckLinkFrameMetadataCintelLiftBlue_v11_5 = 0x476e426c, - bmdDeckLinkFrameMetadataCintelHDRGainRed_v11_5 = 0x48475264, - bmdDeckLinkFrameMetadataCintelHDRGainGreen_v11_5 = 0x48474772, - bmdDeckLinkFrameMetadataCintelHDRGainBlue_v11_5 = 0x4847426c, - bmdDeckLinkFrameMetadataCintel16mmCropRequired_v11_5 = 0x63313663, - bmdDeckLinkFrameMetadataCintelInversionRequired_v11_5 = 0x63696e76, - bmdDeckLinkFrameMetadataCintelFlipRequired_v11_5 = 0x63666c72, - bmdDeckLinkFrameMetadataCintelFocusAssistEnabled_v11_5 = 0x63666165, - bmdDeckLinkFrameMetadataCintelKeykodeIsInterpolated_v11_5 = 0x6b6b6969 - } BMDDeckLinkFrameMetadataID_v11_5; - - -typedef /* [v1_enum] */ -enum _BMDDeckLinkAttributeID_v10_6 - { - BMDDeckLinkSupportsDesktopDisplay_v10_6 = 0x65787464 - } BMDDeckLinkAttributeID_v10_6; - -typedef /* [v1_enum] */ -enum _BMDIdleVideoOutputOperation_v10_6 - { - bmdIdleVideoOutputDesktop_v10_6 = 0x6465736b - } BMDIdleVideoOutputOperation_v10_6; - -typedef /* [v1_enum] */ -enum _BMDDeckLinkAttributeID_v10_5 - { - BMDDeckLinkDeviceBusyState_v10_5 = 0x64627374 - } BMDDeckLinkAttributeID_v10_5; - - - -EXTERN_C const IID LIBID_DeckLinkAPI; - -#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("BC6CFBD3-8317-4325-AC1C-1216391E9340") - 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; - - virtual HRESULT STDMETHODCALLTYPE GetTimecodeUserBits( - /* [out] */ BMDTimecodeUserBits *userBits) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkTimecodeVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkTimecode * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkTimecode * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkTimecode * This); - - DECLSPEC_XFGVIRT(IDeckLinkTimecode, GetBCD) - BMDTimecodeBCD ( STDMETHODCALLTYPE *GetBCD )( - IDeckLinkTimecode * This); - - DECLSPEC_XFGVIRT(IDeckLinkTimecode, GetComponents) - HRESULT ( STDMETHODCALLTYPE *GetComponents )( - IDeckLinkTimecode * This, - /* [out] */ unsigned char *hours, - /* [out] */ unsigned char *minutes, - /* [out] */ unsigned char *seconds, - /* [out] */ unsigned char *frames); - - DECLSPEC_XFGVIRT(IDeckLinkTimecode, GetString) - HRESULT ( STDMETHODCALLTYPE *GetString )( - IDeckLinkTimecode * This, - /* [out] */ BSTR *timecode); - - DECLSPEC_XFGVIRT(IDeckLinkTimecode, GetFlags) - BMDTimecodeFlags ( STDMETHODCALLTYPE *GetFlags )( - IDeckLinkTimecode * This); - - DECLSPEC_XFGVIRT(IDeckLinkTimecode, GetTimecodeUserBits) - HRESULT ( STDMETHODCALLTYPE *GetTimecodeUserBits )( - IDeckLinkTimecode * This, - /* [out] */ BMDTimecodeUserBits *userBits); - - 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) ) - -#define IDeckLinkTimecode_GetTimecodeUserBits(This,userBits) \ - ( (This)->lpVtbl -> GetTimecodeUserBits(This,userBits) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkTimecode_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("9C88499F-F601-4021-B80B-032E4EB41C35") - IDeckLinkDisplayModeIterator : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Next( - /* [out] */ IDeckLinkDisplayMode **deckLinkDisplayMode) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkDisplayModeIteratorVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkDisplayModeIterator * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkDisplayModeIterator * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkDisplayModeIterator * This); - - DECLSPEC_XFGVIRT(IDeckLinkDisplayModeIterator, Next) - 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("3EB2C1AB-0A3D-4523-A3AD-F40D7FB14E78") - 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; - - virtual BMDDisplayModeFlags STDMETHODCALLTYPE GetFlags( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkDisplayModeVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkDisplayMode * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkDisplayMode * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkDisplayMode * This); - - DECLSPEC_XFGVIRT(IDeckLinkDisplayMode, GetName) - HRESULT ( STDMETHODCALLTYPE *GetName )( - IDeckLinkDisplayMode * This, - /* [out] */ BSTR *name); - - DECLSPEC_XFGVIRT(IDeckLinkDisplayMode, GetDisplayMode) - BMDDisplayMode ( STDMETHODCALLTYPE *GetDisplayMode )( - IDeckLinkDisplayMode * This); - - DECLSPEC_XFGVIRT(IDeckLinkDisplayMode, GetWidth) - long ( STDMETHODCALLTYPE *GetWidth )( - IDeckLinkDisplayMode * This); - - DECLSPEC_XFGVIRT(IDeckLinkDisplayMode, GetHeight) - long ( STDMETHODCALLTYPE *GetHeight )( - IDeckLinkDisplayMode * This); - - DECLSPEC_XFGVIRT(IDeckLinkDisplayMode, GetFrameRate) - HRESULT ( STDMETHODCALLTYPE *GetFrameRate )( - IDeckLinkDisplayMode * This, - /* [out] */ BMDTimeValue *frameDuration, - /* [out] */ BMDTimeScale *timeScale); - - DECLSPEC_XFGVIRT(IDeckLinkDisplayMode, GetFieldDominance) - BMDFieldDominance ( STDMETHODCALLTYPE *GetFieldDominance )( - IDeckLinkDisplayMode * This); - - DECLSPEC_XFGVIRT(IDeckLinkDisplayMode, GetFlags) - BMDDisplayModeFlags ( STDMETHODCALLTYPE *GetFlags )( - 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) ) - -#define IDeckLinkDisplayMode_GetFlags(This) \ - ( (This)->lpVtbl -> GetFlags(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("C418FBDD-0587-48ED-8FE5-640F0A14AF91") - IDeckLink : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetModelName( - /* [out] */ BSTR *modelName) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayName( - /* [out] */ BSTR *displayName) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLink * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLink * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLink * This); - - DECLSPEC_XFGVIRT(IDeckLink, GetModelName) - HRESULT ( STDMETHODCALLTYPE *GetModelName )( - IDeckLink * This, - /* [out] */ BSTR *modelName); - - DECLSPEC_XFGVIRT(IDeckLink, GetDisplayName) - HRESULT ( STDMETHODCALLTYPE *GetDisplayName )( - IDeckLink * This, - /* [out] */ BSTR *displayName); - - 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) ) - -#define IDeckLink_GetDisplayName(This,displayName) \ - ( (This)->lpVtbl -> GetDisplayName(This,displayName) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLink_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkConfiguration_INTERFACE_DEFINED__ -#define __IDeckLinkConfiguration_INTERFACE_DEFINED__ - -/* interface IDeckLinkConfiguration */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkConfiguration; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("5a68ffd4-1c12-4ede-a6d2-45451d385fc1") - IDeckLinkConfiguration : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SetFlag( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ BOOL value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFlag( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ BOOL *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetInt( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ LONGLONG value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetInt( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ LONGLONG *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFloat( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ double value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFloat( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ double *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetString( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ BSTR value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetString( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ BSTR *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFlagWithParam( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ ULONGLONG param, - /* [in] */ BOOL value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFlagWithParam( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ ULONGLONG param, - /* [out] */ BOOL *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetIntWithParam( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ ULONGLONG param, - /* [in] */ LONGLONG value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetIntWithParam( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ ULONGLONG param, - /* [out] */ LONGLONG *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFloatWithParam( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ ULONGLONG param, - /* [in] */ double value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFloatWithParam( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ ULONGLONG param, - /* [out] */ double *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetStringWithParam( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ ULONGLONG param, - /* [in] */ BSTR value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetStringWithParam( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ ULONGLONG param, - /* [out] */ BSTR *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE WriteConfigurationToPreferences( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkConfigurationVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkConfiguration * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkConfiguration * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkConfiguration * This); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration, SetFlag) - HRESULT ( STDMETHODCALLTYPE *SetFlag )( - IDeckLinkConfiguration * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ BOOL value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration, GetFlag) - HRESULT ( STDMETHODCALLTYPE *GetFlag )( - IDeckLinkConfiguration * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ BOOL *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration, SetInt) - HRESULT ( STDMETHODCALLTYPE *SetInt )( - IDeckLinkConfiguration * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ LONGLONG value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration, GetInt) - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IDeckLinkConfiguration * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration, SetFloat) - HRESULT ( STDMETHODCALLTYPE *SetFloat )( - IDeckLinkConfiguration * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ double value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration, GetFloat) - HRESULT ( STDMETHODCALLTYPE *GetFloat )( - IDeckLinkConfiguration * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ double *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration, SetString) - HRESULT ( STDMETHODCALLTYPE *SetString )( - IDeckLinkConfiguration * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ BSTR value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration, GetString) - HRESULT ( STDMETHODCALLTYPE *GetString )( - IDeckLinkConfiguration * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ BSTR *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration, SetFlagWithParam) - HRESULT ( STDMETHODCALLTYPE *SetFlagWithParam )( - IDeckLinkConfiguration * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ ULONGLONG param, - /* [in] */ BOOL value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration, GetFlagWithParam) - HRESULT ( STDMETHODCALLTYPE *GetFlagWithParam )( - IDeckLinkConfiguration * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ ULONGLONG param, - /* [out] */ BOOL *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration, SetIntWithParam) - HRESULT ( STDMETHODCALLTYPE *SetIntWithParam )( - IDeckLinkConfiguration * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ ULONGLONG param, - /* [in] */ LONGLONG value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration, GetIntWithParam) - HRESULT ( STDMETHODCALLTYPE *GetIntWithParam )( - IDeckLinkConfiguration * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ ULONGLONG param, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration, SetFloatWithParam) - HRESULT ( STDMETHODCALLTYPE *SetFloatWithParam )( - IDeckLinkConfiguration * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ ULONGLONG param, - /* [in] */ double value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration, GetFloatWithParam) - HRESULT ( STDMETHODCALLTYPE *GetFloatWithParam )( - IDeckLinkConfiguration * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ ULONGLONG param, - /* [out] */ double *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration, SetStringWithParam) - HRESULT ( STDMETHODCALLTYPE *SetStringWithParam )( - IDeckLinkConfiguration * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ ULONGLONG param, - /* [in] */ BSTR value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration, GetStringWithParam) - HRESULT ( STDMETHODCALLTYPE *GetStringWithParam )( - IDeckLinkConfiguration * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ ULONGLONG param, - /* [out] */ BSTR *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration, WriteConfigurationToPreferences) - HRESULT ( STDMETHODCALLTYPE *WriteConfigurationToPreferences )( - IDeckLinkConfiguration * This); - - 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_SetFlag(This,cfgID,value) \ - ( (This)->lpVtbl -> SetFlag(This,cfgID,value) ) - -#define IDeckLinkConfiguration_GetFlag(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) - -#define IDeckLinkConfiguration_SetInt(This,cfgID,value) \ - ( (This)->lpVtbl -> SetInt(This,cfgID,value) ) - -#define IDeckLinkConfiguration_GetInt(This,cfgID,value) \ - ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) - -#define IDeckLinkConfiguration_SetFloat(This,cfgID,value) \ - ( (This)->lpVtbl -> SetFloat(This,cfgID,value) ) - -#define IDeckLinkConfiguration_GetFloat(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) - -#define IDeckLinkConfiguration_SetString(This,cfgID,value) \ - ( (This)->lpVtbl -> SetString(This,cfgID,value) ) - -#define IDeckLinkConfiguration_GetString(This,cfgID,value) \ - ( (This)->lpVtbl -> GetString(This,cfgID,value) ) - -#define IDeckLinkConfiguration_SetFlagWithParam(This,cfgID,param,value) \ - ( (This)->lpVtbl -> SetFlagWithParam(This,cfgID,param,value) ) - -#define IDeckLinkConfiguration_GetFlagWithParam(This,cfgID,param,value) \ - ( (This)->lpVtbl -> GetFlagWithParam(This,cfgID,param,value) ) - -#define IDeckLinkConfiguration_SetIntWithParam(This,cfgID,param,value) \ - ( (This)->lpVtbl -> SetIntWithParam(This,cfgID,param,value) ) - -#define IDeckLinkConfiguration_GetIntWithParam(This,cfgID,param,value) \ - ( (This)->lpVtbl -> GetIntWithParam(This,cfgID,param,value) ) - -#define IDeckLinkConfiguration_SetFloatWithParam(This,cfgID,param,value) \ - ( (This)->lpVtbl -> SetFloatWithParam(This,cfgID,param,value) ) - -#define IDeckLinkConfiguration_GetFloatWithParam(This,cfgID,param,value) \ - ( (This)->lpVtbl -> GetFloatWithParam(This,cfgID,param,value) ) - -#define IDeckLinkConfiguration_SetStringWithParam(This,cfgID,param,value) \ - ( (This)->lpVtbl -> SetStringWithParam(This,cfgID,param,value) ) - -#define IDeckLinkConfiguration_GetStringWithParam(This,cfgID,param,value) \ - ( (This)->lpVtbl -> GetStringWithParam(This,cfgID,param,value) ) - -#define IDeckLinkConfiguration_WriteConfigurationToPreferences(This) \ - ( (This)->lpVtbl -> WriteConfigurationToPreferences(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkConfiguration_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkEncoderConfiguration_INTERFACE_DEFINED__ -#define __IDeckLinkEncoderConfiguration_INTERFACE_DEFINED__ - -/* interface IDeckLinkEncoderConfiguration */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkEncoderConfiguration; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("138050E5-C60A-4552-BF3F-0F358049327E") - IDeckLinkEncoderConfiguration : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SetFlag( - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [in] */ BOOL value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFlag( - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [out] */ BOOL *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetInt( - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [in] */ LONGLONG value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetInt( - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [out] */ LONGLONG *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFloat( - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [in] */ double value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFloat( - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [out] */ double *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetString( - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [in] */ BSTR value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetString( - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [out] */ BSTR *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBytes( - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [out] */ void *buffer, - /* [out][in] */ unsigned int *bufferSize) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkEncoderConfigurationVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkEncoderConfiguration * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkEncoderConfiguration * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkEncoderConfiguration * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderConfiguration, SetFlag) - HRESULT ( STDMETHODCALLTYPE *SetFlag )( - IDeckLinkEncoderConfiguration * This, - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [in] */ BOOL value); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderConfiguration, GetFlag) - HRESULT ( STDMETHODCALLTYPE *GetFlag )( - IDeckLinkEncoderConfiguration * This, - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [out] */ BOOL *value); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderConfiguration, SetInt) - HRESULT ( STDMETHODCALLTYPE *SetInt )( - IDeckLinkEncoderConfiguration * This, - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [in] */ LONGLONG value); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderConfiguration, GetInt) - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IDeckLinkEncoderConfiguration * This, - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderConfiguration, SetFloat) - HRESULT ( STDMETHODCALLTYPE *SetFloat )( - IDeckLinkEncoderConfiguration * This, - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [in] */ double value); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderConfiguration, GetFloat) - HRESULT ( STDMETHODCALLTYPE *GetFloat )( - IDeckLinkEncoderConfiguration * This, - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [out] */ double *value); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderConfiguration, SetString) - HRESULT ( STDMETHODCALLTYPE *SetString )( - IDeckLinkEncoderConfiguration * This, - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [in] */ BSTR value); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderConfiguration, GetString) - HRESULT ( STDMETHODCALLTYPE *GetString )( - IDeckLinkEncoderConfiguration * This, - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [out] */ BSTR *value); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderConfiguration, GetBytes) - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IDeckLinkEncoderConfiguration * This, - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [out] */ void *buffer, - /* [out][in] */ unsigned int *bufferSize); - - END_INTERFACE - } IDeckLinkEncoderConfigurationVtbl; - - interface IDeckLinkEncoderConfiguration - { - CONST_VTBL struct IDeckLinkEncoderConfigurationVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkEncoderConfiguration_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkEncoderConfiguration_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkEncoderConfiguration_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkEncoderConfiguration_SetFlag(This,cfgID,value) \ - ( (This)->lpVtbl -> SetFlag(This,cfgID,value) ) - -#define IDeckLinkEncoderConfiguration_GetFlag(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) - -#define IDeckLinkEncoderConfiguration_SetInt(This,cfgID,value) \ - ( (This)->lpVtbl -> SetInt(This,cfgID,value) ) - -#define IDeckLinkEncoderConfiguration_GetInt(This,cfgID,value) \ - ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) - -#define IDeckLinkEncoderConfiguration_SetFloat(This,cfgID,value) \ - ( (This)->lpVtbl -> SetFloat(This,cfgID,value) ) - -#define IDeckLinkEncoderConfiguration_GetFloat(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) - -#define IDeckLinkEncoderConfiguration_SetString(This,cfgID,value) \ - ( (This)->lpVtbl -> SetString(This,cfgID,value) ) - -#define IDeckLinkEncoderConfiguration_GetString(This,cfgID,value) \ - ( (This)->lpVtbl -> GetString(This,cfgID,value) ) - -#define IDeckLinkEncoderConfiguration_GetBytes(This,cfgID,buffer,bufferSize) \ - ( (This)->lpVtbl -> GetBytes(This,cfgID,buffer,bufferSize) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkEncoderConfiguration_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkDeckControlStatusCallback_INTERFACE_DEFINED__ -#define __IDeckLinkDeckControlStatusCallback_INTERFACE_DEFINED__ - -/* interface IDeckLinkDeckControlStatusCallback */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkDeckControlStatusCallback; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("53436FFB-B434-4906-BADC-AE3060FFE8EF") - IDeckLinkDeckControlStatusCallback : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE TimecodeUpdate( - /* [in] */ BMDTimecodeBCD currentTimecode) = 0; - - virtual HRESULT STDMETHODCALLTYPE VTRControlStateChanged( - /* [in] */ BMDDeckControlVTRControlState newState, - /* [in] */ BMDDeckControlError error) = 0; - - virtual HRESULT STDMETHODCALLTYPE DeckControlEventReceived( - /* [in] */ BMDDeckControlEvent event, - /* [in] */ BMDDeckControlError error) = 0; - - virtual HRESULT STDMETHODCALLTYPE DeckControlStatusChanged( - /* [in] */ BMDDeckControlStatusFlags flags, - /* [in] */ unsigned int mask) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkDeckControlStatusCallbackVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkDeckControlStatusCallback * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkDeckControlStatusCallback * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkDeckControlStatusCallback * This); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControlStatusCallback, TimecodeUpdate) - HRESULT ( STDMETHODCALLTYPE *TimecodeUpdate )( - IDeckLinkDeckControlStatusCallback * This, - /* [in] */ BMDTimecodeBCD currentTimecode); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControlStatusCallback, VTRControlStateChanged) - HRESULT ( STDMETHODCALLTYPE *VTRControlStateChanged )( - IDeckLinkDeckControlStatusCallback * This, - /* [in] */ BMDDeckControlVTRControlState newState, - /* [in] */ BMDDeckControlError error); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControlStatusCallback, DeckControlEventReceived) - HRESULT ( STDMETHODCALLTYPE *DeckControlEventReceived )( - IDeckLinkDeckControlStatusCallback * This, - /* [in] */ BMDDeckControlEvent event, - /* [in] */ BMDDeckControlError error); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControlStatusCallback, DeckControlStatusChanged) - HRESULT ( STDMETHODCALLTYPE *DeckControlStatusChanged )( - IDeckLinkDeckControlStatusCallback * This, - /* [in] */ BMDDeckControlStatusFlags flags, - /* [in] */ unsigned int mask); - - END_INTERFACE - } IDeckLinkDeckControlStatusCallbackVtbl; - - interface IDeckLinkDeckControlStatusCallback - { - CONST_VTBL struct IDeckLinkDeckControlStatusCallbackVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkDeckControlStatusCallback_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkDeckControlStatusCallback_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkDeckControlStatusCallback_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkDeckControlStatusCallback_TimecodeUpdate(This,currentTimecode) \ - ( (This)->lpVtbl -> TimecodeUpdate(This,currentTimecode) ) - -#define IDeckLinkDeckControlStatusCallback_VTRControlStateChanged(This,newState,error) \ - ( (This)->lpVtbl -> VTRControlStateChanged(This,newState,error) ) - -#define IDeckLinkDeckControlStatusCallback_DeckControlEventReceived(This,event,error) \ - ( (This)->lpVtbl -> DeckControlEventReceived(This,event,error) ) - -#define IDeckLinkDeckControlStatusCallback_DeckControlStatusChanged(This,flags,mask) \ - ( (This)->lpVtbl -> DeckControlStatusChanged(This,flags,mask) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkDeckControlStatusCallback_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkDeckControl_INTERFACE_DEFINED__ -#define __IDeckLinkDeckControl_INTERFACE_DEFINED__ - -/* interface IDeckLinkDeckControl */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkDeckControl; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("8E1C3ACE-19C7-4E00-8B92-D80431D958BE") - IDeckLinkDeckControl : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Open( - /* [in] */ BMDTimeScale timeScale, - /* [in] */ BMDTimeValue timeValue, - /* [in] */ BOOL timecodeIsDropFrame, - /* [out] */ BMDDeckControlError *error) = 0; - - virtual HRESULT STDMETHODCALLTYPE Close( - /* [in] */ BOOL standbyOn) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCurrentState( - /* [out] */ BMDDeckControlMode *mode, - /* [out] */ BMDDeckControlVTRControlState *vtrControlState, - /* [out] */ BMDDeckControlStatusFlags *flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetStandby( - /* [in] */ BOOL standbyOn) = 0; - - virtual HRESULT STDMETHODCALLTYPE SendCommand( - /* [in] */ unsigned char *inBuffer, - /* [in] */ unsigned int inBufferSize, - /* [out] */ unsigned char *outBuffer, - /* [out] */ unsigned int *outDataSize, - /* [in] */ unsigned int outBufferSize, - /* [out] */ BMDDeckControlError *error) = 0; - - virtual HRESULT STDMETHODCALLTYPE Play( - /* [out] */ BMDDeckControlError *error) = 0; - - virtual HRESULT STDMETHODCALLTYPE Stop( - /* [out] */ BMDDeckControlError *error) = 0; - - virtual HRESULT STDMETHODCALLTYPE TogglePlayStop( - /* [out] */ BMDDeckControlError *error) = 0; - - virtual HRESULT STDMETHODCALLTYPE Eject( - /* [out] */ BMDDeckControlError *error) = 0; - - virtual HRESULT STDMETHODCALLTYPE GoToTimecode( - /* [in] */ BMDTimecodeBCD timecode, - /* [out] */ BMDDeckControlError *error) = 0; - - virtual HRESULT STDMETHODCALLTYPE FastForward( - /* [in] */ BOOL viewTape, - /* [out] */ BMDDeckControlError *error) = 0; - - virtual HRESULT STDMETHODCALLTYPE Rewind( - /* [in] */ BOOL viewTape, - /* [out] */ BMDDeckControlError *error) = 0; - - virtual HRESULT STDMETHODCALLTYPE StepForward( - /* [out] */ BMDDeckControlError *error) = 0; - - virtual HRESULT STDMETHODCALLTYPE StepBack( - /* [out] */ BMDDeckControlError *error) = 0; - - virtual HRESULT STDMETHODCALLTYPE Jog( - /* [in] */ double rate, - /* [out] */ BMDDeckControlError *error) = 0; - - virtual HRESULT STDMETHODCALLTYPE Shuttle( - /* [in] */ double rate, - /* [out] */ BMDDeckControlError *error) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetTimecodeString( - /* [out] */ BSTR *currentTimeCode, - /* [out] */ BMDDeckControlError *error) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetTimecode( - /* [out] */ IDeckLinkTimecode **currentTimecode, - /* [out] */ BMDDeckControlError *error) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetTimecodeBCD( - /* [out] */ BMDTimecodeBCD *currentTimecode, - /* [out] */ BMDDeckControlError *error) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetPreroll( - /* [in] */ unsigned int prerollSeconds) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPreroll( - /* [out] */ unsigned int *prerollSeconds) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetExportOffset( - /* [in] */ int exportOffsetFields) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetExportOffset( - /* [out] */ int *exportOffsetFields) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetManualExportOffset( - /* [out] */ int *deckManualExportOffsetFields) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetCaptureOffset( - /* [in] */ int captureOffsetFields) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCaptureOffset( - /* [out] */ int *captureOffsetFields) = 0; - - virtual HRESULT STDMETHODCALLTYPE StartExport( - /* [in] */ BMDTimecodeBCD inTimecode, - /* [in] */ BMDTimecodeBCD outTimecode, - /* [in] */ BMDDeckControlExportModeOpsFlags exportModeOps, - /* [out] */ BMDDeckControlError *error) = 0; - - virtual HRESULT STDMETHODCALLTYPE StartCapture( - /* [in] */ BOOL useVITC, - /* [in] */ BMDTimecodeBCD inTimecode, - /* [in] */ BMDTimecodeBCD outTimecode, - /* [out] */ BMDDeckControlError *error) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDeviceID( - /* [out] */ unsigned short *deviceId, - /* [out] */ BMDDeckControlError *error) = 0; - - virtual HRESULT STDMETHODCALLTYPE Abort( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE CrashRecordStart( - /* [out] */ BMDDeckControlError *error) = 0; - - virtual HRESULT STDMETHODCALLTYPE CrashRecordStop( - /* [out] */ BMDDeckControlError *error) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetCallback( - /* [in] */ IDeckLinkDeckControlStatusCallback *callback) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkDeckControlVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkDeckControl * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkDeckControl * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkDeckControl * This); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, Open) - HRESULT ( STDMETHODCALLTYPE *Open )( - IDeckLinkDeckControl * This, - /* [in] */ BMDTimeScale timeScale, - /* [in] */ BMDTimeValue timeValue, - /* [in] */ BOOL timecodeIsDropFrame, - /* [out] */ BMDDeckControlError *error); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, Close) - HRESULT ( STDMETHODCALLTYPE *Close )( - IDeckLinkDeckControl * This, - /* [in] */ BOOL standbyOn); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, GetCurrentState) - HRESULT ( STDMETHODCALLTYPE *GetCurrentState )( - IDeckLinkDeckControl * This, - /* [out] */ BMDDeckControlMode *mode, - /* [out] */ BMDDeckControlVTRControlState *vtrControlState, - /* [out] */ BMDDeckControlStatusFlags *flags); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, SetStandby) - HRESULT ( STDMETHODCALLTYPE *SetStandby )( - IDeckLinkDeckControl * This, - /* [in] */ BOOL standbyOn); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, SendCommand) - HRESULT ( STDMETHODCALLTYPE *SendCommand )( - IDeckLinkDeckControl * This, - /* [in] */ unsigned char *inBuffer, - /* [in] */ unsigned int inBufferSize, - /* [out] */ unsigned char *outBuffer, - /* [out] */ unsigned int *outDataSize, - /* [in] */ unsigned int outBufferSize, - /* [out] */ BMDDeckControlError *error); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, Play) - HRESULT ( STDMETHODCALLTYPE *Play )( - IDeckLinkDeckControl * This, - /* [out] */ BMDDeckControlError *error); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, Stop) - HRESULT ( STDMETHODCALLTYPE *Stop )( - IDeckLinkDeckControl * This, - /* [out] */ BMDDeckControlError *error); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, TogglePlayStop) - HRESULT ( STDMETHODCALLTYPE *TogglePlayStop )( - IDeckLinkDeckControl * This, - /* [out] */ BMDDeckControlError *error); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, Eject) - HRESULT ( STDMETHODCALLTYPE *Eject )( - IDeckLinkDeckControl * This, - /* [out] */ BMDDeckControlError *error); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, GoToTimecode) - HRESULT ( STDMETHODCALLTYPE *GoToTimecode )( - IDeckLinkDeckControl * This, - /* [in] */ BMDTimecodeBCD timecode, - /* [out] */ BMDDeckControlError *error); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, FastForward) - HRESULT ( STDMETHODCALLTYPE *FastForward )( - IDeckLinkDeckControl * This, - /* [in] */ BOOL viewTape, - /* [out] */ BMDDeckControlError *error); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, Rewind) - HRESULT ( STDMETHODCALLTYPE *Rewind )( - IDeckLinkDeckControl * This, - /* [in] */ BOOL viewTape, - /* [out] */ BMDDeckControlError *error); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, StepForward) - HRESULT ( STDMETHODCALLTYPE *StepForward )( - IDeckLinkDeckControl * This, - /* [out] */ BMDDeckControlError *error); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, StepBack) - HRESULT ( STDMETHODCALLTYPE *StepBack )( - IDeckLinkDeckControl * This, - /* [out] */ BMDDeckControlError *error); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, Jog) - HRESULT ( STDMETHODCALLTYPE *Jog )( - IDeckLinkDeckControl * This, - /* [in] */ double rate, - /* [out] */ BMDDeckControlError *error); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, Shuttle) - HRESULT ( STDMETHODCALLTYPE *Shuttle )( - IDeckLinkDeckControl * This, - /* [in] */ double rate, - /* [out] */ BMDDeckControlError *error); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, GetTimecodeString) - HRESULT ( STDMETHODCALLTYPE *GetTimecodeString )( - IDeckLinkDeckControl * This, - /* [out] */ BSTR *currentTimeCode, - /* [out] */ BMDDeckControlError *error); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, GetTimecode) - HRESULT ( STDMETHODCALLTYPE *GetTimecode )( - IDeckLinkDeckControl * This, - /* [out] */ IDeckLinkTimecode **currentTimecode, - /* [out] */ BMDDeckControlError *error); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, GetTimecodeBCD) - HRESULT ( STDMETHODCALLTYPE *GetTimecodeBCD )( - IDeckLinkDeckControl * This, - /* [out] */ BMDTimecodeBCD *currentTimecode, - /* [out] */ BMDDeckControlError *error); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, SetPreroll) - HRESULT ( STDMETHODCALLTYPE *SetPreroll )( - IDeckLinkDeckControl * This, - /* [in] */ unsigned int prerollSeconds); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, GetPreroll) - HRESULT ( STDMETHODCALLTYPE *GetPreroll )( - IDeckLinkDeckControl * This, - /* [out] */ unsigned int *prerollSeconds); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, SetExportOffset) - HRESULT ( STDMETHODCALLTYPE *SetExportOffset )( - IDeckLinkDeckControl * This, - /* [in] */ int exportOffsetFields); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, GetExportOffset) - HRESULT ( STDMETHODCALLTYPE *GetExportOffset )( - IDeckLinkDeckControl * This, - /* [out] */ int *exportOffsetFields); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, GetManualExportOffset) - HRESULT ( STDMETHODCALLTYPE *GetManualExportOffset )( - IDeckLinkDeckControl * This, - /* [out] */ int *deckManualExportOffsetFields); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, SetCaptureOffset) - HRESULT ( STDMETHODCALLTYPE *SetCaptureOffset )( - IDeckLinkDeckControl * This, - /* [in] */ int captureOffsetFields); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, GetCaptureOffset) - HRESULT ( STDMETHODCALLTYPE *GetCaptureOffset )( - IDeckLinkDeckControl * This, - /* [out] */ int *captureOffsetFields); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, StartExport) - HRESULT ( STDMETHODCALLTYPE *StartExport )( - IDeckLinkDeckControl * This, - /* [in] */ BMDTimecodeBCD inTimecode, - /* [in] */ BMDTimecodeBCD outTimecode, - /* [in] */ BMDDeckControlExportModeOpsFlags exportModeOps, - /* [out] */ BMDDeckControlError *error); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, StartCapture) - HRESULT ( STDMETHODCALLTYPE *StartCapture )( - IDeckLinkDeckControl * This, - /* [in] */ BOOL useVITC, - /* [in] */ BMDTimecodeBCD inTimecode, - /* [in] */ BMDTimecodeBCD outTimecode, - /* [out] */ BMDDeckControlError *error); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, GetDeviceID) - HRESULT ( STDMETHODCALLTYPE *GetDeviceID )( - IDeckLinkDeckControl * This, - /* [out] */ unsigned short *deviceId, - /* [out] */ BMDDeckControlError *error); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, Abort) - HRESULT ( STDMETHODCALLTYPE *Abort )( - IDeckLinkDeckControl * This); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, CrashRecordStart) - HRESULT ( STDMETHODCALLTYPE *CrashRecordStart )( - IDeckLinkDeckControl * This, - /* [out] */ BMDDeckControlError *error); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, CrashRecordStop) - HRESULT ( STDMETHODCALLTYPE *CrashRecordStop )( - IDeckLinkDeckControl * This, - /* [out] */ BMDDeckControlError *error); - - DECLSPEC_XFGVIRT(IDeckLinkDeckControl, SetCallback) - HRESULT ( STDMETHODCALLTYPE *SetCallback )( - IDeckLinkDeckControl * This, - /* [in] */ IDeckLinkDeckControlStatusCallback *callback); - - END_INTERFACE - } IDeckLinkDeckControlVtbl; - - interface IDeckLinkDeckControl - { - CONST_VTBL struct IDeckLinkDeckControlVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkDeckControl_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkDeckControl_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkDeckControl_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkDeckControl_Open(This,timeScale,timeValue,timecodeIsDropFrame,error) \ - ( (This)->lpVtbl -> Open(This,timeScale,timeValue,timecodeIsDropFrame,error) ) - -#define IDeckLinkDeckControl_Close(This,standbyOn) \ - ( (This)->lpVtbl -> Close(This,standbyOn) ) - -#define IDeckLinkDeckControl_GetCurrentState(This,mode,vtrControlState,flags) \ - ( (This)->lpVtbl -> GetCurrentState(This,mode,vtrControlState,flags) ) - -#define IDeckLinkDeckControl_SetStandby(This,standbyOn) \ - ( (This)->lpVtbl -> SetStandby(This,standbyOn) ) - -#define IDeckLinkDeckControl_SendCommand(This,inBuffer,inBufferSize,outBuffer,outDataSize,outBufferSize,error) \ - ( (This)->lpVtbl -> SendCommand(This,inBuffer,inBufferSize,outBuffer,outDataSize,outBufferSize,error) ) - -#define IDeckLinkDeckControl_Play(This,error) \ - ( (This)->lpVtbl -> Play(This,error) ) - -#define IDeckLinkDeckControl_Stop(This,error) \ - ( (This)->lpVtbl -> Stop(This,error) ) - -#define IDeckLinkDeckControl_TogglePlayStop(This,error) \ - ( (This)->lpVtbl -> TogglePlayStop(This,error) ) - -#define IDeckLinkDeckControl_Eject(This,error) \ - ( (This)->lpVtbl -> Eject(This,error) ) - -#define IDeckLinkDeckControl_GoToTimecode(This,timecode,error) \ - ( (This)->lpVtbl -> GoToTimecode(This,timecode,error) ) - -#define IDeckLinkDeckControl_FastForward(This,viewTape,error) \ - ( (This)->lpVtbl -> FastForward(This,viewTape,error) ) - -#define IDeckLinkDeckControl_Rewind(This,viewTape,error) \ - ( (This)->lpVtbl -> Rewind(This,viewTape,error) ) - -#define IDeckLinkDeckControl_StepForward(This,error) \ - ( (This)->lpVtbl -> StepForward(This,error) ) - -#define IDeckLinkDeckControl_StepBack(This,error) \ - ( (This)->lpVtbl -> StepBack(This,error) ) - -#define IDeckLinkDeckControl_Jog(This,rate,error) \ - ( (This)->lpVtbl -> Jog(This,rate,error) ) - -#define IDeckLinkDeckControl_Shuttle(This,rate,error) \ - ( (This)->lpVtbl -> Shuttle(This,rate,error) ) - -#define IDeckLinkDeckControl_GetTimecodeString(This,currentTimeCode,error) \ - ( (This)->lpVtbl -> GetTimecodeString(This,currentTimeCode,error) ) - -#define IDeckLinkDeckControl_GetTimecode(This,currentTimecode,error) \ - ( (This)->lpVtbl -> GetTimecode(This,currentTimecode,error) ) - -#define IDeckLinkDeckControl_GetTimecodeBCD(This,currentTimecode,error) \ - ( (This)->lpVtbl -> GetTimecodeBCD(This,currentTimecode,error) ) - -#define IDeckLinkDeckControl_SetPreroll(This,prerollSeconds) \ - ( (This)->lpVtbl -> SetPreroll(This,prerollSeconds) ) - -#define IDeckLinkDeckControl_GetPreroll(This,prerollSeconds) \ - ( (This)->lpVtbl -> GetPreroll(This,prerollSeconds) ) - -#define IDeckLinkDeckControl_SetExportOffset(This,exportOffsetFields) \ - ( (This)->lpVtbl -> SetExportOffset(This,exportOffsetFields) ) - -#define IDeckLinkDeckControl_GetExportOffset(This,exportOffsetFields) \ - ( (This)->lpVtbl -> GetExportOffset(This,exportOffsetFields) ) - -#define IDeckLinkDeckControl_GetManualExportOffset(This,deckManualExportOffsetFields) \ - ( (This)->lpVtbl -> GetManualExportOffset(This,deckManualExportOffsetFields) ) - -#define IDeckLinkDeckControl_SetCaptureOffset(This,captureOffsetFields) \ - ( (This)->lpVtbl -> SetCaptureOffset(This,captureOffsetFields) ) - -#define IDeckLinkDeckControl_GetCaptureOffset(This,captureOffsetFields) \ - ( (This)->lpVtbl -> GetCaptureOffset(This,captureOffsetFields) ) - -#define IDeckLinkDeckControl_StartExport(This,inTimecode,outTimecode,exportModeOps,error) \ - ( (This)->lpVtbl -> StartExport(This,inTimecode,outTimecode,exportModeOps,error) ) - -#define IDeckLinkDeckControl_StartCapture(This,useVITC,inTimecode,outTimecode,error) \ - ( (This)->lpVtbl -> StartCapture(This,useVITC,inTimecode,outTimecode,error) ) - -#define IDeckLinkDeckControl_GetDeviceID(This,deviceId,error) \ - ( (This)->lpVtbl -> GetDeviceID(This,deviceId,error) ) - -#define IDeckLinkDeckControl_Abort(This) \ - ( (This)->lpVtbl -> Abort(This) ) - -#define IDeckLinkDeckControl_CrashRecordStart(This,error) \ - ( (This)->lpVtbl -> CrashRecordStart(This,error) ) - -#define IDeckLinkDeckControl_CrashRecordStop(This,error) \ - ( (This)->lpVtbl -> CrashRecordStop(This,error) ) - -#define IDeckLinkDeckControl_SetCallback(This,callback) \ - ( (This)->lpVtbl -> SetCallback(This,callback) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkDeckControl_INTERFACE_DEFINED__ */ - - -#ifndef __IBMDStreamingDeviceNotificationCallback_INTERFACE_DEFINED__ -#define __IBMDStreamingDeviceNotificationCallback_INTERFACE_DEFINED__ - -/* interface IBMDStreamingDeviceNotificationCallback */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IBMDStreamingDeviceNotificationCallback; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("F9531D64-3305-4B29-A387-7F74BB0D0E84") - IBMDStreamingDeviceNotificationCallback : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE StreamingDeviceArrived( - /* [in] */ IDeckLink *device) = 0; - - virtual HRESULT STDMETHODCALLTYPE StreamingDeviceRemoved( - /* [in] */ IDeckLink *device) = 0; - - virtual HRESULT STDMETHODCALLTYPE StreamingDeviceModeChanged( - /* [in] */ IDeckLink *device, - /* [in] */ BMDStreamingDeviceMode mode) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IBMDStreamingDeviceNotificationCallbackVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IBMDStreamingDeviceNotificationCallback * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IBMDStreamingDeviceNotificationCallback * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IBMDStreamingDeviceNotificationCallback * This); - - DECLSPEC_XFGVIRT(IBMDStreamingDeviceNotificationCallback, StreamingDeviceArrived) - HRESULT ( STDMETHODCALLTYPE *StreamingDeviceArrived )( - IBMDStreamingDeviceNotificationCallback * This, - /* [in] */ IDeckLink *device); - - DECLSPEC_XFGVIRT(IBMDStreamingDeviceNotificationCallback, StreamingDeviceRemoved) - HRESULT ( STDMETHODCALLTYPE *StreamingDeviceRemoved )( - IBMDStreamingDeviceNotificationCallback * This, - /* [in] */ IDeckLink *device); - - DECLSPEC_XFGVIRT(IBMDStreamingDeviceNotificationCallback, StreamingDeviceModeChanged) - HRESULT ( STDMETHODCALLTYPE *StreamingDeviceModeChanged )( - IBMDStreamingDeviceNotificationCallback * This, - /* [in] */ IDeckLink *device, - /* [in] */ BMDStreamingDeviceMode mode); - - END_INTERFACE - } IBMDStreamingDeviceNotificationCallbackVtbl; - - interface IBMDStreamingDeviceNotificationCallback - { - CONST_VTBL struct IBMDStreamingDeviceNotificationCallbackVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IBMDStreamingDeviceNotificationCallback_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IBMDStreamingDeviceNotificationCallback_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IBMDStreamingDeviceNotificationCallback_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IBMDStreamingDeviceNotificationCallback_StreamingDeviceArrived(This,device) \ - ( (This)->lpVtbl -> StreamingDeviceArrived(This,device) ) - -#define IBMDStreamingDeviceNotificationCallback_StreamingDeviceRemoved(This,device) \ - ( (This)->lpVtbl -> StreamingDeviceRemoved(This,device) ) - -#define IBMDStreamingDeviceNotificationCallback_StreamingDeviceModeChanged(This,device,mode) \ - ( (This)->lpVtbl -> StreamingDeviceModeChanged(This,device,mode) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IBMDStreamingDeviceNotificationCallback_INTERFACE_DEFINED__ */ - - -#ifndef __IBMDStreamingH264InputCallback_INTERFACE_DEFINED__ -#define __IBMDStreamingH264InputCallback_INTERFACE_DEFINED__ - -/* interface IBMDStreamingH264InputCallback */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IBMDStreamingH264InputCallback; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("823C475F-55AE-46F9-890C-537CC5CEDCCA") - IBMDStreamingH264InputCallback : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE H264NALPacketArrived( - /* [in] */ IBMDStreamingH264NALPacket *nalPacket) = 0; - - virtual HRESULT STDMETHODCALLTYPE H264AudioPacketArrived( - /* [in] */ IBMDStreamingAudioPacket *audioPacket) = 0; - - virtual HRESULT STDMETHODCALLTYPE MPEG2TSPacketArrived( - /* [in] */ IBMDStreamingMPEG2TSPacket *tsPacket) = 0; - - virtual HRESULT STDMETHODCALLTYPE H264VideoInputConnectorScanningChanged( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE H264VideoInputConnectorChanged( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE H264VideoInputModeChanged( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IBMDStreamingH264InputCallbackVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IBMDStreamingH264InputCallback * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IBMDStreamingH264InputCallback * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IBMDStreamingH264InputCallback * This); - - DECLSPEC_XFGVIRT(IBMDStreamingH264InputCallback, H264NALPacketArrived) - HRESULT ( STDMETHODCALLTYPE *H264NALPacketArrived )( - IBMDStreamingH264InputCallback * This, - /* [in] */ IBMDStreamingH264NALPacket *nalPacket); - - DECLSPEC_XFGVIRT(IBMDStreamingH264InputCallback, H264AudioPacketArrived) - HRESULT ( STDMETHODCALLTYPE *H264AudioPacketArrived )( - IBMDStreamingH264InputCallback * This, - /* [in] */ IBMDStreamingAudioPacket *audioPacket); - - DECLSPEC_XFGVIRT(IBMDStreamingH264InputCallback, MPEG2TSPacketArrived) - HRESULT ( STDMETHODCALLTYPE *MPEG2TSPacketArrived )( - IBMDStreamingH264InputCallback * This, - /* [in] */ IBMDStreamingMPEG2TSPacket *tsPacket); - - DECLSPEC_XFGVIRT(IBMDStreamingH264InputCallback, H264VideoInputConnectorScanningChanged) - HRESULT ( STDMETHODCALLTYPE *H264VideoInputConnectorScanningChanged )( - IBMDStreamingH264InputCallback * This); - - DECLSPEC_XFGVIRT(IBMDStreamingH264InputCallback, H264VideoInputConnectorChanged) - HRESULT ( STDMETHODCALLTYPE *H264VideoInputConnectorChanged )( - IBMDStreamingH264InputCallback * This); - - DECLSPEC_XFGVIRT(IBMDStreamingH264InputCallback, H264VideoInputModeChanged) - HRESULT ( STDMETHODCALLTYPE *H264VideoInputModeChanged )( - IBMDStreamingH264InputCallback * This); - - END_INTERFACE - } IBMDStreamingH264InputCallbackVtbl; - - interface IBMDStreamingH264InputCallback - { - CONST_VTBL struct IBMDStreamingH264InputCallbackVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IBMDStreamingH264InputCallback_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IBMDStreamingH264InputCallback_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IBMDStreamingH264InputCallback_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IBMDStreamingH264InputCallback_H264NALPacketArrived(This,nalPacket) \ - ( (This)->lpVtbl -> H264NALPacketArrived(This,nalPacket) ) - -#define IBMDStreamingH264InputCallback_H264AudioPacketArrived(This,audioPacket) \ - ( (This)->lpVtbl -> H264AudioPacketArrived(This,audioPacket) ) - -#define IBMDStreamingH264InputCallback_MPEG2TSPacketArrived(This,tsPacket) \ - ( (This)->lpVtbl -> MPEG2TSPacketArrived(This,tsPacket) ) - -#define IBMDStreamingH264InputCallback_H264VideoInputConnectorScanningChanged(This) \ - ( (This)->lpVtbl -> H264VideoInputConnectorScanningChanged(This) ) - -#define IBMDStreamingH264InputCallback_H264VideoInputConnectorChanged(This) \ - ( (This)->lpVtbl -> H264VideoInputConnectorChanged(This) ) - -#define IBMDStreamingH264InputCallback_H264VideoInputModeChanged(This) \ - ( (This)->lpVtbl -> H264VideoInputModeChanged(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IBMDStreamingH264InputCallback_INTERFACE_DEFINED__ */ - - -#ifndef __IBMDStreamingDiscovery_INTERFACE_DEFINED__ -#define __IBMDStreamingDiscovery_INTERFACE_DEFINED__ - -/* interface IBMDStreamingDiscovery */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IBMDStreamingDiscovery; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("2C837444-F989-4D87-901A-47C8A36D096D") - IBMDStreamingDiscovery : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE InstallDeviceNotifications( - /* [in] */ IBMDStreamingDeviceNotificationCallback *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE UninstallDeviceNotifications( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IBMDStreamingDiscoveryVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IBMDStreamingDiscovery * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IBMDStreamingDiscovery * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IBMDStreamingDiscovery * This); - - DECLSPEC_XFGVIRT(IBMDStreamingDiscovery, InstallDeviceNotifications) - HRESULT ( STDMETHODCALLTYPE *InstallDeviceNotifications )( - IBMDStreamingDiscovery * This, - /* [in] */ IBMDStreamingDeviceNotificationCallback *theCallback); - - DECLSPEC_XFGVIRT(IBMDStreamingDiscovery, UninstallDeviceNotifications) - HRESULT ( STDMETHODCALLTYPE *UninstallDeviceNotifications )( - IBMDStreamingDiscovery * This); - - END_INTERFACE - } IBMDStreamingDiscoveryVtbl; - - interface IBMDStreamingDiscovery - { - CONST_VTBL struct IBMDStreamingDiscoveryVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IBMDStreamingDiscovery_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IBMDStreamingDiscovery_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IBMDStreamingDiscovery_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IBMDStreamingDiscovery_InstallDeviceNotifications(This,theCallback) \ - ( (This)->lpVtbl -> InstallDeviceNotifications(This,theCallback) ) - -#define IBMDStreamingDiscovery_UninstallDeviceNotifications(This) \ - ( (This)->lpVtbl -> UninstallDeviceNotifications(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IBMDStreamingDiscovery_INTERFACE_DEFINED__ */ - - -#ifndef __IBMDStreamingVideoEncodingMode_INTERFACE_DEFINED__ -#define __IBMDStreamingVideoEncodingMode_INTERFACE_DEFINED__ - -/* interface IBMDStreamingVideoEncodingMode */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IBMDStreamingVideoEncodingMode; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("1AB8035B-CD13-458D-B6DF-5E8F7C2141D9") - IBMDStreamingVideoEncodingMode : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetName( - /* [out] */ BSTR *name) = 0; - - virtual unsigned int STDMETHODCALLTYPE GetPresetID( void) = 0; - - virtual unsigned int STDMETHODCALLTYPE GetSourcePositionX( void) = 0; - - virtual unsigned int STDMETHODCALLTYPE GetSourcePositionY( void) = 0; - - virtual unsigned int STDMETHODCALLTYPE GetSourceWidth( void) = 0; - - virtual unsigned int STDMETHODCALLTYPE GetSourceHeight( void) = 0; - - virtual unsigned int STDMETHODCALLTYPE GetDestWidth( void) = 0; - - virtual unsigned int STDMETHODCALLTYPE GetDestHeight( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFlag( - /* [in] */ BMDStreamingEncodingModePropertyID cfgID, - /* [out] */ BOOL *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetInt( - /* [in] */ BMDStreamingEncodingModePropertyID cfgID, - /* [out] */ LONGLONG *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFloat( - /* [in] */ BMDStreamingEncodingModePropertyID cfgID, - /* [out] */ double *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetString( - /* [in] */ BMDStreamingEncodingModePropertyID cfgID, - /* [out] */ BSTR *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateMutableVideoEncodingMode( - /* [out] */ IBMDStreamingMutableVideoEncodingMode **newEncodingMode) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IBMDStreamingVideoEncodingModeVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IBMDStreamingVideoEncodingMode * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IBMDStreamingVideoEncodingMode * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IBMDStreamingVideoEncodingMode * This); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, GetName) - HRESULT ( STDMETHODCALLTYPE *GetName )( - IBMDStreamingVideoEncodingMode * This, - /* [out] */ BSTR *name); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, GetPresetID) - unsigned int ( STDMETHODCALLTYPE *GetPresetID )( - IBMDStreamingVideoEncodingMode * This); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, GetSourcePositionX) - unsigned int ( STDMETHODCALLTYPE *GetSourcePositionX )( - IBMDStreamingVideoEncodingMode * This); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, GetSourcePositionY) - unsigned int ( STDMETHODCALLTYPE *GetSourcePositionY )( - IBMDStreamingVideoEncodingMode * This); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, GetSourceWidth) - unsigned int ( STDMETHODCALLTYPE *GetSourceWidth )( - IBMDStreamingVideoEncodingMode * This); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, GetSourceHeight) - unsigned int ( STDMETHODCALLTYPE *GetSourceHeight )( - IBMDStreamingVideoEncodingMode * This); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, GetDestWidth) - unsigned int ( STDMETHODCALLTYPE *GetDestWidth )( - IBMDStreamingVideoEncodingMode * This); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, GetDestHeight) - unsigned int ( STDMETHODCALLTYPE *GetDestHeight )( - IBMDStreamingVideoEncodingMode * This); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, GetFlag) - HRESULT ( STDMETHODCALLTYPE *GetFlag )( - IBMDStreamingVideoEncodingMode * This, - /* [in] */ BMDStreamingEncodingModePropertyID cfgID, - /* [out] */ BOOL *value); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, GetInt) - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IBMDStreamingVideoEncodingMode * This, - /* [in] */ BMDStreamingEncodingModePropertyID cfgID, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, GetFloat) - HRESULT ( STDMETHODCALLTYPE *GetFloat )( - IBMDStreamingVideoEncodingMode * This, - /* [in] */ BMDStreamingEncodingModePropertyID cfgID, - /* [out] */ double *value); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, GetString) - HRESULT ( STDMETHODCALLTYPE *GetString )( - IBMDStreamingVideoEncodingMode * This, - /* [in] */ BMDStreamingEncodingModePropertyID cfgID, - /* [out] */ BSTR *value); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, CreateMutableVideoEncodingMode) - HRESULT ( STDMETHODCALLTYPE *CreateMutableVideoEncodingMode )( - IBMDStreamingVideoEncodingMode * This, - /* [out] */ IBMDStreamingMutableVideoEncodingMode **newEncodingMode); - - END_INTERFACE - } IBMDStreamingVideoEncodingModeVtbl; - - interface IBMDStreamingVideoEncodingMode - { - CONST_VTBL struct IBMDStreamingVideoEncodingModeVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IBMDStreamingVideoEncodingMode_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IBMDStreamingVideoEncodingMode_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IBMDStreamingVideoEncodingMode_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IBMDStreamingVideoEncodingMode_GetName(This,name) \ - ( (This)->lpVtbl -> GetName(This,name) ) - -#define IBMDStreamingVideoEncodingMode_GetPresetID(This) \ - ( (This)->lpVtbl -> GetPresetID(This) ) - -#define IBMDStreamingVideoEncodingMode_GetSourcePositionX(This) \ - ( (This)->lpVtbl -> GetSourcePositionX(This) ) - -#define IBMDStreamingVideoEncodingMode_GetSourcePositionY(This) \ - ( (This)->lpVtbl -> GetSourcePositionY(This) ) - -#define IBMDStreamingVideoEncodingMode_GetSourceWidth(This) \ - ( (This)->lpVtbl -> GetSourceWidth(This) ) - -#define IBMDStreamingVideoEncodingMode_GetSourceHeight(This) \ - ( (This)->lpVtbl -> GetSourceHeight(This) ) - -#define IBMDStreamingVideoEncodingMode_GetDestWidth(This) \ - ( (This)->lpVtbl -> GetDestWidth(This) ) - -#define IBMDStreamingVideoEncodingMode_GetDestHeight(This) \ - ( (This)->lpVtbl -> GetDestHeight(This) ) - -#define IBMDStreamingVideoEncodingMode_GetFlag(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) - -#define IBMDStreamingVideoEncodingMode_GetInt(This,cfgID,value) \ - ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) - -#define IBMDStreamingVideoEncodingMode_GetFloat(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) - -#define IBMDStreamingVideoEncodingMode_GetString(This,cfgID,value) \ - ( (This)->lpVtbl -> GetString(This,cfgID,value) ) - -#define IBMDStreamingVideoEncodingMode_CreateMutableVideoEncodingMode(This,newEncodingMode) \ - ( (This)->lpVtbl -> CreateMutableVideoEncodingMode(This,newEncodingMode) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IBMDStreamingVideoEncodingMode_INTERFACE_DEFINED__ */ - - -#ifndef __IBMDStreamingMutableVideoEncodingMode_INTERFACE_DEFINED__ -#define __IBMDStreamingMutableVideoEncodingMode_INTERFACE_DEFINED__ - -/* interface IBMDStreamingMutableVideoEncodingMode */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IBMDStreamingMutableVideoEncodingMode; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("19BF7D90-1E0A-400D-B2C6-FFC4E78AD49D") - IBMDStreamingMutableVideoEncodingMode : public IBMDStreamingVideoEncodingMode - { - public: - virtual HRESULT STDMETHODCALLTYPE SetSourceRect( - /* [in] */ unsigned int posX, - /* [in] */ unsigned int posY, - /* [in] */ unsigned int width, - /* [in] */ unsigned int height) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetDestSize( - /* [in] */ unsigned int width, - /* [in] */ unsigned int height) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFlag( - /* [in] */ BMDStreamingEncodingModePropertyID cfgID, - /* [in] */ BOOL value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetInt( - /* [in] */ BMDStreamingEncodingModePropertyID cfgID, - /* [in] */ LONGLONG value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFloat( - /* [in] */ BMDStreamingEncodingModePropertyID cfgID, - /* [in] */ double value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetString( - /* [in] */ BMDStreamingEncodingModePropertyID cfgID, - /* [in] */ BSTR value) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IBMDStreamingMutableVideoEncodingModeVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IBMDStreamingMutableVideoEncodingMode * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IBMDStreamingMutableVideoEncodingMode * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IBMDStreamingMutableVideoEncodingMode * This); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, GetName) - HRESULT ( STDMETHODCALLTYPE *GetName )( - IBMDStreamingMutableVideoEncodingMode * This, - /* [out] */ BSTR *name); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, GetPresetID) - unsigned int ( STDMETHODCALLTYPE *GetPresetID )( - IBMDStreamingMutableVideoEncodingMode * This); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, GetSourcePositionX) - unsigned int ( STDMETHODCALLTYPE *GetSourcePositionX )( - IBMDStreamingMutableVideoEncodingMode * This); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, GetSourcePositionY) - unsigned int ( STDMETHODCALLTYPE *GetSourcePositionY )( - IBMDStreamingMutableVideoEncodingMode * This); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, GetSourceWidth) - unsigned int ( STDMETHODCALLTYPE *GetSourceWidth )( - IBMDStreamingMutableVideoEncodingMode * This); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, GetSourceHeight) - unsigned int ( STDMETHODCALLTYPE *GetSourceHeight )( - IBMDStreamingMutableVideoEncodingMode * This); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, GetDestWidth) - unsigned int ( STDMETHODCALLTYPE *GetDestWidth )( - IBMDStreamingMutableVideoEncodingMode * This); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, GetDestHeight) - unsigned int ( STDMETHODCALLTYPE *GetDestHeight )( - IBMDStreamingMutableVideoEncodingMode * This); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, GetFlag) - HRESULT ( STDMETHODCALLTYPE *GetFlag )( - IBMDStreamingMutableVideoEncodingMode * This, - /* [in] */ BMDStreamingEncodingModePropertyID cfgID, - /* [out] */ BOOL *value); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, GetInt) - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IBMDStreamingMutableVideoEncodingMode * This, - /* [in] */ BMDStreamingEncodingModePropertyID cfgID, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, GetFloat) - HRESULT ( STDMETHODCALLTYPE *GetFloat )( - IBMDStreamingMutableVideoEncodingMode * This, - /* [in] */ BMDStreamingEncodingModePropertyID cfgID, - /* [out] */ double *value); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, GetString) - HRESULT ( STDMETHODCALLTYPE *GetString )( - IBMDStreamingMutableVideoEncodingMode * This, - /* [in] */ BMDStreamingEncodingModePropertyID cfgID, - /* [out] */ BSTR *value); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingMode, CreateMutableVideoEncodingMode) - HRESULT ( STDMETHODCALLTYPE *CreateMutableVideoEncodingMode )( - IBMDStreamingMutableVideoEncodingMode * This, - /* [out] */ IBMDStreamingMutableVideoEncodingMode **newEncodingMode); - - DECLSPEC_XFGVIRT(IBMDStreamingMutableVideoEncodingMode, SetSourceRect) - HRESULT ( STDMETHODCALLTYPE *SetSourceRect )( - IBMDStreamingMutableVideoEncodingMode * This, - /* [in] */ unsigned int posX, - /* [in] */ unsigned int posY, - /* [in] */ unsigned int width, - /* [in] */ unsigned int height); - - DECLSPEC_XFGVIRT(IBMDStreamingMutableVideoEncodingMode, SetDestSize) - HRESULT ( STDMETHODCALLTYPE *SetDestSize )( - IBMDStreamingMutableVideoEncodingMode * This, - /* [in] */ unsigned int width, - /* [in] */ unsigned int height); - - DECLSPEC_XFGVIRT(IBMDStreamingMutableVideoEncodingMode, SetFlag) - HRESULT ( STDMETHODCALLTYPE *SetFlag )( - IBMDStreamingMutableVideoEncodingMode * This, - /* [in] */ BMDStreamingEncodingModePropertyID cfgID, - /* [in] */ BOOL value); - - DECLSPEC_XFGVIRT(IBMDStreamingMutableVideoEncodingMode, SetInt) - HRESULT ( STDMETHODCALLTYPE *SetInt )( - IBMDStreamingMutableVideoEncodingMode * This, - /* [in] */ BMDStreamingEncodingModePropertyID cfgID, - /* [in] */ LONGLONG value); - - DECLSPEC_XFGVIRT(IBMDStreamingMutableVideoEncodingMode, SetFloat) - HRESULT ( STDMETHODCALLTYPE *SetFloat )( - IBMDStreamingMutableVideoEncodingMode * This, - /* [in] */ BMDStreamingEncodingModePropertyID cfgID, - /* [in] */ double value); - - DECLSPEC_XFGVIRT(IBMDStreamingMutableVideoEncodingMode, SetString) - HRESULT ( STDMETHODCALLTYPE *SetString )( - IBMDStreamingMutableVideoEncodingMode * This, - /* [in] */ BMDStreamingEncodingModePropertyID cfgID, - /* [in] */ BSTR value); - - END_INTERFACE - } IBMDStreamingMutableVideoEncodingModeVtbl; - - interface IBMDStreamingMutableVideoEncodingMode - { - CONST_VTBL struct IBMDStreamingMutableVideoEncodingModeVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IBMDStreamingMutableVideoEncodingMode_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IBMDStreamingMutableVideoEncodingMode_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IBMDStreamingMutableVideoEncodingMode_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IBMDStreamingMutableVideoEncodingMode_GetName(This,name) \ - ( (This)->lpVtbl -> GetName(This,name) ) - -#define IBMDStreamingMutableVideoEncodingMode_GetPresetID(This) \ - ( (This)->lpVtbl -> GetPresetID(This) ) - -#define IBMDStreamingMutableVideoEncodingMode_GetSourcePositionX(This) \ - ( (This)->lpVtbl -> GetSourcePositionX(This) ) - -#define IBMDStreamingMutableVideoEncodingMode_GetSourcePositionY(This) \ - ( (This)->lpVtbl -> GetSourcePositionY(This) ) - -#define IBMDStreamingMutableVideoEncodingMode_GetSourceWidth(This) \ - ( (This)->lpVtbl -> GetSourceWidth(This) ) - -#define IBMDStreamingMutableVideoEncodingMode_GetSourceHeight(This) \ - ( (This)->lpVtbl -> GetSourceHeight(This) ) - -#define IBMDStreamingMutableVideoEncodingMode_GetDestWidth(This) \ - ( (This)->lpVtbl -> GetDestWidth(This) ) - -#define IBMDStreamingMutableVideoEncodingMode_GetDestHeight(This) \ - ( (This)->lpVtbl -> GetDestHeight(This) ) - -#define IBMDStreamingMutableVideoEncodingMode_GetFlag(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) - -#define IBMDStreamingMutableVideoEncodingMode_GetInt(This,cfgID,value) \ - ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) - -#define IBMDStreamingMutableVideoEncodingMode_GetFloat(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) - -#define IBMDStreamingMutableVideoEncodingMode_GetString(This,cfgID,value) \ - ( (This)->lpVtbl -> GetString(This,cfgID,value) ) - -#define IBMDStreamingMutableVideoEncodingMode_CreateMutableVideoEncodingMode(This,newEncodingMode) \ - ( (This)->lpVtbl -> CreateMutableVideoEncodingMode(This,newEncodingMode) ) - - -#define IBMDStreamingMutableVideoEncodingMode_SetSourceRect(This,posX,posY,width,height) \ - ( (This)->lpVtbl -> SetSourceRect(This,posX,posY,width,height) ) - -#define IBMDStreamingMutableVideoEncodingMode_SetDestSize(This,width,height) \ - ( (This)->lpVtbl -> SetDestSize(This,width,height) ) - -#define IBMDStreamingMutableVideoEncodingMode_SetFlag(This,cfgID,value) \ - ( (This)->lpVtbl -> SetFlag(This,cfgID,value) ) - -#define IBMDStreamingMutableVideoEncodingMode_SetInt(This,cfgID,value) \ - ( (This)->lpVtbl -> SetInt(This,cfgID,value) ) - -#define IBMDStreamingMutableVideoEncodingMode_SetFloat(This,cfgID,value) \ - ( (This)->lpVtbl -> SetFloat(This,cfgID,value) ) - -#define IBMDStreamingMutableVideoEncodingMode_SetString(This,cfgID,value) \ - ( (This)->lpVtbl -> SetString(This,cfgID,value) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IBMDStreamingMutableVideoEncodingMode_INTERFACE_DEFINED__ */ - - -#ifndef __IBMDStreamingVideoEncodingModePresetIterator_INTERFACE_DEFINED__ -#define __IBMDStreamingVideoEncodingModePresetIterator_INTERFACE_DEFINED__ - -/* interface IBMDStreamingVideoEncodingModePresetIterator */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IBMDStreamingVideoEncodingModePresetIterator; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("7AC731A3-C950-4AD0-804A-8377AA51C6C4") - IBMDStreamingVideoEncodingModePresetIterator : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Next( - /* [out] */ IBMDStreamingVideoEncodingMode **videoEncodingMode) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IBMDStreamingVideoEncodingModePresetIteratorVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IBMDStreamingVideoEncodingModePresetIterator * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IBMDStreamingVideoEncodingModePresetIterator * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IBMDStreamingVideoEncodingModePresetIterator * This); - - DECLSPEC_XFGVIRT(IBMDStreamingVideoEncodingModePresetIterator, Next) - HRESULT ( STDMETHODCALLTYPE *Next )( - IBMDStreamingVideoEncodingModePresetIterator * This, - /* [out] */ IBMDStreamingVideoEncodingMode **videoEncodingMode); - - END_INTERFACE - } IBMDStreamingVideoEncodingModePresetIteratorVtbl; - - interface IBMDStreamingVideoEncodingModePresetIterator - { - CONST_VTBL struct IBMDStreamingVideoEncodingModePresetIteratorVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IBMDStreamingVideoEncodingModePresetIterator_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IBMDStreamingVideoEncodingModePresetIterator_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IBMDStreamingVideoEncodingModePresetIterator_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IBMDStreamingVideoEncodingModePresetIterator_Next(This,videoEncodingMode) \ - ( (This)->lpVtbl -> Next(This,videoEncodingMode) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IBMDStreamingVideoEncodingModePresetIterator_INTERFACE_DEFINED__ */ - - -#ifndef __IBMDStreamingDeviceInput_INTERFACE_DEFINED__ -#define __IBMDStreamingDeviceInput_INTERFACE_DEFINED__ - -/* interface IBMDStreamingDeviceInput */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IBMDStreamingDeviceInput; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("24B6B6EC-1727-44BB-9818-34FF086ACF98") - IBMDStreamingDeviceInput : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoInputMode( - /* [in] */ BMDDisplayMode inputMode, - /* [out] */ BOOL *result) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetVideoInputModeIterator( - /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetVideoInputMode( - /* [in] */ BMDDisplayMode inputMode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCurrentDetectedVideoInputMode( - /* [out] */ BMDDisplayMode *detectedMode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetVideoEncodingMode( - /* [out] */ IBMDStreamingVideoEncodingMode **encodingMode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetVideoEncodingModePresetIterator( - /* [in] */ BMDDisplayMode inputMode, - /* [out] */ IBMDStreamingVideoEncodingModePresetIterator **iterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoEncodingMode( - /* [in] */ BMDDisplayMode inputMode, - /* [in] */ IBMDStreamingVideoEncodingMode *encodingMode, - /* [out] */ BMDStreamingEncodingSupport *result, - /* [out] */ IBMDStreamingVideoEncodingMode **changedEncodingMode) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetVideoEncodingMode( - /* [in] */ IBMDStreamingVideoEncodingMode *encodingMode) = 0; - - virtual HRESULT STDMETHODCALLTYPE StartCapture( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE StopCapture( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetCallback( - /* [in] */ IUnknown *theCallback) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IBMDStreamingDeviceInputVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IBMDStreamingDeviceInput * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IBMDStreamingDeviceInput * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IBMDStreamingDeviceInput * This); - - DECLSPEC_XFGVIRT(IBMDStreamingDeviceInput, DoesSupportVideoInputMode) - HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoInputMode )( - IBMDStreamingDeviceInput * This, - /* [in] */ BMDDisplayMode inputMode, - /* [out] */ BOOL *result); - - DECLSPEC_XFGVIRT(IBMDStreamingDeviceInput, GetVideoInputModeIterator) - HRESULT ( STDMETHODCALLTYPE *GetVideoInputModeIterator )( - IBMDStreamingDeviceInput * This, - /* [out] */ IDeckLinkDisplayModeIterator **iterator); - - DECLSPEC_XFGVIRT(IBMDStreamingDeviceInput, SetVideoInputMode) - HRESULT ( STDMETHODCALLTYPE *SetVideoInputMode )( - IBMDStreamingDeviceInput * This, - /* [in] */ BMDDisplayMode inputMode); - - DECLSPEC_XFGVIRT(IBMDStreamingDeviceInput, GetCurrentDetectedVideoInputMode) - HRESULT ( STDMETHODCALLTYPE *GetCurrentDetectedVideoInputMode )( - IBMDStreamingDeviceInput * This, - /* [out] */ BMDDisplayMode *detectedMode); - - DECLSPEC_XFGVIRT(IBMDStreamingDeviceInput, GetVideoEncodingMode) - HRESULT ( STDMETHODCALLTYPE *GetVideoEncodingMode )( - IBMDStreamingDeviceInput * This, - /* [out] */ IBMDStreamingVideoEncodingMode **encodingMode); - - DECLSPEC_XFGVIRT(IBMDStreamingDeviceInput, GetVideoEncodingModePresetIterator) - HRESULT ( STDMETHODCALLTYPE *GetVideoEncodingModePresetIterator )( - IBMDStreamingDeviceInput * This, - /* [in] */ BMDDisplayMode inputMode, - /* [out] */ IBMDStreamingVideoEncodingModePresetIterator **iterator); - - DECLSPEC_XFGVIRT(IBMDStreamingDeviceInput, DoesSupportVideoEncodingMode) - HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoEncodingMode )( - IBMDStreamingDeviceInput * This, - /* [in] */ BMDDisplayMode inputMode, - /* [in] */ IBMDStreamingVideoEncodingMode *encodingMode, - /* [out] */ BMDStreamingEncodingSupport *result, - /* [out] */ IBMDStreamingVideoEncodingMode **changedEncodingMode); - - DECLSPEC_XFGVIRT(IBMDStreamingDeviceInput, SetVideoEncodingMode) - HRESULT ( STDMETHODCALLTYPE *SetVideoEncodingMode )( - IBMDStreamingDeviceInput * This, - /* [in] */ IBMDStreamingVideoEncodingMode *encodingMode); - - DECLSPEC_XFGVIRT(IBMDStreamingDeviceInput, StartCapture) - HRESULT ( STDMETHODCALLTYPE *StartCapture )( - IBMDStreamingDeviceInput * This); - - DECLSPEC_XFGVIRT(IBMDStreamingDeviceInput, StopCapture) - HRESULT ( STDMETHODCALLTYPE *StopCapture )( - IBMDStreamingDeviceInput * This); - - DECLSPEC_XFGVIRT(IBMDStreamingDeviceInput, SetCallback) - HRESULT ( STDMETHODCALLTYPE *SetCallback )( - IBMDStreamingDeviceInput * This, - /* [in] */ IUnknown *theCallback); - - END_INTERFACE - } IBMDStreamingDeviceInputVtbl; - - interface IBMDStreamingDeviceInput - { - CONST_VTBL struct IBMDStreamingDeviceInputVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IBMDStreamingDeviceInput_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IBMDStreamingDeviceInput_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IBMDStreamingDeviceInput_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IBMDStreamingDeviceInput_DoesSupportVideoInputMode(This,inputMode,result) \ - ( (This)->lpVtbl -> DoesSupportVideoInputMode(This,inputMode,result) ) - -#define IBMDStreamingDeviceInput_GetVideoInputModeIterator(This,iterator) \ - ( (This)->lpVtbl -> GetVideoInputModeIterator(This,iterator) ) - -#define IBMDStreamingDeviceInput_SetVideoInputMode(This,inputMode) \ - ( (This)->lpVtbl -> SetVideoInputMode(This,inputMode) ) - -#define IBMDStreamingDeviceInput_GetCurrentDetectedVideoInputMode(This,detectedMode) \ - ( (This)->lpVtbl -> GetCurrentDetectedVideoInputMode(This,detectedMode) ) - -#define IBMDStreamingDeviceInput_GetVideoEncodingMode(This,encodingMode) \ - ( (This)->lpVtbl -> GetVideoEncodingMode(This,encodingMode) ) - -#define IBMDStreamingDeviceInput_GetVideoEncodingModePresetIterator(This,inputMode,iterator) \ - ( (This)->lpVtbl -> GetVideoEncodingModePresetIterator(This,inputMode,iterator) ) - -#define IBMDStreamingDeviceInput_DoesSupportVideoEncodingMode(This,inputMode,encodingMode,result,changedEncodingMode) \ - ( (This)->lpVtbl -> DoesSupportVideoEncodingMode(This,inputMode,encodingMode,result,changedEncodingMode) ) - -#define IBMDStreamingDeviceInput_SetVideoEncodingMode(This,encodingMode) \ - ( (This)->lpVtbl -> SetVideoEncodingMode(This,encodingMode) ) - -#define IBMDStreamingDeviceInput_StartCapture(This) \ - ( (This)->lpVtbl -> StartCapture(This) ) - -#define IBMDStreamingDeviceInput_StopCapture(This) \ - ( (This)->lpVtbl -> StopCapture(This) ) - -#define IBMDStreamingDeviceInput_SetCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetCallback(This,theCallback) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IBMDStreamingDeviceInput_INTERFACE_DEFINED__ */ - - -#ifndef __IBMDStreamingH264NALPacket_INTERFACE_DEFINED__ -#define __IBMDStreamingH264NALPacket_INTERFACE_DEFINED__ - -/* interface IBMDStreamingH264NALPacket */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IBMDStreamingH264NALPacket; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("E260E955-14BE-4395-9775-9F02CC0A9D89") - IBMDStreamingH264NALPacket : public IUnknown - { - public: - virtual long STDMETHODCALLTYPE GetPayloadSize( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBytes( - /* [out] */ void **buffer) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBytesWithSizePrefix( - /* [out] */ void **buffer) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayTime( - /* [in] */ ULONGLONG requestedTimeScale, - /* [out] */ ULONGLONG *displayTime) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPacketIndex( - /* [out] */ unsigned int *packetIndex) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IBMDStreamingH264NALPacketVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IBMDStreamingH264NALPacket * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IBMDStreamingH264NALPacket * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IBMDStreamingH264NALPacket * This); - - DECLSPEC_XFGVIRT(IBMDStreamingH264NALPacket, GetPayloadSize) - long ( STDMETHODCALLTYPE *GetPayloadSize )( - IBMDStreamingH264NALPacket * This); - - DECLSPEC_XFGVIRT(IBMDStreamingH264NALPacket, GetBytes) - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IBMDStreamingH264NALPacket * This, - /* [out] */ void **buffer); - - DECLSPEC_XFGVIRT(IBMDStreamingH264NALPacket, GetBytesWithSizePrefix) - HRESULT ( STDMETHODCALLTYPE *GetBytesWithSizePrefix )( - IBMDStreamingH264NALPacket * This, - /* [out] */ void **buffer); - - DECLSPEC_XFGVIRT(IBMDStreamingH264NALPacket, GetDisplayTime) - HRESULT ( STDMETHODCALLTYPE *GetDisplayTime )( - IBMDStreamingH264NALPacket * This, - /* [in] */ ULONGLONG requestedTimeScale, - /* [out] */ ULONGLONG *displayTime); - - DECLSPEC_XFGVIRT(IBMDStreamingH264NALPacket, GetPacketIndex) - HRESULT ( STDMETHODCALLTYPE *GetPacketIndex )( - IBMDStreamingH264NALPacket * This, - /* [out] */ unsigned int *packetIndex); - - END_INTERFACE - } IBMDStreamingH264NALPacketVtbl; - - interface IBMDStreamingH264NALPacket - { - CONST_VTBL struct IBMDStreamingH264NALPacketVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IBMDStreamingH264NALPacket_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IBMDStreamingH264NALPacket_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IBMDStreamingH264NALPacket_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IBMDStreamingH264NALPacket_GetPayloadSize(This) \ - ( (This)->lpVtbl -> GetPayloadSize(This) ) - -#define IBMDStreamingH264NALPacket_GetBytes(This,buffer) \ - ( (This)->lpVtbl -> GetBytes(This,buffer) ) - -#define IBMDStreamingH264NALPacket_GetBytesWithSizePrefix(This,buffer) \ - ( (This)->lpVtbl -> GetBytesWithSizePrefix(This,buffer) ) - -#define IBMDStreamingH264NALPacket_GetDisplayTime(This,requestedTimeScale,displayTime) \ - ( (This)->lpVtbl -> GetDisplayTime(This,requestedTimeScale,displayTime) ) - -#define IBMDStreamingH264NALPacket_GetPacketIndex(This,packetIndex) \ - ( (This)->lpVtbl -> GetPacketIndex(This,packetIndex) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IBMDStreamingH264NALPacket_INTERFACE_DEFINED__ */ - - -#ifndef __IBMDStreamingAudioPacket_INTERFACE_DEFINED__ -#define __IBMDStreamingAudioPacket_INTERFACE_DEFINED__ - -/* interface IBMDStreamingAudioPacket */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IBMDStreamingAudioPacket; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("D9EB5902-1AD2-43F4-9E2C-3CFA50B5EE19") - IBMDStreamingAudioPacket : public IUnknown - { - public: - virtual BMDStreamingAudioCodec STDMETHODCALLTYPE GetCodec( void) = 0; - - virtual long STDMETHODCALLTYPE GetPayloadSize( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBytes( - /* [out] */ void **buffer) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPlayTime( - /* [in] */ ULONGLONG requestedTimeScale, - /* [out] */ ULONGLONG *playTime) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPacketIndex( - /* [out] */ unsigned int *packetIndex) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IBMDStreamingAudioPacketVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IBMDStreamingAudioPacket * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IBMDStreamingAudioPacket * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IBMDStreamingAudioPacket * This); - - DECLSPEC_XFGVIRT(IBMDStreamingAudioPacket, GetCodec) - BMDStreamingAudioCodec ( STDMETHODCALLTYPE *GetCodec )( - IBMDStreamingAudioPacket * This); - - DECLSPEC_XFGVIRT(IBMDStreamingAudioPacket, GetPayloadSize) - long ( STDMETHODCALLTYPE *GetPayloadSize )( - IBMDStreamingAudioPacket * This); - - DECLSPEC_XFGVIRT(IBMDStreamingAudioPacket, GetBytes) - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IBMDStreamingAudioPacket * This, - /* [out] */ void **buffer); - - DECLSPEC_XFGVIRT(IBMDStreamingAudioPacket, GetPlayTime) - HRESULT ( STDMETHODCALLTYPE *GetPlayTime )( - IBMDStreamingAudioPacket * This, - /* [in] */ ULONGLONG requestedTimeScale, - /* [out] */ ULONGLONG *playTime); - - DECLSPEC_XFGVIRT(IBMDStreamingAudioPacket, GetPacketIndex) - HRESULT ( STDMETHODCALLTYPE *GetPacketIndex )( - IBMDStreamingAudioPacket * This, - /* [out] */ unsigned int *packetIndex); - - END_INTERFACE - } IBMDStreamingAudioPacketVtbl; - - interface IBMDStreamingAudioPacket - { - CONST_VTBL struct IBMDStreamingAudioPacketVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IBMDStreamingAudioPacket_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IBMDStreamingAudioPacket_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IBMDStreamingAudioPacket_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IBMDStreamingAudioPacket_GetCodec(This) \ - ( (This)->lpVtbl -> GetCodec(This) ) - -#define IBMDStreamingAudioPacket_GetPayloadSize(This) \ - ( (This)->lpVtbl -> GetPayloadSize(This) ) - -#define IBMDStreamingAudioPacket_GetBytes(This,buffer) \ - ( (This)->lpVtbl -> GetBytes(This,buffer) ) - -#define IBMDStreamingAudioPacket_GetPlayTime(This,requestedTimeScale,playTime) \ - ( (This)->lpVtbl -> GetPlayTime(This,requestedTimeScale,playTime) ) - -#define IBMDStreamingAudioPacket_GetPacketIndex(This,packetIndex) \ - ( (This)->lpVtbl -> GetPacketIndex(This,packetIndex) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IBMDStreamingAudioPacket_INTERFACE_DEFINED__ */ - - -#ifndef __IBMDStreamingMPEG2TSPacket_INTERFACE_DEFINED__ -#define __IBMDStreamingMPEG2TSPacket_INTERFACE_DEFINED__ - -/* interface IBMDStreamingMPEG2TSPacket */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IBMDStreamingMPEG2TSPacket; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("91810D1C-4FB3-4AAA-AE56-FA301D3DFA4C") - IBMDStreamingMPEG2TSPacket : public IUnknown - { - public: - virtual long STDMETHODCALLTYPE GetPayloadSize( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBytes( - /* [out] */ void **buffer) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IBMDStreamingMPEG2TSPacketVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IBMDStreamingMPEG2TSPacket * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IBMDStreamingMPEG2TSPacket * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IBMDStreamingMPEG2TSPacket * This); - - DECLSPEC_XFGVIRT(IBMDStreamingMPEG2TSPacket, GetPayloadSize) - long ( STDMETHODCALLTYPE *GetPayloadSize )( - IBMDStreamingMPEG2TSPacket * This); - - DECLSPEC_XFGVIRT(IBMDStreamingMPEG2TSPacket, GetBytes) - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IBMDStreamingMPEG2TSPacket * This, - /* [out] */ void **buffer); - - END_INTERFACE - } IBMDStreamingMPEG2TSPacketVtbl; - - interface IBMDStreamingMPEG2TSPacket - { - CONST_VTBL struct IBMDStreamingMPEG2TSPacketVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IBMDStreamingMPEG2TSPacket_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IBMDStreamingMPEG2TSPacket_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IBMDStreamingMPEG2TSPacket_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IBMDStreamingMPEG2TSPacket_GetPayloadSize(This) \ - ( (This)->lpVtbl -> GetPayloadSize(This) ) - -#define IBMDStreamingMPEG2TSPacket_GetBytes(This,buffer) \ - ( (This)->lpVtbl -> GetBytes(This,buffer) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IBMDStreamingMPEG2TSPacket_INTERFACE_DEFINED__ */ - - -#ifndef __IBMDStreamingH264NALParser_INTERFACE_DEFINED__ -#define __IBMDStreamingH264NALParser_INTERFACE_DEFINED__ - -/* interface IBMDStreamingH264NALParser */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IBMDStreamingH264NALParser; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("5867F18C-5BFA-4CCC-B2A7-9DFD140417D2") - IBMDStreamingH264NALParser : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE IsNALSequenceParameterSet( - /* [in] */ IBMDStreamingH264NALPacket *nal) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsNALPictureParameterSet( - /* [in] */ IBMDStreamingH264NALPacket *nal) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetProfileAndLevelFromSPS( - /* [in] */ IBMDStreamingH264NALPacket *nal, - /* [out] */ unsigned int *profileIdc, - /* [out] */ unsigned int *profileCompatability, - /* [out] */ unsigned int *levelIdc) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IBMDStreamingH264NALParserVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IBMDStreamingH264NALParser * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IBMDStreamingH264NALParser * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IBMDStreamingH264NALParser * This); - - DECLSPEC_XFGVIRT(IBMDStreamingH264NALParser, IsNALSequenceParameterSet) - HRESULT ( STDMETHODCALLTYPE *IsNALSequenceParameterSet )( - IBMDStreamingH264NALParser * This, - /* [in] */ IBMDStreamingH264NALPacket *nal); - - DECLSPEC_XFGVIRT(IBMDStreamingH264NALParser, IsNALPictureParameterSet) - HRESULT ( STDMETHODCALLTYPE *IsNALPictureParameterSet )( - IBMDStreamingH264NALParser * This, - /* [in] */ IBMDStreamingH264NALPacket *nal); - - DECLSPEC_XFGVIRT(IBMDStreamingH264NALParser, GetProfileAndLevelFromSPS) - HRESULT ( STDMETHODCALLTYPE *GetProfileAndLevelFromSPS )( - IBMDStreamingH264NALParser * This, - /* [in] */ IBMDStreamingH264NALPacket *nal, - /* [out] */ unsigned int *profileIdc, - /* [out] */ unsigned int *profileCompatability, - /* [out] */ unsigned int *levelIdc); - - END_INTERFACE - } IBMDStreamingH264NALParserVtbl; - - interface IBMDStreamingH264NALParser - { - CONST_VTBL struct IBMDStreamingH264NALParserVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IBMDStreamingH264NALParser_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IBMDStreamingH264NALParser_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IBMDStreamingH264NALParser_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IBMDStreamingH264NALParser_IsNALSequenceParameterSet(This,nal) \ - ( (This)->lpVtbl -> IsNALSequenceParameterSet(This,nal) ) - -#define IBMDStreamingH264NALParser_IsNALPictureParameterSet(This,nal) \ - ( (This)->lpVtbl -> IsNALPictureParameterSet(This,nal) ) - -#define IBMDStreamingH264NALParser_GetProfileAndLevelFromSPS(This,nal,profileIdc,profileCompatability,levelIdc) \ - ( (This)->lpVtbl -> GetProfileAndLevelFromSPS(This,nal,profileIdc,profileCompatability,levelIdc) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IBMDStreamingH264NALParser_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_CBMDStreamingDiscovery; - -#ifdef __cplusplus - -class DECLSPEC_UUID("23A4EDF5-A0E5-432C-94EF-3BABB5F81C82") -CBMDStreamingDiscovery; -#endif - -EXTERN_C const CLSID CLSID_CBMDStreamingH264NALParser; - -#ifdef __cplusplus - -class DECLSPEC_UUID("7753EFBD-951C-407C-97A5-23C737B73B52") -CBMDStreamingH264NALParser; -#endif - -#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("5BE6DF26-02CE-433E-99D9-9A87C3AC171F") - 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 - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoOutputCallback * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoOutputCallback * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoOutputCallback * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoOutputCallback, ScheduledFrameCompleted) - HRESULT ( STDMETHODCALLTYPE *ScheduledFrameCompleted )( - IDeckLinkVideoOutputCallback * This, - /* [in] */ IDeckLinkVideoFrame *completedFrame, - /* [in] */ BMDOutputFrameCompletionResult result); - - DECLSPEC_XFGVIRT(IDeckLinkVideoOutputCallback, ScheduledPlaybackHasStopped) - 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("3A94F075-C37D-4BA8-BCC0-1D778C8F881B") - 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 - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkInputCallback * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkInputCallback * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkInputCallback * This); - - DECLSPEC_XFGVIRT(IDeckLinkInputCallback, VideoInputFormatChanged) - HRESULT ( STDMETHODCALLTYPE *VideoInputFormatChanged )( - IDeckLinkInputCallback * This, - /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents, - /* [in] */ IDeckLinkDisplayMode *newDisplayMode, - /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags); - - DECLSPEC_XFGVIRT(IDeckLinkInputCallback, VideoInputFrameArrived) - 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 __IDeckLinkEncoderInputCallback_INTERFACE_DEFINED__ -#define __IDeckLinkEncoderInputCallback_INTERFACE_DEFINED__ - -/* interface IDeckLinkEncoderInputCallback */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkEncoderInputCallback; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("ACF13E61-F4A0-4974-A6A7-59AFF6268B31") - IDeckLinkEncoderInputCallback : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE VideoInputSignalChanged( - /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents, - /* [in] */ IDeckLinkDisplayMode *newDisplayMode, - /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE VideoPacketArrived( - /* [in] */ IDeckLinkEncoderVideoPacket *videoPacket) = 0; - - virtual HRESULT STDMETHODCALLTYPE AudioPacketArrived( - /* [in] */ IDeckLinkEncoderAudioPacket *audioPacket) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkEncoderInputCallbackVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkEncoderInputCallback * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkEncoderInputCallback * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkEncoderInputCallback * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInputCallback, VideoInputSignalChanged) - HRESULT ( STDMETHODCALLTYPE *VideoInputSignalChanged )( - IDeckLinkEncoderInputCallback * This, - /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents, - /* [in] */ IDeckLinkDisplayMode *newDisplayMode, - /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInputCallback, VideoPacketArrived) - HRESULT ( STDMETHODCALLTYPE *VideoPacketArrived )( - IDeckLinkEncoderInputCallback * This, - /* [in] */ IDeckLinkEncoderVideoPacket *videoPacket); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInputCallback, AudioPacketArrived) - HRESULT ( STDMETHODCALLTYPE *AudioPacketArrived )( - IDeckLinkEncoderInputCallback * This, - /* [in] */ IDeckLinkEncoderAudioPacket *audioPacket); - - END_INTERFACE - } IDeckLinkEncoderInputCallbackVtbl; - - interface IDeckLinkEncoderInputCallback - { - CONST_VTBL struct IDeckLinkEncoderInputCallbackVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkEncoderInputCallback_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkEncoderInputCallback_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkEncoderInputCallback_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkEncoderInputCallback_VideoInputSignalChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags) \ - ( (This)->lpVtbl -> VideoInputSignalChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags) ) - -#define IDeckLinkEncoderInputCallback_VideoPacketArrived(This,videoPacket) \ - ( (This)->lpVtbl -> VideoPacketArrived(This,videoPacket) ) - -#define IDeckLinkEncoderInputCallback_AudioPacketArrived(This,audioPacket) \ - ( (This)->lpVtbl -> AudioPacketArrived(This,audioPacket) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkEncoderInputCallback_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkVideoBufferAllocator_INTERFACE_DEFINED__ -#define __IDeckLinkVideoBufferAllocator_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoBufferAllocator */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoBufferAllocator; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("F35DFA8D-9078-4622-95BB-56894054EB0F") - IDeckLinkVideoBufferAllocator : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE AllocateVideoBuffer( - /* [out] */ IDeckLinkVideoBuffer **allocatedBuffer) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkVideoBufferAllocatorVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoBufferAllocator * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoBufferAllocator * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoBufferAllocator * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoBufferAllocator, AllocateVideoBuffer) - HRESULT ( STDMETHODCALLTYPE *AllocateVideoBuffer )( - IDeckLinkVideoBufferAllocator * This, - /* [out] */ IDeckLinkVideoBuffer **allocatedBuffer); - - END_INTERFACE - } IDeckLinkVideoBufferAllocatorVtbl; - - interface IDeckLinkVideoBufferAllocator - { - CONST_VTBL struct IDeckLinkVideoBufferAllocatorVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoBufferAllocator_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoBufferAllocator_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoBufferAllocator_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoBufferAllocator_AllocateVideoBuffer(This,allocatedBuffer) \ - ( (This)->lpVtbl -> AllocateVideoBuffer(This,allocatedBuffer) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoBufferAllocator_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkVideoBufferAllocatorProvider_INTERFACE_DEFINED__ -#define __IDeckLinkVideoBufferAllocatorProvider_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoBufferAllocatorProvider */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoBufferAllocatorProvider; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("6DF6F20A-D8DF-45D2-8914-383CE7E6243F") - IDeckLinkVideoBufferAllocatorProvider : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetVideoBufferAllocator( - /* [in] */ unsigned int bufferSize, - /* [in] */ unsigned int width, - /* [in] */ unsigned int height, - /* [in] */ unsigned int rowBytes, - /* [in] */ BMDPixelFormat pixelFormat, - /* [out] */ IDeckLinkVideoBufferAllocator **allocator) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkVideoBufferAllocatorProviderVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoBufferAllocatorProvider * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoBufferAllocatorProvider * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoBufferAllocatorProvider * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoBufferAllocatorProvider, GetVideoBufferAllocator) - HRESULT ( STDMETHODCALLTYPE *GetVideoBufferAllocator )( - IDeckLinkVideoBufferAllocatorProvider * This, - /* [in] */ unsigned int bufferSize, - /* [in] */ unsigned int width, - /* [in] */ unsigned int height, - /* [in] */ unsigned int rowBytes, - /* [in] */ BMDPixelFormat pixelFormat, - /* [out] */ IDeckLinkVideoBufferAllocator **allocator); - - END_INTERFACE - } IDeckLinkVideoBufferAllocatorProviderVtbl; - - interface IDeckLinkVideoBufferAllocatorProvider - { - CONST_VTBL struct IDeckLinkVideoBufferAllocatorProviderVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoBufferAllocatorProvider_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoBufferAllocatorProvider_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoBufferAllocatorProvider_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoBufferAllocatorProvider_GetVideoBufferAllocator(This,bufferSize,width,height,rowBytes,pixelFormat,allocator) \ - ( (This)->lpVtbl -> GetVideoBufferAllocator(This,bufferSize,width,height,rowBytes,pixelFormat,allocator) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoBufferAllocatorProvider_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( - /* [in] */ BOOL preroll) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkAudioOutputCallbackVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkAudioOutputCallback * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkAudioOutputCallback * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkAudioOutputCallback * This); - - DECLSPEC_XFGVIRT(IDeckLinkAudioOutputCallback, RenderAudioSamples) - HRESULT ( STDMETHODCALLTYPE *RenderAudioSamples )( - IDeckLinkAudioOutputCallback * This, - /* [in] */ 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("50FB36CD-3063-4B73-BDBB-958087F2D8BA") - IDeckLinkIterator : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Next( - /* [out] */ IDeckLink **deckLinkInstance) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkIteratorVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkIterator * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkIterator * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkIterator * This); - - DECLSPEC_XFGVIRT(IDeckLinkIterator, Next) - 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 - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkAPIInformation * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkAPIInformation * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkAPIInformation * This); - - DECLSPEC_XFGVIRT(IDeckLinkAPIInformation, GetFlag) - HRESULT ( STDMETHODCALLTYPE *GetFlag )( - IDeckLinkAPIInformation * This, - /* [in] */ BMDDeckLinkAPIInformationID cfgID, - /* [out] */ BOOL *value); - - DECLSPEC_XFGVIRT(IDeckLinkAPIInformation, GetInt) - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IDeckLinkAPIInformation * This, - /* [in] */ BMDDeckLinkAPIInformationID cfgID, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IDeckLinkAPIInformation, GetFloat) - HRESULT ( STDMETHODCALLTYPE *GetFloat )( - IDeckLinkAPIInformation * This, - /* [in] */ BMDDeckLinkAPIInformationID cfgID, - /* [out] */ double *value); - - DECLSPEC_XFGVIRT(IDeckLinkAPIInformation, GetString) - 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 __IDeckLinkIPFlowAttributes_INTERFACE_DEFINED__ -#define __IDeckLinkIPFlowAttributes_INTERFACE_DEFINED__ - -/* interface IDeckLinkIPFlowAttributes */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkIPFlowAttributes; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("CDA938DA-6479-40C6-B2EC-A3579B3AEECD") - IDeckLinkIPFlowAttributes : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetInt( - /* [in] */ BMDDeckLinkIPFlowAttributeID attrID, - /* [out] */ LONGLONG *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFlag( - /* [in] */ BMDDeckLinkIPFlowAttributeID attrID, - /* [out] */ BOOL *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFloat( - /* [in] */ BMDDeckLinkIPFlowAttributeID attrID, - /* [out] */ double *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetString( - /* [in] */ BMDDeckLinkIPFlowAttributeID attrID, - /* [out] */ BSTR *value) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkIPFlowAttributesVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkIPFlowAttributes * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkIPFlowAttributes * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkIPFlowAttributes * This); - - DECLSPEC_XFGVIRT(IDeckLinkIPFlowAttributes, GetInt) - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IDeckLinkIPFlowAttributes * This, - /* [in] */ BMDDeckLinkIPFlowAttributeID attrID, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IDeckLinkIPFlowAttributes, GetFlag) - HRESULT ( STDMETHODCALLTYPE *GetFlag )( - IDeckLinkIPFlowAttributes * This, - /* [in] */ BMDDeckLinkIPFlowAttributeID attrID, - /* [out] */ BOOL *value); - - DECLSPEC_XFGVIRT(IDeckLinkIPFlowAttributes, GetFloat) - HRESULT ( STDMETHODCALLTYPE *GetFloat )( - IDeckLinkIPFlowAttributes * This, - /* [in] */ BMDDeckLinkIPFlowAttributeID attrID, - /* [out] */ double *value); - - DECLSPEC_XFGVIRT(IDeckLinkIPFlowAttributes, GetString) - HRESULT ( STDMETHODCALLTYPE *GetString )( - IDeckLinkIPFlowAttributes * This, - /* [in] */ BMDDeckLinkIPFlowAttributeID attrID, - /* [out] */ BSTR *value); - - END_INTERFACE - } IDeckLinkIPFlowAttributesVtbl; - - interface IDeckLinkIPFlowAttributes - { - CONST_VTBL struct IDeckLinkIPFlowAttributesVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkIPFlowAttributes_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkIPFlowAttributes_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkIPFlowAttributes_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkIPFlowAttributes_GetInt(This,attrID,value) \ - ( (This)->lpVtbl -> GetInt(This,attrID,value) ) - -#define IDeckLinkIPFlowAttributes_GetFlag(This,attrID,value) \ - ( (This)->lpVtbl -> GetFlag(This,attrID,value) ) - -#define IDeckLinkIPFlowAttributes_GetFloat(This,attrID,value) \ - ( (This)->lpVtbl -> GetFloat(This,attrID,value) ) - -#define IDeckLinkIPFlowAttributes_GetString(This,attrID,value) \ - ( (This)->lpVtbl -> GetString(This,attrID,value) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkIPFlowAttributes_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkIPFlowStatus_INTERFACE_DEFINED__ -#define __IDeckLinkIPFlowStatus_INTERFACE_DEFINED__ - -/* interface IDeckLinkIPFlowStatus */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkIPFlowStatus; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("31C41656-4992-4396-BBE9-5F8406AAB5AF") - IDeckLinkIPFlowStatus : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetInt( - /* [in] */ BMDDeckLinkIPFlowStatusID statusID, - /* [out] */ LONGLONG *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFlag( - /* [in] */ BMDDeckLinkIPFlowStatusID statusID, - /* [out] */ BOOL *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFloat( - /* [in] */ BMDDeckLinkIPFlowStatusID statusID, - /* [out] */ double *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetString( - /* [in] */ BMDDeckLinkIPFlowStatusID statusID, - /* [out] */ BSTR *value) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkIPFlowStatusVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkIPFlowStatus * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkIPFlowStatus * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkIPFlowStatus * This); - - DECLSPEC_XFGVIRT(IDeckLinkIPFlowStatus, GetInt) - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IDeckLinkIPFlowStatus * This, - /* [in] */ BMDDeckLinkIPFlowStatusID statusID, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IDeckLinkIPFlowStatus, GetFlag) - HRESULT ( STDMETHODCALLTYPE *GetFlag )( - IDeckLinkIPFlowStatus * This, - /* [in] */ BMDDeckLinkIPFlowStatusID statusID, - /* [out] */ BOOL *value); - - DECLSPEC_XFGVIRT(IDeckLinkIPFlowStatus, GetFloat) - HRESULT ( STDMETHODCALLTYPE *GetFloat )( - IDeckLinkIPFlowStatus * This, - /* [in] */ BMDDeckLinkIPFlowStatusID statusID, - /* [out] */ double *value); - - DECLSPEC_XFGVIRT(IDeckLinkIPFlowStatus, GetString) - HRESULT ( STDMETHODCALLTYPE *GetString )( - IDeckLinkIPFlowStatus * This, - /* [in] */ BMDDeckLinkIPFlowStatusID statusID, - /* [out] */ BSTR *value); - - END_INTERFACE - } IDeckLinkIPFlowStatusVtbl; - - interface IDeckLinkIPFlowStatus - { - CONST_VTBL struct IDeckLinkIPFlowStatusVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkIPFlowStatus_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkIPFlowStatus_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkIPFlowStatus_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkIPFlowStatus_GetInt(This,statusID,value) \ - ( (This)->lpVtbl -> GetInt(This,statusID,value) ) - -#define IDeckLinkIPFlowStatus_GetFlag(This,statusID,value) \ - ( (This)->lpVtbl -> GetFlag(This,statusID,value) ) - -#define IDeckLinkIPFlowStatus_GetFloat(This,statusID,value) \ - ( (This)->lpVtbl -> GetFloat(This,statusID,value) ) - -#define IDeckLinkIPFlowStatus_GetString(This,statusID,value) \ - ( (This)->lpVtbl -> GetString(This,statusID,value) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkIPFlowStatus_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkIPFlowSetting_INTERFACE_DEFINED__ -#define __IDeckLinkIPFlowSetting_INTERFACE_DEFINED__ - -/* interface IDeckLinkIPFlowSetting */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkIPFlowSetting; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("86DD9174-27D3-4032-B2AD-6067C3BB2424") - IDeckLinkIPFlowSetting : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetInt( - /* [in] */ BMDDeckLinkIPFlowSettingID settingID, - /* [out] */ LONGLONG *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFlag( - /* [in] */ BMDDeckLinkIPFlowSettingID settingID, - /* [out] */ BOOL *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFloat( - /* [in] */ BMDDeckLinkIPFlowSettingID settingID, - /* [out] */ double *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetString( - /* [in] */ BMDDeckLinkIPFlowSettingID settingID, - /* [out] */ BSTR *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetInt( - /* [in] */ BMDDeckLinkIPFlowSettingID settingID, - /* [in] */ LONGLONG value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFlag( - /* [in] */ BMDDeckLinkIPFlowSettingID settingID, - /* [in] */ BOOL value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFloat( - /* [in] */ BMDDeckLinkIPFlowSettingID settingID, - /* [in] */ double value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetString( - /* [in] */ BMDDeckLinkIPFlowSettingID settingID, - /* [in] */ BSTR value) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkIPFlowSettingVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkIPFlowSetting * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkIPFlowSetting * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkIPFlowSetting * This); - - DECLSPEC_XFGVIRT(IDeckLinkIPFlowSetting, GetInt) - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IDeckLinkIPFlowSetting * This, - /* [in] */ BMDDeckLinkIPFlowSettingID settingID, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IDeckLinkIPFlowSetting, GetFlag) - HRESULT ( STDMETHODCALLTYPE *GetFlag )( - IDeckLinkIPFlowSetting * This, - /* [in] */ BMDDeckLinkIPFlowSettingID settingID, - /* [out] */ BOOL *value); - - DECLSPEC_XFGVIRT(IDeckLinkIPFlowSetting, GetFloat) - HRESULT ( STDMETHODCALLTYPE *GetFloat )( - IDeckLinkIPFlowSetting * This, - /* [in] */ BMDDeckLinkIPFlowSettingID settingID, - /* [out] */ double *value); - - DECLSPEC_XFGVIRT(IDeckLinkIPFlowSetting, GetString) - HRESULT ( STDMETHODCALLTYPE *GetString )( - IDeckLinkIPFlowSetting * This, - /* [in] */ BMDDeckLinkIPFlowSettingID settingID, - /* [out] */ BSTR *value); - - DECLSPEC_XFGVIRT(IDeckLinkIPFlowSetting, SetInt) - HRESULT ( STDMETHODCALLTYPE *SetInt )( - IDeckLinkIPFlowSetting * This, - /* [in] */ BMDDeckLinkIPFlowSettingID settingID, - /* [in] */ LONGLONG value); - - DECLSPEC_XFGVIRT(IDeckLinkIPFlowSetting, SetFlag) - HRESULT ( STDMETHODCALLTYPE *SetFlag )( - IDeckLinkIPFlowSetting * This, - /* [in] */ BMDDeckLinkIPFlowSettingID settingID, - /* [in] */ BOOL value); - - DECLSPEC_XFGVIRT(IDeckLinkIPFlowSetting, SetFloat) - HRESULT ( STDMETHODCALLTYPE *SetFloat )( - IDeckLinkIPFlowSetting * This, - /* [in] */ BMDDeckLinkIPFlowSettingID settingID, - /* [in] */ double value); - - DECLSPEC_XFGVIRT(IDeckLinkIPFlowSetting, SetString) - HRESULT ( STDMETHODCALLTYPE *SetString )( - IDeckLinkIPFlowSetting * This, - /* [in] */ BMDDeckLinkIPFlowSettingID settingID, - /* [in] */ BSTR value); - - END_INTERFACE - } IDeckLinkIPFlowSettingVtbl; - - interface IDeckLinkIPFlowSetting - { - CONST_VTBL struct IDeckLinkIPFlowSettingVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkIPFlowSetting_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkIPFlowSetting_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkIPFlowSetting_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkIPFlowSetting_GetInt(This,settingID,value) \ - ( (This)->lpVtbl -> GetInt(This,settingID,value) ) - -#define IDeckLinkIPFlowSetting_GetFlag(This,settingID,value) \ - ( (This)->lpVtbl -> GetFlag(This,settingID,value) ) - -#define IDeckLinkIPFlowSetting_GetFloat(This,settingID,value) \ - ( (This)->lpVtbl -> GetFloat(This,settingID,value) ) - -#define IDeckLinkIPFlowSetting_GetString(This,settingID,value) \ - ( (This)->lpVtbl -> GetString(This,settingID,value) ) - -#define IDeckLinkIPFlowSetting_SetInt(This,settingID,value) \ - ( (This)->lpVtbl -> SetInt(This,settingID,value) ) - -#define IDeckLinkIPFlowSetting_SetFlag(This,settingID,value) \ - ( (This)->lpVtbl -> SetFlag(This,settingID,value) ) - -#define IDeckLinkIPFlowSetting_SetFloat(This,settingID,value) \ - ( (This)->lpVtbl -> SetFloat(This,settingID,value) ) - -#define IDeckLinkIPFlowSetting_SetString(This,settingID,value) \ - ( (This)->lpVtbl -> SetString(This,settingID,value) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkIPFlowSetting_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkIPFlow_INTERFACE_DEFINED__ -#define __IDeckLinkIPFlow_INTERFACE_DEFINED__ - -/* interface IDeckLinkIPFlow */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkIPFlow; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("C5FC83C7-5B8E-42A7-9A40-7C065955D4E1") - IDeckLinkIPFlow : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Enable( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE Disable( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkIPFlowVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkIPFlow * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkIPFlow * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkIPFlow * This); - - DECLSPEC_XFGVIRT(IDeckLinkIPFlow, Enable) - HRESULT ( STDMETHODCALLTYPE *Enable )( - IDeckLinkIPFlow * This); - - DECLSPEC_XFGVIRT(IDeckLinkIPFlow, Disable) - HRESULT ( STDMETHODCALLTYPE *Disable )( - IDeckLinkIPFlow * This); - - END_INTERFACE - } IDeckLinkIPFlowVtbl; - - interface IDeckLinkIPFlow - { - CONST_VTBL struct IDeckLinkIPFlowVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkIPFlow_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkIPFlow_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkIPFlow_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkIPFlow_Enable(This) \ - ( (This)->lpVtbl -> Enable(This) ) - -#define IDeckLinkIPFlow_Disable(This) \ - ( (This)->lpVtbl -> Disable(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkIPFlow_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkIPFlowIterator_INTERFACE_DEFINED__ -#define __IDeckLinkIPFlowIterator_INTERFACE_DEFINED__ - -/* interface IDeckLinkIPFlowIterator */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkIPFlowIterator; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("BD296AB2-A5C5-4153-888F-AAB1FDBD8A5C") - IDeckLinkIPFlowIterator : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Next( - /* [out] */ IDeckLinkIPFlow **deckLinkIPFlowInstance) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkIPFlowIteratorVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkIPFlowIterator * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkIPFlowIterator * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkIPFlowIterator * This); - - DECLSPEC_XFGVIRT(IDeckLinkIPFlowIterator, Next) - HRESULT ( STDMETHODCALLTYPE *Next )( - IDeckLinkIPFlowIterator * This, - /* [out] */ IDeckLinkIPFlow **deckLinkIPFlowInstance); - - END_INTERFACE - } IDeckLinkIPFlowIteratorVtbl; - - interface IDeckLinkIPFlowIterator - { - CONST_VTBL struct IDeckLinkIPFlowIteratorVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkIPFlowIterator_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkIPFlowIterator_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkIPFlowIterator_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkIPFlowIterator_Next(This,deckLinkIPFlowInstance) \ - ( (This)->lpVtbl -> Next(This,deckLinkIPFlowInstance) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkIPFlowIterator_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("5F227C95-39D7-46C7-8B7D-9C81795FBBE4") - IDeckLinkOutput : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( - /* [in] */ BMDVideoConnection connection, - /* [in] */ BMDDisplayMode requestedMode, - /* [in] */ BMDPixelFormat requestedPixelFormat, - /* [in] */ BMDVideoOutputConversionMode conversionMode, - /* [in] */ BMDSupportedVideoModeFlags flags, - /* [out] */ BMDDisplayMode *actualMode, - /* [out] */ BOOL *supported) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayMode( - /* [in] */ BMDDisplayMode displayMode, - /* [out] */ IDeckLinkDisplayMode **resultDisplayMode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( - /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( - /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableVideoOutput( - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDVideoOutputFlags flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableVideoOutput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateVideoFrame( - /* [in] */ int width, - /* [in] */ int height, - /* [in] */ int rowBytes, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDFrameFlags flags, - /* [out] */ IDeckLinkMutableVideoFrame **outFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateVideoFrameWithBuffer( - /* [in] */ int width, - /* [in] */ int height, - /* [in] */ int rowBytes, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDFrameFlags flags, - /* [in] */ IDeckLinkVideoBuffer *buffer, - /* [out] */ IDeckLinkMutableVideoFrame **outFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE RowBytesForPixelFormat( - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ int width, - /* [out] */ int *rowBytes) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateAncillaryData( - /* [in] */ BMDPixelFormat pixelFormat, - /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisplayVideoFrameSync( - /* [in] */ IDeckLinkVideoFrame *theFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE ScheduleVideoFrame( - /* [in] */ IDeckLinkVideoFrame *theFrame, - /* [in] */ BMDTimeValue displayTime, - /* [in] */ BMDTimeValue displayDuration, - /* [in] */ BMDTimeScale timeScale) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetScheduledFrameCompletionCallback( - /* [in] */ IDeckLinkVideoOutputCallback *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBufferedVideoFrameCount( - /* [out] */ unsigned int *bufferedFrameCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableAudioOutput( - /* [in] */ BMDAudioSampleRate sampleRate, - /* [in] */ BMDAudioSampleType sampleType, - /* [in] */ unsigned int channelCount, - /* [in] */ BMDAudioOutputStreamType streamType) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableAudioOutput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE WriteAudioSamplesSync( - /* [in] */ void *buffer, - /* [in] */ unsigned int sampleFrameCount, - /* [out] */ unsigned int *sampleFramesWritten) = 0; - - virtual HRESULT STDMETHODCALLTYPE BeginAudioPreroll( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE EndAudioPreroll( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE ScheduleAudioSamples( - /* [in] */ void *buffer, - /* [in] */ unsigned int sampleFrameCount, - /* [in] */ BMDTimeValue streamTime, - /* [in] */ BMDTimeScale timeScale, - /* [out] */ unsigned int *sampleFramesWritten) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( - /* [out] */ unsigned int *bufferedSampleFrameCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE FlushBufferedAudioSamples( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetAudioCallback( - /* [in] */ IDeckLinkAudioOutputCallback *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE StartScheduledPlayback( - /* [in] */ BMDTimeValue playbackStartTime, - /* [in] */ BMDTimeScale timeScale, - /* [in] */ double playbackSpeed) = 0; - - virtual HRESULT STDMETHODCALLTYPE StopScheduledPlayback( - /* [in] */ BMDTimeValue stopPlaybackAtTime, - /* [out] */ BMDTimeValue *actualStopTime, - /* [in] */ BMDTimeScale timeScale) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsScheduledPlaybackRunning( - /* [out] */ BOOL *active) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetScheduledStreamTime( - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *streamTime, - /* [out] */ double *playbackSpeed) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetReferenceStatus( - /* [out] */ BMDReferenceStatus *referenceStatus) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFrameCompletionReferenceTimestamp( - /* [in] */ IDeckLinkVideoFrame *theFrame, - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *frameCompletionTimestamp) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkOutputVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkOutput * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkOutput * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkOutput * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, DoesSupportVideoMode) - HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( - IDeckLinkOutput * This, - /* [in] */ BMDVideoConnection connection, - /* [in] */ BMDDisplayMode requestedMode, - /* [in] */ BMDPixelFormat requestedPixelFormat, - /* [in] */ BMDVideoOutputConversionMode conversionMode, - /* [in] */ BMDSupportedVideoModeFlags flags, - /* [out] */ BMDDisplayMode *actualMode, - /* [out] */ BOOL *supported); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, GetDisplayMode) - HRESULT ( STDMETHODCALLTYPE *GetDisplayMode )( - IDeckLinkOutput * This, - /* [in] */ BMDDisplayMode displayMode, - /* [out] */ IDeckLinkDisplayMode **resultDisplayMode); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, GetDisplayModeIterator) - HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( - IDeckLinkOutput * This, - /* [out] */ IDeckLinkDisplayModeIterator **iterator); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, SetScreenPreviewCallback) - HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( - IDeckLinkOutput * This, - /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, EnableVideoOutput) - HRESULT ( STDMETHODCALLTYPE *EnableVideoOutput )( - IDeckLinkOutput * This, - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDVideoOutputFlags flags); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, DisableVideoOutput) - HRESULT ( STDMETHODCALLTYPE *DisableVideoOutput )( - IDeckLinkOutput * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, CreateVideoFrame) - HRESULT ( STDMETHODCALLTYPE *CreateVideoFrame )( - IDeckLinkOutput * This, - /* [in] */ int width, - /* [in] */ int height, - /* [in] */ int rowBytes, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDFrameFlags flags, - /* [out] */ IDeckLinkMutableVideoFrame **outFrame); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, CreateVideoFrameWithBuffer) - HRESULT ( STDMETHODCALLTYPE *CreateVideoFrameWithBuffer )( - IDeckLinkOutput * This, - /* [in] */ int width, - /* [in] */ int height, - /* [in] */ int rowBytes, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDFrameFlags flags, - /* [in] */ IDeckLinkVideoBuffer *buffer, - /* [out] */ IDeckLinkMutableVideoFrame **outFrame); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, RowBytesForPixelFormat) - HRESULT ( STDMETHODCALLTYPE *RowBytesForPixelFormat )( - IDeckLinkOutput * This, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ int width, - /* [out] */ int *rowBytes); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, CreateAncillaryData) - HRESULT ( STDMETHODCALLTYPE *CreateAncillaryData )( - IDeckLinkOutput * This, - /* [in] */ BMDPixelFormat pixelFormat, - /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, DisplayVideoFrameSync) - HRESULT ( STDMETHODCALLTYPE *DisplayVideoFrameSync )( - IDeckLinkOutput * This, - /* [in] */ IDeckLinkVideoFrame *theFrame); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, ScheduleVideoFrame) - HRESULT ( STDMETHODCALLTYPE *ScheduleVideoFrame )( - IDeckLinkOutput * This, - /* [in] */ IDeckLinkVideoFrame *theFrame, - /* [in] */ BMDTimeValue displayTime, - /* [in] */ BMDTimeValue displayDuration, - /* [in] */ BMDTimeScale timeScale); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, SetScheduledFrameCompletionCallback) - HRESULT ( STDMETHODCALLTYPE *SetScheduledFrameCompletionCallback )( - IDeckLinkOutput * This, - /* [in] */ IDeckLinkVideoOutputCallback *theCallback); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, GetBufferedVideoFrameCount) - HRESULT ( STDMETHODCALLTYPE *GetBufferedVideoFrameCount )( - IDeckLinkOutput * This, - /* [out] */ unsigned int *bufferedFrameCount); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, EnableAudioOutput) - HRESULT ( STDMETHODCALLTYPE *EnableAudioOutput )( - IDeckLinkOutput * This, - /* [in] */ BMDAudioSampleRate sampleRate, - /* [in] */ BMDAudioSampleType sampleType, - /* [in] */ unsigned int channelCount, - /* [in] */ BMDAudioOutputStreamType streamType); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, DisableAudioOutput) - HRESULT ( STDMETHODCALLTYPE *DisableAudioOutput )( - IDeckLinkOutput * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, WriteAudioSamplesSync) - HRESULT ( STDMETHODCALLTYPE *WriteAudioSamplesSync )( - IDeckLinkOutput * This, - /* [in] */ void *buffer, - /* [in] */ unsigned int sampleFrameCount, - /* [out] */ unsigned int *sampleFramesWritten); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, BeginAudioPreroll) - HRESULT ( STDMETHODCALLTYPE *BeginAudioPreroll )( - IDeckLinkOutput * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, EndAudioPreroll) - HRESULT ( STDMETHODCALLTYPE *EndAudioPreroll )( - IDeckLinkOutput * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, ScheduleAudioSamples) - HRESULT ( STDMETHODCALLTYPE *ScheduleAudioSamples )( - IDeckLinkOutput * This, - /* [in] */ void *buffer, - /* [in] */ unsigned int sampleFrameCount, - /* [in] */ BMDTimeValue streamTime, - /* [in] */ BMDTimeScale timeScale, - /* [out] */ unsigned int *sampleFramesWritten); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, GetBufferedAudioSampleFrameCount) - HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( - IDeckLinkOutput * This, - /* [out] */ unsigned int *bufferedSampleFrameCount); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, FlushBufferedAudioSamples) - HRESULT ( STDMETHODCALLTYPE *FlushBufferedAudioSamples )( - IDeckLinkOutput * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, SetAudioCallback) - HRESULT ( STDMETHODCALLTYPE *SetAudioCallback )( - IDeckLinkOutput * This, - /* [in] */ IDeckLinkAudioOutputCallback *theCallback); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, StartScheduledPlayback) - HRESULT ( STDMETHODCALLTYPE *StartScheduledPlayback )( - IDeckLinkOutput * This, - /* [in] */ BMDTimeValue playbackStartTime, - /* [in] */ BMDTimeScale timeScale, - /* [in] */ double playbackSpeed); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, StopScheduledPlayback) - HRESULT ( STDMETHODCALLTYPE *StopScheduledPlayback )( - IDeckLinkOutput * This, - /* [in] */ BMDTimeValue stopPlaybackAtTime, - /* [out] */ BMDTimeValue *actualStopTime, - /* [in] */ BMDTimeScale timeScale); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, IsScheduledPlaybackRunning) - HRESULT ( STDMETHODCALLTYPE *IsScheduledPlaybackRunning )( - IDeckLinkOutput * This, - /* [out] */ BOOL *active); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, GetScheduledStreamTime) - HRESULT ( STDMETHODCALLTYPE *GetScheduledStreamTime )( - IDeckLinkOutput * This, - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *streamTime, - /* [out] */ double *playbackSpeed); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, GetReferenceStatus) - HRESULT ( STDMETHODCALLTYPE *GetReferenceStatus )( - IDeckLinkOutput * This, - /* [out] */ BMDReferenceStatus *referenceStatus); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, GetHardwareReferenceClock) - HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( - IDeckLinkOutput * This, - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame); - - DECLSPEC_XFGVIRT(IDeckLinkOutput, GetFrameCompletionReferenceTimestamp) - HRESULT ( STDMETHODCALLTYPE *GetFrameCompletionReferenceTimestamp )( - IDeckLinkOutput * This, - /* [in] */ IDeckLinkVideoFrame *theFrame, - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *frameCompletionTimestamp); - - 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,connection,requestedMode,requestedPixelFormat,conversionMode,flags,actualMode,supported) \ - ( (This)->lpVtbl -> DoesSupportVideoMode(This,connection,requestedMode,requestedPixelFormat,conversionMode,flags,actualMode,supported) ) - -#define IDeckLinkOutput_GetDisplayMode(This,displayMode,resultDisplayMode) \ - ( (This)->lpVtbl -> GetDisplayMode(This,displayMode,resultDisplayMode) ) - -#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_CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) \ - ( (This)->lpVtbl -> CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) ) - -#define IDeckLinkOutput_CreateVideoFrameWithBuffer(This,width,height,rowBytes,pixelFormat,flags,buffer,outFrame) \ - ( (This)->lpVtbl -> CreateVideoFrameWithBuffer(This,width,height,rowBytes,pixelFormat,flags,buffer,outFrame) ) - -#define IDeckLinkOutput_RowBytesForPixelFormat(This,pixelFormat,width,rowBytes) \ - ( (This)->lpVtbl -> RowBytesForPixelFormat(This,pixelFormat,width,rowBytes) ) - -#define IDeckLinkOutput_CreateAncillaryData(This,pixelFormat,outBuffer) \ - ( (This)->lpVtbl -> CreateAncillaryData(This,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_GetReferenceStatus(This,referenceStatus) \ - ( (This)->lpVtbl -> GetReferenceStatus(This,referenceStatus) ) - -#define IDeckLinkOutput_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) \ - ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) - -#define IDeckLinkOutput_GetFrameCompletionReferenceTimestamp(This,theFrame,desiredTimeScale,frameCompletionTimestamp) \ - ( (This)->lpVtbl -> GetFrameCompletionReferenceTimestamp(This,theFrame,desiredTimeScale,frameCompletionTimestamp) ) - -#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("6A515F8A-FBCE-4853-B0F7-2A09DB1ECA0B") - IDeckLinkInput : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( - /* [in] */ BMDVideoConnection connection, - /* [in] */ BMDDisplayMode requestedMode, - /* [in] */ BMDPixelFormat requestedPixelFormat, - /* [in] */ BMDVideoInputConversionMode conversionMode, - /* [in] */ BMDSupportedVideoModeFlags flags, - /* [out] */ BMDDisplayMode *actualMode, - /* [out] */ BOOL *supported) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayMode( - /* [in] */ BMDDisplayMode displayMode, - /* [out] */ IDeckLinkDisplayMode **resultDisplayMode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( - /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( - /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDVideoInputFlags flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableVideoInputWithAllocatorProvider( - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDVideoInputFlags flags, - /* [in] */ IDeckLinkVideoBufferAllocatorProvider *allocatorProvider) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAvailableVideoFrameCount( - /* [out] */ unsigned int *availableFrameCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( - /* [in] */ BMDAudioSampleRate sampleRate, - /* [in] */ BMDAudioSampleType sampleType, - /* [in] */ unsigned int channelCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAvailableAudioSampleFrameCount( - /* [out] */ unsigned int *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( - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkInputVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkInput * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkInput * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkInput * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput, DoesSupportVideoMode) - HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( - IDeckLinkInput * This, - /* [in] */ BMDVideoConnection connection, - /* [in] */ BMDDisplayMode requestedMode, - /* [in] */ BMDPixelFormat requestedPixelFormat, - /* [in] */ BMDVideoInputConversionMode conversionMode, - /* [in] */ BMDSupportedVideoModeFlags flags, - /* [out] */ BMDDisplayMode *actualMode, - /* [out] */ BOOL *supported); - - DECLSPEC_XFGVIRT(IDeckLinkInput, GetDisplayMode) - HRESULT ( STDMETHODCALLTYPE *GetDisplayMode )( - IDeckLinkInput * This, - /* [in] */ BMDDisplayMode displayMode, - /* [out] */ IDeckLinkDisplayMode **resultDisplayMode); - - DECLSPEC_XFGVIRT(IDeckLinkInput, GetDisplayModeIterator) - HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( - IDeckLinkInput * This, - /* [out] */ IDeckLinkDisplayModeIterator **iterator); - - DECLSPEC_XFGVIRT(IDeckLinkInput, SetScreenPreviewCallback) - HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( - IDeckLinkInput * This, - /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback); - - DECLSPEC_XFGVIRT(IDeckLinkInput, EnableVideoInput) - HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( - IDeckLinkInput * This, - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDVideoInputFlags flags); - - DECLSPEC_XFGVIRT(IDeckLinkInput, EnableVideoInputWithAllocatorProvider) - HRESULT ( STDMETHODCALLTYPE *EnableVideoInputWithAllocatorProvider )( - IDeckLinkInput * This, - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDVideoInputFlags flags, - /* [in] */ IDeckLinkVideoBufferAllocatorProvider *allocatorProvider); - - DECLSPEC_XFGVIRT(IDeckLinkInput, DisableVideoInput) - HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( - IDeckLinkInput * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput, GetAvailableVideoFrameCount) - HRESULT ( STDMETHODCALLTYPE *GetAvailableVideoFrameCount )( - IDeckLinkInput * This, - /* [out] */ unsigned int *availableFrameCount); - - DECLSPEC_XFGVIRT(IDeckLinkInput, EnableAudioInput) - HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( - IDeckLinkInput * This, - /* [in] */ BMDAudioSampleRate sampleRate, - /* [in] */ BMDAudioSampleType sampleType, - /* [in] */ unsigned int channelCount); - - DECLSPEC_XFGVIRT(IDeckLinkInput, DisableAudioInput) - HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( - IDeckLinkInput * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput, GetAvailableAudioSampleFrameCount) - HRESULT ( STDMETHODCALLTYPE *GetAvailableAudioSampleFrameCount )( - IDeckLinkInput * This, - /* [out] */ unsigned int *availableSampleFrameCount); - - DECLSPEC_XFGVIRT(IDeckLinkInput, StartStreams) - HRESULT ( STDMETHODCALLTYPE *StartStreams )( - IDeckLinkInput * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput, StopStreams) - HRESULT ( STDMETHODCALLTYPE *StopStreams )( - IDeckLinkInput * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput, PauseStreams) - HRESULT ( STDMETHODCALLTYPE *PauseStreams )( - IDeckLinkInput * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput, FlushStreams) - HRESULT ( STDMETHODCALLTYPE *FlushStreams )( - IDeckLinkInput * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput, SetCallback) - HRESULT ( STDMETHODCALLTYPE *SetCallback )( - IDeckLinkInput * This, - /* [in] */ IDeckLinkInputCallback *theCallback); - - DECLSPEC_XFGVIRT(IDeckLinkInput, GetHardwareReferenceClock) - HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( - IDeckLinkInput * This, - /* [in] */ 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,connection,requestedMode,requestedPixelFormat,conversionMode,flags,actualMode,supported) \ - ( (This)->lpVtbl -> DoesSupportVideoMode(This,connection,requestedMode,requestedPixelFormat,conversionMode,flags,actualMode,supported) ) - -#define IDeckLinkInput_GetDisplayMode(This,displayMode,resultDisplayMode) \ - ( (This)->lpVtbl -> GetDisplayMode(This,displayMode,resultDisplayMode) ) - -#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_EnableVideoInputWithAllocatorProvider(This,displayMode,pixelFormat,flags,allocatorProvider) \ - ( (This)->lpVtbl -> EnableVideoInputWithAllocatorProvider(This,displayMode,pixelFormat,flags,allocatorProvider) ) - -#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 __IDeckLinkIPExtensions_INTERFACE_DEFINED__ -#define __IDeckLinkIPExtensions_INTERFACE_DEFINED__ - -/* interface IDeckLinkIPExtensions */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkIPExtensions; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("46CF7903-A9FD-4D0B-8FFC-0103722AB442") - IDeckLinkIPExtensions : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetDeckLinkIPFlowIterator( - /* [out] */ IDeckLinkIPFlowIterator **iterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetIPFlowByID( - /* [in] */ BMDIPFlowID id, - /* [out] */ IDeckLinkIPFlow **flow) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkIPExtensionsVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkIPExtensions * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkIPExtensions * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkIPExtensions * This); - - DECLSPEC_XFGVIRT(IDeckLinkIPExtensions, GetDeckLinkIPFlowIterator) - HRESULT ( STDMETHODCALLTYPE *GetDeckLinkIPFlowIterator )( - IDeckLinkIPExtensions * This, - /* [out] */ IDeckLinkIPFlowIterator **iterator); - - DECLSPEC_XFGVIRT(IDeckLinkIPExtensions, GetIPFlowByID) - HRESULT ( STDMETHODCALLTYPE *GetIPFlowByID )( - IDeckLinkIPExtensions * This, - /* [in] */ BMDIPFlowID id, - /* [out] */ IDeckLinkIPFlow **flow); - - END_INTERFACE - } IDeckLinkIPExtensionsVtbl; - - interface IDeckLinkIPExtensions - { - CONST_VTBL struct IDeckLinkIPExtensionsVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkIPExtensions_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkIPExtensions_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkIPExtensions_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkIPExtensions_GetDeckLinkIPFlowIterator(This,iterator) \ - ( (This)->lpVtbl -> GetDeckLinkIPFlowIterator(This,iterator) ) - -#define IDeckLinkIPExtensions_GetIPFlowByID(This,id,flow) \ - ( (This)->lpVtbl -> GetIPFlowByID(This,id,flow) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkIPExtensions_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkHDMIInputEDID_INTERFACE_DEFINED__ -#define __IDeckLinkHDMIInputEDID_INTERFACE_DEFINED__ - -/* interface IDeckLinkHDMIInputEDID */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkHDMIInputEDID; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("ABBBACBC-45BC-4665-9D92-ACE6E5A97902") - IDeckLinkHDMIInputEDID : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SetInt( - /* [in] */ BMDDeckLinkHDMIInputEDIDID cfgID, - /* [in] */ LONGLONG value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetInt( - /* [in] */ BMDDeckLinkHDMIInputEDIDID cfgID, - /* [out] */ LONGLONG *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE WriteToEDID( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkHDMIInputEDIDVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkHDMIInputEDID * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkHDMIInputEDID * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkHDMIInputEDID * This); - - DECLSPEC_XFGVIRT(IDeckLinkHDMIInputEDID, SetInt) - HRESULT ( STDMETHODCALLTYPE *SetInt )( - IDeckLinkHDMIInputEDID * This, - /* [in] */ BMDDeckLinkHDMIInputEDIDID cfgID, - /* [in] */ LONGLONG value); - - DECLSPEC_XFGVIRT(IDeckLinkHDMIInputEDID, GetInt) - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IDeckLinkHDMIInputEDID * This, - /* [in] */ BMDDeckLinkHDMIInputEDIDID cfgID, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IDeckLinkHDMIInputEDID, WriteToEDID) - HRESULT ( STDMETHODCALLTYPE *WriteToEDID )( - IDeckLinkHDMIInputEDID * This); - - END_INTERFACE - } IDeckLinkHDMIInputEDIDVtbl; - - interface IDeckLinkHDMIInputEDID - { - CONST_VTBL struct IDeckLinkHDMIInputEDIDVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkHDMIInputEDID_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkHDMIInputEDID_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkHDMIInputEDID_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkHDMIInputEDID_SetInt(This,cfgID,value) \ - ( (This)->lpVtbl -> SetInt(This,cfgID,value) ) - -#define IDeckLinkHDMIInputEDID_GetInt(This,cfgID,value) \ - ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) - -#define IDeckLinkHDMIInputEDID_WriteToEDID(This) \ - ( (This)->lpVtbl -> WriteToEDID(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkHDMIInputEDID_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkEncoderInput_INTERFACE_DEFINED__ -#define __IDeckLinkEncoderInput_INTERFACE_DEFINED__ - -/* interface IDeckLinkEncoderInput */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkEncoderInput; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("46C1332E-6FD9-472A-8591-FE59C22192E1") - IDeckLinkEncoderInput : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( - /* [in] */ BMDVideoConnection connection, - /* [in] */ BMDDisplayMode requestedMode, - /* [in] */ BMDPixelFormat requestedCodec, - /* [in] */ unsigned int requestedCodecProfile, - /* [in] */ BMDSupportedVideoModeFlags flags, - /* [out] */ BOOL *supported) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayMode( - /* [in] */ BMDDisplayMode displayMode, - /* [out] */ IDeckLinkDisplayMode **resultDisplayMode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( - /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDVideoInputFlags flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAvailablePacketsCount( - /* [out] */ unsigned int *availablePacketsCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( - /* [in] */ BMDAudioFormat audioFormat, - /* [in] */ BMDAudioSampleRate sampleRate, - /* [in] */ BMDAudioSampleType sampleType, - /* [in] */ unsigned int channelCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAvailableAudioSampleFrameCount( - /* [out] */ unsigned int *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] */ IDeckLinkEncoderInputCallback *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkEncoderInputVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkEncoderInput * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkEncoderInput * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkEncoderInput * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput, DoesSupportVideoMode) - HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( - IDeckLinkEncoderInput * This, - /* [in] */ BMDVideoConnection connection, - /* [in] */ BMDDisplayMode requestedMode, - /* [in] */ BMDPixelFormat requestedCodec, - /* [in] */ unsigned int requestedCodecProfile, - /* [in] */ BMDSupportedVideoModeFlags flags, - /* [out] */ BOOL *supported); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput, GetDisplayMode) - HRESULT ( STDMETHODCALLTYPE *GetDisplayMode )( - IDeckLinkEncoderInput * This, - /* [in] */ BMDDisplayMode displayMode, - /* [out] */ IDeckLinkDisplayMode **resultDisplayMode); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput, GetDisplayModeIterator) - HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( - IDeckLinkEncoderInput * This, - /* [out] */ IDeckLinkDisplayModeIterator **iterator); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput, EnableVideoInput) - HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( - IDeckLinkEncoderInput * This, - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDVideoInputFlags flags); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput, DisableVideoInput) - HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( - IDeckLinkEncoderInput * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput, GetAvailablePacketsCount) - HRESULT ( STDMETHODCALLTYPE *GetAvailablePacketsCount )( - IDeckLinkEncoderInput * This, - /* [out] */ unsigned int *availablePacketsCount); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput, EnableAudioInput) - HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( - IDeckLinkEncoderInput * This, - /* [in] */ BMDAudioFormat audioFormat, - /* [in] */ BMDAudioSampleRate sampleRate, - /* [in] */ BMDAudioSampleType sampleType, - /* [in] */ unsigned int channelCount); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput, DisableAudioInput) - HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( - IDeckLinkEncoderInput * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput, GetAvailableAudioSampleFrameCount) - HRESULT ( STDMETHODCALLTYPE *GetAvailableAudioSampleFrameCount )( - IDeckLinkEncoderInput * This, - /* [out] */ unsigned int *availableSampleFrameCount); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput, StartStreams) - HRESULT ( STDMETHODCALLTYPE *StartStreams )( - IDeckLinkEncoderInput * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput, StopStreams) - HRESULT ( STDMETHODCALLTYPE *StopStreams )( - IDeckLinkEncoderInput * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput, PauseStreams) - HRESULT ( STDMETHODCALLTYPE *PauseStreams )( - IDeckLinkEncoderInput * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput, FlushStreams) - HRESULT ( STDMETHODCALLTYPE *FlushStreams )( - IDeckLinkEncoderInput * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput, SetCallback) - HRESULT ( STDMETHODCALLTYPE *SetCallback )( - IDeckLinkEncoderInput * This, - /* [in] */ IDeckLinkEncoderInputCallback *theCallback); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput, GetHardwareReferenceClock) - HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( - IDeckLinkEncoderInput * This, - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame); - - END_INTERFACE - } IDeckLinkEncoderInputVtbl; - - interface IDeckLinkEncoderInput - { - CONST_VTBL struct IDeckLinkEncoderInputVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkEncoderInput_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkEncoderInput_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkEncoderInput_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkEncoderInput_DoesSupportVideoMode(This,connection,requestedMode,requestedCodec,requestedCodecProfile,flags,supported) \ - ( (This)->lpVtbl -> DoesSupportVideoMode(This,connection,requestedMode,requestedCodec,requestedCodecProfile,flags,supported) ) - -#define IDeckLinkEncoderInput_GetDisplayMode(This,displayMode,resultDisplayMode) \ - ( (This)->lpVtbl -> GetDisplayMode(This,displayMode,resultDisplayMode) ) - -#define IDeckLinkEncoderInput_GetDisplayModeIterator(This,iterator) \ - ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) - -#define IDeckLinkEncoderInput_EnableVideoInput(This,displayMode,pixelFormat,flags) \ - ( (This)->lpVtbl -> EnableVideoInput(This,displayMode,pixelFormat,flags) ) - -#define IDeckLinkEncoderInput_DisableVideoInput(This) \ - ( (This)->lpVtbl -> DisableVideoInput(This) ) - -#define IDeckLinkEncoderInput_GetAvailablePacketsCount(This,availablePacketsCount) \ - ( (This)->lpVtbl -> GetAvailablePacketsCount(This,availablePacketsCount) ) - -#define IDeckLinkEncoderInput_EnableAudioInput(This,audioFormat,sampleRate,sampleType,channelCount) \ - ( (This)->lpVtbl -> EnableAudioInput(This,audioFormat,sampleRate,sampleType,channelCount) ) - -#define IDeckLinkEncoderInput_DisableAudioInput(This) \ - ( (This)->lpVtbl -> DisableAudioInput(This) ) - -#define IDeckLinkEncoderInput_GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) \ - ( (This)->lpVtbl -> GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) ) - -#define IDeckLinkEncoderInput_StartStreams(This) \ - ( (This)->lpVtbl -> StartStreams(This) ) - -#define IDeckLinkEncoderInput_StopStreams(This) \ - ( (This)->lpVtbl -> StopStreams(This) ) - -#define IDeckLinkEncoderInput_PauseStreams(This) \ - ( (This)->lpVtbl -> PauseStreams(This) ) - -#define IDeckLinkEncoderInput_FlushStreams(This) \ - ( (This)->lpVtbl -> FlushStreams(This) ) - -#define IDeckLinkEncoderInput_SetCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetCallback(This,theCallback) ) - -#define IDeckLinkEncoderInput_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) \ - ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkEncoderInput_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkVideoBuffer_INTERFACE_DEFINED__ -#define __IDeckLinkVideoBuffer_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoBuffer */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoBuffer; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("81F03D70-DE13-4B17-873A-C8AC9689C682") - IDeckLinkVideoBuffer : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetBytes( - /* [out] */ void **buffer) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetSize( - /* [out] */ ULONGLONG *size) = 0; - - virtual HRESULT STDMETHODCALLTYPE StartAccess( - /* [in] */ BMDBufferAccessFlags flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE EndAccess( - /* [in] */ BMDBufferAccessFlags flags) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkVideoBufferVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoBuffer * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoBuffer * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoBuffer * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoBuffer, GetBytes) - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IDeckLinkVideoBuffer * This, - /* [out] */ void **buffer); - - DECLSPEC_XFGVIRT(IDeckLinkVideoBuffer, GetSize) - HRESULT ( STDMETHODCALLTYPE *GetSize )( - IDeckLinkVideoBuffer * This, - /* [out] */ ULONGLONG *size); - - DECLSPEC_XFGVIRT(IDeckLinkVideoBuffer, StartAccess) - HRESULT ( STDMETHODCALLTYPE *StartAccess )( - IDeckLinkVideoBuffer * This, - /* [in] */ BMDBufferAccessFlags flags); - - DECLSPEC_XFGVIRT(IDeckLinkVideoBuffer, EndAccess) - HRESULT ( STDMETHODCALLTYPE *EndAccess )( - IDeckLinkVideoBuffer * This, - /* [in] */ BMDBufferAccessFlags flags); - - END_INTERFACE - } IDeckLinkVideoBufferVtbl; - - interface IDeckLinkVideoBuffer - { - CONST_VTBL struct IDeckLinkVideoBufferVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoBuffer_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoBuffer_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoBuffer_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoBuffer_GetBytes(This,buffer) \ - ( (This)->lpVtbl -> GetBytes(This,buffer) ) - -#define IDeckLinkVideoBuffer_GetSize(This,size) \ - ( (This)->lpVtbl -> GetSize(This,size) ) - -#define IDeckLinkVideoBuffer_StartAccess(This,flags) \ - ( (This)->lpVtbl -> StartAccess(This,flags) ) - -#define IDeckLinkVideoBuffer_EndAccess(This,flags) \ - ( (This)->lpVtbl -> EndAccess(This,flags) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoBuffer_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("6502091C-615F-4F51-BAF6-45C4256DD5B0") - 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 GetTimecode( - /* [in] */ BMDTimecodeFormat format, - /* [out] */ IDeckLinkTimecode **timecode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAncillaryData( - /* [out] */ IDeckLinkVideoFrameAncillary **ancillary) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkVideoFrameVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoFrame * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoFrame * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoFrame * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame, GetWidth) - long ( STDMETHODCALLTYPE *GetWidth )( - IDeckLinkVideoFrame * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame, GetHeight) - long ( STDMETHODCALLTYPE *GetHeight )( - IDeckLinkVideoFrame * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame, GetRowBytes) - long ( STDMETHODCALLTYPE *GetRowBytes )( - IDeckLinkVideoFrame * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame, GetPixelFormat) - BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( - IDeckLinkVideoFrame * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame, GetFlags) - BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( - IDeckLinkVideoFrame * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame, GetTimecode) - HRESULT ( STDMETHODCALLTYPE *GetTimecode )( - IDeckLinkVideoFrame * This, - /* [in] */ BMDTimecodeFormat format, - /* [out] */ IDeckLinkTimecode **timecode); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame, GetAncillaryData) - 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_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("CF9EB134-0374-4C5B-95FA-1EC14819FF62") - IDeckLinkMutableVideoFrame : public IDeckLinkVideoFrame - { - public: - virtual HRESULT STDMETHODCALLTYPE SetFlags( - /* [in] */ BMDFrameFlags newFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetTimecode( - /* [in] */ BMDTimecodeFormat format, - /* [in] */ IDeckLinkTimecode *timecode) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetTimecodeFromComponents( - /* [in] */ BMDTimecodeFormat format, - /* [in] */ unsigned char hours, - /* [in] */ unsigned char minutes, - /* [in] */ unsigned char seconds, - /* [in] */ unsigned char frames, - /* [in] */ BMDTimecodeFlags flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetAncillaryData( - /* [in] */ IDeckLinkVideoFrameAncillary *ancillary) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetTimecodeUserBits( - /* [in] */ BMDTimecodeFormat format, - /* [in] */ BMDTimecodeUserBits userBits) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetInterfaceProvider( - /* [in] */ REFIID iid, - /* [in] */ IUnknown *iface) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkMutableVideoFrameVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkMutableVideoFrame * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkMutableVideoFrame * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkMutableVideoFrame * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame, GetWidth) - long ( STDMETHODCALLTYPE *GetWidth )( - IDeckLinkMutableVideoFrame * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame, GetHeight) - long ( STDMETHODCALLTYPE *GetHeight )( - IDeckLinkMutableVideoFrame * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame, GetRowBytes) - long ( STDMETHODCALLTYPE *GetRowBytes )( - IDeckLinkMutableVideoFrame * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame, GetPixelFormat) - BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( - IDeckLinkMutableVideoFrame * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame, GetFlags) - BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( - IDeckLinkMutableVideoFrame * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame, GetTimecode) - HRESULT ( STDMETHODCALLTYPE *GetTimecode )( - IDeckLinkMutableVideoFrame * This, - /* [in] */ BMDTimecodeFormat format, - /* [out] */ IDeckLinkTimecode **timecode); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame, GetAncillaryData) - HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( - IDeckLinkMutableVideoFrame * This, - /* [out] */ IDeckLinkVideoFrameAncillary **ancillary); - - DECLSPEC_XFGVIRT(IDeckLinkMutableVideoFrame, SetFlags) - HRESULT ( STDMETHODCALLTYPE *SetFlags )( - IDeckLinkMutableVideoFrame * This, - /* [in] */ BMDFrameFlags newFlags); - - DECLSPEC_XFGVIRT(IDeckLinkMutableVideoFrame, SetTimecode) - HRESULT ( STDMETHODCALLTYPE *SetTimecode )( - IDeckLinkMutableVideoFrame * This, - /* [in] */ BMDTimecodeFormat format, - /* [in] */ IDeckLinkTimecode *timecode); - - DECLSPEC_XFGVIRT(IDeckLinkMutableVideoFrame, SetTimecodeFromComponents) - HRESULT ( STDMETHODCALLTYPE *SetTimecodeFromComponents )( - IDeckLinkMutableVideoFrame * This, - /* [in] */ BMDTimecodeFormat format, - /* [in] */ unsigned char hours, - /* [in] */ unsigned char minutes, - /* [in] */ unsigned char seconds, - /* [in] */ unsigned char frames, - /* [in] */ BMDTimecodeFlags flags); - - DECLSPEC_XFGVIRT(IDeckLinkMutableVideoFrame, SetAncillaryData) - HRESULT ( STDMETHODCALLTYPE *SetAncillaryData )( - IDeckLinkMutableVideoFrame * This, - /* [in] */ IDeckLinkVideoFrameAncillary *ancillary); - - DECLSPEC_XFGVIRT(IDeckLinkMutableVideoFrame, SetTimecodeUserBits) - HRESULT ( STDMETHODCALLTYPE *SetTimecodeUserBits )( - IDeckLinkMutableVideoFrame * This, - /* [in] */ BMDTimecodeFormat format, - /* [in] */ BMDTimecodeUserBits userBits); - - DECLSPEC_XFGVIRT(IDeckLinkMutableVideoFrame, SetInterfaceProvider) - HRESULT ( STDMETHODCALLTYPE *SetInterfaceProvider )( - IDeckLinkMutableVideoFrame * This, - /* [in] */ REFIID iid, - /* [in] */ IUnknown *iface); - - 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_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) ) - -#define IDeckLinkMutableVideoFrame_SetTimecodeUserBits(This,format,userBits) \ - ( (This)->lpVtbl -> SetTimecodeUserBits(This,format,userBits) ) - -#define IDeckLinkMutableVideoFrame_SetInterfaceProvider(This,iid,iface) \ - ( (This)->lpVtbl -> SetInterfaceProvider(This,iid,iface) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkMutableVideoFrame_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkVideoFrame3DExtensions_INTERFACE_DEFINED__ -#define __IDeckLinkVideoFrame3DExtensions_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoFrame3DExtensions */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoFrame3DExtensions; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("D4DBE9C6-B4D2-49D3-ABF2-B4E86C7391B0") - IDeckLinkVideoFrame3DExtensions : public IUnknown - { - public: - virtual BMDVideo3DPackingFormat STDMETHODCALLTYPE Get3DPackingFormat( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFrameForRightEye( - /* [out] */ IDeckLinkVideoFrame **rightEyeFrame) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkVideoFrame3DExtensionsVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoFrame3DExtensions * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoFrame3DExtensions * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoFrame3DExtensions * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame3DExtensions, Get3DPackingFormat) - BMDVideo3DPackingFormat ( STDMETHODCALLTYPE *Get3DPackingFormat )( - IDeckLinkVideoFrame3DExtensions * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame3DExtensions, GetFrameForRightEye) - HRESULT ( STDMETHODCALLTYPE *GetFrameForRightEye )( - IDeckLinkVideoFrame3DExtensions * This, - /* [out] */ IDeckLinkVideoFrame **rightEyeFrame); - - END_INTERFACE - } IDeckLinkVideoFrame3DExtensionsVtbl; - - interface IDeckLinkVideoFrame3DExtensions - { - CONST_VTBL struct IDeckLinkVideoFrame3DExtensionsVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoFrame3DExtensions_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoFrame3DExtensions_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoFrame3DExtensions_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoFrame3DExtensions_Get3DPackingFormat(This) \ - ( (This)->lpVtbl -> Get3DPackingFormat(This) ) - -#define IDeckLinkVideoFrame3DExtensions_GetFrameForRightEye(This,rightEyeFrame) \ - ( (This)->lpVtbl -> GetFrameForRightEye(This,rightEyeFrame) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoFrame3DExtensions_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkVideoFrameMetadataExtensions_INTERFACE_DEFINED__ -#define __IDeckLinkVideoFrameMetadataExtensions_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoFrameMetadataExtensions */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoFrameMetadataExtensions; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("E232A5B7-4DB4-44C9-9152-F47C12E5F051") - IDeckLinkVideoFrameMetadataExtensions : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetInt( - /* [in] */ BMDDeckLinkFrameMetadataID metadataID, - /* [out] */ LONGLONG *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFloat( - /* [in] */ BMDDeckLinkFrameMetadataID metadataID, - /* [out] */ double *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFlag( - /* [in] */ BMDDeckLinkFrameMetadataID metadataID, - /* [out] */ BOOL *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetString( - /* [in] */ BMDDeckLinkFrameMetadataID metadataID, - /* [out] */ BSTR *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBytes( - /* [in] */ BMDDeckLinkFrameMetadataID metadataID, - /* [out] */ void *buffer, - /* [out][in] */ unsigned int *bufferSize) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkVideoFrameMetadataExtensionsVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoFrameMetadataExtensions * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoFrameMetadataExtensions * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoFrameMetadataExtensions * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameMetadataExtensions, GetInt) - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IDeckLinkVideoFrameMetadataExtensions * This, - /* [in] */ BMDDeckLinkFrameMetadataID metadataID, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameMetadataExtensions, GetFloat) - HRESULT ( STDMETHODCALLTYPE *GetFloat )( - IDeckLinkVideoFrameMetadataExtensions * This, - /* [in] */ BMDDeckLinkFrameMetadataID metadataID, - /* [out] */ double *value); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameMetadataExtensions, GetFlag) - HRESULT ( STDMETHODCALLTYPE *GetFlag )( - IDeckLinkVideoFrameMetadataExtensions * This, - /* [in] */ BMDDeckLinkFrameMetadataID metadataID, - /* [out] */ BOOL *value); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameMetadataExtensions, GetString) - HRESULT ( STDMETHODCALLTYPE *GetString )( - IDeckLinkVideoFrameMetadataExtensions * This, - /* [in] */ BMDDeckLinkFrameMetadataID metadataID, - /* [out] */ BSTR *value); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameMetadataExtensions, GetBytes) - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IDeckLinkVideoFrameMetadataExtensions * This, - /* [in] */ BMDDeckLinkFrameMetadataID metadataID, - /* [out] */ void *buffer, - /* [out][in] */ unsigned int *bufferSize); - - END_INTERFACE - } IDeckLinkVideoFrameMetadataExtensionsVtbl; - - interface IDeckLinkVideoFrameMetadataExtensions - { - CONST_VTBL struct IDeckLinkVideoFrameMetadataExtensionsVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoFrameMetadataExtensions_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoFrameMetadataExtensions_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoFrameMetadataExtensions_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoFrameMetadataExtensions_GetInt(This,metadataID,value) \ - ( (This)->lpVtbl -> GetInt(This,metadataID,value) ) - -#define IDeckLinkVideoFrameMetadataExtensions_GetFloat(This,metadataID,value) \ - ( (This)->lpVtbl -> GetFloat(This,metadataID,value) ) - -#define IDeckLinkVideoFrameMetadataExtensions_GetFlag(This,metadataID,value) \ - ( (This)->lpVtbl -> GetFlag(This,metadataID,value) ) - -#define IDeckLinkVideoFrameMetadataExtensions_GetString(This,metadataID,value) \ - ( (This)->lpVtbl -> GetString(This,metadataID,value) ) - -#define IDeckLinkVideoFrameMetadataExtensions_GetBytes(This,metadataID,buffer,bufferSize) \ - ( (This)->lpVtbl -> GetBytes(This,metadataID,buffer,bufferSize) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoFrameMetadataExtensions_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkVideoFrameMutableMetadataExtensions_INTERFACE_DEFINED__ -#define __IDeckLinkVideoFrameMutableMetadataExtensions_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoFrameMutableMetadataExtensions */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoFrameMutableMetadataExtensions; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("CC198FC6-8298-4419-942D-8357EC355E58") - IDeckLinkVideoFrameMutableMetadataExtensions : public IDeckLinkVideoFrameMetadataExtensions - { - public: - virtual HRESULT STDMETHODCALLTYPE SetInt( - /* [in] */ BMDDeckLinkFrameMetadataID metadataID, - /* [in] */ LONGLONG value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFloat( - /* [in] */ BMDDeckLinkFrameMetadataID metadataID, - /* [in] */ double value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFlag( - /* [in] */ BMDDeckLinkFrameMetadataID metadataID, - /* [in] */ BOOL value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetString( - /* [in] */ BMDDeckLinkFrameMetadataID metadataID, - /* [in] */ BSTR value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetBytes( - /* [in] */ BMDDeckLinkFrameMetadataID metadataID, - /* [in] */ void *buffer, - /* [in] */ unsigned int bufferSize) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkVideoFrameMutableMetadataExtensionsVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoFrameMutableMetadataExtensions * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoFrameMutableMetadataExtensions * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoFrameMutableMetadataExtensions * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameMetadataExtensions, GetInt) - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IDeckLinkVideoFrameMutableMetadataExtensions * This, - /* [in] */ BMDDeckLinkFrameMetadataID metadataID, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameMetadataExtensions, GetFloat) - HRESULT ( STDMETHODCALLTYPE *GetFloat )( - IDeckLinkVideoFrameMutableMetadataExtensions * This, - /* [in] */ BMDDeckLinkFrameMetadataID metadataID, - /* [out] */ double *value); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameMetadataExtensions, GetFlag) - HRESULT ( STDMETHODCALLTYPE *GetFlag )( - IDeckLinkVideoFrameMutableMetadataExtensions * This, - /* [in] */ BMDDeckLinkFrameMetadataID metadataID, - /* [out] */ BOOL *value); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameMetadataExtensions, GetString) - HRESULT ( STDMETHODCALLTYPE *GetString )( - IDeckLinkVideoFrameMutableMetadataExtensions * This, - /* [in] */ BMDDeckLinkFrameMetadataID metadataID, - /* [out] */ BSTR *value); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameMetadataExtensions, GetBytes) - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IDeckLinkVideoFrameMutableMetadataExtensions * This, - /* [in] */ BMDDeckLinkFrameMetadataID metadataID, - /* [out] */ void *buffer, - /* [out][in] */ unsigned int *bufferSize); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameMutableMetadataExtensions, SetInt) - HRESULT ( STDMETHODCALLTYPE *SetInt )( - IDeckLinkVideoFrameMutableMetadataExtensions * This, - /* [in] */ BMDDeckLinkFrameMetadataID metadataID, - /* [in] */ LONGLONG value); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameMutableMetadataExtensions, SetFloat) - HRESULT ( STDMETHODCALLTYPE *SetFloat )( - IDeckLinkVideoFrameMutableMetadataExtensions * This, - /* [in] */ BMDDeckLinkFrameMetadataID metadataID, - /* [in] */ double value); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameMutableMetadataExtensions, SetFlag) - HRESULT ( STDMETHODCALLTYPE *SetFlag )( - IDeckLinkVideoFrameMutableMetadataExtensions * This, - /* [in] */ BMDDeckLinkFrameMetadataID metadataID, - /* [in] */ BOOL value); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameMutableMetadataExtensions, SetString) - HRESULT ( STDMETHODCALLTYPE *SetString )( - IDeckLinkVideoFrameMutableMetadataExtensions * This, - /* [in] */ BMDDeckLinkFrameMetadataID metadataID, - /* [in] */ BSTR value); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameMutableMetadataExtensions, SetBytes) - HRESULT ( STDMETHODCALLTYPE *SetBytes )( - IDeckLinkVideoFrameMutableMetadataExtensions * This, - /* [in] */ BMDDeckLinkFrameMetadataID metadataID, - /* [in] */ void *buffer, - /* [in] */ unsigned int bufferSize); - - END_INTERFACE - } IDeckLinkVideoFrameMutableMetadataExtensionsVtbl; - - interface IDeckLinkVideoFrameMutableMetadataExtensions - { - CONST_VTBL struct IDeckLinkVideoFrameMutableMetadataExtensionsVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoFrameMutableMetadataExtensions_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoFrameMutableMetadataExtensions_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoFrameMutableMetadataExtensions_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoFrameMutableMetadataExtensions_GetInt(This,metadataID,value) \ - ( (This)->lpVtbl -> GetInt(This,metadataID,value) ) - -#define IDeckLinkVideoFrameMutableMetadataExtensions_GetFloat(This,metadataID,value) \ - ( (This)->lpVtbl -> GetFloat(This,metadataID,value) ) - -#define IDeckLinkVideoFrameMutableMetadataExtensions_GetFlag(This,metadataID,value) \ - ( (This)->lpVtbl -> GetFlag(This,metadataID,value) ) - -#define IDeckLinkVideoFrameMutableMetadataExtensions_GetString(This,metadataID,value) \ - ( (This)->lpVtbl -> GetString(This,metadataID,value) ) - -#define IDeckLinkVideoFrameMutableMetadataExtensions_GetBytes(This,metadataID,buffer,bufferSize) \ - ( (This)->lpVtbl -> GetBytes(This,metadataID,buffer,bufferSize) ) - - -#define IDeckLinkVideoFrameMutableMetadataExtensions_SetInt(This,metadataID,value) \ - ( (This)->lpVtbl -> SetInt(This,metadataID,value) ) - -#define IDeckLinkVideoFrameMutableMetadataExtensions_SetFloat(This,metadataID,value) \ - ( (This)->lpVtbl -> SetFloat(This,metadataID,value) ) - -#define IDeckLinkVideoFrameMutableMetadataExtensions_SetFlag(This,metadataID,value) \ - ( (This)->lpVtbl -> SetFlag(This,metadataID,value) ) - -#define IDeckLinkVideoFrameMutableMetadataExtensions_SetString(This,metadataID,value) \ - ( (This)->lpVtbl -> SetString(This,metadataID,value) ) - -#define IDeckLinkVideoFrameMutableMetadataExtensions_SetBytes(This,metadataID,buffer,bufferSize) \ - ( (This)->lpVtbl -> SetBytes(This,metadataID,buffer,bufferSize) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoFrameMutableMetadataExtensions_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("C9ADD3D2-BE52-488D-AB2D-7FDEF7AF0C95") - IDeckLinkVideoInputFrame : public IDeckLinkVideoFrame - { - public: - virtual HRESULT STDMETHODCALLTYPE GetStreamTime( - /* [out] */ BMDTimeValue *frameTime, - /* [out] */ BMDTimeValue *frameDuration, - /* [in] */ BMDTimeScale timeScale) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceTimestamp( - /* [in] */ BMDTimeScale timeScale, - /* [out] */ BMDTimeValue *frameTime, - /* [out] */ BMDTimeValue *frameDuration) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkVideoInputFrameVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoInputFrame * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoInputFrame * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoInputFrame * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame, GetWidth) - long ( STDMETHODCALLTYPE *GetWidth )( - IDeckLinkVideoInputFrame * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame, GetHeight) - long ( STDMETHODCALLTYPE *GetHeight )( - IDeckLinkVideoInputFrame * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame, GetRowBytes) - long ( STDMETHODCALLTYPE *GetRowBytes )( - IDeckLinkVideoInputFrame * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame, GetPixelFormat) - BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( - IDeckLinkVideoInputFrame * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame, GetFlags) - BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( - IDeckLinkVideoInputFrame * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame, GetTimecode) - HRESULT ( STDMETHODCALLTYPE *GetTimecode )( - IDeckLinkVideoInputFrame * This, - /* [in] */ BMDTimecodeFormat format, - /* [out] */ IDeckLinkTimecode **timecode); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame, GetAncillaryData) - HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( - IDeckLinkVideoInputFrame * This, - /* [out] */ IDeckLinkVideoFrameAncillary **ancillary); - - DECLSPEC_XFGVIRT(IDeckLinkVideoInputFrame, GetStreamTime) - HRESULT ( STDMETHODCALLTYPE *GetStreamTime )( - IDeckLinkVideoInputFrame * This, - /* [out] */ BMDTimeValue *frameTime, - /* [out] */ BMDTimeValue *frameDuration, - /* [in] */ BMDTimeScale timeScale); - - DECLSPEC_XFGVIRT(IDeckLinkVideoInputFrame, GetHardwareReferenceTimestamp) - HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceTimestamp )( - IDeckLinkVideoInputFrame * This, - /* [in] */ 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_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 __IDeckLinkAncillaryPacket_INTERFACE_DEFINED__ -#define __IDeckLinkAncillaryPacket_INTERFACE_DEFINED__ - -/* interface IDeckLinkAncillaryPacket */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkAncillaryPacket; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("F5C0D498-5CD3-4C77-9773-8EFA20BB334B") - IDeckLinkAncillaryPacket : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetBytes( - /* [in] */ BMDAncillaryPacketFormat format, - /* [out] */ const void **data, - /* [out] */ unsigned int *size) = 0; - - virtual unsigned char STDMETHODCALLTYPE GetDID( void) = 0; - - virtual unsigned char STDMETHODCALLTYPE GetSDID( void) = 0; - - virtual unsigned int STDMETHODCALLTYPE GetLineNumber( void) = 0; - - virtual unsigned char STDMETHODCALLTYPE GetDataStreamIndex( void) = 0; - - virtual BMDAncillaryDataSpace STDMETHODCALLTYPE GetDataSpace( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkAncillaryPacketVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkAncillaryPacket * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkAncillaryPacket * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkAncillaryPacket * This); - - DECLSPEC_XFGVIRT(IDeckLinkAncillaryPacket, GetBytes) - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IDeckLinkAncillaryPacket * This, - /* [in] */ BMDAncillaryPacketFormat format, - /* [out] */ const void **data, - /* [out] */ unsigned int *size); - - DECLSPEC_XFGVIRT(IDeckLinkAncillaryPacket, GetDID) - unsigned char ( STDMETHODCALLTYPE *GetDID )( - IDeckLinkAncillaryPacket * This); - - DECLSPEC_XFGVIRT(IDeckLinkAncillaryPacket, GetSDID) - unsigned char ( STDMETHODCALLTYPE *GetSDID )( - IDeckLinkAncillaryPacket * This); - - DECLSPEC_XFGVIRT(IDeckLinkAncillaryPacket, GetLineNumber) - unsigned int ( STDMETHODCALLTYPE *GetLineNumber )( - IDeckLinkAncillaryPacket * This); - - DECLSPEC_XFGVIRT(IDeckLinkAncillaryPacket, GetDataStreamIndex) - unsigned char ( STDMETHODCALLTYPE *GetDataStreamIndex )( - IDeckLinkAncillaryPacket * This); - - DECLSPEC_XFGVIRT(IDeckLinkAncillaryPacket, GetDataSpace) - BMDAncillaryDataSpace ( STDMETHODCALLTYPE *GetDataSpace )( - IDeckLinkAncillaryPacket * This); - - END_INTERFACE - } IDeckLinkAncillaryPacketVtbl; - - interface IDeckLinkAncillaryPacket - { - CONST_VTBL struct IDeckLinkAncillaryPacketVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkAncillaryPacket_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkAncillaryPacket_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkAncillaryPacket_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkAncillaryPacket_GetBytes(This,format,data,size) \ - ( (This)->lpVtbl -> GetBytes(This,format,data,size) ) - -#define IDeckLinkAncillaryPacket_GetDID(This) \ - ( (This)->lpVtbl -> GetDID(This) ) - -#define IDeckLinkAncillaryPacket_GetSDID(This) \ - ( (This)->lpVtbl -> GetSDID(This) ) - -#define IDeckLinkAncillaryPacket_GetLineNumber(This) \ - ( (This)->lpVtbl -> GetLineNumber(This) ) - -#define IDeckLinkAncillaryPacket_GetDataStreamIndex(This) \ - ( (This)->lpVtbl -> GetDataStreamIndex(This) ) - -#define IDeckLinkAncillaryPacket_GetDataSpace(This) \ - ( (This)->lpVtbl -> GetDataSpace(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkAncillaryPacket_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkAncillaryPacketIterator_INTERFACE_DEFINED__ -#define __IDeckLinkAncillaryPacketIterator_INTERFACE_DEFINED__ - -/* interface IDeckLinkAncillaryPacketIterator */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkAncillaryPacketIterator; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("10F1AA88-54BE-42F7-B9F8-EC2F5F099551") - IDeckLinkAncillaryPacketIterator : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Next( - /* [out] */ IDeckLinkAncillaryPacket **packet) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkAncillaryPacketIteratorVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkAncillaryPacketIterator * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkAncillaryPacketIterator * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkAncillaryPacketIterator * This); - - DECLSPEC_XFGVIRT(IDeckLinkAncillaryPacketIterator, Next) - HRESULT ( STDMETHODCALLTYPE *Next )( - IDeckLinkAncillaryPacketIterator * This, - /* [out] */ IDeckLinkAncillaryPacket **packet); - - END_INTERFACE - } IDeckLinkAncillaryPacketIteratorVtbl; - - interface IDeckLinkAncillaryPacketIterator - { - CONST_VTBL struct IDeckLinkAncillaryPacketIteratorVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkAncillaryPacketIterator_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkAncillaryPacketIterator_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkAncillaryPacketIterator_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkAncillaryPacketIterator_Next(This,packet) \ - ( (This)->lpVtbl -> Next(This,packet) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkAncillaryPacketIterator_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkVideoFrameAncillaryPackets_INTERFACE_DEFINED__ -#define __IDeckLinkVideoFrameAncillaryPackets_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoFrameAncillaryPackets */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoFrameAncillaryPackets; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("8A72D630-8070-4D05-8A93-E60C40EE088A") - IDeckLinkVideoFrameAncillaryPackets : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetPacketIterator( - /* [out] */ IDeckLinkAncillaryPacketIterator **iterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFirstPacketByID( - /* [in] */ unsigned char DID, - /* [in] */ unsigned char SDID, - /* [out] */ IDeckLinkAncillaryPacket **packet) = 0; - - virtual HRESULT STDMETHODCALLTYPE AttachPacket( - /* [in] */ IDeckLinkAncillaryPacket *packet) = 0; - - virtual HRESULT STDMETHODCALLTYPE DetachPacket( - /* [in] */ IDeckLinkAncillaryPacket *packet) = 0; - - virtual HRESULT STDMETHODCALLTYPE DetachAllPackets( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkVideoFrameAncillaryPacketsVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoFrameAncillaryPackets * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoFrameAncillaryPackets * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoFrameAncillaryPackets * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameAncillaryPackets, GetPacketIterator) - HRESULT ( STDMETHODCALLTYPE *GetPacketIterator )( - IDeckLinkVideoFrameAncillaryPackets * This, - /* [out] */ IDeckLinkAncillaryPacketIterator **iterator); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameAncillaryPackets, GetFirstPacketByID) - HRESULT ( STDMETHODCALLTYPE *GetFirstPacketByID )( - IDeckLinkVideoFrameAncillaryPackets * This, - /* [in] */ unsigned char DID, - /* [in] */ unsigned char SDID, - /* [out] */ IDeckLinkAncillaryPacket **packet); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameAncillaryPackets, AttachPacket) - HRESULT ( STDMETHODCALLTYPE *AttachPacket )( - IDeckLinkVideoFrameAncillaryPackets * This, - /* [in] */ IDeckLinkAncillaryPacket *packet); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameAncillaryPackets, DetachPacket) - HRESULT ( STDMETHODCALLTYPE *DetachPacket )( - IDeckLinkVideoFrameAncillaryPackets * This, - /* [in] */ IDeckLinkAncillaryPacket *packet); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameAncillaryPackets, DetachAllPackets) - HRESULT ( STDMETHODCALLTYPE *DetachAllPackets )( - IDeckLinkVideoFrameAncillaryPackets * This); - - END_INTERFACE - } IDeckLinkVideoFrameAncillaryPacketsVtbl; - - interface IDeckLinkVideoFrameAncillaryPackets - { - CONST_VTBL struct IDeckLinkVideoFrameAncillaryPacketsVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoFrameAncillaryPackets_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoFrameAncillaryPackets_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoFrameAncillaryPackets_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoFrameAncillaryPackets_GetPacketIterator(This,iterator) \ - ( (This)->lpVtbl -> GetPacketIterator(This,iterator) ) - -#define IDeckLinkVideoFrameAncillaryPackets_GetFirstPacketByID(This,DID,SDID,packet) \ - ( (This)->lpVtbl -> GetFirstPacketByID(This,DID,SDID,packet) ) - -#define IDeckLinkVideoFrameAncillaryPackets_AttachPacket(This,packet) \ - ( (This)->lpVtbl -> AttachPacket(This,packet) ) - -#define IDeckLinkVideoFrameAncillaryPackets_DetachPacket(This,packet) \ - ( (This)->lpVtbl -> DetachPacket(This,packet) ) - -#define IDeckLinkVideoFrameAncillaryPackets_DetachAllPackets(This) \ - ( (This)->lpVtbl -> DetachAllPackets(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoFrameAncillaryPackets_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( - /* [in] */ unsigned int 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 - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoFrameAncillary * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoFrameAncillary * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoFrameAncillary * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameAncillary, GetBufferForVerticalBlankingLine) - HRESULT ( STDMETHODCALLTYPE *GetBufferForVerticalBlankingLine )( - IDeckLinkVideoFrameAncillary * This, - /* [in] */ unsigned int lineNumber, - /* [out] */ void **buffer); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameAncillary, GetPixelFormat) - BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( - IDeckLinkVideoFrameAncillary * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameAncillary, GetDisplayMode) - 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 __IDeckLinkEncoderPacket_INTERFACE_DEFINED__ -#define __IDeckLinkEncoderPacket_INTERFACE_DEFINED__ - -/* interface IDeckLinkEncoderPacket */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkEncoderPacket; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("B693F36C-316E-4AF1-B6C2-F389A4BCA620") - IDeckLinkEncoderPacket : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetBytes( - /* [out] */ void **buffer) = 0; - - virtual long STDMETHODCALLTYPE GetSize( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetStreamTime( - /* [out] */ BMDTimeValue *frameTime, - /* [in] */ BMDTimeScale timeScale) = 0; - - virtual BMDPacketType STDMETHODCALLTYPE GetPacketType( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkEncoderPacketVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkEncoderPacket * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkEncoderPacket * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkEncoderPacket * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderPacket, GetBytes) - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IDeckLinkEncoderPacket * This, - /* [out] */ void **buffer); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderPacket, GetSize) - long ( STDMETHODCALLTYPE *GetSize )( - IDeckLinkEncoderPacket * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderPacket, GetStreamTime) - HRESULT ( STDMETHODCALLTYPE *GetStreamTime )( - IDeckLinkEncoderPacket * This, - /* [out] */ BMDTimeValue *frameTime, - /* [in] */ BMDTimeScale timeScale); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderPacket, GetPacketType) - BMDPacketType ( STDMETHODCALLTYPE *GetPacketType )( - IDeckLinkEncoderPacket * This); - - END_INTERFACE - } IDeckLinkEncoderPacketVtbl; - - interface IDeckLinkEncoderPacket - { - CONST_VTBL struct IDeckLinkEncoderPacketVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkEncoderPacket_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkEncoderPacket_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkEncoderPacket_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkEncoderPacket_GetBytes(This,buffer) \ - ( (This)->lpVtbl -> GetBytes(This,buffer) ) - -#define IDeckLinkEncoderPacket_GetSize(This) \ - ( (This)->lpVtbl -> GetSize(This) ) - -#define IDeckLinkEncoderPacket_GetStreamTime(This,frameTime,timeScale) \ - ( (This)->lpVtbl -> GetStreamTime(This,frameTime,timeScale) ) - -#define IDeckLinkEncoderPacket_GetPacketType(This) \ - ( (This)->lpVtbl -> GetPacketType(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkEncoderPacket_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkEncoderVideoPacket_INTERFACE_DEFINED__ -#define __IDeckLinkEncoderVideoPacket_INTERFACE_DEFINED__ - -/* interface IDeckLinkEncoderVideoPacket */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkEncoderVideoPacket; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("4E7FD944-E8C7-4EAC-B8C0-7B77F80F5AE0") - IDeckLinkEncoderVideoPacket : public IDeckLinkEncoderPacket - { - public: - virtual BMDPixelFormat STDMETHODCALLTYPE GetPixelFormat( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceTimestamp( - /* [in] */ BMDTimeScale timeScale, - /* [out] */ BMDTimeValue *frameTime, - /* [out] */ BMDTimeValue *frameDuration) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetTimecode( - /* [in] */ BMDTimecodeFormat format, - /* [out] */ IDeckLinkTimecode **timecode) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkEncoderVideoPacketVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkEncoderVideoPacket * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkEncoderVideoPacket * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkEncoderVideoPacket * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderPacket, GetBytes) - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IDeckLinkEncoderVideoPacket * This, - /* [out] */ void **buffer); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderPacket, GetSize) - long ( STDMETHODCALLTYPE *GetSize )( - IDeckLinkEncoderVideoPacket * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderPacket, GetStreamTime) - HRESULT ( STDMETHODCALLTYPE *GetStreamTime )( - IDeckLinkEncoderVideoPacket * This, - /* [out] */ BMDTimeValue *frameTime, - /* [in] */ BMDTimeScale timeScale); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderPacket, GetPacketType) - BMDPacketType ( STDMETHODCALLTYPE *GetPacketType )( - IDeckLinkEncoderVideoPacket * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderVideoPacket, GetPixelFormat) - BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( - IDeckLinkEncoderVideoPacket * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderVideoPacket, GetHardwareReferenceTimestamp) - HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceTimestamp )( - IDeckLinkEncoderVideoPacket * This, - /* [in] */ BMDTimeScale timeScale, - /* [out] */ BMDTimeValue *frameTime, - /* [out] */ BMDTimeValue *frameDuration); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderVideoPacket, GetTimecode) - HRESULT ( STDMETHODCALLTYPE *GetTimecode )( - IDeckLinkEncoderVideoPacket * This, - /* [in] */ BMDTimecodeFormat format, - /* [out] */ IDeckLinkTimecode **timecode); - - END_INTERFACE - } IDeckLinkEncoderVideoPacketVtbl; - - interface IDeckLinkEncoderVideoPacket - { - CONST_VTBL struct IDeckLinkEncoderVideoPacketVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkEncoderVideoPacket_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkEncoderVideoPacket_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkEncoderVideoPacket_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkEncoderVideoPacket_GetBytes(This,buffer) \ - ( (This)->lpVtbl -> GetBytes(This,buffer) ) - -#define IDeckLinkEncoderVideoPacket_GetSize(This) \ - ( (This)->lpVtbl -> GetSize(This) ) - -#define IDeckLinkEncoderVideoPacket_GetStreamTime(This,frameTime,timeScale) \ - ( (This)->lpVtbl -> GetStreamTime(This,frameTime,timeScale) ) - -#define IDeckLinkEncoderVideoPacket_GetPacketType(This) \ - ( (This)->lpVtbl -> GetPacketType(This) ) - - -#define IDeckLinkEncoderVideoPacket_GetPixelFormat(This) \ - ( (This)->lpVtbl -> GetPixelFormat(This) ) - -#define IDeckLinkEncoderVideoPacket_GetHardwareReferenceTimestamp(This,timeScale,frameTime,frameDuration) \ - ( (This)->lpVtbl -> GetHardwareReferenceTimestamp(This,timeScale,frameTime,frameDuration) ) - -#define IDeckLinkEncoderVideoPacket_GetTimecode(This,format,timecode) \ - ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkEncoderVideoPacket_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkEncoderAudioPacket_INTERFACE_DEFINED__ -#define __IDeckLinkEncoderAudioPacket_INTERFACE_DEFINED__ - -/* interface IDeckLinkEncoderAudioPacket */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkEncoderAudioPacket; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("49E8EDC8-693B-4E14-8EF6-12C658F5A07A") - IDeckLinkEncoderAudioPacket : public IDeckLinkEncoderPacket - { - public: - virtual BMDAudioFormat STDMETHODCALLTYPE GetAudioFormat( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkEncoderAudioPacketVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkEncoderAudioPacket * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkEncoderAudioPacket * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkEncoderAudioPacket * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderPacket, GetBytes) - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IDeckLinkEncoderAudioPacket * This, - /* [out] */ void **buffer); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderPacket, GetSize) - long ( STDMETHODCALLTYPE *GetSize )( - IDeckLinkEncoderAudioPacket * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderPacket, GetStreamTime) - HRESULT ( STDMETHODCALLTYPE *GetStreamTime )( - IDeckLinkEncoderAudioPacket * This, - /* [out] */ BMDTimeValue *frameTime, - /* [in] */ BMDTimeScale timeScale); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderPacket, GetPacketType) - BMDPacketType ( STDMETHODCALLTYPE *GetPacketType )( - IDeckLinkEncoderAudioPacket * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderAudioPacket, GetAudioFormat) - BMDAudioFormat ( STDMETHODCALLTYPE *GetAudioFormat )( - IDeckLinkEncoderAudioPacket * This); - - END_INTERFACE - } IDeckLinkEncoderAudioPacketVtbl; - - interface IDeckLinkEncoderAudioPacket - { - CONST_VTBL struct IDeckLinkEncoderAudioPacketVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkEncoderAudioPacket_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkEncoderAudioPacket_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkEncoderAudioPacket_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkEncoderAudioPacket_GetBytes(This,buffer) \ - ( (This)->lpVtbl -> GetBytes(This,buffer) ) - -#define IDeckLinkEncoderAudioPacket_GetSize(This) \ - ( (This)->lpVtbl -> GetSize(This) ) - -#define IDeckLinkEncoderAudioPacket_GetStreamTime(This,frameTime,timeScale) \ - ( (This)->lpVtbl -> GetStreamTime(This,frameTime,timeScale) ) - -#define IDeckLinkEncoderAudioPacket_GetPacketType(This) \ - ( (This)->lpVtbl -> GetPacketType(This) ) - - -#define IDeckLinkEncoderAudioPacket_GetAudioFormat(This) \ - ( (This)->lpVtbl -> GetAudioFormat(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkEncoderAudioPacket_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkH265NALPacket_INTERFACE_DEFINED__ -#define __IDeckLinkH265NALPacket_INTERFACE_DEFINED__ - -/* interface IDeckLinkH265NALPacket */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkH265NALPacket; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("639C8E0B-68D5-4BDE-A6D4-95F3AEAFF2E7") - IDeckLinkH265NALPacket : public IDeckLinkEncoderVideoPacket - { - public: - virtual HRESULT STDMETHODCALLTYPE GetUnitType( - /* [out] */ unsigned char *unitType) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBytesNoPrefix( - /* [out] */ void **buffer) = 0; - - virtual long STDMETHODCALLTYPE GetSizeNoPrefix( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkH265NALPacketVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkH265NALPacket * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkH265NALPacket * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkH265NALPacket * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderPacket, GetBytes) - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IDeckLinkH265NALPacket * This, - /* [out] */ void **buffer); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderPacket, GetSize) - long ( STDMETHODCALLTYPE *GetSize )( - IDeckLinkH265NALPacket * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderPacket, GetStreamTime) - HRESULT ( STDMETHODCALLTYPE *GetStreamTime )( - IDeckLinkH265NALPacket * This, - /* [out] */ BMDTimeValue *frameTime, - /* [in] */ BMDTimeScale timeScale); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderPacket, GetPacketType) - BMDPacketType ( STDMETHODCALLTYPE *GetPacketType )( - IDeckLinkH265NALPacket * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderVideoPacket, GetPixelFormat) - BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( - IDeckLinkH265NALPacket * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderVideoPacket, GetHardwareReferenceTimestamp) - HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceTimestamp )( - IDeckLinkH265NALPacket * This, - /* [in] */ BMDTimeScale timeScale, - /* [out] */ BMDTimeValue *frameTime, - /* [out] */ BMDTimeValue *frameDuration); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderVideoPacket, GetTimecode) - HRESULT ( STDMETHODCALLTYPE *GetTimecode )( - IDeckLinkH265NALPacket * This, - /* [in] */ BMDTimecodeFormat format, - /* [out] */ IDeckLinkTimecode **timecode); - - DECLSPEC_XFGVIRT(IDeckLinkH265NALPacket, GetUnitType) - HRESULT ( STDMETHODCALLTYPE *GetUnitType )( - IDeckLinkH265NALPacket * This, - /* [out] */ unsigned char *unitType); - - DECLSPEC_XFGVIRT(IDeckLinkH265NALPacket, GetBytesNoPrefix) - HRESULT ( STDMETHODCALLTYPE *GetBytesNoPrefix )( - IDeckLinkH265NALPacket * This, - /* [out] */ void **buffer); - - DECLSPEC_XFGVIRT(IDeckLinkH265NALPacket, GetSizeNoPrefix) - long ( STDMETHODCALLTYPE *GetSizeNoPrefix )( - IDeckLinkH265NALPacket * This); - - END_INTERFACE - } IDeckLinkH265NALPacketVtbl; - - interface IDeckLinkH265NALPacket - { - CONST_VTBL struct IDeckLinkH265NALPacketVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkH265NALPacket_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkH265NALPacket_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkH265NALPacket_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkH265NALPacket_GetBytes(This,buffer) \ - ( (This)->lpVtbl -> GetBytes(This,buffer) ) - -#define IDeckLinkH265NALPacket_GetSize(This) \ - ( (This)->lpVtbl -> GetSize(This) ) - -#define IDeckLinkH265NALPacket_GetStreamTime(This,frameTime,timeScale) \ - ( (This)->lpVtbl -> GetStreamTime(This,frameTime,timeScale) ) - -#define IDeckLinkH265NALPacket_GetPacketType(This) \ - ( (This)->lpVtbl -> GetPacketType(This) ) - - -#define IDeckLinkH265NALPacket_GetPixelFormat(This) \ - ( (This)->lpVtbl -> GetPixelFormat(This) ) - -#define IDeckLinkH265NALPacket_GetHardwareReferenceTimestamp(This,timeScale,frameTime,frameDuration) \ - ( (This)->lpVtbl -> GetHardwareReferenceTimestamp(This,timeScale,frameTime,frameDuration) ) - -#define IDeckLinkH265NALPacket_GetTimecode(This,format,timecode) \ - ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) - - -#define IDeckLinkH265NALPacket_GetUnitType(This,unitType) \ - ( (This)->lpVtbl -> GetUnitType(This,unitType) ) - -#define IDeckLinkH265NALPacket_GetBytesNoPrefix(This,buffer) \ - ( (This)->lpVtbl -> GetBytesNoPrefix(This,buffer) ) - -#define IDeckLinkH265NALPacket_GetSizeNoPrefix(This) \ - ( (This)->lpVtbl -> GetSizeNoPrefix(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkH265NALPacket_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, - /* [in] */ BMDTimeScale timeScale) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkAudioInputPacketVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkAudioInputPacket * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkAudioInputPacket * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkAudioInputPacket * This); - - DECLSPEC_XFGVIRT(IDeckLinkAudioInputPacket, GetSampleFrameCount) - long ( STDMETHODCALLTYPE *GetSampleFrameCount )( - IDeckLinkAudioInputPacket * This); - - DECLSPEC_XFGVIRT(IDeckLinkAudioInputPacket, GetBytes) - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IDeckLinkAudioInputPacket * This, - /* [out] */ void **buffer); - - DECLSPEC_XFGVIRT(IDeckLinkAudioInputPacket, GetPacketTime) - HRESULT ( STDMETHODCALLTYPE *GetPacketTime )( - IDeckLinkAudioInputPacket * This, - /* [out] */ BMDTimeValue *packetTime, - /* [in] */ 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("D4FA2345-9FBA-4497-95C3-C0C3CED3CDA8") - IDeckLinkScreenPreviewCallback : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DrawFrame( - /* [in] */ IDeckLinkVideoFrame *theFrame) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkScreenPreviewCallbackVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkScreenPreviewCallback * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkScreenPreviewCallback * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkScreenPreviewCallback * This); - - DECLSPEC_XFGVIRT(IDeckLinkScreenPreviewCallback, DrawFrame) - 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("CEB778E2-C202-4EC8-9085-0CD285CC5522") - IDeckLinkGLScreenPreviewHelper : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE InitializeGL( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE PaintGL( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFrame( - /* [in] */ IDeckLinkVideoFrame *theFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE Set3DPreviewFormat( - /* [in] */ BMD3DPreviewFormat previewFormat) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkGLScreenPreviewHelperVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkGLScreenPreviewHelper * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkGLScreenPreviewHelper * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkGLScreenPreviewHelper * This); - - DECLSPEC_XFGVIRT(IDeckLinkGLScreenPreviewHelper, InitializeGL) - HRESULT ( STDMETHODCALLTYPE *InitializeGL )( - IDeckLinkGLScreenPreviewHelper * This); - - DECLSPEC_XFGVIRT(IDeckLinkGLScreenPreviewHelper, PaintGL) - HRESULT ( STDMETHODCALLTYPE *PaintGL )( - IDeckLinkGLScreenPreviewHelper * This); - - DECLSPEC_XFGVIRT(IDeckLinkGLScreenPreviewHelper, SetFrame) - HRESULT ( STDMETHODCALLTYPE *SetFrame )( - IDeckLinkGLScreenPreviewHelper * This, - /* [in] */ IDeckLinkVideoFrame *theFrame); - - DECLSPEC_XFGVIRT(IDeckLinkGLScreenPreviewHelper, Set3DPreviewFormat) - HRESULT ( STDMETHODCALLTYPE *Set3DPreviewFormat )( - IDeckLinkGLScreenPreviewHelper * This, - /* [in] */ BMD3DPreviewFormat previewFormat); - - 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) ) - -#define IDeckLinkGLScreenPreviewHelper_Set3DPreviewFormat(This,previewFormat) \ - ( (This)->lpVtbl -> Set3DPreviewFormat(This,previewFormat) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkGLScreenPreviewHelper_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkDX9ScreenPreviewHelper_INTERFACE_DEFINED__ -#define __IDeckLinkDX9ScreenPreviewHelper_INTERFACE_DEFINED__ - -/* interface IDeckLinkDX9ScreenPreviewHelper */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkDX9ScreenPreviewHelper; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("F2DD78CA-2921-4AC2-B5BC-BFDCC2035A1F") - IDeckLinkDX9ScreenPreviewHelper : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Initialize( - /* [in] */ void *device) = 0; - - virtual HRESULT STDMETHODCALLTYPE Render( - /* [in] */ RECT *rc) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFrame( - /* [in] */ IDeckLinkVideoFrame *theFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE Set3DPreviewFormat( - /* [in] */ BMD3DPreviewFormat previewFormat) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkDX9ScreenPreviewHelperVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkDX9ScreenPreviewHelper * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkDX9ScreenPreviewHelper * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkDX9ScreenPreviewHelper * This); - - DECLSPEC_XFGVIRT(IDeckLinkDX9ScreenPreviewHelper, Initialize) - HRESULT ( STDMETHODCALLTYPE *Initialize )( - IDeckLinkDX9ScreenPreviewHelper * This, - /* [in] */ void *device); - - DECLSPEC_XFGVIRT(IDeckLinkDX9ScreenPreviewHelper, Render) - HRESULT ( STDMETHODCALLTYPE *Render )( - IDeckLinkDX9ScreenPreviewHelper * This, - /* [in] */ RECT *rc); - - DECLSPEC_XFGVIRT(IDeckLinkDX9ScreenPreviewHelper, SetFrame) - HRESULT ( STDMETHODCALLTYPE *SetFrame )( - IDeckLinkDX9ScreenPreviewHelper * This, - /* [in] */ IDeckLinkVideoFrame *theFrame); - - DECLSPEC_XFGVIRT(IDeckLinkDX9ScreenPreviewHelper, Set3DPreviewFormat) - HRESULT ( STDMETHODCALLTYPE *Set3DPreviewFormat )( - IDeckLinkDX9ScreenPreviewHelper * This, - /* [in] */ BMD3DPreviewFormat previewFormat); - - END_INTERFACE - } IDeckLinkDX9ScreenPreviewHelperVtbl; - - interface IDeckLinkDX9ScreenPreviewHelper - { - CONST_VTBL struct IDeckLinkDX9ScreenPreviewHelperVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkDX9ScreenPreviewHelper_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkDX9ScreenPreviewHelper_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkDX9ScreenPreviewHelper_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkDX9ScreenPreviewHelper_Initialize(This,device) \ - ( (This)->lpVtbl -> Initialize(This,device) ) - -#define IDeckLinkDX9ScreenPreviewHelper_Render(This,rc) \ - ( (This)->lpVtbl -> Render(This,rc) ) - -#define IDeckLinkDX9ScreenPreviewHelper_SetFrame(This,theFrame) \ - ( (This)->lpVtbl -> SetFrame(This,theFrame) ) - -#define IDeckLinkDX9ScreenPreviewHelper_Set3DPreviewFormat(This,previewFormat) \ - ( (This)->lpVtbl -> Set3DPreviewFormat(This,previewFormat) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkDX9ScreenPreviewHelper_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkWPFDX9ScreenPreviewHelper_INTERFACE_DEFINED__ -#define __IDeckLinkWPFDX9ScreenPreviewHelper_INTERFACE_DEFINED__ - -/* interface IDeckLinkWPFDX9ScreenPreviewHelper */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkWPFDX9ScreenPreviewHelper; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("C59346CD-9326-4266-AC2D-5C190F5799EE") - IDeckLinkWPFDX9ScreenPreviewHelper : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Initialize( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE Render( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetSurfaceSize( - /* [in] */ unsigned int width, - /* [in] */ unsigned int height) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFrame( - /* [in] */ IDeckLinkVideoFrame *theFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE Set3DPreviewFormat( - /* [in] */ BMD3DPreviewFormat previewFormat) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBackBuffer( - /* [out] */ void **backBuffer) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkWPFDX9ScreenPreviewHelperVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkWPFDX9ScreenPreviewHelper * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkWPFDX9ScreenPreviewHelper * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkWPFDX9ScreenPreviewHelper * This); - - DECLSPEC_XFGVIRT(IDeckLinkWPFDX9ScreenPreviewHelper, Initialize) - HRESULT ( STDMETHODCALLTYPE *Initialize )( - IDeckLinkWPFDX9ScreenPreviewHelper * This); - - DECLSPEC_XFGVIRT(IDeckLinkWPFDX9ScreenPreviewHelper, Render) - HRESULT ( STDMETHODCALLTYPE *Render )( - IDeckLinkWPFDX9ScreenPreviewHelper * This); - - DECLSPEC_XFGVIRT(IDeckLinkWPFDX9ScreenPreviewHelper, SetSurfaceSize) - HRESULT ( STDMETHODCALLTYPE *SetSurfaceSize )( - IDeckLinkWPFDX9ScreenPreviewHelper * This, - /* [in] */ unsigned int width, - /* [in] */ unsigned int height); - - DECLSPEC_XFGVIRT(IDeckLinkWPFDX9ScreenPreviewHelper, SetFrame) - HRESULT ( STDMETHODCALLTYPE *SetFrame )( - IDeckLinkWPFDX9ScreenPreviewHelper * This, - /* [in] */ IDeckLinkVideoFrame *theFrame); - - DECLSPEC_XFGVIRT(IDeckLinkWPFDX9ScreenPreviewHelper, Set3DPreviewFormat) - HRESULT ( STDMETHODCALLTYPE *Set3DPreviewFormat )( - IDeckLinkWPFDX9ScreenPreviewHelper * This, - /* [in] */ BMD3DPreviewFormat previewFormat); - - DECLSPEC_XFGVIRT(IDeckLinkWPFDX9ScreenPreviewHelper, GetBackBuffer) - HRESULT ( STDMETHODCALLTYPE *GetBackBuffer )( - IDeckLinkWPFDX9ScreenPreviewHelper * This, - /* [out] */ void **backBuffer); - - END_INTERFACE - } IDeckLinkWPFDX9ScreenPreviewHelperVtbl; - - interface IDeckLinkWPFDX9ScreenPreviewHelper - { - CONST_VTBL struct IDeckLinkWPFDX9ScreenPreviewHelperVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkWPFDX9ScreenPreviewHelper_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkWPFDX9ScreenPreviewHelper_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkWPFDX9ScreenPreviewHelper_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkWPFDX9ScreenPreviewHelper_Initialize(This) \ - ( (This)->lpVtbl -> Initialize(This) ) - -#define IDeckLinkWPFDX9ScreenPreviewHelper_Render(This) \ - ( (This)->lpVtbl -> Render(This) ) - -#define IDeckLinkWPFDX9ScreenPreviewHelper_SetSurfaceSize(This,width,height) \ - ( (This)->lpVtbl -> SetSurfaceSize(This,width,height) ) - -#define IDeckLinkWPFDX9ScreenPreviewHelper_SetFrame(This,theFrame) \ - ( (This)->lpVtbl -> SetFrame(This,theFrame) ) - -#define IDeckLinkWPFDX9ScreenPreviewHelper_Set3DPreviewFormat(This,previewFormat) \ - ( (This)->lpVtbl -> Set3DPreviewFormat(This,previewFormat) ) - -#define IDeckLinkWPFDX9ScreenPreviewHelper_GetBackBuffer(This,backBuffer) \ - ( (This)->lpVtbl -> GetBackBuffer(This,backBuffer) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkWPFDX9ScreenPreviewHelper_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkNotificationCallback_INTERFACE_DEFINED__ -#define __IDeckLinkNotificationCallback_INTERFACE_DEFINED__ - -/* interface IDeckLinkNotificationCallback */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkNotificationCallback; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("b002a1ec-070d-4288-8289-bd5d36e5ff0d") - IDeckLinkNotificationCallback : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Notify( - /* [in] */ BMDNotifications topic, - /* [in] */ ULONGLONG param1, - /* [in] */ ULONGLONG param2) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkNotificationCallbackVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkNotificationCallback * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkNotificationCallback * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkNotificationCallback * This); - - DECLSPEC_XFGVIRT(IDeckLinkNotificationCallback, Notify) - HRESULT ( STDMETHODCALLTYPE *Notify )( - IDeckLinkNotificationCallback * This, - /* [in] */ BMDNotifications topic, - /* [in] */ ULONGLONG param1, - /* [in] */ ULONGLONG param2); - - END_INTERFACE - } IDeckLinkNotificationCallbackVtbl; - - interface IDeckLinkNotificationCallback - { - CONST_VTBL struct IDeckLinkNotificationCallbackVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkNotificationCallback_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkNotificationCallback_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkNotificationCallback_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkNotificationCallback_Notify(This,topic,param1,param2) \ - ( (This)->lpVtbl -> Notify(This,topic,param1,param2) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkNotificationCallback_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkNotification_INTERFACE_DEFINED__ -#define __IDeckLinkNotification_INTERFACE_DEFINED__ - -/* interface IDeckLinkNotification */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkNotification; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("1d70faac-fd27-4866-9de6-0939d1e4c7f1") - IDeckLinkNotification : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Subscribe( - /* [in] */ BMDNotifications topic, - /* [in] */ IDeckLinkNotificationCallback *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE Unsubscribe( - /* [in] */ BMDNotifications topic, - /* [in] */ IDeckLinkNotificationCallback *theCallback) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkNotificationVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkNotification * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkNotification * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkNotification * This); - - DECLSPEC_XFGVIRT(IDeckLinkNotification, Subscribe) - HRESULT ( STDMETHODCALLTYPE *Subscribe )( - IDeckLinkNotification * This, - /* [in] */ BMDNotifications topic, - /* [in] */ IDeckLinkNotificationCallback *theCallback); - - DECLSPEC_XFGVIRT(IDeckLinkNotification, Unsubscribe) - HRESULT ( STDMETHODCALLTYPE *Unsubscribe )( - IDeckLinkNotification * This, - /* [in] */ BMDNotifications topic, - /* [in] */ IDeckLinkNotificationCallback *theCallback); - - END_INTERFACE - } IDeckLinkNotificationVtbl; - - interface IDeckLinkNotification - { - CONST_VTBL struct IDeckLinkNotificationVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkNotification_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkNotification_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkNotification_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkNotification_Subscribe(This,topic,theCallback) \ - ( (This)->lpVtbl -> Subscribe(This,topic,theCallback) ) - -#define IDeckLinkNotification_Unsubscribe(This,topic,theCallback) \ - ( (This)->lpVtbl -> Unsubscribe(This,topic,theCallback) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkNotification_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkProfileAttributes_INTERFACE_DEFINED__ -#define __IDeckLinkProfileAttributes_INTERFACE_DEFINED__ - -/* interface IDeckLinkProfileAttributes */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkProfileAttributes; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("F47551D7-AD22-47AF-BCFD-6BE88AA879D9") - IDeckLinkProfileAttributes : 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; - - virtual HRESULT STDMETHODCALLTYPE GetStringWithParam( - /* [in] */ BMDDeckLinkAttributeID cfgID, - /* [in] */ ULONGLONG param, - /* [out] */ BSTR *value) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkProfileAttributesVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkProfileAttributes * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkProfileAttributes * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkProfileAttributes * This); - - DECLSPEC_XFGVIRT(IDeckLinkProfileAttributes, GetFlag) - HRESULT ( STDMETHODCALLTYPE *GetFlag )( - IDeckLinkProfileAttributes * This, - /* [in] */ BMDDeckLinkAttributeID cfgID, - /* [out] */ BOOL *value); - - DECLSPEC_XFGVIRT(IDeckLinkProfileAttributes, GetInt) - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IDeckLinkProfileAttributes * This, - /* [in] */ BMDDeckLinkAttributeID cfgID, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IDeckLinkProfileAttributes, GetFloat) - HRESULT ( STDMETHODCALLTYPE *GetFloat )( - IDeckLinkProfileAttributes * This, - /* [in] */ BMDDeckLinkAttributeID cfgID, - /* [out] */ double *value); - - DECLSPEC_XFGVIRT(IDeckLinkProfileAttributes, GetString) - HRESULT ( STDMETHODCALLTYPE *GetString )( - IDeckLinkProfileAttributes * This, - /* [in] */ BMDDeckLinkAttributeID cfgID, - /* [out] */ BSTR *value); - - DECLSPEC_XFGVIRT(IDeckLinkProfileAttributes, GetStringWithParam) - HRESULT ( STDMETHODCALLTYPE *GetStringWithParam )( - IDeckLinkProfileAttributes * This, - /* [in] */ BMDDeckLinkAttributeID cfgID, - /* [in] */ ULONGLONG param, - /* [out] */ BSTR *value); - - END_INTERFACE - } IDeckLinkProfileAttributesVtbl; - - interface IDeckLinkProfileAttributes - { - CONST_VTBL struct IDeckLinkProfileAttributesVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkProfileAttributes_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkProfileAttributes_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkProfileAttributes_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkProfileAttributes_GetFlag(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) - -#define IDeckLinkProfileAttributes_GetInt(This,cfgID,value) \ - ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) - -#define IDeckLinkProfileAttributes_GetFloat(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) - -#define IDeckLinkProfileAttributes_GetString(This,cfgID,value) \ - ( (This)->lpVtbl -> GetString(This,cfgID,value) ) - -#define IDeckLinkProfileAttributes_GetStringWithParam(This,cfgID,param,value) \ - ( (This)->lpVtbl -> GetStringWithParam(This,cfgID,param,value) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkProfileAttributes_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkProfileIterator_INTERFACE_DEFINED__ -#define __IDeckLinkProfileIterator_INTERFACE_DEFINED__ - -/* interface IDeckLinkProfileIterator */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkProfileIterator; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("29E5A8C0-8BE4-46EB-93AC-31DAAB5B7BF2") - IDeckLinkProfileIterator : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Next( - /* [out] */ IDeckLinkProfile **profile) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkProfileIteratorVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkProfileIterator * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkProfileIterator * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkProfileIterator * This); - - DECLSPEC_XFGVIRT(IDeckLinkProfileIterator, Next) - HRESULT ( STDMETHODCALLTYPE *Next )( - IDeckLinkProfileIterator * This, - /* [out] */ IDeckLinkProfile **profile); - - END_INTERFACE - } IDeckLinkProfileIteratorVtbl; - - interface IDeckLinkProfileIterator - { - CONST_VTBL struct IDeckLinkProfileIteratorVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkProfileIterator_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkProfileIterator_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkProfileIterator_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkProfileIterator_Next(This,profile) \ - ( (This)->lpVtbl -> Next(This,profile) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkProfileIterator_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkProfile_INTERFACE_DEFINED__ -#define __IDeckLinkProfile_INTERFACE_DEFINED__ - -/* interface IDeckLinkProfile */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkProfile; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("16093466-674A-432B-9DA0-1AC2C5A8241C") - IDeckLinkProfile : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetDevice( - /* [out] */ IDeckLink **device) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsActive( - /* [out] */ BOOL *isActive) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetActive( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPeers( - /* [out] */ IDeckLinkProfileIterator **profileIterator) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkProfileVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkProfile * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkProfile * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkProfile * This); - - DECLSPEC_XFGVIRT(IDeckLinkProfile, GetDevice) - HRESULT ( STDMETHODCALLTYPE *GetDevice )( - IDeckLinkProfile * This, - /* [out] */ IDeckLink **device); - - DECLSPEC_XFGVIRT(IDeckLinkProfile, IsActive) - HRESULT ( STDMETHODCALLTYPE *IsActive )( - IDeckLinkProfile * This, - /* [out] */ BOOL *isActive); - - DECLSPEC_XFGVIRT(IDeckLinkProfile, SetActive) - HRESULT ( STDMETHODCALLTYPE *SetActive )( - IDeckLinkProfile * This); - - DECLSPEC_XFGVIRT(IDeckLinkProfile, GetPeers) - HRESULT ( STDMETHODCALLTYPE *GetPeers )( - IDeckLinkProfile * This, - /* [out] */ IDeckLinkProfileIterator **profileIterator); - - END_INTERFACE - } IDeckLinkProfileVtbl; - - interface IDeckLinkProfile - { - CONST_VTBL struct IDeckLinkProfileVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkProfile_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkProfile_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkProfile_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkProfile_GetDevice(This,device) \ - ( (This)->lpVtbl -> GetDevice(This,device) ) - -#define IDeckLinkProfile_IsActive(This,isActive) \ - ( (This)->lpVtbl -> IsActive(This,isActive) ) - -#define IDeckLinkProfile_SetActive(This) \ - ( (This)->lpVtbl -> SetActive(This) ) - -#define IDeckLinkProfile_GetPeers(This,profileIterator) \ - ( (This)->lpVtbl -> GetPeers(This,profileIterator) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkProfile_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkProfileCallback_INTERFACE_DEFINED__ -#define __IDeckLinkProfileCallback_INTERFACE_DEFINED__ - -/* interface IDeckLinkProfileCallback */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkProfileCallback; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("A4F9341E-97AA-4E04-8935-15F809898CEA") - IDeckLinkProfileCallback : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE ProfileChanging( - /* [in] */ IDeckLinkProfile *profileToBeActivated, - /* [in] */ BOOL streamsWillBeForcedToStop) = 0; - - virtual HRESULT STDMETHODCALLTYPE ProfileActivated( - /* [in] */ IDeckLinkProfile *activatedProfile) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkProfileCallbackVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkProfileCallback * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkProfileCallback * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkProfileCallback * This); - - DECLSPEC_XFGVIRT(IDeckLinkProfileCallback, ProfileChanging) - HRESULT ( STDMETHODCALLTYPE *ProfileChanging )( - IDeckLinkProfileCallback * This, - /* [in] */ IDeckLinkProfile *profileToBeActivated, - /* [in] */ BOOL streamsWillBeForcedToStop); - - DECLSPEC_XFGVIRT(IDeckLinkProfileCallback, ProfileActivated) - HRESULT ( STDMETHODCALLTYPE *ProfileActivated )( - IDeckLinkProfileCallback * This, - /* [in] */ IDeckLinkProfile *activatedProfile); - - END_INTERFACE - } IDeckLinkProfileCallbackVtbl; - - interface IDeckLinkProfileCallback - { - CONST_VTBL struct IDeckLinkProfileCallbackVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkProfileCallback_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkProfileCallback_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkProfileCallback_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkProfileCallback_ProfileChanging(This,profileToBeActivated,streamsWillBeForcedToStop) \ - ( (This)->lpVtbl -> ProfileChanging(This,profileToBeActivated,streamsWillBeForcedToStop) ) - -#define IDeckLinkProfileCallback_ProfileActivated(This,activatedProfile) \ - ( (This)->lpVtbl -> ProfileActivated(This,activatedProfile) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkProfileCallback_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkProfileManager_INTERFACE_DEFINED__ -#define __IDeckLinkProfileManager_INTERFACE_DEFINED__ - -/* interface IDeckLinkProfileManager */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkProfileManager; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("30D41429-3998-4B6D-84F8-78C94A797C6E") - IDeckLinkProfileManager : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetProfiles( - /* [out] */ IDeckLinkProfileIterator **profileIterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetProfile( - /* [in] */ BMDProfileID profileID, - /* [out] */ IDeckLinkProfile **profile) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetCallback( - /* [in] */ IDeckLinkProfileCallback *callback) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkProfileManagerVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkProfileManager * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkProfileManager * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkProfileManager * This); - - DECLSPEC_XFGVIRT(IDeckLinkProfileManager, GetProfiles) - HRESULT ( STDMETHODCALLTYPE *GetProfiles )( - IDeckLinkProfileManager * This, - /* [out] */ IDeckLinkProfileIterator **profileIterator); - - DECLSPEC_XFGVIRT(IDeckLinkProfileManager, GetProfile) - HRESULT ( STDMETHODCALLTYPE *GetProfile )( - IDeckLinkProfileManager * This, - /* [in] */ BMDProfileID profileID, - /* [out] */ IDeckLinkProfile **profile); - - DECLSPEC_XFGVIRT(IDeckLinkProfileManager, SetCallback) - HRESULT ( STDMETHODCALLTYPE *SetCallback )( - IDeckLinkProfileManager * This, - /* [in] */ IDeckLinkProfileCallback *callback); - - END_INTERFACE - } IDeckLinkProfileManagerVtbl; - - interface IDeckLinkProfileManager - { - CONST_VTBL struct IDeckLinkProfileManagerVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkProfileManager_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkProfileManager_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkProfileManager_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkProfileManager_GetProfiles(This,profileIterator) \ - ( (This)->lpVtbl -> GetProfiles(This,profileIterator) ) - -#define IDeckLinkProfileManager_GetProfile(This,profileID,profile) \ - ( (This)->lpVtbl -> GetProfile(This,profileID,profile) ) - -#define IDeckLinkProfileManager_SetCallback(This,callback) \ - ( (This)->lpVtbl -> SetCallback(This,callback) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkProfileManager_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkStatistics_INTERFACE_DEFINED__ -#define __IDeckLinkStatistics_INTERFACE_DEFINED__ - -/* interface IDeckLinkStatistics */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkStatistics; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("21CB2ED1-4429-42BE-AAF3-22A3B1DD3AE0") - IDeckLinkStatistics : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetInt( - /* [in] */ BMDDeckLinkStatisticID statID, - /* [out] */ LONGLONG *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetIntWithParam( - /* [in] */ BMDDeckLinkStatisticID statID, - /* [in] */ ULONGLONG param, - /* [out] */ LONGLONG *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetStringWithParam( - /* [in] */ BMDDeckLinkStatisticID statID, - /* [in] */ ULONGLONG param, - /* [out] */ BSTR *value) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkStatisticsVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkStatistics * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkStatistics * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkStatistics * This); - - DECLSPEC_XFGVIRT(IDeckLinkStatistics, GetInt) - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IDeckLinkStatistics * This, - /* [in] */ BMDDeckLinkStatisticID statID, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IDeckLinkStatistics, GetIntWithParam) - HRESULT ( STDMETHODCALLTYPE *GetIntWithParam )( - IDeckLinkStatistics * This, - /* [in] */ BMDDeckLinkStatisticID statID, - /* [in] */ ULONGLONG param, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IDeckLinkStatistics, GetStringWithParam) - HRESULT ( STDMETHODCALLTYPE *GetStringWithParam )( - IDeckLinkStatistics * This, - /* [in] */ BMDDeckLinkStatisticID statID, - /* [in] */ ULONGLONG param, - /* [out] */ BSTR *value); - - END_INTERFACE - } IDeckLinkStatisticsVtbl; - - interface IDeckLinkStatistics - { - CONST_VTBL struct IDeckLinkStatisticsVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkStatistics_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkStatistics_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkStatistics_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkStatistics_GetInt(This,statID,value) \ - ( (This)->lpVtbl -> GetInt(This,statID,value) ) - -#define IDeckLinkStatistics_GetIntWithParam(This,statID,param,value) \ - ( (This)->lpVtbl -> GetIntWithParam(This,statID,param,value) ) - -#define IDeckLinkStatistics_GetStringWithParam(This,statID,param,value) \ - ( (This)->lpVtbl -> GetStringWithParam(This,statID,param,value) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkStatistics_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkStatus_INTERFACE_DEFINED__ -#define __IDeckLinkStatus_INTERFACE_DEFINED__ - -/* interface IDeckLinkStatus */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkStatus; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("2A04A635-ED42-41EF-9342-0E11F8CF6B5E") - IDeckLinkStatus : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetFlag( - /* [in] */ BMDDeckLinkStatusID statusID, - /* [out] */ BOOL *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetInt( - /* [in] */ BMDDeckLinkStatusID statusID, - /* [out] */ LONGLONG *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFloat( - /* [in] */ BMDDeckLinkStatusID statusID, - /* [out] */ double *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetString( - /* [in] */ BMDDeckLinkStatusID statusID, - /* [out] */ BSTR *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBytes( - /* [in] */ BMDDeckLinkStatusID statusID, - /* [out] */ void *buffer, - /* [out][in] */ unsigned int *bufferSize) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetInterface( - /* [in] */ BMDDeckLinkStatusID statusID, - /* [out] */ void **iface) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFlagWithParam( - /* [in] */ BMDDeckLinkStatusID statusID, - /* [in] */ ULONGLONG param, - /* [out] */ BOOL *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetIntWithParam( - /* [in] */ BMDDeckLinkStatusID statusID, - /* [in] */ ULONGLONG param, - /* [out] */ LONGLONG *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFloatWithParam( - /* [in] */ BMDDeckLinkStatusID statusID, - /* [in] */ ULONGLONG param, - /* [out] */ double *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetStringWithParam( - /* [in] */ BMDDeckLinkStatusID statusID, - /* [in] */ ULONGLONG param, - /* [out] */ BSTR *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBytesWithParam( - /* [in] */ BMDDeckLinkStatusID statusID, - /* [in] */ ULONGLONG param, - /* [out] */ void *buffer, - /* [out][in] */ unsigned int *bufferSize) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkStatusVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkStatus * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkStatus * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkStatus * This); - - DECLSPEC_XFGVIRT(IDeckLinkStatus, GetFlag) - HRESULT ( STDMETHODCALLTYPE *GetFlag )( - IDeckLinkStatus * This, - /* [in] */ BMDDeckLinkStatusID statusID, - /* [out] */ BOOL *value); - - DECLSPEC_XFGVIRT(IDeckLinkStatus, GetInt) - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IDeckLinkStatus * This, - /* [in] */ BMDDeckLinkStatusID statusID, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IDeckLinkStatus, GetFloat) - HRESULT ( STDMETHODCALLTYPE *GetFloat )( - IDeckLinkStatus * This, - /* [in] */ BMDDeckLinkStatusID statusID, - /* [out] */ double *value); - - DECLSPEC_XFGVIRT(IDeckLinkStatus, GetString) - HRESULT ( STDMETHODCALLTYPE *GetString )( - IDeckLinkStatus * This, - /* [in] */ BMDDeckLinkStatusID statusID, - /* [out] */ BSTR *value); - - DECLSPEC_XFGVIRT(IDeckLinkStatus, GetBytes) - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IDeckLinkStatus * This, - /* [in] */ BMDDeckLinkStatusID statusID, - /* [out] */ void *buffer, - /* [out][in] */ unsigned int *bufferSize); - - DECLSPEC_XFGVIRT(IDeckLinkStatus, GetInterface) - HRESULT ( STDMETHODCALLTYPE *GetInterface )( - IDeckLinkStatus * This, - /* [in] */ BMDDeckLinkStatusID statusID, - /* [out] */ void **iface); - - DECLSPEC_XFGVIRT(IDeckLinkStatus, GetFlagWithParam) - HRESULT ( STDMETHODCALLTYPE *GetFlagWithParam )( - IDeckLinkStatus * This, - /* [in] */ BMDDeckLinkStatusID statusID, - /* [in] */ ULONGLONG param, - /* [out] */ BOOL *value); - - DECLSPEC_XFGVIRT(IDeckLinkStatus, GetIntWithParam) - HRESULT ( STDMETHODCALLTYPE *GetIntWithParam )( - IDeckLinkStatus * This, - /* [in] */ BMDDeckLinkStatusID statusID, - /* [in] */ ULONGLONG param, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IDeckLinkStatus, GetFloatWithParam) - HRESULT ( STDMETHODCALLTYPE *GetFloatWithParam )( - IDeckLinkStatus * This, - /* [in] */ BMDDeckLinkStatusID statusID, - /* [in] */ ULONGLONG param, - /* [out] */ double *value); - - DECLSPEC_XFGVIRT(IDeckLinkStatus, GetStringWithParam) - HRESULT ( STDMETHODCALLTYPE *GetStringWithParam )( - IDeckLinkStatus * This, - /* [in] */ BMDDeckLinkStatusID statusID, - /* [in] */ ULONGLONG param, - /* [out] */ BSTR *value); - - DECLSPEC_XFGVIRT(IDeckLinkStatus, GetBytesWithParam) - HRESULT ( STDMETHODCALLTYPE *GetBytesWithParam )( - IDeckLinkStatus * This, - /* [in] */ BMDDeckLinkStatusID statusID, - /* [in] */ ULONGLONG param, - /* [out] */ void *buffer, - /* [out][in] */ unsigned int *bufferSize); - - END_INTERFACE - } IDeckLinkStatusVtbl; - - interface IDeckLinkStatus - { - CONST_VTBL struct IDeckLinkStatusVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkStatus_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkStatus_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkStatus_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkStatus_GetFlag(This,statusID,value) \ - ( (This)->lpVtbl -> GetFlag(This,statusID,value) ) - -#define IDeckLinkStatus_GetInt(This,statusID,value) \ - ( (This)->lpVtbl -> GetInt(This,statusID,value) ) - -#define IDeckLinkStatus_GetFloat(This,statusID,value) \ - ( (This)->lpVtbl -> GetFloat(This,statusID,value) ) - -#define IDeckLinkStatus_GetString(This,statusID,value) \ - ( (This)->lpVtbl -> GetString(This,statusID,value) ) - -#define IDeckLinkStatus_GetBytes(This,statusID,buffer,bufferSize) \ - ( (This)->lpVtbl -> GetBytes(This,statusID,buffer,bufferSize) ) - -#define IDeckLinkStatus_GetInterface(This,statusID,iface) \ - ( (This)->lpVtbl -> GetInterface(This,statusID,iface) ) - -#define IDeckLinkStatus_GetFlagWithParam(This,statusID,param,value) \ - ( (This)->lpVtbl -> GetFlagWithParam(This,statusID,param,value) ) - -#define IDeckLinkStatus_GetIntWithParam(This,statusID,param,value) \ - ( (This)->lpVtbl -> GetIntWithParam(This,statusID,param,value) ) - -#define IDeckLinkStatus_GetFloatWithParam(This,statusID,param,value) \ - ( (This)->lpVtbl -> GetFloatWithParam(This,statusID,param,value) ) - -#define IDeckLinkStatus_GetStringWithParam(This,statusID,param,value) \ - ( (This)->lpVtbl -> GetStringWithParam(This,statusID,param,value) ) - -#define IDeckLinkStatus_GetBytesWithParam(This,statusID,param,buffer,bufferSize) \ - ( (This)->lpVtbl -> GetBytesWithParam(This,statusID,param,buffer,bufferSize) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkStatus_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 int numberOfFrames) = 0; - - virtual HRESULT STDMETHODCALLTYPE RampDown( - /* [in] */ unsigned int numberOfFrames) = 0; - - virtual HRESULT STDMETHODCALLTYPE Disable( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkKeyerVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkKeyer * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkKeyer * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkKeyer * This); - - DECLSPEC_XFGVIRT(IDeckLinkKeyer, Enable) - HRESULT ( STDMETHODCALLTYPE *Enable )( - IDeckLinkKeyer * This, - /* [in] */ BOOL isExternal); - - DECLSPEC_XFGVIRT(IDeckLinkKeyer, SetLevel) - HRESULT ( STDMETHODCALLTYPE *SetLevel )( - IDeckLinkKeyer * This, - /* [in] */ unsigned char level); - - DECLSPEC_XFGVIRT(IDeckLinkKeyer, RampUp) - HRESULT ( STDMETHODCALLTYPE *RampUp )( - IDeckLinkKeyer * This, - /* [in] */ unsigned int numberOfFrames); - - DECLSPEC_XFGVIRT(IDeckLinkKeyer, RampDown) - HRESULT ( STDMETHODCALLTYPE *RampDown )( - IDeckLinkKeyer * This, - /* [in] */ unsigned int numberOfFrames); - - DECLSPEC_XFGVIRT(IDeckLinkKeyer, Disable) - 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__ */ - - -#ifndef __IDeckLinkVideoConversion_INTERFACE_DEFINED__ -#define __IDeckLinkVideoConversion_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoConversion */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoConversion; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("94C536D6-C821-42F5-A600-C66629955101") - IDeckLinkVideoConversion : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE ConvertFrame( - /* [in] */ IDeckLinkVideoFrame *srcFrame, - /* [in] */ IDeckLinkVideoFrame *dstFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE ConvertNewFrame( - /* [in] */ IDeckLinkVideoFrame *srcFrame, - /* [in] */ BMDPixelFormat dstPixelFormat, - /* [in] */ BMDColorspace dstColorspace, - /* [in] */ IDeckLinkVideoBuffer *dstBuffer, - /* [out] */ IDeckLinkVideoFrame **dstFrame) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkVideoConversionVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoConversion * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoConversion * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoConversion * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoConversion, ConvertFrame) - HRESULT ( STDMETHODCALLTYPE *ConvertFrame )( - IDeckLinkVideoConversion * This, - /* [in] */ IDeckLinkVideoFrame *srcFrame, - /* [in] */ IDeckLinkVideoFrame *dstFrame); - - DECLSPEC_XFGVIRT(IDeckLinkVideoConversion, ConvertNewFrame) - HRESULT ( STDMETHODCALLTYPE *ConvertNewFrame )( - IDeckLinkVideoConversion * This, - /* [in] */ IDeckLinkVideoFrame *srcFrame, - /* [in] */ BMDPixelFormat dstPixelFormat, - /* [in] */ BMDColorspace dstColorspace, - /* [in] */ IDeckLinkVideoBuffer *dstBuffer, - /* [out] */ IDeckLinkVideoFrame **dstFrame); - - END_INTERFACE - } IDeckLinkVideoConversionVtbl; - - interface IDeckLinkVideoConversion - { - CONST_VTBL struct IDeckLinkVideoConversionVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoConversion_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoConversion_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoConversion_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoConversion_ConvertFrame(This,srcFrame,dstFrame) \ - ( (This)->lpVtbl -> ConvertFrame(This,srcFrame,dstFrame) ) - -#define IDeckLinkVideoConversion_ConvertNewFrame(This,srcFrame,dstPixelFormat,dstColorspace,dstBuffer,dstFrame) \ - ( (This)->lpVtbl -> ConvertNewFrame(This,srcFrame,dstPixelFormat,dstColorspace,dstBuffer,dstFrame) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoConversion_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkDeviceNotificationCallback_INTERFACE_DEFINED__ -#define __IDeckLinkDeviceNotificationCallback_INTERFACE_DEFINED__ - -/* interface IDeckLinkDeviceNotificationCallback */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkDeviceNotificationCallback; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("4997053B-0ADF-4CC8-AC70-7A50C4BE728F") - IDeckLinkDeviceNotificationCallback : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DeckLinkDeviceArrived( - /* [in] */ IDeckLink *deckLinkDevice) = 0; - - virtual HRESULT STDMETHODCALLTYPE DeckLinkDeviceRemoved( - /* [in] */ IDeckLink *deckLinkDevice) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkDeviceNotificationCallbackVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkDeviceNotificationCallback * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkDeviceNotificationCallback * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkDeviceNotificationCallback * This); - - DECLSPEC_XFGVIRT(IDeckLinkDeviceNotificationCallback, DeckLinkDeviceArrived) - HRESULT ( STDMETHODCALLTYPE *DeckLinkDeviceArrived )( - IDeckLinkDeviceNotificationCallback * This, - /* [in] */ IDeckLink *deckLinkDevice); - - DECLSPEC_XFGVIRT(IDeckLinkDeviceNotificationCallback, DeckLinkDeviceRemoved) - HRESULT ( STDMETHODCALLTYPE *DeckLinkDeviceRemoved )( - IDeckLinkDeviceNotificationCallback * This, - /* [in] */ IDeckLink *deckLinkDevice); - - END_INTERFACE - } IDeckLinkDeviceNotificationCallbackVtbl; - - interface IDeckLinkDeviceNotificationCallback - { - CONST_VTBL struct IDeckLinkDeviceNotificationCallbackVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkDeviceNotificationCallback_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkDeviceNotificationCallback_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkDeviceNotificationCallback_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkDeviceNotificationCallback_DeckLinkDeviceArrived(This,deckLinkDevice) \ - ( (This)->lpVtbl -> DeckLinkDeviceArrived(This,deckLinkDevice) ) - -#define IDeckLinkDeviceNotificationCallback_DeckLinkDeviceRemoved(This,deckLinkDevice) \ - ( (This)->lpVtbl -> DeckLinkDeviceRemoved(This,deckLinkDevice) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkDeviceNotificationCallback_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkDiscovery_INTERFACE_DEFINED__ -#define __IDeckLinkDiscovery_INTERFACE_DEFINED__ - -/* interface IDeckLinkDiscovery */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkDiscovery; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("CDBF631C-BC76-45FA-B44D-C55059BC6101") - IDeckLinkDiscovery : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE InstallDeviceNotifications( - /* [in] */ IDeckLinkDeviceNotificationCallback *deviceNotificationCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE UninstallDeviceNotifications( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkDiscoveryVtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkDiscovery * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkDiscovery * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkDiscovery * This); - - DECLSPEC_XFGVIRT(IDeckLinkDiscovery, InstallDeviceNotifications) - HRESULT ( STDMETHODCALLTYPE *InstallDeviceNotifications )( - IDeckLinkDiscovery * This, - /* [in] */ IDeckLinkDeviceNotificationCallback *deviceNotificationCallback); - - DECLSPEC_XFGVIRT(IDeckLinkDiscovery, UninstallDeviceNotifications) - HRESULT ( STDMETHODCALLTYPE *UninstallDeviceNotifications )( - IDeckLinkDiscovery * This); - - END_INTERFACE - } IDeckLinkDiscoveryVtbl; - - interface IDeckLinkDiscovery - { - CONST_VTBL struct IDeckLinkDiscoveryVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkDiscovery_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkDiscovery_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkDiscovery_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkDiscovery_InstallDeviceNotifications(This,deviceNotificationCallback) \ - ( (This)->lpVtbl -> InstallDeviceNotifications(This,deviceNotificationCallback) ) - -#define IDeckLinkDiscovery_UninstallDeviceNotifications(This) \ - ( (This)->lpVtbl -> UninstallDeviceNotifications(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkDiscovery_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_CDeckLinkIterator; - -#ifdef __cplusplus - -class DECLSPEC_UUID("BA6C6F44-6DA5-4DCE-94AA-EE2D1372A676") -CDeckLinkIterator; -#endif - -EXTERN_C const CLSID CLSID_CDeckLinkAPIInformation; - -#ifdef __cplusplus - -class DECLSPEC_UUID("263CA19F-ED09-482E-9F9D-84005783A237") -CDeckLinkAPIInformation; -#endif - -EXTERN_C const CLSID CLSID_CDeckLinkGLScreenPreviewHelper; - -#ifdef __cplusplus - -class DECLSPEC_UUID("1E332DAE-0D04-49EB-B8A1-B6E00B2B6BD0") -CDeckLinkGLScreenPreviewHelper; -#endif - -EXTERN_C const CLSID CLSID_CDeckLinkGL3ScreenPreviewHelper; - -#ifdef __cplusplus - -class DECLSPEC_UUID("166804E4-15EF-4BFD-B623-B5BA921667C5") -CDeckLinkGL3ScreenPreviewHelper; -#endif - -EXTERN_C const CLSID CLSID_CDeckLinkDX9ScreenPreviewHelper; - -#ifdef __cplusplus - -class DECLSPEC_UUID("0EB111ED-ADA6-43A6-8B16-CA5D27EEA15E") -CDeckLinkDX9ScreenPreviewHelper; -#endif - -EXTERN_C const CLSID CLSID_CDeckLinkWPFDX9ScreenPreviewHelper; - -#ifdef __cplusplus - -class DECLSPEC_UUID("5E64496D-4BB2-45D5-9B63-BF1B463B18AF") -CDeckLinkWPFDX9ScreenPreviewHelper; -#endif - -EXTERN_C const CLSID CLSID_CDeckLinkVideoConversion; - -#ifdef __cplusplus - -class DECLSPEC_UUID("771AD62D-671F-4442-AC90-B070C541090A") -CDeckLinkVideoConversion; -#endif - -EXTERN_C const CLSID CLSID_CDeckLinkDiscovery; - -#ifdef __cplusplus - -class DECLSPEC_UUID("22FBFC33-8D07-495C-A5BF-DAB5EA9B82DB") -CDeckLinkDiscovery; -#endif - -EXTERN_C const CLSID CLSID_CDeckLinkVideoFrameAncillaryPackets; - -#ifdef __cplusplus - -class DECLSPEC_UUID("6F47097E-B390-4650-BCB6-C4D52FAA1643") -CDeckLinkVideoFrameAncillaryPackets; -#endif - -#ifndef __IDeckLinkStatus_v15_3_1_INTERFACE_DEFINED__ -#define __IDeckLinkStatus_v15_3_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkStatus_v15_3_1 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkStatus_v15_3_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("5F558200-4028-49BC-BEAC-DB3FA4A96E46") - IDeckLinkStatus_v15_3_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetFlag( - /* [in] */ BMDDeckLinkStatusID statusID, - /* [out] */ BOOL *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetInt( - /* [in] */ BMDDeckLinkStatusID statusID, - /* [out] */ LONGLONG *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFloat( - /* [in] */ BMDDeckLinkStatusID statusID, - /* [out] */ double *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetString( - /* [in] */ BMDDeckLinkStatusID statusID, - /* [out] */ BSTR *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBytes( - /* [in] */ BMDDeckLinkStatusID statusID, - /* [out] */ void *buffer, - /* [out][in] */ unsigned int *bufferSize) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkStatus_v15_3_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkStatus_v15_3_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkStatus_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkStatus_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkStatus_v15_3_1, GetFlag) - HRESULT ( STDMETHODCALLTYPE *GetFlag )( - IDeckLinkStatus_v15_3_1 * This, - /* [in] */ BMDDeckLinkStatusID statusID, - /* [out] */ BOOL *value); - - DECLSPEC_XFGVIRT(IDeckLinkStatus_v15_3_1, GetInt) - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IDeckLinkStatus_v15_3_1 * This, - /* [in] */ BMDDeckLinkStatusID statusID, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IDeckLinkStatus_v15_3_1, GetFloat) - HRESULT ( STDMETHODCALLTYPE *GetFloat )( - IDeckLinkStatus_v15_3_1 * This, - /* [in] */ BMDDeckLinkStatusID statusID, - /* [out] */ double *value); - - DECLSPEC_XFGVIRT(IDeckLinkStatus_v15_3_1, GetString) - HRESULT ( STDMETHODCALLTYPE *GetString )( - IDeckLinkStatus_v15_3_1 * This, - /* [in] */ BMDDeckLinkStatusID statusID, - /* [out] */ BSTR *value); - - DECLSPEC_XFGVIRT(IDeckLinkStatus_v15_3_1, GetBytes) - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IDeckLinkStatus_v15_3_1 * This, - /* [in] */ BMDDeckLinkStatusID statusID, - /* [out] */ void *buffer, - /* [out][in] */ unsigned int *bufferSize); - - END_INTERFACE - } IDeckLinkStatus_v15_3_1Vtbl; - - interface IDeckLinkStatus_v15_3_1 - { - CONST_VTBL struct IDeckLinkStatus_v15_3_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkStatus_v15_3_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkStatus_v15_3_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkStatus_v15_3_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkStatus_v15_3_1_GetFlag(This,statusID,value) \ - ( (This)->lpVtbl -> GetFlag(This,statusID,value) ) - -#define IDeckLinkStatus_v15_3_1_GetInt(This,statusID,value) \ - ( (This)->lpVtbl -> GetInt(This,statusID,value) ) - -#define IDeckLinkStatus_v15_3_1_GetFloat(This,statusID,value) \ - ( (This)->lpVtbl -> GetFloat(This,statusID,value) ) - -#define IDeckLinkStatus_v15_3_1_GetString(This,statusID,value) \ - ( (This)->lpVtbl -> GetString(This,statusID,value) ) - -#define IDeckLinkStatus_v15_3_1_GetBytes(This,statusID,buffer,bufferSize) \ - ( (This)->lpVtbl -> GetBytes(This,statusID,buffer,bufferSize) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkStatus_v15_3_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkConfiguration_v15_3_1_INTERFACE_DEFINED__ -#define __IDeckLinkConfiguration_v15_3_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkConfiguration_v15_3_1 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkConfiguration_v15_3_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("912F634B-2D4E-40A4-8AAB-8D80B73F1289") - IDeckLinkConfiguration_v15_3_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SetFlag( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ BOOL value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFlag( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ BOOL *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetInt( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ LONGLONG value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetInt( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ LONGLONG *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFloat( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ double value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFloat( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ double *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetString( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ BSTR value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetString( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ BSTR *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE WriteConfigurationToPreferences( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkConfiguration_v15_3_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkConfiguration_v15_3_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkConfiguration_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkConfiguration_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v15_3_1, SetFlag) - HRESULT ( STDMETHODCALLTYPE *SetFlag )( - IDeckLinkConfiguration_v15_3_1 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ BOOL value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v15_3_1, GetFlag) - HRESULT ( STDMETHODCALLTYPE *GetFlag )( - IDeckLinkConfiguration_v15_3_1 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ BOOL *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v15_3_1, SetInt) - HRESULT ( STDMETHODCALLTYPE *SetInt )( - IDeckLinkConfiguration_v15_3_1 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ LONGLONG value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v15_3_1, GetInt) - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IDeckLinkConfiguration_v15_3_1 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v15_3_1, SetFloat) - HRESULT ( STDMETHODCALLTYPE *SetFloat )( - IDeckLinkConfiguration_v15_3_1 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ double value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v15_3_1, GetFloat) - HRESULT ( STDMETHODCALLTYPE *GetFloat )( - IDeckLinkConfiguration_v15_3_1 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ double *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v15_3_1, SetString) - HRESULT ( STDMETHODCALLTYPE *SetString )( - IDeckLinkConfiguration_v15_3_1 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ BSTR value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v15_3_1, GetString) - HRESULT ( STDMETHODCALLTYPE *GetString )( - IDeckLinkConfiguration_v15_3_1 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ BSTR *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v15_3_1, WriteConfigurationToPreferences) - HRESULT ( STDMETHODCALLTYPE *WriteConfigurationToPreferences )( - IDeckLinkConfiguration_v15_3_1 * This); - - END_INTERFACE - } IDeckLinkConfiguration_v15_3_1Vtbl; - - interface IDeckLinkConfiguration_v15_3_1 - { - CONST_VTBL struct IDeckLinkConfiguration_v15_3_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkConfiguration_v15_3_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkConfiguration_v15_3_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkConfiguration_v15_3_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkConfiguration_v15_3_1_SetFlag(This,cfgID,value) \ - ( (This)->lpVtbl -> SetFlag(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v15_3_1_GetFlag(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v15_3_1_SetInt(This,cfgID,value) \ - ( (This)->lpVtbl -> SetInt(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v15_3_1_GetInt(This,cfgID,value) \ - ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v15_3_1_SetFloat(This,cfgID,value) \ - ( (This)->lpVtbl -> SetFloat(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v15_3_1_GetFloat(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v15_3_1_SetString(This,cfgID,value) \ - ( (This)->lpVtbl -> SetString(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v15_3_1_GetString(This,cfgID,value) \ - ( (This)->lpVtbl -> GetString(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v15_3_1_WriteConfigurationToPreferences(This) \ - ( (This)->lpVtbl -> WriteConfigurationToPreferences(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkConfiguration_v15_3_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkVideoBuffer_v15_3_1_INTERFACE_DEFINED__ -#define __IDeckLinkVideoBuffer_v15_3_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoBuffer_v15_3_1 */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoBuffer_v15_3_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("CCB4B64A-5C86-4E02-B778-885D352709FE") - IDeckLinkVideoBuffer_v15_3_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetBytes( - void **buffer) = 0; - - virtual HRESULT STDMETHODCALLTYPE StartAccess( - BMDBufferAccessFlags flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE EndAccess( - BMDBufferAccessFlags flags) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkVideoBuffer_v15_3_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoBuffer_v15_3_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoBuffer_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoBuffer_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoBuffer_v15_3_1, GetBytes) - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IDeckLinkVideoBuffer_v15_3_1 * This, - void **buffer); - - DECLSPEC_XFGVIRT(IDeckLinkVideoBuffer_v15_3_1, StartAccess) - HRESULT ( STDMETHODCALLTYPE *StartAccess )( - IDeckLinkVideoBuffer_v15_3_1 * This, - BMDBufferAccessFlags flags); - - DECLSPEC_XFGVIRT(IDeckLinkVideoBuffer_v15_3_1, EndAccess) - HRESULT ( STDMETHODCALLTYPE *EndAccess )( - IDeckLinkVideoBuffer_v15_3_1 * This, - BMDBufferAccessFlags flags); - - END_INTERFACE - } IDeckLinkVideoBuffer_v15_3_1Vtbl; - - interface IDeckLinkVideoBuffer_v15_3_1 - { - CONST_VTBL struct IDeckLinkVideoBuffer_v15_3_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoBuffer_v15_3_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoBuffer_v15_3_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoBuffer_v15_3_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoBuffer_v15_3_1_GetBytes(This,buffer) \ - ( (This)->lpVtbl -> GetBytes(This,buffer) ) - -#define IDeckLinkVideoBuffer_v15_3_1_StartAccess(This,flags) \ - ( (This)->lpVtbl -> StartAccess(This,flags) ) - -#define IDeckLinkVideoBuffer_v15_3_1_EndAccess(This,flags) \ - ( (This)->lpVtbl -> EndAccess(This,flags) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoBuffer_v15_3_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkVideoBufferAllocator_v15_3_1_INTERFACE_DEFINED__ -#define __IDeckLinkVideoBufferAllocator_v15_3_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoBufferAllocator_v15_3_1 */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoBufferAllocator_v15_3_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("3481A4DF-2B11-4E55-AC61-836B87985E9A") - IDeckLinkVideoBufferAllocator_v15_3_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE AllocateVideoBuffer( - IDeckLinkVideoBuffer_v15_3_1 **allocatedBuffer) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkVideoBufferAllocator_v15_3_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoBufferAllocator_v15_3_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoBufferAllocator_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoBufferAllocator_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoBufferAllocator_v15_3_1, AllocateVideoBuffer) - HRESULT ( STDMETHODCALLTYPE *AllocateVideoBuffer )( - IDeckLinkVideoBufferAllocator_v15_3_1 * This, - IDeckLinkVideoBuffer_v15_3_1 **allocatedBuffer); - - END_INTERFACE - } IDeckLinkVideoBufferAllocator_v15_3_1Vtbl; - - interface IDeckLinkVideoBufferAllocator_v15_3_1 - { - CONST_VTBL struct IDeckLinkVideoBufferAllocator_v15_3_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoBufferAllocator_v15_3_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoBufferAllocator_v15_3_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoBufferAllocator_v15_3_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoBufferAllocator_v15_3_1_AllocateVideoBuffer(This,allocatedBuffer) \ - ( (This)->lpVtbl -> AllocateVideoBuffer(This,allocatedBuffer) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoBufferAllocator_v15_3_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkVideoBufferAllocatorProvider_v15_3_1_INTERFACE_DEFINED__ -#define __IDeckLinkVideoBufferAllocatorProvider_v15_3_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoBufferAllocatorProvider_v15_3_1 */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoBufferAllocatorProvider_v15_3_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("08B80403-BFF2-49D0-B448-8C908B9E9FC9") - IDeckLinkVideoBufferAllocatorProvider_v15_3_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetVideoBufferAllocator( - unsigned int bufferSize, - unsigned int width, - unsigned int height, - unsigned int rowBytes, - BMDPixelFormat pixelFormat, - IDeckLinkVideoBufferAllocator_v15_3_1 **allocator) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkVideoBufferAllocatorProvider_v15_3_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoBufferAllocatorProvider_v15_3_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoBufferAllocatorProvider_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoBufferAllocatorProvider_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoBufferAllocatorProvider_v15_3_1, GetVideoBufferAllocator) - HRESULT ( STDMETHODCALLTYPE *GetVideoBufferAllocator )( - IDeckLinkVideoBufferAllocatorProvider_v15_3_1 * This, - unsigned int bufferSize, - unsigned int width, - unsigned int height, - unsigned int rowBytes, - BMDPixelFormat pixelFormat, - IDeckLinkVideoBufferAllocator_v15_3_1 **allocator); - - END_INTERFACE - } IDeckLinkVideoBufferAllocatorProvider_v15_3_1Vtbl; - - interface IDeckLinkVideoBufferAllocatorProvider_v15_3_1 - { - CONST_VTBL struct IDeckLinkVideoBufferAllocatorProvider_v15_3_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoBufferAllocatorProvider_v15_3_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoBufferAllocatorProvider_v15_3_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoBufferAllocatorProvider_v15_3_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoBufferAllocatorProvider_v15_3_1_GetVideoBufferAllocator(This,bufferSize,width,height,rowBytes,pixelFormat,allocator) \ - ( (This)->lpVtbl -> GetVideoBufferAllocator(This,bufferSize,width,height,rowBytes,pixelFormat,allocator) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoBufferAllocatorProvider_v15_3_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkInput_v15_3_1_INTERFACE_DEFINED__ -#define __IDeckLinkInput_v15_3_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkInput_v15_3_1 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkInput_v15_3_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("4095DB82-E294-4B8C-AAA8-3B9E80C49336") - IDeckLinkInput_v15_3_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( - BMDVideoConnection connection, - BMDDisplayMode requestedMode, - BMDPixelFormat requestedPixelFormat, - BMDVideoInputConversionMode conversionMode, - BMDSupportedVideoModeFlags flags, - BMDDisplayMode *actualMode, - BOOL *supported) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayMode( - BMDDisplayMode displayMode, - IDeckLinkDisplayMode **resultDisplayMode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( - IDeckLinkDisplayModeIterator **iterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( - IDeckLinkScreenPreviewCallback *previewCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - BMDVideoInputFlags flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableVideoInputWithAllocatorProvider( - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - BMDVideoInputFlags flags, - IDeckLinkVideoBufferAllocatorProvider_v15_3_1 *allocatorProvider) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAvailableVideoFrameCount( - unsigned int *availableFrameCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( - BMDAudioSampleRate sampleRate, - BMDAudioSampleType sampleType, - unsigned int channelCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAvailableAudioSampleFrameCount( - unsigned int *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( - IDeckLinkInputCallback *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( - BMDTimeScale desiredTimeScale, - BMDTimeValue *hardwareTime, - BMDTimeValue *timeInFrame, - BMDTimeValue *ticksPerFrame) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkInput_v15_3_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkInput_v15_3_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkInput_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkInput_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v15_3_1, DoesSupportVideoMode) - HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( - IDeckLinkInput_v15_3_1 * This, - BMDVideoConnection connection, - BMDDisplayMode requestedMode, - BMDPixelFormat requestedPixelFormat, - BMDVideoInputConversionMode conversionMode, - BMDSupportedVideoModeFlags flags, - BMDDisplayMode *actualMode, - BOOL *supported); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v15_3_1, GetDisplayMode) - HRESULT ( STDMETHODCALLTYPE *GetDisplayMode )( - IDeckLinkInput_v15_3_1 * This, - BMDDisplayMode displayMode, - IDeckLinkDisplayMode **resultDisplayMode); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v15_3_1, GetDisplayModeIterator) - HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( - IDeckLinkInput_v15_3_1 * This, - IDeckLinkDisplayModeIterator **iterator); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v15_3_1, SetScreenPreviewCallback) - HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( - IDeckLinkInput_v15_3_1 * This, - IDeckLinkScreenPreviewCallback *previewCallback); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v15_3_1, EnableVideoInput) - HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( - IDeckLinkInput_v15_3_1 * This, - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - BMDVideoInputFlags flags); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v15_3_1, EnableVideoInputWithAllocatorProvider) - HRESULT ( STDMETHODCALLTYPE *EnableVideoInputWithAllocatorProvider )( - IDeckLinkInput_v15_3_1 * This, - BMDDisplayMode displayMode, - BMDPixelFormat pixelFormat, - BMDVideoInputFlags flags, - IDeckLinkVideoBufferAllocatorProvider_v15_3_1 *allocatorProvider); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v15_3_1, DisableVideoInput) - HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( - IDeckLinkInput_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v15_3_1, GetAvailableVideoFrameCount) - HRESULT ( STDMETHODCALLTYPE *GetAvailableVideoFrameCount )( - IDeckLinkInput_v15_3_1 * This, - unsigned int *availableFrameCount); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v15_3_1, EnableAudioInput) - HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( - IDeckLinkInput_v15_3_1 * This, - BMDAudioSampleRate sampleRate, - BMDAudioSampleType sampleType, - unsigned int channelCount); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v15_3_1, DisableAudioInput) - HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( - IDeckLinkInput_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v15_3_1, GetAvailableAudioSampleFrameCount) - HRESULT ( STDMETHODCALLTYPE *GetAvailableAudioSampleFrameCount )( - IDeckLinkInput_v15_3_1 * This, - unsigned int *availableSampleFrameCount); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v15_3_1, StartStreams) - HRESULT ( STDMETHODCALLTYPE *StartStreams )( - IDeckLinkInput_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v15_3_1, StopStreams) - HRESULT ( STDMETHODCALLTYPE *StopStreams )( - IDeckLinkInput_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v15_3_1, PauseStreams) - HRESULT ( STDMETHODCALLTYPE *PauseStreams )( - IDeckLinkInput_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v15_3_1, FlushStreams) - HRESULT ( STDMETHODCALLTYPE *FlushStreams )( - IDeckLinkInput_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v15_3_1, SetCallback) - HRESULT ( STDMETHODCALLTYPE *SetCallback )( - IDeckLinkInput_v15_3_1 * This, - IDeckLinkInputCallback *theCallback); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v15_3_1, GetHardwareReferenceClock) - HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( - IDeckLinkInput_v15_3_1 * This, - BMDTimeScale desiredTimeScale, - BMDTimeValue *hardwareTime, - BMDTimeValue *timeInFrame, - BMDTimeValue *ticksPerFrame); - - END_INTERFACE - } IDeckLinkInput_v15_3_1Vtbl; - - interface IDeckLinkInput_v15_3_1 - { - CONST_VTBL struct IDeckLinkInput_v15_3_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkInput_v15_3_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkInput_v15_3_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkInput_v15_3_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkInput_v15_3_1_DoesSupportVideoMode(This,connection,requestedMode,requestedPixelFormat,conversionMode,flags,actualMode,supported) \ - ( (This)->lpVtbl -> DoesSupportVideoMode(This,connection,requestedMode,requestedPixelFormat,conversionMode,flags,actualMode,supported) ) - -#define IDeckLinkInput_v15_3_1_GetDisplayMode(This,displayMode,resultDisplayMode) \ - ( (This)->lpVtbl -> GetDisplayMode(This,displayMode,resultDisplayMode) ) - -#define IDeckLinkInput_v15_3_1_GetDisplayModeIterator(This,iterator) \ - ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) - -#define IDeckLinkInput_v15_3_1_SetScreenPreviewCallback(This,previewCallback) \ - ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) - -#define IDeckLinkInput_v15_3_1_EnableVideoInput(This,displayMode,pixelFormat,flags) \ - ( (This)->lpVtbl -> EnableVideoInput(This,displayMode,pixelFormat,flags) ) - -#define IDeckLinkInput_v15_3_1_EnableVideoInputWithAllocatorProvider(This,displayMode,pixelFormat,flags,allocatorProvider) \ - ( (This)->lpVtbl -> EnableVideoInputWithAllocatorProvider(This,displayMode,pixelFormat,flags,allocatorProvider) ) - -#define IDeckLinkInput_v15_3_1_DisableVideoInput(This) \ - ( (This)->lpVtbl -> DisableVideoInput(This) ) - -#define IDeckLinkInput_v15_3_1_GetAvailableVideoFrameCount(This,availableFrameCount) \ - ( (This)->lpVtbl -> GetAvailableVideoFrameCount(This,availableFrameCount) ) - -#define IDeckLinkInput_v15_3_1_EnableAudioInput(This,sampleRate,sampleType,channelCount) \ - ( (This)->lpVtbl -> EnableAudioInput(This,sampleRate,sampleType,channelCount) ) - -#define IDeckLinkInput_v15_3_1_DisableAudioInput(This) \ - ( (This)->lpVtbl -> DisableAudioInput(This) ) - -#define IDeckLinkInput_v15_3_1_GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) \ - ( (This)->lpVtbl -> GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) ) - -#define IDeckLinkInput_v15_3_1_StartStreams(This) \ - ( (This)->lpVtbl -> StartStreams(This) ) - -#define IDeckLinkInput_v15_3_1_StopStreams(This) \ - ( (This)->lpVtbl -> StopStreams(This) ) - -#define IDeckLinkInput_v15_3_1_PauseStreams(This) \ - ( (This)->lpVtbl -> PauseStreams(This) ) - -#define IDeckLinkInput_v15_3_1_FlushStreams(This) \ - ( (This)->lpVtbl -> FlushStreams(This) ) - -#define IDeckLinkInput_v15_3_1_SetCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetCallback(This,theCallback) ) - -#define IDeckLinkInput_v15_3_1_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) \ - ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkInput_v15_3_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkOutput_v15_3_1_INTERFACE_DEFINED__ -#define __IDeckLinkOutput_v15_3_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkOutput_v15_3_1 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkOutput_v15_3_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("1A8077F1-9FE2-4533-8147-2294305E253F") - IDeckLinkOutput_v15_3_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( - BMDVideoConnection connection, - BMDDisplayMode requestedMode, - BMDPixelFormat requestedPixelFormat, - BMDVideoOutputConversionMode conversionMode, - BMDSupportedVideoModeFlags flags, - BMDDisplayMode *actualMode, - BOOL *supported) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayMode( - BMDDisplayMode displayMode, - IDeckLinkDisplayMode **resultDisplayMode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( - IDeckLinkDisplayModeIterator **iterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( - IDeckLinkScreenPreviewCallback *previewCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableVideoOutput( - BMDDisplayMode displayMode, - BMDVideoOutputFlags flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableVideoOutput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateVideoFrame( - int width, - int height, - int rowBytes, - BMDPixelFormat pixelFormat, - BMDFrameFlags flags, - IDeckLinkMutableVideoFrame **outFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateVideoFrameWithBuffer( - int width, - int height, - int rowBytes, - BMDPixelFormat pixelFormat, - BMDFrameFlags flags, - IDeckLinkVideoBuffer_v15_3_1 *buffer, - IDeckLinkMutableVideoFrame **outFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE RowBytesForPixelFormat( - BMDPixelFormat pixelFormat, - int width, - int *rowBytes) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateAncillaryData( - BMDPixelFormat pixelFormat, - IDeckLinkVideoFrameAncillary **outBuffer) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisplayVideoFrameSync( - IDeckLinkVideoFrame *theFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE ScheduleVideoFrame( - IDeckLinkVideoFrame *theFrame, - BMDTimeValue displayTime, - BMDTimeValue displayDuration, - BMDTimeScale timeScale) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetScheduledFrameCompletionCallback( - IDeckLinkVideoOutputCallback *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBufferedVideoFrameCount( - unsigned int *bufferedFrameCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableAudioOutput( - BMDAudioSampleRate sampleRate, - BMDAudioSampleType sampleType, - unsigned int channelCount, - BMDAudioOutputStreamType streamType) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableAudioOutput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE WriteAudioSamplesSync( - void *buffer, - unsigned int sampleFrameCount, - unsigned int *sampleFramesWritten) = 0; - - virtual HRESULT STDMETHODCALLTYPE BeginAudioPreroll( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE EndAudioPreroll( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE ScheduleAudioSamples( - void *buffer, - unsigned int sampleFrameCount, - BMDTimeValue streamTime, - BMDTimeScale timeScale, - unsigned int *sampleFramesWritten) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( - unsigned int *bufferedSampleFrameCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE FlushBufferedAudioSamples( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetAudioCallback( - 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 IsScheduledPlaybackRunning( - BOOL *active) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetScheduledStreamTime( - BMDTimeScale desiredTimeScale, - BMDTimeValue *streamTime, - double *playbackSpeed) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetReferenceStatus( - BMDReferenceStatus *referenceStatus) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( - BMDTimeScale desiredTimeScale, - BMDTimeValue *hardwareTime, - BMDTimeValue *timeInFrame, - BMDTimeValue *ticksPerFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFrameCompletionReferenceTimestamp( - IDeckLinkVideoFrame *theFrame, - BMDTimeScale desiredTimeScale, - BMDTimeValue *frameCompletionTimestamp) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkOutput_v15_3_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkOutput_v15_3_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkOutput_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkOutput_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, DoesSupportVideoMode) - HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( - IDeckLinkOutput_v15_3_1 * This, - BMDVideoConnection connection, - BMDDisplayMode requestedMode, - BMDPixelFormat requestedPixelFormat, - BMDVideoOutputConversionMode conversionMode, - BMDSupportedVideoModeFlags flags, - BMDDisplayMode *actualMode, - BOOL *supported); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, GetDisplayMode) - HRESULT ( STDMETHODCALLTYPE *GetDisplayMode )( - IDeckLinkOutput_v15_3_1 * This, - BMDDisplayMode displayMode, - IDeckLinkDisplayMode **resultDisplayMode); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, GetDisplayModeIterator) - HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( - IDeckLinkOutput_v15_3_1 * This, - IDeckLinkDisplayModeIterator **iterator); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, SetScreenPreviewCallback) - HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( - IDeckLinkOutput_v15_3_1 * This, - IDeckLinkScreenPreviewCallback *previewCallback); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, EnableVideoOutput) - HRESULT ( STDMETHODCALLTYPE *EnableVideoOutput )( - IDeckLinkOutput_v15_3_1 * This, - BMDDisplayMode displayMode, - BMDVideoOutputFlags flags); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, DisableVideoOutput) - HRESULT ( STDMETHODCALLTYPE *DisableVideoOutput )( - IDeckLinkOutput_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, CreateVideoFrame) - HRESULT ( STDMETHODCALLTYPE *CreateVideoFrame )( - IDeckLinkOutput_v15_3_1 * This, - int width, - int height, - int rowBytes, - BMDPixelFormat pixelFormat, - BMDFrameFlags flags, - IDeckLinkMutableVideoFrame **outFrame); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, CreateVideoFrameWithBuffer) - HRESULT ( STDMETHODCALLTYPE *CreateVideoFrameWithBuffer )( - IDeckLinkOutput_v15_3_1 * This, - int width, - int height, - int rowBytes, - BMDPixelFormat pixelFormat, - BMDFrameFlags flags, - IDeckLinkVideoBuffer_v15_3_1 *buffer, - IDeckLinkMutableVideoFrame **outFrame); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, RowBytesForPixelFormat) - HRESULT ( STDMETHODCALLTYPE *RowBytesForPixelFormat )( - IDeckLinkOutput_v15_3_1 * This, - BMDPixelFormat pixelFormat, - int width, - int *rowBytes); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, CreateAncillaryData) - HRESULT ( STDMETHODCALLTYPE *CreateAncillaryData )( - IDeckLinkOutput_v15_3_1 * This, - BMDPixelFormat pixelFormat, - IDeckLinkVideoFrameAncillary **outBuffer); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, DisplayVideoFrameSync) - HRESULT ( STDMETHODCALLTYPE *DisplayVideoFrameSync )( - IDeckLinkOutput_v15_3_1 * This, - IDeckLinkVideoFrame *theFrame); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, ScheduleVideoFrame) - HRESULT ( STDMETHODCALLTYPE *ScheduleVideoFrame )( - IDeckLinkOutput_v15_3_1 * This, - IDeckLinkVideoFrame *theFrame, - BMDTimeValue displayTime, - BMDTimeValue displayDuration, - BMDTimeScale timeScale); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, SetScheduledFrameCompletionCallback) - HRESULT ( STDMETHODCALLTYPE *SetScheduledFrameCompletionCallback )( - IDeckLinkOutput_v15_3_1 * This, - IDeckLinkVideoOutputCallback *theCallback); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, GetBufferedVideoFrameCount) - HRESULT ( STDMETHODCALLTYPE *GetBufferedVideoFrameCount )( - IDeckLinkOutput_v15_3_1 * This, - unsigned int *bufferedFrameCount); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, EnableAudioOutput) - HRESULT ( STDMETHODCALLTYPE *EnableAudioOutput )( - IDeckLinkOutput_v15_3_1 * This, - BMDAudioSampleRate sampleRate, - BMDAudioSampleType sampleType, - unsigned int channelCount, - BMDAudioOutputStreamType streamType); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, DisableAudioOutput) - HRESULT ( STDMETHODCALLTYPE *DisableAudioOutput )( - IDeckLinkOutput_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, WriteAudioSamplesSync) - HRESULT ( STDMETHODCALLTYPE *WriteAudioSamplesSync )( - IDeckLinkOutput_v15_3_1 * This, - void *buffer, - unsigned int sampleFrameCount, - unsigned int *sampleFramesWritten); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, BeginAudioPreroll) - HRESULT ( STDMETHODCALLTYPE *BeginAudioPreroll )( - IDeckLinkOutput_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, EndAudioPreroll) - HRESULT ( STDMETHODCALLTYPE *EndAudioPreroll )( - IDeckLinkOutput_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, ScheduleAudioSamples) - HRESULT ( STDMETHODCALLTYPE *ScheduleAudioSamples )( - IDeckLinkOutput_v15_3_1 * This, - void *buffer, - unsigned int sampleFrameCount, - BMDTimeValue streamTime, - BMDTimeScale timeScale, - unsigned int *sampleFramesWritten); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, GetBufferedAudioSampleFrameCount) - HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( - IDeckLinkOutput_v15_3_1 * This, - unsigned int *bufferedSampleFrameCount); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, FlushBufferedAudioSamples) - HRESULT ( STDMETHODCALLTYPE *FlushBufferedAudioSamples )( - IDeckLinkOutput_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, SetAudioCallback) - HRESULT ( STDMETHODCALLTYPE *SetAudioCallback )( - IDeckLinkOutput_v15_3_1 * This, - IDeckLinkAudioOutputCallback *theCallback); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, StartScheduledPlayback) - HRESULT ( STDMETHODCALLTYPE *StartScheduledPlayback )( - IDeckLinkOutput_v15_3_1 * This, - BMDTimeValue playbackStartTime, - BMDTimeScale timeScale, - double playbackSpeed); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, StopScheduledPlayback) - HRESULT ( STDMETHODCALLTYPE *StopScheduledPlayback )( - IDeckLinkOutput_v15_3_1 * This, - BMDTimeValue stopPlaybackAtTime, - BMDTimeValue *actualStopTime, - BMDTimeScale timeScale); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, IsScheduledPlaybackRunning) - HRESULT ( STDMETHODCALLTYPE *IsScheduledPlaybackRunning )( - IDeckLinkOutput_v15_3_1 * This, - BOOL *active); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, GetScheduledStreamTime) - HRESULT ( STDMETHODCALLTYPE *GetScheduledStreamTime )( - IDeckLinkOutput_v15_3_1 * This, - BMDTimeScale desiredTimeScale, - BMDTimeValue *streamTime, - double *playbackSpeed); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, GetReferenceStatus) - HRESULT ( STDMETHODCALLTYPE *GetReferenceStatus )( - IDeckLinkOutput_v15_3_1 * This, - BMDReferenceStatus *referenceStatus); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, GetHardwareReferenceClock) - HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( - IDeckLinkOutput_v15_3_1 * This, - BMDTimeScale desiredTimeScale, - BMDTimeValue *hardwareTime, - BMDTimeValue *timeInFrame, - BMDTimeValue *ticksPerFrame); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v15_3_1, GetFrameCompletionReferenceTimestamp) - HRESULT ( STDMETHODCALLTYPE *GetFrameCompletionReferenceTimestamp )( - IDeckLinkOutput_v15_3_1 * This, - IDeckLinkVideoFrame *theFrame, - BMDTimeScale desiredTimeScale, - BMDTimeValue *frameCompletionTimestamp); - - END_INTERFACE - } IDeckLinkOutput_v15_3_1Vtbl; - - interface IDeckLinkOutput_v15_3_1 - { - CONST_VTBL struct IDeckLinkOutput_v15_3_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkOutput_v15_3_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkOutput_v15_3_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkOutput_v15_3_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkOutput_v15_3_1_DoesSupportVideoMode(This,connection,requestedMode,requestedPixelFormat,conversionMode,flags,actualMode,supported) \ - ( (This)->lpVtbl -> DoesSupportVideoMode(This,connection,requestedMode,requestedPixelFormat,conversionMode,flags,actualMode,supported) ) - -#define IDeckLinkOutput_v15_3_1_GetDisplayMode(This,displayMode,resultDisplayMode) \ - ( (This)->lpVtbl -> GetDisplayMode(This,displayMode,resultDisplayMode) ) - -#define IDeckLinkOutput_v15_3_1_GetDisplayModeIterator(This,iterator) \ - ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) - -#define IDeckLinkOutput_v15_3_1_SetScreenPreviewCallback(This,previewCallback) \ - ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) - -#define IDeckLinkOutput_v15_3_1_EnableVideoOutput(This,displayMode,flags) \ - ( (This)->lpVtbl -> EnableVideoOutput(This,displayMode,flags) ) - -#define IDeckLinkOutput_v15_3_1_DisableVideoOutput(This) \ - ( (This)->lpVtbl -> DisableVideoOutput(This) ) - -#define IDeckLinkOutput_v15_3_1_CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) \ - ( (This)->lpVtbl -> CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) ) - -#define IDeckLinkOutput_v15_3_1_CreateVideoFrameWithBuffer(This,width,height,rowBytes,pixelFormat,flags,buffer,outFrame) \ - ( (This)->lpVtbl -> CreateVideoFrameWithBuffer(This,width,height,rowBytes,pixelFormat,flags,buffer,outFrame) ) - -#define IDeckLinkOutput_v15_3_1_RowBytesForPixelFormat(This,pixelFormat,width,rowBytes) \ - ( (This)->lpVtbl -> RowBytesForPixelFormat(This,pixelFormat,width,rowBytes) ) - -#define IDeckLinkOutput_v15_3_1_CreateAncillaryData(This,pixelFormat,outBuffer) \ - ( (This)->lpVtbl -> CreateAncillaryData(This,pixelFormat,outBuffer) ) - -#define IDeckLinkOutput_v15_3_1_DisplayVideoFrameSync(This,theFrame) \ - ( (This)->lpVtbl -> DisplayVideoFrameSync(This,theFrame) ) - -#define IDeckLinkOutput_v15_3_1_ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) \ - ( (This)->lpVtbl -> ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) ) - -#define IDeckLinkOutput_v15_3_1_SetScheduledFrameCompletionCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetScheduledFrameCompletionCallback(This,theCallback) ) - -#define IDeckLinkOutput_v15_3_1_GetBufferedVideoFrameCount(This,bufferedFrameCount) \ - ( (This)->lpVtbl -> GetBufferedVideoFrameCount(This,bufferedFrameCount) ) - -#define IDeckLinkOutput_v15_3_1_EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) \ - ( (This)->lpVtbl -> EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) ) - -#define IDeckLinkOutput_v15_3_1_DisableAudioOutput(This) \ - ( (This)->lpVtbl -> DisableAudioOutput(This) ) - -#define IDeckLinkOutput_v15_3_1_WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) \ - ( (This)->lpVtbl -> WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) ) - -#define IDeckLinkOutput_v15_3_1_BeginAudioPreroll(This) \ - ( (This)->lpVtbl -> BeginAudioPreroll(This) ) - -#define IDeckLinkOutput_v15_3_1_EndAudioPreroll(This) \ - ( (This)->lpVtbl -> EndAudioPreroll(This) ) - -#define IDeckLinkOutput_v15_3_1_ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) \ - ( (This)->lpVtbl -> ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) ) - -#define IDeckLinkOutput_v15_3_1_GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) \ - ( (This)->lpVtbl -> GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) ) - -#define IDeckLinkOutput_v15_3_1_FlushBufferedAudioSamples(This) \ - ( (This)->lpVtbl -> FlushBufferedAudioSamples(This) ) - -#define IDeckLinkOutput_v15_3_1_SetAudioCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetAudioCallback(This,theCallback) ) - -#define IDeckLinkOutput_v15_3_1_StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) \ - ( (This)->lpVtbl -> StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) ) - -#define IDeckLinkOutput_v15_3_1_StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) \ - ( (This)->lpVtbl -> StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) ) - -#define IDeckLinkOutput_v15_3_1_IsScheduledPlaybackRunning(This,active) \ - ( (This)->lpVtbl -> IsScheduledPlaybackRunning(This,active) ) - -#define IDeckLinkOutput_v15_3_1_GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed) \ - ( (This)->lpVtbl -> GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed) ) - -#define IDeckLinkOutput_v15_3_1_GetReferenceStatus(This,referenceStatus) \ - ( (This)->lpVtbl -> GetReferenceStatus(This,referenceStatus) ) - -#define IDeckLinkOutput_v15_3_1_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) \ - ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) - -#define IDeckLinkOutput_v15_3_1_GetFrameCompletionReferenceTimestamp(This,theFrame,desiredTimeScale,frameCompletionTimestamp) \ - ( (This)->lpVtbl -> GetFrameCompletionReferenceTimestamp(This,theFrame,desiredTimeScale,frameCompletionTimestamp) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkOutput_v15_3_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkVideoConversion_v15_3_1_INTERFACE_DEFINED__ -#define __IDeckLinkVideoConversion_v15_3_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoConversion_v15_3_1 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoConversion_v15_3_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("A48755D9-8BD5-4727-A1E9-069FDEDBA6E9") - IDeckLinkVideoConversion_v15_3_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE ConvertFrame( - /* [in] */ IDeckLinkVideoFrame *srcFrame, - /* [in] */ IDeckLinkVideoFrame *dstFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE ConvertNewFrame( - /* [in] */ IDeckLinkVideoFrame *srcFrame, - /* [in] */ BMDPixelFormat dstPixelFormat, - /* [in] */ BMDColorspace dstColorspace, - /* [in] */ IDeckLinkVideoBuffer_v15_3_1 *dstBuffer, - /* [out] */ IDeckLinkVideoFrame **dstFrame) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkVideoConversion_v15_3_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoConversion_v15_3_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoConversion_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoConversion_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoConversion_v15_3_1, ConvertFrame) - HRESULT ( STDMETHODCALLTYPE *ConvertFrame )( - IDeckLinkVideoConversion_v15_3_1 * This, - /* [in] */ IDeckLinkVideoFrame *srcFrame, - /* [in] */ IDeckLinkVideoFrame *dstFrame); - - DECLSPEC_XFGVIRT(IDeckLinkVideoConversion_v15_3_1, ConvertNewFrame) - HRESULT ( STDMETHODCALLTYPE *ConvertNewFrame )( - IDeckLinkVideoConversion_v15_3_1 * This, - /* [in] */ IDeckLinkVideoFrame *srcFrame, - /* [in] */ BMDPixelFormat dstPixelFormat, - /* [in] */ BMDColorspace dstColorspace, - /* [in] */ IDeckLinkVideoBuffer_v15_3_1 *dstBuffer, - /* [out] */ IDeckLinkVideoFrame **dstFrame); - - END_INTERFACE - } IDeckLinkVideoConversion_v15_3_1Vtbl; - - interface IDeckLinkVideoConversion_v15_3_1 - { - CONST_VTBL struct IDeckLinkVideoConversion_v15_3_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoConversion_v15_3_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoConversion_v15_3_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoConversion_v15_3_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoConversion_v15_3_1_ConvertFrame(This,srcFrame,dstFrame) \ - ( (This)->lpVtbl -> ConvertFrame(This,srcFrame,dstFrame) ) - -#define IDeckLinkVideoConversion_v15_3_1_ConvertNewFrame(This,srcFrame,dstPixelFormat,dstColorspace,dstBuffer,dstFrame) \ - ( (This)->lpVtbl -> ConvertNewFrame(This,srcFrame,dstPixelFormat,dstColorspace,dstBuffer,dstFrame) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoConversion_v15_3_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkNotification_v15_3_1_INTERFACE_DEFINED__ -#define __IDeckLinkNotification_v15_3_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkNotification_v15_3_1 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkNotification_v15_3_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("B85DF4C8-BDF5-47C1-8064-28162EBDD4EB") - IDeckLinkNotification_v15_3_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Subscribe( - /* [in] */ BMDNotifications topic, - /* [in] */ IDeckLinkNotificationCallback *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE Unsubscribe( - /* [in] */ BMDNotifications topic, - /* [in] */ IDeckLinkNotificationCallback *theCallback) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkNotification_v15_3_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkNotification_v15_3_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkNotification_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkNotification_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkNotification_v15_3_1, Subscribe) - HRESULT ( STDMETHODCALLTYPE *Subscribe )( - IDeckLinkNotification_v15_3_1 * This, - /* [in] */ BMDNotifications topic, - /* [in] */ IDeckLinkNotificationCallback *theCallback); - - DECLSPEC_XFGVIRT(IDeckLinkNotification_v15_3_1, Unsubscribe) - HRESULT ( STDMETHODCALLTYPE *Unsubscribe )( - IDeckLinkNotification_v15_3_1 * This, - /* [in] */ BMDNotifications topic, - /* [in] */ IDeckLinkNotificationCallback *theCallback); - - END_INTERFACE - } IDeckLinkNotification_v15_3_1Vtbl; - - interface IDeckLinkNotification_v15_3_1 - { - CONST_VTBL struct IDeckLinkNotification_v15_3_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkNotification_v15_3_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkNotification_v15_3_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkNotification_v15_3_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkNotification_v15_3_1_Subscribe(This,topic,theCallback) \ - ( (This)->lpVtbl -> Subscribe(This,topic,theCallback) ) - -#define IDeckLinkNotification_v15_3_1_Unsubscribe(This,topic,theCallback) \ - ( (This)->lpVtbl -> Unsubscribe(This,topic,theCallback) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkNotification_v15_3_1_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_CDeckLinkVideoConversion_v15_3_1; - -#ifdef __cplusplus - -class DECLSPEC_UUID("89BA47BD-1FE2-4D76-9BFE-DE85049C4987") -CDeckLinkVideoConversion_v15_3_1; -#endif - -#ifndef __IDeckLinkProfileAttributes_v15_3_1_INTERFACE_DEFINED__ -#define __IDeckLinkProfileAttributes_v15_3_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkProfileAttributes_v15_3_1 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkProfileAttributes_v15_3_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("17D4BF8E-4911-473A-80A0-731CF6FF345B") - IDeckLinkProfileAttributes_v15_3_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetFlag( - /* [in] */ BMDDeckLinkAttributeID attrID, - /* [out] */ BOOL *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetInt( - /* [in] */ BMDDeckLinkAttributeID attrID, - /* [out] */ LONGLONG *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFloat( - /* [in] */ BMDDeckLinkAttributeID attrID, - /* [out] */ double *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetString( - /* [in] */ BMDDeckLinkAttributeID attrID, - /* [out] */ BSTR *value) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkProfileAttributes_v15_3_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkProfileAttributes_v15_3_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkProfileAttributes_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkProfileAttributes_v15_3_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkProfileAttributes_v15_3_1, GetFlag) - HRESULT ( STDMETHODCALLTYPE *GetFlag )( - IDeckLinkProfileAttributes_v15_3_1 * This, - /* [in] */ BMDDeckLinkAttributeID attrID, - /* [out] */ BOOL *value); - - DECLSPEC_XFGVIRT(IDeckLinkProfileAttributes_v15_3_1, GetInt) - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IDeckLinkProfileAttributes_v15_3_1 * This, - /* [in] */ BMDDeckLinkAttributeID attrID, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IDeckLinkProfileAttributes_v15_3_1, GetFloat) - HRESULT ( STDMETHODCALLTYPE *GetFloat )( - IDeckLinkProfileAttributes_v15_3_1 * This, - /* [in] */ BMDDeckLinkAttributeID attrID, - /* [out] */ double *value); - - DECLSPEC_XFGVIRT(IDeckLinkProfileAttributes_v15_3_1, GetString) - HRESULT ( STDMETHODCALLTYPE *GetString )( - IDeckLinkProfileAttributes_v15_3_1 * This, - /* [in] */ BMDDeckLinkAttributeID attrID, - /* [out] */ BSTR *value); - - END_INTERFACE - } IDeckLinkProfileAttributes_v15_3_1Vtbl; - - interface IDeckLinkProfileAttributes_v15_3_1 - { - CONST_VTBL struct IDeckLinkProfileAttributes_v15_3_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkProfileAttributes_v15_3_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkProfileAttributes_v15_3_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkProfileAttributes_v15_3_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkProfileAttributes_v15_3_1_GetFlag(This,attrID,value) \ - ( (This)->lpVtbl -> GetFlag(This,attrID,value) ) - -#define IDeckLinkProfileAttributes_v15_3_1_GetInt(This,attrID,value) \ - ( (This)->lpVtbl -> GetInt(This,attrID,value) ) - -#define IDeckLinkProfileAttributes_v15_3_1_GetFloat(This,attrID,value) \ - ( (This)->lpVtbl -> GetFloat(This,attrID,value) ) - -#define IDeckLinkProfileAttributes_v15_3_1_GetString(This,attrID,value) \ - ( (This)->lpVtbl -> GetString(This,attrID,value) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkProfileAttributes_v15_3_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkVideoOutputCallback_v14_2_1_INTERFACE_DEFINED__ -#define __IDeckLinkVideoOutputCallback_v14_2_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoOutputCallback_v14_2_1 */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoOutputCallback_v14_2_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("20AA5225-1958-47CB-820B-80A8D521A6EE") - IDeckLinkVideoOutputCallback_v14_2_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted( - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *completedFrame, - /* [in] */ BMDOutputFrameCompletionResult result) = 0; - - virtual HRESULT STDMETHODCALLTYPE ScheduledPlaybackHasStopped( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkVideoOutputCallback_v14_2_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoOutputCallback_v14_2_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoOutputCallback_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoOutputCallback_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoOutputCallback_v14_2_1, ScheduledFrameCompleted) - HRESULT ( STDMETHODCALLTYPE *ScheduledFrameCompleted )( - IDeckLinkVideoOutputCallback_v14_2_1 * This, - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *completedFrame, - /* [in] */ BMDOutputFrameCompletionResult result); - - DECLSPEC_XFGVIRT(IDeckLinkVideoOutputCallback_v14_2_1, ScheduledPlaybackHasStopped) - HRESULT ( STDMETHODCALLTYPE *ScheduledPlaybackHasStopped )( - IDeckLinkVideoOutputCallback_v14_2_1 * This); - - END_INTERFACE - } IDeckLinkVideoOutputCallback_v14_2_1Vtbl; - - interface IDeckLinkVideoOutputCallback_v14_2_1 - { - CONST_VTBL struct IDeckLinkVideoOutputCallback_v14_2_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoOutputCallback_v14_2_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoOutputCallback_v14_2_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoOutputCallback_v14_2_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoOutputCallback_v14_2_1_ScheduledFrameCompleted(This,completedFrame,result) \ - ( (This)->lpVtbl -> ScheduledFrameCompleted(This,completedFrame,result) ) - -#define IDeckLinkVideoOutputCallback_v14_2_1_ScheduledPlaybackHasStopped(This) \ - ( (This)->lpVtbl -> ScheduledPlaybackHasStopped(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoOutputCallback_v14_2_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkInputCallback_v14_2_1_INTERFACE_DEFINED__ -#define __IDeckLinkInputCallback_v14_2_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkInputCallback_v14_2_1 */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkInputCallback_v14_2_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("C6FCE4C9-C4E4-4047-82FB-5D238232A902") - IDeckLinkInputCallback_v14_2_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged( - /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents, - /* [in] */ IDeckLinkDisplayMode *newDisplayMode, - /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived( - /* [in] */ IDeckLinkVideoInputFrame_v14_2_1 *videoFrame, - /* [in] */ IDeckLinkAudioInputPacket *audioPacket) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkInputCallback_v14_2_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkInputCallback_v14_2_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkInputCallback_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkInputCallback_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInputCallback_v14_2_1, VideoInputFormatChanged) - HRESULT ( STDMETHODCALLTYPE *VideoInputFormatChanged )( - IDeckLinkInputCallback_v14_2_1 * This, - /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents, - /* [in] */ IDeckLinkDisplayMode *newDisplayMode, - /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags); - - DECLSPEC_XFGVIRT(IDeckLinkInputCallback_v14_2_1, VideoInputFrameArrived) - HRESULT ( STDMETHODCALLTYPE *VideoInputFrameArrived )( - IDeckLinkInputCallback_v14_2_1 * This, - /* [in] */ IDeckLinkVideoInputFrame_v14_2_1 *videoFrame, - /* [in] */ IDeckLinkAudioInputPacket *audioPacket); - - END_INTERFACE - } IDeckLinkInputCallback_v14_2_1Vtbl; - - interface IDeckLinkInputCallback_v14_2_1 - { - CONST_VTBL struct IDeckLinkInputCallback_v14_2_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkInputCallback_v14_2_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkInputCallback_v14_2_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkInputCallback_v14_2_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkInputCallback_v14_2_1_VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags) \ - ( (This)->lpVtbl -> VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags) ) - -#define IDeckLinkInputCallback_v14_2_1_VideoInputFrameArrived(This,videoFrame,audioPacket) \ - ( (This)->lpVtbl -> VideoInputFrameArrived(This,videoFrame,audioPacket) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkInputCallback_v14_2_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkMemoryAllocator_v14_2_1_INTERFACE_DEFINED__ -#define __IDeckLinkMemoryAllocator_v14_2_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkMemoryAllocator_v14_2_1 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkMemoryAllocator_v14_2_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("B36EB6E7-9D29-4AA8-92EF-843B87A289E8") - IDeckLinkMemoryAllocator_v14_2_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE AllocateBuffer( - /* [in] */ unsigned int 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 IDeckLinkMemoryAllocator_v14_2_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkMemoryAllocator_v14_2_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkMemoryAllocator_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkMemoryAllocator_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkMemoryAllocator_v14_2_1, AllocateBuffer) - HRESULT ( STDMETHODCALLTYPE *AllocateBuffer )( - IDeckLinkMemoryAllocator_v14_2_1 * This, - /* [in] */ unsigned int bufferSize, - /* [out] */ void **allocatedBuffer); - - DECLSPEC_XFGVIRT(IDeckLinkMemoryAllocator_v14_2_1, ReleaseBuffer) - HRESULT ( STDMETHODCALLTYPE *ReleaseBuffer )( - IDeckLinkMemoryAllocator_v14_2_1 * This, - /* [in] */ void *buffer); - - DECLSPEC_XFGVIRT(IDeckLinkMemoryAllocator_v14_2_1, Commit) - HRESULT ( STDMETHODCALLTYPE *Commit )( - IDeckLinkMemoryAllocator_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkMemoryAllocator_v14_2_1, Decommit) - HRESULT ( STDMETHODCALLTYPE *Decommit )( - IDeckLinkMemoryAllocator_v14_2_1 * This); - - END_INTERFACE - } IDeckLinkMemoryAllocator_v14_2_1Vtbl; - - interface IDeckLinkMemoryAllocator_v14_2_1 - { - CONST_VTBL struct IDeckLinkMemoryAllocator_v14_2_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkMemoryAllocator_v14_2_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkMemoryAllocator_v14_2_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkMemoryAllocator_v14_2_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkMemoryAllocator_v14_2_1_AllocateBuffer(This,bufferSize,allocatedBuffer) \ - ( (This)->lpVtbl -> AllocateBuffer(This,bufferSize,allocatedBuffer) ) - -#define IDeckLinkMemoryAllocator_v14_2_1_ReleaseBuffer(This,buffer) \ - ( (This)->lpVtbl -> ReleaseBuffer(This,buffer) ) - -#define IDeckLinkMemoryAllocator_v14_2_1_Commit(This) \ - ( (This)->lpVtbl -> Commit(This) ) - -#define IDeckLinkMemoryAllocator_v14_2_1_Decommit(This) \ - ( (This)->lpVtbl -> Decommit(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkMemoryAllocator_v14_2_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkOutput_v14_2_1_INTERFACE_DEFINED__ -#define __IDeckLinkOutput_v14_2_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkOutput_v14_2_1 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkOutput_v14_2_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("BE2D9020-461E-442F-84B7-E949CB953B9D") - IDeckLinkOutput_v14_2_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( - /* [in] */ BMDVideoConnection connection, - /* [in] */ BMDDisplayMode requestedMode, - /* [in] */ BMDPixelFormat requestedPixelFormat, - /* [in] */ BMDVideoOutputConversionMode conversionMode, - /* [in] */ BMDSupportedVideoModeFlags flags, - /* [out] */ BMDDisplayMode *actualMode, - /* [out] */ BOOL *supported) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayMode( - /* [in] */ BMDDisplayMode displayMode, - /* [out] */ IDeckLinkDisplayMode **resultDisplayMode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( - /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( - /* [in] */ IDeckLinkScreenPreviewCallback_v14_2_1 *previewCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableVideoOutput( - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDVideoOutputFlags flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableVideoOutput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFrameMemoryAllocator( - /* [in] */ IDeckLinkMemoryAllocator_v14_2_1 *theAllocator) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateVideoFrame( - /* [in] */ int width, - /* [in] */ int height, - /* [in] */ int rowBytes, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDFrameFlags flags, - /* [out] */ IDeckLinkMutableVideoFrame_v14_2_1 **outFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateAncillaryData( - /* [in] */ BMDPixelFormat pixelFormat, - /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisplayVideoFrameSync( - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE ScheduleVideoFrame( - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame, - /* [in] */ BMDTimeValue displayTime, - /* [in] */ BMDTimeValue displayDuration, - /* [in] */ BMDTimeScale timeScale) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetScheduledFrameCompletionCallback( - /* [in] */ IDeckLinkVideoOutputCallback_v14_2_1 *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBufferedVideoFrameCount( - /* [out] */ unsigned int *bufferedFrameCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableAudioOutput( - /* [in] */ BMDAudioSampleRate sampleRate, - /* [in] */ BMDAudioSampleType sampleType, - /* [in] */ unsigned int channelCount, - /* [in] */ BMDAudioOutputStreamType streamType) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableAudioOutput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE WriteAudioSamplesSync( - /* [in] */ void *buffer, - /* [in] */ unsigned int sampleFrameCount, - /* [out] */ unsigned int *sampleFramesWritten) = 0; - - virtual HRESULT STDMETHODCALLTYPE BeginAudioPreroll( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE EndAudioPreroll( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE ScheduleAudioSamples( - /* [in] */ void *buffer, - /* [in] */ unsigned int sampleFrameCount, - /* [in] */ BMDTimeValue streamTime, - /* [in] */ BMDTimeScale timeScale, - /* [out] */ unsigned int *sampleFramesWritten) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( - /* [out] */ unsigned int *bufferedSampleFrameCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE FlushBufferedAudioSamples( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetAudioCallback( - /* [in] */ IDeckLinkAudioOutputCallback *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE StartScheduledPlayback( - /* [in] */ BMDTimeValue playbackStartTime, - /* [in] */ BMDTimeScale timeScale, - /* [in] */ double playbackSpeed) = 0; - - virtual HRESULT STDMETHODCALLTYPE StopScheduledPlayback( - /* [in] */ BMDTimeValue stopPlaybackAtTime, - /* [out] */ BMDTimeValue *actualStopTime, - /* [in] */ BMDTimeScale timeScale) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsScheduledPlaybackRunning( - /* [out] */ BOOL *active) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetScheduledStreamTime( - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *streamTime, - /* [out] */ double *playbackSpeed) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetReferenceStatus( - /* [out] */ BMDReferenceStatus *referenceStatus) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFrameCompletionReferenceTimestamp( - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame, - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *frameCompletionTimestamp) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkOutput_v14_2_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkOutput_v14_2_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkOutput_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkOutput_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, DoesSupportVideoMode) - HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( - IDeckLinkOutput_v14_2_1 * This, - /* [in] */ BMDVideoConnection connection, - /* [in] */ BMDDisplayMode requestedMode, - /* [in] */ BMDPixelFormat requestedPixelFormat, - /* [in] */ BMDVideoOutputConversionMode conversionMode, - /* [in] */ BMDSupportedVideoModeFlags flags, - /* [out] */ BMDDisplayMode *actualMode, - /* [out] */ BOOL *supported); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, GetDisplayMode) - HRESULT ( STDMETHODCALLTYPE *GetDisplayMode )( - IDeckLinkOutput_v14_2_1 * This, - /* [in] */ BMDDisplayMode displayMode, - /* [out] */ IDeckLinkDisplayMode **resultDisplayMode); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, GetDisplayModeIterator) - HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( - IDeckLinkOutput_v14_2_1 * This, - /* [out] */ IDeckLinkDisplayModeIterator **iterator); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, SetScreenPreviewCallback) - HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( - IDeckLinkOutput_v14_2_1 * This, - /* [in] */ IDeckLinkScreenPreviewCallback_v14_2_1 *previewCallback); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, EnableVideoOutput) - HRESULT ( STDMETHODCALLTYPE *EnableVideoOutput )( - IDeckLinkOutput_v14_2_1 * This, - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDVideoOutputFlags flags); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, DisableVideoOutput) - HRESULT ( STDMETHODCALLTYPE *DisableVideoOutput )( - IDeckLinkOutput_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, SetVideoOutputFrameMemoryAllocator) - HRESULT ( STDMETHODCALLTYPE *SetVideoOutputFrameMemoryAllocator )( - IDeckLinkOutput_v14_2_1 * This, - /* [in] */ IDeckLinkMemoryAllocator_v14_2_1 *theAllocator); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, CreateVideoFrame) - HRESULT ( STDMETHODCALLTYPE *CreateVideoFrame )( - IDeckLinkOutput_v14_2_1 * This, - /* [in] */ int width, - /* [in] */ int height, - /* [in] */ int rowBytes, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDFrameFlags flags, - /* [out] */ IDeckLinkMutableVideoFrame_v14_2_1 **outFrame); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, CreateAncillaryData) - HRESULT ( STDMETHODCALLTYPE *CreateAncillaryData )( - IDeckLinkOutput_v14_2_1 * This, - /* [in] */ BMDPixelFormat pixelFormat, - /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, DisplayVideoFrameSync) - HRESULT ( STDMETHODCALLTYPE *DisplayVideoFrameSync )( - IDeckLinkOutput_v14_2_1 * This, - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, ScheduleVideoFrame) - HRESULT ( STDMETHODCALLTYPE *ScheduleVideoFrame )( - IDeckLinkOutput_v14_2_1 * This, - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame, - /* [in] */ BMDTimeValue displayTime, - /* [in] */ BMDTimeValue displayDuration, - /* [in] */ BMDTimeScale timeScale); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, SetScheduledFrameCompletionCallback) - HRESULT ( STDMETHODCALLTYPE *SetScheduledFrameCompletionCallback )( - IDeckLinkOutput_v14_2_1 * This, - /* [in] */ IDeckLinkVideoOutputCallback_v14_2_1 *theCallback); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, GetBufferedVideoFrameCount) - HRESULT ( STDMETHODCALLTYPE *GetBufferedVideoFrameCount )( - IDeckLinkOutput_v14_2_1 * This, - /* [out] */ unsigned int *bufferedFrameCount); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, EnableAudioOutput) - HRESULT ( STDMETHODCALLTYPE *EnableAudioOutput )( - IDeckLinkOutput_v14_2_1 * This, - /* [in] */ BMDAudioSampleRate sampleRate, - /* [in] */ BMDAudioSampleType sampleType, - /* [in] */ unsigned int channelCount, - /* [in] */ BMDAudioOutputStreamType streamType); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, DisableAudioOutput) - HRESULT ( STDMETHODCALLTYPE *DisableAudioOutput )( - IDeckLinkOutput_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, WriteAudioSamplesSync) - HRESULT ( STDMETHODCALLTYPE *WriteAudioSamplesSync )( - IDeckLinkOutput_v14_2_1 * This, - /* [in] */ void *buffer, - /* [in] */ unsigned int sampleFrameCount, - /* [out] */ unsigned int *sampleFramesWritten); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, BeginAudioPreroll) - HRESULT ( STDMETHODCALLTYPE *BeginAudioPreroll )( - IDeckLinkOutput_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, EndAudioPreroll) - HRESULT ( STDMETHODCALLTYPE *EndAudioPreroll )( - IDeckLinkOutput_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, ScheduleAudioSamples) - HRESULT ( STDMETHODCALLTYPE *ScheduleAudioSamples )( - IDeckLinkOutput_v14_2_1 * This, - /* [in] */ void *buffer, - /* [in] */ unsigned int sampleFrameCount, - /* [in] */ BMDTimeValue streamTime, - /* [in] */ BMDTimeScale timeScale, - /* [out] */ unsigned int *sampleFramesWritten); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, GetBufferedAudioSampleFrameCount) - HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( - IDeckLinkOutput_v14_2_1 * This, - /* [out] */ unsigned int *bufferedSampleFrameCount); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, FlushBufferedAudioSamples) - HRESULT ( STDMETHODCALLTYPE *FlushBufferedAudioSamples )( - IDeckLinkOutput_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, SetAudioCallback) - HRESULT ( STDMETHODCALLTYPE *SetAudioCallback )( - IDeckLinkOutput_v14_2_1 * This, - /* [in] */ IDeckLinkAudioOutputCallback *theCallback); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, StartScheduledPlayback) - HRESULT ( STDMETHODCALLTYPE *StartScheduledPlayback )( - IDeckLinkOutput_v14_2_1 * This, - /* [in] */ BMDTimeValue playbackStartTime, - /* [in] */ BMDTimeScale timeScale, - /* [in] */ double playbackSpeed); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, StopScheduledPlayback) - HRESULT ( STDMETHODCALLTYPE *StopScheduledPlayback )( - IDeckLinkOutput_v14_2_1 * This, - /* [in] */ BMDTimeValue stopPlaybackAtTime, - /* [out] */ BMDTimeValue *actualStopTime, - /* [in] */ BMDTimeScale timeScale); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, IsScheduledPlaybackRunning) - HRESULT ( STDMETHODCALLTYPE *IsScheduledPlaybackRunning )( - IDeckLinkOutput_v14_2_1 * This, - /* [out] */ BOOL *active); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, GetScheduledStreamTime) - HRESULT ( STDMETHODCALLTYPE *GetScheduledStreamTime )( - IDeckLinkOutput_v14_2_1 * This, - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *streamTime, - /* [out] */ double *playbackSpeed); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, GetReferenceStatus) - HRESULT ( STDMETHODCALLTYPE *GetReferenceStatus )( - IDeckLinkOutput_v14_2_1 * This, - /* [out] */ BMDReferenceStatus *referenceStatus); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, GetHardwareReferenceClock) - HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( - IDeckLinkOutput_v14_2_1 * This, - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v14_2_1, GetFrameCompletionReferenceTimestamp) - HRESULT ( STDMETHODCALLTYPE *GetFrameCompletionReferenceTimestamp )( - IDeckLinkOutput_v14_2_1 * This, - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame, - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *frameCompletionTimestamp); - - END_INTERFACE - } IDeckLinkOutput_v14_2_1Vtbl; - - interface IDeckLinkOutput_v14_2_1 - { - CONST_VTBL struct IDeckLinkOutput_v14_2_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkOutput_v14_2_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkOutput_v14_2_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkOutput_v14_2_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkOutput_v14_2_1_DoesSupportVideoMode(This,connection,requestedMode,requestedPixelFormat,conversionMode,flags,actualMode,supported) \ - ( (This)->lpVtbl -> DoesSupportVideoMode(This,connection,requestedMode,requestedPixelFormat,conversionMode,flags,actualMode,supported) ) - -#define IDeckLinkOutput_v14_2_1_GetDisplayMode(This,displayMode,resultDisplayMode) \ - ( (This)->lpVtbl -> GetDisplayMode(This,displayMode,resultDisplayMode) ) - -#define IDeckLinkOutput_v14_2_1_GetDisplayModeIterator(This,iterator) \ - ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) - -#define IDeckLinkOutput_v14_2_1_SetScreenPreviewCallback(This,previewCallback) \ - ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) - -#define IDeckLinkOutput_v14_2_1_EnableVideoOutput(This,displayMode,flags) \ - ( (This)->lpVtbl -> EnableVideoOutput(This,displayMode,flags) ) - -#define IDeckLinkOutput_v14_2_1_DisableVideoOutput(This) \ - ( (This)->lpVtbl -> DisableVideoOutput(This) ) - -#define IDeckLinkOutput_v14_2_1_SetVideoOutputFrameMemoryAllocator(This,theAllocator) \ - ( (This)->lpVtbl -> SetVideoOutputFrameMemoryAllocator(This,theAllocator) ) - -#define IDeckLinkOutput_v14_2_1_CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) \ - ( (This)->lpVtbl -> CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) ) - -#define IDeckLinkOutput_v14_2_1_CreateAncillaryData(This,pixelFormat,outBuffer) \ - ( (This)->lpVtbl -> CreateAncillaryData(This,pixelFormat,outBuffer) ) - -#define IDeckLinkOutput_v14_2_1_DisplayVideoFrameSync(This,theFrame) \ - ( (This)->lpVtbl -> DisplayVideoFrameSync(This,theFrame) ) - -#define IDeckLinkOutput_v14_2_1_ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) \ - ( (This)->lpVtbl -> ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) ) - -#define IDeckLinkOutput_v14_2_1_SetScheduledFrameCompletionCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetScheduledFrameCompletionCallback(This,theCallback) ) - -#define IDeckLinkOutput_v14_2_1_GetBufferedVideoFrameCount(This,bufferedFrameCount) \ - ( (This)->lpVtbl -> GetBufferedVideoFrameCount(This,bufferedFrameCount) ) - -#define IDeckLinkOutput_v14_2_1_EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) \ - ( (This)->lpVtbl -> EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) ) - -#define IDeckLinkOutput_v14_2_1_DisableAudioOutput(This) \ - ( (This)->lpVtbl -> DisableAudioOutput(This) ) - -#define IDeckLinkOutput_v14_2_1_WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) \ - ( (This)->lpVtbl -> WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) ) - -#define IDeckLinkOutput_v14_2_1_BeginAudioPreroll(This) \ - ( (This)->lpVtbl -> BeginAudioPreroll(This) ) - -#define IDeckLinkOutput_v14_2_1_EndAudioPreroll(This) \ - ( (This)->lpVtbl -> EndAudioPreroll(This) ) - -#define IDeckLinkOutput_v14_2_1_ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) \ - ( (This)->lpVtbl -> ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) ) - -#define IDeckLinkOutput_v14_2_1_GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) \ - ( (This)->lpVtbl -> GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) ) - -#define IDeckLinkOutput_v14_2_1_FlushBufferedAudioSamples(This) \ - ( (This)->lpVtbl -> FlushBufferedAudioSamples(This) ) - -#define IDeckLinkOutput_v14_2_1_SetAudioCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetAudioCallback(This,theCallback) ) - -#define IDeckLinkOutput_v14_2_1_StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) \ - ( (This)->lpVtbl -> StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) ) - -#define IDeckLinkOutput_v14_2_1_StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) \ - ( (This)->lpVtbl -> StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) ) - -#define IDeckLinkOutput_v14_2_1_IsScheduledPlaybackRunning(This,active) \ - ( (This)->lpVtbl -> IsScheduledPlaybackRunning(This,active) ) - -#define IDeckLinkOutput_v14_2_1_GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed) \ - ( (This)->lpVtbl -> GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed) ) - -#define IDeckLinkOutput_v14_2_1_GetReferenceStatus(This,referenceStatus) \ - ( (This)->lpVtbl -> GetReferenceStatus(This,referenceStatus) ) - -#define IDeckLinkOutput_v14_2_1_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) \ - ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) - -#define IDeckLinkOutput_v14_2_1_GetFrameCompletionReferenceTimestamp(This,theFrame,desiredTimeScale,frameCompletionTimestamp) \ - ( (This)->lpVtbl -> GetFrameCompletionReferenceTimestamp(This,theFrame,desiredTimeScale,frameCompletionTimestamp) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkOutput_v14_2_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkInput_v14_2_1_INTERFACE_DEFINED__ -#define __IDeckLinkInput_v14_2_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkInput_v14_2_1 */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkInput_v14_2_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("C21CDB6E-F414-46E4-A636-80A566E0ED37") - IDeckLinkInput_v14_2_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( - /* [in] */ BMDVideoConnection connection, - /* [in] */ BMDDisplayMode requestedMode, - /* [in] */ BMDPixelFormat requestedPixelFormat, - /* [in] */ BMDVideoInputConversionMode conversionMode, - /* [in] */ BMDSupportedVideoModeFlags flags, - /* [out] */ BMDDisplayMode *actualMode, - /* [out] */ BOOL *supported) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayMode( - /* [in] */ BMDDisplayMode displayMode, - /* [out] */ IDeckLinkDisplayMode **resultDisplayMode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( - /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( - /* [in] */ IDeckLinkScreenPreviewCallback_v14_2_1 *previewCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDVideoInputFlags flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAvailableVideoFrameCount( - /* [out] */ unsigned int *availableFrameCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetVideoInputFrameMemoryAllocator( - /* [in] */ IDeckLinkMemoryAllocator_v14_2_1 *theAllocator) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( - /* [in] */ BMDAudioSampleRate sampleRate, - /* [in] */ BMDAudioSampleType sampleType, - /* [in] */ unsigned int channelCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAvailableAudioSampleFrameCount( - /* [out] */ unsigned int *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_v14_2_1 *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkInput_v14_2_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkInput_v14_2_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkInput_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkInput_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v14_2_1, DoesSupportVideoMode) - HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( - IDeckLinkInput_v14_2_1 * This, - /* [in] */ BMDVideoConnection connection, - /* [in] */ BMDDisplayMode requestedMode, - /* [in] */ BMDPixelFormat requestedPixelFormat, - /* [in] */ BMDVideoInputConversionMode conversionMode, - /* [in] */ BMDSupportedVideoModeFlags flags, - /* [out] */ BMDDisplayMode *actualMode, - /* [out] */ BOOL *supported); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v14_2_1, GetDisplayMode) - HRESULT ( STDMETHODCALLTYPE *GetDisplayMode )( - IDeckLinkInput_v14_2_1 * This, - /* [in] */ BMDDisplayMode displayMode, - /* [out] */ IDeckLinkDisplayMode **resultDisplayMode); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v14_2_1, GetDisplayModeIterator) - HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( - IDeckLinkInput_v14_2_1 * This, - /* [out] */ IDeckLinkDisplayModeIterator **iterator); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v14_2_1, SetScreenPreviewCallback) - HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( - IDeckLinkInput_v14_2_1 * This, - /* [in] */ IDeckLinkScreenPreviewCallback_v14_2_1 *previewCallback); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v14_2_1, EnableVideoInput) - HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( - IDeckLinkInput_v14_2_1 * This, - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDVideoInputFlags flags); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v14_2_1, DisableVideoInput) - HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( - IDeckLinkInput_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v14_2_1, GetAvailableVideoFrameCount) - HRESULT ( STDMETHODCALLTYPE *GetAvailableVideoFrameCount )( - IDeckLinkInput_v14_2_1 * This, - /* [out] */ unsigned int *availableFrameCount); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v14_2_1, SetVideoInputFrameMemoryAllocator) - HRESULT ( STDMETHODCALLTYPE *SetVideoInputFrameMemoryAllocator )( - IDeckLinkInput_v14_2_1 * This, - /* [in] */ IDeckLinkMemoryAllocator_v14_2_1 *theAllocator); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v14_2_1, EnableAudioInput) - HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( - IDeckLinkInput_v14_2_1 * This, - /* [in] */ BMDAudioSampleRate sampleRate, - /* [in] */ BMDAudioSampleType sampleType, - /* [in] */ unsigned int channelCount); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v14_2_1, DisableAudioInput) - HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( - IDeckLinkInput_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v14_2_1, GetAvailableAudioSampleFrameCount) - HRESULT ( STDMETHODCALLTYPE *GetAvailableAudioSampleFrameCount )( - IDeckLinkInput_v14_2_1 * This, - /* [out] */ unsigned int *availableSampleFrameCount); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v14_2_1, StartStreams) - HRESULT ( STDMETHODCALLTYPE *StartStreams )( - IDeckLinkInput_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v14_2_1, StopStreams) - HRESULT ( STDMETHODCALLTYPE *StopStreams )( - IDeckLinkInput_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v14_2_1, PauseStreams) - HRESULT ( STDMETHODCALLTYPE *PauseStreams )( - IDeckLinkInput_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v14_2_1, FlushStreams) - HRESULT ( STDMETHODCALLTYPE *FlushStreams )( - IDeckLinkInput_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v14_2_1, SetCallback) - HRESULT ( STDMETHODCALLTYPE *SetCallback )( - IDeckLinkInput_v14_2_1 * This, - /* [in] */ IDeckLinkInputCallback_v14_2_1 *theCallback); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v14_2_1, GetHardwareReferenceClock) - HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( - IDeckLinkInput_v14_2_1 * This, - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame); - - END_INTERFACE - } IDeckLinkInput_v14_2_1Vtbl; - - interface IDeckLinkInput_v14_2_1 - { - CONST_VTBL struct IDeckLinkInput_v14_2_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkInput_v14_2_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkInput_v14_2_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkInput_v14_2_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkInput_v14_2_1_DoesSupportVideoMode(This,connection,requestedMode,requestedPixelFormat,conversionMode,flags,actualMode,supported) \ - ( (This)->lpVtbl -> DoesSupportVideoMode(This,connection,requestedMode,requestedPixelFormat,conversionMode,flags,actualMode,supported) ) - -#define IDeckLinkInput_v14_2_1_GetDisplayMode(This,displayMode,resultDisplayMode) \ - ( (This)->lpVtbl -> GetDisplayMode(This,displayMode,resultDisplayMode) ) - -#define IDeckLinkInput_v14_2_1_GetDisplayModeIterator(This,iterator) \ - ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) - -#define IDeckLinkInput_v14_2_1_SetScreenPreviewCallback(This,previewCallback) \ - ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) - -#define IDeckLinkInput_v14_2_1_EnableVideoInput(This,displayMode,pixelFormat,flags) \ - ( (This)->lpVtbl -> EnableVideoInput(This,displayMode,pixelFormat,flags) ) - -#define IDeckLinkInput_v14_2_1_DisableVideoInput(This) \ - ( (This)->lpVtbl -> DisableVideoInput(This) ) - -#define IDeckLinkInput_v14_2_1_GetAvailableVideoFrameCount(This,availableFrameCount) \ - ( (This)->lpVtbl -> GetAvailableVideoFrameCount(This,availableFrameCount) ) - -#define IDeckLinkInput_v14_2_1_SetVideoInputFrameMemoryAllocator(This,theAllocator) \ - ( (This)->lpVtbl -> SetVideoInputFrameMemoryAllocator(This,theAllocator) ) - -#define IDeckLinkInput_v14_2_1_EnableAudioInput(This,sampleRate,sampleType,channelCount) \ - ( (This)->lpVtbl -> EnableAudioInput(This,sampleRate,sampleType,channelCount) ) - -#define IDeckLinkInput_v14_2_1_DisableAudioInput(This) \ - ( (This)->lpVtbl -> DisableAudioInput(This) ) - -#define IDeckLinkInput_v14_2_1_GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) \ - ( (This)->lpVtbl -> GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) ) - -#define IDeckLinkInput_v14_2_1_StartStreams(This) \ - ( (This)->lpVtbl -> StartStreams(This) ) - -#define IDeckLinkInput_v14_2_1_StopStreams(This) \ - ( (This)->lpVtbl -> StopStreams(This) ) - -#define IDeckLinkInput_v14_2_1_PauseStreams(This) \ - ( (This)->lpVtbl -> PauseStreams(This) ) - -#define IDeckLinkInput_v14_2_1_FlushStreams(This) \ - ( (This)->lpVtbl -> FlushStreams(This) ) - -#define IDeckLinkInput_v14_2_1_SetCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetCallback(This,theCallback) ) - -#define IDeckLinkInput_v14_2_1_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) \ - ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkInput_v14_2_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkEncoderInput_v14_2_1_INTERFACE_DEFINED__ -#define __IDeckLinkEncoderInput_v14_2_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkEncoderInput_v14_2_1 */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkEncoderInput_v14_2_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("F222551D-13DF-4FD8-B587-9D4F19EC12C9") - IDeckLinkEncoderInput_v14_2_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( - /* [in] */ BMDVideoConnection connection, - /* [in] */ BMDDisplayMode requestedMode, - /* [in] */ BMDPixelFormat requestedCodec, - /* [in] */ unsigned int requestedCodecProfile, - /* [in] */ BMDSupportedVideoModeFlags flags, - /* [out] */ BOOL *supported) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayMode( - /* [in] */ BMDDisplayMode displayMode, - /* [out] */ IDeckLinkDisplayMode **resultDisplayMode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( - /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDVideoInputFlags flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAvailablePacketsCount( - /* [out] */ unsigned int *availablePacketsCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetMemoryAllocator( - /* [in] */ IDeckLinkMemoryAllocator_v14_2_1 *theAllocator) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( - /* [in] */ BMDAudioFormat audioFormat, - /* [in] */ BMDAudioSampleRate sampleRate, - /* [in] */ BMDAudioSampleType sampleType, - /* [in] */ unsigned int channelCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAvailableAudioSampleFrameCount( - /* [out] */ unsigned int *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] */ IDeckLinkEncoderInputCallback *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkEncoderInput_v14_2_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkEncoderInput_v14_2_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkEncoderInput_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkEncoderInput_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v14_2_1, DoesSupportVideoMode) - HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( - IDeckLinkEncoderInput_v14_2_1 * This, - /* [in] */ BMDVideoConnection connection, - /* [in] */ BMDDisplayMode requestedMode, - /* [in] */ BMDPixelFormat requestedCodec, - /* [in] */ unsigned int requestedCodecProfile, - /* [in] */ BMDSupportedVideoModeFlags flags, - /* [out] */ BOOL *supported); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v14_2_1, GetDisplayMode) - HRESULT ( STDMETHODCALLTYPE *GetDisplayMode )( - IDeckLinkEncoderInput_v14_2_1 * This, - /* [in] */ BMDDisplayMode displayMode, - /* [out] */ IDeckLinkDisplayMode **resultDisplayMode); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v14_2_1, GetDisplayModeIterator) - HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( - IDeckLinkEncoderInput_v14_2_1 * This, - /* [out] */ IDeckLinkDisplayModeIterator **iterator); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v14_2_1, EnableVideoInput) - HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( - IDeckLinkEncoderInput_v14_2_1 * This, - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDVideoInputFlags flags); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v14_2_1, DisableVideoInput) - HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( - IDeckLinkEncoderInput_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v14_2_1, GetAvailablePacketsCount) - HRESULT ( STDMETHODCALLTYPE *GetAvailablePacketsCount )( - IDeckLinkEncoderInput_v14_2_1 * This, - /* [out] */ unsigned int *availablePacketsCount); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v14_2_1, SetMemoryAllocator) - HRESULT ( STDMETHODCALLTYPE *SetMemoryAllocator )( - IDeckLinkEncoderInput_v14_2_1 * This, - /* [in] */ IDeckLinkMemoryAllocator_v14_2_1 *theAllocator); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v14_2_1, EnableAudioInput) - HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( - IDeckLinkEncoderInput_v14_2_1 * This, - /* [in] */ BMDAudioFormat audioFormat, - /* [in] */ BMDAudioSampleRate sampleRate, - /* [in] */ BMDAudioSampleType sampleType, - /* [in] */ unsigned int channelCount); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v14_2_1, DisableAudioInput) - HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( - IDeckLinkEncoderInput_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v14_2_1, GetAvailableAudioSampleFrameCount) - HRESULT ( STDMETHODCALLTYPE *GetAvailableAudioSampleFrameCount )( - IDeckLinkEncoderInput_v14_2_1 * This, - /* [out] */ unsigned int *availableSampleFrameCount); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v14_2_1, StartStreams) - HRESULT ( STDMETHODCALLTYPE *StartStreams )( - IDeckLinkEncoderInput_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v14_2_1, StopStreams) - HRESULT ( STDMETHODCALLTYPE *StopStreams )( - IDeckLinkEncoderInput_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v14_2_1, PauseStreams) - HRESULT ( STDMETHODCALLTYPE *PauseStreams )( - IDeckLinkEncoderInput_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v14_2_1, FlushStreams) - HRESULT ( STDMETHODCALLTYPE *FlushStreams )( - IDeckLinkEncoderInput_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v14_2_1, SetCallback) - HRESULT ( STDMETHODCALLTYPE *SetCallback )( - IDeckLinkEncoderInput_v14_2_1 * This, - /* [in] */ IDeckLinkEncoderInputCallback *theCallback); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v14_2_1, GetHardwareReferenceClock) - HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( - IDeckLinkEncoderInput_v14_2_1 * This, - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame); - - END_INTERFACE - } IDeckLinkEncoderInput_v14_2_1Vtbl; - - interface IDeckLinkEncoderInput_v14_2_1 - { - CONST_VTBL struct IDeckLinkEncoderInput_v14_2_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkEncoderInput_v14_2_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkEncoderInput_v14_2_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkEncoderInput_v14_2_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkEncoderInput_v14_2_1_DoesSupportVideoMode(This,connection,requestedMode,requestedCodec,requestedCodecProfile,flags,supported) \ - ( (This)->lpVtbl -> DoesSupportVideoMode(This,connection,requestedMode,requestedCodec,requestedCodecProfile,flags,supported) ) - -#define IDeckLinkEncoderInput_v14_2_1_GetDisplayMode(This,displayMode,resultDisplayMode) \ - ( (This)->lpVtbl -> GetDisplayMode(This,displayMode,resultDisplayMode) ) - -#define IDeckLinkEncoderInput_v14_2_1_GetDisplayModeIterator(This,iterator) \ - ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) - -#define IDeckLinkEncoderInput_v14_2_1_EnableVideoInput(This,displayMode,pixelFormat,flags) \ - ( (This)->lpVtbl -> EnableVideoInput(This,displayMode,pixelFormat,flags) ) - -#define IDeckLinkEncoderInput_v14_2_1_DisableVideoInput(This) \ - ( (This)->lpVtbl -> DisableVideoInput(This) ) - -#define IDeckLinkEncoderInput_v14_2_1_GetAvailablePacketsCount(This,availablePacketsCount) \ - ( (This)->lpVtbl -> GetAvailablePacketsCount(This,availablePacketsCount) ) - -#define IDeckLinkEncoderInput_v14_2_1_SetMemoryAllocator(This,theAllocator) \ - ( (This)->lpVtbl -> SetMemoryAllocator(This,theAllocator) ) - -#define IDeckLinkEncoderInput_v14_2_1_EnableAudioInput(This,audioFormat,sampleRate,sampleType,channelCount) \ - ( (This)->lpVtbl -> EnableAudioInput(This,audioFormat,sampleRate,sampleType,channelCount) ) - -#define IDeckLinkEncoderInput_v14_2_1_DisableAudioInput(This) \ - ( (This)->lpVtbl -> DisableAudioInput(This) ) - -#define IDeckLinkEncoderInput_v14_2_1_GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) \ - ( (This)->lpVtbl -> GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) ) - -#define IDeckLinkEncoderInput_v14_2_1_StartStreams(This) \ - ( (This)->lpVtbl -> StartStreams(This) ) - -#define IDeckLinkEncoderInput_v14_2_1_StopStreams(This) \ - ( (This)->lpVtbl -> StopStreams(This) ) - -#define IDeckLinkEncoderInput_v14_2_1_PauseStreams(This) \ - ( (This)->lpVtbl -> PauseStreams(This) ) - -#define IDeckLinkEncoderInput_v14_2_1_FlushStreams(This) \ - ( (This)->lpVtbl -> FlushStreams(This) ) - -#define IDeckLinkEncoderInput_v14_2_1_SetCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetCallback(This,theCallback) ) - -#define IDeckLinkEncoderInput_v14_2_1_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) \ - ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkEncoderInput_v14_2_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkVideoFrame_v14_2_1_INTERFACE_DEFINED__ -#define __IDeckLinkVideoFrame_v14_2_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoFrame_v14_2_1 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoFrame_v14_2_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("3F716FE0-F023-4111-BE5D-EF4414C05B17") - IDeckLinkVideoFrame_v14_2_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( - /* [out] */ void **buffer) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetTimecode( - /* [in] */ BMDTimecodeFormat format, - /* [out] */ IDeckLinkTimecode **timecode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAncillaryData( - /* [out] */ IDeckLinkVideoFrameAncillary **ancillary) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkVideoFrame_v14_2_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoFrame_v14_2_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoFrame_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoFrame_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame_v14_2_1, GetWidth) - long ( STDMETHODCALLTYPE *GetWidth )( - IDeckLinkVideoFrame_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame_v14_2_1, GetHeight) - long ( STDMETHODCALLTYPE *GetHeight )( - IDeckLinkVideoFrame_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame_v14_2_1, GetRowBytes) - long ( STDMETHODCALLTYPE *GetRowBytes )( - IDeckLinkVideoFrame_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame_v14_2_1, GetPixelFormat) - BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( - IDeckLinkVideoFrame_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame_v14_2_1, GetFlags) - BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( - IDeckLinkVideoFrame_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame_v14_2_1, GetBytes) - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IDeckLinkVideoFrame_v14_2_1 * This, - /* [out] */ void **buffer); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame_v14_2_1, GetTimecode) - HRESULT ( STDMETHODCALLTYPE *GetTimecode )( - IDeckLinkVideoFrame_v14_2_1 * This, - /* [in] */ BMDTimecodeFormat format, - /* [out] */ IDeckLinkTimecode **timecode); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame_v14_2_1, GetAncillaryData) - HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( - IDeckLinkVideoFrame_v14_2_1 * This, - /* [out] */ IDeckLinkVideoFrameAncillary **ancillary); - - END_INTERFACE - } IDeckLinkVideoFrame_v14_2_1Vtbl; - - interface IDeckLinkVideoFrame_v14_2_1 - { - CONST_VTBL struct IDeckLinkVideoFrame_v14_2_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoFrame_v14_2_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoFrame_v14_2_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoFrame_v14_2_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoFrame_v14_2_1_GetWidth(This) \ - ( (This)->lpVtbl -> GetWidth(This) ) - -#define IDeckLinkVideoFrame_v14_2_1_GetHeight(This) \ - ( (This)->lpVtbl -> GetHeight(This) ) - -#define IDeckLinkVideoFrame_v14_2_1_GetRowBytes(This) \ - ( (This)->lpVtbl -> GetRowBytes(This) ) - -#define IDeckLinkVideoFrame_v14_2_1_GetPixelFormat(This) \ - ( (This)->lpVtbl -> GetPixelFormat(This) ) - -#define IDeckLinkVideoFrame_v14_2_1_GetFlags(This) \ - ( (This)->lpVtbl -> GetFlags(This) ) - -#define IDeckLinkVideoFrame_v14_2_1_GetBytes(This,buffer) \ - ( (This)->lpVtbl -> GetBytes(This,buffer) ) - -#define IDeckLinkVideoFrame_v14_2_1_GetTimecode(This,format,timecode) \ - ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) - -#define IDeckLinkVideoFrame_v14_2_1_GetAncillaryData(This,ancillary) \ - ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoFrame_v14_2_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkMutableVideoFrame_v14_2_1_INTERFACE_DEFINED__ -#define __IDeckLinkMutableVideoFrame_v14_2_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkMutableVideoFrame_v14_2_1 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkMutableVideoFrame_v14_2_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("69E2639F-40DA-4E19-B6F2-20ACE815C390") - IDeckLinkMutableVideoFrame_v14_2_1 : public IDeckLinkVideoFrame_v14_2_1 - { - public: - virtual HRESULT STDMETHODCALLTYPE SetFlags( - /* [in] */ BMDFrameFlags newFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetTimecode( - /* [in] */ BMDTimecodeFormat format, - /* [in] */ IDeckLinkTimecode *timecode) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetTimecodeFromComponents( - /* [in] */ BMDTimecodeFormat format, - /* [in] */ unsigned char hours, - /* [in] */ unsigned char minutes, - /* [in] */ unsigned char seconds, - /* [in] */ unsigned char frames, - /* [in] */ BMDTimecodeFlags flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetAncillaryData( - /* [in] */ IDeckLinkVideoFrameAncillary *ancillary) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetTimecodeUserBits( - /* [in] */ BMDTimecodeFormat format, - /* [in] */ BMDTimecodeUserBits userBits) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkMutableVideoFrame_v14_2_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkMutableVideoFrame_v14_2_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkMutableVideoFrame_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkMutableVideoFrame_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame_v14_2_1, GetWidth) - long ( STDMETHODCALLTYPE *GetWidth )( - IDeckLinkMutableVideoFrame_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame_v14_2_1, GetHeight) - long ( STDMETHODCALLTYPE *GetHeight )( - IDeckLinkMutableVideoFrame_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame_v14_2_1, GetRowBytes) - long ( STDMETHODCALLTYPE *GetRowBytes )( - IDeckLinkMutableVideoFrame_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame_v14_2_1, GetPixelFormat) - BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( - IDeckLinkMutableVideoFrame_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame_v14_2_1, GetFlags) - BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( - IDeckLinkMutableVideoFrame_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame_v14_2_1, GetBytes) - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IDeckLinkMutableVideoFrame_v14_2_1 * This, - /* [out] */ void **buffer); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame_v14_2_1, GetTimecode) - HRESULT ( STDMETHODCALLTYPE *GetTimecode )( - IDeckLinkMutableVideoFrame_v14_2_1 * This, - /* [in] */ BMDTimecodeFormat format, - /* [out] */ IDeckLinkTimecode **timecode); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame_v14_2_1, GetAncillaryData) - HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( - IDeckLinkMutableVideoFrame_v14_2_1 * This, - /* [out] */ IDeckLinkVideoFrameAncillary **ancillary); - - DECLSPEC_XFGVIRT(IDeckLinkMutableVideoFrame_v14_2_1, SetFlags) - HRESULT ( STDMETHODCALLTYPE *SetFlags )( - IDeckLinkMutableVideoFrame_v14_2_1 * This, - /* [in] */ BMDFrameFlags newFlags); - - DECLSPEC_XFGVIRT(IDeckLinkMutableVideoFrame_v14_2_1, SetTimecode) - HRESULT ( STDMETHODCALLTYPE *SetTimecode )( - IDeckLinkMutableVideoFrame_v14_2_1 * This, - /* [in] */ BMDTimecodeFormat format, - /* [in] */ IDeckLinkTimecode *timecode); - - DECLSPEC_XFGVIRT(IDeckLinkMutableVideoFrame_v14_2_1, SetTimecodeFromComponents) - HRESULT ( STDMETHODCALLTYPE *SetTimecodeFromComponents )( - IDeckLinkMutableVideoFrame_v14_2_1 * This, - /* [in] */ BMDTimecodeFormat format, - /* [in] */ unsigned char hours, - /* [in] */ unsigned char minutes, - /* [in] */ unsigned char seconds, - /* [in] */ unsigned char frames, - /* [in] */ BMDTimecodeFlags flags); - - DECLSPEC_XFGVIRT(IDeckLinkMutableVideoFrame_v14_2_1, SetAncillaryData) - HRESULT ( STDMETHODCALLTYPE *SetAncillaryData )( - IDeckLinkMutableVideoFrame_v14_2_1 * This, - /* [in] */ IDeckLinkVideoFrameAncillary *ancillary); - - DECLSPEC_XFGVIRT(IDeckLinkMutableVideoFrame_v14_2_1, SetTimecodeUserBits) - HRESULT ( STDMETHODCALLTYPE *SetTimecodeUserBits )( - IDeckLinkMutableVideoFrame_v14_2_1 * This, - /* [in] */ BMDTimecodeFormat format, - /* [in] */ BMDTimecodeUserBits userBits); - - END_INTERFACE - } IDeckLinkMutableVideoFrame_v14_2_1Vtbl; - - interface IDeckLinkMutableVideoFrame_v14_2_1 - { - CONST_VTBL struct IDeckLinkMutableVideoFrame_v14_2_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkMutableVideoFrame_v14_2_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkMutableVideoFrame_v14_2_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkMutableVideoFrame_v14_2_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkMutableVideoFrame_v14_2_1_GetWidth(This) \ - ( (This)->lpVtbl -> GetWidth(This) ) - -#define IDeckLinkMutableVideoFrame_v14_2_1_GetHeight(This) \ - ( (This)->lpVtbl -> GetHeight(This) ) - -#define IDeckLinkMutableVideoFrame_v14_2_1_GetRowBytes(This) \ - ( (This)->lpVtbl -> GetRowBytes(This) ) - -#define IDeckLinkMutableVideoFrame_v14_2_1_GetPixelFormat(This) \ - ( (This)->lpVtbl -> GetPixelFormat(This) ) - -#define IDeckLinkMutableVideoFrame_v14_2_1_GetFlags(This) \ - ( (This)->lpVtbl -> GetFlags(This) ) - -#define IDeckLinkMutableVideoFrame_v14_2_1_GetBytes(This,buffer) \ - ( (This)->lpVtbl -> GetBytes(This,buffer) ) - -#define IDeckLinkMutableVideoFrame_v14_2_1_GetTimecode(This,format,timecode) \ - ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) - -#define IDeckLinkMutableVideoFrame_v14_2_1_GetAncillaryData(This,ancillary) \ - ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) - - -#define IDeckLinkMutableVideoFrame_v14_2_1_SetFlags(This,newFlags) \ - ( (This)->lpVtbl -> SetFlags(This,newFlags) ) - -#define IDeckLinkMutableVideoFrame_v14_2_1_SetTimecode(This,format,timecode) \ - ( (This)->lpVtbl -> SetTimecode(This,format,timecode) ) - -#define IDeckLinkMutableVideoFrame_v14_2_1_SetTimecodeFromComponents(This,format,hours,minutes,seconds,frames,flags) \ - ( (This)->lpVtbl -> SetTimecodeFromComponents(This,format,hours,minutes,seconds,frames,flags) ) - -#define IDeckLinkMutableVideoFrame_v14_2_1_SetAncillaryData(This,ancillary) \ - ( (This)->lpVtbl -> SetAncillaryData(This,ancillary) ) - -#define IDeckLinkMutableVideoFrame_v14_2_1_SetTimecodeUserBits(This,format,userBits) \ - ( (This)->lpVtbl -> SetTimecodeUserBits(This,format,userBits) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkMutableVideoFrame_v14_2_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkVideoFrame3DExtensions_v14_2_1_INTERFACE_DEFINED__ -#define __IDeckLinkVideoFrame3DExtensions_v14_2_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoFrame3DExtensions_v14_2_1 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoFrame3DExtensions_v14_2_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("DA0F7E4A-EDC7-48A8-9CDD-2DB51C729CD7") - IDeckLinkVideoFrame3DExtensions_v14_2_1 : public IUnknown - { - public: - virtual BMDVideo3DPackingFormat STDMETHODCALLTYPE Get3DPackingFormat( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFrameForRightEye( - /* [out] */ IDeckLinkVideoFrame_v14_2_1 **rightEyeFrame) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkVideoFrame3DExtensions_v14_2_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoFrame3DExtensions_v14_2_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoFrame3DExtensions_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoFrame3DExtensions_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame3DExtensions_v14_2_1, Get3DPackingFormat) - BMDVideo3DPackingFormat ( STDMETHODCALLTYPE *Get3DPackingFormat )( - IDeckLinkVideoFrame3DExtensions_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame3DExtensions_v14_2_1, GetFrameForRightEye) - HRESULT ( STDMETHODCALLTYPE *GetFrameForRightEye )( - IDeckLinkVideoFrame3DExtensions_v14_2_1 * This, - /* [out] */ IDeckLinkVideoFrame_v14_2_1 **rightEyeFrame); - - END_INTERFACE - } IDeckLinkVideoFrame3DExtensions_v14_2_1Vtbl; - - interface IDeckLinkVideoFrame3DExtensions_v14_2_1 - { - CONST_VTBL struct IDeckLinkVideoFrame3DExtensions_v14_2_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoFrame3DExtensions_v14_2_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoFrame3DExtensions_v14_2_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoFrame3DExtensions_v14_2_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoFrame3DExtensions_v14_2_1_Get3DPackingFormat(This) \ - ( (This)->lpVtbl -> Get3DPackingFormat(This) ) - -#define IDeckLinkVideoFrame3DExtensions_v14_2_1_GetFrameForRightEye(This,rightEyeFrame) \ - ( (This)->lpVtbl -> GetFrameForRightEye(This,rightEyeFrame) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoFrame3DExtensions_v14_2_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkVideoInputFrame_v14_2_1_INTERFACE_DEFINED__ -#define __IDeckLinkVideoInputFrame_v14_2_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoInputFrame_v14_2_1 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoInputFrame_v14_2_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("05CFE374-537C-4094-9A57-680525118F44") - IDeckLinkVideoInputFrame_v14_2_1 : public IDeckLinkVideoFrame_v14_2_1 - { - public: - virtual HRESULT STDMETHODCALLTYPE GetStreamTime( - /* [out] */ BMDTimeValue *frameTime, - /* [out] */ BMDTimeValue *frameDuration, - /* [in] */ BMDTimeScale timeScale) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceTimestamp( - /* [in] */ BMDTimeScale timeScale, - /* [out] */ BMDTimeValue *frameTime, - /* [out] */ BMDTimeValue *frameDuration) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkVideoInputFrame_v14_2_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoInputFrame_v14_2_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoInputFrame_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoInputFrame_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame_v14_2_1, GetWidth) - long ( STDMETHODCALLTYPE *GetWidth )( - IDeckLinkVideoInputFrame_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame_v14_2_1, GetHeight) - long ( STDMETHODCALLTYPE *GetHeight )( - IDeckLinkVideoInputFrame_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame_v14_2_1, GetRowBytes) - long ( STDMETHODCALLTYPE *GetRowBytes )( - IDeckLinkVideoInputFrame_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame_v14_2_1, GetPixelFormat) - BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( - IDeckLinkVideoInputFrame_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame_v14_2_1, GetFlags) - BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( - IDeckLinkVideoInputFrame_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame_v14_2_1, GetBytes) - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IDeckLinkVideoInputFrame_v14_2_1 * This, - /* [out] */ void **buffer); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame_v14_2_1, GetTimecode) - HRESULT ( STDMETHODCALLTYPE *GetTimecode )( - IDeckLinkVideoInputFrame_v14_2_1 * This, - /* [in] */ BMDTimecodeFormat format, - /* [out] */ IDeckLinkTimecode **timecode); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrame_v14_2_1, GetAncillaryData) - HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( - IDeckLinkVideoInputFrame_v14_2_1 * This, - /* [out] */ IDeckLinkVideoFrameAncillary **ancillary); - - DECLSPEC_XFGVIRT(IDeckLinkVideoInputFrame_v14_2_1, GetStreamTime) - HRESULT ( STDMETHODCALLTYPE *GetStreamTime )( - IDeckLinkVideoInputFrame_v14_2_1 * This, - /* [out] */ BMDTimeValue *frameTime, - /* [out] */ BMDTimeValue *frameDuration, - /* [in] */ BMDTimeScale timeScale); - - DECLSPEC_XFGVIRT(IDeckLinkVideoInputFrame_v14_2_1, GetHardwareReferenceTimestamp) - HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceTimestamp )( - IDeckLinkVideoInputFrame_v14_2_1 * This, - /* [in] */ BMDTimeScale timeScale, - /* [out] */ BMDTimeValue *frameTime, - /* [out] */ BMDTimeValue *frameDuration); - - END_INTERFACE - } IDeckLinkVideoInputFrame_v14_2_1Vtbl; - - interface IDeckLinkVideoInputFrame_v14_2_1 - { - CONST_VTBL struct IDeckLinkVideoInputFrame_v14_2_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoInputFrame_v14_2_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoInputFrame_v14_2_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoInputFrame_v14_2_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoInputFrame_v14_2_1_GetWidth(This) \ - ( (This)->lpVtbl -> GetWidth(This) ) - -#define IDeckLinkVideoInputFrame_v14_2_1_GetHeight(This) \ - ( (This)->lpVtbl -> GetHeight(This) ) - -#define IDeckLinkVideoInputFrame_v14_2_1_GetRowBytes(This) \ - ( (This)->lpVtbl -> GetRowBytes(This) ) - -#define IDeckLinkVideoInputFrame_v14_2_1_GetPixelFormat(This) \ - ( (This)->lpVtbl -> GetPixelFormat(This) ) - -#define IDeckLinkVideoInputFrame_v14_2_1_GetFlags(This) \ - ( (This)->lpVtbl -> GetFlags(This) ) - -#define IDeckLinkVideoInputFrame_v14_2_1_GetBytes(This,buffer) \ - ( (This)->lpVtbl -> GetBytes(This,buffer) ) - -#define IDeckLinkVideoInputFrame_v14_2_1_GetTimecode(This,format,timecode) \ - ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) - -#define IDeckLinkVideoInputFrame_v14_2_1_GetAncillaryData(This,ancillary) \ - ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) - - -#define IDeckLinkVideoInputFrame_v14_2_1_GetStreamTime(This,frameTime,frameDuration,timeScale) \ - ( (This)->lpVtbl -> GetStreamTime(This,frameTime,frameDuration,timeScale) ) - -#define IDeckLinkVideoInputFrame_v14_2_1_GetHardwareReferenceTimestamp(This,timeScale,frameTime,frameDuration) \ - ( (This)->lpVtbl -> GetHardwareReferenceTimestamp(This,timeScale,frameTime,frameDuration) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoInputFrame_v14_2_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkScreenPreviewCallback_v14_2_1_INTERFACE_DEFINED__ -#define __IDeckLinkScreenPreviewCallback_v14_2_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkScreenPreviewCallback_v14_2_1 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkScreenPreviewCallback_v14_2_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("B1D3F49A-85FE-4C5D-95C8-0B5D5DCCD438") - IDeckLinkScreenPreviewCallback_v14_2_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DrawFrame( - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkScreenPreviewCallback_v14_2_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkScreenPreviewCallback_v14_2_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkScreenPreviewCallback_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkScreenPreviewCallback_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkScreenPreviewCallback_v14_2_1, DrawFrame) - HRESULT ( STDMETHODCALLTYPE *DrawFrame )( - IDeckLinkScreenPreviewCallback_v14_2_1 * This, - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame); - - END_INTERFACE - } IDeckLinkScreenPreviewCallback_v14_2_1Vtbl; - - interface IDeckLinkScreenPreviewCallback_v14_2_1 - { - CONST_VTBL struct IDeckLinkScreenPreviewCallback_v14_2_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkScreenPreviewCallback_v14_2_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkScreenPreviewCallback_v14_2_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkScreenPreviewCallback_v14_2_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkScreenPreviewCallback_v14_2_1_DrawFrame(This,theFrame) \ - ( (This)->lpVtbl -> DrawFrame(This,theFrame) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkScreenPreviewCallback_v14_2_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkGLScreenPreviewHelper_v14_2_1_INTERFACE_DEFINED__ -#define __IDeckLinkGLScreenPreviewHelper_v14_2_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkGLScreenPreviewHelper_v14_2_1 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkGLScreenPreviewHelper_v14_2_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("504E2209-CAC7-4C1A-9FB4-C5BB6274D22F") - IDeckLinkGLScreenPreviewHelper_v14_2_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE InitializeGL( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE PaintGL( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFrame( - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE Set3DPreviewFormat( - /* [in] */ BMD3DPreviewFormat previewFormat) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkGLScreenPreviewHelper_v14_2_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkGLScreenPreviewHelper_v14_2_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkGLScreenPreviewHelper_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkGLScreenPreviewHelper_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkGLScreenPreviewHelper_v14_2_1, InitializeGL) - HRESULT ( STDMETHODCALLTYPE *InitializeGL )( - IDeckLinkGLScreenPreviewHelper_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkGLScreenPreviewHelper_v14_2_1, PaintGL) - HRESULT ( STDMETHODCALLTYPE *PaintGL )( - IDeckLinkGLScreenPreviewHelper_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkGLScreenPreviewHelper_v14_2_1, SetFrame) - HRESULT ( STDMETHODCALLTYPE *SetFrame )( - IDeckLinkGLScreenPreviewHelper_v14_2_1 * This, - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame); - - DECLSPEC_XFGVIRT(IDeckLinkGLScreenPreviewHelper_v14_2_1, Set3DPreviewFormat) - HRESULT ( STDMETHODCALLTYPE *Set3DPreviewFormat )( - IDeckLinkGLScreenPreviewHelper_v14_2_1 * This, - /* [in] */ BMD3DPreviewFormat previewFormat); - - END_INTERFACE - } IDeckLinkGLScreenPreviewHelper_v14_2_1Vtbl; - - interface IDeckLinkGLScreenPreviewHelper_v14_2_1 - { - CONST_VTBL struct IDeckLinkGLScreenPreviewHelper_v14_2_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkGLScreenPreviewHelper_v14_2_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkGLScreenPreviewHelper_v14_2_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkGLScreenPreviewHelper_v14_2_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkGLScreenPreviewHelper_v14_2_1_InitializeGL(This) \ - ( (This)->lpVtbl -> InitializeGL(This) ) - -#define IDeckLinkGLScreenPreviewHelper_v14_2_1_PaintGL(This) \ - ( (This)->lpVtbl -> PaintGL(This) ) - -#define IDeckLinkGLScreenPreviewHelper_v14_2_1_SetFrame(This,theFrame) \ - ( (This)->lpVtbl -> SetFrame(This,theFrame) ) - -#define IDeckLinkGLScreenPreviewHelper_v14_2_1_Set3DPreviewFormat(This,previewFormat) \ - ( (This)->lpVtbl -> Set3DPreviewFormat(This,previewFormat) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkGLScreenPreviewHelper_v14_2_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkDX9ScreenPreviewHelper_v14_2_1_INTERFACE_DEFINED__ -#define __IDeckLinkDX9ScreenPreviewHelper_v14_2_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkDX9ScreenPreviewHelper_v14_2_1 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkDX9ScreenPreviewHelper_v14_2_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("2094B522-D1A1-40C0-9AC7-1C012218EF02") - IDeckLinkDX9ScreenPreviewHelper_v14_2_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Initialize( - /* [in] */ void *device) = 0; - - virtual HRESULT STDMETHODCALLTYPE Render( - /* [in] */ RECT *rc) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFrame( - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE Set3DPreviewFormat( - /* [in] */ BMD3DPreviewFormat previewFormat) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkDX9ScreenPreviewHelper_v14_2_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkDX9ScreenPreviewHelper_v14_2_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkDX9ScreenPreviewHelper_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkDX9ScreenPreviewHelper_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkDX9ScreenPreviewHelper_v14_2_1, Initialize) - HRESULT ( STDMETHODCALLTYPE *Initialize )( - IDeckLinkDX9ScreenPreviewHelper_v14_2_1 * This, - /* [in] */ void *device); - - DECLSPEC_XFGVIRT(IDeckLinkDX9ScreenPreviewHelper_v14_2_1, Render) - HRESULT ( STDMETHODCALLTYPE *Render )( - IDeckLinkDX9ScreenPreviewHelper_v14_2_1 * This, - /* [in] */ RECT *rc); - - DECLSPEC_XFGVIRT(IDeckLinkDX9ScreenPreviewHelper_v14_2_1, SetFrame) - HRESULT ( STDMETHODCALLTYPE *SetFrame )( - IDeckLinkDX9ScreenPreviewHelper_v14_2_1 * This, - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame); - - DECLSPEC_XFGVIRT(IDeckLinkDX9ScreenPreviewHelper_v14_2_1, Set3DPreviewFormat) - HRESULT ( STDMETHODCALLTYPE *Set3DPreviewFormat )( - IDeckLinkDX9ScreenPreviewHelper_v14_2_1 * This, - /* [in] */ BMD3DPreviewFormat previewFormat); - - END_INTERFACE - } IDeckLinkDX9ScreenPreviewHelper_v14_2_1Vtbl; - - interface IDeckLinkDX9ScreenPreviewHelper_v14_2_1 - { - CONST_VTBL struct IDeckLinkDX9ScreenPreviewHelper_v14_2_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkDX9ScreenPreviewHelper_v14_2_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkDX9ScreenPreviewHelper_v14_2_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkDX9ScreenPreviewHelper_v14_2_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkDX9ScreenPreviewHelper_v14_2_1_Initialize(This,device) \ - ( (This)->lpVtbl -> Initialize(This,device) ) - -#define IDeckLinkDX9ScreenPreviewHelper_v14_2_1_Render(This,rc) \ - ( (This)->lpVtbl -> Render(This,rc) ) - -#define IDeckLinkDX9ScreenPreviewHelper_v14_2_1_SetFrame(This,theFrame) \ - ( (This)->lpVtbl -> SetFrame(This,theFrame) ) - -#define IDeckLinkDX9ScreenPreviewHelper_v14_2_1_Set3DPreviewFormat(This,previewFormat) \ - ( (This)->lpVtbl -> Set3DPreviewFormat(This,previewFormat) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkDX9ScreenPreviewHelper_v14_2_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1_INTERFACE_DEFINED__ -#define __IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("AD8EC84A-7DDE-11E9-8F9E-2A86E4085A59") - IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Initialize( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE Render( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetSurfaceSize( - /* [in] */ unsigned int width, - /* [in] */ unsigned int height) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFrame( - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE Set3DPreviewFormat( - /* [in] */ BMD3DPreviewFormat previewFormat) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBackBuffer( - /* [out] */ void **backBuffer) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1, Initialize) - HRESULT ( STDMETHODCALLTYPE *Initialize )( - IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1, Render) - HRESULT ( STDMETHODCALLTYPE *Render )( - IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1, SetSurfaceSize) - HRESULT ( STDMETHODCALLTYPE *SetSurfaceSize )( - IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1 * This, - /* [in] */ unsigned int width, - /* [in] */ unsigned int height); - - DECLSPEC_XFGVIRT(IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1, SetFrame) - HRESULT ( STDMETHODCALLTYPE *SetFrame )( - IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1 * This, - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame); - - DECLSPEC_XFGVIRT(IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1, Set3DPreviewFormat) - HRESULT ( STDMETHODCALLTYPE *Set3DPreviewFormat )( - IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1 * This, - /* [in] */ BMD3DPreviewFormat previewFormat); - - DECLSPEC_XFGVIRT(IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1, GetBackBuffer) - HRESULT ( STDMETHODCALLTYPE *GetBackBuffer )( - IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1 * This, - /* [out] */ void **backBuffer); - - END_INTERFACE - } IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1Vtbl; - - interface IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1 - { - CONST_VTBL struct IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1_Initialize(This) \ - ( (This)->lpVtbl -> Initialize(This) ) - -#define IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1_Render(This) \ - ( (This)->lpVtbl -> Render(This) ) - -#define IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1_SetSurfaceSize(This,width,height) \ - ( (This)->lpVtbl -> SetSurfaceSize(This,width,height) ) - -#define IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1_SetFrame(This,theFrame) \ - ( (This)->lpVtbl -> SetFrame(This,theFrame) ) - -#define IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1_Set3DPreviewFormat(This,previewFormat) \ - ( (This)->lpVtbl -> Set3DPreviewFormat(This,previewFormat) ) - -#define IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1_GetBackBuffer(This,backBuffer) \ - ( (This)->lpVtbl -> GetBackBuffer(This,backBuffer) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkVideoConversion_v14_2_1_INTERFACE_DEFINED__ -#define __IDeckLinkVideoConversion_v14_2_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoConversion_v14_2_1 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoConversion_v14_2_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("3BBCB8A2-DA2C-42D9-B5D8-88083644E99A") - IDeckLinkVideoConversion_v14_2_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE ConvertFrame( - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *srcFrame, - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *dstFrame) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkVideoConversion_v14_2_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoConversion_v14_2_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoConversion_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoConversion_v14_2_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoConversion_v14_2_1, ConvertFrame) - HRESULT ( STDMETHODCALLTYPE *ConvertFrame )( - IDeckLinkVideoConversion_v14_2_1 * This, - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *srcFrame, - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *dstFrame); - - END_INTERFACE - } IDeckLinkVideoConversion_v14_2_1Vtbl; - - interface IDeckLinkVideoConversion_v14_2_1 - { - CONST_VTBL struct IDeckLinkVideoConversion_v14_2_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoConversion_v14_2_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoConversion_v14_2_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoConversion_v14_2_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoConversion_v14_2_1_ConvertFrame(This,srcFrame,dstFrame) \ - ( (This)->lpVtbl -> ConvertFrame(This,srcFrame,dstFrame) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoConversion_v14_2_1_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_CDeckLinkGLScreenPreviewHelper_v14_2_1; - -#ifdef __cplusplus - -class DECLSPEC_UUID("F63E77C7-B655-4A4A-9AD0-3CA85D394343") -CDeckLinkGLScreenPreviewHelper_v14_2_1; -#endif - -EXTERN_C const CLSID CLSID_CDeckLinkGL3ScreenPreviewHelper_v14_2_1; - -#ifdef __cplusplus - -class DECLSPEC_UUID("00696A71-EBC7-491F-AC02-18D3393F33F0") -CDeckLinkGL3ScreenPreviewHelper_v14_2_1; -#endif - -EXTERN_C const CLSID CLSID_CDeckLinkDX9ScreenPreviewHelper_v14_2_1; - -#ifdef __cplusplus - -class DECLSPEC_UUID("CC010023-E01D-4525-9D59-80C8AB3DC7A0") -CDeckLinkDX9ScreenPreviewHelper_v14_2_1; -#endif - -EXTERN_C const CLSID CLSID_CDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1; - -#ifdef __cplusplus - -class DECLSPEC_UUID("EF2A8478-7DDF-11E9-8F9E-2A86E4085A59") -CDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1; -#endif - -EXTERN_C const CLSID CLSID_CDeckLinkVideoConversion_v14_2_1; - -#ifdef __cplusplus - -class DECLSPEC_UUID("7DBBBB11-5B7B-467D-AEA4-CEA468FD368C") -CDeckLinkVideoConversion_v14_2_1; -#endif - -#ifndef __IDeckLinkInputCallback_v11_5_1_INTERFACE_DEFINED__ -#define __IDeckLinkInputCallback_v11_5_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkInputCallback_v11_5_1 */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkInputCallback_v11_5_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("DD04E5EC-7415-42AB-AE4A-E80C4DFC044A") - IDeckLinkInputCallback_v11_5_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged( - /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents, - /* [in] */ IDeckLinkDisplayMode *newDisplayMode, - /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived( - /* [in] */ IDeckLinkVideoInputFrame_v14_2_1 *videoFrame, - /* [in] */ IDeckLinkAudioInputPacket *audioPacket) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkInputCallback_v11_5_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkInputCallback_v11_5_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkInputCallback_v11_5_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkInputCallback_v11_5_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInputCallback_v11_5_1, VideoInputFormatChanged) - HRESULT ( STDMETHODCALLTYPE *VideoInputFormatChanged )( - IDeckLinkInputCallback_v11_5_1 * This, - /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents, - /* [in] */ IDeckLinkDisplayMode *newDisplayMode, - /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags); - - DECLSPEC_XFGVIRT(IDeckLinkInputCallback_v11_5_1, VideoInputFrameArrived) - HRESULT ( STDMETHODCALLTYPE *VideoInputFrameArrived )( - IDeckLinkInputCallback_v11_5_1 * This, - /* [in] */ IDeckLinkVideoInputFrame_v14_2_1 *videoFrame, - /* [in] */ IDeckLinkAudioInputPacket *audioPacket); - - END_INTERFACE - } IDeckLinkInputCallback_v11_5_1Vtbl; - - interface IDeckLinkInputCallback_v11_5_1 - { - CONST_VTBL struct IDeckLinkInputCallback_v11_5_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkInputCallback_v11_5_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkInputCallback_v11_5_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkInputCallback_v11_5_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkInputCallback_v11_5_1_VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags) \ - ( (This)->lpVtbl -> VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags) ) - -#define IDeckLinkInputCallback_v11_5_1_VideoInputFrameArrived(This,videoFrame,audioPacket) \ - ( (This)->lpVtbl -> VideoInputFrameArrived(This,videoFrame,audioPacket) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkInputCallback_v11_5_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkInput_v11_5_1_INTERFACE_DEFINED__ -#define __IDeckLinkInput_v11_5_1_INTERFACE_DEFINED__ - -/* interface IDeckLinkInput_v11_5_1 */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkInput_v11_5_1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9434C6E4-B15D-4B1C-979E-661E3DDCB4B9") - IDeckLinkInput_v11_5_1 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( - /* [in] */ BMDVideoConnection connection, - /* [in] */ BMDDisplayMode requestedMode, - /* [in] */ BMDPixelFormat requestedPixelFormat, - /* [in] */ BMDVideoInputConversionMode conversionMode, - /* [in] */ BMDSupportedVideoModeFlags flags, - /* [out] */ BMDDisplayMode *actualMode, - /* [out] */ BOOL *supported) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayMode( - /* [in] */ BMDDisplayMode displayMode, - /* [out] */ IDeckLinkDisplayMode **resultDisplayMode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( - /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( - /* [in] */ IDeckLinkScreenPreviewCallback_v14_2_1 *previewCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDVideoInputFlags flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAvailableVideoFrameCount( - /* [out] */ unsigned int *availableFrameCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetVideoInputFrameMemoryAllocator( - /* [in] */ IDeckLinkMemoryAllocator_v14_2_1 *theAllocator) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( - /* [in] */ BMDAudioSampleRate sampleRate, - /* [in] */ BMDAudioSampleType sampleType, - /* [in] */ unsigned int channelCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAvailableAudioSampleFrameCount( - /* [out] */ unsigned int *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_v11_5_1 *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkInput_v11_5_1Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkInput_v11_5_1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkInput_v11_5_1 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkInput_v11_5_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_5_1, DoesSupportVideoMode) - HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( - IDeckLinkInput_v11_5_1 * This, - /* [in] */ BMDVideoConnection connection, - /* [in] */ BMDDisplayMode requestedMode, - /* [in] */ BMDPixelFormat requestedPixelFormat, - /* [in] */ BMDVideoInputConversionMode conversionMode, - /* [in] */ BMDSupportedVideoModeFlags flags, - /* [out] */ BMDDisplayMode *actualMode, - /* [out] */ BOOL *supported); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_5_1, GetDisplayMode) - HRESULT ( STDMETHODCALLTYPE *GetDisplayMode )( - IDeckLinkInput_v11_5_1 * This, - /* [in] */ BMDDisplayMode displayMode, - /* [out] */ IDeckLinkDisplayMode **resultDisplayMode); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_5_1, GetDisplayModeIterator) - HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( - IDeckLinkInput_v11_5_1 * This, - /* [out] */ IDeckLinkDisplayModeIterator **iterator); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_5_1, SetScreenPreviewCallback) - HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( - IDeckLinkInput_v11_5_1 * This, - /* [in] */ IDeckLinkScreenPreviewCallback_v14_2_1 *previewCallback); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_5_1, EnableVideoInput) - HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( - IDeckLinkInput_v11_5_1 * This, - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDVideoInputFlags flags); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_5_1, DisableVideoInput) - HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( - IDeckLinkInput_v11_5_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_5_1, GetAvailableVideoFrameCount) - HRESULT ( STDMETHODCALLTYPE *GetAvailableVideoFrameCount )( - IDeckLinkInput_v11_5_1 * This, - /* [out] */ unsigned int *availableFrameCount); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_5_1, SetVideoInputFrameMemoryAllocator) - HRESULT ( STDMETHODCALLTYPE *SetVideoInputFrameMemoryAllocator )( - IDeckLinkInput_v11_5_1 * This, - /* [in] */ IDeckLinkMemoryAllocator_v14_2_1 *theAllocator); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_5_1, EnableAudioInput) - HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( - IDeckLinkInput_v11_5_1 * This, - /* [in] */ BMDAudioSampleRate sampleRate, - /* [in] */ BMDAudioSampleType sampleType, - /* [in] */ unsigned int channelCount); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_5_1, DisableAudioInput) - HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( - IDeckLinkInput_v11_5_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_5_1, GetAvailableAudioSampleFrameCount) - HRESULT ( STDMETHODCALLTYPE *GetAvailableAudioSampleFrameCount )( - IDeckLinkInput_v11_5_1 * This, - /* [out] */ unsigned int *availableSampleFrameCount); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_5_1, StartStreams) - HRESULT ( STDMETHODCALLTYPE *StartStreams )( - IDeckLinkInput_v11_5_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_5_1, StopStreams) - HRESULT ( STDMETHODCALLTYPE *StopStreams )( - IDeckLinkInput_v11_5_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_5_1, PauseStreams) - HRESULT ( STDMETHODCALLTYPE *PauseStreams )( - IDeckLinkInput_v11_5_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_5_1, FlushStreams) - HRESULT ( STDMETHODCALLTYPE *FlushStreams )( - IDeckLinkInput_v11_5_1 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_5_1, SetCallback) - HRESULT ( STDMETHODCALLTYPE *SetCallback )( - IDeckLinkInput_v11_5_1 * This, - /* [in] */ IDeckLinkInputCallback_v11_5_1 *theCallback); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_5_1, GetHardwareReferenceClock) - HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( - IDeckLinkInput_v11_5_1 * This, - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame); - - END_INTERFACE - } IDeckLinkInput_v11_5_1Vtbl; - - interface IDeckLinkInput_v11_5_1 - { - CONST_VTBL struct IDeckLinkInput_v11_5_1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkInput_v11_5_1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkInput_v11_5_1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkInput_v11_5_1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkInput_v11_5_1_DoesSupportVideoMode(This,connection,requestedMode,requestedPixelFormat,conversionMode,flags,actualMode,supported) \ - ( (This)->lpVtbl -> DoesSupportVideoMode(This,connection,requestedMode,requestedPixelFormat,conversionMode,flags,actualMode,supported) ) - -#define IDeckLinkInput_v11_5_1_GetDisplayMode(This,displayMode,resultDisplayMode) \ - ( (This)->lpVtbl -> GetDisplayMode(This,displayMode,resultDisplayMode) ) - -#define IDeckLinkInput_v11_5_1_GetDisplayModeIterator(This,iterator) \ - ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) - -#define IDeckLinkInput_v11_5_1_SetScreenPreviewCallback(This,previewCallback) \ - ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) - -#define IDeckLinkInput_v11_5_1_EnableVideoInput(This,displayMode,pixelFormat,flags) \ - ( (This)->lpVtbl -> EnableVideoInput(This,displayMode,pixelFormat,flags) ) - -#define IDeckLinkInput_v11_5_1_DisableVideoInput(This) \ - ( (This)->lpVtbl -> DisableVideoInput(This) ) - -#define IDeckLinkInput_v11_5_1_GetAvailableVideoFrameCount(This,availableFrameCount) \ - ( (This)->lpVtbl -> GetAvailableVideoFrameCount(This,availableFrameCount) ) - -#define IDeckLinkInput_v11_5_1_SetVideoInputFrameMemoryAllocator(This,theAllocator) \ - ( (This)->lpVtbl -> SetVideoInputFrameMemoryAllocator(This,theAllocator) ) - -#define IDeckLinkInput_v11_5_1_EnableAudioInput(This,sampleRate,sampleType,channelCount) \ - ( (This)->lpVtbl -> EnableAudioInput(This,sampleRate,sampleType,channelCount) ) - -#define IDeckLinkInput_v11_5_1_DisableAudioInput(This) \ - ( (This)->lpVtbl -> DisableAudioInput(This) ) - -#define IDeckLinkInput_v11_5_1_GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) \ - ( (This)->lpVtbl -> GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) ) - -#define IDeckLinkInput_v11_5_1_StartStreams(This) \ - ( (This)->lpVtbl -> StartStreams(This) ) - -#define IDeckLinkInput_v11_5_1_StopStreams(This) \ - ( (This)->lpVtbl -> StopStreams(This) ) - -#define IDeckLinkInput_v11_5_1_PauseStreams(This) \ - ( (This)->lpVtbl -> PauseStreams(This) ) - -#define IDeckLinkInput_v11_5_1_FlushStreams(This) \ - ( (This)->lpVtbl -> FlushStreams(This) ) - -#define IDeckLinkInput_v11_5_1_SetCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetCallback(This,theCallback) ) - -#define IDeckLinkInput_v11_5_1_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) \ - ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkInput_v11_5_1_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkConfiguration_v10_11_INTERFACE_DEFINED__ -#define __IDeckLinkConfiguration_v10_11_INTERFACE_DEFINED__ - -/* interface IDeckLinkConfiguration_v10_11 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkConfiguration_v10_11; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("EF90380B-4AE5-4346-9077-E288E149F129") - IDeckLinkConfiguration_v10_11 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SetFlag( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ BOOL value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFlag( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ BOOL *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetInt( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ LONGLONG value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetInt( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ LONGLONG *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFloat( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ double value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFloat( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ double *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetString( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ BSTR value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetString( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ BSTR *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE WriteConfigurationToPreferences( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkConfiguration_v10_11Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkConfiguration_v10_11 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkConfiguration_v10_11 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkConfiguration_v10_11 * This); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_11, SetFlag) - HRESULT ( STDMETHODCALLTYPE *SetFlag )( - IDeckLinkConfiguration_v10_11 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ BOOL value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_11, GetFlag) - HRESULT ( STDMETHODCALLTYPE *GetFlag )( - IDeckLinkConfiguration_v10_11 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ BOOL *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_11, SetInt) - HRESULT ( STDMETHODCALLTYPE *SetInt )( - IDeckLinkConfiguration_v10_11 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ LONGLONG value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_11, GetInt) - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IDeckLinkConfiguration_v10_11 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_11, SetFloat) - HRESULT ( STDMETHODCALLTYPE *SetFloat )( - IDeckLinkConfiguration_v10_11 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ double value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_11, GetFloat) - HRESULT ( STDMETHODCALLTYPE *GetFloat )( - IDeckLinkConfiguration_v10_11 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ double *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_11, SetString) - HRESULT ( STDMETHODCALLTYPE *SetString )( - IDeckLinkConfiguration_v10_11 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ BSTR value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_11, GetString) - HRESULT ( STDMETHODCALLTYPE *GetString )( - IDeckLinkConfiguration_v10_11 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ BSTR *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_11, WriteConfigurationToPreferences) - HRESULT ( STDMETHODCALLTYPE *WriteConfigurationToPreferences )( - IDeckLinkConfiguration_v10_11 * This); - - END_INTERFACE - } IDeckLinkConfiguration_v10_11Vtbl; - - interface IDeckLinkConfiguration_v10_11 - { - CONST_VTBL struct IDeckLinkConfiguration_v10_11Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkConfiguration_v10_11_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkConfiguration_v10_11_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkConfiguration_v10_11_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkConfiguration_v10_11_SetFlag(This,cfgID,value) \ - ( (This)->lpVtbl -> SetFlag(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_11_GetFlag(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_11_SetInt(This,cfgID,value) \ - ( (This)->lpVtbl -> SetInt(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_11_GetInt(This,cfgID,value) \ - ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_11_SetFloat(This,cfgID,value) \ - ( (This)->lpVtbl -> SetFloat(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_11_GetFloat(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_11_SetString(This,cfgID,value) \ - ( (This)->lpVtbl -> SetString(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_11_GetString(This,cfgID,value) \ - ( (This)->lpVtbl -> GetString(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_11_WriteConfigurationToPreferences(This) \ - ( (This)->lpVtbl -> WriteConfigurationToPreferences(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkConfiguration_v10_11_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkAttributes_v10_11_INTERFACE_DEFINED__ -#define __IDeckLinkAttributes_v10_11_INTERFACE_DEFINED__ - -/* interface IDeckLinkAttributes_v10_11 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkAttributes_v10_11; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("ABC11843-D966-44CB-96E2-A1CB5D3135C4") - IDeckLinkAttributes_v10_11 : 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 IDeckLinkAttributes_v10_11Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkAttributes_v10_11 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkAttributes_v10_11 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkAttributes_v10_11 * This); - - DECLSPEC_XFGVIRT(IDeckLinkAttributes_v10_11, GetFlag) - HRESULT ( STDMETHODCALLTYPE *GetFlag )( - IDeckLinkAttributes_v10_11 * This, - /* [in] */ BMDDeckLinkAttributeID cfgID, - /* [out] */ BOOL *value); - - DECLSPEC_XFGVIRT(IDeckLinkAttributes_v10_11, GetInt) - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IDeckLinkAttributes_v10_11 * This, - /* [in] */ BMDDeckLinkAttributeID cfgID, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IDeckLinkAttributes_v10_11, GetFloat) - HRESULT ( STDMETHODCALLTYPE *GetFloat )( - IDeckLinkAttributes_v10_11 * This, - /* [in] */ BMDDeckLinkAttributeID cfgID, - /* [out] */ double *value); - - DECLSPEC_XFGVIRT(IDeckLinkAttributes_v10_11, GetString) - HRESULT ( STDMETHODCALLTYPE *GetString )( - IDeckLinkAttributes_v10_11 * This, - /* [in] */ BMDDeckLinkAttributeID cfgID, - /* [out] */ BSTR *value); - - END_INTERFACE - } IDeckLinkAttributes_v10_11Vtbl; - - interface IDeckLinkAttributes_v10_11 - { - CONST_VTBL struct IDeckLinkAttributes_v10_11Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkAttributes_v10_11_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkAttributes_v10_11_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkAttributes_v10_11_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkAttributes_v10_11_GetFlag(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) - -#define IDeckLinkAttributes_v10_11_GetInt(This,cfgID,value) \ - ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) - -#define IDeckLinkAttributes_v10_11_GetFloat(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) - -#define IDeckLinkAttributes_v10_11_GetString(This,cfgID,value) \ - ( (This)->lpVtbl -> GetString(This,cfgID,value) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkAttributes_v10_11_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkNotification_v10_11_INTERFACE_DEFINED__ -#define __IDeckLinkNotification_v10_11_INTERFACE_DEFINED__ - -/* interface IDeckLinkNotification_v10_11 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkNotification_v10_11; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("0A1FB207-E215-441B-9B19-6FA1575946C5") - IDeckLinkNotification_v10_11 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Subscribe( - /* [in] */ BMDNotifications topic, - /* [in] */ IDeckLinkNotificationCallback *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE Unsubscribe( - /* [in] */ BMDNotifications topic, - /* [in] */ IDeckLinkNotificationCallback *theCallback) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkNotification_v10_11Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkNotification_v10_11 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkNotification_v10_11 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkNotification_v10_11 * This); - - DECLSPEC_XFGVIRT(IDeckLinkNotification_v10_11, Subscribe) - HRESULT ( STDMETHODCALLTYPE *Subscribe )( - IDeckLinkNotification_v10_11 * This, - /* [in] */ BMDNotifications topic, - /* [in] */ IDeckLinkNotificationCallback *theCallback); - - DECLSPEC_XFGVIRT(IDeckLinkNotification_v10_11, Unsubscribe) - HRESULT ( STDMETHODCALLTYPE *Unsubscribe )( - IDeckLinkNotification_v10_11 * This, - /* [in] */ BMDNotifications topic, - /* [in] */ IDeckLinkNotificationCallback *theCallback); - - END_INTERFACE - } IDeckLinkNotification_v10_11Vtbl; - - interface IDeckLinkNotification_v10_11 - { - CONST_VTBL struct IDeckLinkNotification_v10_11Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkNotification_v10_11_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkNotification_v10_11_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkNotification_v10_11_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkNotification_v10_11_Subscribe(This,topic,theCallback) \ - ( (This)->lpVtbl -> Subscribe(This,topic,theCallback) ) - -#define IDeckLinkNotification_v10_11_Unsubscribe(This,topic,theCallback) \ - ( (This)->lpVtbl -> Unsubscribe(This,topic,theCallback) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkNotification_v10_11_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkOutput_v10_11_INTERFACE_DEFINED__ -#define __IDeckLinkOutput_v10_11_INTERFACE_DEFINED__ - -/* interface IDeckLinkOutput_v10_11 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkOutput_v10_11; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("CC5C8A6E-3F2F-4B3A-87EA-FD78AF300564") - IDeckLinkOutput_v10_11 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDVideoOutputFlags flags, - /* [out] */ BMDDisplayModeSupport_v10_11 *result, - /* [out] */ IDeckLinkDisplayMode **resultDisplayMode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( - /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( - /* [in] */ IDeckLinkScreenPreviewCallback_v14_2_1 *previewCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableVideoOutput( - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDVideoOutputFlags flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableVideoOutput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFrameMemoryAllocator( - /* [in] */ IDeckLinkMemoryAllocator_v14_2_1 *theAllocator) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateVideoFrame( - /* [in] */ int width, - /* [in] */ int height, - /* [in] */ int rowBytes, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDFrameFlags flags, - /* [out] */ IDeckLinkMutableVideoFrame_v14_2_1 **outFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateAncillaryData( - /* [in] */ BMDPixelFormat pixelFormat, - /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisplayVideoFrameSync( - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE ScheduleVideoFrame( - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame, - /* [in] */ BMDTimeValue displayTime, - /* [in] */ BMDTimeValue displayDuration, - /* [in] */ BMDTimeScale timeScale) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetScheduledFrameCompletionCallback( - /* [in] */ IDeckLinkVideoOutputCallback_v14_2_1 *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBufferedVideoFrameCount( - /* [out] */ unsigned int *bufferedFrameCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableAudioOutput( - /* [in] */ BMDAudioSampleRate sampleRate, - /* [in] */ BMDAudioSampleType sampleType, - /* [in] */ unsigned int channelCount, - /* [in] */ BMDAudioOutputStreamType streamType) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableAudioOutput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE WriteAudioSamplesSync( - /* [in] */ void *buffer, - /* [in] */ unsigned int sampleFrameCount, - /* [out] */ unsigned int *sampleFramesWritten) = 0; - - virtual HRESULT STDMETHODCALLTYPE BeginAudioPreroll( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE EndAudioPreroll( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE ScheduleAudioSamples( - /* [in] */ void *buffer, - /* [in] */ unsigned int sampleFrameCount, - /* [in] */ BMDTimeValue streamTime, - /* [in] */ BMDTimeScale timeScale, - /* [out] */ unsigned int *sampleFramesWritten) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( - /* [out] */ unsigned int *bufferedSampleFrameCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE FlushBufferedAudioSamples( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetAudioCallback( - /* [in] */ IDeckLinkAudioOutputCallback *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE StartScheduledPlayback( - /* [in] */ BMDTimeValue playbackStartTime, - /* [in] */ BMDTimeScale timeScale, - /* [in] */ double playbackSpeed) = 0; - - virtual HRESULT STDMETHODCALLTYPE StopScheduledPlayback( - /* [in] */ BMDTimeValue stopPlaybackAtTime, - /* [out] */ BMDTimeValue *actualStopTime, - /* [in] */ BMDTimeScale timeScale) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsScheduledPlaybackRunning( - /* [out] */ BOOL *active) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetScheduledStreamTime( - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *streamTime, - /* [out] */ double *playbackSpeed) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetReferenceStatus( - /* [out] */ BMDReferenceStatus *referenceStatus) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFrameCompletionReferenceTimestamp( - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame, - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *frameCompletionTimestamp) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkOutput_v10_11Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkOutput_v10_11 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkOutput_v10_11 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkOutput_v10_11 * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, DoesSupportVideoMode) - HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( - IDeckLinkOutput_v10_11 * This, - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDVideoOutputFlags flags, - /* [out] */ BMDDisplayModeSupport_v10_11 *result, - /* [out] */ IDeckLinkDisplayMode **resultDisplayMode); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, GetDisplayModeIterator) - HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( - IDeckLinkOutput_v10_11 * This, - /* [out] */ IDeckLinkDisplayModeIterator **iterator); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, SetScreenPreviewCallback) - HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( - IDeckLinkOutput_v10_11 * This, - /* [in] */ IDeckLinkScreenPreviewCallback_v14_2_1 *previewCallback); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, EnableVideoOutput) - HRESULT ( STDMETHODCALLTYPE *EnableVideoOutput )( - IDeckLinkOutput_v10_11 * This, - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDVideoOutputFlags flags); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, DisableVideoOutput) - HRESULT ( STDMETHODCALLTYPE *DisableVideoOutput )( - IDeckLinkOutput_v10_11 * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, SetVideoOutputFrameMemoryAllocator) - HRESULT ( STDMETHODCALLTYPE *SetVideoOutputFrameMemoryAllocator )( - IDeckLinkOutput_v10_11 * This, - /* [in] */ IDeckLinkMemoryAllocator_v14_2_1 *theAllocator); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, CreateVideoFrame) - HRESULT ( STDMETHODCALLTYPE *CreateVideoFrame )( - IDeckLinkOutput_v10_11 * This, - /* [in] */ int width, - /* [in] */ int height, - /* [in] */ int rowBytes, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDFrameFlags flags, - /* [out] */ IDeckLinkMutableVideoFrame_v14_2_1 **outFrame); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, CreateAncillaryData) - HRESULT ( STDMETHODCALLTYPE *CreateAncillaryData )( - IDeckLinkOutput_v10_11 * This, - /* [in] */ BMDPixelFormat pixelFormat, - /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, DisplayVideoFrameSync) - HRESULT ( STDMETHODCALLTYPE *DisplayVideoFrameSync )( - IDeckLinkOutput_v10_11 * This, - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, ScheduleVideoFrame) - HRESULT ( STDMETHODCALLTYPE *ScheduleVideoFrame )( - IDeckLinkOutput_v10_11 * This, - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame, - /* [in] */ BMDTimeValue displayTime, - /* [in] */ BMDTimeValue displayDuration, - /* [in] */ BMDTimeScale timeScale); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, SetScheduledFrameCompletionCallback) - HRESULT ( STDMETHODCALLTYPE *SetScheduledFrameCompletionCallback )( - IDeckLinkOutput_v10_11 * This, - /* [in] */ IDeckLinkVideoOutputCallback_v14_2_1 *theCallback); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, GetBufferedVideoFrameCount) - HRESULT ( STDMETHODCALLTYPE *GetBufferedVideoFrameCount )( - IDeckLinkOutput_v10_11 * This, - /* [out] */ unsigned int *bufferedFrameCount); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, EnableAudioOutput) - HRESULT ( STDMETHODCALLTYPE *EnableAudioOutput )( - IDeckLinkOutput_v10_11 * This, - /* [in] */ BMDAudioSampleRate sampleRate, - /* [in] */ BMDAudioSampleType sampleType, - /* [in] */ unsigned int channelCount, - /* [in] */ BMDAudioOutputStreamType streamType); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, DisableAudioOutput) - HRESULT ( STDMETHODCALLTYPE *DisableAudioOutput )( - IDeckLinkOutput_v10_11 * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, WriteAudioSamplesSync) - HRESULT ( STDMETHODCALLTYPE *WriteAudioSamplesSync )( - IDeckLinkOutput_v10_11 * This, - /* [in] */ void *buffer, - /* [in] */ unsigned int sampleFrameCount, - /* [out] */ unsigned int *sampleFramesWritten); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, BeginAudioPreroll) - HRESULT ( STDMETHODCALLTYPE *BeginAudioPreroll )( - IDeckLinkOutput_v10_11 * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, EndAudioPreroll) - HRESULT ( STDMETHODCALLTYPE *EndAudioPreroll )( - IDeckLinkOutput_v10_11 * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, ScheduleAudioSamples) - HRESULT ( STDMETHODCALLTYPE *ScheduleAudioSamples )( - IDeckLinkOutput_v10_11 * This, - /* [in] */ void *buffer, - /* [in] */ unsigned int sampleFrameCount, - /* [in] */ BMDTimeValue streamTime, - /* [in] */ BMDTimeScale timeScale, - /* [out] */ unsigned int *sampleFramesWritten); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, GetBufferedAudioSampleFrameCount) - HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( - IDeckLinkOutput_v10_11 * This, - /* [out] */ unsigned int *bufferedSampleFrameCount); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, FlushBufferedAudioSamples) - HRESULT ( STDMETHODCALLTYPE *FlushBufferedAudioSamples )( - IDeckLinkOutput_v10_11 * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, SetAudioCallback) - HRESULT ( STDMETHODCALLTYPE *SetAudioCallback )( - IDeckLinkOutput_v10_11 * This, - /* [in] */ IDeckLinkAudioOutputCallback *theCallback); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, StartScheduledPlayback) - HRESULT ( STDMETHODCALLTYPE *StartScheduledPlayback )( - IDeckLinkOutput_v10_11 * This, - /* [in] */ BMDTimeValue playbackStartTime, - /* [in] */ BMDTimeScale timeScale, - /* [in] */ double playbackSpeed); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, StopScheduledPlayback) - HRESULT ( STDMETHODCALLTYPE *StopScheduledPlayback )( - IDeckLinkOutput_v10_11 * This, - /* [in] */ BMDTimeValue stopPlaybackAtTime, - /* [out] */ BMDTimeValue *actualStopTime, - /* [in] */ BMDTimeScale timeScale); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, IsScheduledPlaybackRunning) - HRESULT ( STDMETHODCALLTYPE *IsScheduledPlaybackRunning )( - IDeckLinkOutput_v10_11 * This, - /* [out] */ BOOL *active); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, GetScheduledStreamTime) - HRESULT ( STDMETHODCALLTYPE *GetScheduledStreamTime )( - IDeckLinkOutput_v10_11 * This, - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *streamTime, - /* [out] */ double *playbackSpeed); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, GetReferenceStatus) - HRESULT ( STDMETHODCALLTYPE *GetReferenceStatus )( - IDeckLinkOutput_v10_11 * This, - /* [out] */ BMDReferenceStatus *referenceStatus); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, GetHardwareReferenceClock) - HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( - IDeckLinkOutput_v10_11 * This, - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v10_11, GetFrameCompletionReferenceTimestamp) - HRESULT ( STDMETHODCALLTYPE *GetFrameCompletionReferenceTimestamp )( - IDeckLinkOutput_v10_11 * This, - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame, - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *frameCompletionTimestamp); - - END_INTERFACE - } IDeckLinkOutput_v10_11Vtbl; - - interface IDeckLinkOutput_v10_11 - { - CONST_VTBL struct IDeckLinkOutput_v10_11Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkOutput_v10_11_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkOutput_v10_11_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkOutput_v10_11_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkOutput_v10_11_DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode) \ - ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode) ) - -#define IDeckLinkOutput_v10_11_GetDisplayModeIterator(This,iterator) \ - ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) - -#define IDeckLinkOutput_v10_11_SetScreenPreviewCallback(This,previewCallback) \ - ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) - -#define IDeckLinkOutput_v10_11_EnableVideoOutput(This,displayMode,flags) \ - ( (This)->lpVtbl -> EnableVideoOutput(This,displayMode,flags) ) - -#define IDeckLinkOutput_v10_11_DisableVideoOutput(This) \ - ( (This)->lpVtbl -> DisableVideoOutput(This) ) - -#define IDeckLinkOutput_v10_11_SetVideoOutputFrameMemoryAllocator(This,theAllocator) \ - ( (This)->lpVtbl -> SetVideoOutputFrameMemoryAllocator(This,theAllocator) ) - -#define IDeckLinkOutput_v10_11_CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) \ - ( (This)->lpVtbl -> CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) ) - -#define IDeckLinkOutput_v10_11_CreateAncillaryData(This,pixelFormat,outBuffer) \ - ( (This)->lpVtbl -> CreateAncillaryData(This,pixelFormat,outBuffer) ) - -#define IDeckLinkOutput_v10_11_DisplayVideoFrameSync(This,theFrame) \ - ( (This)->lpVtbl -> DisplayVideoFrameSync(This,theFrame) ) - -#define IDeckLinkOutput_v10_11_ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) \ - ( (This)->lpVtbl -> ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) ) - -#define IDeckLinkOutput_v10_11_SetScheduledFrameCompletionCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetScheduledFrameCompletionCallback(This,theCallback) ) - -#define IDeckLinkOutput_v10_11_GetBufferedVideoFrameCount(This,bufferedFrameCount) \ - ( (This)->lpVtbl -> GetBufferedVideoFrameCount(This,bufferedFrameCount) ) - -#define IDeckLinkOutput_v10_11_EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) \ - ( (This)->lpVtbl -> EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) ) - -#define IDeckLinkOutput_v10_11_DisableAudioOutput(This) \ - ( (This)->lpVtbl -> DisableAudioOutput(This) ) - -#define IDeckLinkOutput_v10_11_WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) \ - ( (This)->lpVtbl -> WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) ) - -#define IDeckLinkOutput_v10_11_BeginAudioPreroll(This) \ - ( (This)->lpVtbl -> BeginAudioPreroll(This) ) - -#define IDeckLinkOutput_v10_11_EndAudioPreroll(This) \ - ( (This)->lpVtbl -> EndAudioPreroll(This) ) - -#define IDeckLinkOutput_v10_11_ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) \ - ( (This)->lpVtbl -> ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) ) - -#define IDeckLinkOutput_v10_11_GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) \ - ( (This)->lpVtbl -> GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) ) - -#define IDeckLinkOutput_v10_11_FlushBufferedAudioSamples(This) \ - ( (This)->lpVtbl -> FlushBufferedAudioSamples(This) ) - -#define IDeckLinkOutput_v10_11_SetAudioCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetAudioCallback(This,theCallback) ) - -#define IDeckLinkOutput_v10_11_StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) \ - ( (This)->lpVtbl -> StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) ) - -#define IDeckLinkOutput_v10_11_StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) \ - ( (This)->lpVtbl -> StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) ) - -#define IDeckLinkOutput_v10_11_IsScheduledPlaybackRunning(This,active) \ - ( (This)->lpVtbl -> IsScheduledPlaybackRunning(This,active) ) - -#define IDeckLinkOutput_v10_11_GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed) \ - ( (This)->lpVtbl -> GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed) ) - -#define IDeckLinkOutput_v10_11_GetReferenceStatus(This,referenceStatus) \ - ( (This)->lpVtbl -> GetReferenceStatus(This,referenceStatus) ) - -#define IDeckLinkOutput_v10_11_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) \ - ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) - -#define IDeckLinkOutput_v10_11_GetFrameCompletionReferenceTimestamp(This,theFrame,desiredTimeScale,frameCompletionTimestamp) \ - ( (This)->lpVtbl -> GetFrameCompletionReferenceTimestamp(This,theFrame,desiredTimeScale,frameCompletionTimestamp) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkOutput_v10_11_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkInput_v10_11_INTERFACE_DEFINED__ -#define __IDeckLinkInput_v10_11_INTERFACE_DEFINED__ - -/* interface IDeckLinkInput_v10_11 */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkInput_v10_11; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("AF22762B-DFAC-4846-AA79-FA8883560995") - IDeckLinkInput_v10_11 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDVideoInputFlags flags, - /* [out] */ BMDDisplayModeSupport_v10_11 *result, - /* [out] */ IDeckLinkDisplayMode **resultDisplayMode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( - /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( - /* [in] */ IDeckLinkScreenPreviewCallback_v14_2_1 *previewCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDVideoInputFlags flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAvailableVideoFrameCount( - /* [out] */ unsigned int *availableFrameCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetVideoInputFrameMemoryAllocator( - /* [in] */ IDeckLinkMemoryAllocator_v14_2_1 *theAllocator) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( - /* [in] */ BMDAudioSampleRate sampleRate, - /* [in] */ BMDAudioSampleType sampleType, - /* [in] */ unsigned int channelCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAvailableAudioSampleFrameCount( - /* [out] */ unsigned int *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_v11_5_1 *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkInput_v10_11Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkInput_v10_11 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkInput_v10_11 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkInput_v10_11 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v10_11, DoesSupportVideoMode) - HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( - IDeckLinkInput_v10_11 * This, - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDVideoInputFlags flags, - /* [out] */ BMDDisplayModeSupport_v10_11 *result, - /* [out] */ IDeckLinkDisplayMode **resultDisplayMode); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v10_11, GetDisplayModeIterator) - HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( - IDeckLinkInput_v10_11 * This, - /* [out] */ IDeckLinkDisplayModeIterator **iterator); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v10_11, SetScreenPreviewCallback) - HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( - IDeckLinkInput_v10_11 * This, - /* [in] */ IDeckLinkScreenPreviewCallback_v14_2_1 *previewCallback); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v10_11, EnableVideoInput) - HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( - IDeckLinkInput_v10_11 * This, - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDVideoInputFlags flags); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v10_11, DisableVideoInput) - HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( - IDeckLinkInput_v10_11 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v10_11, GetAvailableVideoFrameCount) - HRESULT ( STDMETHODCALLTYPE *GetAvailableVideoFrameCount )( - IDeckLinkInput_v10_11 * This, - /* [out] */ unsigned int *availableFrameCount); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v10_11, SetVideoInputFrameMemoryAllocator) - HRESULT ( STDMETHODCALLTYPE *SetVideoInputFrameMemoryAllocator )( - IDeckLinkInput_v10_11 * This, - /* [in] */ IDeckLinkMemoryAllocator_v14_2_1 *theAllocator); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v10_11, EnableAudioInput) - HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( - IDeckLinkInput_v10_11 * This, - /* [in] */ BMDAudioSampleRate sampleRate, - /* [in] */ BMDAudioSampleType sampleType, - /* [in] */ unsigned int channelCount); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v10_11, DisableAudioInput) - HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( - IDeckLinkInput_v10_11 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v10_11, GetAvailableAudioSampleFrameCount) - HRESULT ( STDMETHODCALLTYPE *GetAvailableAudioSampleFrameCount )( - IDeckLinkInput_v10_11 * This, - /* [out] */ unsigned int *availableSampleFrameCount); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v10_11, StartStreams) - HRESULT ( STDMETHODCALLTYPE *StartStreams )( - IDeckLinkInput_v10_11 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v10_11, StopStreams) - HRESULT ( STDMETHODCALLTYPE *StopStreams )( - IDeckLinkInput_v10_11 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v10_11, PauseStreams) - HRESULT ( STDMETHODCALLTYPE *PauseStreams )( - IDeckLinkInput_v10_11 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v10_11, FlushStreams) - HRESULT ( STDMETHODCALLTYPE *FlushStreams )( - IDeckLinkInput_v10_11 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v10_11, SetCallback) - HRESULT ( STDMETHODCALLTYPE *SetCallback )( - IDeckLinkInput_v10_11 * This, - /* [in] */ IDeckLinkInputCallback_v11_5_1 *theCallback); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v10_11, GetHardwareReferenceClock) - HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( - IDeckLinkInput_v10_11 * This, - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame); - - END_INTERFACE - } IDeckLinkInput_v10_11Vtbl; - - interface IDeckLinkInput_v10_11 - { - CONST_VTBL struct IDeckLinkInput_v10_11Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkInput_v10_11_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkInput_v10_11_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkInput_v10_11_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkInput_v10_11_DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode) \ - ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode) ) - -#define IDeckLinkInput_v10_11_GetDisplayModeIterator(This,iterator) \ - ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) - -#define IDeckLinkInput_v10_11_SetScreenPreviewCallback(This,previewCallback) \ - ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) - -#define IDeckLinkInput_v10_11_EnableVideoInput(This,displayMode,pixelFormat,flags) \ - ( (This)->lpVtbl -> EnableVideoInput(This,displayMode,pixelFormat,flags) ) - -#define IDeckLinkInput_v10_11_DisableVideoInput(This) \ - ( (This)->lpVtbl -> DisableVideoInput(This) ) - -#define IDeckLinkInput_v10_11_GetAvailableVideoFrameCount(This,availableFrameCount) \ - ( (This)->lpVtbl -> GetAvailableVideoFrameCount(This,availableFrameCount) ) - -#define IDeckLinkInput_v10_11_SetVideoInputFrameMemoryAllocator(This,theAllocator) \ - ( (This)->lpVtbl -> SetVideoInputFrameMemoryAllocator(This,theAllocator) ) - -#define IDeckLinkInput_v10_11_EnableAudioInput(This,sampleRate,sampleType,channelCount) \ - ( (This)->lpVtbl -> EnableAudioInput(This,sampleRate,sampleType,channelCount) ) - -#define IDeckLinkInput_v10_11_DisableAudioInput(This) \ - ( (This)->lpVtbl -> DisableAudioInput(This) ) - -#define IDeckLinkInput_v10_11_GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) \ - ( (This)->lpVtbl -> GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) ) - -#define IDeckLinkInput_v10_11_StartStreams(This) \ - ( (This)->lpVtbl -> StartStreams(This) ) - -#define IDeckLinkInput_v10_11_StopStreams(This) \ - ( (This)->lpVtbl -> StopStreams(This) ) - -#define IDeckLinkInput_v10_11_PauseStreams(This) \ - ( (This)->lpVtbl -> PauseStreams(This) ) - -#define IDeckLinkInput_v10_11_FlushStreams(This) \ - ( (This)->lpVtbl -> FlushStreams(This) ) - -#define IDeckLinkInput_v10_11_SetCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetCallback(This,theCallback) ) - -#define IDeckLinkInput_v10_11_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) \ - ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkInput_v10_11_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkEncoderInput_v10_11_INTERFACE_DEFINED__ -#define __IDeckLinkEncoderInput_v10_11_INTERFACE_DEFINED__ - -/* interface IDeckLinkEncoderInput_v10_11 */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkEncoderInput_v10_11; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("270587DA-6B7D-42E7-A1F0-6D853F581185") - IDeckLinkEncoderInput_v10_11 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDVideoInputFlags flags, - /* [out] */ BMDDisplayModeSupport_v10_11 *result, - /* [out] */ IDeckLinkDisplayMode **resultDisplayMode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( - /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDVideoInputFlags flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAvailablePacketsCount( - /* [out] */ unsigned int *availablePacketsCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetMemoryAllocator( - /* [in] */ IDeckLinkMemoryAllocator_v14_2_1 *theAllocator) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( - /* [in] */ BMDAudioFormat audioFormat, - /* [in] */ BMDAudioSampleRate sampleRate, - /* [in] */ BMDAudioSampleType sampleType, - /* [in] */ unsigned int channelCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAvailableAudioSampleFrameCount( - /* [out] */ unsigned int *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] */ IDeckLinkEncoderInputCallback *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkEncoderInput_v10_11Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkEncoderInput_v10_11 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkEncoderInput_v10_11 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkEncoderInput_v10_11 * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v10_11, DoesSupportVideoMode) - HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( - IDeckLinkEncoderInput_v10_11 * This, - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDVideoInputFlags flags, - /* [out] */ BMDDisplayModeSupport_v10_11 *result, - /* [out] */ IDeckLinkDisplayMode **resultDisplayMode); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v10_11, GetDisplayModeIterator) - HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( - IDeckLinkEncoderInput_v10_11 * This, - /* [out] */ IDeckLinkDisplayModeIterator **iterator); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v10_11, EnableVideoInput) - HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( - IDeckLinkEncoderInput_v10_11 * This, - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDVideoInputFlags flags); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v10_11, DisableVideoInput) - HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( - IDeckLinkEncoderInput_v10_11 * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v10_11, GetAvailablePacketsCount) - HRESULT ( STDMETHODCALLTYPE *GetAvailablePacketsCount )( - IDeckLinkEncoderInput_v10_11 * This, - /* [out] */ unsigned int *availablePacketsCount); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v10_11, SetMemoryAllocator) - HRESULT ( STDMETHODCALLTYPE *SetMemoryAllocator )( - IDeckLinkEncoderInput_v10_11 * This, - /* [in] */ IDeckLinkMemoryAllocator_v14_2_1 *theAllocator); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v10_11, EnableAudioInput) - HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( - IDeckLinkEncoderInput_v10_11 * This, - /* [in] */ BMDAudioFormat audioFormat, - /* [in] */ BMDAudioSampleRate sampleRate, - /* [in] */ BMDAudioSampleType sampleType, - /* [in] */ unsigned int channelCount); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v10_11, DisableAudioInput) - HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( - IDeckLinkEncoderInput_v10_11 * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v10_11, GetAvailableAudioSampleFrameCount) - HRESULT ( STDMETHODCALLTYPE *GetAvailableAudioSampleFrameCount )( - IDeckLinkEncoderInput_v10_11 * This, - /* [out] */ unsigned int *availableSampleFrameCount); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v10_11, StartStreams) - HRESULT ( STDMETHODCALLTYPE *StartStreams )( - IDeckLinkEncoderInput_v10_11 * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v10_11, StopStreams) - HRESULT ( STDMETHODCALLTYPE *StopStreams )( - IDeckLinkEncoderInput_v10_11 * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v10_11, PauseStreams) - HRESULT ( STDMETHODCALLTYPE *PauseStreams )( - IDeckLinkEncoderInput_v10_11 * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v10_11, FlushStreams) - HRESULT ( STDMETHODCALLTYPE *FlushStreams )( - IDeckLinkEncoderInput_v10_11 * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v10_11, SetCallback) - HRESULT ( STDMETHODCALLTYPE *SetCallback )( - IDeckLinkEncoderInput_v10_11 * This, - /* [in] */ IDeckLinkEncoderInputCallback *theCallback); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderInput_v10_11, GetHardwareReferenceClock) - HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( - IDeckLinkEncoderInput_v10_11 * This, - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame); - - END_INTERFACE - } IDeckLinkEncoderInput_v10_11Vtbl; - - interface IDeckLinkEncoderInput_v10_11 - { - CONST_VTBL struct IDeckLinkEncoderInput_v10_11Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkEncoderInput_v10_11_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkEncoderInput_v10_11_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkEncoderInput_v10_11_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkEncoderInput_v10_11_DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode) \ - ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode) ) - -#define IDeckLinkEncoderInput_v10_11_GetDisplayModeIterator(This,iterator) \ - ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) - -#define IDeckLinkEncoderInput_v10_11_EnableVideoInput(This,displayMode,pixelFormat,flags) \ - ( (This)->lpVtbl -> EnableVideoInput(This,displayMode,pixelFormat,flags) ) - -#define IDeckLinkEncoderInput_v10_11_DisableVideoInput(This) \ - ( (This)->lpVtbl -> DisableVideoInput(This) ) - -#define IDeckLinkEncoderInput_v10_11_GetAvailablePacketsCount(This,availablePacketsCount) \ - ( (This)->lpVtbl -> GetAvailablePacketsCount(This,availablePacketsCount) ) - -#define IDeckLinkEncoderInput_v10_11_SetMemoryAllocator(This,theAllocator) \ - ( (This)->lpVtbl -> SetMemoryAllocator(This,theAllocator) ) - -#define IDeckLinkEncoderInput_v10_11_EnableAudioInput(This,audioFormat,sampleRate,sampleType,channelCount) \ - ( (This)->lpVtbl -> EnableAudioInput(This,audioFormat,sampleRate,sampleType,channelCount) ) - -#define IDeckLinkEncoderInput_v10_11_DisableAudioInput(This) \ - ( (This)->lpVtbl -> DisableAudioInput(This) ) - -#define IDeckLinkEncoderInput_v10_11_GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) \ - ( (This)->lpVtbl -> GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) ) - -#define IDeckLinkEncoderInput_v10_11_StartStreams(This) \ - ( (This)->lpVtbl -> StartStreams(This) ) - -#define IDeckLinkEncoderInput_v10_11_StopStreams(This) \ - ( (This)->lpVtbl -> StopStreams(This) ) - -#define IDeckLinkEncoderInput_v10_11_PauseStreams(This) \ - ( (This)->lpVtbl -> PauseStreams(This) ) - -#define IDeckLinkEncoderInput_v10_11_FlushStreams(This) \ - ( (This)->lpVtbl -> FlushStreams(This) ) - -#define IDeckLinkEncoderInput_v10_11_SetCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetCallback(This,theCallback) ) - -#define IDeckLinkEncoderInput_v10_11_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) \ - ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkEncoderInput_v10_11_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_CDeckLinkIterator_v10_11; - -#ifdef __cplusplus - -class DECLSPEC_UUID("87D2693F-8D4A-45C7-B43F-10ACBA25E68F") -CDeckLinkIterator_v10_11; -#endif - -EXTERN_C const CLSID CLSID_CDeckLinkDiscovery_v10_11; - -#ifdef __cplusplus - -class DECLSPEC_UUID("652615D4-26CD-4514-B161-2FD5072ED008") -CDeckLinkDiscovery_v10_11; -#endif - -#ifndef __IDeckLinkConfiguration_v10_9_INTERFACE_DEFINED__ -#define __IDeckLinkConfiguration_v10_9_INTERFACE_DEFINED__ - -/* interface IDeckLinkConfiguration_v10_9 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkConfiguration_v10_9; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("CB71734A-FE37-4E8D-8E13-802133A1C3F2") - IDeckLinkConfiguration_v10_9 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SetFlag( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ BOOL value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFlag( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ BOOL *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetInt( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ LONGLONG value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetInt( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ LONGLONG *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFloat( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ double value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFloat( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ double *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetString( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ BSTR value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetString( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ BSTR *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE WriteConfigurationToPreferences( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkConfiguration_v10_9Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkConfiguration_v10_9 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkConfiguration_v10_9 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkConfiguration_v10_9 * This); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_9, SetFlag) - HRESULT ( STDMETHODCALLTYPE *SetFlag )( - IDeckLinkConfiguration_v10_9 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ BOOL value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_9, GetFlag) - HRESULT ( STDMETHODCALLTYPE *GetFlag )( - IDeckLinkConfiguration_v10_9 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ BOOL *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_9, SetInt) - HRESULT ( STDMETHODCALLTYPE *SetInt )( - IDeckLinkConfiguration_v10_9 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ LONGLONG value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_9, GetInt) - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IDeckLinkConfiguration_v10_9 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_9, SetFloat) - HRESULT ( STDMETHODCALLTYPE *SetFloat )( - IDeckLinkConfiguration_v10_9 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ double value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_9, GetFloat) - HRESULT ( STDMETHODCALLTYPE *GetFloat )( - IDeckLinkConfiguration_v10_9 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ double *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_9, SetString) - HRESULT ( STDMETHODCALLTYPE *SetString )( - IDeckLinkConfiguration_v10_9 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ BSTR value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_9, GetString) - HRESULT ( STDMETHODCALLTYPE *GetString )( - IDeckLinkConfiguration_v10_9 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ BSTR *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_9, WriteConfigurationToPreferences) - HRESULT ( STDMETHODCALLTYPE *WriteConfigurationToPreferences )( - IDeckLinkConfiguration_v10_9 * This); - - END_INTERFACE - } IDeckLinkConfiguration_v10_9Vtbl; - - interface IDeckLinkConfiguration_v10_9 - { - CONST_VTBL struct IDeckLinkConfiguration_v10_9Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkConfiguration_v10_9_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkConfiguration_v10_9_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkConfiguration_v10_9_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkConfiguration_v10_9_SetFlag(This,cfgID,value) \ - ( (This)->lpVtbl -> SetFlag(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_9_GetFlag(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_9_SetInt(This,cfgID,value) \ - ( (This)->lpVtbl -> SetInt(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_9_GetInt(This,cfgID,value) \ - ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_9_SetFloat(This,cfgID,value) \ - ( (This)->lpVtbl -> SetFloat(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_9_GetFloat(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_9_SetString(This,cfgID,value) \ - ( (This)->lpVtbl -> SetString(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_9_GetString(This,cfgID,value) \ - ( (This)->lpVtbl -> GetString(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_9_WriteConfigurationToPreferences(This) \ - ( (This)->lpVtbl -> WriteConfigurationToPreferences(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkConfiguration_v10_9_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_CBMDStreamingDiscovery_v10_8; - -#ifdef __cplusplus - -class DECLSPEC_UUID("0CAA31F6-8A26-40B0-86A4-BF58DCCA710C") -CBMDStreamingDiscovery_v10_8; -#endif - -#ifndef __IDeckLinkConfiguration_v10_4_INTERFACE_DEFINED__ -#define __IDeckLinkConfiguration_v10_4_INTERFACE_DEFINED__ - -/* interface IDeckLinkConfiguration_v10_4 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkConfiguration_v10_4; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("1E69FCF6-4203-4936-8076-2A9F4CFD50CB") - IDeckLinkConfiguration_v10_4 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SetFlag( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ BOOL value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFlag( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ BOOL *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetInt( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ LONGLONG value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetInt( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ LONGLONG *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFloat( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ double value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFloat( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ double *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetString( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ BSTR value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetString( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ BSTR *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE WriteConfigurationToPreferences( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkConfiguration_v10_4Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkConfiguration_v10_4 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkConfiguration_v10_4 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkConfiguration_v10_4 * This); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_4, SetFlag) - HRESULT ( STDMETHODCALLTYPE *SetFlag )( - IDeckLinkConfiguration_v10_4 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ BOOL value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_4, GetFlag) - HRESULT ( STDMETHODCALLTYPE *GetFlag )( - IDeckLinkConfiguration_v10_4 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ BOOL *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_4, SetInt) - HRESULT ( STDMETHODCALLTYPE *SetInt )( - IDeckLinkConfiguration_v10_4 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ LONGLONG value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_4, GetInt) - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IDeckLinkConfiguration_v10_4 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_4, SetFloat) - HRESULT ( STDMETHODCALLTYPE *SetFloat )( - IDeckLinkConfiguration_v10_4 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ double value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_4, GetFloat) - HRESULT ( STDMETHODCALLTYPE *GetFloat )( - IDeckLinkConfiguration_v10_4 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ double *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_4, SetString) - HRESULT ( STDMETHODCALLTYPE *SetString )( - IDeckLinkConfiguration_v10_4 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ BSTR value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_4, GetString) - HRESULT ( STDMETHODCALLTYPE *GetString )( - IDeckLinkConfiguration_v10_4 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ BSTR *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_4, WriteConfigurationToPreferences) - HRESULT ( STDMETHODCALLTYPE *WriteConfigurationToPreferences )( - IDeckLinkConfiguration_v10_4 * This); - - END_INTERFACE - } IDeckLinkConfiguration_v10_4Vtbl; - - interface IDeckLinkConfiguration_v10_4 - { - CONST_VTBL struct IDeckLinkConfiguration_v10_4Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkConfiguration_v10_4_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkConfiguration_v10_4_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkConfiguration_v10_4_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkConfiguration_v10_4_SetFlag(This,cfgID,value) \ - ( (This)->lpVtbl -> SetFlag(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_4_GetFlag(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_4_SetInt(This,cfgID,value) \ - ( (This)->lpVtbl -> SetInt(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_4_GetInt(This,cfgID,value) \ - ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_4_SetFloat(This,cfgID,value) \ - ( (This)->lpVtbl -> SetFloat(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_4_GetFloat(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_4_SetString(This,cfgID,value) \ - ( (This)->lpVtbl -> SetString(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_4_GetString(This,cfgID,value) \ - ( (This)->lpVtbl -> GetString(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_4_WriteConfigurationToPreferences(This) \ - ( (This)->lpVtbl -> WriteConfigurationToPreferences(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkConfiguration_v10_4_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkConfiguration_v10_2_INTERFACE_DEFINED__ -#define __IDeckLinkConfiguration_v10_2_INTERFACE_DEFINED__ - -/* interface IDeckLinkConfiguration_v10_2 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkConfiguration_v10_2; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("C679A35B-610C-4D09-B748-1D0478100FC0") - IDeckLinkConfiguration_v10_2 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SetFlag( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ BOOL value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFlag( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ BOOL *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetInt( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ LONGLONG value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetInt( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ LONGLONG *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFloat( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ double value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFloat( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ double *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetString( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ BSTR value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetString( - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ BSTR *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE WriteConfigurationToPreferences( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkConfiguration_v10_2Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkConfiguration_v10_2 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkConfiguration_v10_2 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkConfiguration_v10_2 * This); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_2, SetFlag) - HRESULT ( STDMETHODCALLTYPE *SetFlag )( - IDeckLinkConfiguration_v10_2 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ BOOL value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_2, GetFlag) - HRESULT ( STDMETHODCALLTYPE *GetFlag )( - IDeckLinkConfiguration_v10_2 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ BOOL *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_2, SetInt) - HRESULT ( STDMETHODCALLTYPE *SetInt )( - IDeckLinkConfiguration_v10_2 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ LONGLONG value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_2, GetInt) - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IDeckLinkConfiguration_v10_2 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_2, SetFloat) - HRESULT ( STDMETHODCALLTYPE *SetFloat )( - IDeckLinkConfiguration_v10_2 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ double value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_2, GetFloat) - HRESULT ( STDMETHODCALLTYPE *GetFloat )( - IDeckLinkConfiguration_v10_2 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ double *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_2, SetString) - HRESULT ( STDMETHODCALLTYPE *SetString )( - IDeckLinkConfiguration_v10_2 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [in] */ BSTR value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_2, GetString) - HRESULT ( STDMETHODCALLTYPE *GetString )( - IDeckLinkConfiguration_v10_2 * This, - /* [in] */ BMDDeckLinkConfigurationID cfgID, - /* [out] */ BSTR *value); - - DECLSPEC_XFGVIRT(IDeckLinkConfiguration_v10_2, WriteConfigurationToPreferences) - HRESULT ( STDMETHODCALLTYPE *WriteConfigurationToPreferences )( - IDeckLinkConfiguration_v10_2 * This); - - END_INTERFACE - } IDeckLinkConfiguration_v10_2Vtbl; - - interface IDeckLinkConfiguration_v10_2 - { - CONST_VTBL struct IDeckLinkConfiguration_v10_2Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkConfiguration_v10_2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkConfiguration_v10_2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkConfiguration_v10_2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkConfiguration_v10_2_SetFlag(This,cfgID,value) \ - ( (This)->lpVtbl -> SetFlag(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_2_GetFlag(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_2_SetInt(This,cfgID,value) \ - ( (This)->lpVtbl -> SetInt(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_2_GetInt(This,cfgID,value) \ - ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_2_SetFloat(This,cfgID,value) \ - ( (This)->lpVtbl -> SetFloat(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_2_GetFloat(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_2_SetString(This,cfgID,value) \ - ( (This)->lpVtbl -> SetString(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_2_GetString(This,cfgID,value) \ - ( (This)->lpVtbl -> GetString(This,cfgID,value) ) - -#define IDeckLinkConfiguration_v10_2_WriteConfigurationToPreferences(This) \ - ( (This)->lpVtbl -> WriteConfigurationToPreferences(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkConfiguration_v10_2_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkAncillaryPacket_v15_2_INTERFACE_DEFINED__ -#define __IDeckLinkAncillaryPacket_v15_2_INTERFACE_DEFINED__ - -/* interface IDeckLinkAncillaryPacket_v15_2 */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkAncillaryPacket_v15_2; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("CC5BBF7E-029C-4D3B-9158-6000EF5E3670") - IDeckLinkAncillaryPacket_v15_2 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetBytes( - /* [in] */ BMDAncillaryPacketFormat format, - /* [out] */ const void **data, - /* [out] */ unsigned int *size) = 0; - - virtual unsigned char STDMETHODCALLTYPE GetDID( void) = 0; - - virtual unsigned char STDMETHODCALLTYPE GetSDID( void) = 0; - - virtual unsigned int STDMETHODCALLTYPE GetLineNumber( void) = 0; - - virtual unsigned char STDMETHODCALLTYPE GetDataStreamIndex( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkAncillaryPacket_v15_2Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkAncillaryPacket_v15_2 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkAncillaryPacket_v15_2 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkAncillaryPacket_v15_2 * This); - - DECLSPEC_XFGVIRT(IDeckLinkAncillaryPacket_v15_2, GetBytes) - HRESULT ( STDMETHODCALLTYPE *GetBytes )( - IDeckLinkAncillaryPacket_v15_2 * This, - /* [in] */ BMDAncillaryPacketFormat format, - /* [out] */ const void **data, - /* [out] */ unsigned int *size); - - DECLSPEC_XFGVIRT(IDeckLinkAncillaryPacket_v15_2, GetDID) - unsigned char ( STDMETHODCALLTYPE *GetDID )( - IDeckLinkAncillaryPacket_v15_2 * This); - - DECLSPEC_XFGVIRT(IDeckLinkAncillaryPacket_v15_2, GetSDID) - unsigned char ( STDMETHODCALLTYPE *GetSDID )( - IDeckLinkAncillaryPacket_v15_2 * This); - - DECLSPEC_XFGVIRT(IDeckLinkAncillaryPacket_v15_2, GetLineNumber) - unsigned int ( STDMETHODCALLTYPE *GetLineNumber )( - IDeckLinkAncillaryPacket_v15_2 * This); - - DECLSPEC_XFGVIRT(IDeckLinkAncillaryPacket_v15_2, GetDataStreamIndex) - unsigned char ( STDMETHODCALLTYPE *GetDataStreamIndex )( - IDeckLinkAncillaryPacket_v15_2 * This); - - END_INTERFACE - } IDeckLinkAncillaryPacket_v15_2Vtbl; - - interface IDeckLinkAncillaryPacket_v15_2 - { - CONST_VTBL struct IDeckLinkAncillaryPacket_v15_2Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkAncillaryPacket_v15_2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkAncillaryPacket_v15_2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkAncillaryPacket_v15_2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkAncillaryPacket_v15_2_GetBytes(This,format,data,size) \ - ( (This)->lpVtbl -> GetBytes(This,format,data,size) ) - -#define IDeckLinkAncillaryPacket_v15_2_GetDID(This) \ - ( (This)->lpVtbl -> GetDID(This) ) - -#define IDeckLinkAncillaryPacket_v15_2_GetSDID(This) \ - ( (This)->lpVtbl -> GetSDID(This) ) - -#define IDeckLinkAncillaryPacket_v15_2_GetLineNumber(This) \ - ( (This)->lpVtbl -> GetLineNumber(This) ) - -#define IDeckLinkAncillaryPacket_v15_2_GetDataStreamIndex(This) \ - ( (This)->lpVtbl -> GetDataStreamIndex(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkAncillaryPacket_v15_2_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkAncillaryPacketIterator_v15_2_INTERFACE_DEFINED__ -#define __IDeckLinkAncillaryPacketIterator_v15_2_INTERFACE_DEFINED__ - -/* interface IDeckLinkAncillaryPacketIterator_v15_2 */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkAncillaryPacketIterator_v15_2; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("3FC8994B-88FB-4C17-968F-9AAB69D964A7") - IDeckLinkAncillaryPacketIterator_v15_2 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Next( - /* [out] */ IDeckLinkAncillaryPacket_v15_2 **packet) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkAncillaryPacketIterator_v15_2Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkAncillaryPacketIterator_v15_2 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkAncillaryPacketIterator_v15_2 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkAncillaryPacketIterator_v15_2 * This); - - DECLSPEC_XFGVIRT(IDeckLinkAncillaryPacketIterator_v15_2, Next) - HRESULT ( STDMETHODCALLTYPE *Next )( - IDeckLinkAncillaryPacketIterator_v15_2 * This, - /* [out] */ IDeckLinkAncillaryPacket_v15_2 **packet); - - END_INTERFACE - } IDeckLinkAncillaryPacketIterator_v15_2Vtbl; - - interface IDeckLinkAncillaryPacketIterator_v15_2 - { - CONST_VTBL struct IDeckLinkAncillaryPacketIterator_v15_2Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkAncillaryPacketIterator_v15_2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkAncillaryPacketIterator_v15_2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkAncillaryPacketIterator_v15_2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkAncillaryPacketIterator_v15_2_Next(This,packet) \ - ( (This)->lpVtbl -> Next(This,packet) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkAncillaryPacketIterator_v15_2_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkVideoFrameAncillaryPackets_v15_2_INTERFACE_DEFINED__ -#define __IDeckLinkVideoFrameAncillaryPackets_v15_2_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoFrameAncillaryPackets_v15_2 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoFrameAncillaryPackets_v15_2; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("6C186C0F-459E-41D8-AEE2-4812D81AEE68") - IDeckLinkVideoFrameAncillaryPackets_v15_2 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetPacketIterator( - /* [out] */ IDeckLinkAncillaryPacketIterator_v15_2 **iterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFirstPacketByID( - /* [in] */ unsigned char DID, - /* [in] */ unsigned char SDID, - /* [out] */ IDeckLinkAncillaryPacket_v15_2 **packet) = 0; - - virtual HRESULT STDMETHODCALLTYPE AttachPacket( - /* [in] */ IDeckLinkAncillaryPacket_v15_2 *packet) = 0; - - virtual HRESULT STDMETHODCALLTYPE DetachPacket( - /* [in] */ IDeckLinkAncillaryPacket_v15_2 *packet) = 0; - - virtual HRESULT STDMETHODCALLTYPE DetachAllPackets( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkVideoFrameAncillaryPackets_v15_2Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoFrameAncillaryPackets_v15_2 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoFrameAncillaryPackets_v15_2 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoFrameAncillaryPackets_v15_2 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameAncillaryPackets_v15_2, GetPacketIterator) - HRESULT ( STDMETHODCALLTYPE *GetPacketIterator )( - IDeckLinkVideoFrameAncillaryPackets_v15_2 * This, - /* [out] */ IDeckLinkAncillaryPacketIterator_v15_2 **iterator); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameAncillaryPackets_v15_2, GetFirstPacketByID) - HRESULT ( STDMETHODCALLTYPE *GetFirstPacketByID )( - IDeckLinkVideoFrameAncillaryPackets_v15_2 * This, - /* [in] */ unsigned char DID, - /* [in] */ unsigned char SDID, - /* [out] */ IDeckLinkAncillaryPacket_v15_2 **packet); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameAncillaryPackets_v15_2, AttachPacket) - HRESULT ( STDMETHODCALLTYPE *AttachPacket )( - IDeckLinkVideoFrameAncillaryPackets_v15_2 * This, - /* [in] */ IDeckLinkAncillaryPacket_v15_2 *packet); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameAncillaryPackets_v15_2, DetachPacket) - HRESULT ( STDMETHODCALLTYPE *DetachPacket )( - IDeckLinkVideoFrameAncillaryPackets_v15_2 * This, - /* [in] */ IDeckLinkAncillaryPacket_v15_2 *packet); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameAncillaryPackets_v15_2, DetachAllPackets) - HRESULT ( STDMETHODCALLTYPE *DetachAllPackets )( - IDeckLinkVideoFrameAncillaryPackets_v15_2 * This); - - END_INTERFACE - } IDeckLinkVideoFrameAncillaryPackets_v15_2Vtbl; - - interface IDeckLinkVideoFrameAncillaryPackets_v15_2 - { - CONST_VTBL struct IDeckLinkVideoFrameAncillaryPackets_v15_2Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoFrameAncillaryPackets_v15_2_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoFrameAncillaryPackets_v15_2_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoFrameAncillaryPackets_v15_2_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoFrameAncillaryPackets_v15_2_GetPacketIterator(This,iterator) \ - ( (This)->lpVtbl -> GetPacketIterator(This,iterator) ) - -#define IDeckLinkVideoFrameAncillaryPackets_v15_2_GetFirstPacketByID(This,DID,SDID,packet) \ - ( (This)->lpVtbl -> GetFirstPacketByID(This,DID,SDID,packet) ) - -#define IDeckLinkVideoFrameAncillaryPackets_v15_2_AttachPacket(This,packet) \ - ( (This)->lpVtbl -> AttachPacket(This,packet) ) - -#define IDeckLinkVideoFrameAncillaryPackets_v15_2_DetachPacket(This,packet) \ - ( (This)->lpVtbl -> DetachPacket(This,packet) ) - -#define IDeckLinkVideoFrameAncillaryPackets_v15_2_DetachAllPackets(This) \ - ( (This)->lpVtbl -> DetachAllPackets(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoFrameAncillaryPackets_v15_2_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_CDeckLinkVideoFrameAncillaryPackets_v15_2; - -#ifdef __cplusplus - -class DECLSPEC_UUID("F891AD29-D0C2-46E9-A926-4E2D0DD8CFAD") -CDeckLinkVideoFrameAncillaryPackets_v15_2; -#endif - -#ifndef __IDeckLinkVideoFrameMetadataExtensions_v11_5_INTERFACE_DEFINED__ -#define __IDeckLinkVideoFrameMetadataExtensions_v11_5_INTERFACE_DEFINED__ - -/* interface IDeckLinkVideoFrameMetadataExtensions_v11_5 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkVideoFrameMetadataExtensions_v11_5; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("D5973DC9-6432-46D0-8F0B-2496F8A1238F") - IDeckLinkVideoFrameMetadataExtensions_v11_5 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetInt( - /* [in] */ BMDDeckLinkFrameMetadataID_v11_5 metadataID, - /* [out] */ LONGLONG *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFloat( - /* [in] */ BMDDeckLinkFrameMetadataID_v11_5 metadataID, - /* [out] */ double *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFlag( - /* [in] */ BMDDeckLinkFrameMetadataID_v11_5 metadataID, - /* [out] */ BOOL *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetString( - /* [in] */ BMDDeckLinkFrameMetadataID_v11_5 metadataID, - /* [out] */ BSTR *value) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkVideoFrameMetadataExtensions_v11_5Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkVideoFrameMetadataExtensions_v11_5 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkVideoFrameMetadataExtensions_v11_5 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkVideoFrameMetadataExtensions_v11_5 * This); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameMetadataExtensions_v11_5, GetInt) - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IDeckLinkVideoFrameMetadataExtensions_v11_5 * This, - /* [in] */ BMDDeckLinkFrameMetadataID_v11_5 metadataID, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameMetadataExtensions_v11_5, GetFloat) - HRESULT ( STDMETHODCALLTYPE *GetFloat )( - IDeckLinkVideoFrameMetadataExtensions_v11_5 * This, - /* [in] */ BMDDeckLinkFrameMetadataID_v11_5 metadataID, - /* [out] */ double *value); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameMetadataExtensions_v11_5, GetFlag) - HRESULT ( STDMETHODCALLTYPE *GetFlag )( - IDeckLinkVideoFrameMetadataExtensions_v11_5 * This, - /* [in] */ BMDDeckLinkFrameMetadataID_v11_5 metadataID, - /* [out] */ BOOL *value); - - DECLSPEC_XFGVIRT(IDeckLinkVideoFrameMetadataExtensions_v11_5, GetString) - HRESULT ( STDMETHODCALLTYPE *GetString )( - IDeckLinkVideoFrameMetadataExtensions_v11_5 * This, - /* [in] */ BMDDeckLinkFrameMetadataID_v11_5 metadataID, - /* [out] */ BSTR *value); - - END_INTERFACE - } IDeckLinkVideoFrameMetadataExtensions_v11_5Vtbl; - - interface IDeckLinkVideoFrameMetadataExtensions_v11_5 - { - CONST_VTBL struct IDeckLinkVideoFrameMetadataExtensions_v11_5Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkVideoFrameMetadataExtensions_v11_5_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkVideoFrameMetadataExtensions_v11_5_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkVideoFrameMetadataExtensions_v11_5_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkVideoFrameMetadataExtensions_v11_5_GetInt(This,metadataID,value) \ - ( (This)->lpVtbl -> GetInt(This,metadataID,value) ) - -#define IDeckLinkVideoFrameMetadataExtensions_v11_5_GetFloat(This,metadataID,value) \ - ( (This)->lpVtbl -> GetFloat(This,metadataID,value) ) - -#define IDeckLinkVideoFrameMetadataExtensions_v11_5_GetFlag(This,metadataID,value) \ - ( (This)->lpVtbl -> GetFlag(This,metadataID,value) ) - -#define IDeckLinkVideoFrameMetadataExtensions_v11_5_GetString(This,metadataID,value) \ - ( (This)->lpVtbl -> GetString(This,metadataID,value) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkVideoFrameMetadataExtensions_v11_5_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkOutput_v11_4_INTERFACE_DEFINED__ -#define __IDeckLinkOutput_v11_4_INTERFACE_DEFINED__ - -/* interface IDeckLinkOutput_v11_4 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkOutput_v11_4; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("065A0F6C-C508-4D0D-B919-F5EB0EBFC96B") - IDeckLinkOutput_v11_4 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( - /* [in] */ BMDVideoConnection connection, - /* [in] */ BMDDisplayMode requestedMode, - /* [in] */ BMDPixelFormat requestedPixelFormat, - /* [in] */ BMDSupportedVideoModeFlags flags, - /* [out] */ BMDDisplayMode *actualMode, - /* [out] */ BOOL *supported) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayMode( - /* [in] */ BMDDisplayMode displayMode, - /* [out] */ IDeckLinkDisplayMode **resultDisplayMode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( - /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( - /* [in] */ IDeckLinkScreenPreviewCallback_v14_2_1 *previewCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableVideoOutput( - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDVideoOutputFlags flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableVideoOutput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFrameMemoryAllocator( - /* [in] */ IDeckLinkMemoryAllocator_v14_2_1 *theAllocator) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateVideoFrame( - /* [in] */ int width, - /* [in] */ int height, - /* [in] */ int rowBytes, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDFrameFlags flags, - /* [out] */ IDeckLinkMutableVideoFrame_v14_2_1 **outFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateAncillaryData( - /* [in] */ BMDPixelFormat pixelFormat, - /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisplayVideoFrameSync( - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE ScheduleVideoFrame( - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame, - /* [in] */ BMDTimeValue displayTime, - /* [in] */ BMDTimeValue displayDuration, - /* [in] */ BMDTimeScale timeScale) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetScheduledFrameCompletionCallback( - /* [in] */ IDeckLinkVideoOutputCallback_v14_2_1 *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBufferedVideoFrameCount( - /* [out] */ unsigned int *bufferedFrameCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableAudioOutput( - /* [in] */ BMDAudioSampleRate sampleRate, - /* [in] */ BMDAudioSampleType sampleType, - /* [in] */ unsigned int channelCount, - /* [in] */ BMDAudioOutputStreamType streamType) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableAudioOutput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE WriteAudioSamplesSync( - /* [in] */ void *buffer, - /* [in] */ unsigned int sampleFrameCount, - /* [out] */ unsigned int *sampleFramesWritten) = 0; - - virtual HRESULT STDMETHODCALLTYPE BeginAudioPreroll( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE EndAudioPreroll( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE ScheduleAudioSamples( - /* [in] */ void *buffer, - /* [in] */ unsigned int sampleFrameCount, - /* [in] */ BMDTimeValue streamTime, - /* [in] */ BMDTimeScale timeScale, - /* [out] */ unsigned int *sampleFramesWritten) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( - /* [out] */ unsigned int *bufferedSampleFrameCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE FlushBufferedAudioSamples( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetAudioCallback( - /* [in] */ IDeckLinkAudioOutputCallback *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE StartScheduledPlayback( - /* [in] */ BMDTimeValue playbackStartTime, - /* [in] */ BMDTimeScale timeScale, - /* [in] */ double playbackSpeed) = 0; - - virtual HRESULT STDMETHODCALLTYPE StopScheduledPlayback( - /* [in] */ BMDTimeValue stopPlaybackAtTime, - /* [out] */ BMDTimeValue *actualStopTime, - /* [in] */ BMDTimeScale timeScale) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsScheduledPlaybackRunning( - /* [out] */ BOOL *active) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetScheduledStreamTime( - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *streamTime, - /* [out] */ double *playbackSpeed) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetReferenceStatus( - /* [out] */ BMDReferenceStatus *referenceStatus) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFrameCompletionReferenceTimestamp( - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame, - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *frameCompletionTimestamp) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkOutput_v11_4Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkOutput_v11_4 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkOutput_v11_4 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkOutput_v11_4 * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, DoesSupportVideoMode) - HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( - IDeckLinkOutput_v11_4 * This, - /* [in] */ BMDVideoConnection connection, - /* [in] */ BMDDisplayMode requestedMode, - /* [in] */ BMDPixelFormat requestedPixelFormat, - /* [in] */ BMDSupportedVideoModeFlags flags, - /* [out] */ BMDDisplayMode *actualMode, - /* [out] */ BOOL *supported); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, GetDisplayMode) - HRESULT ( STDMETHODCALLTYPE *GetDisplayMode )( - IDeckLinkOutput_v11_4 * This, - /* [in] */ BMDDisplayMode displayMode, - /* [out] */ IDeckLinkDisplayMode **resultDisplayMode); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, GetDisplayModeIterator) - HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( - IDeckLinkOutput_v11_4 * This, - /* [out] */ IDeckLinkDisplayModeIterator **iterator); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, SetScreenPreviewCallback) - HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( - IDeckLinkOutput_v11_4 * This, - /* [in] */ IDeckLinkScreenPreviewCallback_v14_2_1 *previewCallback); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, EnableVideoOutput) - HRESULT ( STDMETHODCALLTYPE *EnableVideoOutput )( - IDeckLinkOutput_v11_4 * This, - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDVideoOutputFlags flags); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, DisableVideoOutput) - HRESULT ( STDMETHODCALLTYPE *DisableVideoOutput )( - IDeckLinkOutput_v11_4 * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, SetVideoOutputFrameMemoryAllocator) - HRESULT ( STDMETHODCALLTYPE *SetVideoOutputFrameMemoryAllocator )( - IDeckLinkOutput_v11_4 * This, - /* [in] */ IDeckLinkMemoryAllocator_v14_2_1 *theAllocator); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, CreateVideoFrame) - HRESULT ( STDMETHODCALLTYPE *CreateVideoFrame )( - IDeckLinkOutput_v11_4 * This, - /* [in] */ int width, - /* [in] */ int height, - /* [in] */ int rowBytes, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDFrameFlags flags, - /* [out] */ IDeckLinkMutableVideoFrame_v14_2_1 **outFrame); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, CreateAncillaryData) - HRESULT ( STDMETHODCALLTYPE *CreateAncillaryData )( - IDeckLinkOutput_v11_4 * This, - /* [in] */ BMDPixelFormat pixelFormat, - /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, DisplayVideoFrameSync) - HRESULT ( STDMETHODCALLTYPE *DisplayVideoFrameSync )( - IDeckLinkOutput_v11_4 * This, - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, ScheduleVideoFrame) - HRESULT ( STDMETHODCALLTYPE *ScheduleVideoFrame )( - IDeckLinkOutput_v11_4 * This, - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame, - /* [in] */ BMDTimeValue displayTime, - /* [in] */ BMDTimeValue displayDuration, - /* [in] */ BMDTimeScale timeScale); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, SetScheduledFrameCompletionCallback) - HRESULT ( STDMETHODCALLTYPE *SetScheduledFrameCompletionCallback )( - IDeckLinkOutput_v11_4 * This, - /* [in] */ IDeckLinkVideoOutputCallback_v14_2_1 *theCallback); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, GetBufferedVideoFrameCount) - HRESULT ( STDMETHODCALLTYPE *GetBufferedVideoFrameCount )( - IDeckLinkOutput_v11_4 * This, - /* [out] */ unsigned int *bufferedFrameCount); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, EnableAudioOutput) - HRESULT ( STDMETHODCALLTYPE *EnableAudioOutput )( - IDeckLinkOutput_v11_4 * This, - /* [in] */ BMDAudioSampleRate sampleRate, - /* [in] */ BMDAudioSampleType sampleType, - /* [in] */ unsigned int channelCount, - /* [in] */ BMDAudioOutputStreamType streamType); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, DisableAudioOutput) - HRESULT ( STDMETHODCALLTYPE *DisableAudioOutput )( - IDeckLinkOutput_v11_4 * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, WriteAudioSamplesSync) - HRESULT ( STDMETHODCALLTYPE *WriteAudioSamplesSync )( - IDeckLinkOutput_v11_4 * This, - /* [in] */ void *buffer, - /* [in] */ unsigned int sampleFrameCount, - /* [out] */ unsigned int *sampleFramesWritten); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, BeginAudioPreroll) - HRESULT ( STDMETHODCALLTYPE *BeginAudioPreroll )( - IDeckLinkOutput_v11_4 * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, EndAudioPreroll) - HRESULT ( STDMETHODCALLTYPE *EndAudioPreroll )( - IDeckLinkOutput_v11_4 * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, ScheduleAudioSamples) - HRESULT ( STDMETHODCALLTYPE *ScheduleAudioSamples )( - IDeckLinkOutput_v11_4 * This, - /* [in] */ void *buffer, - /* [in] */ unsigned int sampleFrameCount, - /* [in] */ BMDTimeValue streamTime, - /* [in] */ BMDTimeScale timeScale, - /* [out] */ unsigned int *sampleFramesWritten); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, GetBufferedAudioSampleFrameCount) - HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( - IDeckLinkOutput_v11_4 * This, - /* [out] */ unsigned int *bufferedSampleFrameCount); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, FlushBufferedAudioSamples) - HRESULT ( STDMETHODCALLTYPE *FlushBufferedAudioSamples )( - IDeckLinkOutput_v11_4 * This); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, SetAudioCallback) - HRESULT ( STDMETHODCALLTYPE *SetAudioCallback )( - IDeckLinkOutput_v11_4 * This, - /* [in] */ IDeckLinkAudioOutputCallback *theCallback); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, StartScheduledPlayback) - HRESULT ( STDMETHODCALLTYPE *StartScheduledPlayback )( - IDeckLinkOutput_v11_4 * This, - /* [in] */ BMDTimeValue playbackStartTime, - /* [in] */ BMDTimeScale timeScale, - /* [in] */ double playbackSpeed); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, StopScheduledPlayback) - HRESULT ( STDMETHODCALLTYPE *StopScheduledPlayback )( - IDeckLinkOutput_v11_4 * This, - /* [in] */ BMDTimeValue stopPlaybackAtTime, - /* [out] */ BMDTimeValue *actualStopTime, - /* [in] */ BMDTimeScale timeScale); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, IsScheduledPlaybackRunning) - HRESULT ( STDMETHODCALLTYPE *IsScheduledPlaybackRunning )( - IDeckLinkOutput_v11_4 * This, - /* [out] */ BOOL *active); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, GetScheduledStreamTime) - HRESULT ( STDMETHODCALLTYPE *GetScheduledStreamTime )( - IDeckLinkOutput_v11_4 * This, - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *streamTime, - /* [out] */ double *playbackSpeed); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, GetReferenceStatus) - HRESULT ( STDMETHODCALLTYPE *GetReferenceStatus )( - IDeckLinkOutput_v11_4 * This, - /* [out] */ BMDReferenceStatus *referenceStatus); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, GetHardwareReferenceClock) - HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( - IDeckLinkOutput_v11_4 * This, - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame); - - DECLSPEC_XFGVIRT(IDeckLinkOutput_v11_4, GetFrameCompletionReferenceTimestamp) - HRESULT ( STDMETHODCALLTYPE *GetFrameCompletionReferenceTimestamp )( - IDeckLinkOutput_v11_4 * This, - /* [in] */ IDeckLinkVideoFrame_v14_2_1 *theFrame, - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *frameCompletionTimestamp); - - END_INTERFACE - } IDeckLinkOutput_v11_4Vtbl; - - interface IDeckLinkOutput_v11_4 - { - CONST_VTBL struct IDeckLinkOutput_v11_4Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkOutput_v11_4_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkOutput_v11_4_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkOutput_v11_4_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkOutput_v11_4_DoesSupportVideoMode(This,connection,requestedMode,requestedPixelFormat,flags,actualMode,supported) \ - ( (This)->lpVtbl -> DoesSupportVideoMode(This,connection,requestedMode,requestedPixelFormat,flags,actualMode,supported) ) - -#define IDeckLinkOutput_v11_4_GetDisplayMode(This,displayMode,resultDisplayMode) \ - ( (This)->lpVtbl -> GetDisplayMode(This,displayMode,resultDisplayMode) ) - -#define IDeckLinkOutput_v11_4_GetDisplayModeIterator(This,iterator) \ - ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) - -#define IDeckLinkOutput_v11_4_SetScreenPreviewCallback(This,previewCallback) \ - ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) - -#define IDeckLinkOutput_v11_4_EnableVideoOutput(This,displayMode,flags) \ - ( (This)->lpVtbl -> EnableVideoOutput(This,displayMode,flags) ) - -#define IDeckLinkOutput_v11_4_DisableVideoOutput(This) \ - ( (This)->lpVtbl -> DisableVideoOutput(This) ) - -#define IDeckLinkOutput_v11_4_SetVideoOutputFrameMemoryAllocator(This,theAllocator) \ - ( (This)->lpVtbl -> SetVideoOutputFrameMemoryAllocator(This,theAllocator) ) - -#define IDeckLinkOutput_v11_4_CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) \ - ( (This)->lpVtbl -> CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) ) - -#define IDeckLinkOutput_v11_4_CreateAncillaryData(This,pixelFormat,outBuffer) \ - ( (This)->lpVtbl -> CreateAncillaryData(This,pixelFormat,outBuffer) ) - -#define IDeckLinkOutput_v11_4_DisplayVideoFrameSync(This,theFrame) \ - ( (This)->lpVtbl -> DisplayVideoFrameSync(This,theFrame) ) - -#define IDeckLinkOutput_v11_4_ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) \ - ( (This)->lpVtbl -> ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) ) - -#define IDeckLinkOutput_v11_4_SetScheduledFrameCompletionCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetScheduledFrameCompletionCallback(This,theCallback) ) - -#define IDeckLinkOutput_v11_4_GetBufferedVideoFrameCount(This,bufferedFrameCount) \ - ( (This)->lpVtbl -> GetBufferedVideoFrameCount(This,bufferedFrameCount) ) - -#define IDeckLinkOutput_v11_4_EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) \ - ( (This)->lpVtbl -> EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) ) - -#define IDeckLinkOutput_v11_4_DisableAudioOutput(This) \ - ( (This)->lpVtbl -> DisableAudioOutput(This) ) - -#define IDeckLinkOutput_v11_4_WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) \ - ( (This)->lpVtbl -> WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) ) - -#define IDeckLinkOutput_v11_4_BeginAudioPreroll(This) \ - ( (This)->lpVtbl -> BeginAudioPreroll(This) ) - -#define IDeckLinkOutput_v11_4_EndAudioPreroll(This) \ - ( (This)->lpVtbl -> EndAudioPreroll(This) ) - -#define IDeckLinkOutput_v11_4_ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) \ - ( (This)->lpVtbl -> ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) ) - -#define IDeckLinkOutput_v11_4_GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) \ - ( (This)->lpVtbl -> GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) ) - -#define IDeckLinkOutput_v11_4_FlushBufferedAudioSamples(This) \ - ( (This)->lpVtbl -> FlushBufferedAudioSamples(This) ) - -#define IDeckLinkOutput_v11_4_SetAudioCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetAudioCallback(This,theCallback) ) - -#define IDeckLinkOutput_v11_4_StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) \ - ( (This)->lpVtbl -> StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) ) - -#define IDeckLinkOutput_v11_4_StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) \ - ( (This)->lpVtbl -> StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) ) - -#define IDeckLinkOutput_v11_4_IsScheduledPlaybackRunning(This,active) \ - ( (This)->lpVtbl -> IsScheduledPlaybackRunning(This,active) ) - -#define IDeckLinkOutput_v11_4_GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed) \ - ( (This)->lpVtbl -> GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed) ) - -#define IDeckLinkOutput_v11_4_GetReferenceStatus(This,referenceStatus) \ - ( (This)->lpVtbl -> GetReferenceStatus(This,referenceStatus) ) - -#define IDeckLinkOutput_v11_4_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) \ - ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) - -#define IDeckLinkOutput_v11_4_GetFrameCompletionReferenceTimestamp(This,theFrame,desiredTimeScale,frameCompletionTimestamp) \ - ( (This)->lpVtbl -> GetFrameCompletionReferenceTimestamp(This,theFrame,desiredTimeScale,frameCompletionTimestamp) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkOutput_v11_4_INTERFACE_DEFINED__ */ - - -#ifndef __IDeckLinkInput_v11_4_INTERFACE_DEFINED__ -#define __IDeckLinkInput_v11_4_INTERFACE_DEFINED__ - -/* interface IDeckLinkInput_v11_4 */ -/* [helpstring][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkInput_v11_4; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("2A88CF76-F494-4216-A7EF-DC74EEB83882") - IDeckLinkInput_v11_4 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( - /* [in] */ BMDVideoConnection connection, - /* [in] */ BMDDisplayMode requestedMode, - /* [in] */ BMDPixelFormat requestedPixelFormat, - /* [in] */ BMDSupportedVideoModeFlags flags, - /* [out] */ BOOL *supported) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayMode( - /* [in] */ BMDDisplayMode displayMode, - /* [out] */ IDeckLinkDisplayMode **resultDisplayMode) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( - /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( - /* [in] */ IDeckLinkScreenPreviewCallback_v14_2_1 *previewCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDVideoInputFlags flags) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAvailableVideoFrameCount( - /* [out] */ unsigned int *availableFrameCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetVideoInputFrameMemoryAllocator( - /* [in] */ IDeckLinkMemoryAllocator_v14_2_1 *theAllocator) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( - /* [in] */ BMDAudioSampleRate sampleRate, - /* [in] */ BMDAudioSampleType sampleType, - /* [in] */ unsigned int channelCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAvailableAudioSampleFrameCount( - /* [out] */ unsigned int *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_v11_5_1 *theCallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkInput_v11_4Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkInput_v11_4 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkInput_v11_4 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkInput_v11_4 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_4, DoesSupportVideoMode) - HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( - IDeckLinkInput_v11_4 * This, - /* [in] */ BMDVideoConnection connection, - /* [in] */ BMDDisplayMode requestedMode, - /* [in] */ BMDPixelFormat requestedPixelFormat, - /* [in] */ BMDSupportedVideoModeFlags flags, - /* [out] */ BOOL *supported); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_4, GetDisplayMode) - HRESULT ( STDMETHODCALLTYPE *GetDisplayMode )( - IDeckLinkInput_v11_4 * This, - /* [in] */ BMDDisplayMode displayMode, - /* [out] */ IDeckLinkDisplayMode **resultDisplayMode); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_4, GetDisplayModeIterator) - HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( - IDeckLinkInput_v11_4 * This, - /* [out] */ IDeckLinkDisplayModeIterator **iterator); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_4, SetScreenPreviewCallback) - HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( - IDeckLinkInput_v11_4 * This, - /* [in] */ IDeckLinkScreenPreviewCallback_v14_2_1 *previewCallback); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_4, EnableVideoInput) - HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( - IDeckLinkInput_v11_4 * This, - /* [in] */ BMDDisplayMode displayMode, - /* [in] */ BMDPixelFormat pixelFormat, - /* [in] */ BMDVideoInputFlags flags); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_4, DisableVideoInput) - HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( - IDeckLinkInput_v11_4 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_4, GetAvailableVideoFrameCount) - HRESULT ( STDMETHODCALLTYPE *GetAvailableVideoFrameCount )( - IDeckLinkInput_v11_4 * This, - /* [out] */ unsigned int *availableFrameCount); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_4, SetVideoInputFrameMemoryAllocator) - HRESULT ( STDMETHODCALLTYPE *SetVideoInputFrameMemoryAllocator )( - IDeckLinkInput_v11_4 * This, - /* [in] */ IDeckLinkMemoryAllocator_v14_2_1 *theAllocator); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_4, EnableAudioInput) - HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( - IDeckLinkInput_v11_4 * This, - /* [in] */ BMDAudioSampleRate sampleRate, - /* [in] */ BMDAudioSampleType sampleType, - /* [in] */ unsigned int channelCount); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_4, DisableAudioInput) - HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( - IDeckLinkInput_v11_4 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_4, GetAvailableAudioSampleFrameCount) - HRESULT ( STDMETHODCALLTYPE *GetAvailableAudioSampleFrameCount )( - IDeckLinkInput_v11_4 * This, - /* [out] */ unsigned int *availableSampleFrameCount); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_4, StartStreams) - HRESULT ( STDMETHODCALLTYPE *StartStreams )( - IDeckLinkInput_v11_4 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_4, StopStreams) - HRESULT ( STDMETHODCALLTYPE *StopStreams )( - IDeckLinkInput_v11_4 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_4, PauseStreams) - HRESULT ( STDMETHODCALLTYPE *PauseStreams )( - IDeckLinkInput_v11_4 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_4, FlushStreams) - HRESULT ( STDMETHODCALLTYPE *FlushStreams )( - IDeckLinkInput_v11_4 * This); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_4, SetCallback) - HRESULT ( STDMETHODCALLTYPE *SetCallback )( - IDeckLinkInput_v11_4 * This, - /* [in] */ IDeckLinkInputCallback_v11_5_1 *theCallback); - - DECLSPEC_XFGVIRT(IDeckLinkInput_v11_4, GetHardwareReferenceClock) - HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( - IDeckLinkInput_v11_4 * This, - /* [in] */ BMDTimeScale desiredTimeScale, - /* [out] */ BMDTimeValue *hardwareTime, - /* [out] */ BMDTimeValue *timeInFrame, - /* [out] */ BMDTimeValue *ticksPerFrame); - - END_INTERFACE - } IDeckLinkInput_v11_4Vtbl; - - interface IDeckLinkInput_v11_4 - { - CONST_VTBL struct IDeckLinkInput_v11_4Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkInput_v11_4_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkInput_v11_4_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkInput_v11_4_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkInput_v11_4_DoesSupportVideoMode(This,connection,requestedMode,requestedPixelFormat,flags,supported) \ - ( (This)->lpVtbl -> DoesSupportVideoMode(This,connection,requestedMode,requestedPixelFormat,flags,supported) ) - -#define IDeckLinkInput_v11_4_GetDisplayMode(This,displayMode,resultDisplayMode) \ - ( (This)->lpVtbl -> GetDisplayMode(This,displayMode,resultDisplayMode) ) - -#define IDeckLinkInput_v11_4_GetDisplayModeIterator(This,iterator) \ - ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) - -#define IDeckLinkInput_v11_4_SetScreenPreviewCallback(This,previewCallback) \ - ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) - -#define IDeckLinkInput_v11_4_EnableVideoInput(This,displayMode,pixelFormat,flags) \ - ( (This)->lpVtbl -> EnableVideoInput(This,displayMode,pixelFormat,flags) ) - -#define IDeckLinkInput_v11_4_DisableVideoInput(This) \ - ( (This)->lpVtbl -> DisableVideoInput(This) ) - -#define IDeckLinkInput_v11_4_GetAvailableVideoFrameCount(This,availableFrameCount) \ - ( (This)->lpVtbl -> GetAvailableVideoFrameCount(This,availableFrameCount) ) - -#define IDeckLinkInput_v11_4_SetVideoInputFrameMemoryAllocator(This,theAllocator) \ - ( (This)->lpVtbl -> SetVideoInputFrameMemoryAllocator(This,theAllocator) ) - -#define IDeckLinkInput_v11_4_EnableAudioInput(This,sampleRate,sampleType,channelCount) \ - ( (This)->lpVtbl -> EnableAudioInput(This,sampleRate,sampleType,channelCount) ) - -#define IDeckLinkInput_v11_4_DisableAudioInput(This) \ - ( (This)->lpVtbl -> DisableAudioInput(This) ) - -#define IDeckLinkInput_v11_4_GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) \ - ( (This)->lpVtbl -> GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) ) - -#define IDeckLinkInput_v11_4_StartStreams(This) \ - ( (This)->lpVtbl -> StartStreams(This) ) - -#define IDeckLinkInput_v11_4_StopStreams(This) \ - ( (This)->lpVtbl -> StopStreams(This) ) - -#define IDeckLinkInput_v11_4_PauseStreams(This) \ - ( (This)->lpVtbl -> PauseStreams(This) ) - -#define IDeckLinkInput_v11_4_FlushStreams(This) \ - ( (This)->lpVtbl -> FlushStreams(This) ) - -#define IDeckLinkInput_v11_4_SetCallback(This,theCallback) \ - ( (This)->lpVtbl -> SetCallback(This,theCallback) ) - -#define IDeckLinkInput_v11_4_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) \ - ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkInput_v11_4_INTERFACE_DEFINED__ */ - - -EXTERN_C const CLSID CLSID_CDeckLinkIterator_v10_8; - -#ifdef __cplusplus - -class DECLSPEC_UUID("1F2E109A-8F4F-49E4-9203-135595CB6FA5") -CDeckLinkIterator_v10_8; -#endif - -EXTERN_C const CLSID CLSID_CDeckLinkDiscovery_v10_8; - -#ifdef __cplusplus - -class DECLSPEC_UUID("1073A05C-D885-47E9-B3C6-129B3F9F648B") -CDeckLinkDiscovery_v10_8; -#endif - -#ifndef __IDeckLinkEncoderConfiguration_v10_5_INTERFACE_DEFINED__ -#define __IDeckLinkEncoderConfiguration_v10_5_INTERFACE_DEFINED__ - -/* interface IDeckLinkEncoderConfiguration_v10_5 */ -/* [helpstring][local][uuid][object] */ - - -EXTERN_C const IID IID_IDeckLinkEncoderConfiguration_v10_5; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("67455668-0848-45DF-8D8E-350A77C9A028") - IDeckLinkEncoderConfiguration_v10_5 : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SetFlag( - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [in] */ BOOL value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFlag( - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [out] */ BOOL *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetInt( - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [in] */ LONGLONG value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetInt( - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [out] */ LONGLONG *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetFloat( - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [in] */ double value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFloat( - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [out] */ double *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetString( - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [in] */ BSTR value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetString( - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [out] */ BSTR *value) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDecoderConfigurationInfo( - /* [out] */ void *buffer, - /* [in] */ long bufferSize, - /* [out] */ long *returnedSize) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDeckLinkEncoderConfiguration_v10_5Vtbl - { - BEGIN_INTERFACE - - DECLSPEC_XFGVIRT(IUnknown, QueryInterface) - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDeckLinkEncoderConfiguration_v10_5 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - DECLSPEC_XFGVIRT(IUnknown, AddRef) - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDeckLinkEncoderConfiguration_v10_5 * This); - - DECLSPEC_XFGVIRT(IUnknown, Release) - ULONG ( STDMETHODCALLTYPE *Release )( - IDeckLinkEncoderConfiguration_v10_5 * This); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderConfiguration_v10_5, SetFlag) - HRESULT ( STDMETHODCALLTYPE *SetFlag )( - IDeckLinkEncoderConfiguration_v10_5 * This, - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [in] */ BOOL value); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderConfiguration_v10_5, GetFlag) - HRESULT ( STDMETHODCALLTYPE *GetFlag )( - IDeckLinkEncoderConfiguration_v10_5 * This, - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [out] */ BOOL *value); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderConfiguration_v10_5, SetInt) - HRESULT ( STDMETHODCALLTYPE *SetInt )( - IDeckLinkEncoderConfiguration_v10_5 * This, - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [in] */ LONGLONG value); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderConfiguration_v10_5, GetInt) - HRESULT ( STDMETHODCALLTYPE *GetInt )( - IDeckLinkEncoderConfiguration_v10_5 * This, - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [out] */ LONGLONG *value); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderConfiguration_v10_5, SetFloat) - HRESULT ( STDMETHODCALLTYPE *SetFloat )( - IDeckLinkEncoderConfiguration_v10_5 * This, - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [in] */ double value); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderConfiguration_v10_5, GetFloat) - HRESULT ( STDMETHODCALLTYPE *GetFloat )( - IDeckLinkEncoderConfiguration_v10_5 * This, - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [out] */ double *value); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderConfiguration_v10_5, SetString) - HRESULT ( STDMETHODCALLTYPE *SetString )( - IDeckLinkEncoderConfiguration_v10_5 * This, - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [in] */ BSTR value); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderConfiguration_v10_5, GetString) - HRESULT ( STDMETHODCALLTYPE *GetString )( - IDeckLinkEncoderConfiguration_v10_5 * This, - /* [in] */ BMDDeckLinkEncoderConfigurationID cfgID, - /* [out] */ BSTR *value); - - DECLSPEC_XFGVIRT(IDeckLinkEncoderConfiguration_v10_5, GetDecoderConfigurationInfo) - HRESULT ( STDMETHODCALLTYPE *GetDecoderConfigurationInfo )( - IDeckLinkEncoderConfiguration_v10_5 * This, - /* [out] */ void *buffer, - /* [in] */ long bufferSize, - /* [out] */ long *returnedSize); - - END_INTERFACE - } IDeckLinkEncoderConfiguration_v10_5Vtbl; - - interface IDeckLinkEncoderConfiguration_v10_5 - { - CONST_VTBL struct IDeckLinkEncoderConfiguration_v10_5Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDeckLinkEncoderConfiguration_v10_5_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDeckLinkEncoderConfiguration_v10_5_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDeckLinkEncoderConfiguration_v10_5_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDeckLinkEncoderConfiguration_v10_5_SetFlag(This,cfgID,value) \ - ( (This)->lpVtbl -> SetFlag(This,cfgID,value) ) - -#define IDeckLinkEncoderConfiguration_v10_5_GetFlag(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) - -#define IDeckLinkEncoderConfiguration_v10_5_SetInt(This,cfgID,value) \ - ( (This)->lpVtbl -> SetInt(This,cfgID,value) ) - -#define IDeckLinkEncoderConfiguration_v10_5_GetInt(This,cfgID,value) \ - ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) - -#define IDeckLinkEncoderConfiguration_v10_5_SetFloat(This,cfgID,value) \ - ( (This)->lpVtbl -> SetFloat(This,cfgID,value) ) - -#define IDeckLinkEncoderConfiguration_v10_5_GetFloat(This,cfgID,value) \ - ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) - -#define IDeckLinkEncoderConfiguration_v10_5_SetString(This,cfgID,value) \ - ( (This)->lpVtbl -> SetString(This,cfgID,value) ) - -#define IDeckLinkEncoderConfiguration_v10_5_GetString(This,cfgID,value) \ - ( (This)->lpVtbl -> GetString(This,cfgID,value) ) - -#define IDeckLinkEncoderConfiguration_v10_5_GetDecoderConfigurationInfo(This,buffer,bufferSize,returnedSize) \ - ( (This)->lpVtbl -> GetDecoderConfigurationInfo(This,buffer,bufferSize,returnedSize) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDeckLinkEncoderConfiguration_v10_5_INTERFACE_DEFINED__ */ - -#endif /* __DeckLinkAPI_LIBRARY_DEFINED__ */ - -/* Additional Prototypes for ALL interfaces */ - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkAPI_i.c b/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkAPI_i.c deleted file mode 100644 index df3177a..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkAPI_i.c +++ /dev/null @@ -1,486 +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 8.01.0628 */ -/* at Tue Jan 19 14:14:07 2038 - */ -/* Compiler settings for ..\..\3rdParty\Blackmagic DeckLink SDK 16.0\Win\include\DeckLinkAPI.idl: - Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.01.0628 - protocol : all , 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( ) */ - - - -#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) \ - EXTERN_C __declspec(selectany) 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_IDeckLinkTimecode,0xBC6CFBD3,0x8317,0x4325,0xAC,0x1C,0x12,0x16,0x39,0x1E,0x93,0x40); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkDisplayModeIterator,0x9C88499F,0xF601,0x4021,0xB8,0x0B,0x03,0x2E,0x4E,0xB4,0x1C,0x35); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkDisplayMode,0x3EB2C1AB,0x0A3D,0x4523,0xA3,0xAD,0xF4,0x0D,0x7F,0xB1,0x4E,0x78); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLink,0xC418FBDD,0x0587,0x48ED,0x8F,0xE5,0x64,0x0F,0x0A,0x14,0xAF,0x91); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkConfiguration,0x5a68ffd4,0x1c12,0x4ede,0xa6,0xd2,0x45,0x45,0x1d,0x38,0x5f,0xc1); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkEncoderConfiguration,0x138050E5,0xC60A,0x4552,0xBF,0x3F,0x0F,0x35,0x80,0x49,0x32,0x7E); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkDeckControlStatusCallback,0x53436FFB,0xB434,0x4906,0xBA,0xDC,0xAE,0x30,0x60,0xFF,0xE8,0xEF); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkDeckControl,0x8E1C3ACE,0x19C7,0x4E00,0x8B,0x92,0xD8,0x04,0x31,0xD9,0x58,0xBE); - - -MIDL_DEFINE_GUID(IID, IID_IBMDStreamingDeviceNotificationCallback,0xF9531D64,0x3305,0x4B29,0xA3,0x87,0x7F,0x74,0xBB,0x0D,0x0E,0x84); - - -MIDL_DEFINE_GUID(IID, IID_IBMDStreamingH264InputCallback,0x823C475F,0x55AE,0x46F9,0x89,0x0C,0x53,0x7C,0xC5,0xCE,0xDC,0xCA); - - -MIDL_DEFINE_GUID(IID, IID_IBMDStreamingDiscovery,0x2C837444,0xF989,0x4D87,0x90,0x1A,0x47,0xC8,0xA3,0x6D,0x09,0x6D); - - -MIDL_DEFINE_GUID(IID, IID_IBMDStreamingVideoEncodingMode,0x1AB8035B,0xCD13,0x458D,0xB6,0xDF,0x5E,0x8F,0x7C,0x21,0x41,0xD9); - - -MIDL_DEFINE_GUID(IID, IID_IBMDStreamingMutableVideoEncodingMode,0x19BF7D90,0x1E0A,0x400D,0xB2,0xC6,0xFF,0xC4,0xE7,0x8A,0xD4,0x9D); - - -MIDL_DEFINE_GUID(IID, IID_IBMDStreamingVideoEncodingModePresetIterator,0x7AC731A3,0xC950,0x4AD0,0x80,0x4A,0x83,0x77,0xAA,0x51,0xC6,0xC4); - - -MIDL_DEFINE_GUID(IID, IID_IBMDStreamingDeviceInput,0x24B6B6EC,0x1727,0x44BB,0x98,0x18,0x34,0xFF,0x08,0x6A,0xCF,0x98); - - -MIDL_DEFINE_GUID(IID, IID_IBMDStreamingH264NALPacket,0xE260E955,0x14BE,0x4395,0x97,0x75,0x9F,0x02,0xCC,0x0A,0x9D,0x89); - - -MIDL_DEFINE_GUID(IID, IID_IBMDStreamingAudioPacket,0xD9EB5902,0x1AD2,0x43F4,0x9E,0x2C,0x3C,0xFA,0x50,0xB5,0xEE,0x19); - - -MIDL_DEFINE_GUID(IID, IID_IBMDStreamingMPEG2TSPacket,0x91810D1C,0x4FB3,0x4AAA,0xAE,0x56,0xFA,0x30,0x1D,0x3D,0xFA,0x4C); - - -MIDL_DEFINE_GUID(IID, IID_IBMDStreamingH264NALParser,0x5867F18C,0x5BFA,0x4CCC,0xB2,0xA7,0x9D,0xFD,0x14,0x04,0x17,0xD2); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CBMDStreamingDiscovery,0x23A4EDF5,0xA0E5,0x432C,0x94,0xEF,0x3B,0xAB,0xB5,0xF8,0x1C,0x82); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CBMDStreamingH264NALParser,0x7753EFBD,0x951C,0x407C,0x97,0xA5,0x23,0xC7,0x37,0xB7,0x3B,0x52); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoOutputCallback,0x5BE6DF26,0x02CE,0x433E,0x99,0xD9,0x9A,0x87,0xC3,0xAC,0x17,0x1F); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkInputCallback,0x3A94F075,0xC37D,0x4BA8,0xBC,0xC0,0x1D,0x77,0x8C,0x8F,0x88,0x1B); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkEncoderInputCallback,0xACF13E61,0xF4A0,0x4974,0xA6,0xA7,0x59,0xAF,0xF6,0x26,0x8B,0x31); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoBufferAllocator,0xF35DFA8D,0x9078,0x4622,0x95,0xBB,0x56,0x89,0x40,0x54,0xEB,0x0F); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoBufferAllocatorProvider,0x6DF6F20A,0xD8DF,0x45D2,0x89,0x14,0x38,0x3C,0xE7,0xE6,0x24,0x3F); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkAudioOutputCallback,0x403C681B,0x7F46,0x4A12,0xB9,0x93,0x2B,0xB1,0x27,0x08,0x4E,0xE6); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkIterator,0x50FB36CD,0x3063,0x4B73,0xBD,0xBB,0x95,0x80,0x87,0xF2,0xD8,0xBA); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkAPIInformation,0x7BEA3C68,0x730D,0x4322,0xAF,0x34,0x8A,0x71,0x52,0xB5,0x32,0xA4); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkIPFlowAttributes,0xCDA938DA,0x6479,0x40C6,0xB2,0xEC,0xA3,0x57,0x9B,0x3A,0xEE,0xCD); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkIPFlowStatus,0x31C41656,0x4992,0x4396,0xBB,0xE9,0x5F,0x84,0x06,0xAA,0xB5,0xAF); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkIPFlowSetting,0x86DD9174,0x27D3,0x4032,0xB2,0xAD,0x60,0x67,0xC3,0xBB,0x24,0x24); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkIPFlow,0xC5FC83C7,0x5B8E,0x42A7,0x9A,0x40,0x7C,0x06,0x59,0x55,0xD4,0xE1); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkIPFlowIterator,0xBD296AB2,0xA5C5,0x4153,0x88,0x8F,0xAA,0xB1,0xFD,0xBD,0x8A,0x5C); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkOutput,0x5F227C95,0x39D7,0x46C7,0x8B,0x7D,0x9C,0x81,0x79,0x5F,0xBB,0xE4); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkInput,0x6A515F8A,0xFBCE,0x4853,0xB0,0xF7,0x2A,0x09,0xDB,0x1E,0xCA,0x0B); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkIPExtensions,0x46CF7903,0xA9FD,0x4D0B,0x8F,0xFC,0x01,0x03,0x72,0x2A,0xB4,0x42); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkHDMIInputEDID,0xABBBACBC,0x45BC,0x4665,0x9D,0x92,0xAC,0xE6,0xE5,0xA9,0x79,0x02); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkEncoderInput,0x46C1332E,0x6FD9,0x472A,0x85,0x91,0xFE,0x59,0xC2,0x21,0x92,0xE1); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoBuffer,0x81F03D70,0xDE13,0x4B17,0x87,0x3A,0xC8,0xAC,0x96,0x89,0xC6,0x82); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrame,0x6502091C,0x615F,0x4F51,0xBA,0xF6,0x45,0xC4,0x25,0x6D,0xD5,0xB0); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkMutableVideoFrame,0xCF9EB134,0x0374,0x4C5B,0x95,0xFA,0x1E,0xC1,0x48,0x19,0xFF,0x62); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrame3DExtensions,0xD4DBE9C6,0xB4D2,0x49D3,0xAB,0xF2,0xB4,0xE8,0x6C,0x73,0x91,0xB0); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrameMetadataExtensions,0xE232A5B7,0x4DB4,0x44C9,0x91,0x52,0xF4,0x7C,0x12,0xE5,0xF0,0x51); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrameMutableMetadataExtensions,0xCC198FC6,0x8298,0x4419,0x94,0x2D,0x83,0x57,0xEC,0x35,0x5E,0x58); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoInputFrame,0xC9ADD3D2,0xBE52,0x488D,0xAB,0x2D,0x7F,0xDE,0xF7,0xAF,0x0C,0x95); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkAncillaryPacket,0xF5C0D498,0x5CD3,0x4C77,0x97,0x73,0x8E,0xFA,0x20,0xBB,0x33,0x4B); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkAncillaryPacketIterator,0x10F1AA88,0x54BE,0x42F7,0xB9,0xF8,0xEC,0x2F,0x5F,0x09,0x95,0x51); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrameAncillaryPackets,0x8A72D630,0x8070,0x4D05,0x8A,0x93,0xE6,0x0C,0x40,0xEE,0x08,0x8A); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrameAncillary,0x732E723C,0xD1A4,0x4E29,0x9E,0x8E,0x4A,0x88,0x79,0x7A,0x00,0x04); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkEncoderPacket,0xB693F36C,0x316E,0x4AF1,0xB6,0xC2,0xF3,0x89,0xA4,0xBC,0xA6,0x20); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkEncoderVideoPacket,0x4E7FD944,0xE8C7,0x4EAC,0xB8,0xC0,0x7B,0x77,0xF8,0x0F,0x5A,0xE0); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkEncoderAudioPacket,0x49E8EDC8,0x693B,0x4E14,0x8E,0xF6,0x12,0xC6,0x58,0xF5,0xA0,0x7A); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkH265NALPacket,0x639C8E0B,0x68D5,0x4BDE,0xA6,0xD4,0x95,0xF3,0xAE,0xAF,0xF2,0xE7); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkAudioInputPacket,0xE43D5870,0x2894,0x11DE,0x8C,0x30,0x08,0x00,0x20,0x0C,0x9A,0x66); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkScreenPreviewCallback,0xD4FA2345,0x9FBA,0x4497,0x95,0xC3,0xC0,0xC3,0xCE,0xD3,0xCD,0xA8); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkGLScreenPreviewHelper,0xCEB778E2,0xC202,0x4EC8,0x90,0x85,0x0C,0xD2,0x85,0xCC,0x55,0x22); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkDX9ScreenPreviewHelper,0xF2DD78CA,0x2921,0x4AC2,0xB5,0xBC,0xBF,0xDC,0xC2,0x03,0x5A,0x1F); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkWPFDX9ScreenPreviewHelper,0xC59346CD,0x9326,0x4266,0xAC,0x2D,0x5C,0x19,0x0F,0x57,0x99,0xEE); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkNotificationCallback,0xb002a1ec,0x070d,0x4288,0x82,0x89,0xbd,0x5d,0x36,0xe5,0xff,0x0d); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkNotification,0x1d70faac,0xfd27,0x4866,0x9d,0xe6,0x09,0x39,0xd1,0xe4,0xc7,0xf1); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkProfileAttributes,0xF47551D7,0xAD22,0x47AF,0xBC,0xFD,0x6B,0xE8,0x8A,0xA8,0x79,0xD9); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkProfileIterator,0x29E5A8C0,0x8BE4,0x46EB,0x93,0xAC,0x31,0xDA,0xAB,0x5B,0x7B,0xF2); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkProfile,0x16093466,0x674A,0x432B,0x9D,0xA0,0x1A,0xC2,0xC5,0xA8,0x24,0x1C); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkProfileCallback,0xA4F9341E,0x97AA,0x4E04,0x89,0x35,0x15,0xF8,0x09,0x89,0x8C,0xEA); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkProfileManager,0x30D41429,0x3998,0x4B6D,0x84,0xF8,0x78,0xC9,0x4A,0x79,0x7C,0x6E); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkStatistics,0x21CB2ED1,0x4429,0x42BE,0xAA,0xF3,0x22,0xA3,0xB1,0xDD,0x3A,0xE0); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkStatus,0x2A04A635,0xED42,0x41EF,0x93,0x42,0x0E,0x11,0xF8,0xCF,0x6B,0x5E); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkKeyer,0x89AFCAF5,0x65F8,0x421E,0x98,0xF7,0x96,0xFE,0x5F,0x5B,0xFB,0xA3); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoConversion,0x94C536D6,0xC821,0x42F5,0xA6,0x00,0xC6,0x66,0x29,0x95,0x51,0x01); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkDeviceNotificationCallback,0x4997053B,0x0ADF,0x4CC8,0xAC,0x70,0x7A,0x50,0xC4,0xBE,0x72,0x8F); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkDiscovery,0xCDBF631C,0xBC76,0x45FA,0xB4,0x4D,0xC5,0x50,0x59,0xBC,0x61,0x01); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkIterator,0xBA6C6F44,0x6DA5,0x4DCE,0x94,0xAA,0xEE,0x2D,0x13,0x72,0xA6,0x76); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkAPIInformation,0x263CA19F,0xED09,0x482E,0x9F,0x9D,0x84,0x00,0x57,0x83,0xA2,0x37); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkGLScreenPreviewHelper,0x1E332DAE,0x0D04,0x49EB,0xB8,0xA1,0xB6,0xE0,0x0B,0x2B,0x6B,0xD0); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkGL3ScreenPreviewHelper,0x166804E4,0x15EF,0x4BFD,0xB6,0x23,0xB5,0xBA,0x92,0x16,0x67,0xC5); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkDX9ScreenPreviewHelper,0x0EB111ED,0xADA6,0x43A6,0x8B,0x16,0xCA,0x5D,0x27,0xEE,0xA1,0x5E); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkWPFDX9ScreenPreviewHelper,0x5E64496D,0x4BB2,0x45D5,0x9B,0x63,0xBF,0x1B,0x46,0x3B,0x18,0xAF); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkVideoConversion,0x771AD62D,0x671F,0x4442,0xAC,0x90,0xB0,0x70,0xC5,0x41,0x09,0x0A); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkDiscovery,0x22FBFC33,0x8D07,0x495C,0xA5,0xBF,0xDA,0xB5,0xEA,0x9B,0x82,0xDB); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkVideoFrameAncillaryPackets,0x6F47097E,0xB390,0x4650,0xBC,0xB6,0xC4,0xD5,0x2F,0xAA,0x16,0x43); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkStatus_v15_3_1,0x5F558200,0x4028,0x49BC,0xBE,0xAC,0xDB,0x3F,0xA4,0xA9,0x6E,0x46); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkConfiguration_v15_3_1,0x912F634B,0x2D4E,0x40A4,0x8A,0xAB,0x8D,0x80,0xB7,0x3F,0x12,0x89); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoBuffer_v15_3_1,0xCCB4B64A,0x5C86,0x4E02,0xB7,0x78,0x88,0x5D,0x35,0x27,0x09,0xFE); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoBufferAllocator_v15_3_1,0x3481A4DF,0x2B11,0x4E55,0xAC,0x61,0x83,0x6B,0x87,0x98,0x5E,0x9A); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoBufferAllocatorProvider_v15_3_1,0x08B80403,0xBFF2,0x49D0,0xB4,0x48,0x8C,0x90,0x8B,0x9E,0x9F,0xC9); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkInput_v15_3_1,0x4095DB82,0xE294,0x4B8C,0xAA,0xA8,0x3B,0x9E,0x80,0xC4,0x93,0x36); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkOutput_v15_3_1,0x1A8077F1,0x9FE2,0x4533,0x81,0x47,0x22,0x94,0x30,0x5E,0x25,0x3F); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoConversion_v15_3_1,0xA48755D9,0x8BD5,0x4727,0xA1,0xE9,0x06,0x9F,0xDE,0xDB,0xA6,0xE9); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkNotification_v15_3_1,0xB85DF4C8,0xBDF5,0x47C1,0x80,0x64,0x28,0x16,0x2E,0xBD,0xD4,0xEB); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkVideoConversion_v15_3_1,0x89BA47BD,0x1FE2,0x4D76,0x9B,0xFE,0xDE,0x85,0x04,0x9C,0x49,0x87); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkProfileAttributes_v15_3_1,0x17D4BF8E,0x4911,0x473A,0x80,0xA0,0x73,0x1C,0xF6,0xFF,0x34,0x5B); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoOutputCallback_v14_2_1,0x20AA5225,0x1958,0x47CB,0x82,0x0B,0x80,0xA8,0xD5,0x21,0xA6,0xEE); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkInputCallback_v14_2_1,0xC6FCE4C9,0xC4E4,0x4047,0x82,0xFB,0x5D,0x23,0x82,0x32,0xA9,0x02); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkMemoryAllocator_v14_2_1,0xB36EB6E7,0x9D29,0x4AA8,0x92,0xEF,0x84,0x3B,0x87,0xA2,0x89,0xE8); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkOutput_v14_2_1,0xBE2D9020,0x461E,0x442F,0x84,0xB7,0xE9,0x49,0xCB,0x95,0x3B,0x9D); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkInput_v14_2_1,0xC21CDB6E,0xF414,0x46E4,0xA6,0x36,0x80,0xA5,0x66,0xE0,0xED,0x37); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkEncoderInput_v14_2_1,0xF222551D,0x13DF,0x4FD8,0xB5,0x87,0x9D,0x4F,0x19,0xEC,0x12,0xC9); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrame_v14_2_1,0x3F716FE0,0xF023,0x4111,0xBE,0x5D,0xEF,0x44,0x14,0xC0,0x5B,0x17); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkMutableVideoFrame_v14_2_1,0x69E2639F,0x40DA,0x4E19,0xB6,0xF2,0x20,0xAC,0xE8,0x15,0xC3,0x90); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrame3DExtensions_v14_2_1,0xDA0F7E4A,0xEDC7,0x48A8,0x9C,0xDD,0x2D,0xB5,0x1C,0x72,0x9C,0xD7); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoInputFrame_v14_2_1,0x05CFE374,0x537C,0x4094,0x9A,0x57,0x68,0x05,0x25,0x11,0x8F,0x44); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkScreenPreviewCallback_v14_2_1,0xB1D3F49A,0x85FE,0x4C5D,0x95,0xC8,0x0B,0x5D,0x5D,0xCC,0xD4,0x38); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkGLScreenPreviewHelper_v14_2_1,0x504E2209,0xCAC7,0x4C1A,0x9F,0xB4,0xC5,0xBB,0x62,0x74,0xD2,0x2F); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkDX9ScreenPreviewHelper_v14_2_1,0x2094B522,0xD1A1,0x40C0,0x9A,0xC7,0x1C,0x01,0x22,0x18,0xEF,0x02); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1,0xAD8EC84A,0x7DDE,0x11E9,0x8F,0x9E,0x2A,0x86,0xE4,0x08,0x5A,0x59); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoConversion_v14_2_1,0x3BBCB8A2,0xDA2C,0x42D9,0xB5,0xD8,0x88,0x08,0x36,0x44,0xE9,0x9A); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkGLScreenPreviewHelper_v14_2_1,0xF63E77C7,0xB655,0x4A4A,0x9A,0xD0,0x3C,0xA8,0x5D,0x39,0x43,0x43); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkGL3ScreenPreviewHelper_v14_2_1,0x00696A71,0xEBC7,0x491F,0xAC,0x02,0x18,0xD3,0x39,0x3F,0x33,0xF0); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkDX9ScreenPreviewHelper_v14_2_1,0xCC010023,0xE01D,0x4525,0x9D,0x59,0x80,0xC8,0xAB,0x3D,0xC7,0xA0); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkWPFDX9ScreenPreviewHelper_v14_2_1,0xEF2A8478,0x7DDF,0x11E9,0x8F,0x9E,0x2A,0x86,0xE4,0x08,0x5A,0x59); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkVideoConversion_v14_2_1,0x7DBBBB11,0x5B7B,0x467D,0xAE,0xA4,0xCE,0xA4,0x68,0xFD,0x36,0x8C); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkInputCallback_v11_5_1,0xDD04E5EC,0x7415,0x42AB,0xAE,0x4A,0xE8,0x0C,0x4D,0xFC,0x04,0x4A); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkInput_v11_5_1,0x9434C6E4,0xB15D,0x4B1C,0x97,0x9E,0x66,0x1E,0x3D,0xDC,0xB4,0xB9); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkConfiguration_v10_11,0xEF90380B,0x4AE5,0x4346,0x90,0x77,0xE2,0x88,0xE1,0x49,0xF1,0x29); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkAttributes_v10_11,0xABC11843,0xD966,0x44CB,0x96,0xE2,0xA1,0xCB,0x5D,0x31,0x35,0xC4); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkNotification_v10_11,0x0A1FB207,0xE215,0x441B,0x9B,0x19,0x6F,0xA1,0x57,0x59,0x46,0xC5); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkOutput_v10_11,0xCC5C8A6E,0x3F2F,0x4B3A,0x87,0xEA,0xFD,0x78,0xAF,0x30,0x05,0x64); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkInput_v10_11,0xAF22762B,0xDFAC,0x4846,0xAA,0x79,0xFA,0x88,0x83,0x56,0x09,0x95); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkEncoderInput_v10_11,0x270587DA,0x6B7D,0x42E7,0xA1,0xF0,0x6D,0x85,0x3F,0x58,0x11,0x85); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkIterator_v10_11,0x87D2693F,0x8D4A,0x45C7,0xB4,0x3F,0x10,0xAC,0xBA,0x25,0xE6,0x8F); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkDiscovery_v10_11,0x652615D4,0x26CD,0x4514,0xB1,0x61,0x2F,0xD5,0x07,0x2E,0xD0,0x08); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkConfiguration_v10_9,0xCB71734A,0xFE37,0x4E8D,0x8E,0x13,0x80,0x21,0x33,0xA1,0xC3,0xF2); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CBMDStreamingDiscovery_v10_8,0x0CAA31F6,0x8A26,0x40B0,0x86,0xA4,0xBF,0x58,0xDC,0xCA,0x71,0x0C); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkConfiguration_v10_4,0x1E69FCF6,0x4203,0x4936,0x80,0x76,0x2A,0x9F,0x4C,0xFD,0x50,0xCB); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkConfiguration_v10_2,0xC679A35B,0x610C,0x4D09,0xB7,0x48,0x1D,0x04,0x78,0x10,0x0F,0xC0); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkAncillaryPacket_v15_2,0xCC5BBF7E,0x029C,0x4D3B,0x91,0x58,0x60,0x00,0xEF,0x5E,0x36,0x70); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkAncillaryPacketIterator_v15_2,0x3FC8994B,0x88FB,0x4C17,0x96,0x8F,0x9A,0xAB,0x69,0xD9,0x64,0xA7); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrameAncillaryPackets_v15_2,0x6C186C0F,0x459E,0x41D8,0xAE,0xE2,0x48,0x12,0xD8,0x1A,0xEE,0x68); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkVideoFrameAncillaryPackets_v15_2,0xF891AD29,0xD0C2,0x46E9,0xA9,0x26,0x4E,0x2D,0x0D,0xD8,0xCF,0xAD); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrameMetadataExtensions_v11_5,0xD5973DC9,0x6432,0x46D0,0x8F,0x0B,0x24,0x96,0xF8,0xA1,0x23,0x8F); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkOutput_v11_4,0x065A0F6C,0xC508,0x4D0D,0xB9,0x19,0xF5,0xEB,0x0E,0xBF,0xC9,0x6B); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkInput_v11_4,0x2A88CF76,0xF494,0x4216,0xA7,0xEF,0xDC,0x74,0xEE,0xB8,0x38,0x82); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkIterator_v10_8,0x1F2E109A,0x8F4F,0x49E4,0x92,0x03,0x13,0x55,0x95,0xCB,0x6F,0xA5); - - -MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkDiscovery_v10_8,0x1073A05C,0xD885,0x47E9,0xB3,0xC6,0x12,0x9B,0x3F,0x9F,0x64,0x8B); - - -MIDL_DEFINE_GUID(IID, IID_IDeckLinkEncoderConfiguration_v10_5,0x67455668,0x0848,0x45DF,0x8D,0x8E,0x35,0x0A,0x77,0xC9,0xA0,0x28); - -#undef MIDL_DEFINE_GUID - -#ifdef __cplusplus -} -#endif - - - diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkDisplayMode.cpp b/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkDisplayMode.cpp deleted file mode 100644 index 85bf5ea..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkDisplayMode.cpp +++ /dev/null @@ -1,146 +0,0 @@ -#include "DeckLinkDisplayMode.h" - -#include - -std::string NormalizeModeToken(const std::string& value) -{ - std::string normalized; - for (unsigned char ch : value) - { - if (std::isalnum(ch)) - normalized.push_back(static_cast(std::tolower(ch))); - } - return normalized; -} - -bool ResolveConfiguredDisplayMode(const std::string& videoFormat, const std::string& frameRate, BMDDisplayMode& displayMode, std::string& displayModeName) -{ - VideoFormat videoMode; - if (!ResolveConfiguredVideoFormat(videoFormat, frameRate, videoMode)) - return false; - - displayMode = videoMode.displayMode; - displayModeName = videoMode.displayName; - return true; -} - -bool ResolveConfiguredVideoFormat(const std::string& videoFormat, const std::string& frameRate, VideoFormat& videoMode) -{ - const std::string formatToken = NormalizeModeToken(videoFormat); - const std::string frameToken = NormalizeModeToken(frameRate); - const std::string combinedToken = formatToken + frameToken; - - struct ModeOption - { - const char* token; - BMDDisplayMode mode; - const char* displayName; - }; - - static const ModeOption options[] = - { - { "720p50", bmdModeHD720p50, "720p50" }, - { "hd720p50", bmdModeHD720p50, "720p50" }, - { "720p5994", bmdModeHD720p5994, "720p59.94" }, - { "hd720p5994", bmdModeHD720p5994, "720p59.94" }, - { "720p60", bmdModeHD720p60, "720p60" }, - { "hd720p60", bmdModeHD720p60, "720p60" }, - { "1080i50", bmdModeHD1080i50, "1080i50" }, - { "hd1080i50", bmdModeHD1080i50, "1080i50" }, - { "1080i5994", bmdModeHD1080i5994, "1080i59.94" }, - { "hd1080i5994", bmdModeHD1080i5994, "1080i59.94" }, - { "1080i60", bmdModeHD1080i6000, "1080i60" }, - { "hd1080i60", bmdModeHD1080i6000, "1080i60" }, - { "1080p2398", bmdModeHD1080p2398, "1080p23.98" }, - { "hd1080p2398", bmdModeHD1080p2398, "1080p23.98" }, - { "1080p24", bmdModeHD1080p24, "1080p24" }, - { "hd1080p24", bmdModeHD1080p24, "1080p24" }, - { "1080p25", bmdModeHD1080p25, "1080p25" }, - { "hd1080p25", bmdModeHD1080p25, "1080p25" }, - { "1080p2997", bmdModeHD1080p2997, "1080p29.97" }, - { "hd1080p2997", bmdModeHD1080p2997, "1080p29.97" }, - { "1080p30", bmdModeHD1080p30, "1080p30" }, - { "hd1080p30", bmdModeHD1080p30, "1080p30" }, - { "1080p50", bmdModeHD1080p50, "1080p50" }, - { "hd1080p50", bmdModeHD1080p50, "1080p50" }, - { "1080p5994", bmdModeHD1080p5994, "1080p59.94" }, - { "hd1080p5994", bmdModeHD1080p5994, "1080p59.94" }, - { "1080p60", bmdModeHD1080p6000, "1080p60" }, - { "hd1080p60", bmdModeHD1080p6000, "1080p60" }, - { "2160p2398", bmdMode4K2160p2398, "2160p23.98" }, - { "4k2160p2398", bmdMode4K2160p2398, "2160p23.98" }, - { "2160p24", bmdMode4K2160p24, "2160p24" }, - { "4k2160p24", bmdMode4K2160p24, "2160p24" }, - { "2160p25", bmdMode4K2160p25, "2160p25" }, - { "4k2160p25", bmdMode4K2160p25, "2160p25" }, - { "2160p2997", bmdMode4K2160p2997, "2160p29.97" }, - { "4k2160p2997", bmdMode4K2160p2997, "2160p29.97" }, - { "2160p30", bmdMode4K2160p30, "2160p30" }, - { "4k2160p30", bmdMode4K2160p30, "2160p30" }, - { "2160p50", bmdMode4K2160p50, "2160p50" }, - { "4k2160p50", bmdMode4K2160p50, "2160p50" }, - { "2160p5994", bmdMode4K2160p5994, "2160p59.94" }, - { "4k2160p5994", bmdMode4K2160p5994, "2160p59.94" }, - { "2160p60", bmdMode4K2160p60, "2160p60" }, - { "4k2160p60", bmdMode4K2160p60, "2160p60" } - }; - - for (const ModeOption& option : options) - { - if (combinedToken == option.token || (frameToken.empty() && formatToken == option.token)) - { - videoMode.displayMode = option.mode; - videoMode.displayName = option.displayName; - return true; - } - } - - return false; -} - -bool ResolveConfiguredVideoFormats( - const std::string& inputVideoFormat, - const std::string& inputFrameRate, - const std::string& outputVideoFormat, - const std::string& outputFrameRate, - VideoFormatSelection& videoModes, - std::string& error) -{ - if (!ResolveConfiguredVideoFormat(inputVideoFormat, inputFrameRate, videoModes.input)) - { - error = "Unsupported DeckLink inputVideoFormat/inputFrameRate in config/runtime-host.json: " + - inputVideoFormat + " / " + inputFrameRate; - return false; - } - - if (!ResolveConfiguredVideoFormat(outputVideoFormat, outputFrameRate, videoModes.output)) - { - error = "Unsupported DeckLink outputVideoFormat/outputFrameRate in config/runtime-host.json: " + - outputVideoFormat + " / " + outputFrameRate; - return false; - } - - return true; -} - -bool FindDeckLinkDisplayMode(IDeckLinkDisplayModeIterator* iterator, BMDDisplayMode targetMode, IDeckLinkDisplayMode** foundMode) -{ - if (!iterator || !foundMode) - return false; - - *foundMode = NULL; - IDeckLinkDisplayMode* candidate = NULL; - while (iterator->Next(&candidate) == S_OK) - { - if (candidate->GetDisplayMode() == targetMode) - { - *foundMode = candidate; - return true; - } - - candidate->Release(); - candidate = NULL; - } - - return false; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkDisplayMode.h b/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkDisplayMode.h deleted file mode 100644 index 3be24fd..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkDisplayMode.h +++ /dev/null @@ -1,47 +0,0 @@ -#pragma once - -#include "DeckLinkAPI_h.h" - -#include - -struct FrameSize -{ - unsigned width = 0; - unsigned height = 0; - - bool IsEmpty() const { return width == 0 || height == 0; } -}; - -inline bool operator==(const FrameSize& left, const FrameSize& right) -{ - return left.width == right.width && left.height == right.height; -} - -inline bool operator!=(const FrameSize& left, const FrameSize& right) -{ - return !(left == right); -} - -struct VideoFormat -{ - BMDDisplayMode displayMode = bmdModeHD1080p5994; - std::string displayName = "1080p59.94"; -}; - -struct VideoFormatSelection -{ - VideoFormat input; - VideoFormat output; -}; - -std::string NormalizeModeToken(const std::string& value); -bool ResolveConfiguredDisplayMode(const std::string& videoFormat, const std::string& frameRate, BMDDisplayMode& displayMode, std::string& displayModeName); -bool ResolveConfiguredVideoFormat(const std::string& videoFormat, const std::string& frameRate, VideoFormat& videoMode); -bool ResolveConfiguredVideoFormats( - const std::string& inputVideoFormat, - const std::string& inputFrameRate, - const std::string& outputVideoFormat, - const std::string& outputFrameRate, - VideoFormatSelection& videoModes, - std::string& error); -bool FindDeckLinkDisplayMode(IDeckLinkDisplayModeIterator* iterator, BMDDisplayMode targetMode, IDeckLinkDisplayMode** foundMode); diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkFrameTransfer.cpp b/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkFrameTransfer.cpp deleted file mode 100644 index d293c01..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkFrameTransfer.cpp +++ /dev/null @@ -1,100 +0,0 @@ -#include "DeckLinkFrameTransfer.h" - -#include "DeckLinkSession.h" - -//////////////////////////////////////////// -// DeckLink Capture Delegate Class -//////////////////////////////////////////// -CaptureDelegate::CaptureDelegate(DeckLinkSession* pOwner) : - m_pOwner(pOwner), - mRefCount(1) -{ -} - -HRESULT CaptureDelegate::QueryInterface(REFIID, LPVOID* ppv) -{ - *ppv = NULL; - return E_NOINTERFACE; -} - -ULONG CaptureDelegate::AddRef() -{ - return InterlockedIncrement(&mRefCount); -} - -ULONG CaptureDelegate::Release() -{ - int newCount = InterlockedDecrement(&mRefCount); - if (newCount == 0) - delete this; - return newCount; -} - -HRESULT CaptureDelegate::VideoInputFrameArrived(IDeckLinkVideoInputFrame* inputFrame, IDeckLinkAudioInputPacket*) -{ - if (!inputFrame) - { - // It's possible to receive a NULL inputFrame, but a valid audioPacket. Ignore audio-only frame. - return S_OK; - } - - bool hasNoInputSource = (inputFrame->GetFlags() & bmdFrameHasNoInputSource) == bmdFrameHasNoInputSource; - m_pOwner->HandleVideoInputFrame(inputFrame, hasNoInputSource); - return S_OK; -} - -HRESULT CaptureDelegate::VideoInputFormatChanged(BMDVideoInputFormatChangedEvents, IDeckLinkDisplayMode*, BMDDetectedVideoInputFormatFlags) -{ - return S_OK; -} - -//////////////////////////////////////////// -// DeckLink Playout Delegate Class -//////////////////////////////////////////// -PlayoutDelegate::PlayoutDelegate(DeckLinkSession* pOwner) : - m_pOwner(pOwner), - mRefCount(1) -{ -} - -HRESULT PlayoutDelegate::QueryInterface(REFIID, LPVOID* ppv) -{ - *ppv = NULL; - return E_NOINTERFACE; -} - -ULONG PlayoutDelegate::AddRef() -{ - return InterlockedIncrement(&mRefCount); -} - -ULONG PlayoutDelegate::Release() -{ - int newCount = InterlockedDecrement(&mRefCount); - if (newCount == 0) - delete this; - return newCount; -} - -HRESULT PlayoutDelegate::ScheduledFrameCompleted(IDeckLinkVideoFrame* completedFrame, BMDOutputFrameCompletionResult result) -{ - switch (result) - { - case bmdOutputFrameDisplayedLate: - case bmdOutputFrameDropped: - case bmdOutputFrameCompleted: - case bmdOutputFrameFlushed: - // Late/drop counts are recorded by VideoBackend; keep this callback lean. - break; - default: - OutputDebugStringA("ScheduledFrameCompleted() frame did not complete: Unknown error\n"); - } - - m_pOwner->HandlePlayoutFrameCompleted(completedFrame, result); - return S_OK; -} - -HRESULT PlayoutDelegate::ScheduledPlaybackHasStopped() -{ - return S_OK; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkFrameTransfer.h b/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkFrameTransfer.h deleted file mode 100644 index de79944..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkFrameTransfer.h +++ /dev/null @@ -1,49 +0,0 @@ -#pragma once - -#include - -#include - -#include "DeckLinkAPI_h.h" - -class DeckLinkSession; - -//////////////////////////////////////////// -// Capture Delegate Class -//////////////////////////////////////////// -class CaptureDelegate : public IDeckLinkInputCallback -{ - DeckLinkSession* m_pOwner; - LONG mRefCount; - -public: - CaptureDelegate(DeckLinkSession* pOwner); - - // IUnknown needs only a dummy implementation - virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID* ppv); - virtual ULONG STDMETHODCALLTYPE AddRef(); - virtual ULONG STDMETHODCALLTYPE Release(); - - virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived(IDeckLinkVideoInputFrame* videoFrame, IDeckLinkAudioInputPacket* audioPacket); - virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged(BMDVideoInputFormatChangedEvents notificationEvents, IDeckLinkDisplayMode* newDisplayMode, BMDDetectedVideoInputFormatFlags detectedSignalFlags); -}; - -//////////////////////////////////////////// -// Render Delegate Class -//////////////////////////////////////////// -class PlayoutDelegate : public IDeckLinkVideoOutputCallback -{ - DeckLinkSession* m_pOwner; - LONG mRefCount; - -public: - PlayoutDelegate(DeckLinkSession* pOwner); - - // IUnknown needs only a dummy implementation - virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID* ppv); - virtual ULONG STDMETHODCALLTYPE AddRef(); - virtual ULONG STDMETHODCALLTYPE Release(); - - virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted(IDeckLinkVideoFrame* completedFrame, BMDOutputFrameCompletionResult result); - virtual HRESULT STDMETHODCALLTYPE ScheduledPlaybackHasStopped(); -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkSession.cpp b/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkSession.cpp deleted file mode 100644 index 20ae9da..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkSession.cpp +++ /dev/null @@ -1,933 +0,0 @@ -#include "DeckLinkSession.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace -{ -constexpr int64_t kMinimumHealthyScheduleLeadFrames = 4; -constexpr int64_t kProactiveScheduleLeadFloorFrames = 1; - -class SystemMemoryDeckLinkVideoBuffer : public IDeckLinkVideoBuffer -{ -public: - SystemMemoryDeckLinkVideoBuffer(void* bytes, unsigned long long sizeBytes) : - mBytes(bytes), - mSizeBytes(sizeBytes), - mRefCount(1) - { - } - - HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID* ppv) override - { - if (ppv == nullptr) - return E_POINTER; - if (iid == IID_IUnknown || iid == IID_IDeckLinkVideoBuffer) - { - *ppv = static_cast(this); - AddRef(); - return S_OK; - } - *ppv = nullptr; - return E_NOINTERFACE; - } - - ULONG STDMETHODCALLTYPE AddRef() override - { - return ++mRefCount; - } - - ULONG STDMETHODCALLTYPE Release() override - { - const ULONG refCount = --mRefCount; - if (refCount == 0) - delete this; - return refCount; - } - - HRESULT STDMETHODCALLTYPE GetBytes(void** buffer) override - { - if (buffer == nullptr) - return E_POINTER; - *buffer = mBytes; - return mBytes != nullptr ? S_OK : E_FAIL; - } - - HRESULT STDMETHODCALLTYPE GetSize(unsigned long long* bufferSize) override - { - if (bufferSize == nullptr) - return E_POINTER; - *bufferSize = mSizeBytes; - return S_OK; - } - - HRESULT STDMETHODCALLTYPE StartAccess(BMDBufferAccessFlags) override - { - return S_OK; - } - - HRESULT STDMETHODCALLTYPE EndAccess(BMDBufferAccessFlags) override - { - return S_OK; - } - -private: - void* mBytes = nullptr; - unsigned long long mSizeBytes = 0; - std::atomic mRefCount; -}; - -std::string BstrToUtf8(BSTR value) -{ - if (value == nullptr) - return std::string(); - - const int requiredBytes = WideCharToMultiByte(CP_UTF8, 0, value, -1, NULL, 0, NULL, NULL); - if (requiredBytes <= 1) - return std::string(); - - std::vector utf8Name(static_cast(requiredBytes), '\0'); - if (WideCharToMultiByte(CP_UTF8, 0, value, -1, utf8Name.data(), requiredBytes, NULL, NULL) <= 0) - return std::string(); - - return std::string(utf8Name.data()); -} - -bool InputSupportsFormat(IDeckLinkInput* input, BMDDisplayMode displayMode, BMDPixelFormat pixelFormat) -{ - if (input == nullptr) - return false; - - BOOL supported = FALSE; - BMDDisplayMode actualMode = bmdModeUnknown; - const HRESULT result = input->DoesSupportVideoMode( - bmdVideoConnectionUnspecified, - displayMode, - pixelFormat, - bmdNoVideoInputConversion, - bmdSupportedVideoModeDefault, - &actualMode, - &supported); - return result == S_OK && supported != FALSE; -} - -bool OutputSupportsFormat(IDeckLinkOutput* output, BMDDisplayMode displayMode, BMDPixelFormat pixelFormat) -{ - if (output == nullptr) - return false; - - BOOL supported = FALSE; - BMDDisplayMode actualMode = bmdModeUnknown; - const HRESULT result = output->DoesSupportVideoMode( - bmdVideoConnectionUnspecified, - displayMode, - pixelFormat, - bmdNoVideoOutputConversion, - bmdSupportedVideoModeDefault, - &actualMode, - &supported); - return result == S_OK && supported != FALSE; -} -} - -DeckLinkSession::~DeckLinkSession() -{ - ReleaseResources(); -} - -void DeckLinkSession::ReleaseResources() -{ - if (input != nullptr) - input->SetCallback(nullptr); - captureDelegate.Release(); - input.Release(); - - if (output != nullptr) - output->SetScheduledFrameCompletionCallback(nullptr); - - if (keyer != nullptr) - { - keyer->Disable(); - mState.externalKeyingActive = false; - } - keyer.Release(); - - playoutDelegate.Release(); - outputVideoFrameQueue.clear(); - output.Release(); -} - -bool DeckLinkSession::DiscoverDevicesAndModes(const VideoFormatSelection& videoModes, std::string& error) -{ - CComPtr deckLinkIterator; - CComPtr inputMode; - CComPtr outputMode; - - mState.inputDisplayModeName = videoModes.input.displayName; - mState.outputDisplayModeName = videoModes.output.displayName; - - HRESULT result = CoCreateInstance(CLSID_CDeckLinkIterator, nullptr, CLSCTX_ALL, IID_IDeckLinkIterator, reinterpret_cast(&deckLinkIterator)); - if (FAILED(result)) - { - error = "Please install the Blackmagic DeckLink drivers to use the features of this application."; - return false; - } - - CComPtr deckLink; - while (deckLinkIterator->Next(&deckLink) == S_OK) - { - int64_t duplexMode; - bool deviceSupportsInternalKeying = false; - bool deviceSupportsExternalKeying = false; - std::string modelName; - CComPtr deckLinkAttributes; - - if (deckLink->QueryInterface(IID_IDeckLinkProfileAttributes, (void**)&deckLinkAttributes) != S_OK) - { - printf("Could not obtain the IDeckLinkProfileAttributes interface\n"); - deckLink.Release(); - continue; - } - - result = deckLinkAttributes->GetInt(BMDDeckLinkDuplex, &duplexMode); - BOOL attributeFlag = FALSE; - if (deckLinkAttributes->GetFlag(BMDDeckLinkSupportsInternalKeying, &attributeFlag) == S_OK) - deviceSupportsInternalKeying = (attributeFlag != FALSE); - attributeFlag = FALSE; - if (deckLinkAttributes->GetFlag(BMDDeckLinkSupportsExternalKeying, &attributeFlag) == S_OK) - deviceSupportsExternalKeying = (attributeFlag != FALSE); - CComBSTR modelNameBstr; - if (deckLinkAttributes->GetString(BMDDeckLinkModelName, &modelNameBstr) == S_OK) - modelName = BstrToUtf8(modelNameBstr); - - if (result != S_OK || duplexMode == bmdDuplexInactive) - { - deckLink.Release(); - continue; - } - - bool inputUsed = false; - if (!input && deckLink->QueryInterface(IID_IDeckLinkInput, (void**)&input) == S_OK) - inputUsed = true; - - if (!output && (!inputUsed || (duplexMode == bmdDuplexFull))) - { - if (deckLink->QueryInterface(IID_IDeckLinkOutput, (void**)&output) != S_OK) - output.Release(); - else - { - mState.outputModelName = modelName; - mState.supportsInternalKeying = deviceSupportsInternalKeying; - mState.supportsExternalKeying = deviceSupportsExternalKeying; - } - } - - deckLink.Release(); - - if (output && input) - break; - } - - if (!output) - { - error = "Expected an Output DeckLink device"; - ReleaseResources(); - return false; - } - - CComPtr inputDisplayModeIterator; - if (input && input->GetDisplayModeIterator(&inputDisplayModeIterator) != S_OK) - { - error = "Cannot get input Display Mode Iterator."; - ReleaseResources(); - return false; - } - - if (input && !FindDeckLinkDisplayMode(inputDisplayModeIterator, videoModes.input.displayMode, &inputMode)) - { - error = "Cannot get specified input BMDDisplayMode for configured mode: " + videoModes.input.displayName; - ReleaseResources(); - return false; - } - inputDisplayModeIterator.Release(); - - CComPtr outputDisplayModeIterator; - if (output->GetDisplayModeIterator(&outputDisplayModeIterator) != S_OK) - { - error = "Cannot get output Display Mode Iterator."; - ReleaseResources(); - return false; - } - - if (!FindDeckLinkDisplayMode(outputDisplayModeIterator, videoModes.output.displayMode, &outputMode)) - { - error = "Cannot get specified output BMDDisplayMode for configured mode: " + videoModes.output.displayName; - ReleaseResources(); - return false; - } - - mState.outputFrameSize = { static_cast(outputMode->GetWidth()), static_cast(outputMode->GetHeight()) }; - mState.inputFrameSize = inputMode - ? FrameSize{ static_cast(inputMode->GetWidth()), static_cast(inputMode->GetHeight()) } - : mState.outputFrameSize; - if (!input) - mState.inputDisplayModeName = "No input - black frame"; - BMDTimeValue frameDuration = 0; - BMDTimeScale frameTimescale = 0; - outputMode->GetFrameRate(&frameDuration, &frameTimescale); - mScheduler.Configure(frameDuration, frameTimescale, mPlayoutPolicy); - mState.frameBudgetMilliseconds = mScheduler.FrameBudgetMilliseconds(); - - mState.inputFrameRowBytes = mState.inputFrameSize.width * 2u; - mState.outputFrameRowBytes = mState.outputFrameSize.width * 4u; - mState.captureTextureWidth = mState.inputFrameSize.width / 2u; - mState.outputPackTextureWidth = mState.outputFrameSize.width; - mState.hasInputDevice = input != nullptr; - mState.hasInputSource = false; - - return true; -} - -bool DeckLinkSession::SelectPreferredFormats(const VideoFormatSelection& videoModes, bool outputAlphaRequired, std::string& error) -{ - if (!output) - { - error = "Expected an Output DeckLink device"; - return false; - } - - mState.formatStatusMessage.clear(); - - const bool inputTenBitSupported = input != nullptr && InputSupportsFormat(input, videoModes.input.displayMode, bmdFormat10BitYUV); - mState.inputPixelFormat = input != nullptr ? ChoosePreferredVideoIOFormat(inputTenBitSupported) : VideoIOPixelFormat::Uyvy8; - if (input != nullptr && !inputTenBitSupported) - mState.formatStatusMessage += "DeckLink input does not report 10-bit YUV support for the configured mode; using 8-bit capture. "; - - const bool outputTenBitSupported = OutputSupportsFormat(output, videoModes.output.displayMode, bmdFormat10BitYUV); - const bool outputTenBitYuvaSupported = OutputSupportsFormat(output, videoModes.output.displayMode, bmdFormat10BitYUVA); - mState.outputPixelFormat = outputAlphaRequired - ? (outputTenBitYuvaSupported ? VideoIOPixelFormat::Yuva10 : VideoIOPixelFormat::Bgra8) - : (outputTenBitSupported ? VideoIOPixelFormat::V210 : VideoIOPixelFormat::Bgra8); - if (outputAlphaRequired && outputTenBitYuvaSupported) - mState.formatStatusMessage += "External keying requires alpha; using 10-bit YUVA output. "; - else if (outputAlphaRequired) - mState.formatStatusMessage += "External keying requires alpha, but DeckLink output does not report 10-bit YUVA support for the configured mode; using 8-bit BGRA output. "; - else if (!outputTenBitSupported) - mState.formatStatusMessage += "DeckLink output does not report 10-bit YUV support for the configured mode; using 8-bit BGRA output. "; - - int deckLinkOutputRowBytes = 0; - if (output->RowBytesForPixelFormat(DeckLinkPixelFormatForVideoIO(mState.outputPixelFormat), mState.outputFrameSize.width, &deckLinkOutputRowBytes) != S_OK) - { - error = "DeckLink output setup failed while calculating output row bytes."; - return false; - } - mState.outputFrameRowBytes = static_cast(deckLinkOutputRowBytes); - mState.outputPackTextureWidth = OutputIsTenBit() - ? PackedTextureWidthFromRowBytes(mState.outputFrameRowBytes) - : mState.outputFrameSize.width; - - if (InputIsTenBit()) - { - int deckLinkInputRowBytes = 0; - if (output->RowBytesForPixelFormat(bmdFormat10BitYUV, mState.inputFrameSize.width, &deckLinkInputRowBytes) == S_OK) - mState.inputFrameRowBytes = static_cast(deckLinkInputRowBytes); - else - mState.inputFrameRowBytes = MinimumV210RowBytes(mState.inputFrameSize.width); - } - else - { - mState.inputFrameRowBytes = mState.inputFrameSize.width * 2u; - } - mState.captureTextureWidth = InputIsTenBit() - ? PackedTextureWidthFromRowBytes(mState.inputFrameRowBytes) - : mState.inputFrameSize.width / 2u; - - std::ostringstream status; - status << "DeckLink formats: capture " << (input ? VideoIOPixelFormatName(mState.inputPixelFormat) : "none") - << ", output " << VideoIOPixelFormatName(mState.outputPixelFormat) << "."; - if (!mState.formatStatusMessage.empty()) - status << " " << mState.formatStatusMessage; - mState.formatStatusMessage = status.str(); - return true; -} - -bool DeckLinkSession::ConfigureInput(InputFrameCallback callback, const VideoFormat& inputVideoMode, std::string& error) -{ - mInputFrameCallback = std::move(callback); - - if (!input) - { - mState.hasInputSource = false; - mState.inputDisplayModeName = "No input - black frame"; - return true; - } - - const BMDPixelFormat deckLinkInputPixelFormat = DeckLinkPixelFormatForVideoIO(mState.inputPixelFormat); - if (input->EnableVideoInput(inputVideoMode.displayMode, deckLinkInputPixelFormat, bmdVideoInputFlagDefault) != S_OK) - { - if (mState.inputPixelFormat == VideoIOPixelFormat::V210) - { - OutputDebugStringA("DeckLink 10-bit input could not be enabled; falling back to 8-bit capture.\n"); - mState.inputPixelFormat = VideoIOPixelFormat::Uyvy8; - mState.inputFrameRowBytes = mState.inputFrameSize.width * 2u; - mState.captureTextureWidth = mState.inputFrameSize.width / 2u; - if (input->EnableVideoInput(inputVideoMode.displayMode, bmdFormat8BitYUV, bmdVideoInputFlagDefault) == S_OK) - { - std::ostringstream status; - status << "DeckLink formats: capture " << VideoIOPixelFormatName(mState.inputPixelFormat) - << ", output " << VideoIOPixelFormatName(mState.outputPixelFormat) - << ". DeckLink 10-bit input enable failed; using 8-bit capture."; - mState.formatStatusMessage = status.str(); - goto input_enabled; - } - } - - OutputDebugStringA("DeckLink input could not be enabled; continuing in output-only black-frame mode.\n"); - input.Release(); - mState.hasInputDevice = false; - mState.hasInputSource = false; - mState.inputDisplayModeName = "No input - black frame"; - return true; - } - -input_enabled: - captureDelegate.Attach(new (std::nothrow) CaptureDelegate(this)); - if (captureDelegate == nullptr) - { - error = "DeckLink input setup failed while creating the capture callback."; - return false; - } - if (input->SetCallback(captureDelegate) != S_OK) - { - error = "DeckLink input setup failed while installing the capture callback."; - return false; - } - - return true; -} - -bool DeckLinkSession::ConfigureOutput(OutputFrameCallback callback, const VideoFormat& outputVideoMode, bool externalKeyingEnabled, std::string& error) -{ - mOutputFrameCallback = std::move(callback); - - if (output->EnableVideoOutput(outputVideoMode.displayMode, bmdVideoOutputFlagDefault) != S_OK) - { - error = "DeckLink output setup failed while enabling video output."; - return false; - } - - if (output->QueryInterface(IID_IDeckLinkKeyer, (void**)&keyer) == S_OK && keyer != NULL) - mState.keyerInterfaceAvailable = true; - - if (externalKeyingEnabled) - { - if (!mState.supportsExternalKeying) - { - mState.statusMessage = "External keying was requested, but the selected DeckLink output does not report external keying support."; - } - else if (!mState.keyerInterfaceAvailable) - { - mState.statusMessage = "External keying was requested, but the selected DeckLink output does not expose the IDeckLinkKeyer interface."; - } - else if (keyer->Enable(TRUE) != S_OK || keyer->SetLevel(255) != S_OK) - { - mState.statusMessage = "External keying was requested, but enabling the DeckLink keyer failed."; - } - else - { - mState.externalKeyingActive = true; - mState.statusMessage = "External keying is active on the selected DeckLink output."; - } - } - else if (mState.supportsExternalKeying) - { - mState.statusMessage = "Selected DeckLink output supports external keying. Set enableExternalKeying to true in runtime-host.json to request it."; - } - - const VideoPlayoutPolicy policy = NormalizeVideoPlayoutPolicy(mPlayoutPolicy); - mPlayoutPolicy = policy; - for (unsigned i = 0; i < policy.outputFramePoolSize; i++) - { - CComPtr outputFrame; - - const BMDPixelFormat deckLinkOutputPixelFormat = DeckLinkPixelFormatForVideoIO(mState.outputPixelFormat); - if (output->CreateVideoFrame(mState.outputFrameSize.width, mState.outputFrameSize.height, mState.outputFrameRowBytes, deckLinkOutputPixelFormat, bmdFrameFlagFlipVertical, &outputFrame) != S_OK) - { - error = "DeckLink output setup failed while creating an output video frame."; - return false; - } - - outputVideoFrameQueue.push_back(outputFrame); - } - - playoutDelegate.Attach(new (std::nothrow) PlayoutDelegate(this)); - if (playoutDelegate == nullptr) - { - error = "DeckLink output setup failed while creating the playout callback."; - return false; - } - - if (output->SetScheduledFrameCompletionCallback(playoutDelegate) != S_OK) - { - error = "DeckLink output setup failed while installing the scheduled-frame callback."; - return false; - } - - if (!mState.formatStatusMessage.empty()) - mState.statusMessage = mState.statusMessage.empty() ? mState.formatStatusMessage : mState.formatStatusMessage + " " + mState.statusMessage; - - return true; -} - -double DeckLinkSession::FrameBudgetMilliseconds() const -{ - return mScheduler.FrameBudgetMilliseconds(); -} - -bool DeckLinkSession::AcquireNextOutputVideoFrame(CComPtr& outputVideoFrame) -{ - if (outputVideoFrameQueue.empty()) - return false; - - outputVideoFrame = outputVideoFrameQueue.front(); - outputVideoFrameQueue.pop_front(); - return outputVideoFrame != nullptr; -} - -bool DeckLinkSession::PopulateOutputFrame(IDeckLinkMutableVideoFrame* outputVideoFrame, VideoIOOutputFrame& frame) -{ - if (outputVideoFrame == nullptr) - return false; - - CComPtr outputVideoFrameBuffer; - if (outputVideoFrame->QueryInterface(IID_IDeckLinkVideoBuffer, (void**)&outputVideoFrameBuffer) != S_OK) - return false; - - if (outputVideoFrameBuffer->StartAccess(bmdBufferAccessWrite) != S_OK) - return false; - - void* pFrame = nullptr; - outputVideoFrameBuffer->GetBytes(&pFrame); - - frame.bytes = pFrame; - frame.rowBytes = outputVideoFrame->GetRowBytes(); - frame.width = mState.outputFrameSize.width; - frame.height = mState.outputFrameSize.height; - frame.pixelFormat = mState.outputPixelFormat; - outputVideoFrame->AddRef(); - frame.nativeFrame = outputVideoFrame; - frame.nativeBuffer = outputVideoFrameBuffer.Detach(); - return true; -} - -bool DeckLinkSession::ScheduleFrame(IDeckLinkMutableVideoFrame* outputVideoFrame) -{ - if (outputVideoFrame == nullptr || output == nullptr) - { - ++mState.deckLinkScheduleFailureCount; - return false; - } - - if (mScheduleRealignmentPending) - { - RealignScheduleCursorToPlayback(); - mScheduleRealignmentPending = false; - } - - UpdateScheduleLeadTelemetry(); - MaybeRealignScheduleCursorForLowLead(); - const VideoIOScheduleTime scheduleTime = mScheduler.NextScheduleTime(); - const auto scheduleStart = std::chrono::steady_clock::now(); - const HRESULT result = output->ScheduleVideoFrame(outputVideoFrame, scheduleTime.streamTime, scheduleTime.duration, scheduleTime.timeScale); - const auto scheduleEnd = std::chrono::steady_clock::now(); - mState.deckLinkScheduleCallMilliseconds = std::chrono::duration_cast>(scheduleEnd - scheduleStart).count(); - if (result != S_OK) - ++mState.deckLinkScheduleFailureCount; - RefreshBufferedVideoFrameCount(); - return result == S_OK; -} - -void DeckLinkSession::UpdateScheduleLeadTelemetry() -{ - if (output == nullptr) - { - mState.deckLinkScheduleLeadAvailable = false; - return; - } - - BMDTimeValue streamTime = 0; - double playbackSpeed = 0.0; - if (output->GetScheduledStreamTime(mScheduler.TimeScale(), &streamTime, &playbackSpeed) != S_OK || playbackSpeed <= 0.0) - { - mState.deckLinkScheduleLeadAvailable = false; - return; - } - - const uint64_t playbackFrameIndex = streamTime >= 0 && mScheduler.FrameDuration() > 0 - ? static_cast(streamTime / mScheduler.FrameDuration()) - : 0; - const uint64_t nextScheduleFrameIndex = mScheduler.ScheduledFrameIndex(); - mState.deckLinkScheduleLeadAvailable = true; - mState.deckLinkPlaybackStreamTime = streamTime; - mState.deckLinkPlaybackFrameIndex = playbackFrameIndex; - mState.deckLinkNextScheduleFrameIndex = nextScheduleFrameIndex; - mState.deckLinkScheduleLeadFrames = static_cast(nextScheduleFrameIndex) - static_cast(playbackFrameIndex); -} - -void DeckLinkSession::MaybeRealignScheduleCursorForLowLead() -{ - if (!mState.deckLinkScheduleLeadAvailable) - return; - - if (mState.deckLinkScheduleLeadFrames >= kMinimumHealthyScheduleLeadFrames) - { - mProactiveScheduleRealignmentArmed = true; - return; - } - - if (!mProactiveScheduleRealignmentArmed || mState.deckLinkScheduleLeadFrames > kProactiveScheduleLeadFloorFrames) - return; - - RealignScheduleCursorToPlayback(); - mProactiveScheduleRealignmentArmed = false; -} - -void DeckLinkSession::RealignScheduleCursorToPlayback() -{ - if (output == nullptr) - return; - - BMDTimeValue streamTime = 0; - double playbackSpeed = 0.0; - if (output->GetScheduledStreamTime(mScheduler.TimeScale(), &streamTime, &playbackSpeed) != S_OK || playbackSpeed <= 0.0) - return; - - const VideoPlayoutPolicy policy = NormalizeVideoPlayoutPolicy(mPlayoutPolicy); - mScheduler.AlignNextScheduleTimeToPlayback(streamTime, policy.targetPrerollFrames); - ++mState.deckLinkScheduleRealignmentCount; - UpdateScheduleLeadTelemetry(); -} - -bool DeckLinkSession::ScheduleSystemMemoryFrame(const VideoIOOutputFrame& frame) -{ - if (output == nullptr || frame.bytes == nullptr || frame.rowBytes <= 0 || frame.height == 0) - return false; - - CComPtr videoBuffer; - videoBuffer.Attach(new (std::nothrow) SystemMemoryDeckLinkVideoBuffer( - frame.bytes, - static_cast(frame.rowBytes) * static_cast(frame.height))); - if (videoBuffer == nullptr) - return false; - - CComPtr outputVideoFrame; - const BMDPixelFormat pixelFormat = DeckLinkPixelFormatForVideoIO(frame.pixelFormat); - if (output->CreateVideoFrameWithBuffer( - frame.width, - frame.height, - frame.rowBytes, - pixelFormat, - bmdFrameFlagFlipVertical, - videoBuffer, - &outputVideoFrame) != S_OK) - { - return false; - } - - IDeckLinkVideoFrame* scheduledFrame = outputVideoFrame; - { - std::lock_guard lock(mScheduledSystemFrameMutex); - mScheduledSystemFrameBuffers[scheduledFrame] = frame.bytes; - } - - if (ScheduleFrame(outputVideoFrame)) - return true; - - { - std::lock_guard lock(mScheduledSystemFrameMutex); - mScheduledSystemFrameBuffers.erase(scheduledFrame); - } - return false; -} - -bool DeckLinkSession::ScheduleBlackFrame(IDeckLinkMutableVideoFrame* outputVideoFrame) -{ - if (outputVideoFrame == nullptr) - return false; - - CComPtr outputVideoFrameBuffer; - if (outputVideoFrame->QueryInterface(IID_IDeckLinkVideoBuffer, (void**)&outputVideoFrameBuffer) != S_OK) - return false; - - if (outputVideoFrameBuffer->StartAccess(bmdBufferAccessWrite) != S_OK) - return false; - - void* pFrame = nullptr; - outputVideoFrameBuffer->GetBytes((void**)&pFrame); - memset(pFrame, 0, outputVideoFrame->GetRowBytes() * mState.outputFrameSize.height); - - outputVideoFrameBuffer->EndAccess(bmdBufferAccessWrite); - return ScheduleFrame(outputVideoFrame); -} - -void DeckLinkSession::RefreshBufferedVideoFrameCount() -{ - if (output == nullptr) - { - mState.actualDeckLinkBufferedFramesAvailable = false; - return; - } - - unsigned int bufferedFrameCount = 0; - if (output->GetBufferedVideoFrameCount(&bufferedFrameCount) == S_OK) - { - mState.actualDeckLinkBufferedFrames = bufferedFrameCount; - mState.actualDeckLinkBufferedFramesAvailable = true; - } - else - { - mState.actualDeckLinkBufferedFramesAvailable = false; - } -} - -bool DeckLinkSession::BeginOutputFrame(VideoIOOutputFrame& frame) -{ - CComPtr outputVideoFrame; - return AcquireNextOutputVideoFrame(outputVideoFrame) && PopulateOutputFrame(outputVideoFrame, frame); -} - -void DeckLinkSession::EndOutputFrame(VideoIOOutputFrame& frame) -{ - IDeckLinkVideoBuffer* outputVideoFrameBuffer = static_cast(frame.nativeBuffer); - if (outputVideoFrameBuffer != nullptr) - { - outputVideoFrameBuffer->EndAccess(bmdBufferAccessWrite); - outputVideoFrameBuffer->Release(); - } - frame.nativeBuffer = nullptr; - frame.bytes = nullptr; -} - -VideoPlayoutRecoveryDecision DeckLinkSession::AccountForCompletionResult(VideoIOCompletionResult completionResult, uint64_t readyQueueDepth) -{ - return mScheduler.AccountForCompletionResult(completionResult, readyQueueDepth); -} - -bool DeckLinkSession::ScheduleOutputFrame(const VideoIOOutputFrame& frame) -{ - if (frame.nativeFrame == nullptr) - return ScheduleSystemMemoryFrame(frame); - - IDeckLinkMutableVideoFrame* outputVideoFrame = static_cast(frame.nativeFrame); - const bool scheduled = ScheduleFrame(outputVideoFrame); - if (outputVideoFrame != nullptr) - outputVideoFrame->Release(); - return scheduled; -} - -bool DeckLinkSession::PrepareOutputSchedule() -{ - mScheduler.Reset(); - RefreshBufferedVideoFrameCount(); - return output != nullptr; -} - -bool DeckLinkSession::StartInputStreams() -{ - if (!input) - return true; - - if (input->StartStreams() != S_OK) - { - MessageBoxA(NULL, "Could not start the DeckLink input stream.", "DeckLink start failed", MB_OK | MB_ICONERROR); - return false; - } - return true; -} - -bool DeckLinkSession::StartScheduledPlayback() -{ - if (!output) - { - MessageBoxA(NULL, "Cannot start playout because no DeckLink output device is available.", "DeckLink start failed", MB_OK | MB_ICONERROR); - return false; - } - - if (output->StartScheduledPlayback(0, mScheduler.TimeScale(), 1.0) != S_OK) - { - MessageBoxA(NULL, "Could not start DeckLink scheduled playback.", "DeckLink start failed", MB_OK | MB_ICONERROR); - return false; - } - RefreshBufferedVideoFrameCount(); - return true; -} - -bool DeckLinkSession::Start() -{ - if (!output) - { - MessageBoxA(NULL, "Cannot start playout because no DeckLink output device is available.", "DeckLink start failed", MB_OK | MB_ICONERROR); - return false; - } - if (outputVideoFrameQueue.empty()) - { - MessageBoxA(NULL, "Cannot start playout because the output frame queue is empty.", "DeckLink start failed", MB_OK | MB_ICONERROR); - return false; - } - - const VideoPlayoutPolicy policy = NormalizeVideoPlayoutPolicy(mPlayoutPolicy); - mPlayoutPolicy = policy; - if (!PrepareOutputSchedule()) - return false; - - for (unsigned i = 0; i < policy.targetPrerollFrames; i++) - { - CComPtr outputVideoFrame; - if (!AcquireNextOutputVideoFrame(outputVideoFrame)) - { - MessageBoxA(NULL, "Could not acquire a preroll output frame.", "DeckLink start failed", MB_OK | MB_ICONERROR); - return false; - } - if (!ScheduleBlackFrame(outputVideoFrame)) - { - MessageBoxA(NULL, "Could not schedule a preroll output frame.", "DeckLink start failed", MB_OK | MB_ICONERROR); - return false; - } - } - - return StartInputStreams() && StartScheduledPlayback(); -} - -bool DeckLinkSession::Stop() -{ - if (keyer != nullptr) - { - keyer->Disable(); - mState.externalKeyingActive = false; - } - - if (input) - { - input->StopStreams(); - input->DisableVideoInput(); - } - - if (output) - { - output->StopScheduledPlayback(0, NULL, 0); - output->DisableVideoOutput(); - } - - return true; -} - -void DeckLinkSession::HandleVideoInputFrame(IDeckLinkVideoInputFrame* inputFrame, bool hasNoInputSource) -{ - mState.hasInputSource = !hasNoInputSource; - if (hasNoInputSource || mInputFrameCallback == nullptr) - { - VideoIOFrame frame; - frame.width = mState.inputFrameSize.width; - frame.height = mState.inputFrameSize.height; - frame.pixelFormat = mState.inputPixelFormat; - frame.hasNoInputSource = hasNoInputSource; - if (mInputFrameCallback) - mInputFrameCallback(frame); - return; - } - - CComPtr inputFrameBuffer; - void* videoPixels = nullptr; - if (inputFrame->QueryInterface(IID_IDeckLinkVideoBuffer, (void**)&inputFrameBuffer) != S_OK) - return; - if (inputFrameBuffer->StartAccess(bmdBufferAccessRead) != S_OK) - return; - - inputFrameBuffer->GetBytes(&videoPixels); - - VideoIOFrame frame; - frame.bytes = videoPixels; - frame.rowBytes = inputFrame->GetRowBytes(); - frame.width = static_cast(inputFrame->GetWidth()); - frame.height = static_cast(inputFrame->GetHeight()); - frame.pixelFormat = mState.inputPixelFormat; - frame.hasNoInputSource = hasNoInputSource; - mInputFrameCallback(frame); - - inputFrameBuffer->EndAccess(bmdBufferAccessRead); -} - -void DeckLinkSession::HandlePlayoutFrameCompleted(IDeckLinkVideoFrame* completedFrame, BMDOutputFrameCompletionResult completionResult) -{ - RefreshBufferedVideoFrameCount(); - - void* completedSystemBuffer = nullptr; - if (completedFrame != nullptr) - { - bool externalSystemFrame = false; - { - std::lock_guard lock(mScheduledSystemFrameMutex); - auto externalFrame = mScheduledSystemFrameBuffers.find(completedFrame); - if (externalFrame != mScheduledSystemFrameBuffers.end()) - { - completedSystemBuffer = externalFrame->second; - mScheduledSystemFrameBuffers.erase(externalFrame); - externalSystemFrame = true; - } - } - - if (!externalSystemFrame) - { - CComPtr reusableFrame; - if (completedFrame->QueryInterface(IID_IDeckLinkMutableVideoFrame, reinterpret_cast(&reusableFrame)) == S_OK && - reusableFrame != nullptr) - { - outputVideoFrameQueue.push_back(reusableFrame); - } - } - } - - if (!mOutputFrameCallback) - return; - - VideoIOCompletion completion; - completion.result = TranslateCompletionResult(completionResult); - if (completion.result == VideoIOCompletionResult::DisplayedLate || completion.result == VideoIOCompletionResult::Dropped) - { - if (mScheduleRealignmentArmed) - { - mScheduleRealignmentPending = true; - mScheduleRealignmentArmed = false; - } - } - else if (completion.result == VideoIOCompletionResult::Completed) - { - mScheduleRealignmentArmed = true; - } - completion.outputFrameBuffer = completedSystemBuffer; - mOutputFrameCallback(completion); -} - -VideoIOCompletionResult DeckLinkSession::TranslateCompletionResult(BMDOutputFrameCompletionResult completionResult) -{ - switch (completionResult) - { - case bmdOutputFrameDisplayedLate: - return VideoIOCompletionResult::DisplayedLate; - case bmdOutputFrameDropped: - return VideoIOCompletionResult::Dropped; - case bmdOutputFrameFlushed: - return VideoIOCompletionResult::Flushed; - case bmdOutputFrameCompleted: - return VideoIOCompletionResult::Completed; - default: - return VideoIOCompletionResult::Unknown; - } -} diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkSession.h b/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkSession.h deleted file mode 100644 index e1442cc..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkSession.h +++ /dev/null @@ -1,102 +0,0 @@ -#pragma once - -#include "DeckLinkAPI_h.h" -#include "DeckLinkDisplayMode.h" -#include "DeckLinkFrameTransfer.h" -#include "DeckLinkVideoIOFormat.h" -#include "VideoIOFormat.h" -#include "VideoIOTypes.h" -#include "VideoPlayoutPolicy.h" -#include "VideoPlayoutScheduler.h" - -#include -#include -#include -#include -#include - -class OpenGLComposite; - -class DeckLinkSession : public VideoIODevice -{ -public: - DeckLinkSession() = default; - ~DeckLinkSession(); - - void ReleaseResources() override; - bool DiscoverDevicesAndModes(const VideoFormatSelection& videoModes, std::string& error) override; - bool SelectPreferredFormats(const VideoFormatSelection& videoModes, bool outputAlphaRequired, std::string& error) override; - bool ConfigureInput(InputFrameCallback callback, const VideoFormat& inputVideoMode, std::string& error) override; - bool ConfigureOutput(OutputFrameCallback callback, const VideoFormat& outputVideoMode, bool externalKeyingEnabled, std::string& error) override; - bool PrepareOutputSchedule() override; - bool StartInputStreams() override; - bool StartScheduledPlayback() override; - bool Start() override; - bool Stop() override; - - bool HasInputDevice() const { return mState.hasInputDevice; } - bool HasInputSource() const { return mState.hasInputSource; } - void SetInputSourceMissing(bool missing) { mState.hasInputSource = !missing; } - bool InputOutputDimensionsDiffer() const { return mState.inputFrameSize != mState.outputFrameSize; } - const FrameSize& InputFrameSize() const { return mState.inputFrameSize; } - const FrameSize& OutputFrameSize() const { return mState.outputFrameSize; } - unsigned InputFrameWidth() const { return mState.inputFrameSize.width; } - unsigned InputFrameHeight() const { return mState.inputFrameSize.height; } - unsigned OutputFrameWidth() const { return mState.outputFrameSize.width; } - unsigned OutputFrameHeight() const { return mState.outputFrameSize.height; } - VideoIOPixelFormat InputPixelFormat() const { return mState.inputPixelFormat; } - VideoIOPixelFormat OutputPixelFormat() const { return mState.outputPixelFormat; } - bool InputIsTenBit() const { return VideoIOPixelFormatIsTenBit(mState.inputPixelFormat); } - bool OutputIsTenBit() const { return VideoIOPixelFormatIsTenBit(mState.outputPixelFormat); } - unsigned InputFrameRowBytes() const { return mState.inputFrameRowBytes; } - unsigned OutputFrameRowBytes() const { return mState.outputFrameRowBytes; } - unsigned CaptureTextureWidth() const { return mState.captureTextureWidth; } - unsigned OutputPackTextureWidth() const { return mState.outputPackTextureWidth; } - const std::string& FormatStatusMessage() const { return mState.formatStatusMessage; } - const std::string& InputDisplayModeName() const { return mState.inputDisplayModeName; } - const std::string& OutputModelName() const { return mState.outputModelName; } - bool SupportsInternalKeying() const { return mState.supportsInternalKeying; } - bool SupportsExternalKeying() const { return mState.supportsExternalKeying; } - bool KeyerInterfaceAvailable() const { return mState.keyerInterfaceAvailable; } - bool ExternalKeyingActive() const { return mState.externalKeyingActive; } - const std::string& StatusMessage() const { return mState.statusMessage; } - void SetStatusMessage(const std::string& message) { mState.statusMessage = message; } - const VideoIOState& State() const override { return mState; } - VideoIOState& MutableState() override { return mState; } - double FrameBudgetMilliseconds() const; - VideoPlayoutRecoveryDecision AccountForCompletionResult(VideoIOCompletionResult completionResult, uint64_t readyQueueDepth) override; - bool BeginOutputFrame(VideoIOOutputFrame& frame) override; - void EndOutputFrame(VideoIOOutputFrame& frame) override; - bool ScheduleOutputFrame(const VideoIOOutputFrame& frame) override; - void HandleVideoInputFrame(IDeckLinkVideoInputFrame* inputFrame, bool hasNoInputSource); - void HandlePlayoutFrameCompleted(IDeckLinkVideoFrame* completedFrame, BMDOutputFrameCompletionResult completionResult); - -private: - bool AcquireNextOutputVideoFrame(CComPtr& outputVideoFrame); - bool PopulateOutputFrame(IDeckLinkMutableVideoFrame* outputVideoFrame, VideoIOOutputFrame& frame); - bool ScheduleFrame(IDeckLinkMutableVideoFrame* outputVideoFrame); - void UpdateScheduleLeadTelemetry(); - void MaybeRealignScheduleCursorForLowLead(); - void RealignScheduleCursorToPlayback(); - bool ScheduleSystemMemoryFrame(const VideoIOOutputFrame& frame); - bool ScheduleBlackFrame(IDeckLinkMutableVideoFrame* outputVideoFrame); - void RefreshBufferedVideoFrameCount(); - static VideoIOCompletionResult TranslateCompletionResult(BMDOutputFrameCompletionResult completionResult); - - CComPtr captureDelegate; - CComPtr playoutDelegate; - CComPtr input; - CComPtr output; - CComPtr keyer; - std::deque> outputVideoFrameQueue; - std::mutex mScheduledSystemFrameMutex; - std::unordered_map mScheduledSystemFrameBuffers; - VideoIOState mState; - VideoPlayoutPolicy mPlayoutPolicy; - VideoPlayoutScheduler mScheduler; - bool mScheduleRealignmentPending = false; - bool mScheduleRealignmentArmed = true; - bool mProactiveScheduleRealignmentArmed = true; - InputFrameCallback mInputFrameCallback; - OutputFrameCallback mOutputFrameCallback; -}; diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkVideoIOFormat.cpp b/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkVideoIOFormat.cpp deleted file mode 100644 index cf988bf..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkVideoIOFormat.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "DeckLinkVideoIOFormat.h" - -BMDPixelFormat DeckLinkPixelFormatForVideoIO(VideoIOPixelFormat format) -{ - switch (format) - { - case VideoIOPixelFormat::V210: - return bmdFormat10BitYUV; - case VideoIOPixelFormat::Yuva10: - return bmdFormat10BitYUVA; - case VideoIOPixelFormat::Bgra8: - return bmdFormat8BitBGRA; - case VideoIOPixelFormat::Uyvy8: - default: - return bmdFormat8BitYUV; - } -} - -VideoIOPixelFormat VideoIOPixelFormatFromDeckLink(BMDPixelFormat format) -{ - if (format == bmdFormat10BitYUV) - return VideoIOPixelFormat::V210; - if (format == bmdFormat10BitYUVA) - return VideoIOPixelFormat::Yuva10; - if (format == bmdFormat8BitBGRA) - return VideoIOPixelFormat::Bgra8; - return VideoIOPixelFormat::Uyvy8; -} diff --git a/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkVideoIOFormat.h b/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkVideoIOFormat.h deleted file mode 100644 index f6106a3..0000000 --- a/apps/LoopThroughWithOpenGLCompositing/videoio/decklink/DeckLinkVideoIOFormat.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#include "DeckLinkAPI_h.h" -#include "VideoIOFormat.h" - -BMDPixelFormat DeckLinkPixelFormatForVideoIO(VideoIOPixelFormat format); -VideoIOPixelFormat VideoIOPixelFormatFromDeckLink(BMDPixelFormat format); diff --git a/apps/RenderCadenceCompositor/README.md b/src/README.md similarity index 100% rename from apps/RenderCadenceCompositor/README.md rename to src/README.md diff --git a/apps/RenderCadenceCompositor/RenderCadenceCompositor.cpp b/src/RenderCadenceCompositor.cpp similarity index 100% rename from apps/RenderCadenceCompositor/RenderCadenceCompositor.cpp rename to src/RenderCadenceCompositor.cpp diff --git a/apps/RenderCadenceCompositor/app/AppConfig.cpp b/src/app/AppConfig.cpp similarity index 100% rename from apps/RenderCadenceCompositor/app/AppConfig.cpp rename to src/app/AppConfig.cpp diff --git a/apps/RenderCadenceCompositor/app/AppConfig.h b/src/app/AppConfig.h similarity index 100% rename from apps/RenderCadenceCompositor/app/AppConfig.h rename to src/app/AppConfig.h diff --git a/apps/RenderCadenceCompositor/app/AppConfigProvider.cpp b/src/app/AppConfigProvider.cpp similarity index 100% rename from apps/RenderCadenceCompositor/app/AppConfigProvider.cpp rename to src/app/AppConfigProvider.cpp diff --git a/apps/RenderCadenceCompositor/app/AppConfigProvider.h b/src/app/AppConfigProvider.h similarity index 100% rename from apps/RenderCadenceCompositor/app/AppConfigProvider.h rename to src/app/AppConfigProvider.h diff --git a/apps/RenderCadenceCompositor/app/RenderCadenceApp.h b/src/app/RenderCadenceApp.h similarity index 100% rename from apps/RenderCadenceCompositor/app/RenderCadenceApp.h rename to src/app/RenderCadenceApp.h diff --git a/apps/RenderCadenceCompositor/app/RuntimeLayerController.cpp b/src/app/RuntimeLayerController.cpp similarity index 100% rename from apps/RenderCadenceCompositor/app/RuntimeLayerController.cpp rename to src/app/RuntimeLayerController.cpp diff --git a/apps/RenderCadenceCompositor/app/RuntimeLayerController.h b/src/app/RuntimeLayerController.h similarity index 100% rename from apps/RenderCadenceCompositor/app/RuntimeLayerController.h rename to src/app/RuntimeLayerController.h diff --git a/apps/RenderCadenceCompositor/app/RuntimeLayerControllerBuild.cpp b/src/app/RuntimeLayerControllerBuild.cpp similarity index 100% rename from apps/RenderCadenceCompositor/app/RuntimeLayerControllerBuild.cpp rename to src/app/RuntimeLayerControllerBuild.cpp diff --git a/apps/RenderCadenceCompositor/app/RuntimeLayerControllerControls.cpp b/src/app/RuntimeLayerControllerControls.cpp similarity index 100% rename from apps/RenderCadenceCompositor/app/RuntimeLayerControllerControls.cpp rename to src/app/RuntimeLayerControllerControls.cpp diff --git a/apps/RenderCadenceCompositor/control/ControlActionResult.h b/src/control/ControlActionResult.h similarity index 100% rename from apps/RenderCadenceCompositor/control/ControlActionResult.h rename to src/control/ControlActionResult.h diff --git a/apps/RenderCadenceCompositor/control/RuntimeControlCommand.cpp b/src/control/RuntimeControlCommand.cpp similarity index 100% rename from apps/RenderCadenceCompositor/control/RuntimeControlCommand.cpp rename to src/control/RuntimeControlCommand.cpp diff --git a/apps/RenderCadenceCompositor/control/RuntimeControlCommand.h b/src/control/RuntimeControlCommand.h similarity index 100% rename from apps/RenderCadenceCompositor/control/RuntimeControlCommand.h rename to src/control/RuntimeControlCommand.h diff --git a/apps/RenderCadenceCompositor/control/RuntimeStateJson.h b/src/control/RuntimeStateJson.h similarity index 100% rename from apps/RenderCadenceCompositor/control/RuntimeStateJson.h rename to src/control/RuntimeStateJson.h diff --git a/apps/RenderCadenceCompositor/control/http/HttpControlServer.cpp b/src/control/http/HttpControlServer.cpp similarity index 100% rename from apps/RenderCadenceCompositor/control/http/HttpControlServer.cpp rename to src/control/http/HttpControlServer.cpp diff --git a/apps/RenderCadenceCompositor/control/http/HttpControlServer.h b/src/control/http/HttpControlServer.h similarity index 100% rename from apps/RenderCadenceCompositor/control/http/HttpControlServer.h rename to src/control/http/HttpControlServer.h diff --git a/apps/RenderCadenceCompositor/control/http/HttpControlServerRoutes.cpp b/src/control/http/HttpControlServerRoutes.cpp similarity index 100% rename from apps/RenderCadenceCompositor/control/http/HttpControlServerRoutes.cpp rename to src/control/http/HttpControlServerRoutes.cpp diff --git a/apps/RenderCadenceCompositor/control/http/HttpControlServerWebSocket.cpp b/src/control/http/HttpControlServerWebSocket.cpp similarity index 100% rename from apps/RenderCadenceCompositor/control/http/HttpControlServerWebSocket.cpp rename to src/control/http/HttpControlServerWebSocket.cpp diff --git a/apps/RenderCadenceCompositor/frames/InputFrameMailbox.cpp b/src/frames/InputFrameMailbox.cpp similarity index 100% rename from apps/RenderCadenceCompositor/frames/InputFrameMailbox.cpp rename to src/frames/InputFrameMailbox.cpp diff --git a/apps/RenderCadenceCompositor/frames/InputFrameMailbox.h b/src/frames/InputFrameMailbox.h similarity index 100% rename from apps/RenderCadenceCompositor/frames/InputFrameMailbox.h rename to src/frames/InputFrameMailbox.h diff --git a/apps/RenderCadenceCompositor/frames/SystemFrameExchange.cpp b/src/frames/SystemFrameExchange.cpp similarity index 100% rename from apps/RenderCadenceCompositor/frames/SystemFrameExchange.cpp rename to src/frames/SystemFrameExchange.cpp diff --git a/apps/RenderCadenceCompositor/frames/SystemFrameExchange.h b/src/frames/SystemFrameExchange.h similarity index 100% rename from apps/RenderCadenceCompositor/frames/SystemFrameExchange.h rename to src/frames/SystemFrameExchange.h diff --git a/apps/RenderCadenceCompositor/frames/SystemFrameTypes.h b/src/frames/SystemFrameTypes.h similarity index 100% rename from apps/RenderCadenceCompositor/frames/SystemFrameTypes.h rename to src/frames/SystemFrameTypes.h diff --git a/apps/RenderCadenceCompositor/json/JsonWriter.cpp b/src/json/JsonWriter.cpp similarity index 100% rename from apps/RenderCadenceCompositor/json/JsonWriter.cpp rename to src/json/JsonWriter.cpp diff --git a/apps/RenderCadenceCompositor/json/JsonWriter.h b/src/json/JsonWriter.h similarity index 100% rename from apps/RenderCadenceCompositor/json/JsonWriter.h rename to src/json/JsonWriter.h diff --git a/apps/RenderCadenceCompositor/logging/Logger.cpp b/src/logging/Logger.cpp similarity index 100% rename from apps/RenderCadenceCompositor/logging/Logger.cpp rename to src/logging/Logger.cpp diff --git a/apps/RenderCadenceCompositor/logging/Logger.h b/src/logging/Logger.h similarity index 100% rename from apps/RenderCadenceCompositor/logging/Logger.h rename to src/logging/Logger.h diff --git a/apps/RenderCadenceCompositor/platform/HiddenGlWindow.cpp b/src/platform/HiddenGlWindow.cpp similarity index 100% rename from apps/RenderCadenceCompositor/platform/HiddenGlWindow.cpp rename to src/platform/HiddenGlWindow.cpp diff --git a/apps/RenderCadenceCompositor/platform/HiddenGlWindow.h b/src/platform/HiddenGlWindow.h similarity index 100% rename from apps/RenderCadenceCompositor/platform/HiddenGlWindow.h rename to src/platform/HiddenGlWindow.h diff --git a/apps/RenderCadenceCompositor/render/InputFrameTexture.cpp b/src/render/InputFrameTexture.cpp similarity index 100% rename from apps/RenderCadenceCompositor/render/InputFrameTexture.cpp rename to src/render/InputFrameTexture.cpp diff --git a/apps/RenderCadenceCompositor/render/InputFrameTexture.h b/src/render/InputFrameTexture.h similarity index 100% rename from apps/RenderCadenceCompositor/render/InputFrameTexture.h rename to src/render/InputFrameTexture.h diff --git a/apps/RenderCadenceCompositor/render/RenderCadenceClock.cpp b/src/render/RenderCadenceClock.cpp similarity index 100% rename from apps/RenderCadenceCompositor/render/RenderCadenceClock.cpp rename to src/render/RenderCadenceClock.cpp diff --git a/apps/RenderCadenceCompositor/render/RenderCadenceClock.h b/src/render/RenderCadenceClock.h similarity index 100% rename from apps/RenderCadenceCompositor/render/RenderCadenceClock.h rename to src/render/RenderCadenceClock.h diff --git a/apps/RenderCadenceCompositor/render/RenderThread.cpp b/src/render/RenderThread.cpp similarity index 100% rename from apps/RenderCadenceCompositor/render/RenderThread.cpp rename to src/render/RenderThread.cpp diff --git a/apps/RenderCadenceCompositor/render/RenderThread.h b/src/render/RenderThread.h similarity index 100% rename from apps/RenderCadenceCompositor/render/RenderThread.h rename to src/render/RenderThread.h diff --git a/apps/RenderCadenceCompositor/render/SimpleMotionRenderer.cpp b/src/render/SimpleMotionRenderer.cpp similarity index 100% rename from apps/RenderCadenceCompositor/render/SimpleMotionRenderer.cpp rename to src/render/SimpleMotionRenderer.cpp diff --git a/apps/RenderCadenceCompositor/render/SimpleMotionRenderer.h b/src/render/SimpleMotionRenderer.h similarity index 100% rename from apps/RenderCadenceCompositor/render/SimpleMotionRenderer.h rename to src/render/SimpleMotionRenderer.h diff --git a/apps/RenderCadenceCompositor/render/readback/Bgra8ReadbackPipeline.cpp b/src/render/readback/Bgra8ReadbackPipeline.cpp similarity index 100% rename from apps/RenderCadenceCompositor/render/readback/Bgra8ReadbackPipeline.cpp rename to src/render/readback/Bgra8ReadbackPipeline.cpp diff --git a/apps/RenderCadenceCompositor/render/readback/Bgra8ReadbackPipeline.h b/src/render/readback/Bgra8ReadbackPipeline.h similarity index 100% rename from apps/RenderCadenceCompositor/render/readback/Bgra8ReadbackPipeline.h rename to src/render/readback/Bgra8ReadbackPipeline.h diff --git a/apps/RenderCadenceCompositor/render/readback/PboReadbackRing.cpp b/src/render/readback/PboReadbackRing.cpp similarity index 100% rename from apps/RenderCadenceCompositor/render/readback/PboReadbackRing.cpp rename to src/render/readback/PboReadbackRing.cpp diff --git a/apps/RenderCadenceCompositor/render/readback/PboReadbackRing.h b/src/render/readback/PboReadbackRing.h similarity index 100% rename from apps/RenderCadenceCompositor/render/readback/PboReadbackRing.h rename to src/render/readback/PboReadbackRing.h diff --git a/apps/RenderCadenceCompositor/render/runtime/RuntimeRenderScene.cpp b/src/render/runtime/RuntimeRenderScene.cpp similarity index 100% rename from apps/RenderCadenceCompositor/render/runtime/RuntimeRenderScene.cpp rename to src/render/runtime/RuntimeRenderScene.cpp diff --git a/apps/RenderCadenceCompositor/render/runtime/RuntimeRenderScene.h b/src/render/runtime/RuntimeRenderScene.h similarity index 100% rename from apps/RenderCadenceCompositor/render/runtime/RuntimeRenderScene.h rename to src/render/runtime/RuntimeRenderScene.h diff --git a/apps/RenderCadenceCompositor/render/runtime/RuntimeRenderSceneRender.cpp b/src/render/runtime/RuntimeRenderSceneRender.cpp similarity index 100% rename from apps/RenderCadenceCompositor/render/runtime/RuntimeRenderSceneRender.cpp rename to src/render/runtime/RuntimeRenderSceneRender.cpp diff --git a/apps/RenderCadenceCompositor/render/runtime/RuntimeShaderParams.cpp b/src/render/runtime/RuntimeShaderParams.cpp similarity index 100% rename from apps/RenderCadenceCompositor/render/runtime/RuntimeShaderParams.cpp rename to src/render/runtime/RuntimeShaderParams.cpp diff --git a/apps/RenderCadenceCompositor/render/runtime/RuntimeShaderParams.h b/src/render/runtime/RuntimeShaderParams.h similarity index 100% rename from apps/RenderCadenceCompositor/render/runtime/RuntimeShaderParams.h rename to src/render/runtime/RuntimeShaderParams.h diff --git a/apps/RenderCadenceCompositor/render/runtime/RuntimeShaderPrepareWorker.cpp b/src/render/runtime/RuntimeShaderPrepareWorker.cpp similarity index 100% rename from apps/RenderCadenceCompositor/render/runtime/RuntimeShaderPrepareWorker.cpp rename to src/render/runtime/RuntimeShaderPrepareWorker.cpp diff --git a/apps/RenderCadenceCompositor/render/runtime/RuntimeShaderPrepareWorker.h b/src/render/runtime/RuntimeShaderPrepareWorker.h similarity index 100% rename from apps/RenderCadenceCompositor/render/runtime/RuntimeShaderPrepareWorker.h rename to src/render/runtime/RuntimeShaderPrepareWorker.h diff --git a/apps/RenderCadenceCompositor/render/runtime/RuntimeShaderProgram.h b/src/render/runtime/RuntimeShaderProgram.h similarity index 100% rename from apps/RenderCadenceCompositor/render/runtime/RuntimeShaderProgram.h rename to src/render/runtime/RuntimeShaderProgram.h diff --git a/apps/RenderCadenceCompositor/render/runtime/RuntimeShaderRenderer.cpp b/src/render/runtime/RuntimeShaderRenderer.cpp similarity index 100% rename from apps/RenderCadenceCompositor/render/runtime/RuntimeShaderRenderer.cpp rename to src/render/runtime/RuntimeShaderRenderer.cpp diff --git a/apps/RenderCadenceCompositor/render/runtime/RuntimeShaderRenderer.h b/src/render/runtime/RuntimeShaderRenderer.h similarity index 100% rename from apps/RenderCadenceCompositor/render/runtime/RuntimeShaderRenderer.h rename to src/render/runtime/RuntimeShaderRenderer.h diff --git a/apps/RenderCadenceCompositor/runtime/RuntimeLayerModel.cpp b/src/runtime/RuntimeLayerModel.cpp similarity index 100% rename from apps/RenderCadenceCompositor/runtime/RuntimeLayerModel.cpp rename to src/runtime/RuntimeLayerModel.cpp diff --git a/apps/RenderCadenceCompositor/runtime/RuntimeLayerModel.h b/src/runtime/RuntimeLayerModel.h similarity index 100% rename from apps/RenderCadenceCompositor/runtime/RuntimeLayerModel.h rename to src/runtime/RuntimeLayerModel.h diff --git a/apps/RenderCadenceCompositor/runtime/RuntimeShaderArtifact.h b/src/runtime/RuntimeShaderArtifact.h similarity index 100% rename from apps/RenderCadenceCompositor/runtime/RuntimeShaderArtifact.h rename to src/runtime/RuntimeShaderArtifact.h diff --git a/apps/RenderCadenceCompositor/runtime/RuntimeShaderBridge.cpp b/src/runtime/RuntimeShaderBridge.cpp similarity index 100% rename from apps/RenderCadenceCompositor/runtime/RuntimeShaderBridge.cpp rename to src/runtime/RuntimeShaderBridge.cpp diff --git a/apps/RenderCadenceCompositor/runtime/RuntimeShaderBridge.h b/src/runtime/RuntimeShaderBridge.h similarity index 100% rename from apps/RenderCadenceCompositor/runtime/RuntimeShaderBridge.h rename to src/runtime/RuntimeShaderBridge.h diff --git a/apps/RenderCadenceCompositor/runtime/RuntimeSlangShaderCompiler.cpp b/src/runtime/RuntimeSlangShaderCompiler.cpp similarity index 100% rename from apps/RenderCadenceCompositor/runtime/RuntimeSlangShaderCompiler.cpp rename to src/runtime/RuntimeSlangShaderCompiler.cpp diff --git a/apps/RenderCadenceCompositor/runtime/RuntimeSlangShaderCompiler.h b/src/runtime/RuntimeSlangShaderCompiler.h similarity index 100% rename from apps/RenderCadenceCompositor/runtime/RuntimeSlangShaderCompiler.h rename to src/runtime/RuntimeSlangShaderCompiler.h diff --git a/apps/RenderCadenceCompositor/runtime/SupportedShaderCatalog.cpp b/src/runtime/SupportedShaderCatalog.cpp similarity index 100% rename from apps/RenderCadenceCompositor/runtime/SupportedShaderCatalog.cpp rename to src/runtime/SupportedShaderCatalog.cpp diff --git a/apps/RenderCadenceCompositor/runtime/SupportedShaderCatalog.h b/src/runtime/SupportedShaderCatalog.h similarity index 100% rename from apps/RenderCadenceCompositor/runtime/SupportedShaderCatalog.h rename to src/runtime/SupportedShaderCatalog.h diff --git a/apps/RenderCadenceCompositor/telemetry/CadenceTelemetry.h b/src/telemetry/CadenceTelemetry.h similarity index 100% rename from apps/RenderCadenceCompositor/telemetry/CadenceTelemetry.h rename to src/telemetry/CadenceTelemetry.h diff --git a/apps/RenderCadenceCompositor/telemetry/CadenceTelemetryJson.h b/src/telemetry/CadenceTelemetryJson.h similarity index 100% rename from apps/RenderCadenceCompositor/telemetry/CadenceTelemetryJson.h rename to src/telemetry/CadenceTelemetryJson.h diff --git a/apps/RenderCadenceCompositor/telemetry/TelemetryHealthMonitor.h b/src/telemetry/TelemetryHealthMonitor.h similarity index 100% rename from apps/RenderCadenceCompositor/telemetry/TelemetryHealthMonitor.h rename to src/telemetry/TelemetryHealthMonitor.h diff --git a/apps/RenderCadenceCompositor/video/DeckLinkInput.cpp b/src/video/DeckLinkInput.cpp similarity index 100% rename from apps/RenderCadenceCompositor/video/DeckLinkInput.cpp rename to src/video/DeckLinkInput.cpp diff --git a/apps/RenderCadenceCompositor/video/DeckLinkInput.h b/src/video/DeckLinkInput.h similarity index 100% rename from apps/RenderCadenceCompositor/video/DeckLinkInput.h rename to src/video/DeckLinkInput.h diff --git a/apps/RenderCadenceCompositor/video/DeckLinkInputThread.h b/src/video/DeckLinkInputThread.h similarity index 100% rename from apps/RenderCadenceCompositor/video/DeckLinkInputThread.h rename to src/video/DeckLinkInputThread.h diff --git a/apps/RenderCadenceCompositor/video/DeckLinkOutput.cpp b/src/video/DeckLinkOutput.cpp similarity index 100% rename from apps/RenderCadenceCompositor/video/DeckLinkOutput.cpp rename to src/video/DeckLinkOutput.cpp diff --git a/apps/RenderCadenceCompositor/video/DeckLinkOutput.h b/src/video/DeckLinkOutput.h similarity index 100% rename from apps/RenderCadenceCompositor/video/DeckLinkOutput.h rename to src/video/DeckLinkOutput.h diff --git a/apps/RenderCadenceCompositor/video/DeckLinkOutputThread.h b/src/video/DeckLinkOutputThread.h similarity index 100% rename from apps/RenderCadenceCompositor/video/DeckLinkOutputThread.h rename to src/video/DeckLinkOutputThread.h