GN: Implement video_engine, video_capture and video_render.

Also add more from common.gypi to webrtc.gni.

These GN configs are based on GYP files in r6997.

BUG=3441
TEST=Trybots and local compile using:
gn gen out/Default --args="build_with_chromium=false" && ninja -C out/Default
gn gen out/Default --args="build_with_chromium=false is_debug=true" && ninja -C out/Default

Passed compile from a Chromium checkout with src/third_party/webrtc linked to the webrtc/ dir of a checkout with this patch applied.

R=brettw@chromium.org, glaznev@webrtc.org, mflodman@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/18709004

git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@6999 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/build/webrtc.gni b/build/webrtc.gni
index fcbf04f..5b3fe18 100644
--- a/build/webrtc.gni
+++ b/build/webrtc.gni
@@ -12,14 +12,6 @@
   build_with_chromium = true
   build_with_libjingle = true
 
-  if (build_with_libjingle) {
-    include_tests = false
-    restrict_webrtc_logging = true
-  } else {
-    include_tests = true
-    restrict_webrtc_logging = false
-  }
-
   # Adds video support to dependencies shared by voice and video engine.
   # This should normally be enabled; the intended use is to disable only
   # when building voice engine exclusively.
@@ -59,6 +51,41 @@
 
   enable_android_opensl = true
 
