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

# This file defines output paths for the CDM adapters and CDMs.

# Naming and folder structure below are following the recommendation for Chrome
# components. Component-updated CDMs must follow the same recommendation.

# Note: This file must be in sync with cdm_paths.cc

# OS name for components is close to "target_os" but has some differences.
# Explicitly define what we use to avoid confusion.
if (is_chromeos) {
  component_os = "cros"
} else if (is_linux) {
  component_os = "linux"
} else if (is_win) {
  component_os = "win"
} else if (is_mac) {
  component_os = "mac"
} else {
  component_os = "unsupported_platform"
}

if (current_cpu == "x86" || current_cpu == "x64" || current_cpu == "arm") {
  component_arch = "$current_cpu"
} else {
  component_arch = "unsupported_arch"
}

# Only enable platform specific path for Win and Mac, where CDMs are Chrome
# components.
# TODO(xhwang): Improve how we enable platform specific path. See
# http://crbug.com/468584
if ((is_win || is_mac) && (current_cpu == "x86" || current_cpu == "x64")) {
  _platform_specific_path =
      "_platform_specific/$component_os" + "_" + "$component_arch"

  # Path of Clear Key and Widevine CDMs relative to the output dir.
  clearkey_cdm_path = "ClearKeyCdm/$_platform_specific_path"
  widevine_cdm_path = "WidevineCdm/$_platform_specific_path"
} else {
  clearkey_cdm_path = "."
  widevine_cdm_path = "."
}
