| # Copyright 2017 The Chromium Authors | 
 | # Use of this source code is governed by a BSD-style license that can be | 
 | # found in the LICENSE file. | 
 |  | 
 | import("//media/media_options.gni") | 
 |  | 
 | source_set("formats") { | 
 |   # Do not expand the visibility here without double-checking with OWNERS, this | 
 |   # is a roll-up target which is part of the //media component. Most other DEPs | 
 |   # should be using //media and not directly DEP this roll-up target. | 
 |   visibility = [ | 
 |     "//media", | 
 |     "//media/base/android/", | 
 |     "//media/base/win:media_foundation_util", | 
 |     "//media/cdm", | 
 |     "//media/ffmpeg", | 
 |     "//media/filters", | 
 |     "//media/muxers", | 
 |     "//media/muxers:unit_tests", | 
 |   ] | 
 |  | 
 |   sources = [ | 
 |     "ac3/ac3_util.cc", | 
 |     "ac3/ac3_util.h", | 
 |     "common/offset_byte_queue.cc", | 
 |     "common/offset_byte_queue.h", | 
 |     "common/opus_constants.cc", | 
 |     "common/opus_constants.h", | 
 |     "mp4/bitstream_converter.cc", | 
 |     "mp4/bitstream_converter.h", | 
 |     "mp4/box_constants.h", | 
 |     "mp4/box_definitions.cc", | 
 |     "mp4/box_definitions.h", | 
 |     "mp4/box_reader.cc", | 
 |     "mp4/box_reader.h", | 
 |     "mp4/es_descriptor.cc", | 
 |     "mp4/es_descriptor.h", | 
 |     "mp4/fourccs.cc", | 
 |     "mp4/fourccs.h", | 
 |     "mp4/mp4_stream_parser.cc", | 
 |     "mp4/mp4_stream_parser.h", | 
 |     "mp4/parse_result.h", | 
 |     "mp4/rcheck.h", | 
 |     "mp4/sample_to_group_iterator.cc", | 
 |     "mp4/sample_to_group_iterator.h", | 
 |     "mp4/track_run_iterator.cc", | 
 |     "mp4/track_run_iterator.h", | 
 |     "mp4/writable_box_definitions.cc", | 
 |     "mp4/writable_box_definitions.h", | 
 |     "mpeg/mpeg1_audio_stream_parser.cc", | 
 |     "mpeg/mpeg1_audio_stream_parser.h", | 
 |     "mpeg/mpeg_audio_stream_parser_base.cc", | 
 |     "mpeg/mpeg_audio_stream_parser_base.h", | 
 |     "webcodecs/webcodecs_encoded_chunk_stream_parser.cc", | 
 |     "webcodecs/webcodecs_encoded_chunk_stream_parser.h", | 
 |     "webm/webm_audio_client.cc", | 
 |     "webm/webm_audio_client.h", | 
 |     "webm/webm_cluster_parser.cc", | 
 |     "webm/webm_cluster_parser.h", | 
 |     "webm/webm_colour_parser.cc", | 
 |     "webm/webm_colour_parser.h", | 
 |     "webm/webm_constants.cc", | 
 |     "webm/webm_constants.h", | 
 |     "webm/webm_content_encodings.cc", | 
 |     "webm/webm_content_encodings.h", | 
 |     "webm/webm_content_encodings_client.cc", | 
 |     "webm/webm_content_encodings_client.h", | 
 |     "webm/webm_crypto_helpers.cc", | 
 |     "webm/webm_crypto_helpers.h", | 
 |     "webm/webm_info_parser.cc", | 
 |     "webm/webm_info_parser.h", | 
 |     "webm/webm_parser.cc", | 
 |     "webm/webm_parser.h", | 
 |     "webm/webm_projection_parser.cc", | 
 |     "webm/webm_projection_parser.h", | 
 |     "webm/webm_stream_parser.cc", | 
 |     "webm/webm_stream_parser.h", | 
 |     "webm/webm_tracks_parser.cc", | 
 |     "webm/webm_tracks_parser.h", | 
 |     "webm/webm_video_client.cc", | 
 |     "webm/webm_video_client.h", | 
 |     "webm/webm_webvtt_parser.cc", | 
 |     "webm/webm_webvtt_parser.h", | 
 |   ] | 
 |  | 
 |   deps = [ | 
 |     "//build:chromecast_buildflags", | 
 |     "//media:media_buildflags", | 
 |     "//media/base", | 
 |     "//media/parsers", | 
 |     "//third_party/libwebm", | 
 |   ] | 
 |  | 
 |   configs += [ "//media:subcomponent_config" ] | 
 |  | 
 |   if (proprietary_codecs) { | 
 |     deps += [ "//media/video" ] | 
 |     sources += [ | 
 |       "mp4/aac.cc", | 
 |       "mp4/aac.h", | 
 |       "mp4/avc.cc", | 
 |       "mp4/avc.h", | 
 |       "mp4/dolby_vision.cc", | 
 |       "mp4/dolby_vision.h", | 
 |       "mp4/h264_annex_b_to_avc_bitstream_converter.cc", | 
 |       "mp4/h264_annex_b_to_avc_bitstream_converter.h", | 
 |       "mp4/h26x_annex_b_to_bitstream_converter.cc", | 
 |       "mp4/h26x_annex_b_to_bitstream_converter.h", | 
 |       "mp4/mp4_status.h", | 
 |       "mpeg/adts_constants.h", | 
 |       "mpeg/adts_stream_parser.cc", | 
 |       "mpeg/adts_stream_parser.h", | 
 |     ] | 
 |  | 
 |     # We need this to make h264_annex_b_to_avc_bitstream_converter.h accessible | 
 |     # from video_encode_accelerator_adapter.cc, unfortunately we can't move | 
 |     # h264_annex_b_to_avc_bitstream_converter.h since it depends on | 
 |     # box_definitions.h | 
 |     # TODO(eugene): consider moving media/video/h264_parser.(h|cc) to | 
 |     # media/formats. It might help to break this dependency cycle. | 
 |     allow_circular_includes_from = [ "//media/video" ] | 
 |   } | 
 |   if (proprietary_codecs && enable_platform_hevc) { | 
 |     sources += [ | 
 |       "mp4/hevc.cc", | 
 |       "mp4/hevc.h", | 
 |     ] | 
 |  | 
 |     if (enable_hevc_parser_and_hw_decoder) { | 
 |       sources += [ | 
 |         "mp4/h265_annex_b_to_hevc_bitstream_converter.cc", | 
 |         "mp4/h265_annex_b_to_hevc_bitstream_converter.h", | 
 |       ] | 
 |     } | 
 |   } | 
 |  | 
 |   if (enable_platform_dts_audio) { | 
 |     sources += [ | 
 |       "dts/dts_stream_parser.cc", | 
 |       "dts/dts_stream_parser.h", | 
 |       "dts/dts_util.cc", | 
 |       "dts/dts_util.h", | 
 |       "mp4/dts.cc", | 
 |       "mp4/dts.h", | 
 |       "mp4/dtsx.cc", | 
 |       "mp4/dtsx.h", | 
 |     ] | 
 |   } | 
 |  | 
 |   if (enable_platform_ac3_eac3_audio) { | 
 |     sources += [ | 
 |       "mp4/ac3.cc", | 
 |       "mp4/ac3.h", | 
 |       "mp4/ac3_constants.cc", | 
 |       "mp4/ac3_constants.h", | 
 |       "mp4/eac3.cc", | 
 |       "mp4/eac3.h", | 
 |     ] | 
 |   } | 
 |  | 
 |   if (enable_platform_ac4_audio) { | 
 |     sources += [ | 
 |       "mp4/ac4.cc", | 
 |       "mp4/ac4.h", | 
 |     ] | 
 |   } | 
 |  | 
 |   if (proprietary_codecs && enable_mse_mpeg2ts_stream_parser) { | 
 |     deps += [ "//ui/gfx/geometry" ] | 
 |     sources += [ | 
 |       "mp2t/descriptors.cc", | 
 |       "mp2t/descriptors.h", | 
 |       "mp2t/es_adapter_video.cc", | 
 |       "mp2t/es_adapter_video.h", | 
 |       "mp2t/es_parser.cc", | 
 |       "mp2t/es_parser.h", | 
 |       "mp2t/es_parser_adts.cc", | 
 |       "mp2t/es_parser_adts.h", | 
 |       "mp2t/es_parser_h264.cc", | 
 |       "mp2t/es_parser_h264.h", | 
 |       "mp2t/es_parser_mpeg1audio.cc", | 
 |       "mp2t/es_parser_mpeg1audio.h", | 
 |       "mp2t/mp2t_common.h", | 
 |       "mp2t/mp2t_stream_parser.cc", | 
 |       "mp2t/mp2t_stream_parser.h", | 
 |       "mp2t/timestamp_unroller.cc", | 
 |       "mp2t/timestamp_unroller.h", | 
 |       "mp2t/ts_packet.cc", | 
 |       "mp2t/ts_packet.h", | 
 |       "mp2t/ts_section.h", | 
 |       "mp2t/ts_section_cat.cc", | 
 |       "mp2t/ts_section_cat.h", | 
 |       "mp2t/ts_section_cets_ecm.cc", | 
 |       "mp2t/ts_section_cets_ecm.h", | 
 |       "mp2t/ts_section_cets_pssh.cc", | 
 |       "mp2t/ts_section_cets_pssh.h", | 
 |       "mp2t/ts_section_pat.cc", | 
 |       "mp2t/ts_section_pat.h", | 
 |       "mp2t/ts_section_pes.cc", | 
 |       "mp2t/ts_section_pes.h", | 
 |       "mp2t/ts_section_pmt.cc", | 
 |       "mp2t/ts_section_pmt.h", | 
 |       "mp2t/ts_section_psi.cc", | 
 |       "mp2t/ts_section_psi.h", | 
 |     ] | 
 |   } | 
 |  | 
 |   # TODO(crbug.com/40057824): These should be gated behind `enable_hls_demuxer`, once that's enabled by default. | 
 |   sources += [ | 
 |     "hls/items.cc", | 
 |     "hls/items.h", | 
 |     "hls/media_playlist.cc", | 
 |     "hls/media_playlist.h", | 
 |     "hls/media_segment.cc", | 
 |     "hls/media_segment.h", | 
 |     "hls/multivariant_playlist.cc", | 
 |     "hls/multivariant_playlist.h", | 
 |     "hls/parse_status.h", | 
 |     "hls/playlist.cc", | 
 |     "hls/playlist.h", | 
 |     "hls/playlist_common.cc", | 
 |     "hls/playlist_common.h", | 
 |     "hls/quirks.h", | 
 |     "hls/rendition.cc", | 
 |     "hls/rendition.h", | 
 |     "hls/rendition_group.cc", | 
 |     "hls/rendition_group.h", | 
 |     "hls/rendition_manager.cc", | 
 |     "hls/rendition_manager.h", | 
 |     "hls/segment_stream.cc", | 
 |     "hls/segment_stream.h", | 
 |     "hls/source_string.cc", | 
 |     "hls/source_string.h", | 
 |     "hls/tag_name.cc", | 
 |     "hls/tag_name.h", | 
 |     "hls/tags.cc", | 
 |     "hls/tags.h", | 
 |     "hls/types.cc", | 
 |     "hls/types.h", | 
 |     "hls/variable_dictionary.cc", | 
 |     "hls/variable_dictionary.h", | 
 |     "hls/variant_stream.cc", | 
 |     "hls/variant_stream.h", | 
 |   ] | 
 |   deps += [ | 
 |     "//crypto", | 
 |     "//third_party/re2", | 
 |   ] | 
 |   public_deps = [ | 
 |     "//third_party/abseil-cpp:absl", | 
 |  | 
 |     # Needed because `hls/media_playlist.h` includes GURL in its public API. | 
 |     "//url", | 
 |   ] | 
 | } | 
 |  | 
 | static_library("test_support") { | 
 |   testonly = true | 
 |   visibility = [ "//media:test_support" ] | 
 |  | 
 |   sources = [ | 
 |     "common/stream_parser_test_base.cc", | 
 |     "common/stream_parser_test_base.h", | 
 |     "webm/cluster_builder.cc", | 
 |     "webm/cluster_builder.h", | 
 |     "webm/opus_packet_builder.cc", | 
 |     "webm/opus_packet_builder.h", | 
 |     "webm/tracks_builder.cc", | 
 |     "webm/tracks_builder.h", | 
 |   ] | 
 |  | 
 |   deps = [ | 
 |     "//base/test:test_support", | 
 |     "//media/base:test_support", | 
 |     "//testing/gtest", | 
 |   ] | 
 |  | 
 |   if (proprietary_codecs) { | 
 |     sources += [ | 
 |       "mp4/nalu_test_helper.cc", | 
 |       "mp4/nalu_test_helper.h", | 
 |     ] | 
 |  | 
 |     if (enable_mse_mpeg2ts_stream_parser) { | 
 |       sources += [ | 
 |         "mp2t/es_parser_test_base.cc", | 
 |         "mp2t/es_parser_test_base.h", | 
 |       ] | 
 |     } | 
 |   } | 
 | } | 
 |  | 
 | source_set("unit_tests") { | 
 |   testonly = true | 
 |   sources = [ | 
 |     "ac3/ac3_util_unittest.cc", | 
 |     "common/offset_byte_queue_unittest.cc", | 
 |     "mpeg/mpeg1_audio_stream_parser_unittest.cc", | 
 |     "webm/webm_cluster_parser_unittest.cc", | 
 |     "webm/webm_content_encodings_client_unittest.cc", | 
 |     "webm/webm_crypto_helpers_unittest.cc", | 
 |     "webm/webm_parser_unittest.cc", | 
 |     "webm/webm_projection_parser_unittest.cc", | 
 |     "webm/webm_stream_parser_unittest.cc", | 
 |     "webm/webm_tracks_parser_unittest.cc", | 
 |     "webm/webm_video_client_unittest.cc", | 
 |     "webm/webm_webvtt_parser_unittest.cc", | 
 |   ] | 
 |  | 
 |   deps = [ | 
 |     "//base/test:test_support", | 
 |     "//media:test_support", | 
 |     "//testing/gmock", | 
 |     "//testing/gtest", | 
 |   ] | 
 |  | 
 |   if (proprietary_codecs) { | 
 |     sources += [ | 
 |       "mp4/aac_unittest.cc", | 
 |       "mp4/avc_unittest.cc", | 
 |       "mp4/box_reader_unittest.cc", | 
 |       "mp4/dolby_vision_unittest.cc", | 
 |       "mp4/es_descriptor_unittest.cc", | 
 |       "mp4/h264_annex_b_to_avc_bitstream_converter_unittest.cc", | 
 |       "mp4/h26x_annex_b_to_bitstream_converter_unittest.cc", | 
 |       "mp4/mp4_stream_parser_unittest.cc", | 
 |       "mp4/sample_to_group_iterator_unittest.cc", | 
 |       "mp4/track_run_iterator_unittest.cc", | 
 |       "mpeg/adts_stream_parser_unittest.cc", | 
 |     ] | 
 |  | 
 |     deps += [ "//crypto" ] | 
 |  | 
 |     if (enable_platform_dts_audio) { | 
 |       sources += [ | 
 |         "dts/dts_util_unittest.cc", | 
 |         "mp4/dts_unittest.cc", | 
 |         "mp4/dtsx_unittest.cc", | 
 |       ] | 
 |     } | 
 |  | 
 |     if (enable_platform_ac3_eac3_audio) { | 
 |       sources += [ | 
 |         "mp4/ac3_unittest.cc", | 
 |         "mp4/eac3_unittest.cc", | 
 |       ] | 
 |     } | 
 |  | 
 |     if (enable_platform_ac4_audio) { | 
 |       sources += [ "mp4/ac4_unittest.cc" ] | 
 |     } | 
 |  | 
 |     if (enable_mse_mpeg2ts_stream_parser) { | 
 |       sources += [ | 
 |         "mp2t/es_adapter_video_unittest.cc", | 
 |         "mp2t/es_parser_adts_unittest.cc", | 
 |         "mp2t/es_parser_h264_unittest.cc", | 
 |         "mp2t/es_parser_mpeg1audio_unittest.cc", | 
 |         "mp2t/mp2t_stream_parser_unittest.cc", | 
 |         "mp2t/timestamp_unroller_unittest.cc", | 
 |       ] | 
 |     } | 
 |  | 
 |     if (enable_platform_hevc) { | 
 |       sources += [ "mp4/hevc_unittest.cc" ] | 
 |  | 
 |       if (enable_hevc_parser_and_hw_decoder) { | 
 |         sources += | 
 |             [ "mp4/h265_annex_b_to_hevc_bitstream_converter_unittest.cc" ] | 
 |       } | 
 |     } | 
 |   } | 
 |  | 
 |   # TODO(crbug.com/40057824): This should be gated behind `enable_hls_demuxer`, once that's enabled by default. | 
 |   sources += [ | 
 |     "hls/common_playlist_unittest.cc", | 
 |     "hls/items_unittest.cc", | 
 |     "hls/media_playlist_test_builder.cc", | 
 |     "hls/media_playlist_test_builder.h", | 
 |     "hls/media_playlist_unittest.cc", | 
 |     "hls/media_segment_unittest.cc", | 
 |     "hls/multivariant_playlist_test_builder.cc", | 
 |     "hls/multivariant_playlist_test_builder.h", | 
 |     "hls/multivariant_playlist_unittest.cc", | 
 |     "hls/playlist_test_builder.h", | 
 |     "hls/playlist_unittest.cc", | 
 |     "hls/rendition_group_unittest.cc", | 
 |     "hls/rendition_manager_unittest.cc", | 
 |     "hls/segment_stream_unittest.cc", | 
 |     "hls/tags_unittest.cc", | 
 |     "hls/test_util.h", | 
 |     "hls/types_unittest.cc", | 
 |     "hls/variable_dictionary_unittest.cc", | 
 |   ] | 
 |  | 
 |   # TODO(crbug.com/40031409): Fix code that adds exit-time destructors and | 
 |   # enable the diagnostic by removing this line. | 
 |   configs += [ "//build/config/compiler:no_exit_time_destructors" ] | 
 | } | 
 |  | 
 | # TODO(crbug.com/40057824): This should be gated behind `enable_hls_demuxer`, once that's enabled by default. | 
 | fuzzer_test("hls_items_fuzzer") { | 
 |   sources = [ "hls/items_fuzzer.cc" ] | 
 |   deps = [ | 
 |     "//base", | 
 |     "//media", | 
 |   ] | 
 | } | 
 |  | 
 | # TODO(crbug.com/40057824): This should be gated behind `enable_hls_demuxer`, once that's enabled by default. | 
 | fuzzer_test("hls_attribute_list_fuzzer") { | 
 |   sources = [ "hls/attribute_list_fuzzer.cc" ] | 
 |   deps = [ | 
 |     "//base", | 
 |     "//media", | 
 |   ] | 
 | } | 
 |  | 
 | # TODO(crbug.com/40057824): This should be gated behind `enable_hls_demuxer`, once that's enabled by default. | 
 | fuzzer_test("hls_media_playlist_fuzzer") { | 
 |   sources = [ "hls/media_playlist_fuzzer.cc" ] | 
 |   deps = [ | 
 |     "//base", | 
 |     "//base:i18n", | 
 |     "//media", | 
 |   ] | 
 | } | 
 |  | 
 | # TODO(crbug.com/40057824): This should be gated behind `enable_hls_demuxer`, once that's enabled by default. | 
 | fuzzer_test("hls_multivariant_playlist_fuzzer") { | 
 |   sources = [ "hls/multivariant_playlist_fuzzer.cc" ] | 
 |   deps = [ | 
 |     "//base", | 
 |     "//base:i18n", | 
 |     "//media", | 
 |   ] | 
 | } | 
 |  | 
 | if (proprietary_codecs) { | 
 |   fuzzer_test("h264_annex_b_converter_fuzzer") { | 
 |     sources = [ "mp4/h264_annex_b_to_avc_bitstream_converter_fuzztest.cc" ] | 
 |     seed_corpus = "mp4/h264_annex_b_fuzz_corpus" | 
 |     deps = [ | 
 |       "//base", | 
 |       "//media", | 
 |       "//ui/gfx/geometry", | 
 |     ] | 
 |   } | 
 | } | 
 |  | 
 | if (enable_platform_dts_audio) { | 
 |   fuzzer_test("dts_util_fuzzer") { | 
 |     sources = [ "dts/dts_util_fuzzer.cc" ] | 
 |     deps = [ | 
 |       "//base", | 
 |       "//media", | 
 |     ] | 
 |   } | 
 | } | 
 |  | 
 | test("ac3_util_fuzzer") { | 
 |   sources = [ "ac3/ac3_util_fuzzer.cc" ] | 
 |   fuzztests = [ | 
 |     "Ac3UtilTest.ParseTotalAc3SampleCountNeverCrashes", | 
 |     "Ac3UtilTest.ParseTotalEac3SampleCountNeverCrashes", | 
 |   ] | 
 |   deps = [ | 
 |     "//base", | 
 |     "//media", | 
 |     "//third_party/fuzztest:fuzztest_gtest_main", | 
 |   ] | 
 | } |