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 voidaddTrack(DataSource dataSource, MediaFormat format, byte[] sampleData)Adds a track of data to an associatedDataSource.protected booleanadvance()protected PersistableBundlegetMetrics()protected intgetSampleTrackIndex()protected intgetTrackCount()protected MediaFormatgetTrackFormat(int index)protected intreadSampleData(ByteBuffer byteBuf, int offset)static voidreset()protected voidselectTrack(int index)protected voidsetDataSource(Context context, Uri uri, Map<String,String> headers)protected voidsetDataSource(AssetFileDescriptor assetFileDescriptor)protected voidsetDataSource(MediaDataSource mediaDataSource)protected voidsetDataSource(FileDescriptor fileDescriptor)protected voidsetDataSource(FileDescriptor fileDescriptor, long offset, long length)protected voidsetDataSource(String path)protected voidsetDataSource(String path, Map<String,String> headers)static voidsetMetrics(DataSource dataSource, PersistableBundle metrics)Sets metrics for an associatedDataSource.protected voidunselectTrack(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).
-
setMetrics
Sets metrics for an associatedDataSource.- Parameters:
metrics- the data which will be returned byMediaExtractor.getMetrics().
-
setDataSource
-
setDataSource
-
setDataSource
-
setDataSource
-
setDataSource
@Implementation protected void setDataSource(FileDescriptor fileDescriptor, long offset, long length) -
setDataSource
-
setDataSource
-
advance
-
getSampleTrackIndex
-
getTrackCount
-
getTrackFormat
-
readSampleData
-
selectTrack
-
unselectTrack
-
getMetrics
-
reset
-