43 namespace ArgusSamples
50 fprintf(stderr,
"------------------------------------------------------\n");
51 fprintf(stderr,
"Error: Video recording is not supported on Android due\n");
52 fprintf(stderr,
"to the lack of the required gstreamer functionality\n");
53 fprintf(stderr,
"------------------------------------------------------\n");
54 ORIGINATE_ERROR(
"Unsupported function on Android");
59 const float seconds = atof(optArg);
61 ORIGINATE_ERROR(
"'SECONDS' is invalid, must not be less than or equal to zero");
64 PROPAGATE_ERROR(module->
start());
79 PROPAGATE_ERROR(Window::getInstance().pollEvents());
84 recordingGuard.cancel();
88 runningGuard.cancel();
89 PROPAGATE_ERROR(module->
stop());
104 : m_initialized(false)
106 , m_guiContainerConfig(NULL)
124 bool result = (bool)system(
"lsmod | grep 'nvgpu' > /dev/null");
126 PROPAGATE_ERROR(options.addOption(
127 Options::Option(
"video",
'v',
"DURATION", Options::Option::TYPE_ACTION,
128 "record video for DURATION seconds and save to a file.",
video,
this)));
130 PROPAGATE_ERROR(options.addOption(
131 createValueOption(
"videobitrate", 0,
"RATE",
132 "set the video bit rate to RATE. If RATE is zero a reasonable default "
134 PROPAGATE_ERROR(options.addOption(
135 createValueOption(
"videocontrolrate", 0,
"MODE",
136 "set the video bit-rate control method.",
141 PROPAGATE_ERROR(options.addOption(
142 createValueOption(
"videotwopassCBR", 0,
"ENABLE",
143 "set this flag to enable two pass CBR method for encoding.",
146 PROPAGATE_ERROR(options.addOption(
147 createValueOption(
"videoformat", 0,
"FORMAT",
148 "set the video format. Jetson-tx1 doesn't support vp9, use other "
150 PROPAGATE_ERROR(options.addOption(
151 createValueOption(
"videofiletype", 0,
"TYPE",
152 "set the video file type. For video format 'h265/vp9' set the file type as 'mkv' "
153 "since 'h265 & vp9' are only supported by the 'mkv' container.",
166 PROPAGATE_ERROR_CONTINUE(
stop());
181 Window::IGuiContainer *iGuiContainerConfig)
187 PROPAGATE_ERROR(Window::getInstance().registerObserver(
this));
195 PROPAGATE_ERROR(Window::IGuiContainerGrid::create(&
m_guiConfig));
198 UniquePointer<Window::IGuiElement> element;
201 Window::IGuiContainerGrid::BuildHelper buildHelper(
m_guiConfig);
203 #define CREATE_GUI_ELEMENT(_NAME, _VALUE) \
204 PROPAGATE_ERROR(Window::IGuiElement::createValue(&dispatcher._VALUE, &element));\
205 PROPAGATE_ERROR(buildHelper.append(_NAME, element.get())); \
208 #define CREATE_GUI_ELEMENT_COMBO_BOX(_NAME, _VALUE, _FROMTYPE, _TOTYPE) \
209 assert(sizeof(_FROMTYPE) == sizeof(_TOTYPE)); \
210 PROPAGATE_ERROR(Window::IGuiElement::createValue(reinterpret_cast< \
211 Value<_TOTYPE>*>(&dispatcher._VALUE), &element)); \
212 PROPAGATE_ERROR(buildHelper.append(_NAME, element.get())); \
224 #undef CREATE_GUI_ELEMENT
225 #undef CREATE_GUI_ELEMENT_COMBO_BOX
227 PROPAGATE_ERROR(Window::IGuiElement::createAction(
"Toggle Recording",
229 Window::IGuiElement::ICON_MEDIA_RECORD, &element));
230 PROPAGATE_ERROR(buildHelper.append(element.get(), 2));
257 PROPAGATE_ERROR(Window::getInstance().unregisterObserver(
this));
266 if (key == Key(
"space"))