Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions CaptureDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ IDeckLinkConfiguration* CaptureDelegate::queryConfigurationInterface()
return deckLinkConfiguration;
}

IDeckLinkAttributes* CaptureDelegate::queryAttributesInterface()
IDeckLinkProfileAttributes* CaptureDelegate::queryAttributesInterface()
{
LLOG(INFO) << __PRETTY_FUNCTION__;

HRESULT result;
IDeckLinkAttributes* deckLinkAttributes = nullptr;
IDeckLinkProfileAttributes* deckLinkAttributes = nullptr;

result = m_deckLink->QueryInterface(IID_IDeckLinkAttributes, (void **)&deckLinkAttributes);
throwIfNotOk(result, "Could not obtain the IID_IDeckLinkAttributes interface");
result = m_deckLink->QueryInterface(IID_IDeckLinkProfileAttributes, (void **)&deckLinkAttributes);
throwIfNotOk(result, "Could not obtain the IID_IDeckLinkProfileAttributes interface");

return deckLinkAttributes;
}
Expand Down Expand Up @@ -115,7 +115,7 @@ void CaptureDelegate::setDuplexToHalfDuplexMode(IDeckLink *deckLink)
result = deckLink->QueryInterface(IID_IDeckLinkConfiguration, (void **)&m_deckLinkParentDeviceConfiguration);
throwIfNotOk(result, "Could not obtain the IID_IDeckLinkConfiguration interface");

result = m_deckLinkParentDeviceConfiguration->SetInt(bmdDeckLinkConfigDuplexMode, bmdDuplexModeHalf);
//result = m_deckLinkParentDeviceConfiguration->SetInt(bmdDeckLinkConfigDuplexMode, bmdDuplexModeHalf);
throwIfNotOk(result, "Setting duplex mode failed");
}

