зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1192539 - [1.3] Add MediaCodecList JNI query support. r=snorp
This commit is contained in:
Родитель
d3f830df59
Коммит
c8c5cdce50
|
@ -6,6 +6,7 @@
|
|||
|
||||
package org.mozilla.gecko.util;
|
||||
|
||||
import org.mozilla.gecko.annotation.WrapForJNI;
|
||||
import org.mozilla.gecko.AppConstants.Versions;
|
||||
|
||||
import android.media.MediaCodecInfo;
|
||||
|
@ -35,6 +36,21 @@ public final class HardwareCodecCapabilityUtils {
|
|||
COLOR_QCOM_FORMATYUV420PackedSemiPlanar32m
|
||||
};
|
||||
|
||||
@WrapForJNI(allowMultithread = true, stubName = "FindDecoderCodecInfoForMimeType")
|
||||
public static boolean findDecoderCodecInfoForMimeType(String aMimeType) {
|
||||
for (int i = 0; i < MediaCodecList.getCodecCount(); ++i) {
|
||||
MediaCodecInfo info = MediaCodecList.getCodecInfoAt(i);
|
||||
if (info.isEncoder()) {
|
||||
continue;
|
||||
}
|
||||
for (String mimeType : info.getSupportedTypes()) {
|
||||
if (mimeType.equals(aMimeType)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean getHWEncoderCapability() {
|
||||
if (Versions.feature20Plus) {
|
||||
|
|
|
@ -1761,6 +1761,16 @@ auto Clipboard::SetClipboardText(mozilla::jni::String::Param a0) -> void
|
|||
return mozilla::jni::Method<SetClipboardText_t>::Call(nullptr, nullptr, a0);
|
||||
}
|
||||
|
||||
constexpr char HardwareCodecCapabilityUtils::name[];
|
||||
|
||||
constexpr char HardwareCodecCapabilityUtils::FindDecoderCodecInfoForMimeType_t::name[];
|
||||
constexpr char HardwareCodecCapabilityUtils::FindDecoderCodecInfoForMimeType_t::signature[];
|
||||
|
||||
auto HardwareCodecCapabilityUtils::FindDecoderCodecInfoForMimeType(mozilla::jni::String::Param a0) -> bool
|
||||
{
|
||||
return mozilla::jni::Method<FindDecoderCodecInfoForMimeType_t>::Call(nullptr, nullptr, a0);
|
||||
}
|
||||
|
||||
constexpr char NativeJSContainer::name[];
|
||||
|
||||
constexpr char NativeJSContainer::New_t::name[];
|
||||
|
|
|
@ -4677,6 +4677,40 @@ public:
|
|||
|
||||
};
|
||||
|
||||
class HardwareCodecCapabilityUtils : public mozilla::jni::Class<HardwareCodecCapabilityUtils>
|
||||
{
|
||||
public:
|
||||
typedef mozilla::jni::Ref<HardwareCodecCapabilityUtils> Ref;
|
||||
typedef mozilla::jni::LocalRef<HardwareCodecCapabilityUtils> LocalRef;
|
||||
typedef mozilla::jni::GlobalRef<HardwareCodecCapabilityUtils> GlobalRef;
|
||||
typedef const mozilla::jni::Param<HardwareCodecCapabilityUtils>& Param;
|
||||
|
||||
static constexpr char name[] =
|
||||
"org/mozilla/gecko/util/HardwareCodecCapabilityUtils";
|
||||
|
||||
protected:
|
||||
HardwareCodecCapabilityUtils(jobject instance) : Class(instance) {}
|
||||
|
||||
public:
|
||||
struct FindDecoderCodecInfoForMimeType_t {
|
||||
typedef HardwareCodecCapabilityUtils Owner;
|
||||
typedef bool ReturnType;
|
||||
typedef bool SetterType;
|
||||
typedef mozilla::jni::Args<
|
||||
mozilla::jni::String::Param> Args;
|
||||
static constexpr char name[] = "findDecoderCodecInfoForMimeType";
|
||||
static constexpr char signature[] =
|
||||
"(Ljava/lang/String;)Z";
|
||||
static const bool isStatic = true;
|
||||
static const bool isMultithreaded = true;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
static auto FindDecoderCodecInfoForMimeType(mozilla::jni::String::Param) -> bool;
|
||||
|
||||
};
|
||||
|
||||
class NativeJSContainer : public mozilla::jni::Class<NativeJSContainer>
|
||||
{
|
||||
public:
|
||||
|
|
Загрузка…
Ссылка в новой задаче