Class VideoInput

  • All Implemented Interfaces:
    IAttachable, IInput, IAudioDataProvider

    public class VideoInput
    extends java.lang.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.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  VideoInput.IVideoFrameStatus
      Callback with video processing status
    • Constructor Summary

      Constructors 
      Constructor Description
      VideoInput()
      Create an instance of the VideoInput
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void attach()
      Called by the Player when the new input is added to the Player using the 'use()' method
      void detach()
      Called by the Player when the input will be changed to a new input, or when the Player
      com.banuba.sdk.effect_player.FrameProcessor frameProcessor()
      Get last available frame
      java.util.LinkedList<android.util.Pair<android.media.MediaCodec.BufferInfo,​java.nio.ByteBuffer>> getAudioData()
      Audio data.
      android.media.MediaFormat getAudioFormat()
      Audio format.
      long getFrameTimeNanos()
      Get timestamp of the current frame.
      void processVideoFile​(java.io.File inputFile, VideoInput.IVideoFrameStatus videoStatusCallback)
      Start processing the video
      void stopProcessing()
      Stop processing the videofile
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • VideoInput

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

      • 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 java.util.LinkedList<android.util.Pair<android.media.MediaCodec.BufferInfo,​java.nio.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
                                     java.io.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