|
AJA NTV2 SDK
17.1.3.1410
NTV2 SDK 17.1.3.1410
|
Go to the documentation of this file.
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 {cout << argv[0] <<
", NTV2 SDK " <<
::NTV2Version() << endl;
return 0;}
66 const string deviceSpec (pDeviceSpec ? pDeviceSpec :
"0");
73 if ((channelNumber < 1) || (channelNumber > 8))
74 {cerr <<
"## ERROR: Invalid channel number " << channelNumber <<
" -- expected 1 thru 8" << endl;
return 1;}
80 if (inputSourceStr ==
"?" || inputSourceStr ==
"list")
81 {cout << legalSources << endl;
return 0;}
82 if (!inputSourceStr.empty())
86 {cerr <<
"## ERROR: Input source '" << inputSourceStr <<
"' not one of:" << endl << legalSources << endl;
return 1;}
90 const string pixelFormatStr (pPixelFormat ? pPixelFormat :
"");
92 if (pixelFormatStr ==
"?" || pixelFormatStr ==
"list")
96 cerr <<
"## ERROR: Invalid '--pixelFormat' value '" << pixelFormatStr <<
"' -- expected values:" << endl
102 static const string legalFramesSpec (
"{frameCount}[@{firstFrameNum}] or {firstFrameNum}-{lastFrameNum}");
103 const string framesSpec (pFramesSpec ? pFramesSpec :
"");
104 if (!framesSpec.empty())
107 if (!parseResult.empty())
108 {cerr <<
"## ERROR: Bad 'frames' spec '" << framesSpec <<
"'\n## " << parseResult << endl;
return 1;}
111 {cerr <<
"## ERROR: Bad 'frames' spec '" << framesSpec <<
"'\n## Expected " << legalFramesSpec << endl;
return 1;}
114 string ancFilePath (pAncFilePath ? pAncFilePath :
"");
116 if (ancFilePath.empty() && pAncFilePath)
118 ostringstream fileName; fileName <<
"ntv2capture-" << deviceSpec <<
"-"
120 ancFilePath = fileName.str();
134 {cout <<
"## ERROR: Initialization failed: " <<
::AJAStatusToString(status) << endl;
return 1;}
145 cout <<
" Frames Frames Buffer" << endl
146 <<
" Captured Dropped Level" << endl;
149 ULWord framesProcessed, framesDropped, bufferLevel;
150 capturer.
GetACStatus (framesProcessed, framesDropped, bufferLevel);
151 cout << setw(9) << framesProcessed << setw(9) << framesDropped << setw(9) << bufferLevel <<
"\r" << flush;
bool fDoMultiFormat
If true, use multi-format/multi-channel mode, if device supports it; otherwise normal mode.
Declares the NTV2Capture class.
static NTV2InputSource GetInputSourceFromString(const std::string &inStr)
Returns the NTV2InputSource that matches the given string.
std::string & strip(std::string &str, const std::string &ws)
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They're also commonly use...
Instances of me capture frames in real time from a video signal provided to an input of an AJA device...
NTV2PixelFormat fPixelFormat
Pixel format to use.
std::string fAncDataFilePath
Optional path to Anc binary data file.
int main(int argc, const char **argv)
std::string setFromString(const std::string &inStr)
bool fWithAnc
If true, also capture Anc.
static bool IsValidDevice(const std::string &inDeviceSpec)
Declares the AJAProcess class.
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.
This class is used to configure an NTV2Capture instance.
static NTV2FrameBufferFormat GetPixelFormatFromString(const std::string &inStr)
Returns the NTV2FrameBufferFormat that matches the given string.
#define NTV2_IS_VALID_INPUT_SOURCE(_inpSrc_)
@ NTV2_FBF_8BIT_YCBCR
See 8-Bit YCbCr Format.
virtual const std::string & errorStr(void) const
std::string NTV2Version(const bool inDetailed=false)
virtual AJAStatus Run(void)
Runs me.
static AJAStatus Open(bool incrementRefCount=false)
NTV2ACFrameRange fFrames
AutoCirculate frame count or range.
NTV2Channel fInputChannel
The device channel to use.
Private include file for all ajabase sources.
static std::string GetInputSourceStrings(const NTV2IOKinds inKinds=NTV2_IOKINDS_ALL, const std::string inDeviceSpecifier=std::string())
virtual void GetACStatus(ULWord &outGoodFrames, ULWord &outDroppedFrames, ULWord &outBufferLevel)
Provides status information about my input (capture) process.
std::string AJAStatusToString(const AJAStatus inStatus, const bool inDetailed)
static bool gGlobalQuit((0))
static std::string GetPixelFormatStrings(const NTV2PixelFormatKinds inKinds=PIXEL_FORMATS_ALL, const std::string inDeviceSpecifier=std::string())
std::string NTV2ChannelToString(const NTV2Channel inValue, const bool inForRetailDisplay=false)
@ NTV2_IOKINDS_SDI
Specifies SDI input/output kinds.
#define NTV2_IS_VALID_FRAME_BUFFER_FORMAT(__s__)
#define AJA_FAILURE(_status_)
static void SignalHandler(int inSignal)
NTV2InputSource fInputSource
The device input connector to use.
bool fWithAudio
If true, also capture Audio.
virtual AJAStatus Init(void)
Initializes me and prepares me to Run.