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.

598 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.6.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:=e75d598921285d6775f20164a91936ac
  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. pcm_* \
  151. vorbis \
  152. wavpack \
  153. wmav1 \
  154. wmav2 \
  155. wmalossless \
  156. wmapro \
  157. zlib \
  158. FFMPEG_AUDIO_DEMUXERS:= \
  159. aac \
  160. ac3 \
  161. aiff \
  162. amr \
  163. ape \
  164. avi \
  165. flac \
  166. ffm \
  167. matroska \
  168. mp3 \
  169. mov \
  170. mpc \
  171. mpc8 \
  172. mpegts \
  173. ogg \
  174. rm \
  175. rtsp \
  176. rtp \
  177. sdp \
  178. wav \
  179. wv \
  180. FFMPEG_AUDIO_PARSERS:= \
  181. aac \
  182. aac_latm \
  183. flac \
  184. ac3 \
  185. mpegaudio \
  186. FFMPEG_AUDIO_PROTOCOLS:= \
  187. file http icecast rtp tcp udp
  188. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  189. PKG_CONFIG_DEPENDS:= \
  190. $(patsubst %,CONFIG_FFMPEG_CUSTOM_ENCODER_%,$(FFMPEG_CUSTOM_ENCODERS)) \
  191. $(patsubst %,CONFIG_FFMPEG_CUSTOM_DECODER_%,$(FFMPEG_CUSTOM_DECODERS)) \
  192. $(patsubst %,CONFIG_FFMPEG_CUSTOM_MUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
  193. $(patsubst %,CONFIG_FFMPEG_CUSTOM_DEMUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
  194. $(patsubst %,CONFIG_FFMPEG_CUSTOM_PARSER_%,$(FFMPEG_CUSTOM_PARSERS)) \
  195. $(patsubst %,CONFIG_FFMPEG_CUSTOM_PROTOCOL_%,$(FFMPEG_CUSTOM_PROTOCOLS))
  196. include $(INCLUDE_DIR)/package.mk
  197. define Package/ffmpeg/Default
  198. TITLE:=FFmpeg
  199. URL:=http://ffmpeg.mplayerhq.hu/
  200. endef
  201. define Package/ffmpeg/Default/description
  202. FFmpeg is a a software package that can record, convert and stream digital
  203. audio and video in numerous formats.
  204. endef
  205. define Package/ffmpeg
  206. $(call Package/ffmpeg/Default)
  207. SECTION:=multimedia
  208. CATEGORY:=Multimedia
  209. TITLE+= program
  210. DEPENDS+= +libpthread +libffmpeg-full
  211. VARIANT:=full
  212. endef
  213. define Package/ffmpeg/description
  214. $(call Package/ffmpeg/Default/description)
  215. .
  216. This package contains the FFmpeg command line tool.
  217. endef
  218. define Package/ffprobe
  219. $(call Package/ffmpeg/Default)
  220. SECTION:=multimedia
  221. CATEGORY:=Multimedia
  222. TITLE+= CLI media identifier
  223. DEPENDS+= +libffmpeg-full
  224. VARIANT:=full
  225. endef
  226. define Package/ffprobe/description
  227. $(call Package/ffmpeg/Default/description)
  228. .
  229. This package contains the FFprobe command line tool.
  230. endef
  231. define Package/ffserver
  232. $(call Package/ffserver/Default)
  233. SECTION:=multimedia
  234. CATEGORY:=Multimedia
  235. TITLE+= streaming server
  236. DEPENDS+= +libpthread +libffmpeg-full
  237. VARIANT:=full
  238. endef
  239. define Package/ffserver/description
  240. $(call Package/ffmpeg/Default/description)
  241. .
  242. This package contains the FFmpeg streaming server.
  243. endef
  244. define Package/libffmpeg/Default
  245. $(call Package/ffmpeg/Default)
  246. SECTION:=libs
  247. CATEGORY:=Libraries
  248. TITLE+= libraries
  249. DEPENDS+= +libpthread +zlib +libbz2
  250. PROVIDES:= libffmpeg
  251. endef
  252. define Package/libffmpeg-custom
  253. $(call Package/libffmpeg/Default)
  254. TITLE+= (custom)
  255. DEPENDS+= @DEVEL @!ALL +libopus +libspeex
  256. VARIANT:=custom
  257. MENU:=1
  258. endef
  259. define Package/libffmpeg-custom/config
  260. source "$(SOURCE)/Config.in"
  261. endef
  262. define Package/libffmpeg-custom/description
  263. $(call Package/ffmpeg/Default/description)
  264. .
  265. This package contains customized FFmpeg shared libraries.
  266. endef
  267. define Package/libffmpeg-audio-dec
  268. $(call Package/libffmpeg/Default)
  269. TITLE+= (audio)
  270. DEPENDS+= @DEVEL +libopus +libspeex
  271. VARIANT:=audio-dec
  272. endef
  273. define Package/libffmpeg-audio-dec/description
  274. $(call Package/ffmpeg/Default/description)
  275. .
  276. This package contains FFmpeg shared libraries for audio decoding
  277. endef
  278. define Package/libffmpeg-full
  279. $(call Package/libffmpeg/Default)
  280. TITLE+= (full)
  281. DEPENDS+= @BUILD_PATENTED +alsa-lib
  282. VARIANT:=full
  283. endef
  284. define Package/libffmpeg-full/description
  285. $(call Package/ffmpeg/Default/description)
  286. .
  287. This package contains full-featured FFmpeg shared libraries.
  288. endef
  289. define Package/libffmpeg-mini
  290. $(call Package/libffmpeg/Default)
  291. TITLE+= (mini)
  292. DEPENDS+= @BUILD_PATENTED
  293. VARIANT:=mini
  294. endef
  295. define Package/libffmpeg-mini/description
  296. $(call Package/ffmpeg/Default/description)
  297. .
  298. This package contains minimal-featured FFmpeg shared libraries.
  299. endef
  300. FFMPEG_CONFIGURE:= \
  301. CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(FPIC)" \
  302. LDFLAGS="$(TARGET_LDFLAGS)" \
  303. ./configure \
  304. --enable-cross-compile \
  305. --cross-prefix="$(TARGET_CROSS)" \
  306. --arch="$(ARCH)" \
  307. --target-os=linux \
  308. --prefix="/usr" \
  309. --pkg-config="pkg-config" \
  310. --enable-shared \
  311. --enable-static \
  312. --enable-small \
  313. --enable-pthreads \
  314. --enable-zlib \
  315. --disable-runtime-cpudetect \
  316. --disable-doc \
  317. --disable-debug \
  318. \
  319. --enable-gpl \
  320. --enable-version3 \
  321. \
  322. --disable-altivec \
  323. --disable-amd3dnow \
  324. --disable-amd3dnowext \
  325. --disable-mmx \
  326. --disable-mmxext \
  327. --disable-sse \
  328. --disable-sse2 \
  329. --disable-sse3 \
  330. --disable-ssse3 \
  331. --disable-sse4 \
  332. --disable-sse42 \
  333. --disable-avx \
  334. --disable-xop \
  335. --disable-fma3 \
  336. --disable-fma4 \
  337. --disable-avx2 \
  338. --disable-vfp \
  339. --disable-neon \
  340. --disable-inline-asm \
  341. --disable-yasm \
  342. --disable-mips32r2 \
  343. --disable-mipsdspr1 \
  344. --disable-mipsdspr2 \
  345. --disable-mipsfpu \
  346. \
  347. --disable-dxva2 \
  348. --disable-lzma \
  349. --disable-vaapi \
  350. --disable-vda \
  351. --disable-vdpau \
  352. --disable-outdevs
  353. ifeq ($(BUILD_VARIANT),custom)
  354. FFMPEG_ENABLE= \
  355. $(foreach c, $(2), \
  356. $(if $($(3)_$(c)),--enable-$(1)="$(c)") \
  357. )
  358. FFMPEG_CONFIGURE+= \
  359. --disable-programs \
  360. --disable-avfilter \
  361. --disable-postproc \
  362. --disable-swresample \
  363. --disable-swscale \
  364. --disable-everything \
  365. $(call FFMPEG_ENABLE,encoder,$(FFMPEG_CUSTOM_ENCODERS),CONFIG_FFMPEG_CUSTOM_ENCODER) \
  366. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_CUSTOM_DECODERS),CONFIG_FFMPEG_CUSTOM_DECODER) \
  367. $(call FFMPEG_ENABLE,muxer,$(FFMPEG_CUSTOM_MUXERS),CONFIG_FFMPEG_CUSTOM_MUXER) \
  368. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_CUSTOM_DEMUXERS),CONFIG_FFMPEG_CUSTOM_DEMUXER) \
  369. $(call FFMPEG_ENABLE,parser,$(FFMPEG_CUSTOM_PARSERS),CONFIG_FFMPEG_CUSTOM_PARSER) \
  370. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_CUSTOM_PROTOCOLS),CONFIG_FFMPEG_CUSTOM_PROTOCOL) \
  371. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_adpcm),y)
  372. FFMPEG_CONFIGURE+= \
  373. --enable-decoder=adpcm_ima_wav \
  374. --enable-decoder=adpcm_ima_qt \
  375. --enable-decoder=adpcm_ms \
  376. endif
  377. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libopus),y)
  378. FFMPEG_CONFIGURE+= \
  379. --enable-libopus --enable-decoder=libopus \
  380. endif
  381. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_speex),y)
  382. FFMPEG_CONFIGURE+= \
  383. --enable-libspeex --enable-decoder=libspeex \
  384. endif
  385. endif
  386. ifeq ($(BUILD_VARIANT),audio-dec)
  387. FFMPEG_ENABLE= \
  388. $(foreach c, $(2), \
  389. --enable-$(1)="$(c)" \
  390. )
  391. FFMPEG_CONFIGURE+= \
  392. --disable-programs \
  393. --disable-avfilter \
  394. --disable-postproc \
  395. --disable-swresample \
  396. --disable-swscale \
  397. --disable-everything \
  398. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_AUDIO_DECODERS)) \
  399. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_AUDIO_DEMUXERS)) \
  400. $(call FFMPEG_ENABLE,parser,$(FFMPEG_AUDIO_PARSERS)) \
  401. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_AUDIO_PROTOCOLS)) \
  402. --enable-libopus --enable-decoder=libopus \
  403. --enable-libspeex --enable-decoder=libspeex \
  404. --disable-decoder=pcm_bluray,pcm_dvd \
  405. endif
  406. ifeq ($(BUILD_VARIANT),mini)
  407. FFMPEG_ENABLE= \
  408. $(foreach c, $(2), \
  409. --enable-$(1)="$(c)" \
  410. )
  411. FFMPEG_CONFIGURE+= \
  412. --disable-programs \
  413. --disable-avdevice \
  414. --disable-avfilter \
  415. --disable-postproc \
  416. --disable-swresample \
  417. --disable-swscale \
  418. --disable-everything \
  419. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_MINI_DECODERS)) \
  420. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_MINI_DEMUXERS)) \
  421. $(call FFMPEG_ENABLE,parser,$(FFMPEG_MINI_PARSERS)) \
  422. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_MINI_PROTOCOLS)) \
  423. endif
  424. ifneq ($(CONFIG_TARGET_x86),)
  425. TARGET_CFLAGS += -fomit-frame-pointer
  426. endif
  427. define Build/Configure
  428. ( cd $(PKG_BUILD_DIR); $(FFMPEG_CONFIGURE) )
  429. endef
  430. define Build/Compile
  431. $(MAKE) -C $(PKG_BUILD_DIR) \
  432. DESTDIR="$(PKG_INSTALL_DIR)" \
  433. all install
  434. endef
  435. define Build/InstallDev/custom
  436. $(INSTALL_DIR) $(1)/usr/include
  437. $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avformat,avutil} $(1)/usr/include/
  438. $(INSTALL_DIR) $(1)/usr/lib
  439. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.{a,so*} $(1)/usr/lib/
  440. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  441. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
  442. endef
  443. define Build/InstallDev/full
  444. $(INSTALL_DIR) $(1)/usr/include
  445. $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale} $(1)/usr/include/
  446. $(INSTALL_DIR) $(1)/usr/lib
  447. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.{a,so*} $(1)/usr/lib/
  448. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  449. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.pc $(1)/usr/lib/pkgconfig/
  450. endef
  451. define Build/InstallDev/mini
  452. $(INSTALL_DIR) $(1)/usr/include
  453. $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avformat,avutil} $(1)/usr/include/
  454. $(INSTALL_DIR) $(1)/usr/lib
  455. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.{a,so*} $(1)/usr/lib/
  456. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  457. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
  458. endef
  459. Build/InstallDev/audio-dec = $(Build/InstallDev/custom)
  460. # XXX: attempt at installing "best" dev files available
  461. ifeq ($(BUILD_VARIANT),custom)
  462. # XXX: only install "custom" dev files if -full & -mini are not selected
  463. ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
  464. Build/InstallDev = $(Build/InstallDev/custom)
  465. endif
  466. endif
  467. ifeq ($(BUILD_VARIANT),audio-dec)
  468. # XXX: only install "audio-dec" dev files if -full & -mini are not selected
  469. ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
  470. Build/InstallDev = $(Build/InstallDev/audio-dec)
  471. endif
  472. endif
  473. ifeq ($(BUILD_VARIANT),full)
  474. # XXX: always install "full" dev files if -full is selected
  475. Build/InstallDev = $(Build/InstallDev/full)
  476. endif
  477. ifeq ($(BUILD_VARIANT),mini)
  478. # XXX: only install "mini" dev files if -full is not selected
  479. ifeq ($(CONFIG_PACKAGE_libffmpeg-full),)
  480. Build/InstallDev = $(Build/InstallDev/mini)
  481. endif
  482. endif
  483. define Package/ffmpeg/install
  484. $(INSTALL_DIR) $(1)/usr/bin
  485. $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffmpeg $(1)/usr/bin/
  486. endef
  487. define Package/ffprobe/install
  488. $(INSTALL_DIR) $(1)/usr/bin
  489. $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffprobe $(1)/usr/bin/
  490. endef
  491. define Package/ffserver/install
  492. $(INSTALL_DIR) $(1)/usr/bin
  493. $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffserver $(1)/usr/bin/
  494. endef
  495. define Package/libffmpeg-custom/install
  496. $(INSTALL_DIR) $(1)/usr/lib
  497. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.so.* $(1)/usr/lib/
  498. endef
  499. define Package/libffmpeg-full/install
  500. $(INSTALL_DIR) $(1)/usr/lib
  501. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.so.* $(1)/usr/lib/
  502. endef
  503. define Package/libffmpeg-mini/install
  504. $(INSTALL_DIR) $(1)/usr/lib
  505. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.so.* $(1)/usr/lib/
  506. endef
  507. Package/libffmpeg-audio-dec/install = $(Package/libffmpeg-custom/install)
  508. $(eval $(call BuildPackage,ffmpeg))
  509. $(eval $(call BuildPackage,ffprobe))
  510. $(eval $(call BuildPackage,ffserver))
  511. $(eval $(call BuildPackage,libffmpeg-custom))
  512. $(eval $(call BuildPackage,libffmpeg-full))
  513. $(eval $(call BuildPackage,libffmpeg-mini))
  514. $(eval $(call BuildPackage,libffmpeg-audio-dec))