Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

wip: is_upgraded

Richie McIlroyda75b4a4570f
diff --git a/apps/cli/src/main.rs b/apps/cli/src/main.rs
index 815525c04..6ae15b3ca 100644
--- a/apps/cli/src/main.rs
+++ b/apps/cli/src/main.rs
@@ -122,6 +122,7 @@ async fn main() -> Result<(), String> {
&segments,
fps,
XY::new(1920, 1080),
+ true,
)
.unwrap();
diff --git a/apps/desktop/src-tauri/src/export.rs b/apps/desktop/src-tauri/src/export.rs
index 31805c62a..fdc76f0ca 100644
--- a/apps/desktop/src-tauri/src/export.rs
+++ b/apps/desktop/src-tauri/src/export.rs
@@ -1,6 +1,6 @@
use crate::{
general_settings::GeneralSettingsStore, get_video_metadata, upsert_editor_instance,
- windows::ShowCapWindow, RenderProgress, VideoRecordingMetadata, VideoType,
+ windows::ShowCapWindow, AuthStore, RenderProgress, VideoRecordingMetadata, VideoType,
};
use cap_project::{ProjectConfiguration, XY};
use std::path::PathBuf;
@@ -70,6 +70,9 @@ pub async fn export_video(
}
}
+ let auth = AuthStore::get(&app)?.ok_or("Not authenticated")?;
+ let is_upgraded = auth.is_upgraded();
+
let exporter = cap_export::Exporter::new(
modified_project,
output_path.clone(),
@@ -86,6 +89,7 @@ pub async fn export_video(
&editor_instance.segments,
fps,
resolution_base,
+ is_upgraded,
)
.map_err(|e| {
sentry::capture_message(&e.to_string(), sentry::Level::Error);
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index 30f5ff80c..32b80da6a 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -105,6 +105,7 @@ impl Renderer {
time,
total_frames,
resolution_base,
+ false,
)
.await
.unwrap();
@@ -147,7 +148,7 @@ impl RendererHandle {
camera_frame: Option<DecodedFrame>,
background: BackgroundSource,
uniforms: ProjectUniforms,
- time: f32, // Add this parameter
+ time: f32,
resolution_base: XY<u32>,
) {
let (finished_tx, finished_rx) = oneshot::channel();
diff --git a/crates/editor/src/editor_instance.rs b/crates/editor/src/editor_instance.rs
index 6944d3e17..8eae9f51a 100644
--- a/crates/editor/src/editor_instance.rs
+++ b/crates/editor/src/editor_instance.rs
@@ -261,6 +261,7 @@ impl EditorInstance {
&project,
time as f32,
resolution_base,
+ false,
),
time as f32,
resolution_base,
diff --git a/crates/editor/src/playback.rs b/crates/editor/src/playback.rs
index a61bd9958..809bb282c 100644
--- a/crates/editor/src/playback.rs
+++ b/crates/editor/src/playback.rs
@@ -96,7 +96,13 @@ impl Playback {
},
data = segment.decoders.get_frames(time as f32, !project.camera.hide) => {
if let Some((screen_frame, camera_frame)) = data {
- let uniforms = ProjectUniforms::new(&self.render_constants, &project, time as f32, resolution_base);
+ let uniforms = ProjectUniforms::new(
+ &self.render_constants,
+ &project,
+ time as f32,
+ resolution_base,
+ false,
+ );
self
.renderer
diff --git a/crates/export/src/lib.rs b/crates/export/src/lib.rs
index 11b61a534..d78821ba5 100644
--- a/crates/export/src/lib.rs
+++ b/crates/export/src/lib.rs
@@ -44,6 +44,7 @@ pub struct Exporter<TOnProgress> {
render_constants: Arc<RenderVideoConstants>,
fps: u32,
resolution_base: XY<u32>,
+ is_upgraded: bool,
}
impl<TOnProgress> Exporter<TOnProgress>
@@ -60,6 +61,7 @@ where
segments: &[Segment],
fps: u32,
resolution_base: XY<u32>,
+ is_upgraded: bool,
) -> Result<Self, ExportError> {
let output_folder = output_path.parent().unwrap();
std::fs::create_dir_all(output_folder)?;
@@ -108,6 +110,7 @@ where
output_size,
fps,
resolution_base,
+ is_upgraded,
})
}
@@ -299,6 +302,7 @@ where
self.render_segments,
self.fps,
self.resolution_base,
+ self.is_upgraded,
)
.then(|f| async { f.map_err(Into::into) });
diff --git a/crates/flags/src/lib.rs b/crates/flags/src/lib.rs
index da74f9a80..98e17cf22 100644
--- a/crates/flags/src/lib.rs
+++ b/crates/flags/src/lib.rs
@@ -8,7 +8,7 @@ pub struct Flags {
}
pub const FLAGS: Flags = Flags {
- record_mouse: cfg!(debug_assertions),
+ record_mouse: true,
split: false, // cfg!(debug_assertions),
pause_resume: false, // cfg!(debug_assertions),
zoom: cfg!(debug_assertions),
diff --git a/crates/rendering/src/lib.rs b/crates/rendering/src/lib.rs
index ce4139248..c9183e108 100644
--- a/crates/rendering/src/lib.rs
+++ b/crates/rendering/src/lib.rs
@@ -167,6 +167,7 @@ pub async fn render_video_to_channel(
segments: Vec<RenderSegment>,
fps: u32,
resolution_base: XY<u32>,
+ is_upgraded: bool,
) -> Result<(), RenderingError> {
let constants = RenderVideoConstants::new(options, meta).await?;
let recordings = ProjectRecordings::new(meta);
@@ -218,8 +219,13 @@ pub async fn render_video_to_channel(
.get_frames(source_time as f32, !project.camera.hide)
.await
{
- let uniforms =
- ProjectUniforms::new(&constants, &project, source_time as f32, resolution_base);
+ let uniforms = ProjectUniforms::new(
+ &constants,
+ &project,
+ source_time as f32,
+ resolution_base,
+ is_upgraded,
+ );
let frame = produce_frame(
&constants,
@@ -230,6 +236,7 @@ pub async fn render_video_to_channel(
source_time as f32,
total_frames,
resolution_base,
+ is_upgraded,
)
.await?;
@@ -307,7 +314,7 @@ pub struct RenderVideoConstants {
watermark_pipeline: WatermarkPipeline,
watermark_texture: wgpu::Texture,
watermark_bind_group: wgpu::BindGroup,
- watermark_dimensions: (u32, u32), // Add watermark dimensions
+ watermark_dimensions: (u32, u32),
}
impl RenderVideoConstants {
@@ -543,6 +550,7 @@ pub struct ProjectUniforms {
camera: Option<CompositeVideoFrameUniforms>,
pub zoom: Zoom,
pub project: ProjectConfiguration,
+ pub is_upgraded: bool,
}
#[derive(Debug, Clone)]
@@ -693,6 +701,7 @@ impl ProjectUniforms {
project: &ProjectConfiguration,
time: f32,
resolution_base: XY<u32>,
+ is_upgraded: bool,
) -> Self {
let options = &constants.options;
let output_size = Self::get_output_size(options, project, resolution_base);
@@ -909,6 +918,7 @@ impl ProjectUniforms {
camera,
zoom,
project: project.clone(),
+ is_upgraded,
}
}
}
@@ -931,6 +941,7 @@ pub async fn produce_frame(
time: f32,
total_frames: u32,
resolution_base: XY<u32>,
+ is_upgraded: bool,
) -> Result<RenderedFrame, RenderingError> {
let mut encoder = constants.device.create_command_encoder(
&(wgpu::CommandEncoderDescriptor {
@@ -1151,8 +1162,8 @@ pub async fn produce_frame(
padding,
uniforms.output_size.1 as f32 - (target_width * aspect_ratio) - padding,
],
- opacity: 0.5,
- is_upgraded: 0.0,
+ opacity: if uniforms.is_upgraded { 0.0 } else { 0.5 },
+ is_upgraded: if uniforms.is_upgraded { 1.0 } else { 0.0 },
};
// println!(