40 .description =
"Unit test codec",
49 .
name =
"unit_test_double",
50 .description =
"Unit test codec",
59 .
name =
"unit_test_unknown",
60 .description =
"Unit test codec",
69 .
name =
"unit_test_audio_without_rate",
70 .description =
"Unit test codec",
78 .
name =
"unit_test_audio_get",
79 .description =
"Unit test codec",
88 .
name =
"unit_test_audio_get_unknown",
89 .description =
"Unit test codec",
98 .
name =
"unit_test_audio_get_id",
99 .description =
"Unit test codec",
111 info->name =
"codec_register";
112 info->category =
"/main/core_codec/";
113 info->summary =
"codec registration unit test";
115 "Test registration of a core codec that is known to be unknown";
133 info->name =
"codec_register_twice";
134 info->category =
"/main/core_codec/";
135 info->summary =
"codec registration unit test";
137 "Test double registration of a core codec to confirm it fails";
160 info->name =
"codec_register_unknown";
161 info->category =
"/main/core_codec/";
162 info->summary =
"codec registration unit test";
164 "Test that registration of an unknown codec type fails";
182 info->name =
"codec_register_audio_no_sample_rate";
183 info->category =
"/main/core_codec/";
184 info->summary =
"codec registration unit test";
186 "Test that registration of an audio codec without sample rate fails";
206 info->name =
"codec_get";
207 info->category =
"/main/core_codec/";
208 info->summary =
"codec get unit test";
210 "Test that getting of a known codec succeeds";
225 }
else if (strcmp(codec->name, audio_get.
name)) {
228 }
else if (codec->type != audio_get.
type) {
231 }
else if (codec->sample_rate != audio_get.
sample_rate) {
245 info->name =
"codec_get_unregistered";
246 info->category =
"/main/core_codec/";
247 info->summary =
"codec get unit test";
249 "Test that getting of a codec that is not registered fails";
271 info->name =
"codec_get_unknown";
272 info->category =
"/main/core_codec/";
273 info->summary =
"codec get unit test";
275 "Test that getting of a known codec using name and unknown type succeeds";
290 }
else if (strcmp(codec->name, audio_get_unknown.
name)) {
293 }
else if (codec->type != audio_get_unknown.
type) {
296 }
else if (codec->sample_rate != audio_get_unknown.
sample_rate) {
311 info->name =
"codec_get_unknown";
312 info->category =
"/main/core_codec/";
313 info->summary =
"codec get unit test";
315 "Test that getting of a known codec using name and unknown type succeeds";
#define AST_MODULE_INFO_STANDARD(keystr, desc)
const char * name
Name for this codec.
Asterisk main include file. File version handling, generic pbx functions.
static int unload_module(void)
static struct ast_codec audio_get_unknown
struct ast_codec * ast_codec_get_by_id(int id)
Retrieve a codec given the unique identifier.
static int load_module(void)
#define AST_TEST_REGISTER(cb)
static struct ast_codec audio_without_rate
struct ast_codec * ast_codec_get(const char *name, enum ast_media_type type, unsigned int sample_rate)
Retrieve a codec given a name, type, and sample rate.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define ast_test_status_update(a, b, c...)
#define ast_codec_register(codec)
This function is used to register a codec with the Asterisk core. Registering allows it to be passed ...
#define AST_TEST_UNREGISTER(cb)
static struct ast_codec audio_get_id
static struct ast_codec unknown
static struct ast_codec known_unknown
unsigned int sample_rate
Sample rate (number of samples carried in a second)
AST_TEST_DEFINE(codec_register)
enum ast_media_type type
Type of media this codec contains.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
static struct ast_codec audio_get
Represents a media codec within Asterisk.
static struct ast_codec doubly