-
- All Implemented Interfaces:
-
com.otaliastudios.transcoder.sink.DataSink
public class DefaultDataSink implements DataSink
A DataSink implementation that: - Uses MediaMuxer to collect data - Creates an output file with the readable media
-
-
Constructor Summary
Constructors Constructor Description DefaultDataSink(String outputFilePath)DefaultDataSink(String outputFilePath, int format)DefaultDataSink(FileDescriptor fileDescriptor)DefaultDataSink(FileDescriptor fileDescriptor, int format)
-
Method Summary
Modifier and Type Method Description voidsetOrientation(int rotation)Called before starting to set the orientation metadata. voidsetLocation(double latitude, double longitude)Called before starting to set the location metadata. voidsetTrackStatus(@NonNull() TrackType type, @NonNull() TrackStatus status)Called before starting to set the status for the giventrack. voidsetTrackFormat(@NonNull() TrackType type, @NonNull() MediaFormat format)Called by the transcoding pipeline when we have an output format. voidwriteTrack(@NonNull() TrackType type, @NonNull() ByteBuffer byteBuffer, @NonNull() MediaCodec.BufferInfo bufferInfo)Called by the transcoding pipeline to write data into this sink. voidstop()Called when transcoders have stopped writing. voidrelease()Called to release resources.Any exception should probably be caught here. -
-
Constructor Detail
-
DefaultDataSink
DefaultDataSink(String outputFilePath)
-
DefaultDataSink
DefaultDataSink(String outputFilePath, int format)
-
DefaultDataSink
DefaultDataSink(FileDescriptor fileDescriptor)
-
DefaultDataSink
DefaultDataSink(FileDescriptor fileDescriptor, int format)
-
-
Method Detail
-
setOrientation
void setOrientation(int rotation)
Called before starting to set the orientation metadata.
-
setLocation
void setLocation(double latitude, double longitude)
Called before starting to set the location metadata.
- Parameters:
latitude- latitudelongitude- longitude
-
setTrackStatus
void setTrackStatus(@NonNull() TrackType type, @NonNull() TrackStatus status)
Called before starting to set the status for the giventrack. The sink object can check if the track is transcodingusing isTranscoding.
- Parameters:
type- track typestatus- status
-
setTrackFormat
void setTrackFormat(@NonNull() TrackType type, @NonNull() MediaFormat format)
Called by the transcoding pipeline when we have an output format.This is not the output format chosen by the library user but rather theoutput format determined by MediaCodec, which contains more information,and should be inspected to know what kind of data we're collecting.
- Parameters:
type- the track typeformat- the track format
-
writeTrack
void writeTrack(@NonNull() TrackType type, @NonNull() ByteBuffer byteBuffer, @NonNull() MediaCodec.BufferInfo bufferInfo)
Called by the transcoding pipeline to write data into this sink.
- Parameters:
type- the track typebyteBuffer- the databufferInfo- the metadata
-
stop
void stop()
Called when transcoders have stopped writing.
-
release
void release()
Called to release resources.Any exception should probably be caught here.
-
-
-
-