ffmpeg: Update to 2.4.4
[feed/packages.git] / multimedia / ffmpeg / Makefile
1 #
2 # Copyright (C) 2006-2014 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=ffmpeg
11 PKG_VERSION:=2.4.4
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=http://ffmpeg.org/releases/
16 PKG_MD5SUM:=7e2819c71484ffba1ba1a91dd5285643
17 PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>
18
19 PKG_LICENSE:=LGPL-2.1+ GPL-2+ LGPL-3
20 PKG_LICENSE_FILES:=COPYING.GPLv2 COPYING.GPLv3 COPYING.LGPLv2.1 COPYING.LGPLv3
21
22 FFMPEG_CUSTOM_ENCODERS:= \
23 ac3 \
24 jpegls \
25 mpeg1video \
26 mpeg2video \
27 mpeg4 \
28 pcm_s16be \
29 pcm_s16le \
30 png \
31 vorbis \
32 zlib \
33
34 FFMPEG_CUSTOM_DECODERS:= \
35 aac \
36 ac3 \
37 alac \
38 amrnb \
39 amrwb \
40 ape \
41 atrac3 \
42 flac \
43 gif \
44 h264 \
45 jpegls \
46 mp2 \
47 mp3 \
48 mpeg1video \
49 mpeg2video \
50 mpeg4 \
51 mpegvideo \
52 mpc7 \
53 mpc8 \
54 pcm_s16be \
55 pcm_s16le \
56 png \
57 vorbis \
58 wavpack \
59 wmav1 \
60 wmav2 \
61 zlib \
62
63 FFMPEG_CUSTOM_MUXERS:= \
64 ac3 \
65 ffm \
66 h264 \
67 mp3 \
68 mp4 \
69 mpeg1video \
70 mpeg2video \
71 mpegts \
72 ogg \
73 rtp \
74
75 FFMPEG_CUSTOM_DEMUXERS:= \
76 aac \
77 ac3 \
78 amr \
79 ape \
80 avi \
81 flac \
82 ffm \
83 h264 \
84 matroska \
85 mov \
86 mp3 \
87 mpegps \
88 mpegts \
89 mpegvideo \
90 mpc \
91 mpc8 \
92 ogg \
93 rm \
94 rtsp \
95 rtp \
96 sdp \
97 v4l2 \
98 wav \
99 wv \
100
101 FFMPEG_CUSTOM_PARSERS:= \
102 aac \
103 flac \
104 ac3 \
105 h264 \
106 mpegaudio \
107 mpeg4video \
108 mpegvideo \
109
110 FFMPEG_CUSTOM_PROTOCOLS:= \
111 file http pipe rtp tcp udp
112
113 FFMPEG_MINI_DECODERS:= \
114 aac \
115 ac3 \
116 flac \
117 h264 \
118 jpegls \
119 mp3 \
120 mpeg1video \
121 mpeg2video \
122 mpeg4 \
123 mpegvideo \
124 png \
125 wmav1 \
126 wmav2 \
127
128 FFMPEG_MINI_DEMUXERS := \
129 aac \
130 ac3 \
131 avi \
132 flac \
133 h264 \
134 matroska \
135 mov \
136 mp3 \
137 mpegts \
138 mpegvideo \
139
140 FFMPEG_MINI_PARSERS:= \
141 ac3 \
142 flac \
143 h264 \
144 mpeg4video \
145 mpegaudio \
146
147 FFMPEG_MINI_PROTOCOLS := \
148 file \
149
150 FFMPEG_AUDIO_DECODERS:= \
151 aac \
152 aac_latm \
153 ac3 \
154 adpcm_* \
155 alac \
156 amrnb \
157 amrwb \
158 ape \
159 atrac3 \
160 flac \
161 mp2 \
162 mp3* \
163 mpc7 \
164 mpc8 \
165 pcm_* \
166 vorbis \
167 wavpack \
168 wmav1 \
169 wmav2 \
170 wmalossless \
171 wmapro \
172 zlib \
173
174 FFMPEG_AUDIO_DEMUXERS:= \
175 aac \
176 ac3 \
177 aiff \
178 amr \
179 ape \
180 avi \
181 flac \
182 ffm \
183 matroska \
184 mp3 \
185 mov \
186 mpc \
187 mpc8 \
188 mpegts \
189 ogg \
190 rm \
191 rtsp \
192 rtp \
193 sdp \
194 wav \
195 wv \
196
197 FFMPEG_AUDIO_PARSERS:= \
198 aac \
199 aac_latm \
200 flac \
201 ac3 \
202 mpegaudio \
203
204 FFMPEG_AUDIO_PROTOCOLS:= \
205 file http rtp tcp udp
206
207
208 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
209
210 PKG_CONFIG_DEPENDS:= \
211 $(patsubst %,CONFIG_FFMPEG_CUSTOM_ENCODER_%,$(FFMPEG_CUSTOM_ENCODERS)) \
212 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DECODER_%,$(FFMPEG_CUSTOM_DECODERS)) \
213 $(patsubst %,CONFIG_FFMPEG_CUSTOM_MUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
214 $(patsubst %,CONFIG_FFMPEG_CUSTOM_DEMUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
215 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PARSER_%,$(FFMPEG_CUSTOM_PARSERS)) \
216 $(patsubst %,CONFIG_FFMPEG_CUSTOM_PROTOCOL_%,$(FFMPEG_CUSTOM_PROTOCOLS))
217
218 include $(INCLUDE_DIR)/package.mk
219
220 define Package/ffmpeg/Default
221 TITLE:=FFmpeg
222 URL:=http://ffmpeg.mplayerhq.hu/
223 endef
224
225 define Package/ffmpeg/Default/description
226 FFmpeg is a a software package that can record, convert and stream digital
227 audio and video in numerous formats.
228 endef
229
230
231 define Package/ffmpeg
232 $(call Package/ffmpeg/Default)
233 SECTION:=multimedia
234 CATEGORY:=Multimedia
235 TITLE+= program
236 DEPENDS+= +libpthread +libffmpeg-full
237 VARIANT:=full
238 endef
239
240 define Package/ffmpeg/description
241 $(call Package/ffmpeg/Default/description)
242 .
243 This package contains the FFmpeg command line tool.
244 endef
245
246
247 define Package/ffprobe
248 $(call Package/ffmpeg/Default)
249 SECTION:=multimedia
250 CATEGORY:=Multimedia
251 TITLE+= CLI media identifier
252 DEPENDS+= +libffmpeg-full
253 VARIANT:=full
254 endef
255
256 define Package/ffprobe/description
257 $(call Package/ffmpeg/Default/description)
258 .
259 This package contains the FFprobe command line tool.
260 endef
261
262
263 define Package/ffserver
264 $(call Package/ffserver/Default)
265 SECTION:=multimedia
266 CATEGORY:=Multimedia
267 TITLE+= streaming server
268 DEPENDS+= +libpthread +libffmpeg-full
269 VARIANT:=full
270 endef
271
272 define Package/ffserver/description
273 $(call Package/ffmpeg/Default/description)
274 .
275 This package contains the FFmpeg streaming server.
276 endef
277
278
279 define Package/libffmpeg/Default
280 $(call Package/ffmpeg/Default)
281 SECTION:=libs
282 CATEGORY:=Libraries
283 TITLE+= libraries
284 DEPENDS+= +libpthread +zlib +libbz2
285 PROVIDES:= libffmpeg
286 endef
287
288
289 define Package/libffmpeg-custom
290 $(call Package/libffmpeg/Default)
291 TITLE+= (custom)
292 DEPENDS+= @DEVEL @!ALL +libopus +libspeex
293 VARIANT:=custom
294 MENU:=1
295 endef
296
297 define Package/libffmpeg-custom/config
298 source "$(SOURCE)/Config.in"
299 endef
300
301 define Package/libffmpeg-custom/description
302 $(call Package/ffmpeg/Default/description)
303 .
304 This package contains customized FFmpeg shared libraries.
305 endef
306
307
308 define Package/libffmpeg-audio-dec
309 $(call Package/libffmpeg/Default)
310 TITLE+= (audio)
311 DEPENDS+= @DEVEL +libopus +libspeex
312 VARIANT:=audio-dec
313 endef
314
315 define Package/libffmpeg-audio-dec/description
316 $(call Package/ffmpeg/Default/description)
317 .
318 This package contains FFmpeg shared libraries for audio decoding
319 endef
320
321
322 define Package/libffmpeg-full
323 $(call Package/libffmpeg/Default)
324 TITLE+= (full)
325 DEPENDS+= @BUILD_PATENTED +alsa-lib
326 VARIANT:=full
327 endef
328
329 define Package/libffmpeg-full/description
330 $(call Package/ffmpeg/Default/description)
331 .
332 This package contains full-featured FFmpeg shared libraries.
333 endef
334
335
336 define Package/libffmpeg-mini
337 $(call Package/libffmpeg/Default)
338 TITLE+= (mini)
339 DEPENDS+= @BUILD_PATENTED
340 VARIANT:=mini
341 endef
342
343 define Package/libffmpeg-mini/description
344 $(call Package/ffmpeg/Default/description)
345 .
346 This package contains minimal-featured FFmpeg shared libraries.
347 endef
348
349
350 FFMPEG_CONFIGURE:= \
351 CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(FPIC)" \
352 LDFLAGS="$(TARGET_LDFLAGS)" \
353 ./configure \
354 --enable-cross-compile \
355 --cross-prefix="$(TARGET_CROSS)" \
356 --arch="$(ARCH)" \
357 --target-os=linux \
358 --prefix="/usr" \
359 --pkg-config="pkg-config" \
360 --enable-shared \
361 --enable-static \
362 --enable-small \
363 --enable-pthreads \
364 --enable-zlib \
365 --disable-runtime-cpudetect \
366 --disable-doc \
367 --disable-debug \
368 \
369 --enable-gpl \
370 --enable-version3 \
371 \
372 --disable-altivec \
373 --disable-amd3dnow \
374 --disable-amd3dnowext \
375 --disable-mmx \
376 --disable-mmxext \
377 --disable-sse \
378 --disable-sse2 \
379 --disable-sse3 \
380 --disable-ssse3 \
381 --disable-sse4 \
382 --disable-sse42 \
383 --disable-avx \
384 --disable-xop \
385 --disable-fma3 \
386 --disable-fma4 \
387 --disable-avx2 \
388 --disable-vfp \
389 --disable-neon \
390 --disable-inline-asm \
391 --disable-yasm \
392 --disable-mipsdspr1 \
393 --disable-mipsdspr2 \
394 --disable-mipsfpu \
395 \
396 --disable-dxva2 \
397 --disable-vaapi \
398 --disable-vda \
399 --disable-vdpau \
400 --disable-outdevs
401
402 ifeq ($(CONFIG_CPU_TYPE),"mips32")
403 FFMPEG_CONFIGURE +=--disable-mips32r2
404 endif
405
406 ifeq ($(BUILD_VARIANT),custom)
407
408 FFMPEG_ENABLE= \
409 $(foreach c, $(2), \
410 $(if $($(3)_$(c)),--enable-$(1)="$(c)") \
411 )
412
413 FFMPEG_CONFIGURE+= \
414 --disable-programs \
415 --disable-avfilter \
416 --disable-postproc \
417 --disable-swresample \
418 --disable-swscale \
419 --disable-everything \
420 $(call FFMPEG_ENABLE,encoder,$(FFMPEG_CUSTOM_ENCODERS),CONFIG_FFMPEG_CUSTOM_ENCODER) \
421 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_CUSTOM_DECODERS),CONFIG_FFMPEG_CUSTOM_DECODER) \
422 $(call FFMPEG_ENABLE,muxer,$(FFMPEG_CUSTOM_MUXERS),CONFIG_FFMPEG_CUSTOM_MUXER) \
423 $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_CUSTOM_DEMUXERS),CONFIG_FFMPEG_CUSTOM_DEMUXER) \
424 $(call FFMPEG_ENABLE,parser,$(FFMPEG_CUSTOM_PARSERS),CONFIG_FFMPEG_CUSTOM_PARSER) \
425 $(call FFMPEG_ENABLE,protocol,$(FFMPEG_CUSTOM_PROTOCOLS),CONFIG_FFMPEG_CUSTOM_PROTOCOL) \
426
427 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_adpcm),y)
428 FFMPEG_CONFIGURE+= \
429 --enable-decoder=adpcm_ima_wav \
430 --enable-decoder=adpcm_ima_qt \
431 --enable-decoder=adpcm_ms \
432
433 endif
434
435 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libopus),y)
436 FFMPEG_CONFIGURE+= \
437 --enable-libopus --enable-decoder=libopus \
438
439 endif
440
441 ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_speex),y)
442 FFMPEG_CONFIGURE+= \
443 --enable-libspeex --enable-decoder=libspeex \
444
445 endif
446
447 endif
448
449 ifeq ($(BUILD_VARIANT),audio-dec)
450
451 FFMPEG_ENABLE= \
452 $(foreach c, $(2), \
453 --enable-$(1)="$(c)" \
454 )
455
456 FFMPEG_CONFIGURE+= \
457 --disable-programs \
458 --disable-avfilter \
459 --disable-postproc \
460 --disable-swresample \
461 --disable-swscale \
462 --disable-everything \
463 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_AUDIO_DECODERS)) \
464 $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_AUDIO_DEMUXERS)) \
465 $(call FFMPEG_ENABLE,parser,$(FFMPEG_AUDIO_PARSERS)) \
466 $(call FFMPEG_ENABLE,protocol,$(FFMPEG_AUDIO_PROTOCOLS)) \
467 --enable-libopus --enable-decoder=libopus \
468 --enable-libspeex --enable-decoder=libspeex \
469 --disable-decoder=pcm_bluray,pcm_dvd \
470
471 endif
472
473 ifeq ($(BUILD_VARIANT),mini)
474
475 FFMPEG_ENABLE= \
476 $(foreach c, $(2), \
477 --enable-$(1)="$(c)" \
478 )
479
480 FFMPEG_CONFIGURE+= \
481 --disable-programs \
482 --disable-avdevice \
483 --disable-avfilter \
484 --disable-postproc \
485 --disable-swresample \
486 --disable-swscale \
487 --disable-everything \
488 $(call FFMPEG_ENABLE,decoder,$(FFMPEG_MINI_DECODERS)) \
489 $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_MINI_DEMUXERS)) \
490 $(call FFMPEG_ENABLE,parser,$(FFMPEG_MINI_PARSERS)) \
491 $(call FFMPEG_ENABLE,protocol,$(FFMPEG_MINI_PROTOCOLS)) \
492
493 endif
494
495 ifneq ($(CONFIG_TARGET_x86),)
496 TARGET_CFLAGS += -fomit-frame-pointer
497 endif
498
499 define Build/Configure
500 ( cd $(PKG_BUILD_DIR); $(FFMPEG_CONFIGURE) )
501 endef
502
503 define Build/Compile
504 $(MAKE) -C $(PKG_BUILD_DIR) \
505 DESTDIR="$(PKG_INSTALL_DIR)" \
506 all install
507 endef
508
509 define Build/InstallDev/custom
510 $(INSTALL_DIR) $(1)/usr/include
511 $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avformat,avutil} $(1)/usr/include/
512 $(INSTALL_DIR) $(1)/usr/lib
513 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.{a,so*} $(1)/usr/lib/
514 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
515 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
516 endef
517
518 define Build/InstallDev/full
519 $(INSTALL_DIR) $(1)/usr/include
520 $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale} $(1)/usr/include/
521 $(INSTALL_DIR) $(1)/usr/lib
522 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.{a,so*} $(1)/usr/lib/
523 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
524 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.pc $(1)/usr/lib/pkgconfig/
525 endef
526
527 define Build/InstallDev/mini
528 $(INSTALL_DIR) $(1)/usr/include
529 $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avformat,avutil} $(1)/usr/include/
530 $(INSTALL_DIR) $(1)/usr/lib
531 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.{a,so*} $(1)/usr/lib/
532 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
533 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
534 endef
535
536 Build/InstallDev/audio-dec = $(Build/InstallDev/custom)
537
538 # XXX: attempt at installing "best" dev files available
539 ifeq ($(BUILD_VARIANT),custom)
540 # XXX: only install "custom" dev files if -full & -mini are not selected
541 ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
542 Build/InstallDev = $(Build/InstallDev/custom)
543 endif
544 endif
545 ifeq ($(BUILD_VARIANT),audio-dec)
546 # XXX: only install "audio-dec" dev files if -full & -mini are not selected
547 ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
548 Build/InstallDev = $(Build/InstallDev/audio-dec)
549 endif
550 endif
551 ifeq ($(BUILD_VARIANT),full)
552 # XXX: always install "full" dev files if -full is selected
553 Build/InstallDev = $(Build/InstallDev/full)
554 endif
555 ifeq ($(BUILD_VARIANT),mini)
556 # XXX: only install "mini" dev files if -full is not selected
557 ifeq ($(CONFIG_PACKAGE_libffmpeg-full),)
558 Build/InstallDev = $(Build/InstallDev/mini)
559 endif
560 endif
561
562 define Package/ffmpeg/install
563 $(INSTALL_DIR) $(1)/usr/bin
564 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffmpeg $(1)/usr/bin/
565 endef
566
567 define Package/ffprobe/install
568 $(INSTALL_DIR) $(1)/usr/bin
569 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffprobe $(1)/usr/bin/
570 endef
571
572 define Package/ffserver/install
573 $(INSTALL_DIR) $(1)/usr/bin
574 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffserver $(1)/usr/bin/
575 endef
576
577 define Package/libffmpeg-custom/install
578 $(INSTALL_DIR) $(1)/usr/lib
579 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.so.* $(1)/usr/lib/
580 endef
581
582 define Package/libffmpeg-full/install
583 $(INSTALL_DIR) $(1)/usr/lib
584 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.so.* $(1)/usr/lib/
585 endef
586
587 define Package/libffmpeg-mini/install
588 $(INSTALL_DIR) $(1)/usr/lib
589 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.so.* $(1)/usr/lib/
590 endef
591
592 Package/libffmpeg-audio-dec/install = $(Package/libffmpeg-custom/install)
593
594 $(eval $(call BuildPackage,ffmpeg))
595 $(eval $(call BuildPackage,ffprobe))
596 $(eval $(call BuildPackage,ffserver))
597 $(eval $(call BuildPackage,libffmpeg-custom))
598 $(eval $(call BuildPackage,libffmpeg-full))
599 $(eval $(call BuildPackage,libffmpeg-mini))
600 $(eval $(call BuildPackage,libffmpeg-audio-dec))