com.smaxe.uv.media.core
Interface IMediaFileReader


public interface IMediaFileReader

IMediaFileReader - media file reader interface.

Version:
0.3.0
Author:
Andrei Sochirca
See Also:
JUV Media SDK

Nested Class Summary
static class IMediaFileReader.TrackSample
          TrackSample - track sample.
 
Method Summary
 void close()
          Closes media file and releases acquired resources.
 AudioTrackInfo getAudioTrackInfo(MediaTrackInfo info)
          Returns audio track info.
 MediaFileContainer getContainer()
          Returns media file container.
 java.util.Iterator<IMediaFileReader.TrackSample> getTrackSamples(MediaTrackInfo track, long timestamp)
          Returns track samples.
 MediaTrackInfo[] getTracksInfo()
          Returns tracks info.
 VideoTrackInfo getVideoTrackInfo(MediaTrackInfo info)
          Returns video track info.
 ByteArray readTrackSample(IMediaFileReader.TrackSample sample, byte[] buf, int offset)
          Reads sample from the media file.
 

Method Detail

getContainer

MediaFileContainer getContainer()
Returns media file container.

Returns:
media file container

getTracksInfo

MediaTrackInfo[] getTracksInfo()
Returns tracks info.

Returns:
tracks info

getAudioTrackInfo

AudioTrackInfo getAudioTrackInfo(MediaTrackInfo info)
Returns audio track info.

Parameters:
info -
Returns:
audio track info

getVideoTrackInfo

VideoTrackInfo getVideoTrackInfo(MediaTrackInfo info)
Returns video track info.

Parameters:
info -
Returns:
video track info

getTrackSamples

java.util.Iterator<IMediaFileReader.TrackSample> getTrackSamples(MediaTrackInfo track,
                                                                 long timestamp)
Returns track samples.

Parameters:
track - track info, if null then samples of all tracks are returned (interleaved)
timestamp - start timestamp (in milliseconds), if container contains video then timestamp is aligned to the previous key frame
Returns:
track samples

readTrackSample

ByteArray readTrackSample(IMediaFileReader.TrackSample sample,
                          byte[] buf,
                          int offset)
                          throws java.io.IOException
Reads sample from the media file.

Note:
- if buffer length is not enough a new buffer is created

Parameters:
sample - sample to use
buf - buffer to use
offset - buffer offset
Returns:
read track sample data
Throws:
java.io.IOException - if an I/O exception occurred

close

void close()
           throws java.io.IOException
Closes media file and releases acquired resources.

Throws:
java.io.IOException - if an I/O exception occurred