コード例 #1
0
    /* Startup the node, opens the file */
    void Start()
    {
        m_event_processor = SingletonService <EventProcessor> .GetSingleton();

        m_manager = SingletonService <HPV_Manager> .GetSingleton();

        if (!m_event_processor)
        {
            Debug.LogError("Make sure there is exactly ONE EventProcessor.cs script in the scene.");
            return;
        }

        if (!m_manager)
        {
            Debug.LogError("Make sure there is exactly ONE HPV_Manager.cs script present in the scene.");
            return;
        }

        // init the player
        int node_id = m_manager.initPlayer(new HPVEventDelegate(onHPVEvent));

        if (node_id >= 0)
        {
            m_node_id = (byte)node_id;
            //string filepath = Application.streamingAssetsPath + "/../../" + filename;
            string filepath = filename;
            int    ret      = m_manager.openVideo(m_node_id, filepath);
            if (ret == 1)
            {
                // store parameters of the file
                int fps = m_manager.getFrameRate(m_node_id);
                width  = m_manager.getWidth(m_node_id);
                height = m_manager.getHeight(m_node_id);
                int number_of_frames = m_manager.getNumberOfFrames(m_node_id);
                hpv_type = m_manager.getCompressionType(m_node_id);

                /* If state == internal, video will play using internal clock. This call also sets loop mode to LOOP */
                m_manager.setSyncState(m_node_id, HPV_Unity_Bridge.HPVSyncState.HPV_SYNC_INTERNAL);
                /* ... else, wait for external sync, using one of the seek methods */
                //m_manager.setSyncState(m_node_id, HPV_Unity_Bridge.HPVSyncState.HPV_SYNC_EXTERNAL);

                //Debug.Log("Opened video " + filename + " with total of " + number_of_frames + " of frames and dimensions " + width + "x" + height + " @ " + fps + "fps [TYPE: " + HPV_Unity_Bridge.HPVCompressionTypeStrings[(int)hpv_type] + "]");
                b_needs_init = true;
            }
        }
        else
        {
            Debug.LogError("Couldn't create new HPV_Video node!");
        }
    }
コード例 #2
0
ファイル: HPV_Node.cs プロジェクト: antoniohof/Holo_Toolset
    /* Startup the node, opens the file */
    void Start()
    {
        m_event_processor = SingletonService <EventProcessor> .GetSingleton();

        m_manager = SingletonService <HPV_Manager> .GetSingleton();

        if (!m_event_processor)
        {
            Debug.LogError("Make sure there is exactly ONE EventProcessor.cs script in the scene.");
            return;
        }

        if (!m_manager)
        {
            Debug.LogError("Make sure there is exactly ONE HPV_Manager.cs script present in the scene.");
            return;
        }

        // init the player
        int node_id = m_manager.initPlayer(new HPVEventDelegate(onHPVEvent));

        if (node_id >= 0)
        {
            m_node_id = (byte)node_id;
            string filepath = Application.streamingAssetsPath + "/../../" + filename;
            int    ret      = m_manager.openVideo(m_node_id, filepath);

            if (ret == 1)
            {
                // store parameters of the file
                int fps = m_manager.getFrameRate(m_node_id);
                width  = m_manager.getWidth(m_node_id);
                height = m_manager.getHeight(m_node_id);
                int number_of_frames = m_manager.getNumberOfFrames(m_node_id);
                hpv_type = m_manager.getCompressionType(m_node_id);

                ret = m_manager.startVideo(m_node_id);
                ret = m_manager.setLoopState(m_node_id, 1);

                Debug.Log("Opened video " + filename + " with total of " + number_of_frames + " of frames and dimensions " + width + "x" + height + " @ " + fps + "fps [TYPE: " + HPV_Unity_Bridge.HPVCompressionTypeStrings[(int)hpv_type] + "]");
                b_needs_init = true;
            }
        }
        else
        {
            Debug.LogError("Couldn't create new HPV_Video node!");
        }
    }