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.

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