Skip to content

Commit 77caf9c

Browse files
authored
Merge pull request #19 from birros/feat/av1
feat: add av1 support
2 parents 2dfe071 + 474275d commit 77caf9c

File tree

6 files changed

+93
-16
lines changed

6 files changed

+93
-16
lines changed

.tool-versions

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
clang 14.0.3
2-
cmake 3.27.0
3-
golang 1.20.5
4-
macos 13.5
2+
cmake 3.27.4
3+
golang 1.21.0
4+
macos 13.5.1
55
make 3.81
6-
meson 1.2.0
6+
meson 1.2.1
77
ninja 1.11.1
88
xcode 14.3.1

Makefile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,46 @@ ${INTERMEDIATE_DIR}/pkg-config_%: \
217217

218218
rm -rf ${TARGET_TMP_DIR}
219219

220+
# dav1d_<os>-<arch>
221+
${INTERMEDIATE_DIR}/dav1d_%: \
222+
${DOWNLOADS_DIR} \
223+
${PKGCONFIG_DIR}
224+
225+
@echo "\033[32mRULE\033[0m $@"
226+
227+
$(eval TARGET_DIR=$@)
228+
$(eval TARGET_PATTERN=$*)
229+
$(eval TARGET_NAME=$(notdir ${TARGET_DIR}))
230+
$(eval TARGET_PKGNAME=$(firstword $(subst _${TARGET_PATTERN}, ,${TARGET_NAME})))
231+
$(eval TARGET_TMP_DIR=${TMP_DIR}/${TARGET_NAME})
232+
$(eval TARGET_SRC_DIR=${TARGET_TMP_DIR}/src/${TARGET_PKGNAME})
233+
$(eval TARGET_OUTPUT_DIR=${PROJECT_DIR}/${TARGET_DIR})
234+
235+
$(eval ARCHIVE_FILE=$(firstword $(wildcard ${DOWNLOADS_DIR}/${TARGET_PKGNAME}-*.tar.*)))
236+
237+
$(eval TARGET_OS=$(word 1, $(subst -, ,${TARGET_PATTERN})))
238+
$(eval TARGET_ARCH=$(word 2, $(subst -, ,${TARGET_PATTERN})))
239+
240+
rm -rf ${TARGET_TMP_DIR} ${TARGET_DIR}
241+
mkdir -p ${TARGET_TMP_DIR}
242+
243+
env -i \
244+
PATH=${SANDBOX_PATH} \
245+
ARCHIVE_FILE=${ARCHIVE_FILE} \
246+
TARGET_DIR=${TARGET_SRC_DIR} \
247+
sh ${PROJECT_DIR}/scripts/extract/build.sh
248+
249+
env -i \
250+
PATH=${SANDBOX_PATH} \
251+
PROJECT_DIR=${PROJECT_DIR} \
252+
OS=${TARGET_OS} \
253+
ARCH=${TARGET_ARCH} \
254+
SRC_DIR=${TARGET_SRC_DIR} \
255+
OUTPUT_DIR=${TARGET_OUTPUT_DIR} \
256+
sh ${PROJECT_DIR}/scripts/${TARGET_PKGNAME}/build.sh
257+
258+
rm -rf ${TARGET_TMP_DIR}
259+
220260
# libressl_<os>-<arch>
221261
${INTERMEDIATE_DIR}/libressl_%: \
222262
${DOWNLOADS_DIR} \
@@ -303,6 +343,7 @@ ${INTERMEDIATE_DIR}/ffmpeg_%: \
303343
${PKGCONFIG_DIR} \
304344
${INTERMEDIATE_DIR}/libressl_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
305345
$$(if $$(filter video, $$(word 3,$$(subst -, ,$$*))), \
346+
${INTERMEDIATE_DIR}/dav1d_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
306347
${INTERMEDIATE_DIR}/libxml2_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
307348
)
308349

@@ -646,6 +687,7 @@ ${INTERMEDIATE_DIR}/libs-arch_%: \
646687
${INTERMEDIATE_DIR}/ffmpeg_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*))-$$(word 3,$$(subst -, ,$$*))-$$(word 4,$$(subst -, ,$$*)) \
647688
${INTERMEDIATE_DIR}/libressl_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
648689
$$(if $$(filter video, $$(word 3,$$(subst -, ,$$*))), \
690+
${INTERMEDIATE_DIR}/dav1d_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
649691
${INTERMEDIATE_DIR}/libxml2_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
650692
${INTERMEDIATE_DIR}/uchardet_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
651693
${INTERMEDIATE_DIR}/libass_$$(word 1,$$(subst -, ,$$*))-$$(word 2,$$(subst -, ,$$*)) \
@@ -852,6 +894,7 @@ update-downloads-lock:
852894
ffmpeg \
853895
libressl \
854896
libxml2 \
897+
dav1d \
855898
)
856899

857900
go run cmd/update-downloads-lock/main.go ${DEPS} > downloads.lock

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ A(mpv) --> B(ffmpeg)
100100
A(mpv) -.-> C(libass)
101101
A(mpv) -.-> D(uchardet)
102102
103-
B -.-> H(libressl)
104-
B -.-> I(libxml2)
103+
B -.-> H(dav1d)
104+
B -.-> I(libressl)
105+
B -.-> J(libxml2)
105106
106107
C --> E(freetype)
107108
C --> F(harfbuzz)
@@ -130,6 +131,9 @@ E -.-> F
130131
and laying out text in multiple languages and scripts, with support for
131132
advanced typography features such as ligatures and kerning
132133

