Example #1
0
    void CreateMovie()
    {
        if (mInternalCreateDelay > 0)
        {
            mInternalCreateDelay -= Time.deltaTime;
            return;
        }

        DebugLog("Creating movie...");

        try
        {
            mMovie = new PopMovie(filename, MovieParams);
            if (mEnableDebugLog)
            {
                PopMovie.EnableDebugLog = mEnableDebugLog;
            }

            //	gr: temporarily removed from PopMovie, should be moved to your own controller
            //mMovie.AddOnFinishedCallback( OnFinished );
        }
        catch (System.Exception e)
        {
            Debug.LogError("Error creating PopMovieTexture: " + e.Message);
        }
    }
	void UpdateMovie()
	{
		//	queue not initialised (we haven't started)
		if ( mFilenameQueue == null )
			return;

		//	see if movie is finished to move onto next
		if (mMovie != null) {
			//	check duration
			var Duration = mMovie.GetDurationMs();
			var CurrentTime = mMovie.GetTimeMs();
			if ( Duration > 0 && CurrentTime >= Duration && CurrentTime > (mMinDuration*1000.0f) )
			{
				mMovie = null;
				System.GC.Collect();
			}
			else
			{
				//Debug.Log("Current duration: " + CurrentTime + "/" + Duration );
			}
		}

		//	need to alloc next
		if (mMovie == null) {


			if (mFilenameQueue.Count == 0) {
				Debug.Log("queue finished.... ");
				OnFinished ();
				return;
			}

			var Filename = mFilenameQueue [0];
			mFilenameQueue.RemoveAt (0);

			var Params = new PopMovieParams ();
			Params.mGenerateMipMaps = mGenerateMipMaps;
			Params.mPixelClientStorage = mUseClientPixelStorage;

			//Params.mSkipPushFrames = true;
			try {
				mMovie = new PopMovie (Filename, Params, true);
				
				if (mEnableDebugLog)
					mMovie.AddDebugCallback (Debug.Log);
			} catch (System.Exception e) {
				Debug.LogError ("Error creating movie; " + e.Message);
				if (mErrorText != null)
					mErrorText.text = e.Message;
			}
		}

		if (mMovie != null)
			mMovie.Update ();
	}
    void Update()
    {
        mRefreshCountdown -= Time.deltaTime;
        if (mRefreshCountdown < 0)
        {
            EnumSources();
            mRefreshCountdown = RefreshRate;
        }

        PopMovie.FlushDebug((string s) => { Debug.Log(s); });
    }
Example #4
0
    void OnFinished()
    {
        Debug.Log("Movie has finished");

        if (mLooping)
        {
            mMovie = null;
            GC.Collect();
            mInternalCreateDelay = mCreateDelay;
        }
    }
	public void StopMovie()
	{
		//	delete current movie (to "try and go to next")
		mMovie = null;
		System.GC.Collect();

		//	clear queue so we don't go to another
		if (mFilenameQueue != null)
			mFilenameQueue.Clear ();

		UpdateMovie ();
	}
 void Start()
 {
     try
     {
         PopMovieParams Params = new PopMovieParams();
         mMovie = new PopMovie(mFilename, Params, false);
         mMovie.AddDebugCallback(Debug.Log);
     }
     catch (System.Exception e)
     {
         Debug.LogError(e.Message);
     }
 }
 void Start()
 {
     try
     {
         PopMovieParams Params = new PopMovieParams();
         mMovie = new PopMovie(mFilename, Params);
         PopMovie.EnableDebugLog = true;
     }
     catch (System.Exception e)
     {
         Debug.LogError(e.Message);
     }
 }
    public void StopMovie()
    {
        //	delete current movie (to "try and go to next")
        mMovie = null;
        System.GC.Collect();

        //	clear queue so we don't go to another
        if (mFilenameQueue != null)
        {
            mFilenameQueue.Clear();
        }

        UpdateMovie();
    }
    void EnumSources()
    {
        PopMovie.EnumDirectory(Application.streamingAssetsPath, true);
        PopMovie.EnumDirectory(Application.persistentDataPath, true);
        PopMovie.EnumDirectory(PopMovie.FilenamePrefix_Sdcard, true);

        var Source = PopMovie.EnumSource(mIndex);

        if (Source == null)
        {
            return;
        }
        AddSource(Source, mIndex);

        mIndex++;
    }
