Skip to content

Commit c8fcab7

Browse files
Update README.md
1 parent 894fcaf commit c8fcab7

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

README.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,25 @@ Cisco's OpenH264 C++/CLI wrapper in C# with optimised image format conversions.
77

88
### Setup
99
``` 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);
1414
```
1515
- Empty Constructor will look for 32 or 64 bit openh264 dll automatically on executable directory(i.e. Debug/Release folder of your project).
1616
- You can setup with a different dll name, constructor is overloaded.
1717

1818
### Encode
1919
```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+
}
2929
```
3030
- You can encode rgb/rgba/bgr/bgra/yuv_i420 on as raw data format or System.Drawing.Bitmaps.
3131
- 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.
3434

3535
### Decode
3636
```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+
}
4747
```
4848
- You can decode with pointers or managed byte array as input.
4949
- You can decode into System.Drawing.Bitmaps or raw data format images (they are compatible with OpenCV Mats).

0 commit comments

Comments
 (0)