Jetson Inference
DNN Vision Library
videoOptions.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20  * DEALINGS IN THE SOFTWARE.
21  */
22 
23 #ifndef __VIDEO_OPTIONS_H_
24 #define __VIDEO_OPTIONS_H_
25 
26 #include "imageFormat.h"
27 #include "commandLine.h"
28 
29 #include "URI.h"
30 
31 
38 {
39 public:
43  videoOptions();
44 
50 
58 
64  uint32_t width;
65 
71  uint32_t height;
72 
78  float frameRate;
79 
83  uint64_t frameCount;
84 
90  uint32_t bitRate;
91 
97  uint32_t numBuffers;
98 
104  bool zeroCopy;
105 
119  int loop;
120 
127  int latency;
128 
133  {
140  };
141 
146 
150  enum IoType
151  {
152  INPUT = 0,
154  };
155 
160 
165  {
166  FLIP_NONE = 0,
175  };
176 
194 
198  enum Codec
199  {
209  };
210 
223 
228  {
229  CODEC_CPU = 0,
234  };
235 
243 
244 
250  std::string stunServer;
251 
259  std::string sslCert;
260 
268  std::string sslKey;
269 
273  void Print( const char* prefix=NULL ) const;
274 
278  bool Parse( const char* URI, const int argc, char** argv, IoType ioType, const char* extraFlag=NULL);
279 
283  bool Parse( const char* URI, const commandLine& cmdLine, IoType ioType);
284 
288  bool Parse( const int argc, char** argv, IoType ioType, int ioPositionArg=-1 );
289 
293  bool Parse( const commandLine& cmdLine, IoType ioType, int ioPositionArg=-1 );
294 
298  static const char* IoTypeToStr( IoType type );
299 
303  static IoType IoTypeFromStr( const char* str );
304 
308  static const char* DeviceTypeToStr( DeviceType type );
309 
313  static DeviceType DeviceTypeFromStr( const char* str );
314 
318  static const char* FlipMethodToStr( FlipMethod flip );
319 
323  static FlipMethod FlipMethodFromStr( const char* str );
324 
328  static const char* CodecToStr( Codec codec );
329 
333  static Codec CodecFromStr( const char* str );
334 
338  static const char* CodecTypeToStr( CodecType codecType );
339 
343  static CodecType CodecTypeFromStr( const char* str );
344 };
345 
346 
350 #define LOG_VIDEO "[video] "
351 
352 #endif
353 
videoOptions::CodecTypeFromStr
static CodecType CodecTypeFromStr(const char *str)
Parse a Codec enum from a string.
videoOptions::IoTypeFromStr
static IoType IoTypeFromStr(const char *str)
Parse an IoType enum from a string.
videoOptions::FLIP_UPPER_RIGHT_DIAGONAL
@ FLIP_UPPER_RIGHT_DIAGONAL
Flip across upper right/lower left diagonal.
Definition: videoOptions.h:171
videoOptions::CODEC_MPEG4
@ CODEC_MPEG4
MPEG4 (decode only)
Definition: videoOptions.h:207
videoOptions::CODEC_VP8
@ CODEC_VP8
VP8.
Definition: videoOptions.h:204
videoOptions::DEVICE_DEFAULT
@ DEVICE_DEFAULT
Unknown interface type.
Definition: videoOptions.h:134
videoOptions::DeviceType
DeviceType
Device interface types.
Definition: videoOptions.h:132
videoOptions::CodecToStr
static const char * CodecToStr(Codec codec)
Convert a Codec enum to a string.
videoOptions::sslKey
std::string sslKey
Path to a file containing a PEM-encoded private key.
Definition: videoOptions.h:268
videoOptions::FlipMethodFromStr
static FlipMethod FlipMethodFromStr(const char *str)
Parse a FlipMethod enum from a string.
videoOptions::CODEC_NVENC
@ CODEC_NVENC
x86 only - NVENC hardware plugin (not currently implemented)
Definition: videoOptions.h:232
videoOptions::save
URI save
Optional path to save the compressed stream to a video file on disk, which is to be used in addition ...
Definition: videoOptions.h:57
videoOptions::latency
int latency
Number of milliseconds of video to buffer for network RTSP or WebRTC streams.
Definition: videoOptions.h:127
videoOptions::CodecFromStr
static Codec CodecFromStr(const char *str)
Parse a Codec enum from a string.
videoOptions::DEVICE_FILE
@ DEVICE_FILE
Disk-based stream from a file or directory of files.
Definition: videoOptions.h:138
commandLine.h
videoOptions::DEVICE_IP
@ DEVICE_IP
IP-based network stream (e.g.
Definition: videoOptions.h:137
videoOptions::CODEC_H265
@ CODEC_H265
H.265.
Definition: videoOptions.h:203
videoOptions::FLIP_COUNTERCLOCKWISE
@ FLIP_COUNTERCLOCKWISE
Rotate counter-clockwise 90 degrees.
Definition: videoOptions.h:167
videoOptions::Parse
bool Parse(const char *URI, const int argc, char **argv, IoType ioType, const char *extraFlag=NULL)
videoOptions::CODEC_H264
@ CODEC_H264
H.264.
Definition: videoOptions.h:202
videoOptions::INPUT
@ INPUT
Input stream (e.g.
Definition: videoOptions.h:152
videoOptions::FLIP_NONE
@ FLIP_NONE
Identity (no rotation)
Definition: videoOptions.h:166
videoOptions::resource
URI resource
The resource URI of the device, IP stream, or file/directory.
Definition: videoOptions.h:49
videoOptions::Codec
Codec
Video codecs.
Definition: videoOptions.h:198
videoOptions::DeviceTypeToStr
static const char * DeviceTypeToStr(DeviceType type)
Convert a DeviceType enum to a string.
videoOptions::CODEC_CPU
@ CODEC_CPU
CPU-based implementation using libav (e.g.
Definition: videoOptions.h:229
videoOptions::FLIP_HORIZONTAL
@ FLIP_HORIZONTAL
Flip horizontally.
Definition: videoOptions.h:170
videoOptions::FLIP_ROTATE_180
@ FLIP_ROTATE_180
Rotate 180 degrees.
Definition: videoOptions.h:168
videoOptions::IoTypeToStr
static const char * IoTypeToStr(IoType type)
Convert an IoType enum to a string.
videoOptions::CODEC_UNKNOWN
@ CODEC_UNKNOWN
Unknown/unsupported codec.
Definition: videoOptions.h:200
videoOptions::Print
void Print(const char *prefix=NULL) const
Log the video settings, with an optional prefix label.
videoOptions::videoOptions
videoOptions()
Constructor using default options.
videoOptions::CODEC_RAW
@ CODEC_RAW
Uncompressed (e.g.
Definition: videoOptions.h:201
URI
Resource URI of a video device, IP stream, or file/directory.
Definition: URI.h:101
videoOptions::FLIP_VERTICAL
@ FLIP_VERTICAL
Flip vertically.
Definition: videoOptions.h:172
videoOptions::CODEC_NVDEC
@ CODEC_NVDEC
x86 only - NVDEC hardware plugin (not currently implemented)
Definition: videoOptions.h:233
videoOptions::FlipMethodToStr
static const char * FlipMethodToStr(FlipMethod flip)
Convert a FlipMethod enum to a string.
videoOptions::bitRate
uint32_t bitRate
The encoding bitrate for compressed streams (only applies to video codecs like H264/H265).
Definition: videoOptions.h:90
videoOptions::DeviceTypeFromStr
static DeviceType DeviceTypeFromStr(const char *str)
Parse a DeviceType enum from a string.
videoOptions::CODEC_V4L2
@ CODEC_V4L2
aarch64 & JetPack 5 only - V4L2 hardware plugins (e.g.
Definition: videoOptions.h:231
videoOptions::FLIP_CLOCKWISE
@ FLIP_CLOCKWISE
Rotate clockwise 90 degrees.
Definition: videoOptions.h:169
videoOptions::CODEC_OMX
@ CODEC_OMX
aarch64 & JetPack 4 only - OMX hardware plugins (e.g.
Definition: videoOptions.h:230
videoOptions::FLIP_UPPER_LEFT_DIAGONAL
@ FLIP_UPPER_LEFT_DIAGONAL
Flip across upper left/lower right diagonal.
Definition: videoOptions.h:173
videoOptions::CODEC_MJPEG
@ CODEC_MJPEG
MJPEG.
Definition: videoOptions.h:208
videoOptions::stunServer
std::string stunServer
URL of STUN server used for WebRTC.
Definition: videoOptions.h:250
videoOptions::loop
int loop
Control the number of loops for videoSource disk-based inputs (for example, the number of times that ...
Definition: videoOptions.h:119
videoOptions::zeroCopy
bool zeroCopy
If true, indicates the buffers are allocated in zeroCopy memory that is mapped to both the CPU and GP...
Definition: videoOptions.h:104
videoOptions::CodecTypeToStr
static const char * CodecTypeToStr(CodecType codecType)
Convert a CodecType enum to a string.
videoOptions::sslCert
std::string sslCert
Path to a file containing a PEM-encoded SSL/TLS certificate.
Definition: videoOptions.h:259
videoOptions::OUTPUT
@ OUTPUT
Output stream (e.g.
Definition: videoOptions.h:153
videoOptions::codec
Codec codec
Indicates the codec used by the stream.
Definition: videoOptions.h:222
videoOptions::ioType
IoType ioType
Indicates if this stream is an input or an output.
Definition: videoOptions.h:159
videoOptions::CODEC_VP9
@ CODEC_VP9
VP9.
Definition: videoOptions.h:205
videoOptions::CODEC_MPEG2
@ CODEC_MPEG2
MPEG2 (decode only)
Definition: videoOptions.h:206
videoOptions::CodecType
CodecType
Video codec engines.
Definition: videoOptions.h:227
videoOptions::IoType
IoType
Input/Output stream type.
Definition: videoOptions.h:150
videoOptions::DEVICE_DISPLAY
@ DEVICE_DISPLAY
OpenGL output stream rendered to an attached display.
Definition: videoOptions.h:139
URI.h
videoOptions::FLIP_DEFAULT
@ FLIP_DEFAULT
Default setting (none)
Definition: videoOptions.h:174
videoOptions::codecType
CodecType codecType
Indicates the underlying hardware/software engine used by the codec.
Definition: videoOptions.h:242
videoOptions
The videoOptions struct contains common settings that are used to configure and query videoSource and...
Definition: videoOptions.h:37
videoOptions::flipMethod
FlipMethod flipMethod
The flip method controls if and how an input frame is flipped/rotated in pre-processing from a MIPI C...
Definition: videoOptions.h:193
videoOptions::numBuffers
uint32_t numBuffers
The number of ring buffers used for threading.
Definition: videoOptions.h:97
commandLine
Command line parser for extracting flags, values, and strings.
Definition: commandLine.h:35
videoOptions::FlipMethod
FlipMethod
Settings of the flip method used by MIPI CSI cameras and compressed video inputs.
Definition: videoOptions.h:164
videoOptions::width
uint32_t width
The width of the stream (in pixels).
Definition: videoOptions.h:64
videoOptions::DEVICE_V4L2
@ DEVICE_V4L2
V4L2 webcam (e.g.
Definition: videoOptions.h:135
videoOptions::DEVICE_CSI
@ DEVICE_CSI
MIPI CSI camera.
Definition: videoOptions.h:136
videoOptions::frameCount
uint64_t frameCount
The number of frames that have been captured or output on this interface.
Definition: videoOptions.h:83
videoOptions::deviceType
DeviceType deviceType
Indicates the type of device interface used by this stream.
Definition: videoOptions.h:145
videoOptions::frameRate
float frameRate
The framerate of the stream (the default is 30Hz).
Definition: videoOptions.h:78
imageFormat.h
videoOptions::height
uint32_t height
The height of the stream (in pixels).
Definition: videoOptions.h:71