26 int main (
int argc,
const char ** argv)
33 int channelNumber (2);
34 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",
"2-4" },
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 {
"videoFormat",
'v',
POPT_ARG_STRING, &pVideoFormat, 0,
"video format to produce",
"'?' or 'list' to list" },
53 {
"dolby", 0,
POPT_ARG_STRING, &pDolbyFile, 0,
"dolby audio to play",
"path to binary file" },
63 {cerr <<
"## ERROR: " << popt.
errorStr() << endl;
return 2;}
65 {cerr <<
"## WARNING: ignored argument(s): '" <<
aja::join(popt.
otherArgs(),
"', '") <<
"'" << endl;
return 2;}
67 {cout << argv[0] <<
", NTV2 SDK " <<
::NTV2Version() << endl;
return 0;}
69 const string deviceSpec (pDeviceSpec ? pDeviceSpec :
"0");
73 if ((channelNumber < 2) || (channelNumber > 4))
74 {cerr <<
"## ERROR: Invalid channel number " << channelNumber <<
" -- expected 2 thru 4" << endl;
return 1;}
78 const string videoFormatStr (pVideoFormat ? pVideoFormat :
"");
81 if (videoFormatStr ==
"?" || videoFormatStr ==
"list")
85 cerr <<
"## ERROR: Invalid '--videoFormat' value '" << videoFormatStr <<
"' -- expected values:" << endl
91 const string pixelFormatStr (pPixelFormat ? pPixelFormat :
"");
93 if (pixelFormatStr ==
"?" || pixelFormatStr ==
"list")
97 cerr <<
"## ERROR: Invalid '--pixelFormat' value '" << pixelFormatStr <<
"' -- expected values:" << endl
103 static const string legalFramesSpec (
"{frameCount}[@{firstFrameNum}] or {firstFrameNum}-{lastFrameNum}");
104 const string framesSpec (pFramesSpec ? pFramesSpec :
"");
105 if (!framesSpec.empty())
108 if (!parseResult.empty())
109 {cerr <<
"## ERROR: Bad 'frames' spec '" << framesSpec <<
"'\n## " << parseResult << endl;
return 1;}
112 {cerr <<
"## ERROR: Bad 'frames' spec '" << framesSpec <<
"'\n## Expected " << legalFramesSpec << endl;
return 1;}
114 if (noVideo && noAudio)
115 {cerr <<
"## ERROR: conflicting options '--novideo' and '--noaudio'" << endl;
return 1;}
117 if (noAudio && doRamp)
118 {cerr <<
"## ERROR: conflicting options '--noaudio' and '--ramp'" << endl;
return 1;}
120 if (noAudio && pDolbyFile)
121 {cerr <<
"## ERROR: conflicting options '--noaudio' and '--dolby'" << endl;
return 1;}
123 if (doRamp && pDolbyFile)
124 {cerr <<
"## ERROR: conflicting options '--ramp' and '--dolby'" << endl;
return 1;}
136 status = player.
Init();
138 {cout <<
"## ERROR: Initialization failed: " <<
::AJAStatusToString(status) << endl;
return 1;}
149 cout <<
" Playout Playout Frames" << endl
150 <<
" Frames Buffer Dropped" << endl;
int main(int argc, const char **argv)
bool fSuppressAudio
If true, suppress audio; otherwise generate & xfer audio tone.
virtual AJAStatus Run(void)
Runs me.
static AJAStatus Open(bool incrementRefCount=false)
ULWord GetBufferLevel(void) const
#define AJA_FAILURE(_status_)
static NTV2VideoFormat GetVideoFormatFromString(const std::string &inStr, const NTV2VideoFormatKinds inKinds=VIDEO_FORMATS_SDHD, const std::string &inDevSpec=std::string())
Returns the NTV2VideoFormat that matches the given string.
static std::string GetPixelFormatStrings(const NTV2PixelFormatKinds inKinds=PIXEL_FORMATS_ALL, const std::string inDevSpec=std::string())
I am similar to NTV2Player, but I demonstrate how to play/output 8 channels of audio tone (or ramp da...
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...
ULWord GetProcessedFrameCount(void) const
std::string NTV2Version(const bool inDetailed=false)
static std::string GetVideoFormatStrings(const NTV2VideoFormatKinds inKinds=VIDEO_FORMATS_SDHD, const std::string inDevSpec=std::string())
virtual const NTV2StringList & otherArgs(void) const
static bool gGlobalQuit((0))
static void Sleep(const int32_t inMilliseconds)
Suspends execution of the current thread for a given number of milliseconds.
NTV2PixelFormat fPixelFormat
The pixel format to use.
Configures an NTV2DolbyPlayer instance.
virtual const std::string & errorStr(void) const
NTV2VideoFormat fVideoFormat
The video format to use.
ULWord GetDroppedFrameCount(void) const
std::string fDolbyFilePath
Optional path to Dolby audio source file.
bool fDoMultiFormat
If true, enable device-sharing; otherwise take exclusive control of device.
bool fDoRamp
If true, use audio ramp pattern instead of tone.
Header file for NTV2DolbyPlayer demonstration class.
NTV2Channel fOutputChannel
The device channel to use.
This is returned from the CNTV2Card::AutoCirculateGetStatus function.
virtual bool IsRunning(void) const
virtual AJAStatus Init(void)
Initializes me and prepares me to Run.
virtual void GetACStatus(AUTOCIRCULATE_STATUS &outStatus)
Provides status information about my output (playout) process.
NTV2ACFrameRange fFrames
AutoCirculate frame count or range.
std::string AJAStatusToString(const AJAStatus inStatus, const bool inDetailed)
std::string join(const std::vector< std::string > &parts, const std::string &delim)
#define NTV2_IS_VALID_FRAME_BUFFER_FORMAT(__s__)
bool fDoHDMIOutput
If true, enable HDMI output; otherwise, disable HDMI output.
bool fSuppressVideo
If true, suppress video; otherwise generate & xfer test patterns.
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.