123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Iisu;
- namespace bbiwarg.InputProviders
- {
- class VideoInputProvider : InputProvider
- {
- public override int CurrentFrame { get { return currentMovieFrame.Value; } }
- public String MoviePath { get; private set; }
- public bool IsPaused { get { return (playStep.Value == 0); } }
- private IParameterHandle<int> currentMovieFrame;
- private IParameterHandle<int> playStep;
- public VideoInputProvider(String moviePath)
- {
- MoviePath = moviePath;
- }
- protected override IDeviceConfiguration createDeviceConfiguration()
- {
- IDeviceConfiguration conf = base.createDeviceConfiguration();
- conf.MoviePath = MoviePath;
- return conf;
- }
- protected override void registerHandles()
- {
- base.registerHandles();
- device.RegisterParameterHandle<int>("SOURCE.MOVIE.PlayMode").Value = 1; // 0=once, 1=loop, 2=pingPong
- currentMovieFrame = device.RegisterParameterHandle<int>("SOURCE.MOVIE.CurrentFrame");
- playStep = device.RegisterParameterHandle<int>("SOURCE.MOVIE.PlayStep");
- }
- public void pause()
- {
- playStep.Value = 0;
- Console.WriteLine("pause");
- }
- public void play()
- {
- playStep.Value = 1;
- Console.WriteLine("play");
- }
- public void nextFrame()
- {
- playStep.Value = 1;
- int nextFrame = currentMovieFrame.Value + 1;
- while (currentMovieFrame.Value != nextFrame)
- {
- device.UpdateFrame(false);
- device.ReleaseFrame();
- }
- playStep.Value = 0;
- Console.WriteLine("nextFrame");
- }
- public void previousFrame()
- {
- playStep.Value = -1;
- int previousFrame = currentMovieFrame.Value - 1;
- while (currentMovieFrame.Value != previousFrame)
- {
- device.UpdateFrame(false);
- device.ReleaseFrame();
- }
- playStep.Value = 0;
- Console.WriteLine("previousFrame");
- }
- }
- }
|