Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

add ffmpeg dlls as resources in windows build

Brendan Allan62065ef149ae
diff --git a/.gitignore b/.gitignore
index ae63d5913..a32642b5b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,6 +35,5 @@ pnpm-lock.yaml
.vinxi
native-deps*
apps/storybook/storybook-static
-tauri.*.conf.json
*.tsbuildinfo
diff --git a/apps/desktop/scripts/prepare.js b/apps/desktop/scripts/prepare.js
index ac45f925d..012577948 100644
--- a/apps/desktop/scripts/prepare.js
+++ b/apps/desktop/scripts/prepare.js
@@ -31,19 +31,6 @@ async function exists(filePath) {
.catch(() => false);
}
-/**
- * @param {string} targetPath
- * @param {string} outputPath
- */
-async function unzip(targetPath, outputPath) {
- console.log(`unzipping \"${targetPath}\" --> \"${outputPath}\"`);
- if (isWindows) {
- await exec(`tar -xf ${targetPath} -C ${outputPath}`);
- } else {
- await exec(`unzip -o ${targetPath} -d ${outputPath}`);
- }
-}
-
/**
* Creates a Microsoft Windows Installer (TM) compatible version from the provided crate's semver version.
* `major.minor.patch.build`
diff --git a/apps/desktop/src-tauri/tauri.conf.prod.json b/apps/desktop/src-tauri/tauri.conf.prod.json
index 93b35f2e5..9dfde482c 100644
--- a/apps/desktop/src-tauri/tauri.conf.prod.json
+++ b/apps/desktop/src-tauri/tauri.conf.prod.json
@@ -3,9 +3,6 @@
"productName": "Cap",
"mainBinaryName": "Cap",
"identifier": "so.cap.desktop",
- "build": {
- "beforeBundleCommand": "node scripts/stripDebugSymbols.js"
- },
"plugins": {
"updater": {
"active": true
diff --git a/apps/desktop/src-tauri/tauri.windows.conf.json b/apps/desktop/src-tauri/tauri.windows.conf.json
new file mode 100644
index 000000000..bfe86ea44
--- /dev/null
+++ b/apps/desktop/src-tauri/tauri.windows.conf.json
@@ -0,0 +1,8 @@
+{
+ "$schema": "https://schema.tauri.app/config/2",
+ "bundle": {
+ "resources": {
+ "../../../target/ffmpeg/bin/*.dll": "./"
+ }
+ }
+}
diff --git a/apps/desktop/src/utils/web-api.ts b/apps/desktop/src/utils/web-api.ts
index 1cd65876a..89f24844d 100644
--- a/apps/desktop/src/utils/web-api.ts
+++ b/apps/desktop/src/utils/web-api.ts
@@ -1,4 +1,4 @@
-import { ApiFetcher, AppRouter, initClient } from "@ts-rest/core";
+import { ApiFetcher, initClient } from "@ts-rest/core";
import { contract, licenseContract } from "@cap/web-api-contract";
import { fetch } from "@tauri-apps/plugin-http";
diff --git a/crates/rendering/src/decoder/ffmpeg.rs b/crates/rendering/src/decoder/ffmpeg.rs
index 58834b642..f96886d54 100644
--- a/crates/rendering/src/decoder/ffmpeg.rs
+++ b/crates/rendering/src/decoder/ffmpeg.rs
@@ -117,24 +117,15 @@ impl FfmpegDecoder {
}
}
- let hw_device: Option<HwDevice> = {
- #[cfg(target_os = "macos")]
- {
- decoder
- .try_use_hw_device(
- AVHWDeviceType::AV_HWDEVICE_TYPE_VIDEOTOOLBOX,
- Pixel::NV12,
- )
- .ok()
- }
- #[cfg(target_os = "windows")]
- {
- decoder
- .try_use_hw_device(AVHWDeviceType::AV_HWDEVICE_TYPE_DXVA2, Pixel::DXVA2_VLD)
- .ok()
- }
-
- #[cfg(not(any(target_os = "macos", target_os = "windows")))]
+ let hw_device: Option<HwDevice> = if cfg!(target_os = "macos") {
+ decoder
+ .try_use_hw_device(AVHWDeviceType::AV_HWDEVICE_TYPE_VIDEOTOOLBOX, Pixel::NV12)
+ .ok()
+ } else if cfg!(target_os = "windows") {
+ decoder
+ .try_use_hw_device(AVHWDeviceType::AV_HWDEVICE_TYPE_DXVA2, Pixel::DXVA2_VLD)
+ .ok()
+ } else {
None
};