| # 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" ] |
| } |