Class MediaInput

All Implemented Interfaces:
MediaIO

public class MediaInput extends MediaFormat implements MediaIO
  • Constructor Details

    • MediaInput

      public MediaInput()
  • Method Details

    • open

      public boolean open(String file, String format)
      Opens media file for decoding.
    • read

      public int read(byte[] data)
      Description copied from interface: MediaIO
      Request to read data.
      Specified by:
      read in interface MediaIO
      Parameters:
      data - = buffer to receive data
    • write

      public int write(byte[] data)
      Description copied from interface: MediaIO
      Request to write data.
      Specified by:
      write in interface MediaIO
      Parameters:
      data - = buffer of data to be written.
    • seek

      public long seek(long pos, int how)
      Description copied from interface: MediaIO
      Request to seek file.
      Specified by:
      seek in interface MediaIO
      Parameters:
      pos - = position
      how - = how to seek (see MediaCoder.SEEK_... types)
    • open

      public boolean open(MediaIO io)
      Opens media using user supplied MediaIO for decoding.
    • getDuration

      public long getDuration(long ctx)
    • getVideoWidth

      public int getVideoWidth(long ctx)
    • getVideoHeight

      public int getVideoHeight(long ctx)
    • getVideoFrameRate

      public float getVideoFrameRate(long ctx)
    • getVideoKeyFrameInterval

      public int getVideoKeyFrameInterval(long ctx)
    • getAudioChannels

      public int getAudioChannels(long ctx)
    • getAudioSampleRate

      public int getAudioSampleRate(long ctx)
    • getCodecInfo

      public CodecInfo getCodecInfo()
      Returns media video/audio codec info.
    • close

      public boolean close()
      Closes media file and frees resources.
    • createVideoDecoder

      public MediaVideoDecoder createVideoDecoder(int width, int height)
      Create video decoder.
      Parameters:
      width - = desired width (-1 = no conversion)
      height - = desired height (-1 = no conversion)
    • createVideoDecoder

      public MediaVideoDecoder createVideoDecoder()
      Create video decoder.
    • createAudioDecoder

      public MediaAudioDecoder createAudioDecoder(int chs, int freq)
      Create audio decoder.
      Parameters:
      chs - = desired channels (-1 = no conversion)
      freq - = desired sample rate (-1 = no conversion)
    • createAudioDecoder

      public MediaAudioDecoder createAudioDecoder()
      Create audio decoder.
    • read

      public int read(long ctx)
      Reads next packet and returns size. Used internally by readPacket().
    • getPacketKeyFrame

      public boolean getPacketKeyFrame(long ctx)
      Returns next packet key frame flag. Used internally by readPacket().
    • getPacketData

      public int getPacketData(long ctx, byte[] data, int offset, int length)
      Copies next packet into data and returns stream. Used internally by readPacket().
    • readPacket

      public Packet readPacket()
      Reads next packet. Packet.stream will indicate which stream it is.
    • seek

      public boolean seek(long seconds)
      Seek media to time in seconds.