 Chromium Code Reviews
 Chromium Code Reviews Issue 1403893007:
  Adding third_party/openh264/src, build files and unittests  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1403893007:
  Adding third_party/openh264/src, build files and unittests  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| Index: third_party/openh264/BUILD.gn | 
| diff --git a/third_party/openh264/BUILD.gn b/third_party/openh264/BUILD.gn | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..61d8c992723b7b7f2c46a4927105207b56a8ee41 | 
| --- /dev/null | 
| +++ b/third_party/openh264/BUILD.gn | 
| @@ -0,0 +1,147 @@ | 
| +# Copyright 2015 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. | 
| + | 
| +import("//build/config/features.gni") | 
| +import("//third_party/openh264/openh264.gni") | 
| + | 
| +if (use_openh264) { | 
| + # Config shared by all openh264 targets. | 
| + config("openh264_config") { | 
| + cflags = [] | 
| + defines = [] | 
| + | 
| + # Compiler warnings to ignore. | 
| + if (!is_win) { | 
| + # GCC flags | 
| + cflags += [ | 
| + "-fvisibility=default", | 
| 
hbos_chromium
2015/11/16 16:56:29
I should check if this (-fvisiblity=default) is re
 | 
| + "-Wno-header-hygiene", | 
| + "-Wno-unused-value", | 
| + ] | 
| + } | 
| + | 
| + # Platform-specific defines. | 
| + if (is_android) { | 
| + defines += [ "ANDROID_NDK" ] | 
| + } | 
| + | 
| + # Workaround relating to the VERSION_NUMBER macro in version.h. | 
| 
torbjorng
2015/11/12 11:02:02
I am not too excited about these workarounds. If i
 
hbos_chromium
2015/11/16 16:56:29
OpenH264's version.h has include guards, it redefi
 | 
| + # TODO(hbos): Fix cause of the issue instead of this workaround. | 
| + if (!is_android) { | 
| + # On some builds VERSION_NUMBER is not defined when including version.h | 
| + # (probably another file is included named version.h, I have not been able | 
| + # to reproduce the problem on a local machine). Since the macro is only | 
| + # used for debug printing in wels[En/De]coderExt.cpp we can get around the | 
| + # undeclared identifier error by giving it a default value ourselves. | 
| + defines += [ "VERSION_NUMBER=\"openh264 v.?.?\"" ] | 
| + | 
| + # For other builds we end up with a macro redefinition and have to | 
| + # suppress the macro redefined warning. Suppressing it does not work on | 
| + # android, but that's OK because we do not have the version.h problem on | 
| + # android, thus the if (!is_android) above. | 
| + if (!is_win) { | 
| + # GCC flags | 
| + cflags += [ "-Wno-macro-redefined" ] | 
| + } else { | 
| + # MSVC flags | 
| + cflags += [ "/wd4005" ] # macro redefinition | 
| + } | 
| + } | 
| + } | 
| + | 
| + static_library("openh264_common") { | 
| + deps = [] | 
| + if (is_android) { | 
| + deps += [ | 
| + # Defines "android_get/setCpu..." functions. The original OpenH264 build | 
| + # files replaces these using macros for "wels_..." versions of the same | 
| + # functions. We do not have access to these and use the <cpu-features.h> | 
| + # ones instead. | 
| + "//third_party/android_tools:cpu_features", | 
| + ] | 
| + } | 
| + configs -= [ "//build/config/compiler:chromium_code" ] | 
| + configs += [ "//build/config/compiler:no_chromium_code" ] | 
| + configs += [ ":openh264_config" ] | 
| + include_dirs = [ | 
| + "src/codec/api/svc", | 
| + "src/codec/common/inc", | 
| + "src/codec/common/src", | 
| + ] | 
| + sources = openh264_common_sources | 
| + } | 
| + | 
| + static_library("openh264_processing") { | 
| + deps = [ | 
| + ":openh264_common", | 
| + ] | 
| + configs -= [ "//build/config/compiler:chromium_code" ] | 
| 
torbjorng
2015/11/12 11:02:02
I am not good at gn, but perhaps the "configs" man
 
hbos_chromium
2015/11/16 16:56:29
I don't think that's possible, openh264_common is
 | 
| + configs += [ "//build/config/compiler:no_chromium_code" ] | 
| + configs += [ ":openh264_config" ] | 
| + include_dirs = [ | 
| + "src/codec/api/svc", | 
| + "src/codec/common/inc", | 
| + "src/codec/common/src", | 
| + "src/codec/processing/interface", | 
| + "src/codec/processing/interface/", | 
| + "src/codec/processing/src/adaptivequantization", | 
| + "src/codec/processing/src/backgrounddetection", | 
| + "src/codec/processing/src/common", | 
| + "src/codec/processing/src/complexityanalysis", | 
| + "src/codec/processing/src/denoise", | 
| + "src/codec/processing/src/downsample", | 
| + "src/codec/processing/src/imagerotate", | 
| + "src/codec/processing/src/scenechangedetection", | 
| + "src/codec/processing/src/scrolldetection", | 
| + "src/codec/processing/src/vaacalc", | 
| + ] | 
| + sources = openh264_processing_sources | 
| + } | 
| + | 
| + static_library("openh264_encoder") { | 
| + deps = [ | 
| + ":openh264_common", | 
| + ":openh264_processing", | 
| + ] | 
| + configs -= [ "//build/config/compiler:chromium_code" ] | 
| + configs += [ "//build/config/compiler:no_chromium_code" ] | 
| + configs += [ ":openh264_config" ] | 
| + include_dirs = [ | 
| + "src/codec/api/svc", | 
| + "src/codec/common/inc", | 
| + "src/codec/common/src", | 
| + "src/codec/encoder/core/inc", | 
| + "src/codec/encoder/core/src", | 
| + "src/codec/encoder/plus/inc", | 
| + "src/codec/encoder/plus/src", | 
| + "src/codec/processing/interface/", | 
| + ] | 
| + sources = openh264_encoder_sources | 
| + } | 
| + | 
| + static_library("openh264_decoder") { | 
| + deps = [ | 
| + ":openh264_common", | 
| + ":openh264_processing", | 
| + ] | 
| + defines = [ | 
| + # Disables decoder_core.cpp debug prints. | 
| + "CODEC_FOR_TESTBED", | 
| + ] | 
| + configs -= [ "//build/config/compiler:chromium_code" ] | 
| + configs += [ "//build/config/compiler:no_chromium_code" ] | 
| + configs += [ ":openh264_config" ] | 
| + include_dirs = [ | 
| + "src/codec/api/svc", | 
| + "src/codec/common/inc", | 
| + "src/codec/common/src", | 
| + "src/codec/decoder/core/inc", | 
| + "src/codec/decoder/core/src", | 
| + "src/codec/decoder/plus/inc", | 
| + "src/codec/decoder/plus/src", | 
| + "src/codec/processing/interface/", | 
| + ] | 
| + sources = openh264_decoder_sources | 
| + } | 
| +} |