henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1 | /* |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 2 | * Copyright 2013 The WebRTC project authors. All Rights Reserved. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 3 | * |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 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. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 9 | */ |
| 10 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 11 | package org.webrtc; |
| 12 | |
fischman@webrtc.org | 4e65e07 | 2013-10-03 18:23:13 +0000 | [diff] [blame] | 13 | /** |
Magnus Jedvert | 7640fcf | 2016-09-21 16:20:03 +0200 | [diff] [blame] | 14 | * Java wrapper of native AndroidVideoTrackSource. |
fischman@webrtc.org | 4e65e07 | 2013-10-03 18:23:13 +0000 | [diff] [blame] | 15 | */ |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame^] | 16 | @JNINamespace("webrtc::jni") |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 17 | public class VideoSource extends MediaSource { |
| 18 | public VideoSource(long nativeSource) { |
| 19 | super(nativeSource); |
| 20 | } |
Magnus Jedvert | 7640fcf | 2016-09-21 16:20:03 +0200 | [diff] [blame] | 21 | |
| 22 | /** |
| 23 | * Calling this function will cause frames to be scaled down to the requested resolution. Also, |
| 24 | * frames will be cropped to match the requested aspect ratio, and frames will be dropped to match |
| 25 | * the requested fps. The requested aspect ratio is orientation agnostic and will be adjusted to |
| 26 | * maintain the input orientation, so it doesn't matter if e.g. 1280x720 or 720x1280 is requested. |
| 27 | */ |
| 28 | public void adaptOutputFormat(int width, int height, int fps) { |
| 29 | nativeAdaptOutputFormat(nativeSource, width, height, fps); |
| 30 | } |
| 31 | |
Magnus Jedvert | 84d8ae5 | 2017-12-20 15:12:10 +0100 | [diff] [blame^] | 32 | private static native void nativeAdaptOutputFormat(long source, int width, int height, int fps); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 33 | } |