Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Sound file format and description index. More...
#include "asterisk.h"
#include <dirent.h>
#include <sys/stat.h>
#include "asterisk/utils.h"
#include "asterisk/lock.h"
#include "asterisk/format.h"
#include "asterisk/format_cap.h"
#include "asterisk/paths.h"
#include "asterisk/media_index.h"
#include "asterisk/sounds_index.h"
#include "asterisk/file.h"
#include "asterisk/cli.h"
#include "asterisk/module.h"
#include "asterisk/stasis_message_router.h"
#include "asterisk/stasis_system.h"
Go to the source code of this file.
Macros | |
#define | LANGUAGE_BUCKETS 7 |
The number of buckets to be used for storing language-keyed objects. More... | |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
struct ast_media_index * | ast_sounds_get_index (void) |
Get the sounds index. More... | |
struct ast_media_index * | ast_sounds_get_index_for_file (const char *filename) |
Get the index for a specific sound file. More... | |
static struct ao2_container * | get_languages (void) |
Get the languages in which sound files are available. More... | |
static char * | handle_cli_sound_show (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Show details about a sound available in the system. More... | |
static char * | handle_cli_sounds_show (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Show a list of sounds available on the system. More... | |
static int | load_module (void) |
static int | show_sound_info_cb (void *obj, void *arg, void *data, int flags) |
static int | show_sounds_cb (void *obj, void *arg, int flags) |
static int | sound_sorter (const void *obj_left, const void *obj_right, int flags) |
static int | unload_module (void) |
static int | update_index_cb (void *obj, void *arg, void *data, int flags) |
Callback to process an individual language directory or subdirectory. More... | |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER , .description = "Sounds Index" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_APP_DEPEND + 1, } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_cli_entry | cli_sounds [] |
Struct for registering CLI commands. More... | |
Sound file format and description index.
Definition in file sounds.c.
#define LANGUAGE_BUCKETS 7 |
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
struct ast_media_index * ast_sounds_get_index | ( | void | ) |
Get the sounds index.
sounds | index (must be ao2_cleanup()'ed) |
NULL | on failure |
Definition at line 308 of file sounds.c.
References ast_sounds_get_index_for_file(), and NULL.
Referenced by ast_ari_sounds_list(), handle_cli_sound_show(), and handle_cli_sounds_show().
struct ast_media_index * ast_sounds_get_index_for_file | ( | const char * | filename | ) |
Get the index for a specific sound file.
filename | Sound file name without extension |
sounds | index (must be ao2_cleanup()'ed) |
NULL | on failure |
Definition at line 313 of file sounds.c.
References ao2_callback_data, ao2_ref, ast_config_AST_DATA_DIR, ast_free, ast_media_index_create(), ast_str_buffer(), ast_str_create, ast_str_set(), get_languages(), NULL, and update_index_cb().
Referenced by ast_ari_sounds_get(), ast_sounds_get_index(), and handle_cli_sound_show().
|
static |
Get the languages in which sound files are available.
Definition at line 49 of file sounds.c.
References ao2_cleanup, ao2_ref, ast_config_AST_DATA_DIR, ast_free, ast_log, ast_str_buffer(), ast_str_container_add(), ast_str_container_alloc, ast_str_create, ast_str_reset(), ast_str_set(), LANGUAGE_BUCKETS, LOG_ERROR, NULL, and RAII_VAR.
Referenced by ast_sounds_get_index_for_file().
|
static |
Show details about a sound available in the system.
Definition at line 193 of file sounds.c.
References a, ao2_callback_data, ao2_cleanup, ao2_container_count(), ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_cli(), ast_cli_completion_add(), ast_media_get_media(), ast_media_get_variants(), ast_sounds_get_index(), ast_sounds_get_index_for_file(), ast_strdup, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, NULL, OBJ_MULTIPLE, OBJ_NODATA, show_sound_info_cb(), and ast_cli_entry::usage.
|
static |
Show a list of sounds available on the system.
Definition at line 144 of file sounds.c.
References a, AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_callback, ao2_cleanup, ao2_container_alloc_rbtree, ao2_container_dup(), ao2_ref, ast_cli(), ast_media_get_media(), ast_sounds_get_index(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, NULL, OBJ_MULTIPLE, OBJ_NODATA, show_sounds_cb(), sound_sorter(), and ast_cli_entry::usage.
|
static |
Definition at line 282 of file sounds.c.
References ARRAY_LEN, ast_cli_register_multiple, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, and cli_sounds.
|
static |
Definition at line 104 of file sounds.c.
References a, ao2_ref, ast_cli(), ast_format_cap_count(), ast_format_cap_get_format(), ast_format_get_name(), ast_media_get_description(), ast_media_get_format_cap(), ast_strlen_zero(), and language.
Referenced by handle_cli_sound_show().
|
static |
|
static |
Definition at line 138 of file sounds.c.
Referenced by handle_cli_sounds_show().
|
static |
Definition at line 275 of file sounds.c.
References ARRAY_LEN, ast_cli_unregister_multiple(), and cli_sounds.
|
static |
Callback to process an individual language directory or subdirectory.
Definition at line 295 of file sounds.c.
References ast_media_index_update_for_file(), CMP_MATCH, and ast_media_index::index.
Referenced by ast_sounds_get_index_for_file().
|
static |
|
static |
|
static |
Struct for registering CLI commands.
Definition at line 270 of file sounds.c.
Referenced by load_module(), and unload_module().