transcoding: Remove MediaTranscodeManager's jni files.
Bug: 160260102 Test: Unit test Change-Id: Ie29b0c3ccf0955801df99b9dc8bc3d7358cf7a18
This commit is contained in:
@@ -166,26 +166,3 @@ cc_library_shared {
|
||||
],
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "libmediatranscodemanager_jni",
|
||||
srcs: [
|
||||
"android_media_MediaTranscodeManager.cpp",
|
||||
],
|
||||
|
||||
shared_libs: [
|
||||
"libandroid_runtime",
|
||||
"libcutils",
|
||||
"liblog",
|
||||
"libmedia",
|
||||
],
|
||||
|
||||
export_include_dirs: ["."],
|
||||
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
"-Wno-error=deprecated-declarations",
|
||||
"-Wunused",
|
||||
"-Wunreachable-code",
|
||||
],
|
||||
}
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
/*
|
||||
* Copyright 2019, The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "MediaTranscodeManager_JNI"
|
||||
|
||||
#include "android_runtime/AndroidRuntime.h"
|
||||
#include "jni.h"
|
||||
|
||||
#include <nativehelper/JNIHelp.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
namespace {
|
||||
|
||||
// NOTE: Keep these enums in sync with their equivalents in MediaTranscodeManager.java.
|
||||
enum {
|
||||
ID_INVALID = -1
|
||||
};
|
||||
|
||||
enum {
|
||||
EVENT_JOB_STARTED = 1,
|
||||
EVENT_JOB_PROGRESSED = 2,
|
||||
EVENT_JOB_FINISHED = 3,
|
||||
};
|
||||
|
||||
enum {
|
||||
RESULT_NONE = 1,
|
||||
RESULT_SUCCESS = 2,
|
||||
RESULT_ERROR = 3,
|
||||
RESULT_CANCELED = 4,
|
||||
};
|
||||
|
||||
struct {
|
||||
jmethodID postEventFromNative;
|
||||
} gMediaTranscodeManagerClassInfo;
|
||||
|
||||
using namespace android;
|
||||
|
||||
void android_media_MediaTranscodeManager_native_init(JNIEnv *env, jclass clazz) {
|
||||
ALOGV("android_media_MediaTranscodeManager_native_init");
|
||||
|
||||
gMediaTranscodeManagerClassInfo.postEventFromNative = env->GetMethodID(
|
||||
clazz, "postEventFromNative", "(IJI)V");
|
||||
LOG_ALWAYS_FATAL_IF(gMediaTranscodeManagerClassInfo.postEventFromNative == NULL,
|
||||
"can't find android/media/MediaTranscodeManager.postEventFromNative");
|
||||
}
|
||||
|
||||
jlong android_media_MediaTranscodeManager_requestUniqueJobID(
|
||||
JNIEnv *env __unused, jobject thiz __unused) {
|
||||
ALOGV("android_media_MediaTranscodeManager_reserveUniqueJobID");
|
||||
static std::atomic_int32_t sJobIDCounter{0};
|
||||
jlong id = (jlong)++sJobIDCounter;
|
||||
return id;
|
||||
}
|
||||
|
||||
jboolean android_media_MediaTranscodeManager_enqueueTranscodingRequest(
|
||||
JNIEnv *env, jobject thiz, jlong id, jobject request, jobject context __unused) {
|
||||
ALOGV("android_media_MediaTranscodeManager_enqueueTranscodingRequest");
|
||||
if (!request) {
|
||||
return ID_INVALID;
|
||||
}
|
||||
|
||||
env->CallVoidMethod(thiz, gMediaTranscodeManagerClassInfo.postEventFromNative,
|
||||
EVENT_JOB_FINISHED, id, RESULT_ERROR);
|
||||
return true;
|
||||
}
|
||||
|
||||
void android_media_MediaTranscodeManager_cancelTranscodingRequest(
|
||||
JNIEnv *env __unused, jobject thiz __unused, jlong jobID __unused) {
|
||||
ALOGV("android_media_MediaTranscodeManager_cancelTranscodingRequest");
|
||||
}
|
||||
|
||||
const JNINativeMethod gMethods[] = {
|
||||
{ "native_init", "()V",
|
||||
(void *)android_media_MediaTranscodeManager_native_init },
|
||||
{ "native_requestUniqueJobID", "()J",
|
||||
(void *)android_media_MediaTranscodeManager_requestUniqueJobID },
|
||||
{ "native_enqueueTranscodingRequest",
|
||||
"(JLandroid/media/MediaTranscodeManager$TranscodingRequest;Landroid/content/Context;)Z",
|
||||
(void *)android_media_MediaTranscodeManager_enqueueTranscodingRequest },
|
||||
{ "native_cancelTranscodingRequest", "(J)V",
|
||||
(void *)android_media_MediaTranscodeManager_cancelTranscodingRequest },
|
||||
};
|
||||
|
||||
} // namespace anonymous
|
||||
|
||||
int register_android_media_MediaTranscodeManager(JNIEnv *env) {
|
||||
return AndroidRuntime::registerNativeMethods(env,
|
||||
"android/media/MediaTranscodeManager", gMethods, NELEM(gMethods));
|
||||
}
|
||||
|
||||
jint JNI_OnLoad(JavaVM* vm, void* /* reserved */)
|
||||
{
|
||||
JNIEnv* env = NULL;
|
||||
jint result = -1;
|
||||
|
||||
if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
|
||||
ALOGE("ERROR: GetEnv failed\n");
|
||||
return result;
|
||||
}
|
||||
assert(env != NULL);
|
||||
|
||||
if (register_android_media_MediaTranscodeManager(env) < 0) {
|
||||
ALOGE("ERROR: MediaTranscodeManager native registration failed");
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* success -- return valid version number */
|
||||
result = JNI_VERSION_1_4;
|
||||
|
||||
bail:
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user