summaryrefslogtreecommitdiffstats
path: root/chromecast/media/media.gyp
blob: 71074a22eaead2e4f79be02d9dcbc40c37377dc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

{
  'variables': {
    'chromium_code': 1,
    'chromecast_branding%': 'public',
    'use_alsa%': 0,

    # Set true if the ALSA library being used supports raw timestamps
    'use_alsa_monotonic_raw_tstamps%': 0,
  },
  'target_defaults': {
    'include_dirs': [
      '../..',  # Root of Chromium checkout
      '../public/',  # Public APIs
    ],
  },
  'targets': [
    {
      'target_name': 'media_audio',
      'type': '<(component)',
      'dependencies': [
        '../../media/media.gyp:media',
      ],
      'sources': [
        'audio/cast_audio_manager.cc',
        'audio/cast_audio_manager.h',
        'audio/cast_audio_manager_factory.cc',
        'audio/cast_audio_manager_factory.h',
        'audio/cast_audio_output_stream.cc',
        'audio/cast_audio_output_stream.h',
      ],
    },
    {
      'target_name': 'media_base',
      'type': '<(component)',
      'dependencies': [
        'libcast_media_1.0',
        '../../base/base.gyp:base',
        '../../crypto/crypto.gyp:crypto',
        '../../third_party/widevine/cdm/widevine_cdm.gyp:widevine_cdm_version_h',
      ],
      'sources': [
        'base/decrypt_context_impl.cc',
        'base/decrypt_context_impl.h',
        'base/decrypt_context_impl_clearkey.cc',
        'base/decrypt_context_impl_clearkey.h',
        'base/key_systems_common.cc',
        'base/key_systems_common.h',
        'base/media_caps.cc',
        'base/media_caps.h',
        'base/media_codec_support.cc',
        'base/media_codec_support.h',
        'base/media_message_loop.cc',
        'base/media_message_loop.h',
        'base/video_plane_controller.cc',
        'base/video_plane_controller.h',
      ],
      'conditions': [
        ['chromecast_branding!="public"', {
          'dependencies': [
            '../internal/chromecast_internal.gyp:media_base_internal',
          ],
        }, {
          'sources': [
            'base/key_systems_common_simple.cc',
          ],
        }],
      ],
    },
    {
      'target_name': 'media_cdm',
      'type': '<(component)',
      'dependencies': [
        'media_base',
        '../../base/base.gyp:base',
        '../../media/media.gyp:media',
      ],
      'sources': [
        'cdm/browser_cdm_cast.cc',
        'cdm/browser_cdm_cast.h',
        'cdm/chromecast_init_data.cc',
        'cdm/chromecast_init_data.h',
      ],
      'conditions': [
        ['use_playready==1', {
          'sources': [
            'cdm/playready_drm_delegate_android.cc',
            'cdm/playready_drm_delegate_android.h',
          ],
        }],
      ],
    },
    {
      'target_name': 'cma_base',
      'type': '<(component)',
      'dependencies': [
        '../chromecast.gyp:cast_base',
        '../../base/base.gyp:base',
        '../../media/media.gyp:media',
      ],
      'include_dirs': [
        '../..',
      ],
      'sources': [
        'cma/base/balanced_media_task_runner_factory.cc',
        'cma/base/balanced_media_task_runner_factory.h',
        'cma/base/buffering_controller.cc',
        'cma/base/buffering_controller.h',
        'cma/base/buffering_defs.cc',
        'cma/base/buffering_defs.h',
        'cma/base/buffering_frame_provider.cc',
        'cma/base/buffering_frame_provider.h',
        'cma/base/buffering_state.cc',
        'cma/base/buffering_state.h',
        'cma/base/cast_decrypt_config_impl.cc',
        'cma/base/cast_decrypt_config_impl.h',
        'cma/base/cma_logging.h',
        'cma/base/coded_frame_provider.cc',
        'cma/base/coded_frame_provider.h',
        'cma/base/decoder_buffer_adapter.cc',
        'cma/base/decoder_buffer_adapter.h',
        'cma/base/decoder_config_adapter.cc',
        'cma/base/decoder_config_adapter.h',
        'cma/base/demuxer_stream_adapter.cc',
        'cma/base/demuxer_stream_adapter.h',
        'cma/base/media_task_runner.cc',
        'cma/base/media_task_runner.h',
        'cma/base/simple_media_task_runner.cc',
        'cma/base/simple_media_task_runner.h',
      ],
    },
    {
      'target_name': 'default_cma_backend',
      'type': '<(component)',
      'dependencies': [
        '../../base/base.gyp:base',
      ],
      'include_dirs': [
        '../..',
      ],
      'sources': [
        'cma/backend/audio_decoder_default.cc',
        'cma/backend/audio_decoder_default.h',
        'cma/backend/media_pipeline_backend_default.cc',
        'cma/backend/media_pipeline_backend_default.h',
        'cma/backend/video_decoder_default.cc',
        'cma/backend/video_decoder_default.h',
      ],
    },
    {
      'target_name': 'cma_decoder',
      'type': '<(component)',
      'dependencies': [
        'cma_base',
        '../../base/base.gyp:base',
        '../../media/media.gyp:media',
      ],
      'sources': [
        'cma/decoder/cast_audio_decoder.h',
        'cma/decoder/cast_audio_decoder_android.cc',
        'cma/decoder/cast_audio_decoder_linux.cc',
      ],
    },
    {
      'target_name': 'cma_ipc',
      'type': '<(component)',
      'dependencies': [
        '../../base/base.gyp:base',
      ],
      'sources': [
        'cma/ipc/media_memory_chunk.cc',
        'cma/ipc/media_memory_chunk.h',
        'cma/ipc/media_message.cc',
        'cma/ipc/media_message.h',
        'cma/ipc/media_message_fifo.cc',
        'cma/ipc/media_message_fifo.h',
      ],
    },
    {
      'target_name': 'cma_ipc_streamer',
      'type': '<(component)',
      'dependencies': [
        '../../base/base.gyp:base',
        '../../media/media.gyp:media',
        'cma_base',
      ],
      'sources': [
        'cma/ipc_streamer/audio_decoder_config_marshaller.cc',
        'cma/ipc_streamer/audio_decoder_config_marshaller.h',
        'cma/ipc_streamer/av_streamer_proxy.cc',
        'cma/ipc_streamer/av_streamer_proxy.h',
        'cma/ipc_streamer/coded_frame_provider_host.cc',
        'cma/ipc_streamer/coded_frame_provider_host.h',
        'cma/ipc_streamer/decoder_buffer_base_marshaller.cc',
        'cma/ipc_streamer/decoder_buffer_base_marshaller.h',
        'cma/ipc_streamer/decrypt_config_marshaller.cc',
        'cma/ipc_streamer/decrypt_config_marshaller.h',
        'cma/ipc_streamer/video_decoder_config_marshaller.cc',
        'cma/ipc_streamer/video_decoder_config_marshaller.h',
      ],
    },
    {
      'target_name': 'cma_pipeline',
      'type': '<(component)',
      'dependencies': [
        'cma_base',
        'cma_decoder',
        'media_base',
        'media_cdm',
        '../../base/base.gyp:base',
        '../../crypto/crypto.gyp:crypto',
        '../../media/media.gyp:media',
        '../../third_party/boringssl/boringssl.gyp:boringssl',
      ],
      'sources': [
        'cma/pipeline/audio_decoder_software_wrapper.cc',
        'cma/pipeline/audio_decoder_software_wrapper.h',
        'cma/pipeline/audio_pipeline_impl.cc',
        'cma/pipeline/audio_pipeline_impl.h',
        'cma/pipeline/av_pipeline_client.cc',
        'cma/pipeline/av_pipeline_client.h',
        'cma/pipeline/av_pipeline_impl.cc',
        'cma/pipeline/av_pipeline_impl.h',
        'cma/pipeline/decrypt_util.cc',
        'cma/pipeline/decrypt_util.h',
        'cma/pipeline/load_type.h',
        'cma/pipeline/media_pipeline_client.cc',
        'cma/pipeline/media_pipeline_client.h',
        'cma/pipeline/media_pipeline_impl.cc',
        'cma/pipeline/media_pipeline_impl.h',
        'cma/pipeline/video_pipeline_client.cc',
        'cma/pipeline/video_pipeline_client.h',
        'cma/pipeline/video_pipeline_impl.cc',
        'cma/pipeline/video_pipeline_impl.h',
      ],
    },
    {
      'target_name': 'cast_media',
      'type': 'none',
      'dependencies': [
        'cma_base',
        'cma_ipc',
        'cma_ipc_streamer',
        'cma_pipeline',
        'default_cma_backend',
        'media_audio',
        'media_cdm',
      ],
    },
    {
      'target_name': 'cast_media_unittests',
      'type': '<(gtest_target_type)',
      'dependencies': [
        'cast_media',
        '../../base/base.gyp:base',
        '../../base/base.gyp:base_i18n',
        '../../base/base.gyp:test_support_base',
        '../../chromecast/chromecast.gyp:cast_metrics_test_support',
        '../../gpu/gpu.gyp:gpu_unittest_utils',
        '../../media/media.gyp:media_test_support',
        '../../testing/gmock.gyp:gmock',
        '../../testing/gtest.gyp:gtest',
        '../../testing/gtest.gyp:gtest_main',
        '../../ui/gfx/gfx.gyp:gfx_test_support',
      ],
      'sources': [
        'audio/cast_audio_output_stream_unittest.cc',
        'cdm/chromecast_init_data_unittest.cc',
        'cma/backend/audio_video_pipeline_device_unittest.cc',
        'cma/base/balanced_media_task_runner_unittest.cc',
        'cma/base/buffering_controller_unittest.cc',
        'cma/base/buffering_frame_provider_unittest.cc',
        'cma/base/demuxer_stream_adapter_unittest.cc',
        'cma/base/demuxer_stream_for_test.cc',
        'cma/base/demuxer_stream_for_test.h',
        'cma/base/multi_demuxer_stream_adapter_unittest.cc',
        'cma/ipc/media_message_fifo_unittest.cc',
        'cma/ipc/media_message_unittest.cc',
        'cma/ipc_streamer/av_streamer_unittest.cc',
        'cma/pipeline/audio_video_pipeline_impl_unittest.cc',
        'cma/test/frame_generator_for_test.cc',
        'cma/test/frame_generator_for_test.h',
        'cma/test/frame_segmenter_for_test.cc',
        'cma/test/frame_segmenter_for_test.h',
        'cma/test/mock_frame_consumer.cc',
        'cma/test/mock_frame_consumer.h',
        'cma/test/mock_frame_provider.cc',
        'cma/test/mock_frame_provider.h',
        'cma/test/run_all_unittests.cc',
      ],
      'ldflags': [
        # Allow  OEMs to override default libraries that are shipped with
        # cast receiver package by installed OEM-specific libraries in
        # /oem_cast_shlib.
        '-Wl,-rpath=/oem_cast_shlib',
        # Some shlibs are built in same directory of executables.
        '-Wl,-rpath=\$$ORIGIN',
      ],
      'conditions': [
        ['chromecast_branding=="public"', {
          'dependencies': [
            # Link default libcast_media_1.0 statically not to link dummy one
            # dynamically for public unittests.
            'libcast_media_1.0_default_core',
          ],
        }],
      ],
    },
    { # Target for OEM partners to override media shared library, i.e.
      # libcast_media_1.0.so. This target is only used to build executables
      # with correct linkage information.
      'target_name': 'libcast_media_1.0',
      'type': 'shared_library',
      'dependencies': [
        '../../chromecast/chromecast.gyp:cast_public_api',
      ],
      'sources': [
        'base/cast_media_dummy.cc',
      ],
    },
    { # This target can be statically linked into unittests, but production
      # binaries should not depend on this target.
      'target_name': 'libcast_media_1.0_default_core',
      'type': '<(component)',
      'dependencies': [
        '../../chromecast/chromecast.gyp:cast_public_api',
        'default_cma_backend'
      ],
      'sources': [
        'base/cast_media_default.cc',
      ],
    },
    { # Default implementation of libcast_media_1.0.so.
      'target_name': 'libcast_media_1.0_default',
      'type': 'loadable_module',
      # Cannot depend on libcast_media_1.0_default_core since a loadable_module
      # include only symbols necessary for source files. So, it should include
      # top-level .cc, here cast_media_default.cc explicitly.
      'dependencies': [
        '../../chromecast/chromecast.gyp:cast_public_api',
        'default_cma_backend'
      ],
      'sources': [
        'base/cast_media_default.cc',
      ],
    },
    { # Alsa implementation of CMA backend.
      'target_name': 'alsa_cma_backend',
      'type': '<(component)',
      'dependencies': [
        'chromecast_alsa_features',
        'cma_base',
        'cma_decoder',
        'default_cma_backend',
        '<(DEPTH)/base/base.gyp:base',
        '<(DEPTH)/chromecast/chromecast.gyp:cast_base',
        '<(DEPTH)/chromecast/chromecast.gyp:cast_public_api',
        '<(DEPTH)/media/media.gyp:media',
      ],
      'sources': [
        'cma/backend/alsa/alsa_wrapper.cc',
        'cma/backend/alsa/alsa_wrapper.h',
        'cma/backend/alsa/audio_decoder_alsa.cc',
        'cma/backend/alsa/audio_decoder_alsa.h',
        'cma/backend/alsa/media_pipeline_backend_alsa.cc',
        'cma/backend/alsa/media_pipeline_backend_alsa.h',
        'cma/backend/alsa/stream_mixer_alsa.cc',
        'cma/backend/alsa/stream_mixer_alsa.h',
        'cma/backend/alsa/stream_mixer_alsa_input.cc',
        'cma/backend/alsa/stream_mixer_alsa_input.h',
        'cma/backend/alsa/stream_mixer_alsa_input_impl.cc',
        'cma/backend/alsa/stream_mixer_alsa_input_impl.h',
      ],
    },  # end of target 'alsa_cma_backend'
    {
      # GN target: //chromecast/media/cma/backend/alsa:alsa_features
      'target_name': 'chromecast_alsa_features',
      'includes': [ '../../build/buildflag_header.gypi' ],
      'variables': {
        'buildflag_header_path': 'chromecast/media/cma/backend/alsa/alsa_features.h',
        'buildflag_flags': [
          'ALSA_MONOTONIC_RAW_TSTAMPS=<(use_alsa_monotonic_raw_tstamps)',
        ]
      }
    },  # end of target 'alsa_features'
    { # Alsa implementation of libcast_media_1.0.
      'target_name': 'libcast_media_1.0_audio',
      'type': 'loadable_module',
      'dependencies': [
        'alsa_cma_backend',
        '<(DEPTH)/base/base.gyp:base',
        '<(DEPTH)/chromecast/chromecast.gyp:cast_base',
        '<(DEPTH)/chromecast/chromecast.gyp:cast_public_api',
        '<(DEPTH)/chromecast/media/media.gyp:default_cma_backend',
      ],
      'sources': [
        'cma/backend/alsa/cast_media_shlib.cc',
        'cma/backend/alsa/media_codec_support_cast_audio.cc',
        # NOTE: can't depend on media_base because that pulls in libcast_media.
        '<(DEPTH)/chromecast/media/base/media_caps.cc',
        '<(DEPTH)/chromecast/media/base/media_caps.h',
      ],
    },  # end of target 'libcast_media_1.0_audio'
  ],  # end of targets
  'conditions': [
    ['use_alsa==1', {
      'targets': [
        {
          'target_name': 'alsa_cma_backend_unittests',
          'type': '<(gtest_target_type)',
          'dependencies': [
            'alsa_cma_backend',
            '<(DEPTH)/base/base.gyp:run_all_unittests',
            '<(DEPTH)/testing/gmock.gyp:gmock',
            '<(DEPTH)/testing/gtest.gyp:gtest',
           ],
          'sources': [
            'cma/backend/alsa/mock_alsa_wrapper.cc',
            'cma/backend/alsa/mock_alsa_wrapper.h',
            'cma/backend/alsa/stream_mixer_alsa_unittest.cc',
          ],
        },  # end of target 'alsa_cma_backend_unittests'
      ],  # end of targets
    }],
  ],  # end of conditions
}