1# Copyright (c) 2020-2021 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13import("//build/lite/config/component/lite_component.gni")
14import("//build/lite/ndk/ndk.gni")
15import("//foundation/multimedia/media_utils_lite/config.gni")
16
17if (ohos_kernel_type != "liteos_m") {
18  shared_library("player_lite") {
19    if (enable_media_passthrough_mode == false) {
20      sources = [
21        "binder/player.cpp",
22        "binder/player_client.cpp",
23      ]
24    } else {
25      sources = [
26        "passthrough/liteplayer/player.cpp",
27        "passthrough/liteplayer/player_client.cpp",
28      ]
29    }
30    cflags = [ "-fPIC" ]
31    cflags += [ "-Wall" ]
32    cflags += [ "-Werror" ]
33    cflags_cc = cflags
34
35    outdir = rebase_path("$root_out_dir")
36    ldflags = [ "-L$outdir" ]
37    include_dirs = [ "//base/security/permission_lite/interfaces/kits" ]
38
39    if (enable_media_passthrough_mode == false) {
40      include_dirs +=
41          [ "//foundation/multimedia/media_lite/frameworks/player_lite/binder" ]
42      deps = [
43        "//foundation/communication/ipc/interfaces/innerkits/c/ipc:ipc_single",
44        "//foundation/graphic/surface_lite:surface_lite",
45        "//foundation/systemabilitymgr/samgr_lite/samgr:samgr",
46      ]
47    } else {
48      include_dirs += [
49        "//foundation/multimedia/media_lite/frameworks/player_lite/passthrough/liteplayer",
50        "//foundation/multimedia/media_lite/services/player_lite/impl",
51        "//foundation/multimedia/media_lite/services/player_lite/impl/buffersource/include",
52        "//foundation/multimedia/media_lite/services/player_lite/impl/player_control/include",
53        "//foundation/multimedia/media_lite/services/player_lite/impl/player_control/player",
54        "//foundation/multimedia/media_lite/services/player_lite/impl/player_control/player/fsm/src",
55        "//foundation/multimedia/media_lite/services/player_lite/impl/player_control/player/fsm/include",
56        "//foundation/multimedia/media_lite/services/player_lite/impl/player_control/source",
57        "//foundation/multimedia/media_lite/services/player_lite/impl/player_control/sink",
58        "//foundation/multimedia/media_lite/services/player_lite/impl/player_control/decoder",
59        "//drivers/peripheral/display/interfaces/include",
60        "//drivers/peripheral/base",
61        "//drivers/peripheral/format/interfaces/include",
62        "//drivers/peripheral/audio/interfaces/include",
63        "//drivers/peripheral/codec/interfaces/include",
64      ]
65      deps = [
66        "//foundation/multimedia/media_lite/services/player_lite:player_impl",
67      ]
68      ldflags += [ "-laudio_hw" ]
69      ldflags += [ "-lcodec" ]
70      ldflags += [ "-lformat_hw" ]
71      ldflags += [ "-lhdi_videodisplayer" ]
72    }
73
74    public_configs = [ ":player_external_library_config" ]
75    public_deps = [
76      "//base/security/permission_lite/services/pms_client:pms_client",
77      "//foundation/graphic/surface_lite:surface_lite",
78      "//foundation/multimedia/media_utils_lite:media_common",
79      "//third_party/bounds_checking_function:libsec_shared",
80    ]
81  }
82
83  config("player_external_library_config") {
84    include_dirs =
85        [ "//foundation/multimedia/media_lite/interfaces/kits/player_lite" ]
86    include_dirs +=
87        [ "//foundation/multimedia/media_lite/interfaces/innerkits" ]
88    include_dirs +=
89        [ "//foundation/multimedia/media_utils_lite/interfaces/kits" ]
90  }
91
92  lite_component("media_lite") {
93    features = [
94      ":player_lite",
95      "//foundation/multimedia/media_lite/interfaces/kits/player_lite/js/builtin:audio_lite_api",
96    ]
97  }
98} else {
99  static_library("player_lite") {
100    sources = [ "passthrough/histreamer/player.cpp" ]
101    include_dirs =
102        [ "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits/hilog" ]
103    public_deps = [
104      "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_static",
105      "//foundation/multimedia/media_foundation:histreamer",
106    ]
107    public_configs = [ ":player_direct_external_library_config" ]
108  }
109
110  config("player_direct_external_library_config") {
111    include_dirs = [
112      "//foundation/multimedia/media_lite/interfaces/innerkits",
113      "//foundation/multimedia/frameworks/player_lite",
114      "//foundation/multimedia/media_utils_lite/interfaces/kits",
115      "//foundation/multimedia/media_lite/interfaces/kits/player_lite",
116      "//drivers/peripheral/format/interfaces/include",
117    ]
118  }
119}
120