Skip to content

Commit

Permalink
update to new NHVD
Browse files Browse the repository at this point in the history
- allow optionally specifying width/height/profile for NHVD
- this allows HEVC streams receiving with workaround (set profile/width/height)
- update readme

bmegli/network-hardware-video-decoder#6
bmegli committed Jan 12, 2020
1 parent a9064db commit 162c0dc
Showing 5 changed files with 17 additions and 4 deletions.
6 changes: 5 additions & 1 deletion Assets/NHVD.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Unity Network Hardware Video Decoder
*
* Copyright 2019 (C) Bartosz Meglicki <meglickib@gmail.com>
* Copyright 2019-2020 (C) Bartosz Meglicki <meglickib@gmail.com>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -29,6 +29,10 @@ public struct nhvd_hw_config

[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)]
public string pixel_format;

public int width;
public int height;
public int profile;
}

[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
2 changes: 1 addition & 1 deletion Assets/RawImageVideoRenderer.cs
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ public class RawImageVideoRenderer : MonoBehaviour

void Awake()
{
NHVD.nhvd_hw_config hw_config = new NHVD.nhvd_hw_config{hardware="vaapi", codec="h264", device=this.device, pixel_format="bgr0"};
NHVD.nhvd_hw_config hw_config = new NHVD.nhvd_hw_config{hardware="vaapi", codec="h264", device=this.device, pixel_format="bgr0", width=0, height=0, profile=0};
NHVD.nhvd_net_config net_config = new NHVD.nhvd_net_config{ip=this.ip, port=this.port, timeout_ms=500 };

nhvd=NHVD.nhvd_init (ref net_config, ref hw_config);
2 changes: 1 addition & 1 deletion Assets/VideoRenderer.cs
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ public class VideoRenderer : MonoBehaviour

void Awake()
{
NHVD.nhvd_hw_config hw_config = new NHVD.nhvd_hw_config{hardware="vaapi", codec="h264", device=this.device, pixel_format="bgr0"};
NHVD.nhvd_hw_config hw_config = new NHVD.nhvd_hw_config{hardware="vaapi", codec="h264", device=this.device, pixel_format="bgr0", width=0, height=0, profile=0};
NHVD.nhvd_net_config net_config = new NHVD.nhvd_net_config{ip=this.ip, port=this.port, timeout_ms=500 };

nhvd=NHVD.nhvd_init (ref net_config, ref hw_config);
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -92,6 +92,15 @@ parameters you need to setup your hardware. Assuming you are using VAAPI device:

Alternatively configure `VideoQuad` `VideoRenderer` componenent (scene, not UI streaming).

For troubleshooting you may use:

```bash
# in the PluginsSource/network-hardware-video-decoder/build
./nhvd-receive-example
```

This program prints diagnostic information that you would not see from Unity.

### Sending side

For a quick test you may use [NHVE](https://github.com/bmegli/network-hardware-video-encoder) procedurally generated H.264 video (recommended).

0 comments on commit 162c0dc

Please sign in to comment.