| # Copyright 2016 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD - style license that can be |
| # found in the LICENSE file. |
| |
| declare_args() { |
| # Use a prebuilt ffmpeg binary rather than building it locally. See |
| # //garnet/bin/mediaplayer/ffmpeg/README.md for details. This is |
| # ignored when building media_player in variant builds (e.g. sanitizers); |
| # in that case, ffmpeg is always built from source so as to be built with |
| # the selected variant's config. When this is false (either explicitly |
| # or because media_player is a variant build) then //third_party/ffmpeg |
| # must be in the source tree, which requires: |
| # `jiri import -name garnet manifest/ffmpeg https://fuchsia.googlesource.com/garnet` |
| use_prebuilt_ffmpeg = true |
| } |
| |
| if (toolchain_variant.name != "" && toolchain_variant.name != "debug" && |
| toolchain_variant.name != "release") { |
| use_prebuilt_ffmpeg = false |
| } |
| |
| source_set("ffmpeg") { |
| sources = [ |
| "av_codec_context.cc", |
| "av_codec_context.h", |
| "av_format_context.h", |
| "av_frame.h", |
| "av_io_context.cc", |
| "av_io_context.h", |
| "av_packet.h", |
| "ffmpeg_audio_decoder.cc", |
| "ffmpeg_audio_decoder.h", |
| "ffmpeg_decoder_base.cc", |
| "ffmpeg_decoder_base.h", |
| "ffmpeg_decoder_factory.cc", |
| "ffmpeg_decoder_factory.h", |
| "ffmpeg_demux.cc", |
| "ffmpeg_demux.h", |
| "ffmpeg_demux_factory.cc", |
| "ffmpeg_demux_factory.h", |
| "ffmpeg_formatting.cc", |
| "ffmpeg_formatting.h", |
| "ffmpeg_init.cc", |
| "ffmpeg_init.h", |
| "ffmpeg_video_decoder.cc", |
| "ffmpeg_video_decoder.h", |
| "ffmpeg_video_frame_layout.cc", |
| "ffmpeg_video_frame_layout.h", |
| "lpcm_util.cc", |
| "lpcm_util.h", |
| ] |
| |
| deps = [ |
| "//garnet/bin/mediaplayer/decode", |
| "//garnet/bin/mediaplayer/demux", |
| "//garnet/bin/mediaplayer/graph", |
| "//garnet/bin/mediaplayer/util", |
| "//garnet/public/fidl/fuchsia.media", |
| "//garnet/public/fidl/fuchsia.mediaplayer", |
| "//garnet/public/lib/fsl", |
| "//garnet/public/lib/fxl", |
| "//garnet/public/lib/media/timeline", |
| "//zircon/public/lib/async-loop-cpp", |
| "//zircon/public/lib/trace", |
| ] |
| |
| defines = [ |
| "FF_API_PIX_FMT_DESC=0", |
| "FF_API_OLD_DECODE_AUDIO=0", |
| "FF_API_DESTRUCT_PACKET=0", |
| "FF_API_GET_BUFFER=0", |
| "FF_API_CONVERGENCE_DURATION=0", |
| "__STDC_CONSTANT_MACROS", |
| ] |
| |
| if (use_prebuilt_ffmpeg) { |
| deps += [ ":prebuilt_ffmpeg" ] |
| } else { |
| deps += [ "//third_party/ffmpeg" ] |
| } |
| } |
| |
| if (use_prebuilt_ffmpeg) { |
| assert( |
| toolchain_variant.name == "" || toolchain_variant.name == "debug" || |
| toolchain_variant.name == "release", |
| "Set use_prebuilt_ffmpeg=false when selecting variants for media_player.") |
| |
| group("prebuilt_ffmpeg") { |
| deps = [ |
| ":prebuilt_ffmpeg_copy", |
| ] |
| |
| public_configs = [ ":prebuilt_ffmpeg_config" ] |
| } |
| |
| copy("prebuilt_ffmpeg_copy") { |
| visibility = [ ":prebuilt_ffmpeg" ] |
| |
| sources = [ |
| "prebuilt/${current_cpu}/libffmpeg.so", |
| ] |
| outputs = [ |
| "$root_out_dir/${current_cpu}-shared/libffmpeg.so", |
| ] |
| } |
| |
| config("prebuilt_ffmpeg_config") { |
| visibility = [ ":prebuilt_ffmpeg" ] |
| |
| prebuilt_ffmpeg_base = "prebuilt/${current_cpu}/" |
| if (current_cpu == "x64") { |
| ffmpeg_config = "max" |
| } else { |
| ffmpeg_config = "default" |
| } |
| |
| include_dirs = [ |
| prebuilt_ffmpeg_base, |
| prebuilt_ffmpeg_base + "/fuchsia/config/" + ffmpeg_config + "/" + |
| current_cpu, |
| ] |
| |
| libs = get_target_outputs(":prebuilt_ffmpeg_copy") |
| } |
| } |