10 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) 29 : QDialog (parent, flags)
31 if (objectName().isEmpty())
32 setObjectName(QString::fromUtf8(
"Dialog"));
34 mBoardChoiceCombo =
new QComboBox;
35 for (
ULWord ndx(0); ndx < 100; ndx++)
41 {mBoardChoiceCombo->addItem(
"No Devices Found");
break;}
45 mBoardChoiceCombo->setCurrentIndex (0);
48 mInputButtonGroup =
new QButtonGroup ();
50 for (
unsigned ndx (0); ndx < 8; ndx++)
52 for (
unsigned ndx (0); ndx < 4; ndx++)
58 mCheckFixedReference =
new QCheckBox (
"Fixed Reference",
this);
65 mStreamGrabber->
SetDeviceIndex (mBoardChoiceCombo->currentIndex ());
68 QVBoxLayout * layout (
new QVBoxLayout);
69 layout->addWidget (mBoardChoiceCombo);
70 layout->addWidget (mVideoPreviewWidget);
72 for (
QButtonIterator iter (mInputButtonGroup->buttons()); iter.hasNext (); )
73 layout->addWidget (iter.next());
74 layout->addWidget (mCheckFixedReference);
76 layout->addStretch (1);
79 QObject::connect (mBoardChoiceCombo, SIGNAL (currentIndexChanged (
int)),
this, SLOT (RequestDeviceChange (
const int)));
80 QObject::connect (mInputButtonGroup, SIGNAL (buttonReleased (
int)),
this, SLOT (inputChanged (
int)));
81 QObject::connect (mCheckFixedReference, SIGNAL (toggled (
bool)),
this, SLOT (fixedRefChanged (
bool)));
82 connect (mStreamGrabber, SIGNAL (newFrame (
const QImage &,
bool)), mVideoPreviewWidget, SLOT (updateFrame (
const QImage &,
bool)));
83 connect (mStreamGrabber, SIGNAL (newStatusString (
const QString)), mVideoPreviewWidget, SLOT (updateStatusString (
const QString)));
86 mStreamGrabber->start ();
87 mTimerID = startTimer (100);
97 delete mStreamGrabber;
102 void NTV2StreamPreview::RequestDeviceChange (
const int inDeviceIndexNum)
107 qDebug (
"## NOTE: Device changed to %d", inDeviceIndexNum);
112 void NTV2StreamPreview::inputChanged (
int inputRadioButtonId)
114 const NTV2InputSource chosenInputSource (static_cast <NTV2InputSource> (inputRadioButtonId));
122 qDebug (
"## DEBUG: NTV2StreamPreview::inputChanged: off");
132 void NTV2StreamPreview::fixedRefChanged (
bool checked)
139 void NTV2StreamPreview::updateInputs (
void)
141 CNTV2Card ntv2Card (mBoardChoiceCombo->currentIndex());
142 if (ntv2Card.IsOpen())
144 for (
QButtonIterator iter (mInputButtonGroup->buttons()); iter.hasNext(); )
146 QRadioButton * pButton (reinterpret_cast<QRadioButton*>(iter.next()));
150 const bool hasInputSource (ntv2Card.features().CanDoInputSource(inputSource));
151 const string videoFormatStr (hasInputSource ? ::
NTV2VideoFormatToString(ntv2Card.GetInputVideoFormat(inputSource)) :
"");
152 const QString buttonLabel (QString(
"%1 %2").arg(::
NTV2InputSourceToString(inputSource,
true).c_str(), videoFormatStr.empty() ?
"No Detected Input" : videoFormatStr.c_str()));
153 pButton->setText (buttonLabel);
154 pButton->setEnabled (hasInputSource);
162 void NTV2StreamPreview::timerEvent (QTimerEvent * event)
164 if (event->timerId() == mTimerID)
167 QWidget::timerEvent(event);
172 void NTV2StreamPreview::devicesChanged (
void)
174 qDebug () << QString (
"devicesChanged");
178 mBoardChoiceCombo->clear ();
179 for (
ULWord ndx (0); ndx < 100; ndx++)
183 mBoardChoiceCombo->addItem (tr (device.
GetDisplayName ().c_str ()));
185 {mBoardChoiceCombo->addItem (tr (
"No Devices Found"));
break;}
189 mBoardChoiceCombo->setCurrentIndex (0);
194 void NTV2StreamPreview::PnpCallback (
AJAPnpMessage inMessage,
void * pUserData)
200 NTV2StreamPreview * pMainWindow (reinterpret_cast <NTV2StreamPreview *>(pUserData));
201 pMainWindow->devicesChanged ();
NTV2StreamPreview(QWidget *parent=NULL, Qt::WindowFlags flags=Qt::WindowFlags())
Specifies SDI input/output kinds.
Declares common types used in the ajabase library.
I interrogate and control an AJA video/audio capture/playout device.
virtual AJAStatus Uninstall()
Uninstalls any previously-installed callback notifier.
Specifies HDMI input/output kinds.
QListIterator< QAbstractButton * > QButtonIterator
virtual class DeviceCapabilities & features(void)
bool CanDoInputSource(const NTV2InputSource inSrc)
std::string NTV2InputSourceToString(const NTV2InputSource inValue, const bool inForRetailDisplay=false)
#define STREAMPREVIEW_WIDGET_Y
Specifies analog input/output kinds.
virtual std::string GetDisplayName(void)
Answers with this device's display name.
NTV2InputSource GetNTV2InputSourceForIndex(const ULWord inIndex0, const NTV2IOKinds inKinds=NTV2_IOKINDS_SDI)
std::string NTV2VideoFormatToString(const NTV2VideoFormat inValue, const bool inUseFrameRate=false)
Header file for NTV2StreamPreview demo application. Demonstrates how to capture audio/video from NTV2...
#define STREAMPREVIEW_WIDGET_X
static bool GetDeviceAtIndex(const ULWord inDeviceIndexNumber, CNTV2Card &outDevice)
Rescans the host, and returns an open CNTV2Card instance for the AJA device having the given zero-bas...
NTV2InputSource
Identifies a specific video input source.
void SetDeviceIndex(const UWord inDeviceIndex)
Sets the AJA device to be used for capture.
#define NTV2_IS_VALID_INPUT_SOURCE(_inpSrc_)
Declares numerous NTV2 utility functions.
void SetFixedReference(bool fixed)
QListIterator< QAbstractButton * > QButtonIterator
I am a QDialog that displays whatever video is present on the SDI inputs of an AJA streaming device...
virtual AJAStatus Install(AJAPnpCallback pInCallback, void *inRefCon=NULL, uint32_t inDeviceMask=0xFFFFFFFF)
Installs the given plug & play notification callback function, replacing any callback function that m...
Identifies the 1st SDI video input.
void SetInputSource(const NTV2InputSource inInputSource)
Sets the input to be used for capture on the AJA device being used.
Declares device capability functions.
A QThread that captures audio/video from NTV2-compatible AJA devices and uses Qt signals to emit ARGB...