[packages/asterisk] Add Opus codec and VP8 passthrough

jajcus jajcus at pld-linux.org
Wed Mar 9 13:15:43 CET 2016


commit 4dd6f92bd782fd650813bbc11bcd2b38aaace8ef
Author: Jacek Konieczny <j.konieczny at eggsoft.pl>
Date:   Wed Mar 9 13:03:20 2016 +0100

    Add Opus codec and VP8 passthrough
    
    From https://github.com/seanbright/asterisk-opus/
    
    Please note, Asterisk has opus dependency even without this. That is
    also the reason why I have decided not to create a new subpackage(s).

 asterisk-opus.patch | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 asterisk.spec       | 27 +++++++++++++++++++++--
 2 files changed, 88 insertions(+), 2 deletions(-)
---
diff --git a/asterisk.spec b/asterisk.spec
index cc36545..fb7e8f8 100644
--- a/asterisk.spec
+++ b/asterisk.spec
@@ -28,15 +28,18 @@
 %bcond_without	odbc		# build without ODBC support
 %bcond_without	radius		# build without Radius support
 %bcond_without	pjsip		# build without PJSIP stack
+%bcond_without	opus_vp8	# build without Opus codec and VP8 passthrough
 
 %bcond_without	apidocs		# disable apidocs building
 %bcond_without	verbose		# verbose build
 
+%define	opus_commit	058319d6ad464c79bbea71cf589883af62a18548
+
 Summary:	Asterisk PBX
 Summary(pl.UTF-8):	Centralka (PBX) Asterisk
 Name:		asterisk
 Version:	13.7.2
-Release:	1
+Release:	2
 License:	GPL v2
 Group:		Applications/System
 Source0:	http://downloads.digium.com/pub/asterisk/releases/%{name}-%{version}.tar.gz
@@ -49,6 +52,9 @@ Source5:	%{name}.service
 # menuselect.* -> make menuconfig; choose options; copy resulting files here
 Source6:	menuselect.makedeps
 Source7:	menuselect.makeopts
+# https://github.com/seanbright/asterisk-opus/
+Source8:	https://github.com/seanbright/asterisk-opus/archive/%{opus_commit}/asterisk-opus-%{opus_commit}.tar.gz
+# Source8-md5:	2cc55d2036ee4b7e5a44ea5e2d7280f3
 Patch0:		lua51-path.patch
 Patch1:		%{name}-ppc.patch
 Patch2:		FHS-paths.patch
@@ -57,6 +63,7 @@ Patch4:		lpc10-system.patch
 Patch5:		%{name}-histedit.patch
 Patch6:		x32.patch
 Patch7:		%{name}-ilbc.patch
+Patch8:		asterisk-opus.patch
 URL:		http://www.asterisk.org/
 BuildRequires:	OSPToolkit-devel >= 4.0.0
 %{?with_oss:BuildRequires:	SDL-devel}
@@ -728,7 +735,7 @@ API documentation for Asterisk.
 Dokumentacja API Asteriska.
 
 %prep
-%setup -q
+%setup -q -a 8
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
@@ -738,6 +745,13 @@ Dokumentacja API Asteriska.
 %patch6 -p1
 %patch7 -p1
 
