# Copyright 2021 The Cobalt Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

ffmpeg_specialization_sources = [
  "ffmpeg_audio_decoder_impl.cc",
  "ffmpeg_audio_decoder_impl.h",
  "ffmpeg_common.h",
  "ffmpeg_demuxer_impl.cc",
  "ffmpeg_demuxer_impl.h",
  "ffmpeg_video_decoder_impl.cc",
  "ffmpeg_video_decoder_impl.h",
]

static_library("ffmpeg_dynamic_load") {
  sources = [
    "ffmpeg_dynamic_load_audio_decoder_impl.cc",
    "ffmpeg_dynamic_load_demuxer_impl.cc",
    "ffmpeg_dynamic_load_dispatch_impl.cc",
    "ffmpeg_dynamic_load_video_decoder_impl.cc",
  ]
  public_deps = [
    ":ffmpeg.57.107.100",
    ":ffmpeg.58.35.100",
    ":ffmpeg_dispatch_sources",
    ":libav.54.35.1",
    ":libav.56.1.0",
  ]
}

# TODO(b/208910380): ffmpeg_linked doesn't compile for linux locally.
_target_platform_name_parts = string_split(target_platform, "-")
_building_linux_platform = _target_platform_name_parts[0] == "linux"
if (!_building_linux_platform) {
  static_library("ffmpeg_linked") {
    check_includes = false
    sources = ffmpeg_specialization_sources + [
                "ffmpeg_linked_audio_decoder_impl.cc",
                "ffmpeg_linked_demuxer_impl.cc",
                "ffmpeg_linked_dispatch_impl.cc",
                "ffmpeg_linked_video_decoder_impl.cc",
              ]
    public_deps = [ ":ffmpeg_dispatch_sources" ]
  }
}

# We recompile the specialization sources for each different library version.
# Changing include_dirs changes where implementations in the sources look.
template("versioned_ffmpeg_library") {
  not_needed(invoker, "*")
  static_library(target_name) {
    check_includes = false
    sources = ffmpeg_specialization_sources
    public_deps = [ "//starboard/common" ]

    configs += [
      "//starboard/build/config:starboard_implementation",
      ":${target_name}_config",
    ]
  }

  config("${target_name}_config") {
    include_dirs = [ "//third_party/ffmpeg_includes/$target_name" ]
  }
}

versioned_ffmpeg_library("libav.54.35.1") {
}
versioned_ffmpeg_library("libav.56.1.0") {
}
versioned_ffmpeg_library("ffmpeg.57.107.100") {
}
versioned_ffmpeg_library("ffmpeg.58.35.100") {
}

static_library("ffmpeg_dispatch_sources") {
  check_includes = false
  sources = [
    "ffmpeg_audio_decoder.h",
    "ffmpeg_demuxer.cc",
    "ffmpeg_demuxer.h",
    "ffmpeg_dispatch.cc",
    "ffmpeg_dispatch.h",
    "ffmpeg_video_decoder.h",
  ]

  public_configs = [ "//starboard/build/config:starboard_implementation" ]
}

target(gtest_target_type, "ffmpeg_demuxer_test") {
  testonly = true
  sources = [ "ffmpeg_demuxer_test.cc" ]
  configs += [ "//starboard/build/config:starboard_implementation" ]
  deps = [
    ":ffmpeg_dispatch_sources",
    "//cobalt/test:run_all_unittests",
    "//starboard",
    "//starboard/common",
    "//testing/gmock",
    "//testing/gtest",
  ]
  data_deps = [ "//third_party/chromium/media/test/data:media_testdata" ]
}
