-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.ffmpeg
704 lines (532 loc) · 17.9 KB
/
Makefile.ffmpeg
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
#
# Static Audio/Video libs (ffmpeg version) build
# Copyright (C) 2014 Jaroslav Kysela
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
DIR := $(dir $(lastword $(MAKEFILE_LIST)))
include $(DIR)/.config.mk
ifneq (,$(filter i386 i486 i586 i686 pentium,$(ARCH)))
FFMPEG_HOST := $(ARCH)-linux-gnu
FFMPEG_TARGET := x86-linux-gcc
endif
unexport CFLAGS
unexport LDFLAGS
# ##############################################################################
# Upstream Packages
# ##############################################################################
EXTLIBS =
COMPONENTS = avutil avcodec avformat swscale avresample swresample avfilter
PROTOCOLS = file http https hls mmsh mmst rtmp rtmpe rtmps rtmpt rtmpte rtmpts \
ffrtmpcrypt ffrtmphttp rtp srtp tcp udp udplite unix crypto
DECODERS = mpeg2video mp2 aac vorbis ac3 eac3 aac_latm opus h264 hevc theora flac
ENCODERS = mpeg2video mp2 aac vorbis flac
MUXERS = mpegts matroska mp4
DEMUXERS = mpegts matroska hls flv live_flv
BSFS = h264_mp4toannexb hevc_mp4toannexb
FILTERS = yadif format hwupload hwdownload scale null aresample anull
HWACCELS =
NASM_VER = 2.14.02
NASM = nasm-$(NASM_VER)
NASM_TB = $(NASM).tar.gz
NASM_URL = https://www.nasm.us/pub/nasm/releasebuilds/$(NASM_VER)/$(NASM_TB)
NASM_SHA1 = bfa67d0d33f0c7b00c50d9f1bd33fd4d5df3c5d5
NASM_DIFFS = remove-invalid-pure_func-qualifiers.diff
LIBX264 = x264-snapshot-20191216-2245
LIBX264_TB = $(LIBX264).tar.bz2
LIBX264_URL = http://ftp.videolan.org/x264/snapshots/$(LIBX264_TB)
LIBX264_SHA1 = 712f37aeabf3cb42f1ebe55588c33583636a7230
LIBX265 = x265_3.2
LIBX265_TB = $(LIBX265).tar.gz
LIBX265_URL = http://ftp.videolan.org/videolan/x265/$(LIBX265_TB)
LIBX265_SHA1 = 5922f88d0997c47e2c95feee95dc98bcb2e54871
ifeq ($(CONFIG_PIE),yes)
LIBX265_DIFFS = libx265.pie.diff
else
LIBX265_DIFFS = libx265.pic.diff
endif
LIBVPX_VER = 1.8.2
LIBVPX = libvpx-$(LIBVPX_VER)
LIBVPX_TB = $(LIBVPX).tar.gz
LIBVPX_URL = https://github.com/webmproject/libvpx/archive/v$(LIBVPX_VER)/$(LIBVPX_TB)
LIBVPX_SHA1 = 7fbc7de47f59431fa2c5b76660f115963e83193d
LIBOGG = libogg-1.3.4
LIBOGG_TB = $(LIBOGG).tar.gz
LIBOGG_URL = https://ftp.osuosl.org/pub/xiph/releases/ogg/$(LIBOGG_TB)
LIBOGG_SHA1 = 851cef020b346d44893e5d1c3dab83c675d479d9
LIBTHEORA = libtheora-1.1.1
LIBTHEORA_TB = $(LIBTHEORA).tar.gz
LIBTHEORA_URL = https://ftp.osuosl.org/pub/xiph/releases/theora/$(LIBTHEORA_TB)
LIBTHEORA_SHA1 = 0b91be522746a29351a5ee592fd8160940059303
LIBVORBIS = libvorbis-1.3.6
LIBVORBIS_TB = $(LIBVORBIS).tar.gz
LIBVORBIS_URL = https://ftp.osuosl.org/pub/xiph/releases/vorbis/$(LIBVORBIS_TB)
LIBVORBIS_SHA1 = 91f140c220d1fe3376d637dc5f3d046263784b1f
LIBFDKAAC = fdk-aac-0.1.6
LIBFDKAAC_TB = $(LIBFDKAAC).tar.gz
LIBFDKAAC_URL = https://freefr.dl.sourceforge.net/project/opencore-amr/fdk-aac/$(LIBFDKAAC_TB)
LIBFDKAAC_SHA1 = 574103e24fe45b3b89a92cc6a7a9d260c483b9e0
LIBOPUS = opus-1.3.1
LIBOPUS_TB = $(LIBOPUS).tar.gz
LIBOPUS_URL = https://archive.mozilla.org/pub/opus/$(LIBOPUS_TB)
LIBOPUS_SHA1 = ed226536537861c9f0f1ef7ca79dffc225bc181b
FFNVCODEC_VER = 8.2.15.10
FFNVCODEC = nv-codec-headers-$(FFNVCODEC_VER)
FFNVCODEC_TB = $(FFNVCODEC).tar.gz
FFNVCODEC_URL = https://github.com/FFmpeg/nv-codec-headers/releases/download/n$(FFNVCODEC_VER)/nv-codec-headers-$(FFNVCODEC_VER).tar.gz
FFNVCODEC_SHA1 = 80c3bd878e6b4a7d3a6a643ad6ad07a9f02bfe81
FFMPEG = ffmpeg-4.1.5
FFMPEG_TB = $(FFMPEG).tar.bz2
FFMPEG_URL = https://ffmpeg.org/releases/$(FFMPEG_TB)
FFMPEG_SHA1 = 850ca59493aa6d773a1346257c9fbee80ba6efe0
# ##############################################################################
# Library Config
# ##############################################################################
LIB_NAME := ffmpeg
LIB_ROOT := $(BUILDDIR)/$(LIB_NAME)
EBUILDIR := $(LIB_ROOT)/build
EPREFIX0 := ffmpeg
EPREFIX := $(EBUILDIR)/$(EPREFIX0)
LIB_FILES := \
$(LIB_ROOT)/$(NASM)/.tvh_download \
$(LIB_ROOT)/$(NASM)/.tvh_build \
$(LIB_ROOT)/$(LIBX264)/.tvh_download \
$(LIB_ROOT)/$(LIBX264)/.tvh_build \
$(LIB_ROOT)/$(LIBX265)/.tvh_download \
$(LIB_ROOT)/$(LIBX265)/.tvh_build \
$(LIB_ROOT)/$(LIBVPX)/.tvh_download \
$(LIB_ROOT)/$(LIBVPX)/.tvh_build \
$(LIB_ROOT)/$(LIBTHEORA)/.tvh_download \
$(LIB_ROOT)/$(LIBTHEORA)/.tvh_build \
$(LIB_ROOT)/$(LIBOGG)/.tvh_download \
$(LIB_ROOT)/$(LIBOGG)/.tvh_build \
$(LIB_ROOT)/$(LIBVORBIS)/.tvh_download \
$(LIB_ROOT)/$(LIBVORBIS)/.tvh_build \
$(LIB_ROOT)/$(LIBFDKAAC)/.tvh_download \
$(LIB_ROOT)/$(LIBFDKAAC)/.tvh_build \
$(LIB_ROOT)/$(LIBOPUS)/.tvh_download \
$(LIB_ROOT)/$(LIBOPUS)/.tvh_build \
$(LIB_ROOT)/$(FFNVCODEC)/.tvh_download \
$(LIB_ROOT)/$(FFNVCODEC)/.tvh_build \
$(LIB_ROOT)/$(FFMPEG)/.tvh_download \
$(LIB_ROOT)/$(FFMPEG)/.tvh_build \
$(EPREFIX)
include $(DIR)/Makefile.static
.PHONY: build $(PHONY)
build: $(LIB_ROOT)/$(FFMPEG)/.tvh_build
$(call LIBCACHEGET_TIMESTAMP)
# ##############################################################################
# Build Rules
# ##############################################################################
export PATH := $(LIB_ROOT)/build/ffmpeg/bin:$(PATH)
ifeq ($(CONFIG_PIE),yes)
CFLAGS_PI = -fPIE
else
CFLAGS_PI = -fPIC
endif
ECFLAGS := -I$(EPREFIX)/include $(CFLAGS_PI)
ELIBS := -L$(EPREFIX)/lib -ldl
CONFIGURE := FFMPEG_PREFIX=$(EPREFIX) \
PKG_CONFIG=$(ROOTDIR)/support/pkg-config.ffmpeg \
./configure --prefix=/ffmpeg --enable-static --disable-shared
CONFIGURE_PI := CC="$(COMPILER) $(CFLAGS_PI)" $(CONFIGURE)
# ##############################################################################
# NASM
#
$(LIB_ROOT)/$(NASM)/.tvh_download:
$(call DOWNLOAD,$(NASM_URL),$(LIB_ROOT)/$(NASM_TB),$(NASM_SHA1))
$(call UNTAR,$(NASM_TB),z)
$(call PATCH,$(NASM),$(NASM_DIFFS))
@touch $@
$(LIB_ROOT)/$(NASM)/.tvh_build: \
$(LIB_ROOT)/$(NASM)/.tvh_download
cd $(LIB_ROOT)/$(NASM) && $(CONFIGURE_PI) \
--libdir=/$(EPREFIX0)/lib
DESTDIR=$(EBUILDIR) \
$(MAKE) -C $(LIB_ROOT)/$(NASM) install
@touch $@
# ##############################################################################
# LIBX264
#
ifeq (yes,$(CONFIG_LIBX264))
EXTLIBS += libx264
ENCODERS += libx264
FFMPEG_DIFFS += ffmpeg.libx264.diff
endif
ifeq (yes,$(CONFIG_LIBX264_STATIC))
ifneq (,$(DEB_BUILD_GNU_TYPE))
LIBX264_HOST := --host=$(DEB_BUILD_GNU_TYPE)
endif
ifeq (,$(LIBX264_HOST))
ifneq (,$(FFMPEG_HOST))
LIBX264_HOST := --host=$(FFMPEG_HOST)
endif
endif
$(LIB_ROOT)/$(LIBX264)/.tvh_download:
$(call DOWNLOAD,$(LIBX264_URL),$(LIB_ROOT)/$(LIBX264_TB),$(LIBX264_SHA1))
$(call UNTAR,$(LIBX264_TB),j)
@touch $@
$(LIB_ROOT)/$(LIBX264)/.tvh_build: \
$(LIB_ROOT)/$(NASM)/.tvh_build \
$(LIB_ROOT)/$(LIBX264)/.tvh_download
cd $(LIB_ROOT)/$(LIBX264) && $(CONFIGURE) \
--extra-asflags="-DPIC" \
--extra-cflags="$(CFLAGS_PI)" \
--disable-cli \
--disable-swscale \
--disable-lavf \
--disable-avs \
--disable-ffms \
--disable-gpac \
--disable-lsmash \
$(LIBX264_HOST)
DESTDIR=$(EBUILDIR) \
$(MAKE) -C $(LIB_ROOT)/$(LIBX264) install
@touch $@
else
$(LIB_ROOT)/$(LIBX264)/.tvh_download:
@mkdir -p $(LIB_ROOT)/$(LIBX264)
@touch $@
$(LIB_ROOT)/$(LIBX264)/.tvh_build: \
$(LIB_ROOT)/$(LIBX264)/.tvh_download
@touch $@
endif
# ##############################################################################
# LIBX265
#
ifeq (yes,$(CONFIG_LIBX265))
EXTLIBS += libx265
ENCODERS += libx265
FFMPEG_DIFFS += ffmpeg.libx265.diff
endif
ifeq (yes,$(CONFIG_LIBX265_STATIC))
$(LIB_ROOT)/$(LIBX265)/.tvh_download:
$(call DOWNLOAD,$(LIBX265_URL),$(LIB_ROOT)/$(LIBX265_TB),$(LIBX265_SHA1))
$(call UNTAR,$(LIBX265_TB),z)
$(call PATCH,$(LIBX265),$(LIBX265_DIFFS))
@touch $@
$(LIB_ROOT)/$(LIBX265)/.tvh_build: \
$(LIB_ROOT)/$(NASM)/.tvh_build \
$(LIB_ROOT)/$(LIBX265)/.tvh_download
cd $(LIB_ROOT)/$(LIBX265)/build/linux && cmake -G "Unix Makefiles" \
-DCMAKE_INSTALL_PREFIX="/ffmpeg" \
-DENABLE_SHARED:BOOL=OFF \
../../source
DESTDIR=$(EBUILDIR) \
$(MAKE) -C $(LIB_ROOT)/$(LIBX265)/build/linux install
mv $(EPREFIX)/lib/pkgconfig/x265.pc $(EPREFIX)/lib/pkgconfig/x265.pc.old
sed -e 's,-ldl,-ldl -lpthread,g' \
< $(EPREFIX)/lib/pkgconfig/x265.pc.old \
> $(EPREFIX)/lib/pkgconfig/x265.pc
@touch $@
else
$(LIB_ROOT)/$(LIBX265)/.tvh_download:
@mkdir -p $(LIB_ROOT)/$(LIBX265)
@touch $@
$(LIB_ROOT)/$(LIBX265)/.tvh_build: \
$(LIB_ROOT)/$(LIBX265)/.tvh_download
@touch $@
endif
# ##############################################################################
# LIBVPX
#
ifeq (yes,$(CONFIG_LIBVPX))
EXTLIBS += libvpx
ENCODERS += libvpx_vp8 libvpx_vp9
endif
ifeq (yes,$(CONFIG_LIBVPX_STATIC))
ifneq (,$(FFMPEG_TARGET))
LIBVPX_TARGET := --target=$(FFMPEG_TARGET)
endif
$(LIB_ROOT)/$(LIBVPX)/.tvh_download:
$(call DOWNLOAD,$(LIBVPX_URL),$(LIB_ROOT)/$(LIBVPX_TB),$(LIBVPX_SHA1))
$(call UNTAR,$(LIBVPX_TB),z)
@touch $@
$(LIB_ROOT)/$(LIBVPX)/.tvh_build: \
$(LIB_ROOT)/$(NASM)/.tvh_build \
$(LIB_ROOT)/$(LIBVPX)/.tvh_download
cd $(LIB_ROOT)/$(LIBVPX) && \
ASFLAGS="-DENABLE_PIC=1 -DPIC=1" $(CONFIGURE) \
--extra-cflags="$(CFLAGS_PI)" \
--disable-examples \
--disable-docs \
--disable-unit-tests \
$(LIBVPX_TARGET)
DIST_DIR=$(EPREFIX) \
$(MAKE) -C $(LIB_ROOT)/$(LIBVPX) install
@touch $@
else
$(LIB_ROOT)/$(LIBVPX)/.tvh_download:
@mkdir -p $(LIB_ROOT)/$(LIBVPX)
@touch $@
$(LIB_ROOT)/$(LIBVPX)/.tvh_build: \
$(LIB_ROOT)/$(LIBVPX)/.tvh_download
@touch $@
endif
# ##############################################################################
# LIBOGG
#
ifeq (yes,$(CONFIG_LIBOGG_STATIC))
$(LIB_ROOT)/$(LIBOGG)/.tvh_download:
$(call DOWNLOAD,$(LIBOGG_URL),$(LIB_ROOT)/$(LIBOGG_TB),$(LIBOGG_SHA1))
$(call UNTAR,$(LIBOGG_TB),z)
@touch $@
$(LIB_ROOT)/$(LIBOGG)/.tvh_build: \
$(LIB_ROOT)/$(NASM)/.tvh_build \
$(LIB_ROOT)/$(LIBOGG)/.tvh_download
cd $(LIB_ROOT)/$(LIBOGG) && \
$(CONFIGURE_PI) \
--libdir=/$(EPREFIX0)/lib
DESTDIR=$(EBUILDIR) \
$(MAKE) -C $(LIB_ROOT)/$(LIBOGG) install
@touch $@
endif
# ##############################################################################
# LIBTHEORA
#
ifeq (yes,$(CONFIG_LIBTHEORA))
EXTLIBS += libtheora
ENCODERS += libtheora
endif
ifeq (yes,$(CONFIG_LIBTHEORA_STATIC))
ifeq (,$(LIBTHEORA_HOST))
ifneq (,$(FFMPEG_HOST))
LIBTHEORA_HOST := --host=$(FFMPEG_HOST)
endif
endif
$(LIB_ROOT)/$(LIBTHEORA)/.tvh_download:
$(call DOWNLOAD,$(LIBTHEORA_URL),$(LIB_ROOT)/$(LIBTHEORA_TB),$(LIBTHEORA_SHA1))
$(call UNTAR,$(LIBTHEORA_TB),z)
@touch $@
$(LIB_ROOT)/$(LIBTHEORA)/.tvh_build: \
$(LIB_ROOT)/$(NASM)/.tvh_build \
$(LIB_ROOT)/$(LIBOGG)/.tvh_build \
$(LIB_ROOT)/$(LIBTHEORA)/.tvh_download
cd $(LIB_ROOT)/$(LIBTHEORA) && \
$(CONFIGURE_PI) \
--libdir=/$(EPREFIX0)/lib \
--with-ogg=$(EPREFIX) \
--disable-examples \
--disable-spec \
$(LIBTHEORA_HOST)
DESTDIR=$(EBUILDIR) \
$(MAKE) -C $(LIB_ROOT)/$(LIBTHEORA) install
@touch $@
else
$(LIB_ROOT)/$(LIBTHEORA)/.tvh_download:
@mkdir -p $(LIB_ROOT)/$(LIBTHEORA)
@touch $@
$(LIB_ROOT)/$(LIBTHEORA)/.tvh_build: \
$(LIB_ROOT)/$(LIBTHEORA)/.tvh_download
@touch $@
endif
# ##############################################################################
# LIBVORBIS
#
ifeq (yes,$(CONFIG_LIBVORBIS))
EXTLIBS += libvorbis
DECODERS += libvorbis
ENCODERS += libvorbis
endif
ifeq (yes,$(CONFIG_LIBVORBIS_STATIC))
$(LIB_ROOT)/$(LIBVORBIS)/.tvh_download:
$(call DOWNLOAD,$(LIBVORBIS_URL),$(LIB_ROOT)/$(LIBVORBIS_TB),$(LIBVORBIS_SHA1))
$(call UNTAR,$(LIBVORBIS_TB),z)
@touch $@
$(LIB_ROOT)/$(LIBVORBIS)/.tvh_build: \
$(LIB_ROOT)/$(NASM)/.tvh_build \
$(LIB_ROOT)/$(LIBOGG)/.tvh_build \
$(LIB_ROOT)/$(LIBVORBIS)/.tvh_download
cd $(LIB_ROOT)/$(LIBVORBIS) && \
$(CONFIGURE_PI) \
--libdir=/$(EPREFIX0)/lib \
--with-ogg=$(EPREFIX)
DESTDIR=$(EBUILDIR) \
$(MAKE) -C $(LIB_ROOT)/$(LIBVORBIS) install
@touch $@
else
$(LIB_ROOT)/$(LIBVORBIS)/.tvh_download:
@mkdir -p $(LIB_ROOT)/$(LIBVORBIS)
@touch $@
$(LIB_ROOT)/$(LIBVORBIS)/.tvh_build: \
$(LIB_ROOT)/$(LIBVORBIS)/.tvh_download
@touch $@
endif
# ##############################################################################
# LIBFDKAAC
#
ifeq (yes,$(CONFIG_LIBFDKAAC))
EXTLIBS += libfdk-aac
ENCODERS += libfdk_aac
endif
ifeq (yes,$(CONFIG_LIBFDKAAC_STATIC))
$(LIB_ROOT)/$(LIBFDKAAC)/.tvh_download:
$(call DOWNLOAD,$(LIBFDKAAC_URL),$(LIB_ROOT)/$(LIBFDKAAC_TB),$(LIBFDKAAC_SHA1))
$(call UNTAR,$(LIBFDKAAC_TB),z)
@touch $@
$(LIB_ROOT)/$(LIBFDKAAC)/.tvh_build: \
$(LIB_ROOT)/$(LIBFDKAAC)/.tvh_download
cd $(LIB_ROOT)/$(LIBFDKAAC) && CXXFLAGS="-std=c++98 -fPIC" $(CONFIGURE_PI) \
--libdir=/$(EPREFIX0)/lib
DESTDIR=$(EBUILDIR) \
$(MAKE) -C $(LIB_ROOT)/$(LIBFDKAAC) install
@touch $@
else
$(LIB_ROOT)/$(LIBFDKAAC)/.tvh_download:
@mkdir -p $(LIB_ROOT)/$(LIBFDKAAC)
@touch $@
$(LIB_ROOT)/$(LIBFDKAAC)/.tvh_build: \
$(LIB_ROOT)/$(LIBFDKAAC)/.tvh_download
@touch $@
endif
# ##############################################################################
# LIBOPUS
#
ifeq (yes,$(CONFIG_LIBOPUS))
EXTLIBS += libopus
ENCODERS += libopus
endif
ifeq (yes,$(CONFIG_LIBOPUS_STATIC))
$(LIB_ROOT)/$(LIBOPUS)/.tvh_download:
$(call DOWNLOAD,$(LIBOPUS_URL),$(LIB_ROOT)/$(LIBOPUS_TB),$(LIBOPUS_SHA1))
$(call UNTAR,$(LIBOPUS_TB),z)
@touch $@
$(LIB_ROOT)/$(LIBOPUS)/.tvh_build: \
$(LIB_ROOT)/$(NASM)/.tvh_build \
$(LIB_ROOT)/$(LIBOPUS)/.tvh_download
cd $(LIB_ROOT)/$(LIBOPUS) && $(CONFIGURE_PI) \
--disable-doc \
--disable-extra-programs
DESTDIR=$(EBUILDIR) \
$(MAKE) -C $(LIB_ROOT)/$(LIBOPUS) install
@touch $@
else
$(LIB_ROOT)/$(LIBOPUS)/.tvh_download:
@mkdir -p $(LIB_ROOT)/$(LIBOPUS)
@touch $@
$(LIB_ROOT)/$(LIBOPUS)/.tvh_build: \
$(LIB_ROOT)/$(LIBOPUS)/.tvh_download
@touch $@
endif
# ##############################################################################
# NVENC
#
ifeq (yes,$(CONFIG_NVENC))
EXTLIBS += nvenc
ENCODERS += h264_nvenc hevc_nvenc
$(LIB_ROOT)/$(FFNVCODEC)/.tvh_download:
$(call DOWNLOAD,$(FFNVCODEC_URL),$(LIB_ROOT)/$(FFNVCODEC_TB),$(FFNVCODEC_SHA1))
$(call UNTAR,$(FFNVCODEC_TB),z)
@touch $@
$(LIB_ROOT)/$(FFNVCODEC)/.tvh_build: \
$(LIB_ROOT)/$(FFNVCODEC)/.tvh_download
mv $(LIB_ROOT)/$(FFNVCODEC)/Makefile $(LIB_ROOT)/$(FFNVCODEC)/Makefile.old
sed -e 's,PREFIX = /usr/local,PREFIX ?= /usr/local,g' \
< $(LIB_ROOT)/$(FFNVCODEC)/Makefile.old \
> $(LIB_ROOT)/$(FFNVCODEC)/Makefile
DESTDIR=$(EBUILDIR) PREFIX=/ffmpeg \
$(MAKE) -C $(LIB_ROOT)/$(FFNVCODEC) install
@touch $@
else
$(LIB_ROOT)/$(FFNVCODEC)/.tvh_download:
@mkdir $(LIB_ROOT)/$(FFNVCODEC)
@touch $@
$(LIB_ROOT)/$(FFNVCODEC)/.tvh_build: \
$(LIB_ROOT)/$(FFNVCODEC)/.tvh_download
@touch $@
endif
# ##############################################################################
# VAAPI
#
ifeq (yes,$(CONFIG_VAAPI))
EXTLIBS += vaapi
ENCODERS += h264_vaapi hevc_vaapi vp8_vaapi vp9_vaapi
HWACCELS += mpeg2_vaapi h264_vaapi hevc_vaapi vp9_vaapi
FILTERS += deinterlace_vaapi scale_vaapi
FFMPEG_DIFFS += ffmpeg.vaapi_encode.diff
endif
# ##############################################################################
# MMAL
#
ifeq (yes,$(CONFIG_MMAL))
EXTLIBS += mmal
HWACCELS += h264_mmal mpeg2_mmal
DECODERS += h264_mmal
endif
# ##############################################################################
# OMX
#
ifeq (yes,$(CONFIG_OMX))
EXTLIBS += omx
ENCODERS += h264_omx
endif
ifeq (yes,$(CONFIG_OMX_RPI))
EXTLIBS += omx_rpi
endif
# ##############################################################################
# Misc.
#
ifneq (,$(filter yes,$(CONFIG_LIBVORBIS) $(CONFIG_LIBTHEORA)))
MUXERS += ogg
endif
ifneq (,$(filter yes,$(CONFIG_NVENC) $(CONFIG_LIBFDKAAC)))
EXTLIBS += nonfree
endif
# ##############################################################################
# FFMPEG
#
$(LIB_ROOT)/$(FFMPEG)/.tvh_download:
@mkdir -p $(EBUILDIR)
$(call DOWNLOAD,$(FFMPEG_URL),$(LIB_ROOT)/$(FFMPEG_TB),$(FFMPEG_SHA1))
$(call UNTAR,$(FFMPEG_TB),j)
$(call PATCH,$(FFMPEG),$(FFMPEG_DIFFS))
@touch $@
$(LIB_ROOT)/$(FFMPEG)/.tvh_build: \
$(LIB_ROOT)/$(NASM)/.tvh_build \
$(LIB_ROOT)/$(LIBX264)/.tvh_build \
$(LIB_ROOT)/$(LIBX265)/.tvh_build \
$(LIB_ROOT)/$(LIBVPX)/.tvh_build \
$(LIB_ROOT)/$(LIBTHEORA)/.tvh_build \
$(LIB_ROOT)/$(LIBVORBIS)/.tvh_build \
$(LIB_ROOT)/$(LIBFDKAAC)/.tvh_build \
$(LIB_ROOT)/$(LIBOPUS)/.tvh_build \
$(LIB_ROOT)/$(FFNVCODEC)/.tvh_build \
$(LIB_ROOT)/$(FFMPEG)/.tvh_download
cd $(LIB_ROOT)/$(FFMPEG) && $(CONFIGURE) \
--disable-all \
--enable-gpl \
--enable-nonfree \
--extra-cflags="$(ECFLAGS)" \
--extra-libs="$(ELIBS)" \
--pkg-config="$(ROOTDIR)/support/pkg-config.ffmpeg" \
--enable-openssl \
$(foreach component,$(COMPONENTS),--enable-$(component)) \
$(foreach extlib,$(EXTLIBS),--enable-$(extlib)) \
$(foreach protocol,$(PROTOCOLS),--enable-protocol=$(protocol)) \
$(foreach decoder,$(DECODERS),--enable-decoder=$(decoder)) \
$(foreach encoder,$(ENCODERS),--enable-encoder=$(encoder)) \
$(foreach demuxer,$(DEMUXERS),--enable-demuxer=$(demuxer)) \
$(foreach muxer,$(MUXERS),--enable-muxer=$(muxer)) \
$(foreach bsf,$(BSFS),--enable-bsf=$(bsf)) \
$(foreach filter,$(FILTERS),--enable-filter=$(filter)) \
$(foreach hwaccel,$(HWACCELS),--enable-hwaccel=$(hwaccel)) \
--disable-programs \
--disable-doc \
--disable-htmlpages \
--disable-manpages \
--disable-podpages \
--disable-txtpages
DESTDIR=$(EBUILDIR) \
$(MAKE) -C $(LIB_ROOT)/$(FFMPEG) install
@touch $@