Skip to content

Commit

Permalink
in cpp, void args is default, not varargs
Browse files Browse the repository at this point in the history
  • Loading branch information
MaZderMind committed Feb 17, 2019
1 parent 61419dd commit f33fab0
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 52 deletions.
26 changes: 13 additions & 13 deletions CaptureDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ CaptureDelegate::CaptureDelegate(IDeckLink* deckLink) :
setDuplexToHalfDuplexModeIfSupported();
}

IDeckLinkInput* CaptureDelegate::queryInputInterface(void)
IDeckLinkInput* CaptureDelegate::queryInputInterface()
{
HRESULT result;
IDeckLinkInput* deckLinkInput = NULL;
Expand All @@ -54,7 +54,7 @@ IDeckLinkInput* CaptureDelegate::queryInputInterface(void)
return deckLinkInput;
}

int64_t CaptureDelegate::getPairedDeviceId(void)
int64_t CaptureDelegate::getPairedDeviceId()
{
HRESULT result;
int64_t paired_device_id;
Expand All @@ -68,7 +68,7 @@ int64_t CaptureDelegate::getPairedDeviceId(void)
return paired_device_id;
}

IDeckLinkConfiguration* CaptureDelegate::queryConfigurationInterface(void)
IDeckLinkConfiguration* CaptureDelegate::queryConfigurationInterface()
{
return queryConfigurationInterface(m_deckLink);
}
Expand All @@ -87,7 +87,7 @@ IDeckLinkConfiguration* CaptureDelegate::queryConfigurationInterface(IDeckLink*
return deckLinkConfiguration;
}

IDeckLinkAttributes* CaptureDelegate::queryAttributesInterface(void)
IDeckLinkAttributes* CaptureDelegate::queryAttributesInterface()
{
return queryAttributesInterface(m_deckLink);
}
Expand All @@ -106,7 +106,7 @@ IDeckLinkAttributes* CaptureDelegate::queryAttributesInterface(IDeckLink* deckLi
return deckLinkAttributes;
}

