Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/surface view #626

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
release/
# built application files
*.apk
*.ap_
Expand Down Expand Up @@ -49,6 +50,7 @@ build
# gedit
*~

.idea/
.idea/*.xml
!.idea/codeStyleSettings.xml
!.idea/copyright/*.xml
Expand Down
22 changes: 0 additions & 22 deletions .idea/compiler.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/encodings.xml

This file was deleted.

29 changes: 0 additions & 29 deletions .idea/gradle.xml

This file was deleted.

118 changes: 0 additions & 118 deletions .idea/inspectionProfiles/Project_Default.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

19 changes: 0 additions & 19 deletions .idea/modules.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

2 changes: 1 addition & 1 deletion UVCCamera.iml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="UVCCamera" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<module external.linked.project.id="UVCCamera" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.android.tools.build:gradle:4.0.0'
}
}

Expand All @@ -26,7 +26,7 @@ task clean(type: Delete) {
ext {
supportLibVersion = '27.1.1' // variable that can be referenced to keep support libs consistent
commonLibVersion= '2.12.4'
versionBuildTool = '27.0.3'
versionBuildTool = '29.0.2'
versionCompiler = 27
versionTarget = 27
versionNameString = '1.0.0'
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Oct 02 16:16:11 JST 2018
#Mon Jun 29 14:24:40 CST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
4 changes: 1 addition & 3 deletions libuvccamera/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
android:versionCode="2"
android:versionName="1.1" >

<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="22" />
<uses-sdk android:targetSdkVersion="22" />

</manifest>
20 changes: 14 additions & 6 deletions libuvccamera/src/main/java/com/serenegiant/usb/UVCCamera.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class UVCCamera {
public static final int DEFAULT_PREVIEW_MAX_FPS = 30;
public static final float DEFAULT_BANDWIDTH = 1.0f;

public static final int FRAME_FORMAT_YUYV = 0;
public static final int FRAME_FORMAT_H264 = 0;
public static final int FRAME_FORMAT_MJPEG = 1;

public static final int PIXEL_FORMAT_RAW = 0;
Expand Down Expand Up @@ -204,10 +204,18 @@ public synchronized void open(final UsbControlBlock ctrlBlock) {
throw new UnsupportedOperationException("open failed:result=" + result);
}
if (mNativePtr != 0 && TextUtils.isEmpty(mSupportedSize)) {
mSupportedSize = nativeGetSupportedSize(mNativePtr);
mSupportedSize = nativeGetSupportedSize(mNativePtr);
Log.e(TAG, "open: mSupportedSize " + mSupportedSize);
}
nativeSetPreviewSize(mNativePtr, DEFAULT_PREVIEW_WIDTH, DEFAULT_PREVIEW_HEIGHT,
int ret = nativeSetPreviewSize(mNativePtr, DEFAULT_PREVIEW_WIDTH, DEFAULT_PREVIEW_HEIGHT,
DEFAULT_PREVIEW_MIN_FPS, DEFAULT_PREVIEW_MAX_FPS, DEFAULT_PREVIEW_MODE, DEFAULT_BANDWIDTH);
Log.e(TAG, "open: nativeSetPreviewSize"
+ DEFAULT_PREVIEW_WIDTH + " "
+ DEFAULT_PREVIEW_WIDTH + " "
+ DEFAULT_PREVIEW_MIN_FPS + " "
+ DEFAULT_PREVIEW_MAX_FPS + " "
+ DEFAULT_PREVIEW_MODE + " "
+ DEFAULT_BANDWIDTH);
}

/**
Expand Down Expand Up @@ -293,7 +301,7 @@ public void setPreviewSize(final int width, final int height) {
* Set preview size and preview mode
* @param width
* @param height
* @param frameFormat either FRAME_FORMAT_YUYV(0) or FRAME_FORMAT_MJPEG(1)
* @param frameFormat either FRAME_FORMAT_H264(0) or FRAME_FORMAT_MJPEG(1)
*/
public void setPreviewSize(final int width, final int height, final int frameFormat) {
setPreviewSize(width, height, DEFAULT_PREVIEW_MIN_FPS, DEFAULT_PREVIEW_MAX_FPS, frameFormat, mCurrentBandwidthFactor);
Expand All @@ -303,7 +311,7 @@ public void setPreviewSize(final int width, final int height, final int frameFor
* Set preview size and preview mode
* @param width
@param height
@param frameFormat either FRAME_FORMAT_YUYV(0) or FRAME_FORMAT_MJPEG(1)
@param frameFormat either FRAME_FORMAT_H264(0) or FRAME_FORMAT_MJPEG(1)
@param bandwidth [0.0f,1.0f]
*/
public void setPreviewSize(final int width, final int height, final int frameFormat, final float bandwidth) {
Expand All @@ -316,7 +324,7 @@ public void setPreviewSize(final int width, final int height, final int frameFor
* @param height
* @param min_fps
* @param max_fps
* @param frameFormat either FRAME_FORMAT_YUYV(0) or FRAME_FORMAT_MJPEG(1)
* @param frameFormat either FRAME_FORMAT_H264(0) or FRAME_FORMAT_MJPEG(1)
* @param bandwidthFactor
*/
public void setPreviewSize(final int width, final int height, final int min_fps, final int max_fps, final int frameFormat, final float bandwidthFactor) {
Expand Down
2 changes: 1 addition & 1 deletion libuvccamera/src/main/jni/Application.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
#NDK_TOOLCHAIN_VERSION := 4.9

APP_PLATFORM := android-14
APP_ABI := armeabi armeabi-v7a x86 mips
APP_ABI := armeabi-v7a arm64-v8a
#APP_OPTIM := debug
APP_OPTIM := release
4 changes: 4 additions & 0 deletions libuvccamera/src/main/jni/UVCCamera/Parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ static const char *_uvc_name_for_format_subtype(uint8_t subtype) {
return "UncompressedFormat";
case UVC_VS_FORMAT_MJPEG:
return "MJPEGFormat";
case UVC_VS_FORMAT_FRAME_BASED:
return "H264";
default:
return "Unknown";
}
Expand Down Expand Up @@ -237,6 +239,7 @@ static void writerFormatDescriptions(Writer<StringBuffer> &writer, uvc_streaming
switch (fmt_desc->bDescriptorSubtype) {
case UVC_VS_FORMAT_UNCOMPRESSED:
case UVC_VS_FORMAT_MJPEG:
case UVC_VS_FORMAT_FRAME_BASED:
writerFormat(writer, fmt_desc);
break;
default:
Expand Down Expand Up @@ -365,6 +368,7 @@ char *UVCDiags::getSupportedSize(const uvc_device_handle_t *deviceHandle) {
switch (fmt_desc->bDescriptorSubtype) {
case UVC_VS_FORMAT_UNCOMPRESSED:
case UVC_VS_FORMAT_MJPEG:
case UVC_VS_FORMAT_FRAME_BASED:
write(writer, "index", fmt_desc->bFormatIndex);
write(writer, "type", fmt_desc->bDescriptorSubtype);
write(writer, "default", fmt_desc->bDefaultFrameIndex);
Expand Down
Loading