AJA NTV2 SDK
17.5.0.1658
NTV2 SDK 17.5.0.1658
main.cpp
Go to the documentation of this file.
1
/* SPDX-License-Identifier: MIT */
9
// Includes
10
#include "
ntv2overlay.h
"
11
#include <signal.h>
12
#include <iostream>
13
#include <iomanip>
14
15
using namespace
std
;
16
17
18
// Globals
19
static
bool
gGlobalQuit
(
false
);
20
21
22
static
void
SignalHandler
(
int
inSignal)
23
{
24
(
void
) inSignal;
25
gGlobalQuit
=
true
;
26
}
27
28
29
int
main
(
int
argc,
const
char
** argv)
30
{
31
char
* pDeviceSpec (
AJA_NULL
);
// Which device to use
32
int
showVersion (0);
// Show version?
33
AJADebug::Open
();
34
35
// Command line option descriptions:
36
const
struct
poptOption
optionsTable [] =
37
{
38
{
"version"
, 0,
POPT_ARG_NONE
, &showVersion, 0,
"show version & exit"
,
AJA_NULL
},
39
{
"device"
,
'd'
,
POPT_ARG_STRING
, &pDeviceSpec, 0,
"device to use"
,
"index#, serial#, or model"
},
40
POPT_AUTOHELP
41
POPT_TABLEEND
42
};
43
CNTV2DemoCommon::Popt
popt(argc, argv, optionsTable);
44
if
(!popt)
45
{cerr <<
"## ERROR: "
<< popt.
errorStr
() << endl;
return
2;}
46
if
(showVersion)
47
{cout << argv[0] <<
", NTV2 SDK "
<<
::NTV2Version
() << endl;
return
0;}
48
49
// Device
50
const
string
deviceSpec (pDeviceSpec ? pDeviceSpec :
"0"
);
51
if
(!
CNTV2DemoCommon::IsValidDevice
(deviceSpec))
52
return
1;
53
54
OverlayConfig
config(deviceSpec);
55
config.
fInputSource
=
NTV2_INPUTSOURCE_SDI1
;
56
config.
fOutputDest
=
NTV2_OUTPUTDESTINATION_SDI1
;
57
config.
fPixelFormat
=
NTV2_FBF_10BIT_YCBCR
;
58
config.
fDoMultiFormat
=
true
;
59
config.
fVerbose
=
true
;
60
61
// Instantiate the NTV2Overlay object...
62
NTV2Overlay
overlayer (config);
63
64
// Initialize the NTV2Burn instance...
65
AJAStatus
status (overlayer.
Init
());
66
if
(
AJA_FAILURE
(status))
67
{cerr <<
"## ERROR: Initialization failed, status="
<< status << endl;
return
4;}
68
69
::signal (SIGINT,
SignalHandler
);
70
#if defined (AJAMac)
71
::signal (SIGHUP,
SignalHandler
);
72
::signal (SIGQUIT,
SignalHandler
);
73
#endif
74
75
// Start the burner's capture and playout threads...
76
overlayer.
Run
();
77
78
// Loop until told to stop...
79
ULWord
counter(0);
80
do
81
{
82
cout << setw(9) << ++counter
83
<<
"\r"
<< flush;
84
AJATime::Sleep
(2000);
85
}
while
(!
gGlobalQuit
);
// loop until signaled
86
87
cout << endl;
88
return
0;
89
90
}
// main
BurnConfig::fVerbose
bool fVerbose
If true, emit explanatory messages to stdout/stderr. Defaults to false.
Definition:
ntv2democommon.h:403
poptOption
Definition:
options_popt.h:148
SignalHandler
void SignalHandler(int inSignal)
Definition:
main.cpp:26
BurnConfig::fOutputDest
NTV2OutputDest fOutputDest
The device output connector to use (NTV2_OUTPUTDESTINATION_INVALID means unspecified)
Definition:
ntv2democommon.h:391
BurnConfig::fDoMultiFormat
bool fDoMultiFormat
If true, enables device-sharing; otherwise takes exclusive control of the device.
Definition:
ntv2democommon.h:396
gGlobalQuit
static bool gGlobalQuit((0))
Set this "true" to exit gracefully.
ntv2overlay.h
Header file for the NTV2Overlay demonstration class.
main
int main(int argc, const char **argv)
Definition:
main.cpp:30
nlohmann::json_abiNLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON_v3_11_NLOHMANN_JSON_VERSION_PATCH::detail::void
j template void())
Definition:
json.hpp:4893
BurnConfig::fPixelFormat
NTV2PixelFormat fPixelFormat
The pixel format to use.
Definition:
ntv2democommon.h:394
POPT_AUTOHELP
#define POPT_AUTOHELP
Definition:
options_popt.h:220
NTV2Overlay::Run
AJAStatus Run(void)
Runs me (only after Init called)
Definition:
ntv2overlay.cpp:345
NTV2_INPUTSOURCE_SDI1
@ NTV2_INPUTSOURCE_SDI1
Identifies the 1st SDI video input.
Definition:
ntv2enums.h:1260
CNTV2DemoCommon::IsValidDevice
static bool IsValidDevice(const std::string &inDeviceSpec)
Definition:
ntv2democommon.cpp:455
AJAStatus
AJAStatus
Definition:
types.h:378
NTV2_OUTPUTDESTINATION_SDI1
@ NTV2_OUTPUTDESTINATION_SDI1
Definition:
ntv2enums.h:1314
AJATime::Sleep
static void Sleep(const int32_t inMilliseconds)
Suspends execution of the current thread for a given number of milliseconds.
Definition:
systemtime.cpp:284
ULWord
uint32_t ULWord
Definition:
ajatypes.h:255
CNTV2DemoCommon::Popt
Definition:
ntv2democommon.h:849
CNTV2DemoCommon::Popt::errorStr
virtual const std::string & errorStr(void) const
Definition:
ntv2democommon.h:857
NTV2Version
std::string NTV2Version(const bool inDetailed=false)
Definition:
ntv2version.cpp:41
NTV2Overlay::Init
AJAStatus Init(void)
Prepares me to Run()
Definition:
ntv2overlay.cpp:74
AJADebug::Open
static AJAStatus Open(bool incrementRefCount=false)
Definition:
debug.cpp:44
AJA_NULL
#define AJA_NULL
Definition:
ajatypes.h:199
BurnConfig::fInputSource
NTV2InputSource fInputSource
The device input connector to use.
Definition:
ntv2democommon.h:390
NTV2_FBF_10BIT_YCBCR
@ NTV2_FBF_10BIT_YCBCR
See 10-Bit YCbCr Format.
Definition:
ntv2enums.h:213
std
Definition:
json.hpp:5362
POPT_TABLEEND
#define POPT_TABLEEND
Definition:
options_popt.h:215
AJA_FAILURE
#define AJA_FAILURE(_status_)
Definition:
types.h:371
BurnConfig
Configures an NTV2Burn or NTV2FieldBurn instance.
Definition:
ntv2democommon.h:383
NTV2Overlay
Outputs live input video overlaid with image having transparency.
Definition:
ntv2overlay.h:22
POPT_ARG_STRING
#define POPT_ARG_STRING
Definition:
options_popt.h:57
POPT_ARG_NONE
#define POPT_ARG_NONE
Definition:
options_popt.h:56
libajantv2
demos
ntv2overlay
main.cpp
Generated on Tue Feb 25 2025 18:41:18 for AJA NTV2 SDK by
1.8.17