Package com.banuba.sdk.input
Class VideoInput
java.lang.Object
com.banuba.sdk.input.VideoInput
- All Implemented Interfaces:
IAttachable,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 ClassesModifier and TypeClassDescriptionstatic interfaceCallback with video processing status -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidattach()Called by thePlayerwhen the new input is added to the Player using the 'use()' methodvoiddetach()Called by thePlayerwhen the input will be changed to a new input, or when the Playercom.banuba.sdk.effect_player.FrameProcessorGet last available frameLinkedList<android.util.Pair<android.media.MediaCodec.BufferInfo,ByteBuffer>> Audio data.android.media.MediaFormatAudio format.longGet timestamp of the current frame.voidprocessVideoFile(File inputFile, VideoInput.IVideoFrameStatus videoStatusCallback) Start processing the videovoidStop processing the videofile
-
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:
getAudioFormatin interfaceIAudioDataProvider- 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:
getAudioDatain interfaceIAudioDataProvider- 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 videofilevideoStatusCallback- 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:
frameProcessorin interfaceIInput- Returns:
- frameProcessor with filled frameData
-
getFrameTimeNanos
public long getFrameTimeNanos()Get timestamp of the current frame.- Specified by:
getFrameTimeNanosin interfaceIInput- Returns:
- timestamp
-
attach
public void attach()Description copied from interface:IAttachableCalled by thePlayerwhen the new input is added to the Player using the 'use()' method- Specified by:
attachin interfaceIAttachable
-
detach
public void detach()Description copied from interface:IAttachableCalled by thePlayerwhen the input will be changed to a new input, or when the Player- Specified by:
detachin interfaceIAttachable
-