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 
56  uint32_t width;
57 
63  uint32_t height;
64 
70  float frameRate;
71 
77  uint32_t bitRate;
78 
84  uint32_t numBuffers;
85 
91  bool zeroCopy;
92 
106  int loop;
107 
113 
118  {
125  };
126 
131 
135  enum IoType
136  {
137  INPUT = 0,
139  };
140 
145 
150  {
151  FLIP_NONE = 0,
160  };
161 
179 
183  enum Codec
184  {
194  };
195 
208 
212  void Print( const char* prefix=NULL ) const;
213 
217  bool Parse( const char* URI, const int argc, char** argv, IoType ioType);
218 
222  bool Parse( const char* URI, const commandLine& cmdLine, IoType ioType);
223 
227  bool Parse( const int argc, char** argv, IoType ioType, int ioPositionArg=-1 );
228 
232  bool Parse( const commandLine& cmdLine, IoType ioType, int ioPositionArg=-1 );
233 
237  static const char* IoTypeToStr( IoType type );
238 
242  static IoType IoTypeFromStr( const char* str );
243 
247  static const char* DeviceTypeToStr( DeviceType type );
248 
252  static DeviceType DeviceTypeFromStr( const char* str );
253 
257  static const char* FlipMethodToStr( FlipMethod flip );
258 
262  static FlipMethod FlipMethodFromStr( const char* str );
263 
267  static const char* CodecToStr( Codec codec );
268 
272  static Codec CodecFromStr( const char* str );
273 };
274 
275 
279 #define LOG_VIDEO "[video] "
280 
281 #endif
282 
MIPI CSI camera.
Definition: videoOptions.h:121
Input stream (e.g.
Definition: videoOptions.h:137
Uncompressed (e.g.
Definition: videoOptions.h:186
static const char * CodecToStr(Codec codec)
Convert a Codec enum to a string.
Unknown/unsupported codec.
Definition: videoOptions.h:185
int rtspLatency
Number of milliseconds of video to buffer for incoming RTSP streams (the default is 2000 ms)...
Definition: videoOptions.h:112
static Codec CodecFromStr(const char *str)
Parse a Codec enum from a string.
static const char * DeviceTypeToStr(DeviceType type)
Convert a DeviceType enum to a string.
MPEG4 (decode only)
Definition: videoOptions.h:192
Output stream (e.g.
Definition: videoOptions.h:138
Identity (no rotation)
Definition: videoOptions.h:151
int loop
Control the number of loops for videoSource disk-based inputs (for example, the number of times that ...
Definition: videoOptions.h:106
static IoType IoTypeFromStr(const char *str)
Parse an IoType enum from a string.
DeviceType
Device interface types.
Definition: videoOptions.h:117
float frameRate
The framerate of the stream (the default is 30Hz).
Definition: videoOptions.h:70
bool Parse(const char *URI, const int argc, char **argv, IoType ioType)
Resource URI of a video device, IP stream, or file/directory.
Definition: URI.h:91
Rotate clockwise 90 degrees.
Definition: videoOptions.h:154
static FlipMethod FlipMethodFromStr(const char *str)
Parse a FlipMethod enum from a string.
FlipMethod
Settings of the flip method used by MIPI CSI cameras and compressed video inputs. ...
Definition: videoOptions.h:149
MJPEG.
Definition: videoOptions.h:193
OpenGL output stream rendered to an attached display.
Definition: videoOptions.h:124
Unknown interface type.
Definition: videoOptions.h:119
uint32_t height
The height of the stream (in pixels).
Definition: videoOptions.h:63
The videoOptions struct contains common settings that are used to configure and query videoSource and...
Definition: videoOptions.h:37
void Print(const char *prefix=NULL) const
Log the video settings, with an optional prefix label.
uint32_t numBuffers
The number of ring buffers used for threading.
Definition: videoOptions.h:84
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:178
videoOptions()
Constructor using default options.
VP9.
Definition: videoOptions.h:190
Command line parser for extracting flags, values, and strings.
Definition: commandLine.h:35
uint32_t width
The width of the stream (in pixels).
Definition: videoOptions.h:56
bool zeroCopy
If true, indicates the buffers are allocated in zeroCopy memory that is mapped to both the CPU and GP...
Definition: videoOptions.h:91
H.264.
Definition: videoOptions.h:187
Flip horizontally.
Definition: videoOptions.h:155
Flip vertically.
Definition: videoOptions.h:157
Disk-based stream from a file or directory of files.
Definition: videoOptions.h:123
static const char * FlipMethodToStr(FlipMethod flip)
Convert a FlipMethod enum to a string.
uint32_t bitRate
The encoding bitrate for compressed streams (only applies to video codecs like H264/H265).
Definition: videoOptions.h:77
DeviceType deviceType
Indicates the type of device interface used by this stream.
Definition: videoOptions.h:130
IP-based network stream (e.g.
Definition: videoOptions.h:122
IoType
Input/Output stream type.
Definition: videoOptions.h:135
Rotate counter-clockwise 90 degrees.
Definition: videoOptions.h:152
MPEG2 (decode only)
Definition: videoOptions.h:191
H.265.
Definition: videoOptions.h:188
IoType ioType
Indicates if this stream is an input or an output.
Definition: videoOptions.h:144
static DeviceType DeviceTypeFromStr(const char *str)
Parse a DeviceType enum from a string.
static const char * IoTypeToStr(IoType type)
Convert an IoType enum to a string.
Codec codec
Indicates the codec used by the stream.
Definition: videoOptions.h:207
Rotate 180 degrees.
Definition: videoOptions.h:153
Default setting (none)
Definition: videoOptions.h:159
VP8.
Definition: videoOptions.h:189
Flip across upper right/lower left diagonal.
Definition: videoOptions.h:156
Codec
Video codec types.
Definition: videoOptions.h:183
Flip across upper left/lower right diagonal.
Definition: videoOptions.h:158
URI resource
The resource URI of the device, IP stream, or file/directory.
Definition: videoOptions.h:49
V4L2 webcam (e.g.
Definition: videoOptions.h:120