Copyright 2013-01-06 Werner Randelshofer

org.monte.media
Interface MovieReader

All Known Implementing Classes:
AVIReader, QuickTimeReader

public interface MovieReader

A simple API for reading movie data (audio and video) from a file.

FIXME - MovieReader should extend Demultiplexer

Version:
$Id: MovieReader.java 299 2013-01-03 07:40:18Z werner $
Author:
Werner Randelshofer

Method Summary
 void close()
           
 int findTrack(int fromTrack, Format format)
          Finds a track with the specified format.
 long getChunkCount(int track)
          Returns the number of media data chunks in the specified track.
 Rational getDuration()
          Returns the total duration of the movie .
 Rational getDuration(int track)
          Returns the duration of the specified track.
 Format getFileFormat()
          Returns the file format.
 Format getFormat(int track)
          Returns the media format of the specified track.
 Rational getReadTime(int track)
          Returns the current time of the track.
 int getTrackCount()
          Returns the number of tracks.
 int nextTrack()
          Returns the index of the next track in playback sequence.
 void read(int track, Buffer buffer)
          Reads the next sample chunk from the specified track.
 Rational sampleToTime(int track, long sample)
          Returns the time for the specified sample number.
 void setMovieReadTime(Rational newValue)
          Sets the read time of all tracks to the closest sync sample before or at the specified time.
 long timeToSample(int track, Rational seconds)
          Returns the sample number for the specified time.
 

Method Detail

getTrackCount

int getTrackCount()
                  throws java.io.IOException
Returns the number of tracks.

Throws:
java.io.IOException

findTrack

int findTrack(int fromTrack,
              Format format)
              throws java.io.IOException
Finds a track with the specified format.

Parameters:
fromTrack - the start track number.
format - A format specification.
Returns:
The track number >= fromTrack or -1 if no track has been found.
Throws:
java.io.IOException

getDuration

Rational getDuration()
                     throws java.io.IOException
Returns the total duration of the movie .

Throws:
java.io.IOException

getDuration

Rational getDuration(int track)
                     throws java.io.IOException
Returns the duration of the specified track.

Throws:
java.io.IOException

timeToSample

long timeToSample(int track,
                  Rational seconds)
                  throws java.io.IOException
Returns the sample number for the specified time.

Throws:
java.io.IOException

sampleToTime

Rational sampleToTime(int track,
                      long sample)
                      throws java.io.IOException
Returns the time for the specified sample number.

Throws:
java.io.IOException

getFileFormat

Format getFileFormat()
                     throws java.io.IOException
Returns the file format.

Throws:
java.io.IOException

getFormat

Format getFormat(int track)
                 throws java.io.IOException
Returns the media format of the specified track.

Parameters:
track - Track number.
Returns:
The media format of the track.
Throws:
java.io.IOException

getChunkCount

long getChunkCount(int track)
                   throws java.io.IOException
Returns the number of media data chunks in the specified track. A chunk contains one or more samples.

Throws:
java.io.IOException

read

void read(int track,
          Buffer buffer)
          throws java.io.IOException
Reads the next sample chunk from the specified track.

Parameters:
track - Track number.
buffer - The buffer into which to store the sample data.
Throws:
java.io.IOException

nextTrack

int nextTrack()
              throws java.io.IOException
Returns the index of the next track in playback sequence.

Returns:
Index of next track or -1 if end of media reached.
Throws:
java.io.IOException

close

void close()
           throws java.io.IOException
Throws:
java.io.IOException

setMovieReadTime

void setMovieReadTime(Rational newValue)
                      throws java.io.IOException
Sets the read time of all tracks to the closest sync sample before or at the specified time.

Parameters:
newValue - Time in seconds.
Throws:
java.io.IOException

getReadTime

Rational getReadTime(int track)
                     throws java.io.IOException
Returns the current time of the track.

Throws:
java.io.IOException

Copyright 2013-01-06 Werner Randelshofer