Skip to content

Commit

Permalink
Disable FLAC encoding on Windows.
Browse files Browse the repository at this point in the history
  - Libflac seems to have linking configured differently from other codecs.
  - To expedite getting a MSVC/Windows build working we can disable FLAC functionality entirely.
  - b/362229054: Add a TODO that we should fix the build and enable FLAC on Windows.
  - Drive-by: Clean some nearby BUILD targets.

PiperOrigin-RevId: 670995412
  • Loading branch information
jwcullen committed Sep 4, 2024
1 parent b963054 commit 78e5ee3
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 6 deletions.
14 changes: 8 additions & 6 deletions iamf/cli/codec/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ cc_library(
name = "aac_utils",
srcs = [],
hdrs = ["aac_utils.h"],
deps = [
"@com_google_absl//absl/log",
"@fdk_aac//:aac_encoder_lib",
"@fdk_aac//:fdk_sys_lib",
],
deps = ["@fdk_aac//:fdk_sys_lib"],
)

cc_library(
Expand All @@ -78,9 +74,15 @@ cc_library(
],
)

# TODO(b/362229054): Enable FLAC support on Windows and unify `flac_encoder.cc` and
# `flac_encoder_windows.cc`.

cc_library(
name = "flac_encoder",
srcs = ["flac_encoder.cc"],
srcs = select({
"@platforms//os:windows": ["flac_encoder_windows.cc"],
"//conditions:default": ["flac_encoder.cc"],
}),
hdrs = ["flac_encoder.h"],
deps = [
":encoder_base",
Expand Down
41 changes: 41 additions & 0 deletions iamf/cli/codec/flac_encoder_windows.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2024, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 3-Clause Clear License
* and the Alliance for Open Media Patent License 1.0. If the BSD 3-Clause Clear
* License was not distributed with this source code in the LICENSE file, you
* can obtain it at www.aomedia.org/license/software-license/bsd-3-c-c. If the
* Alliance for Open Media Patent License 1.0 was not distributed with this
* source code in the PATENTS file, you can obtain it at
* www.aomedia.org/license/patent.
*/
#include <cstdint>
#include <memory>
#include <vector>

#include "absl/status/status.h"
#include "iamf/cli/codec/flac_encoder.h"

namespace iamf_tools {

FlacEncoder::~FlacEncoder() {}

absl::Status FlacEncoder::EncodeAudioFrame(
int /*input_bit_depth*/,
const std::vector<std::vector<int32_t>>& /*samples*/,
std::unique_ptr<AudioFrameWithData> /*partial_audio_frame_with_data*/) {
return absl::UnimplementedError(
"Encoding FLAC on native Windows is not yet implemented.");
}

absl::Status FlacEncoder::Finalize() {
return absl::UnimplementedError(
"Encoding FLAC on native Windows is not yet implemented.");
}

absl::Status FlacEncoder::InitializeEncoder() {
return absl::UnimplementedError(
"Encoding FLAC on native Windows is not yet implemented.");
}

} // namespace iamf_tools

0 comments on commit 78e5ee3

Please sign in to comment.