react-native-alpha-video-gpu 0.0.0-stage → 1.0.1
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/LICENSE +21 -0
- package/README.md +953 -2
- package/THIRD_PARTY_NOTICES.md +14 -0
- package/android/src/main/AndroidManifest.xml +9 -0
- package/android/src/main/cpp/CMakeLists.txt +41 -0
- package/android/src/main/cpp/alphavideogpu_jni.cpp +1168 -0
- package/android/src/main/cpp/astc_decomp.cpp +1550 -0
- package/android/src/main/cpp/astc_decomp.h +41 -0
- package/android/src/main/cpp/source_jni.cpp +242 -0
- package/android/src/main/cpp/source_jni.h +13 -0
- package/android/src/main/java/dev/mediacache/alphavideo/gpu/AlphaVideoGpuNative.java +43 -0
- package/android/src/main/java/dev/mediacache/alphavideo/gpu/AlphaVideoGpuReader.java +209 -0
- package/android/src/main/java/dev/mediacache/alphavideo/gpu/AlphaVideoGpuSource.java +328 -0
- package/android/src/main/java/dev/mediacache/alphavideo/gpu/AlphaVideoGpuView.java +2126 -0
- package/android/src/main/java/dev/mediacache/alphavideo/gpu/Fetcher.java +37 -0
- package/android/src/main/java/dev/mediacache/alphavideo/gpu/HttpFetcher.java +156 -0
- package/android/src/main/java/dev/mediacache/alphavideo/gpu/Ktx2Metadata.java +78 -0
- package/android/src/main/java/dev/mediacache/alphavideo/gpu/RangeSourceLink.java +54 -0
- package/android/src/main/java/dev/mediacache/alphavideo/gpu/ZstdSeekTable.java +120 -0
- package/android/src/rangesource/java/dev/mediacache/alphavideo/gpu/AppDataSource.java +50 -0
- package/ios/Sources/AlphaVideoGPU/AlphaVideoGpuSource.h +63 -0
- package/ios/Sources/AlphaVideoGPU/AlphaVideoGpuSource.mm +522 -0
- package/ios/Sources/AlphaVideoGPU/AlphaVideoGpuView.mm +2722 -0
- package/ios/Sources/AlphaVideoGPU/astc_decomp.cpp +1550 -0
- package/ios/Sources/AlphaVideoGPU/astc_decomp.h +41 -0
- package/ios/Sources/AlphaVideoGPU/include/AlphaVideoGPU.h +110 -0
- package/ios/Sources/AlphaVideoGPU/zstd_seek.h +250 -0
- package/package.json +78 -4
- package/react-native/android/build.gradle +95 -0
- package/react-native/android/src/main/AndroidManifest.xml +9 -0
- package/react-native/android/src/main/java/dev/mediacache/alphavideo/gpu/reactnative/AlphaVideoGpuPackage.java +26 -0
- package/react-native/android/src/main/java/dev/mediacache/alphavideo/gpu/reactnative/AlphaVideoGpuViewManager.java +187 -0
- package/react-native/android/src/main/java/dev/mediacache/alphavideo/gpu/reactnative/PlayerEventForwarder.java +107 -0
- package/react-native/android/src/newarch/java/dev/mediacache/alphavideo/gpu/reactnative/AlphaVideoGpuViewManagerSpec.java +23 -0
- package/react-native/android/src/norangesource/java/dev/mediacache/alphavideo/gpu/AppDataSource.java +15 -0
- package/react-native/android/src/oldarch/java/dev/mediacache/alphavideo/gpu/reactnative/AlphaVideoGpuViewManagerSpec.java +56 -0
- package/react-native/ios/RNAlphaVideoGpuViewComponentView.mm +176 -0
- package/react-native/ios/RNAlphaVideoGpuViewManager.mm +175 -0
- package/react-native/src/AlphaVideoGpuView.js +2 -0
- package/react-native/src/AlphaVideoGpuView.web.tsx +296 -0
- package/react-native/src/AlphaVideoGpuViewNativeComponent.ts +128 -0
- package/react-native/src/AlphaVideoGpuViewNativeComponent.web.ts +2 -0
- package/react-native/src/index.d.ts +95 -0
- package/react-native/src/index.js +162 -0
- package/react-native-alpha-video-gpu.podspec +37 -0
- package/react-native.config.js +12 -0
- package/third_party/licenses/Apache-2.0.txt +208 -0
- package/third_party/range-source/LICENSE +21 -0
- package/third_party/range-source/README.md +10 -0
- package/third_party/range-source/include/range_source.h +395 -0
- package/third_party/range-source/include/range_source_download.h +309 -0
- package/third_party/zstd/LICENSE +30 -0
- package/third_party/zstd/zstd.c +38717 -0
- package/third_party/zstd/zstd.h +2450 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { ViewStyle } from 'react-native';
|
|
2
|
+
import type React from 'react';
|
|
3
|
+
|
|
4
|
+
// Re-export native component types
|
|
5
|
+
export * from './AlphaVideoGpuViewNativeComponent';
|
|
6
|
+
|
|
7
|
+
// Source type for the wrapper component (see SourceType for the URI forms, headers and dataSource)
|
|
8
|
+
export type AlphaVideoGpuSource = import('./AlphaVideoGpuViewNativeComponent').SourceType;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Where a URL's or data source's bytes are kept between plays, read back by range: 'disk' (the
|
|
12
|
+
* cache folder; the browser's storage on web), 'memory' (for the app's lifetime) or 'none'. 'auto',
|
|
13
|
+
* the default, is 'disk' for URLs and 'none' for a data source, whose caching is its own.
|
|
14
|
+
*/
|
|
15
|
+
export type AlphaVideoGpuStorage = 'auto' | 'disk' | 'memory' | 'none';
|
|
16
|
+
|
|
17
|
+
/** Web only: reads the file by offset (an app's own fetcher or cache); the smallest is `{ size, read }`. */
|
|
18
|
+
export interface AlphaVideoGpuByteSource {
|
|
19
|
+
open?(signal?: AbortSignal): Promise<{ size: number; etag?: string; lastModified?: string }>;
|
|
20
|
+
readonly size?: number;
|
|
21
|
+
read(offset: number, length: number, signal?: AbortSignal): Promise<Uint8Array>;
|
|
22
|
+
close?(): void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Props for the main AlphaVideoGpuView wrapper component (index.js)
|
|
26
|
+
export interface AlphaVideoGpuViewProps {
|
|
27
|
+
/** Source object, or a bare URI string (legacy). On web also a Blob or a byte source */
|
|
28
|
+
source?: AlphaVideoGpuSource | string | Blob | AlphaVideoGpuByteSource | null;
|
|
29
|
+
/** Start playing automatically (default: true) */
|
|
30
|
+
autoPlay?: boolean;
|
|
31
|
+
/** Loop the animation (default: true) */
|
|
32
|
+
loop?: boolean;
|
|
33
|
+
/** Playback speed multiplier (default: 1.0) */
|
|
34
|
+
playbackSpeed?: number;
|
|
35
|
+
/** What the store keeps the source under, instead of its URL (same as `source.cacheKey`) */
|
|
36
|
+
cacheKey?: string;
|
|
37
|
+
/** Where a URL's or data source's bytes are kept between plays. Default: 'auto' */
|
|
38
|
+
storage?: AlphaVideoGpuStorage;
|
|
39
|
+
/** The store's cap in bytes, over every clip, least recently played out first. Default: 512 MB */
|
|
40
|
+
maxStorageBytes?: number;
|
|
41
|
+
/** Pause playback */
|
|
42
|
+
paused?: boolean;
|
|
43
|
+
/** View style */
|
|
44
|
+
style?: ViewStyle;
|
|
45
|
+
/** Locates the view in end-to-end tests */
|
|
46
|
+
testID?: string;
|
|
47
|
+
// Every event has this shape on Android, iOS and web
|
|
48
|
+
/** Callback when player state changes */
|
|
49
|
+
onStateChange?: (event: { nativeEvent: { state: string } }) => void;
|
|
50
|
+
/** Callback after a seek, and for every frame played with `enableFrameEvents` */
|
|
51
|
+
onFrameUpdate?: (event: { nativeEvent: { frame: number; totalFrames: number } }) => void;
|
|
52
|
+
/** Callback when playback finishes */
|
|
53
|
+
onFinished?: (event: { nativeEvent: {} }) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Callback on error. `code` tells apart the errors an app may handle: on the web
|
|
56
|
+
* 'ASTC_UNSUPPORTED' or 'WEBGL_UNSUPPORTED', on iOS and Android 'NO_SOURCE_MODULE' (a data
|
|
57
|
+
* source without the range-source add-on)
|
|
58
|
+
*/
|
|
59
|
+
onError?: (event: { nativeEvent: { error: string; code?: 'ASTC_UNSUPPORTED' | 'WEBGL_UNSUPPORTED' | 'NO_SOURCE_MODULE' | '' } }) => void;
|
|
60
|
+
/** Callback when loaded */
|
|
61
|
+
onLoad?: (event: { nativeEvent: { width: number; height: number; frameCount: number; frameRate: number; duration: number } }) => void;
|
|
62
|
+
|
|
63
|
+
// Streaming parameters
|
|
64
|
+
/** Frames decoded ahead of the shown one, all streaming keeps (in the GPU ring with 'vram', in RAM with 'ram') */
|
|
65
|
+
streamingPrefetchAhead?: number;
|
|
66
|
+
/** Where frames are kept: 'vram' (default) or 'ram' */
|
|
67
|
+
memoryStrategy?: 'vram' | 'ram';
|
|
68
|
+
/** Stream texture-array files instead of loading every frame. Default: true */
|
|
69
|
+
stream?: boolean;
|
|
70
|
+
/** Send onFrameUpdate for every frame played; seeks always send it. Default: false */
|
|
71
|
+
enableFrameEvents?: boolean;
|
|
72
|
+
/** Log info traces. Warnings and errors always log. Default: false */
|
|
73
|
+
verbose?: boolean;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Seeks show the frame (clamped to the clip) and keep playing, or stay paused. They are ignored
|
|
78
|
+
* until `onLoad`. With `stream`, a seek outside the buffered frames decodes the file again from
|
|
79
|
+
* the start (or onwards from the decoder, for a seek ahead of it).
|
|
80
|
+
*/
|
|
81
|
+
export interface AlphaVideoGpuViewRef {
|
|
82
|
+
/** Plays from the shown frame, or from the start once a clip that doesn't loop has finished. */
|
|
83
|
+
play: () => void;
|
|
84
|
+
pause: () => void;
|
|
85
|
+
/** Pauses on the first frame. */
|
|
86
|
+
stop: () => void;
|
|
87
|
+
seekToFrame: (frame: number) => void;
|
|
88
|
+
/** Seeks to the frame showing at that time, in seconds. */
|
|
89
|
+
seekToTime: (seconds: number) => void;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// The actual component is defined in index.js, but we declare the type here
|
|
93
|
+
export declare const AlphaVideoGpuView: React.MemoExoticComponent<
|
|
94
|
+
React.ForwardRefExoticComponent<AlphaVideoGpuViewProps & React.RefAttributes<AlphaVideoGpuViewRef>>
|
|
95
|
+
>;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import React, { forwardRef, useImperativeHandle, useMemo, useRef } from 'react';
|
|
2
|
+
import { View, StyleSheet, Platform } from 'react-native';
|
|
3
|
+
|
|
4
|
+
// Platform-specific imports
|
|
5
|
+
let NativeAlphaVideoGpuView;
|
|
6
|
+
let NativeCommands;
|
|
7
|
+
let WebAlphaVideoGpuView;
|
|
8
|
+
|
|
9
|
+
if (Platform.OS === 'web') {
|
|
10
|
+
// Resolves to AlphaVideoGpuView.web.tsx; native bundles get the empty AlphaVideoGpuView.js
|
|
11
|
+
WebAlphaVideoGpuView = require('./AlphaVideoGpuView').default;
|
|
12
|
+
} else {
|
|
13
|
+
// Codegen spec: a Fabric component on the new architecture, a view manager on the old one
|
|
14
|
+
const nativeComponent = require('./AlphaVideoGpuViewNativeComponent');
|
|
15
|
+
NativeAlphaVideoGpuView = nativeComponent.default;
|
|
16
|
+
NativeCommands = nativeComponent.Commands;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* AlphaVideoGpuView - React Native component for GPU-accelerated alpha video playback
|
|
21
|
+
*
|
|
22
|
+
* Features:
|
|
23
|
+
* - GPU texture compression (ASTC) for efficient transparent video
|
|
24
|
+
* - GPU-accelerated playback (Metal on iOS, OpenGL ES on Android, WebGL on Web)
|
|
25
|
+
* - Low CPU/battery usage compared to traditional video codecs
|
|
26
|
+
* - Sources: https:// (read by range, and stored), file:// or absolute paths, asset://, on Android
|
|
27
|
+
* content:// and res/raw, and with source.dataSource anything a registered native data source reads
|
|
28
|
+
* - Works on iOS, Android, and Web (React Native Web)
|
|
29
|
+
*
|
|
30
|
+
* @param {Object} props - Component props
|
|
31
|
+
* @param {Object|string} props.source - Source object {uri, cacheKey, headers, dataSource}, or a bare URI string (legacy)
|
|
32
|
+
* @param {boolean} [props.autoPlay=true] - Start playing automatically
|
|
33
|
+
* @param {boolean} [props.loop=true] - Loop the animation
|
|
34
|
+
* @param {number} [props.playbackSpeed=1.0] - Playback speed multiplier
|
|
35
|
+
* @param {string} [props.cacheKey] - What the store keeps the source under, instead of its URL
|
|
36
|
+
* @param {string} [props.storage='auto'] - 'auto', 'disk', 'memory' or 'none': where a URL's or data source's bytes are kept
|
|
37
|
+
* @param {number} [props.maxStorageBytes] - The store's cap in bytes (default 512 MB)
|
|
38
|
+
* @param {Function} [props.onStateChange] - Callback when player state changes
|
|
39
|
+
* @param {Function} [props.onFrameUpdate] - Callback on each frame update
|
|
40
|
+
* @param {Function} [props.onFinished] - Callback when playback finishes
|
|
41
|
+
* @param {Function} [props.onError] - Callback on error
|
|
42
|
+
* @param {Object} [props.style] - View style
|
|
43
|
+
*
|
|
44
|
+
* The ref has play(), pause(), stop(), seekToFrame(frame) and seekToTime(seconds).
|
|
45
|
+
*/
|
|
46
|
+
export const AlphaVideoGpuView = React.memo(forwardRef(({
|
|
47
|
+
source,
|
|
48
|
+
autoPlay = true,
|
|
49
|
+
loop = true,
|
|
50
|
+
playbackSpeed = 1.0,
|
|
51
|
+
cacheKey,
|
|
52
|
+
style,
|
|
53
|
+
onStateChange,
|
|
54
|
+
onFrameUpdate,
|
|
55
|
+
onFinished,
|
|
56
|
+
onError,
|
|
57
|
+
...otherProps
|
|
58
|
+
}, ref) => {
|
|
59
|
+
const viewRef = useRef(null);
|
|
60
|
+
|
|
61
|
+
useImperativeHandle(ref, () => {
|
|
62
|
+
if (Platform.OS === 'web') {
|
|
63
|
+
const call = (name, args) => viewRef.current?.[name]?.(...args);
|
|
64
|
+
return {
|
|
65
|
+
play: () => call('play', []),
|
|
66
|
+
pause: () => call('pause', []),
|
|
67
|
+
stop: () => call('stop', []),
|
|
68
|
+
seekToFrame: frame => call('seekToFrame', [frame]),
|
|
69
|
+
seekToTime: seconds => call('seekToTime', [seconds]),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const send = (name, ...args) => {
|
|
73
|
+
if (viewRef.current) NativeCommands[name](viewRef.current, ...args);
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
play: () => send('play'),
|
|
77
|
+
pause: () => send('pause'),
|
|
78
|
+
stop: () => send('stop'),
|
|
79
|
+
seekToFrame: frame => send('seekToFrame', frame),
|
|
80
|
+
seekToTime: seconds => send('seekToTime', seconds),
|
|
81
|
+
};
|
|
82
|
+
}, []);
|
|
83
|
+
// Normalize source to object format for consistency
|
|
84
|
+
const normalizedSource = useMemo(() => {
|
|
85
|
+
if (!source) return null;
|
|
86
|
+
|
|
87
|
+
// If source is already an object, use it as-is
|
|
88
|
+
if (typeof source === 'object') {
|
|
89
|
+
return source;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Legacy string support - convert to object
|
|
93
|
+
return { uri: source };
|
|
94
|
+
}, [source]);
|
|
95
|
+
|
|
96
|
+
// A key passed as a prop or inside `source` both count; the prop wins.
|
|
97
|
+
const effectiveCacheKey = cacheKey != null ? cacheKey : normalizedSource?.cacheKey;
|
|
98
|
+
|
|
99
|
+
// Codegen has no string maps, so headers go to native as [name, value, ...]. Keyed by value,
|
|
100
|
+
// so that a source object made inline on each render isn't a new source.
|
|
101
|
+
const { uri, headers, dataSource } = normalizedSource ?? {};
|
|
102
|
+
const headersKey = headers ? JSON.stringify(headers) : '';
|
|
103
|
+
const nativeSource = useMemo(
|
|
104
|
+
() => ({
|
|
105
|
+
uri,
|
|
106
|
+
cacheKey: normalizedSource?.cacheKey,
|
|
107
|
+
headers: headers ? [].concat(...Object.entries(headers)) : undefined,
|
|
108
|
+
dataSource,
|
|
109
|
+
}),
|
|
110
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
111
|
+
[uri, normalizedSource?.cacheKey, headersKey, dataSource],
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
if (!source) {
|
|
115
|
+
return <View style={style} />;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Web implementation
|
|
119
|
+
if (Platform.OS === 'web') {
|
|
120
|
+
return (
|
|
121
|
+
<WebAlphaVideoGpuView
|
|
122
|
+
ref={viewRef}
|
|
123
|
+
source={normalizedSource}
|
|
124
|
+
cacheKey={effectiveCacheKey}
|
|
125
|
+
autoPlay={autoPlay}
|
|
126
|
+
loop={loop}
|
|
127
|
+
playbackSpeed={playbackSpeed}
|
|
128
|
+
style={style}
|
|
129
|
+
onStateChange={onStateChange}
|
|
130
|
+
onFrameUpdate={onFrameUpdate}
|
|
131
|
+
onFinished={onFinished}
|
|
132
|
+
onError={onError}
|
|
133
|
+
{...otherProps}
|
|
134
|
+
/>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return (
|
|
139
|
+
<NativeAlphaVideoGpuView
|
|
140
|
+
ref={viewRef}
|
|
141
|
+
source={nativeSource}
|
|
142
|
+
autoPlay={autoPlay}
|
|
143
|
+
loop={loop}
|
|
144
|
+
playbackSpeed={playbackSpeed}
|
|
145
|
+
cacheKey={effectiveCacheKey}
|
|
146
|
+
style={[styles.container, style]}
|
|
147
|
+
onStateChange={onStateChange}
|
|
148
|
+
onFrameUpdate={onFrameUpdate}
|
|
149
|
+
onFinished={onFinished}
|
|
150
|
+
onError={onError}
|
|
151
|
+
{...otherProps}
|
|
152
|
+
/>
|
|
153
|
+
);
|
|
154
|
+
}));
|
|
155
|
+
|
|
156
|
+
AlphaVideoGpuView.displayName = 'AlphaVideoGpuView';
|
|
157
|
+
|
|
158
|
+
const styles = StyleSheet.create({
|
|
159
|
+
container: {
|
|
160
|
+
// Note: backgroundColor not supported on GLSurfaceView
|
|
161
|
+
},
|
|
162
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = 'react-native-alpha-video-gpu'
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.homepage = package['homepage']
|
|
10
|
+
s.license = package['license']
|
|
11
|
+
s.authors = package['author']
|
|
12
|
+
|
|
13
|
+
s.platforms = { :ios => '13.0' }
|
|
14
|
+
s.source = { :git => package['repository']['url'], :tag => "v#{s.version}" }
|
|
15
|
+
|
|
16
|
+
# The iOS library (ios/Sources/AlphaVideoGPU, also the Swift package and the alpha-video-gpu
|
|
17
|
+
# pod) and the React Native view. AlphaVideoGpuView.mm compiles the ASTC decoder and zstd by
|
|
18
|
+
# #include. The range-source add-on is react-native-range-source, which the player finds at runtime.
|
|
19
|
+
s.source_files = 'ios/Sources/AlphaVideoGPU/**/*.{h,mm}', 'third_party/range-source/include/*.h',
|
|
20
|
+
'react-native/ios/**/*.{h,mm}'
|
|
21
|
+
s.public_header_files = 'ios/Sources/AlphaVideoGPU/include/AlphaVideoGPU.h'
|
|
22
|
+
s.preserve_paths = 'ios/Sources/AlphaVideoGPU/astc_decomp.cpp', 'third_party/zstd/**/*'
|
|
23
|
+
s.frameworks = 'Metal', 'MetalKit'
|
|
24
|
+
s.libraries = 'c++'
|
|
25
|
+
s.pod_target_xcconfig = {
|
|
26
|
+
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
|
|
27
|
+
'HEADER_SEARCH_PATHS' => '"$(PODS_TARGET_SRCROOT)/third_party" "$(PODS_TARGET_SRCROOT)/third_party/range-source/include"'
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
# React Native's helper: the Fabric and codegen dependencies, and RCT_NEW_ARCH_ENABLED on the
|
|
31
|
+
# new architecture. It reads pod_target_xcconfig, so it comes after it.
|
|
32
|
+
if respond_to?(:install_modules_dependencies, true)
|
|
33
|
+
install_modules_dependencies(s)
|
|
34
|
+
else
|
|
35
|
+
s.dependency 'React-Core'
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
dependency: {
|
|
3
|
+
platforms: {
|
|
4
|
+
android: {
|
|
5
|
+
sourceDir: './react-native/android',
|
|
6
|
+
packageImportPath: 'import dev.mediacache.alphavideo.gpu.reactnative.AlphaVideoGpuPackage;',
|
|
7
|
+
packageInstance: 'new AlphaVideoGpuPackage()',
|
|
8
|
+
},
|
|
9
|
+
ios: {},
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
};
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
|
|
5
|
+
http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION,
|
|
6
|
+
AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution
|
|
13
|
+
as defined by Sections 1 through 9 of this document.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright
|
|
18
|
+
owner that is granting the License.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities
|
|
23
|
+
that control, are controlled by, or are under common control with that entity.
|
|
24
|
+
For the purposes of this definition, "control" means (i) the power, direct
|
|
25
|
+
or indirect, to cause the direction or management of such entity, whether
|
|
26
|
+
by contract or otherwise, or (ii) ownership of fifty percent (50%) or more
|
|
27
|
+
of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions
|
|
32
|
+
granted by this License.
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
"Source" form shall mean the preferred form for making modifications, including
|
|
37
|
+
but not limited to software source code, documentation source, and configuration
|
|
38
|
+
files.
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
"Object" form shall mean any form resulting from mechanical transformation
|
|
43
|
+
or translation of a Source form, including but not limited to compiled object
|
|
44
|
+
code, generated documentation, and conversions to other media types.
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
"Work" shall mean the work of authorship, whether in Source or Object form,
|
|
49
|
+
made available under the License, as indicated by a copyright notice that
|
|
50
|
+
is included in or attached to the work (an example is provided in the Appendix
|
|
51
|
+
below).
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
"Derivative Works" shall mean any work, whether in Source or Object form,
|
|
56
|
+
that is based on (or derived from) the Work and for which the editorial revisions,
|
|
57
|
+
annotations, elaborations, or other modifications represent, as a whole, an
|
|
58
|
+
original work of authorship. For the purposes of this License, Derivative
|
|
59
|
+
Works shall not include works that remain separable from, or merely link (or
|
|
60
|
+
bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
"Contribution" shall mean any work of authorship, including the original version
|
|
65
|
+
of the Work and any modifications or additions to that Work or Derivative
|
|
66
|
+
Works thereof, that is intentionally submitted to Licensor for inclusion in
|
|
67
|
+
the Work by the copyright owner or by an individual or Legal Entity authorized
|
|
68
|
+
to submit on behalf of the copyright owner. For the purposes of this definition,
|
|
69
|
+
"submitted" means any form of electronic, verbal, or written communication
|
|
70
|
+
sent to the Licensor or its representatives, including but not limited to
|
|
71
|
+
communication on electronic mailing lists, source code control systems, and
|
|
72
|
+
issue tracking systems that are managed by, or on behalf of, the Licensor
|
|
73
|
+
for the purpose of discussing and improving the Work, but excluding communication
|
|
74
|
+
that is conspicuously marked or otherwise designated in writing by the copyright
|
|
75
|
+
owner as "Not a Contribution."
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
|
|
80
|
+
of whom a Contribution has been received by Licensor and subsequently incorporated
|
|
81
|
+
within the Work.
|
|
82
|
+
|
|
83
|
+
2. Grant of Copyright License. Subject to the terms and conditions of this
|
|
84
|
+
License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
|
|
85
|
+
no-charge, royalty-free, irrevocable copyright license to reproduce, prepare
|
|
86
|
+
Derivative Works of, publicly display, publicly perform, sublicense, and distribute
|
|
87
|
+
the Work and such Derivative Works in Source or Object form.
|
|
88
|
+
|
|
89
|
+
3. Grant of Patent License. Subject to the terms and conditions of this License,
|
|
90
|
+
each Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
|
|
91
|
+
no-charge, royalty-free, irrevocable (except as stated in this section) patent
|
|
92
|
+
license to make, have made, use, offer to sell, sell, import, and otherwise
|
|
93
|
+
transfer the Work, where such license applies only to those patent claims
|
|
94
|
+
licensable by such Contributor that are necessarily infringed by their Contribution(s)
|
|
95
|
+
alone or by combination of their Contribution(s) with the Work to which such
|
|
96
|
+
Contribution(s) was submitted. If You institute patent litigation against
|
|
97
|
+
any entity (including a cross-claim or counterclaim in a lawsuit) alleging
|
|
98
|
+
that the Work or a Contribution incorporated within the Work constitutes direct
|
|
99
|
+
or contributory patent infringement, then any patent licenses granted to You
|
|
100
|
+
under this License for that Work shall terminate as of the date such litigation
|
|
101
|
+
is filed.
|
|
102
|
+
|
|
103
|
+
4. Redistribution. You may reproduce and distribute copies of the Work or
|
|
104
|
+
Derivative Works thereof in any medium, with or without modifications, and
|
|
105
|
+
in Source or Object form, provided that You meet the following conditions:
|
|
106
|
+
|
|
107
|
+
(a) You must give any other recipients of the Work or Derivative Works a copy
|
|
108
|
+
of this License; and
|
|
109
|
+
|
|
110
|
+
(b) You must cause any modified files to carry prominent notices stating that
|
|
111
|
+
You changed the files; and
|
|
112
|
+
|
|
113
|
+
(c) You must retain, in the Source form of any Derivative Works that You distribute,
|
|
114
|
+
all copyright, patent, trademark, and attribution notices from the Source
|
|
115
|
+
form of the Work, excluding those notices that do not pertain to any part
|
|
116
|
+
of the Derivative Works; and
|
|
117
|
+
|
|
118
|
+
(d) If the Work includes a "NOTICE" text file as part of its distribution,
|
|
119
|
+
then any Derivative Works that You distribute must include a readable copy
|
|
120
|
+
of the attribution notices contained within such NOTICE file, excluding those
|
|
121
|
+
notices that do not pertain to any part of the Derivative Works, in at least
|
|
122
|
+
one of the following places: within a NOTICE text file distributed as part
|
|
123
|
+
of the Derivative Works; within the Source form or documentation, if provided
|
|
124
|
+
along with the Derivative Works; or, within a display generated by the Derivative
|
|
125
|
+
Works, if and wherever such third-party notices normally appear. The contents
|
|
126
|
+
of the NOTICE file are for informational purposes only and do not modify the
|
|
127
|
+
License. You may add Your own attribution notices within Derivative Works
|
|
128
|
+
that You distribute, alongside or as an addendum to the NOTICE text from the
|
|
129
|
+
Work, provided that such additional attribution notices cannot be construed
|
|
130
|
+
as modifying the License.
|
|
131
|
+
|
|
132
|
+
You may add Your own copyright statement to Your modifications and may provide
|
|
133
|
+
additional or different license terms and conditions for use, reproduction,
|
|
134
|
+
or distribution of Your modifications, or for any such Derivative Works as
|
|
135
|
+
a whole, provided Your use, reproduction, and distribution of the Work otherwise
|
|
136
|
+
complies with the conditions stated in this License.
|
|
137
|
+
|
|
138
|
+
5. Submission of Contributions. Unless You explicitly state otherwise, any
|
|
139
|
+
Contribution intentionally submitted for inclusion in the Work by You to the
|
|
140
|
+
Licensor shall be under the terms and conditions of this License, without
|
|
141
|
+
any additional terms or conditions. Notwithstanding the above, nothing herein
|
|
142
|
+
shall supersede or modify the terms of any separate license agreement you
|
|
143
|
+
may have executed with Licensor regarding such Contributions.
|
|
144
|
+
|
|
145
|
+
6. Trademarks. This License does not grant permission to use the trade names,
|
|
146
|
+
trademarks, service marks, or product names of the Licensor, except as required
|
|
147
|
+
for reasonable and customary use in describing the origin of the Work and
|
|
148
|
+
reproducing the content of the NOTICE file.
|
|
149
|
+
|
|
150
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to
|
|
151
|
+
in writing, Licensor provides the Work (and each Contributor provides its
|
|
152
|
+
Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
153
|
+
KIND, either express or implied, including, without limitation, any warranties
|
|
154
|
+
or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR
|
|
155
|
+
A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness
|
|
156
|
+
of using or redistributing the Work and assume any risks associated with Your
|
|
157
|
+
exercise of permissions under this License.
|
|
158
|
+
|
|
159
|
+
8. Limitation of Liability. In no event and under no legal theory, whether
|
|
160
|
+
in tort (including negligence), contract, or otherwise, unless required by
|
|
161
|
+
applicable law (such as deliberate and grossly negligent acts) or agreed to
|
|
162
|
+
in writing, shall any Contributor be liable to You for damages, including
|
|
163
|
+
any direct, indirect, special, incidental, or consequential damages of any
|
|
164
|
+
character arising as a result of this License or out of the use or inability
|
|
165
|
+
to use the Work (including but not limited to damages for loss of goodwill,
|
|
166
|
+
work stoppage, computer failure or malfunction, or any and all other commercial
|
|
167
|
+
damages or losses), even if such Contributor has been advised of the possibility
|
|
168
|
+
of such damages.
|
|
169
|
+
|
|
170
|
+
9. Accepting Warranty or Additional Liability. While redistributing the Work
|
|
171
|
+
or Derivative Works thereof, You may choose to offer, and charge a fee for,
|
|
172
|
+
acceptance of support, warranty, indemnity, or other liability obligations
|
|
173
|
+
and/or rights consistent with this License. However, in accepting such obligations,
|
|
174
|
+
You may act only on Your own behalf and on Your sole responsibility, not on
|
|
175
|
+
behalf of any other Contributor, and only if You agree to indemnify, defend,
|
|
176
|
+
and hold each Contributor harmless for any liability incurred by, or claims
|
|
177
|
+
asserted against, such Contributor by reason of your accepting any such warranty
|
|
178
|
+
or additional liability. END OF TERMS AND CONDITIONS
|
|
179
|
+
|
|
180
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
181
|
+
|
|
182
|
+
To apply the Apache License to your work, attach the following boilerplate
|
|
183
|
+
notice, with the fields enclosed by brackets "[]" replaced with your own identifying
|
|
184
|
+
information. (Don't include the brackets!) The text should be enclosed in
|
|
185
|
+
the appropriate comment syntax for the file format. We also recommend that
|
|
186
|
+
a file or class name and description of purpose be included on the same "printed
|
|
187
|
+
page" as the copyright notice for easier identification within third-party
|
|
188
|
+
archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
|
|
194
|
+
you may not use this file except in compliance with the License.
|
|
195
|
+
|
|
196
|
+
You may obtain a copy of the License at
|
|
197
|
+
|
|
198
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
199
|
+
|
|
200
|
+
Unless required by applicable law or agreed to in writing, software
|
|
201
|
+
|
|
202
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
203
|
+
|
|
204
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
205
|
+
|
|
206
|
+
See the License for the specific language governing permissions and
|
|
207
|
+
|
|
208
|
+
limitations under the License.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Daniel Kasprowicz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# range-source (native)
|
|
2
|
+
|
|
3
|
+
`include/` is `native/include` from [range-source](https://github.com/MediaCacheDev/range-source), unmodified, at commit `5c5dd0929ddbfbb51730b41d9dfd1a468d35e58e`. MIT, by the same author as this repository.
|
|
4
|
+
|
|
5
|
+
- `include/range_source.h` is the add-on's C interface, a table of functions, with a C++ wrapper over it. The player finds the add-on at runtime and reads URLs and data sources through it.
|
|
6
|
+
- `include/range_source_download.h` is the basic input, for when the add-on isn't there: a URL downloaded whole into a temporary file, read as it arrives.
|
|
7
|
+
|
|
8
|
+
Each player puts the C++ wrappers in a namespace of its own (`RANGE_SOURCE_CLIENT_NAMESPACE`), so another player's copy in the same app can't clash.
|
|
9
|
+
|
|
10
|
+
To update, run `scripts/vendor_range_source.sh` against a newer checkout. Its tests live in that repository (`native/test`).
|