Пример #1
0
        private void getTextureFromNative()
        {
            ReleaseTexture();

            var nativeTexturePtrY = new IntPtr();
            var nativeTexturePtrU = new IntPtr();
            var nativeTexturePtrV = new IntPtr();

            DecoderNative.nativeCreateTexture(decoderID, ref nativeTexturePtrY, ref nativeTexturePtrU,
                                              ref nativeTexturePtrV);
            videoTexYch = Texture2D.CreateExternalTexture(
                videoWidth, videoHeight, TextureFormat.Alpha8, false, false, nativeTexturePtrY);
            videoTexUch = Texture2D.CreateExternalTexture(
                videoWidth / 2, videoHeight / 2, TextureFormat.Alpha8, false, false, nativeTexturePtrU);
            videoTexVch = Texture2D.CreateExternalTexture(
                videoWidth / 2, videoHeight / 2, TextureFormat.Alpha8, false, false, nativeTexturePtrV);
        }
Пример #2
0
        //  Render event

        private void getTextureFromNative()
        {
            releaseTextures();
            var nativeTexturePtrY = new IntPtr();
            var nativeTexturePtrU = new IntPtr();
            var nativeTexturePtrV = new IntPtr();
            var duration          = 0.0f;

            DecoderNative.nativeGetVideoFormat(decoderID, ref videoWidth, ref videoHeight, ref duration);
            videoTotalTime = duration > 0 ? duration : -1.0f;
            print(LOG_TAG + " Video format: (" + videoWidth + ", " + videoHeight + ")");
            if (videoTotalTime > 0)
            {
                print(LOG_TAG + " Total time: " + videoTotalTime);
            }
            DecoderNative.nativeCreateTexture(decoderID, ref nativeTexturePtrY, ref nativeTexturePtrU, ref nativeTexturePtrV);
            videoTexYch = Texture2D.CreateExternalTexture(videoWidth, videoHeight, TextureFormat.Alpha8, false, false, nativeTexturePtrY);
            videoTexUch = Texture2D.CreateExternalTexture(videoWidth / 2, videoHeight / 2, TextureFormat.Alpha8, false, false, nativeTexturePtrU);
            videoTexVch = Texture2D.CreateExternalTexture(videoWidth / 2, videoHeight / 2, TextureFormat.Alpha8, false, false, nativeTexturePtrV);
        }