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 "sdk/android/src/jni/video_codec_info.h"
12
13 #include "sdk/android/generated_video_jni/VideoCodecInfo_jni.h"
14 #include "sdk/android/native_api/jni/java_types.h"
15 #include "sdk/android/src/jni/jni_helpers.h"
16
17 namespace webrtc {
18 namespace jni {
19
VideoCodecInfoToSdpVideoFormat(JNIEnv * jni,const JavaRef<jobject> & j_info)20 SdpVideoFormat VideoCodecInfoToSdpVideoFormat(JNIEnv* jni,
21 const JavaRef<jobject>& j_info) {
22 return SdpVideoFormat(
23 JavaToNativeString(jni, Java_VideoCodecInfo_getName(jni, j_info)),
24 JavaToNativeStringMap(jni, Java_VideoCodecInfo_getParams(jni, j_info)));
25 }
26
SdpVideoFormatToVideoCodecInfo(JNIEnv * jni,const SdpVideoFormat & format)27 ScopedJavaLocalRef<jobject> SdpVideoFormatToVideoCodecInfo(
28 JNIEnv* jni,
29 const SdpVideoFormat& format) {
30 ScopedJavaLocalRef<jobject> j_params =
31 NativeToJavaStringMap(jni, format.parameters);
32 return Java_VideoCodecInfo_Constructor(
33 jni, NativeToJavaString(jni, format.name), j_params);
34 }
35
36 } // namespace jni
37 } // namespace webrtc
38