|
AJA NTV2 SDK
17.0.1.1246
NTV2 SDK 17.0.1.1246
|
Go to the documentation of this file.
35 int main (
int argc,
const char ** argv)
43 int doRecordAudio (0);
44 int doRecordDolby (0);
45 uint32_t channelNumber (1);
46 int doAudioFilter (0);
48 int doMultiFormat (0);
54 #if !defined(NTV2_DEPRECATE_16_0) // --board option is deprecated!
55 {
"board",
'b',
POPT_ARG_STRING, &pDeviceSpec, 0,
"device to use",
"(deprecated)" },
57 {
"device",
'd',
POPT_ARG_STRING, &pDeviceSpec, 0,
"device to use",
"index#, serial#, or model" },
58 {
"input",
'i',
POPT_ARG_STRING, &pInputSrcSpec, 0,
"which HDMI input",
"?=list" },
59 {
"pixelFormat",
'p',
POPT_ARG_STRING, &pPixelFormat, 0,
"pixel format to use",
"'?' or 'list' to list" },
60 {
"frames", 0,
POPT_ARG_STRING, &pFramesSpec, 0,
"frames to AutoCirculate",
"num[@min] or min-max" },
66 {
"channel",
'c',
POPT_ARG_INT, &channelNumber, 0,
"channel to use",
"1-8" },
73 {cerr <<
"## ERROR: " << popt.
errorStr() << endl;
return 2;}
75 const string deviceSpec (pDeviceSpec ? pDeviceSpec :
"0");
77 const string pixelFormatStr (pPixelFormat ? pPixelFormat :
"");
78 const string framesSpec (pFramesSpec ? pFramesSpec :
"");
79 string recordAncFile (
"disabled");
80 string recordAudioFile (
"disabled");
81 string recordDolbyFile (
"disabled");
85 if (deviceSpec ==
"?" || deviceSpec ==
"list")
86 {cout << legalDevices << endl;
return 0;}
88 {cout <<
"## ERROR: No such device '" << deviceSpec <<
"'" << endl << legalDevices;
return 1;}
93 if ((channelNumber < 1) || (channelNumber > 8))
94 {cerr <<
"## ERROR: Invalid channel number " << channelNumber <<
" -- expected 1 thru 8" << endl;
return 1;}
99 if (inputSourceStr ==
"?" || inputSourceStr ==
"list")
100 {cout << legalSources << endl;
return 0;}
101 if (!inputSourceStr.empty())
105 {cerr <<
"## ERROR: Input source '" << inputSourceStr <<
"' not one of:" << endl << legalSources << endl;
return 1;}
110 if (pixelFormatStr ==
"?" || pixelFormatStr ==
"list")
114 cerr <<
"## ERROR: Invalid '--pixelFormat' value '" << pixelFormatStr <<
"' -- expected values:" << endl
120 static const string legalFramesSpec(
"{frameCount}[@{firstFrameNum}] or {firstFrameNum}-{lastFrameNum}");
121 if (!framesSpec.empty())
124 if (!parseResult.empty())
125 {cerr <<
"## ERROR: Bad 'frames' spec '" << framesSpec <<
"'\n## " << parseResult << endl;
return 1;}
128 {cerr <<
"## ERROR: Bad 'frames' spec '" << framesSpec <<
"'\n## Expected " << legalFramesSpec << endl;
return 1;}
133 ostringstream fileName; fileName <<
"ntv2dolbycapture-" << deviceSpec <<
"-"
135 recordAncFile = fileName.str();
141 ostringstream fileName; fileName <<
"ntv2dolbycapture-" << deviceSpec <<
"-"
143 recordAudioFile = fileName.str();
149 ostringstream fileName; fileName <<
"ntv2dolbycapture-" << deviceSpec <<
"-"
151 recordDolbyFile = fileName.str();
177 status = capturer.
Init();
179 {cout <<
"## ERROR: Capture initialization failed with status " << status << endl;
return 1;}
184 cout <<
" Capture Capture" << endl
185 <<
" Frames Frames Buffer" << endl
186 <<
"Processed Dropped Level" << endl;
190 ULWord framesProcessed, framesDropped, bufferLevel;
191 capturer.
GetACStatus (framesProcessed, framesDropped, bufferLevel);
192 cout << setw(9) << framesProcessed << setw(9) << framesDropped << setw(9) << bufferLevel <<
"\r" << flush;
Declares the NTV2DolbyCapture class.
static NTV2InputSource GetInputSourceFromString(const std::string &inStr)
Returns the NTV2InputSource that matches the given string.
bool fDoAudioFilter
If true, capture only audio anc.
std::string fDeviceSpec
The AJA device to use.
std::string fDolbyDataFilePath
Optional path to Dolby binary data file.
NTV2Channel
These enum values are mostly used to identify a specific Frame Store. They're also commonly used to i...
virtual void GetACStatus(ULWord &outGoodFrames, ULWord &outDroppedFrames, ULWord &outBufferLevel)
Provides status information about my input (capture) process.
virtual AJAStatus Init(void)
Initializes me and prepares me to Run.
Declares the AJATime class.
void SignalHandler(int inSignal)
bool fDoFrameData
if true, output per frame statistics
NTV2Channel fInputChannel
The device channel to use.
This class is used to configure an NTV2Capture instance.
NTV2InputSource fInputSource
The device input connector to use.
@ NTV2_IOKINDS_HDMI
Specifies HDMI input/output kinds.
bool fDoMultiFormat
If true, use multi-format/multi-channel mode, if device supports it; otherwise normal mode.
NTV2FrameBufferFormat
Identifies a particular video frame buffer format. See Device Frame Buffer Formats for details.
int main(int argc, const char **argv)
std::string setFromString(const std::string &inStr)
Declares the most fundamental data types used by NTV2. Since Windows NT was the first principal devel...
static std::string GetDeviceStrings(const NTV2DeviceKinds inKinds=NTV2_DEVICEKIND_ALL)
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.
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.
Declares numerous NTV2 utility functions.
virtual const std::string & errorStr(void) const
#define AJA_SUCCESS(_status_)
bool fWithAnc
If true, also capture Anc.
static AJAStatus Open(bool incrementRefCount=false)
CNTV2DemoCommon::ACFrameRange fFrames
AutoCirculate frame count or range.
Private include file for all ajabase sources.
bool fWithDolby
If true, also capture Dolby.
static std::string GetInputSourceStrings(const NTV2IOKinds inKinds=NTV2_IOKINDS_ALL, const std::string inDeviceSpecifier=std::string())
static bool gGlobalQuit((0))
virtual AJAStatus Run(void)
Runs me.
static std::string GetPixelFormatStrings(const NTV2PixelFormatKinds inKinds=PIXEL_FORMATS_ALL, const std::string inDeviceSpecifier=std::string())
bool fWithAudio
If true, also capture Audio.
std::string NTV2ChannelToString(const NTV2Channel inValue, const bool inForRetailDisplay=false)
NTV2PixelFormat fPixelFormat
Pixel format to use.
Instances of me capture frames in real time from a video signal provided to an input of an AJA device...
#define NTV2_IS_VALID_FRAME_BUFFER_FORMAT(__s__)
#define AJA_FAILURE(_status_)
std::string fAudioDataFilePath
Optional path to Audio binary data file.
std::string fAncDataFilePath
Optional path to Anc binary data file.