[Android] [PATCH] Benchmark: now receive screenshot directory location from intent
Duncan McNamara
dcn.mcnamara at gmail.com
Wed May 31 18:42:27 CEST 2017
---
.../org/videolan/vlc/gui/video/benchmark/BenchActivity.java | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.java
index 791c99c..d4e2c33 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.java
@@ -68,6 +68,7 @@ public class BenchActivity extends ShallowVideoPlayer {
private static final String PLAYBACK = "org.videolan.vlc.gui.video.benchmark.ACTION_PLAYBACK";
private static final String TIMESTAMPS = "org.videolan.vlc.gui.video.benchmark.TIMESTAMPS";
+ private static final String INTENT_SCREENSHOT_DIR = "SCREENSHOT_DIR";
private static final String TAG = "VLCBenchmark";
private static final int REQUEST_SCREENSHOT = 666;
@@ -101,6 +102,8 @@ public class BenchActivity extends ShallowVideoPlayer {
/* set to true when Vout event is received
* used to check if hardware decoder works */
private boolean mHasVout = false;
+ /* screenshot directory location */
+ private String screenshotDir;
@Override
protected void loadMedia() {
@@ -126,6 +129,11 @@ public class BenchActivity extends ShallowVideoPlayer {
}
mIsBenchmark = true;
+ if (!intent.hasExtra(INTENT_SCREENSHOT_DIR)) {
+ errorFinish("Failed to get screenshot directory location");
+ }
+ screenshotDir = intent.getStringExtra(INTENT_SCREENSHOT_DIR);
+
super.onCreate(savedInstanceState);
/* Determining the benchmark mode */
@@ -422,11 +430,12 @@ public class BenchActivity extends ShallowVideoPlayer {
if (bitmap != null) {
bitmap.copyPixelsFromBuffer(buffer);
- File folder = new File(Environment.getExternalStorageDirectory() + File.separator + "screenshotFolder");
+ String folderStr = screenshotDir;
+ File folder = new File(folderStr);
if (!folder.exists()) {
if (!folder.mkdir()) {
- errorFinish("Failed to create screenshotFolder");
+ errorFinish("Failed to create screenshot directory");
}
}
--
2.7.5
More information about the Android
mailing list