+%if %{with opus_vp8}
+%patch8 -p1
+
+cp -a asterisk-opus-%{opus_commit}/codecs/* codecs
+cp -a asterisk-opus-%{opus_commit}/formats/* formats
+%endif
+
 # Fixup makefile so sound archives aren't downloaded/installed
 %{__sed} -i -e 's/^all:.*$/all:/' sounds/Makefile
 %{__sed} -i -e 's/^install:.*$/install:/' sounds/Makefile
@@ -1210,6 +1224,9 @@ chown -R asterisk:asterisk /var/lib/asterisk
 %attr(755,root,root) %{_libdir}/asterisk/modules/codec_alaw.so
 %attr(755,root,root) %{_libdir}/asterisk/modules/codec_g722.so
 %attr(755,root,root) %{_libdir}/asterisk/modules/codec_g726.so
+%if %{with opus_vp8}
+%attr(755,root,root) %{_libdir}/asterisk/modules/codec_opus.so
+%endif
 %attr(755,root,root) %{_libdir}/asterisk/modules/codec_ulaw.so
 %attr(755,root,root) %{_libdir}/asterisk/modules/format_g719.so
 %attr(755,root,root) %{_libdir}/asterisk/modules/format_g723.so
@@ -1223,6 +1240,9 @@ chown -R asterisk:asterisk /var/lib/asterisk
 %attr(755,root,root) %{_libdir}/asterisk/modules/format_siren7.so
 %attr(755,root,root) %{_libdir}/asterisk/modules/format_sln.so
 %attr(755,root,root) %{_libdir}/asterisk/modules/format_vox.so
+%if %{with opus_vp8}
+%attr(755,root,root) %{_libdir}/asterisk/modules/format_vp8.so
+%endif
 %attr(755,root,root) %{_libdir}/asterisk/modules/format_wav.so
 %attr(755,root,root) %{_libdir}/asterisk/modules/func_aes.so
 %attr(755,root,root) %{_libdir}/asterisk/modules/func_audiohookinherit.so
@@ -1300,6 +1320,9 @@ chown -R asterisk:asterisk /var/lib/asterisk
 %attr(755,root,root) %{_libdir}/asterisk/modules/res_format_attr_h264.so
 %attr(755,root,root) %{_libdir}/asterisk/modules/res_format_attr_opus.so
 %attr(755,root,root) %{_libdir}/asterisk/modules/res_format_attr_silk.so
+%if %{with opus_vp8}
+%attr(755,root,root) %{_libdir}/asterisk/modules/res_format_attr_vp8.so
+%endif
 %attr(755,root,root) %{_libdir}/asterisk/modules/res_http_websocket.so
 %attr(755,root,root) %{_libdir}/asterisk/modules/res_limit.so
 %attr(755,root,root) %{_libdir}/asterisk/modules/res_manager_devicestate.so
diff --git a/asterisk-opus.patch b/asterisk-opus.patch
new file mode 100644
index 0000000..330523e
--- /dev/null
+++ b/asterisk-opus.patch
@@ -0,0 +1,63 @@
+diff -dur asterisk-13.7.2.orig/main/codec_builtin.c asterisk-13.7.2/main/codec_builtin.c
+--- asterisk-13.7.2.orig/main/codec_builtin.c	2016-02-05 21:32:40.000000000 +0100
++++ asterisk-13.7.2/main/codec_builtin.c	2016-03-09 11:55:44.000000000 +0100
+@@ -38,6 +38,8 @@
+ #include "asterisk/format_cache.h"
+ #include "asterisk/frame.h"
+ 
++#include <opus/opus.h>
++
+ enum frame_type {
+ 	TYPE_HIGH,     /* 0x0 */
+ 	TYPE_LOW,      /* 0x1 */
+@@ -698,6 +700,11 @@
+ 	.get_length = g719_length,
+ };
+ 
++static int opus_samples(struct ast_frame *frame)
++{
++	return opus_packet_get_nb_samples(frame->data.ptr, frame->datalen, 48000);
++}
++
+ static struct ast_codec opus = {
+ 	.name = "opus",
+ 	.description = "Opus Codec",
+@@ -707,6 +714,7 @@
+ 	.maximum_ms = 60,
+ 	.default_ms = 20,
+ 	.minimum_bytes = 10,
++	.samples_count = opus_samples,
+ };
+ 
+ static struct ast_codec jpeg = {
+diff -dur asterisk-13.7.2.orig/main/Makefile asterisk-13.7.2/main/Makefile
+--- asterisk-13.7.2.orig/main/Makefile	2016-03-09 11:53:45.000000000 +0100
++++ asterisk-13.7.2/main/Makefile	2016-03-09 11:55:44.000000000 +0100
+@@ -40,6 +40,7 @@
+ AST_LIBS+=$(URIPARSER_LIB)
+ AST_LIBS+=$(UUID_LIB)
+ AST_LIBS+=$(CRYPT_LIB)
++AST_LIBS+=$(OPUS_LIB)
+ AST_LIBS+=$(AST_CLANG_BLOCKS_LIBS)
+ 
+ ifneq ($(findstring $(OSARCH), linux-gnu linux-gnux32 uclinux linux-uclibc kfreebsd-gnu),)
+@@ -160,6 +161,7 @@
+ bucket.o: _ASTCFLAGS+=$(URIPARSER_INCLUDE)
+ crypt.o: _ASTCFLAGS+=$(CRYPT_INCLUDE)
+ uuid.o: _ASTCFLAGS+=$(UUID_INCLUDE)
++codec_builtin.o: _ASTCFLAGS+=$(OPUS_INCLUDE)
+ 
+ ifneq ($(findstring ENABLE_UPLOADS,$(MENUSELECT_CFLAGS)),)
+ http.o: _ASTCFLAGS+=$(GMIME_INCLUDE)
+diff -dur asterisk-13.7.2.orig/main/Makefile.orig asterisk-13.7.2/main/Makefile.orig
+--- asterisk-13.7.2.orig/main/Makefile.orig	2016-02-05 21:32:40.000000000 +0100
++++ asterisk-13.7.2/main/Makefile.orig	2016-03-09 11:53:45.000000000 +0100
+@@ -42,7 +42,7 @@
+ AST_LIBS+=$(CRYPT_LIB)
+ AST_LIBS+=$(AST_CLANG_BLOCKS_LIBS)
+ 
+-ifneq ($(findstring $(OSARCH), linux-gnu uclinux linux-uclibc kfreebsd-gnu),)
++ifneq ($(findstring $(OSARCH), linux-gnu linux-gnux32 uclinux linux-uclibc kfreebsd-gnu),)
+   ifneq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
+   AST_LIBS+=-ldl
+   endif
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/asterisk.git/commitdiff/1fcbde87cefa72ea4de7f4af31acdea832517333



More information about the pld-cvs-commit mailing list