Skip to content

Commit 474275d

Browse files
committed
feat: add dav1d support
1 parent 10e6f92 commit 474275d

File tree

5 files changed

+80
-3
lines changed

5 files changed

+80
-3
lines changed

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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
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

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)