Upload upstream chromium 108.0.5359.1
[platform/framework/web/chromium-efl.git] / media / filters / BUILD.gn
1 # Copyright 2017 The Chromium Authors
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import("//media/gpu/args.gni")
6 import("//media/media_options.gni")
7
8 source_set("filters") {
9   # Do not expand the visibility here without double-checking with OWNERS, this
10   # is a roll-up target which is part of the //media component. Most other DEPs
11   # should be using //media and not directly DEP this roll-up target.
12   visibility = [
13     "//media",
14     "//media/fuchsia/audio",
15     "//media/renderers",
16   ]
17
18   sources = [
19     "audio_clock.cc",
20     "audio_clock.h",
21     "audio_renderer_algorithm.cc",
22     "audio_renderer_algorithm.h",
23     "audio_timestamp_validator.cc",
24     "audio_timestamp_validator.h",
25     "chunk_demuxer.cc",
26     "chunk_demuxer.h",
27     "decoder_selector.cc",
28     "decoder_selector.h",
29     "decoder_stream.cc",
30     "decoder_stream.h",
31     "decoder_stream_traits.cc",
32     "decoder_stream_traits.h",
33     "decrypting_audio_decoder.cc",
34     "decrypting_audio_decoder.h",
35     "decrypting_demuxer_stream.cc",
36     "decrypting_demuxer_stream.h",
37     "decrypting_media_resource.cc",
38     "decrypting_media_resource.h",
39     "decrypting_video_decoder.cc",
40     "decrypting_video_decoder.h",
41     "file_data_source.cc",
42     "file_data_source.h",
43     "frame_buffer_pool.cc",
44     "frame_buffer_pool.h",
45     "frame_processor.cc",
46     "frame_processor.h",
47     "memory_data_source.cc",
48     "memory_data_source.h",
49     "offloading_video_decoder.cc",
50     "offloading_video_decoder.h",
51     "pipeline_controller.cc",
52     "pipeline_controller.h",
53     "source_buffer_parse_warnings.h",
54     "source_buffer_range.cc",
55     "source_buffer_range.h",
56     "source_buffer_state.cc",
57     "source_buffer_state.h",
58     "source_buffer_stream.cc",
59     "source_buffer_stream.h",
60     "stream_parser_factory.cc",
61     "stream_parser_factory.h",
62     "video_cadence_estimator.cc",
63     "video_cadence_estimator.h",
64     "video_renderer_algorithm.cc",
65     "video_renderer_algorithm.h",
66     "vp9_bool_decoder.cc",
67     "vp9_bool_decoder.h",
68     "vp9_compressed_header_parser.cc",
69     "vp9_compressed_header_parser.h",
70     "vp9_parser.cc",
71     "vp9_parser.h",
72     "vp9_raw_bits_reader.cc",
73     "vp9_raw_bits_reader.h",
74     "vp9_uncompressed_header_parser.cc",
75     "vp9_uncompressed_header_parser.h",
76     "wsola_internals.cc",
77     "wsola_internals.h",
78   ]
79
80   configs += [ "//media:subcomponent_config" ]
81
82   deps = [
83     "//base",
84     "//build:chromeos_buildflags",
85     "//cc/base",  # For MathUtil.
86     "//media:media_buildflags",
87     "//media/base",
88     "//media/cdm",
89     "//media/formats",
90     "//media/video",
91     "//third_party/libyuv",
92     "//ui/gfx/geometry:geometry",
93   ]
94
95   libs = []
96
97   if (proprietary_codecs) {
98     sources += [
99       "h264_to_annex_b_bitstream_converter.cc",
100       "h264_to_annex_b_bitstream_converter.h",
101     ]
102
103     if (enable_platform_hevc) {
104       sources += [
105         "h265_to_annex_b_bitstream_converter.cc",
106         "h265_to_annex_b_bitstream_converter.h",
107       ]
108     }
109   }
110
111   if (media_use_ffmpeg) {
112     deps += [
113       "//media/ffmpeg",
114       "//third_party/ffmpeg",
115       "//third_party/ffmpeg:ffmpeg_features",
116       "//third_party/opus",
117     ]
118     sources += [
119       "audio_file_reader.cc",
120       "audio_file_reader.h",
121       "audio_video_metadata_extractor.cc",
122       "audio_video_metadata_extractor.h",
123       "blocking_url_protocol.cc",
124       "blocking_url_protocol.h",
125       "ffmpeg_audio_decoder.cc",
126       "ffmpeg_audio_decoder.h",
127       "ffmpeg_bitstream_converter.h",
128       "ffmpeg_demuxer.cc",
129       "ffmpeg_demuxer.h",
130       "ffmpeg_glue.cc",
131       "ffmpeg_glue.h",
132       "in_memory_url_protocol.cc",
133       "in_memory_url_protocol.h",
134       "media_file_checker.cc",
135       "media_file_checker.h",
136     ]
137   }
138
139   if (media_use_libvpx) {
140     sources += [
141       "vpx_video_decoder.cc",
142       "vpx_video_decoder.h",
143     ]
144     deps += [ "//third_party/libvpx" ]
145   }
146
147   if (enable_dav1d_decoder) {
148     sources += [
149       "dav1d_video_decoder.cc",
150       "dav1d_video_decoder.h",
151     ]
152     deps += [ "//third_party/dav1d" ]
153   }
154
155   if (enable_libgav1_decoder) {
156     sources += [
157       "gav1_video_decoder.cc",
158       "gav1_video_decoder.h",
159     ]
160     deps += [ "//third_party/libgav1" ]
161   }
162
163   if (media_use_ffmpeg) {
164     if (proprietary_codecs) {
165       sources += [
166         "ffmpeg_aac_bitstream_converter.cc",
167         "ffmpeg_aac_bitstream_converter.h",
168         "ffmpeg_h264_to_annex_b_bitstream_converter.cc",
169         "ffmpeg_h264_to_annex_b_bitstream_converter.h",
170       ]
171
172       if (enable_platform_hevc) {
173         sources += [
174           "ffmpeg_h265_to_annex_b_bitstream_converter.cc",
175           "ffmpeg_h265_to_annex_b_bitstream_converter.h",
176         ]
177       }
178     }
179
180     if (enable_ffmpeg_video_decoders) {
181       sources += [
182         "ffmpeg_video_decoder.cc",
183         "ffmpeg_video_decoder.h",
184       ]
185     }
186
187     if (is_android) {
188       sources += [
189         "android/video_frame_extractor.cc",
190         "android/video_frame_extractor.h",
191       ]
192     }
193   }
194
195   if (is_android) {
196     sources -= [
197       "decrypting_audio_decoder.cc",
198       "decrypting_audio_decoder.h",
199       "decrypting_video_decoder.cc",
200       "decrypting_video_decoder.h",
201     ]
202     sources += [
203       "android/media_codec_audio_decoder.cc",
204       "android/media_codec_audio_decoder.h",
205     ]
206     deps += [ "//media/base/android" ]
207   }
208
209   if (is_mac) {
210     sources += [
211       "mac/audio_toolbox_audio_decoder.cc",
212       "mac/audio_toolbox_audio_decoder.h",
213       "mac/audio_toolbox_audio_encoder.cc",
214       "mac/audio_toolbox_audio_encoder.h",
215     ]
216   }
217   if (is_win && enable_platform_dts_audio) {
218     sources += [
219       "passthrough_dts_audio_decoder.cc",
220       "passthrough_dts_audio_decoder.h",
221     ]
222   }
223   if (is_win) {
224     sources += [
225       "win/media_foundation_utils.cc",
226       "win/media_foundation_utils.h",
227     ]
228     deps += [ "//media/base/win:media_foundation_util" ]
229     if (enable_platform_dts_audio) {
230       sources += [
231         "win/media_foundation_audio_decoder.cc",
232         "win/media_foundation_audio_decoder.h",
233       ]
234       ldflags = [
235         "/DELAYLOAD:packages/Microsoft.VCRTForwarders.140.1.0.6/runtimes/win10-x64/native/release/concrt140_app.dll",
236         "/DELAYLOAD:packages/Microsoft.VCRTForwarders.140.1.0.6/runtimes/win10-x64/native/release/msvcp140_1_app.dll",
237         "/DELAYLOAD:packages/Microsoft.VCRTForwarders.140.1.0.6/runtimes/win10-x64/native/release/msvcp140_2_app.dll",
238         "/DELAYLOAD:packages/Microsoft.VCRTForwarders.140.1.0.6/runtimes/win10-x64/native/release/msvcp140_app.dll",
239         "/DELAYLOAD:packages/Microsoft.VCRTForwarders.140.1.0.6/runtimes/win10-x64/native/release/vcamp140_app.dll",
240         "/DELAYLOAD:packages/Microsoft.VCRTForwarders.140.1.0.6/runtimes/win10-x64/native/release/vccorlib140_app.dll",
241         "/DELAYLOAD:packages/Microsoft.VCRTForwarders.140.1.0.6/runtimes/win10-x64/native/release/vcomp140_app.dll",
242         "/DELAYLOAD:packages/Microsoft.VCRTForwarders.140.1.0.6/runtimes/win10-x64/native/release/vcruntime140_app.dll",
243       ]
244     }
245   }
246
247   if (use_vaapi) {
248     sources += [
249       "h264_bitstream_buffer.cc",
250       "h264_bitstream_buffer.h",
251     ]
252   }
253 }
254
255 source_set("perftests") {
256   testonly = true
257   sources = []
258
259   if (media_use_ffmpeg) {
260     sources += [ "demuxer_perftest.cc" ]
261   }
262
263   configs += [ "//media:media_config" ]
264   deps = [
265     "//base",
266     "//base/test:test_support",
267     "//media:test_support",
268     "//testing/gmock",
269     "//testing/gtest",
270     "//testing/perf",
271   ]
272 }
273
274 static_library("test_support") {
275   testonly = true
276   visibility = [ "//media:test_support" ]
277
278   sources = [
279     "fake_video_decoder.cc",
280     "fake_video_decoder.h",
281     "ivf_parser.cc",
282     "ivf_parser.h",
283   ]
284
285   deps = [
286     "//base/test:test_support",
287     "//media/base:test_support",
288   ]
289 }
290
291 source_set("unit_tests") {
292   testonly = true
293   sources = [
294     "audio_clock_unittest.cc",
295     "audio_decoder_stream_unittest.cc",
296     "audio_renderer_algorithm_unittest.cc",
297     "audio_timestamp_validator_unittest.cc",
298     "chunk_demuxer_unittest.cc",
299     "decoder_selector_unittest.cc",
300     "decrypting_audio_decoder_unittest.cc",
301     "decrypting_demuxer_stream_unittest.cc",
302     "decrypting_media_resource_unittest.cc",
303     "decrypting_video_decoder_unittest.cc",
304     "fake_video_decoder_unittest.cc",
305     "file_data_source_unittest.cc",
306     "frame_buffer_pool_unittest.cc",
307     "frame_processor_unittest.cc",
308     "ivf_parser_unittest.cc",
309     "memory_data_source_unittest.cc",
310     "offloading_video_decoder_unittest.cc",
311     "pipeline_controller_unittest.cc",
312     "source_buffer_state_unittest.cc",
313     "source_buffer_stream_unittest.cc",
314     "video_cadence_estimator_unittest.cc",
315     "video_decoder_stream_unittest.cc",
316     "video_renderer_algorithm_unittest.cc",
317     "vp9_parser_unittest.cc",
318     "vp9_raw_bits_reader_unittest.cc",
319     "vp9_uncompressed_header_parser_unittest.cc",
320   ]
321
322   deps = [
323     "//base/test:test_support",
324     "//build:chromeos_buildflags",
325     "//media:test_support",
326     "//testing/gmock",
327     "//testing/gtest",
328     "//ui/gfx:test_support",
329   ]
330
331   if (is_android) {
332     sources += [ "android/video_frame_extractor_unittest.cc" ]
333     sources -= [
334       "decrypting_audio_decoder_unittest.cc",
335       "decrypting_video_decoder_unittest.cc",
336     ]
337
338     deps += [ "//ui/gl" ]
339   }
340
341   # libvpx for running vpx test on chromecast doesn't support high bit depth.
342   # This may cause some unit tests failure. See b/65382374 for further context.
343   if (is_castos) {
344     defines = [ "LIBVPX_NO_HIGH_BIT_DEPTH" ]
345   }
346
347   if (media_use_ffmpeg) {
348     sources += [
349       "audio_decoder_unittest.cc",
350       "audio_file_reader_unittest.cc",
351       "blocking_url_protocol_unittest.cc",
352       "ffmpeg_demuxer_unittest.cc",
353       "ffmpeg_glue_unittest.cc",
354       "in_memory_url_protocol_unittest.cc",
355     ]
356
357     deps += [
358       # Direct dependency needed for the config
359       "//third_party/opus",
360     ]
361
362     # Even if FFmpeg is enabled on Android we don't want these.
363     # TODO(watk): Refactor tests that could be made to run on Android.
364     if (!is_android) {
365       sources += [
366         "audio_video_metadata_extractor_unittest.cc",
367         "media_file_checker_unittest.cc",
368       ]
369     }
370
371     if (enable_ffmpeg_video_decoders) {
372       sources += [ "ffmpeg_video_decoder_unittest.cc" ]
373     }
374   }
375
376   if (media_use_libvpx) {
377     sources += [ "vpx_video_decoder_unittest.cc" ]
378   }
379
380   if (enable_dav1d_decoder) {
381     sources += [ "dav1d_video_decoder_unittest.cc" ]
382   }
383
384   if (enable_libgav1_decoder) {
385     sources += [ "gav1_video_decoder_unittest.cc" ]
386   }
387
388   if (use_vaapi) {
389     sources += [ "h264_bitstream_buffer_unittest.cc" ]
390   }
391
392   if (proprietary_codecs) {
393     sources += [ "h264_to_annex_b_bitstream_converter_unittest.cc" ]
394
395     if (enable_platform_hevc) {
396       sources += [ "h265_to_annex_b_bitstream_converter_unittest.cc" ]
397     }
398
399     if (media_use_ffmpeg) {
400       sources += [
401         "ffmpeg_aac_bitstream_converter_unittest.cc",
402         "ffmpeg_h264_to_annex_b_bitstream_converter_unittest.cc",
403       ]
404     }
405   }
406
407   if (media_use_ffmpeg) {
408     # Direct dependency required to inherit config.
409     deps += [ "//third_party/ffmpeg" ]
410   }
411 }