Asterisk - The Open Source Telephony Project GIT-master-27fb039
Loading...
Searching...
No Matches
Functions | Variables
res_format_attr_siren14.c File Reference

Siren14 format attribute interface. More...

#include "asterisk.h"
#include <ctype.h>
#include "asterisk/module.h"
#include "asterisk/format.h"
#include "asterisk/astobj2.h"
#include "asterisk/logger.h"
#include "asterisk/strings.h"
Include dependency graph for res_format_attr_siren14.c:

Go to the source code of this file.

Functions

static void __reg_module (void)
 
static void __unreg_module (void)
 
struct ast_moduleAST_MODULE_SELF_SYM (void)
 
static int load_module (void)
 
static int siren14_clone (const struct ast_format *src, struct ast_format *dst)
 
static void siren14_destroy (struct ast_format *format)
 
static void siren14_generate_sdp_fmtp (const struct ast_format *format, unsigned int payload, struct ast_str **str)
 
static struct ast_formatsiren14_parse_sdp_fmtp (const struct ast_format *format, const char *attributes)
 
static int unload_module (void)
 

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Siren14 Format Attribute Module" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_CHANNEL_DEPEND, }
 
static const struct ast_module_infoast_module_info = &__mod_info
 
static struct ast_format_interface siren14_interface
 

Detailed Description

Siren14 format attribute interface.

Author
Joshua Colp jcolp.nosp@m.@dig.nosp@m.ium.c.nosp@m.om

Definition in file res_format_attr_siren14.c.

Function Documentation

◆ __reg_module()

static void __reg_module ( void  )
static

Definition at line 103 of file res_format_attr_siren14.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

Definition at line 103 of file res_format_attr_siren14.c.

◆ AST_MODULE_SELF_SYM()

struct ast_module * AST_MODULE_SELF_SYM ( void  )

Definition at line 103 of file res_format_attr_siren14.c.

◆ load_module()

static int load_module ( void  )
static

Definition at line 84 of file res_format_attr_siren14.c.

85{
88 }
89
91}
#define ast_format_interface_register(codec, interface)
Register a format interface for use with the provided codec.
Definition format.h:273
@ AST_MODULE_LOAD_SUCCESS
Definition module.h:70
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
Definition module.h:78
static struct ast_format_interface siren14_interface

References ast_format_interface_register, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, and siren14_interface.

◆ siren14_clone()

static int siren14_clone ( const struct ast_format src,
struct ast_format dst 
)
static

Definition at line 46 of file res_format_attr_siren14.c.

47{
48 return 0;
49}

◆ siren14_destroy()

static void siren14_destroy ( struct ast_format format)
static

Definition at line 41 of file res_format_attr_siren14.c.

42{
43}

◆ siren14_generate_sdp_fmtp()

static void siren14_generate_sdp_fmtp ( const struct ast_format format,
unsigned int  payload,
struct ast_str **  str 
)
static

Definition at line 72 of file res_format_attr_siren14.c.

73{
74 ast_str_append(str, 0, "a=fmtp:%u bitrate=48000\r\n", payload);
75}
const char * str
Definition app_jack.c:150
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
Definition strings.h:1139

References ast_str_append(), and str.

◆ siren14_parse_sdp_fmtp()

static struct ast_format * siren14_parse_sdp_fmtp ( const struct ast_format format,
const char *  attributes 
)
static

Definition at line 51 of file res_format_attr_siren14.c.

52{
53 char *attribs = ast_strdupa(attributes), *attrib;
54 unsigned int val;
55
56 /* lower-case everything, so we are case-insensitive */
57 for (attrib = attribs; *attrib; ++attrib) {
58 *attrib = tolower(*attrib);
59 } /* based on channels/chan_sip.c:process_a_sdp_image() */
60
61 if (sscanf(attribs, "bitrate=%30u", &val) == 1) {
62 if (val != 48000) {
63 ast_log(LOG_WARNING, "Got siren14 offer at %u bps, but only 48000 bps supported; ignoring.\n", val);
64 return NULL;
65 }
66 }
67
68 /* We aren't modifying the format and once passed back it won't be touched, so use what we were given */
69 return ao2_bump((struct ast_format *)format);
70}
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition astmm.h:298
#define ast_log
Definition astobj2.c:42
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
Definition astobj2.h:480
#define LOG_WARNING
#define NULL
Definition resample.c:96
Definition of a media format.
Definition format.c:43

References ao2_bump, ast_log, ast_strdupa, LOG_WARNING, and NULL.

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 93 of file res_format_attr_siren14.c.

94{
95 return 0;
96}

Variable Documentation

◆ __mod_info

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Siren14 Format Attribute Module" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_CHANNEL_DEPEND, }
static

Definition at line 103 of file res_format_attr_siren14.c.

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 103 of file res_format_attr_siren14.c.

◆ siren14_interface

struct ast_format_interface siren14_interface
static

Definition at line 77 of file res_format_attr_siren14.c.

77 {
78 .format_destroy = siren14_destroy,
79 .format_clone = siren14_clone,
80 .format_parse_sdp_fmtp = siren14_parse_sdp_fmtp,
81 .format_generate_sdp_fmtp = siren14_generate_sdp_fmtp,
82};
static void siren14_generate_sdp_fmtp(const struct ast_format *format, unsigned int payload, struct ast_str **str)
static void siren14_destroy(struct ast_format *format)
static int siren14_clone(const struct ast_format *src, struct ast_format *dst)
static struct ast_format * siren14_parse_sdp_fmtp(const struct ast_format *format, const char *attributes)

Referenced by load_module().