Merge branch 'master' into csf

This commit is contained in:
rustdesk 2022-02-10 02:07:53 +08:00
commit e20bb04697
78 changed files with 8105 additions and 617 deletions

View File

@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>8.0</string>
<string>9.0</string>
</dict>
</plist>

View File

@ -166,7 +166,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -1,12 +1,10 @@
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_hbb/server_page.dart';
import 'package:tuple/tuple.dart';
import 'dart:io';
import 'main.dart';
typedef F = String Function(String);
typedef FMethod = String Function(String, dynamic);
class Translator {
static F call;
@ -22,6 +20,8 @@ class MyTheme {
static const Color accent80 = Color(0xAA0071FF);
static const Color canvasColor = Color(0xFF212121);
static const Color border = Color(0xFFCCCCCC);
static const Color idColor = Color(0xFF00B6F0);
static const Color darkGray = Color(0xFFB9BABC);
}
final ButtonStyle flatButtonStyle = TextButton.styleFrom(
@ -32,41 +32,44 @@ final ButtonStyle flatButtonStyle = TextButton.styleFrom(
),
);
void Function() loadingCancelCallback = null;
void Function() loadingCancelCallback;
void showLoading(String text, BuildContext context) {
if (_hasDialog && context != null) {
Navigator.pop(context);
_hasDialog = false;
}
dismissLoading();
if (Platform.isAndroid) {
if (isAndroid) {
EasyLoading.show(status: text, maskType: EasyLoadingMaskType.black);
return;
}
EasyLoading.showWidget(
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(child: CircularProgressIndicator()),
SizedBox(height: 20),
Center(
child:
Text(Translator.call(text), style: TextStyle(fontSize: 15))),
SizedBox(height: 20),
Center(
child: TextButton(
style: flatButtonStyle,
onPressed: () {
// with out loadingCancelCallback, we can see unexpected input password
// dialog shown in home, no clue why, so use this as workaround
// why no such issue on android?
if (loadingCancelCallback != null) loadingCancelCallback();
Navigator.pop(context);
},
child: Text(Translator.call('Cancel'),
style: TextStyle(color: MyTheme.accent))))
],
),
Container(
constraints: BoxConstraints(maxWidth: 300),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(child: CircularProgressIndicator()),
SizedBox(height: 20),
Center(
child: Text(Translator.call(text),
style: TextStyle(fontSize: 15))),
SizedBox(height: 20),
Center(
child: TextButton(
style: flatButtonStyle,
onPressed: () {
// with out loadingCancelCallback, we can see unexpected input password
// dialog shown in home, no clue why, so use this as workaround
// why no such issue on android?
if (loadingCancelCallback != null)
loadingCancelCallback();
Navigator.pop(context);
},
child: Text(Translator.call('Cancel'),
style: TextStyle(color: MyTheme.accent))))
],
)),
maskType: EasyLoadingMaskType.black);
}
@ -126,6 +129,7 @@ void msgbox(String type, String title, String text, BuildContext context,
dismissLoading();
if (_hasDialog) {
Navigator.pop(context);
_hasDialog = false;
}
final buttons = [
Expanded(child: Container()),
@ -145,18 +149,20 @@ void msgbox(String type, String title, String text, BuildContext context,
}));
}
EasyLoading.showWidget(
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(Translator.call(title), style: TextStyle(fontSize: 21)),
SizedBox(height: 20),
Text(Translator.call(text), style: TextStyle(fontSize: 15)),
SizedBox(height: 20),
Row(
children: buttons,
)
],
),
Container(
constraints: BoxConstraints(maxWidth: 300),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(Translator.call(title), style: TextStyle(fontSize: 21)),
SizedBox(height: 20),
Text(Translator.call(text), style: TextStyle(fontSize: 15)),
SizedBox(height: 20),
Row(
children: buttons,
)
],
)),
maskType: EasyLoadingMaskType.black);
}
@ -211,44 +217,8 @@ Color str2color(String str, [alpha = 0xFF]) {
return Color((hash & 0xFF7FFF) | (alpha << 24));
}
toAndroidChannelInit() {
toAndroidChannel.setMethodCallHandler((call) async {
debugPrint("flutter got android msg");
try {
switch (call.method) {
case "try_start_without_auth":
{
// FFI直接去获取 serverModel里面直接封装一个update通过FFI从rust端获取
ServerPage.serverModel.updateClientState();
debugPrint("pre show loginAlert:${ServerPage.serverModel.isFileTransfer.toString()}");
showLoginReqAlert(nowCtx, ServerPage.serverModel.peerID, ServerPage.serverModel.peerName);
debugPrint("from jvm:try_start_without_auth done");
break;
}
case "start_capture":
{
clearLoginReqAlert();
ServerPage.serverModel.updateClientState();
break;
}
case "stop_capture":
{
ServerPage.serverModel.setPeer(false);
break;
}
case "on_permission_changed":
{
var name = call.arguments["name"] as String;
var value = call.arguments["value"] as String == "true";
debugPrint("from jvm:on_permission_changed,$name:$value");
ServerPage.serverModel.changeStatue(name, value);
break;
}
}
} catch (e) {
debugPrint("MethodCallHandler err:$e");
}
return null;
});
}
bool isAndroid = false;
bool isIOS = false;
bool isWeb = false;
bool isDesktop = false;
BuildContext nowCtx;

View File

