Jonathan Yu | fa6a283 | 2018-02-12 17:32:37 -0800 | [diff] [blame] | 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/video/wrapper.h" |
| 12 | |
Mirko Bonadei | 317a1f0 | 2019-09-17 17:06:18 +0200 | [diff] [blame^] | 13 | #include <memory> |
| 14 | |
Jonathan Yu | fa6a283 | 2018-02-12 17:32:37 -0800 | [diff] [blame] | 15 | #include "sdk/android/native_api/jni/scoped_java_ref.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 16 | #include "sdk/android/src/jni/video_frame.h" |
| 17 | #include "sdk/android/src/jni/video_sink.h" |
Jonathan Yu | fa6a283 | 2018-02-12 17:32:37 -0800 | [diff] [blame] | 18 | |
| 19 | namespace webrtc { |
| 20 | |
| 21 | std::unique_ptr<rtc::VideoSinkInterface<VideoFrame>> JavaToNativeVideoSink( |
| 22 | JNIEnv* jni, |
| 23 | jobject video_sink) { |
Mirko Bonadei | 317a1f0 | 2019-09-17 17:06:18 +0200 | [diff] [blame^] | 24 | return std::make_unique<jni::VideoSinkWrapper>( |
Jonathan Yu | fa6a283 | 2018-02-12 17:32:37 -0800 | [diff] [blame] | 25 | jni, JavaParamRef<jobject>(video_sink)); |
| 26 | } |
| 27 | |
| 28 | ScopedJavaLocalRef<jobject> NativeToJavaVideoFrame(JNIEnv* jni, |
| 29 | const VideoFrame& frame) { |
Sami Kalliomäki | 2bde850 | 2018-02-15 13:58:15 +0100 | [diff] [blame] | 30 | return jni::NativeToJavaVideoFrame(jni, frame); |
Jonathan Yu | fa6a283 | 2018-02-12 17:32:37 -0800 | [diff] [blame] | 31 | } |
| 32 | |
| 33 | } // namespace webrtc |