gnu: Add MLT 7.
[jackhill/guix/guix.git] / gnu / packages / video.scm
index 74c8d3b..5503beb 100644 (file)
@@ -52,6 +52,7 @@
 ;;; Copyright © 2021 David Wilson <david@daviwil.com>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2020 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
   #:use-module (gnu packages vulkan)
   #:use-module (gnu packages web)
   #:use-module (gnu packages webkit)
+  #:use-module (gnu packages wget)
   #:use-module (gnu packages wxwidgets)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xiph)
@@ -1021,89 +1023,115 @@ H.264 (MPEG-4 AVC) video streams.")
 (@command{mkvmerge}).")
     (license license:gpl2)))
 
-(define-public straw-viewer
+(define-public pipe-viewer
   (package
-    (name "straw-viewer")
-    (version "0.1.3")
+    (name "pipe-viewer")
+    (version "0.1.2")
     (source
      (origin
        (method git-fetch)
-       (uri (git-reference
-             (url "https://github.com/trizen/straw-viewer")
-             (commit version)))
+       (uri
+        (git-reference
+         (url "https://github.com/trizen/pipe-viewer")
+         (commit version)))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "1n21byn7hqykpm94jmmnir1fwsskq6dp9wgj0bd2qf0qx5nq33cl"))))
+        (base32 "1d2gfkd3nc0c4ah67250lqskkd85wpljrikw8a378ni398ngaq14"))))
     (build-system perl-build-system)
