From 66e8f847e61602a4e9c0e382c97ab064927018d2 Mon Sep 17 00:00:00 2001 From: Kongqun Yang Date: Thu, 13 Feb 2014 15:56:38 -0800 Subject: [PATCH] Clean up gyp. Split packager.gyp into multiple smaller gyp definitions. Change-Id: Icb38bd20f6e11ea41a975332c911d6bde7fc827d --- media/base/media_base.gyp | 141 ++++++++++++++++ media/event/media_event.gyp | 49 ++++++ media/file/file.gyp | 39 +++++ media/mp4/mp4.gyp | 85 ++++++++++ media/test/media_test.gyp | 26 +++ mpd/mpd.gyp | 4 +- packager.gyp | 326 +++++------------------------------- 7 files changed, 384 insertions(+), 286 deletions(-) create mode 100644 media/base/media_base.gyp create mode 100644 media/event/media_event.gyp create mode 100644 media/file/file.gyp create mode 100644 media/mp4/mp4.gyp create mode 100644 media/test/media_test.gyp diff --git a/media/base/media_base.gyp b/media/base/media_base.gyp new file mode 100644 index 0000000000..dca777b879 --- /dev/null +++ b/media/base/media_base.gyp @@ -0,0 +1,141 @@ +# Copyright (c) 2013 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'target_defaults': { + 'include_dirs': [ + '../..', + ], + }, + 'targets': [ + { + 'target_name': 'status', + 'type': '<(component)', + 'sources': [ + 'status.cc', + 'status.h', + ], + 'dependencies': [ + '../../base/base.gyp:base', + ], + }, + { + 'target_name': 'httpfetcher', + 'type': '<(component)', + 'sources': [ + 'httpfetcher.cc', + 'httpfetcher.h', + ], + 'cflags!': [ '-fno-exceptions' ], + 'cflags_cc!': [ '-fno-exceptions' ], + 'conditions': [ + ['OS=="mac"', { + 'xcode_settings': { + 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES' + } + }] + ], + 'dependencies': [ + '../../third_party/happyhttp/happyhttp.gyp:happyhttp_lib', + 'status', + ], + }, + { + # Note that this test performs real http requests to a http server. + 'target_name': 'httpfetcher_unittest', + 'type': '<(gtest_target_type)', + 'sources': [ + 'httpfetcher_unittest.cc', + ], + 'dependencies': [ + '../../base/base.gyp:base', + '../../testing/gtest.gyp:gtest', + '../../testing/gtest.gyp:gtest_main', + 'httpfetcher', + ], + }, + { + 'target_name': 'base', + 'type': '<(component)', + 'sources': [ + 'aes_encryptor.cc', + 'aes_encryptor.h', + 'audio_stream_info.cc', + 'audio_stream_info.h', + 'bit_reader.cc', + 'bit_reader.h', + 'buffers.h', + 'buffer_reader.cc', + 'buffer_reader.h', + 'buffer_writer.cc', + 'buffer_writer.h', + 'byte_queue.cc', + 'byte_queue.h', + 'container_names.cc', + 'container_names.h', + 'demuxer.cc', + 'demuxer.h', + 'decrypt_config.cc', + 'decrypt_config.h', + 'decryptor_source.h', + 'encryptor_source.cc', + 'encryptor_source.h', + 'fixed_encryptor_source.cc', + 'fixed_encryptor_source.h', + 'limits.h', + 'media_parser.h', + 'media_sample.cc', + 'media_sample.h', + 'media_stream.cc', + 'media_stream.h', + 'muxer.cc', + 'muxer.h', + 'muxer_options.cc', + 'muxer_options.h', + 'request_signer.cc', + 'request_signer.h', + 'rsa_key.cc', + 'rsa_key.h', + 'stream_info.cc', + 'stream_info.h', + 'text_track.h', + 'video_stream_info.cc', + 'video_stream_info.h', + 'widevine_encryptor_source.cc', + 'widevine_encryptor_source.h', + ], + 'dependencies': [ + '../../base/base.gyp:base', + '../../third_party/openssl/openssl.gyp:openssl', + 'httpfetcher', + 'status', + ], + }, + { + 'target_name': 'media_base_unittest', + 'type': '<(gtest_target_type)', + 'sources': [ + 'aes_encryptor_unittest.cc', + 'bit_reader_unittest.cc', + 'buffer_writer_unittest.cc', + 'container_names_unittest.cc', + 'fake_prng.cc', # For rsa_key_unittest + 'fake_prng.h', # For rsa_key_unittest + 'rsa_key_unittest.cc', + 'rsa_test_data.cc', # For rsa_key_unittest + 'rsa_test_data.h', # For rsa_key_unittest + 'status_test_util.h', + 'status_test_util_unittest.cc', + 'status_unittest.cc', + ], + 'dependencies': [ + '../../testing/gtest.gyp:gtest', + '../../testing/gmock.gyp:gmock', + '../file/file.gyp:file', + '../test/media_test.gyp:media_test_support', + 'base', + ], + }, + ], +} diff --git a/media/event/media_event.gyp b/media/event/media_event.gyp new file mode 100644 index 0000000000..2f632ee584 --- /dev/null +++ b/media/event/media_event.gyp @@ -0,0 +1,49 @@ +# Copyright (c) 2013 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'target_defaults': { + 'include_dirs': [ + '../..', + ], + }, + 'targets': [ + { + 'target_name': 'media_event', + 'type': '<(component)', + 'sources': [ + 'muxer_listener.h', + 'vod_media_info_dump_muxer_listener.cc', + 'vod_media_info_dump_muxer_listener.h', + 'vod_mpd_notify_muxer_listener.cc', + 'vod_mpd_notify_muxer_listener.h', + 'vod_muxer_listener_internal.cc', + 'vod_muxer_listener_internal.h', + ], + 'dependencies': [ + '../../mpd/mpd.gyp:media_info_proto', + # Depends on full protobuf to read/write with TextFormat. + '../../third_party/protobuf/protobuf.gyp:protobuf_full_do_not_use', + '../base/media_base.gyp:base', + ], + }, + { + 'target_name': 'media_event_unittest', + 'type': '<(gtest_target_type)', + 'sources': [ + 'vod_media_info_dump_muxer_listener_unittest.cc', + ], + 'dependencies': [ + '../../base/base.gyp:base', + '../../base/base.gyp:run_all_unittests', + '../../mpd/mpd.gyp:media_info_proto', + '../../testing/gtest.gyp:gtest', + # Depends on full protobuf to read/write with TextFormat. + '../../third_party/protobuf/protobuf.gyp:protobuf_full_do_not_use', + '../file/file.gyp:file', + 'media_event', + ], + }, + ], +} diff --git a/media/file/file.gyp b/media/file/file.gyp new file mode 100644 index 0000000000..b4789c3e8c --- /dev/null +++ b/media/file/file.gyp @@ -0,0 +1,39 @@ +# Copyright (c) 2013 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'target_defaults': { + 'include_dirs': [ + '../..', + ], + }, + 'targets': [ + { + 'target_name': 'file', + 'type': '<(component)', + 'sources': [ + 'file.cc', + 'file.h', + 'file_closer.h', + 'local_file.cc', + 'local_file.h', + ], + 'dependencies': [ + '../../base/base.gyp:base', + ], + }, + { + 'target_name': 'file_unittest', + 'type': '<(gtest_target_type)', + 'sources': [ + 'file_unittest.cc', + ], + 'dependencies': [ + '../../testing/gtest.gyp:gtest', + '../../testing/gtest.gyp:gtest_main', + 'file', + ], + }, + ], +} diff --git a/media/mp4/mp4.gyp b/media/mp4/mp4.gyp new file mode 100644 index 0000000000..d73b55a52e --- /dev/null +++ b/media/mp4/mp4.gyp @@ -0,0 +1,85 @@ +# Copyright (c) 2013 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'target_defaults': { + 'include_dirs': [ + '../..', + ], + }, + 'targets': [ + { + 'target_name': 'mp4', + 'type': '<(component)', + 'sources': [ + 'aac_audio_specific_config.cc', + 'aac_audio_specific_config.h', + 'box.cc', + 'box.h', + 'box_buffer.h', + 'box_definitions.cc', + 'box_definitions.h', + 'box_reader.cc', + 'box_reader.h', + 'box_writer.h', + 'cenc.cc', + 'cenc.h', + 'chunk_info_iterator.cc', + 'chunk_info_iterator.h', + 'composition_offset_iterator.cc', + 'composition_offset_iterator.h', + 'decoding_time_iterator.cc', + 'decoding_time_iterator.h', + 'es_descriptor.cc', + 'es_descriptor.h', + 'fourccs.h', + 'mp4_fragmenter.cc', + 'mp4_fragmenter.h', + 'mp4_general_segmenter.cc', + 'mp4_general_segmenter.h', + 'mp4_media_parser.cc', + 'mp4_media_parser.h', + 'mp4_muxer.cc', + 'mp4_muxer.h', + 'mp4_segmenter.cc', + 'mp4_segmenter.h', + 'mp4_vod_segmenter.cc', + 'mp4_vod_segmenter.h', + 'offset_byte_queue.cc', + 'offset_byte_queue.h', + 'rcheck.h', + 'sync_sample_iterator.cc', + 'sync_sample_iterator.h', + 'track_run_iterator.cc', + 'track_run_iterator.h', + ], + 'dependencies': [ + '../base/media_base.gyp:base', + ], + }, + { + 'target_name': 'mp4_unittest', + 'type': '<(gtest_target_type)', + 'sources': [ + 'aac_audio_specific_config_unittest.cc', + 'box_definitions_unittest.cc', + 'box_reader_unittest.cc', + 'chunk_info_iterator_unittest.cc', + 'composition_offset_iterator_unittest.cc', + 'decoding_time_iterator_unittest.cc', + 'es_descriptor_unittest.cc', + 'mp4_media_parser_unittest.cc', + 'offset_byte_queue_unittest.cc', + 'sync_sample_iterator_unittest.cc', + 'track_run_iterator_unittest.cc', + ], + 'dependencies': [ + '../../testing/gtest.gyp:gtest', + '../../testing/gmock.gyp:gmock', + '../test/media_test.gyp:media_test_support', + 'mp4', + ] + }, + ], +} diff --git a/media/test/media_test.gyp b/media/test/media_test.gyp new file mode 100644 index 0000000000..bdd5a3ed89 --- /dev/null +++ b/media/test/media_test.gyp @@ -0,0 +1,26 @@ +# Copyright (c) 2013 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'target_defaults': { + 'include_dirs': [ + '../..', + ], + }, + 'targets': [ + { + 'target_name': 'media_test_support', + 'type': '<(component)', + 'sources': [ + 'run_tests_with_atexit_manager.cc', + 'test_data_util.cc', + 'test_data_util.h', + ], + 'dependencies': [ + '../../base/base.gyp:base', + '../../testing/gtest.gyp:gtest', + ], + }, + ], +} diff --git a/mpd/mpd.gyp b/mpd/mpd.gyp index f65156bc85..a41c7e0f06 100644 --- a/mpd/mpd.gyp +++ b/mpd/mpd.gyp @@ -61,7 +61,7 @@ 'dependencies': [ '../base/base.gyp:base', '../base/base.gyp:run_all_unittests', - '../packager.gyp:file', + '../media/file/file.gyp:file', '../testing/gtest.gyp:gtest', 'mpd_builder', 'mpd_util', @@ -75,7 +75,7 @@ 'util/mpd_writer.h', ], 'dependencies': [ - '../packager.gyp:file', + '../media/file/file.gyp:file', 'mpd_builder', ], }, diff --git a/packager.gyp b/packager.gyp index b9d0cc1146..ed473cd684 100644 --- a/packager.gyp +++ b/packager.gyp @@ -1,7 +1,6 @@ # Copyright (c) 2013 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# TODO(kqyang): this file should be in media directory. { 'target_defaults': { 'include_dirs': [ @@ -9,296 +8,19 @@ ], }, 'targets': [ - { - 'target_name': 'httpfetcher', - 'type': 'static_library', - 'sources': [ - 'media/base/httpfetcher.cc', - 'media/base/httpfetcher.h', - 'media/base/status.cc', - ], - 'cflags!': [ '-fno-exceptions' ], - 'cflags_cc!': [ '-fno-exceptions' ], - 'conditions': [ - ['OS=="mac"', { - 'xcode_settings': { - 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES' - } - }] - ], - 'dependencies': [ - 'third_party/happyhttp/happyhttp.gyp:happyhttp_lib', - ], - }, - { - # Note that this test performs real http requests to a http server. - 'target_name': 'httpfetcher_unittest', - 'type': 'executable', - 'sources': [ - 'media/base/httpfetcher_unittest.cc', - ], - 'dependencies': [ - 'base/base.gyp:base', - 'httpfetcher', - 'testing/gtest.gyp:gtest', - 'testing/gtest.gyp:gtest_main', - ], - }, - { - 'target_name': 'media_base', - 'type': 'static_library', - 'sources': [ - 'media/base/aes_encryptor.cc', - 'media/base/aes_encryptor.h', - 'media/base/audio_stream_info.cc', - 'media/base/audio_stream_info.h', - 'media/base/bit_reader.cc', - 'media/base/bit_reader.h', - 'media/base/buffers.h', - 'media/base/buffer_reader.cc', - 'media/base/buffer_reader.h', - 'media/base/buffer_writer.cc', - 'media/base/buffer_writer.h', - 'media/base/byte_queue.cc', - 'media/base/byte_queue.h', - 'media/base/container_names.cc', - 'media/base/container_names.h', - # TODO(kqyang): demuxer should not be here, it looks like some kinds of - # circular dependencies. - 'media/base/demuxer.cc', - 'media/base/demuxer.h', - 'media/base/decrypt_config.cc', - 'media/base/decrypt_config.h', - 'media/base/decryptor_source.h', - 'media/base/encryptor_source.cc', - 'media/base/encryptor_source.h', - 'media/base/fixed_encryptor_source.cc', - 'media/base/fixed_encryptor_source.h', - 'media/base/limits.h', - 'media/base/media_parser.h', - 'media/base/media_sample.cc', - 'media/base/media_sample.h', - 'media/base/media_stream.cc', - 'media/base/media_stream.h', - 'media/base/muxer.cc', - 'media/base/muxer.h', - 'media/base/muxer_options.cc', - 'media/base/muxer_options.h', - 'media/base/request_signer.cc', - 'media/base/request_signer.h', - 'media/base/rsa_key.cc', - 'media/base/rsa_key.h', - 'media/base/status.cc', - 'media/base/status.h', - 'media/base/stream_info.cc', - 'media/base/stream_info.h', - 'media/base/text_track.h', - 'media/base/video_stream_info.cc', - 'media/base/video_stream_info.h', - 'media/base/widevine_encryptor_source.cc', - 'media/base/widevine_encryptor_source.h', - ], - 'dependencies': [ - 'base/base.gyp:base', - 'httpfetcher', - 'third_party/openssl/openssl.gyp:openssl', - ], - }, - { - 'target_name': 'media_test_support', - 'type': 'static_library', - 'sources': [ - 'media/test/run_tests_with_atexit_manager.cc', - 'media/test/test_data_util.cc', - 'media/test/test_data_util.h', - ], - 'dependencies': [ - 'base/base.gyp:base', - 'testing/gtest.gyp:gtest', - ], - }, - { - 'target_name': 'media_base_unittest', - 'type': 'executable', - 'sources': [ - 'media/base/aes_encryptor_unittest.cc', - 'media/base/bit_reader_unittest.cc', - 'media/base/buffer_writer_unittest.cc', - 'media/base/container_names_unittest.cc', - 'media/base/fake_prng.cc', # For rsa_key_unittest - 'media/base/fake_prng.h', # For rsa_key_unittest - 'media/base/rsa_key_unittest.cc', - 'media/base/rsa_test_data.cc', # For rsa_key_unittest - 'media/base/rsa_test_data.h', # For rsa_key_unittest - 'media/base/status_test_util.h', - 'media/base/status_test_util_unittest.cc', - 'media/base/status_unittest.cc', - ], - 'dependencies': [ - 'file', - 'media_base', - 'media_test_support', - 'testing/gtest.gyp:gtest', - 'testing/gmock.gyp:gmock', - ], - }, - { - 'target_name': 'mp4', - 'type': 'static_library', - 'sources': [ - 'media/mp4/aac_audio_specific_config.cc', - 'media/mp4/aac_audio_specific_config.h', - 'media/mp4/box.cc', - 'media/mp4/box.h', - 'media/mp4/box_buffer.h', - 'media/mp4/box_definitions.cc', - 'media/mp4/box_definitions.h', - 'media/mp4/box_reader.cc', - 'media/mp4/box_reader.h', - 'media/mp4/box_writer.h', - 'media/mp4/cenc.cc', - 'media/mp4/cenc.h', - 'media/mp4/chunk_info_iterator.cc', - 'media/mp4/chunk_info_iterator.h', - 'media/mp4/composition_offset_iterator.cc', - 'media/mp4/composition_offset_iterator.h', - 'media/mp4/decoding_time_iterator.cc', - 'media/mp4/decoding_time_iterator.h', - 'media/mp4/es_descriptor.cc', - 'media/mp4/es_descriptor.h', - 'media/mp4/fourccs.h', - 'media/mp4/mp4_fragmenter.cc', - 'media/mp4/mp4_fragmenter.h', - 'media/mp4/mp4_general_segmenter.cc', - 'media/mp4/mp4_general_segmenter.h', - 'media/mp4/mp4_media_parser.cc', - 'media/mp4/mp4_media_parser.h', - 'media/mp4/mp4_muxer.cc', - 'media/mp4/mp4_muxer.h', - 'media/mp4/mp4_segmenter.cc', - 'media/mp4/mp4_segmenter.h', - 'media/mp4/mp4_vod_segmenter.cc', - 'media/mp4/mp4_vod_segmenter.h', - 'media/mp4/offset_byte_queue.cc', - 'media/mp4/offset_byte_queue.h', - 'media/mp4/rcheck.h', - 'media/mp4/sync_sample_iterator.cc', - 'media/mp4/sync_sample_iterator.h', - 'media/mp4/track_run_iterator.cc', - 'media/mp4/track_run_iterator.h', - ], - 'dependencies': [ - 'media_base', - ], - }, - { - 'target_name': 'mp4_unittest', - 'type': 'executable', - 'sources': [ - 'media/mp4/aac_audio_specific_config_unittest.cc', - 'media/mp4/box_definitions_unittest.cc', - 'media/mp4/box_reader_unittest.cc', - 'media/mp4/chunk_info_iterator_unittest.cc', - 'media/mp4/composition_offset_iterator_unittest.cc', - 'media/mp4/decoding_time_iterator_unittest.cc', - 'media/mp4/es_descriptor_unittest.cc', - 'media/mp4/mp4_media_parser_unittest.cc', - 'media/mp4/offset_byte_queue_unittest.cc', - 'media/mp4/sync_sample_iterator_unittest.cc', - 'media/mp4/track_run_iterator_unittest.cc', - ], - 'dependencies': [ - 'media_test_support', - 'mp4', - 'testing/gtest.gyp:gtest', - 'testing/gmock.gyp:gmock', - ] - }, - { - 'target_name': 'file', - 'type': 'static_library', - 'sources': [ - 'media/file/file.cc', - 'media/file/file.h', - 'media/file/file_closer.h', - 'media/file/local_file.cc', - 'media/file/local_file.h', - ], - 'dependencies': [ - 'base/base.gyp:base', - ], - }, - { - 'target_name': 'file_unittest', - 'type': 'executable', - 'sources': [ - 'media/file/file_unittest.cc', - ], - 'dependencies': [ - 'file', - 'testing/gtest.gyp:gtest', - 'testing/gtest.gyp:gtest_main', - ], - }, - { - 'target_name': 'packager_test', - 'type': 'executable', - 'sources': [ - 'media/test/packager_test.cc', - ], - 'dependencies': [ - 'file', - 'media_test_support', - 'mp4', - 'testing/gtest.gyp:gtest', - ], - }, - { - 'target_name': 'media_event', - 'type': '<(component)', - 'sources': [ - 'media/event/muxer_listener.h', - 'media/event/vod_media_info_dump_muxer_listener.cc', - 'media/event/vod_media_info_dump_muxer_listener.h', - 'media/event/vod_mpd_notify_muxer_listener.cc', - 'media/event/vod_mpd_notify_muxer_listener.h', - 'media/event/vod_muxer_listener_internal.cc', - 'media/event/vod_muxer_listener_internal.h', - ], - 'dependencies': [ - 'media_base', - 'mpd/mpd.gyp:media_info_proto', - # Depends on full protobuf to read/write with TextFormat. - 'third_party/protobuf/protobuf.gyp:protobuf_full_do_not_use', - ], - }, - { - 'target_name': 'media_event_unittest', - 'type': '<(gtest_target_type)', - 'sources': [ - 'media/event/vod_media_info_dump_muxer_listener_unittest.cc', - ], - 'dependencies': [ - 'base/base.gyp:base', - 'base/base.gyp:run_all_unittests', - 'file', - 'media_event', - 'mpd/mpd.gyp:media_info_proto', - 'testing/gtest.gyp:gtest', - # Depends on full protobuf to read/write with TextFormat. - 'third_party/protobuf/protobuf.gyp:protobuf_full_do_not_use', - ], - }, { 'target_name': 'packager_main', 'type': 'executable', 'sources': [ + 'app/fixed_key_encryption_flags.h', + 'app/muxer_flags.h', 'app/packager_main.cc', + 'app/widevine_encryption_flags.h', ], 'dependencies': [ - 'file', - 'media_event', - 'mp4', + 'media/event/media_event.gyp:media_event', + 'media/file/file.gyp:file', + 'media/mp4/mp4.gyp:mp4', 'third_party/gflags/gflags.gyp:gflags', ], }, @@ -315,5 +37,41 @@ 'third_party/gflags/gflags.gyp:gflags', ], }, + { + 'target_name': 'packager_test', + 'type': '<(gtest_target_type)', + 'sources': [ + 'media/test/packager_test.cc', + ], + 'dependencies': [ + 'media/file/file.gyp:file', + 'media/mp4/mp4.gyp:mp4', + 'media/test/media_test.gyp:media_test_support', + 'testing/gtest.gyp:gtest', + ], + }, + { + 'target_name': 'All', + 'type': 'none', + 'dependencies': [ + 'media/base/media_base.gyp:*', + 'media/event/media_event.gyp:*', + 'media/file/file.gyp:*', + 'media/mp4/mp4.gyp:*', + 'mpd/mpd.gyp:*', + ], + }, + { + 'target_name': 'packager_builder_tests', + 'type': 'none', + 'dependencies': [ + 'media/base/media_base.gyp:media_base_unittest', + 'media/event/media_event.gyp:media_event_unittest', + 'media/file/file.gyp:file_unittest', + 'media/mp4/mp4.gyp:mp4_unittest', + 'mpd/mpd.gyp:mpd_unittest', + 'packager_test', + ], + }, ], }