1e26a3ce3e3e307386f4be69316303d4d10d03ed
[jackhill/guix/guix.git] / gnu / packages / gstreamer.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2014 John Darrington <jmd@gnu.org>
4 ;;; Copyright © 2015, 2016 Sou Bunnbu <iyzsong@gmail.com>
5 ;;; Copyright © 2015, 2018 Mark H Weaver <mhw@netris.org>
6 ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2016, 2018 Leo Famulari <leo@famulari.name>
8 ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
9 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
10 ;;; Copyright © 2019, 2020 Marius Bakke <mbakke@fastmail.com>
11 ;;;
12 ;;; This file is part of GNU Guix.
13 ;;;
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
18 ;;;
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
23 ;;;
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26
27 (define-module (gnu packages gstreamer)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix packages)
30 #:use-module (guix download)
31 #:use-module (guix build-system gnu)
32 #:use-module (guix build-system meson)
33 #:use-module (guix utils)
34 #:use-module (gnu packages)
35 #:use-module (gnu packages audio)
36 #:use-module (gnu packages bison)
37 #:use-module (gnu packages cdrom)
38 #:use-module (gnu packages curl)
39 #:use-module (gnu packages compression)
40 #:use-module (gnu packages flex)
41 #:use-module (gnu packages freedesktop)
42 #:use-module (gnu packages gl)
43 #:use-module (gnu packages glib)
44 #:use-module (gnu packages gnome)
45 #:use-module (gnu packages gnupg)
46 #:use-module (gnu packages graphics)
47 #:use-module (gnu packages gtk)
48 #:use-module (gnu packages image)
49 #:use-module (gnu packages libusb)
50 #:use-module (gnu packages linux)
51 #:use-module (gnu packages mp3)
52 #:use-module (gnu packages ncurses)
53 #:use-module (gnu packages perl)
54 #:use-module (gnu packages pulseaudio)
55 #:use-module (gnu packages qt)
56 #:use-module (gnu packages rdf)
57 #:use-module (gnu packages video)
58 #:use-module (gnu packages xorg)
59 #:use-module (gnu packages xiph)
60 #:use-module (gnu packages pkg-config)
61 #:use-module (gnu packages python)
62 #:use-module (gnu packages ssh)
63 #:use-module (gnu packages telephony)
64 #:use-module (gnu packages tls)
65 #:use-module (gnu packages version-control)
66 #:use-module (gnu packages assembly)
67 #:use-module (gnu packages xml))
68
69 (define-public orc
70 (package
71 (name "orc")
72 (version "0.4.31")
73 (source (origin
74 (method url-fetch)
75 (uri (string-append "https://gstreamer.freedesktop.org/data/src/"
76 "orc/orc-" version ".tar.xz"))
77 (sha256
78 (base32
79 "0xb0c7q3xv1ldmz5ipybazb01gy3cijj8622dcx7rbm9lq85zax0"))))
80 (build-system meson-build-system)
81 (arguments
82 `(#:phases
83 (modify-phases %standard-phases
84 (add-after 'unpack 'disable-faulty-test
85 (lambda _
86 ;; XXX Disable the 'test-limits' and 'exec_opcodes_sys'
87 ;; tests, which fail on some machines. See:
88 ;; https://bugzilla.gnome.org/show_bug.cgi?id=735273
89 (substitute* '("testsuite/test-limits.c"
90 "testsuite/exec_opcodes_sys.c")
91 (("if \\(error\\) return 1;")
92 "if (error) return 77;"))
93 #t)))))
94 (native-inputs
95 `(("gtk-doc" ,gtk-doc)))
96 (home-page "https://gstreamer.freedesktop.org/modules/orc.html")
97 (synopsis "Oil runtime compiler")
98 (description
99 "Orc is a just-in-time compiler implemented as a library and set of
100 associated tools for compiling and executing simple programs that operate on
101 arrays of data.")
102 ;; The source code implementing the Marsenne Twister algorithm is licensed
103 ;; under the 3-clause BSD license, the rest is under 2-clause BSD license.
104 (license (list license:bsd-2 license:bsd-3))))
105
106 (define-public gstreamer
107 (package
108 (name "gstreamer")
109 (version "1.16.2")
110 (source
111 (origin
112 (method url-fetch)
113 (uri (string-append
114 "https://gstreamer.freedesktop.org/src/gstreamer/gstreamer-"
115 version ".tar.xz"))
116 (sha256
117 (base32
118 "0kp93622y29pck8asvil1fmzf55s2gx76wv475a6izc3cwj49w73"))))
119 (build-system meson-build-system)
120 (outputs '("out" "doc"))
121 (arguments
122 `(#:phases
123 (modify-phases %standard-phases
124 ;; FIXME: Since switching to the meson-build-system, two tests
125 ;; started failing on i686. See
126 ;; <https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/499>.
127 ,@(if (string-prefix? "i686" (or (%current-target-system)
128 (%current-system)))
129 `((add-after 'unpack 'disable-some-tests
130 (lambda _
131 (substitute* "tests/check/gst/gstsystemclock.c"
132 (("tcase_add_test \\(tc_chain, test_stress_cleanup_unschedule.*")
133 "")
134 (("tcase_add_test \\(tc_chain, test_stress_reschedule.*")
135 ""))
136 #t)))
137 '())
138 (add-after 'install 'move-docs
139 (lambda* (#:key outputs #:allow-other-keys)
140 (let ((out (assoc-ref outputs "out"))
141 (doc (assoc-ref outputs "doc")))
142 (mkdir-p (string-append doc "/share"))
143 (copy-recursively (string-append out "/share/gtk-doc")
144 (string-append doc "/share/gtk-doc"))
145 (delete-file-recursively (string-append out "/share/gtk-doc"))
146 #t))))))
147 (propagated-inputs `(("glib" ,glib))) ; required by gstreamer-1.0.pc.
148 (native-inputs
149 `(("bison" ,bison)
150 ("flex" ,flex)
151 ("glib" ,glib "bin")
152 ("gobject-introspection" ,gobject-introspection)
153 ("gtk-doc" ,gtk-doc)
154 ("perl" ,perl)
155 ("pkg-config" ,pkg-config)
156 ("python-wrapper" ,python-wrapper)))
157 (native-search-paths
158 (list (search-path-specification
159 (variable "GST_PLUGIN_SYSTEM_PATH")
160 (files '("lib/gstreamer-1.0")))))
161 (home-page "https://gstreamer.freedesktop.org/")
162 (synopsis "Multimedia library")
163 (description
164 "GStreamer is a library for constructing graphs of media-handling
165 components. The applications it supports range from simple Ogg/Vorbis
166 playback, audio/video streaming to complex audio mixing and video
167 non-linear editing.
168
169 Applications can take advantage of advances in codec and filter technology
170 transparently. Developers can add new codecs and filters by writing a
171 simple plugin with a clean, generic interface.
172
173 This package provides the core library and elements.")
174 (license license:lgpl2.0+)))
175
176 (define-public gst-plugins-base
177 (package
178 (name "gst-plugins-base")
179 (version "1.16.2")
180 (source
181 (origin
182 (method url-fetch)
183 (uri (string-append "https://gstreamer.freedesktop.org/src/" name "/"
184 name "-" version ".tar.xz"))
185 (sha256
186 (base32
187 "0sl1hxlyq46r02k7z70v09vx1gi4rcypqmzra9jid93lzvi76gmi"))))
188 (build-system meson-build-system)
189 (propagated-inputs
190 `(("glib" ,glib) ;required by gstreamer-sdp-1.0.pc
191 ("gstreamer" ,gstreamer) ;required by gstreamer-plugins-base-1.0.pc
192
193 ;; XXX: Do not enable Orc optimizations on ARM systems because
194 ;; it leads to two test failures.
195 ;; https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/683
196 ,@(if (string-prefix? "arm" (or (%current-target-system)
197 (%current-system)))
198 '()
199 `(("orc" ,orc))))) ;required by gstreamer-audio-1.0.pc
200 (inputs
201 `(("cdparanoia" ,cdparanoia)
202 ("pango" ,pango)
203 ("libogg" ,libogg)
204 ("libtheora" ,libtheora)
205 ("libvorbis" ,libvorbis)
206 ("libx11" ,libx11)
207 ("zlib" ,zlib)
208 ("libXext" ,libxext)
209 ("libxv" ,libxv)
210 ("alsa-lib" ,alsa-lib)
211 ;; XXX Don't build with opus on 32-bit systems:
212 ;; <https://bugs.gnu.org/32360>
213 ,@(if (target-64bit?)
214 `(("opus" ,opus))
215 '())))
216 (native-inputs
217 `(("pkg-config" ,pkg-config)
218 ("glib:bin" ,glib "bin")
219 ("gobject-introspection" ,gobject-introspection)
220 ("python-wrapper" ,python-wrapper)))
221 (arguments
222 '(#:configure-flags '("-Dgl=disabled"
223 ;; FIXME: Documentation fails to build without
224 ;; enabling GL above, which causes other problems.
225 "-Ddoc=false")
226 #:phases
227 (modify-phases %standard-phases
228 (add-before 'configure 'patch
229 (lambda _
230 (substitute* "tests/check/libs/pbutils.c"
231 (("/bin/sh") (which "sh")))
232 #t)))))
233 (home-page "https://gstreamer.freedesktop.org/")
234 (synopsis
235 "Plugins for the GStreamer multimedia library")
236 (description "This package provides an essential exemplary set of plug-ins
237 for the GStreamer multimedia library.")
238 (license license:lgpl2.0+)))
239
240 (define-public gst-plugins-good
241 (package
242 (name "gst-plugins-good")
243 (version "1.16.2")
244 (source
245 (origin
246 (method url-fetch)
247 (uri (string-append
248 "https://gstreamer.freedesktop.org/src/" name "/"
249 name "-" version ".tar.xz"))
250 (sha256
251 (base32
252 "068k3cbv1yf3gbllfdzqsg263kzwh21y8dpwr0wvgh15vapkpfs0"))))
253 (build-system meson-build-system)
254 (inputs
255 `(("aalib" ,aalib)
256 ("cairo" ,cairo)
257 ("flac" ,flac)
258 ("gdk-pixbuf" ,gdk-pixbuf)
259 ("gst-plugins-base" ,gst-plugins-base)
260 ("gtk+" ,gtk+)
261 ("jack" ,jack-1)
262 ("lame" ,lame)
263 ("libavc1394" ,libavc1394)
264 ("libcaca" ,libcaca)
265 ("libdv" ,libdv)
266 ("libiec61883" ,libiec61883)
267 ("libjpeg" ,libjpeg)
268 ("libpng" ,libpng)
269 ("libshout" ,libshout)
270 ("libsoup" ,libsoup)
271 ("libvpx" ,libvpx)
272 ("mpg123" ,mpg123)
273 ("orc" ,orc)
274 ("pulseaudio" ,pulseaudio)
275 ("speex" ,speex)
276 ("taglib" ,taglib)
277 ("twolame" ,twolame)
278 ("wavpack" ,wavpack)))
279 (native-inputs
280 `(("glib:bin" ,glib "bin")
281 ("pkg-config" ,pkg-config)
282 ("python-wrapper" ,python-wrapper)))
283 (arguments
284 `(#:phases
285 (modify-phases %standard-phases
286 ,@(if (string-prefix? "arm" (or (%current-target-system)
287 (%current-system)))
288 ;; FIXME: These tests started failing on armhf after switching to Meson.
289 ;; https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/689
290 `((add-after 'unpack 'disable-tests-for-armhf
291 (lambda _
292 (substitute* "tests/check/elements/rtpbin_buffer_list.c"
293 (("tcase_add_test \\(tc_chain, test_bufferlist\\);")
294 ""))
295 (substitute* "tests/check/elements/rtpulpfec.c"
296 (("tcase_add_loop_test.*rtpulpfecdec_recovered_from_many.*")
297 "")
298 (("tcase_add.*rtpulpfecdec_recovered_using_recovered_packet.*")
299 ""))
300 #t)))
301 '())
302 (add-after
303 'unpack 'disable-failing-tests
304 (lambda _
305 ;; Disable tests that fail non-deterministically.
306 ;; This test fails on aarch64 on 1.12.x.
307 (substitute* "tests/check/elements/alpha.c"
308 (("tcase_add_test \\(tc_chain, test_chromakeying\\);" all)
309 (string-append "/* " all " */")))
310 #t)))))
311 (home-page "https://gstreamer.freedesktop.org/")
312 (synopsis
313 "Plugins for the GStreamer multimedia library")
314 (description "GStreamer Good Plug-ins is a set of plug-ins for the
315 GStreamer multimedia library. This set contains those plug-ins which the
316 developers consider to have good quality code and correct functionality.")
317 (license license:lgpl2.0+)))
318
319 (define-public gst-plugins-bad
320 (package
321 (name "gst-plugins-bad")
322 (version "1.16.2")
323 (source (origin
324 (method url-fetch)
325 (uri (string-append "https://gstreamer.freedesktop.org/src/"
326 name "/" name "-" version ".tar.xz"))
327 (sha256
328 (base32
329 "0x0y0hm0ga3zqi5q4090hw5sjh59y1ry9ak16qsaascm72i7mjzi"))))
330 (build-system meson-build-system)
331 (arguments
332 `(#:phases
333 (modify-phases %standard-phases
334 ,@(if (string-prefix? "arm" (or (%current-target-system)
335 (%current-system)))
336 ;; Disable test that fails on ARMv7.
337 ;; https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1188
338 `((add-after 'unpack 'disable-asfmux-test
339 (lambda _
340 (substitute* "tests/check/meson.build"
341 (("\\[\\['elements/asfmux\\.c'\\]\\],")
342 ""))
343 #t)))
344 '())
345 (add-after 'unpack 'disable-failing-test
346 (lambda _
347 ;; FIXME: Why is this failing.
348 (substitute* "tests/check/meson.build"
349 ((".*elements/dash_mpd\\.c.*")
350 ""))
351 #t)))))
352 (propagated-inputs
353 `(("gst-plugins-base" ,gst-plugins-base)))
354 (native-inputs
355 `(("glib:bin" ,glib "bin") ; for glib-mkenums, etc.
356 ("gobject-introspection" ,gobject-introspection)
357 ;; TODO: Enable documentation for 1.18.
358 ;;("gtk-doc" ,gtk-doc)
359 ("pkg-config" ,pkg-config)
360 ("python" ,python)))
361 (inputs
362 ;; XXX: The following dependencies are missing:
363 ;; vo-amrwbenc, vo-aacenc, bs2b, chromaprint, directfb, daala, libdts,
364 ;; faac, flite, libgsm, libde265, libmms, libmimic, mjpegtools,
365 ;; mpeg2enc, libofa, opencv, openh264, openni2, libtimemmgr, wildmidi,
366 ;; openspc, gme, sbc, schroedinger, zbar, librtmp, spandsp
367 `(("bluez" ,bluez)
368 ("curl" ,curl)
369 ("faad2" ,faad2)
370 ("fluidsynth" ,fluidsynth)
371 ("gtk+" ,gtk+)
372 ("ladspa" ,ladspa)
373 ("libass" ,libass)
374 ("libdvdnav" ,libdvdnav)
375 ("libdvdread" ,libdvdread)
376 ("libgcrypt" ,libgcrypt)
377 ("libgudev" ,libgudev)
378 ("libkate" ,libkate)
379 ("libmodplug" ,libmodplug)
380 ("librsvg" ,librsvg)
381 ("libsndfile" ,libsndfile)
382 ("libsrtp" ,libsrtp)
383 ("libssh2" ,libssh2)
384 ("libusb" ,libusb)
385 ("libvdpau" ,libvdpau)
386 ("libwebp" ,libwebp)
387 ("libxml2" ,libxml2)
388 ("lrdf" ,lrdf)
389 ("mesa" ,mesa)
390 ("neon" ,neon)
391 ("openal" ,openal)
392 ("openexr" ,openexr)
393 ("openjpeg" ,openjpeg)
394 ("openssl" ,openssl)
395 ("opus" ,opus)
396 ("orc" ,orc)
397 ;("qtbase" ,qtbase)
398 ;("qtdeclarative" ,qtdeclarative)
399 ;("qtx11extras" ,qtx11extras)
400 ("soundtouch" ,soundtouch)
401 ("x265" ,x265)
402 ("wayland" ,wayland)))
403 (home-page "https://gstreamer.freedesktop.org/")
404 (synopsis "Plugins for the GStreamer multimedia library")
405 (description
406 "GStreamer Bad Plug-ins is a set of plug-ins whose quality aren't up to
407 par compared to the rest.")
408 (license license:lgpl2.0+)))
409
410 (define-public gst-plugins-ugly
411 (package
412 (name "gst-plugins-ugly")
413 (version "1.16.2")
414 (source
415 (origin
416 (method url-fetch)
417 (uri (string-append "https://gstreamer.freedesktop.org/src/"
418 name "/" name "-" version ".tar.xz"))
419 (sha256
420 (base32
421 "1jpvc32x6q01zjkfgh6gmq6aaikiyfwwnhj7bmvn52syhrdl202m"))))
422 (build-system meson-build-system)
423 (inputs
424 `(("gst-plugins-base" ,gst-plugins-base)
425 ("liba52" ,liba52)
426 ("libcdio" ,libcdio)
427 ("libmpeg2" ,libmpeg2)
428 ("libdvdread" ,libdvdread)
429 ("libx264" ,libx264)
430 ;; TODO:
431 ;; * opencore-amr (for the AMR-NB decoder and encoder and the
432 ;; AMR-WB decoder) <http://sourceforge.net/projects/opencore-amr/>
433 ("orc" ,orc)))
434 (native-inputs
435 `(("glib:bin" ,glib "bin")
436 ("pkg-config" ,pkg-config)
437 ("python-wrapper" ,python-wrapper)))
438 (home-page "https://gstreamer.freedesktop.org/")
439 (synopsis "GStreamer plugins from the \"ugly\" set")
440 (description "GStreamer Ugly Plug-ins. This set contains those plug-ins
441 which the developers consider to have good quality code but that might pose
442 distribution problems in some jurisdictions, e.g. due to patent threats.")
443 (license license:lgpl2.0+)))
444
445 (define-public gst-libav
446 (package
447 (name "gst-libav")
448 (version "1.16.2")
449 (source (origin
450 (method url-fetch)
451 (uri (string-append
452 "https://gstreamer.freedesktop.org/src/" name "/"
453 name "-" version ".tar.xz"))
454 (sha256
455 (base32
456 "1wpfilc98bad9nsv3y1qapxp35dvn2mvwvrmqwrsj58cf09gc967"))
457 (modules '((guix build utils)))
458 (snippet
459 '(begin
460 ;; Drop bundled ffmpeg.
461 (delete-file-recursively "gst-libs/ext/libav")
462 #t))))
463 (build-system meson-build-system)
464 (native-inputs
465 `(("pkg-config" ,pkg-config)
466 ("python" ,python)))
467 (inputs
468 `(("gst-plugins-base" ,gst-plugins-base)
469 ("ffmpeg" ,ffmpeg)
470 ("orc" ,orc)
471 ("zlib" ,zlib)))
472 (home-page "https://gstreamer.freedesktop.org/")
473 (synopsis "Plugins for the GStreamer multimedia library")
474 (description
475 "This GStreamer plugin supports a large number of audio and video
476 compression formats through the use of the libav library.")
477 (license license:gpl2+)))
478
479 (define-public python-gst
480 (package
481 (name "python-gst")
482 (version "1.16.2")
483 (source (origin
484 (method url-fetch)
485 (uri (string-append
486 "https://gstreamer.freedesktop.org/src/gst-python/"
487 "gst-python-" version ".tar.xz"))
488 (sha256
489 (base32
490 "1a48ca66izmm8hnp608jv5isg3jxb0vlfmhns0bg9nbkilag7390"))))
491 (build-system meson-build-system)
492 (arguments
493 `(#:modules ((guix build meson-build-system)
494 (guix build utils)
495 ((guix build python-build-system) #:prefix python:))
496 #:imported-modules (,@%meson-build-system-modules
497 (guix build python-build-system))
498 #:configure-flags
499 (list (string-append
500 "-Dpygi-overrides-dir="
501 (python:site-packages %build-inputs %outputs) "gi/overrides"))))
502 (native-inputs
503 `(("pkg-config" ,pkg-config)
504 ("python" ,python)))
505 (propagated-inputs
506 `(("gst-plugins-base" ,gst-plugins-base)
507 ("python-pygobject" ,python-pygobject)))
508 (home-page "https://gstreamer.freedesktop.org/")
509 (synopsis "GStreamer GObject Introspection overrides for Python")
510 (description
511 "This package contains GObject Introspection overrides for Python that can
512 be used by Python applications using GStreamer.")
513 (license license:lgpl2.1+)
514 (properties `((python2-variant . ,(delay python2-gst))))))
515
516 (define-public python2-gst
517 (package (inherit python-gst)
518 (name "python2-gst")
519 (native-inputs
520 `(("pkg-config" ,pkg-config)
521 ("python" ,python-2)))
522 (propagated-inputs
523 `(("gst-plugins-base" ,gst-plugins-base)
524 ("python-pygobject" ,python2-pygobject)))))
525
526 (define-public gst123
527 (package
528 (name "gst123")
529 (version "0.3.5")
530 (source (origin
531 (method url-fetch)
532 (uri (string-append "http://space.twc.de/~stefan/gst123/gst123-"
533 version ".tar.bz2"))
534 (sha256
535 (base32
536 "0zaa117n4wkya9p903vkj8hj58lmdb66pxsdx5wwcv7nffbp5d67"))))
537 (build-system gnu-build-system)
538 (inputs
539 `(("gtk+" ,gtk+-2)
540 ("ncurses" ,ncurses)
541 ("gstreamer" ,gstreamer)
542 ("gst-plugins-base" ,gst-plugins-base)))
543 (native-inputs
544 `(("pkg-config" ,pkg-config)))
545 (home-page "http://space.twc.de/~stefan/gst123.php")
546 (synopsis "Flexible command line media player based on gstreamer")
547 (description "The program gst123 is designed to be a more flexible command
548 line player in the spirit of ogg123 and mpg123, based on the gstreamer media
549 framework. It plays all file formats gstreamer supports, so if you have a
550 music collection which contains different file formats, like flac, ogg and
551 mp3, you can use gst123 to play all your music files.")
552 (license license:lgpl2.0+)))