summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2013-08-23 15:42:27 +0000
committerMatthew Jordan <mjordan@digium.com>2013-08-23 15:42:27 +0000
commit4d348e853cbd9ba7bc976487bfcb352a84e5ece0 (patch)
treefdf289e34cd706884aed7a262409fc3cdcba9bd1 /include
parente31bd332b83f0245ce8bd6626279e1b9c683ec18 (diff)
Add pass through support for Opus and VP8; Opus format attribute negotiation
This patch adds pass through support for Opus and VP8. That includes: * Format attribute negotiation for Opus. Note that unlike some other codecs, the draft RFC specifies having spaces delimiting the attributes in addition to ';', so you have "attra=X; attrb=Y". This broke the attribute parsing in chan_sip, so a small tweak was also included in this patch for that. * A format attribute negotiation module for Opus, res_format_attr_opus * Fast picture update for VP8. Since VP8 uses a different RTCP packet number than FIR, this really is specific to VP8 at this time. Note that the format attribute negotiation in res_pjsip_sdp_rtp was written by mjordan. The rest of this patch was written completely by Lorenzo Miniero. Review: https://reviewboard.asterisk.org/r/2723/ (closes issue ASTERISK-21981) Reported by: Tzafrir Cohen patches: asterisk_opus+vp8_passthrough_20130718.patch uploaded by lminiero (License 6518) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397526 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/format.h5
-rw-r--r--include/asterisk/opus.h41
2 files changed, 46 insertions, 0 deletions
diff --git a/include/asterisk/format.h b/include/asterisk/format.h
index ab7d8eefb..885c62b2d 100644
--- a/include/asterisk/format.h
+++ b/include/asterisk/format.h
@@ -29,6 +29,7 @@
#include "asterisk/astobj2.h"
#include "asterisk/silk.h"
#include "asterisk/celt.h"
+#include "asterisk/opus.h"
#define AST_FORMAT_ATTR_SIZE 64
#define AST_FORMAT_INC 100000
@@ -101,6 +102,8 @@ enum ast_format_id {
AST_FORMAT_SLINEAR192 = 27 + AST_FORMAT_TYPE_AUDIO,
AST_FORMAT_SPEEX32 = 28 + AST_FORMAT_TYPE_AUDIO,
AST_FORMAT_CELT = 29 + AST_FORMAT_TYPE_AUDIO,
+ /*! Opus */
+ AST_FORMAT_OPUS = 30 + AST_FORMAT_TYPE_AUDIO,
/*! H.261 Video */
AST_FORMAT_H261 = 1 + AST_FORMAT_TYPE_VIDEO,
@@ -112,6 +115,8 @@ enum ast_format_id {
AST_FORMAT_H264 = 4 + AST_FORMAT_TYPE_VIDEO,
/*! MPEG4 Video */
AST_FORMAT_MP4_VIDEO = 5 + AST_FORMAT_TYPE_VIDEO,
+ /*! VP8 */
+ AST_FORMAT_VP8 = 6 + AST_FORMAT_TYPE_VIDEO,
/*! JPEG Images */
AST_FORMAT_JPEG = 1 + AST_FORMAT_TYPE_IMAGE,
diff --git a/include/asterisk/opus.h b/include/asterisk/opus.h
new file mode 100644
index 000000000..0fbcfa10e
--- /dev/null
+++ b/include/asterisk/opus.h
@@ -0,0 +1,41 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2013, Digium, Inc.
+ *
+ * Lorenzo Miniero <lorenzo@meetecho.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*!
+ * \file
+ * \brief Opus Format Attributes (http://tools.ietf.org/html/draft-ietf-payload-rtp-opus)
+ *
+ * \author Lorenzo Miniero <lorenzo@meetecho.com>
+ */
+#ifndef _AST_FORMAT_OPUS_H_
+#define _AST_FORMAT_OPUS_H_
+
+/*! Opus format attribute key value pairs, all are accessible through ast_format_get_value()*/
+enum opus_attr_keys {
+ OPUS_ATTR_KEY_MAX_BITRATE, /*! value is an int (6000-510000 in spec). */
+ OPUS_ATTR_KEY_MAX_PLAYRATE, /*! value is an int (8000-48000), maximum output rate the receiver can render. */
+ OPUS_ATTR_KEY_MINPTIME, /*! value is an int (3-120 in spec, 10-60 in format.c), decoder's minimum length of time in milliseconds. */
+ OPUS_ATTR_KEY_STEREO, /*! value is an int, 1 prefer receiving stereo, 0 prefer mono. */
+ OPUS_ATTR_KEY_CBR, /*! value is an int, 1 use constant bitrate, 0 use variable bitrate. */
+ OPUS_ATTR_KEY_FEC, /*! value is an int, 1 encode with FEC, 0 do not use FEC. */
+ OPUS_ATTR_KEY_DTX, /*! value is an int, 1 dtx is enabled, 0 dtx not enabled. */
+ OPUS_ATTR_KEY_SPROP_CAPTURE_RATE, /*! value is an int (8000-48000), likely input rate we're going to produce. */
+ OPUS_ATTR_KEY_SPROP_STEREO, /*! value is an int, 1 likely to send stereo, 0 likely to send mono. */
+};
+
+#endif /* _AST_FORMAT_OPUS_H */