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
Modifier and TypeClassDescriptionstatic interface
Callback with video processing status -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
attach()
Called by thePlayer
when the new input is added to the Player using the 'use()' methodvoid
detach()
Called by thePlayer
when the input will be changed to a new input, or when the Playercom.banuba.sdk.effect_player.FrameProcessor
Get last available frameLinkedList<android.util.Pair<android.media.MediaCodec.BufferInfo,
ByteBuffer>> Audio data.android.media.MediaFormat
Audio format.long
Get timestamp of the current frame.void
processVideoFile
(File inputFile, VideoInput.IVideoFrameStatus videoStatusCallback) Start processing the videovoid
Stop 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:
getAudioFormat
in 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:
getAudioData
in 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:
frameProcessor
in interfaceIInput
- Returns:
- frameProcessor with filled frameData
-
getFrameTimeNanos
public long getFrameTimeNanos()Get timestamp of the current frame.- Specified by:
getFrameTimeNanos
in interfaceIInput
- Returns:
- timestamp
-
attach
public void attach()Description copied from interface:IAttachable
Called by thePlayer
when the new input is added to the Player using the 'use()' method- Specified by:
attach
in interfaceIAttachable
-
detach
public void detach()Description copied from interface:IAttachable
Called by thePlayer
when the input will be changed to a new input, or when the Player- Specified by:
detach
in interfaceIAttachable
-