Package org.robolectric.shadows
Class ShadowMediaExtractor
java.lang.Object
org.robolectric.shadows.ShadowMediaExtractor
@Implements(android.media.MediaExtractor.class) public class ShadowMediaExtractor extends Object
A shadow for the MediaExtractor class.
Returns data previously injected by addTrack(DataSource, MediaFormat, byte[])
.
Note several limitations, due to not using actual media codecs for decoding:
- Only one track may be selected at a time; multi-track selection is not supported.
advance()
will advance by the size of the last read (i.e. the return value of the last call toreadSampleData(ByteBuffer, int)
).MediaExtractor.getSampleTime()
andMediaExtractor.getSampleSize()
are unimplemented.MediaExtractor#seekTo()
is unimplemented.
-
Constructor Summary
Constructors Constructor Description ShadowMediaExtractor()
-
Method Summary
Modifier and Type Method Description static void
addTrack(DataSource dataSource, MediaFormat format, byte[] sampleData)
Adds a track of data to an associatedDataSource
.protected boolean
advance()
protected int
getSampleTrackIndex()
protected int
getTrackCount()
protected MediaFormat
getTrackFormat(int index)
protected int
readSampleData(ByteBuffer byteBuf, int offset)
static void
reset()
protected void
selectTrack(int index)
protected void
setDataSource(Context context, Uri uri, Map<String,String> headers)
protected void
setDataSource(AssetFileDescriptor assetFileDescriptor)
protected void
setDataSource(MediaDataSource mediaDataSource)
protected void
setDataSource(FileDescriptor fileDescriptor)
protected void
setDataSource(FileDescriptor fileDescriptor, long offset, long length)
protected void
setDataSource(String path)
protected void
setDataSource(String path, Map<String,String> headers)
protected void
unselectTrack(int index)
-
Constructor Details
-
ShadowMediaExtractor
public ShadowMediaExtractor()
-
-
Method Details
-
addTrack
Adds a track of data to an associatedDataSource
.- Parameters:
format
- the format which will be returned byMediaExtractor.getTrackFormat(int)
sampleData
- the data which will be iterated upon and returned byMediaExtractor.readSampleData(ByteBuffer, int)
.
-
setDataSource
-
setDataSource
-
setDataSource
-
setDataSource
-
setDataSource
@Implementation protected void setDataSource(FileDescriptor fileDescriptor, long offset, long length) -
setDataSource
-
setDataSource
-
advance
-
getSampleTrackIndex
-
getTrackCount
-
getTrackFormat
-
readSampleData
-
selectTrack
-
unselectTrack
-
reset
-