From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 0IlPC8tAvl5kWQAA0tVLHw (envelope-from ) for ; Fri, 15 May 2020 07:12:11 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id QDQRB8tAvl4PZAAA1q6Kng (envelope-from ) for ; Fri, 15 May 2020 07:12:11 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 6A7F4940144 for ; Fri, 15 May 2020 07:12:10 +0000 (UTC) Received: from localhost ([::1]:44484 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZUVt-0001BR-5c for larch@yhetil.org; Fri, 15 May 2020 03:12:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZUVm-0001AL-So for guix-patches@gnu.org; Fri, 15 May 2020 03:12:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52427) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZUVm-0006m0-IS for guix-patches@gnu.org; Fri, 15 May 2020 03:12:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jZUVm-0007S4-EO for guix-patches@gnu.org; Fri, 15 May 2020 03:12:02 -0400 Subject: bug#40677: [PATCH v5] gnu: Add ffmpeg-jami. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-To: guix-patches@gnu.org Resent-Date: Fri, 15 May 2020 07:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 40677 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: Jan Wielkiewicz Cc: 40677-done@debbugs.gnu.org Mail-Followup-To: 40677@debbugs.gnu.org, othacehe@gnu.org, tona_kosmicznego_smiecia@interia.pl Received: via spool by 40677-done@debbugs.gnu.org id=D40677.158952668528595 (code D ref 40677); Fri, 15 May 2020 07:12:02 +0000 Received: (at 40677-done) by debbugs.gnu.org; 15 May 2020 07:11:25 +0000 Received: from localhost ([127.0.0.1]:35739 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZUVB-0007R9-4C for submit@debbugs.gnu.org; Fri, 15 May 2020 03:11:25 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60418) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZUV8-0007Qt-Rw for 40677-done@debbugs.gnu.org; Fri, 15 May 2020 03:11:23 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:52410) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZUV2-0006fI-UN; Fri, 15 May 2020 03:11:16 -0400 Received: from [2a01:cb18:832e:5f00:5cdd:cc67:a2e1:e2f0] (port=58060 helo=meru) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jZUV2-00050W-9u; Fri, 15 May 2020 03:11:16 -0400 From: Mathieu Othacehe References: <20200417015857.0650ff6a@interia.pl> <20200515004705.11286-1-tona_kosmicznego_smiecia@interia.pl> Date: Fri, 15 May 2020 09:11:14 +0200 In-Reply-To: <20200515004705.11286-1-tona_kosmicznego_smiecia@interia.pl> (Jan Wielkiewicz's message of "Fri, 15 May 2020 02:47:05 +0200") Message-ID: <87mu69wu3x.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: -1.01 X-TUID: T58f37h1Faa9 Pushed with minor modifications. Thanks for your work, Mathieu Jan Wielkiewicz writes: > This package is needed, because Jami uses a modified version > of ffmpeg, which provides GPU hardware acceleration, automatical > adapting of bitrate and extra codecs. Because of the configure flags > list being long, it is better to keep them separated in variables, > instead of littering the package definition. > > * gnu/packages/jami.scm (ffmpeg-jami, %ffmpeg-default-configure-flags, > %ffmpeg-linux-configure-flags, %ffmpeg-linux-x86-configure-flags): > New variables. > (ffmpeg-compose-configure-flags): New procedure. > (libring)[inputs]: Use ffmpeg-jami instead of ffmpeg. > --- > gnu/packages/jami.scm | 248 +++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 246 insertions(+), 2 deletions(-) > > diff --git a/gnu/packages/jami.scm b/gnu/packages/jami.scm > index dda787b3cd..dea5e7d3b8 100644 > --- a/gnu/packages/jami.scm > +++ b/gnu/packages/jami.scm > @@ -59,7 +59,8 @@ > #:use-module (guix download) > #:use-module (guix git-download) > #:use-module (guix packages) > - #:use-module (guix utils)) > + #:use-module (guix utils) > + #:use-module (srfi srfi-1)) > > (define %jami-version "20200401.1.6f090de") > > @@ -186,6 +187,249 @@ > "selftest: pjlib-test pjlib-util-test pjmedia-test")) > #t))))))) > > +;; The following variables are configure flags used by ffmpeg-jami. > +;; They're from the ring-project/daemon/contrib/src/ffmpeg/rules.mak > +;; file. We try to keep it as close to the official Jami package as > +;; possible to provide all the codecs and extra features that are > +;; the effect of patching ffmpeg. > +;; > +;; Web view of the file: > +;;https://review.jami.net/plugins/gitiles/ring-daemon/+/refs/heads/master/contrib/src/ffmpeg/rules.mak > +(define %ffmpeg-default-configure-flags > + '(;; disable everything > + "--disable-everything" > + "--enable-zlib" > + "--enable-gpl" > + "--enable-swscale" > + "--enable-bsfs" > + "--disable-filters" > + "--disable-programs" > + "--disable-postproc" > + "--disable-protocols" > + "--enable-protocol=crypto" > + "--enable-protocol=file" > + "--enable-protocol=rtp" > + "--enable-protocol=srtp" > + "--enable-protocol=tcp" > + "--enable-protocol=udp" > + "--enable-protocol=unix" > + "--enable-protocol=pipe" > + ;; enable muxers/demuxers > + "--disable-demuxers" > + "--disable-muxers" > + "--enable-muxer=rtp" > + "--enable-muxer=g722" > + "--enable-muxer=h263" > + "--enable-muxer=h264" > + "--enable-muxer=hevc" > + "--enable-muxer=webm" > + "--enable-muxer=ogg" > + "--enable-muxer=pcm_s16be" > + "--enable-muxer=pcm_s16le" > + "--enable-demuxer=rtp" > + "--enable-demuxer=mjpeg" > + "--enable-demuxer=mjpeg_2000" > + "--enable-demuxer=mpegvideo" > + "--enable-demuxer=gif" > + "--enable-demuxer=image_jpeg_pipe" > + "--enable-demuxer=image_png_pipe" > + "--enable-demuxer=image_webp_pipe" > + "--enable-demuxer=matroska" > + "--enable-demuxer=m4v" > + "--enable-demuxer=mp3" > + "--enable-demuxer=ogg" > + "--enable-demuxer=flac" > + "--enable-demuxer=wav" > + "--enable-demuxer=ac3" > + "--enable-demuxer=g722" > + "--enable-demuxer=pcm_mulaw" > + "--enable-demuxer=pcm_alaw" > + "--enable-demuxer=pcm_s16be" > + "--enable-demuxer=pcm_s16le" > + "--enable-demuxer=h263" > + "--enable-demuxer=h264" > + "--enable-demuxer=hevc" > + ;; enable parsers > + "--enable-parser=h263" > + "--enable-parser=h264" > + "--enable-parser=hevc" > + "--enable-parser=mpeg4video" > + "--enable-parser=vp8" > + "--enable-parser=vp9" > + "--enable-parser=opus" > + ;; encoders/decoders > + "--enable-encoder=adpcm_g722" > + "--enable-decoder=adpcm_g722" > + "--enable-encoder=rawvideo" > + "--enable-decoder=rawvideo" > + "--enable-encoder=libx264" > + "--enable-decoder=h264" > + "--enable-encoder=pcm_alaw" > + "--enable-decoder=pcm_alaw" > + "--enable-encoder=pcm_mulaw" > + "--enable-decoder=pcm_mulaw" > + "--enable-encoder=mpeg4" > + "--enable-decoder=mpeg4" > + "--enable-encoder=libvpx_vp8" > + "--enable-decoder=vp8" > + "--enable-decoder=vp9" > + "--enable-encoder=h263" > + "--enable-encoder=h263p" > + "--enable-decoder=h263" > + "--enable-encoder=mjpeg" > + "--enable-decoder=mjpeg" > + "--enable-decoder=mjpegb" > + "--enable-libspeex" > + "--enable-libopus" > + "--enable-libvpx" > + "--enable-libx264" > + "--enable-encoder=libspeex" > + "--enable-decoder=libspeex" > + "--enable-encoder=libopus" > + "--enable-decoder=libopus" > + ;; decoders for ringtones and audio streaming > + "--enable-decoder=flac" > + "--enable-decoder=vorbis" > + "--enable-decoder=aac" > + "--enable-decoder=ac3" > + "--enable-decoder=eac3" > + "--enable-decoder=mp3" > + "--enable-decoder=pcm_u24be" > + "--enable-decoder=pcm_u24le" > + "--enable-decoder=pcm_u32be" > + "--enable-decoder=pcm_u32le" > + "--enable-decoder=pcm_u8" > + "--enable-decoder=pcm_f16le" > + "--enable-decoder=pcm_f24le" > + "--enable-decoder=pcm_f32be" > + "--enable-decoder=pcm_f32le" > + "--enable-decoder=pcm_f64be" > + "--enable-decoder=pcm_f64le" > + "--enable-decoder=pcm_s16be" > + "--enable-decoder=pcm_s16be_planar" > + "--enable-decoder=pcm_s16le" > + "--enable-decoder=pcm_s16le_planar" > + "--enable-decoder=pcm_s24be" > + "--enable-decoder=pcm_s24le" > + "--enable-decoder=pcm_s24le_planar" > + "--enable-decoder=pcm_s32be" > + "--enable-decoder=pcm_s32le" > + "--enable-decoder=pcm_s32le_planar" > + "--enable-decoder=pcm_s64be" > + "--enable-decoder=pcm_s64le" > + "--enable-decoder=pcm_s8" > + "--enable-decoder=pcm_s8_planar" > + "--enable-decoder=pcm_u16be" > + "--enable-decoder=pcm_u16le" > + ;; encoders/decoders for images > + "--enable-encoder=gif" > + "--enable-decoder=gif" > + "--enable-encoder=jpegls" > + "--enable-decoder=jpegls" > + "--enable-encoder=ljpeg" > + "--enable-decoder=jpeg2000" > + "--enable-encoder=png" > + "--enable-decoder=png" > + "--enable-encoder=bmp" > + "--enable-decoder=bmp" > + "--enable-encoder=tiff" > + "--enable-decoder=tiff" > + ;; filters > + "--enable-filter=scale" > + "--enable-filter=overlay" > + "--enable-filter=amix" > + "--enable-filter=amerge" > + "--enable-filter=aresample" > + "--enable-filter=format" > + "--enable-filter=aformat" > + "--enable-filter=fps" > + "--enable-filter=transpose" > + "--enable-filter=pad")) > + > +(define %ffmpeg-linux-configure-flags > + '("--enable-pic" > + "--extra-cxxflags=-fPIC" > + "--extra-cflags=-fPIC" > + "--target-os=linux" > + "--enable-indev=v4l2" > + "--enable-indev=xcbgrab" > + "--enable-vdpau" > + "--enable-hwaccel=h264_vdpau" > + "--enable-hwaccel=mpeg4_vdpau" > + "--enable-vaapi" > + "--enable-hwaccel=h264_vaapi" > + "--enable-hwaccel=mpeg4_vaapi" > + "--enable-hwaccel=h263_vaapi" > + "--enable-hwaccel=vp8_vaapi" > + "--enable-hwaccel=mjpeg_vaapi" > + "--enable-hwaccel=hevc_vaapi" > + "--enable-encoder=h264_vaapi" > + "--enable-encoder=vp8_vaapi" > + "--enable-encoder=mjpeg_vaapi" > + "--enable-encoder=hevc_vaapi")) > + > +;; ffnvcodec is not supported on ARM then we enable it here for i386 and x86_64 > +(define %ffmpeg-linux-x86-configure-flags > + '("--arch=x86" > + "--enable-cuvid" > + "--enable-ffnvcodec" > + "--enable-nvdec" > + "--enable-nvenc" > + "--enable-hwaccel=h264_nvdec" > + "--enable-hwaccel=hevc_nvdec" > + "--enable-hwaccel=vp8_nvdec" > + "--enable-hwaccel=mjpeg_nvdec" > + "--enable-encoder=h264_nvenc" > + "--enable-encoder=hevc_nvenc")) > + > +;; This procedure composes the configure flags list for ffmpeg-jami. > +(define (ffmpeg-compose-configure-flags) > + (define (system=? s) > + (string-prefix? s (%current-system))) > + `(,@%ffmpeg-default-configure-flags > + ,@(if (string-contains (%current-system) "linux") > + (if (or (system=? "i686") > + (system=? "x86_64")) > + (append %ffmpeg-linux-configure-flags > + %ffmpeg-linux-x86-configure-flags) > + %ffmpeg-linux-configure-flags) > + '()))) > + > +(define-public ffmpeg-jami > + (package > + (inherit ffmpeg) > + (name "ffmpeg-jami") > + (native-inputs > + `(("sfl-patches" ,(jami-source)) > + ("libiconv" ,libiconv) > + ,@(package-native-inputs ffmpeg))) > + (supported-systems '("x86_64-linux" "i686-linux" > + "aarch64-linux" "armhf-linux")) > + (arguments > + (append > + '(#:tests? #f) > + (substitute-keyword-arguments (package-arguments ffmpeg) > + ((#:configure-flags '()) > + (ffmpeg-compose-configure-flags)) > + ((#:phases phases) > + `(modify-phases ,phases > + (add-after 'unpack 'make-git-checkout-writable > + (lambda _ > + (for-each make-file-writable (find-files ".")) > + #t)) > + (add-after 'unpack 'apply-patches > + (lambda* (#:key inputs #:allow-other-keys) > + (let ((jami-apply-dependency-patches ,jami-apply-dependency-patches)) > + ;; These patches come from: > + ;; "ring-project/daemon/contrib/src/ffmpeg/rules.mak". > + (jami-apply-dependency-patches #:inputs inputs > + #:dep-name "ffmpeg" > + #:patches > + '("remove-mjpeg-log" > + "change-RTCP-ratio" > + "rtp_ext_abs_send_time")) > + #t)))))))))) > + > (define-public libring > (package > (name "libring") > @@ -197,7 +441,7 @@ > ("boost" ,boost) > ("dbus-c++" ,dbus-c++) > ("eudev" ,eudev) > - ("ffmpeg" ,ffmpeg) > + ("ffmpeg" ,ffmpeg-jami) > ("flac" ,flac) > ("gmp" ,gmp) > ("gsm" ,gsm)