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.

600 lines
13 KiB

  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. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=ffmpeg
  9. PKG_VERSION:=2.4.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:=9e6163b09b7b9331b834d80874c2c0ff
  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-mipsdspr1 \
  343. --disable-mipsdspr2 \
  344. --disable-mipsfpu \
  345. \
  346. --disable-dxva2 \
  347. --disable-vaapi \
  348. --disable-vda \
  349. --disable-vdpau \
  350. --disable-outdevs
  351. ifeq ($(CONFIG_CPU_TYPE),"mips32")
  352. FFMPEG_CONFIGURE +=--disable-mips32r2
  353. endif
  354. ifeq ($(BUILD_VARIANT),custom)
  355. FFMPEG_ENABLE= \
  356. $(foreach c, $(2), \
  357. $(if $($(3)_$(c)),--enable-$(1)="$(c)") \
  358. )
  359. FFMPEG_CONFIGURE+= \
  360. --disable-programs \
  361. --disable-avfilter \
  362. --disable-postproc \
  363. --disable-swresample \
  364. --disable-swscale \
  365. --disable-everything \
  366. $(call FFMPEG_ENABLE,encoder,$(FFMPEG_CUSTOM_ENCODERS),CONFIG_FFMPEG_CUSTOM_ENCODER) \
  367. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_CUSTOM_DECODERS),CONFIG_FFMPEG_CUSTOM_DECODER) \
  368. $(call FFMPEG_ENABLE,muxer,$(FFMPEG_CUSTOM_MUXERS),CONFIG_FFMPEG_CUSTOM_MUXER) \
  369. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_CUSTOM_DEMUXERS),CONFIG_FFMPEG_CUSTOM_DEMUXER) \
  370. $(call FFMPEG_ENABLE,parser,$(FFMPEG_CUSTOM_PARSERS),CONFIG_FFMPEG_CUSTOM_PARSER) \
  371. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_CUSTOM_PROTOCOLS),CONFIG_FFMPEG_CUSTOM_PROTOCOL) \
  372. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_adpcm),y)
  373. FFMPEG_CONFIGURE+= \
  374. --enable-decoder=adpcm_ima_wav \
  375. --enable-decoder=adpcm_ima_qt \
  376. --enable-decoder=adpcm_ms \
  377. endif
  378. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libopus),y)
  379. FFMPEG_CONFIGURE+= \
  380. --enable-libopus --enable-decoder=libopus \
  381. endif
  382. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_speex),y)
  383. FFMPEG_CONFIGURE+= \
  384. --enable-libspeex --enable-decoder=libspeex \
  385. endif
  386. endif
  387. ifeq ($(BUILD_VARIANT),audio-dec)
  388. FFMPEG_ENABLE= \
  389. $(foreach c, $(2), \
  390. --enable-$(1)="$(c)" \
  391. )
  392. FFMPEG_CONFIGURE+= \
  393. --disable-programs \
  394. --disable-avfilter \
  395. --disable-postproc \
  396. --disable-swresample \
  397. --disable-swscale \
  398. --disable-everything \
  399. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_AUDIO_DECODERS)) \
  400. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_AUDIO_DEMUXERS)) \
  401. $(call FFMPEG_ENABLE,parser,$(FFMPEG_AUDIO_PARSERS)) \
  402. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_AUDIO_PROTOCOLS)) \
  403. --enable-libopus --enable-decoder=libopus \
  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))