blob: bacb4a826d8a00bcc8ef56c59c0ef397bb55f3fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
/*
* Copyright (C) 2020 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#include "JNIXBMCTextureCache.h"
#include "CompileInfo.h"
#include "TextureCache.h"
#include <androidjni/Context.h>
#include <androidjni/jutils-details.hpp>
using namespace jni;
static std::string s_className = std::string(CCompileInfo::GetClass()) + "/XBMCTextureCache";
void CJNIXBMCTextureCache::RegisterNatives(JNIEnv* env)
{
jclass cClass = env->FindClass(s_className.c_str());
if (cClass)
{
JNINativeMethod methods[] = {
{"_unwrapImageURL", "(Ljava/lang/String;)Ljava/lang/String;",
(void*)&CJNIXBMCTextureCache::_unwrapImageURL},
};
env->RegisterNatives(cClass, methods, sizeof(methods) / sizeof(methods[0]));
}
}
jstring CJNIXBMCTextureCache::_unwrapImageURL(JNIEnv* env, jobject thiz, jstring image)
{
std::string strImage = jcast<std::string>(jhstring::fromJNI(image));
std::string responseData = CTextureUtils::UnwrapImageURL(strImage);
jstring jres = env->NewStringUTF(responseData.c_str());
return jres;
}
|