Class SalmonMediaDataSource

java.lang.Object
MediaDataSource
com.mku.android.salmon.media.SalmonMediaDataSource

public class SalmonMediaDataSource extends MediaDataSource
This class provides a parallel processing seekable source for encrypted media content
  • Constructor Summary

    Constructors
    Constructor
    Description
    SalmonMediaDataSource(Activity activity, SalmonFile salmonFile, int buffers, int bufferSize, int threads, int backOffset)
    Construct a seekable source for the media player from an encrypted file source
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Close the source and all associated resources.
    long
    Get the content size.
    int
    readAt(long position, byte[] buffer, int offset, int size)
    Decrypts and reads the contents of an encrypted file

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SalmonMediaDataSource

      public SalmonMediaDataSource(Activity activity, SalmonFile salmonFile, int buffers, int bufferSize, int threads, int backOffset) throws Exception
      Construct a seekable source for the media player from an encrypted file source
      Parameters:
      activity - Activity this data source will be used with. This is usually the activity the MediaPlayer is attached to
      salmonFile - SalmonFile that will be used as a source
      buffers - The buffers
      bufferSize - Buffer size
      threads - Threads for parallel processing
      backOffset - The backwards offset to use when reading buffers
      Throws:
      Exception - Thrown if error occured
  • Method Details

    • readAt

      public int readAt(long position, byte[] buffer, int offset, int size) throws IOException
      Decrypts and reads the contents of an encrypted file
      Parameters:
      position - The source file position the read will start from
      buffer - The buffer that will store the decrypted contents
      offset - The position on the buffer that the decrypted data will start
      size - The length of the data requested
      Throws:
      IOException
    • getSize

      public long getSize()
      Get the content size.
      Returns:
      The size
    • close

      public void close() throws IOException
      Close the source and all associated resources.
      Throws:
      IOException - Thrown if error during IO