Class VideoInput

java.lang.Object
com.banuba.sdk.input.VideoInput
All Implemented Interfaces:
IAttachable, IInput, IAudioDataProvider

public class VideoInput extends Object implements IInput, IAudioDataProvider
The video input provides the ability to transfer a video file to the video processor. Uses synchronous processor, so frames cannot be dropped in case of `Player` latency.
  • Constructor Details

    • VideoInput

      public VideoInput()
      Create an instance of the VideoInput
  • Method Details

    • getAudioFormat

      @Nullable public android.media.MediaFormat getAudioFormat()
      Audio format. Available only when video processing has already started.
      Specified by:
      getAudioFormat in interface IAudioDataProvider
      Returns:
      audio format or null if there is no audio data or processing has not started
    • getAudioData

      @Nullable public LinkedList<android.util.Pair<android.media.MediaCodec.BufferInfo,ByteBuffer>> getAudioData()
      Audio data. Available only when video processing has already started.
      Specified by:
      getAudioData in interface IAudioDataProvider
      Returns:
      audio data or null if there is no audio data or processing has not started
    • processVideoFile

      public void processVideoFile(@NonNull File inputFile, @NonNull VideoInput.IVideoFrameStatus videoStatusCallback)
      Start processing the video
      Parameters:
      inputFile - path to the videofile
      videoStatusCallback - the callback calls the methods in the following order: .onStart() - Called when decoding starts successfully, only once. .onFrame() - Called on every decoded frame, after .onStart() but before .onFinish() .onFinish() - Called when decoding is complete and only if .onStart() was called .onError() - Called in any order when any error occurs
    • stopProcessing

      public void stopProcessing()
      Stop processing the videofile
    • frameProcessor

      @NonNull public com.banuba.sdk.effect_player.FrameProcessor frameProcessor()
      Get last available frame
      Specified by:
      frameProcessor in interface IInput
      Returns:
      frameProcessor with filled frameData
    • getFrameTimeNanos

      public long getFrameTimeNanos()
      Get timestamp of the current frame.
      Specified by:
      getFrameTimeNanos in interface IInput
      Returns:
      timestamp
    • attach

      public void attach()
      Description copied from interface: IAttachable
      Called by the Player when the new input is added to the Player using the 'use()' method
      Specified by:
      attach in interface IAttachable
    • detach

      public void detach()
      Description copied from interface: IAttachable
      Called by the Player when the input will be changed to a new input, or when the Player
      Specified by:
      detach in interface IAttachable