forked from tvheadend/tvheadend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.ffmpeg
718 lines (542 loc) · 18.4 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
705
706
707
708
709
710
711
712
713
714
715
716
717
718
#
# 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 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.16.01
NASM = nasm-$(NASM_VER)
NASM_TB = $(NASM).tar.gz
NASM_URL = https://www.nasm.us/pub/nasm/releasebuilds/$(NASM_VER)/$(NASM_TB)
NASM_SHA1 = 13bf04e35e1042dc163d14aa124c68cfa7620871
NASM_DIFFS = remove-invalid-pure_func-qualifiers.diff
LIBX264_VER = d2907f67227cbf38ac957efed84c532b12ce19cc
LIBX264 = x264-$(LIBX264_VER)
LIBX264_TB = $(LIBX264).tar.bz2
LIBX264_URL = https://code.videolan.org/videolan/x264/-/archive/$(LIBX264_VER)/$(LIBX264_TB)
LIBX264_SHA1 = 6b69f9af34ddfb9bc0bbfedb0b41a0b8b6c2771a
LIBX265_VER = 3.5
LIBX265 = x265_$(LIBX265_VER)
LIBX265_TB = $(LIBX265).tar.gz
LIBX265_URL = https://bitbucket.org/multicoreware/x265_git/downloads/$(LIBX265_TB)
LIBX265_SHA1 = dc8e70f441991289a9a34fd37e1649d59435bfae
ifeq ($(CONFIG_PIE),yes)
LIBX265_DIFFS = libx265.pie.diff
else
LIBX265_DIFFS = libx265.pic.diff
endif
LIBX265_DIFFS += libx265-silence.patch
LIBVPX_VER = 1.12.0
LIBVPX = libvpx-$(LIBVPX_VER)
LIBVPX_TB = $(LIBVPX).tar.gz
LIBVPX_URL = https://github.com/webmproject/libvpx/archive/v$(LIBVPX_VER)/$(LIBVPX_TB)
LIBVPX_SHA1 = e5f344d28752344d4c6e0c83b055093932b8d2c9
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.2.0alpha1
LIBTHEORA_TB = $(LIBTHEORA).tar.gz
LIBTHEORA_URL = https://ftp.osuosl.org/pub/xiph/releases/theora/$(LIBTHEORA_TB)
LIBTHEORA_SHA1 = f03e6b1648b7574a249ee19cd386ff3d5c9deb84
LIBVORBIS = libvorbis-1.3.7
LIBVORBIS_TB = $(LIBVORBIS).tar.gz
LIBVORBIS_URL = https://ftp.osuosl.org/pub/xiph/releases/vorbis/$(LIBVORBIS_TB)
LIBVORBIS_SHA1 = 2b415495f89b103138a23da5017a2a00837c6c94
LIBFDKAAC_VER = 2.0.2
LIBFDKAAC = fdk-aac-$(LIBFDKAAC_VER)
LIBFDKAAC_TB = v$(LIBFDKAAC_VER).tar.gz
LIBFDKAAC_URL = https://github.com/mstorsjo/fdk-aac/archive/refs/tags/$(LIBFDKAAC_TB)
LIBFDKAAC_SHA1 = 8d711c298d1a562f8e5bedb0ca8dc39365efe93b
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 = 11.1.5.0
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 = 89bee0d3025b813c513084ad8546b0261623fbb0
FFMPEG = ffmpeg-5.1.3
FFMPEG_TB = $(FFMPEG).tar.bz2
FFMPEG_URL = https://ffmpeg.org/releases/$(FFMPEG_TB)
FFMPEG_SHA1 = 027cf7011307689fdb670317f5ff29eee7cfcfbf
# ##############################################################################
# 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
AUTOGEN := ./autogen.sh
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)
CONFIGURE_FFMPEG := $(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
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) && \
$(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) && $(AUTOGEN) && 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))
## YOU MUST INSTALL CUDA from NVIDIA for "libnpp"
EXTLIBS += nvenc cuvid libnpp
ENCODERS += h264_nvenc hevc_nvenc
DECODERS += h264_cuvid hevc_cuvid
HWACCELS += h264_nvdec hevc_nvdec vp8_nvdec vp9_nvdec mjpeg_nvdec mpeg1_nvdec mpeg2_nvdec mpeg4_nvdec
ECFLAGS += -I/usr/local/cuda/include
## NVIDIA LIB for "libnpp"
CONFIGURE_FFMPEG += --extra-ldflags=-L/usr/local/cuda/lib64
$(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 denoise_vaapi sharpness_vaapi
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_FFMPEG) \
--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 $@