dasha 3.1.5 → 4.0.0-alpha.2

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.
@@ -0,0 +1,179 @@
1
+ //#region lib/shared/media-type.d.ts
2
+ declare const MEDIA_TYPES: {
3
+ readonly VIDEO: "video";
4
+ readonly AUDIO: "audio";
5
+ readonly SUBTITLES: "subtitle";
6
+ readonly CLOSED_CAPTIONS: "closed-captions";
7
+ };
8
+ type MediaType = (typeof MEDIA_TYPES)[keyof typeof MEDIA_TYPES];
9
+
10
+ //#endregion
11
+ //#region lib/shared/encrypt-method.d.ts
12
+ declare const ENCRYPT_METHODS: {
13
+ NONE: number;
14
+ AES_128: number;
15
+ AES_128_ECB: number;
16
+ SAMPLE_AES: number;
17
+ SAMPLE_AES_CTR: number;
18
+ CENC: number;
19
+ CHACHA20: number;
20
+ UNKNOWN: number;
21
+ };
22
+ type EncryptMethod = (typeof ENCRYPT_METHODS)[keyof typeof ENCRYPT_METHODS];
23
+
24
+ //#endregion
25
+ //#region lib/shared/extractor-type.d.ts
26
+ declare const EXTRACTOR_TYPES: {
27
+ readonly MPEG_DASH: "MPEG_DASH";
28
+ readonly HLS: "HLS";
29
+ readonly HTTP_LIVE: "HTTP_LIVE";
30
+ readonly MSS: "MSS";
31
+ };
32
+ type ExtractorType = (typeof EXTRACTOR_TYPES)[keyof typeof EXTRACTOR_TYPES];
33
+
34
+ //#endregion
35
+ //#region lib/shared/role-type.d.ts
36
+ declare const ROLE_TYPE: {
37
+ Subtitle: number;
38
+ Main: number;
39
+ Alternate: number;
40
+ Supplementary: number;
41
+ Commentary: number;
42
+ Dub: number;
43
+ Description: number;
44
+ Sign: number;
45
+ Metadata: number;
46
+ ForcedSubtitle: number;
47
+ };
48
+ type RoleType = (typeof ROLE_TYPE)[keyof typeof ROLE_TYPE];
49
+
50
+ //#endregion
51
+ //#region lib/shared/encrypt-info.d.ts
52
+ declare class EncryptInfo {
53
+ method: EncryptMethod;
54
+ key?: Buffer;
55
+ iv?: Buffer;
56
+ constructor(method?: string | null);
57
+ parseMethod(method?: string | null): EncryptMethod;
58
+ }
59
+
60
+ //#endregion
61
+ //#region lib/processor.d.ts
62
+ declare abstract class ContentProcessor {
63
+ abstract canProcess(extractorType: ExtractorType, rawText: string, parserConfig: ParserConfig): boolean;
64
+ abstract process(rawText: string, parserConfig: ParserConfig): string;
65
+ }
66
+ declare abstract class KeyProcessor {
67
+ abstract canProcess(extractorType: ExtractorType, keyLine: string, m3u8Url: string, m3u8Content: string, parserConfig: ParserConfig): boolean;
68
+ abstract process(keyLine: string, m3u8Url: string, m3u8Content: string, parserConfig: ParserConfig): Promise<EncryptInfo>;
69
+ }
70
+ declare abstract class UrlProcessor {
71
+ abstract canProcess(extractorType: ExtractorType, originalUrl: string, parserConfig: ParserConfig): boolean;
72
+ abstract process(originalUrl: string, parserConfig: ParserConfig): string;
73
+ }
74
+ declare class DefaultUrlProcessor extends UrlProcessor {
75
+ canProcess(_extractorType: ExtractorType, _originalUrl: string, parserConfig: ParserConfig): boolean;
76
+ process(url: string, parserConfig: ParserConfig): string;
77
+ }
78
+
79
+ //#endregion
80
+ //#region lib/parser-config.d.ts
81
+ declare class ParserConfig {
82
+ url: string;
83
+ originalUrl: string;
84
+ baseUrl?: string;
85
+ customParserArgs: Record<string, string>;
86
+ headers: Record<string, string>;
87
+ contentProcessors: ContentProcessor[];
88
+ urlProcessors: UrlProcessor[];
89
+ keyProcessors: KeyProcessor[];
90
+ customMethod?: EncryptMethod;
91
+ customKey?: Buffer;
92
+ customIv?: Buffer;
93
+ urlProcessorArgs?: string;
94
+ appendUrlParams: boolean;
95
+ keyRetryCount: number;
96
+ }
97
+
98
+ //#endregion
99
+ //#region lib/shared/media-segment.d.ts
100
+ declare class MediaSegment {
101
+ index: number;
102
+ duration: number;
103
+ title?: string;
104
+ dateTime?: Date;
105
+ startRange?: number;
106
+ get stopRange(): number | undefined;
107
+ expectLength?: number;
108
+ encryptInfo: EncryptInfo;
109
+ get isEncrypted(): boolean;
110
+ url: string;
111
+ nameFromVar?: string;
112
+ equals(segment: unknown): boolean;
113
+ getHashCode(): string;
114
+ }
115
+
116
+ //#endregion
117
+ //#region lib/shared/media-part.d.ts
118
+ declare class MediaPart {
119
+ mediaSegments: MediaSegment[];
120
+ constructor(segments?: MediaSegment[]);
121
+ }
122
+
123
+ //#endregion
124
+ //#region lib/shared/playlist.d.ts
125
+ declare class Playlist {
126
+ url: string;
127
+ isLive: boolean;
128
+ refreshIntervalMs: number;
129
+ get totalDuration(): number;
130
+ targetDuration?: number;
131
+ mediaInit?: MediaSegment;
132
+ mediaParts: MediaPart[];
133
+ }
134
+
135
+ //#endregion
136
+ //#region lib/shared/stream-spec.d.ts
137
+ declare class StreamSpec {
138
+ mediaType?: MediaType;
139
+ groupId: string | null;
140
+ language?: string;
141
+ name?: string;
142
+ default?: boolean;
143
+ skippedDuration?: number;
144
+ bandwidth?: number;
145
+ codecs: string | null;
146
+ resolution?: string;
147
+ frameRate?: number;
148
+ channels: string | null;
149
+ extension: string | null;
150
+ role?: RoleType;
151
+ videoRange?: string;
152
+ characteristics?: string;
153
+ publishTime?: Date;
154
+ audioId?: string;
155
+ videoId?: string;
156
+ subtitleId?: string;
157
+ periodId: string | null;
158
+ url: string;
159
+ originalUrl: string;
160
+ playlist?: Playlist;
161
+ get segmentsCount(): number;
162
+ toShortString(): string;
163
+ }
164
+
165
+ //#endregion
166
+ //#region lib/stream-extractor.d.ts
167
+ declare class StreamExtractor {
168
+ #private;
169
+ constructor(parserConfig?: ParserConfig);
170
+ get extractorType(): ExtractorType;
171
+ loadSourceFromUrl(url: string): Promise<void>;
172
+ loadSourceFromText(rawText: string, url?: string): void;
173
+ extractStreams(): Promise<StreamSpec[]>;
174
+ fetchPlayList(streamSpecs: StreamSpec[]): Promise<void>;
175
+ refreshPlayList(streamSpecs: StreamSpec[]): Promise<void>;
176
+ }
177
+
178
+ //#endregion
179
+ export { ContentProcessor, DefaultUrlProcessor, ENCRYPT_METHODS, EXTRACTOR_TYPES, EncryptMethod, ExtractorType, KeyProcessor, MEDIA_TYPES, MediaType, ParserConfig, ROLE_TYPE, RoleType, StreamExtractor, UrlProcessor };
@@ -0,0 +1,179 @@
1
+ //#region lib/shared/media-type.d.ts
2
+ declare const MEDIA_TYPES: {
3
+ readonly VIDEO: "video";
4
+ readonly AUDIO: "audio";
5
+ readonly SUBTITLES: "subtitle";
6
+ readonly CLOSED_CAPTIONS: "closed-captions";
7
+ };
8
+ type MediaType = (typeof MEDIA_TYPES)[keyof typeof MEDIA_TYPES];
9
+
10
+ //#endregion
11
+ //#region lib/shared/encrypt-method.d.ts
12
+ declare const ENCRYPT_METHODS: {
13
+ NONE: number;
14
+ AES_128: number;
15
+ AES_128_ECB: number;
16
+ SAMPLE_AES: number;
17
+ SAMPLE_AES_CTR: number;
18
+ CENC: number;
19
+ CHACHA20: number;
20
+ UNKNOWN: number;
21
+ };
22
+ type EncryptMethod = (typeof ENCRYPT_METHODS)[keyof typeof ENCRYPT_METHODS];
23
+
24
+ //#endregion
25
+ //#region lib/shared/extractor-type.d.ts
26
+ declare const EXTRACTOR_TYPES: {
27
+ readonly MPEG_DASH: "MPEG_DASH";
28
+ readonly HLS: "HLS";
29
+ readonly HTTP_LIVE: "HTTP_LIVE";
30
+ readonly MSS: "MSS";
31
+ };
32
+ type ExtractorType = (typeof EXTRACTOR_TYPES)[keyof typeof EXTRACTOR_TYPES];
33
+
34
+ //#endregion
35
+ //#region lib/shared/role-type.d.ts
36
+ declare const ROLE_TYPE: {
37
+ Subtitle: number;
38
+ Main: number;
39
+ Alternate: number;
40
+ Supplementary: number;
41
+ Commentary: number;
42
+ Dub: number;
43
+ Description: number;
44
+ Sign: number;
45
+ Metadata: number;
46
+ ForcedSubtitle: number;
47
+ };
48
+ type RoleType = (typeof ROLE_TYPE)[keyof typeof ROLE_TYPE];
49
+
50
+ //#endregion
51
+ //#region lib/shared/encrypt-info.d.ts
52
+ declare class EncryptInfo {
53
+ method: EncryptMethod;
54
+ key?: Buffer;
55
+ iv?: Buffer;
56
+ constructor(method?: string | null);
57
+ parseMethod(method?: string | null): EncryptMethod;
58
+ }
59
+
60
+ //#endregion
61
+ //#region lib/processor.d.ts
62
+ declare abstract class ContentProcessor {
63
+ abstract canProcess(extractorType: ExtractorType, rawText: string, parserConfig: ParserConfig): boolean;
64
+ abstract process(rawText: string, parserConfig: ParserConfig): string;
65
+ }
66
+ declare abstract class KeyProcessor {
67
+ abstract canProcess(extractorType: ExtractorType, keyLine: string, m3u8Url: string, m3u8Content: string, parserConfig: ParserConfig): boolean;
68
+ abstract process(keyLine: string, m3u8Url: string, m3u8Content: string, parserConfig: ParserConfig): Promise<EncryptInfo>;
69
+ }
70
+ declare abstract class UrlProcessor {
71
+ abstract canProcess(extractorType: ExtractorType, originalUrl: string, parserConfig: ParserConfig): boolean;
72
+ abstract process(originalUrl: string, parserConfig: ParserConfig): string;
73
+ }
74
+ declare class DefaultUrlProcessor extends UrlProcessor {
75
+ canProcess(_extractorType: ExtractorType, _originalUrl: string, parserConfig: ParserConfig): boolean;
76
+ process(url: string, parserConfig: ParserConfig): string;
77
+ }
78
+
79
+ //#endregion
80
+ //#region lib/parser-config.d.ts
81
+ declare class ParserConfig {
82
+ url: string;
83
+ originalUrl: string;
84
+ baseUrl?: string;
85
+ customParserArgs: Record<string, string>;
86
+ headers: Record<string, string>;
87
+ contentProcessors: ContentProcessor[];
88
+ urlProcessors: UrlProcessor[];
89
+ keyProcessors: KeyProcessor[];
90
+ customMethod?: EncryptMethod;
91
+ customKey?: Buffer;
92
+ customIv?: Buffer;
93
+ urlProcessorArgs?: string;
94
+ appendUrlParams: boolean;
95
+ keyRetryCount: number;
96
+ }
97
+
98
+ //#endregion
99
+ //#region lib/shared/media-segment.d.ts
100
+ declare class MediaSegment {
101
+ index: number;
102
+ duration: number;
103
+ title?: string;
104
+ dateTime?: Date;
105
+ startRange?: number;
106
+ get stopRange(): number | undefined;
107
+ expectLength?: number;
108
+ encryptInfo: EncryptInfo;
109
+ get isEncrypted(): boolean;
110
+ url: string;
111
+ nameFromVar?: string;
112
+ equals(segment: unknown): boolean;
113
+ getHashCode(): string;
114
+ }
115
+
116
+ //#endregion
117
+ //#region lib/shared/media-part.d.ts
118
+ declare class MediaPart {
119
+ mediaSegments: MediaSegment[];
120
+ constructor(segments?: MediaSegment[]);
121
+ }
122
+
123
+ //#endregion
124
+ //#region lib/shared/playlist.d.ts
125
+ declare class Playlist {
126
+ url: string;
127
+ isLive: boolean;
128
+ refreshIntervalMs: number;
129
+ get totalDuration(): number;
130
+ targetDuration?: number;
131
+ mediaInit?: MediaSegment;
132
+ mediaParts: MediaPart[];
133
+ }
134
+
135
+ //#endregion
136
+ //#region lib/shared/stream-spec.d.ts
137
+ declare class StreamSpec {
138
+ mediaType?: MediaType;
139
+ groupId: string | null;
140
+ language?: string;
141
+ name?: string;
142
+ default?: boolean;
143
+ skippedDuration?: number;
144
+ bandwidth?: number;
145
+ codecs: string | null;
146
+ resolution?: string;
147
+ frameRate?: number;
148
+ channels: string | null;
149
+ extension: string | null;
150
+ role?: RoleType;
151
+ videoRange?: string;
152
+ characteristics?: string;
153
+ publishTime?: Date;
154
+ audioId?: string;
155
+ videoId?: string;
156
+ subtitleId?: string;
157
+ periodId: string | null;
158
+ url: string;
159
+ originalUrl: string;
160
+ playlist?: Playlist;
161
+ get segmentsCount(): number;
162
+ toShortString(): string;
163
+ }
164
+
165
+ //#endregion
166
+ //#region lib/stream-extractor.d.ts
167
+ declare class StreamExtractor {
168
+ #private;
169
+ constructor(parserConfig?: ParserConfig);
170
+ get extractorType(): ExtractorType;
171
+ loadSourceFromUrl(url: string): Promise<void>;
172
+ loadSourceFromText(rawText: string, url?: string): void;
173
+ extractStreams(): Promise<StreamSpec[]>;
174
+ fetchPlayList(streamSpecs: StreamSpec[]): Promise<void>;
175
+ refreshPlayList(streamSpecs: StreamSpec[]): Promise<void>;
176
+ }
177
+
178
+ //#endregion
179
+ export { ContentProcessor, DefaultUrlProcessor, ENCRYPT_METHODS, EXTRACTOR_TYPES, EncryptMethod, ExtractorType, KeyProcessor, MEDIA_TYPES, MediaType, ParserConfig, ROLE_TYPE, RoleType, StreamExtractor, UrlProcessor };