blob: 647b078f7ee8c2b51c34b2d1df518b4b5b144e24 [file] [log] [blame]
Alexandre Lision8af73cb2013-12-10 14:11:20 -05001/* $Id$ */
2/*
3 * Copyright (C) 2011-2013 Teluu Inc. (http://www.teluu.com)
4 * Copyright (C) 2011 Dan Arrhenius <dan@keystream.se>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __PJMEDIA_CODEC_OPENCORE_AMR_H__
21#define __PJMEDIA_CODEC_OPENCORE_AMR_H__
22
23#include <pjmedia-codec/types.h>
24
25/**
26 * @defgroup PJMED_OC_AMR OpenCORE AMR Codec
27 * @ingroup PJMEDIA_CODEC_CODECS
28 * @brief AMRCodec wrapper for OpenCORE AMR codec
29 * @{
30 */
31
32PJ_BEGIN_DECL
33
34/**
35 * Bitmask options to be passed during AMR codec factory initialization.
36 */
37enum pjmedia_amr_options
38{
39 PJMEDIA_AMR_NO_NB = 1, /**< Disable narrowband mode. */
40 PJMEDIA_AMR_NO_WB = 2, /**< Disable wideband mode. */
41};
42
43/**
44 * Settings. Use #pjmedia_codec_opencore_amrnb/wb_set_config() to
45 * activate.
46 */
47typedef struct pjmedia_codec_amr_config
48{
49 /**
50 * Control whether to use octent align.
51 */
52 pj_bool_t octet_align;
53
54 /**
55 * Set the bitrate.
56 */
57 unsigned bitrate;
58
59} pjmedia_codec_amr_config;
60
61typedef pjmedia_codec_amr_config pjmedia_codec_amrnb_config;
62typedef pjmedia_codec_amr_config pjmedia_codec_amrwb_config;
63
64/**
65 * Initialize and register AMR codec factory to pjmedia endpoint.
66 *
67 * @param endpt The pjmedia endpoint.
68 * @param options Bitmask of pjmedia_amr_options (default=0).
69 *
70 * @return PJ_SUCCESS on success.
71 */
72PJ_DECL(pj_status_t) pjmedia_codec_opencore_amr_init(pjmedia_endpt* endpt,
73 unsigned options);
74
75/**
76 * Initialize and register AMR codec factory using default settings to
77 * pjmedia endpoint.
78 *
79 * @param endpt The pjmedia endpoint.
80 *
81 * @return PJ_SUCCESS on success.
82 */
83PJ_DECL(pj_status_t)
84pjmedia_codec_opencore_amr_init_default(pjmedia_endpt* endpt);
85
86/**
87 * Unregister AMR codec factory from pjmedia endpoint and deinitialize
88 * the OpenCORE codec library.
89 *
90 * @return PJ_SUCCESS on success.
91 */
92PJ_DECL(pj_status_t) pjmedia_codec_opencore_amr_deinit(void);
93
94/**
95 * Initialize and register AMR-NB codec factory to pjmedia endpoint. Calling
96 * this function will automatically initialize AMR codec factory without
97 * the wideband mode (i.e. it is equivalent to calling
98 * #pjmedia_codec_opencore_amr_init() with PJMEDIA_AMR_NO_WB). Application
99 * should call #pjmedia_codec_opencore_amr_init() instead if wishing to use
100 * both modes.
101 *
102 * @param endpt The pjmedia endpoint.
103 *
104 * @return PJ_SUCCESS on success.
105 */
106PJ_DECL(pj_status_t) pjmedia_codec_opencore_amrnb_init(pjmedia_endpt* endpt);
107
108/**
109 * Unregister AMR-NB codec factory from pjmedia endpoint and deinitialize
110 * the OpenCORE codec library.
111 *
112 * @return PJ_SUCCESS on success.
113 */
114PJ_DECL(pj_status_t) pjmedia_codec_opencore_amrnb_deinit(void);
115
116
117/**
118 * Set AMR-NB parameters.
119 *
120 * @param cfg The settings;
121 *
122 * @return PJ_SUCCESS on success.
123 */
124PJ_DECL(pj_status_t) pjmedia_codec_opencore_amrnb_set_config(
125 const pjmedia_codec_amrnb_config* cfg);
126
127
128/**
129 * Set AMR-WB parameters.
130 *
131 * @param cfg The settings;
132 *
133 * @return PJ_SUCCESS on success.
134 */
135PJ_DECL(pj_status_t) pjmedia_codec_opencore_amrwb_set_config(
136 const pjmedia_codec_amrwb_config* cfg);
137
138PJ_END_DECL
139
140
141/**
142 * @}
143 */
144
145#endif /* __PJMEDIA_CODEC_OPENCORE_AMRNB_H__ */
146