Package com.mku.android.salmonfs.media
Class AesMediaDataSource
java.lang.Object
MediaDataSource
com.mku.android.salmonfs.media.AesMediaDataSource
public class AesMediaDataSource
extends MediaDataSource
Seekable source for encrypted media content.
-
Constructor Summary
ConstructorsConstructorDescriptionAesMediaDataSource(AesStream aesStream) Construct a seekable source for the android media player from an encrypted stream.AesMediaDataSource(AesFile aesFile) Construct a seekable source for the android media player from an encrypted file.AesMediaDataSource(AesFile aesFile, int buffers, int bufferSize, int threads, int backOffset) Construct a seekable source for the android media player from an encrypted file using cached buffers and parallel processing. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the source and all associated resources.longgetSize()Get the content size.intreadAt(long position, byte[] buffer, int offset, int size) Decrypts and reads the contents of an encrypted filevoidsetOnError(Consumer<String> onError) Notify when error occurs
-
Constructor Details
-
AesMediaDataSource
Construct a seekable source for the android media player from an encrypted file.- Parameters:
aesFile- AesFile that will be used as a source- Throws:
Exception- Thrown if error occurred
-
AesMediaDataSource
public AesMediaDataSource(AesFile aesFile, int buffers, int bufferSize, int threads, int backOffset) throws Exception Construct a seekable source for the android media player from an encrypted file using cached buffers and parallel processing.- Parameters:
aesFile- AesFile that will be used as a sourcebuffers- The buffersbufferSize- Buffer sizethreads- Threads for parallel processingbackOffset- The backwards offset to use when reading buffers- Throws:
Exception- Thrown if error occurred
-
AesMediaDataSource
Construct a seekable source for the android media player from an encrypted stream.- Parameters:
aesStream- AesStream that will be used as a source- Throws:
Exception- Thrown if error occurred
-
-
Method Details
-
setOnError
Notify when error occurs- Parameters:
onError- The callback
-
readAt
Decrypts and reads the contents of an encrypted file- Parameters:
position- The source file position the read will start frombuffer- The buffer that will store the decrypted contentsoffset- The position on the buffer that the decrypted data will startsize- The length of the data requested- Throws:
IOException
-
getSize
public long getSize()Get the content size.- Returns:
- The size
-
close
Close the source and all associated resources.- Throws:
IOException- Thrown if error during IO
-