Package com.banuba.sdk.input
Class VideoInput
- java.lang.Object
-
- com.banuba.sdk.input.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 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
frameProcessor()
Get last available framejava.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 videovoid
stopProcessing()
Stop processing the videofile
-
-
-
Method Detail
-
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 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 interfaceIAudioDataProvider
- 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 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
-
-