36 lines
1.5 KiB
Plaintext
36 lines
1.5 KiB
Plaintext
// Screen_Record: a region of one screen recorded to H.264 in an MP4, for the mcap app's screen
|
|
// recording and tools/record_probe.jai (video-capture-plan.html, macos-plan phase 7). On Windows with
|
|
// Desktop Duplication or Windows.Graphics.Capture and WASAPI (windows.jai); on macOS with
|
|
// ScreenCaptureKit, its frames and sound alike, through modules/Screen_Record/macos/capture.m
|
|
// (macos.jai). Either way to FFmpeg (encoder.jai), the sound mixed onto the video's timeline
|
|
// (audio_mix.jai), and made a regular MP4 at the end (remux.jai).
|
|
//
|
|
// recorder: Recorder;
|
|
// ok, error := record_start(*recorder, .{path = "out.mp4", ...});
|
|
// ...
|
|
// ok, error = record_stop(*recorder);
|
|
|
|
RECORD_MIN_WIDTH :: 240; // a smaller region is refused
|
|
RECORD_MIN_HEIGHT :: 180;
|
|
RECORD_QUEUE :: 8; // frames waiting for the encoder at most
|
|
RECORD_BUFFERS :: RECORD_QUEUE + 2; // and the one being filled, and the one being encoded
|
|
|
|
// Whether a region this size may be recorded: at least RECORD_MIN_WIDTH x RECORD_MIN_HEIGHT. It is
|
|
// rounded down to even sizes after, which keeps it at least that, as both are even.
|
|
record_size_allowed :: (width: s64, height: s64) -> bool {
|
|
return width >= RECORD_MIN_WIDTH && height >= RECORD_MIN_HEIGHT;
|
|
}
|
|
|
|
#if OS == .WINDOWS #load "windows.jai";
|
|
#if OS == .MACOS #load "macos.jai";
|
|
#load "audio_mix.jai";
|
|
#load "encoder.jai";
|
|
#load "remux.jai";
|
|
|
|
#import "Basic";
|
|
#import "String";
|
|
#import "Atomics";
|
|
#import "Math";
|
|
#import "Thread";
|
|
#import "ffmpeg";
|