Replace naudio.dll with code
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ba14ea67cbf77c64a830d06c4509d0f8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3e43bf2102ffb8146a97ee8251425939
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cceabf142838dcb4a8a13baa3d5f491a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+227
@@ -0,0 +1,227 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2015 CRI Middleware Co., Ltd.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if UNITY_EDITOR_OSX || (!UNITY_EDITOR && UNITY_STANDALONE_OSX)
|
||||
using UnityEngine;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace CriWare {
|
||||
|
||||
namespace CriMana.Detail
|
||||
{
|
||||
public static partial class AutoResisterRendererResourceFactories
|
||||
{
|
||||
[RendererResourceFactoryPriority(7000)]
|
||||
public class RendererResourceFactoryOSXH264Yuv : RendererResourceFactory
|
||||
{
|
||||
public override RendererResource CreateRendererResource(int playerId, MovieInfo movieInfo, bool additive, Shader userShader)
|
||||
{
|
||||
bool isCodecSuitable = movieInfo.codecType == CodecType.H264;
|
||||
bool isSuitable = isCodecSuitable;
|
||||
return isSuitable
|
||||
? new RendererResourceOSXH264Yuv(playerId, movieInfo, additive, userShader)
|
||||
: null;
|
||||
}
|
||||
|
||||
protected override void OnDisposeManaged()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDisposeUnmanaged()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class RendererResourceOSXH264Yuv : RendererResource
|
||||
{
|
||||
private int width;
|
||||
private int height;
|
||||
private int playerId;
|
||||
private bool useUserShader;
|
||||
private Vector4 movieTextureST = Vector4.zero;
|
||||
private Texture2D[] textures;
|
||||
private RenderTexture[] renderTextures;
|
||||
System.IntPtr[] nativePtrs;
|
||||
private bool isStoppingForSeek = false;
|
||||
private bool isStartTriggered = true;
|
||||
private bool hasRenderedNewFrame = false;
|
||||
|
||||
public RendererResourceOSXH264Yuv(int playerId, MovieInfo movieInfo, bool additive, Shader userShader)
|
||||
{
|
||||
this.width = (int)movieInfo.width;
|
||||
this.height = (int)movieInfo.height;
|
||||
this.playerId = playerId;
|
||||
this.hasAlpha = movieInfo.hasAlpha;
|
||||
this.additive = additive;
|
||||
this.useUserShader = userShader != null;
|
||||
|
||||
if (userShader != null) {
|
||||
shader = userShader;
|
||||
} else {
|
||||
string shaderName = "CriMana/OSXH264Yuv";
|
||||
shader = Shader.Find(shaderName);
|
||||
}
|
||||
|
||||
if (hasAlpha) {
|
||||
nativePtrs = new System.IntPtr[2];
|
||||
} else {
|
||||
nativePtrs = new System.IntPtr[1];
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDisposeManaged()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDisposeUnmanaged()
|
||||
{
|
||||
DisposeTextures(textures);
|
||||
DisposeTextures(renderTextures);
|
||||
textures = null;
|
||||
renderTextures = null;
|
||||
currentMaterial = null;
|
||||
}
|
||||
|
||||
public override bool IsPrepared()
|
||||
{ return true; }
|
||||
|
||||
public override bool ContinuePreparing()
|
||||
{ return true; }
|
||||
|
||||
public override bool IsSuitable(int playerId, MovieInfo movieInfo, bool additive, Shader userShader)
|
||||
{
|
||||
bool isCodecSuitable = movieInfo.codecType == CodecType.H264;
|
||||
bool isAlphaSuitable = hasAlpha == movieInfo.hasAlpha;
|
||||
bool isAdditiveSuitable = this.additive == additive;
|
||||
bool isShaderSuitable = this.useUserShader ? (userShader == shader) : true;
|
||||
return isCodecSuitable && isAlphaSuitable && isAdditiveSuitable && isShaderSuitable;
|
||||
}
|
||||
|
||||
public override bool OnPlayerStopForSeek()
|
||||
{
|
||||
isStoppingForSeek = true;
|
||||
isStartTriggered = false;
|
||||
if (renderTextures != null || textures == null) {
|
||||
return true;
|
||||
}
|
||||
renderTextures = new RenderTexture[hasAlpha ? 2 : 1];
|
||||
for (int i = 0; i < renderTextures.Length; i++) {
|
||||
Texture2D baseTexture = textures[i];
|
||||
RenderTexture texture = new RenderTexture(baseTexture.width, baseTexture.height, 0,
|
||||
i == 0 ? RenderTextureFormat.ARGB32 : RenderTextureFormat.R8);
|
||||
texture.Create();
|
||||
Graphics.Blit(baseTexture, texture);
|
||||
renderTextures[i] = texture;
|
||||
}
|
||||
forceUpdateMaterialTextures(renderTextures);
|
||||
DisposeTextures(textures);
|
||||
textures = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnPlayerStart()
|
||||
{
|
||||
isStartTriggered = true;
|
||||
}
|
||||
|
||||
public override bool HasRenderedNewFrame()
|
||||
{
|
||||
return hasRenderedNewFrame;
|
||||
}
|
||||
|
||||
private void forceUpdateMaterialTextures(Texture[] newTextures)
|
||||
{
|
||||
if (currentMaterial != null) {
|
||||
currentMaterial.mainTexture = newTextures[0];
|
||||
currentMaterial.SetTexture("_TextureRGB", newTextures[0]);
|
||||
if (hasAlpha) {
|
||||
currentMaterial.SetTexture("_TextureA", newTextures[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void AttachToPlayer(int playerId)
|
||||
{
|
||||
// reset texture if exist
|
||||
DisposeTextures(textures);
|
||||
textures = null;
|
||||
hasRenderedNewFrame = false;
|
||||
}
|
||||
|
||||
public override bool UpdateFrame(int playerId, FrameInfo frameInfo, ref bool frameDrop)
|
||||
{
|
||||
bool isFrameUpdated = CRIWARE9061FF01(playerId, 0, null, frameInfo, ref frameDrop);
|
||||
if (isFrameUpdated && !frameDrop) {
|
||||
UpdateMovieTextureST(frameInfo.dispWidth, frameInfo.dispHeight);
|
||||
}
|
||||
|
||||
return isFrameUpdated;
|
||||
}
|
||||
|
||||
public override bool UpdateMaterial(Material material)
|
||||
{
|
||||
if (currentMaterial != material) {
|
||||
if (textures != null || isStoppingForSeek) {
|
||||
currentMaterial = material;
|
||||
SetupStaticMaterialProperties();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
material.SetVector("_MovieTexture_ST", movieTextureST);
|
||||
if (textures != null && !isStoppingForSeek) {
|
||||
material.SetTexture("_TextureRGB", textures[0]);
|
||||
if (hasAlpha) {
|
||||
material.SetTexture("_TextureA", textures[1]);
|
||||
}
|
||||
DisposeTextures(renderTextures);
|
||||
renderTextures = null;
|
||||
hasRenderedNewFrame = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void UpdateMovieTextureST(System.UInt32 dispWidth, System.UInt32 dispHeight)
|
||||
{
|
||||
float uScale = (dispWidth != width) ? (float)(dispWidth - 0.5f) / width : 1.0f;
|
||||
float vScale = (dispHeight != height) ? (float)(dispHeight - 0.5f) / height : 1.0f;
|
||||
movieTextureST.x = uScale;
|
||||
movieTextureST.y = -vScale;
|
||||
movieTextureST.z = 0.0f;
|
||||
movieTextureST.w = vScale;
|
||||
}
|
||||
|
||||
public override void UpdateTextures()
|
||||
{
|
||||
for (int i = 0; i < nativePtrs.Length; i++) {
|
||||
nativePtrs[i] = System.IntPtr.Zero;
|
||||
}
|
||||
bool isTextureUpdated = CRIWAREDA63C3D7(playerId, nativePtrs.Length, nativePtrs);
|
||||
if (isTextureUpdated && nativePtrs[0] != System.IntPtr.Zero && isStartTriggered) {
|
||||
if (textures == null) {
|
||||
textures = new Texture2D[2];
|
||||
textures[0] = Texture2D.CreateExternalTexture(width, height, TextureFormat.BGRA32, false, false, nativePtrs[0]);
|
||||
textures[0].wrapMode = TextureWrapMode.Clamp;
|
||||
if (hasAlpha) {
|
||||
textures[1] = Texture2D.CreateExternalTexture(width, height, TextureFormat.R8, false, false, nativePtrs[1]);
|
||||
textures[1].wrapMode = TextureWrapMode.Clamp;
|
||||
}
|
||||
} else {
|
||||
textures[0].UpdateExternalTexture(nativePtrs[0]);
|
||||
if (hasAlpha) {
|
||||
textures[1].UpdateExternalTexture(nativePtrs[1]);
|
||||
}
|
||||
}
|
||||
isStoppingForSeek = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} //namespace CriWare
|
||||
|
||||
#endif
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 90d607173f1704c988704d3aed98260c
|
||||
timeCreated: 1461031521
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 18b37d25e817cb04f88473c6a7eb1f7f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7d05e68ec8b2ea84f9fc2b883101751e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9586ec280901aae4d876151aee8ab969
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
Shader "CriMana/OSXH264Yuv"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Texture", 2D) = "white" {}
|
||||
[HideInInspector] _MovieTexture_ST ("MovieTexture_ST", Vector) = (1.0, 1.0, 0, 0)
|
||||
[HideInInspector] _TextureRGB("TextureRGB", 2D) = "white" {}
|
||||
[HideInInspector] _TextureA("TextureA", 2D) = "white" {}
|
||||
[HideInInspector] _SrcBlendMode("SrcBlendMode", Int) = 0
|
||||
[HideInInspector] _DstBlendMode("DstBlendMode", Int) = 0
|
||||
[HideInInspector] _CullMode("CullMode", Int) = 2
|
||||
[HideInInspector] _ZWriteMode("ZWriteMode", Int) = 1
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"Queue" = "Transparent"
|
||||
"PreviewType"="Plane"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Blend [_SrcBlendMode] [_DstBlendMode]
|
||||
Cull [_CullMode]
|
||||
ZWrite [_ZWriteMode]
|
||||
ZTest [unity_GUIZTestMode]
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
#pragma multi_compile _ CRI_ALPHA_MOVIE
|
||||
#pragma multi_compile _ CRI_APPLY_TARGET_ALPHA
|
||||
#pragma multi_compile _ CRI_LINEAR_COLORSPACE
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
half2 texcoord : TEXCOORD0;
|
||||
#ifdef CRI_APPLY_TARGET_ALPHA
|
||||
float4 color : COLOR;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
half2 uv : TEXCOORD0;
|
||||
#ifdef CRI_APPLY_TARGET_ALPHA
|
||||
float4 color : COLOR;
|
||||
#endif
|
||||
};
|
||||
|
||||
float4 _MainTex_ST;
|
||||
float4 _MovieTexture_ST;
|
||||
|
||||
v2f vert(appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = (TRANSFORM_TEX(v.texcoord, _MainTex) * _MovieTexture_ST.xy) + _MovieTexture_ST.zw;
|
||||
#ifdef CRI_APPLY_TARGET_ALPHA
|
||||
o.color = v.color;
|
||||
#endif
|
||||
return o;
|
||||
}
|
||||
|
||||
sampler2D _TextureRGB;
|
||||
#ifdef CRI_ALPHA_MOVIE
|
||||
sampler2D _TextureA;
|
||||
#endif
|
||||
fixed _Transparency;
|
||||
|
||||
fixed4 frag(v2f i) : COLOR
|
||||
{
|
||||
fixed4 color = tex2D(_TextureRGB, i.uv);
|
||||
#ifdef CRI_ALPHA_MOVIE
|
||||
fixed4 alpha = tex2D(_TextureA, i.uv);
|
||||
color.a = alpha.r;
|
||||
#endif
|
||||
#ifdef CRI_LINEAR_COLORSPACE
|
||||
color.rgb = pow(max(color.rgb, 0), 2.2);
|
||||
#endif
|
||||
#ifdef CRI_APPLY_TARGET_ALPHA
|
||||
color.a = color.a * i.color.a;
|
||||
#endif
|
||||
color.a *= 1 - _Transparency;
|
||||
|
||||
return color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3ecadf8cf71554c599b839bc4a1933ec
|
||||
timeCreated: 1461226273
|
||||
licenseType: Pro
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f94522956777deb4e8d972962d38163b
|
||||
folderAsset: yes
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88559606d836bf24a993061c34c02e08
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>20G165</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>cri_ware_unity</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>CRI-MIddleware.cri-ware-unity</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>cri_ware_unity</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
<array>
|
||||
<string>MacOSX</string>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>12E262</string>
|
||||
<key>DTPlatformName</key>
|
||||
<string>macosx</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>11.3</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>20E214</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx11.3</string>
|
||||
<key>DTXcode</key>
|
||||
<string>1250</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>12E262</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.8</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2011 CRI Middleware Co., Ltd. All rights reserved.</string>
|
||||
</dict>
|
||||
</plist>
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 46f76bc75ce101d4296a6a2cf1a54468
|
||||
timeCreated: 1433816075
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b42da6358acfc714f824d34950105eaa
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Binary file not shown.
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 389f1b8cdccb3dd41b4ce4196bebdf2c
|
||||
timeCreated: 1433816075
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user