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