Skip to content

Commit c0e75d3

Browse files
authored
Merge pull request #6 from artoolkitx/android-update
Android update
2 parents de86622 + 045ce6d commit c0e75d3

File tree

6 files changed

+24
-12
lines changed

6 files changed

+24
-12
lines changed

AndroidStudioProjects/ARBaseLibProj/aRBaseLib/build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
apply plugin: 'com.android.library'
22

33
android {
4-
compileSdkVersion = 25 // The version of the Android API, i.e. SDK, the app is compiled against
5-
buildToolsVersion = "25.0.2" // The downloaded version of the Build Tools used to build Android application code
4+
compileSdkVersion = 27 // The version of the Android API, i.e. SDK, the app is compiled against
5+
buildToolsVersion = "27.0.3" // The downloaded version of the Build Tools used to build Android application code
66

77
defaultConfig {
88
minSdkVersion 15 // Signals the Google Play Store as to what device, running this minimum indicated or greater version, an app can be installed on
@@ -21,5 +21,6 @@ android {
2121

2222
dependencies {
2323
// compile 'com.android.support:support-v4:24.2.1'// Only required when the target device API level is greater than
24-
compile 'com.android.support:appcompat-v7:25.1.0' // the compile and target of the app being deployed to the device
24+
// the compile and target of the app being deployed to the device
25+
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
2526
}

AndroidStudioProjects/ARBaseLibProj/aRBaseLib/src/main/java/org/artoolkit/ar/base/ARActivity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,9 @@ public GLSurfaceView getGLView() {
340340
}
341341

342342
@Override
343-
public void cameraPreviewStarted(int width, int height, int rate, int cameraIndex, boolean cameraIsFrontFacing) {
343+
public void cameraPreviewStarted(int width, int height, int rate, String pixelFormat, int cameraIndex, boolean cameraIsFrontFacing) {
344344

345-
if (ARToolKit.getInstance().startWithPushedVideo(width, height, null, cameraIndex, cameraIsFrontFacing)) {
345+
if (ARToolKit.getInstance().startWithPushedVideo(width, height, pixelFormat, null, cameraIndex, cameraIsFrontFacing)) {
346346
// Expects Data to be already in the cache dir. This can be done with the AssetUnpacker.
347347
Log.i(TAG, "cameraPreviewStarted(): Camera initialised");
348348
} else {

AndroidStudioProjects/ARBaseLibProj/aRBaseLib/src/main/java/org/artoolkit/ar/base/ARToolKit.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ public class ARToolKit {
7272
else Log.i(TAG, "Loaded native library.");
7373
}
7474

75+
private int frameWidth;
76+
private int frameHeight;
77+
private int cameraIndex;
78+
private boolean cameraIsFrontFacing;
79+
7580
/**
7681
* Array of RGB color values containing the debug video image data.
7782
*/
@@ -170,6 +175,11 @@ public boolean nativeInitialised() {
170175
*/
171176
public boolean startWithPushedVideo(int videoWidth, int videoHeight, String pixelFormat, String cameraParaPath, int cameraIndex, boolean cameraIsFrontFacing) {
172177

178+
this.frameWidth = videoWidth;
179+
this.frameHeight = videoHeight;
180+
this.cameraIndex = cameraIndex;
181+
this.cameraIsFrontFacing = cameraIsFrontFacing;
182+
173183
if (!initedNative) {
174184
Log.e(TAG, "startWithPushedVideo(): Cannot start because native interface not inited.");
175185
return false;
@@ -346,7 +356,7 @@ public boolean isRunning() {
346356
*/
347357
public boolean convertAndDetect1(byte[] frame, int frameSize) {
348358

349-
if ((!isNativeInited()) || (frame == null)) {
359+
if ((!initedNative) || (frame == null)) {
350360
return false;
351361
}
352362

@@ -369,7 +379,7 @@ public boolean convertAndDetect1(byte[] frame, int frameSize) {
369379
*/
370380
public boolean convertAndDetect2(ByteBuffer[] framePlanes, int[] framePlanePixelStrides, int[] framePlaneRowStrides) {
371381

372-
if ((!isNativeInited()) || (framePlanes == null)) {
382+
if ((!initedNative) || (framePlanes == null)) {
373383
return false;
374384
}
375385

AndroidStudioProjects/ARBaseLibProj/aRBaseLib/src/main/java/org/artoolkit/ar/base/camera/CameraEventListener.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,11 @@ public interface CameraEventListener {
5050
* @param width The width of the video image in pixels.
5151
* @param height The height of the video image in pixels.
5252
* @param rate The capture rate in frames per second.
53+
* @param pixelFormat A string with format in which buffers will be pushed. Supported values include "NV21", "NV12", "YUV_420_888", "RGBA", "RGB_565", and "MONO".
5354
* @param cameraIndex Zero-based index of the camera in use. If only one camera is present, will be 0.
5455
* @param cameraIsFrontFacing false if camera is rear-facing (the default) or true if camera is facing toward the user.
5556
*/
56-
public void cameraPreviewStarted(int width, int height, int rate, int cameraIndex, boolean cameraIsFrontFacing);
57+
public void cameraPreviewStarted(int width, int height, int rate, String pixelFormat, int cameraIndex, boolean cameraIsFrontFacing);
5758

5859
/**
5960
* Called when the camera preview has a new frame ready.

AndroidStudioProjects/ARBaseLibProj/aRBaseLib/src/main/java/org/artoolkit/ar/base/camera/CaptureCameraPreview.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
327327
camera.startPreview();
328328

329329
if (listener != null)
330-
listener.cameraPreviewStarted(captureWidth, captureHeight, captureRate, cameraIndex, cameraIsFrontFacing);
330+
listener.cameraPreviewStarted(captureWidth, captureHeight, captureRate,"NV21", cameraIndex, cameraIsFrontFacing);
331331
}
332332

333333
@Override

AndroidStudioProjects/ARSimpleProj/aRSimple/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion = 25 // The version of the Android API, i.e. SDK, the app is compiled against
5-
buildToolsVersion = "25.0.2" // The downloaded version of the Build Tools used to build Android application code
4+
compileSdkVersion = 27 // The version of the Android API, i.e. SDK, the app is compiled against
5+
buildToolsVersion = "27.0.3" // The downloaded version of the Build Tools used to build Android application code
66

77
defaultConfig {
88
applicationId = "org.artoolkit.ar.samples.ARSimple"
99
minSdkVersion 15 // Signals the Google Play Store as to what device, running this minimum indicated or greater version, an app can be installed on
10-
targetSdkVersion 24 // Indicates the version that you have tested your app on (presumably up to and including)
10+
targetSdkVersion 27 // Indicates the version that you have tested your app on (presumably up to and including)
1111
versionCode = 5000 // Integer type incremented by 1 for every release, major or minor, to Google store
1212
versionName = "5.0" // Real fully qualified major and minor release description
1313

0 commit comments

Comments
 (0)