Module vcr4j.core

Class SchedulerVideoIO<S extends VideoState,E extends VideoError>

java.lang.Object
org.mbari.vcr4j.decorators.SchedulerVideoIO<S,E>
All Implemented Interfaces:
Closeable, AutoCloseable, Decorator, VideoIO<S,E>

public class SchedulerVideoIO<S extends VideoState,E extends VideoError> extends Object implements VideoIO<S,E>, Decorator
Decorator that moves the IO off of the currently executing thread. All commands are sent from a single independent thread (not managed by any scheduler or executor). All other observables have their state dealt with on the Executor or Scheduler that you provide.
Since:
2016-02-11T14:38:00
Author:
Brian Schlining
  • Constructor Details

    • SchedulerVideoIO

      public SchedulerVideoIO(VideoIO<S,E> io, Executor executor)
    • SchedulerVideoIO

      public SchedulerVideoIO(VideoIO<S,E> io, io.reactivex.rxjava3.core.Scheduler scheduler)
  • Method Details

    • unsubscribe

      public void unsubscribe()
      Description copied from interface: Decorator
      Tells the decorator to unsubscribe from all Observables that it is watching.
      Specified by:
      unsubscribe in interface Decorator
    • send

      public void send(VideoCommand videoCommand)
      Description copied from interface: VideoIO
      Send a command to the video player
      Specified by:
      send in interface VideoIO<S extends VideoState,E extends VideoError>
      Parameters:
      videoCommand - The command to send
    • getCommandSubject

      public io.reactivex.rxjava3.subjects.Subject<VideoCommand<?>> getCommandSubject()
      Description copied from interface: VideoIO
      We foresee needing to chain several VideoIO services together. The current plan is to use RX to monitor commands sent between different services so that one may augment anothers capabilities. For example, we may talk to a video player, but also need to fetch information from a Media Asset Manager simultaneously to get recorded dates for each frame.
      Specified by:
      getCommandSubject in interface VideoIO<S extends VideoState,E extends VideoError>
      Returns:
      A Subject that is the pipeline for all commands sent to the VideoIO provider
    • getConnectionID

      public String getConnectionID()
      Specified by:
      getConnectionID in interface VideoIO<S extends VideoState,E extends VideoError>
      Returns:
      A string unique to the particular video io connection
    • close

      public void close()
      Description copied from interface: VideoIO
      Close the video io and free it's resources.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface VideoIO<S extends VideoState,E extends VideoError>
    • getErrorObservable

      public io.reactivex.rxjava3.core.Observable<E> getErrorObservable()
      Description copied from interface: VideoIO
      All errors that occur will be sent to this observable
      Specified by:
      getErrorObservable in interface VideoIO<S extends VideoState,E extends VideoError>
      Returns:
      stream of errors
    • getStateObservable

      public io.reactivex.rxjava3.core.Observable<S> getStateObservable()
      Description copied from interface: VideoIO
      Listen to this observable for responses to status requests
      Specified by:
      getStateObservable in interface VideoIO<S extends VideoState,E extends VideoError>
      Returns:
      Status stream
    • getIndexObservable

      public io.reactivex.rxjava3.core.Observable<VideoIndex> getIndexObservable()
      Specified by:
      getIndexObservable in interface VideoIO<S extends VideoState,E extends VideoError>
      Returns:
      THis observable streams timecode/elapsedtime/timestamp responses.