am d127a4eb: media.MediaPlayer: don\'t check file-existence for URI-s with scheme

* commit 'd127a4ebe9cbd96dfe4879d969c4de0feedd4717':
  media.MediaPlayer: don't check file-existence for URI-s with scheme
This commit is contained in:
Lajos Molnar
2014-08-19 18:14:43 +00:00
committed by Android Git Automerger

View File

@@ -1049,8 +1049,17 @@ public class MediaPlayer implements SubtitleController.Listener
private void setDataSource(String path, String[] keys, String[] values)
throws IOException, IllegalArgumentException, SecurityException, IllegalStateException {
final Uri uri = Uri.parse(path);
if ("file".equals(uri.getScheme())) {
final String scheme = uri.getScheme();
if ("file".equals(scheme)) {
path = uri.getPath();
} else if (scheme != null) {
// handle non-file sources
nativeSetDataSource(
MediaHTTPService.createHttpServiceBinderIfNecessary(path),
path,
keys,
values);
return;
}
final File file = new File(path);
@@ -1060,20 +1069,10 @@ public class MediaPlayer implements SubtitleController.Listener
setDataSource(fd);
is.close();
} else {
_setDataSource(path, keys, values);
throw new IOException("setDataSource failed.");
}
}
private void _setDataSource(
String path, String[] keys, String[] values)
throws IOException, IllegalArgumentException, SecurityException, IllegalStateException {
nativeSetDataSource(
MediaHTTPService.createHttpServiceBinderIfNecessary(path),
path,
keys,
values);
}
private native void nativeSetDataSource(
IBinder httpServiceBinder, String path, String[] keys, String[] values)
throws IOException, IllegalArgumentException, SecurityException, IllegalStateException;