Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        rimg.transform.parent.gameObject.SetActive(false);
        mat = rimg.material;
#if UNITY_EDITOR
        StreamDecoder.dllPath = Application.streamingAssetsPath + "/../../../../bin/";
#else
        StreamDecoder.dllPath = Application.streamingAssetsPath + "/../../../../../bin/";
#endif
        adbController.adbPath = StreamDecoder.dllPath + "adb.exe";

        //启动ADB
        adbController.AdbStartServer();


        StreamDecoder.LoadLibrary();
        player = StreamPlayer.CreateSession();
        player.SetOption(OptionType.DataCacheSize, 2000000);
        player.SetOption(OptionType.DemuxTimeout, 2000);
        //player.SetOption(OptionType.PushFrameInterval, 0);
        player.SetOption(OptionType.AlwaysWaitBitStream, 1);
        //player.SetOption(OptionType.WaitBitStreamTimeout, waitBitStreamTimeout);
        player.SetOption(OptionType.AutoDecode, 1);
        player.SetOption(OptionType.DecodeThreadCount, 0);
        //player.SetOption(OptionType.UseCPUConvertYUV, 0);
        //player.SetOption(OptionType.ConvertPixelFormat, (int)PixelFormat.RGBA);
        //player.SetOption(OptionType.AsyncUpdate, 0);
        player.SetPlayerCb(null, OnFrame);
    }
Exemplo n.º 2
0
    public void CreateSession()
    {
        if (player != null)
        {
            return;
        }

        player = StreamPlayer.CreateSession();
        player.SetOption(OptionType.DataCacheSize, bitStreamCacheSize);
        player.SetOption(OptionType.DemuxTimeout, demuxTimeout);
        player.SetOption(OptionType.PushFrameInterval, pushFrameInterval);
        player.SetOption(OptionType.AlwaysWaitBitStream, alwaysWaitBitStream ? 1 : 0);
        player.SetOption(OptionType.WaitBitStreamTimeout, waitBitStreamTimeout);
        player.SetOption(OptionType.AutoDecode, autoDecode ? 1 : 0);
        player.SetOption(OptionType.DecodeThreadCount, decodeThreadCount);
        player.SetOption(OptionType.UseCPUConvertYUV, useCPUConvertYUV ? 1 : 0);
        player.SetOption(OptionType.ConvertPixelFormat, (int)PixelFormat.RGBA);
        player.SetOption(OptionType.AsyncUpdate, 0);
        player.SetEventCallBack(OnEvent, OnDrawFrame, this);
    }