/
package.mk
169 lines (155 loc) · 4.23 KB
/
package.mk
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="ffmpegx"
PKG_VERSION="6.0.1"
PKG_SHA256="9b16b8731d78e596b4be0d720428ca42df642bb2d78342881ff7f5bc29fc9623"
PKG_LICENSE="GPL-3.0-only"
PKG_SITE="https://ffmpeg.org"
PKG_URL="https://ffmpeg.org/releases/ffmpeg-${PKG_VERSION}.tar.xz"
PKG_DEPENDS_TARGET="toolchain aom bzip2 openssl lame libvorbis opus x264 zlib"
PKG_LONGDESC="FFmpegx is an complete FFmpeg build to support encoding and decoding."
PKG_BUILD_FLAGS="-sysroot"
# Dependencies
get_graphicdrivers
if [ "${TARGET_ARCH}" = "x86_64" ]; then
PKG_DEPENDS_TARGET+=" nasm:host x265"
if listcontains "${GRAPHIC_DRIVERS}" "(crocus|i915|iris)"; then
PKG_DEPENDS_TARGET+=" intel-vaapi-driver"
fi
fi
if [[ ! ${TARGET_ARCH} = arm ]] || target_has_feature neon; then
PKG_DEPENDS_TARGET+=" libvpx"
fi
# X11 grab for screen recording
if [ "${DISPLAYSERVER}" = "x11" ]; then
PKG_DEPENDS_TARGET+=" libxcb libX11"
fi
pre_configure_target() {
cd ${PKG_BUILD}
rm -rf .${TARGET_NAME}
# HW encoders
# Generic
if [[ "${TARGET_ARCH}" = "x86_64" ]]; then
PKG_FFMPEG_HW_ENCODERS_GENERIC="\
`#Video encoders` \
--enable-encoder=h264_vaapi \
--enable-encoder=hevc_vaapi \
--enable-encoder=mjpeg_vaapi \
--enable-encoder=mpeg2_vaapi \
--enable-encoder=vp8_vaapi \
--enable-encoder=vp9_vaapi \
--disable-encoder=h264_nvenc \
--disable-encoder=hevc_nvenc \
\
`#Video hwaccel` \
--enable-hwaccel=h263_vaapi \
--enable-hwaccel=h264_vaapi \
--enable-hwaccel=hevc_vaapi \
--enable-hwaccel=mjpeg_vaapi \
--enable-hwaccel=mpeg2_vaapi \
--enable-hwaccel=mpeg4_vaapi \
--enable-hwaccel=vc1_vaapi \
--enable-hwaccel=vp8_vaapi \
--enable-hwaccel=vp9_vaapi \
--enable-hwaccel=wmv3_vaapi"
PKG_FFMPEG_X26x_GENERIC="\
--enable-libx264 \
--enable-encoder=libx264 \
--enable-libx265 \
--enable-encoder=libx265"
fi
# Encoders
PKG_FFMPEG_ENCODERS="\
`#Video encoders` \
--enable-libvpx \
--enable-encoder=libvpx_vp8 \
--enable-encoder=libvpx_vp9 \
${PKG_FFMPEG_X26x_GENERIC} \
--enable-libaom \
--enable-encoder=libaom_av1 \
\
`#Audio encoders` \
--enable-encoder=aac \
--enable-encoder=ac3 \
--enable-encoder=eac3 \
--enable-encoder=flac \
--enable-libmp3lame \
--enable-encoder=libmp3lame \
--enable-libopus \
--enable-encoder=libopus \
--enable-libvorbis \
--enable-encoder=libvorbis"
# X11 grab for screen recording
if [ "${DISPLAYSERVER}" = "x11" ]; then
PKG_FFMPEG_LIBS+=" -lX11"
PKG_FFMPEG_X11_GRAB="\
--enable-libxcb \
--enable-libxcb-shm \
--enable-libxcb-xfixes \
--enable-libxcb-shape"
else
PKG_FFMPEG_X11_GRAB="\
--disable-libxcb \
--disable-libxcb-shm \
--disable-libxcb-xfixes \
--disable-libxcb-shape"
fi
}
configure_target() {
./configure \
\
`#Programs to build` \
--enable-ffmpeg \
--disable-ffplay \
--enable-ffprobe \
\
`#Static and Shared` \
--enable-static \
--pkg-config-flags="--static" \
--disable-shared \
\
`#Licensing options` \
--enable-gpl \
--enable-version3 \
\
`#Documentation options` \
--disable-doc \
\
`#Hardware accelerated decoding encoding` \
${PKG_FFMPEG_HW_ENCODERS_GENERIC} \
\
${PKG_FFMPEG_ENCODERS} \
\
`#General options` \
--disable-lzma \
--disable-alsa \
${PKG_FFMPEG_X11_GRAB} \
\
`#Toolchain options` \
--arch="${TARGET_ARCH}" \
--cpu="${TARGET_CPU}" \
--cross-prefix="${TARGET_PREFIX}" \
--enable-cross-compile \
--sysroot="${SYSROOT_PREFIX}" \
--sysinclude="${SYSROOT_PREFIX}/usr/include" \
--target-os="linux" \
--nm="${NM}" \
--ar="${AR}" \
--as="${CC}" \
--cc="${CC}" \
--ld="${CC}" \
--pkg-config="${TOOLCHAIN}/bin/pkg-config" \
--host-cc="${HOST_CC}" \
--host-cflags="${HOST_CFLAGS}" \
--host-ldflags="${HOST_LDFLAGS}" \
--host-extralibs="-lm" \
--extra-cflags="${CFLAGS}" \
--extra-ldflags="${LDFLAGS}" \
--extra-libs="${PKG_FFMPEG_LIBS}" \
--enable-pic \
--disable-gnutls \
--enable-openssl \
\
`#Advanced options` \
--disable-hardcoded-tables \
}