Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(655)

Side by Side Diff: webrtc/sdk/android/api/org/webrtc/EncodedImage.java

Issue 3003873002: Bindings for injectable Java video encoders. (Closed)
Patch Set: Fix tests Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/sdk/android/BUILD.gn ('k') | webrtc/sdk/android/api/org/webrtc/VideoEncoder.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 package org.webrtc; 11 package org.webrtc;
12 12
13 import java.nio.ByteBuffer; 13 import java.nio.ByteBuffer;
14 import java.util.concurrent.TimeUnit; 14 import java.util.concurrent.TimeUnit;
15 15
16 /** 16 /**
17 * An encoded frame from a video stream. Used as an input for decoders and as an output for 17 * An encoded frame from a video stream. Used as an input for decoders and as an output for
18 * encoders. 18 * encoders.
19 */ 19 */
20 public class EncodedImage { 20 public class EncodedImage {
21 // Must be kept in sync with common_types.h FrameType.
21 public enum FrameType { 22 public enum FrameType {
22 EmptyFrame, 23 EmptyFrame(0),
23 VideoFrameKey, 24 VideoFrameKey(3),
24 VideoFrameDelta, 25 VideoFrameDelta(4);
26
27 private final int nativeIndex;
28
29 private FrameType(int nativeIndex) {
30 this.nativeIndex = nativeIndex;
31 }
32
33 public int getNative() {
34 return nativeIndex;
35 }
36
37 public static FrameType fromNative(int nativeIndex) {
38 for (FrameType type : FrameType.values()) {
39 if (type.nativeIndex == nativeIndex) {
40 return type;
41 }
42 }
43 throw new IllegalArgumentException("Unknown native frame type: " + nativeI ndex);
44 }
25 } 45 }
26 46
27 public final ByteBuffer buffer; 47 public final ByteBuffer buffer;
28 public final int encodedWidth; 48 public final int encodedWidth;
29 public final int encodedHeight; 49 public final int encodedHeight;
30 public final long captureTimeMs; // Deprecated 50 public final long captureTimeMs; // Deprecated
31 public final long captureTimeNs; 51 public final long captureTimeNs;
32 public final FrameType frameType; 52 public final FrameType frameType;
33 public final int rotation; 53 public final int rotation;
34 public final boolean completeFrame; 54 public final boolean completeFrame;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 this.qp = qp; 128 this.qp = qp;
109 return this; 129 return this;
110 } 130 }
111 131
112 public EncodedImage createEncodedImage() { 132 public EncodedImage createEncodedImage() {
113 return new EncodedImage(buffer, encodedWidth, encodedHeight, captureTimeNs , frameType, 133 return new EncodedImage(buffer, encodedWidth, encodedHeight, captureTimeNs , frameType,
114 rotation, completeFrame, qp); 134 rotation, completeFrame, qp);
115 } 135 }
116 } 136 }
117 } 137 }
OLDNEW
« no previous file with comments | « webrtc/sdk/android/BUILD.gn ('k') | webrtc/sdk/android/api/org/webrtc/VideoEncoder.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698