Example #10
0
    void CreateMovie()
    {
        if (mInternalCreateDelay > 0)
        {
            mInternalCreateDelay -= Time.deltaTime;
            return;
        }

        DebugLog("Creating movie...");

        PopMovieParams Params = new PopMovieParams();

        Params.mPreSeekMs                 = (ulong)(mPreSeekSecs * 1000.0f);
        Params.mSkipPushFrames            = mSkipPushFrames;
        Params.mSkipPopFrames             = mSkipPopFrames;
        Params.mAllowGpuColourConversion  = mAllowGpuColourConversion;
        Params.mAllowCpuColourConversion  = mAllowCpuColourConversion;
        Params.mPixelClientStorage        = mPixelClientStorage;
        Params.mAllowFastCopy             = mAllowFastCopy;
        Params.mAllowSlowCopy             = mAllowSlowCopy;
        Params.mDebugFrameSkipping        = mDebugFrameSkipping;
        Params.mPeekBeforeDefferedCopy    = mPeekBeforeDefferedCopy;
        Params.mDebugNoNewPixelBuffer     = mDebugNoNewPixelBuffer;
        Params.mDebugRenderThreadCallback = mDebugRenderThreadCallback;
        Params.mResetInternalTimestamp    = mResetInternalTimestamp;
        Params.mDebugBlit                 = mDebugBlit;
        Params.mApplyVideoTransform       = mApplyVideoTransform;
        Params.mPopNearestFrame           = mPopNearestFrame;
        Params.mGenerateMipMaps           = mGenerateMipMaps;
        Params.mStretchImage              = mStretchToFillTexture;
        Params.mDecoderUseHardwareBuffer  = mDecoderUseHardwareBuffer;

        try
        {
            mMovie = new PopMovie(filename, Params, true);
            if (mEnableDebugLog)
            {
                mMovie.AddDebugCallback(DebugLog);
            }
            mMovie.AddOnFinishedCallback(OnFinished);
        }
        catch (System.Exception e)
        {
            Debug.LogError("Error creating PopMovieTexture: " + e.Message);
        }
    }
    void EnumSources()
    {
        var Sources = PopMovie.EnumSources();

        if (Sources == null)
        {
            UpdateOutput("No sources found, error?");
            return;
        }
        string Output = "";

        foreach (string Source in Sources)
        {
            Output += Source + "\n";
        }
        UpdateOutput(Output);
        return;
    }
Example #12
0
    void UpdateSources()
    {
        //	enum sources
        var Sources = PopMovie.EnumSources(IncludeFilter, ExcludeFilter, 50000, IncludeDirectory);

        if (Sources != null)
        {
            foreach (var Filename in Sources)
            {
                if (mFilenamesAndDiscoveryTime.ContainsKey(Filename))
                {
                    continue;
                }

                OnFoundFilename(Filename);
            }
        }
    }
Example #13
0
    void Update()
    {
        if (mMovie == null)
        {
            var Params = new PopMovieParams();
            mMovie = new PopMovie(mFilename, Params, true);
            mMovie.AddDebugCallback(Debug.Log);
        }

        if (mMovie != null)
        {
            mMovie.Update();

            if (mTarget != null)
            {
                mMovie.UpdateTexture(mTarget, 0);
            }
        }
    }
Example #14
0
    public void SetFilename(string Filename)
    {
        mFilename = Filename;

        //	init
        try
        {
            PopMovieParams Params = new PopMovieParams();
            mMovie = new PopMovie(Filename, Params, true);
        }
        catch (System.Exception e)
        {
            mMovie = null;
            ShowError(e.Message);
        }

        mTexture = new RenderTexture(mTextureWidth, mTextureHeight, 0);
        AssignTexture();
    }
	public void SetFilename(string Filename)
	{
		mFilename = Filename;

		//	init
		try
		{
			PopMovieParams Params = new PopMovieParams();
			mMovie = new PopMovie( Filename, Params, true );
		}
		catch(System.Exception e)
		{
			mMovie = null;
			ShowError( e.Message );
		}
	
		mTexture = new RenderTexture( mTextureWidth, mTextureHeight, 0 );
		AssignTexture();
	}
Example #16
0
 void OnDisable()
 {
     mMovie = null;
     //	force cleanup now
     GC.Collect();
 }
    void UpdateMovie()
    {
        //	queue not initialised (we haven't started)
        if (mFilenameQueue == null)
        {
            return;
        }

        //	see if movie is finished to move onto next
        if (mMovie != null)
        {
            //	check duration
            var Duration    = mMovie.GetDurationMs();
            var CurrentTime = mMovie.GetTimeMs();
            if (Duration > 0 && CurrentTime >= Duration)
            {
                mMovie = null;
                System.GC.Collect();
            }
            else
            {
                //Debug.Log("Current duration: " + CurrentTime + "/" + Duration );
            }
        }

        //	need to alloc next
        if (mMovie == null)
        {
            if (mFilenameQueue.Count == 0)
            {
                Debug.Log("queue finished.... ");
                OnFinished();
                return;
            }

            var Filename = mFilenameQueue [0];
            mFilenameQueue.RemoveAt(0);

            var Params = new PopMovieParams();
            //Params.mSkipPushFrames = true;
            try {
                mMovie = new PopMovie(Filename, Params, true);

                if (mEnableDebugLog)
                {
                    mMovie.AddDebugCallback(Debug.Log);
                }
            } catch (System.Exception e) {
                Debug.LogError("Error creating movie; " + e.Message);
                if (mErrorText != null)
                {
                    mErrorText.text = e.Message;
                }
            }
        }

        if (mMovie != null)
        {
            mMovie.Update();
        }
    }