@@ -7,25 +7,25 @@ Cisco's OpenH264 C++/CLI wrapper in C# with optimised image format conversions.
7
7
8
8
### Setup
9
9
``` c#
10
- decoder = new H264Sharp .Decoder ();
11
-
12
- encoder = new H264Sharp .Encoder ();
13
- encoder .Initialize (w , h , bps : 200_ 000_ 000 , fps : 30 , H264Sharp .Encoder .ConfigType .CameraBasic );
10
+ decoder = new H264Sharp .Decoder ();
11
+
12
+ encoder = new H264Sharp .Encoder ();
13
+ encoder .Initialize (w , h , bps : 200_ 000_ 000 , fps : 30 , H264Sharp .Encoder .ConfigType .CameraBasic );
14
14
```
15
15
- Empty Constructor will look for 32 or 64 bit openh264 dll automatically on executable directory(i.e. Debug/Release folder of your project).
16
16
- You can setup with a different dll name, constructor is overloaded.
17
17
18
18
### Encode
19
19
``` C#
20
- if (encoder .Encode (bitmap , out EncodedFrame [] frames ))
21
- {
22
- foreach (var frame in frames )
23
- {
24
- // byte[] b = frame.ToByteArray();
25
- // frame.CopyTo(buffer, 0);
26
- Decode (frame .Data , frame .Length , frame .Type );
27
- }
28
- }
20
+ if (encoder .Encode (bitmap , out EncodedFrame [] frames ))
21
+ {
22
+ foreach (var frame in frames )
23
+ {
24
+ // byte[] b = frame.ToByteArray();
25
+ // frame.CopyTo(buffer, 0);
26
+ Decode (frame .Data , frame .Length , frame .Type );
27
+ }
28
+ }
29
29
```
30
30
- You can encode rgb/rgba/bgr/bgra/yuv_i420 on as raw data format or System.Drawing.Bitmaps.
31
31
- You have to determine startIndex, width height and stride values for your raw data images.
@@ -34,16 +34,16 @@ Cisco's OpenH264 C++/CLI wrapper in C# with optimised image format conversions.
34
34
35
35
### Decode
36
36
``` C#
37
- void Decode (IntPtr data , int length , FrameType type )
38
- {
39
- // if (decoder.Decode(data, length, noDelay:true, out DecodingState statusCode, out RgbImage rgb))
40
- // if (decoder.Decode(data, length, noDelay:true, out DecodingState statusCode, out Yuv420p yuv420))
41
- if (decoder .Decode (data , length , noDelay :true , out DecodingState statusCode , out Bitmap bmp ))
42
- {
43
- // Do stuff..
44
- // bmp.Save("t.bmp");
45
- }
46
- }
37
+ void Decode (IntPtr data , int length , FrameType type )
38
+ {
39
+ // if (decoder.Decode(data, length, noDelay:true, out DecodingState statusCode, out RgbImage rgb))
40
+ // if (decoder.Decode(data, length, noDelay:true, out DecodingState statusCode, out Yuv420p yuv420))
41
+ if (decoder .Decode (data , length , noDelay :true , out DecodingState statusCode , out Bitmap bmp ))
42
+ {
43
+ // Do stuff..
44
+ // bmp.Save("t.bmp");
45
+ }
46
+ }
47
47
```
48
48
- You can decode with pointers or managed byte array as input.
49
49
- You can decode into System.Drawing.Bitmaps or raw data format images (they are compatible with OpenCV Mats).
0 commit comments