Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MasayukiSuda committed Jan 17, 2019
1 parent 43922c4 commit 7fd7ed7
Show file tree
Hide file tree
Showing 160 changed files with 11,567 additions and 0 deletions.
Binary file added art/art.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/camera.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/gray_scale_filter_apply.mp4
Binary file not shown.
Binary file added art/grayscale.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/monochrome.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/monochrome_filter_apply.mp4
Binary file not shown.
Binary file added art/sample.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/samplevideo.mp4
Binary file not shown.
Binary file added art/watermark.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/watermark_filter_apply.mp4
Binary file not shown.
27 changes: 27 additions & 0 deletions build.gradle
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
}
1 change: 1 addition & 0 deletions gpuv/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
30 changes: 30 additions & 0 deletions gpuv/build.gradle
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'

}
21 changes: 21 additions & 0 deletions gpuv/proguard-rules.pro
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
2 changes: 2 additions & 0 deletions gpuv/src/main/AndroidManifest.xml
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 gpuv/src/main/java/com/daasuu/gpuv/camerarecorder/CameraHandler.java
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);
}
}
}

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();

}
Loading

0 comments on commit 7fd7ed7

Please sign in to comment.