+    (arguments
+     `(#:imported-modules
+       ((guix build copy-build-system)
+        ,@%perl-build-system-modules)
+       #:modules
+       (((guix build copy-build-system)
+         #:prefix copy:)
+        (guix build perl-build-system)
+        (guix build utils)
+        (srfi srfi-26))
+       #:module-build-flags
+       (list
+        "--gtk3")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-source
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* (find-files "." ".*-viewer$")
+               (("'ffmpeg'")
+                (format #f "'~a/bin/ffmpeg'"
+                        (assoc-ref inputs "ffmpeg")))
+               (("'wget'")
+                (format #f "'~a/bin/wget'"
+                        (assoc-ref inputs "wget")))
+               (("'xdg-open'")
+                (format #f "'~a/bin/xdg-open'"
+                        (assoc-ref inputs "xdg-utils")))
+               (("'youtube-dl'")
+                (format #f "'~a/bin/youtube-dl'"
+                        (assoc-ref inputs "youtube-dl"))))))
+         (add-after 'install 'install-xdg
+           (lambda args
+             (apply (assoc-ref copy:%standard-phases 'install)
+                    #:install-plan
+                    '(("share/icons" "share/pixmaps")
+                      ("share" "share/applications"
+                       #:include-regexp ("\\.desktop$")))
+                    args)))
+         (add-after 'install-xdg 'wrap-programs
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin-dir (string-append out "/bin/"))
+                    (site-dir (string-append out "/lib/perl5/site_perl/"))
+                    (perl-lib (getenv "PERL5LIB"))
+                    (gi-typelib (getenv "GI_TYPELIB_PATH")))
+               (for-each
+                (cut wrap-program <>
+                     `("PERL5LIB" ":" prefix (,perl-lib ,site-dir))
+                     `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib)))
+                (find-files bin-dir))))))))
     (native-inputs
      `(("perl-module-build" ,perl-module-build)
-       ("perl-test-pod" ,perl-test-pod)))
+       ("perl-test-pod" ,perl-test-pod)
+       ("perl-test-simple" ,perl-test-simple)))
     (inputs
      `(("perl-data-dump" ,perl-data-dump)
+       ("perl-digest-md5" ,perl-digest-md5)
+       ("perl-encode" ,perl-encode)
+       ("ffmpeg" ,ffmpeg)
+       ("perl-file-path" ,perl-file-path)
+       ("perl-file-sharedir" ,perl-file-sharedir)
+       ("perl-getopt-long" ,perl-getopt-long)
+       ("perl-gtk3" ,perl-gtk3)
+       ("perl-http-message" ,perl-http-message)
        ("perl-json" ,perl-json)
+       ("perl-json-xs" ,perl-json-xs)
        ("perl-libwww" ,perl-libwww)
        ("perl-lwp-protocol-https" ,perl-lwp-protocol-https)
        ("perl-lwp-useragent-cached" ,perl-lwp-useragent-cached)
-       ("perl-mozilla-ca" ,perl-mozilla-ca)
+       ("perl-memoize" ,perl-memoize)
+       ("perl-mime-base64" ,perl-mime-base64)
+       ("perl-pathtools" ,perl-pathtools)
+       ("perl-scalar-list-utils" ,perl-scalar-list-utils)
+       ("perl-storable" ,perl-storable)
+       ("perl-term-ansicolor" ,perl-term-ansicolor)
        ("perl-term-readline-gnu" ,perl-term-readline-gnu)
+       ("perl-text-parsewords" ,perl-text-parsewords)
+       ("perl-text-tabs+wrap" ,perl-text-tabs+wrap)
        ("perl-unicode-linebreak" ,perl-unicode-linebreak)
-       ("xdg-utils" ,xdg-utils)))
-    ;; Required only when building the graphical interface (--gtk).
-    ;;("perl-file-sharedir" ,perl-file-sharedir)
-    
-    ;; Some videos play without youtube-dl, but others silently fail to.
+       ("perl-uri-escape" ,perl-uri-escape)
+       ("wget" ,wget)
+       ("xdg-utils" ,xdg-utils)
+       ("youtube-dl" ,youtube-dl)))
     (propagated-inputs
-     `(("youtube-dl" ,youtube-dl)))
-    (arguments
-     `(#:modules ((guix build perl-build-system)
-                  (guix build utils)
-                  (srfi srfi-26))
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'refer-to-inputs
-           (lambda* (#:key inputs #:allow-other-keys)
-             (substitute* "lib/WWW/StrawViewer.pm"
-               (("'youtube-dl'")
-                (format #f "'~a/bin/youtube-dl'"
-                        (assoc-ref inputs "youtube-dl"))))
-             (substitute* "bin/gtk-straw-viewer"
-               (("'xdg-open'")
-                (format #f "'~a/bin/xdg-open'"
-                        (assoc-ref inputs "xdg-utils"))))
-             #t))
-         ;; (add-after 'install 'install-desktop
-         ;;   (lambda* (#:key outputs #:allow-other-keys)
-         ;;     (let* ((out (assoc-ref outputs "out"))
-         ;;            (sharedir (string-append out "/share")))
-         ;;       (install-file "share/gtk-straw-viewer.desktop"
-         ;;                     (string-append sharedir "/applications"))
-         ;;       (install-file "share/icons/gtk-straw-viewer.png"
-         ;;                     (string-append sharedir "/pixmaps"))
-         ;;       #t)))
-         (add-after 'install 'wrap-program
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (bin-dir (string-append out "/bin/"))
-                    (site-dir (string-append out "/lib/perl5/site_perl/"))
-                    (lib-path (getenv "PERL5LIB")))
-               (for-each (cut wrap-program <>
-                              `("PERL5LIB" ":" prefix (,lib-path ,site-dir)))
-                         (find-files bin-dir))
-               #t))))))
-    (synopsis
-     "Light-weight application for searching and streaming videos from YouTube")
-    (description
-     "Straw-viewer searches for YouTube videos using @uref{https://invidio.us/,
-invidio.us} and plays them locally in a native media player like @command{vlc}
-or @command{mpv}.
-
-You can search for videos, playlists, and/or channels.  The videos are streamed
-directly to the player at the best chosen resolution and with closed captions if
-available.")
-    ;; XXX Add #:module-build-flags '("--gtk") dependencies and this sentence.
-    ;; Both a command-line and a graphical interface are available.
-    (home-page "https://github.com/trizen/youtube-viewer")
-    (license license:perl-license)))
+     `(("dconf" ,dconf)))
+    (home-page "https://github.com/trizen/pipe-viewer")
+    (synopsis "CLI+GUI YouTube Client")
+    (description "Pipe-Viewer is a lightweight application for searching and
+playing videos from YouTube.  It parses the YouTube website directly and relies
+on the Invidious instances only as a fallback method.")
+    (license license:artistic2.0)))
+
+(define-public straw-viewer
+  (deprecated-package "straw-viewer" pipe-viewer))
 
 (define-public x265
   (package
@@ -2989,35 +3017,27 @@ from sites like Twitch.tv and pipes them into a video player of choice.")
 (define-public mlt
   (package
     (name "mlt")
-    (version "6.26.1")
-    (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                    (url "https://github.com/mltframework/mlt")
-                    (commit (string-append "v" version))))
-              (file-name (git-file-name name version))
-              (sha256
-               (base32
-                "1gz79xvs5jrzqhwhfk0dqdd3xiavnjp4q957h7nb02rij32byb39"))))
-    (build-system gnu-build-system)
+    (version "7.0.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/mltframework/mlt")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "13c5miph9jjbz69dhy0zvbkk5zbb05dr3vraaci0d5fdbrlhyscf"))))
+    (build-system cmake-build-system)
     (arguments
-     `(#:tests? #f                      ; no tests
-       #:make-flags '(,(string-append "CC=" (cc-for-target))
-                      ,(string-append "CXX=" (cxx-for-target)))
-       #:configure-flags
-       (list "--enable-gpl3"
-             "--enable-gpl")
+     `(#:tests? #f ;requires "Kwalify"
        #:phases
        (modify-phases %standard-phases
-         (add-after
-             'configure 'override-LDFLAGS
+         (add-before 'configure 'override-LDFLAGS
            (lambda* (#:key outputs #:allow-other-keys)
-             (substitute* "config.mak"
-               (("LDFLAGS\\+=")
-                (string-append "LDFLAGS+=-Wl,-rpath="
-                               (assoc-ref outputs "out")
-                               "/lib ")))
-             #t)))))
+             (setenv "LDFLAGS"
+                     (string-append
+                      "-Wl,-rpath="
+                      (assoc-ref outputs "out") "/lib")))))))
     (inputs
      `(("alsa-lib" ,alsa-lib)
        ("alsa-plugins" ,alsa-plugins "pulseaudio")
@@ -3025,7 +3045,7 @@ from sites like Twitch.tv and pipes them into a video player of choice.")
        ("fftw" ,fftw)
        ("frei0r-plugins" ,frei0r-plugins)
        ("gdk-pixbuf" ,gdk-pixbuf)
-       ("gtk+" ,gtk+-2)
+       ("gtk+" ,gtk+)
        ("libxml2" ,libxml2)
        ("jack" ,jack-1)
        ("ladspa" ,ladspa)
@@ -3054,6 +3074,33 @@ functionality of the system is provided via an assortment of ready to use
 tools, XML authoring components, and an extensible plug-in based API.")
     (license license:lgpl2.1+)))
 
