-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
43922c4
commit 7fd7ed7
Showing
160 changed files
with
11,567 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
|
||
buildscript { | ||
ext.kotlin_version = '1.3.10' | ||
repositories { | ||
google() | ||
jcenter() | ||
} | ||
dependencies { | ||
classpath 'com.android.tools.build:gradle:3.2.1' | ||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | ||
|
||
// NOTE: Do not place your application dependencies here; they belong | ||
// in the individual module build.gradle files | ||
} | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
google() | ||
jcenter() | ||
} | ||
} | ||
|
||
task clean(type: Delete) { | ||
delete rootProject.buildDir | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
apply plugin: 'com.android.library' | ||
|
||
android { | ||
compileSdkVersion 28 | ||
|
||
|
||
|
||
defaultConfig { | ||
minSdkVersion 21 | ||
targetSdkVersion 28 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
|
||
} | ||
|
||
dependencies { | ||
implementation fileTree(dir: 'libs', include: ['*.jar']) | ||
|
||
compileOnly 'com.google.android.exoplayer:exoplayer-core:2.9.3' | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.daasuu.gpuv"/> |
125 changes: 125 additions & 0 deletions
125
gpuv/src/main/java/com/daasuu/gpuv/camerarecorder/CameraHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
package com.daasuu.gpuv.camerarecorder; | ||
|
||
import android.os.Handler; | ||
import android.os.Looper; | ||
import android.os.Message; | ||
import android.util.Log; | ||
|
||
/** | ||
* Created by sudamasayuki on 2018/03/13. | ||
*/ | ||
|
||
public class CameraHandler extends Handler { | ||
private static final boolean DEBUG = false; | ||
private static final String TAG = "CameraHandler"; | ||
|
||
private static final int MSG_PREVIEW_START = 1; | ||
private static final int MSG_PREVIEW_STOP = 2; | ||
private static final int MSG_MANUAL_FOCUS = 3; | ||
private static final int MSG_SWITCH_FLASH = 4; | ||
private static final int MSG_AUTO_FOCUS = 5; | ||
|
||
|
||
private int viewWidth = 0; | ||
private int viewHeight = 0; | ||
private float eventX = 0; | ||
private float eventY = 0; | ||
|
||
private CameraThread thread; | ||
|
||
CameraHandler(final CameraThread thread) { | ||
this.thread = thread; | ||
} | ||
|
||
void startPreview(final int width, final int height) { | ||
sendMessage(obtainMessage(MSG_PREVIEW_START, width, height)); | ||
} | ||
|
||
/** | ||
* request to stop camera preview | ||
* | ||
* @param needWait need to wait for stopping camera preview | ||
*/ | ||
void stopPreview(final boolean needWait) { | ||
synchronized (this) { | ||
sendEmptyMessage(MSG_PREVIEW_STOP); | ||
if (thread == null) return; | ||
if (needWait && thread.isRunning) { | ||
try { | ||
if (DEBUG) Log.d(TAG, "wait for terminating of camera thread"); | ||
wait(); | ||
} catch (final InterruptedException e) { | ||
} | ||
} | ||
} | ||
} | ||
|
||
void changeManualFocusPoint(float eventX, float eventY, int viewWidth, int viewHeight) { | ||
this.viewWidth = viewWidth; | ||
this.viewHeight = viewHeight; | ||
this.eventX = eventX; | ||
this.eventY = eventY; | ||
sendMessage(obtainMessage(MSG_MANUAL_FOCUS)); | ||
} | ||
|
||
void changeAutoFocus() { | ||
sendMessage(obtainMessage(MSG_AUTO_FOCUS)); | ||
} | ||
|
||
void switchFlashMode() { | ||
sendMessage(obtainMessage(MSG_SWITCH_FLASH)); | ||
} | ||
|
||
/** | ||
* message handler for camera thread | ||
*/ | ||
@Override | ||
public void handleMessage(final Message msg) { | ||
switch (msg.what) { | ||
case MSG_PREVIEW_START: | ||
if (thread != null) { | ||
thread.startPreview(msg.arg1, msg.arg2); | ||
} | ||
break; | ||
case MSG_PREVIEW_STOP: | ||
if (thread != null) { | ||
thread.stopPreview(); | ||
} | ||
synchronized (this) { | ||
notifyAll(); | ||
} | ||
try { | ||
Looper.myLooper().quit(); | ||
removeCallbacks(thread); | ||
removeMessages(MSG_PREVIEW_START); | ||
removeMessages(MSG_PREVIEW_STOP); | ||
removeMessages(MSG_MANUAL_FOCUS); | ||
removeMessages(MSG_SWITCH_FLASH); | ||
removeMessages(MSG_AUTO_FOCUS); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
thread = null; | ||
break; | ||
case MSG_MANUAL_FOCUS: | ||
if (thread != null) { | ||
thread.changeManualFocusPoint(eventX, eventY, viewWidth, viewHeight); | ||
} | ||
break; | ||
case MSG_SWITCH_FLASH: | ||
if (thread != null) { | ||
thread.switchFlashMode(); | ||
} | ||
break; | ||
case MSG_AUTO_FOCUS: | ||
if (thread != null) { | ||
thread.changeAutoFocus(); | ||
} | ||
break; | ||
|
||
default: | ||
throw new RuntimeException("unknown message:what=" + msg.what); | ||
} | ||
} | ||
} | ||
|
19 changes: 19 additions & 0 deletions
19
gpuv/src/main/java/com/daasuu/gpuv/camerarecorder/CameraRecordListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.daasuu.gpuv.camerarecorder; | ||
|
||
/** | ||
* Created by sudamasayuki on 2018/03/13. | ||
*/ | ||
|
||
public interface CameraRecordListener { | ||
|
||
void onGetFlashSupport(boolean flashSupport); | ||
|
||
void onRecordComplete(); | ||
|
||
void onRecordStart(); | ||
|
||
void onError(Exception exception); | ||
|
||
void onCameraThreadFinish(); | ||
|
||
} |
Oops, something went wrong.