blob: 08cafd83b8cc5fd41743816a7b7dafa296e7aec9 [file] [log] [blame]
Sami Kalliomäki82f96e62018-01-29 13:18:57 +01001/*
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
Mirko Bonadei317a1f02019-09-17 17:06:18 +020013#include <memory>
14
Rasmus Brandtbfd44e02018-07-06 10:34:57 +020015#include "sdk/android/native_api/jni/scoped_java_ref.h"
Steve Anton10542f22019-01-11 09:11:00 -080016#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"
Sami Kalliomäki82f96e62018-01-29 13:18:57 +010019
20namespace webrtc {
21
Rasmus Brandtbfd44e02018-07-06 10:34:57 +020022SdpVideoFormat JavaToNativeVideoCodecInfo(JNIEnv* jni, jobject codec_info) {
23 return jni::VideoCodecInfoToSdpVideoFormat(jni,
24 JavaParamRef<jobject>(codec_info));
25}
26
Sami Kalliomäki82f96e62018-01-29 13:18:57 +010027std::unique_ptr<VideoDecoderFactory> JavaToNativeVideoDecoderFactory(
28 JNIEnv* jni,
29 jobject decoder_factory) {
Mirko Bonadei317a1f02019-09-17 17:06:18 +020030 return std::make_unique<jni::VideoDecoderFactoryWrapper>(
Sami Kalliomäki82f96e62018-01-29 13:18:57 +010031 jni, JavaParamRef<jobject>(decoder_factory));
32}
33
34std::unique_ptr<VideoEncoderFactory> JavaToNativeVideoEncoderFactory(
35 JNIEnv* jni,
Rasmus Brandtbfd44e02018-07-06 10:34:57 +020036 jobject encoder_factory) {
Mirko Bonadei317a1f02019-09-17 17:06:18 +020037 return std::make_unique<jni::VideoEncoderFactoryWrapper>(
Rasmus Brandtbfd44e02018-07-06 10:34:57 +020038 jni, JavaParamRef<jobject>(encoder_factory));
Sami Kalliomäki82f96e62018-01-29 13:18:57 +010039}
40
41} // namespace webrtc