29 int main (
int argc,
const char ** argv)
37 int channelNumber (1);
38 int doMultiFormat (0);
47 {
"device",
'd',
POPT_ARG_STRING, &pDeviceSpec, 0,
"device to use",
"index#, serial#, or model" },
48 {
"channel",
'c',
POPT_ARG_INT, &channelNumber, 0,
"channel to use",
"1-8" },
50 {
"pixelFormat",
'p',
POPT_ARG_STRING, &pPixelFormat, 0,
"pixel format to use",
"'?' or 'list' to list" },
51 {
"frames", 0,
POPT_ARG_STRING, &pFramesSpec, 0,
"frames to AutoCirculate",
"num[@min] or min-max" },
52 {
"input",
'i',
POPT_ARG_STRING, &pInputSrcSpec, 0,
"which SDI input",
"1-8, ?=list" },
53 {
"anc", 0,
POPT_ARG_STRING, &pAncFilePath, 0,
"record anc to file",
"path/to/binary/data/file" },
61 {cerr <<
"## ERROR: " << popt.
errorStr() << endl;
return 2;}
63 {cerr <<
"## WARNING: ignored argument(s): '" <<
aja::join(popt.
otherArgs(),
"', '") <<
"'" << endl;
return 2;}
65 {cout << argv[0] <<
", NTV2 SDK " <<
::NTV2Version() << endl;
return 0;}
68 const string deviceSpec (pDeviceSpec ? pDeviceSpec :
"0");
72 if ((channelNumber < 1) || (channelNumber > 8))
73 {cerr <<
"## ERROR: Invalid channel number " << channelNumber <<
" -- expected 1 thru 8" << endl;
return 1;}
79 if (inputSourceStr ==
"?" || inputSourceStr ==
"list")
80 {cout << legalSources << endl;
return 0;}
81 if (!inputSourceStr.empty())
85 {cerr <<
"## ERROR: Input source '" << inputSourceStr <<
"' not one of:" << endl << legalSources << endl;
return 1;}
89 const string pixelFormatStr (pPixelFormat ? pPixelFormat :
"");
91 if (pixelFormatStr ==
"?" || pixelFormatStr ==
"list")
95 cerr <<
"## ERROR: Invalid '--pixelFormat' value '" << pixelFormatStr <<
"' -- expected values:" << endl
101 static const string legalFramesSpec (
"{frameCount}[@{firstFrameNum}] or {firstFrameNum}-{lastFrameNum}");
102 const string framesSpec (pFramesSpec ? pFramesSpec :
"");
103 if (!framesSpec.empty())
106 if (!parseResult.empty())
107 {cerr <<
"## ERROR: Bad 'frames' spec '" << framesSpec <<
"'\n## " << parseResult << endl;
return 1;}
110 {cerr <<
"## ERROR: Bad 'frames' spec '" << framesSpec <<
"'\n## Expected " << legalFramesSpec << endl;
return 1;}
113 string ancFilePath (pAncFilePath ? pAncFilePath :
"");
115 if (ancFilePath.empty() && pAncFilePath)
117 ostringstream fileName; fileName <<
"ntv2capture-" << deviceSpec <<
"-" 119 ancFilePath = fileName.str();
133 {cout <<
"## ERROR: Initialization failed: " <<
::AJAStatusToString(status) << endl;
return 1;}
144 cout <<
" Frames Frames Buffer" << endl
145 <<
" Captured Dropped Level" << endl;
148 ULWord framesProcessed, framesDropped, bufferLevel;
149 capturer.
GetACStatus (framesProcessed, framesDropped, bufferLevel);
150 cout << setw(9) << framesProcessed << setw(9) << framesDropped << setw(9) << bufferLevel <<
"\r" << flush;
int main(int argc, const char **argv)
Instances of me capture frames in real time from a video signal provided to an input of an AJA device...
Specifies SDI input/output kinds.
Declares the NTV2Capture class.
static void SignalHandler(int inSignal)
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())
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)
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They're also commonly use...
virtual AJAStatus Run(void)
Runs me.
bool fWithAudio
If true, also capture Audio.
virtual void GetACStatus(ULWord &outGoodFrames, ULWord &outDroppedFrames, ULWord &outBufferLevel)
Provides status information about my input (capture) process.
NTV2Channel fInputChannel
The device channel to use.
std::string NTV2Version(const bool inDetailed=false)
std::string fAncDataFilePath
Optional path to Anc binary data file.
This class is used to configure an NTV2Capture instance.
virtual const NTV2StringList & otherArgs(void) const
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
static bool gGlobalQuit((0))
Declares the AJAProcess class.
std::string & strip(std::string &str, const std::string &ws)
NTV2InputSource fInputSource
The device input connector to use.
#define NTV2_IS_VALID_INPUT_SOURCE(_inpSrc_)
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.
Private include file for all ajabase sources.
std::string AJAStatusToString(const AJAStatus inStatus, const bool inDetailed)
virtual AJAStatus Init(void)
Initializes me and prepares me to Run.
std::string join(const std::vector< std::string > &parts, const std::string &delim)
#define NTV2_IS_VALID_FRAME_BUFFER_FORMAT(__s__)
std::string NTV2ChannelToString(const NTV2Channel inValue, const bool inForRetailDisplay=false)
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.