Skip to content

Commit

Permalink
Avoid implicit converstion of filesystem::path to string
Browse files Browse the repository at this point in the history
Use explicit conversion because the implicit does not work on Windows builds.

PiperOrigin-RevId: 668154026
  • Loading branch information
trevorknight authored and felicialim committed Aug 27, 2024
1 parent 0b78b9b commit 378bd26
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
5 changes: 3 additions & 2 deletions iamf/cli/encoder_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@ int main(int argc, char** argv) {
? std::filesystem::temp_directory_path()
: std::filesystem::path(absl::GetFlag(FLAGS_output_iamf_directory));

absl::Status status = iamf_tools::TestMain(
*user_metadata, input_wav_directory, output_iamf_directory);
absl::Status status =
iamf_tools::TestMain(*user_metadata, input_wav_directory.string(),
output_iamf_directory.string());

// Log success or failure. Success is defined as a valid test vector returning
// `absl::OkStatus()` or an invalid test vector returning a different status.
Expand Down
5 changes: 3 additions & 2 deletions iamf/cli/encoder_main_lib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,9 @@ absl::Status GenerateObus(
// Write the output audio streams which were used to measure loudness to the
// same directory as the IAMF file.
const std::string output_wav_file_prefix =
std::filesystem::path(output_iamf_directory) /
user_metadata.test_vector_metadata().file_name_prefix();
(std::filesystem::path(output_iamf_directory) /
user_metadata.test_vector_metadata().file_name_prefix())
.string();
LOG(INFO) << "output_wav_file_prefix = " << output_wav_file_prefix;
auto mix_presentation_finalizer = CreateMixPresentationFinalizer(
output_wav_file_prefix, output_wav_file_bit_depth_override,
Expand Down
5 changes: 3 additions & 2 deletions iamf/cli/iamf_components.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ std::vector<std::unique_ptr<ObuSequencerBase>> CreateObuSequencers(
// TODO(b/314895932): Find a more portable alternative to `/dev/null/`.
const std::string iamf_filename =
prefix.empty() ? "/dev/null"
: std::filesystem::path(output_iamf_directory) /
std::filesystem::path(absl::StrCat(prefix, ".iamf"));
: (std::filesystem::path(output_iamf_directory) /
std::filesystem::path(absl::StrCat(prefix, ".iamf")))
.string();
obu_sequencers.emplace_back(std::make_unique<ObuSequencerIamf>(
iamf_filename, include_temporal_delimiters, *leb_generator));

Expand Down
2 changes: 1 addition & 1 deletion iamf/cli/wav_sample_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ absl::Status WavSampleProvider::Initialize(
audio_frame_metadata.wav_filename();

auto wav_reader = WavReader::CreateFromFile(
wav_filename,
wav_filename.string(),
static_cast<size_t>(codec_config.GetNumSamplesPerFrame()));
if (!wav_reader.ok()) {
return wav_reader.status();
Expand Down

0 comments on commit 378bd26

Please sign in to comment.