You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

599 lines
13 KiB

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