• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright 2018 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 "sdk/android/native_api/codecs/wrapper.h"
12 
13 #include <memory>
14 
15 #include "sdk/android/native_api/jni/scoped_java_ref.h"
16 #include "sdk/android/src/jni/video_codec_info.h"
17 #include "sdk/android/src/jni/video_decoder_factory_wrapper.h"
18 #include "sdk/android/src/jni/video_encoder_factory_wrapper.h"
19 #include "sdk/android/src/jni/video_encoder_wrapper.h"
20 
21 namespace webrtc {
22 
JavaToNativeVideoCodecInfo(JNIEnv * jni,jobject codec_info)23 SdpVideoFormat JavaToNativeVideoCodecInfo(JNIEnv* jni, jobject codec_info) {
24   return jni::VideoCodecInfoToSdpVideoFormat(jni,
25                                              JavaParamRef<jobject>(codec_info));
26 }
27 
JavaToNativeVideoDecoderFactory(JNIEnv * jni,jobject decoder_factory)28 std::unique_ptr<VideoDecoderFactory> JavaToNativeVideoDecoderFactory(
29     JNIEnv* jni,
30     jobject decoder_factory) {
31   return std::make_unique<jni::VideoDecoderFactoryWrapper>(
32       jni, JavaParamRef<jobject>(decoder_factory));
33 }
34 
JavaToNativeVideoEncoderFactory(JNIEnv * jni,jobject encoder_factory)35 std::unique_ptr<VideoEncoderFactory> JavaToNativeVideoEncoderFactory(
36     JNIEnv* jni,
37     jobject encoder_factory) {
38   return std::make_unique<jni::VideoEncoderFactoryWrapper>(
39       jni, JavaParamRef<jobject>(encoder_factory));
40 }
41 
42 std::vector<VideoEncoder::ResolutionBitrateLimits>
JavaToNativeResolutionBitrateLimits(JNIEnv * jni,const jobjectArray j_bitrate_limits_array)43 JavaToNativeResolutionBitrateLimits(JNIEnv* jni,
44                                     const jobjectArray j_bitrate_limits_array) {
45   return jni::JavaToNativeResolutionBitrateLimits(
46       jni, JavaParamRef<jobjectArray>(j_bitrate_limits_array));
47 }
48 
49 }  // namespace webrtc
50