|
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "OGG/Speex audio" , .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 = "30ef0c93b36035ec78c9cfd712d36d9b" , .support_level = AST_MODULE_SUPPORT_EXTENDED, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_APP_DEPEND } |
|
static const struct ast_module_info * | ast_module_info = &__mod_info |
|
static struct ast_format_def | speex16_f |
|
static struct ast_format_def | speex32_f |
|
static struct ast_format_def | speex_f |
|
OGG/Speex streams.
Definition in file format_ogg_speex.c.
Create a new OGG/Speex filestream and set it up for reading.
- Parameters
-
fs | File that points to on disk storage of the OGG/Speex data. |
- Returns
- The new filestream.
Definition at line 130 of file format_ogg_speex.c.
References ast_filestream::_private, ast_format_get_sample_rate(), ast_log, BLOCK_SIZE, error(), ast_filestream::f, ast_filestream::fmt, ast_format_def::format, LOG_ERROR, NULL, speex_desc::og, speex_desc::op, speex_desc::os, speex_desc::oy, read_packet(), result, and speex_desc::serialno.
135 SpeexHeader *hdr =
NULL;
136 int i,
result, expected_rate;
140 ogg_sync_init(&s->
oy);
144 ogg_sync_wrote(&s->
oy, bytes);
153 ogg_sync_clear(&s->
oy);
157 ogg_stream_init(&s->
os, ogg_page_serialno(&s->
og));
158 if (ogg_stream_pagein(&s->
os, &s->
og) < 0) {
168 hdr = speex_packet_to_header((
char*)s->
op.packet, s->
op.bytes);
169 if (memcmp(hdr->speex_string,
"Speex ", 8)) {
173 if (hdr->frames_per_packet != 1) {
174 ast_log(
LOG_ERROR,
"Only one frame-per-packet OGG/Speex files are currently supported!\n");
177 if (hdr->nb_channels != 1) {
178 ast_log(
LOG_ERROR,
"Only monophonic OGG/Speex files are currently supported!\n");
181 if (hdr->rate != expected_rate) {
183 hdr->rate, expected_rate);
192 for (i = 0; i < hdr->extra_headers; i++) {
198 speex_header_free(hdr);
203 speex_header_free(hdr);
205 ogg_stream_clear(&s->
os);
206 ogg_sync_clear(&s->
oy);
struct ast_format_def * fmt
int error(const char *format,...)
Definition at line 55 of file format_ogg_speex.c.
References ast_filestream::_private, ast_log, BLOCK_SIZE, speex_desc::eos, ast_filestream::f, LOG_WARNING, speex_desc::og, speex_desc::op, speex_desc::os, speex_desc::oy, result, speex_desc::serialno, and while().
Referenced by ogg_speex_open(), and ogg_speex_read().
66 if (s->
op.bytes >= 5 && !memcmp(s->
op.packet,
"Speex", 5)) {
77 "Corrupt or missing data at this page position; continuing...\n");
91 if (ogg_page_serialno(&s->
og) != s->
os.serialno) {
92 ogg_stream_reset_serialno(&s->
os, ogg_page_serialno(&s->
og));
99 if (ogg_page_eos(&s->
og) &&
105 "Invalid page in the bitstream; continuing...\n");
110 "Corrupt or missing data in bitstream; continuing...\n");
117 ogg_sync_wrote(&s->
oy, bytes);
int eos
Indicates whether an End of Stream condition has been detected.