134+
- **[dav1d](https://code.videolan.org/videolan/dav1d) (optional)**: A library
135+
for cross-platform AV1 decoding
136+
133137
- **[libressl](https://www.libressl.org/) (optional)**: A fork of OpenSSL that
134138
aims to provide a more secure and auditable implementation of the SSL/TLS
135139
protocols
@@ -154,6 +158,7 @@ E -.-> F
154158
| libressl | Apache-1.0, BSD-4-Clause, ISC, public domain ||
155159
| uchardet | MPL-1.1, GPL-2, LGPL-2.1 ||
156160
| libxml2 | MIT ||
161+
| dav1d | BSD-2-clause ||
157162

158163
## Notes
159164

downloads.lock

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1+
dav1d:
2+
version: 1.2.1
3+
url: https://code.videolan.org/videolan/dav1d/-/archive/1.2.1/dav1d-1.2.1.tar.bz2
4+
sha256: a4003623cdc0109dec3aac8435520aa3fb12c4d69454fa227f2658cdb6dab5fa
15
ffmpeg:
26
version: "6.0"
37
url: https://ffmpeg.org/releases/ffmpeg-6.0.tar.xz
48
sha256: 57be87c22d9b49c112b6d24bc67d42508660e6b718b3db89c44e47e289137082
59
freetype:
6-
version: 2.13.1
7-
url: https://downloads.sourceforge.net/project/freetype/freetype2/2.13.1/freetype-2.13.1.tar.xz
8-
sha256: ea67e3b019b1104d1667aa274f5dc307d8cbd606b399bc32df308a77f1a564bf
10+
version: 2.13.2
11+
url: https://downloads.sourceforge.net/project/freetype/freetype2/2.13.2/freetype-2.13.2.tar.xz
12+
sha256: 12991c4e55c506dd7f9b765933e62fd2be2e06d421505d7950a132e4f1bb484d
913
fribidi:
1014
version: 1.0.13
1115
url: https://github.com/fribidi/fribidi/releases/download/v1.0.13/fribidi-1.0.13.tar.xz
1216
sha256: 7fa16c80c81bd622f7b198d31356da139cc318a63fc7761217af4130903f54a2
1317
harfbuzz:
14-
version: 8.0.1
15-
url: https://github.com/harfbuzz/harfbuzz/archive/8.0.1.tar.gz
16-
sha256: d54ca67b6a0bf732b66a343566446d7f93df2bb850133f886c0082fb618a06b2
18+
version: 8.1.1
19+
url: https://github.com/harfbuzz/harfbuzz/archive/8.1.1.tar.gz
20+
sha256: b16e6bc0fc7e6a218583f40c7d201771f2e3072f85ef6e9217b36c1dc6b2aa25
1721
libass:
1822
version: 0.17.1
1923
url: https://github.com/libass/libass/releases/download/0.17.1/libass-0.17.1.tar.xz
@@ -23,9 +27,9 @@ libressl:
2327
url: https://cdn.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.7.3.tar.gz
2428
sha256: 7948c856a90c825bd7268b6f85674a8dcd254bae42e221781b24e3f8dc335db3
2529
libxml2:
26-
version: 2.11.4
27-
url: https://download.gnome.org/sources/libxml2/2.11/libxml2-2.11.4.tar.xz
28-
sha256: 737e1d7f8ab3f139729ca13a2494fd17bf30ddb4b7a427cf336252cab57f57f7
30+
version: 2.11.5
31+
url: https://download.gnome.org/sources/libxml2/2.11/libxml2-2.11.5.tar.xz
32+
sha256: 3727b078c360ec69fa869de14bd6f75d7ee8d36987b071e6928d4720a28df3a6
2933
mpv:
3034
version: 0.36.0
3135
url: https://github.com/mpv-player/mpv/archive/refs/tags/v0.36.0.tar.gz

scripts/dav1d/build.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/sh
2+
3+
set -e # exit immediately if a command exits with a non-zero status
4+
set -u # treat unset variables as an error
5+
6+
cd ${SRC_DIR}
7+
meson setup build \
8+
--cross-file ${PROJECT_DIR}/cross-files/${OS}-${ARCH}.ini \
9+
--prefix="${OUTPUT_DIR}" \
10+
-Dbitdepths="['8', '16']" \
11+
-Denable_asm=false \
12+
-Denable_tools=false \
13+
-Denable_examples=false \
14+
-Denable_tests=false \
15+
-Denable_docs=false \
16+
-Dlogging=true \
17+
-Dtestdata_tests=false \
18+
-Dfuzzing_engine=none \
19+
-Dfuzzer_ldflags= \
20+
-Dstack_alignment=0 \
21+
-Dxxhash_muxer=auto \
22+
-Dtrim_dsp=if-release
23+
meson compile -C build
24+
meson install -C build

scripts/ffmpeg/meson.build

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ video_common_options = [
6868
'--enable-neon', # improve hevc (h265) support on arm
6969
'--enable-libxml2', # dash support
7070
'--enable-videotoolbox',
71+
'--enable-libdav1d', # av1 support
7172
]
7273

7374
# https://github.com/media-kit/libmpv-android-audio-build/blob/260666c0fef8c154971b5faf3f78da27c2bf2c40/buildscripts/flavors/default.sh
@@ -183,7 +184,7 @@ video_default_options = [
183184
'--enable-decoder=vp9', # vp9*
184185
'--enable-decoder=hevc', # hevc*
185186
'--enable-decoder=av1', # av1*
186-
# '--enable-decoder=libdav1d', # --enable-libdav1d required
187+
'--enable-decoder=libdav1d',
187188
'--enable-decoder=theora',
188189
'--enable-decoder=msmpeg4v1', # msmpeg*
189190
'--enable-decoder=msmpeg4v2', # msmpeg*

0 commit comments

Comments
 (0)