@predy-js/render-interface 0.3.3-beta.15 → 0.3.3-beta.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -19
- package/dist/index.mjs.map +1 -1
- package/dist/statistic.js +1 -1
- package/dist/types/native/PredyNativeInternal.d.ts +3 -25
- package/dist/types/native/TextureInternal.d.ts +0 -1
- package/dist/types/native/index.d.ts +0 -1
- package/package.json +1 -1
- package/types/native/PredyNativeInternal.ts +3 -30
- package/types/native/TextureInternal.ts +0 -2
- package/types/native/index.ts +0 -1
- package/dist/types/native/VideoDecoder.d.ts +0 -69
- package/types/native/VideoDecoder.ts +0 -79
package/dist/statistic.js
CHANGED
@@ -3,8 +3,6 @@ import type { TypedArray, vec2 } from '../type';
|
|
3
3
|
import type { GPUCapability } from '../GPUCapability';
|
4
4
|
import type { PredyResizeTemplate, SDFImageOptions, SDFImage } from '@predy-js/specification';
|
5
5
|
import type { ImageBitmapInternal } from './ImageBitmapInternal';
|
6
|
-
import type { PredyVideoDecoder, PredyVideoDecoderConstructor } from './VideoDecoder';
|
7
|
-
import type { ResourcePlatform } from './ResourceInternal';
|
8
6
|
export interface PredyRequestOptions {
|
9
7
|
url: string;
|
10
8
|
disableCache?: boolean;
|
@@ -31,18 +29,8 @@ export declare enum PredyTextEncoding {
|
|
31
29
|
utf8 = 0,
|
32
30
|
ascii = 1
|
33
31
|
}
|
34
|
-
export declare enum PredyVideoCodec {
|
35
|
-
h264 = "avc1",
|
36
|
-
h265 = "hev1",
|
37
|
-
av1 = "av1"
|
38
|
-
}
|
39
32
|
export interface PredyNativeInternal {
|
40
33
|
webpDisabled?: boolean;
|
41
|
-
/**
|
42
|
-
* 是否支持获取gles3,但如果获取es3失败,会降级到es2
|
43
|
-
*/
|
44
|
-
supportGLES3?: boolean;
|
45
|
-
platform: ResourcePlatform;
|
46
34
|
createImageBitmap(data: TypedArray | string, //图片文件的数据
|
47
35
|
options: ImageBitmapConstructor, callback: ImageBitmapCallback): void;
|
48
36
|
getDefaultGPUCapability(): GPUCapability;
|
@@ -95,20 +83,10 @@ export interface PredyNativeInternal {
|
|
95
83
|
*/
|
96
84
|
inflateData(data: Uint8Array, method: DataCompressMethod): Uint8Array | undefined;
|
97
85
|
/**
|
98
|
-
|
99
|
-
|
100
|
-
|
86
|
+
* 恢复当前的主JSContext,多个JSContext执行的时候会发生抢占,
|
87
|
+
* 调用此函数后,当前的JSContext会被恢复
|
88
|
+
*/
|
101
89
|
restoreJSContext(): boolean;
|
102
|
-
/**
|
103
|
-
* 创建 video decoder
|
104
|
-
* @param options
|
105
|
-
*/
|
106
|
-
createVideoDecoder(options: PredyVideoDecoderConstructor): PredyVideoDecoder;
|
107
|
-
/**
|
108
|
-
* 是否支持视频编码
|
109
|
-
* @param codec
|
110
|
-
*/
|
111
|
-
supportVideoCodec(codec: PredyVideoCodec): boolean;
|
112
90
|
}
|
113
91
|
type renderSDFImageCallback = (img: SDFImage) => void;
|
114
92
|
export {};
|
@@ -23,7 +23,6 @@ export declare abstract class TextureInternal implements ResourceInternal {
|
|
23
23
|
readonly height: number;
|
24
24
|
readonly name: string;
|
25
25
|
readonly options: TextureInternalOptions;
|
26
|
-
readonly error?: number;
|
27
26
|
protected constructor(options: TextureInternalConstructOptions);
|
28
27
|
abstract resize(width: number, height: number): boolean;
|
29
28
|
abstract destroy(): void;
|
package/package.json
CHANGED
@@ -3,8 +3,6 @@ import type { TypedArray, vec2 } from '../type';
|
|
3
3
|
import type { GPUCapability } from '../GPUCapability';
|
4
4
|
import type { PredyResizeTemplate, SDFImageOptions, SDFImage } from '@predy-js/specification';
|
5
5
|
import type { ImageBitmapInternal } from './ImageBitmapInternal';
|
6
|
-
import type { PredyVideoDecoder, PredyVideoDecoderConstructor } from './VideoDecoder';
|
7
|
-
import type { ResourcePlatform } from './ResourceInternal';
|
8
6
|
|
9
7
|
export interface PredyRequestOptions {
|
10
8
|
url: string,
|
@@ -44,22 +42,9 @@ export enum PredyTextEncoding {
|
|
44
42
|
ascii = 1,
|
45
43
|
}
|
46
44
|
|
47
|
-
export enum PredyVideoCodec {
|
48
|
-
h264 = 'avc1',
|
49
|
-
h265 = 'hev1',
|
50
|
-
av1 = 'av1'
|
51
|
-
}
|
52
|
-
|
53
45
|
export interface PredyNativeInternal {
|
54
46
|
webpDisabled?: boolean,
|
55
47
|
|
56
|
-
/**
|
57
|
-
* 是否支持获取gles3,但如果获取es3失败,会降级到es2
|
58
|
-
*/
|
59
|
-
supportGLES3?: boolean,
|
60
|
-
|
61
|
-
platform: ResourcePlatform,
|
62
|
-
|
63
48
|
createImageBitmap(data: TypedArray | string, //图片文件的数据
|
64
49
|
options: ImageBitmapConstructor, callback: ImageBitmapCallback): void,
|
65
50
|
|
@@ -122,22 +107,10 @@ export interface PredyNativeInternal {
|
|
122
107
|
inflateData(data: Uint8Array, method: DataCompressMethod): Uint8Array | undefined,
|
123
108
|
|
124
109
|
/**
|
125
|
-
|
126
|
-
|
127
|
-
|
110
|
+
* 恢复当前的主JSContext,多个JSContext执行的时候会发生抢占,
|
111
|
+
* 调用此函数后,当前的JSContext会被恢复
|
112
|
+
*/
|
128
113
|
restoreJSContext(): boolean,
|
129
|
-
|
130
|
-
/**
|
131
|
-
* 创建 video decoder
|
132
|
-
* @param options
|
133
|
-
*/
|
134
|
-
createVideoDecoder(options: PredyVideoDecoderConstructor): PredyVideoDecoder,
|
135
|
-
|
136
|
-
/**
|
137
|
-
* 是否支持视频编码
|
138
|
-
* @param codec
|
139
|
-
*/
|
140
|
-
supportVideoCodec(codec: PredyVideoCodec): boolean,
|
141
114
|
}
|
142
115
|
|
143
116
|
type renderSDFImageCallback = (img: SDFImage) => void;
|
package/types/native/index.ts
CHANGED
@@ -1,69 +0,0 @@
|
|
1
|
-
import type { VideoFrameFormat } from '@predy-js/specification';
|
2
|
-
export interface PredyVideoDecoderFrameData {
|
3
|
-
width: number;
|
4
|
-
height: number;
|
5
|
-
data: Uint8Array;
|
6
|
-
idx: number;
|
7
|
-
}
|
8
|
-
export declare enum PredyVideoDecoderStatus {
|
9
|
-
init = 0,
|
10
|
-
loading = 1,
|
11
|
-
metadataReady = 2,
|
12
|
-
seekingFrame = 3,
|
13
|
-
frameReady = 4,
|
14
|
-
destroyed = 5,
|
15
|
-
error = 44
|
16
|
-
}
|
17
|
-
/**
|
18
|
-
* 视频解码的通用class,在native和web端有不同的实现
|
19
|
-
*/
|
20
|
-
export interface PredyVideoDecoderMetadata {
|
21
|
-
width: number;
|
22
|
-
height: number;
|
23
|
-
duration: number;
|
24
|
-
frameCount: number;
|
25
|
-
format: VideoFrameFormat;
|
26
|
-
frameBufferSize: number;
|
27
|
-
}
|
28
|
-
/**
|
29
|
-
* VideoDecoder创建参数
|
30
|
-
*/
|
31
|
-
export interface PredyVideoDecoderConstructor {
|
32
|
-
name: string;
|
33
|
-
prefetchOnly?: boolean;
|
34
|
-
}
|
35
|
-
export type PredyVideoDecoderLoadedCallback = (error?: Error, metadata?: PredyVideoDecoderMetadata) => void;
|
36
|
-
export type PredyVideoDecoderSeekFrameCallback = (error?: Error, frame?: PredyVideoDecoderFrameData) => void;
|
37
|
-
export interface PredyVideoDecoder {
|
38
|
-
readonly name: string;
|
39
|
-
readonly status: PredyVideoDecoderStatus;
|
40
|
-
readonly metadata?: PredyVideoDecoderMetadata;
|
41
|
-
/**
|
42
|
-
* 只做资源请求,不进行视频解码,
|
43
|
-
* 这种情况下,seekFrame永远返回error(prefetch only)
|
44
|
-
*/
|
45
|
-
readonly prefetchOnly: boolean;
|
46
|
-
/**
|
47
|
-
* 是否要跳播/回播,如果不需要的话,Decoder可以自行释放已经播放的帧
|
48
|
-
*/
|
49
|
-
readonly willReverseTime: boolean;
|
50
|
-
readonly currentFrame: number;
|
51
|
-
/**
|
52
|
-
* 加载视频,解析视频的metadata,设置frame数组,
|
53
|
-
* 此函数只能调用一次,如果需要解析其他的视频,需要重新创建对象
|
54
|
-
* @param url 视频地址
|
55
|
-
* @param callback 解析回调
|
56
|
-
*/
|
57
|
-
loadVideo(url: string, callback: PredyVideoDecoderLoadedCallback): void;
|
58
|
-
/**
|
59
|
-
* 解析视频的下一帧,获得图像数据。如果调用的时候正在解析,callback直接返回error
|
60
|
-
* @param frameIndex frame的index
|
61
|
-
* @param data 图像数据buffer,数据将被写入到此Buffer中,如果buffer尺寸不对,解析会失败
|
62
|
-
* @param callback 图像数据回调
|
63
|
-
*/
|
64
|
-
seekFrame(frameIndex: number, data: Uint8Array, callback: PredyVideoDecoderSeekFrameCallback): void;
|
65
|
-
/**
|
66
|
-
* 释放资源
|
67
|
-
*/
|
68
|
-
destroy(): void;
|
69
|
-
}
|
@@ -1,79 +0,0 @@
|
|
1
|
-
import type { VideoFrameFormat } from '@predy-js/specification';
|
2
|
-
|
3
|
-
export interface PredyVideoDecoderFrameData {
|
4
|
-
width: number,
|
5
|
-
height: number,
|
6
|
-
data: Uint8Array,
|
7
|
-
idx: number,
|
8
|
-
}
|
9
|
-
|
10
|
-
export enum PredyVideoDecoderStatus {
|
11
|
-
init = 0, // 创建对象
|
12
|
-
loading = 1, // 正在解析metadata,解析过程任何函数调用都会导致error
|
13
|
-
metadataReady = 2, // metadata 解析完成,此时 currentFrame = -1
|
14
|
-
seekingFrame = 3, // 正在解析某一帧,解析过程任何函数调用都会导致error
|
15
|
-
frameReady = 4, // 解析某一帧完成,此时 currentFrame = frame.index
|
16
|
-
destroyed = 5, // 对象已经销毁
|
17
|
-
error = 44, // 发生错误
|
18
|
-
}
|
19
|
-
|
20
|
-
/**
|
21
|
-
* 视频解码的通用class,在native和web端有不同的实现
|
22
|
-
*/
|
23
|
-
export interface PredyVideoDecoderMetadata {
|
24
|
-
width: number,
|
25
|
-
height: number,
|
26
|
-
duration: number,
|
27
|
-
frameCount: number,
|
28
|
-
format: VideoFrameFormat,
|
29
|
-
frameBufferSize: number, // 每帧的buffer大小
|
30
|
-
}
|
31
|
-
|
32
|
-
/**
|
33
|
-
* VideoDecoder创建参数
|
34
|
-
*/
|
35
|
-
export interface PredyVideoDecoderConstructor {
|
36
|
-
name: string,
|
37
|
-
prefetchOnly?: boolean,
|
38
|
-
}
|
39
|
-
|
40
|
-
export type PredyVideoDecoderLoadedCallback = (error?: Error, metadata?: PredyVideoDecoderMetadata) => void;
|
41
|
-
export type PredyVideoDecoderSeekFrameCallback = (error?: Error, frame?: PredyVideoDecoderFrameData) => void;
|
42
|
-
|
43
|
-
export interface PredyVideoDecoder {
|
44
|
-
readonly name: string,
|
45
|
-
readonly status: PredyVideoDecoderStatus,
|
46
|
-
readonly metadata?: PredyVideoDecoderMetadata,
|
47
|
-
|
48
|
-
/**
|
49
|
-
* 只做资源请求,不进行视频解码,
|
50
|
-
* 这种情况下,seekFrame永远返回error(prefetch only)
|
51
|
-
*/
|
52
|
-
readonly prefetchOnly: boolean,
|
53
|
-
/**
|
54
|
-
* 是否要跳播/回播,如果不需要的话,Decoder可以自行释放已经播放的帧
|
55
|
-
*/
|
56
|
-
readonly willReverseTime: boolean,
|
57
|
-
readonly currentFrame: number,
|
58
|
-
|
59
|
-
/**
|
60
|
-
* 加载视频,解析视频的metadata,设置frame数组,
|
61
|
-
* 此函数只能调用一次,如果需要解析其他的视频,需要重新创建对象
|
62
|
-
* @param url 视频地址
|
63
|
-
* @param callback 解析回调
|
64
|
-
*/
|
65
|
-
loadVideo(url: string, callback: PredyVideoDecoderLoadedCallback): void,
|
66
|
-
|
67
|
-
/**
|
68
|
-
* 解析视频的下一帧,获得图像数据。如果调用的时候正在解析,callback直接返回error
|
69
|
-
* @param frameIndex frame的index
|
70
|
-
* @param data 图像数据buffer,数据将被写入到此Buffer中,如果buffer尺寸不对,解析会失败
|
71
|
-
* @param callback 图像数据回调
|
72
|
-
*/
|
73
|
-
seekFrame(frameIndex: number, data: Uint8Array, callback: PredyVideoDecoderSeekFrameCallback): void,
|
74
|
-
|
75
|
-
/**
|
76
|
-
* 释放资源
|
77
|
-
*/
|
78
|
-
destroy(): void,
|
79
|
-
}
|