mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:07:45 +00:00
aconv: Copy metadata to output
This requires postponing FLAC header finalization, since FLAC cannot write metadata after a finalized header.
This commit is contained in:
parent
1e291753b0
commit
4c9c2104f3
1 changed files with 7 additions and 2 deletions
|
@ -134,15 +134,20 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
static_cast<int>(input_loader->sample_rate()),
|
static_cast<int>(input_loader->sample_rate()),
|
||||||
input_loader->num_channels(),
|
input_loader->num_channels(),
|
||||||
Audio::pcm_bits_per_sample(parsed_output_sample_format)));
|
Audio::pcm_bits_per_sample(parsed_output_sample_format)));
|
||||||
TRY(flac_writer->finalize_header_format());
|
|
||||||
writer.emplace(move(flac_writer));
|
writer.emplace(move(flac_writer));
|
||||||
} else {
|
} else {
|
||||||
warnln("Codec {} is not supported for encoding", output_format);
|
warnln("Codec {} is not supported for encoding", output_format);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (writer.has_value())
|
if (writer.has_value()) {
|
||||||
(*writer)->sample_count_hint(input_loader->total_samples());
|
(*writer)->sample_count_hint(input_loader->total_samples());
|
||||||
|
TRY((*writer)->set_metadata(input_loader->metadata()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME: Maybe use a generalized interface for this as well if the need arises.
|
||||||
|
if (output_format == "flac"sv)
|
||||||
|
TRY(static_cast<Audio::FlacWriter*>(writer->ptr())->finalize_header_format());
|
||||||
|
|
||||||
if (output != "-"sv)
|
if (output != "-"sv)
|
||||||
out("Writing: \033[s");
|
out("Writing: \033[s");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue