2 * Copyright (C) 2020 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
9 #include "JNIXBMCTextureCache.h"
11 #include "CompileInfo.h"
12 #include "imagefiles/ImageFileURL.h"
14 #include <androidjni/Context.h>
15 #include <androidjni/jutils-details.hpp>
19 static std::string s_className
= std::string(CCompileInfo::GetClass()) + "/XBMCTextureCache";
21 void CJNIXBMCTextureCache::RegisterNatives(JNIEnv
* env
)
23 jclass cClass
= env
->FindClass(s_className
.c_str());
26 JNINativeMethod methods
[] = {
27 {"_unwrapImageURL", "(Ljava/lang/String;)Ljava/lang/String;",
28 (void*)&CJNIXBMCTextureCache::_unwrapImageURL
},
31 env
->RegisterNatives(cClass
, methods
, sizeof(methods
) / sizeof(methods
[0]));
35 jstring
CJNIXBMCTextureCache::_unwrapImageURL(JNIEnv
* env
, jobject thiz
, jstring image
)
37 std::string strImage
= jcast
<std::string
>(jhstring::fromJNI(image
));
38 std::string responseData
= IMAGE_FILES::ToCacheKey(strImage
);
40 jstring jres
= env
->NewStringUTF(responseData
.c_str());