13 #if defined (INCLUDE_AJACC) 19 #define NTV2_NUM_IMAGES (10) 22 #define FGFAIL(_expr_) AJA_sERROR (AJA_DebugUnit_Application, AJAFUNC << ": " << _expr_) 23 #define FGWARN(_expr_) AJA_sWARNING(AJA_DebugUnit_Application, AJAFUNC << ": " << _expr_) 24 #define FGDBG(_expr_) AJA_sDEBUG (AJA_DebugUnit_Application, AJAFUNC << ": " << _expr_) 25 #define FGNOTE(_expr_) AJA_sNOTICE (AJA_DebugUnit_Application, AJAFUNC << ": " << _expr_) 26 #define FGINFO(_expr_) AJA_sINFO (AJA_DebugUnit_Application, AJAFUNC << ": " << _expr_) 35 mbFixedReference (
false),
44 mFormatIsProgressive (
true),
47 mDoMultiChannel (
false)
66 if (inInputSource != mInputSource)
70 mInputSource = inInputSource;
80 if (inDeviceIndex != mBoardNumber)
83 mBoardNumber = inDeviceIndex;
93 const UWord result (mBoardNumber);
103 ULWord framesCaptured (0);
107 if (mNTV2Card.
Open(mBoardNumber))
132 currentImage.load (
":/resources/splash.png");
137 bool waitForInput =
false;
139 for (
UWord offset = 0; offset < numInputs; offset++)
163 if (!mDoMultiChannel)
173 if (mNTV2Card.
Open(mBoardNumber))
178 qDebug() <<
"Could not acquire board number " <<
GetDeviceIndex();
194 qDebug (
"Device not ready");
206 qDebug() <<
"## WARNING: Cannot acquire stream channel " << (int)(mStream);
222 buffers[i].GetByteCount(),
225 qDebug() <<
"## WARNING: Cannot DMA lock input buffer";
236 qDebug() <<
"## WARNING: Cannot add buffer to stream: " << bfrStatus.
mStatus;
244 qDebug() <<
"## WARNING: Stream start failed: " << bfrStatus.
mStatus;
257 qDebug() <<
"## WARNING: Open failed for device " <<
GetDeviceIndex ();
267 QImage currentImage (mFrameDimensions.
width (),
268 mFrameDimensions.
height (),
269 QImage::Format_RGB32);
270 currentImage.fill (qRgba (40, 40, 40, 255));
293 outString.append (
" ");
298 QImage img = QImage((uchar*)(buffers[index].GetHostAddress (0)),
299 mFrameDimensions.
width (),
300 mFrameDimensions.
height (),
301 QImage::Format_RGB32);
312 qDebug() <<
"## WARNING: Cannot add buffer to stream";
323 qDebug() <<
"## WARNING: stream wait failed";
334 if (!mDoMultiChannel)
356 bool validInput (
false);
372 switch (mCurrentVideoFormat)
386 mNTV2Card.
SetVideoFormat (mCurrentVideoFormat,
false,
false, mChannel);
392 qDebug() <<
"## DEBUG: mInputSource=" << mChannel <<
", mCurrentVideoFormat=" << vfString <<
", width=" << mFrameDimensions.
width() <<
", height=" << mFrameDimensions.
height();
395 if (!mbFixedReference)
417 if (!mbFixedReference)
478 mCurrentVideoFormat = videoFormat;
481 else if ((mCurrentVideoFormat != videoFormat) ||
482 (mCurrentColorSpace != colorSpace))
484 if (mDebounceCounter == 0)
487 mLastVideoFormat = videoFormat;
490 else if (mDebounceCounter == 6)
494 mCurrentVideoFormat = videoFormat;
495 mDebounceCounter = 0;
499 if (mLastVideoFormat == videoFormat)
502 mDebounceCounter = 0;
519 switch (mInputSource)
NTV2Channel NTV2InputSourceToChannel(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2Channel value.
virtual bool ReleaseStreamForApplicationWithReference(ULWord inApplicationType, int32_t inProcessID)
A reference-counted version of CNTV2DriverInterface::ReleaseStreamForApplication useful for process g...
virtual ULWord StreamChannelInitialize(const NTV2Channel inChannel)
Initialize a stream. Put the stream queue and hardware in a known good state ready for use...
virtual bool SetTaskMode(const NTV2TaskMode inMode)
Sets the device's task mode.
virtual ULWord StreamBufferQueue(const NTV2Channel inChannel, NTV2Buffer &inBuffer, ULWord64 bufferCookie, NTV2StreamBuffer &status)
Queue a buffer to the stream. The bufferCookie is a user defined identifier of the buffer used by the...
virtual bool GetSDITransmitEnable(const NTV2Channel inChannel, bool &outEnabled)
Answers whether or not the specified SDI connector is currently acting as a transmitter (i...
bool Allocate(const size_t inByteCount, const bool inPageAligned=false)
Allocates (or re-allocates) my user-space storage using the given byte count. I assume full responsib...
Header file for the NTV2StreamGrabber class.
Specifies the device's internal clock.
virtual bool SetReference(const NTV2ReferenceSource inRefSource, const bool inKeepFramePulseSelect=(0))
Sets the device's clock reference source. See Video Output Clocking & Synchronization for more inform...
This identifies the invalid (unspecified, uninitialized) VANC mode.
virtual ULWord StreamChannelRelease(const NTV2Channel inChannel)
Release a stream. Releases all buffers remaining in the queue.
virtual bool SetVideoFormat(const NTV2VideoFormat inVideoFormat, const bool inIsAJARetail=(!(0)), const bool inKeepVancSettings=(0), const NTV2Channel inChannel=NTV2_CHANNEL1)
Configures the AJA device to handle a specific video format.
NTV2LHIHDMIColorSpace GetColorSpaceFromInputSource(void)
virtual bool IsDeviceReady(const bool inCheckValid=(0))
enum _NTV2VideoFormat NTV2VideoFormat
Identifies a particular video format.
bool IsInput3Gb(const NTV2InputSource inputSource)
Declares the AJAAncillaryData_Cea608_line21 class.
bool NTV2DeviceCanDoMultiFormat(const NTV2DeviceID inDeviceID)
bool CheckForValidInput(void)
Capture (input) mode, which writes into device SDRAM.
virtual bool Close(void)
Closes me, releasing host resources that may have been allocated in a previous Open call...
virtual bool GetSDIInput3GbPresent(bool &outValue, const NTV2Channel channel)
virtual bool Open(const UWord inDeviceIndex)
Opens a local/physical AJA device so it can be monitored/controlled.
UWord NTV2DeviceGetNumCSCs(const NTV2DeviceID inDeviceID)
virtual bool SetFrameBufferFormat(NTV2Channel inChannel, NTV2FrameBufferFormat inNewFormat, bool inIsAJARetail=(!(0)), NTV2HDRXferChars inXferChars=NTV2_VPID_TC_SDR_TV, NTV2HDRColorimetry inColorimetry=NTV2_VPID_Color_Rec709, NTV2HDRLuminance inLuminance=NTV2_VPID_Luminance_YCbCr)
Sets the frame buffer format for the given FrameStore on the AJA device.
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They're also commonly use...
void newFrame(const QImage &inImage, const bool inClear)
This is signaled (called) when a new frame has been captured and is available for display...
virtual bool SetMultiFormatMode(const bool inEnable)
Enables or disables multi-format (per channel) device operation. If enabled, each device channel can ...
virtual bool GetHDMIInputColor(NTV2LHIHDMIColorSpace &outValue, const NTV2Channel inHDMIInput=NTV2_CHANNEL1)
Answers with the current colorspace for the given HDMI input.
bool IsProgressivePicture(const NTV2VideoFormat format)
#define NTV2_ASSERT(_expr_)
ULWord height(void) const
virtual bool GetTaskMode(NTV2TaskMode &outMode)
Retrieves the device's current task mode.
std::string NTV2InputSourceToString(const NTV2InputSource inValue, const bool inForRetailDisplay=false)
NTV2OutputXptID GetInputSourceOutputXpt(const NTV2InputSource inInputSource, const bool inIsSDI_DS2=false, const bool inIsHDMI_RGB=false, const UWord inHDMI_Quadrant=0)
bool Deallocate(void)
Deallocates my user-space storage (if I own it – i.e. from a prior call to Allocate).
#define STREAMPREVIEW_WIDGET_Y
virtual bool SetMode(const NTV2Channel inChannel, const NTV2Mode inNewValue, const bool inIsRetail=(!(0)))
Determines if a given FrameStore on the AJA device will be used to capture or playout video...
virtual bool IsOpen(void) const
virtual bool SetSDITransmitEnable(const NTV2Channel inChannel, const bool inEnable)
Sets the specified bidirectional SDI connector to act as an input or an output.
#define NTV2_INPUT_SOURCE_IS_HDMI(_inpSrc_)
NTV2VideoFormat GetVideoFormatFromInputSource(void)
NTV2Crosspoint NTV2InputSourceToChannelSpec(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2Crosspoint value.
virtual bool DMABufferLock(const NTV2Buffer &inBuffer, bool inMap=(0), bool inRDMA=(0))
Page-locks the given host buffer to reduce transfer time and CPU usage of DMA transfers.
virtual bool GetVANCMode(NTV2VANCMode &outVancMode, const NTV2Channel inChannel=NTV2_CHANNEL1)
Retrieves the current VANC mode for the given FrameStore.
virtual std::string GetDisplayName(void)
Answers with this device's display name.
NTV2InputXptID GetCSCInputXptFromChannel(const NTV2Channel inCSC, const bool inIsKeyInput=false)
virtual ULWord StreamBufferRelease(const NTV2Channel inChannel, NTV2StreamBuffer &status)
Remove the oldest buffer released by the streaming engine from the buffer queue.
virtual NTV2VideoFormat GetInputVideoFormat(const NTV2InputSource inVideoSource=NTV2_INPUTSOURCE_SDI1, const bool inIsProgressive=(0))
Returns the video format of the signal that is present on the given input source. ...
2: OEM (recommended): device configured by client application(s) with some driver involvement...
virtual ULWord StreamChannelStart(const NTV2Channel inChannel, NTV2StreamChannel &status)
Start a stream. Put the stream is the active state to start processing queued buffers. For frame based video, the stream will start with the current buffer on the next frame sync.
virtual ~NTV2StreamGrabber()
My destructor.
NTV2InputXptID GetFrameStoreInputXptFromChannel(const NTV2Channel inFrameStore, const bool inIsBInput=false)
std::string NTV2VideoFormatToString(const NTV2VideoFormat inValue, const bool inUseFrameRate=false)
bool NTV2DeviceHasBiDirectionalSDI(const NTV2DeviceID inDeviceID)
bool SetupInput(void)
Configures my AJA device for capture.
See 8-Bit ARGB, RGBA, ABGR Formats.
virtual bool AcquireStreamForApplicationWithReference(ULWord inApplicationType, int32_t inProcessID)
A reference-counted version of CNTV2DriverInterface::AcquireStreamForApplication useful for process g...
virtual bool DMABufferUnlockAll()
Unlocks all previously-locked buffers used for DMA transfers.
#define STREAMPREVIEW_WIDGET_X
Specifies channel or FrameStore 2 (or the 2nd item).
virtual NTV2DeviceID GetDeviceID(void)
UWord NTV2DeviceGetNumVideoInputs(const NTV2DeviceID inDeviceID)
Declares the CNTV2DeviceScanner class.
Describes a user-space buffer on the host computer. I have an address and a length, plus some optional attributes (allocated by SDK?, page-aligned? etc.).
virtual bool Connect(const NTV2InputCrosspointID inInputXpt, const NTV2OutputCrosspointID inOutputXpt, const bool inValidate=(0))
Connects the given widget signal input (sink) to the given widget signal output (source).
NTV2InputSource
Identifies a specific video input source.
void SetDeviceIndex(const UWord inDeviceIndex)
Sets the AJA device to be used for capture.
virtual ULWord StreamChannelWait(const NTV2Channel inChannel, NTV2StreamChannel &status)
Wait for any stream event. Returns for any state or buffer change.
void StopStream(void)
Stops capturing.
virtual void run(void)
My thread function.
#define NTV2_IS_VALID_INPUT_SOURCE(_inpSrc_)
static const ULWord kDemoAppSignature((((uint32_t)( 'D'))<< 24)|(((uint32_t)( 'E'))<< 16)|(((uint32_t)( 'M'))<< 8)|(((uint32_t)( 'O'))<< 0))
Declares numerous NTV2 utility functions.
Specifies channel or FrameStore 1 (or the first item).
void newStatusString(const QString &inStatus)
This is signaled (called) when my status string changes.
NTV2VANCMode
These enum values identify the available VANC modes.
virtual bool SetSDIInLevelBtoLevelAConversion(const NTV2ChannelSet &inSDIInputs, const bool inEnable)
Enables or disables 3G level B to 3G level A conversion at the SDI input(s).
#define NTV2_STREAM_STATUS_SUCCESS
Used in NTV2Stream success.
ULWord mStatus
Action status.
This file contains some structures, constants, classes and functions that are used in some of the dem...
#define NTV2_IS_VALID_VIDEO_FORMAT(__f__)
UWord GetDeviceIndex(void) const
NTV2OutputXptID GetSDIInputOutputXptFromChannel(const NTV2Channel inSDIInput, const bool inIsDS2=false)
#define NTV2_INPUT_SOURCE_IS_SDI(_inpSrc_)
Declares the AJAAncillaryList class.
void * GetHostAddress(const ULWord inByteOffset, const bool inFromEnd=false) const
NTV2FrameSize & set(const ULWord inWidth, const ULWord inHeight)
Sets my dimension values.
void SetInputSource(const NTV2InputSource inInputSource)
Sets the input to be used for capture on the AJA device being used.
ULWord64 mBufferCookie
Buffer User cookie.
Declares device capability functions.
NTV2OutputXptID GetCSCOutputXptFromChannel(const NTV2Channel inCSC, const bool inIsKey=false, const bool inIsRGB=false)
NTV2ReferenceSource NTV2InputSourceToReferenceSource(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2ReferenceSource value.
NTV2StreamGrabber(QObject *pInParentObject=NULL)
Constructs me.
virtual bool EnableChannel(const NTV2Channel inChannel)
Enables the given FrameStore.