xref: /aosp_15_r20/external/webrtc/sdk/android/src/jni/vp9_codec.cc (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright 2017 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #include <jni.h>
12 
13 #include "modules/video_coding/codecs/vp9/include/vp9.h"
14 #include "sdk/android/generated_libvpx_vp9_jni/LibvpxVp9Decoder_jni.h"
15 #include "sdk/android/generated_libvpx_vp9_jni/LibvpxVp9Encoder_jni.h"
16 #include "sdk/android/src/jni/jni_helpers.h"
17 
18 namespace webrtc {
19 namespace jni {
20 
JNI_LibvpxVp9Encoder_CreateEncoder(JNIEnv * jni)21 static jlong JNI_LibvpxVp9Encoder_CreateEncoder(JNIEnv* jni) {
22   return jlongFromPointer(VP9Encoder::Create().release());
23 }
24 
JNI_LibvpxVp9Encoder_IsSupported(JNIEnv * jni)25 static jboolean JNI_LibvpxVp9Encoder_IsSupported(JNIEnv* jni) {
26   return !SupportedVP9Codecs().empty();
27 }
28 
JNI_LibvpxVp9Decoder_CreateDecoder(JNIEnv * jni)29 static jlong JNI_LibvpxVp9Decoder_CreateDecoder(JNIEnv* jni) {
30   return jlongFromPointer(VP9Decoder::Create().release());
31 }
32 
JNI_LibvpxVp9Decoder_IsSupported(JNIEnv * jni)33 static jboolean JNI_LibvpxVp9Decoder_IsSupported(JNIEnv* jni) {
34   return !SupportedVP9Codecs().empty();
35 }
36 
37 }  // namespace jni
38 }  // namespace webrtc
39