+(define-public mlt-6
+  (package
+    (inherit mlt)
+    (name "mlt")
+    (version "6.26.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/mltframework/mlt")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1gz79xvs5jrzqhwhfk0dqdd3xiavnjp4q957h7nb02rij32byb39"))))
+    (arguments
+     `(#:configure-flags
+       (list (string-append "-DGTK2_GDKCONFIG_INCLUDE_DIR="
+                            (assoc-ref %build-inputs "gtk+")
+                             "/lib/gtk-2.0/include")
+             (string-append "-DGTK2_GLIBCONFIG_INCLUDE_DIR="
+                            (assoc-ref %build-inputs "glib")
+                            "/lib/glib-2.0/include"))
+       ,@(package-arguments mlt)))
+    (inputs
+     `(("gtk+", gtk+-2)
+       ,@(alist-delete "gtk+" (package-inputs mlt))))))
+
 (define-public v4l-utils
   (package
     (name "v4l-utils")
@@ -4677,7 +4724,7 @@ transitions, and effects and then export your film to many common formats.")
        ("lame" ,lame)
        ("libvpx" ,libvpx)
        ("libx264" ,libx264)
-       ("mlt" ,mlt)
+       ("mlt" ,mlt-6)
        ("pulseaudio" ,pulseaudio)
        ("qtbase" ,qtbase-5)
        ("qtdeclarative" ,qtdeclarative)