You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Build and connect to your project](#Build-and-connect-to-your-project)
29
+
30
+
26
31
27
32
# Overview
28
33
29
-
**VCodec** C++ library provides standard interface as well defines data structures and rules for different video codec classes (video encoding and decoding). **VCodec** interface class doesn't do anything, just provides interface. Different video codec classes inherit interface form **VCodec** C++ class. **VCodec.h** file contains VCodecCommand** enum, **VCodecParam** enum and **VCodec** class declaration. **VCodecCommands** enum contains IDs of commands supported by **VCodec** class. **VCodecParam** enum contains IDs of params supported by **VCodec** class. All video codec should include params and commands listed in **VCodec.h** file. **VCodec** class depends on **Frame** class which determines video frame structure. Video codec interface supports only 8 bit depth input pixels.
34
+
**VCodec** C++ library provides standard interface as well defines data structures and rules for different video codec classes (video encoding and decoding). **VCodec** interface class doesn't do anything, just provides interface. Different video codec classes inherit interface form **VCodec** C++ class. **VCodec.h** file contains **VCodecCommand** enum, **VCodecParam** enum and **VCodec** class declaration. **VCodecCommands** enum contains IDs of commands supported by **VCodec** class. **VCodecParam** enum contains IDs of params supported by **VCodec** class. All video codec should include params and commands listed in **VCodec.h** file. **VCodec** class depends on **Frame** class which determines video frame structure. Video codec interface supports only 8 bit depth input pixels.
* @param id Parameter ID according to camera specification.
82
89
* @return Parameter value or -1.
83
90
*/
84
91
virtual float getParam(VCodecParam id) = 0;
85
-
86
92
/**
87
93
* @brief Execute command.
88
94
* @param id Command ID .
@@ -94,9 +100,11 @@ public:
94
100
}
95
101
```
96
102
103
+
104
+
97
105
## getVersion method
98
106
99
-
**getVersion()** method return string of current version of **VCodec** class. Particular video codec class can have it's own **getVersion()** method. Method declaration:
107
+
**getVersion()** method returns string of current version of **VCodec** class. Particular video codec class can have it's own **getVersion()** method. Method declaration:
100
108
101
109
```cpp
102
110
static std::string getVersion();
@@ -108,6 +116,14 @@ Method can be used without **VCodec** class instance:
108
116
std::cout << "VCodec class version: " << VCodec::getVersion() << std::endl;
109
117
```
110
118
119
+
Console output:
120
+
121
+
```bash
122
+
VCodec class version: 1.1.1
123
+
```
124
+
125
+
126
+
111
127
## transcode method
112
128
113
129
**transcode(...)** method intended to encode and decode video frame (**Frame** class). Video codec encode/decode video frames frame-by-frame. Method declaration:
| src | Source video frame (see **Frame** class description). To encode video data **src** frame must have RAW pixel data (field **fourcc** of **Frame** class): **RGB24**, **BGR24**, **YUYV**, **UYVY**, **GRAY**, **YUV24**, **NV12**, **NV21**, **YU12** or **YV12**. To decode video data **src** frame must have compressed pixel format (field **fourcc** of **Frame** class): **JPEG**, **H264** or **HEVC**. Particular video codec can support limited RAW input pixel format or only one. When it possible video codec should accept all supported RAW pixel formats and should do pixel format conversion inside if it necessary. Also, particular video codec can support all, few or just one compressed pixel format. When it possible video code should support all compressed pixel format to encode/decode. |
122
-
| dst | Result video frame (see **Frame** class description). To decode video data **src** frame must have compressed pixel format (field **fourcc** of **Frame** class): **JPEG**, **H264** or **HEVC**. In case decoding particular video codec can set output pixel format automatically. To encode video frame user must set **fourcc** field of dst frame to necessary output compressed format: **JPEG**, **H264** or **HEVC**. |
138
+
| dst | Result video frame (see **Frame** class description). To decode video data **src** frame must have compressed pixel format (field **fourcc** of **Frame** class): **JPEG**, **H264** or **HEVC**. In case decoding particular video codec can set output pixel format automatically. To encode video frame user must set **fourcc** field of dst frame to necessary output compressed format: **JPEG**, **H264** or **HEVC**. The method will write decoded frame data (RAW pixel format) to **data** filed of **src** frame in case decoding or will write compressed data in case encoding. |
123
139
124
140
**Returns:** TRUE if frame was encoded/decoded or FALSE if not.
125
141
142
+
143
+
126
144
## setParam method
127
145
128
146
**setParam(...)** method designed to set new video codec parameters value. Method declaration:
/// [read/write] Codec type. Depends on implementation.
215
-
TYPE
243
+
TYPE,
244
+
/// Custom 1. Depends on implementation.
245
+
CUSTOM_1,
246
+
/// Custom 2. Depends on implementation.
247
+
CUSTOM_2,
248
+
/// Custom 3. Depends on implementation.
249
+
CUSTOM_3
216
250
};
217
251
```
218
252
@@ -227,3 +261,117 @@ enum class VCodecParam
227
261
| GOP | read / write | GOP size (Period of key frames) for H264 or H265(HEVC) encoding. Value: 1 - each output frame is key frame, 20 - each 20th frame is key frame etc. |
In you repository folder will be created folder **3rdparty/VCodec** which contains files of **VCodec** repository with subrepositories **Frame**. New structure of your repository:
303
+
304
+
```bash
305
+
CMakeLists.txt
306
+
src
307
+
CMakeList.txt
308
+
yourLib.h
309
+
yourLib.cpp
310
+
3rdparty
311
+
VCodec
312
+
```
313
+
314
+
Create CMakeLists.txt file in **3rdparty** folder. CMakeLists.txt should contain:
0 commit comments