@Implements(value=android.media.MediaMetadataRetriever.class) public class ShadowMediaMetadataRetriever extends Object
Constructor and Description |
---|
ShadowMediaMetadataRetriever() |
Modifier and Type | Method and Description |
---|---|
static void |
addException(DataSource ds,
RuntimeException e)
Configures an exception to be thrown when
setDataSource(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(DataSource ds,
long time,
Bitmap bitmap) |
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(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(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 |
addMetadata(DataSource ds,
int keyCode,
String value) |
static void |
addMetadata(String path,
int keyCode,
String value)
Adds the given keyCode/value pair for the given data source.
|
protected String |
extractMetadata(int keyCode) |
protected Bitmap |
getFrameAtTime(long timeUs,
int option) |
static void |
reset() |
protected void |
setDataSource(Context context,
Uri uri) |
void |
setDataSource(DataSource dataSource) |
protected void |
setDataSource(FileDescriptor fd,
long offset,
long length) |
protected void |
setDataSource(String path) |
protected void |
setDataSource(String uri,
Map<String,String> headers) |
public void setDataSource(DataSource dataSource)
@Implementation protected void setDataSource(String path)
@Implementation protected void setDataSource(Context context, Uri uri)
@Implementation protected void setDataSource(String uri, Map<String,String> headers)
@Implementation protected void setDataSource(FileDescriptor fd, long offset, long length)
@Implementation protected String extractMetadata(int keyCode)
@Implementation protected Bitmap getFrameAtTime(long timeUs, int option)
public static void addException(DataSource ds, RuntimeException e)
Configures an exception to be thrown when setDataSource(org.robolectric.shadows.util.DataSource)
is called for the given data source.
ds
- the data source that will trigger an exceptione
- the exception to trigger, or null to avoid throwing an exception.public static void addMetadata(DataSource ds, int keyCode, String value)
public static void addMetadata(String path, int keyCode, String value)
Adds the given keyCode/value pair for the given data source. Uses path to call DataSource.toDataSource(String)
and then calls addMetadata(DataSource, int, String)
. This method is retained mostly for backwards compatibility; you can call addMetadata(DataSource, int, String)
directly.
path
- the path to the data source whose metadata is being set.keyCode
- the keyCode for the metadata being set, as used by MediaMetadataRetriever.extractMetadata(int)
.value
- the value for the specified metadata.public static void addFrame(DataSource ds, long time, Bitmap bitmap)
public static void addFrame(String path, long time, Bitmap bitmap)
Adds the given bitmap at the given time for the given data source. Uses path to call DataSource.toDataSource(String)
and then calls addFrame(DataSource, long, Bitmap)
. This method is retained mostly for backwards compatibility; you can call addFrame(DataSource, long, Bitmap)
directly.
path
- the path to the data source.time
- the playback time at which the specified bitmap should be retrieved.bitmap
- the bitmap to retrieve.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. Uses path to call DataSource.toDataSource(Context, Uri)
and then calls addFrame(DataSource, long, Bitmap)
. This method is retained mostly for backwards compatibility; you can call addFrame(DataSource, long, Bitmap)
directly.
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.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. Uses path to call DataSource.toDataSource(String, Map)
and then calls addFrame(DataSource, long, Bitmap)
. This method is retained mostly for backwards compatibility; you can call addFrame(DataSource, long, Bitmap)
directly.
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.public static void addFrame(FileDescriptor fd, long time, Bitmap bitmap)
Adds the given bitmap at the given time for the given data source. Uses path to call DataSource.toDataSource(FileDescriptor)
and then calls addFrame(DataSource, long, Bitmap)
. This method is retained mostly for backwards compatibility; you can call addFrame(DataSource, long, Bitmap)
directly.
fd
- file descriptor of the data source.time
- the playback time at which the specified bitmap should be retrieved.bitmap
- the bitmap to retrieve.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. Uses path to call DataSource.toDataSource(FileDescriptor, long, long)
and then calls addFrame(DataSource, long, Bitmap)
. This method is retained mostly for backwards compatibility; you can call addFrame(DataSource, long, Bitmap)
directly.
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.@Resetter public static void reset()