/
patch-bug1559213
123 lines (114 loc) · 4.14 KB
/
patch-bug1559213
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
commit 717bba28411c
Author: Jory A. Pratt <anarchy@gentoo.org>
Date: Thu Jun 13 11:53:00 2019 -0700
Bug 1559213 - Allow to use system av1 libs instead of bundled.
---
config/external/moz.build | 5 +++--
config/system-headers.mozbuild | 8 ++++++++
dom/media/platforms/moz.build | 5 +++++
toolkit/moz.configure | 19 ++++++++++++++++++-
4 files changed, 34 insertions(+), 3 deletions(-)
diff --git config/external/moz.build config/external/moz.build
index a0877c9d717e..5caa2036e0ec 100644
--- config/external/moz.build
+++ config/external/moz.build
@@ -45,8 +45,9 @@ if not CONFIG["MOZ_SYSTEM_LIBVPX"]:
external_dirs += ["media/libvpx"]
if CONFIG["MOZ_AV1"]:
- external_dirs += ["media/libaom"]
- external_dirs += ["media/libdav1d"]
+ if not CONFIG["MOZ_SYSTEM_AV1"]:
+ external_dirs += ["media/libaom"]
+ external_dirs += ["media/libdav1d"]
if not CONFIG["MOZ_SYSTEM_PNG"]:
external_dirs += ["media/libpng"]
diff --git config/system-headers.mozbuild config/system-headers.mozbuild
index d9489c8f15e4..4d2f15e18c1c 100644
--- config/system-headers.mozbuild
+++ config/system-headers.mozbuild
@@ -1291,6 +1291,14 @@ if CONFIG['MOZ_ENABLE_LIBPROXY']:
'proxy.h',
]
+if CONFIG['MOZ_SYSTEM_AV1']:
+ system_headers += [
+ 'aom/aom_decoder.h',
+ 'aom/aomdx.h',
+ 'aom/aom_image.h',
+ 'dav1d/dav1d.h',
+ ]
+
if CONFIG['MOZ_SYSTEM_LIBVPX']:
system_headers += [
'vpx_mem/vpx_mem.h',
diff --git dom/media/platforms/moz.build dom/media/platforms/moz.build
index c71f22a22eee..efbd523b1225 100644
--- dom/media/platforms/moz.build
+++ dom/media/platforms/moz.build
@@ -80,6 +80,11 @@ if CONFIG["MOZ_AV1"]:
"agnostic/AOMDecoder.cpp",
"agnostic/DAV1DDecoder.cpp",
]
+ if CONFIG['MOZ_SYSTEM_AV1']:
+ CXXFLAGS += CONFIG['MOZ_SYSTEM_LIBAOM_CFLAGS']
+ OS_LIBS += CONFIG['MOZ_SYSTEM_LIBAOM_LIBS']
+ CXXFLAGS += CONFIG['MOZ_SYSTEM_LIBDAV1D_CFLAGS']
+ OS_LIBS += CONFIG['MOZ_SYSTEM_LIBDAV1D_LIBS']
if CONFIG["MOZ_OMX"]:
EXPORTS += [
diff --git media/ffvpx/libavcodec/moz.build media/ffvpx/libavcodec/moz.build
index 5675c28234a1..56344e5e4c98 100644
--- media/ffvpx/libavcodec/moz.build
+++ media/ffvpx/libavcodec/moz.build
@@ -109,10 +109,14 @@ if not CONFIG['MOZ_FFVPX_AUDIOONLY']:
'vp9recon.c',
'vpx_rac.c',
]
- USE_LIBS += [
- 'dav1d',
- 'media_libdav1d_asm',
- ]
+ if CONFIG["MOZ_SYSTEM_AV1"]:
+ CFLAGS += CONFIG['MOZ_SYSTEM_LIBDAV1D_CFLAGS']
+ OS_LIBS += CONFIG['MOZ_SYSTEM_LIBDAV1D_LIBS']
+ else:
+ USE_LIBS += [
+ 'dav1d',
+ 'media_libdav1d_asm',
+ ]
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
LOCAL_INCLUDES += ['/media/mozva']
SOURCES += [
diff --git toolkit/moz.configure toolkit/moz.configure
index 2e56fa46ce59..23e30935c4bc 100644
--- toolkit/moz.configure
+++ toolkit/moz.configure
@@ -745,7 +745,23 @@ def av1(value):
return True
-@depends(target, when=av1 & compile_environment)
+option("--with-system-av1",
+ help="Use system av1 (located with pkgconfig)")
+
+system_libaom_info = pkg_check_modules("MOZ_SYSTEM_LIBAOM", "aom >= 1.0.0",
+ when="--with-system-av1")
+
+system_libdav1d_info = pkg_check_modules("MOZ_SYSTEM_LIBDAV1D", "dav1d >= 0.1.1",
+ when="--with-system-av1")
+
+@depends(system_libaom_info, system_libdav1d_info)
+def system_av1(system_libaom_info, system_libdav1d_info):
+ has_av1_libs = False
+ if system_libaom_info and system_libdav1d_info:
+ has_av1_libs = True
+ return has_av1_libs
+
+@depends(target, when=av1 & depends(system_av1)(lambda v: not v) & compile_environment)
def dav1d_asm(target):
if target.cpu in ("aarch64", "x86", "x86_64"):
return True
@@ -761,6 +777,7 @@ set_config("MOZ_DAV1D_ASM", dav1d_asm)
set_define("MOZ_DAV1D_ASM", dav1d_asm)
set_config("MOZ_AV1", av1)
set_define("MOZ_AV1", av1)
+set_config("MOZ_SYSTEM_AV1", depends_if(system_av1)(lambda _: True))
# JXL Image Codec Support
# ==============================================================