Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions manpage/wf-recorder.1
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
.Op Fl P, -audio-codec-param Op Ar option_param=option_value
.Op Fl R, -sample-rate Ar sample_rate
.Op Fl X, -sample-format Ar sample_format
.Op Fl y, -overwrite
.Sh DESCRIPTION
.Nm
is a tool built to record your screen on Wayland compositors.
Expand Down Expand Up @@ -160,6 +161,9 @@ Set the output audio sample format.
.Pp
List available formats using
.Dl $ ffmpeg -sample_fmts
.Pp
.It Fl y , -overwrite
Force overwriting the output file without prompting.

.El
.Sh EXAMPLES
Expand Down
12 changes: 10 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,8 @@ Use Ctrl+C to stop.)");

-P, --audio-codec-param Change the audio codec parameters.
-P <option_name>=<option_value>

-y, --overwrite Force overwriting the output file without prompting.

Examples:)");
#ifdef HAVE_PULSE
Expand Down Expand Up @@ -971,6 +973,7 @@ int main(int argc, char *argv[])
constexpr const char* default_cmdline_output = "interactive";
std::string cmdline_output = default_cmdline_output;
bool force_no_dmabuf = false;
bool force_overwrite = false;

struct option opts[] = {
{ "output", required_argument, NULL, 'o' },
Expand All @@ -995,11 +998,12 @@ int main(int argc, char *argv[])
{ "buffrate", required_argument, NULL, 'B' },
{ "version", no_argument, NULL, 'v' },
{ "no-damage", no_argument, NULL, 'D' },
{ "overwrite", no_argument, NULL, 'y' },
{ 0, 0, NULL, 0 }
};

int c, i;
while((c = getopt_long(argc, argv, "o:f:m:g:c:p:r:x:C:P:R:X:d:b:B:la::hvDF:", opts, &i)) != -1)
while((c = getopt_long(argc, argv, "o:f:m:g:c:p:r:x:C:P:R:X:d:b:B:la::hvDF:y", opts, &i)) != -1)
{
switch(c)
{
Expand Down Expand Up @@ -1097,12 +1101,16 @@ int main(int argc, char *argv[])
force_no_dmabuf = true;
break;

case 'y':
force_overwrite = true;
break;

default:
printf("Unsupported command line argument %s\n", optarg);
}
}

if (!user_specified_overwrite(params.file))
if (!force_overwrite && !user_specified_overwrite(params.file))
{
return EXIT_FAILURE;
}
Expand Down