unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Raghav Gururajan <raghavgururajan@disroot.org>
To: Danny Milosavljevic <dannym@scratchpost.org>
Cc: guix-devel@gnu.org
Subject: Re: [OUTREACHY]: Integration of desktop environments into GNU Guix
Date: Sat, 4 Jul 2020 06:37:59 -0400	[thread overview]
Message-ID: <8c2fb558-249e-e96c-d2b2-ef53d3adfd00@disroot.org> (raw)
In-Reply-To: <20200625004018.62dd2ac5@scratchpost.org>


[-- Attachment #1.1.1: Type: text/plain, Size: 14393 bytes --]

@Danny

> * In ruby-slim: Why are tests disabled?  There are tests.

Ah yes! I have not disabled the tests with correct comment.

> * In libmpeg3: Could you unbundle a52dec-0.7.3?  It's bundled right now.

Done!

> * In flux, a git commit is used.  We usually don't package non-releases.
>   Is there a good reason?

Fixed now. The version is 1.1.0. I over-looked as there were no tags.

> * 0019-gnu-Add-asciidoctor.patch does some other stuff to other packages, and that
> fact isn't mentioned in the commit log in the patch.  Why not?

This patch has been removed from the patch-set now, as the package
already exist in the name of ruby-asciidoctor.

> * If nng is compatible with nanomsg, why do we need the "nanomsg" package at all?

It appears they have different library and header files.

> * In tesseract-ocr you propagate leptonica.  Why?
>   If we did that, users that would install tesseract for the "tesseract" binary
>   would get leptonica in their profile.
>   Is it necessary?

It is required as per .pc file. lpt --> leptonica.

> * ccextractor still has a XXX.  Does it work?

Fixed now.

> * In libtimidity, what's the problem with libtimidity using its own "play"
> binary?  I would expect the package to test itself like that...

Fixed now.

I initially thought the binary was distributed in binary-only form.
Turns out it is built from source. Also, it required package 'ao'.

> * In faac, what do the comments "Newer code" and "Older code" mean?

Fixed now.

The older meant original base code, on which the project was forked
upon. The newer meant changes made by the project.

> * In flite, there are tests, but they fail.

Now diabled with comments.

> * In libopenmpt, why does it propagate zlib?  That sounds wrong.

Fixed now.

Please find the attached patches.


@Others

Please find the following git log:

*** START ***

commit 21061a651f516d4df94f8a6a65775f4c41d92d76
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Sat Jul 4 05:21:57 2020 -0400

    gnu: gst-libav: Update package definition.

    * gnu/packages/gstreamer.scm (gst-libav): Update package definition.
    [arguments]<#:phases>['patch-docbook-xml]: New phase.
    [native-inputs]: Add docbook-xml, perl and ruby.
    [inputs]: Remove gst-plugins-base, orc and zlib.
    [propagated-inputs]: Add gstreamer and gst-plugins-base.
    [synopsis]: Modify.
    [description]: Modify.
    [license]: Change from gpl2+ to lgpl2.0+.

commit 1b41ffd6da8efe18e8790bfe4d84a9e05b7bd0e8
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Sat Jul 4 05:20:50 2020 -0400

    gnu: gst-plugins-ugly: Update package definition.

    * gnu/packages/gstreamer.scm (gst-plugins-ugly): Update package
definition.
    [arguments]<#:glib-or-gtk?>: New argument.
    <#:phases>['patch-docbook-xml]: New phase.
    ['pre-check]: New phase.
    [native-inputs]: Add docbook-xml, gettext-minimal,
gsettings-desktop-schemas,
    perl and xorg-server-for-tests.
    [inputs]: Add glib, glib-networking and opencore-amr. Remove
gst-plugins-base.
    [propagated-inputs]: Add gstreamer and gst-plugins-base.
    [synopsis]: Modify.
    [description]: Modify.

commit 4889d6baeadf35269edc702b9dfad7c0c8bea317
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Sat Jul 4 05:13:42 2020 -0400

    gnu: gst-plugins-bad: Update package definition.

    * gnu/packages/gstreamer.scm (gst-plugins-base): Update package
definition.
    [outputs]: New output 'doc'.
    [arguments]<#:glib-or-gtk?>: New argument.
    <#:phases>['fix-build-errors]: New phase.
    ['patch-docbook-xml]: New phase.
    ['pre-check]: New phase.
    ['move-doc]: New phase.
    [native-inputs]: Add docbook-xml, gettext-minimal,
gsettings-desktop-schemas,
    perl, libxml2 and xorg-server-for-tests.
    [inputs]: Add bzip2, cairo, ccextractor, chromaprint, directfb, faac,
    flite, glib, glib-networking, glu, gsm, iqa, lcms, libaom, libbs2b,
libdc1394,
    libdca, libde265, libdrm, libexif, libfdk, libgme, libmfx, libmms,
libmpcdec,
    libnice, libofa, libopenmpt, libtiff, libva, libx11, libxcb,
libxext, libxshm, lilv,
    lv2, mjpegtools, nettle, opencv, openh264, openni2, opensles, pango,
rtmpdump,
    sbc, sctp, spandsp, srt, svt-hevc, transcode, v4l-utils, vo-aacenc,
vo-amrwbenc,
    vulkan-headers, vulkan-loader, webrtc-audio-processing, wildmidi,
    wpebackend-fdo, zbar and zxing-cpp.
    [propagated-inputs]: Add gstreamer and gst-plugins-base.
    [synopsis]: Modify.
    [description]: Modify.

commit 05e54fa894e5998b65ccce87467ca160a1ec5731
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Sat Jul 4 03:11:51 2020 -0400

    gnu: Add opensles.

    * gnu/packages/audio.scm (opensles): New variable.

commit e812fd130dabda501d5508b2ba781a4e787f8c66
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Fri Jul 3 13:02:22 2020 -0400

    gnu: Add rust-imgref.

    * gnu/packages/crates-io.scm (rust-imgref): New variable.

commit 160fa94f7ffe1c54915106506b366251f4fcd62c
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Fri Jul 3 12:14:25 2020 -0400

    gnu: Add openni2.

    * gnu/packages/gstreamer.scm (openni2): New variable.

commit 593388c5a11b993699b63993db99d138cbca35b5
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Fri Jul 3 12:12:59 2020 -0400

    gnu: Add libnice.

    * gnu/packages/networking.scm (libnice): New variable.

commit e9701a31ff8213ae2b2caba0f1756bfaf01888a3
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Fri Jul 3 12:10:10 2020 -0400

    gnu: Add rtmpdump.

    * gnu/packages/networking.scm (rtmpdump): New variable.

commit f805f26f03c812658e0ed0606b47a78208d5856f
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Fri Jul 3 12:08:33 2020 -0400

    gnu: Add iqa.

    * gnu/packages/image.scm (iqa): New variable.

commit 3004121e24d5732caa93e6260cc5605ea8deda40
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Fri Jul 3 12:06:23 2020 -0400

    gnu: Add zxing-cpp.

    * gnu/packages/aidc.scm (zxing-cpp): New variable.

commit b5a86585954259fbf20722079c7a5fa384b5b2d4
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Fri Jul 3 11:49:36 2020 -0400

    gnu: Add wildmidi.

    * gnu/packages/audio.scm (wildmidi): New variable.

commit e258e023bf246ea961b6be46bff7808b5f029883
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Fri Jul 3 11:25:10 2020 -0400

    gnu: Add webrtc-audio-processing.

    * gnu/packages/audio.scm (webrtc-audio-processing): New variable.

commit 330d27978badff5c3a88e15cd8068e20d0a26b5c
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Fri Jul 3 11:23:48 2020 -0400

    gnu: Add vo-aacenc.

    * gnu/packages/audio.scm (vo-aacenc): New variable.

commit 680003a107d7e64cee7e3a6c4283e5a67a61de98
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Fri Jul 3 11:22:08 2020 -0400

    gnu: Add transcode.

    * gnu/packages/video.scm (transcode): New variable.
    * gnu/packages/patches/transcode-ffmpeg.patch: New file.
    * gnu/local.mk (transcode-ffmpeg.patch): New reference.

commit 0854bf5a69af3af1a4a3784acebcd8e77dad70a0
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Fri Jul 3 11:18:19 2020 -0400

    gnu: Add tinyalsa.

    * gnu/packages/audio.scm (tinyalsa): New variable.

commit 13dcaf86065d3ce9d84ef4776f137050f3f627d2
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Fri Jul 3 11:16:21 2020 -0400

    gnu: Add svt-hevc.

    * gnu/packages/video.scm (svt-hevc): New variable.

commit e397b83cf9d21afa37977c8c854dadbc78302516
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Fri Jul 3 10:59:03 2020 -0400

    gnu: Add mediasdk.

    * gnu/packages/video.scm (mediasdk): New variable.

commit f8f6c6502e1853ecfcbc25768156d2fd6dfc0d1c
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Fri Jul 3 09:44:14 2020 -0400

    gnu: Add srt.

    * gnu/packages/networking.scm (srt): New variable.

commit 39885fcfa5fe43f4bea6932c45f6be49b3459716
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Fri Jul 3 09:43:19 2020 -0400

    gnu: Add lksctp-tools.

    * gnu/packages/networking.scm (lksctp-tools): New variable.

commit 4663dc3351eb9c4512c32a4df98ba57351c7b01a
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Fri Jul 3 09:41:39 2020 -0400

    gnu: Add opensles.

    * gnu/packages/audio.scm (opensles): New variable.

commit 196951ed551b199f0f4233389cc836cf40182092
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Fri Jul 3 09:40:24 2020 -0400

    gnu: Add libopenmpt.

    * gnu/packages/audio.scm (libopenmpt): New variable.

commit 99bb9b203f253ac46bf9b055aa7287cdc744bf44
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Fri Jul 3 09:16:01 2020 -0400

    gnu: Add libofa.

    * gnu/packages/audio.scm (libofa): New variable.
    * gnu/packages/patches/libofa-ftbfs-1.diff: New file.
    * gnu/packages/patches/libofa-curl.diff: New file.
    * gnu/packages/patches/libofa-ftbfs-2.diff: New file.
    * gnu/local.mk (libofa-ftbfs-1.diff): New reference.
    * gnu/local.mk (libofa-curl.diff): New reference.
    * gnu/local.mk (libofa-ftbfs-2.diff): New reference.

commit ac7243f1d5832d37f7edffd3281094300b833788
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Fri Jul 3 08:07:02 2020 -0400

    gnu: Add mjpegtools.

    * gnu/packages/video.scm (mjpegtools): New variable.

commit 36d39908f4c608b6ed13593cbb434ed667d4db52
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Fri Jul 3 08:03:40 2020 -0400

    gnu: Add libquicktime.

    * gnu/packages/video.scm (libquicktime): New variable.
    * gnu/packages/patches/libquicktime-ffmpeg.patch: New file.
    * gnu/local.mk (libquicktime-ffmpeg.patch): New reference.

commit 91f31378141ad994884d3a83db30deb07d7b7dea
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Fri Jul 3 07:14:26 2020 -0400

    gnu: Add schroedinger.

    * gnu/packages/video.scm (schroedinger): New variable.

commit 78c129ac8656540ec8599c68157dae5f82eba647
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Fri Jul 3 07:12:48 2020 -0400

    gnu: Add libmms.

    * gnu/packages/video.scm (libmms): New variable.

commit aa366534f7fecda57d18b4e9162ee6f1a1235dd4
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Thu Jul 2 09:56:33 2020 -0400

    gnu: Add libde265.

    * gnu/packages/video.scm (libde265): New variable.

commit 71b7882404917563398e0fb54274b0a83ca25db1
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Thu Jul 2 09:10:19 2020 -0400

    gnu: Add libvideogfx.

    * gnu/packages/video.scm (libvideogfx): New variable.

commit b038f8f315c6dc1015794f950512ab80f7cfaa20
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Thu Jul 2 05:52:47 2020 -0400

    gnu: Add ffmpeg-2.8.

    * gnu/packages/video.scm (ffmpeg-2.8): New variable.

commit 5ea62c03c490f798e1478d5a27ea2733b6472ddf
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Thu Jul 2 01:55:56 2020 -0400

    gnu: Add flite.

    * gnu/packages/speech.scm (flite): New variable.

commit ca172dd43ec32775f12f4f0ee7ec59f628548f2c
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Wed Jul 1 06:06:41 2020 -0400

    gnu: Add faac.

    * gnu/packages/audio.scm (faac): New variable.

commit bd77133228c63547998aa7cf7e90776bc0e8c0a4
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Wed Jul 1 06:00:23 2020 -0400

    gnu: Add directfb.

    * gnu/packages/graphics.scm (directfb): New variable.

commit ccc04df59b953e993bfba18ee8692e396f4393b6
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Wed Jul 1 05:55:02 2020 -0400

    gnu: Add libtimidity.

    * gnu/packages/audio.scm (libtimidity): New variable.

commit ec9f500fdb5f45ded1d7f066bf9b845d630358a9
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Wed Jul 1 01:04:20 2020 -0400

    gnu: Add flux.

    * gnu/packages/graphics.scm (flux): New variable.

commit c84083b0c0f3952f82e041b3f50ffa3cb4ae6ca4
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Wed Jul 1 00:45:50 2020 -0400

    gnu: Add tslib.

    * gnu/packages/video.scm (tslib): New variable.

commit 8d9e10ef1ded6f81da4efc2de79986928ad00f99
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Wed Jul 1 00:24:40 2020 -0400

    gnu: Add libmpeg3.

    * gnu/packages/video.scm (libmpeg3): New variable.

commit e3979c9fa51ed95753d06484f772d068aecaf996
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Tue Jun 30 06:54:00 2020 -0400

    gnu: Add ruby-slim.

    * gnu/packages/ruby.scm (ruby-slim): New variable.

commit 194cc4cce3ca0d2678b8a3bc0f08e8a2764699cd
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Mon Jun 29 03:05:39 2020 -0400

    gnu: Add libdc1394.

    * gnu/packages/gstreamer.scm (libdc1394): New variable.

commit 4886ac01b8c62c4d51f2501a778f69da2eaf7954
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Mon Jun 29 01:58:27 2020 -0400

    gnu: Add ccextractor.

    * gnu/packages/gstreamer.scm (ccextractor): New variable.

commit 5140dbf01a6fac4d8827cf173d2445d97e7fe798
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Mon Jun 29 01:53:03 2020 -0400

    gnu: tesseract-ocr: Propagate leptonica.

    * gnu/packages/ocr.scm (tesseract-ocr) [inputs]: Move leptonica to ...
    [propagated-inputs]: ... here.

commit e7f8c22e007a8ca64a93cbef53cee7fe1a30b1d6
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Mon Jun 29 01:48:27 2020 -0400

    gnu: Add nng.

    * gnu/packages/networking.scm (nng): New variable.

commit b3148ad0efcc3e5304061a5ca10a2026687af20a
Author: Raghav Gururajan <raghavgururajan@disroot.org>
Date:   Mon Jun 29 01:39:30 2020 -0400

    gnu: Add nanomsg.

    * gnu/packages/networking.scm (nanomsg): New variable.

*** END ***

Regards,
RG.

[-- Attachment #1.1.2: 0010-gnu-Add-nanomsg.patch --]
[-- Type: text/x-patch, Size: 2633 bytes --]

From b3148ad0efcc3e5304061a5ca10a2026687af20a Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Mon, 29 Jun 2020 01:39:30 -0400
Subject: [PATCH 10/51] gnu: Add nanomsg.

* gnu/packages/networking.scm (nanomsg): New variable.
---
 gnu/packages/networking.scm | 43 +++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index 1e6f70e1ff..692ba7f841 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -119,6 +119,7 @@
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages readline)
+  #:use-module (gnu packages ruby)
   #:use-module (gnu packages samba)
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages sqlite)
@@ -131,6 +132,48 @@
   #:use-module (gnu packages xml)
   #:use-module (ice-9 match))
 
+(define-public nanomsg
+  (package
+    (name "nanomsg")
+    (version "1.1.5")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/nanomsg/nanomsg.git")
+         (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "01ddfzjlkf2dgijrmm3j3j8irccsnbgfvjcnwslsfaxnrmrq5s64"))))
+    (build-system cmake-build-system)
+    (outputs '("out" "doc"))
+    (arguments
+     `(#:configure-flags
+       (list
+        "-DNN_ENABLE_COVERAGE=ON")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'move-docs
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (doc (assoc-ref outputs "doc")))
+               (mkdir-p (string-append doc "/share/doc"))
+               (rename-file
+                (string-append out "/share/doc/nanomsg")
+                (string-append doc "/share/doc/nanomsg"))
+               #t))))))
+    (native-inputs
+     `(("asciidoctor" ,ruby-asciidoctor)
+       ("pkg-config" ,pkg-config)))
+    (synopsis "Scalable socket library")
+    (description "Nanomsg is a socket library that provides several common
+communication patterns.  It aims to make the networking layer fast, scalable,
+and easy to use.  Implemented in C, it works on a wide range of operating
+systems with no further dependencies.")
+    (home-page "https://nanomsg.org/")
+    (license (license:non-copyleft "file:///COPYING"))))
+
 (define-public blueman
   (package
     (name "blueman")
-- 
2.26.2


[-- Attachment #1.1.3: 0011-gnu-Add-nng.patch --]
[-- Type: text/x-patch, Size: 2680 bytes --]

From e7f8c22e007a8ca64a93cbef53cee7fe1a30b1d6 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Mon, 29 Jun 2020 01:48:27 -0400
Subject: [PATCH 11/51] gnu: Add nng.

* gnu/packages/networking.scm (nng): New variable.
---
 gnu/packages/networking.scm | 44 +++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index 692ba7f841..1f185cad7c 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -122,6 +122,7 @@
   #:use-module (gnu packages ruby)
   #:use-module (gnu packages samba)
   #:use-module (gnu packages serialization)
+  #:use-module (gnu packages shells)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages ssh)
   #:use-module (gnu packages textutils)
@@ -132,6 +133,49 @@
   #:use-module (gnu packages xml)
   #:use-module (ice-9 match))
 
+(define-public nng
+  (package
+    (name "nng")
+    (version "1.3.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/nanomsg/nng.git")
+         (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "042kmqzvdhv8fqmjr9kyi7rirm6akmpidfav6j14zhrab221n06j"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:configure-flags
+       (list
+        "-DNNG_ENABLE_COVERAGE=ON"
+        "-DNNG_ENABLE_TLS=ON")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'disable-failing-tests
+           (lambda _
+             ;; These tests require network access.
+             (substitute* "tests/CMakeLists.txt"
+               (("add_nng_test1\\(httpclient 60 NNG_SUPP_HTTP\\)") "")
+               (("add_nng_test1\\(resolv 10 NNG_STATIC_LIB\\)") "")
+               (("add_nng_test\\(tls 60\\)") ""))
+             #t)))))
+    (native-inputs
+     `(("ksh" ,oksh)))
+    (inputs
+     `(("mbedtls" ,mbedtls-apache)))
+    (synopsis "Lightweight messaging library")
+    (description "NNG project is a rewrite of the scalability protocols library
+known as libnanomsg, and adds significant new capabilities, while retaining
+compatibility with the original.  It is a lightweight, broker-less library,
+offering a simple API to solve common recurring messaging problems, such as
+publish/subscribe, RPC-style request/reply, or service discovery.")
+    (home-page "https://nng.nanomsg.org/")
+    (license license:expat)))
+
 (define-public nanomsg
   (package
     (name "nanomsg")
-- 
2.26.2


[-- Attachment #1.1.4: 0012-gnu-tesseract-ocr-Propagate-leptonica.patch --]
[-- Type: text/x-patch, Size: 1031 bytes --]

From 5140dbf01a6fac4d8827cf173d2445d97e7fe798 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Mon, 29 Jun 2020 01:53:03 -0400
Subject: [PATCH 12/51] gnu: tesseract-ocr: Propagate leptonica.

* gnu/packages/ocr.scm (tesseract-ocr) [inputs]: Move leptonica to ...
[propagated-inputs]: ... here.
---
 gnu/packages/ocr.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/ocr.scm b/gnu/packages/ocr.scm
index dc690f3cef..23cb86449e 100644
--- a/gnu/packages/ocr.scm
+++ b/gnu/packages/ocr.scm
@@ -65,8 +65,8 @@ it produces text in 8-bit or UTF-8 formats.")
        (sha256
         (base32 "0h1x4z1h86n2gwknd0wck6gykkp99bmm02lg4a47a698g4az6ybv"))))
     (build-system gnu-build-system)
-    (inputs
-     `(("leptonica" ,leptonica)))
+    (propagated-inputs
+     `(("leptonica" ,leptonica))) ; Refered by .pc file
     (arguments
      '(#:configure-flags
        (let ((leptonica (assoc-ref %build-inputs "leptonica")))
-- 
2.26.2


[-- Attachment #1.1.5: 0013-gnu-Add-ccextractor.patch --]
[-- Type: text/x-patch, Size: 3029 bytes --]

From 4886ac01b8c62c4d51f2501a778f69da2eaf7954 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Mon, 29 Jun 2020 01:58:27 -0400
Subject: [PATCH 13/51] gnu: Add ccextractor.

* gnu/packages/gstreamer.scm (ccextractor): New variable.
---
 gnu/packages/gstreamer.scm | 54 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/gnu/packages/gstreamer.scm b/gnu/packages/gstreamer.scm
index 8b62894210..b06dcbd528 100644
--- a/gnu/packages/gstreamer.scm
+++ b/gnu/packages/gstreamer.scm
@@ -30,6 +30,7 @@
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system meson)
   #:use-module (guix utils)
@@ -63,6 +64,7 @@
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages networking)
+  #:use-module (gnu packages ocr)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages qt)
@@ -81,6 +83,58 @@
   #:use-module (gnu packages assembly)
   #:use-module (gnu packages xml))
 
+(define-public ccextractor
+  (package
+    (name "ccextractor")
+    (version "0.88")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/CCExtractor/ccextractor.git")
+         (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1sya45hvv4d46bk7541yimmafgvgyhkpsvwfz9kv6pm4yi1lz6nb"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:tests? #f                      ; No target
+       #:configure-flags
+       (list
+        "-DWITH_FFMPEG=ON"
+        "-DWITH_OCR=ON"
+        "-DWITH_SHARING=ON"
+        "-DWITH_HARDSUBX=ON")
+       #:phases
+       (modify-phases %standard-phases
+         ;; The package is in a sub-dir of this repo.
+         (add-after 'unpack 'chdir
+           (lambda _
+             (chdir "src")
+             #t))
+         (add-after 'chdir 'fix-build-errors
+           (lambda _
+             (substitute* "CMakeLists.txt"
+               (("libnanomsg")
+                "nanomsg"))
+             #t)))))
+    (native-inputs
+     `(("perl" ,perl)
+       ("pkg-config" ,pkg-config)
+       ("python" ,python-wrapper)))
+    (inputs
+     `(("ffmeg" ,ffmpeg-3.4)
+       ("nanomsg" ,nanomsg)
+       ("ocr" ,tesseract-ocr)
+       ("zlib" ,zlib)))
+    (synopsis "Closed Caption Extractor")
+    (description "CCExtractor is a tool that analyzes video files and produces
+independent subtitle files from the closed captions data.  It is portable, small,
+and very fast.")
+    (home-page "https://www.ccextractor.org/")
+    (license license:gpl2+)))
+
 (define-public libvisual
   (package
     (name "libvisual")
-- 
2.26.2


[-- Attachment #1.1.6: 0014-gnu-Add-libdc1394.patch --]
[-- Type: text/x-patch, Size: 2437 bytes --]

From 194cc4cce3ca0d2678b8a3bc0f08e8a2764699cd Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Mon, 29 Jun 2020 03:05:39 -0400
Subject: [PATCH 14/51] gnu: Add libdc1394.

* gnu/packages/gstreamer.scm (libdc1394): New variable.
---
 gnu/packages/gstreamer.scm | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/gnu/packages/gstreamer.scm b/gnu/packages/gstreamer.scm
index b06dcbd528..57593c860e 100644
--- a/gnu/packages/gstreamer.scm
+++ b/gnu/packages/gstreamer.scm
@@ -44,6 +44,7 @@
   #:use-module (gnu packages curl)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages docbook)
+  #:use-module (gnu packages documentation)
   #:use-module (gnu packages elf)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages freedesktop)
@@ -83,6 +84,40 @@
   #:use-module (gnu packages assembly)
   #:use-module (gnu packages xml))
 
+(define-public libdc1394
+  (package
+    (name "libdc1394")
+    (version "2.2.6")
+    (source (origin
+              (method url-fetch)
+              (uri
+               (string-append "https://sourceforge.net/projects/" name "/files/"
+                              name "-2" "/" version "/" name "-" version ".tar.gz"))
+              (sha256
+               (base32 "1v8gq54n1pg8izn7s15yylwjf8r1l1dmzbm2yvf6pv2fmb4mz41b"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("doxygen" ,doxygen)
+       ("perl" ,perl)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("glu" ,glu)
+       ("libraw1394" ,libraw1394)
+       ("libusb" ,libusb)
+       ("libxv" ,libxv)
+       ("linux-headers" ,linux-libre-headers)
+       ("mesa" ,mesa)
+       ("sdl" ,sdl)
+       ("v4l" ,v4l-utils)))
+    (synopsis "1394-Based Digital Camera Control Library")
+    (description "LibDC1394 is a library that provides functionality to control
+any camera that conforms to the 1394-Based Digital Camera Specification written
+by the 1394 Trade Association.  It utilizes the lowlevel functionality provided
+by libraw1394 to communicate with the camera.  It also uses the video1394 kernel
+module for the DMA capture of the video flow.")
+    (home-page "https://damien.douxchamps.net/ieee1394/libdc1394/")
+    (license license:lgpl2.0+)))
+
 (define-public ccextractor
   (package
     (name "ccextractor")
-- 
2.26.2


[-- Attachment #1.1.7: 0015-gnu-Add-ruby-slim.patch --]
[-- Type: text/x-patch, Size: 1793 bytes --]

From e3979c9fa51ed95753d06484f772d068aecaf996 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Tue, 30 Jun 2020 06:54:00 -0400
Subject: [PATCH 15/51] gnu: Add ruby-slim.

* gnu/packages/ruby.scm (ruby-slim): New variable.
---
 gnu/packages/ruby.scm | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 08c55e4e3c..eba447c160 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -9684,3 +9684,32 @@ which snapshots to consider and what files to include.")
 defined in @file{.travis.yml} on your local machine, using @code{rvm},
 @code{rbenv}, or @code{chruby} to test different versions of Ruby.")
     (license license:expat)))
+
+(define-public ruby-slim
+  (package
+    (name "ruby-slim")
+    (version "4.0.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/slim-template/slim.git")
+         (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "19118dddf6n6vwzl130qgqj61wr280qrh5y9hjhmym2da3q7m90c"))))
+    (build-system ruby-build-system)
+    (arguments
+     `(#:tests? #f))           ; XXX: rake/testtask not being detected
+    (native-inputs
+     `(("git" ,git-minimal)
+       ("rake" ,ruby-rake)))
+    (inputs
+     `(("temple" ,ruby-temple)
+       ("tilt" ,ruby-tilt)))
+    (synopsis "Lightweight templating engine for Ruby")
+    (description "Slim is a Ruby template language whose goal is reduce the
+syntax to the essential parts without becoming cryptic.")
+    (home-page "http://slim-lang.com/")
+    (license license:expat)))
-- 
2.26.2


[-- Attachment #1.1.8: 0016-gnu-Add-libmpeg3.patch --]
[-- Type: text/x-patch, Size: 2593 bytes --]

From 8d9e10ef1ded6f81da4efc2de79986928ad00f99 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Wed, 1 Jul 2020 00:24:40 -0400
Subject: [PATCH 16/51] gnu: Add libmpeg3.

* gnu/packages/video.scm (libmpeg3): New variable.
---
 gnu/packages/video.scm | 49 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index 84d6b59534..d698678e49 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -170,6 +170,55 @@
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg))
 
+(define-public libmpeg3
+  (package
+    (name "libmpeg3")
+    (version "1.8")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://sourceforge.net/projects/heroines/files/"
+                       "releases/081108/" name "-" version "-src.tar.bz2"))
+       (sha256
+        (base32 "1i53vv0wm5qfwgg1z7j9g14s6c7gxxkiy4vbdkq3lijjyyz50vv5"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:test-target "test"
+       #:make-flags
+       (list
+        (string-append "A52DIR=" (assoc-ref %build-inputs "liba52"))
+        (string-append "DST=" (assoc-ref %outputs "out") "/bin"))
+     #:phases
+     (modify-phases %standard-phases
+       (add-after 'unpack 'delete-bundled-a52dec
+         (lambda _
+           (delete-file-recursively "a52dec-0.7.3")
+           (substitute* "Makefile"
+             (("include Makefile\\.a52")
+              "")
+             (("\\(A52DIR\\)/include")
+              "(A52DIR)/include/a52dec")
+             (("LIBS = " match)
+              (string-append match "-la52 ")))
+           #t))
+       (add-before 'install 'create-destination-directory
+         (lambda* (#:key outputs #:allow-other-keys)
+           (let* ((out (string-append (assoc-ref outputs "out"))))
+             (mkdir-p (string-append out "/bin"))
+             #t))))))
+  (native-inputs
+   `(("nasm" ,nasm)))
+  (inputs
+   `(("liba52" ,liba52)))
+  (synopsis "Advanced MPEG editing and manipulation library")
+  (description "Libmpeg3 decodes MP2, MP3, AC3, MPEG-1 video, MPEG-2 video,
+and DVD footage in a single library.  It supports many esoteric features like
+parallel video decoding, frame-accurate editing, YUV 4:2:2, and ATSC transport
+stream decoding")
+  (home-page "http://heroinewarrior.com/libmpeg3.php")
+  (license license:gpl2+)))
+
 (define-public aalib
   (package
     (name "aalib")
-- 
2.26.2


[-- Attachment #1.1.9: 0017-gnu-Add-tslib.patch --]
[-- Type: text/x-patch, Size: 1782 bytes --]

From c84083b0c0f3952f82e041b3f50ffa3cb4ae6ca4 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Wed, 1 Jul 2020 00:45:50 -0400
Subject: [PATCH 17/51] gnu: Add tslib.

* gnu/packages/video.scm (tslib): New variable.
---
 gnu/packages/video.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index d698678e49..d14e5962e7 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -170,6 +170,40 @@
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg))
 
+(define-public tslib
+  (package
+    (name "tslib")
+    (version "1.21")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/libts/tslib.git")
+         (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1ph51vpfp92rpa2vs6wkz1b1pcs3z334p1i33sprsi8mjlwvkbzc"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:test-target "tests"
+       #:configure-flags
+       (list
+        "--with-sdl2")))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("libtool" ,libtool)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("linux-headers" ,linux-libre-headers)
+       ("sdl2" ,sdl2)))
+    (synopsis "Touchscreen access library")
+    (description "TSLib is a cross-platform library that provides access to
+touchscreen devices and the ability to apply filters to their input events.")
+    (home-page "http://www.tslib.org/")
+    (license license:lgpl2.1+)))
+
 (define-public libmpeg3
   (package
     (name "libmpeg3")
-- 
2.26.2


[-- Attachment #1.1.10: 0018-gnu-Add-flux.patch --]
[-- Type: text/x-patch, Size: 1571 bytes --]

From ec9f500fdb5f45ded1d7f066bf9b845d630358a9 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Wed, 1 Jul 2020 01:04:20 -0400
Subject: [PATCH 18/51] gnu: Add flux.

* gnu/packages/graphics.scm (flux): New variable.
---
 gnu/packages/graphics.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index 0d768b8a0e..bd346699c2 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -93,6 +93,32 @@
   #:use-module (guix packages)
   #:use-module (guix utils))
 
+(define-public flux
+  (package
+    (name "flux")
+    (version "1.4.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/deniskropp/flux.git")
+         (commit "e45758a")))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "11f3ypg0sdq5kj69zgz6kih1yrzgm48r16spyvzwvlswng147410"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("libtool" ,libtool)
+       ("pkg-config" ,pkg-config)))
+    (synopsis "Interface description language")
+    (description "Flux is an interface description language used by DirectFB.
+Fluxcomp compiles .flux files to .cpp or .c files.")
+    (home-page "http://www.directfb.org/")
+    (license license:lgpl2.1+))) ; Same as DirectFB
+
 (define-public fox
   (package
     (name "fox")
-- 
2.26.2


[-- Attachment #1.1.11: 0019-gnu-Add-libtimidity.patch --]
[-- Type: text/x-patch, Size: 1812 bytes --]

From ccc04df59b953e993bfba18ee8692e396f4393b6 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Wed, 1 Jul 2020 05:55:02 -0400
Subject: [PATCH 19/51] gnu: Add libtimidity.

* gnu/packages/audio.scm (libtimidity): New variable.
---
 gnu/packages/audio.scm | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 74ef7111c3..60ebbe5e89 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -126,6 +126,37 @@
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26))
 
+(define-public libtimidity
+  (package
+    (name "libtimidity")
+    (version "0.2.6")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://sourceforge.net/projects/" name "/files/"
+                       name "/" version "/" name "-" version ".tar.gz"))
+       (sha256
+        (base32 "0p2px0m907gi1zpdr0l9adq25jl89j85c11ag9s2g4yc6n1nhgfm"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f))       ; XXX: LibTiMidity could not be initialised
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("ao" ,ao)))
+    (synopsis "MIDI to WAVE converter library")
+    (description "LibTiMidity is a MIDI to WAVE converter library that uses
+Gravis Ultrasound-compatible patch files to generate digital audio data from
+General MIDI files.")
+    (home-page "http://libtimidity.sourceforge.net/")
+    (license
+     ;; This project is dual-licensed.
+     ;; Either of the following licenses can be exercised.
+     (list
+      license:lgpl2.1+
+      license:artistic2.0))))
+
 (define-public vo-amrwbenc
   (package
     (name "vo-amrwbenc")
-- 
2.26.2


[-- Attachment #1.1.12: 0020-gnu-Add-directfb.patch --]
[-- Type: text/x-patch, Size: 4512 bytes --]

From bd77133228c63547998aa7cf7e90776bc0e8c0a4 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Wed, 1 Jul 2020 06:00:23 -0400
Subject: [PATCH 20/51] gnu: Add directfb.

* gnu/packages/graphics.scm (directfb): New variable.
---
 gnu/packages/graphics.scm | 77 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)

diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index bd346699c2..073404673c 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -47,24 +47,29 @@
   #:use-module (gnu packages bash)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages boost)
+  #:use-module (gnu packages cdrom)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages fonts)
   #:use-module (gnu packages fontutils)
+  #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages graphviz)
+  #:use-module (gnu packages gstreamer)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages haskell-xyz)
   #:use-module (gnu packages image)
   #:use-module (gnu packages imagemagick)
   #:use-module (gnu packages jemalloc)
+  #:use-module (gnu packages linux)
   #:use-module (gnu packages maths)
+  #:use-module (gnu packages mp3)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages pdf)
   #:use-module (gnu packages perl)
@@ -81,8 +86,10 @@
   #:use-module (gnu packages swig)
   #:use-module (gnu packages tbb)
   #:use-module (gnu packages video)
+  #:use-module (gnu packages xiph)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
+  #:use-module (gnu packages xdisorg)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
@@ -93,6 +100,76 @@
   #:use-module (guix packages)
   #:use-module (guix utils))
 
+(define-public directfb
+  (package
+    (name "directfb")
+    (version "1.7.7")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/deniskropp/DirectFB.git")
+         (commit "DIRECTFB_1_7_7")))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0bs3yzb7hy3mgydrj8ycg7pllrd2b6j0gxj596inyr7ihssr3i0y"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'disable-configure-during-bootstrap
+           (lambda _
+             (substitute* "autogen.sh"
+               (("^.*\\$srcdir/configure.*") ""))
+             #t)))))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("libtool" ,libtool)
+       ("perl" ,perl)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("alsa" ,alsa-lib)
+       ("ffmpeg" ,ffmpeg)
+       ("freetype" ,freetype)
+       ("glu" ,glu)
+       ("gstreamer" ,gstreamer)
+       ("imlib2" ,imlib2)
+       ("jasper" ,jasper)
+       ("jpeg" ,libjpeg-turbo)
+       ("libcddb" ,libcddb)
+       ("libdrm" ,libdrm)
+       ("libtimidity" ,libtimidity)
+       ("linux-headers" ,linux-libre-headers)
+       ("mad" ,libmad)
+       ("mng" ,libmng)
+       ("mpeg2" ,libmpeg2)
+       ("mpeg3" ,libmpeg3)
+       ("opengl" ,mesa)
+       ("png" ,libpng)
+       ("sdl" ,sdl)
+       ("svg" ,librsvg)
+       ("tiff" ,libtiff)
+       ("tslib" ,tslib)
+       ("vdpau" ,libvdpau)
+       ("vorbisfile" ,libvorbis)
+       ("wayland" ,wayland)
+       ("webp" ,libwebp)
+       ("x11" ,libx11)
+       ("xcomposite" ,libxcomposite)
+       ("xext" ,libxext)
+       ("xproto" ,xorgproto)
+       ("zlib" ,zlib)))
+    (propagated-inputs
+     `(("flux" ,flux)))
+    (synopsis "DFB Graphics Library")
+    (description "DirectFB is a graphics library which was designed with embedded
+systems in mind.  It offers maximum hardware accelerated performance at a
+minimum of resource usage and overhead.")
+    (home-page "http://www.directfb.org/")
+    (license license:lgpl2.1+)))
+
 (define-public flux
   (package
     (name "flux")
-- 
2.26.2


[-- Attachment #1.1.13: 0021-gnu-Add-faac.patch --]
[-- Type: text/x-patch, Size: 1576 bytes --]

From ca172dd43ec32775f12f4f0ee7ec59f628548f2c Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Wed, 1 Jul 2020 06:06:41 -0400
Subject: [PATCH 21/51] gnu: Add faac.

* gnu/packages/audio.scm (faac): New variable.
---
 gnu/packages/audio.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 60ebbe5e89..3823115f24 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -126,6 +126,34 @@
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26))
 
+(define-public faac
+  (package
+    (name "faac")
+    (version "1.30")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://sourceforge.net/projects/faac/files/faac-src/"
+                       "faac-1.30/faac-1_30.tar.gz/download"))
+       (sha256
+        (base32 "1lmj0dib3mjp84jhxc5ddvydkzzhb0gfrdh3ikcidjlcb378ghxd"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("libtool" ,libtool)
+       ("pkg-config" ,pkg-config)))
+    (synopsis "Freeware Advanced Audio Coder")
+    (description "FAAC is an MPEG-4 and MPEG-2 AAC encoder.")
+    (home-page "https://www.audiocoding.com/faac.html")
+    (license
+     (list
+      ;; ISO MPEG-4 reference code.
+      license:gpl2+
+      ;; Others.
+      license:lgpl2.0+))))
+
 (define-public libtimidity
   (package
     (name "libtimidity")
-- 
2.26.2


[-- Attachment #1.1.14: 0022-gnu-Add-flite.patch --]
[-- Type: text/x-patch, Size: 3439 bytes --]

From 5ea62c03c490f798e1478d5a27ea2733b6472ddf Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Thu, 2 Jul 2020 01:55:56 -0400
Subject: [PATCH 22/51] gnu: Add flite.

* gnu/packages/speech.scm (flite): New variable.
---
 gnu/packages/speech.scm | 58 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/gnu/packages/speech.scm b/gnu/packages/speech.scm
index c9c1eaa8d9..0968b015be 100644
--- a/gnu/packages/speech.scm
+++ b/gnu/packages/speech.scm
@@ -50,6 +50,64 @@
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages textutils))
 
+(define-public flite
+  (package
+    (name "flite")
+    (version "2.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "http://www.festvox.org/" name "/packed/" name
+                       "-" version "/" name "-" version "-release.tar.bz2"))
+       (sha256
+        (base32 "119b7l7pjb1l5raqq24p8rmhdqni49vjh2mgdryrfr575rm3yg67"))))
+    (build-system gnu-build-system)
+    (arguments
+     ;; XXX:
+     ;; There numerous issues with the testsuite.
+     ;; Enable them once they are fixed in upstream.
+     `(#:tests? #f
+       #:configure-flags
+       (list
+        "--enable-shared"
+        (string-append "LDFLAGS=-Wl,-rpath="
+                       (assoc-ref %outputs "out")
+                       "/lib"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'remove-static-libs
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out")))
+               (for-each delete-file
+                         (list
+                          (string-append out "/lib/libflite.a")
+                          (string-append out "/lib/libflite_cmu_grapheme_lang.a")
+                          (string-append out "/lib/libflite_cmu_grapheme_lex.a")
+                          (string-append out "/lib/libflite_cmu_indic_lang.a")
+                          (string-append out "/lib/libflite_cmu_indic_lex.a")
+                          (string-append out "/lib/libflite_cmulex.a")
+                          (string-append out "/lib/libflite_cmu_time_awb.a")
+                          (string-append out "/lib/libflite_cmu_us_awb.a")
+                          (string-append out "/lib/libflite_cmu_us_kal16.a")
+                          (string-append out "/lib/libflite_cmu_us_kal.a")
+                          (string-append out "/lib/libflite_cmu_us_rms.a")
+                          (string-append out "/lib/libflite_cmu_us_slt.a")
+                          (string-append out "/lib/libflite_usenglish.a"))))
+             #t)))))
+    (native-inputs
+     `(("perl" ,perl)))
+    (inputs
+     `(("alsa" ,alsa-lib)))
+    (synopsis "Speech synthesis system")
+    (description "Flite (festival-lite) is a small, fast run-time text to speech
+synthesis engine developed at CMU and primarily designed for small embedded
+machines and/or large servers.  It is designed as an alternative text to speech
+synthesis engine to Festival for voices built using the FestVox suite of voice
+building tools.")
+    (home-page "http://www.festvox.org/flite/index.html")
+    (license (license:non-copyleft "file:///COPYING"))))
+
 (define-public espeak
   (package
     (name "espeak")
-- 
2.26.2


[-- Attachment #1.1.15: 0023-gnu-Add-ffmpeg-2.8.patch --]
[-- Type: text/x-patch, Size: 2913 bytes --]

From b038f8f315c6dc1015794f950512ab80f7cfaa20 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Thu, 2 Jul 2020 05:52:47 -0400
Subject: [PATCH 23/51] gnu: Add ffmpeg-2.8.

* gnu/packages/video.scm (ffmpeg-2.8): New variable.
---
 gnu/packages/video.scm | 48 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index d14e5962e7..aaf3471a62 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -1247,6 +1247,54 @@ audio/video codec library.")
     (inputs (alist-delete "dav1d" (alist-delete "libaom" (alist-delete "rav1e"
                            (package-inputs ffmpeg)))))))
 
+(define-public ffmpeg-2.8
+  (package
+    (inherit ffmpeg)
+    (version "2.8.16")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://ffmpeg.org/releases/ffmpeg-"
+                                  version ".tar.xz"))
+              (sha256
+               (base32
+                "14n0xg22yz1r4apif2idm91s3avcmkz4sl8gyj5763gcy415k2bb"))))
+    (arguments
+     `(#:tests? #f               ; XXX: Enable them later, if required
+       #:configure-flags
+       (list
+        "--disable-static"
+        "--enable-shared"
+        "--extra-cflags=-DFF_API_OLD_ENCODE_VIDEO -DFF_API_OLD_ENCODE_AUDIO")
+       #:phases
+       (modify-phases %standard-phases
+         (replace
+             'configure
+           ;; configure does not work followed by "SHELL=..." and
+           ;; "CONFIG_SHELL=..."; set environment variables instead
+           (lambda* (#:key outputs configure-flags #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (substitute* "configure"
+                 (("#! /bin/sh") (string-append "#!" (which "sh"))))
+               (setenv "SHELL" (which "bash"))
+               (setenv "CONFIG_SHELL" (which "bash"))
+               (apply invoke
+                      "./configure"
+                      (string-append "--prefix=" out)
+                      ;; Add $libdir to the RUNPATH of all the binaries.
+                      (string-append "--extra-ldflags=-Wl,-rpath="
+                                     out "/lib")
+                      configure-flags))))
+         (add-before
+             'check 'set-ld-library-path
+           (lambda _
+             ;; Allow $(top_builddir)/ffmpeg to find its dependencies when
+             ;; running tests.
+             (let* ((dso  (find-files "." "\\.so$"))
+                    (path (string-join (map dirname dso) ":")))
+               (format #t "setting LD_LIBRARY_PATH to ~s~%" path)
+               (setenv "LD_LIBRARY_PATH" path)
+               #t))))))))
+
 (define-public ffmpeg-for-stepmania
   (hidden-package
    (package
-- 
2.26.2


[-- Attachment #1.1.16: 0024-gnu-Add-libvideogfx.patch --]
[-- Type: text/x-patch, Size: 2342 bytes --]

From 71b7882404917563398e0fb54274b0a83ca25db1 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Thu, 2 Jul 2020 09:10:19 -0400
Subject: [PATCH 24/51] gnu: Add libvideogfx.

* gnu/packages/video.scm (libvideogfx): New variable.
---
 gnu/packages/video.scm | 44 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index aaf3471a62..d335ca626f 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -170,6 +170,50 @@
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg))
 
+(define-public libvideogfx
+  (package
+    (name "libvideogfx")
+    (version "1.0.9")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/farindk/libvideogfx.git")
+         (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "154b0j8cfg879pg08xcbwvbz8z9nrfnyj31i48vxir1psas70ynq"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-build-errors
+           (lambda _
+             (substitute* "libvideogfx/graphics/fileio/ffmpeg.cc"
+               (("av_close_input_file\\(")
+                "avformat_close_input(&"))
+             (substitute* "libvideogfx/graphics/fileio/png.cc"
+               (("is != NULL") "is.good()"))
+             #t)))))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("libtool" ,libtool)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("ffmpeg" ,ffmpeg-2.8)
+       ("jpeg" ,libjpeg-turbo)
+       ("png" ,libpng)
+       ("x11" ,libx11)
+       ("xext" ,libxext)))
+    (synopsis "Video processing library")
+    (description "LibVideoGfx is a C++ library for low-level video processing.
+It aims at speeding up the development process for image and video processing
+applications by providing high-level classes for commonly required tasks.")
+    (home-page "https://dirk-farin.net/software/libvideogfx/index.html")
+    (license license:lgpl2.1+)))
+
 (define-public tslib
   (package
     (name "tslib")
-- 
2.26.2


[-- Attachment #1.1.17: 0025-gnu-Add-libde265.patch --]
[-- Type: text/x-patch, Size: 2037 bytes --]

From aa366534f7fecda57d18b4e9162ee6f1a1235dd4 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Thu, 2 Jul 2020 09:56:33 -0400
Subject: [PATCH 25/51] gnu: Add libde265.

* gnu/packages/video.scm (libde265): New variable.
---
 gnu/packages/video.scm | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index d335ca626f..b25a8d1af8 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -214,6 +214,44 @@ applications by providing high-level classes for commonly required tasks.")
     (home-page "https://dirk-farin.net/software/libvideogfx/index.html")
     (license license:lgpl2.1+)))
 
+(define-public libde265
+  (package
+    (name "libde265")
+    (version "1.0.5")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/strukturag/libde265.git")
+         (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1qisj8ryzbknam3hk81rq70fsd9mcpxm898bqygvbsmbwyvmz3pg"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("libtool" ,libtool)
+       ("pkg-config" ,pkg-config)
+       ("python" ,python-wrapper)))
+    (inputs
+     `(;; XXX: Build fails with libvideogfx.
+       ;; ("libvideogfx" ,libvideogfx)
+       ("qt" ,qtbase)
+       ("sdl" ,sdl)))
+    (synopsis "H.265 video codec implementation")
+    (description "Libde265 is an implementation of the h.265 video codec.  It is
+written from scratch and has a plain C API to enable a simple integration into
+other software.")
+    (home-page "https://www.libde265.org/")
+    (license
+     (list
+      ;; Applications.
+      license:expat
+      ;; Library.
+      license:lgpl3+))))
+
 (define-public tslib
   (package
     (name "tslib")
-- 
2.26.2


[-- Attachment #1.1.18: 0026-gnu-Add-libmms.patch --]
[-- Type: text/x-patch, Size: 1379 bytes --]

From 78c129ac8656540ec8599c68157dae5f82eba647 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Fri, 3 Jul 2020 07:12:48 -0400
Subject: [PATCH 26/51] gnu: Add libmms.

* gnu/packages/video.scm (libmms): New variable.
---
 gnu/packages/video.scm | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index b25a8d1af8..d2194717a1 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -170,6 +170,25 @@
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg))
 
+(define-public libmms
+  (package
+    (name "libmms")
+    (version "0.6.4")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://sourceforge.net/projects/" name "/files/"
+                       name "/" version "/" name "-" version ".tar.gz"))
+       (sha256
+        (base32 "0kvhxr5hkabj9v7ah2rzkbirndfqdijd9hp8v52c1z6bxddf019w"))))
+    (build-system gnu-build-system)
+    (synopsis "MMS stream protocol library")
+    (description "Libmms is a library for streaming media files using the mmst
+and mmsh protocols.")
+    (home-page "https://sourceforge.net/projects/libmms/")
+    (license license:lgpl2.1+)))
+
 (define-public libvideogfx
   (package
     (name "libvideogfx")
-- 
2.26.2


[-- Attachment #1.1.19: 0027-gnu-Add-schroedinger.patch --]
[-- Type: text/x-patch, Size: 2496 bytes --]

From 91f31378141ad994884d3a83db30deb07d7b7dea Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Fri, 3 Jul 2020 07:14:26 -0400
Subject: [PATCH 27/51] gnu: Add schroedinger.

* gnu/packages/video.scm (schroedinger): New variable.
---
 gnu/packages/video.scm | 49 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index d2194717a1..3764e14552 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -170,6 +170,55 @@
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg))
 
+(define-public schroedinger
+  (package
+    (name "schroedinger")
+    (version "1.0.11")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://launchpad.net/" name "/trunk/" version
+                       "/+download/" name "-" version ".tar.gz"))
+       (sha256
+        (base32 "04prr667l4sn4zx256v1z36a0nnkxfdqyln48rbwlamr6l3jlmqy"))))
+    (build-system gnu-build-system)
+    (outputs '("out" "doc"))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'move-docs
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (doc (assoc-ref outputs "doc")))
+               (mkdir-p (string-append doc "/share"))
+               (rename-file
+                (string-append out "/share/gtk-doc")
+                (string-append doc "/share/gtk-doc"))
+               #t))))))
+    (native-inputs
+     `(("dash" ,dash)
+       ("gtk-doc" ,gtk-doc)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("glew" ,glew)
+       ("opengl" ,mesa)))
+    (propagated-inputs
+     `(("orc" ,orc)))
+    (synopsis "Dirac video codec")
+    (description "Schroedinger is a project implementing the Dirac video codec in
+ANSI C code.  It is meant to be highly optimized and portable.  It is developed
+as a joint effort between the BBC and Fluendo.")
+    (home-page "https://launchpad.net/schroedinger")
+    (license
+     ;; This library is licensed under 4 different licenses,
+     ;; and you can choose to use it under the terms of any one of them.
+     (list
+      license:gpl2+
+      license:lgpl2.0+
+      license:expat
+      license:mpl1.1))))
+
 (define-public libmms
   (package
     (name "libmms")
-- 
2.26.2


[-- Attachment #1.1.20: 0028-gnu-Add-libquicktime.patch --]
[-- Type: text/x-patch, Size: 52241 bytes --]

From 36d39908f4c608b6ed13593cbb434ed667d4db52 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Fri, 3 Jul 2020 08:03:40 -0400
Subject: [PATCH 28/51] gnu: Add libquicktime.

* gnu/packages/video.scm (libquicktime): New variable.
* gnu/packages/patches/libquicktime-ffmpeg.patch: New file.
* gnu/local.mk (libquicktime-ffmpeg.patch): New reference.
---
 gnu/local.mk                                  |    1 +
 .../patches/libquicktime-ffmpeg.patch         | 1309 +++++++++++++++++
 gnu/packages/video.scm                        |   40 +
 3 files changed, 1350 insertions(+)
 create mode 100644 gnu/packages/patches/libquicktime-ffmpeg.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 1b9fabd2ad..ecc6bf8bb0 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1194,6 +1194,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/libmygpo-qt-fix-qt-5.11.patch		\
   %D%/packages/patches/libmygpo-qt-missing-qt5-modules.patch	\
   %D%/packages/patches/libqalculate-3.8.0-libcurl-ssl-fix.patch	\
+  %D%/packages/patches/libquicktime-ffmpeg.patch 		\
   %D%/packages/patches/libreoffice-poppler-compat.patch		\
   %D%/packages/patches/libsndfile-armhf-type-checks.patch	\
   %D%/packages/patches/libsndfile-CVE-2017-8361-8363-8365.patch	\
diff --git a/gnu/packages/patches/libquicktime-ffmpeg.patch b/gnu/packages/patches/libquicktime-ffmpeg.patch
new file mode 100644
index 0000000000..48c595fba9
--- /dev/null
+++ b/gnu/packages/patches/libquicktime-ffmpeg.patch
@@ -0,0 +1,1309 @@
+Submitted By: Ken Moffat <ken at linuxfromscratch dot org>
+Date: 2018-05-12
+Initial Package Version: 1.2.4
+Upstream Status: Defunct
+Origin: Gentoo
+Description: Accumulated fixes up to and including building with ffmpeg-4
+
+From gentoo, their libav-9.patch, ffmpeg2.patch, CVE-2016-2399.patch,
+ffmpeg29.patch, ffmpeg4.patch, and seds to files lqt_ffmpeg.c, video.c,
+audio.c in plugins/ffmpeg/ to change CODEC_ID to AV_CODEC_ID.
+
+Build-tested only.
+
+diff -Naur a/plugins/ffmpeg/audio.c b/plugins/ffmpeg/audio.c
+--- a/plugins/ffmpeg/audio.c	2012-03-29 20:44:28.000000000 +0100
++++ b/plugins/ffmpeg/audio.c	2018-05-11 23:15:21.057985300 +0100
+@@ -45,6 +45,11 @@
+ #define ENCODE_AUDIO 1
+ #endif
+ 
++#ifndef AVCODEC_MAX_AUDIO_FRAME_SIZE
++/* from libavcodec/avcodec.h dated Dec 23 2012 */
++#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
++#endif
++
+ /* The following code was ported from gmerlin_avdecoder (http://gmerlin.sourceforge.net) */
+ 
+ /* MPEG Audio header parsing code */
+@@ -540,7 +545,7 @@
+ 
+ #if DECODE_AUDIO3 || DECODE_AUDIO4
+     codec->pkt.data = codec->chunk_buffer;
+-    codec->pkt.size = packet_size + FF_INPUT_BUFFER_PADDING_SIZE;
++    codec->pkt.size = packet_size + AV_INPUT_BUFFER_PADDING_SIZE;
+ 
+ #if DECODE_AUDIO4
+     frame_bytes = avcodec_decode_audio4(codec->avctx, &f,
+@@ -578,7 +583,7 @@
+                                          (codec->sample_buffer_end - codec->sample_buffer_start)],
+                   &bytes_decoded,
+                   codec->chunk_buffer,
+-                  packet_size + FF_INPUT_BUFFER_PADDING_SIZE);
++                  packet_size + AV_INPUT_BUFFER_PADDING_SIZE);
+     if(frame_bytes < 0)
+       {
+       lqt_log(file, LQT_LOG_ERROR, LOG_DOMAIN, "avcodec_decode_audio2 error");
+@@ -626,7 +631,7 @@
+     {
+     /* If the codec is mp3, make sure to decode the very last frame */
+ 
+-    if((codec->avctx->codec_id == CODEC_ID_MP3) &&
++    if((codec->avctx->codec_id == AV_CODEC_ID_MP3) &&
+        (codec->bytes_in_chunk_buffer >= 4))
+       {
+       if(!mpa_decode_header(&mph, codec->chunk_buffer, (const mpa_header*)0))
+@@ -640,13 +645,13 @@
+         return 0;
+         }
+ 
+-      if(codec->chunk_buffer_alloc < mph.frame_bytes + FF_INPUT_BUFFER_PADDING_SIZE)
++      if(codec->chunk_buffer_alloc < mph.frame_bytes + AV_INPUT_BUFFER_PADDING_SIZE)
+         {
+-        codec->chunk_buffer_alloc = mph.frame_bytes + FF_INPUT_BUFFER_PADDING_SIZE;
++        codec->chunk_buffer_alloc = mph.frame_bytes + AV_INPUT_BUFFER_PADDING_SIZE;
+         codec->chunk_buffer = realloc(codec->chunk_buffer, codec->chunk_buffer_alloc);
+         }
+       memset(codec->chunk_buffer + codec->bytes_in_chunk_buffer, 0,
+-             mph.frame_bytes - codec->bytes_in_chunk_buffer + FF_INPUT_BUFFER_PADDING_SIZE);
++             mph.frame_bytes - codec->bytes_in_chunk_buffer + AV_INPUT_BUFFER_PADDING_SIZE);
+       num_samples = mph.samples_per_frame;
+       codec->bytes_in_chunk_buffer = mph.frame_bytes;
+       }
+@@ -690,12 +695,12 @@
+     {
+ 
+         
+-    /* BIG NOTE: We pass extra FF_INPUT_BUFFER_PADDING_SIZE for the buffer size
++    /* BIG NOTE: We pass extra AV_INPUT_BUFFER_PADDING_SIZE for the buffer size
+        because we know, that lqt_read_audio_chunk allocates 16 extra bytes for us */
+     
+     /* Some really broken mp3 files have the header bytes split across 2 chunks */
+ 
+-    if(codec->avctx->codec_id == CODEC_ID_MP3)
++    if(codec->avctx->codec_id == AV_CODEC_ID_MP3)
+       {
+       if(codec->bytes_in_chunk_buffer < 4)
+         {
+@@ -756,7 +761,7 @@
+ 
+ #if DECODE_AUDIO3 || DECODE_AUDIO4
+     codec->pkt.data = &codec->chunk_buffer[bytes_used];
+-    codec->pkt.size = codec->bytes_in_chunk_buffer + FF_INPUT_BUFFER_PADDING_SIZE;
++    codec->pkt.size = codec->bytes_in_chunk_buffer + AV_INPUT_BUFFER_PADDING_SIZE;
+ 
+ #if DECODE_AUDIO4
+     
+@@ -793,7 +798,7 @@
+                                                   (codec->sample_buffer_end - codec->sample_buffer_start)],
+                             &bytes_decoded,
+                             &codec->chunk_buffer[bytes_used],
+-                            codec->bytes_in_chunk_buffer + FF_INPUT_BUFFER_PADDING_SIZE);
++                            codec->bytes_in_chunk_buffer + AV_INPUT_BUFFER_PADDING_SIZE);
+ #endif
+     if(frame_bytes < 0)
+       {
+@@ -806,7 +811,7 @@
+     
+     if(bytes_decoded < 0)
+       {
+-      if(codec->avctx->codec_id == CODEC_ID_MP3)
++      if(codec->avctx->codec_id == AV_CODEC_ID_MP3)
+         {
+         /* For mp3, bytes_decoded < 0 means, that the frame should be muted */
+         memset(&codec->sample_buffer[track_map->channels * (codec->sample_buffer_end -
+@@ -833,7 +838,7 @@
+         }
+       }
+     
+-    /* This happens because ffmpeg adds FF_INPUT_BUFFER_PADDING_SIZE to the bytes returned */
++    /* This happens because ffmpeg adds AV_INPUT_BUFFER_PADDING_SIZE to the bytes returned */
+     
+     if(codec->bytes_in_chunk_buffer < 0)
+       codec->bytes_in_chunk_buffer = 0;
+@@ -866,8 +871,8 @@
+   quicktime_audio_map_t *track_map = &file->atracks[track];
+   quicktime_ffmpeg_audio_codec_t *codec = track_map->codec->priv;
+ 
+-  if((codec->decoder->id == CODEC_ID_MP2) ||
+-     (codec->decoder->id == CODEC_ID_MP3))
++  if((codec->decoder->id == AV_CODEC_ID_MP2) ||
++     (codec->decoder->id == AV_CODEC_ID_MP3))
+     {
+     mpa_header h;
+     uint32_t header;
+@@ -909,7 +914,7 @@
+     else
+       track_map->ci.bitrate = h.bitrate;
+     }
+-  else if(codec->decoder->id == CODEC_ID_AC3)
++  else if(codec->decoder->id == AV_CODEC_ID_AC3)
+     {
+     a52_header h;
+     uint8_t * ptr;
+@@ -986,7 +991,7 @@
+ #endif
+     /* Some codecs need extra stuff */
+ 
+-    if(codec->decoder->id == CODEC_ID_ALAC)
++    if(codec->decoder->id == AV_CODEC_ID_ALAC)
+       {
+       header = quicktime_wave_get_user_atom(track_map->track, "alac", &header_len);
+       if(header)
+@@ -995,7 +1000,7 @@
+         codec->avctx->extradata_size = header_len;
+         }
+       }
+-    if(codec->decoder->id == CODEC_ID_QDM2)
++    if(codec->decoder->id == AV_CODEC_ID_QDM2)
+       {
+       header = quicktime_wave_get_user_atom(track_map->track, "QDCA", &header_len);
+       if(header)
+@@ -1261,7 +1266,7 @@
+     pkt.data = codec->chunk_buffer;
+     pkt.size = codec->chunk_buffer_alloc;
+ 
+-    avcodec_get_frame_defaults(&f);
++    av_frame_unref(&f);
+     f.nb_samples = codec->avctx->frame_size;
+     
+     avcodec_fill_audio_frame(&f, channels, codec->avctx->sample_fmt,
+@@ -1495,9 +1500,9 @@
+     codec_base->decode_audio = lqt_ffmpeg_decode_audio;
+   codec_base->set_parameter = set_parameter;
+ 
+-  if((decoder->id == CODEC_ID_MP3) || (decoder->id == CODEC_ID_MP2))
++  if((decoder->id == AV_CODEC_ID_MP3) || (decoder->id == AV_CODEC_ID_MP2))
+     codec_base->read_packet = read_packet_mpa;
+-  else if(decoder->id == CODEC_ID_AC3)
++  else if(decoder->id == AV_CODEC_ID_AC3)
+     {
+     codec_base->write_packet = write_packet_ac3;
+     codec_base->read_packet = read_packet_ac3;
+diff -Naur a/plugins/ffmpeg/ffmpeg.h b/plugins/ffmpeg/ffmpeg.h
+--- a/plugins/ffmpeg/ffmpeg.h	2012-02-15 19:48:30.000000000 +0000
++++ b/plugins/ffmpeg/ffmpeg.h	2018-05-11 23:10:24.204992468 +0100
+@@ -27,6 +27,7 @@
+ 
+ #include <quicktime/qtprivate.h>
+ #include AVCODEC_HEADER
++#include <libavutil/mem.h>
+ 
+ void quicktime_init_video_codec_ffmpeg(quicktime_codec_t * codec,
+                                        quicktime_video_map_t *vtrack,
+diff -Naur a/plugins/ffmpeg/lqt_ffmpeg.c b/plugins/ffmpeg/lqt_ffmpeg.c
+--- a/plugins/ffmpeg/lqt_ffmpeg.c	2012-02-15 19:48:30.000000000 +0000
++++ b/plugins/ffmpeg/lqt_ffmpeg.c	2018-05-11 23:15:07.583985628 +0100
+@@ -386,7 +386,7 @@
+ struct CODECIDMAP codecidmap_v[] =
+   {
+     {
+-      .id = CODEC_ID_MPEG1VIDEO,
++      .id = AV_CODEC_ID_MPEG1VIDEO,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -397,7 +397,7 @@
+       .wav_ids = { LQT_WAV_ID_NONE }
+     },
+     {
+-      .id = CODEC_ID_MPEG4,
++      .id = AV_CODEC_ID_MPEG4,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -415,7 +415,7 @@
+       .compression_id = LQT_COMPRESSION_MPEG4_ASP,
+     },
+     {
+-      .id = CODEC_ID_MSMPEG4V1,
++      .id = AV_CODEC_ID_MSMPEG4V1,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -426,7 +426,7 @@
+       .wav_ids = { LQT_WAV_ID_NONE },
+     },
+     {
+-      .id = CODEC_ID_MSMPEG4V2,
++      .id = AV_CODEC_ID_MSMPEG4V2,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -437,7 +437,7 @@
+       .wav_ids = { LQT_WAV_ID_NONE },
+     },
+     {
+-      .id = CODEC_ID_MSMPEG4V3,
++      .id = AV_CODEC_ID_MSMPEG4V3,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -453,7 +453,7 @@
+       .do_encode = 1,
+     },
+     {
+-      .id = CODEC_ID_MSMPEG4V3,
++      .id = AV_CODEC_ID_MSMPEG4V3,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -468,7 +468,7 @@
+     },
+ #if 0
+     {
+-      .id = CODEC_ID_WMV1,
++      .id = AV_CODEC_ID_WMV1,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -481,7 +481,7 @@
+     },
+ #endif
+     {
+-      .id = CODEC_ID_H263,
++      .id = AV_CODEC_ID_H263,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -493,7 +493,7 @@
+       .compatibility_flags = LQT_FILE_QT_OLD | LQT_FILE_QT | LQT_FILE_MP4 | LQT_FILE_3GP,
+     },
+     {
+-      .id = CODEC_ID_H263,
++      .id = AV_CODEC_ID_H263,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -508,7 +508,7 @@
+       .do_encode = 1,
+     },
+     {
+-      .id = CODEC_ID_H264,
++      .id = AV_CODEC_ID_H264,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -519,7 +519,7 @@
+       .wav_ids = { LQT_WAV_ID_NONE },
+     },
+     {
+-      .id = CODEC_ID_H263P,
++      .id = AV_CODEC_ID_H263P,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -533,7 +533,7 @@
+       .do_encode = 1,
+     },
+     {
+-      .id = CODEC_ID_H263I,
++      .id = AV_CODEC_ID_H263I,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -544,7 +544,7 @@
+       .wav_ids = { LQT_WAV_ID_NONE },
+     },
+     {
+-      .id = CODEC_ID_SVQ1,
++      .id = AV_CODEC_ID_SVQ1,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -555,7 +555,7 @@
+       .wav_ids = { LQT_WAV_ID_NONE },
+     },
+     {
+-      .id = CODEC_ID_SVQ3,
++      .id = AV_CODEC_ID_SVQ3,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -566,7 +566,7 @@
+       .wav_ids = { LQT_WAV_ID_NONE },
+     },
+     {
+-      .id = CODEC_ID_MJPEG,
++      .id = AV_CODEC_ID_MJPEG,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -580,7 +580,7 @@
+       .do_encode = 1,
+     },
+     {
+-      .id = CODEC_ID_MJPEGB,
++      .id = AV_CODEC_ID_MJPEGB,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -594,7 +594,7 @@
+     },
+ #if LIBAVCODEC_BUILD >= 3346688
+     {
+-      .id = CODEC_ID_TARGA,
++      .id = AV_CODEC_ID_TARGA,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -606,7 +606,7 @@
+ #endif
+ #if LIBAVCODEC_BUILD >= 3347456
+     {
+-      .id = CODEC_ID_TIFF,
++      .id = AV_CODEC_ID_TIFF,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -617,7 +617,7 @@
+     },
+ #endif
+     {
+-      .id = CODEC_ID_8BPS,
++      .id = AV_CODEC_ID_8BPS,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -627,7 +627,7 @@
+       .wav_ids = { LQT_WAV_ID_NONE },
+     },
+     {
+-      .id = CODEC_ID_INDEO3,
++      .id = AV_CODEC_ID_INDEO3,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -638,7 +638,7 @@
+       .wav_ids = { LQT_WAV_ID_NONE },
+     },
+     {
+-      .id = CODEC_ID_RPZA,
++      .id = AV_CODEC_ID_RPZA,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -648,7 +648,7 @@
+       .wav_ids = { LQT_WAV_ID_NONE },
+     },
+     {
+-      .id = CODEC_ID_SMC,
++      .id = AV_CODEC_ID_SMC,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -658,7 +658,7 @@
+       .wav_ids = { LQT_WAV_ID_NONE },
+     },
+     {
+-      .id = CODEC_ID_CINEPAK,
++      .id = AV_CODEC_ID_CINEPAK,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -669,7 +669,7 @@
+       .wav_ids = { LQT_WAV_ID_NONE },
+     },
+     {
+-      .id = CODEC_ID_CYUV,
++      .id = AV_CODEC_ID_CYUV,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -680,7 +680,7 @@
+       .wav_ids = { LQT_WAV_ID_NONE },
+     },
+     {
+-      .id = CODEC_ID_QTRLE,
++      .id = AV_CODEC_ID_QTRLE,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -693,7 +693,7 @@
+       .encoding_colormodels = (int[]){ BC_RGB888, BC_RGBA8888, LQT_COLORMODEL_NONE },
+     },
+     {
+-      .id = CODEC_ID_MSRLE,
++      .id = AV_CODEC_ID_MSRLE,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -703,7 +703,7 @@
+       .wav_ids = { LQT_WAV_ID_NONE },
+     },
+     {
+-      .id = CODEC_ID_DVVIDEO,
++      .id = AV_CODEC_ID_DVVIDEO,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -719,7 +719,7 @@
+       .image_sizes = image_sizes_dv,
+     },
+     {
+-      .id = CODEC_ID_DVVIDEO,
++      .id = AV_CODEC_ID_DVVIDEO,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -735,7 +735,7 @@
+       .image_sizes = image_sizes_dv,
+     },
+     {
+-      .id = CODEC_ID_DVVIDEO,
++      .id = AV_CODEC_ID_DVVIDEO,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -751,7 +751,7 @@
+     },
+     /* DVCPRO HD (decoding only for now) */
+     {
+-      .id = CODEC_ID_DVVIDEO,
++      .id = AV_CODEC_ID_DVVIDEO,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -772,7 +772,7 @@
+       // .do_encode = 1
+     },
+     {
+-      .id = CODEC_ID_FFVHUFF,
++      .id = AV_CODEC_ID_FFVHUFF,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -785,7 +785,7 @@
+       .do_encode = 1
+     },
+     {
+-      .id = CODEC_ID_FFV1,
++      .id = AV_CODEC_ID_FFV1,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -801,7 +801,7 @@
+     },
+ #if LIBAVCODEC_BUILD >= 3352576
+     {
+-      .id = CODEC_ID_DNXHD,
++      .id = AV_CODEC_ID_DNXHD,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -817,7 +817,7 @@
+     },
+ #endif
+     {
+-      .id = CODEC_ID_MPEG2VIDEO,
++      .id = AV_CODEC_ID_MPEG2VIDEO,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -839,7 +839,7 @@
+ struct CODECIDMAP codecidmap_a[] =
+   {
+     {
+-      .id = CODEC_ID_MP3,
++      .id = AV_CODEC_ID_MP3,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -851,7 +851,7 @@
+       .wav_ids = { 0x50, 0x55, LQT_WAV_ID_NONE },
+     },
+     {
+-      .id = CODEC_ID_MP2,
++      .id = AV_CODEC_ID_MP2,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -866,7 +866,7 @@
+       .compression_id = LQT_COMPRESSION_MP2,
+     },
+     {
+-      .id = CODEC_ID_AC3,
++      .id = AV_CODEC_ID_AC3,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -881,7 +881,7 @@
+       .compression_id = LQT_COMPRESSION_AC3,
+     },
+     {
+-      .id = CODEC_ID_QDM2,
++      .id = AV_CODEC_ID_QDM2,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -896,7 +896,7 @@
+ #if 1
+     /* Doesn't work as long as audio chunks are not split into VBR "Samples" */
+     {
+-      .id = CODEC_ID_ALAC,
++      .id = AV_CODEC_ID_ALAC,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -909,7 +909,7 @@
+ #if 1
+     /* Sounds ugly */
+     {
+-      .id = CODEC_ID_ADPCM_MS,
++      .id = AV_CODEC_ID_ADPCM_MS,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+@@ -922,7 +922,7 @@
+ #if 1
+     /* Sounds ugly */
+     {
+-      .id = CODEC_ID_ADPCM_IMA_WAV,
++      .id = AV_CODEC_ID_ADPCM_IMA_WAV,
+       .index = -1,
+       .encoder = NULL,
+       .decoder = NULL,
+diff -Naur a/plugins/ffmpeg/params.c b/plugins/ffmpeg/params.c
+--- a/plugins/ffmpeg/params.c	2012-03-07 14:10:41.000000000 +0000
++++ b/plugins/ffmpeg/params.c	2018-05-11 23:11:59.803990160 +0100
+@@ -101,6 +101,17 @@
+     }                                           \
+   }
+ 
++#define PARAM_DICT_INT(name, dict_name)             \
++  {                                                 \
++  if(!strcasecmp(name, key))                        \
++    {                                               \
++    char buf[128];                                  \
++    snprintf(buf, sizeof(buf), "%d", *(int*)value); \
++    av_dict_set(options, dict_name, buf, 0);        \
++    found = 1;                                      \
++    }                                               \
++  }
++
+ #define PARAM_DICT_FLAG(name, dict_name)        \
+   {                                             \
+   if(!strcasecmp(name, key))                    \
+@@ -113,16 +124,6 @@
+   }
+ 
+ 
+-enum_t me_method[] =
+-  {
+-    { "Zero",  ME_ZERO },
+-    { "Phods", ME_PHODS },
+-    { "Log",   ME_LOG },
+-    { "X1",    ME_X1 },
+-    { "Epzs",  ME_EPZS },
+-    { "Full",  ME_FULL }
+-  };
+-
+ enum_t prediction_method[] =
+   {
+     { "Left",   FF_PRED_LEFT },
+@@ -152,15 +153,6 @@
+     { "Rate distoration",     FF_MB_DECISION_RD }
+   };
+ 
+-enum_t coder_type[] =
+-  {
+-    { "VLC",                  FF_CODER_TYPE_VLC },
+-    { "Arithmetic",           FF_CODER_TYPE_AC },
+-    { "Raw",                  FF_CODER_TYPE_RAW },
+-    { "RLE",                  FF_CODER_TYPE_RLE },
+-    { "Deflate",              FF_CODER_TYPE_DEFLATE },
+-  };
+-
+ #define PARAM_ENUM(name, var, arr) \
+   if(!strcasecmp(key, name)) \
+     { \
+@@ -192,7 +184,7 @@
+   PARAM_INT_SCALE("ff_bit_rate_audio",bit_rate,1000);
+   PARAM_INT_SCALE("ff_bit_rate_video",bit_rate,1000);
+   PARAM_INT_SCALE("ff_bit_rate_tolerance",bit_rate_tolerance,1000);
+-  PARAM_ENUM("ff_me_method",me_method,me_method);
++  PARAM_DICT_INT("ff_me_method","motion-est");
+   PARAM_INT("ff_gop_size",gop_size);
+   PARAM_FLOAT("ff_qcompress",qcompress);
+   PARAM_FLOAT("ff_qblur",qblur);
+@@ -202,17 +194,23 @@
+   PARAM_INT("ff_max_b_frames",max_b_frames);
+   PARAM_FLOAT("ff_b_quant_factor",b_quant_factor);
+   PARAM_INT("ff_b_frame_strategy",b_frame_strategy);
++
++#if LIBAVCODEC_VERSION_MAJOR >= 55
++  PARAM_DICT_INT("ff_luma_elim_threshold","luma_elim_threshold");
++  PARAM_DICT_INT("ff_chroma_elim_threshold","chroma_elim_threshold");
++#else
+   PARAM_INT("ff_luma_elim_threshold",luma_elim_threshold);
+   PARAM_INT("ff_chroma_elim_threshold",chroma_elim_threshold);
++#endif
++
+   PARAM_INT("ff_strict_std_compliance",strict_std_compliance);
+   PARAM_QP2LAMBDA("ff_b_quant_offset",b_quant_offset);
+   PARAM_INT("ff_rc_min_rate",rc_min_rate);
+   PARAM_INT("ff_rc_max_rate",rc_max_rate);
+   PARAM_INT_SCALE("ff_rc_buffer_size",rc_buffer_size,1000);
+-  PARAM_FLOAT("ff_rc_buffer_aggressivity",rc_buffer_aggressivity);
+   PARAM_FLOAT("ff_i_quant_factor",i_quant_factor);
+   PARAM_QP2LAMBDA("ff_i_quant_offset",i_quant_offset);
+-  PARAM_FLOAT("ff_rc_initial_cplx",rc_initial_cplx);
++  PARAM_DICT_INT("ff_rc_initial_cplx","rc_init_cplx");
+   PARAM_FLOAT("ff_lumi_masking",lumi_masking);
+   PARAM_FLOAT("ff_temporal_cplx_masking",temporal_cplx_masking);
+   PARAM_FLOAT("ff_spatial_cplx_masking",spatial_cplx_masking);
+@@ -237,58 +235,68 @@
+   PARAM_INT("ff_me_range",me_range);
+   PARAM_ENUM("ff_mb_decision",mb_decision,mb_decision);
+   PARAM_INT("ff_scenechange_threshold",scenechange_threshold);
+-  PARAM_QP2LAMBDA("ff_lmin", lmin);
+-  PARAM_QP2LAMBDA("ff_lmax", lmax);
++  PARAM_DICT_INT("ff_lmin", "lmin");
++  PARAM_DICT_INT("ff_lmax", "lmax");
+   PARAM_INT("ff_noise_reduction",noise_reduction);
+   PARAM_INT_SCALE("ff_rc_initial_buffer_occupancy",rc_initial_buffer_occupancy,1000);
++
++#if LIBAVCODEC_VERSION_MAJOR >= 55
++  PARAM_DICT_INT("ff_inter_threshold","inter_threshold");
++  PARAM_DICT_INT("ff_quantizer_noise_shaping","quantizer_noise_shaping");
++#else
+   PARAM_INT("ff_inter_threshold",inter_threshold);
+   PARAM_INT("ff_quantizer_noise_shaping",quantizer_noise_shaping);
++#endif
++
+   PARAM_INT("ff_thread_count",thread_count);
+-  PARAM_INT("ff_me_threshold",me_threshold);
+-  PARAM_INT("ff_mb_threshold",mb_threshold);
+   PARAM_INT("ff_nsse_weight",nsse_weight);
+-  PARAM_FLOAT("ff_border_masking",border_masking);
++  PARAM_DICT_INT("ff_border_masking","border_mask");
+   PARAM_QP2LAMBDA("ff_mb_lmin", mb_lmin);
+   PARAM_QP2LAMBDA("ff_mb_lmax", mb_lmax);
+   PARAM_INT("ff_me_penalty_compensation",me_penalty_compensation);
+   PARAM_INT("ff_bidir_refine",bidir_refine);
+   PARAM_INT("ff_brd_scale",brd_scale);
+-  PARAM_INT("ff_scenechange_factor",scenechange_factor);
+-  PARAM_FLAG("ff_flag_qscale",CODEC_FLAG_QSCALE);
+-  PARAM_FLAG("ff_flag_4mv",CODEC_FLAG_4MV);
+-  PARAM_FLAG("ff_flag_qpel",CODEC_FLAG_QPEL);
+-  PARAM_FLAG("ff_flag_gmc",CODEC_FLAG_GMC);
+-  PARAM_FLAG("ff_flag_mv0",CODEC_FLAG_MV0);
++  PARAM_FLAG("ff_flag_qscale",AV_CODEC_FLAG_QSCALE);
++  PARAM_FLAG("ff_flag_4mv",AV_CODEC_FLAG_4MV);
++  PARAM_FLAG("ff_flag_qpel",AV_CODEC_FLAG_QPEL);
++  PARAM_DICT_FLAG("ff_flag_gmc","gmc");
++  PARAM_DICT_FLAG("ff_flag_mv0","mpv_flags");
+   //  PARAM_FLAG("ff_flag_part",CODEC_FLAG_PART); // Unused
+-  PARAM_FLAG("ff_flag_gray",CODEC_FLAG_GRAY);
+-  PARAM_FLAG("ff_flag_emu_edge",CODEC_FLAG_EMU_EDGE);
+-  PARAM_FLAG("ff_flag_normalize_aqp",CODEC_FLAG_NORMALIZE_AQP);
++  PARAM_FLAG("ff_flag_gray",AV_CODEC_FLAG_GRAY);
++  PARAM_DICT_FLAG("ff_flag_normalize_aqp","naq");
+   //  PARAM_FLAG("ff_flag_alt_scan",CODEC_FLAG_ALT_SCAN); // Unused
+ #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
+   PARAM_FLAG("ff_flag_trellis_quant",CODEC_FLAG_TRELLIS_QUANT);
+ #else
+   PARAM_INT("ff_trellis",trellis);
+ #endif
+-  PARAM_FLAG("ff_flag_bitexact",CODEC_FLAG_BITEXACT);
+-  PARAM_FLAG("ff_flag_ac_pred",CODEC_FLAG_AC_PRED);
++  PARAM_FLAG("ff_flag_bitexact",AV_CODEC_FLAG_BITEXACT);
++  PARAM_FLAG("ff_flag_ac_pred",AV_CODEC_FLAG_AC_PRED);
+   //  PARAM_FLAG("ff_flag_h263p_umv",CODEC_FLAG_H263P_UMV); // Unused
+-  PARAM_FLAG("ff_flag_cbp_rd",CODEC_FLAG_CBP_RD);
+-  PARAM_FLAG("ff_flag_qp_rd",CODEC_FLAG_QP_RD);
++
++#if LIBAVCODEC_VERSION_MAJOR >= 55
++  PARAM_DICT_FLAG("ff_flag_cbp_rd","cbp_rd");
++  PARAM_DICT_FLAG("ff_flag_qp_rd","qp_rd");
++  PARAM_DICT_FLAG("ff_flag2_strict_gop","strict_gop");
++#else
++  PARAM_FLAG("ff_flag_cbp_rd",AV_CODEC_FLAG_CBP_RD);
++  PARAM_FLAG("ff_flag_qp_rd",AV_CODEC_FLAG_QP_RD);
++  PARAM_FLAG2("ff_flag2_strict_gop",AV_CODEC_FLAG2_STRICT_GOP);
++#endif
+ 
+ #if LIBAVCODEC_VERSION_MAJOR >= 54
+   PARAM_DICT_FLAG("ff_flag_h263p_aiv", "aiv");
+   PARAM_DICT_FLAG("ff_flag_obmc","obmc");
+   PARAM_DICT_FLAG("ff_flag_h263p_slice_struct","structured_slices");
+ #else
+-  PARAM_FLAG("ff_flag_h263p_aiv",CODEC_FLAG_H263P_AIV);
+-  PARAM_FLAG("ff_flag_obmc",CODEC_FLAG_OBMC);
+-  PARAM_FLAG("ff_flag_h263p_slice_struct",CODEC_FLAG_H263P_SLICE_STRUCT);
++  PARAM_FLAG("ff_flag_h263p_aiv",AV_CODEC_FLAG_H263P_AIV);
++  PARAM_FLAG("ff_flag_obmc",AV_CODEC_FLAG_OBMC);
++  PARAM_FLAG("ff_flag_h263p_slice_struct",AV_CODEC_FLAG_H263P_SLICE_STRUCT);
+ #endif
+ 
+-  PARAM_FLAG("ff_flag_loop_filter",CODEC_FLAG_LOOP_FILTER);
+-  PARAM_FLAG("ff_flag_closed_gop",CODEC_FLAG_CLOSED_GOP);
+-  PARAM_FLAG2("ff_flag2_fast",CODEC_FLAG2_FAST);
+-  PARAM_FLAG2("ff_flag2_strict_gop",CODEC_FLAG2_STRICT_GOP);
+-  PARAM_ENUM("ff_coder_type",coder_type,coder_type);
++  PARAM_FLAG("ff_flag_loop_filter",AV_CODEC_FLAG_LOOP_FILTER);
++  PARAM_FLAG("ff_flag_closed_gop",AV_CODEC_FLAG_CLOSED_GOP);
++  PARAM_FLAG2("ff_flag2_fast",AV_CODEC_FLAG2_FAST);
++  PARAM_DICT_INT("ff_coder_type","coder");
+   
+   }
+diff -Naur a/plugins/ffmpeg/params.h b/plugins/ffmpeg/params.h
+--- a/plugins/ffmpeg/params.h	2011-05-11 16:13:39.000000000 +0100
++++ b/plugins/ffmpeg/params.h	2018-05-11 23:11:59.803990160 +0100
+@@ -149,7 +149,7 @@
+     .type =        LQT_PARAMETER_INT, \
+     .val_default = { .val_int = 0 }, \
+     .val_min =     { .val_int = 0 }, \
+-    .val_max =     { .val_int = FF_MAX_B_FRAMES }, \
++    .val_max =     { .val_int = 16 }, \
+     .help_string = TRS("Maximum number of B-frames between non B-frames") \
+   }
+ 
+diff -Naur a/plugins/ffmpeg/video.c b/plugins/ffmpeg/video.c
+--- a/plugins/ffmpeg/video.c	2012-02-25 19:46:56.000000000 +0000
++++ b/plugins/ffmpeg/video.c	2018-05-11 23:15:15.697985432 +0100
+@@ -37,10 +37,10 @@
+ #endif
+ 
+ 
+-#ifdef  PIX_FMT_YUV422P10
+-#define PIX_FMT_YUV422P10_OR_DUMMY PIX_FMT_YUV422P10
++#ifdef  AV_PIX_FMT_YUV422P10
++#define AV_PIX_FMT_YUV422P10_OR_DUMMY AV_PIX_FMT_YUV422P10
+ #else
+-#define PIX_FMT_YUV422P10_OR_DUMMY -1234
++#define AV_PIX_FMT_YUV422P10_OR_DUMMY -1234
+ #endif
+ 
+ #if LIBAVCODEC_VERSION_INT >= ((54<<16)|(1<<8)|0)
+@@ -90,9 +90,9 @@
+   int imx_bitrate;
+   int imx_strip_vbi;
+ 
+-  /* In some cases FFMpeg would report something like PIX_FMT_YUV422P, while
+-     we would like to treat it as PIX_FMT_YUVJ422P. It's only used for decoding */
+-  enum PixelFormat reinterpret_pix_fmt;
++  /* In some cases FFMpeg would report something like AV_PIX_FMT_YUV422P, while
++     we would like to treat it as AV_PIX_FMT_YUVJ422P. It's only used for decoding */
++  enum AVPixelFormat reinterpret_pix_fmt;
+   
+   int is_imx;
+   int y_offset;
+@@ -137,42 +137,42 @@
+ 
+ static const struct
+   {
+-  enum PixelFormat ffmpeg_id;
++  enum AVPixelFormat ffmpeg_id;
+   int              lqt_id;
+   int              exact;
+   }
+ colormodels[] =
+   {
+-    { PIX_FMT_YUV420P,   BC_YUV420P,   1 }, ///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples)
++    { AV_PIX_FMT_YUV420P,   BC_YUV420P,   1 }, ///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples)
+ #if LIBAVUTIL_VERSION_INT < (50<<16)
+-    { PIX_FMT_YUV422,    BC_YUV422,    1 },
++    { AV_PIX_FMT_YUV422,    BC_YUV422,    1 },
+ #else
+-    { PIX_FMT_YUYV422,   BC_YUV422,    1 },
++    { AV_PIX_FMT_YUYV422,   BC_YUV422,    1 },
+ #endif
+-    { PIX_FMT_RGB24,     BC_RGB888,    1 }, ///< Packed pixel, 3 bytes per pixel, RGBRGB...
+-    { PIX_FMT_BGR24,     BC_BGR888,    1 }, ///< Packed pixel, 3 bytes per pixel, BGRBGR...
+-    { PIX_FMT_YUV422P,   BC_YUV422P,   1 }, ///< Planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
+-    { PIX_FMT_YUV444P,   BC_YUV444P,   1 }, ///< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples)
+-    { PIX_FMT_YUV411P,   BC_YUV411P,   1 }, ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples)
+-    { PIX_FMT_YUV422P16, BC_YUV422P16, 1 }, ///< Planar 16 bit YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
+-#ifdef PIX_FMT_YUV422P10
+-    { PIX_FMT_YUV422P10, BC_YUV422P10, 1 }, ///< 10 bit samples in uint16_t containers, planar 4:2:2
+-#endif
+-    { PIX_FMT_RGB565,    BC_RGB565,    1 }, ///< always stored in cpu endianness
+-    { PIX_FMT_YUVJ420P,  BC_YUVJ420P,  1 }, ///< Planar YUV 4:2:0 full scale (jpeg)
+-    { PIX_FMT_YUVJ422P,  BC_YUVJ422P,  1 }, ///< Planar YUV 4:2:2 full scale (jpeg)
+-    { PIX_FMT_YUVJ444P,  BC_YUVJ444P,  1 }, ///< Planar YUV 4:4:4 full scale (jpeg)
++    { AV_PIX_FMT_RGB24,     BC_RGB888,    1 }, ///< Packed pixel, 3 bytes per pixel, RGBRGB...
++    { AV_PIX_FMT_BGR24,     BC_BGR888,    1 }, ///< Packed pixel, 3 bytes per pixel, BGRBGR...
++    { AV_PIX_FMT_YUV422P,   BC_YUV422P,   1 }, ///< Planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
++    { AV_PIX_FMT_YUV444P,   BC_YUV444P,   1 }, ///< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples)
++    { AV_PIX_FMT_YUV411P,   BC_YUV411P,   1 }, ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples)
++    { AV_PIX_FMT_YUV422P16, BC_YUV422P16, 1 }, ///< Planar 16 bit YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
++#ifdef AV_PIX_FMT_YUV422P10
++    { AV_PIX_FMT_YUV422P10, BC_YUV422P10, 1 }, ///< 10 bit samples in uint16_t containers, planar 4:2:2
++#endif
++    { AV_PIX_FMT_RGB565,    BC_RGB565,    1 }, ///< always stored in cpu endianness
++    { AV_PIX_FMT_YUVJ420P,  BC_YUVJ420P,  1 }, ///< Planar YUV 4:2:0 full scale (jpeg)
++    { AV_PIX_FMT_YUVJ422P,  BC_YUVJ422P,  1 }, ///< Planar YUV 4:2:2 full scale (jpeg)
++    { AV_PIX_FMT_YUVJ444P,  BC_YUVJ444P,  1 }, ///< Planar YUV 4:4:4 full scale (jpeg)
+ #if LIBAVUTIL_VERSION_INT < (50<<16)
+-    { PIX_FMT_RGBA32,    BC_RGBA8888,  0 }, ///< Packed pixel, 4 bytes per pixel, BGRABGRA...
++    { AV_PIX_FMT_RGBA32,    BC_RGBA8888,  0 }, ///< Packed pixel, 4 bytes per pixel, BGRABGRA...
+ #else
+-    { PIX_FMT_RGB32,     BC_RGBA8888,  0 }, ///< Packed pixel, 4 bytes per pixel, BGRABGRA...
++    { AV_PIX_FMT_RGB32,     BC_RGBA8888,  0 }, ///< Packed pixel, 4 bytes per pixel, BGRABGRA...
+ #endif
+-    { PIX_FMT_RGB555,    BC_RGB888,    0 }, ///< always stored in cpu endianness, most significant bit to 1
+-    { PIX_FMT_GRAY8,     BC_RGB888,    0 },
+-    { PIX_FMT_MONOWHITE, BC_RGB888,    0 }, ///< 0 is white
+-    { PIX_FMT_MONOBLACK, BC_RGB888,    0 }, ///< 0 is black
+-    { PIX_FMT_PAL8,      BC_RGB888,    0 }, ///< 8 bit with RGBA palette
+-    { PIX_FMT_YUV410P,   BC_YUV420P,   0 }, ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
++    { AV_PIX_FMT_RGB555,    BC_RGB888,    0 }, ///< always stored in cpu endianness, most significant bit to 1
++    { AV_PIX_FMT_GRAY8,     BC_RGB888,    0 },
++    { AV_PIX_FMT_MONOWHITE, BC_RGB888,    0 }, ///< 0 is white
++    { AV_PIX_FMT_MONOBLACK, BC_RGB888,    0 }, ///< 0 is black
++    { AV_PIX_FMT_PAL8,      BC_RGB888,    0 }, ///< 8 bit with RGBA palette
++    { AV_PIX_FMT_YUV410P,   BC_YUV420P,   0 }, ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
+   };
+ 
+ static const struct
+@@ -343,16 +343,16 @@
+   if (!codec->pix_fmts)
+     return 0;
+ 
+-  for (i = 0; codec->pix_fmts[i] != PIX_FMT_NONE; ++i)
++  for (i = 0; codec->pix_fmts[i] != AV_PIX_FMT_NONE; ++i)
+     {
+-    if (codec->pix_fmts[i] == PIX_FMT_YUV422P10_OR_DUMMY)
++    if (codec->pix_fmts[i] == AV_PIX_FMT_YUV422P10_OR_DUMMY)
+       return 1;
+     }
+ 
+   return 0;
+   }
+ 
+-static enum PixelFormat lqt_ffmpeg_get_ffmpeg_colormodel(int id)
++static enum AVPixelFormat lqt_ffmpeg_get_ffmpeg_colormodel(int id)
+   {
+   int i;
+ 
+@@ -361,10 +361,10 @@
+     if(colormodels[i].lqt_id == id)
+       return colormodels[i].ffmpeg_id;
+     }
+-  return PIX_FMT_NB;
++  return AV_PIX_FMT_NB;
+   }
+ 
+-static int lqt_ffmpeg_get_lqt_colormodel(enum PixelFormat id, int * exact)
++static int lqt_ffmpeg_get_lqt_colormodel(enum AVPixelFormat id, int * exact)
+   {
+   int i;
+ 
+@@ -400,26 +400,26 @@
+   codec->reinterpret_pix_fmt = codec->avctx->pix_fmt;
+ 
+   /* First we try codec-specific colormodel matching. */
+-  if(codec->decoder->id == CODEC_ID_DNXHD)
++  if(codec->decoder->id == AV_CODEC_ID_DNXHD)
+     {
+-    /* FFMpeg supports PIX_FMT_YUV422P and PIX_FMT_YUV422P10 for DNxHD, which
+-       we sometimes interpret as PIX_FMT_YUVJ422P and PIX_FMT_YUVJ422P10. */
+-    if (codec->avctx->pix_fmt == PIX_FMT_YUV422P || codec->avctx->pix_fmt == PIX_FMT_YUV422P10_OR_DUMMY)
++    /* FFMpeg supports AV_PIX_FMT_YUV422P and AV_PIX_FMT_YUV422P10 for DNxHD, which
++       we sometimes interpret as AV_PIX_FMT_YUVJ422P and AV_PIX_FMT_YUVJ422P10. */
++    if (codec->avctx->pix_fmt == AV_PIX_FMT_YUV422P || codec->avctx->pix_fmt == AV_PIX_FMT_YUV422P10_OR_DUMMY)
+       {
+-      int p10 = (codec->avctx->pix_fmt == PIX_FMT_YUV422P10_OR_DUMMY);
++      int p10 = (codec->avctx->pix_fmt == AV_PIX_FMT_YUV422P10_OR_DUMMY);
+       *exact = 1;
+       if (lqt_ffmpeg_get_avid_yuv_range(vtrack->track) == AVID_FULL_YUV_RANGE)
+         {
+         vtrack->stream_cmodel = p10 ? BC_YUVJ422P10 : BC_YUVJ422P;
+-        codec->reinterpret_pix_fmt = p10 ? PIX_FMT_YUV422P10_OR_DUMMY : PIX_FMT_YUVJ422P;
+-        // Note: reinterpret_pix_fmt should really be PIX_FMT_YUVJ422P10, except
++        codec->reinterpret_pix_fmt = p10 ? AV_PIX_FMT_YUV422P10_OR_DUMMY : AV_PIX_FMT_YUVJ422P;
++        // Note: reinterpret_pix_fmt should really be AV_PIX_FMT_YUVJ422P10, except
+         // there is no such colormodel in FFMpeg. Fortunately, it's not a problem
+         // in this case, as reinterpret_pix_fmt is only used when *exact == 0.
+         }
+       else
+         {
+         vtrack->stream_cmodel = p10 ? BC_YUV422P10 : BC_YUV422P;
+-        codec->reinterpret_pix_fmt = p10 ? PIX_FMT_YUV422P10_OR_DUMMY : PIX_FMT_YUV422P;
++        codec->reinterpret_pix_fmt = p10 ? AV_PIX_FMT_YUV422P10_OR_DUMMY : AV_PIX_FMT_YUV422P;
+         }
+       return;
+       }
+@@ -438,16 +438,16 @@
+   quicktime_ffmpeg_video_codec_t *codec = vtrack->codec->priv;
+   codec->avctx->pix_fmt = lqt_ffmpeg_get_ffmpeg_colormodel(vtrack->stream_cmodel);
+ 
+-  if (codec->encoder->id == CODEC_ID_DNXHD)
++  if (codec->encoder->id == AV_CODEC_ID_DNXHD)
+     {
+-    /* FFMpeg's DNxHD encoder only supports PIX_FMT_YUV422P and PIX_FMT_YUV422P10
+-       and doesn't know anything about PIX_FMT_YUVJ422P and PIX_FMT_YUVJ422P10
++    /* FFMpeg's DNxHD encoder only supports AV_PIX_FMT_YUV422P and AV_PIX_FMT_YUV422P10
++       and doesn't know anything about AV_PIX_FMT_YUVJ422P and AV_PIX_FMT_YUVJ422P10
+        (in fact, the latter doesn't even exist) */
+-    codec->avctx->pix_fmt = PIX_FMT_YUV422P;
++    codec->avctx->pix_fmt = AV_PIX_FMT_YUV422P;
+     if (vtrack->stream_cmodel == BC_YUV422P10 || vtrack->stream_cmodel == BC_YUVJ422P10)
+       {
+       if (lqt_tenbit_dnxhd_supported(codec->encoder))
+-        codec->avctx->pix_fmt = PIX_FMT_YUV422P10_OR_DUMMY;
++        codec->avctx->pix_fmt = AV_PIX_FMT_YUV422P10_OR_DUMMY;
+       }
+     }
+   }
+@@ -458,7 +458,7 @@
+ /* From avcodec.h: */
+ 
+ /*
+- * PIX_FMT_RGBA32 is handled in an endian-specific manner. A RGBA
++ * AV_PIX_FMT_RGBA32 is handled in an endian-specific manner. A RGBA
+  * color is put together as:
+  *  (A << 24) | (R << 16) | (G << 8) | B
+  * This is stored as BGRA on little endian CPU architectures and ARGB on
+@@ -530,7 +530,7 @@
+  */
+ 
+ static void convert_image_decode(quicktime_ffmpeg_video_codec_t *codec,
+-                                 AVFrame * in_frame, enum PixelFormat in_format,
++                                 AVFrame * in_frame, enum AVPixelFormat in_format,
+                                  unsigned char ** out_frame, int out_format,
+                                  int width, int height, int row_span, int row_span_uv)
+   {
+@@ -547,9 +547,9 @@
+    *  RGBA format like in ffmpeg??
+    */
+ #if LIBAVUTIL_VERSION_INT < (50<<16)
+-  if((in_format == PIX_FMT_RGBA32) && (out_format == BC_RGBA8888))
++  if((in_format == AV_PIX_FMT_RGBA32) && (out_format == BC_RGBA8888))
+ #else
+-    if((in_format == PIX_FMT_RGB32) && (out_format == BC_RGBA8888))
++    if((in_format == AV_PIX_FMT_RGB32) && (out_format == BC_RGBA8888))
+ #endif
+       {
+       convert_image_decode_rgba(in_frame, out_frame, width, height, codec->y_offset);
+@@ -728,13 +728,13 @@
+ 
+     /* Set extradata: It's done differently for each codec */
+ 
+-    if(codec->decoder->id == CODEC_ID_SVQ3)
++    if(codec->decoder->id == AV_CODEC_ID_SVQ3)
+       {
+       extradata       = trak->mdia.minf.stbl.stsd.table[0].table_raw + 4;
+       extradata_size  = trak->mdia.minf.stbl.stsd.table[0].table_raw_size - 4;
+       
+       }
+-    else if(codec->decoder->id == CODEC_ID_H264)
++    else if(codec->decoder->id == AV_CODEC_ID_H264)
+       {
+       user_atom = quicktime_stsd_get_user_atom(trak, "avcC", &user_atom_len);
+ 
+@@ -753,7 +753,7 @@
+         }
+       
+       }
+-    else if(codec->decoder->id == CODEC_ID_MPEG4)
++    else if(codec->decoder->id == AV_CODEC_ID_MPEG4)
+       {
+       if(trak->mdia.minf.stbl.stsd.table[0].has_esds)
+         {
+@@ -781,7 +781,7 @@
+     if(extradata)
+       {
+       codec->extradata =
+-        calloc(1, extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
++        calloc(1, extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
+       memcpy(codec->extradata, extradata, extradata_size);
+       codec->avctx->extradata_size = extradata_size;
+       codec->avctx->extradata = codec->extradata;
+@@ -829,7 +829,7 @@
+     if(avcodec_open2(codec->avctx, codec->decoder, NULL) != 0)
+       return -1;
+ #endif
+-    codec->frame = avcodec_alloc_frame();
++    codec->frame = av_frame_alloc();
+     vtrack->stream_cmodel = LQT_COLORMODEL_NONE;
+     codec->initialized = 1;
+     }
+@@ -929,10 +929,10 @@
+ #ifdef HAVE_LIBSWSCALE
+ 
+ #if LIBAVUTIL_VERSION_INT < (50<<16)
+-      if(!((codec->avctx->pix_fmt == PIX_FMT_RGBA32) &&
++      if(!((codec->avctx->pix_fmt == AV_PIX_FMT_RGBA32) &&
+            (vtrack->stream_cmodel == BC_RGBA8888)))
+ #else
+-        if(!((codec->avctx->pix_fmt == PIX_FMT_RGB32) &&
++        if(!((codec->avctx->pix_fmt == AV_PIX_FMT_RGB32) &&
+              (vtrack->stream_cmodel == BC_RGBA8888)))
+ #endif
+           {
+@@ -947,15 +947,15 @@
+           }
+ #endif
+       }
+-    if(codec->decoder->id == CODEC_ID_DVVIDEO)
++    if(codec->decoder->id == AV_CODEC_ID_DVVIDEO)
+       {
+       if(vtrack->stream_cmodel == BC_YUV420P)
+         vtrack->chroma_placement = LQT_CHROMA_PLACEMENT_DVPAL;
+       vtrack->interlace_mode = LQT_INTERLACE_BOTTOM_FIRST;
+       vtrack->ci.id = LQT_COMPRESSION_DV;
+       }
+-    else if((codec->decoder->id == CODEC_ID_MPEG4) ||
+-            (codec->decoder->id == CODEC_ID_H264))
++    else if((codec->decoder->id == AV_CODEC_ID_MPEG4) ||
++            (codec->decoder->id == AV_CODEC_ID_H264))
+       {
+       if(vtrack->stream_cmodel == BC_YUV420P)
+         vtrack->chroma_placement = LQT_CHROMA_PLACEMENT_MPEG2;
+@@ -1140,8 +1140,8 @@
+   codec->avctx->qmin = 1;
+   codec->avctx->qmax = 3;
+   codec->avctx->rtp_payload_size = 1; // ??
+-  codec->avctx->rc_buffer_aggressivity = 0.25;
+-  codec->avctx->flags |= CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_LOW_DELAY;
++  av_dict_set(&codec->options, "rc_buf_aggressivity", "0.25", 0);
++  codec->avctx->flags |= AV_CODEC_FLAG_INTERLACED_DCT|AV_CODEC_FLAG_LOW_DELAY;
+ 
+ #if (LIBAVCODEC_VERSION_MAJOR < 54)
+   codec->avctx->flags2 |= CODEC_FLAG2_INTRA_VLC|CODEC_FLAG2_NON_LINEAR_QUANT;
+@@ -1299,13 +1299,13 @@
+     {
+     if(vtrack->stream_cmodel == BC_YUV420P)
+       {
+-      if(codec->encoder->id == CODEC_ID_MPEG4)
++      if(codec->encoder->id == AV_CODEC_ID_MPEG4)
+         {
+         vtrack->chroma_placement = LQT_CHROMA_PLACEMENT_MPEG2;
+         /* enable interlaced encoding */
+         vtrack->interlace_mode = LQT_INTERLACE_NONE;
+         }
+-      else if(codec->encoder->id == CODEC_ID_DVVIDEO)
++      else if(codec->encoder->id == AV_CODEC_ID_DVVIDEO)
+         {
+         vtrack->chroma_placement = LQT_CHROMA_PLACEMENT_DVPAL;
+         }
+@@ -1318,7 +1318,7 @@
+         
+   if(!codec->initialized)
+     {
+-    codec->frame = avcodec_alloc_frame();
++    codec->frame = av_frame_alloc();
+ 
+     /* time_base is 1/framerate for constant framerate */
+           
+@@ -1328,7 +1328,7 @@
+     //          codec->avctx->time_base.den = 1;
+     //          codec->avctx->time_base.num = lqt_video_time_scale(file, track);
+ 
+-    if(codec->avctx->flags & CODEC_FLAG_QSCALE)
++    if(codec->avctx->flags & AV_CODEC_FLAG_QSCALE)
+       codec->avctx->global_quality = codec->qscale;
+                               
+     codec->avctx->width = width;
+@@ -1340,11 +1340,11 @@
+     codec->avctx->sample_aspect_ratio.num = pixel_width;
+     codec->avctx->sample_aspect_ratio.den = pixel_height;
+     /* Use global headers for mp4v */
+-    if(codec->encoder->id == CODEC_ID_MPEG4)
++    if(codec->encoder->id == AV_CODEC_ID_MPEG4)
+       {
+       if(!(file->file_type & (LQT_FILE_AVI|LQT_FILE_AVI_ODML)))
+         {
+-        codec->avctx->flags |= CODEC_FLAG_GLOBAL_HEADER;
++        codec->avctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
+         codec->write_global_header = 1;
+         }
+             
+@@ -1360,16 +1360,16 @@
+         {
+         lqt_log(file, LQT_LOG_INFO, LOG_DOMAIN, "Enabling interlaced encoding");
+         codec->avctx->flags |=
+-          (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME|CODEC_FLAG_ALT_SCAN);
++          (AV_CODEC_FLAG_INTERLACED_DCT|AV_CODEC_FLAG_INTERLACED_ME|AV_CODEC_FLAG_ALT_SCAN);
+         }
+ #endif
+       }
+-    else if((codec->encoder->id == CODEC_ID_MSMPEG4V3) && (trak->strl) &&
++    else if((codec->encoder->id == AV_CODEC_ID_MSMPEG4V3) && (trak->strl) &&
+             !strncmp(trak->strl->strf.bh.biCompression, "DIV3", 4))
+       {
+       strncpy(trak->strl->strh.fccHandler, "div3", 4);
+       }
+-    else if((codec->encoder->id == CODEC_ID_H263) &&
++    else if((codec->encoder->id == AV_CODEC_ID_H263) &&
+             (file->file_type & (LQT_FILE_MP4|LQT_FILE_3GP)))
+       {
+       uint8_t d263_data[] =
+@@ -1383,34 +1383,34 @@
+       strncpy(trak->mdia.minf.stbl.stsd.table[0].format,
+               "s263", 4);
+       }
+-    else if(codec->encoder->id == CODEC_ID_FFVHUFF)
++    else if(codec->encoder->id == AV_CODEC_ID_FFVHUFF)
+       {
+       if(!(file->file_type & (LQT_FILE_AVI|LQT_FILE_AVI_ODML)))
+         {
+-        codec->avctx->flags |= CODEC_FLAG_GLOBAL_HEADER;
++        codec->avctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
+         codec->write_global_header = 1;
+         }
+       }
+-    else if(codec->encoder->id == CODEC_ID_QTRLE)
++    else if(codec->encoder->id == AV_CODEC_ID_QTRLE)
+       {
+       if(vtrack->stream_cmodel == BC_RGBA8888)
+         {
+         /* Libquicktime doesn't natively support a color model equivalent
+-           to PIX_FMT_ARGB, which is required for QTRLE with alpha channel.
++           to AV_PIX_FMT_ARGB, which is required for QTRLE with alpha channel.
+            So, we use BC_RGBA8888 and do ad hoc conversion below. */
+-        codec->avctx->pix_fmt = PIX_FMT_ARGB;
++        codec->avctx->pix_fmt = AV_PIX_FMT_ARGB;
+         vtrack->track->mdia.minf.stbl.stsd.table[0].depth = 32;
+         }
+       }
+-    else if(codec->encoder->id == CODEC_ID_DVVIDEO)
++    else if(codec->encoder->id == AV_CODEC_ID_DVVIDEO)
+       {
+       set_dv_fourcc(width, height, vtrack->stream_cmodel, trak);
+       }
+-    else if(codec->encoder->id == CODEC_ID_DNXHD)
++    else if(codec->encoder->id == AV_CODEC_ID_DNXHD)
+       {
+       if(vtrack->interlace_mode != LQT_INTERLACE_NONE)
+         {
+-        codec->avctx->flags |= CODEC_FLAG_INTERLACED_DCT;
++        codec->avctx->flags |= AV_CODEC_FLAG_INTERLACED_DCT;
+         }
+       }
+     else if(codec->is_imx)
+@@ -1422,7 +1422,7 @@
+       if(codec->pass == 1)
+         {
+         codec->stats_file = fopen(codec->stats_filename, "w");
+-        codec->avctx->flags |= CODEC_FLAG_PASS1;
++        codec->avctx->flags |= AV_CODEC_FLAG_PASS1;
+         }
+       else if(codec->pass == codec->total_passes)
+         {
+@@ -1438,7 +1438,7 @@
+         fclose(codec->stats_file);
+         codec->stats_file = (FILE*)0;
+               
+-        codec->avctx->flags |= CODEC_FLAG_PASS2;
++        codec->avctx->flags |= AV_CODEC_FLAG_PASS2;
+         }
+       }
+     /* Open codec */
+@@ -1467,7 +1467,7 @@
+     }
+   //        codec->lqt_colormodel = ffmepg_2_lqt(codec->com.ffcodec_enc);
+ 
+-  if(codec->y_offset != 0 || codec->avctx->pix_fmt == PIX_FMT_ARGB)
++  if(codec->y_offset != 0 || codec->avctx->pix_fmt == AV_PIX_FMT_ARGB)
+     {
+     if(!codec->tmp_rows)
+       {
+@@ -1492,7 +1492,7 @@
+                         vtrack->stream_cmodel,
+                         0, 0, 0, codec->y_offset);
+       }
+-    else if(codec->avctx->pix_fmt == PIX_FMT_ARGB)
++    else if(codec->avctx->pix_fmt == AV_PIX_FMT_ARGB)
+       {
+       convert_rgba_to_argb(row_pointers[0], vtrack->stream_row_span,
+                            codec->tmp_rows[0], codec->tmp_row_span,
+@@ -1516,7 +1516,7 @@
+     }
+   
+   codec->frame->pts = vtrack->timestamp;
+-  if(codec->avctx->flags & CODEC_FLAG_QSCALE)
++  if(codec->avctx->flags & AV_CODEC_FLAG_QSCALE)
+     codec->frame->quality = codec->qscale;
+ #ifdef DO_INTERLACE
+   if(vtrack->interlace_mode != LQT_INTERLACE_NONE)
+@@ -1558,12 +1558,12 @@
+   
+ #endif
+   
+-  if(!was_initialized && codec->encoder->id == CODEC_ID_DNXHD)
++  if(!was_initialized && codec->encoder->id == AV_CODEC_ID_DNXHD)
+     setup_avid_atoms(file, vtrack, codec->buffer, bytes_encoded);
+   
+   if(bytes_encoded)
+     {
+-    if (pts == AV_NOPTS_VALUE || (codec->encoder->id == CODEC_ID_DNXHD && pts == 0))
++    if (pts == AV_NOPTS_VALUE || (codec->encoder->id == AV_CODEC_ID_DNXHD && pts == 0))
+       {
+       /* Some codecs don't bother generating presentation timestamps.
+          FFMpeg's DNxHD encoder doesn't even bother to set it to AV_NOPTS_VALUE. */
+@@ -1590,17 +1590,16 @@
+ 
+   if(codec->write_global_header && !codec->global_header_written)
+     {
+-    if(codec->encoder->id == CODEC_ID_FFVHUFF)
++    if(codec->encoder->id == AV_CODEC_ID_FFVHUFF)
+       {
+       quicktime_user_atoms_add_atom(&trak->mdia.minf.stbl.stsd.table[0].user_atoms,
+                                     "glbl",
+                                     codec->avctx->extradata, codec->avctx->extradata_size );
+       }
+-    else if(codec->encoder->id == CODEC_ID_MPEG4)
++    else if(codec->encoder->id == AV_CODEC_ID_MPEG4)
+       {
+       int advanced = 0;
+-      if(codec->avctx->max_b_frames ||
+-         (codec->avctx->flags & (CODEC_FLAG_QPEL|CODEC_FLAG_GMC)))
++      if(codec->avctx->max_b_frames)
+         advanced = 1;
+ 
+       setup_header_mpeg4(file, track, codec->avctx->extradata,
+@@ -1903,18 +1902,18 @@
+     codec_base->encode_video = lqt_ffmpeg_encode_video;
+     codec_base->set_pass = set_pass_ffmpeg;
+ 
+-    if(encoder->id == CODEC_ID_MPEG4)
++    if(encoder->id == AV_CODEC_ID_MPEG4)
+       {
+       codec_base->writes_compressed = writes_compressed_mpeg4;
+       codec_base->init_compressed   = init_compressed_mpeg4;
+       codec_base->write_packet = write_packet_mpeg4;
+       }
+-    else if(encoder->id == CODEC_ID_MPEG2VIDEO)
++    else if(encoder->id == AV_CODEC_ID_MPEG2VIDEO)
+       {
+       codec_base->writes_compressed = writes_compressed_imx;
+       codec_base->init_compressed   = init_compressed_imx;
+       }
+-    else if(encoder->id == CODEC_ID_DVVIDEO)
++    else if(encoder->id == AV_CODEC_ID_DVVIDEO)
+       {
+       codec_base->init_compressed = init_compressed_dv;
+       }
+@@ -1922,7 +1921,7 @@
+     }
+   if(decoder)
+     {
+-    if(decoder->id == CODEC_ID_H264)
++    if(decoder->id == AV_CODEC_ID_H264)
+       codec_base->read_packet = read_packet_h264;
+     codec_base->decode_video = lqt_ffmpeg_decode_video;
+     }
+diff -Naur a/src/util.c b/src/util.c
+--- a/src/util.c	2011-01-07 14:40:47.000000000 +0000
++++ b/src/util.c	2018-05-11 23:11:04.367991499 +0100
+@@ -340,9 +340,14 @@
+ 
+ void quicktime_read_pascal(quicktime_t *file, char *data)
+ {
+-	char len = quicktime_read_char(file);
+-	quicktime_read_data(file, (uint8_t*)data, len);
+-	data[(int)len] = 0;
++	int len = quicktime_read_char(file);
++	if ((len > 0) && (len < 256)) {
++          /* data[] is expected to be 256 bytes long */
++          quicktime_read_data(file, (uint8_t*)data, len);
++          data[len] = 0;
++        } else {
++          data[0] = 0;
++        }
+ }
+ 
+ void quicktime_write_pascal(quicktime_t *file, char *data)
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index 3764e14552..6a900eceee 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -219,6 +219,46 @@ as a joint effort between the BBC and Fluendo.")
       license:expat
       license:mpl1.1))))
 
+(define-public libquicktime
+  (package
+    (name "libquicktime")
+    (version "1.2.4")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://sourceforge.net/projects/" name "/files/"
+                       name "/" version "/" name "-" version ".tar.gz"))
+       (sha256
+        (base32 "0s3kshzl3zfjw3phzv73r91fkr9z8q8kc3dhsys4f4xk6ff3alqw"))
+       (patches
+        (search-patches "libquicktime-ffmpeg.patch"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("gettext" ,gettext-minimal)
+       ("doxygen" ,doxygen)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("alsa" ,alsa-lib)
+       ("ffmpeg" ,ffmpeg)
+       ("gtk+-2" ,gtk+-2)
+       ("lame" ,lame)
+       ("libdv" ,libdv)
+       ("libjpeg" ,libjpeg-turbo)
+       ("libpng" ,libpng)
+       ("libvorbis" ,libvorbis)
+       ("opengl" ,mesa)
+       ("schroedinger" ,schroedinger)
+       ("x11" ,libx11)
+       ("x264" ,libx264)
+       ("xaw" ,libxaw)
+       ("xv" ,libxv)))
+    (synopsis "Quick Time Library")
+    (description "The goal of this project is to enhance the quicktime4linux
+library.")
+    (home-page "http://libquicktime.sourceforge.net/")
+    (license license:lgpl2.1+)))
+
 (define-public libmms
   (package
     (name "libmms")
-- 
2.26.2


[-- Attachment #1.1.21: 0029-gnu-Add-mjpegtools.patch --]
[-- Type: text/x-patch, Size: 1669 bytes --]

From ac7243f1d5832d37f7edffd3281094300b833788 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Fri, 3 Jul 2020 08:07:02 -0400
Subject: [PATCH 29/51] gnu: Add mjpegtools.

* gnu/packages/video.scm (mjpegtools): New variable.
---
 gnu/packages/video.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index 6a900eceee..932e6dae33 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -259,6 +259,32 @@ library.")
     (home-page "http://libquicktime.sourceforge.net/")
     (license license:lgpl2.1+)))
 
+(define-public mjpegtools
+  (package
+    (name "mjpegtools")
+    (version "2.1.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://sourceforge.net/projects/" name "/files/"
+                       name "/" version "/" name "-" version ".tar.gz"))
+       (sha256
+        (base32 "0kvhxr5hkabj9v7ah2rzkbirndfqdijd9hp8v52c1z6bxddf019w"))))
+    (build-system gnu-build-system)
+    (inputs
+     `(("gtk+-2" ,gtk+-2)
+       ("libdv" ,libdv)
+       ("libpng" ,libpng)
+       ("libquicktime" ,libquicktime)
+       ("sdl" ,sdl)))
+    (synopsis "Tools for handling MPEG")
+    (description "Mjpeg tools is a suite of programs which support video capture,
+editing, playback, and compression to MPEG of MJPEG video.  Edit, play and
+compression software is hardware independent.")
+    (home-page "http://mjpeg.sourceforge.net/")
+    (license license:gpl2+)))
+
 (define-public libmms
   (package
     (name "libmms")
-- 
2.26.2


[-- Attachment #1.1.22: 0030-gnu-Add-libofa.patch --]
[-- Type: text/x-patch, Size: 6710 bytes --]

From 99bb9b203f253ac46bf9b055aa7287cdc744bf44 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Fri, 3 Jul 2020 09:16:01 -0400
Subject: [PATCH 30/51] gnu: Add libofa.

* gnu/packages/audio.scm (libofa): New variable.
* gnu/packages/patches/libofa-ftbfs-1.diff: New file.
* gnu/packages/patches/libofa-curl.diff: New file.
* gnu/packages/patches/libofa-ftbfs-2.diff: New file.
* gnu/local.mk (libofa-ftbfs-1.diff): New reference.
* gnu/local.mk (libofa-curl.diff): New reference.
* gnu/local.mk (libofa-ftbfs-2.diff): New reference.
---
 gnu/local.mk                             |  3 ++
 gnu/packages/audio.scm                   | 32 +++++++++++++++++
 gnu/packages/patches/libofa-curl.diff    | 15 ++++++++
 gnu/packages/patches/libofa-ftbfs-1.diff | 45 ++++++++++++++++++++++++
 gnu/packages/patches/libofa-ftbfs-2.diff | 27 ++++++++++++++
 5 files changed, 122 insertions(+)
 create mode 100644 gnu/packages/patches/libofa-curl.diff
 create mode 100644 gnu/packages/patches/libofa-ftbfs-1.diff
 create mode 100644 gnu/packages/patches/libofa-ftbfs-2.diff

diff --git a/gnu/local.mk b/gnu/local.mk
index ecc6bf8bb0..9385c2a985 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1181,6 +1181,9 @@ dist_patch_DATA =						\
   %D%/packages/patches/libgnomeui-utf8.patch			\
   %D%/packages/patches/libjxr-fix-function-signature.patch	\
   %D%/packages/patches/libjxr-fix-typos.patch			\
+  %D%/packages/patches/libofa-ftbfs-1.diff		\
+  %D%/packages/patches/libofa-curl.diff		\
+  %D%/packages/patches/libofa-ftbfs-2.diff		\
   %D%/packages/patches/libotr-test-auth-fix.patch		\
   %D%/packages/patches/libksieve-Fix-missing-link-libraries.patch \
   %D%/packages/patches/libmad-armv7-thumb-pt1.patch		\
diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 3823115f24..83113b00a5 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -126,6 +126,38 @@
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26))
 
+(define-public libofa
+  (package
+    (name "libofa")
+    (version "0.9.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://storage.googleapis.com/"
+                       "google-code-archive-downloads/v2/code.google.com/"
+                       "musicip-libofa/" name "-" version ".tar.gz"))
+       (sha256
+        (base32 "184ham039l7lwhfgg0xr2vch2xnw1lwh7sid432mh879adhlc5h2"))
+       (patches
+        (search-patches
+         "libofa-ftbfs-1.diff"
+         "libofa-curl.diff"
+         "libofa-ftbfs-2.diff"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("curl" ,curl)
+       ("expat" ,expat)))
+    (propagated-inputs
+     `(("fftw" ,fftw)))
+    (synopsis "Open Fingerprint Architecture")
+    (description "LibOFA is an audio fingerprint library, created and provided
+by MusicIP.")
+    (home-page "https://code.google.com/archive/p/musicip-libofa/")
+    (license license:gpl2+)))
+
 (define-public faac
   (package
     (name "faac")
diff --git a/gnu/packages/patches/libofa-curl.diff b/gnu/packages/patches/libofa-curl.diff
new file mode 100644
index 0000000000..6b1e824fad
--- /dev/null
+++ b/gnu/packages/patches/libofa-curl.diff
@@ -0,0 +1,15 @@
+Description: Fix FTBFS due to unexisting and useless include. (Closes: #637896)
+Author: Regis Boudin <regis@debian.org>
+Last-Update: 2011-10-03
+Index: libofa-0.9.3/examples/protocol.cpp
+===================================================================
+--- libofa-0.9.3.orig/examples/protocol.cpp
++++ libofa-0.9.3/examples/protocol.cpp
+@@ -13,7 +13,6 @@
+ #include <map>
+ #include <expat.h>
+ #include <curl/curl.h>
+-#include <curl/types.h>
+ #include <curl/easy.h>
+ 
+ using namespace std;
diff --git a/gnu/packages/patches/libofa-ftbfs-1.diff b/gnu/packages/patches/libofa-ftbfs-1.diff
new file mode 100644
index 0000000000..4aa712320c
--- /dev/null
+++ b/gnu/packages/patches/libofa-ftbfs-1.diff
@@ -0,0 +1,45 @@
+Description: fix FTBFS with GCC 4.3. (Closes: #417355)
+Author: Martin Michlmayr <tbm@cyrius.com>
+Last-Update: 2007-04-02
+
+Description: add a missing include. (Closes: #441557)
+Author: Brian M. Carlson <sandals@crustytoothpaste.ath.cx>
+Last-Update: 2007-12-29
+
+Index: libofa-0.9.3/lib/signal_op.cpp
+===================================================================
+--- libofa-0.9.3.orig/lib/signal_op.cpp
++++ libofa-0.9.3/lib/signal_op.cpp
+@@ -12,6 +12,7 @@
+ // DATE CREATED: 1/12/06
+ 
+ 
++#include <cstdlib>
+ #include <math.h>
+ #include "signal_op.h"
+ #include "AFLIB/aflibConverter.h"
+Index: libofa-0.9.3/examples/example.cpp
+===================================================================
+--- libofa-0.9.3.orig/examples/example.cpp
++++ libofa-0.9.3/examples/example.cpp
+@@ -8,6 +8,8 @@
+ -------------------------------------------------------------------*/
+ 
+ #include "protocol.h"
++#include <cctype>
++#include <string.h>
+ 
+ AudioData* loadWaveFile(char *file);
+ AudioData* loadDataUsingLAME(char *file);
+Index: libofa-0.9.3/examples/protocol.cpp
+===================================================================
+--- libofa-0.9.3.orig/examples/protocol.cpp
++++ libofa-0.9.3/examples/protocol.cpp
+@@ -8,6 +8,7 @@
+ -------------------------------------------------------------------*/
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <cstring>
+ #include <string>
+ #include <map>
+ #include <expat.h>
diff --git a/gnu/packages/patches/libofa-ftbfs-2.diff b/gnu/packages/patches/libofa-ftbfs-2.diff
new file mode 100644
index 0000000000..ad61573578
--- /dev/null
+++ b/gnu/packages/patches/libofa-ftbfs-2.diff
@@ -0,0 +1,27 @@
+Description: ftbfs with GCC-4.7. (Closes: #667250)
+Author: Matthias Klose <doko@debian.org>
+Last-Update: 2012-04-17
+Index: libofa-0.9.3/examples/uselame.cpp
+===================================================================
+--- libofa-0.9.3.orig/examples/uselame.cpp
++++ libofa-0.9.3/examples/uselame.cpp
+@@ -11,6 +11,7 @@
+ #include "windows.h"
+ #else
+ #include <sys/wait.h>
++#include <unistd.h>
+ #endif
+ 
+ AudioData *loadWaveFile(char *file);
+Index: libofa-0.9.3/examples/wavefile.cpp
+===================================================================
+--- libofa-0.9.3.orig/examples/wavefile.cpp
++++ libofa-0.9.3/examples/wavefile.cpp
+@@ -11,6 +11,7 @@
+ #include "io.h"
+ #endif
+ #include <fcntl.h>
++#include <unistd.h>
+ 
+ static bool readBytes(int fd, unsigned char *buf, int size) {
+     int ct = 0;
-- 
2.26.2


[-- Attachment #1.1.23: 0031-gnu-Add-libopenmpt.patch --]
[-- Type: text/x-patch, Size: 1860 bytes --]

From 196951ed551b199f0f4233389cc836cf40182092 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Fri, 3 Jul 2020 09:40:24 -0400
Subject: [PATCH 31/51] gnu: Add libopenmpt.

* gnu/packages/audio.scm (libopenmpt): New variable.
---
 gnu/packages/audio.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 83113b00a5..e8a283d809 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -126,6 +126,40 @@
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26))
 
+(define-public libopenmpt
+  (package
+    (name "libopenmpt")
+    (version "0.5.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://download.openmpt.org/archive/" name "/src/"
+                       name "-" version "+release.autotools.tar.gz"))
+       (sha256
+        (base32 "0zl3djy9z7cpqk8g8pxrzmmikxsskb0y5qdabg6c683j7x5abjs3"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("doxygen" ,doxygen)
+       ("perl" ,perl)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("alsa" ,alsa-lib)
+       ("flac" ,flac)
+       ("portaudio" ,portaudio)
+       ("pulseaudio" ,pulseaudio)
+       ("sdl2" ,sdl2)
+       ("sndfile" ,libsndfile)
+       ("zlib" ,zlib)))
+    (propagated-inputs
+     `(("vorbis" ,libvorbis)
+       ("mpg123" ,mpg123)))
+    (synopsis "Audio tracking library")
+    (description "LibOpenMPT is a cross-platform C++ and C module playback
+library.  It is based on the player code of the Open ModPlug Tracker project.")
+    (home-page "https://openmpt.org/")
+    (license (license:non-copyleft "file:///LICENSE"))))
+
 (define-public libofa
   (package
     (name "libofa")
-- 
2.26.2


[-- Attachment #1.1.24: 0032-gnu-Add-opensles.patch --]
[-- Type: text/x-patch, Size: 2128 bytes --]

From 4663dc3351eb9c4512c32a4df98ba57351c7b01a Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Fri, 3 Jul 2020 09:41:39 -0400
Subject: [PATCH 32/51] gnu: Add opensles.

* gnu/packages/audio.scm (opensles): New variable.
---
 gnu/packages/audio.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index e8a283d809..9e65a285d6 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -112,6 +112,7 @@
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
   #:use-module (guix build-system cmake)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system glib-or-gtk)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system meson)
@@ -126,6 +127,32 @@
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26))
 
+(define-public opensles
+  (package
+    (name "opensles")
+    (version "1.1.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/KhronosGroup/OpenSL-ES-Registry.git")
+         (commit "ea5104b")))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0j5bm7h3ahz66f23i9abwc0y10agfkpksnj6y078x2nichq66h4f"))))
+    (build-system copy-build-system)
+    (synopsis "Embedded Audio Acceleration")
+    (description "OpenSLES is a royalty-free, cross-platform,
+hardware-accelerated audio API tuned for embedded systems.  It provides a
+standardized, high-performance, low-latency method to access audio
+functionality for developers of native applications on embedded mobile
+multimedia devices, enabling straightforward cross-platform deployment of
+hardware and software audio capabilities, reducing implementation effort, and
+promoting the market for advanced audio.")
+    (home-page "https://www.khronos.org/opensles/")
+    (license (license:non-copyleft "Refer individual files"))))
+
 (define-public libopenmpt
   (package
     (name "libopenmpt")
-- 
2.26.2


[-- Attachment #1.1.25: 0033-gnu-Add-lksctp-tools.patch --]
[-- Type: text/x-patch, Size: 1939 bytes --]

From 39885fcfa5fe43f4bea6932c45f6be49b3459716 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Fri, 3 Jul 2020 09:43:19 -0400
Subject: [PATCH 33/51] gnu: Add lksctp-tools.

* gnu/packages/networking.scm (lksctp-tools): New variable.
---
 gnu/packages/networking.scm | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index 1f185cad7c..1c731231db 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -133,6 +133,41 @@
   #:use-module (gnu packages xml)
   #:use-module (ice-9 match))
 
+(define-public lksctp-tools
+  (package
+    (name "lksctp-tools")
+    (version "1.0.18")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/sctp/lksctp-tools.git")
+         (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1x4fwzrlzvfa3vcpja97m8w5g9ir2zrh4zs7zksminrnmdrs0dsr"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("libtool" ,libtool)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("linux-headers" ,linux-libre-headers)))
+    (synopsis "Linux SCTP helper library")
+    (description "Lksctp-tools project provides a user space library for SCTP
+(libsctp) including C language header files (netinet/sctp.h) for accessing SCTP
+specific application programming interfaces not provided by the standard
+sockets, and also some helper utilities around SCTP.")
+    (home-page "http://lksctp.sourceforge.net/")
+    (license
+     (list
+      ;; Library.
+      license:lgpl2.1+
+      ;; Others.
+      license:gpl2+))))
+
 (define-public nng
   (package
     (name "nng")
-- 
2.26.2


[-- Attachment #1.1.26: 0034-gnu-Add-srt.patch --]
[-- Type: text/x-patch, Size: 2647 bytes --]

From f8f6c6502e1853ecfcbc25768156d2fd6dfc0d1c Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Fri, 3 Jul 2020 09:44:14 -0400
Subject: [PATCH 34/51] gnu: Add srt.

* gnu/packages/networking.scm (srt): New variable.
---
 gnu/packages/networking.scm | 43 +++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index 1c731231db..66798bd2d2 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -125,14 +125,57 @@
   #:use-module (gnu packages shells)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages ssh)
+  #:use-module (gnu packages tcl)
   #:use-module (gnu packages textutils)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages valgrind)
+  #:use-module (gnu packages version-control)
   #:use-module (gnu packages web)
   #:use-module (gnu packages wxwidgets)
   #:use-module (gnu packages xml)
   #:use-module (ice-9 match))
 
+(define-public srt
+  (package
+    (name "srt")
+    (version "1.4.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/Haivision/srt.git")
+         (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "01xaq44j95kbgqfl41pnybvqy0yq6wd4wdw88ckylzf0nzp977xz"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:configure-flags
+       (list
+        (string-append "-DCMAKE_INSTALL_BINDIR="
+                       (assoc-ref %outputs "out") "/bin")
+        (string-append "-DCMAKE_INSTALL_LIBDIR="
+                       (assoc-ref %outputs "out") "/lib")
+        (string-append "-DINSTALL_SHARED_DIR="
+                       (assoc-ref %outputs "out") "/lib")
+        (string-append "-DCMAKE_INSTALL_INCLUDEDIR="
+                       (assoc-ref %outputs "out") "/include")
+        "-DENABLE_UNITTESTS=ON"
+        "-DENABLE_CODE_COVERAGE=ON")))
+    (native-inputs
+     `(("git" ,git-minimal)
+       ("gtest" ,googletest)
+       ("pkg-config" ,pkg-config)
+       ("tclsh" ,tcl)))
+    (propagated-inputs
+     `(("openssl" ,openssl)))
+    (synopsis "Secure Reliable Transport")
+    (description "SRT is a transport technology that optimizes streaming
+performance across unpredictable networks, such as the Internet.")
+    (home-page "https://www.srtalliance.org/")
+    (license license:mpl2.0)))
+
 (define-public lksctp-tools
   (package
     (name "lksctp-tools")
-- 
2.26.2


[-- Attachment #1.1.27: 0035-gnu-Add-mediasdk.patch --]
[-- Type: text/x-patch, Size: 2184 bytes --]

From e397b83cf9d21afa37977c8c854dadbc78302516 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Fri, 3 Jul 2020 10:59:03 -0400
Subject: [PATCH 35/51] gnu: Add mediasdk.

* gnu/packages/video.scm (mediasdk): New variable.
---
 gnu/packages/video.scm | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index 932e6dae33..82a3ffb6ed 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -170,6 +170,48 @@
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg))
 
+(define-public mediasdk
+  (package
+    (name "mediasdk")
+    (version "20.1.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/Intel-Media-SDK/MediaSDK.git")
+         (commit (string-append "intel-" name "-" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0blwcxr5j8762nylx2cxrq0h53bpgnk859dbs6crq4wr9fcxlx9z"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:configure-flags
+       (list
+        "-DENABLE_X11=ON"
+        "-DENABLE_X11_DRI3=ON"
+        "-DENABLE_WAYLAND=ON"
+        "-DENABLE_TEXTLOG=ON"
+        "-DENABLE_STAT=ON"
+        "-DBUILD_TESTS=ON"
+        "-DBUILD_TOOLS=ON"
+        (string-append "-DCMAKE_EXE_LINKER_FLAGS=-Wl,-rpath="
+                       (assoc-ref %outputs "out") "/lib"))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ("python" ,python-wrapper)))
+    (inputs
+     `(("libdrm" ,libdrm)
+       ("libva" ,libva)
+       ("pciaccess" ,libpciaccess)
+       ("wayland" ,wayland)
+       ("x11" ,libx11)))
+    (synopsis "Intel Media SDK")
+    (description "MediaSDK provides a plain C API to access hardware-accelerated
+video decode, encode and filtering on Intel's Gen graphics hardware platforms.")
+    (home-page "http://mediasdk.intel.com/")
+    (license (license:non-copyleft "file:///LICENSE"))))
+
 (define-public schroedinger
   (package
     (name "schroedinger")
-- 
2.26.2


[-- Attachment #1.1.28: 0036-gnu-Add-svt-hevc.patch --]
[-- Type: text/x-patch, Size: 1771 bytes --]

From 13dcaf86065d3ce9d84ef4776f137050f3f627d2 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Fri, 3 Jul 2020 11:16:21 -0400
Subject: [PATCH 36/51] gnu: Add svt-hevc.

* gnu/packages/video.scm (svt-hevc): New variable.
---
 gnu/packages/video.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index 82a3ffb6ed..abfcf6d73d 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -170,6 +170,34 @@
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg))
 
+(define-public svt-hevc
+  (package
+    (name "svt-hevc")
+    (version "1.4.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/OpenVisualCloud/SVT-HEVC.git")
+         (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1sqh3dciqm2p1b66kngcpxqy5fx3ramxlxy8gfcbdwn2i3rsqhs7"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:tests? #f)) ; Test script is stand-alone
+    (native-inputs
+     `(("yasm" ,yasm)))
+    (synopsis "SVT HEVC encoder")
+    (description "Scalable Video Technology (SVT) is a software-based video
+coding technology that is highly optimized for Intel's Xeon processors.  Using
+the SVT-HEVC encoder, it is possible to spread video encoding processing across
+multiple Intel's Xeon processors to achieve a real advantage of processing
+efficiency.")
+    (home-page "https://01.org/svt")
+    (license (license:non-copyleft "file://LICENSE.md"))))
+
 (define-public mediasdk
   (package
     (name "mediasdk")
-- 
2.26.2


[-- Attachment #1.1.29: 0037-gnu-Add-tinyalsa.patch --]
[-- Type: text/x-patch, Size: 2617 bytes --]

From 0854bf5a69af3af1a4a3784acebcd8e77dad70a0 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Fri, 3 Jul 2020 11:18:19 -0400
Subject: [PATCH 37/51] gnu: Add tinyalsa.

* gnu/packages/audio.scm (tinyalsa): New variable.
---
 gnu/packages/audio.scm | 37 ++++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 9e65a285d6..0d67508c7f 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -127,31 +127,34 @@
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26))
 
-(define-public opensles
+(define-public tinyalsa
   (package
-    (name "opensles")
-    (version "1.1.0")
+    (name "tinyalsa")
+    (version "1.1.1")
     (source
      (origin
        (method git-fetch)
        (uri
         (git-reference
-         (url "https://github.com/KhronosGroup/OpenSL-ES-Registry.git")
-         (commit "ea5104b")))
+         (url "https://github.com/tinyalsa/tinyalsa.git")
+         (commit version)))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0j5bm7h3ahz66f23i9abwc0y10agfkpksnj6y078x2nichq66h4f"))))
-    (build-system copy-build-system)
-    (synopsis "Embedded Audio Acceleration")
-    (description "OpenSLES is a royalty-free, cross-platform,
-hardware-accelerated audio API tuned for embedded systems.  It provides a
-standardized, high-performance, low-latency method to access audio
-functionality for developers of native applications on embedded mobile
-multimedia devices, enabling straightforward cross-platform deployment of
-hardware and software audio capabilities, reducing implementation effort, and
-promoting the market for advanced audio.")
-    (home-page "https://www.khronos.org/opensles/")
-    (license (license:non-copyleft "Refer individual files"))))
+        (base32 "0ajyvml5bnzvhiyyrn42gqwgg23ssxkfh09rvsnywhzxhd0xai4h"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f                      ; No target
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure))
+       #:make-flags
+       (list
+        (string-append "PREFIX=" (assoc-ref %outputs "out")))))
+    (synopsis "ALSA interfacing library")
+    (description "TinyALSA is a small library to interface with ALSA in the
+Linux kernel.")
+    (home-page "https://github.com/tinyalsa/tinyalsa")
+    (license (license:non-copyleft "file:///NOTICE"))))
 
 (define-public libopenmpt
   (package
-- 
2.26.2


[-- Attachment #1.1.30: 0038-gnu-Add-transcode.patch --]
[-- Type: text/x-patch, Size: 68411 bytes --]

From 680003a107d7e64cee7e3a6c4283e5a67a61de98 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Fri, 3 Jul 2020 11:22:08 -0400
Subject: [PATCH 38/51] gnu: Add transcode.

* gnu/packages/video.scm (transcode): New variable.
* gnu/packages/patches/transcode-ffmpeg.patch: New file.
* gnu/local.mk (transcode-ffmpeg.patch): New reference.
---
 gnu/local.mk                                |    1 +
 gnu/packages/patches/transcode-ffmpeg.patch | 1408 +++++++++++++++++++
 gnu/packages/video.scm                      |  101 ++
 3 files changed, 1510 insertions(+)
 create mode 100644 gnu/packages/patches/transcode-ffmpeg.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 9385c2a985..78058e4653 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1545,6 +1545,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/tipp10-fix-compiling.patch		\
   %D%/packages/patches/tipp10-remove-license-code.patch		\
   %D%/packages/patches/tk-find-library.patch			\
+  %D%/packages/patches/transcode-ffmpeg.patch	\
   %D%/packages/patches/transmission-CVE-2018-10756.patch	\
   %D%/packages/patches/ttf2eot-cstddef.patch			\
   %D%/packages/patches/ttfautohint-source-date-epoch.patch	\
diff --git a/gnu/packages/patches/transcode-ffmpeg.patch b/gnu/packages/patches/transcode-ffmpeg.patch
new file mode 100644
index 0000000000..c547cbad2b
--- /dev/null
+++ b/gnu/packages/patches/transcode-ffmpeg.patch
@@ -0,0 +1,1408 @@
+Submitted By: Ken Moffat <ken at linuxfromscratch dot org>
+Date: 2018-05-14
+Initial Package Version: 1.1.7
+Upstream Status: Defunct
+Origin: From gentoo.
+Description: Accumulated fixes to build with ffmpeg-4.0 (but only
+with the limited functionality we had before).
+
+diff -Naur a/encode/encode_lavc.c b/encode/encode_lavc.c
+--- a/encode/encode_lavc.c	2011-11-19 16:50:27.000000000 +0000
++++ b/encode/encode_lavc.c	2018-05-14 01:58:58.346408791 +0100
+@@ -74,6 +74,16 @@
+     int lmin;
+     int lmax;
+     int me_method;
++    int luma_elim_threshold;
++    int chroma_elim_threshold;
++    int quantizer_noise_shaping;
++    int inter_quant_bias;
++    int intra_quant_bias;
++    int scenechange_factor;
++    int rc_strategy;
++    float rc_initial_cplx;
++    float rc_qsquish;
++    float border_masking;
+ 
+     /* same as above for flags */
+     struct {
+@@ -114,6 +124,7 @@
+ 
+     AVFrame ff_venc_frame;
+     AVCodecContext ff_vcontext;
++    AVDictionary * ff_opts;
+ 
+     AVCodec *ff_vcodec;
+ 
+@@ -164,6 +175,7 @@
+     TC_CODEC_ERROR
+ };
+ 
++#if LIBAVCODEC_VERSION_MAJOR < 55
+ static const enum CodecID tc_lavc_internal_codecs[] = {
+     CODEC_ID_MPEG1VIDEO, CODEC_ID_MPEG2VIDEO, CODEC_ID_MPEG4,
+     CODEC_ID_H263I, CODEC_ID_H263P,
+@@ -176,6 +188,20 @@
+     CODEC_ID_MSMPEG4V2, CODEC_ID_MSMPEG4V3,
+     CODEC_ID_NONE
+ };
++#else
++static const enum AVCodecID tc_lavc_internal_codecs[] = {
++    AV_CODEC_ID_MPEG1VIDEO, AV_CODEC_ID_MPEG2VIDEO, AV_CODEC_ID_MPEG4,
++    AV_CODEC_ID_H263I, AV_CODEC_ID_H263P,
++    AV_CODEC_ID_H264,
++    AV_CODEC_ID_WMV1, AV_CODEC_ID_WMV2,
++    AV_CODEC_ID_RV10,
++    AV_CODEC_ID_HUFFYUV, AV_CODEC_ID_FFV1,
++    AV_CODEC_ID_DVVIDEO,
++    AV_CODEC_ID_MJPEG, AV_CODEC_ID_LJPEG,
++    AV_CODEC_ID_MSMPEG4V2, AV_CODEC_ID_MSMPEG4V3,
++    AV_CODEC_ID_NONE
++};
++#endif
+ 
+ static const TCFormatID tc_lavc_formats[] = { TC_FORMAT_ERROR };
+ 
+@@ -214,7 +240,7 @@
+                                      vframe_list_t *vframe)
+ {
+     avpicture_fill((AVPicture *)&pd->ff_venc_frame, vframe->video_buf,
+-                    PIX_FMT_YUV420P,
++                    AV_PIX_FMT_YUV420P,
+                     pd->ff_vcontext.width, pd->ff_vcontext.height);
+ }
+ 
+@@ -228,7 +254,7 @@
+                     IMG_YUV_DEFAULT,
+                     pd->ff_vcontext.width, pd->ff_vcontext.height);
+     avpicture_fill((AVPicture *)&pd->ff_venc_frame, pd->vframe_buf->video_buf,
+-                   PIX_FMT_YUV422P,
++                   AV_PIX_FMT_YUV422P,
+                    pd->ff_vcontext.width, pd->ff_vcontext.height);
+     ac_imgconvert(src, IMG_YUV_DEFAULT,
+                   pd->ff_venc_frame.data, IMG_YUV422P,
+@@ -244,7 +270,7 @@
+                     IMG_YUV422P,
+                     pd->ff_vcontext.width, pd->ff_vcontext.height);
+     avpicture_fill((AVPicture *)&pd->ff_venc_frame, pd->vframe_buf->video_buf,
+-                   PIX_FMT_YUV420P,
++                   AV_PIX_FMT_YUV420P,
+                    pd->ff_vcontext.width, pd->ff_vcontext.height);
+     ac_imgconvert(src, IMG_YUV422P,
+                   pd->ff_venc_frame.data, IMG_YUV420P,
+@@ -266,7 +292,7 @@
+                                    vframe_list_t *vframe)
+ {
+     avpicture_fill((AVPicture *)&pd->ff_venc_frame, pd->vframe_buf->video_buf,
+-                   PIX_FMT_YUV420P,
++                   AV_PIX_FMT_YUV420P,
+                    pd->ff_vcontext.width, pd->ff_vcontext.height);
+     ac_imgconvert(&vframe->video_buf, IMG_RGB_DEFAULT,
+                   pd->ff_venc_frame.data, IMG_YUV420P,
+@@ -596,15 +622,15 @@
+         } else {
+             pd->tc_pix_fmt = TC_CODEC_YUV420P;
+             pd->ff_vcontext.pix_fmt = (TC_VCODEC_ID(pd) == TC_CODEC_MJPEG) 
+-                                       ? PIX_FMT_YUVJ420P
+-                                       : PIX_FMT_YUV420P;
++                                       ? AV_PIX_FMT_YUVJ420P
++                                       : AV_PIX_FMT_YUV420P;
+             pd->pre_encode_video = pre_encode_video_yuv420p;
+         }
+         break;
+       case CODEC_YUV422:
+         pd->tc_pix_fmt = TC_CODEC_YUV422P;
+         pd->ff_vcontext.pix_fmt = (TC_VCODEC_ID(pd) == TC_CODEC_MJPEG) 
+-                                   ? PIX_FMT_YUVJ422P
++                                   ? AV_PIX_FMT_YUVJ422P
+                                    : PIX_FMT_YUV422P;
+         if (TC_VCODEC_ID(pd) == TC_CODEC_HUFFYUV) {
+             pd->pre_encode_video = pre_encode_video_yuv422p_huffyuv;
+@@ -617,8 +643,8 @@
+         pd->ff_vcontext.pix_fmt = (TC_VCODEC_ID(pd) == TC_CODEC_HUFFYUV)
+                                         ? PIX_FMT_YUV422P
+                                         : (TC_VCODEC_ID(pd) == TC_CODEC_MJPEG) 
+-                                           ? PIX_FMT_YUVJ420P
+-                                           : PIX_FMT_YUV420P;
++                                           ? AV_PIX_FMT_YUVJ420P
++                                           : AV_PIX_FMT_YUV420P;
+         pd->pre_encode_video = pre_encode_video_rgb24;
+         break;
+       default:
+@@ -665,7 +691,7 @@
+     switch (vob->divxmultipass) {
+       case 1:
+         CAN_DO_MULTIPASS(multipass_flag);
+-        pd->ff_vcontext.flags |= CODEC_FLAG_PASS1;
++        pd->ff_vcontext.flags |= AV_CODEC_FLAG_PASS1;
+         pd->stats_file = fopen(vob->divxlogfile, "w");
+         if (pd->stats_file == NULL) {
+             tc_log_error(MOD_NAME, "could not create 2pass log file"
+@@ -675,7 +701,7 @@
+         break;
+       case 2:
+         CAN_DO_MULTIPASS(multipass_flag);
+-        pd->ff_vcontext.flags |= CODEC_FLAG_PASS2;
++        pd->ff_vcontext.flags |= AV_CODEC_FLAG_PASS2;
+         pd->stats_file = fopen(vob->divxlogfile, "r");
+         if (pd->stats_file == NULL){
+             tc_log_error(MOD_NAME, "could not open 2pass log file \"%s\""
+@@ -704,7 +730,7 @@
+         break;
+       case 3:
+         /* fixed qscale :p */
+-        pd->ff_vcontext.flags |= CODEC_FLAG_QSCALE;
++        pd->ff_vcontext.flags |= AV_CODEC_FLAG_QSCALE;
+         pd->ff_venc_frame.quality = vob->divxbitrate;
+         break;
+     }
+@@ -937,7 +963,11 @@
+ static void tc_lavc_config_defaults(TCLavcPrivateData *pd)
+ {
+     /* first of all reinitialize lavc data */
++#if LIBAVCODEC_VERSION_MAJOR < 55
+     avcodec_get_context_defaults(&pd->ff_vcontext);
++#else
++    avcodec_get_context_defaults3(&pd->ff_vcontext, NULL);
++#endif
+ 
+     pd->confdata.thread_count = 1;
+ 
+@@ -947,7 +977,7 @@
+     pd->confdata.rc_buffer_size  = 0;
+     pd->confdata.lmin            = 2;
+     pd->confdata.lmax            = 31;
+-    pd->confdata.me_method       = ME_EPZS;
++    pd->confdata.me_method       = 0;
+ 
+     memset(&pd->confdata.flags, 0, sizeof(pd->confdata.flags));
+     pd->confdata.turbo_setup = 0;
+@@ -962,12 +992,12 @@
+     pd->ff_vcontext.me_range                = 0;
+     pd->ff_vcontext.mb_decision             = 0;
+     pd->ff_vcontext.scenechange_threshold   = 0;
+-    pd->ff_vcontext.scenechange_factor      = 1;
++    pd->confdata.scenechange_factor         = 1;
+     pd->ff_vcontext.b_frame_strategy        = 0;
+     pd->ff_vcontext.b_sensitivity           = 40;
+     pd->ff_vcontext.brd_scale               = 0;
+     pd->ff_vcontext.bidir_refine            = 0;
+-    pd->ff_vcontext.rc_strategy             = 2;
++    pd->confdata.rc_strategy                = 2;
+     pd->ff_vcontext.b_quant_factor          = 1.25;
+     pd->ff_vcontext.i_quant_factor          = 0.8;
+     pd->ff_vcontext.b_quant_offset          = 1.25;
+@@ -975,10 +1005,10 @@
+     pd->ff_vcontext.qblur                   = 0.5;
+     pd->ff_vcontext.qcompress               = 0.5;
+     pd->ff_vcontext.mpeg_quant              = 0;
+-    pd->ff_vcontext.rc_initial_cplx         = 0.0;
+-    pd->ff_vcontext.rc_qsquish              = 1.0;
+-    pd->ff_vcontext.luma_elim_threshold     = 0;
+-    pd->ff_vcontext.chroma_elim_threshold   = 0;
++    pd->confdata.rc_initial_cplx            = 0.0;
++    pd->confdata.rc_qsquish              = 1.0;
++    pd->confdata.luma_elim_threshold     = 0;
++    pd->confdata.chroma_elim_threshold   = 0;
+     pd->ff_vcontext.strict_std_compliance   = 0;
+     pd->ff_vcontext.dct_algo                = FF_DCT_AUTO;
+     pd->ff_vcontext.idct_algo               = FF_IDCT_AUTO;
+@@ -987,7 +1017,7 @@
+     pd->ff_vcontext.temporal_cplx_masking   = 0.0;
+     pd->ff_vcontext.spatial_cplx_masking    = 0.0;
+     pd->ff_vcontext.p_masking               = 0.0;
+-    pd->ff_vcontext.border_masking          = 0.0;
++    pd->confdata.border_masking          = 0.0;
+     pd->ff_vcontext.me_pre_cmp              = 0;
+     pd->ff_vcontext.me_cmp                  = 0;
+     pd->ff_vcontext.me_sub_cmp              = 0;
+@@ -999,10 +1029,8 @@
+     pd->ff_vcontext.pre_me                  = 1;
+     pd->ff_vcontext.me_subpel_quality       = 8;
+     pd->ff_vcontext.refs                    = 1;
+-    pd->ff_vcontext.intra_quant_bias        = FF_DEFAULT_QUANT_BIAS;
+-    pd->ff_vcontext.inter_quant_bias        = FF_DEFAULT_QUANT_BIAS;
+     pd->ff_vcontext.noise_reduction         = 0;
+-    pd->ff_vcontext.quantizer_noise_shaping = 0;
++    pd->confdata.quantizer_noise_shaping = 0;
+     pd->ff_vcontext.flags                   = 0;
+ }
+ 
+@@ -1023,27 +1051,22 @@
+  */
+ static void tc_lavc_dispatch_settings(TCLavcPrivateData *pd)
+ {
++    char buf[1024];
+     /* some translation... */
+     pd->ff_vcontext.bit_rate_tolerance = pd->confdata.vrate_tolerance * 1000;
+     pd->ff_vcontext.rc_min_rate = pd->confdata.rc_min_rate * 1000;
+     pd->ff_vcontext.rc_max_rate = pd->confdata.rc_max_rate * 1000;
+     pd->ff_vcontext.rc_buffer_size = pd->confdata.rc_buffer_size * 1024;
+-    pd->ff_vcontext.lmin = (int)(FF_QP2LAMBDA * pd->confdata.lmin + 0.5);
+-    pd->ff_vcontext.lmax = (int)(FF_QP2LAMBDA * pd->confdata.lmax + 0.5);
+-    pd->ff_vcontext.me_method = ME_ZERO + pd->confdata.me_method;
++    snprintf(buf, sizeof(buf), "%i", (int)(FF_QP2LAMBDA * pd->confdata.lmin + 0.5));
++    av_dict_set(&(pd->ff_opts), "lmin", buf, 0);
++    snprintf(buf, sizeof(buf), "%i", (int)(FF_QP2LAMBDA * pd->confdata.lmax + 0.5));
++    av_dict_set(&(pd->ff_opts), "lmax", buf, 0);
+ 
+     pd->ff_vcontext.flags = 0;
+-    SET_FLAG(pd, mv0);
+-    SET_FLAG(pd, cbp);
+     SET_FLAG(pd, qpel);
+-    SET_FLAG(pd, alt);
+-    SET_FLAG(pd, vdpart);
+-    SET_FLAG(pd, naq);
+     SET_FLAG(pd, ilme);
+     SET_FLAG(pd, ildct);
+     SET_FLAG(pd, aic);
+-    SET_FLAG(pd, aiv);
+-    SET_FLAG(pd, umv);
+     SET_FLAG(pd, psnr);
+     SET_FLAG(pd, trell);
+     SET_FLAG(pd, gray);
+@@ -1061,9 +1084,49 @@
+     }
+     if (pd->interlacing.active) {
+         /* enforce interlacing */
+-        pd->ff_vcontext.flags |= CODEC_FLAG_INTERLACED_DCT;
+-        pd->ff_vcontext.flags |= CODEC_FLAG_INTERLACED_ME;
++        pd->ff_vcontext.flags |= AV_CODEC_FLAG_INTERLACED_DCT;
++        pd->ff_vcontext.flags |= AV_CODEC_FLAG_INTERLACED_ME;
++    }
++    if (pd->confdata.flags.alt) {
++        av_dict_set(&(pd->ff_opts), "alternate_scan", "1", 0);
+     }
++    if (pd->confdata.flags.vdpart) {
++        av_dict_set(&(pd->ff_opts), "data_partitioning", "1", 0);
++    }
++    if (pd->confdata.flags.umv) {
++        av_dict_set(&(pd->ff_opts), "umv", "1", 0);
++    }
++    if (pd->confdata.flags.aiv) {
++        av_dict_set(&(pd->ff_opts), "aiv", "1", 0);
++    }
++    if (pd->confdata.flags.cbp) {
++    	av_dict_set(&(pd->ff_opts), "mpv_flags", "+cbp_rd", 0);
++    }
++    if (pd->confdata.flags.mv0) {
++    	av_dict_set(&(pd->ff_opts), "mpv_flags", "+mv0", 0);
++    }
++    if (pd->confdata.flags.naq) {
++    	av_dict_set(&(pd->ff_opts), "mpv_flags", "+naq", 0);
++    }
++
++#define set_dict_opt(val, opt) \
++    snprintf(buf, sizeof(buf), "%i", pd->confdata.val);\
++    av_dict_set(&(pd->ff_opts), opt, buf, 0)
++#define set_dict_float_opt(val, opt) \
++    snprintf(buf, sizeof(buf), "%f", pd->confdata.val);\
++    av_dict_set(&(pd->ff_opts), opt, buf, 0)
++
++    set_dict_opt(luma_elim_threshold, "luma_elim_threshold");
++    set_dict_opt(chroma_elim_threshold, "chroma_elim_threshold");
++    set_dict_opt(quantizer_noise_shaping, "quantizer_noise_shaping");
++    set_dict_opt(inter_quant_bias, "pbias");
++    set_dict_opt(intra_quant_bias, "ibias");
++    set_dict_opt(me_method, "me_method");
++    set_dict_opt(scenechange_factor, "sc_factor");
++    set_dict_opt(rc_strategy, "rc_strategy");
++    set_dict_float_opt(rc_initial_cplx, "rc_init_cplx");
++    set_dict_float_opt(rc_qsquish, "qsquish");
++    set_dict_float_opt(border_masking, "border_mask");
+ }
+ 
+ #undef SET_FLAG
+@@ -1121,12 +1184,12 @@
+         { "lmin", PAUX(lmin), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.01, 255.0 },
+         { "lmax", PAUX(lmax), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.01, 255.0 },
+         { "vqdiff", PCTX(max_qdiff), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 31 },
+-        { "vmax_b_frames", PCTX(max_b_frames), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, FF_MAX_B_FRAMES },
++        { "vmax_b_frames", PCTX(max_b_frames), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, INT_MAX },
+         { "vme", PAUX(me_method), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 16, },
+         { "me_range", PCTX(me_range), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 16000 },
+         { "mbd", PCTX(mb_decision), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 3 },
+         { "sc_threshold", PCTX(scenechange_threshold), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -1000000, 1000000 },
+-        { "sc_factor", PCTX(scenechange_factor), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 16 },
++        { "sc_factor", PAUX(scenechange_factor), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 16 },
+         { "vb_strategy", PCTX(b_frame_strategy), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10 },
+         { "b_sensitivity", PCTX(b_sensitivity), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 100 },
+         { "brd_scale", PCTX(brd_scale), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10 },
+@@ -1137,7 +1200,7 @@
+         { "vrc_maxrate", PAUX(rc_max_rate), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 24000000 },
+         { "vrc_minrate", PAUX(rc_min_rate), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 24000000 },
+         { "vrc_buf_size", PAUX(rc_buffer_size), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 4, 24000000 },
+-        { "vrc_strategy", PCTX(rc_strategy), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2 },
++        { "vrc_strategy", PAUX(rc_strategy), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2 },
+         { "vb_qfactor", PCTX(b_quant_factor), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, -31.0, 31.0 },
+         { "vi_qfactor", PCTX(i_quant_factor), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, -31.0, 31.0 },
+         { "vb_qoffset", PCTX(b_quant_offset), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 31.0 },
+@@ -1147,11 +1210,11 @@
+         { "mpeg_quant", PCTX(mpeg_quant), TCCONF_TYPE_FLAG, 0, 0, 1 },
+         //  { "vrc_eq",     }, // not yet supported
+         { "vrc_override", rc_override_buf, TCCONF_TYPE_STRING, 0, 0, 0 },
+-        { "vrc_init_cplx", PCTX(rc_initial_cplx), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 9999999.0 },
++        { "vrc_init_cplx", PAUX(rc_initial_cplx), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 9999999.0 },
+         //  { "vrc_init_occupancy",   }, // not yet supported
+-        { "vqsquish", PCTX(rc_qsquish), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 99.0 },
+-        { "vlelim", PCTX(luma_elim_threshold), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99 },
+-        { "vcelim", PCTX(chroma_elim_threshold), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99 },
++        { "vqsquish", PAUX(rc_qsquish), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 99.0 },
++        { "vlelim", PAUX(luma_elim_threshold), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99 },
++        { "vcelim", PAUX(chroma_elim_threshold), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99 },
+         { "vstrict", PCTX(strict_std_compliance), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99 },
+         { "vpsize", PCTX(rtp_payload_size), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 100000000 },
+         { "dct", PCTX(dct_algo), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10 },
+@@ -1161,7 +1224,7 @@
+         { "tcplx_mask", PCTX(temporal_cplx_masking), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0 },
+         { "scplx_mask", PCTX(spatial_cplx_masking), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0 },
+         { "p_mask", PCTX(p_masking), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0 },
+-        { "border_mask", PCTX(border_masking), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0 },
++        { "border_mask", PAUX(border_masking), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0 },
+         { "pred", PCTX(prediction_method), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 4 },
+         { "precmp", PCTX(me_pre_cmp), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000 },
+         { "cmp", PCTX(me_cmp), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000 },
+@@ -1174,37 +1237,37 @@
+         { "pre_me", PCTX(pre_me), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000},
+         { "subq", PCTX(me_subpel_quality), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 8 },
+         { "refs", PCTX(refs), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 8 },
+-        { "ibias", PCTX(intra_quant_bias), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512 },
+-        { "pbias", PCTX(inter_quant_bias), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512 },
++        { "ibias", PAUX(intra_quant_bias), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512 },
++        { "pbias", PAUX(inter_quant_bias), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512 },
+         { "nr", PCTX(noise_reduction), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 1000000},
+-        { "qns", PCTX(quantizer_noise_shaping), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 3 },
++        { "qns", PAUX(quantizer_noise_shaping), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 3 },
+         { "inter_matrix_file", inter_matrix_file, TCCONF_TYPE_STRING, 0, 0, 0 },
+         { "intra_matrix_file", intra_matrix_file, TCCONF_TYPE_STRING, 0, 0, 0 },
+     
+-        { "mv0", PAUX(flags.mv0), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_MV0 },
+-        { "cbp", PAUX(flags.cbp), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_CBP_RD },
+-        { "qpel", PAUX(flags.qpel), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_QPEL },
+-        { "alt", PAUX(flags.alt), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_ALT_SCAN },
+-        { "ilme", PAUX(flags.ilme), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_INTERLACED_ME },
+-        { "ildct", PAUX(flags.ildct), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_INTERLACED_DCT },
+-        { "naq", PAUX(flags.naq), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_NORMALIZE_AQP },
+-        { "vdpart", PAUX(flags.vdpart), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART },
++        { "mv0", PAUX(flags.mv0), TCCONF_TYPE_FLAG, 0, 0, 1 },
++        { "cbp", PAUX(flags.cbp), TCCONF_TYPE_FLAG, 0, 0, 1 },
++        { "qpel", PAUX(flags.qpel), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_QPEL },
++        { "alt", PAUX(flags.alt), TCCONF_TYPE_FLAG, 0, 0, 1 },
++        { "ilme", PAUX(flags.ilme), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_INTERLACED_ME },
++        { "ildct", PAUX(flags.ildct), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_INTERLACED_DCT },
++        { "naq", PAUX(flags.naq), TCCONF_TYPE_FLAG, 0, 0, 1 },
++        { "vdpart", PAUX(flags.vdpart), TCCONF_TYPE_FLAG, 0, 0, 1 },
+ #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
+         { "aic", PAUX(flags.aic), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_AIC },
+ #else        
+-        { "aic", PAUX(flags.aic), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_AC_PRED },
++        { "aic", PAUX(flags.aic), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_AC_PRED },
+ #endif
+-        { "aiv", PAUX(flags.aiv), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_AIV },
+-        { "umv", PAUX(flags.umv), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_UMV },
+-        { "psnr", PAUX(flags.psnr), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PSNR },
++        { "aiv", PAUX(flags.aiv), TCCONF_TYPE_FLAG, 0, 0, 1 },
++        { "umv", PAUX(flags.umv), TCCONF_TYPE_FLAG, 0, 0, 1 },
++        { "psnr", PAUX(flags.psnr), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_PSNR },
+ #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
+         { "trell", PAUX(flags.trell), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_TRELLIS_QUANT },
+ #else
+         { "trell", PCTX(trellis), TCCONF_TYPE_FLAG, 0, 0, 1 },
+ #endif
+-        { "gray", PAUX(flags.gray), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_GRAY },
+-        { "v4mv", PAUX(flags.v4mv), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_4MV },
+-        { "closedgop", PAUX(flags.closedgop), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_CLOSED_GOP },
++        { "gray", PAUX(flags.gray), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_GRAY },
++        { "v4mv", PAUX(flags.v4mv), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_4MV },
++        { "closedgop", PAUX(flags.closedgop), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_CLOSED_GOP },
+     
+         //  { "turbo", PAUX(turbo_setup), TCCONF_TYPE_FLAG, 0, 0, 1 }, // not yet  supported
+         /* End of the config file */
+@@ -1345,6 +1408,8 @@
+ 
+     pd = self->userdata;
+ 
++    pd->ff_opts = NULL;
++
+     pd->flush_flag = vob->encoder_flush;
+     
+     /* FIXME: move into core? */
+@@ -1387,7 +1452,7 @@
+                     pd->confdata.thread_count,
+                     (pd->confdata.thread_count > 1) ?"s" :"");
+     }
+-    avcodec_thread_init(&pd->ff_vcontext, pd->confdata.thread_count);
++    pd->ff_vcontext.thread_count = pd->confdata.thread_count;
+ 
+     pd->ff_vcodec = avcodec_find_encoder(FF_VCODEC_ID(pd));
+     if (pd->ff_vcodec == NULL) {
+@@ -1397,11 +1462,11 @@
+     }
+ 
+     TC_LOCK_LIBAVCODEC;
+-    ret = avcodec_open(&pd->ff_vcontext, pd->ff_vcodec);
++    ret = avcodec_open2(&pd->ff_vcontext, pd->ff_vcodec, &(pd->ff_opts));
+     TC_UNLOCK_LIBAVCODEC;
+ 
+     if (ret < 0) {
+-        tc_log_error(MOD_NAME, "avcodec_open() failed");
++        tc_log_error(MOD_NAME, "avcodec_open2() failed");
+         goto failed;
+     }
+     /* finally, pass up the extradata, if any */
+diff -Naur a/export/aud_aux.c b/export/aud_aux.c
+--- a/export/aud_aux.c	2011-11-19 16:50:27.000000000 +0000
++++ b/export/aud_aux.c	2018-05-14 01:58:58.346408791 +0100
+@@ -326,10 +326,18 @@
+ 
+     switch (o_codec) {
+       case   0x50:
++#if LIBAVCODEC_VERSION_MAJOR < 55
+         codeid = CODEC_ID_MP2;
++#else
++        codeid = AV_CODEC_ID_MP2;
++#endif
+         break;
+       case 0x2000:
++#if LIBAVCODEC_VERSION_MAJOR < 55
+         codeid = CODEC_ID_AC3;
++#else
++        codeid = AV_CODEC_ID_AC3;
++#endif
+         break;
+       default:
+         tc_warn("cannot init ffmpeg with %x", o_codec);
+@@ -346,7 +354,7 @@
+ 
+     //-- set parameters (bitrate, channels and sample-rate) --
+     //--------------------------------------------------------
+-    avcodec_get_context_defaults(&mpa_ctx);
++    avcodec_get_context_defaults3(&mpa_ctx, mpa_codec);
+ #if LIBAVCODEC_VERSION_MAJOR < 53
+     mpa_ctx.codec_type  = CODEC_TYPE_AUDIO;
+ #else
+@@ -359,11 +367,16 @@
+     //-- open codec --
+     //----------------
+     TC_LOCK_LIBAVCODEC;
+-    ret = avcodec_open(&mpa_ctx, mpa_codec);
++    ret = avcodec_open2(&mpa_ctx, mpa_codec, NULL);
+     TC_UNLOCK_LIBAVCODEC;
+     if (ret < 0) {
+         tc_warn("tc_audio_init_ffmpeg: could not open %s codec !",
+-                (codeid == CODEC_ID_MP2) ?"mpa" :"ac3");
++#if LIBAVCODEC_VERSION_MAJOR < 55
++                (codeid == CODEC_ID_MP2)
++#else
++                (codeid == AV_CODEC_ID_MP2)
++#endif
++                ?"mpa" :"ac3");
+         return(TC_EXPORT_ERROR);
+     }
+ 
+diff -Naur a/export/export_ffmpeg.c b/export/export_ffmpeg.c
+--- a/export/export_ffmpeg.c	2011-11-19 16:50:27.000000000 +0000
++++ b/export/export_ffmpeg.c	2018-05-14 01:58:58.346408791 +0100
+@@ -122,6 +122,7 @@
+ static AVFrame             *lavc_convert_frame = NULL;
+ 
+ static AVCodec             *lavc_venc_codec = NULL;
++static AVDictionary        *lavc_venc_opts = NULL;
+ static AVFrame             *lavc_venc_frame = NULL;
+ static AVCodecContext      *lavc_venc_context;
+ static avi_t               *avifile = NULL;
+@@ -180,7 +181,7 @@
+ 
+ 
+ /* START: COPIED FROM ffmpeg-0.5_p22846(ffmpeg.c, cmdutils.c) */
+-#include <libavcodec/opt.h>
++#include <libavutil/opt.h>
+ #include <libavutil/avstring.h>
+ #include <libswscale/swscale.h>
+ 
+@@ -321,7 +322,7 @@
+     }
+ 
+     if(!f){
+-        fprintf(stderr, "File for preset '%s' not found\n", arg);
++        tc_log_error(MOD_NAME, "File for preset '%s' not found", arg);
+         av_exit(1);
+     }
+ 
+@@ -470,7 +471,6 @@
+     }
+ 
+     TC_LOCK_LIBAVCODEC;
+-    avcodec_init();
+     avcodec_register_all();
+     TC_UNLOCK_LIBAVCODEC;
+ 
+@@ -486,11 +486,11 @@
+ 		            codec->name, codec->fourCC, codec->comments);
+     }
+ 
+-    lavc_venc_context = avcodec_alloc_context();
++    lavc_venc_context = avcodec_alloc_context3(lavc_venc_codec);
+     lavc_venc_frame   = avcodec_alloc_frame();
+ 
+     lavc_convert_frame= avcodec_alloc_frame();
+-    size = avpicture_get_size(PIX_FMT_RGB24, vob->ex_v_width, vob->ex_v_height);
++    size = avpicture_get_size(AV_PIX_FMT_RGB24, vob->ex_v_width, vob->ex_v_height);
+     enc_buffer = tc_malloc(size);
+ 
+     if (lavc_venc_context == NULL || !enc_buffer || !lavc_convert_frame) {
+@@ -634,7 +634,7 @@
+         lavc_param_rc_max_rate = 2516;
+         lavc_param_rc_buffer_size = 224 * 8;
+         lavc_param_rc_buffer_aggressivity = 99;
+-        lavc_param_scan_offset = CODEC_FLAG_SVCD_SCAN_OFFSET;
++        lavc_param_scan_offset = 1;
+ 
+         break;
+ 
+@@ -674,7 +674,7 @@
+ 
+         lavc_param_rc_buffer_size = 224 * 8;
+         lavc_param_rc_buffer_aggressivity = 99;
+-        lavc_param_scan_offset = CODEC_FLAG_SVCD_SCAN_OFFSET;
++        lavc_param_scan_offset = 1;
+ 
+         break;
+ 
+@@ -828,18 +828,35 @@
+ 
+     lavc_venc_context->bit_rate           = vob->divxbitrate * 1000;
+     lavc_venc_context->bit_rate_tolerance = lavc_param_vrate_tolerance * 1000;
+-    lavc_venc_context->lmin= (int)(FF_QP2LAMBDA * lavc_param_lmin + 0.5);
+-    lavc_venc_context->lmax= (int)(FF_QP2LAMBDA * lavc_param_lmax + 0.5);
+     lavc_venc_context->max_qdiff          = lavc_param_vqdiff;
+     lavc_venc_context->qcompress          = lavc_param_vqcompress;
+     lavc_venc_context->qblur              = lavc_param_vqblur;
+     lavc_venc_context->max_b_frames       = lavc_param_vmax_b_frames;
+     lavc_venc_context->b_quant_factor     = lavc_param_vb_qfactor;
+-    lavc_venc_context->rc_strategy        = lavc_param_vrc_strategy;
+     lavc_venc_context->b_frame_strategy   = lavc_param_vb_strategy;
+     lavc_venc_context->b_quant_offset     = lavc_param_vb_qoffset;
+-    lavc_venc_context->luma_elim_threshold= lavc_param_luma_elim_threshold;
+-    lavc_venc_context->chroma_elim_threshold= lavc_param_chroma_elim_threshold;
++
++    char buf[1024];
++#define set_dict_opt(val, opt) \
++	snprintf(buf, sizeof(buf), "%i", val); \
++	av_dict_set(&lavc_venc_opts, opt, buf, 0)
++#define set_dict_float_opt(val, opt) \
++	snprintf(buf, sizeof(buf), "%f", val); \
++	av_dict_set(&lavc_venc_opts, opt, buf, 0)
++    set_dict_opt(lavc_param_luma_elim_threshold, "luma_elim_threshold");
++    set_dict_opt(lavc_param_chroma_elim_threshold, "chroma_elim_threshold");
++    set_dict_opt((int)(FF_QP2LAMBDA * lavc_param_lmin + 0.5), "lmin");
++    set_dict_opt((int)(FF_QP2LAMBDA * lavc_param_lmax + 0.5), "lmax");
++    set_dict_opt(lavc_param_vrc_strategy, "rc_strategy");
++    set_dict_float_opt(lavc_param_rc_qsquish, "qsquish");
++    set_dict_float_opt(lavc_param_rc_qmod_amp, "rc_qmod_amp");
++    set_dict_opt(lavc_param_rc_qmod_freq, "rc_qmod_freq");
++    set_dict_opt(lavc_param_rc_eq, "rc_eq");
++    set_dict_opt(lavc_param_vme, "me_method");
++    set_dict_opt(lavc_param_ibias, "ibias");
++    set_dict_opt(lavc_param_pbias, "pbias");
++    set_dict_float_opt(lavc_param_rc_buffer_aggressivity, "rc_buf_aggressivity");
++    set_dict_float_opt(lavc_param_rc_initial_cplx, "rc_init_cplx");
+     lavc_venc_context->rtp_payload_size   = lavc_param_packet_size;
+ #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)   
+     if (lavc_param_packet_size)
+@@ -848,15 +865,9 @@
+     lavc_venc_context->strict_std_compliance= lavc_param_strict;
+     lavc_venc_context->i_quant_factor     = lavc_param_vi_qfactor;
+     lavc_venc_context->i_quant_offset     = lavc_param_vi_qoffset;
+-    lavc_venc_context->rc_qsquish         = lavc_param_rc_qsquish;
+-    lavc_venc_context->rc_qmod_amp        = lavc_param_rc_qmod_amp;
+-    lavc_venc_context->rc_qmod_freq       = lavc_param_rc_qmod_freq;
+-    lavc_venc_context->rc_eq              = lavc_param_rc_eq;
+     lavc_venc_context->rc_max_rate        = lavc_param_rc_max_rate * 1000;
+     lavc_venc_context->rc_min_rate        = lavc_param_rc_min_rate * 1000;
+     lavc_venc_context->rc_buffer_size     = lavc_param_rc_buffer_size * 1024;
+-    lavc_venc_context->rc_buffer_aggressivity= lavc_param_rc_buffer_aggressivity;
+-    lavc_venc_context->rc_initial_cplx    = lavc_param_rc_initial_cplx;
+     lavc_venc_context->debug              = lavc_param_debug;
+     lavc_venc_context->last_predictor_count= lavc_param_last_pred;
+     lavc_venc_context->pre_me             = lavc_param_pre_me;
+@@ -864,13 +875,11 @@
+     lavc_venc_context->pre_dia_size       = lavc_param_pre_dia_size;
+     lavc_venc_context->me_subpel_quality  = lavc_param_me_subpel_quality;
+     lavc_venc_context->me_range           = lavc_param_me_range;
+-    lavc_venc_context->intra_quant_bias   = lavc_param_ibias;
+-    lavc_venc_context->inter_quant_bias   = lavc_param_pbias;
+     lavc_venc_context->coder_type         = lavc_param_coder;
+     lavc_venc_context->context_model      = lavc_param_context;
+     lavc_venc_context->scenechange_threshold= lavc_param_sc_threshold;
+     lavc_venc_context->noise_reduction    = lavc_param_noise_reduction;
+-    lavc_venc_context->inter_threshold    = lavc_param_inter_threshold;
++    set_dict_opt(lavc_param_inter_threshold, "inter_threshold");
+     lavc_venc_context->intra_dc_precision = lavc_param_intra_dc_precision;
+     lavc_venc_context->skip_top           = lavc_param_skip_top;
+     lavc_venc_context->skip_bottom        = lavc_param_skip_bottom;
+@@ -887,7 +896,7 @@
+ 		    lavc_venc_context->thread_count);
+     }
+ 
+-    avcodec_thread_init(lavc_venc_context, lavc_param_threads);
++    lavc_venc_context->thread_count = lavc_param_threads;
+ 
+     if (lavc_param_intra_matrix) {
+         char *tmp;
+@@ -1065,15 +1074,14 @@
+     lavc_venc_context->flags |= lavc_param_closedgop;
+     lavc_venc_context->flags |= lavc_param_trunc;
+     lavc_venc_context->flags |= lavc_param_aic;
+-    lavc_venc_context->flags |= lavc_param_umv;
+     lavc_venc_context->flags |= lavc_param_v4mv;
+-    lavc_venc_context->flags |= lavc_param_data_partitioning;
+-    lavc_venc_context->flags |= lavc_param_cbp;
++    if(lavc_param_cbp)
++    	av_dict_set(&lavc_venc_opts, "mpv_flags", "+cbp_rd", 0);
+     lavc_venc_context->flags |= lavc_param_mv0;
+-    lavc_venc_context->flags |= lavc_param_qp_rd;
+-    lavc_venc_context->flags |= lavc_param_scan_offset;
+-    lavc_venc_context->flags |= lavc_param_ss;
+-    lavc_venc_context->flags |= lavc_param_alt;
++    if(lavc_param_qp_rd)
++    	av_dict_set(&lavc_venc_opts, "mpv_flags", "+qp_rd", 0);
++    if (lavc_param_normalize_aqp)
++    	av_dict_set(&lavc_venc_opts, "mpv_flags", "+naq", 0);
+     lavc_venc_context->flags |= lavc_param_ilme;
+ #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)   
+     lavc_venc_context->flags |= lavc_param_trell;
+@@ -1082,9 +1090,7 @@
+ #endif
+ 
+     if (lavc_param_gray)
+-        lavc_venc_context->flags |= CODEC_FLAG_GRAY;
+-    if (lavc_param_normalize_aqp)
+-        lavc_venc_context->flags |= CODEC_FLAG_NORMALIZE_AQP;
++        lavc_venc_context->flags |= AV_CODEC_FLAG_GRAY;
+ 
+     switch(vob->encode_fields) {
+     case TC_ENCODE_FIELDS_TOP_FIRST:
+@@ -1102,9 +1108,9 @@
+     }
+ 
+     lavc_venc_context->flags |= interlacing_active ?
+-        CODEC_FLAG_INTERLACED_DCT : 0;
++        AV_CODEC_FLAG_INTERLACED_DCT : 0;
+     lavc_venc_context->flags |= interlacing_active ?
+-        CODEC_FLAG_INTERLACED_ME : 0;
++        AV_CODEC_FLAG_INTERLACED_ME : 0;
+ 
+     lavc_venc_context->flags |= lavc_param_psnr;
+     do_psnr = lavc_param_psnr;
+@@ -1112,7 +1118,7 @@
+     lavc_venc_context->prediction_method = lavc_param_prediction_method;
+ 
+     if(is_huffyuv)
+-        lavc_venc_context->pix_fmt = PIX_FMT_YUV422P;
++        lavc_venc_context->pix_fmt = AV_PIX_FMT_YUV422P;
+     else
+     {
+         switch(pix_fmt)
+@@ -1121,18 +1127,18 @@
+             case CODEC_RGB:
+             {
+                 if(is_mjpeg)
+-                    lavc_venc_context->pix_fmt = PIX_FMT_YUVJ420P;
++                    lavc_venc_context->pix_fmt = AV_PIX_FMT_YUVJ420P;
+                 else
+-                    lavc_venc_context->pix_fmt = PIX_FMT_YUV420P;
++                    lavc_venc_context->pix_fmt = AV_PIX_FMT_YUV420P;
+                 break;
+             }
+ 
+             case CODEC_YUV422:
+             {
+                 if(is_mjpeg)
+-                    lavc_venc_context->pix_fmt = PIX_FMT_YUVJ422P;
++                    lavc_venc_context->pix_fmt = AV_PIX_FMT_YUVJ422P;
+                 else
+-                    lavc_venc_context->pix_fmt = PIX_FMT_YUV422P;
++                    lavc_venc_context->pix_fmt = AV_PIX_FMT_YUV422P;
+                 break;
+             }
+ 
+@@ -1151,7 +1157,7 @@
+                   "encoding.");
+           return TC_EXPORT_ERROR;
+         }
+-        lavc_venc_context->flags |= CODEC_FLAG_PASS1;
++        lavc_venc_context->flags |= AV_CODEC_FLAG_PASS1;
+         stats_file = fopen(vob->divxlogfile, "w");
+         if (stats_file == NULL){
+           tc_log_warn(MOD_NAME, "Could not create 2pass log file \"%s\".",
+@@ -1165,7 +1171,7 @@
+                   "encoding.");
+           return TC_EXPORT_ERROR;
+         }
+-        lavc_venc_context->flags |= CODEC_FLAG_PASS2;
++        lavc_venc_context->flags |= AV_CODEC_FLAG_PASS2;
+         stats_file= fopen(vob->divxlogfile, "r");
+         if (stats_file==NULL){
+           tc_log_warn(MOD_NAME, "Could not open 2pass log file \"%s\" for "
+@@ -1196,18 +1202,16 @@
+         break;
+       case 3:
+         /* fixed qscale :p */
+-        lavc_venc_context->flags   |= CODEC_FLAG_QSCALE;
++        lavc_venc_context->flags   |= AV_CODEC_FLAG_QSCALE;
+         lavc_venc_frame->quality  = vob->divxbitrate;
+         break;
+     }
+ 
+-    lavc_venc_context->me_method = ME_ZERO + lavc_param_vme;
+-
+ 
+ 	/* FIXME: transcode itself contains "broken ffmpeg default settings", thus we need to override them! */
+-	if (lavc_param_video_preset) {
++	if (lavc_param_video_preset && strcmp(lavc_param_video_preset, "none")) {
+ 		avcodec_opts[AVMEDIA_TYPE_VIDEO] = lavc_venc_context;
+-		video_codec_name = ffmpeg_codec_name(codec->name);
++		video_codec_name = av_strdup(ffmpeg_codec_name(codec->name));
+ 
+ 		const char *preset_start = lavc_param_video_preset;
+ 		while (preset_start) {
+@@ -1225,6 +1229,8 @@
+ 			if (opt_preset("vpre", preset_name) != 0) {
+ 				tc_log_warn(MOD_NAME, "Parsing ffmpeg preset '%s' failed", preset_name);
+ 			}
++      av_free(video_codec_name);
++      video_codec_name = NULL;
+ 			if (verbose) {
+ 				int i;
+ 				tc_log_info(MOD_NAME, "After parsing preset '%s', %i options are overridden:", preset_name, opt_name_count);
+@@ -1241,20 +1247,39 @@
+ 		}
+ 	}
+ 
++    if (lavc_param_scan_offset) {
++      av_dict_set(&lavc_venc_opts, "scan_offset", "1", 0);
++    }
++
++    if (lavc_param_ss) {
++      av_dict_set(&lavc_venc_opts, "structured_slices", "1", 0);
++    }
++
++    if (lavc_param_alt) {
++      av_dict_set(&lavc_venc_opts, "alternate_scan", "1", 0);
++    }
++
++    if (lavc_param_umv) {
++      av_dict_set(&lavc_venc_opts, "umv", "1", 0);
++    }
++
++    if (lavc_param_data_partitioning) {
++      av_dict_set(&lavc_venc_opts, "vdpart", "1", 0);
++    }
+ 
+     //-- open codec --
+     //----------------
+     TC_LOCK_LIBAVCODEC;
+-    ret = avcodec_open(lavc_venc_context, lavc_venc_codec);
++    ret = avcodec_open2(lavc_venc_context, lavc_venc_codec, &lavc_venc_opts);
+     TC_UNLOCK_LIBAVCODEC;
+     if (ret < 0) {
+       tc_log_warn(MOD_NAME, "could not open FFMPEG codec");
+       return TC_EXPORT_ERROR;
+     }
+ 
+-    if (lavc_venc_context->codec->encode == NULL) {
++    if (av_codec_is_encoder(lavc_venc_context->codec) == 0) {
+       tc_log_warn(MOD_NAME, "could not open FFMPEG codec "
+-              "(lavc_venc_context->codec->encode == NULL)");
++              "(av_codec_is_encoder(lavc_venc_context->codec) == 0)");
+       return TC_EXPORT_ERROR;
+     }
+ 
+@@ -1598,7 +1623,7 @@
+ 	        	YUV_INIT_PLANES(src, param->buffer, IMG_YUV_DEFAULT,
+ 			                	lavc_venc_context->width, lavc_venc_context->height);
+                 avpicture_fill((AVPicture *)lavc_venc_frame, img_buffer,
+-                               PIX_FMT_YUV422P, lavc_venc_context->width,
++                               AV_PIX_FMT_YUV422P, lavc_venc_context->width,
+                                lavc_venc_context->height);
+         		/* FIXME: can't use tcv_convert (see decode_lavc.c) */
+                 ac_imgconvert(src, IMG_YUV_DEFAULT,
+@@ -1628,7 +1653,7 @@
+ 		                		lavc_venc_context->width,
+                                 lavc_venc_context->height);
+                 avpicture_fill((AVPicture *)lavc_venc_frame, img_buffer,
+-                               PIX_FMT_YUV420P, lavc_venc_context->width,
++                               AV_PIX_FMT_YUV420P, lavc_venc_context->width,
+                                lavc_venc_context->height);
+                 ac_imgconvert(src, IMG_YUV422P,
+                               lavc_venc_frame->data, IMG_YUV420P,
+@@ -1639,7 +1664,7 @@
+ 
+         case CODEC_RGB:
+             avpicture_fill((AVPicture *)lavc_venc_frame, img_buffer,
+-                           PIX_FMT_YUV420P, lavc_venc_context->width,
++                           AV_PIX_FMT_YUV420P, lavc_venc_context->width,
+                            lavc_venc_context->height);
+     	    ac_imgconvert(&param->buffer, IMG_RGB_DEFAULT,
+                               lavc_venc_frame->data, IMG_YUV420P,
+diff -Naur a/export/ffmpeg_cfg.c b/export/ffmpeg_cfg.c
+--- a/export/ffmpeg_cfg.c	2011-11-19 16:50:27.000000000 +0000
++++ b/export/ffmpeg_cfg.c	2018-05-14 01:58:58.346408791 +0100
+@@ -95,8 +95,8 @@
+ int lavc_param_pre_me= 1;
+ int lavc_param_me_subpel_quality= 8;
+ int lavc_param_me_range=0;
+-int lavc_param_ibias=FF_DEFAULT_QUANT_BIAS;
+-int lavc_param_pbias=FF_DEFAULT_QUANT_BIAS;
++int lavc_param_ibias=0;
++int lavc_param_pbias=0;
+ int lavc_param_coder=0;
+ int lavc_param_context=0;
+ char *lavc_param_intra_matrix = NULL;
+@@ -126,7 +126,7 @@
+ //int lavc_param_atag = 0;
+ //int lavc_param_abitrate = 224;
+ 
+-char *lavc_param_video_preset = "medium";
++char *lavc_param_video_preset = "none";
+ char *lavc_param_ffmpeg_datadir = "/usr/share/ffmpeg";
+ 
+ TCConfigEntry lavcopts_conf[]={
+@@ -138,7 +138,7 @@
+     {"vratetol", &lavc_param_vrate_tolerance, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 4, 24000000},
+     {"vhq", &lavc_param_mb_decision, TCCONF_TYPE_FLAG, 0, 0, 1},
+     {"mbd", &lavc_param_mb_decision, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 9},
+-    {"v4mv", &lavc_param_v4mv, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_4MV},
++    {"v4mv", &lavc_param_v4mv, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_4MV},
+     {"vme", &lavc_param_vme, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 5},
+ //    {"vqscale", &lavc_param_vqscale, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 31},
+ //    {"vqmin", &lavc_param_vqmin, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 31},
+@@ -151,7 +151,7 @@
+     {"vqcomp", &lavc_param_vqcompress, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0},
+     {"vqblur", &lavc_param_vqblur, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0},
+     {"vb_qfactor", &lavc_param_vb_qfactor, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, -31.0, 31.0},
+-    {"vmax_b_frames", &lavc_param_vmax_b_frames, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, FF_MAX_B_FRAMES},
++    {"vmax_b_frames", &lavc_param_vmax_b_frames, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, INT_MAX},
+ //    {"vpass", &lavc_param_vpass, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2},
+     {"vrc_strategy", &lavc_param_vrc_strategy, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2},
+     {"vb_strategy", &lavc_param_vb_strategy, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10},
+@@ -160,9 +160,9 @@
+     {"vcelim", &lavc_param_chroma_elim_threshold, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99},
+     {"vpsize", &lavc_param_packet_size, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 100000000},
+     {"vstrict", &lavc_param_strict, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99},
+-    {"vdpart", &lavc_param_data_partitioning, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART},
++    {"vdpart", &lavc_param_data_partitioning, TCCONF_TYPE_FLAG, 0, 0, 1},
+ //    {"keyint", &lavc_param_keyint, TCCONF_TYPE_INT, 0, 0, 0},
+-    {"gray", &lavc_param_gray, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART},
++    {"gray", &lavc_param_gray, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_GRAY},
+     {"mpeg_quant", &lavc_param_mpeg_quant, TCCONF_TYPE_FLAG, 0, 0, 1},
+     {"vi_qfactor", &lavc_param_vi_qfactor, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, -31.0, 31.0},
+     {"vi_qoffset", &lavc_param_vi_qoffset, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 31.0},
+@@ -188,7 +188,7 @@
+     {"pred", &lavc_param_prediction_method, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 20},
+     {"format", &lavc_param_format, TCCONF_TYPE_STRING, 0, 0, 0},
+     {"debug", &lavc_param_debug, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 100000000},
+-    {"psnr", &lavc_param_psnr, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PSNR},
++    {"psnr", &lavc_param_psnr, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_PSNR},
+     {"precmp", &lavc_param_me_pre_cmp, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000},
+     {"cmp", &lavc_param_me_cmp, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000},
+     {"subcmp", &lavc_param_me_sub_cmp, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000},
+@@ -196,9 +196,9 @@
+     {"ildctcmp", &lavc_param_ildct_cmp, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000},
+     {"predia", &lavc_param_pre_dia_size, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -2000, 2000},
+     {"dia", &lavc_param_dia_size, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -2000, 2000},
+-    {"qpel", &lavc_param_qpel, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_QPEL},
++    {"qpel", &lavc_param_qpel, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_QPEL},
+ #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)   
+-    {"trell", &lavc_param_trell, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_TRELLIS_QUANT},
++    {"trell", &lavc_param_trell, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_TRELLIS_QUANT},
+ #else
+     {"trell", &lavc_param_trell, TCCONF_TYPE_FLAG, 0, 0, 1},
+ #endif
+@@ -207,32 +207,32 @@
+     {"subq", &lavc_param_me_subpel_quality, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 8},
+     {"me_range", &lavc_param_me_range, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 16000},
+ #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)   
+-    {"aic", &lavc_param_aic, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_AIC},
++    {"aic", &lavc_param_aic, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_H263P_AIC},
+ #else
+-    {"aic", &lavc_param_aic, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_AC_PRED},
++    {"aic", &lavc_param_aic, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_AC_PRED},
+ #endif    
+-    {"umv", &lavc_param_umv, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_UMV},
++    {"umv", &lavc_param_umv, TCCONF_TYPE_FLAG, 0, 0, 1},
+     {"ibias", &lavc_param_ibias, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512},
+     {"pbias", &lavc_param_pbias, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512},
+     {"coder", &lavc_param_coder, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10},
+     {"context", &lavc_param_context, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10},
+     {"intra_matrix", &lavc_param_intra_matrix, TCCONF_TYPE_STRING, 0, 0, 0},
+     {"inter_matrix", &lavc_param_inter_matrix, TCCONF_TYPE_STRING, 0, 0, 0},
+-    {"cbp", &lavc_param_cbp, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_CBP_RD},
+-    {"mv0", &lavc_param_mv0, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_MV0},
++    {"cbp", &lavc_param_cbp, TCCONF_TYPE_FLAG, 0, 0, 1},
++    {"mv0", &lavc_param_mv0, TCCONF_TYPE_FLAG, 0, 0, 1},
+     {"nr", &lavc_param_noise_reduction, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 1000000},
+-    {"qprd", &lavc_param_qp_rd, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_QP_RD},
++    {"qprd", &lavc_param_qp_rd, TCCONF_TYPE_FLAG, 0, 0, 1},
+     {"threads", &lavc_param_threads, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 16},
+-    {"ss", &lavc_param_ss, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_SLICE_STRUCT},
+-    {"svcd_sof", &lavc_param_scan_offset, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_SVCD_SCAN_OFFSET},
+-    {"alt", &lavc_param_alt, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_ALT_SCAN},
+-    {"ilme", &lavc_param_ilme, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_INTERLACED_ME},
++    {"ss", &lavc_param_ss, TCCONF_TYPE_FLAG, 0, 0, 1},
++    {"svcd_sof", &lavc_param_scan_offset, TCCONF_TYPE_FLAG, 0, 0, 1},
++    {"alt", &lavc_param_alt, TCCONF_TYPE_FLAG, 0, 0, 1},
++    {"ilme", &lavc_param_ilme, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_INTERLACED_ME},
+     {"inter_threshold", &lavc_param_inter_threshold, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -1000000, 1000000},
+     {"sc_threshold", &lavc_param_sc_threshold, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -1000000, 1000000},
+     {"top", &lavc_param_top, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -1, 1},
+-    {"gmc", &lavc_param_gmc, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_GMC},
+-    {"trunc", &lavc_param_trunc, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_TRUNCATED},
+-    {"closedgop", &lavc_param_closedgop, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_CLOSED_GOP},
++    {"gmc", &lavc_param_gmc, TCCONF_TYPE_FLAG, 0, 0, 1},
++    {"trunc", &lavc_param_trunc, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_TRUNCATED},
++    {"closedgop", &lavc_param_closedgop, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_CLOSED_GOP},
+     {"intra_dc_precision", &lavc_param_intra_dc_precision, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 16},
+     {"skip_top", &lavc_param_skip_top, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 1000},
+     {"skip_bottom", &lavc_param_skip_bottom, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 1000},
+diff -Naur a/filter/filter_pp.c b/filter/filter_pp.c
+--- a/filter/filter_pp.c	2011-11-19 16:50:27.000000000 +0000
++++ b/filter/filter_pp.c	2018-05-14 01:58:58.347408780 +0100
+@@ -38,8 +38,8 @@
+ 
+ /* FIXME: these use the filter ID as an index--the ID can grow
+  * arbitrarily large, so this needs to be fixed */
+-static pp_mode_t *mode[100];
+-static pp_context_t *context[100];
++static pp_mode *mode[100];
++static pp_context *context[100];
+ static int width[100], height[100];
+ static int pre[100];
+ 
+diff -Naur a/filter/filter_resample.c b/filter/filter_resample.c
+--- a/filter/filter_resample.c	2011-11-19 16:50:27.000000000 +0000
++++ b/filter/filter_resample.c	2018-05-14 01:58:58.347408780 +0100
+@@ -37,6 +37,7 @@
+ #include "libtc/optstr.h"
+ #include "libtc/tcavcodec.h"
+ #include "libtc/tcmodule-plugin.h"
++#include <libavresample/avresample.h>
+ 
+ 
+ typedef struct {
+@@ -45,7 +46,7 @@
+ 
+     int bytes_per_sample;
+ 
+-    ReSampleContext *resample_ctx;
++    AVAudioResampleContext *resample_ctx;
+ } ResamplePrivateData;
+ 
+ static const char resample_help[] = ""
+diff -Naur a/filter/subtitler/load_font.c b/filter/subtitler/load_font.c
+--- a/filter/subtitler/load_font.c	2011-11-19 16:50:27.000000000 +0000
++++ b/filter/subtitler/load_font.c	2018-05-14 01:58:58.347408780 +0100
+@@ -47,8 +47,8 @@
+ // FreeType specific includes
+ #include <ft2build.h>
+ #include FT_FREETYPE_H
++#include FT_GLYPH_H
+ 
+-#include <freetype/ftglyph.h>
+ 
+ /**
+  * @file bswap.h
+diff -Naur a/import/decode_lavc.c b/import/decode_lavc.c
+--- a/import/decode_lavc.c	2011-11-19 16:50:27.000000000 +0000
++++ b/import/decode_lavc.c	2018-05-14 01:58:58.347408780 +0100
+@@ -57,6 +57,7 @@
+ };
+ 
+ // fourCC to ID mapping taken from MPlayer's codecs.conf
++#if LIBAVCODEC_VERSION_MAJOR < 55
+ static struct ffmpeg_codec ffmpeg_codecs[] = {
+   {CODEC_ID_MSMPEG4V1, TC_CODEC_ERROR, "mp41",
+     {"MP41", "DIV1", ""}},
+@@ -91,6 +92,42 @@
+   {CODEC_ID_MPEG2VIDEO, TC_CODEC_MPEG2, "mpeg2video",
+     {"MPG2", ""}},
+   {0, TC_CODEC_UNKNOWN, NULL, {""}}};
++#else
++static struct ffmpeg_codec ffmpeg_codecs[] = {
++  {AV_CODEC_ID_MSMPEG4V1, TC_CODEC_ERROR, "mp41",
++    {"MP41", "DIV1", ""}},
++  {AV_CODEC_ID_MSMPEG4V2, TC_CODEC_MP42, "mp42",
++    {"MP42", "DIV2", ""}},
++  {AV_CODEC_ID_MSMPEG4V3, TC_CODEC_DIVX3, "msmpeg4",
++    {"DIV3", "DIV5", "AP41", "MPG3", "MP43", ""}},
++  {AV_CODEC_ID_MPEG4, TC_CODEC_DIVX4, "mpeg4",
++    {"DIVX", "XVID", "MP4S", "M4S2", "MP4V", "UMP4", "DX50", ""}},
++  {AV_CODEC_ID_MJPEG, TC_CODEC_MJPEG, "mjpeg",
++    {"MJPG", "AVRN", "AVDJ", "JPEG", "MJPA", "JFIF", ""}},
++  {AV_CODEC_ID_MPEG1VIDEO, TC_CODEC_MPEG1VIDEO, "mpeg1video",
++    {"MPG1", ""}},
++  {AV_CODEC_ID_DVVIDEO, TC_CODEC_DV, "dvvideo",
++    {"DVSD", ""}},
++  {AV_CODEC_ID_WMV1, TC_CODEC_WMV1, "wmv1",
++    {"WMV1", ""}},
++  {AV_CODEC_ID_WMV2, TC_CODEC_WMV2, "wmv2",
++    {"WMV2", ""}},
++  {AV_CODEC_ID_HUFFYUV, TC_CODEC_HUFFYUV, "hfyu",
++    {"HFYU", ""}},
++  {AV_CODEC_ID_H263I, TC_CODEC_H263I, "h263i",
++    {"I263", ""}},
++  {AV_CODEC_ID_H263P, TC_CODEC_H263P, "h263p",
++    {"H263", "U263", "VIV1", ""}},
++  {AV_CODEC_ID_RV10, TC_CODEC_RV10, "rv10",
++    {"RV10", "RV13", ""}},
++  {AV_CODEC_ID_SVQ1, TC_CODEC_SVQ1, "svq1",
++    {"SVQ1", ""}},
++  {AV_CODEC_ID_SVQ3, TC_CODEC_SVQ3, "svq3",
++    {"SVQ3", ""}},
++  {AV_CODEC_ID_MPEG2VIDEO, TC_CODEC_MPEG2, "mpeg2video",
++    {"MPG2", ""}},
++  {0, TC_CODEC_UNKNOWN, NULL, {""}}};
++#endif
+ 
+ 
+ static struct ffmpeg_codec *find_ffmpeg_codec_id(unsigned int transcode_id)
+@@ -170,7 +207,7 @@
+ 
+   // Set these to the expected values so that ffmpeg's decoder can
+   // properly detect interlaced input.
+-  lavc_dec_context = avcodec_alloc_context();
++  lavc_dec_context = avcodec_alloc_context3(NULL);
+   if (lavc_dec_context == NULL) {
+       tc_log_error(__FILE__, "Could not allocate enough memory.");
+       goto decoder_error;
+@@ -181,12 +218,12 @@
+ #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
+   lavc_dec_context->error_resilience  = 2;
+ #else
+-  lavc_dec_context->error_recognition = 2;
++  lavc_dec_context->err_recognition = 2;
+ #endif
+   lavc_dec_context->error_concealment = 3;
+   lavc_dec_context->workaround_bugs = FF_BUG_AUTODETECT;
+ 
+-  if (avcodec_open(lavc_dec_context, lavc_dec_codec) < 0) {
++  if (avcodec_open2(lavc_dec_context, lavc_dec_codec, NULL) < 0) {
+       tc_log_error(__FILE__, "Could not initialize the '%s' codec.",
+ 		   codec->name);
+       goto decoder_error;
+@@ -290,8 +327,8 @@
+ 
+       // Convert avcodec image to the requested YUV or RGB format
+       switch (lavc_dec_context->pix_fmt) {
+-	case PIX_FMT_YUVJ420P:
+-	case PIX_FMT_YUV420P:
++	case AV_PIX_FMT_YUVJ420P:
++	case AV_PIX_FMT_YUV420P:
+ 	    // Remove "dead space" at right edge of planes, if any
+ 	    if (picture.linesize[0] != lavc_dec_context->width) {
+ 		int y;
+@@ -315,7 +352,7 @@
+ 			  pix_fmt==TC_CODEC_YUV420P ? IMG_YUV420P : IMG_RGB_DEFAULT,
+ 			  lavc_dec_context->width, lavc_dec_context->height);
+ 	    break;
+-	case PIX_FMT_YUV411P:
++	case AV_PIX_FMT_YUV411P:
+ 	    if (picture.linesize[0] != lavc_dec_context->width) {
+ 		int y;
+ 		for (y = 0; y < lavc_dec_context->height; y++) {
+@@ -334,8 +371,8 @@
+ 			  pix_fmt==TC_CODEC_YUV420P ? IMG_YUV420P : IMG_RGB_DEFAULT,
+ 			  lavc_dec_context->width, lavc_dec_context->height);
+ 	    break;
+-	case PIX_FMT_YUVJ422P:
+-	case PIX_FMT_YUV422P:
++	case AV_PIX_FMT_YUVJ422P:
++	case AV_PIX_FMT_YUV422P:
+ 	    if (picture.linesize[0] != lavc_dec_context->width) {
+ 		int y;
+ 		for (y = 0; y < lavc_dec_context->height; y++) {
+@@ -354,8 +391,8 @@
+ 			  pix_fmt==TC_CODEC_YUV420P ? IMG_YUV420P : IMG_RGB_DEFAULT,
+ 			  lavc_dec_context->width, lavc_dec_context->height);
+ 	    break;
+-	case PIX_FMT_YUVJ444P:
+-	case PIX_FMT_YUV444P:
++	case AV_PIX_FMT_YUVJ444P:
++	case AV_PIX_FMT_YUV444P:
+ 	    if (picture.linesize[0] != lavc_dec_context->width) {
+ 		int y;
+ 		for (y = 0; y < lavc_dec_context->height; y++) {
+diff -Naur a/import/import_ffmpeg.c b/import/import_ffmpeg.c
+--- a/import/import_ffmpeg.c	2011-11-19 16:50:27.000000000 +0000
++++ b/import/import_ffmpeg.c	2018-05-14 01:58:58.347408780 +0100
+@@ -58,6 +58,7 @@
+ };
+ 
+ // fourCC to ID mapping taken from MPlayer's codecs.conf
++#if LIBAVCODEC_VERSION_MAJOR < 55
+ static struct ffmpeg_codec ffmpeg_codecs[] = {
+   {CODEC_ID_MSMPEG4V1, TC_CODEC_ERROR, "mp41",
+     {"MP41", "DIV1", ""}},
+@@ -106,6 +107,56 @@
+   {CODEC_ID_RAWVIDEO, TC_CODEC_YUV422P, "raw",
+     {"Y42B", ""}},
+   {0, TC_CODEC_UNKNOWN, NULL, {""}}};
++#else
++static struct ffmpeg_codec ffmpeg_codecs[] = {
++  {AV_CODEC_ID_MSMPEG4V1, TC_CODEC_ERROR, "mp41",
++    {"MP41", "DIV1", ""}},
++  {AV_CODEC_ID_MSMPEG4V2, TC_CODEC_MP42, "mp42",
++    {"MP42", "DIV2", ""}},
++  {AV_CODEC_ID_MSMPEG4V3, TC_CODEC_DIVX3, "msmpeg4",
++    {"DIV3", "DIV5", "AP41", "MPG3", "MP43", ""}},
++  {AV_CODEC_ID_MPEG4, TC_CODEC_DIVX4, "mpeg4",
++    {"DIVX", "XVID", "MP4S", "M4S2", "MP4V", "UMP4", "DX50", ""}},
++  {AV_CODEC_ID_MJPEG, TC_CODEC_MJPEG, "mjpeg",
++    {"MJPG", "AVRN", "AVDJ", "JPEG", "MJPA", "JFIF", ""}},
++  {AV_CODEC_ID_MPEG1VIDEO, TC_CODEC_MPG1, "mpeg1video",
++    {"MPG1", ""}},
++  {AV_CODEC_ID_DVVIDEO, TC_CODEC_DV, "dvvideo",
++    {"DVSD", ""}},
++  {AV_CODEC_ID_WMV1, TC_CODEC_WMV1, "wmv1",
++    {"WMV1", ""}},
++  {AV_CODEC_ID_WMV2, TC_CODEC_WMV2, "wmv2",
++    {"WMV2", ""}},
++  {AV_CODEC_ID_HUFFYUV, TC_CODEC_HUFFYUV, "hfyu",
++    {"HFYU", ""}},
++  {AV_CODEC_ID_H263I, TC_CODEC_H263I, "h263i",
++    {"I263", ""}},
++  {AV_CODEC_ID_H263P, TC_CODEC_H263P, "h263p",
++    {"H263", "U263", "VIV1", ""}},
++  {AV_CODEC_ID_H264, TC_CODEC_H264, "h264",
++    {"H264", "h264", "X264", "x264", "avc1", ""}},
++  {AV_CODEC_ID_RV10, TC_CODEC_RV10, "rv10",
++    {"RV10", "RV13", ""}},
++  {AV_CODEC_ID_SVQ1, TC_CODEC_SVQ1, "svq1",
++    {"SVQ1", ""}},
++  {AV_CODEC_ID_SVQ3, TC_CODEC_SVQ3, "svq3",
++    {"SVQ3", ""}},
++  {AV_CODEC_ID_MPEG2VIDEO, TC_CODEC_MPEG2, "mpeg2video",
++    {"MPG2", ""}},
++  {AV_CODEC_ID_MPEG2VIDEO, TC_CODEC_MPEG, "mpeg2video",
++    {"MPG2", ""}},
++  {AV_CODEC_ID_ASV1, TC_CODEC_ASV1, "asv1",
++    {"ASV1", ""}},
++  {AV_CODEC_ID_ASV2, TC_CODEC_ASV2, "asv2",
++    {"ASV2", ""}},
++  {AV_CODEC_ID_FFV1, TC_CODEC_FFV1, "ffv1",
++    {"FFV1", ""}},
++  {AV_CODEC_ID_RAWVIDEO, TC_CODEC_YUV420P, "raw",
++    {"I420", "IYUV", ""}},
++  {AV_CODEC_ID_RAWVIDEO, TC_CODEC_YUV422P, "raw",
++    {"Y42B", ""}},
++  {0, TC_CODEC_UNKNOWN, NULL, {""}}};
++#endif
+ 
+ #define BUFFER_SIZE SIZE_RGB_FRAME
+ 
+@@ -302,7 +353,7 @@
+ 
+     // Set these to the expected values so that ffmpeg's decoder can
+     // properly detect interlaced input.
+-    lavc_dec_context = avcodec_alloc_context();
++    lavc_dec_context = avcodec_alloc_context3(lavc_dec_codec);
+     if (lavc_dec_context == NULL) {
+       tc_log_error(MOD_NAME, "Could not allocate enough memory.");
+       return TC_IMPORT_ERROR;
+@@ -310,11 +361,11 @@
+     lavc_dec_context->width  = x_dim;
+     lavc_dec_context->height = y_dim;
+ 
+-    if (vob->decolor) lavc_dec_context->flags |= CODEC_FLAG_GRAY;
++    if (vob->decolor) lavc_dec_context->flags |= AV_CODEC_FLAG_GRAY;
+ #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
+     lavc_dec_context->error_resilience  = 2;
+ #else
+-    lavc_dec_context->error_recognition = 2;
++    lavc_dec_context->err_recognition = 2;
+ #endif
+     lavc_dec_context->error_concealment = 3;
+     lavc_dec_context->workaround_bugs = FF_BUG_AUTODETECT;
+@@ -324,6 +375,7 @@
+     // XXX: some codecs need extra data
+     switch (codec->id)
+     {
++#if LIBAVCODEC_VERSION_MAJOR < 55
+       case CODEC_ID_MJPEG: extra_data_size  = 28; break;
+       case CODEC_ID_LJPEG: extra_data_size  = 28; break;
+       case CODEC_ID_HUFFYUV: extra_data_size = 1000; break;
+@@ -331,6 +383,15 @@
+       case CODEC_ID_ASV2: extra_data_size = 8; break;
+       case CODEC_ID_WMV1: extra_data_size = 4; break;
+       case CODEC_ID_WMV2: extra_data_size = 4; break;
++#else
++      case AV_CODEC_ID_MJPEG: extra_data_size  = 28; break;
++      case AV_CODEC_ID_LJPEG: extra_data_size  = 28; break;
++      case AV_CODEC_ID_HUFFYUV: extra_data_size = 1000; break;
++      case AV_CODEC_ID_ASV1: extra_data_size = 8; break;
++      case AV_CODEC_ID_ASV2: extra_data_size = 8; break;
++      case AV_CODEC_ID_WMV1: extra_data_size = 4; break;
++      case AV_CODEC_ID_WMV2: extra_data_size = 4; break;
++#endif
+       default: extra_data_size = 0; break;
+     }
+ 
+@@ -344,7 +405,7 @@
+     }
+ 
+     TC_LOCK_LIBAVCODEC;
+-    ret = avcodec_open(lavc_dec_context, lavc_dec_codec);
++    ret = avcodec_open2(lavc_dec_context, lavc_dec_codec, NULL);
+     TC_UNLOCK_LIBAVCODEC;
+     if (ret < 0) {
+       tc_log_warn(MOD_NAME, "Could not initialize the '%s' codec.",
+@@ -360,7 +421,11 @@
+         frame_size = x_dim*y_dim + 2*UV_PLANE_SIZE(IMG_YUV_DEFAULT,x_dim,y_dim);
+ 
+ 	// we adapt the color space
++#if LIBAVCODEC_VERSION_MAJOR < 55
+         if(codec->id == CODEC_ID_MJPEG) {
++#else
++        if(codec->id == AV_CODEC_ID_MJPEG) {
++#endif
+ 	  enable_levels_filter();
+         }
+         break;
+@@ -434,7 +499,11 @@
+       }
+ 
+       // we adapt the color space
++#if LIBAVCODEC_VERSION_MAJOR < 55
+       if(codec->id == CODEC_ID_MJPEG) {
++#else
++      if(codec->id == AV_CODEC_ID_MJPEG) {
++#endif
+         enable_levels_filter();
+       }
+ 
+@@ -504,13 +573,25 @@
+       int bkey = 0;
+ 
+       // check for keyframes
++#if LIBAVCODEC_VERSION_MAJOR < 55
+       if (codec->id == CODEC_ID_MSMPEG4V3) {
++#else
++      if (codec->id == AV_CODEC_ID_MSMPEG4V3) {
++#endif
+ 	if (divx3_is_key(buffer)) bkey = 1;
+       }
++#if LIBAVCODEC_VERSION_MAJOR < 55
+       else if (codec->id == CODEC_ID_MPEG4) {
++#else
++      else if (codec->id == AV_CODEC_ID_MPEG4) {
++#endif
+ 	if (mpeg4_is_key(buffer, bytes_read)) bkey = 1;
+       }
++#if LIBAVCODEC_VERSION_MAJOR < 55
+       else if (codec->id == CODEC_ID_MJPEG) {
++#else
++      else if (codec->id == AV_CODEC_ID_MJPEG) {
++#endif
+ 	bkey = 1;
+       }
+ 
+@@ -580,8 +661,8 @@
+ 
+     // Convert avcodec image to our internal YUV or RGB format
+     switch (lavc_dec_context->pix_fmt) {
+-      case PIX_FMT_YUVJ420P:
+-      case PIX_FMT_YUV420P:
++      case AV_PIX_FMT_YUVJ420P:
++      case AV_PIX_FMT_YUV420P:
+         src_fmt = IMG_YUV420P;
+         YUV_INIT_PLANES(src_planes, frame, src_fmt,
+                         lavc_dec_context->width, lavc_dec_context->height);
+@@ -612,7 +693,7 @@
+ 	}
+         break;
+ 
+-      case PIX_FMT_YUV411P:
++      case AV_PIX_FMT_YUV411P:
+         src_fmt = IMG_YUV411P;
+         YUV_INIT_PLANES(src_planes, frame, src_fmt,
+                         lavc_dec_context->width, lavc_dec_context->height);
+@@ -640,8 +721,8 @@
+         }
+         break;
+ 
+-      case PIX_FMT_YUVJ422P:
+-      case PIX_FMT_YUV422P:
++      case AV_PIX_FMT_YUVJ422P:
++      case AV_PIX_FMT_YUV422P:
+         src_fmt = IMG_YUV422P;
+         YUV_INIT_PLANES(src_planes, frame, src_fmt,
+                         lavc_dec_context->width, lavc_dec_context->height);
+@@ -669,8 +750,8 @@
+         }
+ 	break;
+ 
+-      case PIX_FMT_YUVJ444P:
+-      case PIX_FMT_YUV444P:
++      case AV_PIX_FMT_YUVJ444P:
++      case AV_PIX_FMT_YUV444P:
+         src_fmt = IMG_YUV444P;
+         YUV_INIT_PLANES(src_planes, frame, src_fmt,
+                         lavc_dec_context->width, lavc_dec_context->height);
+diff -Naur a/import/probe_ffmpeg.c b/import/probe_ffmpeg.c
+--- a/import/probe_ffmpeg.c	2011-11-19 16:50:27.000000000 +0000
++++ b/import/probe_ffmpeg.c	2018-05-14 01:58:58.347408780 +0100
+@@ -51,8 +51,8 @@
+             info->bitrate = st->codec->bit_rate / 1000;
+             info->width = st->codec->width;
+             info->height = st->codec->height;
+-            if (st->r_frame_rate.num > 0 && st->r_frame_rate.den > 0) {
+-                info->fps = av_q2d(st->r_frame_rate);
++            if (st->avg_frame_rate.num > 0 && st->avg_frame_rate.den > 0) {
++                info->fps = av_q2d(st->avg_frame_rate);
+             } else {
+                 /* watch out here */
+                 info->fps = 1.0/av_q2d(st->codec->time_base);
+@@ -99,8 +99,8 @@
+ 
+     TC_INIT_LIBAVCODEC;
+ 
+-    ret = av_open_input_file(&lavf_dmx_context, ipipe->name,
+-                             NULL, 0, NULL);
++    ret = avformat_open_input(&lavf_dmx_context, ipipe->name,
++                             NULL, NULL);
+     if (ret != 0) {
+         tc_log_error(__FILE__, "unable to open '%s'"
+                                " (libavformat failure)",
+@@ -109,7 +109,7 @@
+         return;
+     }
+ 
+-    ret = av_find_stream_info(lavf_dmx_context);
++    ret = avformat_find_stream_info(lavf_dmx_context, NULL);
+     if (ret < 0) {
+         tc_log_error(__FILE__, "unable to fetch informations from '%s'"
+                                " (libavformat failure)",
+@@ -120,7 +120,11 @@
+ 
+     translate_info(lavf_dmx_context, ipipe->probe_info);
+ 
++#if LIBAVFORMAT_VERSION_INT > AV_VERSION_INT(53,25,0)
++    avformat_close_input(&lavf_dmx_context);
++#else
+     av_close_input_file(lavf_dmx_context);
++#endif
+     return;
+ }
+ 
+diff -Naur a/libtc/tcavcodec.h b/libtc/tcavcodec.h
+--- a/libtc/tcavcodec.h	2011-11-19 16:50:27.000000000 +0000
++++ b/libtc/tcavcodec.h	2018-05-14 01:58:58.347408780 +0100
+@@ -53,7 +53,6 @@
+ 
+ #define TC_INIT_LIBAVCODEC do { \
+     TC_LOCK_LIBAVCODEC; \
+-    avcodec_init(); \
+     avcodec_register_all(); \
+     TC_UNLOCK_LIBAVCODEC; \
+ } while (0)
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index abfcf6d73d..e57f503d13 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -170,6 +170,107 @@
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg))
 
+(define-public transcode
+  (package
+    (name "transcode")
+    (version "1.1.7")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://sources.archlinux.org/other/community/"
+                       name "/" name "-" version ".tar.bz2"))
+       (sha256
+        (base32 "14ha9xjsjrj131f35jd56z5v1jb4rbsrj1nril5shqnxw3c74khy"))
+       (patches
+        (search-patches "transcode-ffmpeg.patch"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:configure-flags
+       (list
+        "--enable-libv4l2"
+        "--enable-libmpeg2"
+        "--enable-libmpeg2convert"
+        "--enable-v4l"
+        ;; XXX: Not available.
+        ;;"--enable-bktr"
+        ;;"--enable-sunau"
+        "--enable-oss"
+        "--enable-alsa"
+        ;; XXX: Not available.
+        ;;"--enable-libpostproc"
+        "--enable-freetype2"
+        "--enable-xvid"
+        "--enable-x264"
+        "--enable-ogg"
+        "--enable-vorbis"
+        "--enable-theora"
+        ;; XXX: Not available.
+        ;;"--enable-pvm3"
+        "--enable-libdv"
+        "--enable-libquicktime"
+        "--enable-lzo"
+        "--enable-a52"
+        "--enable-faac"
+        "--enable-libxml2"
+        ;; XXX: Not available.
+        ;;"--enable-ibp"
+        ;;"--enable-mjpegtools"
+        "--enable-sdl"
+        "--enable-imagemagick"
+        ;; XXX: Not available.
+        ;;"--enable-libjpegmmx"
+        "--enable-libjpeg")))
+        ;; XXX: Not available.
+        ;;"--enable-bsdav"
+        ;;"--enable-pv3"
+        ;;"--enable-nuv"
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("iconv" ,libiconv)
+       ("libtool" ,libtool)
+       ("libxml2" ,libxml2)
+       ("perl" ,perl)
+       ("pkg-config" ,pkg-config)
+       ("python" ,python-wrapper)))
+    (inputs
+     `(("alsa-lib" ,alsa-lib)
+       ("faac" ,faac)
+       ("ffmpeg" ,ffmpeg)
+       ("freetype" ,freetype)
+       ("imagemagick" ,imagemagick)
+       ("lame" ,lame)
+       ("liba52" ,liba52)
+       ("libdv" ,libdv)
+       ("libdvdread" ,libdvdread)
+       ("libjpeg" ,libjpeg-turbo)
+       ("libmpeg2" ,libmpeg2)
+       ("libogg" ,libogg)
+       ("libquicktime" ,libquicktime)
+       ("libtheora" ,libtheora)
+       ("libvorbis" ,libvorbis)
+       ("lzo" ,lzo)
+       ("mjepgtools" ,mjpegtools)
+       ("sdl" ,sdl)
+       ("v4l-utils" ,v4l-utils)
+       ("x11" ,libx11)
+       ("x264" ,libx264)
+       ("xaw" ,libxaw)
+       ("xext" ,libxext)
+       ("xpm" ,libxpm)
+       ("xv" ,libxv)
+       ("xvid" ,xvid)
+       ("zlib" ,zlib)))
+    (synopsis "Audio/Video Transcoder")
+    (description "Transcode is a fast, versatile and command-line based
+audio/video everything to everything converter primarily focussed on producing
+AVI video files with MP3 audio, but also including a program to read all the
+video and audio streams from a DVD.")
+    (home-page
+     "http://linuxfromscratch.org/blfs/view/svn/multimedia/transcode.html")
+    (license license:gpl2+)))
+
 (define-public svt-hevc
   (package
     (name "svt-hevc")
-- 
2.26.2


[-- Attachment #1.1.31: 0039-gnu-Add-vo-aacenc.patch --]
[-- Type: text/x-patch, Size: 1364 bytes --]

From 330d27978badff5c3a88e15cd8068e20d0a26b5c Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Fri, 3 Jul 2020 11:23:48 -0400
Subject: [PATCH 39/51] gnu: Add vo-aacenc.

* gnu/packages/audio.scm (vo-aacenc): New variable.
---
 gnu/packages/audio.scm | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 0d67508c7f..0d4fe01eb9 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -127,6 +127,25 @@
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26))
 
+(define-public vo-aacenc
+  (package
+    (name "vo-aacenc")
+    (version "0.1.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://sourceforge.net/projects/opencore-amr/files/"
+                       name "/" name "-" version ".tar.gz"))
+       (sha256
+        (base32 "0dhghm3c8pqrriwwyj5x9i0yf52fmdfijbgqqkvqvwarldvp86p5"))))
+    (build-system gnu-build-system)
+    (synopsis "VisualOn AAC Encoder")
+    (description "VO-AACENC is the VisualOn implementation of Advanced Audio
+Coding (AAC) encoder.")
+    (home-page "https://sourceforge.net/projects/opencore-amr/")
+    (license license:asl2.0)))
+
 (define-public tinyalsa
   (package
     (name "tinyalsa")
-- 
2.26.2


[-- Attachment #1.1.32: 0040-gnu-Add-webrtc-audio-processing.patch --]
[-- Type: text/x-patch, Size: 1477 bytes --]

From e258e023bf246ea961b6be46bff7808b5f029883 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Fri, 3 Jul 2020 11:25:10 -0400
Subject: [PATCH 40/51] gnu: Add webrtc-audio-processing.

* gnu/packages/audio.scm (webrtc-audio-processing): New variable.
---
 gnu/packages/audio.scm | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 0d4fe01eb9..f99972e038 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -127,6 +127,26 @@
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26))
 
+(define-public webrtc-audio-processing
+  (package
+    (name "webrtc-audio-processing")
+    (version "0.3.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "http://freedesktop.org/software/pulseaudio/"
+                       name "/" name "-" version ".tar.xz"))
+       (sha256
+        (base32 "1gsx7k77blfy171b6g3m0k0s0072v6jcawhmx1kjs9w5zlwdkzd0"))))
+    (build-system gnu-build-system)
+    (synopsis "WebRTC's Audio Processing Library")
+    (description "WebRTC-Audio-Processing library based on Google's
+implementation of WebRTC.")
+    (home-page
+     "https://freedesktop.org/software/pulseaudio/webrtc-audio-processing/")
+    (license (license:non-copyleft "file:///COPYING"))))
+
 (define-public vo-aacenc
   (package
     (name "vo-aacenc")
-- 
2.26.2


[-- Attachment #1.1.33: 0041-gnu-Add-wildmidi.patch --]
[-- Type: text/x-patch, Size: 1824 bytes --]

From b5a86585954259fbf20722079c7a5fa384b5b2d4 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Fri, 3 Jul 2020 11:49:36 -0400
Subject: [PATCH 41/51] gnu: Add wildmidi.

* gnu/packages/audio.scm (wildmidi): New variable.
---
 gnu/packages/audio.scm | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index f99972e038..91d85082db 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -127,6 +127,42 @@
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26))
 
+(define-public wildmidi
+  (package
+    (name "wildmidi")
+    (version "0.4.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/Mindwerks/wildmidi.git")
+         (commit (string-append name "-" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "01f4a9c5xlap5a4pkfnlgkzk5pjlk43zkq6fnw615ghya04g6hrl"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:tests? #f ; No target
+       #:configure-flags
+       (list
+        "-DWANT_ALSA=ON"
+        "-DWANT_OSS=ON"
+        "-DWANT_OPENAL=ON")))
+    (inputs
+     `(("alsa" ,alsa-lib)
+       ("openal" ,openal)))
+    (synopsis "Software Synthesizer")
+    (description "WildMIDI is a simple software midi player which has a core
+softsynth library that can be use with other applications.")
+    (home-page "https://www.mindwerks.net/projects/wildmidi/")
+    (license
+     (list
+      ;; Library.
+      license:lgpl3+
+      ;; Player.
+      license:gpl3+))))
+
 (define-public webrtc-audio-processing
   (package
     (name "webrtc-audio-processing")
-- 
2.26.2


[-- Attachment #1.1.34: 0042-gnu-Add-zxing-cpp.patch --]
[-- Type: text/x-patch, Size: 1531 bytes --]

From 3004121e24d5732caa93e6260cc5605ea8deda40 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Fri, 3 Jul 2020 12:06:23 -0400
Subject: [PATCH 42/51] gnu: Add zxing-cpp.

* gnu/packages/aidc.scm (zxing-cpp): New variable.
---
 gnu/packages/aidc.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/aidc.scm b/gnu/packages/aidc.scm
index 5648f5a9ec..4921ae03a1 100644
--- a/gnu/packages/aidc.scm
+++ b/gnu/packages/aidc.scm
@@ -37,8 +37,30 @@
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages video)
+  #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu))
 
+(define-public zxing-cpp
+  (package
+    (name "zxing-cpp")
+    (version "1.0.8")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/nu-book/zxing-cpp.git")
+         (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "011sq8wcjfxbnd8sj6bf2fgkamlp8gj6q835g61c952npvwsnl71"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:tests? #f))                    ; No target
+    (synopsis "C++ port of ZXing")
+    (description "ZXing-CPP is a barcode scanning library.")
+    (home-page "https://github.com/nu-book/zxing-cpp")
+    (license license:asl2.0)))
 
 (define-public barcode
   (package
-- 
2.26.2


[-- Attachment #1.1.35: 0043-gnu-Add-iqa.patch --]
[-- Type: text/x-patch, Size: 1963 bytes --]

From f805f26f03c812658e0ed0606b47a78208d5856f Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Fri, 3 Jul 2020 12:08:33 -0400
Subject: [PATCH 43/51] gnu: Add iqa.

* gnu/packages/image.scm (iqa): New variable.
---
 gnu/packages/image.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index 393ee7e08b..5d01f04383 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -93,6 +93,38 @@
   #:use-module (guix deprecation)
   #:use-module (srfi srfi-1))
 
+(define-public iqa
+  (package
+    (name "iqa")
+    (version "1.1.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://sourceforge.net/projects/iqa/files/"
+                       "1.1.2%20Release/iqa_1.1.2_src.tar.gz/download"))
+       (sha256
+        (base32 "00mgwy031ammab6bwmd1whhvqv3fxy1cs1igabq0n3ag12zhjs77"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f                      ; No target
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (lib (string-append out "/lib")))
+               (install-file "build/debug/libiqa.a" lib)
+               #t))))))
+    (synopsis "Image Quality Assessment")
+    (description "IQA is a C library for objectively measuring image/video
+quality.  It implements many popular algorithms, such as MS-SSIM, MS-SSIM*,
+SIMM, MSE, and PSNR.  It is designed to be fast, accurate, and reliable.  All
+code is Valgrind-clean and unit tested.")
+    (home-page "https://sourceforge.net/projects/iqa/")
+    (license license:bsd-4)))
+
 (define-public libpng
   (package
    (name "libpng")
-- 
2.26.2


[-- Attachment #1.1.36: 0044-gnu-Add-rtmpdump.patch --]
[-- Type: text/x-patch, Size: 1861 bytes --]

From e9701a31ff8213ae2b2caba0f1756bfaf01888a3 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Fri, 3 Jul 2020 12:10:10 -0400
Subject: [PATCH 44/51] gnu: Add rtmpdump.

* gnu/packages/networking.scm (rtmpdump): New variable.
---
 gnu/packages/networking.scm | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index 66798bd2d2..c4357b093f 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -135,6 +135,41 @@
   #:use-module (gnu packages xml)
   #:use-module (ice-9 match))
 
+(define-public rtmpdump
+  (package
+    (name "rtmpdump")
+    (version "2.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://rtmpdump.mplayerhq.hu/download/"
+                       name "-" version ".tgz"))
+       (sha256
+        (base32 "0b2b49a57kpz9gi8dx1x3cs8b0gjx8x0c89x0q96kkl2knlvff7g"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f                      ; No target
+       #:make-flags
+       (list
+        (string-append "prefix=" (assoc-ref %outputs "out")))
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure))))
+    (inputs
+     `(("openssl" ,openssl-1.0)
+       ("zlib" ,zlib)))
+    (synopsis "Tools and library for handling RTMP streams")
+    (description "RTMPdump is a toolkit for RTMP streams.  All forms of RTMP are
+supported, including rtmp://, rtmpt://, rtmpe://, rtmpte://, and rtmps://.")
+    (home-page "https://rtmpdump.mplayerhq.hu/")
+    (license
+     (list
+      ;; Library.
+      license:lgpl2.1+
+      ;; Others.
+      license:gpl2+))))
+
 (define-public srt
   (package
     (name "srt")
-- 
2.26.2


[-- Attachment #1.1.37: 0045-gnu-Add-libnice.patch --]
[-- Type: text/x-patch, Size: 3299 bytes --]

From 593388c5a11b993699b63993db99d138cbca35b5 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Fri, 3 Jul 2020 12:12:59 -0400
Subject: [PATCH 45/51] gnu: Add libnice.

* gnu/packages/networking.scm (libnice): New variable.
---
 gnu/packages/networking.scm | 56 +++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index c4357b093f..46911c50e0 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -95,6 +95,7 @@
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages gnupg)
+  #:use-module (gnu packages gstreamer)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages image)
   #:use-module (gnu packages libevent)
@@ -106,6 +107,7 @@
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages nettle)
   #:use-module (gnu packages openldap)
+  #:use-module (gnu packages onc-rpc)
   #:use-module (gnu packages password-utils)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages perl)
@@ -135,6 +137,60 @@
   #:use-module (gnu packages xml)
   #:use-module (ice-9 match))
 
+(define-public libnice
+  (package
+    (name "libnice")
+    (version "0.1.17")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://libnice.freedesktop.org/releases/"
+                       name "-" version ".tar.gz"))
+       (sha256
+        (base32 "09lm0rxwvbr53svi3inaharlq96iwbs3s6957z69qp4bqpga0lhr"))))
+    (build-system meson-build-system)
+    (outputs '("out" "doc"))
+    (arguments
+     `(#:glib-or-gtk? #t     ; To wrap binaries and/or compile schemas
+       #:configure-flags
+       (list
+        "-Dgtk_doc=enabled")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'move-docs
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (doc (assoc-ref outputs "doc")))
+               (mkdir-p (string-append doc "/share"))
+               (rename-file
+                (string-append out "/share/gtk-doc")
+                (string-append doc "/share/gtk-doc"))
+               #t))))))
+    (native-inputs
+     `(("glib:bin" ,glib "bin")
+       ("gobject-introspection" ,gobject-introspection)
+       ("gtk-doc" ,gtk-doc)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("gstreamer" ,gstreamer)
+       ("gst-plugins-base" ,gst-plugins-base)
+       ("libnsl" ,libnsl)))
+    (propagated-inputs
+     `(("glib" ,glib)
+       ("glib-networking" ,glib-networking)
+       ("gnutls" ,gnutls)))
+    (synopsis "GLib ICE implementation")
+    (description "LibNice is a library that implements the Interactive
+Connectivity Establishment (ICE) standard (RFC 5245 & RFC 8445).  It provides a
+GLib-based library, libnice, as well as GStreamer elements to use it.")
+    (home-page "https://libnice.freedesktop.org/")
+    (license
+     ;; This project is dual-licensed.
+     (list
+      license:lgpl2.1+
+      license:mpl1.1))))
+
 (define-public rtmpdump
   (package
     (name "rtmpdump")
-- 
2.26.2


[-- Attachment #1.1.38: 0046-gnu-Add-openni2.patch --]
[-- Type: text/x-patch, Size: 2550 bytes --]

From 160fa94f7ffe1c54915106506b366251f4fcd62c Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Fri, 3 Jul 2020 12:14:25 -0400
Subject: [PATCH 46/51] gnu: Add openni2.

* gnu/packages/gstreamer.scm (openni2): New variable.
---
 gnu/packages/gstreamer.scm | 40 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/gnu/packages/gstreamer.scm b/gnu/packages/gstreamer.scm
index 57593c860e..05b0d9042f 100644
--- a/gnu/packages/gstreamer.scm
+++ b/gnu/packages/gstreamer.scm
@@ -54,9 +54,11 @@
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages gnupg)
   #:use-module (gnu packages graphics)
+  #:use-module (gnu packages graphviz)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages image)
   #:use-module (gnu packages iso-codes)
+  #:use-module (gnu packages java)
   #:use-module (gnu packages libunwind)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
@@ -84,6 +86,44 @@
   #:use-module (gnu packages assembly)
   #:use-module (gnu packages xml))
 
+(define-public openni2
+  (package
+    (name "openni2")
+    (version "2.2.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/occipital/OpenNI2.git")
+         (commit (string-append "v" version "-debian"))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0mfnyzpq53wnzgjfx91xcbx0nrl0lp1vrk1rk20a3gb3kshsr675"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f                      ; No target
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure))))
+    (native-inputs
+     `(("graphviz" ,graphviz)
+       ("doxygen" ,doxygen)
+       ("python" ,python-wrapper)))
+    (inputs
+     `(("freeglut3" ,freeglut)
+       ("libudev" ,eudev)
+       ("libusb" ,libusb)
+       ("openjdk" ,openjdk14)
+       ("openjdk:jdk" ,openjdk14 "jdk")))
+    (synopsis "Framework for sensor-based 'Natural Interaction")
+    (description "OpenNI is a framework for getting data to support
+'Natural Interaction', i.e. skeleton tracking, gesture tracking, and similar
+ways of getting data from humans.  It provides the interface for physical devices
+and for middleware components.")
+    (home-page "https://structure.io/openni")
+    (license license:asl2.0)))
+
 (define-public libdc1394
   (package
     (name "libdc1394")
-- 
2.26.2


[-- Attachment #1.1.39: 0047-gnu-Add-rust-imgref.patch --]
[-- Type: text/x-patch, Size: 1483 bytes --]

From e812fd130dabda501d5508b2ba781a4e787f8c66 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Fri, 3 Jul 2020 13:02:22 -0400
Subject: [PATCH 47/51] gnu: Add rust-imgref.

* gnu/packages/crates-io.scm (rust-imgref): New variable.
---
 gnu/packages/crates-io.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index a2d82c466e..08f6c6b249 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -10319,6 +10319,27 @@ for the most common image formats.")
         ("rust-num-complex" ,rust-num-complex-0.2)
         ("rust-quickcheck" ,rust-quickcheck-0.6))))))
 
+(define-public rust-imgref
+  (package
+    (name "rust-imgref")
+    (version "1.6.1")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (crate-uri "imgref" version))
+        (file-name
+         (string-append name "-" version ".tar.gz"))
+        (sha256
+         (base32
+          "1f2m9lq769248bwbyzda714a8xcgk5bdpdsi20xcnavikiw449g8"))))
+    (build-system cargo-build-system)
+    (home-page "https://lib.rs/crates/imgref")
+    (synopsis "Image processing library")
+    (description
+     "A trivial struct for interchange of 2d-dimensional pixel buffers
+with width, height & stride.")
+    (license license:cc0)))
+
 (define-public rust-indexmap-1.3
   (package
     (name "rust-indexmap")
-- 
2.26.2


[-- Attachment #1.1.40: 0048-gnu-Add-opensles.patch --]
[-- Type: text/x-patch, Size: 3333 bytes --]

From 05e54fa894e5998b65ccce87467ca160a1ec5731 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Sat, 4 Jul 2020 03:11:51 -0400
Subject: [PATCH 48/51] gnu: Add opensles.

* gnu/packages/audio.scm (opensles): New variable.
---
 gnu/packages/audio.scm | 57 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 91d85082db..3fa5e381b2 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -127,6 +127,63 @@
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26))
 
+(define-public opensles
+  (package
+    (name "opensles")
+    (version "1.1.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/KhronosGroup/OpenSL-ES-Registry.git")
+         (commit "ea5104b")))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0j5bm7h3ahz66f23i9abwc0y10agfkpksnj6y078x2nichq66h4f"))))
+    (build-system copy-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'clean
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out")))
+               (mkdir-p (string-append out "/etc"))
+               (mkdir-p (string-append out "/include"))
+               (mkdir-p (string-append out "/share"))
+               (rename-file
+                (string-append out "/api/1.1/OpenSLES_IID.c")
+                (string-append out "/etc/OpenSLES_IID.c"))
+               (rename-file
+                (string-append out "/api/1.1/OpenSLES.h")
+                (string-append out "/include/OpenSLES.h"))
+               (rename-file
+                (string-append out "/api/1.1/OpenSLES_Platform.h")
+                (string-append out "/include/OpenSLES_Platform.h"))
+               (rename-file
+                (string-append out "/api/1.1/README.txt")
+                (string-append out "/share/README.txt"))
+               (for-each delete-file-recursively
+                         (list
+                          (string-append out "/api")
+                          (string-append out "/specs")))
+               (for-each delete-file
+                         (list
+                          (string-append out "/CODE_OF_CONDUCT.md")
+                          (string-append out "/index.php")
+                          (string-append out "/README.md"))))
+             #t)))))
+    (synopsis "Embedded Audio Acceleration")
+    (description "OpenSLES is a royalty-free, cross-platform,
+hardware-accelerated audio API tuned for embedded systems.  It provides a
+standardized, high-performance, low-latency method to access audio
+functionality for developers of native applications on embedded mobile
+multimedia devices, enabling straightforward cross-platform deployment of
+hardware and software audio capabilities, reducing implementation effort, and
+promoting the market for advanced audio.")
+    (home-page "https://www.khronos.org/opensles/")
+    (license (license:non-copyleft "Refer individual files"))))
+
 (define-public wildmidi
   (package
     (name "wildmidi")
-- 
2.26.2


[-- Attachment #1.1.41: 0049-gnu-gst-plugins-bad-Update-package-definition.patch --]
[-- Type: text/x-patch, Size: 12269 bytes --]

From 4889d6baeadf35269edc702b9dfad7c0c8bea317 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Sat, 4 Jul 2020 05:13:42 -0400
Subject: [PATCH 49/51] gnu: gst-plugins-bad: Update package definition.

* gnu/packages/gstreamer.scm (gst-plugins-base): Update package definition.
[outputs]: New output 'doc'.
[arguments]<#:glib-or-gtk?>: New argument.
<#:phases>['fix-build-errors]: New phase.
['patch-docbook-xml]: New phase.
['pre-check]: New phase.
['move-doc]: New phase.
[native-inputs]: Add docbook-xml, gettext-minimal, gsettings-desktop-schemas,
perl, libxml2 and xorg-server-for-tests.
[inputs]: Add bzip2, cairo, ccextractor, chromaprint, directfb, faac,
flite, glib, glib-networking, glu, gsm, iqa, lcms, libaom, libbs2b, libdc1394,
libdca, libde265, libdrm, libexif, libfdk, libgme, libmfx, libmms, libmpcdec,
libnice, libofa, libopenmpt, libtiff, libva, libx11, libxcb, libxext, libxshm, lilv,
lv2, mjpegtools, nettle, opencv, openh264, openni2, opensles, pango, rtmpdump,
sbc, sctp, spandsp, srt, svt-hevc, transcode, v4l-utils, vo-aacenc, vo-amrwbenc,
vulkan-headers, vulkan-loader, webrtc-audio-processing, wildmidi,
wpebackend-fdo, zbar and zxing-cpp.
[propagated-inputs]: Add gstreamer and gst-plugins-base.
[synopsis]: Modify.
[description]: Modify.
---
 gnu/packages/gstreamer.scm | 179 ++++++++++++++++++++++++++++---------
 1 file changed, 137 insertions(+), 42 deletions(-)

diff --git a/gnu/packages/gstreamer.scm b/gnu/packages/gstreamer.scm
index 05b0d9042f..d63873ec65 100644
--- a/gnu/packages/gstreamer.scm
+++ b/gnu/packages/gstreamer.scm
@@ -35,6 +35,7 @@
   #:use-module (guix build-system meson)
   #:use-module (guix utils)
   #:use-module (gnu packages)
+  #:use-module (gnu packages aidc)
   #:use-module (gnu packages audio)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
@@ -49,6 +50,7 @@
   #:use-module (gnu packages flex)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gettext)
+  #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
@@ -57,6 +59,7 @@
   #:use-module (gnu packages graphviz)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages image)
+  #:use-module (gnu packages image-processing)
   #:use-module (gnu packages iso-codes)
   #:use-module (gnu packages java)
   #:use-module (gnu packages libunwind)
@@ -65,10 +68,13 @@
   #:use-module (gnu packages maths)
   #:use-module (gnu packages mp3)
   #:use-module (gnu packages multiprecision)
+  #:use-module (gnu packages music)
   #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages nettle)
   #:use-module (gnu packages networking)
   #:use-module (gnu packages ocr)
   #:use-module (gnu packages perl)
+  #:use-module (gnu packages photo)
   #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages rdf)
@@ -76,13 +82,17 @@
   #:use-module (gnu packages shells)
   #:use-module (gnu packages video)
   #:use-module (gnu packages xorg)
+  #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xiph)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages speech)
   #:use-module (gnu packages python)
   #:use-module (gnu packages ssh)
   #:use-module (gnu packages telephony)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages version-control)
+  #:use-module (gnu packages vulkan)
+  #:use-module (gnu packages webkit)
   #:use-module (gnu packages assembly)
   #:use-module (gnu packages xml))
 
@@ -690,92 +700,177 @@ model to base your own plug-in on, here it is.")
   (package
     (name "gst-plugins-bad")
     (version "1.16.2")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "https://gstreamer.freedesktop.org/src/"
-                                  name "/" name "-" version ".tar.xz"))
-              (sha256
-               (base32
-                "0x0y0hm0ga3zqi5q4090hw5sjh59y1ry9ak16qsaascm72i7mjzi"))))
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://gstreamer.freedesktop.org/src/"
+                       name "/" name "-" version ".tar.xz"))
+       (sha256
+        (base32 "0x0y0hm0ga3zqi5q4090hw5sjh59y1ry9ak16qsaascm72i7mjzi"))))
     (build-system meson-build-system)
     (arguments
-     `(#:phases
+     `(#:glib-or-gtk? #t     ; To wrap binaries and/or compile schemas
+       #:phases
        (modify-phases %standard-phases
-         ,@%common-gstreamer-phases
-         ,@(if (string-prefix? "arm" (or (%current-target-system)
-                                         (%current-system)))
-               ;; Disable test that fails on ARMv7.
-               ;; https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1188
-               `((add-after 'unpack 'disable-asfmux-test
-                   (lambda _
-                     (substitute* "tests/check/meson.build"
-                       (("\\[\\['elements/asfmux\\.c'\\]\\],")
-                        ""))
-                     #t)))
-               '())
-         (add-after 'unpack 'disable-failing-test
+         (add-after 'unpack 'fix-build-errors
+           (lambda _
+             (substitute* "ext/vulkan/vkerror.c"
+               (("VK_RESULT_BEGIN_RANGE")
+                "VK_RESULT_MAX_ENUM"))
+             #t))
+         (add-after 'unpack 'patch-docbook-xml
+           (lambda* (#:key inputs #:allow-other-keys)
+             (with-directory-excursion "docs"
+               (substitute* '("libs/compiling.sgml"
+                              "libs/gst-plugins-bad-libs-docs.sgml"
+                              "plugins/gst-plugins-bad-plugins-docs.sgml")
+                 (("http://www.oasis-open.org/docbook/xml/4.1.2/")
+                  (string-append (assoc-ref inputs "docbook-xml")
+                                 "/xml/dtd/docbook/"))))
+             #t))
+         (add-after 'unpack 'disable-failing-tests
            (lambda _
-             ;; FIXME: Why is this failing.
              (substitute* "tests/check/meson.build"
-               ((".*elements/dash_mpd\\.c.*")
+               (("\\[\\['elements/msdkh264enc.c'\\], not have_msdk, \\[msdk_dep\\]\\],")
+                "")
+               (("\\[\\['elements/dash_mpd.c'\\], not xml2_dep.found\\(\\), \\[xml2_dep\\]\\],")
+                "")
+               (("\\[\\['elements/shm.c'\\], not shm_enabled, shm_deps\\],")
+                "")
+               (("\\[\\['elements/webrtcbin.c'\\], not libnice_dep.found\\(\\), \\[gstwebrtc_dep\\]\\],")
                 ""))
+             #t))
+         (add-before
+             'check 'pre-check
+           (lambda _
+             ;; Tests require a running X server.
+             (system "Xvfb :1 +extension GLX &")
+             (setenv "DISPLAY" ":1")
+             ;; Tests write to $HOME.
+             (setenv "HOME" (getcwd))
+             ;; Tests look for $XDG_RUNTIME_DIR.
+             (setenv "XDG_RUNTIME_DIR" (getcwd))
+             ;; For missing '/etc/machine-id'.
+             (setenv "DBUS_FATAL_WARNINGS" "0")
              #t)))))
-    (propagated-inputs
-     `(("gst-plugins-base" ,gst-plugins-base)))
     (native-inputs
-     `(("glib:bin" ,glib "bin") ; for glib-mkenums, etc.
+     `(("docbook-xml" ,docbook-xml-4.1.2)
+       ("gettext" ,gettext-minimal)
+       ("glib:bin" ,glib "bin")
        ("gobject-introspection" ,gobject-introspection)
-       ;; TODO: Enable documentation for 1.18.
-       ;;("gtk-doc" ,gtk-doc)
+       ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)
+       ("perl" ,perl)
        ("pkg-config" ,pkg-config)
-       ("python" ,python)))
+       ("python-wrapper" ,python-wrapper)
+       ("xorg-server" ,xorg-server-for-tests)))
     (inputs
-     ;; XXX: The following dependencies are missing:
-     ;;  vo-amrwbenc, vo-aacenc, bs2b, chromaprint, directfb, daala, libdts,
-     ;;  faac, flite, libgsm, libde265, libmms, libmimic, mjpegtools,
-     ;;  mpeg2enc, libofa, opencv, openh264, openni2, libtimemmgr, wildmidi,
-     ;;  openspc, gme, sbc, schroedinger, zbar, librtmp, spandsp
      `(("bluez" ,bluez)
+       ("bzip2" ,bzip2)
+       ("cairo" ,cairo)
+       ("ccextractor" ,ccextractor)
+       ("chromaprint" ,chromaprint)
        ("curl" ,curl)
+       ("directfb" ,directfb)
+       ;;("dssim" ,dssim)
+       ("faac" ,faac)
        ("faad2" ,faad2)
+       ("flite" ,flite)
        ("fluidsynth" ,fluidsynth)
+       ("glib" ,glib)
+       ("glib-networking" ,glib-networking)
+       ("glu" ,glu)
+       ("gsm" ,gsm)
        ("gtk+" ,gtk+)
+       ("iqa" ,iqa)
        ("ladspa" ,ladspa)
+       ("lcms" ,lcms)
+       ("libaom" ,libaom)
        ("libass" ,libass)
+       ("libbs2b" ,libbs2b)
+       ("libdc1394" ,libdc1394)
+       ("libdca" ,libdca)
+       ("libde265" ,libde265)
+       ("libdrm" ,libdrm)
        ("libdvdnav" ,libdvdnav)
        ("libdvdread" ,libdvdread)
+       ("libexif" ,libexif)
+       ("libfdk" ,libfdk)
        ("libgcrypt" ,libgcrypt)
+       ("libgme" ,libgme)
        ("libgudev" ,libgudev)
        ("libkate" ,libkate)
+       ("libmfx" ,mediasdk)
+       ("libmms" ,libmms)
        ("libmodplug" ,libmodplug)
+       ("libmpcdec" ,libmpcdec)
+       ("libnice" ,libnice)
+       ("libofa" ,libofa)
+       ("libopenmpt" ,libopenmpt)
        ("librsvg" ,librsvg)
        ("libsndfile" ,libsndfile)
        ("libsrtp" ,libsrtp)
        ("libssh2" ,libssh2)
+       ("libtiff" ,libtiff)
        ("libusb" ,libusb)
+       ("libva" ,libva)
        ("libvdpau" ,libvdpau)
        ("libwebp" ,libwebp)
+       ("libx11" ,libx11)
+       ("libxcb" ,libxcb)
+       ("libxext" ,libxext)
+       ("libxkbcommon" ,libxkbcommon)
        ("libxml2" ,libxml2)
+       ("libxshm" ,libxshmfence)
+       ("lilv" ,lilv)
        ("lrdf" ,lrdf)
+       ("lv2" ,lv2)
        ("mesa" ,mesa)
+       ("mjpegtools" ,mjpegtools)
        ("neon" ,neon)
+       ("nettle" ,nettle)
        ("openal" ,openal)
+       ("opencv" ,opencv)
        ("openexr" ,openexr)
+       ("openh264" ,openh264)
        ("openjpeg" ,openjpeg)
+       ("openni2" ,openni2)
+       ("opensles" ,opensles)
        ("openssl" ,openssl)
        ("opus" ,opus)
        ("orc" ,orc)
-       ;("qtbase" ,qtbase)
-       ;("qtdeclarative" ,qtdeclarative)
-       ;("qtx11extras" ,qtx11extras)
+       ("pango" ,pango)
+       ("rtmp" ,rtmpdump)
+       ("sbc" ,sbc)
+       ("sctp" ,lksctp-tools)
        ("soundtouch" ,soundtouch)
+       ("spandsp" ,spandsp)
+       ("srt" ,srt)
+       ("svthevcenc" ,svt-hevc)
+       ("tinyalsa" ,tinyalsa)
+       ("transcode" ,transcode)
+       ("v4l" ,v4l-utils)
+       ("voaacenc", vo-aacenc)
+       ("voamrwbenc" ,vo-amrwbenc)
+       ("vulkan-headers" ,vulkan-headers)
+       ("vulkan-loader" ,vulkan-loader)
        ("x265" ,x265)
-       ("wayland" ,wayland)))
+       ("wayland" ,wayland)
+       ("webrtcdsp" ,webrtc-audio-processing)
+       ("wildmidi" ,wildmidi)
+       ("wpebackend-fdo" ,wpebackend-fdo)
+       ;;("wpewebkit" ,wpewebkit)
+       ("zbar" ,zbar)
+       ("zxing" ,zxing-cpp)))
+    (propagated-inputs
+     `(("gstreamer" ,gstreamer)
+       ("gst-plugins-base" ,gst-plugins-base)))
+    (synopsis "GStreamer plugins and helper libraries")
+    (description "Gst-Plugins-Bad are Bad with a capital B.  They look fine on
+the outside, and might even appear to get the job done, but at the end of the
+day they're a black sheep.  Without a golden-haired angel to watch over them,
+they'll probably land in an unmarked grave at the final showdown.")
     (home-page "https://gstreamer.freedesktop.org/")
-    (synopsis "Plugins for the GStreamer multimedia library")
-    (description
-     "GStreamer Bad Plug-ins is a set of plug-ins whose quality aren't up to
-par compared to the rest.")
     (license license:lgpl2.0+)))
 
 (define-public gst-plugins-ugly
-- 
2.26.2


[-- Attachment #1.1.42: 0050-gnu-gst-plugins-ugly-Update-package-definition.patch --]
[-- Type: text/x-patch, Size: 4800 bytes --]

From 1b41ffd6da8efe18e8790bfe4d84a9e05b7bd0e8 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Sat, 4 Jul 2020 05:20:50 -0400
Subject: [PATCH 50/51] gnu: gst-plugins-ugly: Update package definition.

* gnu/packages/gstreamer.scm (gst-plugins-ugly): Update package definition.
[arguments]<#:glib-or-gtk?>: New argument.
<#:phases>['patch-docbook-xml]: New phase.
['pre-check]: New phase.
[native-inputs]: Add docbook-xml, gettext-minimal, gsettings-desktop-schemas,
perl and xorg-server-for-tests.
[inputs]: Add glib, glib-networking and opencore-amr. Remove gst-plugins-base.
[propagated-inputs]: Add gstreamer and gst-plugins-base.
[synopsis]: Modify.
[description]: Modify.
---
 gnu/packages/gstreamer.scm | 67 ++++++++++++++++++++++++++++----------
 1 file changed, 49 insertions(+), 18 deletions(-)

diff --git a/gnu/packages/gstreamer.scm b/gnu/packages/gstreamer.scm
index d63873ec65..858dbe2d5a 100644
--- a/gnu/packages/gstreamer.scm
+++ b/gnu/packages/gstreamer.scm
@@ -880,35 +880,66 @@ they'll probably land in an unmarked grave at the final showdown.")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "https://gstreamer.freedesktop.org/src/"
-                           name "/" name "-" version ".tar.xz"))
+       (uri
+        (string-append "https://gstreamer.freedesktop.org/src/"
+                       name "/" name "-" version ".tar.xz"))
        (sha256
-        (base32
-         "1jpvc32x6q01zjkfgh6gmq6aaikiyfwwnhj7bmvn52syhrdl202m"))))
+        (base32 "1jpvc32x6q01zjkfgh6gmq6aaikiyfwwnhj7bmvn52syhrdl202m"))))
     (build-system meson-build-system)
     (arguments
-     `(#:phases (modify-phases %standard-phases
-                  ,@%common-gstreamer-phases)))
+     `(#:glib-or-gtk? #t     ; To wrap binaries and/or compile schemas
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-docbook-xml
+           (lambda* (#:key inputs #:allow-other-keys)
+             (with-directory-excursion "docs"
+               (substitute* "plugins/gst-plugins-ugly-plugins-docs.sgml"
+                 (("http://www.oasis-open.org/docbook/xml/4.1.2/")
+                  (string-append (assoc-ref inputs "docbook-xml")
+                                 "/xml/dtd/docbook/"))))
+             #t))
+         (add-before
+             'check 'pre-check
+           (lambda _
+             ;; Tests require a running X server.
+             (system "Xvfb :1 +extension GLX &")
+             (setenv "DISPLAY" ":1")
+             ;; Tests write to $HOME.
+             (setenv "HOME" (getcwd))
+             ;; Tests look for $XDG_RUNTIME_DIR.
+             (setenv "XDG_RUNTIME_DIR" (getcwd))
+             ;; For missing '/etc/machine-id'.
+             (setenv "DBUS_FATAL_WARNINGS" "0")
+             #t)))))
+    (native-inputs
+     `(("docbook-xml" ,docbook-xml-4.1.2)
+       ("gettext" ,gettext-minimal)
+       ("glib:bin" ,glib "bin")
+       ("gobject-introspection" ,gobject-introspection)
+       ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)
+       ("perl" ,perl)
+       ("pkg-config" ,pkg-config)
+       ("python-wrapper" ,python-wrapper)
+       ("xorg-server" ,xorg-server-for-tests)))
     (inputs
-     `(("gst-plugins-base" ,gst-plugins-base)
+     `(("glib" ,glib)
+       ("glib-networking" ,glib-networking)
        ("liba52" ,liba52)
        ("libcdio" ,libcdio)
+       ("libdvdread" ,libdvdread)
        ("libmpeg2" ,libmpeg2)
        ("libdvdread" ,libdvdread)
        ("libx264" ,libx264)
-       ;; TODO:
-       ;; * opencore-amr (for the AMR-NB decoder and encoder and the
-       ;;   AMR-WB decoder) <http://sourceforge.net/projects/opencore-amr/>
+       ("opencore-amr" ,opencore-amr)
        ("orc" ,orc)))
-    (native-inputs
-     `(("glib:bin" ,glib "bin")
-       ("pkg-config" ,pkg-config)
-       ("python-wrapper" ,python-wrapper)))
+    (propagated-inputs
+     `(("gstreamer" ,gstreamer)
+       ("gst-plugins-base" ,gst-plugins-base)))
+    (synopsis "GStreamer plugins and helper libraries")
+    (description "Gst-Plugins-Ugly are the ones that might have a patent noose
+around their neck, or a lock-up license, or any other problem that makes you
+think twice about shipping them.")
     (home-page "https://gstreamer.freedesktop.org/")
-    (synopsis "GStreamer plugins from the \"ugly\" set")
-    (description "GStreamer Ugly Plug-ins.  This set contains those plug-ins
-which the developers consider to have good quality code but that might pose
-distribution problems in some jurisdictions, e.g. due to patent threats.")
     (license license:lgpl2.0+)))
 
 (define-public gst-libav
-- 
2.26.2


[-- Attachment #1.1.43: 0051-gnu-gst-libav-Update-package-definition.patch --]
[-- Type: text/x-patch, Size: 4388 bytes --]

From 21061a651f516d4df94f8a6a65775f4c41d92d76 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <raghavgururajan@disroot.org>
Date: Sat, 4 Jul 2020 05:21:57 -0400
Subject: [PATCH 51/51] gnu: gst-libav: Update package definition.

* gnu/packages/gstreamer.scm (gst-libav): Update package definition.
[arguments]<#:phases>['patch-docbook-xml]: New phase.
[native-inputs]: Add docbook-xml, perl and ruby.
[inputs]: Remove gst-plugins-base, orc and zlib.
[propagated-inputs]: Add gstreamer and gst-plugins-base.
[synopsis]: Modify.
[description]: Modify.
[license]: Change from gpl2+ to lgpl2.0+.
---
 gnu/packages/gstreamer.scm | 66 +++++++++++++++++++++++---------------
 1 file changed, 40 insertions(+), 26 deletions(-)

diff --git a/gnu/packages/gstreamer.scm b/gnu/packages/gstreamer.scm
index 858dbe2d5a..2d2e9c7995 100644
--- a/gnu/packages/gstreamer.scm
+++ b/gnu/packages/gstreamer.scm
@@ -85,6 +85,7 @@
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xiph)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages ruby)
   #:use-module (gnu packages speech)
   #:use-module (gnu packages python)
   #:use-module (gnu packages ssh)
@@ -928,7 +929,6 @@ they'll probably land in an unmarked grave at the final showdown.")
        ("libcdio" ,libcdio)
        ("libdvdread" ,libdvdread)
        ("libmpeg2" ,libmpeg2)
-       ("libdvdread" ,libdvdread)
        ("libx264" ,libx264)
        ("opencore-amr" ,opencore-amr)
        ("orc" ,orc)))
@@ -946,35 +946,49 @@ think twice about shipping them.")
   (package
     (name "gst-libav")
     (version "1.16.2")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append
-                    "https://gstreamer.freedesktop.org/src/" name "/"
-                    name "-" version ".tar.xz"))
-              (sha256
-               (base32
-                "1wpfilc98bad9nsv3y1qapxp35dvn2mvwvrmqwrsj58cf09gc967"))
-              (modules '((guix build utils)))
-              (snippet
-               '(begin
-                  ;; Drop bundled ffmpeg.
-                  (delete-file-recursively "gst-libs/ext/libav")
-                  #t))))
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append
+         "https://gstreamer.freedesktop.org/src/" name "/"
+         name "-" version ".tar.xz"))
+       (sha256
+        (base32 "1wpfilc98bad9nsv3y1qapxp35dvn2mvwvrmqwrsj58cf09gc967"))
+       (modules '((guix build utils)))
+       (snippet
+        '(begin
+           ;; Drop bundled ffmpeg.
+           (delete-file-recursively "gst-libs/ext/libav")
+           #t))))
     (build-system meson-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-docbook-xml
+           (lambda* (#:key inputs #:allow-other-keys)
+             (with-directory-excursion "docs"
+               (substitute* "plugins/gst-libav-plugins-docs.sgml"
+                 (("http://www.oasis-open.org/docbook/xml/4.1.2/")
+                  (string-append (assoc-ref inputs "docbook-xml")
+                                 "/xml/dtd/docbook/"))))
+             #t)))))
     (native-inputs
-     `(("pkg-config" ,pkg-config)
-       ("python" ,python)))
+     `(("docbook-xml" ,docbook-xml-4.1.2)
+       ("perl" ,perl)
+       ("pkg-config" ,pkg-config)
+       ("python" ,python-wrapper)
+       ("ruby" ,ruby)))
     (inputs
-     `(("gst-plugins-base" ,gst-plugins-base)
-       ("ffmpeg" ,ffmpeg)
-       ("orc" ,orc)
-       ("zlib" ,zlib)))
+     `(("ffmpeg" ,ffmpeg)))
+    (propagated-inputs
+     `(("gstreamer" ,gstreamer)
+       ("gst-plugins-base" ,gst-plugins-base)))
+    (synopsis "GStreamer plugins and helper libraries")
+    (description "Gst-Libav contains a GStreamer plugin for using the encoders,
+decoders, muxers, and demuxers provided by FFmpeg.")
     (home-page "https://gstreamer.freedesktop.org/")
-    (synopsis "Plugins for the GStreamer multimedia library")
-    (description
-     "This GStreamer plugin supports a large number of audio and video
-compression formats through the use of the libav library.")
-    (license license:gpl2+)))
+    (license license:lgpl2.0+)))
 
 (define-public gst-editing-services
   (package
-- 
2.26.2


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-07-04 10:40 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-06  9:13 [OUTREACHY]: Integration of desktop environments into GNU Guix Raghav Gururajan
2020-05-06 14:19 ` Ludovic Courtès
2020-05-06 15:05   ` Gábor Boskovits
2020-05-06 15:49 ` Ricardo Wurmus
2020-05-06 16:03   ` Raghav Gururajan
2020-05-06 15:52 ` sirgazil
2020-05-06 16:04   ` Raghav Gururajan
2020-05-06 17:22 ` Jan Nieuwenhuizen
2020-05-06 17:23   ` Raghav Gururajan
2020-05-20 13:34 ` Raghav Gururajan
2020-05-20 13:51   ` Pierre Neidhardt
2020-05-20 13:57     ` Raghav Gururajan
2020-05-20 14:06       ` Pierre Neidhardt
2020-05-21  9:08   ` Efraim Flashner
2020-05-22 11:18     ` Raghav Gururajan
2020-05-22 11:25   ` Raghav Gururajan
2020-05-23 14:26     ` Raghav Gururajan
2020-05-25 20:08       ` Danny Milosavljevic
2020-05-28 17:11         ` Raghav Gururajan
2020-05-28 17:10       ` Raghav Gururajan
2020-05-28 18:23         ` Danny Milosavljevic
2020-05-29 21:01           ` Raghav Gururajan
2020-05-29 23:02             ` Danny Milosavljevic
2020-05-29 20:54         ` Raghav Gururajan
2020-05-29 21:08           ` Raghav Gururajan
2020-05-30 20:30             ` Raghav Gururajan
2020-05-31 13:31               ` Danny Milosavljevic
2020-06-10 13:12                 ` Raghav Gururajan
2020-06-04 18:31               ` Raghav Gururajan
2020-06-04 18:52                 ` Vincent Legoll
2020-06-10 13:06                   ` Raghav Gururajan
2020-06-04 18:57                 ` Danny Milosavljevic
2020-06-14 13:31                 ` Raghav Gururajan
2020-06-19 23:37                   ` Raghav Gururajan
2020-06-24 22:40                     ` Danny Milosavljevic
2020-07-04 10:37                       ` Raghav Gururajan [this message]
2020-07-04 11:14                         ` Raghav Gururajan
2020-07-06  1:36                           ` Raghav Gururajan
2020-07-06 19:24                           ` Danny Milosavljevic
2020-07-06 19:56                             ` Efraim Flashner
2020-07-05 19:25                         ` Danny Milosavljevic
2020-07-06  5:05                           ` Raghav Gururajan
2020-07-13 13:45                             ` Ludovic Courtès
2020-07-13 13:50                               ` Raghav Gururajan
2020-07-16  1:21                             ` Raghav Gururajan
2020-07-17 12:38                               ` Danny Milosavljevic
2020-07-18 13:29                                 ` Raghav Gururajan
2020-07-18 14:12                                   ` Danny Milosavljevic
2020-07-18 19:27                                     ` Raghav Gururajan
2020-07-18 20:18                                       ` Raghav Gururajan
2020-07-19 11:43                                         ` Danny Milosavljevic
2020-07-19 19:21                                         ` Danny Milosavljevic
2020-07-19 19:22                                   ` Danny Milosavljevic
2020-07-20  1:54                                     ` Raghav Gururajan
2020-07-24 18:29                                       ` Raghav Gururajan
2020-07-25  8:15                                         ` Raghav Gururajan
2020-07-25  8:18                                           ` Raghav Gururajan
2020-07-25  8:24                                             ` Raghav Gururajan
2020-07-25  9:12                                               ` Raghav Gururajan
2020-07-27 16:11                                                 ` Raghav Gururajan
2020-07-30 23:51                                                   ` Raghav Gururajan
2020-08-02  7:32                                                   ` Raghav Gururajan
2020-08-03 22:29                                                     ` Danny Milosavljevic
2020-08-04 10:22                                                       ` Raghav Gururajan
2020-08-04 22:50                                                         ` Raghav Gururajan
2020-08-05 15:14                                                           ` Danny Milosavljevic
2020-08-07  2:14                                                             ` Raghav Gururajan
2020-08-09 22:28                                                               ` Danny Milosavljevic
2020-08-11 10:38                                                                 ` Raghav Gururajan
2020-08-12  4:05                                                                   ` Raghav Gururajan
2020-08-12  4:11                                                                     ` Raghav Gururajan
2020-08-12  8:02                                                                       ` Danny Milosavljevic
2020-08-19 15:06                                                                         ` Raghav Gururajan
2020-08-22 14:48                                                                           ` Pierre Neidhardt
2020-08-24  3:18                                                                           ` Maxim Cournoyer
2020-08-14 14:24                                                               ` [20.08.2020 Hartmut Goebel
2020-08-14 14:28                                                                 ` [20.08.2020 Raghav Gururajan
2020-06-24 11:37                   ` [OUTREACHY]: Integration of desktop environments into GNU Guix Danny Milosavljevic
2020-06-25  4:04                     ` Raghav Gururajan
2020-06-25 11:47                       ` Danny Milosavljevic
2020-06-28  5:56                         ` Raghav Gururajan
2020-06-25 11:52                       ` Danny Milosavljevic
2020-05-25 19:58     ` Danny Milosavljevic
2020-05-25 20:00     ` Danny Milosavljevic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8c2fb558-249e-e96c-d2b2-ef53d3adfd00@disroot.org \
    --to=raghavgururajan@disroot.org \
    --cc=dannym@scratchpost.org \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).