NIMSDK-AOS  9.16.0
AVChatBuffer.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.avchat.video;
2 
3 import com.netease.nrtc.sdk.video.VideoFrame;
4 
5 public abstract class AVChatBuffer implements VideoFrame.Buffer {
6 
7  private final VideoFrame.Buffer buffer;
8 
9  AVChatBuffer(VideoFrame.Buffer buffer) {
10  this.buffer = buffer;
11  }
12 
13  @Override
14  public int getWidth() {
15  return buffer.getWidth();
16  }
17 
18  @Override
19  public int getHeight() {
20  return buffer.getHeight();
21  }
22 
23 
24  @Override
25  public int getFormat(){
26  return buffer.getFormat();
27  }
28 
29 
30  @Override
31  public VideoFrame.Buffer mirror(boolean mirrorVertical, boolean mirrorHorizontal){
32  return buffer.mirror(mirrorVertical,mirrorHorizontal);
33  }
34 
35  @Override
36  public VideoFrame.Buffer rotate(int rotation){
37  return buffer.rotate(rotation);
38  }
39 
40  @Override
41  public VideoFrame.I420Buffer toI420() {
42  return buffer.toI420();
43  }
44 
45  @Override
46  public VideoFrame.Buffer toFormat(int format) {
47  return buffer.toFormat(format);
48  }
49 
50  @Override
51  public void retain() {
52  buffer.retain();
53  }
54 
55  @Override
56  public void release() {
57  buffer.release();
58  }
59 
60  @Override
61  public AVChatBuffer cropAndScale(int cropX,
62  int cropY,
63  int cropWidth,
64  int cropHeight,
65  int scaleWidth,
66  int scaleHeight) {
67  VideoFrame.Buffer out = buffer.cropAndScale(cropX,
68  cropY,
69  cropWidth,
70  cropHeight,
71  scaleWidth,
72  scaleHeight);
73  return wrap(out);
74  }
75 
76  static AVChatBuffer wrap(VideoFrame.Buffer buffer) {
77  if (buffer instanceof VideoFrame.I420Buffer) {
78  return new AVChatI420Buffer((VideoFrame.I420Buffer) buffer);
79  } else if (buffer instanceof VideoFrame.TextureBuffer) {
80  return new AVChatTextureBuffer((VideoFrame.TextureBuffer) buffer);
81  }
82 
83  return null;
84  }
85 
86  @Override
87  public void toBytes(byte[] target) {
88 
89  }
90 }
AVChatBuffer cropAndScale(int cropX, int cropY, int cropWidth, int cropHeight, int scaleWidth, int scaleHeight)
VideoFrame.Buffer mirror(boolean mirrorVertical, boolean mirrorHorizontal)
VideoFrame.Buffer rotate(int rotation)