+  if (build_with_chromium) {
+    # Exclude pulse audio on Chromium since its prerequisites don't require
+    # pulse audio.
+    include_pulse_audio = false
+
+    # Exclude internal ADM since Chromium uses its own IO handling.
+    include_internal_audio_device = false
+
+    # Exclude internal VCM in Chromium build.
+    include_internal_video_capture = false
+
+    # Exclude internal video render module in Chromium build.
+    include_internal_video_render = false
+  } else {
+    # Settings for the standalone (not-in-Chromium) build.
+
+    # TODO(andrew): For now, disable the Chrome plugins, which causes a
+    # flood of chromium-style warnings. Investigate enabling them:
+    # http://code.google.com/p/webrtc/issues/detail?id=163
+    clang_use_chrome_plugins = false
+
+    include_pulse_audio = true
+    include_internal_audio_device = true
+    include_internal_video_capture = true
+    include_internal_video_render = true
+  }
+
+  if (build_with_libjingle) {
+    include_tests = false
+    restrict_webrtc_logging = true
+  } else {
+    include_tests = true
+    restrict_webrtc_logging = false
+  }
+
   if (is_ios) {
     build_libjpeg = false
     enable_protobuf = false
diff --git a/modules/video_capture/BUILD.gn b/modules/video_capture/BUILD.gn
index fd3fe57..9c314ae 100644
--- a/modules/video_capture/BUILD.gn
+++ b/modules/video_capture/BUILD.gn
@@ -8,6 +8,132 @@
 
 import("../../build/webrtc.gni")
 
+config("video_capture_config") {
+  if (is_ios) {
+    libs = [
+      "AVFoundation.framework",
+      "CoreMedia.framework",
+      "CoreVideo.framework",
+    ]
+  }
+}
+
 source_set("video_capture") {
-  # TODO(glaznev): Implement.
+  sources = [
+    "device_info_impl.cc",
+    "device_info_impl.h",
+    "include/video_capture.h",
+    "include/video_capture_defines.h",
+    "include/video_capture_factory.h",
+    "video_capture_config.h",
+    "video_capture_delay.h",
+    "video_capture_factory.cc",
+    "video_capture_impl.cc",
+    "video_capture_impl.h",
+  ]
+
+  libs = []
+  deps = []
+
+  if (include_internal_video_capture) {
+    if (is_linux) {
+      sources += [
+        "linux/device_info_linux.cc",
+        "linux/device_info_linux.h",
+        "linux/video_capture_linux.cc",
+        "linux/video_capture_linux.h",
+      ]
+    }
+    if (is_mac) {
+      sources += [
+        "mac/qtkit/video_capture_qtkit.h",
+        "mac/qtkit/video_capture_qtkit.mm",
+        "mac/qtkit/video_capture_qtkit_info.h",
+        "mac/qtkit/video_capture_qtkit_info.mm",
+        "mac/qtkit/video_capture_qtkit_info_objc.h",
+        "mac/qtkit/video_capture_qtkit_info_objc.mm",
+        "mac/qtkit/video_capture_qtkit_objc.h",
+        "mac/qtkit/video_capture_qtkit_objc.mm",
+        "mac/qtkit/video_capture_qtkit_utility.h",
+        "mac/video_capture_mac.mm",
+      ]
+
+      libs += [
+        "CoreVideo.framework",
+        "QTKit.framework",
+      ]
+    }
+    if (is_win) {
+      sources += [
+        "windows/device_info_ds.cc",
+        "windows/device_info_ds.h",
+        "windows/device_info_mf.cc",
+        "windows/device_info_mf.h",
+        "windows/help_functions_ds.cc",
+        "windows/help_functions_ds.h",
+        "windows/sink_filter_ds.cc",
+        "windows/sink_filter_ds.h",
+        "windows/video_capture_ds.cc",
+        "windows/video_capture_ds.h",
+        "windows/video_capture_factory_windows.cc",
+        "windows/video_capture_mf.cc",
+        "windows/video_capture_mf.h",
+      ]
+
+      libs += [ "Strmiids.lib" ]
+      deps += [ "//third_party/winsdk_samples"]
+    }
+    if (is_android) {
+      sources += [
+        "android/device_info_android.cc",
+        "android/device_info_android.h",
+        "android/video_capture_android.cc",
+        "android/video_capture_android.h",
+      ]
+
+      deps += [
+        "//third_party/icu:icuuc",
+        "//third_party/jsoncpp",
+      ]
+    }
+    if (is_ios) {
+      sources += [
+        "ios/device_info_ios.h",
+        "ios/device_info_ios.mm",
+        "ios/device_info_ios_objc.h",
+        "ios/device_info_ios_objc.mm",
+        "ios/rtc_video_capture_ios_objc.h",
+        "ios/rtc_video_capture_ios_objc.mm",
+        "ios/video_capture_ios.h",
+        "ios/video_capture_ios.mm",
+      ]
+
+      cflags += [
+        "-fobjc-arc",  # CLANG_ENABLE_OBJC_ARC = YES.
+        # To avoid warnings for deprecated videoMinFrameDuration and
+        # videoMaxFrameDuration properties in iOS 7.0.
+        # See webrtc:3705 for more details.
+        "-Wno-deprecated-declarations",
+      ]
+    }
+  } else {
+    sources += [
+      "external/device_info_external.cc",
+      "external/video_capture_external.cc",
+    ]
+  }
+
+  all_dependent_configs = [ ":video_capture_config"]
+
+  if (is_clang) {
+    # Suppress warnings from Chrome's Clang plugins.
+    # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
+    configs -= [ "//build/config/clang:find_bad_constructs" ]
+  }
+
+  deps += [
+    "../../common_video",
+    "../../system_wrappers",
+    "../utility",
+  ]
 }
diff --git a/modules/video_render/BUILD.gn b/modules/video_render/BUILD.gn
index c569b7f..fe9259c 100644
--- a/modules/video_render/BUILD.gn
+++ b/modules/video_render/BUILD.gn
@@ -8,6 +8,136 @@
 
 import("../../build/webrtc.gni")
 
+config("video_render_config") {
+  if (is_ios) {
+    libs = [
+      "OpenGLES.framework",
+      "QuartzCore.framework",
+    ]
+  }
+}
+
 source_set("video_render") {
-  # TODO(wuchengli): Implement.
+  sources = [
+    "external/video_render_external_impl.cc",
+    "external/video_render_external_impl.h",
+    "i_video_render.h",
+    "include/video_render.h",
+    "include/video_render_defines.h",
+    "incoming_video_stream.cc",
+    "incoming_video_stream.h",
+    "video_render_frames.cc",
+    "video_render_frames.h",
+    "video_render_impl.cc",
+    "video_render_impl.h",
+  ]
+
+  libs = []
+  deps = []
+
+  if (include_internal_video_render) {
+    defines += [ "WEBRTC_INCLUDE_INTERNAL_VIDEO_RENDER" ]
+
+    if (is_linux) {
+      sources += [
+        "linux/video_render_linux_impl.cc",
+        "linux/video_render_linux_impl.h",
+        "linux/video_x11_channel.cc",
+        "linux/video_x11_channel.h",
+        "linux/video_x11_render.cc",
+        "linux/video_x11_render.h",
+      ]
+
+      libs += [ "Xext" ]
+    }
+    if (is_mac) {
+      sources += [
+        "mac/cocoa_full_screen_window.h",
+        "mac/cocoa_full_screen_window.mm",
+        "mac/cocoa_render_view.h",
+        "mac/cocoa_render_view.mm",
+        "mac/video_render_agl.cc",
+        "mac/video_render_agl.h",
+        "mac/video_render_mac_carbon_impl.cc",
+        "mac/video_render_mac_carbon_impl.h",
+        "mac/video_render_mac_cocoa_impl.h",
+        "mac/video_render_mac_cocoa_impl.mm",
+        "mac/video_render_nsopengl.h",
+        "mac/video_render_nsopengl.mm",
+      ]
+
+      libs += [
+        "CoreVideo.framework",
+        "QTKit.framework",
+      ]
+    }
+    if (is_win) {
+      sources += [
+        "windows/i_video_render_win.h",
+        "windows/video_render_direct3d9.cc",
+        "windows/video_render_direct3d9.h",
+        "windows/video_render_windows_impl.cc",
+        "windows/video_render_windows_impl.h",
+      ]
+
+      directxsdk_exists =
+        (exec_script("//build/dir_exists.py",
+                     [ rebase_path("//third_party/directxsdk/files",
+                                   root_build_dir) ],
+                     "trim string") == "True")
+      if (directxsdk_exists) {
+        directxsdk_path = "//third_party/directxsdk/files"
+      } else {
+        directxsdk_path = getenv("DXSDK_DIR")
+      }
+      include_dirs = [ directxsdk_path +  "/Include" ]
+
+    }
+    if (is_android) {
+      sources += [
+        "android/video_render_android_impl.cc",
+        "android/video_render_android_impl.h",
+        "android/video_render_android_native_opengl2.cc",
+        "android/video_render_android_native_opengl2.h",
+        "android/video_render_android_surface_view.cc",
+        "android/video_render_android_surface_view.h",
+        "android/video_render_opengles20.cc",
+        "android/video_render_opengles20.h",
+      ]
+
+      libs += [ "GLESv2" ]
+    }
+    if (is_ios) {
+      sources += [
+        "ios/open_gles20.h",
+        "ios/open_gles20.mm",
+        "ios/video_render_ios_channel.h",
+        "ios/video_render_ios_channel.mm",
+        "ios/video_render_ios_gles20.h",
+        "ios/video_render_ios_gles20.mm",
+        "ios/video_render_ios_impl.h",
+        "ios/video_render_ios_impl.mm",
+        "ios/video_render_ios_view.h",
+        "ios/video_render_ios_view.mm",
+      ]
+    }
+  }
+
+  all_dependent_configs = [ ":video_render_config"]
+
+  if (is_ios) {
+    cflags += [ "-fobjc-arc" ]  # CLANG_ENABLE_OBJC_ARC = YES.
+  }
+
+  if (is_clang) {
+    # Suppress warnings from Chrome's Clang plugins.
+    # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
+    configs -= [ "//build/config/clang:find_bad_constructs" ]
+  }
+
+  deps += [
+    "../../common_video",
+    "../../system_wrappers",
+    "../utility",
+  ]
 }
diff --git a/video/BUILD.gn b/video/BUILD.gn
index 18c43f9..121e754 100644
--- a/video/BUILD.gn
+++ b/video/BUILD.gn
@@ -9,6 +9,28 @@
 import("../build/webrtc.gni")
 
 source_set("video") {
-  # TODO(pbos): Implement when video_engine_core is done.
+  sources = [
+    "call.cc",
+    "encoded_frame_callback_adapter.cc",
+    "encoded_frame_callback_adapter.h",
+    "receive_statistics_proxy.cc",
+    "receive_statistics_proxy.h",
+    "send_statistics_proxy.cc",
+    "send_statistics_proxy.h",
+    "transport_adapter.cc",
+    "transport_adapter.h",
+    "video_receive_stream.cc",
+    "video_receive_stream.h",
+    "video_send_stream.cc",
+    "video_send_stream.h",
+  ]
+
+  if (is_clang) {
+    # Suppress warnings from Chrome's Clang plugins.
+    # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
+    configs -= [ "//build/config/clang:find_bad_constructs" ]
+  }
+
+  deps = [ "../video_engine:video_engine_core" ]
 }
 
diff --git a/video_engine/BUILD.gn b/video_engine/BUILD.gn
index c93833a..1b76776 100644
--- a/video_engine/BUILD.gn
+++ b/video_engine/BUILD.gn
@@ -13,5 +13,102 @@
 }
 
 source_set("video_engine_core") {
-  # TODO(pbos): Implement.
+  sources = [
+    "include/vie_base.h",
+    "include/vie_capture.h",
+    "include/vie_codec.h",
+    "include/vie_errors.h",
+    "include/vie_external_codec.h",
+    "include/vie_image_process.h",
+    "include/vie_network.h",
+    "include/vie_render.h",
+    "include/vie_rtp_rtcp.h",
+    "call_stats.cc",
+    "call_stats.h",
+    "encoder_state_feedback.cc",
+    "encoder_state_feedback.h",
+    "overuse_frame_detector.cc",
+    "overuse_frame_detector.h",
+    "stream_synchronization.cc",
+    "stream_synchronization.h",
+    "vie_base_impl.cc",
+    "vie_base_impl.h",
+    "vie_capture_impl.cc",
+    "vie_capture_impl.h",
+    "vie_capturer.cc",
+    "vie_capturer.h",
+    "vie_channel.cc",
+    "vie_channel_group.cc",
+    "vie_channel_group.h",
+    "vie_channel.h",
+    "vie_channel_manager.cc",
+    "vie_channel_manager.h",
+    "vie_codec_impl.cc",
+    "vie_codec_impl.h",
+    "vie_defines.h",
+    "vie_encoder.cc",
+    "vie_encoder.h",
+    "vie_external_codec_impl.cc",
+    "vie_external_codec_impl.h",
+    "vie_file_image.cc",
+    "vie_file_image.h",
+    "vie_frame_provider_base.cc",
+    "vie_frame_provider_base.h",
+    "vie_image_process_impl.cc",
+    "vie_image_process_impl.h",
+    "vie_impl.cc",
+    "vie_impl.h",
+    "vie_input_manager.cc",
+    "vie_input_manager.h",
+    "vie_manager_base.cc",
+    "vie_manager_base.h",
+    "vie_network_impl.cc",
+    "vie_network_impl.h",
+    "vie_receiver.cc",
+    "vie_receiver.h",
+    "vie_ref_count.cc",
+    "vie_ref_count.h",
+    "vie_remb.cc",
+    "vie_remb.h",
+    "vie_renderer.cc",
+    "vie_renderer.h",
+    "vie_render_impl.cc",
+    "vie_render_impl.h",
+    "vie_render_manager.cc",
+    "vie_render_manager.h",
+    "vie_rtp_rtcp_impl.cc",
+    "vie_rtp_rtcp_impl.h",
+    "vie_sender.cc",
+    "vie_sender.h",
+    "vie_shared_data.cc",
+    "vie_shared_data.h",
+    "vie_sync_module.cc",
+    "vie_sync_module.h",
+  ]
+
+  if (is_clang) {
+    # Suppress warnings from Chrome's Clang plugins.
+    # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
+    configs -= [ "//build/config/clang:find_bad_constructs" ]
+  }
+
+  if (is_win) {
+    cflags = [
+      # TODO(jschuh): Bug 1348: fix size_t to int truncations.
+      "/wd4267",  # size_t to int truncation.
+    ]
+  }
+
+  deps = [
+    "../common_video",
+    "../modules/bitrate_controller",
+    "../modules/rtp_rtcp",
+    "../modules/utility",
+    "../modules/video_capture",
+    "../modules/video_coding",
+    "../modules/video_processing",
+    "../modules/video_render",
+    "../voice_engine",
+    "../system_wrappers",
+  ]
 }