russelltg / wl-screenrec

High performance wlroots screen recording, featuring hardware encoding
Apache License 2.0
266 stars 9 forks source link

Unbreak audio build on DragonFly #22

Closed jbeich closed 11 months ago

jbeich commented 11 months ago

DragonFly supports wlroots and has fork of FreeBSD Ports, so may inherit wl-screenrec package recipe. Currently, not listed platforms fail to build:

error[E0432]: unresolved imports `platform`, `crate::Args`
  --> src/main.rs:91:5
   |
91 | use platform::*;
   |     ^^^^^^^^ use of undeclared crate or module `platform`
   |
  ::: src/audio.rs:22:30
   |
22 | use crate::{fifo::AudioFifo, Args};
   |                              ^^^^

error[E0425]: cannot find value `DEFAULT_AUDIO_CAPTURE_DEVICE` in this scope
   --> src/main.rs:163:36
    |
163 |     #[clap(long, default_value_t = DEFAULT_AUDIO_CAPTURE_DEVICE.to_string(), help = AUDIO_DEVICE_HELP)]
    |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find value `AUDIO_DEVICE_HELP` in this scope
   --> src/main.rs:163:85
    |
163 |     #[clap(long, default_value_t = DEFAULT_AUDIO_CAPTURE_DEVICE.to_string(), help = AUDIO_DEVICE_HELP)]
    |                                                                                     ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find value `DEFAULT_AUDIO_BACKEND` in this scope
   --> src/main.rs:166:36
    |
166 |     #[clap(long, default_value_t = DEFAULT_AUDIO_BACKEND.to_string(), help = "which ffmpeg audio capture backend (see https://ff...
    |                                    ^^^^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find value `DEFAULT_AUDIO_BACKEND` in this scope
    --> src/main.rs:1587:45
     |
1587 |     if !args.audio && args.audio_backend != DEFAULT_AUDIO_BACKEND {
     |                                             ^^^^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find value `DEFAULT_AUDIO_CAPTURE_DEVICE` in this scope
    --> src/main.rs:1590:44
     |
1590 |     if !args.audio && args.audio_device != DEFAULT_AUDIO_CAPTURE_DEVICE {
     |                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope

Note, pulse can be made as a fallback but none of BSDs have FFmpeg built with PulseAudio enabled by default. Worse, PulseAudio is broken on DragonFly and discouraged on OpenBSD.

russelltg commented 11 months ago

Currently there is no fallback anyways, but I'm pretty sure if you did get a ffmpeg built with pulse and passed pulse to --audio-backend it would work fine. Anyways, LGTM--cannot test on dragonfly but happy to accept PR's so long they are not hacks.

jbeich commented 11 months ago

Oops, forgot to test against typos:

error: expected `;`, found keyword `pub`
  --> src/main.rs:88:97
   |
88 |         "which audio device to record from. list devices with `cat /dev/sndstat` (pcmN -> dspN)"
   |                                                                                                 ^ help: add `;` here
89 |     pub const DEFAULT_AUDIO_BACKEND: &str = "oss";
   |     --- unexpected token
russelltg commented 11 months ago

Yep--pushed a fix for that. I'll get a simple cargo check CI pipeline up at some point so it's easier to accept contributions (you may have noticed--you're the first ;) )