Skip to content

Commit

Permalink
Update to latest Omega.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDaChicken committed Oct 16, 2023
1 parent c40794a commit d11d29e
Show file tree
Hide file tree
Showing 30 changed files with 365 additions and 291 deletions.
34 changes: 34 additions & 0 deletions lib/jni/jni/jutils/jutils-details.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,31 @@ struct jcast_helper<std::vector<char>, jbyteArray>
}
};

template<>
struct jcast_helper<std::vector<uint8_t>, jbyteArray>
{
static std::vector<uint8_t> cast(jbyteArray const& v)
{
JNIEnv* env = xbmc_jnienv();
jsize size = 0;
std::vector<uint8_t> vec;
if (v)
{
size = env->GetArrayLength(v);

vec.reserve(size);

jbyte* elements = env->GetByteArrayElements(v, NULL);
for (int i = 0; i < size; i++)
{
vec.emplace_back(static_cast<uint8_t>(elements[i]));
}
env->ReleaseByteArrayElements(v, elements, JNI_ABORT);
}
return vec;
}
};

template <>
struct jcast_helper<std::vector<int>, jintArray>
{
Expand Down Expand Up @@ -229,6 +254,15 @@ struct jcast_helper<std::vector<char>, jhbyteArray>
}
};

template<>
struct jcast_helper<std::vector<uint8_t>, jhbyteArray>
{
static std::vector<uint8_t> cast(jhbyteArray const& v)
{
return jcast_helper<std::vector<uint8_t>, jbyteArray>::cast(v.get());
}
};

template <>
struct jcast_helper<std::vector<int>, jhintArray>
{
Expand Down
13 changes: 6 additions & 7 deletions lib/jni/jni/src/MediaDrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ std::string CJNIMediaDrm::getPropertyString(const std::string &propertyName) con
jcast<jhstring>(propertyName)));
}

std::vector<char> CJNIMediaDrm::getPropertyByteArray(const std::string &propertyName) const
std::vector<uint8_t> CJNIMediaDrm::getPropertyByteArray(const std::string &propertyName) const
{
JNIEnv *env = xbmc_jnienv();
jhbyteArray array = call_method<jhbyteArray>(m_object,
"getPropertyByteArray", "(Ljava/lang/String;)[B",
jcast<jhstring>(propertyName));

std::vector<char> result;
std::vector<uint8_t> result;

if (!env->ExceptionCheck())
{
Expand All @@ -86,12 +86,11 @@ void CJNIMediaDrm::setPropertyString(const std::string &propertyName, const std:
jcast<jhstring>(propertyName), jcast<jhstring>(value));
}

void CJNIMediaDrm::setPropertyByteArray(const std::string &propertyName, const std::vector<char> &value) const
void CJNIMediaDrm::setPropertyByteArray(const std::string &propertyName, const std::vector<uint8_t> &value) const
{
JNIEnv *env = xbmc_jnienv();
call_method<void>(m_object,
"setPropertyByteArray", "(Ljava/lang/String;[B)V",
jcast<jhstring>(propertyName), jcast<jhbyteArray, std::vector<char> >(value));
JNIEnv* env = xbmc_jnienv();
call_method<void>(m_object, "setPropertyByteArray", "(Ljava/lang/String;[B)V",
jcast<jhstring>(propertyName), jcast<jhbyteArray, std::vector<uint8_t>>(value));
}

CJNIMediaDrmKeyRequest CJNIMediaDrm::getKeyRequest(
Expand Down
4 changes: 2 additions & 2 deletions lib/jni/jni/src/MediaDrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ class CJNIMediaDrm : public CJNIBase
void closeSession(const std::vector<char> & sessionId) const;

std::string getPropertyString(const std::string &propertyName) const;
std::vector<char> getPropertyByteArray(const std::string &propertyName) const;
std::vector<uint8_t> getPropertyByteArray(const std::string& propertyName) const;
void setPropertyString(const std::string &propertyName, const std::string &value) const;
void setPropertyByteArray(const std::string &propertyName, const std::vector<char> &value) const;
void setPropertyByteArray(const std::string &propertyName, const std::vector<uint8_t> &value) const;

CJNIMediaDrmKeyRequest getKeyRequest(const std::vector<char> &scope,
const std::vector<uint8_t> &init, const std::string &mimeType, int keyType,
Expand Down
3 changes: 0 additions & 3 deletions src/Iaes_decrypter.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,4 @@ class IAESDecrypter
virtual void ivFromSequence(uint8_t* buffer, uint64_t sid) = 0;
virtual const std::string& getLicenseKey() const = 0;
virtual bool RenewLicense(const std::string& pluginUrl) = 0;

private:
std::string m_licenseKey;
};
Loading

0 comments on commit d11d29e

Please sign in to comment.