Class M4AReader

  • All Implemented Interfaces:
    IoConstants, ITagReader

    public class M4AReader
    extends Object
    implements IoConstants, ITagReader
    A Reader is used to read the contents of a M4A file. NOTE: This class is not implemented as threading-safe. The caller should make sure the threading-safety.
    Author:
    The Red5 Project, Paul Gregoire, (mondain@gmail.com)
    • Constructor Detail

      • M4AReader

        public M4AReader​(File f)
                  throws IOException
        Creates M4A reader from file input stream, sets up metadata generation flag.
        Parameters:
        f - File input stream
        Throws:
        IOException - on IO error
    • Method Detail

      • decodeHeader

        public void decodeHeader()
        This handles the moov atom being at the beginning or end of the file, so the mdat may also be before or after the moov atom.
        Specified by:
        decodeHeader in interface ITagReader
      • getTotalBytes

        public long getTotalBytes()
        Description copied from interface: ITagReader
        Get the total readable bytes in a file or ByteBuffer
        Specified by:
        getTotalBytes in interface ITagReader
        Returns:
        Total readable bytes
      • hasVideo

        public boolean hasVideo()
        Check if the reader also has video tags.
        Specified by:
        hasVideo in interface ITagReader
        Returns:
        has video
      • getFileData

        public org.apache.mina.core.buffer.IoBuffer getFileData()
        Returns the file buffer.
        Returns:
        File contents as byte buffer
      • getOffset

        public int getOffset()
        Returns the offet length
        Specified by:
        getOffset in interface ITagReader
        Returns:
        int
      • getBytesRead

        public long getBytesRead()
        Returns the amount of bytes read
        Specified by:
        getBytesRead in interface ITagReader
        Returns:
        long
      • getDuration

        public long getDuration()
        Return length in seconds
        Specified by:
        getDuration in interface ITagReader
        Returns:
        length in seconds
      • getAudioCodecId

        public String getAudioCodecId()
      • hasMoreTags

        public boolean hasMoreTags()
        Returns a boolean stating whether the FLV has more tags
        Specified by:
        hasMoreTags in interface ITagReader
        Returns:
        boolean
      • readTag

        public ITag readTag()
        Packages media data for return to providers.
        Specified by:
        readTag in interface ITagReader
        Returns:
        Tag
      • analyzeFrames

        public void analyzeFrames()
        Performs frame analysis and generates metadata for use in seeking. All the frames are analyzed and sorted together based on time and offset.
      • position

        public void position​(long pos)
        Put the current position to pos. The caller must ensure the pos is a valid one.
        Specified by:
        position in interface ITagReader
        Parameters:
        pos - position to move to in file / channel
      • close

        public void close()
        Closes the reader and free any allocated memory.
        Specified by:
        close in interface ITagReader
      • setAudioCodecId

        public void setAudioCodecId​(String audioCodecId)
      • readTagHeader

        public ITag readTagHeader()