Skip to content

Commit

Permalink
delete set/getcolor space as member method
Browse files Browse the repository at this point in the history
  • Loading branch information
lemon-chen committed Nov 22, 2024
1 parent 7370da7 commit 28425ec
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 75 deletions.
133 changes: 60 additions & 73 deletions en-US/dita/RTC-NG/API/class_videoframe.dita
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,45 @@
<section id="prototype">
<p outputclass="codeblock">
<codeblock props="android" outputclass="language-java">public class VideoFrame implements RefCounted {

public interface Buffer extends RefCounted {

@CalledByNative(&quot;Buffer&quot;) int getWidth();

@CalledByNative(&quot;Buffer&quot;) int getHeight();

@CalledByNative(&quot;Buffer&quot;) I420Buffer toI420();

@Override @CalledByNative(&quot;Buffer&quot;) void release();

@Override @CalledByNative(&quot;Buffer&quot;) void retain();

@CalledByNative(&quot;Buffer&quot;)
Buffer cropAndScale(
int cropX, int cropY, int cropWidth, int cropHeight, int scaleWidth, int scaleHeight);

@CalledByNative(&quot;Buffer&quot;) @Nullable Buffer mirror(int frameRotation);

@CalledByNative(&quot;Buffer&quot;) @Nullable Buffer rotate(int frameRotation);

@CalledByNative(&quot;Buffer&quot;)
@Nullable
Buffer transform(int cropX, int cropY, int cropWidth, int cropHeight, int scaleWidth,
int scaleHeight, int frameRotation);
}

public interface I420Buffer extends Buffer {

@CalledByNative(&quot;I420Buffer&quot;) ByteBuffer getDataY();

@CalledByNative(&quot;I420Buffer&quot;) ByteBuffer getDataU();

@CalledByNative(&quot;I420Buffer&quot;) ByteBuffer getDataV();
@CalledByNative(&quot;I420Buffer&quot;) int getStrideY();
@CalledByNative(&quot;I420Buffer&quot;) int getStrideU();
@CalledByNative(&quot;I420Buffer&quot;) int getStrideV();
}

public interface I422Buffer extends Buffer {
@CalledByNative(&quot;I422Buffer&quot;) ByteBuffer getDataY();
@CalledByNative(&quot;I422Buffer&quot;) ByteBuffer getDataU();
Expand All @@ -55,13 +55,13 @@
@CalledByNative(&quot;I422Buffer&quot;) int getStrideV();
}
public interface RgbaBuffer extends Buffer { @CalledByNative(&quot;RgbaBuffer&quot;) ByteBuffer getData(); }

public interface TextureBuffer extends Buffer {

enum Type {

OES(GLES11Ext.GL_TEXTURE_EXTERNAL_OES),

RGB(GLES20.GL_TEXTURE_2D);
private final int glTarget;
private Type(final int glTarget) {
Expand All @@ -76,17 +76,17 @@
EGL_CONTEXT_14;
}
Type getType();

@CalledByNative(&quot;TextureBuffer&quot;) int getTextureId();

Matrix getTransformMatrix();

@CalledByNative(&quot;TextureBuffer&quot;) EglBase.Context getEglBaseContext();
@CalledByNative(&quot;TextureBuffer&quot;) Object getSourceTexturePool();
@CalledByNative(&quot;TextureBuffer&quot;) long getNativeEglContext();
@CalledByNative(&quot;TextureBuffer&quot;) int getEglContextType();
@CalledByNative(&quot;TextureBuffer&quot;) float[] getTransformMatrixArray();

@CalledByNative(&quot;TextureBuffer&quot;) int getSequence();
@CalledByNative(&quot;TextureBuffer&quot;) long getFenceObject();
@CalledByNative(&quot;TextureBuffer&quot;) boolean is10BitTexture();
Expand Down Expand Up @@ -198,22 +198,22 @@
return stitchMode;
}
}

private Buffer buffer;

private int rotation;

private long timestampNs;
private ColorSpace colorSpace;
private SourceType sourceType;
private float sampleAspectRatio;

private AlphaStitchMode alphaStitchMode = AlphaStitchMode.ALPHA_NO_STITCH;
private VideoFrameMetaInfo metaInfo = new VideoFrameMetaInfo();

private @Nullable ByteBuffer alphaBuffer;
private long nativeAlphaBuffer;

public VideoFrame(Buffer buffer, int rotation, long timestampNs) {
this(buffer, rotation, timestampNs, new WrappedNativeColorSpace(), null, 0L, 1.0f,
SourceType.kUnspecified.ordinal());
Expand Down Expand Up @@ -243,12 +243,12 @@
public float getSampleAspectRatio() {
return sampleAspectRatio;
}

@CalledByNative
public Buffer getBuffer() {
return buffer;
}

@CalledByNative
public int getRotation() {
return rotation;
Expand All @@ -261,7 +261,7 @@
public void setAlphaStitchMode(int stitchMode) {
alphaStitchMode = AlphaStitchMode.values()[stitchMode];
}

@CalledByNative
public long getTimestampNs() {
return timestampNs;
Expand All @@ -270,7 +270,7 @@
public VideoFrameMetaInfo getMetaInfo() {
return metaInfo;
}

public int getRotatedWidth() {
if (rotation % 180 == 0) {
return (alphaStitchMode == AlphaStitchMode.ALPHA_STITCH_LEFT
Expand All @@ -283,7 +283,7 @@
? buffer.getHeight() / 2
: buffer.getHeight();
}

public int getRotatedHeight() {
if (rotation % 180 == 0) {
return (alphaStitchMode == AlphaStitchMode.ALPHA_STITCH_UP
Expand All @@ -296,7 +296,7 @@
? buffer.getWidth() / 2
: buffer.getWidth();
}

public void replaceBuffer(Buffer buffer, int rotation, long timestampNs) {
release();
this.buffer = buffer;
Expand Down Expand Up @@ -351,12 +351,12 @@
public void fillAlphaData(ByteBuffer buffer) {
alphaBuffer = buffer;
}

@Override
public void retain() {
buffer.retain();
}

@Override
@CalledByNative
public void release() {
Expand Down Expand Up @@ -431,51 +431,51 @@ struct VideoFrame {
metaInfo(NULL){
memset(matrix, 0, sizeof(matrix));
}

VIDEO_PIXEL_FORMAT type;

int width;

int height;

int yStride;

int uStride;

int vStride;

uint8_t* yBuffer;

uint8_t* uBuffer;

uint8_t* vBuffer;

int rotation;

int64_t renderTimeMs;

int avsync_type;

uint8_t* metadata_buffer;

int metadata_size;

void* sharedContext;

int textureId;

void* d3d11Texture2d;

float matrix[16];

uint8_t* alphaBuffer;

ALPHA_STITCH_MODE alphaStitchMode;

void* pixelBuffer;

IVideoFrameMetaInfo* metaInfo;

ColorSpace colorSpace;
};</codeblock>
<codeblock props="bp" outputclass="language-cpp">USTRUCT(BlueprintType)
Expand Down Expand Up @@ -742,19 +742,6 @@ class VideoFrame {
<section id="detailed_desc">
<p>Note that the buffer provides a pointer to a pointer. This interface cannot modify the pointer of the buffer, but it can modify the content of the buffer.</p>
</section>
<section id="sub-method" props="android">
<title>Method</title>
<parml>
<plentry>
<pt>getColorSpace</pt>
<pd>Get the color space properties of the video frame.</pd>
</plentry>
<plentry>
<pt>setColorSpace</pt>
<pd>Get the color space properties of the video frame.</pd>
</plentry>
</parml>
</section>
<section id="parameters">
<title><text conref="../conref/conref_api_metadata.dita#conref_api_metadata/property"/></title>
<parml>
Expand Down
3 changes: 1 addition & 2 deletions en-US/dita/RTC-NG/release/release_notes.dita
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@
<p>This version introduces the <codeph><apiname keyref="setExternalRemoteEglContext"/></codeph> method, which is used to set the EGL context for rendering remote video streams. When using Texture format video data for remote video self-rendering, you can use this method to replace the SDK's default remote EGL context, achieving unified EGL context management.</p>
</li>
<li><ph><b>Color space settings</b></ph>
<p props="android">This version adds <codeph><apiname keyref="getColorSpace"/></codeph> and <codeph><apiname keyref="setColorSpace"/></codeph> to <codeph><apiname keyref="VideoFrame"/></codeph>. You can use <codeph><apiname keyref="getColorSpace"/></codeph> to obtain the color space properties of the video frame and use <codeph><apiname keyref="setColorSpace"/></codeph> to customize the settings. By default, the color space uses Full Range and BT.709 standard configuration. Developers can flexibly adjust according to their own capture or rendering needs, further enhancing the customization capabilities of video processing.</p>
<p props="cpp ios mac">This version adds the <parmname>colorSpace</parmname> parameter to <codeph><apiname keyref="VideoFrame"/></codeph> and <codeph><apiname keyref="ExternalVideoFrame"/></codeph>. You can use this parameter to set the color space properties of the video frame. By default, the color space uses Full Range and BT.709 standard configuration. You can flexibly adjust according to your own capture or rendering needs, further enhancing the customization capabilities of video processing.</p>
<p>This version adds the <parmname>colorSpace</parmname> parameter to <codeph><apiname keyref="VideoFrame"/></codeph> and <codeph><apiname keyref="ExternalVideoFrame"/></codeph>. You can use this parameter to set the color space properties of the video frame. By default, the color space uses Full Range and BT.709 standard configuration. You can flexibly adjust according to your own capture or rendering needs, further enhancing the customization capabilities of video processing.</p>
</li>
<li><ph><b>Others</b></ph>
<ul>
Expand Down

0 comments on commit 28425ec

Please sign in to comment.