summaryrefslogtreecommitdiff
path: root/include/asterisk/frame.h
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2009-02-13 13:35:24 +0000
committerKevin P. Fleming <kpfleming@digium.com>2009-02-13 13:35:24 +0000
commit2a53f2ec98d58e6ea32d71877e4b4ca6d9aa4a7d (patch)
tree51f8bb89740396001e20f9f64d9044733305193c /include/asterisk/frame.h
parent1981fdac02eb22d615619895ab26b5a955b74e61 (diff)
Add basic (passthrough, playback, record) support for ITU G.722.1 and G.722.1C (also known as Siren7 and Siren14)
This patch adds passthrough, file recording and file playback support for the codecs listed above, with negotiation over SIP/SDP supported. Due to Asterisk's current limitation of treating a codec/bitrate combination as a unique codec, only G.722.1 at 32 kbps and G.722.1C at 48 kbps are supported. Along the way, some related work was done: 1) The rtpPayloadType structure definition, used as a return result for an API call in rtp.h, was moved from rtp.c to rtp.h so that the API call was actually usable. The only previous used of the API all was chan_h323.c, which had a duplicate of the structure definition instead of doing it the right way. 2) The hardcoded SDP sample rates for various codecs in chan_sip.c were removed, in favor of storing these sample rates in rtp.c along with the codec definitions there. A new API call was added to allow retrieval of the sample rate for a given codec. 3) Some basic 'a=fmtp' parsing for SDP was added to chan_sip, because chan_sip *must* decline any media streams offered for these codecs that are not at the bitrates that we support (otherwise Bad Things (TM) would result). Review: http://reviewboard.digium.com/r/158/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@175508 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk/frame.h')
-rw-r--r--include/asterisk/frame.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/include/asterisk/frame.h b/include/asterisk/frame.h
index 267a820e8..4a18bdbac 100644
--- a/include/asterisk/frame.h
+++ b/include/asterisk/frame.h
@@ -259,6 +259,10 @@ extern struct ast_frame ast_null_frame;
#define AST_FORMAT_G726 (1 << 11)
/*! G.722 */
#define AST_FORMAT_G722 (1 << 12)
+/*! G.722.1 (also known as Siren7, 32kbps assumed) */
+#define AST_FORMAT_SIREN7 (1 << 13)
+/*! G.722.1 Annex C (also known as Siren14, 48kbps assumed) */
+#define AST_FORMAT_SIREN14 (1 << 14)
/*! Raw 16-bit Signed Linear (16000 Hz) PCM */
#define AST_FORMAT_SLINEAR16 (1 << 15)
/*! Maximum audio mask */
@@ -523,8 +527,8 @@ struct ast_frame *ast_smoother_read(struct ast_smoother *s);
#endif
/*@} Doxygen marker */
-struct ast_format_list *ast_get_format_list_index(int index);
-struct ast_format_list *ast_get_format_list(size_t *size);
+const struct ast_format_list *ast_get_format_list_index(int index);
+const struct ast_format_list *ast_get_format_list(size_t *size);
void ast_frame_dump(const char *name, struct ast_frame *f, char *prefix);
/*! \page AudioCodecPref Audio Codec Preferences
@@ -630,10 +634,16 @@ int ast_frame_slinear_sum(struct ast_frame *f1, struct ast_frame *f2);
*/
static force_inline int ast_format_rate(int format)
{
- if (format == AST_FORMAT_G722 || format == AST_FORMAT_SLINEAR16)
+ switch (format) {
+ case AST_FORMAT_G722:
+ case AST_FORMAT_SLINEAR16:
+ case AST_FORMAT_SIREN7:
return 16000;
-
- return 8000;
+ case AST_FORMAT_SIREN14:
+ return 32000;
+ default:
+ return 8000;
+ }
}
#if defined(__cplusplus) || defined(c_plusplus)