Fixed JSON parsing in OpenSeeWebcamInfo.
This commit is contained in:
parent
971f81b030
commit
a6cd1dfa6c
1 changed files with 7 additions and 17 deletions
|
|
@ -8,9 +8,6 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
// UniJSON is part of UniVRM (https://github.com/vrm-c/UniVRM)
|
|
||||||
using UniJSON;
|
|
||||||
|
|
||||||
namespace OpenSee {
|
namespace OpenSee {
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
|
@ -178,6 +175,11 @@ public class OpenSeeWebcamInfo : MonoBehaviour {
|
||||||
private static extern void bm_get_json_x86([Out] StringBuilder namebuffer, int bufferlength);
|
private static extern void bm_get_json_x86([Out] StringBuilder namebuffer, int bufferlength);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class OpenSeeWebcamList {
|
||||||
|
public List<OpenSeeWebcam> list;
|
||||||
|
}
|
||||||
|
|
||||||
public List<OpenSeeWebcam> cameras;
|
public List<OpenSeeWebcam> cameras;
|
||||||
public bool dumpJson = false;
|
public bool dumpJson = false;
|
||||||
|
|
||||||
|
|
@ -232,15 +234,11 @@ public class OpenSeeWebcamInfo : MonoBehaviour {
|
||||||
if (includeBlackMagic)
|
if (includeBlackMagic)
|
||||||
UnityEngine.Debug.Log("Blackmagic JSON: " + bmJsonData);
|
UnityEngine.Debug.Log("Blackmagic JSON: " + bmJsonData);
|
||||||
}
|
}
|
||||||
List<OpenSeeWebcam> details = new List<OpenSeeWebcam>();
|
List<OpenSeeWebcam> details = JsonUtility.FromJson<OpenSeeWebcamList>("{\"list\":" + jsonData + "}").list;
|
||||||
var parsed = JsonParser.Parse(jsonData);
|
|
||||||
parsed.Deserialize(ref details);
|
|
||||||
foreach (var cam in details)
|
foreach (var cam in details)
|
||||||
cam.type = OpenSeeWebcamType.DirectShow;
|
cam.type = OpenSeeWebcamType.DirectShow;
|
||||||
if (includeBlackMagic) {
|
if (includeBlackMagic) {
|
||||||
List<OpenSeeWebcam> bmDetails = new List<OpenSeeWebcam>();
|
List<OpenSeeWebcam> bmDetails = JsonUtility.FromJson<OpenSeeWebcamList>("{\"list\":" + bmJsonData + "}").list;
|
||||||
parsed = JsonParser.Parse(bmJsonData);
|
|
||||||
parsed.Deserialize(ref bmDetails);
|
|
||||||
foreach (var cam in bmDetails)
|
foreach (var cam in bmDetails)
|
||||||
cam.type = OpenSeeWebcamType.Blackmagic;
|
cam.type = OpenSeeWebcamType.Blackmagic;
|
||||||
details.AddRange(bmDetails);
|
details.AddRange(bmDetails);
|
||||||
|
|
@ -258,13 +256,5 @@ public class OpenSeeWebcamInfo : MonoBehaviour {
|
||||||
foreach (var camera in cameras)
|
foreach (var camera in cameras)
|
||||||
camera.GetPrettyCapabilities();
|
camera.GetPrettyCapabilities();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AOTCall() {
|
|
||||||
GenericDeserializer<JsonValue, OpenSeeWebcamCapability[]>.GenericArrayDeserializer<OpenSeeWebcamCapability>(default(ListTreeNode<JsonValue>));
|
|
||||||
JsonObjectValidator.GenericDeserializer<JsonValue, OpenSeeWebcamCapability>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
|
|
||||||
JsonObjectValidator.GenericDeserializer<JsonValue, OpenSeeWebcamCapability>.DeserializeField<OpenSeeWebcamFormat>(default(JsonSchema), default(ListTreeNode<JsonValue>));
|
|
||||||
GenericDeserializer<JsonValue, OpenSeeWebcam[]>.GenericArrayDeserializer<OpenSeeWebcam>(default(ListTreeNode<JsonValue>));
|
|
||||||
throw new InvalidOperationException("This method is used for AOT code generation only. Do not call it at runtime.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue