зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1306185-[Part1] Provide Java interface to bridge Gecko's gmp-decryption-like API and MediaDrm API r=cpearce,jchen
MozReview-Commit-ID: 3jxofUxcTA9 --HG-- extra : rebase_source : c00f4d79aeca0fbee0cdf16789a7a6ceadab0317
This commit is contained in:
Родитель
9e8e7969e0
Коммит
eb35a8ab7e
|
@ -0,0 +1,35 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.gecko.media;
|
||||
|
||||
import android.media.MediaCrypto;
|
||||
|
||||
public interface GeckoMediaDrm {
|
||||
public interface Callbacks {
|
||||
void onSessionCreated(int createSessionToken,
|
||||
int promiseId,
|
||||
byte[] sessionId,
|
||||
byte[] request);
|
||||
void onSessionUpdated(int promiseId, byte[] sessionId);
|
||||
void onSessionClosed(int promiseId, byte[] sessionId);
|
||||
void onSessionMessage(byte[] sessionId,
|
||||
int sessionMessageType,
|
||||
byte[] request);
|
||||
void onSessionError(byte[] sessionId, String message);
|
||||
void onSessionBatchedKeyChanged(byte[] sessionId,
|
||||
SessionKeyInfo[] keyInfos);
|
||||
// All failure cases should go through this function.
|
||||
void onRejectPromise(int promiseId, String message);
|
||||
}
|
||||
void setCallbacks(Callbacks callbacks);
|
||||
void createSession(int createSessionToken,
|
||||
int promiseId,
|
||||
String initDataType,
|
||||
byte[] initData);
|
||||
void updateSession(int promiseId, String sessionId, byte[] response);
|
||||
void closeSession(int promiseId, String sessionId);
|
||||
void release();
|
||||
MediaCrypto getMediaCrypto();
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.gecko.media;
|
||||
|
||||
import org.mozilla.gecko.annotation.WrapForJNI;
|
||||
|
||||
@WrapForJNI
|
||||
public final class SessionKeyInfo {
|
||||
public byte[] keyId;
|
||||
public int status;
|
||||
|
||||
public SessionKeyInfo(byte[] keyId, int status) {
|
||||
this.keyId = keyId;
|
||||
this.status = status;
|
||||
}
|
||||
}
|
|
@ -555,6 +555,7 @@ gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [
|
|||
'media/Codec.java',
|
||||
'media/CodecProxy.java',
|
||||
'media/FormatParam.java',
|
||||
'media/GeckoMediaDrm.java',
|
||||
'media/JellyBeanAsyncCodec.java',
|
||||
'media/MediaControlService.java',
|
||||
'media/MediaDrmProxy.java',
|
||||
|
@ -562,6 +563,7 @@ gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [
|
|||
'media/RemoteManager.java',
|
||||
'media/Sample.java',
|
||||
'media/SamplePool.java',
|
||||
'media/SessionKeyInfo.java',
|
||||
'media/VideoPlayer.java',
|
||||
'MediaCastingBar.java',
|
||||
'MemoryMonitor.java',
|
||||
|
|
|
@ -311,6 +311,43 @@ auto Sample::Info(mozilla::jni::Object::Param a0) const -> void
|
|||
return mozilla::jni::Field<Info_t>::Set(Sample::mCtx, nullptr, a0);
|
||||
}
|
||||
|
||||
const char SessionKeyInfo::name[] =
|
||||
"org/mozilla/gecko/media/SessionKeyInfo";
|
||||
|
||||
constexpr char SessionKeyInfo::New_t::name[];
|
||||
constexpr char SessionKeyInfo::New_t::signature[];
|
||||
|
||||
auto SessionKeyInfo::New(mozilla::jni::ByteArray::Param a0, int32_t a1) -> SessionKeyInfo::LocalRef
|
||||
{
|
||||
return mozilla::jni::Constructor<New_t>::Call(SessionKeyInfo::Context(), nullptr, a0, a1);
|
||||
}
|
||||
|
||||
constexpr char SessionKeyInfo::KeyId_t::name[];
|
||||
constexpr char SessionKeyInfo::KeyId_t::signature[];
|
||||
|
||||
auto SessionKeyInfo::KeyId() const -> mozilla::jni::ByteArray::LocalRef
|
||||
{
|
||||
return mozilla::jni::Field<KeyId_t>::Get(SessionKeyInfo::mCtx, nullptr);
|
||||
}
|
||||
|
||||
auto SessionKeyInfo::KeyId(mozilla::jni::ByteArray::Param a0) const -> void
|
||||
{
|
||||
return mozilla::jni::Field<KeyId_t>::Set(SessionKeyInfo::mCtx, nullptr, a0);
|
||||
}
|
||||
|
||||
constexpr char SessionKeyInfo::Status_t::name[];
|
||||
constexpr char SessionKeyInfo::Status_t::signature[];
|
||||
|
||||
auto SessionKeyInfo::Status() const -> int32_t
|
||||
{
|
||||
return mozilla::jni::Field<Status_t>::Get(SessionKeyInfo::mCtx, nullptr);
|
||||
}
|
||||
|
||||
auto SessionKeyInfo::Status(int32_t a0) const -> void
|
||||
{
|
||||
return mozilla::jni::Field<Status_t>::Set(SessionKeyInfo::mCtx, nullptr, a0);
|
||||
}
|
||||
|
||||
const char Restrictions::name[] =
|
||||
"org/mozilla/gecko/restrictions/Restrictions";
|
||||
|
||||
|
|
|
@ -1060,6 +1060,81 @@ public:
|
|||
|
||||
};
|
||||
|
||||
class SessionKeyInfo : public mozilla::jni::ObjectBase<SessionKeyInfo>
|
||||
{
|
||||
public:
|
||||
static const char name[];
|
||||
|
||||
explicit SessionKeyInfo(const Context& ctx) : ObjectBase<SessionKeyInfo>(ctx) {}
|
||||
|
||||
struct New_t {
|
||||
typedef SessionKeyInfo Owner;
|
||||
typedef SessionKeyInfo::LocalRef ReturnType;
|
||||
typedef SessionKeyInfo::Param SetterType;
|
||||
typedef mozilla::jni::Args<
|
||||
mozilla::jni::ByteArray::Param,
|
||||
int32_t> Args;
|
||||
static constexpr char name[] = "<init>";
|
||||
static constexpr char signature[] =
|
||||
"([BI)V";
|
||||
static const bool isStatic = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
static const mozilla::jni::CallingThread callingThread =
|
||||
mozilla::jni::CallingThread::ANY;
|
||||
static const mozilla::jni::DispatchTarget dispatchTarget =
|
||||
mozilla::jni::DispatchTarget::CURRENT;
|
||||
};
|
||||
|
||||
static auto New(mozilla::jni::ByteArray::Param, int32_t) -> SessionKeyInfo::LocalRef;
|
||||
|
||||
struct KeyId_t {
|
||||
typedef SessionKeyInfo Owner;
|
||||
typedef mozilla::jni::ByteArray::LocalRef ReturnType;
|
||||
typedef mozilla::jni::ByteArray::Param SetterType;
|
||||
typedef mozilla::jni::Args<> Args;
|
||||
static constexpr char name[] = "keyId";
|
||||
static constexpr char signature[] =
|
||||
"[B";
|
||||
static const bool isStatic = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
static const mozilla::jni::CallingThread callingThread =
|
||||
mozilla::jni::CallingThread::ANY;
|
||||
static const mozilla::jni::DispatchTarget dispatchTarget =
|
||||
mozilla::jni::DispatchTarget::CURRENT;
|
||||
};
|
||||
|
||||
auto KeyId() const -> mozilla::jni::ByteArray::LocalRef;
|
||||
|
||||
auto KeyId(mozilla::jni::ByteArray::Param) const -> void;
|
||||
|
||||
struct Status_t {
|
||||
typedef SessionKeyInfo Owner;
|
||||
typedef int32_t ReturnType;
|
||||
typedef int32_t SetterType;
|
||||
typedef mozilla::jni::Args<> Args;
|
||||
static constexpr char name[] = "status";
|
||||
static constexpr char signature[] =
|
||||
"I";
|
||||
static const bool isStatic = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
static const mozilla::jni::CallingThread callingThread =
|
||||
mozilla::jni::CallingThread::ANY;
|
||||
static const mozilla::jni::DispatchTarget dispatchTarget =
|
||||
mozilla::jni::DispatchTarget::CURRENT;
|
||||
};
|
||||
|
||||
auto Status() const -> int32_t;
|
||||
|
||||
auto Status(int32_t) const -> void;
|
||||
|
||||
static const mozilla::jni::CallingThread callingThread =
|
||||
mozilla::jni::CallingThread::ANY;
|
||||
|
||||
};
|
||||
|
||||
class Restrictions : public mozilla::jni::ObjectBase<Restrictions>
|
||||
{
|
||||
public:
|
||||
|
|
Загрузка…
Ссылка в новой задаче