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.

597 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.5.3
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  12. PKG_SOURCE_URL:=http://ffmpeg.org/releases/
  13. PKG_MD5SUM:=efba7c5cfbea9ce58ff693cd08f90ffa
  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 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 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-vaapi \
  349. --disable-vda \
  350. --disable-vdpau \
  351. --disable-outdevs
  352. ifeq ($(BUILD_VARIANT),custom)
  353. FFMPEG_ENABLE= \
  354. $(foreach c, $(2), \
  355. $(if $($(3)_$(c)),--enable-$(1)="$(c)") \
  356. )
  357. FFMPEG_CONFIGURE+= \
  358. --disable-programs \
  359. --disable-avfilter \
  360. --disable-postproc \
  361. --disable-swresample \
  362. --disable-swscale \
  363. --disable-everything \
  364. $(call FFMPEG_ENABLE,encoder,$(FFMPEG_CUSTOM_ENCODERS),CONFIG_FFMPEG_CUSTOM_ENCODER) \
  365. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_CUSTOM_DECODERS),CONFIG_FFMPEG_CUSTOM_DECODER) \
  366. $(call FFMPEG_ENABLE,muxer,$(FFMPEG_CUSTOM_MUXERS),CONFIG_FFMPEG_CUSTOM_MUXER) \
  367. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_CUSTOM_DEMUXERS),CONFIG_FFMPEG_CUSTOM_DEMUXER) \
  368. $(call FFMPEG_ENABLE,parser,$(FFMPEG_CUSTOM_PARSERS),CONFIG_FFMPEG_CUSTOM_PARSER) \
  369. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_CUSTOM_PROTOCOLS),CONFIG_FFMPEG_CUSTOM_PROTOCOL) \
  370. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_adpcm),y)
  371. FFMPEG_CONFIGURE+= \
  372. --enable-decoder=adpcm_ima_wav \
  373. --enable-decoder=adpcm_ima_qt \
  374. --enable-decoder=adpcm_ms \
  375. endif
  376. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libopus),y)
  377. FFMPEG_CONFIGURE+= \
  378. --enable-libopus --enable-decoder=libopus \
  379. endif
  380. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_speex),y)
  381. FFMPEG_CONFIGURE+= \
  382. --enable-libspeex --enable-decoder=libspeex \
  383. endif
  384. endif
  385. ifeq ($(BUILD_VARIANT),audio-dec)
  386. FFMPEG_ENABLE= \
  387. $(foreach c, $(2), \
  388. --enable-$(1)="$(c)" \
  389. )
  390. FFMPEG_CONFIGURE+= \
  391. --disable-programs \
  392. --disable-avfilter \
  393. --disable-postproc \
  394. --disable-swresample \
  395. --disable-swscale \
  396. --disable-everything \
  397. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_AUDIO_DECODERS)) \
  398. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_AUDIO_DEMUXERS)) \
  399. $(call FFMPEG_ENABLE,parser,$(FFMPEG_AUDIO_PARSERS)) \
  400. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_AUDIO_PROTOCOLS)) \
  401. --enable-libopus --enable-decoder=libopus \
  402. --enable-libspeex --enable-decoder=libspeex \
  403. --disable-decoder=pcm_bluray,pcm_dvd \
  404. endif
  405. ifeq ($(BUILD_VARIANT),mini)
  406. FFMPEG_ENABLE= \
  407. $(foreach c, $(2), \
  408. --enable-$(1)="$(c)" \
  409. )
  410. FFMPEG_CONFIGURE+= \
  411. --disable-programs \
  412. --disable-avdevice \
  413. --disable-avfilter \
  414. --disable-postproc \
  415. --disable-swresample \
  416. --disable-swscale \
  417. --disable-everything \
  418. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_MINI_DECODERS)) \
  419. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_MINI_DEMUXERS)) \
  420. $(call FFMPEG_ENABLE,parser,$(FFMPEG_MINI_PARSERS)) \
  421. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_MINI_PROTOCOLS)) \
  422. endif
  423. ifneq ($(CONFIG_TARGET_x86),)
  424. TARGET_CFLAGS += -fomit-frame-pointer
  425. endif
  426. define Build/Configure
  427. ( cd $(PKG_BUILD_DIR); $(FFMPEG_CONFIGURE) )
  428. endef
  429. define Build/Compile
  430. $(MAKE) -C $(PKG_BUILD_DIR) \
  431. DESTDIR="$(PKG_INSTALL_DIR)" \
  432. all install
  433. endef
  434. define Build/InstallDev/custom
  435. $(INSTALL_DIR) $(1)/usr/include
  436. $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avformat,avutil} $(1)/usr/include/
  437. $(INSTALL_DIR) $(1)/usr/lib
  438. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.{a,so*} $(1)/usr/lib/
  439. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  440. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
  441. endef
  442. define Build/InstallDev/full
  443. $(INSTALL_DIR) $(1)/usr/include
  444. $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale} $(1)/usr/include/
  445. $(INSTALL_DIR) $(1)/usr/lib
  446. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.{a,so*} $(1)/usr/lib/
  447. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  448. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.pc $(1)/usr/lib/pkgconfig/
  449. endef
  450. define Build/InstallDev/mini
  451. $(INSTALL_DIR) $(1)/usr/include
  452. $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avformat,avutil} $(1)/usr/include/
  453. $(INSTALL_DIR) $(1)/usr/lib
  454. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.{a,so*} $(1)/usr/lib/
  455. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  456. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
  457. endef
  458. Build/InstallDev/audio-dec = $(Build/InstallDev/custom)
  459. # XXX: attempt at installing "best" dev files available
  460. ifeq ($(BUILD_VARIANT),custom)
  461. # XXX: only install "custom" dev files if -full & -mini are not selected
  462. ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
  463. Build/InstallDev = $(Build/InstallDev/custom)
  464. endif
  465. endif
  466. ifeq ($(BUILD_VARIANT),audio-dec)
  467. # XXX: only install "audio-dec" dev files if -full & -mini are not selected
  468. ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
  469. Build/InstallDev = $(Build/InstallDev/audio-dec)
  470. endif
  471. endif
  472. ifeq ($(BUILD_VARIANT),full)
  473. # XXX: always install "full" dev files if -full is selected
  474. Build/InstallDev = $(Build/InstallDev/full)
  475. endif
  476. ifeq ($(BUILD_VARIANT),mini)
  477. # XXX: only install "mini" dev files if -full is not selected
  478. ifeq ($(CONFIG_PACKAGE_libffmpeg-full),)
  479. Build/InstallDev = $(Build/InstallDev/mini)
  480. endif
  481. endif
  482. define Package/ffmpeg/install
  483. $(INSTALL_DIR) $(1)/usr/bin
  484. $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffmpeg $(1)/usr/bin/
  485. endef
  486. define Package/ffprobe/install
  487. $(INSTALL_DIR) $(1)/usr/bin
  488. $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffprobe $(1)/usr/bin/
  489. endef
  490. define Package/ffserver/install
  491. $(INSTALL_DIR) $(1)/usr/bin
  492. $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffserver $(1)/usr/bin/
  493. endef
  494. define Package/libffmpeg-custom/install
  495. $(INSTALL_DIR) $(1)/usr/lib
  496. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.so.* $(1)/usr/lib/
  497. endef
  498. define Package/libffmpeg-full/install
  499. $(INSTALL_DIR) $(1)/usr/lib
  500. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.so.* $(1)/usr/lib/
  501. endef
  502. define Package/libffmpeg-mini/install
  503. $(INSTALL_DIR) $(1)/usr/lib
  504. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.so.* $(1)/usr/lib/
  505. endef
  506. Package/libffmpeg-audio-dec/install = $(Package/libffmpeg-custom/install)
  507. $(eval $(call BuildPackage,ffmpeg))
  508. $(eval $(call BuildPackage,ffprobe))
  509. $(eval $(call BuildPackage,ffserver))
  510. $(eval $(call BuildPackage,libffmpeg-custom))
  511. $(eval $(call BuildPackage,libffmpeg-full))
  512. $(eval $(call BuildPackage,libffmpeg-mini))
  513. $(eval $(call BuildPackage,libffmpeg-audio-dec))