28 int main (
int argc,
const char ** argv)
35 uint32_t channelNumber (1);
36 int doMultiFormat (0);
38 int doRecordAudio (0);
39 int doRecordDolby (0);
40 int doAudioFilter (0);
49 {
"device",
'd',
POPT_ARG_STRING, &pDeviceSpec, 0,
"device to use",
"index#, serial#, or model" },
50 {
"channel",
'c',
POPT_ARG_INT, &channelNumber, 0,
"channel to use",
"1-8" },
52 {
"pixelFormat",
'p',
POPT_ARG_STRING, &pPixelFormat, 0,
"pixel format to use",
"'?' or 'list' to list" },
53 {
"frames", 0,
POPT_ARG_STRING, &pFramesSpec, 0,
"frames to AutoCirculate",
"num[@min] or min-max" },
54 {
"input",
'i',
POPT_ARG_STRING, &pInputSrcSpec, 0,
"which HDMI input",
"?=list" },
66 {cerr <<
"## ERROR: " << popt.
errorStr() << endl;
return 2;}
68 {cout << argv[0] <<
", NTV2 SDK " <<
::NTV2Version() << endl;
return 0;}
71 const string deviceSpec (pDeviceSpec ? pDeviceSpec :
"0");
78 if ((channelNumber < 1) || (channelNumber > 8))
79 {cerr <<
"## ERROR: Invalid channel number " << channelNumber <<
" -- expected 1 thru 8" << endl;
return 1;}
85 if (inputSourceStr ==
"?" || inputSourceStr ==
"list")
86 {cout << legalSources << endl;
return 0;}
87 if (!inputSourceStr.empty())
91 {cerr <<
"## ERROR: Input source '" << inputSourceStr <<
"' not one of:" << endl << legalSources << endl;
return 1;}
95 const string pixelFormatStr (pPixelFormat ? pPixelFormat :
"");
97 if (pixelFormatStr ==
"?" || pixelFormatStr ==
"list")
101 cerr <<
"## ERROR: Invalid '--pixelFormat' value '" << pixelFormatStr <<
"' -- expected values:" << endl
107 static const string legalFramesSpec(
"{frameCount}[@{firstFrameNum}] or {firstFrameNum}-{lastFrameNum}");
108 const string framesSpec (pFramesSpec ? pFramesSpec :
"");
109 if (!framesSpec.empty())
112 if (!parseResult.empty())
113 {cerr <<
"## ERROR: Bad 'frames' spec '" << framesSpec <<
"'\n## " << parseResult << endl;
return 1;}
116 {cerr <<
"## ERROR: Bad 'frames' spec '" << framesSpec <<
"'\n## Expected " << legalFramesSpec << endl;
return 1;}
121 ostringstream fileName; fileName <<
"ntv2dolbycapture-" << deviceSpec <<
"-" 129 ostringstream fileName; fileName <<
"ntv2dolbycapture-" << deviceSpec <<
"-" 137 ostringstream fileName; fileName <<
"ntv2dolbycapture-" << deviceSpec <<
"-" 150 status = capturer.
Init();
152 {cout <<
"## ERROR: Initialization failed: " <<
::AJAStatusToString(status) << endl;
return 1;}
163 cout <<
" Frames Frames Buffer" << endl
164 <<
" Captured Dropped Level" << endl;
167 ULWord framesProcessed, framesDropped, bufferLevel;
168 capturer.
GetACStatus (framesProcessed, framesDropped, bufferLevel);
169 cout << setw(9) << framesProcessed << setw(9) << framesDropped << setw(9) << bufferLevel <<
"\r" << flush;
int main(int argc, const char **argv)
bool fDoMultiFormat
If true, use multi-format/multi-channel mode, if device supports it; otherwise normal mode...
static AJAStatus Open(bool incrementRefCount=false)
#define AJA_FAILURE(_status_)
static std::string GetInputSourceStrings(const NTV2IOKinds inKinds=NTV2_IOKINDS_ALL, const std::string inDevSpec=std::string())
Specifies HDMI input/output kinds.
static std::string GetPixelFormatStrings(const NTV2PixelFormatKinds inKinds=PIXEL_FORMATS_ALL, const std::string inDevSpec=std::string())
bool fWithAnc
If true, also capture Anc.
std::string setFromString(const std::string &inStr)
void SignalHandler(int inSignal)
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They're also commonly use...
bool fDoFrameStats
if true, output per frame statistics
bool fWithAudio
If true, also capture Audio.
NTV2Channel fInputChannel
The device channel to use.
std::string NTV2Version(const bool inDetailed=false)
std::string fAncDataFilePath
Optional path to Anc binary data file.
static void Sleep(const int32_t inMilliseconds)
Suspends execution of the current thread for a given number of milliseconds.
static std::string ToLower(const std::string &inStr)
Returns the given string after converting it to lower case.
virtual const std::string & errorStr(void) const
bool fDoAudioFilter
If true, capture only audio anc.
std::string fDolbyDataFilePath
Optional path to Dolby binary data file.
Declares the AJAProcess class.
virtual AJAStatus Run(void)
Runs me.
NTV2InputSource fInputSource
The device input connector to use.
virtual AJAStatus Init(void)
Initializes me and prepares me to Run.
#define NTV2_IS_VALID_INPUT_SOURCE(_inpSrc_)
Declares the NTV2DolbyCapture class.
I capture HDMI Dolby audio from an HDMI input of an AJA device.
static NTV2InputSource GetInputSourceFromString(const std::string &inStr, const NTV2IOKinds inKinds=NTV2_IOKINDS_ALL, const std::string inDevSpec=std::string())
Returns the NTV2InputSource that matches the given string.
NTV2ACFrameRange fFrames
AutoCirculate frame count or range.
NTV2PixelFormat fPixelFormat
Pixel format to use.
static bool IsValidDevice(const std::string &inDeviceSpec)
std::string AJAStatusToString(const AJAStatus inStatus, const bool inDetailed)
virtual void GetACStatus(ULWord &outGoodFrames, ULWord &outDroppedFrames, ULWord &outBufferLevel)
Provides status information about my input (capture) process.
#define NTV2_IS_VALID_FRAME_BUFFER_FORMAT(__s__)
std::string NTV2ChannelToString(const NTV2Channel inValue, const bool inForRetailDisplay=false)
This class is used to configure an NTV2Capture instance.
std::string fAudioDataFilePath
Optional path to Audio binary data file.
static NTV2PixelFormat GetPixelFormatFromString(const std::string &inStr, const NTV2PixelFormatKinds inKinds=PIXEL_FORMATS_ALL, const std::string inDevSpec=std::string())
Returns the NTV2PixelFormat that matches the given string.
static bool gGlobalQuit((0))