Expand Down Expand Up @@ -253,10 +253,17 @@ HRESULT CaptureDelegate::VideoInputFormatChanged(UNUSED BMDVideoInputFormatChang

bool isRgb = formatFlags & bmdDetectedVideoInputRGB444;

mode->GetName((const char**)&displayModeName);
m_detectedMode = displayModeName;
m_detectedMode += " ";
m_detectedMode += (isRgb ? "RGB" : "YUV");
result = mode->GetName((const char**)&displayModeName);
if (result == S_OK)
{
m_detectedMode = displayModeName;
m_detectedMode += " ";
m_detectedMode += (isRgb ? "RGB" : "YUV");
}
else
{
m_detectedMode = "Unknown mode";
}

if (displayModeName)
free(displayModeName);
Expand Down
6 changes: 3 additions & 3 deletions CaptureDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class CaptureDelegate : public IDeckLinkInputCallback

IDeckLinkDisplayMode* queryFirstDisplayMode();
IDeckLinkConfiguration* queryConfigurationInterface();
IDeckLinkAttributes* queryAttributesInterface();
IDeckLinkProfileAttributes* queryAttributesInterface();

int64_t queryInputConnections();
BMDVideoConnection querySelectedConnection();
Expand All @@ -60,8 +60,8 @@ class CaptureDelegate : public IDeckLinkInputCallback
IDeckLink* m_deckLink;
IDeckLinkInput* m_deckLinkInput;

IDeckLinkAttributes* m_deckLinkAttributes;
RefReleaser<IDeckLinkAttributes> m_deckLinkAttributesReleaser;
IDeckLinkProfileAttributes* m_deckLinkAttributes;
RefReleaser<IDeckLinkProfileAttributes> m_deckLinkAttributesReleaser;

IDeckLinkConfiguration* m_deckLinkConfiguration;
RefReleaser<IDeckLinkConfiguration> m_deckLinkConfigurationReleaser;
Expand Down
46 changes: 31 additions & 15 deletions DeckLinkAPIDispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
** execute, and transmit the Software, and to prepare derivative works of the
** Software, and to permit third-parties to whom the Software is furnished to
** do so, all subject to the following:
**
**
** The copyright notices in the Software and this entire statement, including
** the above license grant, this restriction and the following disclaimer,
** must be included in all copies of the Software, in whole or in part, and
** all derivative works of the Software, unless such copies or derivative
** works are solely in the form of machine-executable object code generated by
** a source language processor.
**
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
Expand All @@ -39,6 +39,7 @@ typedef IDeckLinkAPIInformation* (*CreateAPIInformationFunc)(void);
typedef IDeckLinkGLScreenPreviewHelper* (*CreateOpenGLScreenPreviewHelperFunc)(void);
typedef IDeckLinkVideoConversion* (*CreateVideoConversionInstanceFunc)(void);
typedef IDeckLinkDiscovery* (*CreateDeckLinkDiscoveryInstanceFunc)(void);
typedef IDeckLinkVideoFrameAncillaryPackets* (*CreateVideoFrameAncillaryPacketsInstanceFunc)(void);

static pthread_once_t gDeckLinkOnceControl = PTHREAD_ONCE_INIT;
static pthread_once_t gPreviewOnceControl = PTHREAD_ONCE_INIT;
Expand All @@ -50,21 +51,22 @@ static CreateAPIInformationFunc gCreateAPIInformationFunc = NULL;
static CreateOpenGLScreenPreviewHelperFunc gCreateOpenGLPreviewFunc = NULL;
static CreateVideoConversionInstanceFunc gCreateVideoConversionFunc = NULL;
static CreateDeckLinkDiscoveryInstanceFunc gCreateDeckLinkDiscoveryFunc = NULL;
static CreateVideoFrameAncillaryPacketsInstanceFunc gCreateVideoFrameAncillaryPacketsFunc = NULL;

void InitDeckLinkAPI (void)
static void InitDeckLinkAPI (void)
{
void *libraryHandle;

libraryHandle = dlopen(kDeckLinkAPI_Name, RTLD_NOW|RTLD_GLOBAL);
if (!libraryHandle)
{
fprintf(stderr, "%s\n", dlerror());
return;
}

gLoadedDeckLinkAPI = true;
gCreateIteratorFunc = (CreateIteratorFunc)dlsym(libraryHandle, "CreateDeckLinkIteratorInstance_0003");

gCreateIteratorFunc = (CreateIteratorFunc)dlsym(libraryHandle, "CreateDeckLinkIteratorInstance_0004");
if (!gCreateIteratorFunc)
fprintf(stderr, "%s\n", dlerror());
gCreateAPIInformationFunc = (CreateAPIInformationFunc)dlsym(libraryHandle, "CreateDeckLinkAPIInformationInstance_0001");
Expand All @@ -73,15 +75,18 @@ void InitDeckLinkAPI (void)
gCreateVideoConversionFunc = (CreateVideoConversionInstanceFunc)dlsym(libraryHandle, "CreateVideoConversionInstance_0001");
if (!gCreateVideoConversionFunc)
fprintf(stderr, "%s\n", dlerror());
gCreateDeckLinkDiscoveryFunc = (CreateDeckLinkDiscoveryInstanceFunc)dlsym(libraryHandle, "CreateDeckLinkDiscoveryInstance_0002");
gCreateDeckLinkDiscoveryFunc = (CreateDeckLinkDiscoveryInstanceFunc)dlsym(libraryHandle, "CreateDeckLinkDiscoveryInstance_0003");
if (!gCreateDeckLinkDiscoveryFunc)
fprintf(stderr, "%s\n", dlerror());
gCreateVideoFrameAncillaryPacketsFunc = (CreateVideoFrameAncillaryPacketsInstanceFunc)dlsym(libraryHandle, "CreateVideoFrameAncillaryPacketsInstance_0001");
if (!gCreateVideoFrameAncillaryPacketsFunc)
fprintf(stderr, "%s\n", dlerror());
}

void InitDeckLinkPreviewAPI (void)
static void InitDeckLinkPreviewAPI (void)
{
void *libraryHandle;

libraryHandle = dlopen(KDeckLinkPreviewAPI_Name, RTLD_NOW|RTLD_GLOBAL);
if (!libraryHandle)
{
Expand All @@ -93,16 +98,18 @@ void InitDeckLinkPreviewAPI (void)
fprintf(stderr, "%s\n", dlerror());
}

#if 0
bool IsDeckLinkAPIPresent (void)
{
// If the DeckLink API dynamic library was successfully loaded, return this knowledge to the caller
return gLoadedDeckLinkAPI;
}
#endif

IDeckLinkIterator* CreateDeckLinkIteratorInstance (void)
{
pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI);

if (gCreateIteratorFunc == NULL)
return NULL;
return gCreateIteratorFunc();
Expand All @@ -111,7 +118,7 @@ IDeckLinkIterator* CreateDeckLinkIteratorInstance (void)
IDeckLinkAPIInformation* CreateDeckLinkAPIInformationInstance (void)
{
pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI);

if (gCreateAPIInformationFunc == NULL)
return NULL;
return gCreateAPIInformationFunc();
Expand All @@ -121,7 +128,7 @@ IDeckLinkGLScreenPreviewHelper* CreateOpenGLScreenPreviewHelper (void)
{
pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI);
pthread_once(&gPreviewOnceControl, InitDeckLinkPreviewAPI);

if (gCreateOpenGLPreviewFunc == NULL)
return NULL;
return gCreateOpenGLPreviewFunc();
Expand All @@ -130,7 +137,7 @@ IDeckLinkGLScreenPreviewHelper* CreateOpenGLScreenPreviewHelper (void)
IDeckLinkVideoConversion* CreateVideoConversionInstance (void)
{
pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI);

if (gCreateVideoConversionFunc == NULL)
return NULL;
return gCreateVideoConversionFunc();
Expand All @@ -139,8 +146,17 @@ IDeckLinkVideoConversion* CreateVideoConversionInstance (void)
IDeckLinkDiscovery* CreateDeckLinkDiscoveryInstance (void)
{
pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI);

if (gCreateDeckLinkDiscoveryFunc == NULL)
return NULL;
return gCreateDeckLinkDiscoveryFunc();
}

IDeckLinkVideoFrameAncillaryPackets* CreateVideoFrameAncillaryPacketsInstance (void)
{
pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI);

if (gCreateVideoFrameAncillaryPacketsFunc == NULL)
return NULL;
return gCreateVideoFrameAncillaryPacketsFunc();
}
10 changes: 5 additions & 5 deletions DeviceProber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ bool DeviceProber::queryCanAutodetect()
LLOG(INFO) << __PRETTY_FUNCTION__;

