xref: /aosp_15_r20/external/webrtc/sdk/android/src/jni/video_frame.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright 2015 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 #ifndef SDK_ANDROID_SRC_JNI_VIDEO_FRAME_H_
12 #define SDK_ANDROID_SRC_JNI_VIDEO_FRAME_H_
13 
14 #include <jni.h>
15 
16 #include "api/video/video_frame.h"
17 #include "api/video/video_frame_buffer.h"
18 #include "sdk/android/src/jni/jni_helpers.h"
19 
20 namespace webrtc {
21 namespace jni {
22 
23 rtc::scoped_refptr<VideoFrameBuffer> JavaToNativeFrameBuffer(
24     JNIEnv* jni,
25     const JavaRef<jobject>& j_video_frame_buffer);
26 
27 VideoFrame JavaToNativeFrame(JNIEnv* jni,
28                              const JavaRef<jobject>& j_video_frame,
29                              uint32_t timestamp_rtp);
30 
31 // NOTE: Returns a new video frame that has to be released by calling
32 // ReleaseJavaVideoFrame.
33 ScopedJavaLocalRef<jobject> NativeToJavaVideoFrame(JNIEnv* jni,
34                                                    const VideoFrame& frame);
35 void ReleaseJavaVideoFrame(JNIEnv* jni, const JavaRef<jobject>& j_video_frame);
36 
37 int64_t GetJavaVideoFrameTimestampNs(JNIEnv* jni,
38                                      const JavaRef<jobject>& j_video_frame);
39 
40 }  // namespace jni
41 }  // namespace webrtc
42 
43 #endif  // SDK_ANDROID_SRC_JNI_VIDEO_FRAME_H_
44