Methods Summary |
---|
public native android.graphics.Bitmap | captureFrame()Call this method after setDataSource(). This method finds a
representative frame if successful and returns it as a bitmap. This is
useful for generating a thumbnail for an input media source.
|
public native byte[] | extractAlbumArt()Call this method after setDataSource(). This method finds the optional
graphic or album art associated (embedded or external url linked) the
related data source.
|
public native java.lang.String | extractMetadata(int keyCode)Call this method after setDataSource(). This method retrieves the
meta data value associated with the keyCode.
The keyCode currently supported is listed below as METADATA_XXX
constants. With any other value, it returns a null pointer.
|
protected void | finalize()
try {
native_finalize();
} finally {
super.finalize();
}
|
public native int | getMode()
|
private final native void | native_finalize()
|
private native void | native_setup()
|
public native void | release()Call it when one is done with the object. This method releases the memory
allocated internally.
|
public native void | setDataSource(java.lang.String path)Sets the data source (file pathname) to use. Call this
method before the rest of the methods in this class. This method may be
time-consuming.
|
public native void | setDataSource(java.io.FileDescriptor fd, long offset, long length)Sets the data source (FileDescriptor) to use. It is the caller's
responsibility to close the file descriptor. It is safe to do so as soon
as this call returns. Call this method before the rest of the methods in
this class. This method may be time-consuming.
|
public void | setDataSource(java.io.FileDescriptor fd)Sets the data source (FileDescriptor) to use. It is the caller's
responsibility to close the file descriptor. It is safe to do so as soon
as this call returns. Call this method before the rest of the methods in
this class. This method may be time-consuming.
// intentionally less than LONG_MAX
setDataSource(fd, 0, 0x7ffffffffffffffL);
|
public void | setDataSource(android.content.Context context, android.net.Uri uri)Sets the data source as a content Uri. Call this method before
the rest of the methods in this class. This method may be time-consuming.
if (uri == null) {
throw new IllegalArgumentException();
}
String scheme = uri.getScheme();
if(scheme == null || scheme.equals("file")) {
setDataSource(uri.getPath());
return;
}
AssetFileDescriptor fd = null;
try {
ContentResolver resolver = context.getContentResolver();
try {
fd = resolver.openAssetFileDescriptor(uri, "r");
} catch(FileNotFoundException e) {
throw new IllegalArgumentException();
}
if (fd == null) {
throw new IllegalArgumentException();
}
FileDescriptor descriptor = fd.getFileDescriptor();
if (!descriptor.valid()) {
throw new IllegalArgumentException();
}
// Note: using getDeclaredLength so that our behavior is the same
// as previous versions when the content provider is returning
// a full file.
if (fd.getDeclaredLength() < 0) {
setDataSource(descriptor);
} else {
setDataSource(descriptor, fd.getStartOffset(), fd.getDeclaredLength());
}
return;
} catch (SecurityException ex) {
} finally {
try {
if (fd != null) {
fd.close();
}
} catch(IOException ioEx) {
}
}
setDataSource(uri.toString());
|
public native void | setMode(int mode)Call this method before setDataSource() so that the mode becomes
effective for subsequent operations. This method can be called only once
at the beginning if the intended mode of operation for a
MediaMetadataRetriever object remains the same for its whole lifetime,
and thus it is unnecessary to call this method each time setDataSource()
is called. If this is not never called (which is allowed), by default the
intended mode of operation is to both capture frame and retrieve meta
data (i.e., MODE_GET_METADATA_ONLY | MODE_CAPTURE_FRAME_ONLY).
Often, this may not be what one wants, since doing this has negative
performance impact on execution time of a call to setDataSource(), since
both types of operations may be time consuming.
|