HRESULT result;
IDeckLinkAttributes* deckLinkAttributes = nullptr;
RefReleaser<IDeckLinkAttributes> deckLinkAttributesReleaser(&deckLinkAttributes);
IDeckLinkProfileAttributes* deckLinkAttributes = nullptr;
RefReleaser<IDeckLinkProfileAttributes> deckLinkAttributesReleaser(&deckLinkAttributes);

LLOG(DEBUG1) << "querying IID_IDeckLinkAttributes Interface";
result = m_deckLink->QueryInterface(IID_IDeckLinkAttributes, (void **)&deckLinkAttributes);
throwIfNotOk(result, "Could not obtain the IDeckLinkAttributes interface");
LLOG(DEBUG1) << "querying IID_IDeckLinkProfileAttributes Interface";
result = m_deckLink->QueryInterface(IID_IDeckLinkProfileAttributes, (void **)&deckLinkAttributes);
throwIfNotOk(result, "Could not obtain the IDeckLinkProfileAttributes interface");

LLOG(DEBUG1) << "querying BMDDeckLinkSupportsInputFormatDetection flag";
bool formatDetectionSupported;
Expand Down
22 changes: 19 additions & 3 deletions HttpServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@

#include "rc.h"

int requestHandlerProxy(

#if MHD_VERSION < 0x00097002
static int
#else
static enum MHD_Result
#endif
requestHandlerProxy(
void *cls,
struct MHD_Connection *connection,
const char *url,
Expand Down Expand Up @@ -228,7 +234,12 @@ int HttpServer::indexRequestHandler(
return MHD_HTTP_OK;
}

int requestHandlerProxy(
#if MHD_VERSION < 0x00097002
static int
#else
static enum MHD_Result
#endif
requestHandlerProxy(
void *cls,
struct MHD_Connection *connection,
UNUSED const char *url,
Expand Down Expand Up @@ -267,7 +278,12 @@ int requestHandlerProxy(
MHD_add_response_header(response, entry.first.c_str(), entry.second.c_str());
}

int ret = MHD_queue_response(connection, status_code, response);
#if MHD_VERSION < 0x00097002
int
#else
MHD_Result
#endif
ret = MHD_queue_response(connection, status_code, response);
MHD_destroy_response(response);
return ret;
}
34 changes: 17 additions & 17 deletions SubDeviceUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ bool SubDeviceUtil::SupportsDuplexMode(IDeckLink *deckLink)
LLOG(INFO) << __PRETTY_FUNCTION__;

HRESULT result;
IDeckLinkAttributes* deckLinkAttributes = nullptr;
RefReleaser<IDeckLinkAttributes> deckLinkAttributesReleaser(&deckLinkAttributes);
IDeckLinkProfileAttributes* deckLinkAttributes = nullptr;
RefReleaser<IDeckLinkProfileAttributes> deckLinkAttributesReleaser(&deckLinkAttributes);

LLOG(DEBUG1) << "querying IID_IDeckLinkAttributes Interface";
result = deckLink->QueryInterface(IID_IDeckLinkAttributes, (void **)&deckLinkAttributes);
throwIfNotOk(result, "Could not obtain the IDeckLinkAttributes interface");
LLOG(DEBUG1) << "querying IID_IDeckLinkProfileAttributes Interface";
result = deckLink->QueryInterface(IID_IDeckLinkProfileAttributes, (void **)&deckLinkAttributes);
throwIfNotOk(result, "Could not obtain the IDeckLinkProfileAttributes interface");

LLOG(DEBUG1) << "querying BMDDeckLinkSupportsDuplexModeConfiguration flag";
bool supportsDuplexModeConfiguration;
result = deckLinkAttributes->GetFlag(BMDDeckLinkSupportsDuplexModeConfiguration, &supportsDuplexModeConfiguration);
//result = deckLinkAttributes->GetFlag(IDeckLinkProfileIterator, &supportsDuplexModeConfiguration);
if(result != S_OK) {
LLOG(DEBUG1) << "failed to query BMDDeckLinkSupportsDuplexModeConfiguration flag";
return false;
Expand All @@ -46,16 +46,16 @@ IDeckLink *SubDeviceUtil::QueryParentDevice(IDeckLink *deckLink)
LLOG(INFO) << __PRETTY_FUNCTION__;

HRESULT result;
IDeckLinkAttributes* deckLinkAttributes = nullptr;
RefReleaser<IDeckLinkAttributes> deckLinkAttributesReleaser(&deckLinkAttributes);
IDeckLinkProfileAttributes* deckLinkAttributes = nullptr;
RefReleaser<IDeckLinkProfileAttributes> deckLinkAttributesReleaser(&deckLinkAttributes);

LLOG(DEBUG1) << "querying IID_IDeckLinkAttributes Interface";
result = deckLink->QueryInterface(IID_IDeckLinkAttributes, (void **)&deckLinkAttributes);
throwIfNotOk(result, "Could not obtain the IDeckLinkAttributes interface");
LLOG(DEBUG1) << "querying IID_IDeckLinkProfileAttributes Interface";
result = deckLink->QueryInterface(IID_IDeckLinkProfileAttributes, (void **)&deckLinkAttributes);
throwIfNotOk(result, "Could not obtain the IDeckLinkProfileAttributes interface");

LLOG(DEBUG1) << "querying BMDDeckLinkPairedDevicePersistentID attribute";
int64_t pairedDeviceId;
result = deckLinkAttributes->GetInt(BMDDeckLinkPairedDevicePersistentID, &pairedDeviceId);
result = deckLinkAttributes->GetInt(BMDDeckLinkPersistentID, &pairedDeviceId);
if(result != S_OK)
{
LLOG(DEBUG1) << "failed to query BMDDeckLinkPairedDevicePersistentID attribute, this is no SubDevice";
Expand Down Expand Up @@ -95,12 +95,12 @@ IDeckLink *SubDeviceUtil::findDeckLinkInterfaceByPersistentId(int64_t pairedDevi
LLOG(DEBUG) << "probing Device " << i;
RefReleaser<IDeckLink> deckLinkReleaser(&deckLink);

IDeckLinkAttributes* deckLinkAttributes = nullptr;
RefReleaser<IDeckLinkAttributes> deckLinkAttributesReleaser(&deckLinkAttributes);
IDeckLinkProfileAttributes* deckLinkAttributes = nullptr;
RefReleaser<IDeckLinkProfileAttributes> deckLinkAttributesReleaser(&deckLinkAttributes);

LLOG(DEBUG1) << "querying IID_IDeckLinkAttributes Interface";
result = deckLink->QueryInterface(IID_IDeckLinkAttributes, (void **)&deckLinkAttributes);
throwIfNotOk(result, "Could not obtain the IDeckLinkAttributes interface");
LLOG(DEBUG1) << "querying IID_IDeckLinkProfileAttributes Interface";
result = deckLink->QueryInterface(IID_IDeckLinkProfileAttributes, (void **)&deckLinkAttributes);
throwIfNotOk(result, "Could not obtain the IDeckLinkProfileAttributes interface");

LLOG(DEBUG1) << "querying BMDDeckLinkPersistentID attribute";
int64_t persistent_id;
Expand Down
2 changes: 1 addition & 1 deletion TablePrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ TablePrinter& TablePrinter::operator<<(double input){
}

TablePrinter& TablePrinter::operator<<(UNUSED greyon input) {
*out_stream_ << "\033[1;30m";
*out_stream_ << "\033[0;37m";
return *this;
}

Expand Down
12 changes: 6 additions & 6 deletions decklink-debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ void printStatusList(std::vector<DeviceProber*> deviceProbers, unsigned int iter
}

bprinter::TablePrinter table(&std::cout);
table.AddColumn("#", 15);
table.AddColumn("Device Name", 31);
table.AddColumn("#", 4);
table.AddColumn("Device Name", 33);
table.AddColumn("Can Input & Detect", 20);
table.AddColumn("Signal Detected", 17);
table.AddColumn("Active Connection", 19);
table.AddColumn("Detected Mode", 16);
table.AddColumn("Pixel Format", 15);
table.AddColumn("Signal", 8);
table.AddColumn("Connection", 12);
table.AddColumn("Detected Mode", 20);
table.AddColumn("Pixel Format", 92);
table.set_flush_left();
table.PrintHeader();

Expand Down
Binary file modified screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.