xref: /aosp_15_r20/external/webrtc/sdk/android/native_api/video/video_source.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
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 #ifndef SDK_ANDROID_NATIVE_API_VIDEO_VIDEO_SOURCE_H_
12 #define SDK_ANDROID_NATIVE_API_VIDEO_VIDEO_SOURCE_H_
13 
14 #include <jni.h>
15 
16 #include "api/media_stream_interface.h"
17 #include "rtc_base/thread.h"
18 #include "sdk/android/native_api/jni/scoped_java_ref.h"
19 
20 namespace webrtc {
21 
22 // Interface for class that implements VideoTrackSourceInterface and provides a
23 // Java object that can be used to feed frames to the source.
24 class JavaVideoTrackSourceInterface : public VideoTrackSourceInterface {
25  public:
26   // Returns CapturerObserver object that can be used to feed frames to the
27   // video source.
28   virtual ScopedJavaLocalRef<jobject> GetJavaVideoCapturerObserver(
29       JNIEnv* env) = 0;
30 };
31 
32 // Creates an instance of JavaVideoTrackSourceInterface,
33 rtc::scoped_refptr<JavaVideoTrackSourceInterface> CreateJavaVideoSource(
34     JNIEnv* env,
35     rtc::Thread* signaling_thread,
36     bool is_screencast,
37     bool align_timestamps);
38 
39 }  // namespace webrtc
40 
41 #endif  // SDK_ANDROID_NATIVE_API_VIDEO_VIDEO_SOURCE_H_
42