int64_t CaptureDelegate::queryInputConnections(void)
int64_t CaptureDelegate::queryInputConnections()
{
HRESULT result;
int64_t connections;
Expand Down Expand Up @@ -161,7 +161,7 @@ IDeckLink* CaptureDelegate::queryDeckLinkInterfaceByPersistentId(int64_t pairedD
return NULL;
}

void CaptureDelegate::setDuplexToHalfDuplexModeIfSupported(void)
void CaptureDelegate::setDuplexToHalfDuplexModeIfSupported()
{
try {
// try setDuplexToHalfDuplexModeIfSupported on this device
Expand Down Expand Up @@ -223,7 +223,7 @@ void CaptureDelegate::setDuplexToHalfDuplexModeIfSupported(IDeckLinkAttributes*
}
}

void CaptureDelegate::Start(void)
void CaptureDelegate::Start()
{
HRESULT result;

Expand Down Expand Up @@ -257,7 +257,7 @@ void CaptureDelegate::Start(void)
}
}

void CaptureDelegate::Stop(void)
void CaptureDelegate::Stop()
{
m_deckLinkInput->StopStreams();
m_deckLinkInput->DisableAudioInput();
Expand All @@ -266,7 +266,7 @@ void CaptureDelegate::Stop(void)
m_deckLinkInput->SetCallback(NULL);
}

IDeckLinkDisplayMode* CaptureDelegate::queryFirstDisplayMode(void)
IDeckLinkDisplayMode* CaptureDelegate::queryFirstDisplayMode()
{
HRESULT result;

Expand Down Expand Up @@ -294,7 +294,7 @@ IDeckLinkDisplayMode* CaptureDelegate::queryFirstDisplayMode(void)
return displayMode;
}

void CaptureDelegate::SelectNextConnection(void)
void CaptureDelegate::SelectNextConnection()
{
std::array<BMDVideoConnection, 3> relevantConnections = {
bmdVideoConnectionSDI,
Expand Down Expand Up @@ -330,7 +330,7 @@ void CaptureDelegate::SelectNextConnection(void)
m_deckLinkConfiguration->SetInt(bmdDeckLinkConfigVideoInputConnection, m_activeConnection);
}

BMDVideoConnection CaptureDelegate::querySelectedConnection(void)
BMDVideoConnection CaptureDelegate::querySelectedConnection()
{
int64_t activeConnection;

Expand Down Expand Up @@ -396,12 +396,12 @@ HRESULT CaptureDelegate::VideoInputFormatChanged(UNUSED BMDVideoInputFormatChang
return S_OK;
}

ULONG CaptureDelegate::AddRef(void)
ULONG CaptureDelegate::AddRef()
{
return __sync_add_and_fetch(&m_refCount, 1);
}

ULONG CaptureDelegate::Release(void)
ULONG CaptureDelegate::Release()
{
int32_t newRefValue = __sync_sub_and_fetch(&m_refCount, 1);
if (newRefValue == 0)
Expand Down
38 changes: 19 additions & 19 deletions CaptureDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,37 @@ class CaptureDelegate : public IDeckLinkInputCallback
CaptureDelegate(IDeckLink* deckLink);

virtual HRESULT QueryInterface(UNUSED REFIID iid, UNUSED LPVOID *ppv) { return E_NOINTERFACE; }
virtual ULONG AddRef(void);
virtual ULONG Release(void);
virtual ULONG AddRef();
virtual ULONG Release();
virtual HRESULT VideoInputFormatChanged(BMDVideoInputFormatChangedEvents, IDeckLinkDisplayMode*, BMDDetectedVideoInputFormatFlags);
virtual HRESULT VideoInputFrameArrived(IDeckLinkVideoInputFrame*, IDeckLinkAudioInputPacket*);

virtual void Start(void);
virtual void Stop(void);
virtual void Start();
virtual void Stop();

virtual bool GetSignalDetected(void) { return m_hasSignal; }
virtual bool IsSubDevice(void) { return m_isSubDevice; }
virtual std::string GetDetectedMode(void) { return m_detectedMode; }
virtual BMDPixelFormat GetPixelFormat(void) { return m_pixelFormat; }
virtual BMDVideoConnection GetActiveConnection(void) { return m_activeConnection; }
virtual void SelectNextConnection(void);
virtual bool GetSignalDetected() { return m_hasSignal; }
virtual bool IsSubDevice() { return m_isSubDevice; }
virtual std::string GetDetectedMode() { return m_detectedMode; }
virtual BMDPixelFormat GetPixelFormat() { return m_pixelFormat; }
virtual BMDVideoConnection GetActiveConnection() { return m_activeConnection; }
virtual void SelectNextConnection();

virtual IDeckLinkVideoInputFrame* GetLastFrame(void) { return m_lastFrame; }
virtual IDeckLinkVideoInputFrame* GetLastFrame() { return m_lastFrame; }

private:
IDeckLinkDisplayMode* queryFirstDisplayMode(void);
IDeckLinkInput* queryInputInterface(void);
IDeckLinkDisplayMode* queryFirstDisplayMode();
IDeckLinkInput* queryInputInterface();
IDeckLinkConfiguration* queryConfigurationInterface(IDeckLink* deckLink);
IDeckLinkConfiguration* queryConfigurationInterface(void);
IDeckLinkConfiguration* queryConfigurationInterface();
IDeckLinkAttributes* queryAttributesInterface(IDeckLink* deckLink);
IDeckLinkAttributes* queryAttributesInterface(void);
int64_t queryInputConnections(void);
BMDVideoConnection querySelectedConnection(void);
IDeckLinkAttributes* queryAttributesInterface();
int64_t queryInputConnections();
BMDVideoConnection querySelectedConnection();

IDeckLink* queryDeckLinkInterfaceByPersistentId(int64_t pairedDeviceId);
int64_t getPairedDeviceId(void);
int64_t getPairedDeviceId();

void setDuplexToHalfDuplexModeIfSupported(void);
void setDuplexToHalfDuplexModeIfSupported();
void setDuplexToHalfDuplexModeIfSupported(IDeckLinkAttributes* m_deckLinkAttributes, IDeckLinkConfiguration* m_deckLinkConfiguration);

private:
Expand Down
24 changes: 14 additions & 10 deletions DeviceProber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,21 @@ DeviceProber::DeviceProber(IDeckLink* deckLink) :

m_canInput = queryCanInput();
m_canAutodetect = queryCanAutodetect();
LLOG(DEBUG) << "canInput = " << m_canInput << " && canAutodetect = " << m_canAutodetect;

LLOG(DEBUG) << "canInput = " << m_canInput
<< " && canAutodetect = " << m_canAutodetect;

/*
if (m_canAutodetect && m_canInput)
{
LLOG(DEBUG) << "creating CaptureDelegate";
m_captureDelegate = new CaptureDelegate(m_deckLink);
m_captureDelegate->Start();
}
*/
}

IDeckLinkAttributes* DeviceProber::queryAttributesInterface(void)
IDeckLinkAttributes* DeviceProber::queryAttributesInterface()
{
HRESULT result;
IDeckLinkAttributes* deckLinkAttributes = NULL;
Expand All @@ -56,7 +60,7 @@ IDeckLinkAttributes* DeviceProber::queryAttributesInterface(void)
return deckLinkAttributes;
}

bool DeviceProber::queryCanInput(void)
bool DeviceProber::queryCanInput()
{
HRESULT result;
IDeckLinkInput* deckLinkInput = NULL;
Expand All @@ -68,7 +72,7 @@ bool DeviceProber::queryCanInput(void)
return (result == S_OK);
}

bool DeviceProber::queryCanAutodetect(void)
bool DeviceProber::queryCanAutodetect()
{
HRESULT result;
IDeckLinkAttributes* deckLinkAttributes = NULL;
Expand All @@ -85,7 +89,7 @@ bool DeviceProber::queryCanAutodetect(void)
return formatDetectionSupported;
}

bool DeviceProber::GetSignalDetected(void) {
bool DeviceProber::GetSignalDetected() {
if (m_captureDelegate)
{
return m_captureDelegate->GetSignalDetected();
Expand All @@ -94,7 +98,7 @@ bool DeviceProber::GetSignalDetected(void) {
return false;
}

bool DeviceProber::IsSubDevice(void) {
bool DeviceProber::IsSubDevice() {
if (m_captureDelegate)
{
return m_captureDelegate->IsSubDevice();
Expand All @@ -103,7 +107,7 @@ bool DeviceProber::IsSubDevice(void) {
return false;
}

std::string DeviceProber::GetDetectedMode(void)
std::string DeviceProber::GetDetectedMode()
{
if (m_captureDelegate)
{
Expand All @@ -116,7 +120,7 @@ std::string DeviceProber::GetDetectedMode(void)
return "";
}

BMDPixelFormat DeviceProber::GetPixelFormat(void)
BMDPixelFormat DeviceProber::GetPixelFormat()
{
if (m_captureDelegate)
{
Expand All @@ -129,7 +133,7 @@ BMDPixelFormat DeviceProber::GetPixelFormat(void)
return 0;
}

IDeckLinkVideoInputFrame* DeviceProber::GetLastFrame(void)
IDeckLinkVideoInputFrame* DeviceProber::GetLastFrame()
{
if (m_captureDelegate)
{
Expand All @@ -139,7 +143,7 @@ IDeckLinkVideoInputFrame* DeviceProber::GetLastFrame(void)
return NULL;
}

BMDVideoConnection DeviceProber::GetActiveConnection(void)
BMDVideoConnection DeviceProber::GetActiveConnection()
{
if (m_captureDelegate)
{
Expand Down
19 changes: 9 additions & 10 deletions DeviceProber.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,19 @@ class DeviceProber
virtual bool CanInput() { return m_canInput; }

// proxy to CaptureDelegate
virtual bool GetSignalDetected(void);
virtual bool IsSubDevice();
virtual std::string GetDetectedMode(void);
virtual BMDPixelFormat GetPixelFormat(void);
virtual BMDVideoConnection GetActiveConnection(void);
virtual bool GetSignalDetected();
virtual std::string GetDetectedMode();
virtual BMDPixelFormat GetPixelFormat();
virtual BMDVideoConnection GetActiveConnection();

virtual void SelectNextConnection(void);
virtual void SelectNextConnection();

virtual IDeckLinkVideoInputFrame* GetLastFrame(void);
virtual IDeckLinkVideoInputFrame* GetLastFrame();

private:
bool queryCanAutodetect(void);
bool queryCanInput(void);
IDeckLinkAttributes* queryAttributesInterface(void);
bool queryCanAutodetect();
bool queryCanInput();
IDeckLinkAttributes* queryAttributesInterface();

private:
IDeckLink* m_deckLink;
Expand Down

0 comments on commit f33fab0

Please sign in to comment.