Package org.robolectric.shadows
Class ShadowMediaMetadataRetriever
- java.lang.Object
-
- org.robolectric.shadows.ShadowMediaMetadataRetriever
-
@Implements(android.media.MediaMetadataRetriever.class) public class ShadowMediaMetadataRetriever extends Object
-
-
Constructor Summary
Constructors Constructor Description ShadowMediaMetadataRetriever()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
addException(DataSource ds, RuntimeException e)
Configures an exception to be thrown whensetDataSource(org.robolectric.shadows.util.DataSource)
is called for the given data source.static void
addFrame(Context context, Uri uri, long time, Bitmap bitmap)
Adds the given bitmap at the given time for the given data source.static void
addFrame(FileDescriptor fd, long offset, long length, long time, Bitmap bitmap)
Adds the given bitmap at the given time for the given data source.static void
addFrame(FileDescriptor fd, long time, Bitmap bitmap)
Adds the given bitmap at the given time for the given data source.static void
addFrame(String path, long time, Bitmap bitmap)
Adds the given bitmap at the given time for the given data source.static void
addFrame(String uri, Map<String,String> headers, long time, Bitmap bitmap)
Adds the given bitmap at the given time for the given data source.static void
addFrame(DataSource ds, long time, Bitmap bitmap)
static void
addMetadata(String path, int keyCode, String value)
Adds the given keyCode/value pair for the given data source.static void
addMetadata(DataSource ds, int keyCode, String value)
static void
addScaledFrame(DataSource ds, long time, int dstWidth, int dstHeight, Bitmap bitmap)
protected String
extractMetadata(int keyCode)
protected Bitmap
getFrameAtTime(long timeUs, int option)
protected Bitmap
getScaledFrameAtTime(long timeUs, int option, int dstWidth, int dstHeight)
static void
reset()
protected void
setDataSource(Context context, Uri uri)
protected void
setDataSource(MediaDataSource mediaDataSource)
protected void
setDataSource(FileDescriptor fd, long offset, long length)
protected void
setDataSource(String path)
protected void
setDataSource(String uri, Map<String,String> headers)
void
setDataSource(DataSource dataSource)
-
-
-
Method Detail
-
setDataSource
public void setDataSource(DataSource dataSource)
-
setDataSource
@Implementation protected void setDataSource(String path)
-
setDataSource
@Implementation protected void setDataSource(Context context, Uri uri)
-
setDataSource
@Implementation protected void setDataSource(String uri, Map<String,String> headers)
-
setDataSource
@Implementation protected void setDataSource(FileDescriptor fd, long offset, long length)
-
setDataSource
@Implementation(minSdk=23) protected void setDataSource(MediaDataSource mediaDataSource)
-
extractMetadata
@Implementation protected String extractMetadata(int keyCode)
-
getFrameAtTime
@Implementation protected Bitmap getFrameAtTime(long timeUs, int option)
-
getScaledFrameAtTime
@Implementation(minSdk=27) protected Bitmap getScaledFrameAtTime(long timeUs, int option, int dstWidth, int dstHeight)
-
addException
public static void addException(DataSource ds, RuntimeException e)
Configures an exception to be thrown whensetDataSource(org.robolectric.shadows.util.DataSource)
is called for the given data source.- Parameters:
ds
- the data source that will trigger an exceptione
- the exception to trigger, or null to avoid throwing an exception.
-
addMetadata
public static void addMetadata(DataSource ds, int keyCode, String value)
-
addMetadata
public static void addMetadata(String path, int keyCode, String value)
Adds the given keyCode/value pair for the given data source. Usespath
to callDataSource.toDataSource(String)
and then callsaddMetadata(DataSource, int, String)
. This method is retained mostly for backwards compatibility; you can calladdMetadata(DataSource, int, String)
directly.- Parameters:
path
- the path to the data source whose metadata is being set.keyCode
- the keyCode for the metadata being set, as used byMediaMetadataRetriever.extractMetadata(int)
.value
- the value for the specified metadata.
-
addFrame
public static void addFrame(DataSource ds, long time, Bitmap bitmap)
-
addScaledFrame
public static void addScaledFrame(DataSource ds, long time, int dstWidth, int dstHeight, Bitmap bitmap)
-
addFrame
public static void addFrame(String path, long time, Bitmap bitmap)
Adds the given bitmap at the given time for the given data source. Usespath
to callDataSource.toDataSource(String)
and then callsaddFrame(DataSource, long, Bitmap)
. This method is retained mostly for backwards compatibility; you can calladdFrame(DataSource, long, Bitmap)
directly.- Parameters:
path
- the path to the data source.time
- the playback time at which the specified bitmap should be retrieved.bitmap
- the bitmap to retrieve.
-
addFrame
public static void addFrame(Context context, Uri uri, long time, Bitmap bitmap)
Adds the given bitmap at the given time for the given data source. Usespath
to callDataSource.toDataSource(Context, Uri)
and then callsaddFrame(DataSource, long, Bitmap)
. This method is retained mostly for backwards compatibility; you can calladdFrame(DataSource, long, Bitmap)
directly.- Parameters:
context
- the Context object to match on the data source.uri
- the Uri of the data source.time
- the playback time at which the specified bitmap should be retrieved.bitmap
- the bitmap to retrieve.
-
addFrame
public static void addFrame(String uri, Map<String,String> headers, long time, Bitmap bitmap)
Adds the given bitmap at the given time for the given data source. Usespath
to callDataSource.toDataSource(String, Map)
and then callsaddFrame(DataSource, long, Bitmap)
. This method is retained mostly for backwards compatibility; you can calladdFrame(DataSource, long, Bitmap)
directly.- Parameters:
uri
- the Uri of the data source.headers
- the headers to use when requesting the specified uri.time
- the playback time at which the specified bitmap should be retrieved.bitmap
- the bitmap to retrieve.
-
addFrame
public static void addFrame(FileDescriptor fd, long time, Bitmap bitmap)
Adds the given bitmap at the given time for the given data source. Usespath
to callDataSource.toDataSource(FileDescriptor)
and then callsaddFrame(DataSource, long, Bitmap)
. This method is retained mostly for backwards compatibility; you can calladdFrame(DataSource, long, Bitmap)
directly.- Parameters:
fd
- file descriptor of the data source.time
- the playback time at which the specified bitmap should be retrieved.bitmap
- the bitmap to retrieve.
-
addFrame
public static void addFrame(FileDescriptor fd, long offset, long length, long time, Bitmap bitmap)
Adds the given bitmap at the given time for the given data source. Usespath
to callDataSource.toDataSource(FileDescriptor, long, long)
and then callsaddFrame(DataSource, long, Bitmap)
. This method is retained mostly for backwards compatibility; you can calladdFrame(DataSource, long, Bitmap)
directly.- Parameters:
fd
- file descriptor of the data source.offset
- the byte offset within the specified file from which to start reading the data.length
- the number of bytes to read from the file.time
- the playback time at which the specified bitmap should be retrieved.bitmap
- the bitmap to retrieve.
-
reset
@Resetter public static void reset()
-
-