@ -1,14 +1,11 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart';
import 'package:package_info/package_info.dart';
import 'package:url_launcher/url_launcher.dart';
import 'dart:async';
import 'common.dart';
import 'main.dart';
import 'model.dart';
import 'remote_page.dart';
import 'dart:io';
class HomePage extends StatefulWidget {
HomePage({Key key, this.title}) : super(key: key);
@ -22,12 +19,13 @@ class HomePage extends StatefulWidget {
class _HomePageState extends State<HomePage> {
final _idController = TextEditingController();
var _updateUrl = '';
var _menuPos;
@override
void initState() {
super.initState();
nowCtx = context;
if (Platform.isAndroid) {
if (isAndroid) {
Timer(Duration(seconds: 5), () {
_updateUrl = FFI.getByName('software_update_url');
if (_updateUrl.isNotEmpty) setState(() {});
@ -45,37 +43,45 @@ class _HomePageState extends State<HomePage> {
appBar: AppBar(
centerTitle: true,
actions: [
IconButton(
icon: Icon(Icons.more_vert),
onPressed: () {
() async {
var value = await showMenu(
context: context,
position: RelativeRect.fromLTRB(3000, 70, 3000, 70),
items: [
PopupMenuItem<String>(
child: Text(translate('ID Server')),
value: 'id_server'),
Platform.isAndroid
? PopupMenuItem<String>(
child: Text(translate('Share My Screen')),
value: 'server')
: null,
PopupMenuItem<String>(
child: Text(translate('About') + ' RustDesk'),
value: 'about'),
],
elevation: 8,
);
if (value == 'id_server') {
showServer(context);
} else if (value == 'server') {
Navigator.pushNamed(context, "server_page");
} else if (value == 'about') {
showAbout(context);
}
}();
})
Ink(
child: InkWell(
child: Padding(
padding: const EdgeInsets.all(12),
child: Icon(Icons.more_vert)),
onTapDown: (e) {
var x = e.globalPosition.dx;
var y = e.globalPosition.dy;
this._menuPos = RelativeRect.fromLTRB(x, y, x, y);
},
onTap: () {
() async {
var value = await showMenu(
context: context,
position: this._menuPos,
items: [
PopupMenuItem<String>(
child: Text(translate('ID Server')),
value: 'server'),
isAndroid
? PopupMenuItem<String>(
child: Text(translate('Share My Screen')),
value: 'server')
: null,
PopupMenuItem<String>(
child: Text(translate('About') + ' RustDesk'),
value: 'about'),
],
elevation: 8,
);
if (value == 'server') {
showServer(context);
} else if (value == 'server') {
Navigator.pushNamed(context, "server_page");
} else if (value == 'about') {
showAbout(context);
}
}();
}))
],
title: Text(widget.title),
),
@ -104,6 +110,7 @@ class _HomePageState extends State<HomePage> {
color: Colors.white,
fontWeight: FontWeight.bold)))),
getSearchBarUI(),
Container(height: 12),
getPeers(),
]),
));
@ -136,13 +143,13 @@ class _HomePageState extends State<HomePage> {
if (!FFI.ffiModel.initialized) {
return Container();
}
return Padding(
var w = Padding(
padding: const EdgeInsets.fromLTRB(16.0, 8.0, 16.0, 0.0),
child: Container(
height: 84,
child: Padding(
padding: const EdgeInsets.only(top: 8, bottom: 8),
child: Container(
child: Ink(
decoration: BoxDecoration(
color: MyTheme.white,
borderRadius: const BorderRadius.only(
@ -166,7 +173,7 @@ class _HomePageState extends State<HomePage> {
fontFamily: 'WorkSans',
fontWeight: FontWeight.bold,
fontSize: 30,
color: Color(0xFF00B6F0),
color: MyTheme.idColor,
),
decoration: InputDecoration(
labelText: translate('Remote ID'),
@ -175,13 +182,13 @@ class _HomePageState extends State<HomePage> {
helperStyle: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
color: Color(0xFFB9BABC),
color: MyTheme.darkGray,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 16,
letterSpacing: 0.2,
color: Color(0xFFB9BABC),
color: MyTheme.darkGray,
),
),
autofocus: _idController.text.isEmpty,
@ -194,7 +201,7 @@ class _HomePageState extends State<HomePage> {
height: 60,
child: IconButton(
icon: Icon(Icons.arrow_forward,
color: Color(0xFFB9BABC), size: 45),
color: MyTheme.darkGray, size: 45),
onPressed: onConnect,
autofocus: _idController.text.isNotEmpty,
),
@ -205,6 +212,8 @@ class _HomePageState extends State<HomePage> {
),
),
);
return Center(
child: Container(constraints: BoxConstraints(maxWidth: 600), child: w));
}
@override
@ -225,46 +234,75 @@ class _HomePageState extends State<HomePage> {
if (!FFI.ffiModel.initialized) {
return Container();
}
final size = MediaQuery.of(context).size;
final space = 8.0;
var width = size.width - 2 * space;
final minWidth = 320.0;
if (size.width > minWidth + 2 * space) {
final n = (size.width / (minWidth + 2 * space)).floor();
width = size.width / n - 2 * space;
}
final cards = <Widget>[];
var peers = FFI.peers();
peers.forEach((p) {
cards.add(Padding(
padding: EdgeInsets.symmetric(horizontal: 12),
cards.add(Container(
width: width,
child: Card(
child: GestureDetector(
onTap: () => connect('${p.id}'),
onTap: () => {
if (!isDesktop) {connect('${p.id}')}
},
onDoubleTap: () => {
if (isDesktop) {connect('${p.id}')}
},
onLongPressStart: (details) {
var x = details.globalPosition.dx;
var y = details.globalPosition.dy;
() async {
var value = await showMenu(
context: context,
position: RelativeRect.fromLTRB(x, y, x, y),
items: [
PopupMenuItem<String>(
child: Text(translate('Remove')),
value: 'remove'),
],
elevation: 8,
);
if (value == 'remove') {
setState(() => FFI.setByName('remove', '${p.id}'));
() async {
removePreference(p.id);
}();
}
}();
this._menuPos = RelativeRect.fromLTRB(x, y, x, y);
this.showPeerMenu(context, p.id);
},
child: ListTile(
contentPadding: const EdgeInsets.only(left: 12),
subtitle: Text('${p.username}@${p.hostname}'),
title: Text('${p.id}'),
leading: Container(
padding: const EdgeInsets.all(6),
child: getPlatformImage('${p.platform}'),
color: str2color('${p.id}${p.platform}', 0x7f)),
trailing: InkWell(
child: Padding(
padding: const EdgeInsets.all(12),
child: Icon(Icons.more_vert)),
onTapDown: (e) {
var x = e.globalPosition.dx;
var y = e.globalPosition.dy;
this._menuPos = RelativeRect.fromLTRB(x, y, x, y);
},
onDoubleTap: () {},
onTap: () {
showPeerMenu(context, p.id);
}),
)))));
});
return Wrap(children: cards);
return Wrap(children: cards, spacing: space, runSpacing: space);
}
void showPeerMenu(BuildContext context, String id) async {
var value = await showMenu(
context: context,
position: this._menuPos,
items: [
PopupMenuItem<String>(
child: Text(translate('Remove')), value: 'remove'),
],
elevation: 8,
);
if (value == 'remove') {
setState(() => FFI.setByName('remove', '$id'));
() async {
removePreference(id);
}();
}
}
}
@ -332,13 +370,13 @@ void showServer(BuildContext context) {
formKey.currentState.save();
if (id != id0)
FFI.setByName('option',
'{"name": "custom-rendezvous-server", "value": "${id}"}');
'{"name": "custom-rendezvous-server", "value": "$id"}');
if (relay != relay0)
FFI.setByName('option',
'{"name": "relay-server", "value": "${relay}"}');
'{"name": "relay-server", "value": "$relay"}');
if (key != key0)
FFI.setByName(
'option', '{"name": "key", "value": "${key}"}');
'option', '{"name": "key", "value": "$key"}');
Navigator.pop(context);
}
},
@ -349,13 +387,13 @@ void showServer(BuildContext context) {
}
Future<Null> showAbout(BuildContext context) async {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
var version = await FFI.getVersion();
showAlertDialog(
context,
(setState) => Tuple3(
null,
Wrap(direction: Axis.vertical, spacing: 12, children: [
Text('Version: ${packageInfo.version}'),
Text('Version: $version'),
InkWell(
onTap: () async {
const url = 'https://rustdesk.com/';

View File

@ -1,16 +1,11 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_hbb/server_page.dart';
import 'package:provider/provider.dart';
import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:firebase_analytics/observer.dart';
import 'package:firebase_core/firebase_core.dart';
import 'common.dart';
import 'model.dart';
import 'home_page.dart';
const toAndroidChannel = MethodChannel("mChannel");
BuildContext nowCtx;
import 'server_page.dart';
Future<Null> main() async {
WidgetsFlutterBinding.ensureInitialized();
@ -20,7 +15,6 @@ Future<Null> main() async {
}
class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
final analytics = FirebaseAnalytics();
@ -40,7 +34,7 @@ class App extends StatelessWidget {
),
home: HomePage(title: 'RustDesk'),
routes: {
"server_page":(context) => ServerPage(),
"server_page": (context) => ServerPage(),
},
navigatorObservers: [
FirebaseAnalyticsObserver(analytics: analytics),

View File

@ -1,13 +1,6 @@
import 'package:ffi/ffi.dart';
import 'package:flutter/services.dart';
import 'package:flutter/gestures.dart';
import 'package:path_provider/path_provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:device_info/device_info.dart';
import 'package:external_path/external_path.dart';
import 'dart:io';
import 'dart:math';
import 'dart:ffi';
import 'dart:convert';
import 'dart:typed_data';
import 'dart:ui' as ui;
@ -15,17 +8,7 @@ import 'package:flutter/material.dart';
import 'package:tuple/tuple.dart';
import 'dart:async';
import 'common.dart';
class RgbaFrame extends Struct {
@Uint32()
int len;
Pointer<Uint8> data;
}
typedef F2 = Pointer<Utf8> Function(Pointer<Utf8>, Pointer<Utf8>);
typedef F3 = void Function(Pointer<Utf8>, Pointer<Utf8>);
typedef F4 = void Function(Pointer<RgbaFrame>);
typedef F5 = Pointer<RgbaFrame> Function();
import 'native_model.dart' if (dart.library.html) 'web_model.dart';
class FfiModel with ChangeNotifier {
PeerInfo _pi;
@ -33,6 +16,7 @@ class FfiModel with ChangeNotifier {
var _decoding = false;
bool _waitForImage;
bool _initialized = false;
var _inputBlocked = false;
final _permissions = Map<String, bool>();
bool _secure;
bool _direct;
@ -48,12 +32,17 @@ class FfiModel with ChangeNotifier {
get direct => _direct;
get pi => _pi;
get inputBlocked => _inputBlocked;
set inputBlocked(v) {
_inputBlocked = v;
}
FfiModel() {
Translator.call = translate;
clear();
() async {
await FFI.init();
await PlatformFFI.init();
_initialized = true;
print("FFI initialized");
notifyListeners();
@ -66,6 +55,7 @@ class FfiModel with ChangeNotifier {
_permissions[k] = v == 'true';
});
print('$_permissions');
notifyListeners();
}
bool keyboard() => _permissions['keyboard'] != false;
@ -76,6 +66,7 @@ class FfiModel with ChangeNotifier {
_waitForImage = false;
_secure = null;
_direct = null;
_inputBlocked = false;
clearPermissions();
}
@ -101,6 +92,7 @@ class FfiModel with ChangeNotifier {
}
void clearPermissions() {
_inputBlocked = false;
_permissions.clear();
}
@ -140,7 +132,7 @@ class FfiModel with ChangeNotifier {
}
if (pos != null) FFI.cursorModel.updateCursorPosition(pos);
if (!_decoding) {
var rgba = FFI.getRgba();
var rgba = PlatformFFI.getRgba();
if (rgba != null) {
if (_waitForImage) {
_waitForImage = false;
@ -151,7 +143,7 @@ class FfiModel with ChangeNotifier {
ui.decodeImageFromPixels(
rgba, _display.width, _display.height, ui.PixelFormat.bgra8888,
(image) {
FFI.clearRgbaFrame();
PlatformFFI.clearRgbaFrame();
_decoding = false;
if (FFI.id != pid) return;
try {
@ -198,7 +190,6 @@ class FfiModel with ChangeNotifier {
}
if (_pi.currentDisplay < _pi.displays.length) {
_display = _pi.displays[_pi.currentDisplay];
initializeCursorAndCanvas();
}
if (displays.length > 0) {
showLoading(translate('Connected, waiting for image...'), context);
@ -215,10 +206,15 @@ class ImageModel with ChangeNotifier {
void update(ui.Image image) {
if (_image == null && image != null) {
final size = MediaQueryData.fromWindow(ui.window).size;
final xscale = size.width / image.width;
final yscale = size.height / image.height;
FFI.canvasModel.scale = max(xscale, yscale);
if (isDesktop) {
FFI.canvasModel.updateViewStyle();
} else {
final size = MediaQueryData.fromWindow(ui.window).size;
final xscale = size.width / image.width;
final yscale = size.height / image.height;
FFI.canvasModel.scale = max(xscale, yscale);
}
initializeCursorAndCanvas();
}
_image = image;
if (image != null) notifyListeners();
@ -256,6 +252,29 @@ class CanvasModel with ChangeNotifier {
double get scale => _scale;
void updateViewStyle() {
final s = FFI.getByName('peer_option', 'view-style');
final size = MediaQueryData.fromWindow(ui.window).size;
final s1 = size.width / FFI.ffiModel.display.width;
final s2 = size.height / FFI.ffiModel.display.height;
if (s == 'shrink') {
final s = s1 < s2 ? s1 : s2;
if (s < 1) {
_scale = s;
}
} else if (s == 'stretch') {
final s = s1 > s2 ? s1 : s2;
if (s > 1) {
_scale = s;
}
} else {
_scale = 1;
}
_x = (size.width - FFI.ffiModel.display.width * _scale) / 2;
_y = (size.height - FFI.ffiModel.display.height * _scale) / 2;
notifyListeners();
}
void update(double x, double y, double scale) {
_x = x;
_y = y;
@ -263,6 +282,26 @@ class CanvasModel with ChangeNotifier {
notifyListeners();
}
void moveDesktopMouse(double x, double y) {
final size = MediaQueryData.fromWindow(ui.window).size;
final dw = FFI.ffiModel.display.width * _scale;
final dh = FFI.ffiModel.display.height * _scale;
var dxOffset = 0;
var dyOffset = 0;
if (dw > size.width) {
dxOffset = (x - dw * (x / size.width) - _x).toInt();
}
if (dh > size.height) {
dyOffset = (y - dh * (y / size.height) - _y).toInt();
}
_x += dxOffset;
_y += dyOffset;
if (dxOffset != 0 || dyOffset != 0) {
notifyListeners();
}
FFI.cursorModel.move(x, y);
}
set scale(v) {
_scale = v;
notifyListeners();
@ -274,8 +313,12 @@ class CanvasModel with ChangeNotifier {
}
void resetOffset() {
_x = 0;
_y = 0;
if (isDesktop) {
updateViewStyle();
} else {
_x = 0;
_y = 0;
}
notifyListeners();
}
@ -356,13 +399,17 @@ class CursorModel with ChangeNotifier {
}
void touch(double x, double y, bool right) {
move(x, y);
FFI.moveMouse(_x, _y);
FFI.tap(right);
}
void move(double x, double y) {
final scale = FFI.canvasModel.scale;
final xoffset = FFI.canvasModel.x;
final yoffset = FFI.canvasModel.y;
_x = (x - xoffset) / scale + _displayOriginX;
_y = (y - yoffset) / scale + _displayOriginY;
FFI.moveMouse(_x, _y);
FFI.tap(right);
notifyListeners();
}
@ -558,7 +605,7 @@ class ServerModel with ChangeNotifier {
bool get inputOk => _inputOk;
// bool get needServerOpen => _needServerOpen;
bool get isPeerStart => _isPeerStart;
bool get isFileTransfer => _isFileTransfer;
@ -625,13 +672,6 @@ class ServerModel with ChangeNotifier {
class FFI {
static String id = "";
static String _dir = "";
static String _homeDir = "";
static F2 _getByName;
static F3 _setByName;
static F4 _freeRgba;
static F5 _getRgba;
static Pointer<RgbaFrame> _lastRgbaFrame;
static var shift = false;
static var ctrl = false;
static var alt = false;
@ -640,6 +680,7 @@ class FFI {
static final ffiModel = FfiModel();
static final cursorModel = CursorModel();
static final canvasModel = CanvasModel();
static final serverModel = ServerModel();
static String getId() {
return getByName('remote_id');
@ -682,7 +723,8 @@ class FFI {
static void inputKey(String name) {
if (!ffiModel.keyboard()) return;
setByName('input_key', json.encode(modify({'name': name})));
setByName(
'input_key', json.encode(modify({'name': name, 'press': 'true'})));
}
static void moveMouse(double x, double y) {
@ -711,19 +753,6 @@ class FFI {
FFI.id = id;
}
static void clearRgbaFrame() {
if (_lastRgbaFrame != null && _lastRgbaFrame != nullptr)
_freeRgba(_lastRgbaFrame);
}
static Uint8List getRgba() {
if (_getRgba == null) return null;
_lastRgbaFrame = _getRgba();
if (_lastRgbaFrame == null || _lastRgbaFrame == nullptr) return null;
final ref = _lastRgbaFrame.ref;
return Uint8List.sublistView(ref.data.asTypedList(ref.len));
}
static Map<String, dynamic> popEvent() {
var s = getByName('event');
if (s == '') return null;
@ -746,8 +775,10 @@ class FFI {
}
static void close() {
savePreference(id, cursorModel.x, cursorModel.y, canvasModel.x,
canvasModel.y, canvasModel.scale, ffiModel.pi.currentDisplay);
if (FFI.imageModel.image != null && !isDesktop) {
savePreference(id, cursorModel.x, cursorModel.y, canvasModel.x,
canvasModel.y, canvasModel.scale, ffiModel.pi.currentDisplay);
}
id = "";
setByName('close', '');
imageModel.update(null);
@ -757,63 +788,86 @@ class FFI {
resetModifiers();
}
static void setByName(String name, [String value = '']) {
if (_setByName == null) return;
var a = name.toNativeUtf8();
var b = value.toNativeUtf8();
_setByName(a, b);
calloc.free(a);
calloc.free(b);
}
static String getByName(String name, [String arg = '']) {
if (_getByName == null) return '';
var a = name.toNativeUtf8();
var b = arg.toNativeUtf8();
var p = _getByName(a, b);
assert(p != nullptr && p != null);
var res = p.toDartString();
calloc.free(p);
calloc.free(a);
calloc.free(b);
return res;
return PlatformFFI.getByName(name, arg);
}
static Future<Null> init() async {
final dylib = Platform.isAndroid
? DynamicLibrary.open('librustdesk.so')
: DynamicLibrary.process();
print('initializing FFI');
try {
_getByName = dylib.lookupFunction<F2, F2>('get_by_name');
_setByName =
dylib.lookupFunction<Void Function(Pointer<Utf8>, Pointer<Utf8>), F3>(
'set_by_name');
_freeRgba = dylib
.lookupFunction<Void Function(Pointer<RgbaFrame>), F4>('free_rgba');
_getRgba = dylib.lookupFunction<F5, F5>('get_rgba');
_dir = (await getApplicationDocumentsDirectory()).path;
_homeDir = (await ExternalPath.getExternalStorageDirectories())[0];
String id = 'NA';
String name = 'Flutter';
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
if (Platform.isAndroid) {
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
name = '${androidInfo.brand}-${androidInfo.model}';
id = androidInfo.id.hashCode.toString();
} else {
IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
name = iosInfo.utsname.machine;
id = iosInfo.identifierForVendor.hashCode.toString();
}
debugPrint("info1-id:$id,info2-name:$name,dir:$_dir,homeDir:$_homeDir");
setByName('info1', id);
setByName('info2', name);
setByName('home_dir',_homeDir);
setByName('init', _dir);
} catch (e) {
print(e);
static void setByName(String name, [String value = '']) {
PlatformFFI.setByName(name, value);
}
static Future<String> getVersion() async {
return await PlatformFFI.getVersion();
}
static handleMouse(Map<String, dynamic> evt) {
var type = '';
var isMove = false;
switch (evt['type']) {
case 'mousedown':
type = 'down';
break;
case 'mouseup':
type = 'up';
break;
case 'mousemove':
isMove = true;
break;
default:
return;
}
evt['type'] = type;
var x = evt['x'];
var y = evt['y'];
if (isMove) {
FFI.canvasModel.moveDesktopMouse(x, y);
}
final d = FFI.ffiModel.display;
x -= FFI.canvasModel.x;
y -= FFI.canvasModel.y;
if (!isMove && (x < 0 || x > d.width || y < 0 || y > d.height)) {
return;
}
x /= FFI.canvasModel.scale;
y /= FFI.canvasModel.scale;
x += d.x;
y += d.y;
if (type != '') {
x = 0;
y = 0;
}
evt['x'] = '$x';
evt['y'] = '$y';
var buttons = '';
switch (evt['buttons']) {
case 1:
buttons = 'left';
break;
case 2:
buttons = 'right';
break;
case 4:
buttons = 'wheel';
break;
}
evt['buttons'] = buttons;
setByName('send_mouse', json.encode(evt));
}
static listenToMouse(bool yesOrNo) {
if (yesOrNo) {
PlatformFFI.startDesktopWebListener(handleMouse);
} else {
PlatformFFI.stopDesktopWebListener();
}
}
static void setMethodCallHandler(FMethod callback) {
PlatformFFI.setMethodCallHandler(callback);
}
static Future<bool> invokeMethod(String method) async {
return await PlatformFFI.invokeMethod(method);
}
}
@ -861,6 +915,7 @@ void savePreference(String id, double xCursor, double yCursor, double xCanvas,
}
Future<Map<String, dynamic>> getPreference(String id) async {
if (!isDesktop) return null;
SharedPreferences prefs = await SharedPreferences.getInstance();
var p = prefs.getString('peer' + id);
if (p == null) return null;
@ -894,33 +949,11 @@ void initializeCursorAndCanvas() async {
FFI.canvasModel.update(xCanvas, yCanvas, scale);
}
final locale = Platform.localeName;
final bool isCn =
locale.startsWith('zh') && (locale.endsWith('CN') || locale.endsWith('SG'));
final langs = <String, Map<String, String>>{
'cn': <String, String>{
'Remote ID': '远程ID',
'Paste': '粘贴',
'Are you sure to close the connection?': '是否确认关闭连接?',
'Download new version': '下载新版本',
'Touch mode': '触屏模式',
'Reset canvas': '重置画布',
},
'en': <String, String>{}
};
String translate(String name) {
if (name.startsWith('Failed') && name.contains(':')) {
if (name.startsWith('Failed to') && name.contains(': ')) {
return name.split(': ').map((x) => translate(x)).join(': ');
}
final tmp = isCn ? langs['cn'] : langs['en'];
final v = tmp[name];
if (v == null) {
var a = 'translate';
var b = '{"locale": "${Platform.localeName}", "text": "${name}"}';
return FFI.getByName(a, b);
} else {
return v;
}
var a = 'translate';
var b = '{"locale": "$localeName", "text": "$name"}';
return FFI.getByName(a, b);
}

128
lib/native_model.dart Normal file
View File

@ -0,0 +1,128 @@
import 'dart:io';
import 'dart:typed_data';
import 'dart:ffi';
import 'package:ffi/ffi.dart';
import 'package:path_provider/path_provider.dart';
import 'package:device_info/device_info.dart';
import 'package:package_info/package_info.dart';
import 'package:external_path/external_path.dart';
import 'package:flutter/services.dart';
import 'common.dart';
class RgbaFrame extends Struct {
@Uint32()
int len;
Pointer<Uint8> data;
}
typedef F2 = Pointer<Utf8> Function(Pointer<Utf8>, Pointer<Utf8>);
typedef F3 = void Function(Pointer<Utf8>, Pointer<Utf8>);
typedef F4 = void Function(Pointer<RgbaFrame>);
typedef F5 = Pointer<RgbaFrame> Function();
class PlatformFFI {
static Pointer<RgbaFrame> _lastRgbaFrame;
static String _dir = '';
static String _homeDir = '';
static F2 _getByName;
static F3 _setByName;
static F4 _freeRgba;
static F5 _getRgba;
static void clearRgbaFrame() {
if (_lastRgbaFrame != null && _lastRgbaFrame != nullptr)
_freeRgba(_lastRgbaFrame);
}
static Uint8List getRgba() {
if (_getRgba == null) return null;
_lastRgbaFrame = _getRgba();
if (_lastRgbaFrame == null || _lastRgbaFrame == nullptr) return null;
final ref = _lastRgbaFrame.ref;
return Uint8List.sublistView(ref.data.asTypedList(ref.len));
}
static Future<String> getVersion() async {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
return packageInfo.version;
}
static String getByName(String name, [String arg = '']) {
if (_getByName == null) return '';
var a = name.toNativeUtf8();
var b = arg.toNativeUtf8();
var p = _getByName(a, b);
assert(p != nullptr && p != null);
var res = p.toDartString();
calloc.free(p);
calloc.free(a);
calloc.free(b);
return res;
}
static void setByName(String name, [String value = '']) {
if (_setByName == null) return;
var a = name.toNativeUtf8();
var b = value.toNativeUtf8();
_setByName(a, b);
calloc.free(a);
calloc.free(b);
}
static Future<Null> init() async {
isIOS = Platform.isIOS;
isAndroid = Platform.isAndroid;
final dylib = Platform.isAndroid
? DynamicLibrary.open('librustdesk.so')
: DynamicLibrary.process();
print('initializing FFI');
try {
_getByName = dylib.lookupFunction<F2, F2>('get_by_name');
_setByName =
dylib.lookupFunction<Void Function(Pointer<Utf8>, Pointer<Utf8>), F3>(
'set_by_name');
_freeRgba = dylib
.lookupFunction<Void Function(Pointer<RgbaFrame>), F4>('free_rgba');
_getRgba = dylib.lookupFunction<F5, F5>('get_rgba');
_dir = (await getApplicationDocumentsDirectory()).path;
_homeDir = (await ExternalPath.getExternalStorageDirectories())[0];
String id = 'NA';
String name = 'Flutter';
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
if (Platform.isAndroid) {
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
name = '${androidInfo.brand}-${androidInfo.model}';
id = androidInfo.id.hashCode.toString();
} else {
IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
name = iosInfo.utsname.machine;
id = iosInfo.identifierForVendor.hashCode.toString();
}
print("info1-id:$id,info2-name:$name,dir:$_dir,homeDir:$_homeDir");
setByName('info1', id);
setByName('info2', name);
setByName('home_dir', _homeDir);
setByName('init', _dir);
} catch (e) {
print(e);
}
}
static void startDesktopWebListener(
Function(Map<String, dynamic>) handleMouse) {}
static void stopDesktopWebListener() {}
static void setMethodCallHandler(FMethod callback) {
toAndroidChannel.setMethodCallHandler((call) async {
callback(call.method, call.arguments);
return null;
});
}
static invokeMethod(String method) async {
return await toAndroidChannel.invokeMethod(method);
}
}
final localeName = Platform.localeName;
final toAndroidChannel = MethodChannel("mChannel");

View File

@ -8,7 +8,6 @@ import 'package:tuple/tuple.dart';
import 'package:wakelock/wakelock.dart';
import 'common.dart';
import 'model.dart';
import 'dart:io';
final initText = '\1' * 1024;
@ -24,7 +23,7 @@ class RemotePage extends StatefulWidget {
class _RemotePageState extends State<RemotePage> {
Timer _interval;
Timer _timer;
bool _showBar = true;
bool _showBar = !isDesktop;
double _bottom = 0;
String _value = '';
double _xOffset = 0;
@ -79,7 +78,8 @@ class _RemotePageState extends State<RemotePage> {
return _bottom >= 100;
}
void interval() {
// crash on web before widgit initiated.
void intervalUnsafe() {
var v = MediaQuery.of(context).viewInsets.bottom;
if (v != _bottom) {
resetTool();
@ -93,6 +93,12 @@ class _RemotePageState extends State<RemotePage> {
FFI.ffiModel.update(widget.id, context, handleMsgbox);
}
void interval() {
try {
intervalUnsafe();
} catch (e) {}
}
void handleMsgbox(Map<String, dynamic> evt, String id) {
var type = evt['type'];
var title = evt['title'];
@ -103,6 +109,7 @@ class _RemotePageState extends State<RemotePage> {
enterPasswordDialog(id, context);
} else {
var hasRetry = evt['hasRetry'] == 'true';
print(evt);
showMsgBox(type, title, text, hasRetry);
}
}
@ -124,7 +131,7 @@ class _RemotePageState extends State<RemotePage> {
void handleInput(String newValue) {
var oldValue = _value;
_value = newValue;
if (Platform.isIOS) {
if (isIOS) {
var i = newValue.length - 1;
for (; i >= 0 && newValue[i] != '\1'; --i) {}
var j = oldValue.length - 1;
@ -236,6 +243,7 @@ class _RemotePageState extends State<RemotePage> {
return false;
},
child: Scaffold(
// resizeToAvoidBottomInset: true,
floatingActionButton: !showActionButton
? null
: FloatingActionButton(
@ -252,175 +260,218 @@ class _RemotePageState extends State<RemotePage> {
}
});
}),
bottomNavigationBar: _showBar && pi.displays != null
? BottomAppBar(
elevation: 10,
color: MyTheme.accent,
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Row(children: [
IconButton(
color: Colors.white,
icon: Icon(Icons.clear),
onPressed: () {
close();
},
),
IconButton(
color: Colors.white,
icon: Icon(Icons.keyboard),
onPressed: openKeyboard),
IconButton(
color: Colors.white,
icon: Icon(Icons.tv),
onPressed: () {
setState(() => _showEdit = false);
showOptions(context);
},
),
Container(
color: _mouseTools ? Colors.blue[500] : null,
child: IconButton(
color: Colors.white,
icon: Icon(Icons.mouse),
onPressed: () {
setState(() {
_mouseTools = !_mouseTools;
resetTool();
if (_mouseTools) _drag = true;
});
},
)),
IconButton(
color: Colors.white,
icon: Icon(Icons.more_vert),
onPressed: () {
setState(() => _showEdit = false);
showActions(context);
},
),
]),
IconButton(
color: Colors.white,
icon: Icon(Icons.expand_more),
onPressed: () {
setState(() => _showBar = !_showBar);
}),
],
),
)
: null,
bottomNavigationBar:
_showBar && pi.displays != null ? getBottomAppBar() : null,
body: FlutterEasyLoading(
child: Container(
color: Colors.black,
child: SafeArea(
child: GestureDetector(
onLongPress: () {
if (_drag || _scroll) return;
// make right click and real left long click both work
// should add "long press = right click" option?
FFI.sendMouse('down', 'left');
FFI.tap(true);
},
onLongPressUp: () {
FFI.sendMouse('up', 'left');
},
onTapUp: (details) {
if (_drag || _scroll) return;
if (_touchMode) {
FFI.cursorModel.touch(details.localPosition.dx,
details.localPosition.dy, _right);
} else {
FFI.tap(_right);
}
},
onScaleStart: (details) {
_scale = 1;
_xOffset = details.focalPoint.dx;
_yOffset = _yOffset0 = details.focalPoint.dy;
if (_drag) {
FFI.sendMouse('down', 'left');
}
},
onScaleUpdate: (details) {
var scale = details.scale;
if (scale == 1) {
if (!_scroll) {
var x = details.focalPoint.dx;
var y = details.focalPoint.dy;
var dx = x - _xOffset;
var dy = y - _yOffset;
FFI.cursorModel
.updatePan(dx, dy, _touchMode, _drag);
_xOffset = x;
_yOffset = y;
} else {
_xOffset = details.focalPoint.dx;
_yOffset = details.focalPoint.dy;
}
} else if (!_drag && !_scroll) {
FFI.canvasModel.updateScale(scale / _scale);
_scale = scale;
}
},
onScaleEnd: (details) {
if (_drag) {
FFI.sendMouse('up', 'left');
setState(resetMouse);
} else if (_scroll) {
var dy = (_yOffset - _yOffset0) / 10;
if (dy.abs() > 0.1) {
if (dy > 0 && dy < 1) dy = 1;
if (dy < 0 && dy > -1) dy = -1;
FFI.scroll(dy);
}
}
},
child: Container(
color: MyTheme.canvasColor,
child: Stack(children: [
ImagePaint(),
CursorPaint(),
getHelpTools(),
SizedBox(
width: 0,
height: 0,
child: !_showEdit
? Container()
: TextFormField(
textInputAction:
TextInputAction.newline,
autocorrect: false,
enableSuggestions: false,
focusNode: _focusNode,
maxLines: null,
initialValue:
_value, // trick way to make backspace work always
keyboardType: TextInputType.multiline,
onChanged: handleInput,
),
),
]))))),
child: isDesktop
? getBodyForDesktopWithListener()
: SafeArea(child: getBodyForMobileWithGuesture())),
)),
);
}
Widget getBottomAppBar() {
return BottomAppBar(
elevation: 10,
color: MyTheme.accent,
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Row(
children: <Widget>[
IconButton(
color: Colors.white,
icon: Icon(Icons.clear),
onPressed: () {
close();
},
)
] +
(isDesktop
? []
: [
IconButton(
color: Colors.white,
icon: Icon(Icons.keyboard),
onPressed: openKeyboard)
]) +
<Widget>[
IconButton(
color: Colors.white,
icon: Icon(Icons.tv),
onPressed: () {
setState(() => _showEdit = false);
showOptions(context);
},
)
] +
(isDesktop
? []
: [
Container(
color: _mouseTools ? Colors.blue[500] : null,
child: IconButton(
color: Colors.white,
icon: Icon(Icons.mouse),
onPressed: () {
setState(() {
_mouseTools = !_mouseTools;
resetTool();
if (_mouseTools) _drag = true;
});
},
))
]) +
<Widget>[
IconButton(
color: Colors.white,
icon: Icon(Icons.more_vert),
onPressed: () {
setState(() => _showEdit = false);
showActions(context);
},
),
]),
IconButton(
color: Colors.white,
icon: Icon(Icons.expand_more),
onPressed: () {
setState(() => _showBar = !_showBar);
}),
],
),
);
}
Widget getBodyForMobileWithGuesture() {
return GestureDetector(
onLongPress: () {
if (_drag || _scroll) return;
// make right click and real left long click both work
// should add "long press = right click" option?
FFI.sendMouse('down', 'left');
FFI.tap(true);
},
onLongPressUp: () {
FFI.sendMouse('up', 'left');
},
onTapUp: (details) {
if (_drag || _scroll) return;
if (_touchMode) {
FFI.cursorModel.touch(
details.localPosition.dx, details.localPosition.dy, _right);
} else {
FFI.tap(_right);
}
},
onScaleStart: (details) {
_scale = 1;
_xOffset = details.focalPoint.dx;
_yOffset = _yOffset0 = details.focalPoint.dy;
if (_drag) {
FFI.sendMouse('down', 'left');
}
},
onScaleUpdate: (details) {
var scale = details.scale;
if (scale == 1) {
if (!_scroll) {
var x = details.focalPoint.dx;
var y = details.focalPoint.dy;
var dx = x - _xOffset;
var dy = y - _yOffset;
FFI.cursorModel.updatePan(dx, dy, _touchMode, _drag);
_xOffset = x;
_yOffset = y;
} else {
_xOffset = details.focalPoint.dx;
_yOffset = details.focalPoint.dy;
}
} else if (!_drag && !_scroll) {
FFI.canvasModel.updateScale(scale / _scale);
_scale = scale;
}
},
onScaleEnd: (details) {
if (_drag) {
FFI.sendMouse('up', 'left');
setState(resetMouse);
} else if (_scroll) {
var dy = (_yOffset - _yOffset0) / 10;
if (dy.abs() > 0.1) {
if (dy > 0 && dy < 1) dy = 1;
if (dy < 0 && dy > -1) dy = -1;
FFI.scroll(dy);
}
}
},
child: getBodyForMobile());
}
Widget getBodyForMobile() {
return Container(
color: MyTheme.canvasColor,
child: Stack(children: [
ImagePaint(),
CursorPaint(),
getHelpTools(),
SizedBox(
width: 0,
height: 0,
child: !_showEdit
? Container()
: TextFormField(
textInputAction: TextInputAction.newline,
autocorrect: false,
enableSuggestions: false,
focusNode: _focusNode,
maxLines: null,
initialValue:
_value, // trick way to make backspace work always
keyboardType: TextInputType.multiline,
onChanged: handleInput,
),
),
]));
}
Widget getBodyForDesktopWithListener() {
final keyboard = FFI.ffiModel.permissions['keyboard'] != false;
var paints = <Widget>[ImagePaint()];
if (keyboard ||
FFI.getByName('toggle-option', 'show-remote-cursor') == 'true') {
paints.add(CursorPaint());
}
return MouseRegion(
cursor: keyboard
? SystemMouseCursors.none
: null, // still laggy, set cursor directly for web is better
onEnter: (event) {
print('enter');
FFI.listenToMouse(true);
},
onExit: (event) {
print('exit');
FFI.listenToMouse(false);
},
child: Container(
color: MyTheme.canvasColor, child: Stack(children: paints)));
}
void showActions(BuildContext context) {
final size = MediaQuery.of(context).size;
final x = 120.0;
final y = size.height;
final more = <PopupMenuItem<String>>[];
if (FFI.ffiModel.pi.version.isNotEmpty) {
final pi = FFI.ffiModel.pi;
final perms = FFI.ffiModel.permissions;
if (pi.version.isNotEmpty) {
more.add(PopupMenuItem<String>(
child: Text(translate('Refresh')), value: 'refresh'));
}
if (FFI.ffiModel.permissions['keyboard'] != false &&
FFI.ffiModel.permissions['clipboard'] != false) {
more.add(PopupMenuItem<String>(
child: Text(translate('Paste')), value: 'paste'));
}
more.add(PopupMenuItem<String>(
child: Row(
children: ([
@ -435,38 +486,57 @@ class _RemotePageState extends State<RemotePage> {
)
])),
value: 'enter_os_password'));
more.add(PopupMenuItem<String>(
child: Row(
children: ([
Container(width: 100.0, child: Text(translate('Touch mode'))),
Padding(padding: EdgeInsets.symmetric(horizontal: 16.0)),
Icon(
_touchMode
? Icons.check_box_outlined
: Icons.check_box_outline_blank,
color: MyTheme.accent)
])),
value: 'touch_mode'));
more.add(PopupMenuItem<String>(
child: Text(translate('Reset canvas')), value: 'reset_canvas'));
if (!isDesktop) {
if (perms['keyboard'] != false && perms['clipboard'] != false) {
more.add(PopupMenuItem<String>(
child: Text(translate('Paste')), value: 'paste'));
}
more.add(PopupMenuItem<String>(
child: Row(
children: ([
Container(width: 100.0, child: Text(translate('Touch mode'))),
Padding(padding: EdgeInsets.symmetric(horizontal: 16.0)),
Icon(
_touchMode
? Icons.check_box_outlined
: Icons.check_box_outline_blank,
color: MyTheme.accent)
])),
value: 'touch_mode'));
more.add(PopupMenuItem<String>(
child: Text(translate('Reset canvas')), value: 'reset_canvas'));
}
if (perms['keyboard'] != false) {
if (pi.platform == 'Linux' || pi.sasEnabled) {
more.add(PopupMenuItem<String>(
child: Text(translate('Insert') + ' Ctrl + Alt + Del'),
value: 'cad'));
}
more.add(PopupMenuItem<String>(
child: Text(translate('Insert Lock')), value: 'lock'));
if (pi.platform == 'Windows' &&
FFI.getByName('toggle_option', 'privacy-mode') != 'true') {
more.add(PopupMenuItem<String>(
child: Text(translate(
(FFI.ffiModel.inputBlocked ? 'Unb' : 'B') + 'lock user input')),
value: 'block-input'));
}
}
() async {
var value = await showMenu(
context: context,
position: RelativeRect.fromLTRB(x, y, x, y),
items: [
PopupMenuItem<String>(
child: Text(translate('Insert') + ' Ctrl + Alt + Del'),
value: 'cad'),
PopupMenuItem<String>(
child: Text(translate('Insert Lock')), value: 'lock'),
] +
more,
items: more,
elevation: 8,
);
if (value == 'cad') {
FFI.setByName('ctrl_alt_del');
} else if (value == 'lock') {
FFI.setByName('lock_screen');
} else if (value == 'block-input') {
FFI.setByName('toggle_option',
(FFI.ffiModel.inputBlocked ? 'un' : '') + 'block-inpu');
FFI.ffiModel.inputBlocked = !FFI.ffiModel.inputBlocked;
} else if (value == 'refresh') {
FFI.setByName('refresh');
} else if (value == 'paste') {
@ -486,7 +556,7 @@ class _RemotePageState extends State<RemotePage> {
} else if (value == 'touch_mode') {
_touchMode = !_touchMode;
final v = _touchMode ? 'Y' : '';
FFI.setByName('peer_option', '{"name": "touch-mode", "value": "${v}"}');
FFI.setByName('peer_option', '{"name": "touch-mode", "value": "$v"}');
} else if (value == 'reset_canvas') {
FFI.cursorModel.reset();
}
@ -790,9 +860,36 @@ void wrongPasswordDialog(String id, BuildContext context) {
]));
}
CheckboxListTile getToggle(
void Function(void Function()) setState, option, name) {
return CheckboxListTile(
value: FFI.getByName('toggle_option', option) == 'true',
onChanged: (v) {
setState(() {
FFI.setByName('toggle_option', option);
});
},
dense: true,
title: Text(translate(name)));
}
RadioListTile<String> getRadio(String name, String toValue, String curValue,
void Function(String) onChange) {
return RadioListTile<String>(
controlAffinity: ListTileControlAffinity.trailing,
title: Text(translate(name)),
value: toValue,
groupValue: curValue,
onChanged: onChange,
dense: true,
);
}
void showOptions(BuildContext context) {
String quality = FFI.getByName('image_quality');
if (quality == '') quality = 'balanced';
String viewStyle = FFI.getByName('peer_option', 'view-style');
if (viewStyle == '') viewStyle = 'original';
var displays = <Widget>[];
final pi = FFI.ffiModel.pi;
final image = FFI.ffiModel.getConnectionImage();
@ -829,82 +926,57 @@ void showOptions(BuildContext context) {
if (displays.isNotEmpty) {
displays.add(Divider(color: MyTheme.border));
}
final perms = FFI.ffiModel.permissions;
showAlertDialog(context, (setState) {
final more = <Widget>[];
if (FFI.ffiModel.permissions['audio'] != false) {
more.add(CheckboxListTile(
value: FFI.getByName('toggle_option', 'disable-audio') == 'true',
onChanged: (v) {
setState(() {
FFI.setByName('toggle_option', 'disable-audio');
});
},
title: Text(translate('Mute'))));
if (perms['audio'] != false) {
more.add(getToggle(setState, 'disable-audio', 'Mute'));
}
if (FFI.ffiModel.permissions['keyboard'] != false) {
more.add(CheckboxListTile(
value: FFI.getByName('toggle_option', 'lock-after-session-end') ==
'true',
onChanged: (v) {
setState(() {
FFI.setByName('toggle_option', 'lock-after-session-end');
});
},
title: Text(translate('Lock after session end'))));
if (perms['keyboard'] != false) {
if (perms['clipboard'] != false)
more.add(getToggle(setState, 'disable-clipboard', 'Disable clipboard'));
more.add(getToggle(
setState, 'lock-after-session-end', 'Lock after session end'));
if (pi.platform == 'Windows') {
more.add(getToggle(setState, 'privacy-mode', 'Privacy mode'));
}
}
var setQuality = (String value) {
setState(() {
quality = value;
FFI.setByName('image_quality', value);
});
};
var setViewStyle = (String value) {
setState(() {
viewStyle = value;
FFI.setByName(
'peer_option', '{"name": "view-style", "value": "$value"}');
FFI.canvasModel.updateViewStyle();
});
};
return Tuple3(
null,
Column(
mainAxisSize: MainAxisSize.min,
children: displays +
(isDesktop
? <Widget>[
getRadio(
'Original', 'original', viewStyle, setViewStyle),
getRadio('Shrink', 'shrink', viewStyle, setViewStyle),
getRadio('Stretch', 'stretch', viewStyle, setViewStyle),
Divider(color: MyTheme.border),
]
: {}) +
<Widget>[
RadioListTile<String>(
controlAffinity: ListTileControlAffinity.trailing,
title: Text(translate('Good image quality')),
value: 'best',
groupValue: quality,
onChanged: (String value) {
setState(() {
quality = value;
FFI.setByName('image_quality', value);
});
},
),
RadioListTile<String>(
controlAffinity: ListTileControlAffinity.trailing,
title: Text(translate('Balanced')),
value: 'balanced',
groupValue: quality,
onChanged: (String value) {
setState(() {
quality = value;
FFI.setByName('image_quality', value);
});
},
),
RadioListTile<String>(
controlAffinity: ListTileControlAffinity.trailing,
title: Text(translate('Optimize reaction time')),
value: 'low',
groupValue: quality,
onChanged: (String value) {
setState(() {
quality = value;
FFI.setByName('image_quality', value);
});
},
),
getRadio('Good image quality', 'best', quality, setQuality),
getRadio('Balanced', 'balanced', quality, setQuality),
getRadio(
'Optimize reaction time', 'low', quality, setQuality),
Divider(color: MyTheme.border),
CheckboxListTile(
value: FFI.getByName(
'toggle_option', 'show-remote-cursor') ==
'true',
onChanged: (v) {
setState(() {
FFI.setByName('toggle_option', 'show-remote-cursor');
});
},
title: Text(translate('Show remote cursor'))),
getToggle(
setState, 'show-remote-cursor', 'Show remote cursor'),
] +
more),
null);
@ -948,7 +1020,7 @@ void showSetOSPassword(BuildContext context, bool login) {
onPressed: () {
var text = controller.text.trim();
FFI.setByName('peer_option',
'{"name": "os-password", "value": "${text}"}');
'{"name": "os-password", "value": "$text"}');
FFI.setByName('peer_option',
'{"name": "auto-login", "value": "${autoLogin ? 'Y' : ''}"}');
if (text != "" && login) {

View File

@ -4,16 +4,14 @@ import 'package:flutter_hbb/model.dart';
import 'package:provider/provider.dart';
import 'common.dart';
import 'main.dart';
import 'model.dart';
class ServerPage extends StatelessWidget {
static final serverModel = ServerModel();
@override
Widget build(BuildContext context) {
checkService();
return ChangeNotifierProvider.value(
value: serverModel,
value: FFI.serverModel,
child: Scaffold(
backgroundColor: MyTheme.grayBg,
appBar: AppBar(
@ -57,8 +55,8 @@ class ServerPage extends StatelessWidget {
void checkService() {
//
toAndroidChannel.invokeMethod("check_service"); // jvm
ServerPage.serverModel.updateClientState();
FFI.invokeMethod("check_service"); // jvm
FFI.serverModel.updateClientState();
}
class ServerInfo extends StatefulWidget {
@ -74,14 +72,13 @@ class _ServerInfoState extends State<ServerInfo> {
var _serverPasswd = TextEditingController(text: "");
static const _emptyIdShow = "正在获取ID...";
@override
void initState() {
super.initState();
var id = FFI.getByName("server_id");
_serverId.text = id==""?_emptyIdShow:id;
_serverId.text = id == "" ? _emptyIdShow : id;
_serverPasswd.text = FFI.getByName("server_password");
if(_serverId.text == _emptyIdShow || _serverPasswd.text == ""){
if (_serverId.text == _emptyIdShow || _serverPasswd.text == "") {
fetchConfigAgain();
}
}
@ -132,19 +129,21 @@ class _ServerInfoState extends State<ServerInfo> {
],
));
}
fetchConfigAgain()async{
fetchConfigAgain() async {
FFI.setByName("start_service");
var count = 0;
const maxCount = 10;
while(count<maxCount){
if(_serverId.text!=_emptyIdShow && _serverPasswd.text!=""){
while (count < maxCount) {
if (_serverId.text != _emptyIdShow && _serverPasswd.text != "") {
break;
}
await Future.delayed(Duration(seconds: 2));
var id = FFI.getByName("server_id");
_serverId.text = id==""?_emptyIdShow:id;
_serverId.text = id == "" ? _emptyIdShow : id;
_serverPasswd.text = FFI.getByName("server_password");
debugPrint("fetch id & passwd again at $count:id:${_serverId.text},passwd:${_serverPasswd.text}");
debugPrint(
"fetch id & passwd again at $count:id:${_serverId.text},passwd:${_serverPasswd.text}");
count++;
}
FFI.setByName("stop_service");
@ -191,7 +190,7 @@ class _PermissionCheckerState extends State<PermissionChecker> {
BuildContext loginReqAlertCtx;
void showLoginReqAlert(BuildContext context, String peerID, String name)async {
void showLoginReqAlert(BuildContext context, String peerID, String name) async {
debugPrint("got try_start_without_auth");
await showDialog(
context: context,
@ -205,10 +204,10 @@ void showLoginReqAlert(BuildContext context, String peerID, String name)async {
child: Text("接受"),
onPressed: () {
FFI.setByName("login_res", "true");
if (!ServerPage.serverModel.isFileTransfer) {
if (!FFI.serverModel.isFileTransfer) {
_toAndroidStartCapture();
}
ServerPage.serverModel.setPeer(true);
FFI.serverModel.setPeer(true);
Navigator.of(alertContext).pop();
}),
TextButton(
@ -224,10 +223,10 @@ void showLoginReqAlert(BuildContext context, String peerID, String name)async {
loginReqAlertCtx = null;
}
clearLoginReqAlert(){
if (loginReqAlertCtx!=null){
clearLoginReqAlert() {
if (loginReqAlertCtx != null) {
Navigator.of(loginReqAlertCtx).pop();
ServerPage.serverModel.updateClientState();
FFI.serverModel.updateClientState();
}
}
@ -321,31 +320,73 @@ Widget myCard(Widget child) {
}
Future<Null> _toAndroidInitService() async {
bool res = await toAndroidChannel.invokeMethod("init_service");
bool res = await FFI.invokeMethod("init_service");
FFI.setByName("start_service");
debugPrint("_toAndroidInitService:$res");
}
Future<Null> _toAndroidStartCapture() async {
bool res = await toAndroidChannel.invokeMethod("start_capture");
bool res = await FFI.invokeMethod("start_capture");
debugPrint("_toAndroidStartCapture:$res");
}
// Future<Null> _toAndroidStopCapture() async {
// bool res = await toAndroidChannel.invokeMethod("stop_capture");
// bool res = await FFI.invokeMethod("stop_capture");
// debugPrint("_toAndroidStopCapture:$res");
// }
Future<Null> _toAndroidStopService() async {
FFI.setByName("close_conn");
ServerPage.serverModel.setPeer(false);
FFI.serverModel.setPeer(false);
bool res = await toAndroidChannel.invokeMethod("stop_service");
bool res = await FFI.invokeMethod("stop_service");
FFI.setByName("stop_service");
debugPrint("_toAndroidStopSer:$res");
}
Future<Null> _toAndroidInitInput() async {
bool res = await toAndroidChannel.invokeMethod("init_input");
bool res = await FFI.invokeMethod("init_input");
debugPrint("_toAndroidInitInput:$res");
}
void toAndroidChannelInit() {
FFI.setMethodCallHandler((method, arguments) {
debugPrint("flutter got android msg");
try {
switch (method) {
case "try_start_without_auth":
{
FFI.serverModel.updateClientState();
debugPrint(
"pre show loginAlert:${FFI.serverModel.isFileTransfer.toString()}");
showLoginReqAlert(
nowCtx, FFI.serverModel.peerID, FFI.serverModel.peerName);
debugPrint("from jvm:try_start_without_auth done");
break;
}
case "start_capture":
{
clearLoginReqAlert();
FFI.serverModel.updateClientState();
break;
}
case "stop_capture":
{
FFI.serverModel.setPeer(false);
break;
}
case "on_permission_changed":
{
var name = arguments["name"] as String;
var value = arguments["value"] as String == "true";
debugPrint("from jvm:on_permission_changed,$name:$value");
FFI.serverModel.changeStatue(name, value);
break;
}
}
} catch (e) {
debugPrint("MethodCallHandler err:$e");
}
return "";
});
}

175
lib/web_model.dart Normal file
View File

@ -0,0 +1,175 @@
import 'dart:typed_data';
import 'dart:js' as js;
import 'package:flutter/cupertino.dart';
import 'dart:convert';
import 'common.dart';
import 'dart:html';
import 'dart:async';
final List<StreamSubscription<MouseEvent>> mouseListeners = [];
final List<StreamSubscription<KeyboardEvent>> keyListeners = [];
int lastMouseDownButtons = 0;
bool mouseIn = false;
class PlatformFFI {
static void clearRgbaFrame() {}
static Uint8List getRgba() {
return js.context.callMethod('getRgba');
}
static Future<String> getVersion() async {
return getByName('version');
}
static String getByName(String name, [String arg = '']) {
return js.context.callMethod('getByName', [name, arg]);
}
static void setByName(String name, [String value = '']) {
js.context.callMethod('setByName', [name, value]);
}
static Future<Null> init() async {
isWeb = true;
isDesktop = !js.context.callMethod('isMobile');
js.context.callMethod('init');
}
// MouseRegion onHover not work for mouse move when right button down
static void startDesktopWebListener(
Function(Map<String, dynamic>) handleMouse) {
mouseIn = true;
lastMouseDownButtons = 0;
// document.body.getElementsByTagName('flt-glass-pane')[0].style.cursor = 'none';
mouseListeners
.add(window.document.onMouseEnter.listen((evt) => mouseIn = true));
mouseListeners
.add(window.document.onMouseLeave.listen((evt) => mouseIn = false));
mouseListeners.add(window.document.onMouseMove
.listen((evt) => handleMouse(getEvent(evt))));
mouseListeners.add(window.document.onMouseDown
.listen((evt) => handleMouse(getEvent(evt))));
mouseListeners.add(
window.document.onMouseUp.listen((evt) => handleMouse(getEvent(evt))));
mouseListeners.add(window.document.onMouseWheel.listen((evt) {
var dx = evt.deltaX;
var dy = evt.deltaY;
if (dx > 0)
dx = -1;
else if (dx < 0) dx = 1;
if (dy > 0)
dy = -1;
else if (dy < 0) dy = 1;
setByName('send_mouse', '{"type": "wheel", "x": "$dx", "y": "$dy"}');
}));
mouseListeners.add(
window.document.onContextMenu.listen((evt) => evt.preventDefault()));
keyListeners
.add(window.document.onKeyDown.listen((evt) => handleKey(evt, true)));
keyListeners
.add(window.document.onKeyUp.listen((evt) => handleKey(evt, false)));
}
static void stopDesktopWebListener() {
mouseIn = true;
mouseListeners.forEach((l) {
l.cancel();
});
mouseListeners.clear();
keyListeners.forEach((l) {
l.cancel();
});
keyListeners.clear();
}
static void setMethodCallHandler(FMethod callback) {}
static Future<bool> invokeMethod(String method) async {
return true;
}
}
Map<String, dynamic> getEvent(MouseEvent evt) {
// https://github.com/novnc/noVNC/blob/679b45fa3b453c7cf32f4b4455f4814818ecf161/core/rfb.js
// https://developer.mozilla.org/zh-CN/docs/Web/API/Element/mousedown_event
final Map<String, dynamic> out = {};
out['type'] = evt.type;
out['x'] = evt.client.x;
out['y'] = evt.client.y;
if (evt.altKey) out['alt'] = 'true';
if (evt.shiftKey) out['shift'] = 'true';
if (evt.ctrlKey) out['ctrl'] = 'true';
if (evt.metaKey) out['command'] = 'true';
out['buttons'] = evt
.buttons; // left button: 1, right button: 2, middle button: 4, 1 | 2 = 3 (left + right)
if (evt.buttons != 0) {
lastMouseDownButtons = evt.buttons;
} else {
out['buttons'] = lastMouseDownButtons;
}
return out;
}
void handleKey(KeyboardEvent evt, bool down) {
if (!mouseIn) return;
evt.stopPropagation();
evt.preventDefault();
evt.stopImmediatePropagation();
print('${evt.code} ${evt.key} ${evt.location}');
final out = {};
var name = ctrlKeyMap[evt.code];
if (name == null) {
if (evt.code == evt.key) {
name = evt.code;
} else {
name = evt.key;
if (name.toLowerCase() != name.toUpperCase() &&
name == name.toUpperCase()) {
if (!evt.shiftKey) out['shift'] = 'true';
}
}
}
out['name'] = name;
if (evt.altKey) out['alt'] = 'true';
if (evt.shiftKey) out['shift'] = 'true';
if (evt.ctrlKey) out['ctrl'] = 'true';
if (evt.metaKey) out['command'] = 'true';
if (down) out['down'] = 'true';
PlatformFFI.setByName('input_key', json.encode(out));
}
final localeName = window.navigator.language;
final ctrlKeyMap = {
'AltLeft': 'Alt',
'AltRight': 'RAlt',
'ShiftLeft': 'Shift',
'ShiftRight': 'RShift',
'ControlLeft': 'Control',
'ControlRight': 'RControl',
'MetaLeft': 'Meta',
'MetaRight': 'RWin',
'ContextMenu': 'Apps',
'ArrowUp': 'UpArrow',
'ArrowDown': 'DownArrow',
'ArrowLeft': 'LeftArrow',
'ArrowRight': 'RightArrow',
'NumpadDecimal': 'Decimal',
'NumpadDivide': 'Divide',
'NumpadMultiply': 'Multiply',
'NumpadSubtract': 'Subtract',
'NumpadAdd': 'Add',
'NumpadEnter': 'NumpadEnter',
'Enter': 'Return',
'Space': 'Space',
'NumpadClear': 'Clear',
'NumpadBackspace': 'Backspace',
'PrintScreen': 'Snapshot',
'HangulMode': 'Hangul',
'HanjaMode': 'Hanja',
'KanaMode': 'Kana',
'JunjaMode': 'Junja',
'KanjiMode': 'Hanja',
};

View File

@ -7,14 +7,14 @@ packages:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.2"
version: "3.1.11"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
version: "2.3.0"
async:
dependency: transitive
description:
@ -70,14 +70,14 @@ packages:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
version: "1.0.4"
device_info:
dependency: "direct main"
description:
name: device_info
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
version: "2.0.3"
device_info_platform_interface:
dependency: transitive
description:
@ -119,14 +119,14 @@ packages:
name: firebase
url: "https://pub.dartlang.org"
source: hosted
version: "9.0.1"
version: "9.0.2"
firebase_analytics:
dependency: "direct main"
description:
name: firebase_analytics
url: "https://pub.dartlang.org"
source: hosted
version: "8.2.0"
version: "8.3.4"
firebase_analytics_platform_interface:
dependency: transitive
description:
@ -147,21 +147,21 @@ packages:
name: firebase_core
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.0"
version: "1.12.0"
firebase_core_platform_interface:
dependency: transitive
description:
name: firebase_core_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.1"
version: "4.2.4"
firebase_core_web:
dependency: transitive
description:
name: firebase_core_web
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.5.4"
flutter:
dependency: "direct main"
description: flutter
@ -182,7 +182,7 @@ packages:
name: flutter_launcher_icons
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.1"
version: "0.9.2"
flutter_spinkit:
dependency: transitive
description:
@ -206,7 +206,7 @@ packages:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.3"
version: "0.13.4"
http_parser:
dependency: transitive
description:
@ -220,7 +220,7 @@ packages:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.2"
version: "3.1.1"
js:
dependency: transitive
description:
@ -235,6 +235,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
meta:
dependency: transitive
description:
@ -269,70 +276,77 @@ packages:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
version: "2.0.8"
path_provider_android:
dependency: transitive
description:
name: path_provider_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.11"
path_provider_ios:
dependency: transitive
description:
name: path_provider_ios
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.7"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
version: "2.1.5"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
version: "2.0.5"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.0.3"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.1"
version: "2.0.5"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.0"
version: "4.4.0"
platform:
dependency: transitive
description:
name: platform
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
version: "3.1.0"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.1.2"
process:
dependency: transitive
description:
name: process
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.3"
version: "4.2.4"
provider:
dependency: "direct main"
description:
@ -346,21 +360,35 @@ packages:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
version: "3.0.1+1"
shared_preferences:
dependency: "direct main"
description:
name: shared_preferences
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.6"
version: "2.0.13"
shared_preferences_android:
dependency: transitive
description:
name: shared_preferences_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.10"
shared_preferences_ios:
dependency: transitive
description:
name: shared_preferences_ios
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.9"
shared_preferences_linux:
dependency: transitive
description:
name: shared_preferences_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
version: "2.0.4"
shared_preferences_macos:
dependency: transitive
description:
@ -381,14 +409,14 @@ packages:
name: shared_preferences_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.0.3"
shared_preferences_windows:
dependency: transitive
description:
name: shared_preferences_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
version: "2.0.4"
sky_engine:
dependency: transitive
description: flutter
@ -435,7 +463,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.3"
version: "0.4.8"
tuple:
dependency: "direct main"
description:
@ -456,42 +484,56 @@ packages:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.9"
version: "6.0.18"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.15"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.15"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.0.3"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.0.3"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
version: "2.0.5"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
version: "2.0.8"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.0.2"
vector_math:
dependency: transitive
description:
@ -505,56 +547,56 @@ packages:
name: wakelock
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.2"
version: "0.5.6"
wakelock_macos:
dependency: transitive
description:
name: wakelock_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0+1"
version: "0.4.0"
wakelock_platform_interface:
dependency: transitive
description:
name: wakelock_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.1+1"
version: "0.3.0"
wakelock_web:
dependency: transitive
description:
name: wakelock_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0+1"
version: "0.4.0"
wakelock_windows:
dependency: transitive
description:
name: wakelock_windows
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0"
version: "0.2.0"
win32:
dependency: transitive
description:
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.5"
version: "2.3.11"
xdg_directories:
dependency: transitive
description:
name: xdg_directories
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
version: "0.2.0+1"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.2"
version: "5.3.1"
yaml:
dependency: transitive
description:
@ -563,5 +605,5 @@ packages:
source: hosted
version: "3.1.0"
sdks:
dart: ">=2.14.0 <3.0.0"
flutter: ">=2.0.0"
dart: ">=2.15.0 <3.0.0"
flutter: ">=2.10.0"

View File

@ -0,0 +1 @@
<svg viewBox="0 0 375 375" style="width:32px;height:32px;margin:0 4px 4px 0" xmlns="http://www.w3.org/2000/svg"><rect transform="matrix(.91553 0 0 .91553 -152.92 116.76)" x="167.03" y="-127.54" width="409.6" height="409.6" rx="64" ry="64" fill="#0071ff"></rect><path d="M150.428 322.264c-29.063-6.202-53.897-22.439-73.115-47.804-19.507-25.746-27.838-55.355-25.723-91.414 6.655-62.013 47.667-106.753 99.687-120.411 4.509-.989 8.353-3.462 12.55-1.322 3.22 1.64 6.028 4.467 7.206 7.251 1.25 2.955 1.877 21.54.99 29.331-1.076 9.46-3.877 12.418-14.566 15.388-29.723 10.195-48.105 34.07-53.697 61.017-4.8 29.668 2.951 59.729 21.528 78.727 8.966 8.993 17.92 14.24 30.869 18.086 8.646 2.57 13.393 5.758 15.036 10.102 1.085 2.867 1.63 22.984.779 28.772-1.33 9.046-1.702 9.796-5.792 11.667-5.029 2.3-7.404 2.392-15.752.61zm50.708.29c-3.092-1.402-5.673-4.83-6.73-8.94-.134-9.408-2.366-25.754 1.02-33.373 1.88-4.128 4.65-5.999 12.433-8.396 21.267-6.551 37.593-19.88 46.806-38.213 11.11-22.108 11.877-55.183 1.808-77.975-9.154-20.723-25.7-35.217-48.555-42.534-8.872-2.84-12.004-5.065-12.968-9.21-1.002-4.31-1.435-19.87-.785-28.218.682-8.766 1.249-9.99 6.162-13.318 3.701-2.505 5.482-2.446 17.223.575 36.718 10.077 65.97 33.597 83.026 66.68 18.495 37.034 19.191 86.11 1.742 122.655-17.233 36.09-50.591 62.511-88.622 70.194-8.172 1.65-9.07 1.656-12.56.073z" fill="#fff"></path></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1 @@
#app{font-family:Avenir,Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-align:center;color:#2c3e50;margin-top:60px}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
web/favicon.svg Normal file
View File

@ -0,0 +1 @@
<svg viewBox="0 0 375 375" style="width:32px;height:32px;margin:0 4px 4px 0" xmlns="http://www.w3.org/2000/svg"><rect transform="matrix(.91553 0 0 .91553 -152.92 116.76)" x="167.03" y="-127.54" width="409.6" height="409.6" rx="64" ry="64" fill="#0071ff"></rect><path d="M150.428 322.264c-29.063-6.202-53.897-22.439-73.115-47.804-19.507-25.746-27.838-55.355-25.723-91.414 6.655-62.013 47.667-106.753 99.687-120.411 4.509-.989 8.353-3.462 12.55-1.322 3.22 1.64 6.028 4.467 7.206 7.251 1.25 2.955 1.877 21.54.99 29.331-1.076 9.46-3.877 12.418-14.566 15.388-29.723 10.195-48.105 34.07-53.697 61.017-4.8 29.668 2.951 59.729 21.528 78.727 8.966 8.993 17.92 14.24 30.869 18.086 8.646 2.57 13.393 5.758 15.036 10.102 1.085 2.867 1.63 22.984.779 28.772-1.33 9.046-1.702 9.796-5.792 11.667-5.029 2.3-7.404 2.392-15.752.61zm50.708.29c-3.092-1.402-5.673-4.83-6.73-8.94-.134-9.408-2.366-25.754 1.02-33.373 1.88-4.128 4.65-5.999 12.433-8.396 21.267-6.551 37.593-19.88 46.806-38.213 11.11-22.108 11.877-55.183 1.808-77.975-9.154-20.723-25.7-35.217-48.555-42.534-8.872-2.84-12.004-5.065-12.968-9.21-1.002-4.31-1.435-19.87-.785-28.218.682-8.766 1.249-9.99 6.162-13.318 3.701-2.505 5.482-2.446 17.223.575 36.718 10.077 65.97 33.597 83.026 66.68 18.495 37.034 19.191 86.11 1.742 122.655-17.233 36.09-50.591 62.511-88.622 70.194-8.172 1.65-9.07 1.656-12.56.073z" fill="#fff"></path></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
web/icons/Icon-192.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
web/icons/Icon-512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

129
web/index.html Normal file
View File

@ -0,0 +1,129 @@
<!DOCTYPE html>
<html>
<head>
<!--
If you are serving your web app in a path other than the root, change the
href value below to reflect the base path you are serving from.
The path provided below has to start and end with a slash "/" in order for
it to work correctly.
For more details:
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
This is a placeholder for base href that will be replaced by the value of
the `--base-href` argument provided to `flutter build`.
-->
<base href="$FLUTTER_BASE_HREF">
<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="description" content="Remote Desktop.">
<!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="RustDesk">
<link rel="apple-touch-icon" href="icons/Icon-192.png">
<!-- Favicon -->
<link rel="icon" type="image/svg+xml" href="favicon.svg" />
<title>RustDesk</title>
<link rel="manifest" href="manifest.json">
<script src="ogvjs-1.8.6/ogv.js"></script>
<script src="yuv.js"></script>
<script type="module" crossorigin src="assets/index.b043e392.js"></script>
<link rel="modulepreload" href="assets/vendor.b7bb6fa2.js">
</head>
<body>
<!-- This script installs service_worker.js to provide PWA functionality to
application. For more information, see:
https://developers.google.com/web/fundamentals/primers/service-workers -->
<script>
var serviceWorkerVersion = null;
var scriptLoaded = false;
function loadMainDartJs() {
if (scriptLoaded) {
return;
}
scriptLoaded = true;
var scriptTag = document.createElement('script');
scriptTag.src = 'main.dart.js';
scriptTag.type = 'application/javascript';
document.body.append(scriptTag);
}
if ('serviceWorker' in navigator) {
// Service workers are supported. Use them.
window.addEventListener('load', function () {
// Wait for registration to finish before dropping the <script> tag.
// Otherwise, the browser will load the script multiple times,
// potentially different versions.
var serviceWorkerUrl = 'flutter_service_worker.js?v=' + serviceWorkerVersion;
navigator.serviceWorker.register(serviceWorkerUrl)
.then((reg) => {
function waitForActivation(serviceWorker) {
serviceWorker.addEventListener('statechange', () => {
if (serviceWorker.state == 'activated') {
console.log('Installed new service worker.');
loadMainDartJs();
}
});
}
if (!reg.active && (reg.installing || reg.waiting)) {
// No active web worker and we have installed or are installing
// one for the first time. Simply wait for it to activate.
waitForActivation(reg.installing || reg.waiting);
} else if (!reg.active.scriptURL.endsWith(serviceWorkerVersion)) {
// When the app updates the serviceWorkerVersion changes, so we
// need to ask the service worker to update.
console.log('New service worker available.');
reg.update();
waitForActivation(reg.installing);
} else {
// Existing service worker is still good.
console.log('Loading app from service worker.');
loadMainDartJs();
}
});
// If service worker doesn't succeed in a reasonable amount of time,
// fallback to plaint <script> tag.
setTimeout(() => {
if (!scriptLoaded) {
console.warn(
'Failed to load app from service worker. Falling back to plain <script> tag.',
);
loadMainDartJs();
}
}, 4000);
});
} else {
// Service workers not supported. Just drop the <script> tag.
loadMainDartJs();
}
</script>
<script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-analytics.js"></script>
<script>
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
apiKey: "AIzaSyCgehIZk1aFP0E7wZtYRRqrfvNiNAF39-A",
authDomain: "rustdesk.firebaseapp.com",
databaseURL: "https://rustdesk.firebaseio.com",
projectId: "rustdesk",
storageBucket: "rustdesk.appspot.com",
messagingSenderId: "768133699366",
appId: "1:768133699366:web:d50faf0792cb208d7993e7",
measurementId: "G-9PEH85N6ZQ"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
firebase.analytics();
</script>
</body>
</html>

5555
web/libopus.js Normal file

File diff suppressed because it is too large Load Diff

BIN
web/libopus.wasm Executable file

Binary file not shown.

35
web/manifest.json Normal file
View File

@ -0,0 +1,35 @@
{
"name": "rustdesk",
"short_name": "rustdesk",
"start_url": ".",
"display": "standalone",
"background_color": "#0175C2",
"theme_color": "#0175C2",
"description": "Remote Desktop.",
"orientation": "portrait-primary",
"prefer_related_applications": false,
"icons": [
{
"src": "icons/Icon-192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "icons/Icon-512.png",
"sizes": "512x512",
"type": "image/png"
},
{
"src": "icons/Icon-maskable-192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable"
},
{
"src": "icons/Icon-maskable-512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
}
]
}

21
web/ogvjs-1.8.6/COPYING Normal file
View File

@ -0,0 +1,21 @@
ogv.js wrapper and player code
Copyright (c) 2013-2019 Brion Vibber and other contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,23 @@
Copyright © 2018-2019, VideoLAN and dav1d authors
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,28 @@
Copyright (c) 2002, Xiph.org Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,44 @@
Copyright 2001-2011 Xiph.Org, Skype Limited, Octasic,
Jean-Marc Valin, Timothy B. Terriberry,
CSIRO, Gregory Maxwell, Mark Borgerding,
Erik de Castro Lopo
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of Internet Society, IETF or IETF Trust, nor the
names of specific contributors, may be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Opus is subject to the royalty-free patent licenses which are
specified at:
Xiph.Org Foundation:
https://datatracker.ietf.org/ipr/1524/
Microsoft Corporation:
https://datatracker.ietf.org/ipr/1914/
Broadcom Corporation:
https://datatracker.ietf.org/ipr/1526/

View File

@ -0,0 +1,28 @@
Copyright (C) 2002-2009 Xiph.org Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,28 @@
Copyright (c) 2002-2018 Xiph.org Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,13 @@
Copyright © 2010 Mozilla Foundation
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@ -0,0 +1,31 @@
Copyright (c) 2010, The WebM Project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of Google, nor the WebM Project, nor the names
of its contributors may be used to endorse or promote products
derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,23 @@
Additional IP Rights Grant (Patents)
------------------------------------
"These implementations" means the copyrightable works that implement the WebM
codecs distributed by Google as part of the WebM Project.
Google hereby grants to you a perpetual, worldwide, non-exclusive, no-charge,
royalty-free, irrevocable (except as stated in this section) patent license to
make, have made, use, offer to sell, sell, import, transfer, and otherwise
run, modify and propagate the contents of these implementations of WebM, where
such license applies only to those patent claims, both currently owned by
Google and acquired in the future, licensable by Google that are necessarily
infringed by these implementations of WebM. This grant does not include claims
that would be infringed only as a consequence of further modification of these
implementations. If you or your agent or exclusive licensee institute or order
or agree to the institution of patent litigation or any other patent
enforcement activity against any entity (including a cross-claim or
counterclaim in a lawsuit) alleging that any of these implementations of WebM
or any code incorporated within any of these implementations of WebM
constitute direct or contributory patent infringement, or inducement of
patent infringement, then any patent rights granted to you under this License
for these implementations of WebM shall terminate as of the date such
litigation is filed.

391
web/ogvjs-1.8.6/README.md Normal file
View File

@ -0,0 +1,391 @@
ogv.js
======
Media decoder and player for Ogg Vorbis/Opus/Theora and WebM VP8/VP9/AV1 video.
Based around libogg, libvorbis, libtheora, libopus, libvpx, libnestegg and dav1d compiled to JavaScript and WebAssembly with Emscripten.
## Updates
1.8.6 - 2022-01-12
* Bump to yuv-canvas
* Fix demo for removal of video-canvas mode
1.8.5 - 2022-01-11
* Remove unnecessary user-agent checks
* Remove flaky, obsolete support for faking CSS `object-fit`
* Remove experimental support for streaming `<canvas>` into `<video>`
1.8.4 - 2021-07-02
* Fix for fix for OGVLoader.base fix
1.8.3 - 2021-07-02
* Fixes for build with emscripten 2.0.25
* Fix for nextTick/setImmediate-style polyfill in front-end
* Provisional fix for OGVLoader.base not working with CDNs
* the fallback code for loading a non-local worker had been broken with WebAssembly for some time, sorry!
1.8.2 - errored out
1.8.1 - 2021-02-18
* Fixed OGVCompat APIs to correctly return false without WebAssembly and Web Audio
1.8.0 - 2021-02-09
* Dropping IE support and Flash audio backend
* Updated to stream-file 0.3.0
* Updated to audio-feeder 0.5.0
* The old IE 10/11 support _no longer works_ due to the Flash plugin being disabled, and so is being removed
* Drop es6-promise shim
* Now requires WebAssembly, which requires native Promise support
* Build & fixes
* Demo fixed (removed test files that are now offline)
* Builds with emscripten 2.0.13
* Requires latest meson from git pending a fix hitting release
1.7.0 - 2020-09-28
* Builds with emscripten's LLVM upstream backend
* Updated to build with emscripten 2.0.4
* Reduced amount of memory used between GC runs by reusing frame buffers
* Removed `memoryLimit` option
* JS, Wasm, and threaded Wasm builds now all use dynamic memory growth
* Updated dav1d
* Updated libvpx to 1.8.1
* Experimental SIMD builds of AV1 decoder optional, with `make SIMD=1`
* These work in Chrome with the "WebAssembly SIMD" flag enabled in chrome://flags/
* Significant speed boost when available.
* Available with and without multithreading.
* Must enable explicitly with `simd: true` in `options`.
* Experimental SIMD work for VP9 as well, incomplete.
1.6.1 - 2019-06-18
* playbackSpeed attribute now supported
* updated audio-feeder to 0.4.21;
* mono audio is now less loud, matching native playback better
* audio resampling now uses linear interpolation for upscaling
* fix for IE in bundling scenarios that use strict mode
* tempo change support thanks to a great patch from velochy!
* updated yuv-canvas to 1.2.6;
* fixes for capturing WebGL canvas as MediaStream
* fixes for seeks on low frame rate video
* updated emscripten toolchain to 1.38.36
* drop OUTLINING_LIMIT from AV1 JS build; doesn't work in newer emscripten and not really needed
1.6.0 - 2019-02-26
* experimental support for AV1 video in WebM
* update buildchain to emscripten 1.38.28
* fix a stray global
* starting to move to ES6 classes and modules
* building with babel for ES5/IE11 compat
* updated eslint
* updated yuv-canvas to 1.2.4; fixes for software GL rendering
* updated audio-feeder to 0.4.15; fixes for resampling and Flash perf
* retooled buffer copies
* sync fix for audio packets with discard padding
* clients can pass a custom `StreamFile` instance as `{stream:foo}` in options. This can be useful for custom streaming until MSE interfaces are ready.
* refactored WebM keyframe detection
* prefill the frame pipeline as well as the audio pipeline before starting audio
* removed BINARYEN_IGNORE_IMPLICIT_TRAPS=1 option which can cause intermittent breakages
* changed download streaming method to avoid data corruption problem on certain files
* fix for seek on very short WebM files
* fix for replay-after-end-of-playback in WebM
See more details and history in [CHANGES.md](https://github.com/brion/ogv.js/blob/master/CHANGES.md)
## Current status
Note that as of 2021 ogv.js works pretty nicely but may still have some packagine oddities with tools like webpack. It should work via CDNs again as of 1.8.2 if you can't or don't want to package locally, but this is not documented well yet. Improved documentation will come with the next major update & code cleanup!
Since August 2015, ogv.js can be seen in action [on Wikipedia and Wikimedia Commons](https://commons.wikimedia.org/wiki/Commons:Video) in Safari and IE/Edge where native Ogg and WebM playback is not available. (See [technical details on MediaWiki integration](https://www.mediawiki.org/wiki/Extension:TimedMediaHandler/ogv.js).)
See also a standalone demo with performance metrics at https://brionv.com/misc/ogv.js/demo/
* streaming: yes (with Range header)
* seeking: yes for Ogg and WebM (with Range header)
* color: yes
* audio: yes, with a/v sync (requires Web Audio or Flash)
* background threading: yes (video, audio decoders in Workers)
* [GPU accelerated drawing: yes (WebGL)](https://github.com/brion/ogv.js/wiki/GPU-acceleration)
* GPU accelerated decoding: no
* SIMD acceleration: no
* Web Assembly: yes (with asm.js fallback)
* multithreaded VP8, VP9, AV1: in development (set `options.threading` to `true`; requires flags to be enabled in Firefox 65 and Chrome 72, no support yet in Safari)
* controls: no (currently provided by demo or other UI harness)
Ogg and WebM files are fairly well supported.
## Goals
Long-form goal is to create a drop-in replacement for the HTML5 video and audio tags which can be used for basic playback of Ogg Theora and Vorbis or WebM media on browsers that don't support Ogg or WebM natively.
The API isn't quite complete, but works pretty well.
## Compatibility
ogv.js requires a fast JS engine with typed arrays, and Web Audio for audio playback.
The primary target browsers are (testing 360p/30fps and up):
* Safari 6.1-12 on Mac OS X 10.7-10.14
* Safari on iOS 10-11 64-bit
Older versions of Safari have flaky JIT compilers. IE 9 and below lack typed arrays, and IE 10/11 no longer support an audio channel since the Flash plugin was sunset.
(Note that Windows and Mac OS X can support Ogg and WebM by installing codecs or alternate browsers with built-in support, but this is not possible on iOS where all browsers are really Safari.)
Testing browsers (these support .ogv and .webm natively):
* Firefox 65
* Chrome 73
## Package installation
Pre-built releases of ogv.js are available as [.zip downloads from the GitHub releases page](https://github.com/brion/ogv.js/releases) and through the npm package manager.
You can load the `ogv.js` main entry point directly in a script tag, or bundle it through whatever build process you like. The other .js files must be made available for runtime loading, together in the same directory.
ogv.js will try to auto-detect the path to its resources based on the script element that loads ogv.js or ogv-support.js. If you load ogv.js through another bundler (such as browserify or MediaWiki's ResourceLoader) you may need to override this manually before instantiating players:
```
// Path to ogv-demuxer-ogg.js, ogv-worker-audio.js, etc
OGVLoader.base = '/path/to/resources';
```
To fetch from npm:
```
npm install ogv
```
The distribution-ready files will appear in 'node_modules/ogv/dist'.
To load the player library into your browserify or webpack project:
```
var ogv = require('ogv');
// Access public classes either as ogv.OGVPlayer or just OGVPlayer.
// Your build/lint tools may be happier with ogv.OGVPlayer!
ogv.OGVLoader.base = '/path/to/resources';
var player = new ogv.OGVPlayer();
```
## Usage
The `OGVPlayer` class implements a player, and supports a subset of the events, properties and methods from [HTMLMediaElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement) and [HTMLVideoElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement).
```
// Create a new player with the constructor
var player = new OGVPlayer();
// Or with options
var player = new OGVPlayer({
debug: true,
debugFilter: /demuxer/
});
// Now treat it just like a video or audio element
containerElement.appendChild(player);
player.src = 'path/to/media.ogv';
player.play();
player.addEventListener('ended', function() {
// ta-da!
});
```
To check for compatibility before creating a player, include `ogv-support.js` and use the `OGVCompat` API:
```
if (OGVCompat.supported('OGVPlayer')) {
// go load the full player from ogv.js and instantiate stuff
}
```
This will check for typed arrays, web audio, blacklisted iOS versions, and super-slow/broken JIT compilers.
If you need a URL versioning/cache-buster parameter for dynamic loading of `ogv.js`, you can use the `OGVVersion` symbol provided by `ogv-support.js` or the even tinier `ogv-version.js`:
```
var script = document.createElement('script');
script.src = 'ogv.js?version=' + encodeURIComponent(OGVVersion);
document.querySelector('head').appendChild(script);
```
## Distribution notes
Entry points:
* `ogv.js` contains the main runtime classes, including OGVPlayer, OGVLoader, and OGVCompat.
* `ogv-support.js` contains the OGVCompat class and OGVVersion symbol, useful for checking for runtime support before loading the main `ogv.js`.
* `ogv-version.js` contains only the OGVVersion symbol.
These entry points may be loaded directly from a script element, or concatenated into a larger project, or otherwise loaded as you like.
Further code modules are loaded at runtime, which must be available with their defined names together in a directory. If the files are not hosted same-origin to the web page that includes them, you will need to set up appropriate CORS headers to allow loading of the worker JS modules.
Dynamically loaded assets:
* `ogv-worker-audio.js`, `ogv-worker-video.js`, and `*.worker.js` are Worker entry points, used to run video and audio decoders in the background.
* `ogv-demuxer-ogg-wasm.js/.wasm` are used in playing .ogg, .oga, and .ogv files.
* `ogv-demuxer-webm-wasm.js/.wasm` are used in playing .webm files.
* `ogv-decoder-audio-vorbis-wasm.js/.wasm` and `ogv-decoder-audio-opus-wasm.js/.wasm` are used in playing both Ogg and WebM files containing audio.
* `ogv-decoder-video-theora-wasm.js/.wasm` are used in playing .ogg and .ogv video files.
* `ogv-decoder-video-vp8-wasm.js/.wasm` and `ogv-decoder-video-vp9-wasm.js/.wasm` are used in playing .webm video files.
* `*-mt.js/.wasm` are the multithreaded versions of some of the above modules. They have additional support files.
If you know you will never use particular formats or codecs you can skip bundling them; for instance if you only need to play Ogg files you don't need `ogv-demuxer-webm-wasm.js` or `ogv-decoder-video-vp8-wasm.js` which are only used for WebM.
## Performance
(This section is somewhat out of date.)
As of 2015, for SD-or-less resolution basic Ogg Theora decoding speed is reliable on desktop and newer high-end mobile devices; current high-end desktops and laptops can even reach HD resolutions. Older and low-end mobile devices may have difficulty on any but audio and the lowest-resolution video files.
WebM VP8/VP9 is slower, but works pretty well at a resolution step below Theora.
AV1 is slower still, and tops out around 360p for single-threaded decoding on a fast desktop or iOS device.
*Low-res targets*
I've gotten acceptable performance for Vorbis audio and 160p/15fps Theora files on 32-bit iOS devices: iPhone 4s, iPod Touch 5th-gen and iPad 3. These have difficulty at 240p and above, and just won't keep up with higher resolutions.
Meanwhile, newer 64-bit iPhones and iPads are comparable to low-end laptops, and videos at 360p and often 480p play acceptably. Since 32-bit and 64-bit iOS devices have the same user-agent, a benchmark must be used to approximately test minimum CPU speed.
(On iOS, Safari performs significantly better than some alternative browsers that are unable to enable the JIT due to use of the old UIWebView API. Chrome 49 and Firefox for iOS are known to work using the newer WKWebView API internally. Again, a benchmark must be used to detect slow performance, as the browser remains otherwise compatible.)
Windows on 32-bit ARM platforms is similar... IE 11 on Windows RT 8.1 on a Surface tablet (NVidia Tegra 3) does not work (crashes IE), while Edge on Windows 10 Mobile works ok at low resolutions, having trouble starting around 240p.
In both cases, a native application looms as a possibly better alternative. See [OGVKit](https://github.com/brion/OGVKit) and [OgvRt](https://github.com/brion/OgvRT) projects for experiments in those directions.
Note that at these lower resolutions, Vorbis audio and Theora video decoding are about equally expensive operations -- dual-core phones and tablets should be able to eke out a little parallelism here thanks to audio and video being in separate Worker threads.
*WebGL drawing acceleration*
Accelerated YCbCr->RGB conversion and drawing is done using WebGL on supporting browsers, or through software CPU conversion if not. This is abstracted in the [yuv-canvas](https://github.com/brion/yuv-canvas) package, now separately installable.
It may be possible to do further acceleration of actual decoding operations using WebGL shaders, but this could be ... tricky. WebGL is also only available on the main thread, and there are no compute shaders yet so would have to use fragment shaders.
## Difficulties
*Threading*
Currently the video and audio codecs run in worker threads by default, while the demuxer and player logic run on the UI thread. This seems to work pretty well.
There is some overhead in extracting data out of each emscripten module's heap and in the thread-to-thread communications, but the parallelism and smoother main thread makes up for it.
*Streaming download*
Streaming buffering is done by chunking the requests at up to a megabyte each, using the HTTP Range header. For cross-site playback, this requires CORS setup to whitelist the Range header! Chunks are downloaded as ArrayBuffers, so a chunk must be loaded in full before demuxing or playback can start.
Old versions of [Safari have a bug with Range headers](https://bugs.webkit.org/show_bug.cgi?id=82672) which is worked around as necessary with a 'cache-busting' URL string parameter.
*Seeking*
Seeking is implemented via the HTTP Range: header.
For Ogg files with keyframe indices in a skeleton index, seeking is very fast. Otherwise, a bisection search is used to locate the target frame or audio position, which is very slow over the internet as it creates a lot of short-lived HTTP requests.
For WebM files with cues, efficient seeking is supported as well as of 1.1.2. WebM files without cues can be seeked in 1.5.5, but inefficiently via linear seek from the beginning. This is fine for small audio-only files, but might be improved for large files with a bisection in future.
As with chunked streaming, cross-site playback requires CORS support for the Range header.
*Audio output*
Audio output is handled through the [AudioFeeder](https://github.com/brion/audio-feeder) library, which encapsulates use of Web Audio API:
Firefox, Safari, Chrome, and Edge support the W3C Web Audio API.
IE is no longer supported; the workaround using Flash no longer works due to sunsetting of the Flash plugin.
A/V synchronization is performed on files with both audio and video, and seems to actually work. Yay!
Note that autoplay with audio doesn't work on iOS Safari due to limitations with starting audio playback from event handlers; if playback is started outside an event handler, the player will hang due to broken audio.
As of 1.1.1, muting before script-triggered playback allows things to work:
```
player = new OGVPlayer();
player.muted = true;
player.src = 'path/to/file-with-audio.ogv';
player.play();
```
You can then unmute the video in response to a touch or click handler. Alternately if audio is not required, do not include an audio track in the file.
*WebM*
WebM support was added in June 2015, with some major issues finally worked out in May 2016. Initial VP9 support was added in February 2017. It's pretty stable in production use at Wikipedia and is enabled by default as of October 2015.
Beware that performance of WebM VP8 is much slower than Ogg Theora, and VP9 is slightly slower still.
For best WebM decode speed, consider encoding VP8 with "profile 1" (simple deblocking filter) which will sacrifice quality modestly, mainly in high-motion scenes. When encoding with ffmpeg, this is the `-profile:v 1` option to the `libvpx` codec.
It is also recommended to use the `-slices` option for VP8, or `-tile-columns` for VP9, to maximize ability to use multithreaded decoding when available in the future.
*AV1*
WebM files containing the AV1 codec are supported as of 1.6.0 (February 2019) using the [dav1d](https://code.videolan.org/videolan/dav1d) decoder.
Currently this is experimental, and does not advertise support via `canPlayType`.
Performance is about 2-3x slower than VP8 or VP9, and may require bumping down a resolution step or two to maintain frame rate. There may be further optimizations that can be done to improve this a bit, but the best improvements will come from future improvements to WebAssembly multithreading and SIMD.
Currently AV1 in MP4 container is not supported.
## Upstream library notes
We've experimented with tremor (libivorbis), an integer-only variant of libvorbis. This actually does *not* decode faster, but does save about 200kb off our generated JavaScript, presumably thanks to not including an encoder in the library. However on slow devices like iPod Touch 5th-generation, it makes a significant negative impact on the decode time so we've gone back to libvorbis.
The Ogg Skeleton library (libskeleton) is a bit ... unfinished and is slightly modified here.
libvpx is slightly modified to work around emscripten threading limitations in the VP8 decoder.
## WebAssembly
WebAssembly (Wasm) builds are used exclusively as of 1.8.0, as Safari's Wasm support is pretty well established now and IE no longer works due to the Flash plugin deprecation.
## Multithreading
Experimental multithreaded VP8, VP9, and AV1 decoding up to 4 cores is in development, requiring emscripten 1.38.27 to build.
Multithreading is used only if `options.threading` is true. This requires browser support for the new `SharedArrayBuffer` and `Atomics` APIs, currently available in Firefox and Chrome with experimental flags enabled.
Threading currently requires WebAssembly; JavaScript builds are possible but perform poorly.
Speedups will only be noticeable when using the "slices" or "token partitions" option for VP8 encoding, or the "tile columns" option for VP9 encoding.
If you are making a slim build and will not use the `threading` option, you can leave out the `*-mt.*` files.
## Building JS components
Building ogv.js is known to work on Mac OS X and Linux (tested Fedora 29 and Ubuntu 18.10 with Meson manually updated).
1. You will need autoconf, automake, libtool, pkg-config, meson, ninja, and node (nodejs). These can be installed through Homebrew on Mac OS X, or through distribution-specific methods on Linux. For meson, you may need a newer version than your distro packages -- install it manually with `pip3` or from source.
2. Install [Emscripten](http://kripken.github.io/emscripten-site/docs/getting_started/Tutorial.html); currently building with 2.0.13.
3. `git submodule update --init`
4. Run `npm install` to install build utilities
5. Run `make js` to configure and build the libraries and the C wrapper
## Building the demo
If you did all the setup above, just run `make demo` or `make`. Look in build/demo/ and enjoy!
## License
libogg, libvorbis, libtheora, libopus, nestegg, libvpx, and dav1d are available under their respective licenses, and the JavaScript and C wrapper code in this repo is licensed under MIT.
Based on build scripts from https://github.com/devongovett/ogg.js
See [AUTHORS.md](https://github.com/brion/ogv.js/blob/master/AUTHORS.md) and/or the git history for a list of contributors.

View File

@ -0,0 +1,39 @@
var OGVDecoderAudioOpusW = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(OGVDecoderAudioOpusW) {
OGVDecoderAudioOpusW = OGVDecoderAudioOpusW || {};
var a;a||(a=typeof OGVDecoderAudioOpusW !== 'undefined' ? OGVDecoderAudioOpusW : {});var g=Object.assign,h,m;a.ready=new Promise(function(b,c){h=b;m=c});var n=a,p=g({},a),q="object"===typeof window,r="function"===typeof importScripts,t="",u,v,w,fs,x,y;
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)t=r?require("path").dirname(t)+"/":__dirname+"/",y=function(){x||(fs=require("fs"),x=require("path"))},u=function(b,c){y();b=x.normalize(b);return fs.readFileSync(b,c?null:"utf8")},w=function(b){b=u(b,!0);b.buffer||(b=new Uint8Array(b));return b},v=function(b,c,e){y();b=x.normalize(b);fs.readFile(b,function(d,f){d?e(d):c(f.buffer)})},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),
process.on("unhandledRejection",function(b){throw b;}),a.inspect=function(){return"[Emscripten Module object]"};else if(q||r)r?t=self.location.href:"undefined"!==typeof document&&document.currentScript&&(t=document.currentScript.src),_scriptDir&&(t=_scriptDir),0!==t.indexOf("blob:")?t=t.substr(0,t.replace(/[?#].*/,"").lastIndexOf("/")+1):t="",u=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},r&&(w=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);
c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),v=function(b,c,e){var d=new XMLHttpRequest;d.open("GET",b,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?c(d.response):e()};d.onerror=e;d.send(null)};a.print||console.log.bind(console);var z=a.printErr||console.warn.bind(console);g(a,p);p=null;var A;a.wasmBinary&&(A=a.wasmBinary);var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&B("no native wasm support detected");
var C,D=!1,E,F;function G(){var b=C.buffer;E=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=new Int32Array(b);a.HEAPU8=F=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var H,I=[],J=[],K=[];function aa(){var b=a.preRun.shift();I.unshift(b)}var L=0,M=null,N=null;a.preloadedImages={};a.preloadedAudios={};
function B(b){if(a.onAbort)a.onAbort(b);b="Aborted("+b+")";z(b);D=!0;b=new WebAssembly.RuntimeError(b+". Build with -s ASSERTIONS=1 for more info.");m(b);throw b;}function O(){return P.startsWith("data:application/octet-stream;base64,")}var P;P="ogv-decoder-audio-opus-wasm.wasm";if(!O()){var Q=P;P=a.locateFile?a.locateFile(Q,t):t+Q}function R(){var b=P;try{if(b==P&&A)return new Uint8Array(A);if(w)return w(b);throw"both async and sync fetching of the wasm failed";}catch(c){B(c)}}
function ba(){if(!A&&(q||r)){if("function"===typeof fetch&&!P.startsWith("file://"))return fetch(P,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+P+"'";return b.arrayBuffer()}).catch(function(){return R()});if(v)return new Promise(function(b,c){v(P,function(e){b(new Uint8Array(e))},c)})}return Promise.resolve().then(function(){return R()})}
function S(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var e=c.s;"number"===typeof e?void 0===c.o?ca(e)():ca(e)(c.o):e(void 0===c.o?null:c.o)}}}var T=[];function ca(b){var c=T[b];c||(b>=T.length&&(T.length=b+1),T[b]=c=H.get(b));return c}
var da={a:function(b,c,e){F.copyWithin(b,c,c+e)},b:function(b){var c=F.length;b>>>=0;if(2147483648<b)return!1;for(var e=1;4>=e;e*=2){var d=c*(1+.2/e);d=Math.min(d,b+100663296);d=Math.max(b,d);0<d%65536&&(d+=65536-d%65536);a:{try{C.grow(Math.min(2147483648,d)-E.byteLength+65535>>>16);G();var f=1;break a}catch(k){}f=void 0}if(f)return!0}return!1},c:function(b,c,e){var d=C.buffer,f=new Uint32Array(d,b,c),k=[];if(0!==b)for(b=0;b<c;b++){var l=f[b];d.slice?(l=d.slice(l,l+4*e),l=new Float32Array(l)):(l=
new Float32Array(d,l,e),l=new Float32Array(l));k.push(l)}a.audioBuffer=k},d:function(b,c){a.audioFormat={channels:b,rate:c};a.loadedMetadata=!0}};
(function(){function b(f){a.asm=f.exports;C=a.asm.e;G();H=a.asm.m;J.unshift(a.asm.f);L--;a.monitorRunDependencies&&a.monitorRunDependencies(L);0==L&&(null!==M&&(clearInterval(M),M=null),N&&(f=N,N=null,f()))}function c(f){b(f.instance)}function e(f){return ba().then(function(k){return WebAssembly.instantiate(k,d)}).then(function(k){return k}).then(f,function(k){z("failed to asynchronously prepare wasm: "+k);B(k)})}var d={a:da};L++;a.monitorRunDependencies&&a.monitorRunDependencies(L);if(a.instantiateWasm)try{return a.instantiateWasm(d,
b)}catch(f){return z("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return A||"function"!==typeof WebAssembly.instantiateStreaming||O()||P.startsWith("file://")||"function"!==typeof fetch?e(c):fetch(P,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(c,function(k){z("wasm streaming compile failed: "+k);z("falling back to ArrayBuffer instantiation");return e(c)})})})().catch(m);return{}})();
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.f).apply(null,arguments)};a._ogv_audio_decoder_init=function(){return(a._ogv_audio_decoder_init=a.asm.g).apply(null,arguments)};a._ogv_audio_decoder_process_header=function(){return(a._ogv_audio_decoder_process_header=a.asm.h).apply(null,arguments)};a._ogv_audio_decoder_process_audio=function(){return(a._ogv_audio_decoder_process_audio=a.asm.i).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.j).apply(null,arguments)};
a._free=function(){return(a._free=a.asm.k).apply(null,arguments)};a._ogv_audio_decoder_destroy=function(){return(a._ogv_audio_decoder_destroy=a.asm.l).apply(null,arguments)};var U;N=function ea(){U||V();U||(N=ea)};
function V(){function b(){if(!U&&(U=!0,a.calledRun=!0,!D)){S(J);h(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();K.unshift(c)}S(K)}}if(!(0<L)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)aa();S(I);0<L||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=V;
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();V();var W,X;function fa(b){if(W&&X>=b)return W;W&&a._free(W);X=b;return W=a._malloc(X)}var Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(b){var c=Y();b=b();a.cpuTime+=Y()-c;return b}a.loadedMetadata=!!n.audioFormat;a.audioFormat=n.audioFormat||null;a.audioBuffer=null;a.cpuTime=0;
Object.defineProperty(a,"processing",{get:function(){return!1}});a.init=function(b){Z(function(){a._ogv_audio_decoder_init()});b()};a.processHeader=function(b,c){var e=Z(function(){var d=b.byteLength,f=fa(d);(new Uint8Array(C.buffer,f,d)).set(new Uint8Array(b));return a._ogv_audio_decoder_process_header(f,d)});c(e)};a.processAudio=function(b,c){var e=Z(function(){var d=b.byteLength,f=fa(d);(new Uint8Array(C.buffer,f,d)).set(new Uint8Array(b));return a._ogv_audio_decoder_process_audio(f,d)});c(e)};
a.close=function(){};
return OGVDecoderAudioOpusW.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = OGVDecoderAudioOpusW;
else if (typeof define === 'function' && define['amd'])
define([], function() { return OGVDecoderAudioOpusW; });
else if (typeof exports === 'object')
exports["OGVDecoderAudioOpusW"] = OGVDecoderAudioOpusW;

Binary file not shown.

View File

@ -0,0 +1,40 @@
var OGVDecoderAudioVorbisW = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(OGVDecoderAudioVorbisW) {
OGVDecoderAudioVorbisW = OGVDecoderAudioVorbisW || {};
var b;b||(b=typeof OGVDecoderAudioVorbisW !== 'undefined' ? OGVDecoderAudioVorbisW : {});var g=Object.assign,h,m;b.ready=new Promise(function(a,c){h=a;m=c});var n=b,p=g({},b),q=(a,c)=>{throw c;},r="object"===typeof window,t="function"===typeof importScripts,u="",v,w,x,fs,y,z;
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)u=t?require("path").dirname(u)+"/":__dirname+"/",z=function(){y||(fs=require("fs"),y=require("path"))},v=function(a,c){z();a=y.normalize(a);return fs.readFileSync(a,c?null:"utf8")},x=function(a){a=v(a,!0);a.buffer||(a=new Uint8Array(a));return a},w=function(a,c,e){z();a=y.normalize(a);fs.readFile(a,function(d,f){d?e(d):c(f.buffer)})},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),
process.on("unhandledRejection",function(a){throw a;}),q=(a,c)=>{if(noExitRuntime||0<A)throw process.exitCode=a,c;c instanceof B||C("exiting due to exception: "+c);process.exit(a)},b.inspect=function(){return"[Emscripten Module object]"};else if(r||t)t?u=self.location.href:"undefined"!==typeof document&&document.currentScript&&(u=document.currentScript.src),_scriptDir&&(u=_scriptDir),0!==u.indexOf("blob:")?u=u.substr(0,u.replace(/[?#].*/,"").lastIndexOf("/")+1):u="",v=function(a){var c=new XMLHttpRequest;
c.open("GET",a,!1);c.send(null);return c.responseText},t&&(x=function(a){var c=new XMLHttpRequest;c.open("GET",a,!1);c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),w=function(a,c,e){var d=new XMLHttpRequest;d.open("GET",a,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?c(d.response):e()};d.onerror=e;d.send(null)};b.print||console.log.bind(console);var C=b.printErr||console.warn.bind(console);g(b,p);p=null;b.quit&&(q=b.quit);
var D;b.wasmBinary&&(D=b.wasmBinary);var noExitRuntime=b.noExitRuntime||!0;"object"!==typeof WebAssembly&&E("no native wasm support detected");var F,G=!1,H,I;function J(){var a=F.buffer;H=a;b.HEAP8=new Int8Array(a);b.HEAP16=new Int16Array(a);b.HEAP32=new Int32Array(a);b.HEAPU8=I=new Uint8Array(a);b.HEAPU16=new Uint16Array(a);b.HEAPU32=new Uint32Array(a);b.HEAPF32=new Float32Array(a);b.HEAPF64=new Float64Array(a)}var K,L=[],M=[],N=[],A=0;function aa(){var a=b.preRun.shift();L.unshift(a)}
var O=0,P=null,Q=null;b.preloadedImages={};b.preloadedAudios={};function E(a){if(b.onAbort)b.onAbort(a);a="Aborted("+a+")";C(a);G=!0;a=new WebAssembly.RuntimeError(a+". Build with -s ASSERTIONS=1 for more info.");m(a);throw a;}function ba(){return R.startsWith("data:application/octet-stream;base64,")}var R;R="ogv-decoder-audio-vorbis-wasm.wasm";if(!ba()){var ca=R;R=b.locateFile?b.locateFile(ca,u):u+ca}
function da(){var a=R;try{if(a==R&&D)return new Uint8Array(D);if(x)return x(a);throw"both async and sync fetching of the wasm failed";}catch(c){E(c)}}
function ea(){if(!D&&(r||t)){if("function"===typeof fetch&&!R.startsWith("file://"))return fetch(R,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+R+"'";return a.arrayBuffer()}).catch(function(){return da()});if(w)return new Promise(function(a,c){w(R,function(e){a(new Uint8Array(e))},c)})}return Promise.resolve().then(function(){return da()})}
function S(a){for(;0<a.length;){var c=a.shift();if("function"==typeof c)c(b);else{var e=c.s;"number"===typeof e?void 0===c.o?fa(e)():fa(e)(c.o):e(void 0===c.o?null:c.o)}}}var T=[];function fa(a){var c=T[a];c||(a>=T.length&&(T.length=a+1),T[a]=c=K.get(a));return c}
var ha={a:function(a,c,e){I.copyWithin(a,c,c+e)},b:function(a){var c=I.length;a>>>=0;if(2147483648<a)return!1;for(var e=1;4>=e;e*=2){var d=c*(1+.2/e);d=Math.min(d,a+100663296);d=Math.max(a,d);0<d%65536&&(d+=65536-d%65536);a:{try{F.grow(Math.min(2147483648,d)-H.byteLength+65535>>>16);J();var f=1;break a}catch(k){}f=void 0}if(f)return!0}return!1},c:function(a){if(!(noExitRuntime||0<A)){if(b.onExit)b.onExit(a);G=!0}q(a,new B(a))},d:function(a,c,e){var d=F.buffer,f=new Uint32Array(d,a,c),k=[];if(0!==
a)for(a=0;a<c;a++){var l=f[a];d.slice?(l=d.slice(l,l+4*e),l=new Float32Array(l)):(l=new Float32Array(d,l,e),l=new Float32Array(l));k.push(l)}b.audioBuffer=k},e:function(a,c){b.audioFormat={channels:a,rate:c};b.loadedMetadata=!0}};
(function(){function a(f){b.asm=f.exports;F=b.asm.f;J();K=b.asm.n;M.unshift(b.asm.g);O--;b.monitorRunDependencies&&b.monitorRunDependencies(O);0==O&&(null!==P&&(clearInterval(P),P=null),Q&&(f=Q,Q=null,f()))}function c(f){a(f.instance)}function e(f){return ea().then(function(k){return WebAssembly.instantiate(k,d)}).then(function(k){return k}).then(f,function(k){C("failed to asynchronously prepare wasm: "+k);E(k)})}var d={a:ha};O++;b.monitorRunDependencies&&b.monitorRunDependencies(O);if(b.instantiateWasm)try{return b.instantiateWasm(d,
a)}catch(f){return C("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return D||"function"!==typeof WebAssembly.instantiateStreaming||ba()||R.startsWith("file://")||"function"!==typeof fetch?e(c):fetch(R,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(c,function(k){C("wasm streaming compile failed: "+k);C("falling back to ArrayBuffer instantiation");return e(c)})})})().catch(m);return{}})();
b.___wasm_call_ctors=function(){return(b.___wasm_call_ctors=b.asm.g).apply(null,arguments)};b._ogv_audio_decoder_init=function(){return(b._ogv_audio_decoder_init=b.asm.h).apply(null,arguments)};b._ogv_audio_decoder_process_header=function(){return(b._ogv_audio_decoder_process_header=b.asm.i).apply(null,arguments)};b._ogv_audio_decoder_process_audio=function(){return(b._ogv_audio_decoder_process_audio=b.asm.j).apply(null,arguments)};
b._ogv_audio_decoder_destroy=function(){return(b._ogv_audio_decoder_destroy=b.asm.k).apply(null,arguments)};b._malloc=function(){return(b._malloc=b.asm.l).apply(null,arguments)};b._free=function(){return(b._free=b.asm.m).apply(null,arguments)};var U;function B(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}Q=function ia(){U||V();U||(Q=ia)};
function V(){function a(){if(!U&&(U=!0,b.calledRun=!0,!G)){S(M);h(b);if(b.onRuntimeInitialized)b.onRuntimeInitialized();if(b.postRun)for("function"==typeof b.postRun&&(b.postRun=[b.postRun]);b.postRun.length;){var c=b.postRun.shift();N.unshift(c)}S(N)}}if(!(0<O)){if(b.preRun)for("function"==typeof b.preRun&&(b.preRun=[b.preRun]);b.preRun.length;)aa();S(L);0<O||(b.setStatus?(b.setStatus("Running..."),setTimeout(function(){setTimeout(function(){b.setStatus("")},1);a()},1)):a())}}b.run=V;
if(b.preInit)for("function"==typeof b.preInit&&(b.preInit=[b.preInit]);0<b.preInit.length;)b.preInit.pop()();V();var W,X;function ja(a){if(W&&X>=a)return W;W&&b._free(W);X=a;return W=b._malloc(X)}var Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(a){var c=Y();a=a();b.cpuTime+=Y()-c;return a}b.loadedMetadata=!!n.audioFormat;b.audioFormat=n.audioFormat||null;b.audioBuffer=null;b.cpuTime=0;
Object.defineProperty(b,"processing",{get:function(){return!1}});b.init=function(a){Z(function(){b._ogv_audio_decoder_init()});a()};b.processHeader=function(a,c){var e=Z(function(){var d=a.byteLength,f=ja(d);(new Uint8Array(F.buffer,f,d)).set(new Uint8Array(a));return b._ogv_audio_decoder_process_header(f,d)});c(e)};b.processAudio=function(a,c){var e=Z(function(){var d=a.byteLength,f=ja(d);(new Uint8Array(F.buffer,f,d)).set(new Uint8Array(a));return b._ogv_audio_decoder_process_audio(f,d)});c(e)};
b.close=function(){};
return OGVDecoderAudioVorbisW.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = OGVDecoderAudioVorbisW;
else if (typeof define === 'function' && define['amd'])
define([], function() { return OGVDecoderAudioVorbisW; });
else if (typeof exports === 'object')
exports["OGVDecoderAudioVorbisW"] = OGVDecoderAudioVorbisW;

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1 @@
"use strict";var Module={};if(typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string"){var nodeWorkerThreads=require("worker_threads");var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",function(data){onmessage({data:data})});var nodeFS=require("fs");Object.assign(global,{self:global,require:require,Module:Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:function(f){(0,eval)(nodeFS.readFileSync(f,"utf8"))},postMessage:function(msg){parentPort.postMessage(msg)},performance:global.performance||{now:function(){return Date.now()}}})}function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};self.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob==="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}OGVDecoderVideoAV1MTW(Module).then(function(instance){Module=instance})}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,0,0,1);Module["establishStackSpace"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInit();try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(Module["keepRuntimeAlive"]()){Module["PThread"].setExitStatus(result)}else{Module["__emscripten_thread_exit"](result)}}catch(ex){if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["__emscripten_thread_exit"](ex.status)}}else{throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["__emscripten_thread_exit"](-1)}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1 @@
"use strict";var Module={};if(typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string"){var nodeWorkerThreads=require("worker_threads");var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",function(data){onmessage({data:data})});var nodeFS=require("fs");Object.assign(global,{self:global,require:require,Module:Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:function(f){(0,eval)(nodeFS.readFileSync(f,"utf8"))},postMessage:function(msg){parentPort.postMessage(msg)},performance:global.performance||{now:function(){return Date.now()}}})}function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};self.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob==="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}OGVDecoderVideoAV1SIMDMTW(Module).then(function(instance){Module=instance})}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,0,0,1);Module["establishStackSpace"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInit();try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(Module["keepRuntimeAlive"]()){Module["PThread"].setExitStatus(result)}else{Module["__emscripten_thread_exit"](result)}}catch(ex){if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["__emscripten_thread_exit"](ex.status)}}else{throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["__emscripten_thread_exit"](-1)}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};

View File

@ -0,0 +1,43 @@
var OGVDecoderVideoAV1SIMDW = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(OGVDecoderVideoAV1SIMDW) {
OGVDecoderVideoAV1SIMDW = OGVDecoderVideoAV1SIMDW || {};
var a;a||(a=typeof OGVDecoderVideoAV1SIMDW !== 'undefined' ? OGVDecoderVideoAV1SIMDW : {});var aa=Object.assign,ba,q;a.ready=new Promise(function(b,c){ba=b;q=c});var ca=a,da=aa({},a),ea="object"===typeof window,r="function"===typeof importScripts,A="",fa,F,G,fs,I,ha;
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)A=r?require("path").dirname(A)+"/":__dirname+"/",ha=function(){I||(fs=require("fs"),I=require("path"))},fa=function(b,c){ha();b=I.normalize(b);return fs.readFileSync(b,c?null:"utf8")},G=function(b){b=fa(b,!0);b.buffer||(b=new Uint8Array(b));return b},F=function(b,c,e){ha();b=I.normalize(b);fs.readFile(b,function(d,f){d?e(d):c(f.buffer)})},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),
process.argv.slice(2),process.on("unhandledRejection",function(b){throw b;}),a.inspect=function(){return"[Emscripten Module object]"};else if(ea||r)r?A=self.location.href:"undefined"!==typeof document&&document.currentScript&&(A=document.currentScript.src),_scriptDir&&(A=_scriptDir),0!==A.indexOf("blob:")?A=A.substr(0,A.replace(/[?#].*/,"").lastIndexOf("/")+1):A="",fa=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},r&&(G=function(b){var c=new XMLHttpRequest;
c.open("GET",b,!1);c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),F=function(b,c,e){var d=new XMLHttpRequest;d.open("GET",b,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?c(d.response):e()};d.onerror=e;d.send(null)};var ia=a.print||console.log.bind(console),J=a.printErr||console.warn.bind(console);aa(a,da);da=null;var K;a.wasmBinary&&(K=a.wasmBinary);var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&M("no native wasm support detected");
var N,ja=!1,ka="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0,la,O,P;function ma(){var b=N.buffer;la=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=P=new Int32Array(b);a.HEAPU8=O=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var na,oa=[],pa=[],qa=[];function ra(){var b=a.preRun.shift();oa.unshift(b)}var Q=0,sa=null,R=null;a.preloadedImages={};a.preloadedAudios={};
function M(b){if(a.onAbort)a.onAbort(b);b="Aborted("+b+")";J(b);ja=!0;b=new WebAssembly.RuntimeError(b+". Build with -s ASSERTIONS=1 for more info.");q(b);throw b;}function ta(){return S.startsWith("data:application/octet-stream;base64,")}var S;S="ogv-decoder-video-av1-simd-wasm.wasm";if(!ta()){var ua=S;S=a.locateFile?a.locateFile(ua,A):A+ua}function va(){var b=S;try{if(b==S&&K)return new Uint8Array(K);if(G)return G(b);throw"both async and sync fetching of the wasm failed";}catch(c){M(c)}}
function wa(){if(!K&&(ea||r)){if("function"===typeof fetch&&!S.startsWith("file://"))return fetch(S,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+S+"'";return b.arrayBuffer()}).catch(function(){return va()});if(F)return new Promise(function(b,c){F(S,function(e){b(new Uint8Array(e))},c)})}return Promise.resolve().then(function(){return va()})}
function xa(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var e=c.B;"number"===typeof e?void 0===c.s?Ja(e)():Ja(e)(c.s):e(void 0===c.s?null:c.s)}}}var T=[];function Ja(b){var c=T[b];c||(b>=T.length&&(T.length=b+1),T[b]=c=na.get(b));return c}
var Ka=[null,[],[]],La={b:function(){M("")},d:function(b,c,e){O.copyWithin(b,c,c+e)},e:function(b){var c=O.length;b>>>=0;if(2147483648<b)return!1;for(var e=1;4>=e;e*=2){var d=c*(1+.2/e);d=Math.min(d,b+100663296);d=Math.max(b,d);0<d%65536&&(d+=65536-d%65536);a:{try{N.grow(Math.min(2147483648,d)-la.byteLength+65535>>>16);ma();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},f:function(){return 0},c:function(){},a:function(b,c,e,d){for(var f=0,g=0;g<e;g++){var x=P[c>>2],u=P[c+4>>2];c+=8;for(var y=
0;y<u;y++){var n=O[x+y],w=Ka[b];if(0===n||10===n){n=1===b?ia:J;var l=w;for(var p=0,t=p+NaN,v=p;l[v]&&!(v>=t);)++v;if(16<v-p&&l.subarray&&ka)l=ka.decode(l.subarray(p,v));else{for(t="";p<v;){var h=l[p++];if(h&128){var B=l[p++]&63;if(192==(h&224))t+=String.fromCharCode((h&31)<<6|B);else{var U=l[p++]&63;h=224==(h&240)?(h&15)<<12|B<<6|U:(h&7)<<18|B<<12|U<<6|l[p++]&63;65536>h?t+=String.fromCharCode(h):(h-=65536,t+=String.fromCharCode(55296|h>>10,56320|h&1023))}}else t+=String.fromCharCode(h)}l=t}n(l);w.length=
0}else w.push(n)}f+=u}P[d>>2]=f;return 0},g:function(b,c,e,d,f,g,x,u,y,n,w,l,p,t,v,h){function B(H,k,C,ya,za,Aa,Na,Oa,V){H.set(new Uint8Array(U,k,C*ya));var D,z;for(D=z=0;D<Aa;D++,z+=C)for(k=0;k<C;k++)H[z+k]=V;for(;D<Aa+Oa;D++,z+=C){for(k=0;k<za;k++)H[z+k]=V;for(k=za+Na;k<C;k++)H[z+k]=V}for(;D<ya;D++,z+=C)for(k=0;k<C;k++)H[z+k]=V;return H}var U=N.buffer,m=a.videoFormat,Ba=(p&-2)*y/x,Ca=(t&-2)*n/u,Da=w*y/x,Ea=l*n/u;w===m.cropWidth&&l===m.cropHeight&&(v=m.displayWidth,h=m.displayHeight);for(var Fa=
a.recycledFrames,E,Ga=u*c,Ha=n*d,Ia=n*g;0<Fa.length;){var L=Fa.shift();m=L.format;if(m.width===x&&m.height===u&&m.chromaWidth===y&&m.chromaHeight===n&&m.cropLeft===p&&m.cropTop===t&&m.cropWidth===w&&m.cropHeight===l&&m.displayWidth===v&&m.displayHeight===h&&L.y.bytes.length===Ga&&L.u.bytes.length===Ha&&L.v.bytes.length===Ia){E=L;break}}E||(E={format:{width:x,height:u,chromaWidth:y,chromaHeight:n,cropLeft:p,cropTop:t,cropWidth:w,cropHeight:l,displayWidth:v,displayHeight:h},y:{bytes:new Uint8Array(Ga),
stride:c},u:{bytes:new Uint8Array(Ha),stride:d},v:{bytes:new Uint8Array(Ia),stride:g}});B(E.y.bytes,b,c,u,p,t,w,l,0);B(E.u.bytes,e,d,n,Ba,Ca,Da,Ea,128);B(E.v.bytes,f,g,n,Ba,Ca,Da,Ea,128);a.frameBuffer=E}};
(function(){function b(f){a.asm=f.exports;N=a.asm.h;ma();na=a.asm.p;pa.unshift(a.asm.i);Q--;a.monitorRunDependencies&&a.monitorRunDependencies(Q);0==Q&&(null!==sa&&(clearInterval(sa),sa=null),R&&(f=R,R=null,f()))}function c(f){b(f.instance)}function e(f){return wa().then(function(g){return WebAssembly.instantiate(g,d)}).then(function(g){return g}).then(f,function(g){J("failed to asynchronously prepare wasm: "+g);M(g)})}var d={a:La};Q++;a.monitorRunDependencies&&a.monitorRunDependencies(Q);if(a.instantiateWasm)try{return a.instantiateWasm(d,
b)}catch(f){return J("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return K||"function"!==typeof WebAssembly.instantiateStreaming||ta()||S.startsWith("file://")||"function"!==typeof fetch?e(c):fetch(S,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(c,function(g){J("wasm streaming compile failed: "+g);J("falling back to ArrayBuffer instantiation");return e(c)})})})().catch(q);return{}})();
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.i).apply(null,arguments)};a._ogv_video_decoder_init=function(){return(a._ogv_video_decoder_init=a.asm.j).apply(null,arguments)};a._ogv_video_decoder_async=function(){return(a._ogv_video_decoder_async=a.asm.k).apply(null,arguments)};a._ogv_video_decoder_destroy=function(){return(a._ogv_video_decoder_destroy=a.asm.l).apply(null,arguments)};
a._ogv_video_decoder_process_header=function(){return(a._ogv_video_decoder_process_header=a.asm.m).apply(null,arguments)};a._ogv_video_decoder_process_frame=function(){return(a._ogv_video_decoder_process_frame=a.asm.n).apply(null,arguments)};a._free=function(){return(a._free=a.asm.o).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.q).apply(null,arguments)};var W;R=function Ma(){W||Pa();W||(R=Ma)};
function Pa(){function b(){if(!W&&(W=!0,a.calledRun=!0,!ja)){xa(pa);ba(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();qa.unshift(c)}xa(qa)}}if(!(0<Q)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)ra();xa(oa);0<Q||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=Pa;
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();Pa();var X,Qa,Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(b){var c=Y();b=b();a.cpuTime+=Y()-c;return b}a.loadedMetadata=!!ca.videoFormat;a.videoFormat=ca.videoFormat||null;a.frameBuffer=null;a.cpuTime=0;Object.defineProperty(a,"processing",{get:function(){return!1}});
a.init=function(b){Z(function(){a._ogv_video_decoder_init()});b()};a.processHeader=function(b,c){var e=Z(function(){var d=b.byteLength;X&&Qa>=d||(X&&a._free(X),Qa=d,X=a._malloc(Qa));var f=X;(new Uint8Array(N.buffer,f,d)).set(new Uint8Array(b));return a._ogv_video_decoder_process_header(f,d)});c(e)};a.A=[];
a.processFrame=function(b,c){function e(u){a._free(g);c(u)}var d=a._ogv_video_decoder_async(),f=b.byteLength,g=a._malloc(f);d&&a.A.push(e);var x=Z(function(){(new Uint8Array(N.buffer,g,f)).set(new Uint8Array(b));return a._ogv_video_decoder_process_frame(g,f)});d||e(x)};a.close=function(){};a.sync=function(){a._ogv_video_decoder_async()&&(a.A.push(function(){}),Z(function(){a._ogv_video_decoder_process_frame(0,0)}))};a.recycledFrames=[];
a.recycleFrame=function(b){var c=a.recycledFrames;c.push(b);16<c.length&&c.shift()};
return OGVDecoderVideoAV1SIMDW.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = OGVDecoderVideoAV1SIMDW;
else if (typeof define === 'function' && define['amd'])
define([], function() { return OGVDecoderVideoAV1SIMDW; });
else if (typeof exports === 'object')
exports["OGVDecoderVideoAV1SIMDW"] = OGVDecoderVideoAV1SIMDW;

Binary file not shown.

View File

@ -0,0 +1,43 @@
var OGVDecoderVideoAV1W = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(OGVDecoderVideoAV1W) {
OGVDecoderVideoAV1W = OGVDecoderVideoAV1W || {};
var a;a||(a=typeof OGVDecoderVideoAV1W !== 'undefined' ? OGVDecoderVideoAV1W : {});var aa=Object.assign,ba,q;a.ready=new Promise(function(b,c){ba=b;q=c});var ca=a,da=aa({},a),ea="object"===typeof window,r="function"===typeof importScripts,A="",fa,F,G,fs,I,ha;
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)A=r?require("path").dirname(A)+"/":__dirname+"/",ha=function(){I||(fs=require("fs"),I=require("path"))},fa=function(b,c){ha();b=I.normalize(b);return fs.readFileSync(b,c?null:"utf8")},G=function(b){b=fa(b,!0);b.buffer||(b=new Uint8Array(b));return b},F=function(b,c,e){ha();b=I.normalize(b);fs.readFile(b,function(d,f){d?e(d):c(f.buffer)})},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),
process.argv.slice(2),process.on("unhandledRejection",function(b){throw b;}),a.inspect=function(){return"[Emscripten Module object]"};else if(ea||r)r?A=self.location.href:"undefined"!==typeof document&&document.currentScript&&(A=document.currentScript.src),_scriptDir&&(A=_scriptDir),0!==A.indexOf("blob:")?A=A.substr(0,A.replace(/[?#].*/,"").lastIndexOf("/")+1):A="",fa=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},r&&(G=function(b){var c=new XMLHttpRequest;
c.open("GET",b,!1);c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),F=function(b,c,e){var d=new XMLHttpRequest;d.open("GET",b,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?c(d.response):e()};d.onerror=e;d.send(null)};var ia=a.print||console.log.bind(console),J=a.printErr||console.warn.bind(console);aa(a,da);da=null;var K;a.wasmBinary&&(K=a.wasmBinary);var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&M("no native wasm support detected");
var N,ja=!1,ka="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0,la,O,P;function ma(){var b=N.buffer;la=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=P=new Int32Array(b);a.HEAPU8=O=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var na,oa=[],pa=[],qa=[];function ra(){var b=a.preRun.shift();oa.unshift(b)}var Q=0,sa=null,R=null;a.preloadedImages={};a.preloadedAudios={};
function M(b){if(a.onAbort)a.onAbort(b);b="Aborted("+b+")";J(b);ja=!0;b=new WebAssembly.RuntimeError(b+". Build with -s ASSERTIONS=1 for more info.");q(b);throw b;}function ta(){return S.startsWith("data:application/octet-stream;base64,")}var S;S="ogv-decoder-video-av1-wasm.wasm";if(!ta()){var ua=S;S=a.locateFile?a.locateFile(ua,A):A+ua}function va(){var b=S;try{if(b==S&&K)return new Uint8Array(K);if(G)return G(b);throw"both async and sync fetching of the wasm failed";}catch(c){M(c)}}
function wa(){if(!K&&(ea||r)){if("function"===typeof fetch&&!S.startsWith("file://"))return fetch(S,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+S+"'";return b.arrayBuffer()}).catch(function(){return va()});if(F)return new Promise(function(b,c){F(S,function(e){b(new Uint8Array(e))},c)})}return Promise.resolve().then(function(){return va()})}
function xa(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var e=c.B;"number"===typeof e?void 0===c.s?Ja(e)():Ja(e)(c.s):e(void 0===c.s?null:c.s)}}}var T=[];function Ja(b){var c=T[b];c||(b>=T.length&&(T.length=b+1),T[b]=c=na.get(b));return c}
var Ka=[null,[],[]],La={f:function(){M("")},c:function(b,c,e){O.copyWithin(b,c,c+e)},d:function(b){var c=O.length;b>>>=0;if(2147483648<b)return!1;for(var e=1;4>=e;e*=2){var d=c*(1+.2/e);d=Math.min(d,b+100663296);d=Math.max(b,d);0<d%65536&&(d+=65536-d%65536);a:{try{N.grow(Math.min(2147483648,d)-la.byteLength+65535>>>16);ma();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},e:function(){return 0},b:function(){},a:function(b,c,e,d){for(var f=0,g=0;g<e;g++){var x=P[c>>2],u=P[c+4>>2];c+=8;for(var y=
0;y<u;y++){var n=O[x+y],w=Ka[b];if(0===n||10===n){n=1===b?ia:J;var l=w;for(var p=0,t=p+NaN,v=p;l[v]&&!(v>=t);)++v;if(16<v-p&&l.subarray&&ka)l=ka.decode(l.subarray(p,v));else{for(t="";p<v;){var h=l[p++];if(h&128){var B=l[p++]&63;if(192==(h&224))t+=String.fromCharCode((h&31)<<6|B);else{var U=l[p++]&63;h=224==(h&240)?(h&15)<<12|B<<6|U:(h&7)<<18|B<<12|U<<6|l[p++]&63;65536>h?t+=String.fromCharCode(h):(h-=65536,t+=String.fromCharCode(55296|h>>10,56320|h&1023))}}else t+=String.fromCharCode(h)}l=t}n(l);w.length=
0}else w.push(n)}f+=u}P[d>>2]=f;return 0},g:function(b,c,e,d,f,g,x,u,y,n,w,l,p,t,v,h){function B(H,k,C,ya,za,Aa,Na,Oa,V){H.set(new Uint8Array(U,k,C*ya));var D,z;for(D=z=0;D<Aa;D++,z+=C)for(k=0;k<C;k++)H[z+k]=V;for(;D<Aa+Oa;D++,z+=C){for(k=0;k<za;k++)H[z+k]=V;for(k=za+Na;k<C;k++)H[z+k]=V}for(;D<ya;D++,z+=C)for(k=0;k<C;k++)H[z+k]=V;return H}var U=N.buffer,m=a.videoFormat,Ba=(p&-2)*y/x,Ca=(t&-2)*n/u,Da=w*y/x,Ea=l*n/u;w===m.cropWidth&&l===m.cropHeight&&(v=m.displayWidth,h=m.displayHeight);for(var Fa=
a.recycledFrames,E,Ga=u*c,Ha=n*d,Ia=n*g;0<Fa.length;){var L=Fa.shift();m=L.format;if(m.width===x&&m.height===u&&m.chromaWidth===y&&m.chromaHeight===n&&m.cropLeft===p&&m.cropTop===t&&m.cropWidth===w&&m.cropHeight===l&&m.displayWidth===v&&m.displayHeight===h&&L.y.bytes.length===Ga&&L.u.bytes.length===Ha&&L.v.bytes.length===Ia){E=L;break}}E||(E={format:{width:x,height:u,chromaWidth:y,chromaHeight:n,cropLeft:p,cropTop:t,cropWidth:w,cropHeight:l,displayWidth:v,displayHeight:h},y:{bytes:new Uint8Array(Ga),
stride:c},u:{bytes:new Uint8Array(Ha),stride:d},v:{bytes:new Uint8Array(Ia),stride:g}});B(E.y.bytes,b,c,u,p,t,w,l,0);B(E.u.bytes,e,d,n,Ba,Ca,Da,Ea,128);B(E.v.bytes,f,g,n,Ba,Ca,Da,Ea,128);a.frameBuffer=E}};
(function(){function b(f){a.asm=f.exports;N=a.asm.h;ma();na=a.asm.p;pa.unshift(a.asm.i);Q--;a.monitorRunDependencies&&a.monitorRunDependencies(Q);0==Q&&(null!==sa&&(clearInterval(sa),sa=null),R&&(f=R,R=null,f()))}function c(f){b(f.instance)}function e(f){return wa().then(function(g){return WebAssembly.instantiate(g,d)}).then(function(g){return g}).then(f,function(g){J("failed to asynchronously prepare wasm: "+g);M(g)})}var d={a:La};Q++;a.monitorRunDependencies&&a.monitorRunDependencies(Q);if(a.instantiateWasm)try{return a.instantiateWasm(d,
b)}catch(f){return J("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return K||"function"!==typeof WebAssembly.instantiateStreaming||ta()||S.startsWith("file://")||"function"!==typeof fetch?e(c):fetch(S,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(c,function(g){J("wasm streaming compile failed: "+g);J("falling back to ArrayBuffer instantiation");return e(c)})})})().catch(q);return{}})();
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.i).apply(null,arguments)};a._ogv_video_decoder_init=function(){return(a._ogv_video_decoder_init=a.asm.j).apply(null,arguments)};a._ogv_video_decoder_async=function(){return(a._ogv_video_decoder_async=a.asm.k).apply(null,arguments)};a._ogv_video_decoder_destroy=function(){return(a._ogv_video_decoder_destroy=a.asm.l).apply(null,arguments)};
a._ogv_video_decoder_process_header=function(){return(a._ogv_video_decoder_process_header=a.asm.m).apply(null,arguments)};a._ogv_video_decoder_process_frame=function(){return(a._ogv_video_decoder_process_frame=a.asm.n).apply(null,arguments)};a._free=function(){return(a._free=a.asm.o).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.q).apply(null,arguments)};var W;R=function Ma(){W||Pa();W||(R=Ma)};
function Pa(){function b(){if(!W&&(W=!0,a.calledRun=!0,!ja)){xa(pa);ba(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();qa.unshift(c)}xa(qa)}}if(!(0<Q)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)ra();xa(oa);0<Q||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=Pa;
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();Pa();var X,Qa,Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(b){var c=Y();b=b();a.cpuTime+=Y()-c;return b}a.loadedMetadata=!!ca.videoFormat;a.videoFormat=ca.videoFormat||null;a.frameBuffer=null;a.cpuTime=0;Object.defineProperty(a,"processing",{get:function(){return!1}});
a.init=function(b){Z(function(){a._ogv_video_decoder_init()});b()};a.processHeader=function(b,c){var e=Z(function(){var d=b.byteLength;X&&Qa>=d||(X&&a._free(X),Qa=d,X=a._malloc(Qa));var f=X;(new Uint8Array(N.buffer,f,d)).set(new Uint8Array(b));return a._ogv_video_decoder_process_header(f,d)});c(e)};a.A=[];
a.processFrame=function(b,c){function e(u){a._free(g);c(u)}var d=a._ogv_video_decoder_async(),f=b.byteLength,g=a._malloc(f);d&&a.A.push(e);var x=Z(function(){(new Uint8Array(N.buffer,g,f)).set(new Uint8Array(b));return a._ogv_video_decoder_process_frame(g,f)});d||e(x)};a.close=function(){};a.sync=function(){a._ogv_video_decoder_async()&&(a.A.push(function(){}),Z(function(){a._ogv_video_decoder_process_frame(0,0)}))};a.recycledFrames=[];
a.recycleFrame=function(b){var c=a.recycledFrames;c.push(b);16<c.length&&c.shift()};
return OGVDecoderVideoAV1W.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = OGVDecoderVideoAV1W;
else if (typeof define === 'function' && define['amd'])
define([], function() { return OGVDecoderVideoAV1W; });
else if (typeof exports === 'object')
exports["OGVDecoderVideoAV1W"] = OGVDecoderVideoAV1W;

Binary file not shown.

View File

@ -0,0 +1,42 @@
var OGVDecoderVideoTheoraW = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(OGVDecoderVideoTheoraW) {
OGVDecoderVideoTheoraW = OGVDecoderVideoTheoraW || {};
var a;a||(a=typeof OGVDecoderVideoTheoraW !== 'undefined' ? OGVDecoderVideoTheoraW : {});var ca=Object.assign,da,l;a.ready=new Promise(function(b,c){da=b;l=c});var ea=a,fa=ca({},a),ha="object"===typeof window,m="function"===typeof importScripts,t="",y,B,C,fs,D,E;
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)t=m?require("path").dirname(t)+"/":__dirname+"/",E=function(){D||(fs=require("fs"),D=require("path"))},y=function(b,c){E();b=D.normalize(b);return fs.readFileSync(b,c?null:"utf8")},C=function(b){b=y(b,!0);b.buffer||(b=new Uint8Array(b));return b},B=function(b,c,e){E();b=D.normalize(b);fs.readFile(b,function(d,f){d?e(d):c(f.buffer)})},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),
process.on("unhandledRejection",function(b){throw b;}),a.inspect=function(){return"[Emscripten Module object]"};else if(ha||m)m?t=self.location.href:"undefined"!==typeof document&&document.currentScript&&(t=document.currentScript.src),_scriptDir&&(t=_scriptDir),0!==t.indexOf("blob:")?t=t.substr(0,t.replace(/[?#].*/,"").lastIndexOf("/")+1):t="",y=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},m&&(C=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);
c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),B=function(b,c,e){var d=new XMLHttpRequest;d.open("GET",b,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?c(d.response):e()};d.onerror=e;d.send(null)};a.print||console.log.bind(console);var H=a.printErr||console.warn.bind(console);ca(a,fa);fa=null;var I;a.wasmBinary&&(I=a.wasmBinary);var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&J("no native wasm support detected");
var K,ia=!1,ja,L;function ka(){var b=K.buffer;ja=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=new Int32Array(b);a.HEAPU8=L=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var la,ma=[],na=[],oa=[];function pa(){var b=a.preRun.shift();ma.unshift(b)}var P=0,Q=null,R=null;a.preloadedImages={};a.preloadedAudios={};
function J(b){if(a.onAbort)a.onAbort(b);b="Aborted("+b+")";H(b);ia=!0;b=new WebAssembly.RuntimeError(b+". Build with -s ASSERTIONS=1 for more info.");l(b);throw b;}function qa(){return S.startsWith("data:application/octet-stream;base64,")}var S;S="ogv-decoder-video-theora-wasm.wasm";if(!qa()){var ra=S;S=a.locateFile?a.locateFile(ra,t):t+ra}function sa(){var b=S;try{if(b==S&&I)return new Uint8Array(I);if(C)return C(b);throw"both async and sync fetching of the wasm failed";}catch(c){J(c)}}
function ta(){if(!I&&(ha||m)){if("function"===typeof fetch&&!S.startsWith("file://"))return fetch(S,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+S+"'";return b.arrayBuffer()}).catch(function(){return sa()});if(B)return new Promise(function(b,c){B(S,function(e){b(new Uint8Array(e))},c)})}return Promise.resolve().then(function(){return sa()})}
function T(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var e=c.A;"number"===typeof e?void 0===c.o?ua(e)():ua(e)(c.o):e(void 0===c.o?null:c.o)}}}var U=[];function ua(b){var c=U[b];c||(b>=U.length&&(U.length=b+1),U[b]=c=la.get(b));return c}
var Ga={a:function(b,c,e){L.copyWithin(b,c,c+e)},b:function(b){var c=L.length;b>>>=0;if(2147483648<b)return!1;for(var e=1;4>=e;e*=2){var d=c*(1+.2/e);d=Math.min(d,b+100663296);d=Math.max(b,d);0<d%65536&&(d+=65536-d%65536);a:{try{K.grow(Math.min(2147483648,d)-ja.byteLength+65535>>>16);ka();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},c:function(b,c,e,d,f,g,q,n,z,p,u,F,M,N,Z,aa){function ba(A,h,v,va,wa,xa,Ia,Ja,O){A.set(new Uint8Array(Ka,h,v*va));var w,r;for(w=r=0;w<xa;w++,r+=v)for(h=
0;h<v;h++)A[r+h]=O;for(;w<xa+Ja;w++,r+=v){for(h=0;h<wa;h++)A[r+h]=O;for(h=wa+Ia;h<v;h++)A[r+h]=O}for(;w<va;w++,r+=v)for(h=0;h<v;h++)A[r+h]=O;return A}var Ka=K.buffer,k=a.videoFormat,ya=(M&-2)*z/q,za=(N&-2)*p/n,Aa=u*z/q,Ba=F*p/n;u===k.cropWidth&&F===k.cropHeight&&(Z=k.displayWidth,aa=k.displayHeight);for(var Ca=a.recycledFrames,x,Da=n*c,Ea=p*d,Fa=p*g;0<Ca.length;){var G=Ca.shift();k=G.format;if(k.width===q&&k.height===n&&k.chromaWidth===z&&k.chromaHeight===p&&k.cropLeft===M&&k.cropTop===N&&k.cropWidth===
u&&k.cropHeight===F&&k.displayWidth===Z&&k.displayHeight===aa&&G.y.bytes.length===Da&&G.u.bytes.length===Ea&&G.v.bytes.length===Fa){x=G;break}}x||(x={format:{width:q,height:n,chromaWidth:z,chromaHeight:p,cropLeft:M,cropTop:N,cropWidth:u,cropHeight:F,displayWidth:Z,displayHeight:aa},y:{bytes:new Uint8Array(Da),stride:c},u:{bytes:new Uint8Array(Ea),stride:d},v:{bytes:new Uint8Array(Fa),stride:g}});ba(x.y.bytes,b,c,n,M,N,u,F,0);ba(x.u.bytes,e,d,p,ya,za,Aa,Ba,128);ba(x.v.bytes,f,g,p,ya,za,Aa,Ba,128);
a.frameBuffer=x},d:function(b,c,e,d,f,g,q,n,z,p,u){a.videoFormat={width:b,height:c,chromaWidth:e,chromaHeight:d,cropLeft:n,cropTop:z,cropWidth:g,cropHeight:q,displayWidth:p,displayHeight:u,fps:f};a.loadedMetadata=!0}};
(function(){function b(f){a.asm=f.exports;K=a.asm.e;ka();la=a.asm.n;na.unshift(a.asm.f);P--;a.monitorRunDependencies&&a.monitorRunDependencies(P);0==P&&(null!==Q&&(clearInterval(Q),Q=null),R&&(f=R,R=null,f()))}function c(f){b(f.instance)}function e(f){return ta().then(function(g){return WebAssembly.instantiate(g,d)}).then(function(g){return g}).then(f,function(g){H("failed to asynchronously prepare wasm: "+g);J(g)})}var d={a:Ga};P++;a.monitorRunDependencies&&a.monitorRunDependencies(P);if(a.instantiateWasm)try{return a.instantiateWasm(d,
b)}catch(f){return H("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return I||"function"!==typeof WebAssembly.instantiateStreaming||qa()||S.startsWith("file://")||"function"!==typeof fetch?e(c):fetch(S,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(c,function(g){H("wasm streaming compile failed: "+g);H("falling back to ArrayBuffer instantiation");return e(c)})})})().catch(l);return{}})();
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.f).apply(null,arguments)};a._ogv_video_decoder_init=function(){return(a._ogv_video_decoder_init=a.asm.g).apply(null,arguments)};a._ogv_video_decoder_async=function(){return(a._ogv_video_decoder_async=a.asm.h).apply(null,arguments)};a._ogv_video_decoder_process_header=function(){return(a._ogv_video_decoder_process_header=a.asm.i).apply(null,arguments)};
a._ogv_video_decoder_process_frame=function(){return(a._ogv_video_decoder_process_frame=a.asm.j).apply(null,arguments)};a._ogv_video_decoder_destroy=function(){return(a._ogv_video_decoder_destroy=a.asm.k).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.l).apply(null,arguments)};a._free=function(){return(a._free=a.asm.m).apply(null,arguments)};var V;R=function Ha(){V||La();V||(R=Ha)};
function La(){function b(){if(!V&&(V=!0,a.calledRun=!0,!ia)){T(na);da(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();oa.unshift(c)}T(oa)}}if(!(0<P)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)pa();T(ma);0<P||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=La;
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();La();var W,Ma,X;"undefined"===typeof performance||"undefined"===typeof performance.now?X=Date.now:X=performance.now.bind(performance);function Y(b){var c=X();b=b();a.cpuTime+=X()-c;return b}a.loadedMetadata=!!ea.videoFormat;a.videoFormat=ea.videoFormat||null;a.frameBuffer=null;a.cpuTime=0;Object.defineProperty(a,"processing",{get:function(){return!1}});
a.init=function(b){Y(function(){a._ogv_video_decoder_init()});b()};a.processHeader=function(b,c){var e=Y(function(){var d=b.byteLength;W&&Ma>=d||(W&&a._free(W),Ma=d,W=a._malloc(Ma));var f=W;(new Uint8Array(K.buffer,f,d)).set(new Uint8Array(b));return a._ogv_video_decoder_process_header(f,d)});c(e)};a.s=[];
a.processFrame=function(b,c){function e(n){a._free(g);c(n)}var d=a._ogv_video_decoder_async(),f=b.byteLength,g=a._malloc(f);d&&a.s.push(e);var q=Y(function(){(new Uint8Array(K.buffer,g,f)).set(new Uint8Array(b));return a._ogv_video_decoder_process_frame(g,f)});d||e(q)};a.close=function(){};a.sync=function(){a._ogv_video_decoder_async()&&(a.s.push(function(){}),Y(function(){a._ogv_video_decoder_process_frame(0,0)}))};a.recycledFrames=[];
a.recycleFrame=function(b){var c=a.recycledFrames;c.push(b);16<c.length&&c.shift()};
return OGVDecoderVideoTheoraW.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = OGVDecoderVideoTheoraW;
else if (typeof define === 'function' && define['amd'])
define([], function() { return OGVDecoderVideoTheoraW; });
else if (typeof exports === 'object')
exports["OGVDecoderVideoTheoraW"] = OGVDecoderVideoTheoraW;

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1 @@
"use strict";var Module={};if(typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string"){var nodeWorkerThreads=require("worker_threads");var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",function(data){onmessage({data:data})});var nodeFS=require("fs");Object.assign(global,{self:global,require:require,Module:Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:function(f){(0,eval)(nodeFS.readFileSync(f,"utf8"))},postMessage:function(msg){parentPort.postMessage(msg)},performance:global.performance||{now:function(){return Date.now()}}})}function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};self.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob==="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}OGVDecoderVideoVP8MTW(Module).then(function(instance){Module=instance})}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,0,0,1);Module["establishStackSpace"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInit();try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(Module["keepRuntimeAlive"]()){Module["PThread"].setExitStatus(result)}else{Module["__emscripten_thread_exit"](result)}}catch(ex){if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["__emscripten_thread_exit"](ex.status)}}else{throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["__emscripten_thread_exit"](-1)}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};

View File

@ -0,0 +1,44 @@
var OGVDecoderVideoVP8W = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(OGVDecoderVideoVP8W) {
OGVDecoderVideoVP8W = OGVDecoderVideoVP8W || {};
var a;a||(a=typeof OGVDecoderVideoVP8W !== 'undefined' ? OGVDecoderVideoVP8W : {});var aa=Object.assign,ba,n;a.ready=new Promise(function(b,c){ba=b;n=c});var ca=a,ha=aa({},a),ia="object"===typeof window,p="function"===typeof importScripts,t="",x,y,A,fs,B,C;
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)t=p?require("path").dirname(t)+"/":__dirname+"/",C=function(){B||(fs=require("fs"),B=require("path"))},x=function(b,c){C();b=B.normalize(b);return fs.readFileSync(b,c?null:"utf8")},A=function(b){b=x(b,!0);b.buffer||(b=new Uint8Array(b));return b},y=function(b,c,e){C();b=B.normalize(b);fs.readFile(b,function(d,f){d?e(d):c(f.buffer)})},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),
process.on("unhandledRejection",function(b){throw b;}),a.inspect=function(){return"[Emscripten Module object]"};else if(ia||p)p?t=self.location.href:"undefined"!==typeof document&&document.currentScript&&(t=document.currentScript.src),_scriptDir&&(t=_scriptDir),0!==t.indexOf("blob:")?t=t.substr(0,t.replace(/[?#].*/,"").lastIndexOf("/")+1):t="",x=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},p&&(A=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);
c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),y=function(b,c,e){var d=new XMLHttpRequest;d.open("GET",b,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?c(d.response):e()};d.onerror=e;d.send(null)};a.print||console.log.bind(console);var D=a.printErr||console.warn.bind(console);aa(a,ha);ha=null;var ja=0,E;a.wasmBinary&&(E=a.wasmBinary);var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&F("no native wasm support detected");
var G,ka=!1,la,ma;function na(){var b=G.buffer;la=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=new Int32Array(b);a.HEAPU8=ma=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var oa,pa=[],qa=[],ra=[];function sa(){var b=a.preRun.shift();pa.unshift(b)}var K=0,ta=null,L=null;a.preloadedImages={};a.preloadedAudios={};
function F(b){if(a.onAbort)a.onAbort(b);b="Aborted("+b+")";D(b);ka=!0;b=new WebAssembly.RuntimeError(b+". Build with -s ASSERTIONS=1 for more info.");n(b);throw b;}function ua(){return M.startsWith("data:application/octet-stream;base64,")}var M;M="ogv-decoder-video-vp8-wasm.wasm";if(!ua()){var va=M;M=a.locateFile?a.locateFile(va,t):t+va}function wa(){var b=M;try{if(b==M&&E)return new Uint8Array(E);if(A)return A(b);throw"both async and sync fetching of the wasm failed";}catch(c){F(c)}}
function xa(){if(!E&&(ia||p)){if("function"===typeof fetch&&!M.startsWith("file://"))return fetch(M,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+M+"'";return b.arrayBuffer()}).catch(function(){return wa()});if(y)return new Promise(function(b,c){y(M,function(e){b(new Uint8Array(e))},c)})}return Promise.resolve().then(function(){return wa()})}
function ya(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var e=c.C;"number"===typeof e?void 0===c.A?N(e)():N(e)(c.A):e(void 0===c.A?null:c.A)}}}var O=[];function N(b){var c=O[b];c||(b>=O.length&&(O.length=b+1),O[b]=c=oa.get(b));return c}
var Pa={g:function(){throw"longjmp";},e:function(b,c,e){ma.copyWithin(b,c,c+e)},f:function(b){var c=ma.length;b>>>=0;if(2147483648<b)return!1;for(var e=1;4>=e;e*=2){var d=c*(1+.2/e);d=Math.min(d,b+100663296);d=Math.max(b,d);0<d%65536&&(d+=65536-d%65536);a:{try{G.grow(Math.min(2147483648,d)-la.byteLength+65535>>>16);na();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},a:function(){return ja},d:Ka,i:La,j:Ma,h:Na,c:Oa,k:function(b,c,e,d,f,g,l,m,P,q,H,I,Q,R,da,ea){function fa(z,h,u,za,Aa,Ba,
Sa,Ta,S){z.set(new Uint8Array(Ua,h,u*za));var v,r;for(v=r=0;v<Ba;v++,r+=u)for(h=0;h<u;h++)z[r+h]=S;for(;v<Ba+Ta;v++,r+=u){for(h=0;h<Aa;h++)z[r+h]=S;for(h=Aa+Sa;h<u;h++)z[r+h]=S}for(;v<za;v++,r+=u)for(h=0;h<u;h++)z[r+h]=S;return z}var Ua=G.buffer,k=a.videoFormat,Ca=(Q&-2)*P/l,Da=(R&-2)*q/m,Ea=H*P/l,Fa=I*q/m;H===k.cropWidth&&I===k.cropHeight&&(da=k.displayWidth,ea=k.displayHeight);for(var Ga=a.recycledFrames,w,Ha=m*c,Ia=q*d,Ja=q*g;0<Ga.length;){var J=Ga.shift();k=J.format;if(k.width===l&&k.height===
m&&k.chromaWidth===P&&k.chromaHeight===q&&k.cropLeft===Q&&k.cropTop===R&&k.cropWidth===H&&k.cropHeight===I&&k.displayWidth===da&&k.displayHeight===ea&&J.y.bytes.length===Ha&&J.u.bytes.length===Ia&&J.v.bytes.length===Ja){w=J;break}}w||(w={format:{width:l,height:m,chromaWidth:P,chromaHeight:q,cropLeft:Q,cropTop:R,cropWidth:H,cropHeight:I,displayWidth:da,displayHeight:ea},y:{bytes:new Uint8Array(Ha),stride:c},u:{bytes:new Uint8Array(Ia),stride:d},v:{bytes:new Uint8Array(Ja),stride:g}});fa(w.y.bytes,
b,c,m,Q,R,H,I,0);fa(w.u.bytes,e,d,q,Ca,Da,Ea,Fa,128);fa(w.v.bytes,f,g,q,Ca,Da,Ea,Fa,128);a.frameBuffer=w},b:function(b){ja=b}};
(function(){function b(f){a.asm=f.exports;G=a.asm.l;na();oa=a.asm.s;qa.unshift(a.asm.m);K--;a.monitorRunDependencies&&a.monitorRunDependencies(K);0==K&&(null!==ta&&(clearInterval(ta),ta=null),L&&(f=L,L=null,f()))}function c(f){b(f.instance)}function e(f){return xa().then(function(g){return WebAssembly.instantiate(g,d)}).then(function(g){return g}).then(f,function(g){D("failed to asynchronously prepare wasm: "+g);F(g)})}var d={a:Pa};K++;a.monitorRunDependencies&&a.monitorRunDependencies(K);if(a.instantiateWasm)try{return a.instantiateWasm(d,
b)}catch(f){return D("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return E||"function"!==typeof WebAssembly.instantiateStreaming||ua()||M.startsWith("file://")||"function"!==typeof fetch?e(c):fetch(M,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(c,function(g){D("wasm streaming compile failed: "+g);D("falling back to ArrayBuffer instantiation");return e(c)})})})().catch(n);return{}})();
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.m).apply(null,arguments)};a._ogv_video_decoder_init=function(){return(a._ogv_video_decoder_init=a.asm.n).apply(null,arguments)};a._ogv_video_decoder_async=function(){return(a._ogv_video_decoder_async=a.asm.o).apply(null,arguments)};a._ogv_video_decoder_destroy=function(){return(a._ogv_video_decoder_destroy=a.asm.p).apply(null,arguments)};
a._ogv_video_decoder_process_header=function(){return(a._ogv_video_decoder_process_header=a.asm.q).apply(null,arguments)};a._ogv_video_decoder_process_frame=function(){return(a._ogv_video_decoder_process_frame=a.asm.r).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.t).apply(null,arguments)};a._free=function(){return(a._free=a.asm.u).apply(null,arguments)};
var T=a._setThrew=function(){return(T=a._setThrew=a.asm.v).apply(null,arguments)},U=a.stackSave=function(){return(U=a.stackSave=a.asm.w).apply(null,arguments)},V=a.stackRestore=function(){return(V=a.stackRestore=a.asm.x).apply(null,arguments)},Qa=a.dynCall_iiiij=function(){return(Qa=a.dynCall_iiiij=a.asm.y).apply(null,arguments)};function Oa(b,c,e,d,f){var g=U();try{N(b)(c,e,d,f)}catch(l){V(g);if(l!==l+0&&"longjmp"!==l)throw l;T(1,0)}}
function Ka(b,c,e){var d=U();try{return N(b)(c,e)}catch(f){V(d);if(f!==f+0&&"longjmp"!==f)throw f;T(1,0)}}function La(b,c,e,d){var f=U();try{return N(b)(c,e,d)}catch(g){V(f);if(g!==g+0&&"longjmp"!==g)throw g;T(1,0)}}function Na(b,c){var e=U();try{N(b)(c)}catch(d){V(e);if(d!==d+0&&"longjmp"!==d)throw d;T(1,0)}}function Ma(b,c,e,d,f,g){var l=U();try{return Qa(b,c,e,d,f,g)}catch(m){V(l);if(m!==m+0&&"longjmp"!==m)throw m;T(1,0)}}var W;L=function Ra(){W||Va();W||(L=Ra)};
function Va(){function b(){if(!W&&(W=!0,a.calledRun=!0,!ka)){ya(qa);ba(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();ra.unshift(c)}ya(ra)}}if(!(0<K)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)sa();ya(pa);0<K||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=Va;
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();Va();var X,Wa,Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(b){var c=Y();b=b();a.cpuTime+=Y()-c;return b}a.loadedMetadata=!!ca.videoFormat;a.videoFormat=ca.videoFormat||null;a.frameBuffer=null;a.cpuTime=0;Object.defineProperty(a,"processing",{get:function(){return!1}});
a.init=function(b){Z(function(){a._ogv_video_decoder_init()});b()};a.processHeader=function(b,c){var e=Z(function(){var d=b.byteLength;X&&Wa>=d||(X&&a._free(X),Wa=d,X=a._malloc(Wa));var f=X;(new Uint8Array(G.buffer,f,d)).set(new Uint8Array(b));return a._ogv_video_decoder_process_header(f,d)});c(e)};a.B=[];
a.processFrame=function(b,c){function e(m){a._free(g);c(m)}var d=a._ogv_video_decoder_async(),f=b.byteLength,g=a._malloc(f);d&&a.B.push(e);var l=Z(function(){(new Uint8Array(G.buffer,g,f)).set(new Uint8Array(b));return a._ogv_video_decoder_process_frame(g,f)});d||e(l)};a.close=function(){};a.sync=function(){a._ogv_video_decoder_async()&&(a.B.push(function(){}),Z(function(){a._ogv_video_decoder_process_frame(0,0)}))};a.recycledFrames=[];
a.recycleFrame=function(b){var c=a.recycledFrames;c.push(b);16<c.length&&c.shift()};
return OGVDecoderVideoVP8W.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = OGVDecoderVideoVP8W;
else if (typeof define === 'function' && define['amd'])
define([], function() { return OGVDecoderVideoVP8W; });
else if (typeof exports === 'object')
exports["OGVDecoderVideoVP8W"] = OGVDecoderVideoVP8W;

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1 @@
"use strict";var Module={};if(typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string"){var nodeWorkerThreads=require("worker_threads");var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",function(data){onmessage({data:data})});var nodeFS=require("fs");Object.assign(global,{self:global,require:require,Module:Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:function(f){(0,eval)(nodeFS.readFileSync(f,"utf8"))},postMessage:function(msg){parentPort.postMessage(msg)},performance:global.performance||{now:function(){return Date.now()}}})}function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};self.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob==="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}OGVDecoderVideoVP9MTW(Module).then(function(instance){Module=instance})}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,0,0,1);Module["establishStackSpace"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInit();try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(Module["keepRuntimeAlive"]()){Module["PThread"].setExitStatus(result)}else{Module["__emscripten_thread_exit"](result)}}catch(ex){if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["__emscripten_thread_exit"](ex.status)}}else{throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["__emscripten_thread_exit"](-1)}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1 @@
"use strict";var Module={};if(typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string"){var nodeWorkerThreads=require("worker_threads");var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",function(data){onmessage({data:data})});var nodeFS=require("fs");Object.assign(global,{self:global,require:require,Module:Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:function(f){(0,eval)(nodeFS.readFileSync(f,"utf8"))},postMessage:function(msg){parentPort.postMessage(msg)},performance:global.performance||{now:function(){return Date.now()}}})}function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};self.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob==="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}OGVDecoderVideoVP9SIMDMTW(Module).then(function(instance){Module=instance})}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,0,0,1);Module["establishStackSpace"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInit();try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(Module["keepRuntimeAlive"]()){Module["PThread"].setExitStatus(result)}else{Module["__emscripten_thread_exit"](result)}}catch(ex){if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["__emscripten_thread_exit"](ex.status)}}else{throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["__emscripten_thread_exit"](-1)}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};

View File

@ -0,0 +1,45 @@
var OGVDecoderVideoVP9SIMDW = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(OGVDecoderVideoVP9SIMDW) {
OGVDecoderVideoVP9SIMDW = OGVDecoderVideoVP9SIMDW || {};
var a;a||(a=typeof OGVDecoderVideoVP9SIMDW !== 'undefined' ? OGVDecoderVideoVP9SIMDW : {});var aa=Object.assign,ba,n;a.ready=new Promise(function(b,c){ba=b;n=c});var ca=a,ha=aa({},a),ia="object"===typeof window,p="function"===typeof importScripts,r="",v,w,x,fs,z,D;
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)r=p?require("path").dirname(r)+"/":__dirname+"/",D=function(){z||(fs=require("fs"),z=require("path"))},v=function(b,c){D();b=z.normalize(b);return fs.readFileSync(b,c?null:"utf8")},x=function(b){b=v(b,!0);b.buffer||(b=new Uint8Array(b));return b},w=function(b,c,e){D();b=z.normalize(b);fs.readFile(b,function(d,f){d?e(d):c(f.buffer)})},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),
process.on("unhandledRejection",function(b){throw b;}),a.inspect=function(){return"[Emscripten Module object]"};else if(ia||p)p?r=self.location.href:"undefined"!==typeof document&&document.currentScript&&(r=document.currentScript.src),_scriptDir&&(r=_scriptDir),0!==r.indexOf("blob:")?r=r.substr(0,r.replace(/[?#].*/,"").lastIndexOf("/")+1):r="",v=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},p&&(x=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);
c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),w=function(b,c,e){var d=new XMLHttpRequest;d.open("GET",b,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?c(d.response):e()};d.onerror=e;d.send(null)};a.print||console.log.bind(console);var F=a.printErr||console.warn.bind(console);aa(a,ha);ha=null;var ja=0,G;a.wasmBinary&&(G=a.wasmBinary);var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&H("no native wasm support detected");
var I,ka=!1,la,ma;function na(){var b=I.buffer;la=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=new Int32Array(b);a.HEAPU8=ma=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var oa,pa=[],qa=[],ra=[];function sa(){var b=a.preRun.shift();pa.unshift(b)}var L=0,ta=null,M=null;a.preloadedImages={};a.preloadedAudios={};
function H(b){if(a.onAbort)a.onAbort(b);b="Aborted("+b+")";F(b);ka=!0;b=new WebAssembly.RuntimeError(b+". Build with -s ASSERTIONS=1 for more info.");n(b);throw b;}function ua(){return N.startsWith("data:application/octet-stream;base64,")}var N;N="ogv-decoder-video-vp9-simd-wasm.wasm";if(!ua()){var va=N;N=a.locateFile?a.locateFile(va,r):r+va}function wa(){var b=N;try{if(b==N&&G)return new Uint8Array(G);if(x)return x(b);throw"both async and sync fetching of the wasm failed";}catch(c){H(c)}}
function xa(){if(!G&&(ia||p)){if("function"===typeof fetch&&!N.startsWith("file://"))return fetch(N,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+N+"'";return b.arrayBuffer()}).catch(function(){return wa()});if(w)return new Promise(function(b,c){w(N,function(e){b(new Uint8Array(e))},c)})}return Promise.resolve().then(function(){return wa()})}
function ya(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var e=c.D;"number"===typeof e?void 0===c.B?O(e)():O(e)(c.B):e(void 0===c.B?null:c.B)}}}var P=[];function O(b){var c=P[b];c||(b>=P.length&&(P.length=b+1),P[b]=c=oa.get(b));return c}
var Sa={m:function(){throw"longjmp";},k:function(b,c,e){ma.copyWithin(b,c,c+e)},l:function(b){var c=ma.length;b>>>=0;if(2147483648<b)return!1;for(var e=1;4>=e;e*=2){var d=c*(1+.2/e);d=Math.min(d,b+100663296);d=Math.max(b,d);0<d%65536&&(d+=65536-d%65536);a:{try{I.grow(Math.min(2147483648,d)-la.byteLength+65535>>>16);na();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},a:function(){return ja},d:Ka,f:La,i:Ma,g:Na,e:Oa,c:Pa,j:Qa,h:Ra,n:function(b,c,e,d,f,g,h,k,q,t,u,J,Q,R,da,ea){function fa(E,
l,A,za,Aa,Ba,Ua,Va,S){E.set(new Uint8Array(Wa,l,A*za));var B,y;for(B=y=0;B<Ba;B++,y+=A)for(l=0;l<A;l++)E[y+l]=S;for(;B<Ba+Va;B++,y+=A){for(l=0;l<Aa;l++)E[y+l]=S;for(l=Aa+Ua;l<A;l++)E[y+l]=S}for(;B<za;B++,y+=A)for(l=0;l<A;l++)E[y+l]=S;return E}var Wa=I.buffer,m=a.videoFormat,Ca=(Q&-2)*q/h,Da=(R&-2)*t/k,Ea=u*q/h,Fa=J*t/k;u===m.cropWidth&&J===m.cropHeight&&(da=m.displayWidth,ea=m.displayHeight);for(var Ga=a.recycledFrames,C,Ha=k*c,Ia=t*d,Ja=t*g;0<Ga.length;){var K=Ga.shift();m=K.format;if(m.width===
h&&m.height===k&&m.chromaWidth===q&&m.chromaHeight===t&&m.cropLeft===Q&&m.cropTop===R&&m.cropWidth===u&&m.cropHeight===J&&m.displayWidth===da&&m.displayHeight===ea&&K.y.bytes.length===Ha&&K.u.bytes.length===Ia&&K.v.bytes.length===Ja){C=K;break}}C||(C={format:{width:h,height:k,chromaWidth:q,chromaHeight:t,cropLeft:Q,cropTop:R,cropWidth:u,cropHeight:J,displayWidth:da,displayHeight:ea},y:{bytes:new Uint8Array(Ha),stride:c},u:{bytes:new Uint8Array(Ia),stride:d},v:{bytes:new Uint8Array(Ja),stride:g}});
fa(C.y.bytes,b,c,k,Q,R,u,J,0);fa(C.u.bytes,e,d,t,Ca,Da,Ea,Fa,128);fa(C.v.bytes,f,g,t,Ca,Da,Ea,Fa,128);a.frameBuffer=C},b:function(b){ja=b}};
(function(){function b(f){a.asm=f.exports;I=a.asm.o;na();oa=a.asm.v;qa.unshift(a.asm.p);L--;a.monitorRunDependencies&&a.monitorRunDependencies(L);0==L&&(null!==ta&&(clearInterval(ta),ta=null),M&&(f=M,M=null,f()))}function c(f){b(f.instance)}function e(f){return xa().then(function(g){return WebAssembly.instantiate(g,d)}).then(function(g){return g}).then(f,function(g){F("failed to asynchronously prepare wasm: "+g);H(g)})}var d={a:Sa};L++;a.monitorRunDependencies&&a.monitorRunDependencies(L);if(a.instantiateWasm)try{return a.instantiateWasm(d,
b)}catch(f){return F("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return G||"function"!==typeof WebAssembly.instantiateStreaming||ua()||N.startsWith("file://")||"function"!==typeof fetch?e(c):fetch(N,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(c,function(g){F("wasm streaming compile failed: "+g);F("falling back to ArrayBuffer instantiation");return e(c)})})})().catch(n);return{}})();
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.p).apply(null,arguments)};a._ogv_video_decoder_init=function(){return(a._ogv_video_decoder_init=a.asm.q).apply(null,arguments)};a._ogv_video_decoder_async=function(){return(a._ogv_video_decoder_async=a.asm.r).apply(null,arguments)};a._ogv_video_decoder_destroy=function(){return(a._ogv_video_decoder_destroy=a.asm.s).apply(null,arguments)};
a._ogv_video_decoder_process_header=function(){return(a._ogv_video_decoder_process_header=a.asm.t).apply(null,arguments)};a._ogv_video_decoder_process_frame=function(){return(a._ogv_video_decoder_process_frame=a.asm.u).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.w).apply(null,arguments)};a._free=function(){return(a._free=a.asm.x).apply(null,arguments)};
var T=a._setThrew=function(){return(T=a._setThrew=a.asm.y).apply(null,arguments)},U=a.stackSave=function(){return(U=a.stackSave=a.asm.z).apply(null,arguments)},V=a.stackRestore=function(){return(V=a.stackRestore=a.asm.A).apply(null,arguments)};function Ma(b,c,e,d,f){var g=U();try{return O(b)(c,e,d,f)}catch(h){V(g);if(h!==h+0&&"longjmp"!==h)throw h;T(1,0)}}function Pa(b,c,e,d,f){var g=U();try{O(b)(c,e,d,f)}catch(h){V(g);if(h!==h+0&&"longjmp"!==h)throw h;T(1,0)}}
function Ra(b,c,e,d,f,g,h,k,q){var t=U();try{O(b)(c,e,d,f,g,h,k,q)}catch(u){V(t);if(u!==u+0&&"longjmp"!==u)throw u;T(1,0)}}function Na(b,c,e,d,f,g){var h=U();try{return O(b)(c,e,d,f,g)}catch(k){V(h);if(k!==k+0&&"longjmp"!==k)throw k;T(1,0)}}function La(b,c,e,d){var f=U();try{return O(b)(c,e,d)}catch(g){V(f);if(g!==g+0&&"longjmp"!==g)throw g;T(1,0)}}function Qa(b,c,e,d,f,g,h){var k=U();try{O(b)(c,e,d,f,g,h)}catch(q){V(k);if(q!==q+0&&"longjmp"!==q)throw q;T(1,0)}}
function Ka(b,c,e){var d=U();try{return O(b)(c,e)}catch(f){V(d);if(f!==f+0&&"longjmp"!==f)throw f;T(1,0)}}function Oa(b,c){var e=U();try{O(b)(c)}catch(d){V(e);if(d!==d+0&&"longjmp"!==d)throw d;T(1,0)}}var W;M=function Ta(){W||Xa();W||(M=Ta)};
function Xa(){function b(){if(!W&&(W=!0,a.calledRun=!0,!ka)){ya(qa);ba(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();ra.unshift(c)}ya(ra)}}if(!(0<L)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)sa();ya(pa);0<L||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=Xa;
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();Xa();var X,Ya,Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(b){var c=Y();b=b();a.cpuTime+=Y()-c;return b}a.loadedMetadata=!!ca.videoFormat;a.videoFormat=ca.videoFormat||null;a.frameBuffer=null;a.cpuTime=0;Object.defineProperty(a,"processing",{get:function(){return!1}});
a.init=function(b){Z(function(){a._ogv_video_decoder_init()});b()};a.processHeader=function(b,c){var e=Z(function(){var d=b.byteLength;X&&Ya>=d||(X&&a._free(X),Ya=d,X=a._malloc(Ya));var f=X;(new Uint8Array(I.buffer,f,d)).set(new Uint8Array(b));return a._ogv_video_decoder_process_header(f,d)});c(e)};a.C=[];
a.processFrame=function(b,c){function e(k){a._free(g);c(k)}var d=a._ogv_video_decoder_async(),f=b.byteLength,g=a._malloc(f);d&&a.C.push(e);var h=Z(function(){(new Uint8Array(I.buffer,g,f)).set(new Uint8Array(b));return a._ogv_video_decoder_process_frame(g,f)});d||e(h)};a.close=function(){};a.sync=function(){a._ogv_video_decoder_async()&&(a.C.push(function(){}),Z(function(){a._ogv_video_decoder_process_frame(0,0)}))};a.recycledFrames=[];
a.recycleFrame=function(b){var c=a.recycledFrames;c.push(b);16<c.length&&c.shift()};
return OGVDecoderVideoVP9SIMDW.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = OGVDecoderVideoVP9SIMDW;
else if (typeof define === 'function' && define['amd'])
define([], function() { return OGVDecoderVideoVP9SIMDW; });
else if (typeof exports === 'object')
exports["OGVDecoderVideoVP9SIMDW"] = OGVDecoderVideoVP9SIMDW;

Binary file not shown.

View File

@ -0,0 +1,45 @@
var OGVDecoderVideoVP9W = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(OGVDecoderVideoVP9W) {
OGVDecoderVideoVP9W = OGVDecoderVideoVP9W || {};
var a;a||(a=typeof OGVDecoderVideoVP9W !== 'undefined' ? OGVDecoderVideoVP9W : {});var aa=Object.assign,ba,n;a.ready=new Promise(function(b,c){ba=b;n=c});var ca=a,ha=aa({},a),ia="object"===typeof window,p="function"===typeof importScripts,r="",v,w,x,fs,z,D;
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)r=p?require("path").dirname(r)+"/":__dirname+"/",D=function(){z||(fs=require("fs"),z=require("path"))},v=function(b,c){D();b=z.normalize(b);return fs.readFileSync(b,c?null:"utf8")},x=function(b){b=v(b,!0);b.buffer||(b=new Uint8Array(b));return b},w=function(b,c,e){D();b=z.normalize(b);fs.readFile(b,function(d,f){d?e(d):c(f.buffer)})},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),
process.on("unhandledRejection",function(b){throw b;}),a.inspect=function(){return"[Emscripten Module object]"};else if(ia||p)p?r=self.location.href:"undefined"!==typeof document&&document.currentScript&&(r=document.currentScript.src),_scriptDir&&(r=_scriptDir),0!==r.indexOf("blob:")?r=r.substr(0,r.replace(/[?#].*/,"").lastIndexOf("/")+1):r="",v=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},p&&(x=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);
c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),w=function(b,c,e){var d=new XMLHttpRequest;d.open("GET",b,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?c(d.response):e()};d.onerror=e;d.send(null)};a.print||console.log.bind(console);var F=a.printErr||console.warn.bind(console);aa(a,ha);ha=null;var ja=0,G;a.wasmBinary&&(G=a.wasmBinary);var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&H("no native wasm support detected");
var I,ka=!1,la,ma;function na(){var b=I.buffer;la=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=new Int32Array(b);a.HEAPU8=ma=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var oa,pa=[],qa=[],ra=[];function sa(){var b=a.preRun.shift();pa.unshift(b)}var L=0,ta=null,M=null;a.preloadedImages={};a.preloadedAudios={};
function H(b){if(a.onAbort)a.onAbort(b);b="Aborted("+b+")";F(b);ka=!0;b=new WebAssembly.RuntimeError(b+". Build with -s ASSERTIONS=1 for more info.");n(b);throw b;}function ua(){return N.startsWith("data:application/octet-stream;base64,")}var N;N="ogv-decoder-video-vp9-wasm.wasm";if(!ua()){var va=N;N=a.locateFile?a.locateFile(va,r):r+va}function wa(){var b=N;try{if(b==N&&G)return new Uint8Array(G);if(x)return x(b);throw"both async and sync fetching of the wasm failed";}catch(c){H(c)}}
function xa(){if(!G&&(ia||p)){if("function"===typeof fetch&&!N.startsWith("file://"))return fetch(N,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+N+"'";return b.arrayBuffer()}).catch(function(){return wa()});if(w)return new Promise(function(b,c){w(N,function(e){b(new Uint8Array(e))},c)})}return Promise.resolve().then(function(){return wa()})}
function ya(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var e=c.D;"number"===typeof e?void 0===c.B?O(e)():O(e)(c.B):e(void 0===c.B?null:c.B)}}}var P=[];function O(b){var c=P[b];c||(b>=P.length&&(P.length=b+1),P[b]=c=oa.get(b));return c}
var Sa={m:function(){throw"longjmp";},k:function(b,c,e){ma.copyWithin(b,c,c+e)},l:function(b){var c=ma.length;b>>>=0;if(2147483648<b)return!1;for(var e=1;4>=e;e*=2){var d=c*(1+.2/e);d=Math.min(d,b+100663296);d=Math.max(b,d);0<d%65536&&(d+=65536-d%65536);a:{try{I.grow(Math.min(2147483648,d)-la.byteLength+65535>>>16);na();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},a:function(){return ja},d:Ka,f:La,i:Ma,g:Na,e:Oa,c:Pa,j:Qa,h:Ra,n:function(b,c,e,d,f,g,h,k,q,t,u,J,Q,R,da,ea){function fa(E,
l,A,za,Aa,Ba,Ua,Va,S){E.set(new Uint8Array(Wa,l,A*za));var B,y;for(B=y=0;B<Ba;B++,y+=A)for(l=0;l<A;l++)E[y+l]=S;for(;B<Ba+Va;B++,y+=A){for(l=0;l<Aa;l++)E[y+l]=S;for(l=Aa+Ua;l<A;l++)E[y+l]=S}for(;B<za;B++,y+=A)for(l=0;l<A;l++)E[y+l]=S;return E}var Wa=I.buffer,m=a.videoFormat,Ca=(Q&-2)*q/h,Da=(R&-2)*t/k,Ea=u*q/h,Fa=J*t/k;u===m.cropWidth&&J===m.cropHeight&&(da=m.displayWidth,ea=m.displayHeight);for(var Ga=a.recycledFrames,C,Ha=k*c,Ia=t*d,Ja=t*g;0<Ga.length;){var K=Ga.shift();m=K.format;if(m.width===
h&&m.height===k&&m.chromaWidth===q&&m.chromaHeight===t&&m.cropLeft===Q&&m.cropTop===R&&m.cropWidth===u&&m.cropHeight===J&&m.displayWidth===da&&m.displayHeight===ea&&K.y.bytes.length===Ha&&K.u.bytes.length===Ia&&K.v.bytes.length===Ja){C=K;break}}C||(C={format:{width:h,height:k,chromaWidth:q,chromaHeight:t,cropLeft:Q,cropTop:R,cropWidth:u,cropHeight:J,displayWidth:da,displayHeight:ea},y:{bytes:new Uint8Array(Ha),stride:c},u:{bytes:new Uint8Array(Ia),stride:d},v:{bytes:new Uint8Array(Ja),stride:g}});
fa(C.y.bytes,b,c,k,Q,R,u,J,0);fa(C.u.bytes,e,d,t,Ca,Da,Ea,Fa,128);fa(C.v.bytes,f,g,t,Ca,Da,Ea,Fa,128);a.frameBuffer=C},b:function(b){ja=b}};
(function(){function b(f){a.asm=f.exports;I=a.asm.o;na();oa=a.asm.v;qa.unshift(a.asm.p);L--;a.monitorRunDependencies&&a.monitorRunDependencies(L);0==L&&(null!==ta&&(clearInterval(ta),ta=null),M&&(f=M,M=null,f()))}function c(f){b(f.instance)}function e(f){return xa().then(function(g){return WebAssembly.instantiate(g,d)}).then(function(g){return g}).then(f,function(g){F("failed to asynchronously prepare wasm: "+g);H(g)})}var d={a:Sa};L++;a.monitorRunDependencies&&a.monitorRunDependencies(L);if(a.instantiateWasm)try{return a.instantiateWasm(d,
b)}catch(f){return F("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return G||"function"!==typeof WebAssembly.instantiateStreaming||ua()||N.startsWith("file://")||"function"!==typeof fetch?e(c):fetch(N,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(c,function(g){F("wasm streaming compile failed: "+g);F("falling back to ArrayBuffer instantiation");return e(c)})})})().catch(n);return{}})();
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.p).apply(null,arguments)};a._ogv_video_decoder_init=function(){return(a._ogv_video_decoder_init=a.asm.q).apply(null,arguments)};a._ogv_video_decoder_async=function(){return(a._ogv_video_decoder_async=a.asm.r).apply(null,arguments)};a._ogv_video_decoder_destroy=function(){return(a._ogv_video_decoder_destroy=a.asm.s).apply(null,arguments)};
a._ogv_video_decoder_process_header=function(){return(a._ogv_video_decoder_process_header=a.asm.t).apply(null,arguments)};a._ogv_video_decoder_process_frame=function(){return(a._ogv_video_decoder_process_frame=a.asm.u).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.w).apply(null,arguments)};a._free=function(){return(a._free=a.asm.x).apply(null,arguments)};
var T=a._setThrew=function(){return(T=a._setThrew=a.asm.y).apply(null,arguments)},U=a.stackSave=function(){return(U=a.stackSave=a.asm.z).apply(null,arguments)},V=a.stackRestore=function(){return(V=a.stackRestore=a.asm.A).apply(null,arguments)};function Ma(b,c,e,d,f){var g=U();try{return O(b)(c,e,d,f)}catch(h){V(g);if(h!==h+0&&"longjmp"!==h)throw h;T(1,0)}}function Pa(b,c,e,d,f){var g=U();try{O(b)(c,e,d,f)}catch(h){V(g);if(h!==h+0&&"longjmp"!==h)throw h;T(1,0)}}
function Ra(b,c,e,d,f,g,h,k,q){var t=U();try{O(b)(c,e,d,f,g,h,k,q)}catch(u){V(t);if(u!==u+0&&"longjmp"!==u)throw u;T(1,0)}}function Na(b,c,e,d,f,g){var h=U();try{return O(b)(c,e,d,f,g)}catch(k){V(h);if(k!==k+0&&"longjmp"!==k)throw k;T(1,0)}}function La(b,c,e,d){var f=U();try{return O(b)(c,e,d)}catch(g){V(f);if(g!==g+0&&"longjmp"!==g)throw g;T(1,0)}}function Qa(b,c,e,d,f,g,h){var k=U();try{O(b)(c,e,d,f,g,h)}catch(q){V(k);if(q!==q+0&&"longjmp"!==q)throw q;T(1,0)}}
function Ka(b,c,e){var d=U();try{return O(b)(c,e)}catch(f){V(d);if(f!==f+0&&"longjmp"!==f)throw f;T(1,0)}}function Oa(b,c){var e=U();try{O(b)(c)}catch(d){V(e);if(d!==d+0&&"longjmp"!==d)throw d;T(1,0)}}var W;M=function Ta(){W||Xa();W||(M=Ta)};
function Xa(){function b(){if(!W&&(W=!0,a.calledRun=!0,!ka)){ya(qa);ba(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();ra.unshift(c)}ya(ra)}}if(!(0<L)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)sa();ya(pa);0<L||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=Xa;
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();Xa();var X,Ya,Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(b){var c=Y();b=b();a.cpuTime+=Y()-c;return b}a.loadedMetadata=!!ca.videoFormat;a.videoFormat=ca.videoFormat||null;a.frameBuffer=null;a.cpuTime=0;Object.defineProperty(a,"processing",{get:function(){return!1}});
a.init=function(b){Z(function(){a._ogv_video_decoder_init()});b()};a.processHeader=function(b,c){var e=Z(function(){var d=b.byteLength;X&&Ya>=d||(X&&a._free(X),Ya=d,X=a._malloc(Ya));var f=X;(new Uint8Array(I.buffer,f,d)).set(new Uint8Array(b));return a._ogv_video_decoder_process_header(f,d)});c(e)};a.C=[];
a.processFrame=function(b,c){function e(k){a._free(g);c(k)}var d=a._ogv_video_decoder_async(),f=b.byteLength,g=a._malloc(f);d&&a.C.push(e);var h=Z(function(){(new Uint8Array(I.buffer,g,f)).set(new Uint8Array(b));return a._ogv_video_decoder_process_frame(g,f)});d||e(h)};a.close=function(){};a.sync=function(){a._ogv_video_decoder_async()&&(a.C.push(function(){}),Z(function(){a._ogv_video_decoder_process_frame(0,0)}))};a.recycledFrames=[];
a.recycleFrame=function(b){var c=a.recycledFrames;c.push(b);16<c.length&&c.shift()};
return OGVDecoderVideoVP9W.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = OGVDecoderVideoVP9W;
else if (typeof define === 'function' && define['amd'])
define([], function() { return OGVDecoderVideoVP9W; });
else if (typeof exports === 'object')
exports["OGVDecoderVideoVP9W"] = OGVDecoderVideoVP9W;

Binary file not shown.

View File

@ -0,0 +1,43 @@
var OGVDemuxerOggW = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(OGVDemuxerOggW) {
OGVDemuxerOggW = OGVDemuxerOggW || {};
var a;a||(a=typeof OGVDemuxerOggW !== 'undefined' ? OGVDemuxerOggW : {});var h=Object.assign,k,l;a.ready=new Promise(function(b,c){k=b;l=c});var m=h({},a),n="object"===typeof window,p="function"===typeof importScripts,q="",r,t,u,fs,v,w;
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)q=p?require("path").dirname(q)+"/":__dirname+"/",w=function(){v||(fs=require("fs"),v=require("path"))},r=function(b,c){w();b=v.normalize(b);return fs.readFileSync(b,c?null:"utf8")},u=function(b){b=r(b,!0);b.buffer||(b=new Uint8Array(b));return b},t=function(b,c,d){w();b=v.normalize(b);fs.readFile(b,function(e,f){e?d(e):c(f.buffer)})},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),
process.on("unhandledRejection",function(b){throw b;}),a.inspect=function(){return"[Emscripten Module object]"};else if(n||p)p?q=self.location.href:"undefined"!==typeof document&&document.currentScript&&(q=document.currentScript.src),_scriptDir&&(q=_scriptDir),0!==q.indexOf("blob:")?q=q.substr(0,q.replace(/[?#].*/,"").lastIndexOf("/")+1):q="",r=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},p&&(u=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);
c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),t=function(b,c,d){var e=new XMLHttpRequest;e.open("GET",b,!0);e.responseType="arraybuffer";e.onload=function(){200==e.status||0==e.status&&e.response?c(e.response):d()};e.onerror=d;e.send(null)};a.print||console.log.bind(console);var x=a.printErr||console.warn.bind(console);h(a,m);m=null;var y;a.wasmBinary&&(y=a.wasmBinary);var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&z("no native wasm support detected");
var A,B=!1;"undefined"!==typeof TextDecoder&&new TextDecoder("utf8");var C,D,E;function F(){var b=A.buffer;C=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=E=new Int32Array(b);a.HEAPU8=D=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var G,H=[],I=[],J=[];function aa(){var b=a.preRun.shift();H.unshift(b)}var K=0,L=null,M=null;a.preloadedImages={};a.preloadedAudios={};
function z(b){if(a.onAbort)a.onAbort(b);b="Aborted("+b+")";x(b);B=!0;b=new WebAssembly.RuntimeError(b+". Build with -s ASSERTIONS=1 for more info.");l(b);throw b;}function N(){return O.startsWith("data:application/octet-stream;base64,")}var O;O="ogv-demuxer-ogg-wasm.wasm";if(!N()){var P=O;O=a.locateFile?a.locateFile(P,q):q+P}function Q(){var b=O;try{if(b==O&&y)return new Uint8Array(y);if(u)return u(b);throw"both async and sync fetching of the wasm failed";}catch(c){z(c)}}
function ba(){if(!y&&(n||p)){if("function"===typeof fetch&&!O.startsWith("file://"))return fetch(O,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+O+"'";return b.arrayBuffer()}).catch(function(){return Q()});if(t)return new Promise(function(b,c){t(O,function(d){b(new Uint8Array(d))},c)})}return Promise.resolve().then(function(){return Q()})}
function R(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var d=c.B;"number"===typeof d?void 0===c.v?S(d)():S(d)(c.v):d(void 0===c.v?null:c.v)}}}var T=[];function S(b){var c=T[b];c||(b>=T.length&&(T.length=b+1),T[b]=c=G.get(b));return c}
var ca={},da={d:function(b,c,d){D.copyWithin(b,c,c+d)},e:function(b){var c=D.length;b>>>=0;if(2147483648<b)return!1;for(var d=1;4>=d;d*=2){var e=c*(1+.2/d);e=Math.min(e,b+100663296);e=Math.max(b,e);0<e%65536&&(e+=65536-e%65536);a:{try{A.grow(Math.min(2147483648,e)-C.byteLength+65535>>>16);F();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},f:function(b,c,d,e){b=ca.C(b);c=ca.A(b,c,d);E[e>>2]=c;return 0},a:function(b,c,d,e){var f=A.buffer;a.audioPackets.push({data:f.slice?f.slice(b,b+c):
(new Uint8Array(new Uint8Array(f,b,c))).buffer,timestamp:d,discardPadding:e})},c:function(b,c){function d(e){for(var f="",g=new Uint8Array(A.buffer);0!=g[e];e++)f+=String.fromCharCode(g[e]);return f}b&&(a.videoCodec=d(b));c&&(a.audioCodec=d(c));b=a._ogv_demuxer_media_duration();a.duration=0<=b?b:NaN;a.loadedMetadata=!0},b:function(b,c,d,e,f){var g=A.buffer;a.videoPackets.push({data:g.slice?g.slice(b,b+c):(new Uint8Array(new Uint8Array(g,b,c))).buffer,timestamp:d,keyframeTimestamp:e,isKeyframe:!!f})}};
(function(){function b(f){a.asm=f.exports;A=a.asm.g;F();G=a.asm.s;I.unshift(a.asm.h);K--;a.monitorRunDependencies&&a.monitorRunDependencies(K);0==K&&(null!==L&&(clearInterval(L),L=null),M&&(f=M,M=null,f()))}function c(f){b(f.instance)}function d(f){return ba().then(function(g){return WebAssembly.instantiate(g,e)}).then(function(g){return g}).then(f,function(g){x("failed to asynchronously prepare wasm: "+g);z(g)})}var e={a:da};K++;a.monitorRunDependencies&&a.monitorRunDependencies(K);if(a.instantiateWasm)try{return a.instantiateWasm(e,
b)}catch(f){return x("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return y||"function"!==typeof WebAssembly.instantiateStreaming||N()||O.startsWith("file://")||"function"!==typeof fetch?d(c):fetch(O,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(c,function(g){x("wasm streaming compile failed: "+g);x("falling back to ArrayBuffer instantiation");return d(c)})})})().catch(l);return{}})();
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.h).apply(null,arguments)};a._ogv_demuxer_init=function(){return(a._ogv_demuxer_init=a.asm.i).apply(null,arguments)};a._ogv_demuxer_receive_input=function(){return(a._ogv_demuxer_receive_input=a.asm.j).apply(null,arguments)};a._ogv_demuxer_process=function(){return(a._ogv_demuxer_process=a.asm.k).apply(null,arguments)};a._ogv_demuxer_destroy=function(){return(a._ogv_demuxer_destroy=a.asm.l).apply(null,arguments)};
a._ogv_demuxer_media_length=function(){return(a._ogv_demuxer_media_length=a.asm.m).apply(null,arguments)};a._ogv_demuxer_media_duration=function(){return(a._ogv_demuxer_media_duration=a.asm.n).apply(null,arguments)};a._ogv_demuxer_seekable=function(){return(a._ogv_demuxer_seekable=a.asm.o).apply(null,arguments)};a._ogv_demuxer_keypoint_offset=function(){return(a._ogv_demuxer_keypoint_offset=a.asm.p).apply(null,arguments)};
a._ogv_demuxer_seek_to_keypoint=function(){return(a._ogv_demuxer_seek_to_keypoint=a.asm.q).apply(null,arguments)};a._ogv_demuxer_flush=function(){return(a._ogv_demuxer_flush=a.asm.r).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.t).apply(null,arguments)};a._free=function(){return(a._free=a.asm.u).apply(null,arguments)};var U;M=function ea(){U||V();U||(M=ea)};
function V(){function b(){if(!U&&(U=!0,a.calledRun=!0,!B)){R(I);k(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();J.unshift(c)}R(J)}}if(!(0<K)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)aa();R(H);0<K||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=V;
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();V();var W,X,Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(b){var c=Y();b=b();c=Y()-c;a.cpuTime+=c;return b}a.loadedMetadata=!1;a.videoCodec=null;a.audioCodec=null;a.duration=NaN;a.onseek=null;a.cpuTime=0;a.audioPackets=[];Object.defineProperty(a,"hasAudio",{get:function(){return a.loadedMetadata&&a.audioCodec}});
Object.defineProperty(a,"audioReady",{get:function(){return 0<a.audioPackets.length}});Object.defineProperty(a,"audioTimestamp",{get:function(){return 0<a.audioPackets.length?a.audioPackets[0].timestamp:-1}});a.videoPackets=[];Object.defineProperty(a,"hasVideo",{get:function(){return a.loadedMetadata&&a.videoCodec}});Object.defineProperty(a,"frameReady",{get:function(){return 0<a.videoPackets.length}});
Object.defineProperty(a,"frameTimestamp",{get:function(){return 0<a.videoPackets.length?a.videoPackets[0].timestamp:-1}});Object.defineProperty(a,"keyframeTimestamp",{get:function(){return 0<a.videoPackets.length?a.videoPackets[0].keyframeTimestamp:-1}});Object.defineProperty(a,"nextKeyframeTimestamp",{get:function(){for(var b=0;b<a.videoPackets.length;b++){var c=a.videoPackets[b];if(c.isKeyframe)return c.timestamp}return-1}});Object.defineProperty(a,"processing",{get:function(){return!1}});
Object.defineProperty(a,"seekable",{get:function(){return!!a._ogv_demuxer_seekable()}});a.init=function(b){Z(function(){a._ogv_demuxer_init()});b()};a.receiveInput=function(b,c){Z(function(){var d=b.byteLength;W&&X>=d||(W&&a._free(W),X=d,W=a._malloc(X));var e=W;(new Uint8Array(A.buffer,e,d)).set(new Uint8Array(b));a._ogv_demuxer_receive_input(e,d)});c()};a.process=function(b){var c=Z(function(){return a._ogv_demuxer_process()});b(!!c)};
a.dequeueVideoPacket=function(b){if(a.videoPackets.length){var c=a.videoPackets.shift().data;b(c)}else b(null)};a.dequeueAudioPacket=function(b){if(a.audioPackets.length){var c=a.audioPackets.shift();b(c.data,c.discardPadding)}else b(null)};a.getKeypointOffset=function(b,c){var d=Z(function(){return a._ogv_demuxer_keypoint_offset(1E3*b)});c(d)};
a.seekToKeypoint=function(b,c){var d=Z(function(){return a._ogv_demuxer_seek_to_keypoint(1E3*b)});d&&(a.audioPackets.splice(0,a.audioPackets.length),a.videoPackets.splice(0,a.videoPackets.length));c(!!d)};a.flush=function(b){Z(function(){a.audioPackets.splice(0,a.audioPackets.length);a.videoPackets.splice(0,a.videoPackets.length);a._ogv_demuxer_flush()});b()};a.close=function(){};
return OGVDemuxerOggW.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = OGVDemuxerOggW;
else if (typeof define === 'function' && define['amd'])
define([], function() { return OGVDemuxerOggW; });
else if (typeof exports === 'object')
exports["OGVDemuxerOggW"] = OGVDemuxerOggW;

Binary file not shown.

View File

@ -0,0 +1,46 @@
var OGVDemuxerWebMW = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(OGVDemuxerWebMW) {
OGVDemuxerWebMW = OGVDemuxerWebMW || {};
var a;a||(a=typeof OGVDemuxerWebMW !== 'undefined' ? OGVDemuxerWebMW : {});var h=Object.assign,k,l;a.ready=new Promise(function(b,c){k=b;l=c});var m=h({},a),n="object"===typeof window,q="function"===typeof importScripts,r="",t,u,v,fs,w,A;
if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)r=q?require("path").dirname(r)+"/":__dirname+"/",A=function(){w||(fs=require("fs"),w=require("path"))},t=function(b,c){A();b=w.normalize(b);return fs.readFileSync(b,c?null:"utf8")},v=function(b){b=t(b,!0);b.buffer||(b=new Uint8Array(b));return b},u=function(b,c,d){A();b=w.normalize(b);fs.readFile(b,function(e,f){e?d(e):c(f.buffer)})},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),
process.on("unhandledRejection",function(b){throw b;}),a.inspect=function(){return"[Emscripten Module object]"};else if(n||q)q?r=self.location.href:"undefined"!==typeof document&&document.currentScript&&(r=document.currentScript.src),_scriptDir&&(r=_scriptDir),0!==r.indexOf("blob:")?r=r.substr(0,r.replace(/[?#].*/,"").lastIndexOf("/")+1):r="",t=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},q&&(v=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);
c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),u=function(b,c,d){var e=new XMLHttpRequest;e.open("GET",b,!0);e.responseType="arraybuffer";e.onload=function(){200==e.status||0==e.status&&e.response?c(e.response):d()};e.onerror=d;e.send(null)};var aa=a.print||console.log.bind(console),B=a.printErr||console.warn.bind(console);h(a,m);m=null;var C;a.wasmBinary&&(C=a.wasmBinary);var noExitRuntime=a.noExitRuntime||!0;"object"!==typeof WebAssembly&&D("no native wasm support detected");
var E,F=!1,H="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
function I(b,c,d){var e=c+d;for(d=c;b[d]&&!(d>=e);)++d;if(16<d-c&&b.subarray&&H)return H.decode(b.subarray(c,d));for(e="";c<d;){var f=b[c++];if(f&128){var g=b[c++]&63;if(192==(f&224))e+=String.fromCharCode((f&31)<<6|g);else{var p=b[c++]&63;f=224==(f&240)?(f&15)<<12|g<<6|p:(f&7)<<18|g<<12|p<<6|b[c++]&63;65536>f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else e+=String.fromCharCode(f)}return e}function J(b){return b?I(K,b,void 0):""}var L,K,M;
function N(){var b=E.buffer;L=b;a.HEAP8=new Int8Array(b);a.HEAP16=new Int16Array(b);a.HEAP32=M=new Int32Array(b);a.HEAPU8=K=new Uint8Array(b);a.HEAPU16=new Uint16Array(b);a.HEAPU32=new Uint32Array(b);a.HEAPF32=new Float32Array(b);a.HEAPF64=new Float64Array(b)}var ba,ca=[],da=[],ea=[];function fa(){var b=a.preRun.shift();ca.unshift(b)}var O=0,P=null,Q=null;a.preloadedImages={};a.preloadedAudios={};
function D(b){if(a.onAbort)a.onAbort(b);b="Aborted("+b+")";B(b);F=!0;b=new WebAssembly.RuntimeError(b+". Build with -s ASSERTIONS=1 for more info.");l(b);throw b;}function ha(){return R.startsWith("data:application/octet-stream;base64,")}var R;R="ogv-demuxer-webm-wasm.wasm";if(!ha()){var ia=R;R=a.locateFile?a.locateFile(ia,r):r+ia}function ja(){var b=R;try{if(b==R&&C)return new Uint8Array(C);if(v)return v(b);throw"both async and sync fetching of the wasm failed";}catch(c){D(c)}}
function ka(){if(!C&&(n||q)){if("function"===typeof fetch&&!R.startsWith("file://"))return fetch(R,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+R+"'";return b.arrayBuffer()}).catch(function(){return ja()});if(u)return new Promise(function(b,c){u(R,function(d){b(new Uint8Array(d))},c)})}return Promise.resolve().then(function(){return ja()})}
function S(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c(a);else{var d=c.B;"number"===typeof d?void 0===c.A?la(d)():la(d)(c.A):d(void 0===c.A?null:c.A)}}}var T=[];function la(b){var c=T[b];c||(b>=T.length&&(T.length=b+1),T[b]=c=ba.get(b));return c}
var ma=[null,[],[]],na={a:function(b,c,d,e){D("Assertion failed: "+J(b)+", at: "+[c?J(c):"unknown filename",d,e?J(e):"unknown function"])},f:function(){D("")},d:function(b,c,d){K.copyWithin(b,c,c+d)},e:function(b){var c=K.length;b>>>=0;if(2147483648<b)return!1;for(var d=1;4>=d;d*=2){var e=c*(1+.2/d);e=Math.min(e,b+100663296);e=Math.max(b,e);0<e%65536&&(e+=65536-e%65536);a:{try{E.grow(Math.min(2147483648,e)-L.byteLength+65535>>>16);N();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},b:function(b,
c,d,e){for(var f=0,g=0;g<d;g++){var p=M[c>>2],G=M[c+4>>2];c+=8;for(var x=0;x<G;x++){var y=K[p+x],z=ma[b];0===y||10===y?((1===b?aa:B)(I(z,0)),z.length=0):z.push(y)}f+=G}M[e>>2]=f;return 0},c:function(b,c,d,e){var f=E.buffer;a.audioPackets.push({data:f.slice?f.slice(b,b+c):(new Uint8Array(new Uint8Array(f,b,c))).buffer,timestamp:d,discardPadding:e})},j:function(b,c,d,e,f,g,p,G,x,y,z){a.videoFormat={width:b,height:c,chromaWidth:d,chromaHeight:e,cropLeft:G,cropTop:x,cropWidth:g,cropHeight:p,displayWidth:y,
displayHeight:z,fps:f}},h:function(b,c){function d(e){for(var f="",g=new Uint8Array(E.buffer);0!=g[e];e++)f+=String.fromCharCode(g[e]);return f}b&&(a.videoCodec=d(b));c&&(a.audioCodec=d(c));b=a._ogv_demuxer_media_duration();a.duration=0<=b?b:NaN;a.loadedMetadata=!0},i:function(b,c){if(a.onseek)a.onseek(b+4294967296*c)},g:function(b,c,d,e,f){var g=E.buffer;a.videoPackets.push({data:g.slice?g.slice(b,b+c):(new Uint8Array(new Uint8Array(g,b,c))).buffer,timestamp:d,keyframeTimestamp:e,isKeyframe:!!f})}};
(function(){function b(f){a.asm=f.exports;E=a.asm.k;N();ba=a.asm.w;da.unshift(a.asm.l);O--;a.monitorRunDependencies&&a.monitorRunDependencies(O);0==O&&(null!==P&&(clearInterval(P),P=null),Q&&(f=Q,Q=null,f()))}function c(f){b(f.instance)}function d(f){return ka().then(function(g){return WebAssembly.instantiate(g,e)}).then(function(g){return g}).then(f,function(g){B("failed to asynchronously prepare wasm: "+g);D(g)})}var e={a:na};O++;a.monitorRunDependencies&&a.monitorRunDependencies(O);if(a.instantiateWasm)try{return a.instantiateWasm(e,
b)}catch(f){return B("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return C||"function"!==typeof WebAssembly.instantiateStreaming||ha()||R.startsWith("file://")||"function"!==typeof fetch?d(c):fetch(R,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(c,function(g){B("wasm streaming compile failed: "+g);B("falling back to ArrayBuffer instantiation");return d(c)})})})().catch(l);return{}})();
a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.l).apply(null,arguments)};a._ogv_demuxer_init=function(){return(a._ogv_demuxer_init=a.asm.m).apply(null,arguments)};a._ogv_demuxer_receive_input=function(){return(a._ogv_demuxer_receive_input=a.asm.n).apply(null,arguments)};a._ogv_demuxer_process=function(){return(a._ogv_demuxer_process=a.asm.o).apply(null,arguments)};a._ogv_demuxer_destroy=function(){return(a._ogv_demuxer_destroy=a.asm.p).apply(null,arguments)};
a._ogv_demuxer_flush=function(){return(a._ogv_demuxer_flush=a.asm.q).apply(null,arguments)};a._ogv_demuxer_media_length=function(){return(a._ogv_demuxer_media_length=a.asm.r).apply(null,arguments)};a._ogv_demuxer_media_duration=function(){return(a._ogv_demuxer_media_duration=a.asm.s).apply(null,arguments)};a._ogv_demuxer_seekable=function(){return(a._ogv_demuxer_seekable=a.asm.t).apply(null,arguments)};
a._ogv_demuxer_keypoint_offset=function(){return(a._ogv_demuxer_keypoint_offset=a.asm.u).apply(null,arguments)};a._ogv_demuxer_seek_to_keypoint=function(){return(a._ogv_demuxer_seek_to_keypoint=a.asm.v).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.x).apply(null,arguments)};a._free=function(){return(a._free=a.asm.y).apply(null,arguments)};var U;Q=function oa(){U||V();U||(Q=oa)};
function V(){function b(){if(!U&&(U=!0,a.calledRun=!0,!F)){S(da);k(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();ea.unshift(c)}S(ea)}}if(!(0<O)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)fa();S(ca);0<O||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):b())}}a.run=V;
if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();V();var W,X,Y;"undefined"===typeof performance||"undefined"===typeof performance.now?Y=Date.now:Y=performance.now.bind(performance);function Z(b){var c=Y();b=b();c=Y()-c;a.cpuTime+=c;return b}a.loadedMetadata=!1;a.videoCodec=null;a.audioCodec=null;a.duration=NaN;a.onseek=null;a.cpuTime=0;a.audioPackets=[];Object.defineProperty(a,"hasAudio",{get:function(){return a.loadedMetadata&&a.audioCodec}});
Object.defineProperty(a,"audioReady",{get:function(){return 0<a.audioPackets.length}});Object.defineProperty(a,"audioTimestamp",{get:function(){return 0<a.audioPackets.length?a.audioPackets[0].timestamp:-1}});a.videoPackets=[];Object.defineProperty(a,"hasVideo",{get:function(){return a.loadedMetadata&&a.videoCodec}});Object.defineProperty(a,"frameReady",{get:function(){return 0<a.videoPackets.length}});
Object.defineProperty(a,"frameTimestamp",{get:function(){return 0<a.videoPackets.length?a.videoPackets[0].timestamp:-1}});Object.defineProperty(a,"keyframeTimestamp",{get:function(){return 0<a.videoPackets.length?a.videoPackets[0].keyframeTimestamp:-1}});Object.defineProperty(a,"nextKeyframeTimestamp",{get:function(){for(var b=0;b<a.videoPackets.length;b++){var c=a.videoPackets[b];if(c.isKeyframe)return c.timestamp}return-1}});Object.defineProperty(a,"processing",{get:function(){return!1}});
Object.defineProperty(a,"seekable",{get:function(){return!!a._ogv_demuxer_seekable()}});a.init=function(b){Z(function(){a._ogv_demuxer_init()});b()};a.receiveInput=function(b,c){Z(function(){var d=b.byteLength;W&&X>=d||(W&&a._free(W),X=d,W=a._malloc(X));var e=W;(new Uint8Array(E.buffer,e,d)).set(new Uint8Array(b));a._ogv_demuxer_receive_input(e,d)});c()};a.process=function(b){var c=Z(function(){return a._ogv_demuxer_process()});b(!!c)};
a.dequeueVideoPacket=function(b){if(a.videoPackets.length){var c=a.videoPackets.shift().data;b(c)}else b(null)};a.dequeueAudioPacket=function(b){if(a.audioPackets.length){var c=a.audioPackets.shift();b(c.data,c.discardPadding)}else b(null)};a.getKeypointOffset=function(b,c){var d=Z(function(){return a._ogv_demuxer_keypoint_offset(1E3*b)});c(d)};
a.seekToKeypoint=function(b,c){var d=Z(function(){return a._ogv_demuxer_seek_to_keypoint(1E3*b)});d&&(a.audioPackets.splice(0,a.audioPackets.length),a.videoPackets.splice(0,a.videoPackets.length));c(!!d)};a.flush=function(b){Z(function(){a.audioPackets.splice(0,a.audioPackets.length);a.videoPackets.splice(0,a.videoPackets.length);a._ogv_demuxer_flush()});b()};a.close=function(){};
return OGVDemuxerWebMW.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = OGVDemuxerWebMW;
else if (typeof define === 'function' && define['amd'])
define([], function() { return OGVDemuxerWebMW; });
else if (typeof exports === 'object')
exports["OGVDemuxerWebMW"] = OGVDemuxerWebMW;

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
(()=>{var e={575:e=>{e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},913:e=>{function t(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,o,r){return o&&t(e.prototype,o),r&&t(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports},318:e=>{e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports},8:e=>{function t(o){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(o)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},523:(e,t,o)=>{"use strict";var r=o(318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=r(o(575)),u=r(o(913)),s=new(function(){function e(){(0,n.default)(this,e)}return(0,u.default)(e,[{key:"hasTypedArrays",value:function(){return!!window.Uint32Array}},{key:"hasWebAssembly",value:function(){return!!window.WebAssembly}},{key:"hasWebAudio",value:function(){return!(!window.AudioContext&&!window.webkitAudioContext)}},{key:"hasFlash",value:function(){return!1}},{key:"hasAudio",value:function(){return this.hasWebAudio()}},{key:"isBlacklisted",value:function(e){return!1}},{key:"isSlow",value:function(){return!1}},{key:"isTooSlow",value:function(){return!1}},{key:"supported",value:function(e){return"OGVDecoder"===e?this.hasWebAssembly():"OGVPlayer"===e&&this.supported("OGVDecoder")&&this.hasAudio()}}]),e}());t.default=s}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var u=t[r]={exports:{}};return e[r](u,u.exports,o),u.exports}(()=>{"use strict";var e=o(318),t=e(o(8)),r=e(o(523));"object"===("undefined"==typeof window?"undefined":(0,t.default)(window))&&(window.OGVCompat=r.default,window.OGVVersion="1.8.6-20220111172545-1f60d9d")})()})();

View File

@ -0,0 +1 @@
(()=>{var e={318:e=>{e.exports=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports},8:e=>{function _typeof(o){return e.exports=_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,_typeof(o)}e.exports=_typeof,e.exports.__esModule=!0,e.exports.default=e.exports}},o={};function __webpack_require__(t){var r=o[t];if(void 0!==r)return r.exports;var p=o[t]={exports:{}};return e[t](p,p.exports,__webpack_require__),p.exports}(()=>{"use strict";var e=__webpack_require__(318)(__webpack_require__(8)),o="1.8.6-20220111172545-1f60d9d";"object"===("undefined"==typeof window?"undefined":(0,e.default)(window))&&(window.OGVVersion=o)})()})();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
web/ogvjs-1.8.6/ogv.js Normal file

File diff suppressed because one or more lines are too long

73
web/yuv.js Normal file
View File

@ -0,0 +1,73 @@
var wasmExports;
fetch('yuv.wasm').then(function (res) { return res.arrayBuffer(); })
.then(function (file) { return WebAssembly.instantiate(file); })
.then(function (wasm) {
wasmExports = wasm.instance.exports;
console.log('yuv ready');
});
var yPtr, yPtrLen, uPtr, uPtrLen, vPtr, vPtrLen, outPtr, outPtrLen;
let testSpeed = [0, 0];
function I420ToARGB(yb) {
if (!wasmExports) return;
var tm0 = new Date().getTime();
var { malloc, free, memory } = wasmExports;
var HEAPU8 = new Uint8Array(memory.buffer);
let n = yb.y.bytes.length;
if (yPtrLen != n) {
if (yPtr) free(yPtr);
yPtrLen = n;
yPtr = malloc(n);
}
HEAPU8.set(yb.y.bytes, yPtr);
n = yb.u.bytes.length;
if (uPtrLen != n) {
if (uPtr) free(uPtr);
uPtrLen = n;
uPtr = malloc(n);
}
HEAPU8.set(yb.u.bytes, uPtr);
n = yb.v.bytes.length;
if (vPtrLen != n) {
if (vPtr) free(vPtr);
vPtrLen = n;
vPtr = malloc(n);
}
HEAPU8.set(yb.v.bytes, vPtr);
var w = yb.format.displayWidth;
var h = yb.format.displayHeight;
n = w * h * 4;
if (outPtrLen != n) {
if (outPtr) free(outPtr);
outPtrLen = n;
outPtr = malloc(n);
HEAPU8.fill(255, outPtr, outPtr + n);
}
// var res = wasmExports.I420ToARGB(yPtr, yb.y.stride, uPtr, yb.u.stride, vPtr, yb.v.stride, outPtr, w * 4, w, h);
// var res = wasmExports.AVX_YUV_to_ARGB(outPtr, yPtr, yb.y.stride, uPtr, yb.u.stride, vPtr, yb.v.stride, w, h);
var res = wasmExports.yuv420_rgb24_std(w, h, yPtr, uPtr, vPtr, yb.y.stride, yb.v.stride, outPtr, w * 4, 1);
var out = HEAPU8.slice(outPtr, outPtr + n);
testSpeed[1] += new Date().getTime() - tm0;
testSpeed[0] += 1;
if (testSpeed[0] > 30) {
console.log('yuv: ' + parseInt('' + testSpeed[1] / testSpeed[0]));
testSpeed = [0, 0];
}
return out;
}
var currentFrame;
self.addEventListener('message', (e) => {
currentFrame = e.data;
});
function run() {
if (currentFrame) {
self.postMessage(I420ToARGB(currentFrame));
currentFrame = undefined;
}
setTimeout(run, 1);
}
run();

BIN
web/yuv.wasm Executable file

Binary file not shown.