From 9fb33c83078e0282beef7554bb881bc5d1a2bc69 Mon Sep 17 00:00:00 2001 From: jiangdongguo <765067602@qq.com> Date: Tue, 17 Oct 2017 16:51:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96h264?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../usb/common/AbstractUVCCameraHandler.java | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/libusbcamera/src/main/java/com/serenegiant/usb/common/AbstractUVCCameraHandler.java b/libusbcamera/src/main/java/com/serenegiant/usb/common/AbstractUVCCameraHandler.java index 66e92f1..7bbc799 100644 --- a/libusbcamera/src/main/java/com/serenegiant/usb/common/AbstractUVCCameraHandler.java +++ b/libusbcamera/src/main/java/com/serenegiant/usb/common/AbstractUVCCameraHandler.java @@ -1,5 +1,6 @@ package com.serenegiant.usb.common; +import android.annotation.TargetApi; import android.app.Activity; import android.content.Context; import android.graphics.Bitmap; @@ -8,6 +9,7 @@ import android.hardware.usb.UsbDevice; import android.media.AudioManager; import android.media.MediaScannerConnection; import android.media.SoundPool; +import android.os.Build; import android.os.Environment; import android.os.Handler; import android.os.Looper; @@ -614,6 +616,7 @@ public abstract class AbstractUVCCameraHandler extends Handler { } }; + @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public void handleUpdateMedia(final String path) { if (DEBUG) Log.v(TAG_THREAD, "handleUpdateMedia:path=" + path); final Activity parent = mWeakParent.get(); @@ -666,6 +669,7 @@ public abstract class AbstractUVCCameraHandler extends Handler { } } + @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) @Override public void onStopped(final MediaEncoder encoder) { if (DEBUG) Log.v(TAG_THREAD, "onStopped:encoder=" + encoder); @@ -703,16 +707,16 @@ public abstract class AbstractUVCCameraHandler extends Handler { }; - private void loadShutterSound(final Context context) { - // get system stream type using reflection - int streamType; - try { - final Class audioSystemClass = Class.forName("android.media.AudioSystem"); - final Field sseField = audioSystemClass.getDeclaredField("STREAM_SYSTEM_ENFORCED"); - streamType = sseField.getInt(null); - } catch (final Exception e) { - streamType = AudioManager.STREAM_SYSTEM; // set appropriate according to your app policy - } +// private void loadShutterSound(final Context context) { +// // get system stream type using reflection +// int streamType; +// try { +// final Class audioSystemClass = Class.forName("android.media.AudioSystem"); +// final Field sseField = audioSystemClass.getDeclaredField("STREAM_SYSTEM_ENFORCED"); +// streamType = sseField.getInt(null); +// } catch (final Exception e) { +// streamType = AudioManager.STREAM_SYSTEM; // set appropriate according to your app policy +// } // if (mSoundPool != null) { // try { // mSoundPool.release(); @@ -723,7 +727,7 @@ public abstract class AbstractUVCCameraHandler extends Handler { // // load shutter sound from resource // mSoundPool = new SoundPool(2, streamType, 0); // mSoundId = mSoundPool.load(context, R.raw.camera_click, 1); - } +// } /** * prepare and load shutter sound for still image capturing