[bug#34050] gnu: Add libaom and activate AV1 support in ffmpeg.

Message ID 871s5iemss.fsf@web.de
State Accepted
Headers show
Series [bug#34050] gnu: Add libaom and activate AV1 support in ffmpeg. | expand

Checks

Context Check Description
cbaines/package builds pending In Cuirass
cbaines/package builds pending In Cuirass
cbaines/package builds pending In Cuirass
cbaines/package builds pending In Cuirass
cbaines/applying patch success Successfully applied

Commit Message

Dr. Arne Babenhauserheide Jan. 12, 2019, 12:24 a.m. UTC
* gnu/packages/video.scm (libaom): New variable.
    * gnu/packages/video.scm (ffmpeg): Add libaom support.
    [inputs] new input libaom.
    [arguments] new configure-flag --enable-libaom.
---
 gnu/packages/video.scm | 38 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

Comments

Dr. Arne Babenhauserheide Jan. 12, 2019, 12:13 p.m. UTC | #1
There’s a problem with my patch: ffmpeg-3.4 inherits the values of ffmpeg but does not support the --enable-aom option.

How can I filter it?

This is the definition:

(define-public ffmpeg-3.4
  (package
    (inherit ffmpeg)
    (version "3.4.5")
    (source (origin
             (method url-fetch)
             (uri (string-append "https://ffmpeg.org/releases/ffmpeg-"
                                 version ".tar.xz"))
             (sha256
              (base32
               "0b59qk5wpc5ksiha76jbhb859g5gxa4w0k6afh3kgvgajiivs73l"))))))

Best wishes,
Arne
Leo Famulari Jan. 12, 2019, 11:33 p.m. UTC | #2
On Sat, Jan 12, 2019 at 01:13:09PM +0100, Arne Babenhauserheide wrote:
> There’s a problem with my patch: ffmpeg-3.4 inherits the values of ffmpeg but does not support the --enable-aom option.
> 
> How can I filter it?

Take a look at ((guix utils) substitute-keyword-arguments) and examples
of it being used in existing packages. Basically, you'll inherit the
arguments of ffmpeg but replace #:configure-flags with something
appropriate for ffmpeg-3.4.
Ludovic Courtès Jan. 13, 2019, 10:19 p.m. UTC | #3
Hello Arne,

"Arne Babenhauserheide" <Arne_Bab@web.de> skribis:

> There’s a problem with my patch: ffmpeg-3.4 inherits the values of ffmpeg but does not support the --enable-aom option.
>
> How can I filter it?

You can use ‘substitute-keyword-arguments’, along these lines:


   (define ffmpeg-3.4
     (package
       (inherit ffmpeg)
       ;; …
       (arguments (substitute-keyword-arguments (package-arguments ffmpeg)
                    …))))

See the other packages that use it as examples.

HTH!

Ludo’.

Patch

diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index 52facebe4..97ae20b05 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -236,6 +236,40 @@  A/52 standard is used in a variety of applications, including digital
 television and DVD.  It is also known as AC-3.")
     (license license:gpl2+)))
 
+(define-public libaom
+  (package
+    (name "libaom")
+    (version "22b150bf040608028a56d8bf39e72f771383d836") ;; master
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://aomedia.googlesource.com/aom/")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1pdd5h3n42607n6qmggz4yv8izhjr2kl6knb3kh7gh4v0vy47h1r"))))
+    (build-system cmake-build-system)
+    (native-inputs
+     `(("git" ,git)
+       ("perl" ,perl)
+       ("pkg-config" ,pkg-config)
+       ("python" ,python))) ; to detect the version
+    (arguments
+     `(#:tests? #f  ;no check target
+       #:configure-flags
+         ;; build dynamic library
+       (list "-DBUILD_SHARED_LIBS=YES"
+             "-DENABLE_PIC=TRUE"
+             "-DAOM_TARGET_CPU=generic"
+             (string-append "-DCMAKE_INSTALL_PREFIX="
+                              (assoc-ref %outputs "out")))))
+    (home-page "https://aomedia.googlesource.com/aom/")
+    (synopsis "AV1 Codec Library")
+    (description "libaom is the reference encoder of AV1.")
+    (license license:bsd-2)))
+
+
 (define-public libmpeg2
   (package
     (name "libmpeg2")
@@ -700,6 +734,7 @@  standards (MPEG-2, MPEG-4 ASP/H.263, MPEG-4 AVC/H.264, and VC-1/VMW3).")
        ("opus" ,opus)
        ("ladspa" ,ladspa)
        ("lame" ,lame)
+       ("libaom" ,libaom)
        ("libass" ,libass)
        ("libbluray" ,libbluray)
        ("libcaca" ,libcaca)
@@ -778,7 +813,8 @@  standards (MPEG-2, MPEG-4 ASP/H.263, MPEG-4 AVC/H.264, and VC-1/VMW3).")
        ;;   --enable-libzmq          enable message passing via libzmq [no]
        ;;   --enable-libzvbi         enable teletext support via libzvbi [no]
        ;;   --enable-opencl          enable OpenCL code
-       '("--enable-avresample"
+       '("--enable-libaom" ; for AV1
+         "--enable-avresample"
          "--enable-gpl" ; enable optional gpl licensed parts
          "--enable-shared"
          "--enable-frei0r"