chromium/third_party/blink/renderer/modules/webcodecs/BUILD.gn

# Copyright 2019 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//media/media_options.gni")
import("//third_party/blink/renderer/modules/modules.gni")
import("//third_party/libaom/options.gni")
import("//third_party/libgav1/options.gni")
import("//third_party/libprotobuf-mutator/fuzzable_proto_library.gni")
import("//third_party/protobuf/proto_library.gni")

blink_modules_sources("webcodecs") {
  sources = [
    "array_buffer_util.cc",
    "array_buffer_util.h",
    "audio_data.cc",
    "audio_data.h",
    "audio_data_attachment.cc",
    "audio_data_attachment.h",
    "audio_data_transfer_list.cc",
    "audio_data_transfer_list.h",
    "audio_decoder.cc",
    "audio_decoder.h",
    "audio_decoder_broker.cc",
    "audio_decoder_broker.h",
    "audio_encoder.cc",
    "audio_encoder.h",
    "background_readback.cc",
    "background_readback.h",
    "codec_config_eval.h",
    "codec_logger.cc",
    "codec_logger.h",
    "codec_pressure_gauge.cc",
    "codec_pressure_gauge.h",
    "codec_pressure_manager.cc",
    "codec_pressure_manager.h",
    "codec_pressure_manager_provider.cc",
    "codec_pressure_manager_provider.h",
    "codec_state_helper.cc",
    "codec_state_helper.h",
    "codec_trace_names.h",
    "decoder_buffer_attachment.cc",
    "decoder_buffer_attachment.h",
    "decoder_selector.cc",
    "decoder_selector.h",
    "decoder_template.cc",
    "decoder_template.h",
    "decrypt_config_util.cc",
    "decrypt_config_util.h",
    "encoded_audio_chunk.cc",
    "encoded_audio_chunk.h",
    "encoded_video_chunk.cc",
    "encoded_video_chunk.h",
    "encoder_base.cc",
    "encoder_base.h",
    "gpu_factories_retriever.cc",
    "gpu_factories_retriever.h",
    "hardware_preference.cc",
    "hardware_preference.h",
    "image_decoder_core.cc",
    "image_decoder_core.h",
    "image_decoder_external.cc",
    "image_decoder_external.h",
    "image_track.cc",
    "image_track.h",
    "image_track_list.cc",
    "image_track_list.h",
    "reclaimable_codec.cc",
    "reclaimable_codec.h",
    "video_color_space.cc",
    "video_color_space.h",
    "video_decoder.cc",
    "video_decoder.h",
    "video_decoder_broker.cc",
    "video_decoder_broker.h",
    "video_decoder_helper.cc",
    "video_decoder_helper.h",
    "video_encoder.cc",
    "video_encoder.h",
    "video_encoder_buffer.cc",
    "video_encoder_buffer.h",
    "video_frame.cc",
    "video_frame.h",
    "video_frame_attachment.cc",
    "video_frame_attachment.h",
    "video_frame_handle.cc",
    "video_frame_handle.h",
    "video_frame_init_util.cc",
    "video_frame_init_util.h",
    "video_frame_layout.cc",
    "video_frame_layout.h",
    "video_frame_monitor.cc",
    "video_frame_monitor.h",
    "video_frame_rect_util.cc",
    "video_frame_rect_util.h",
    "video_frame_transfer_list.cc",
    "video_frame_transfer_list.h",
    "webcodecs_logger.cc",
    "webcodecs_logger.h",
  ]
  deps = [
    "//build:chromeos_buildflags",
    "//media",
    "//media/mojo:buildflags",
    "//media/mojo/clients",
    "//media/mojo/mojom",
    "//third_party/libaom:libaom_buildflags",
    "//third_party/libyuv:libyuv",
    "//third_party/opus",
  ]
  if (enable_libaom) {
    deps += [ "//third_party/libaom" ]
  }
  assert(use_libgav1_parser)
  deps += [ "//third_party/libgav1:libgav1_parser" ]
  if (media_use_libvpx) {
    deps += [ "//third_party/libvpx" ]
  }
  if (media_use_openh264) {
    deps += [ "//third_party/openh264:encoder" ]
  }
  if (is_fuchsia) {
    deps += [ "//media/fuchsia/video" ]
  }
  public_deps = [ "//third_party/blink/renderer/modules/webaudio:webaudio" ]
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "audio_data_test.cc",
    "audio_decoder_broker_test.cc",
    "codec_pressure_gauge_test.cc",
    "codec_pressure_manager_test.cc",
    "decoder_selector_test.cc",
    "decoder_template_test.cc",
    "decrypt_config_util_test.cc",
    "encoded_audio_chunk_test.cc",
    "encoded_video_chunk_test.cc",
    "image_decoder_core_test.cc",
    "image_decoder_external_test.cc",
    "reclaimable_codec_test.cc",
    "test_helpers.cc",
    "test_helpers.h",
    "video_decoder_broker_test.cc",
    "video_decoder_test.cc",
    "video_encoder_test.cc",
    "video_frame_monitor_test.cc",
    "video_frame_test.cc",
  ]

  configs += [
    "//third_party/blink/renderer:config",
    "//third_party/blink/renderer:inside_blink",
    "//third_party/blink/renderer/core:blink_core_pch",
  ]

  deps = [
    "//base/test:test_support",
    "//gpu/command_buffer/common",
    "//media:test_support",
    "//media/mojo/services:services",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/blink/public:test_headers",
    "//third_party/blink/renderer/controller:blink_bindings_test_sources",
    "//third_party/blink/renderer/core:testing",
    "//third_party/blink/renderer/modules",
    "//third_party/blink/renderer/platform",
    "//third_party/blink/renderer/platform:test_support",
    "//third_party/blink/renderer/platform/wtf",
    "//third_party/libyuv",
  ]

  data = [ "//third_party/blink/web_tests/images/resources/" ]
}

fuzzable_proto_library("fuzzer_protos") {
  generate_python = true
  sources = [ "fuzzer_inputs.proto" ]
}