36 #include <speex/speex_header.h> 39 #define BLOCK_SIZE 4096 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);
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);
218 ogg_stream_clear(&s->
os);
219 ogg_sync_clear(&s->
oy);
290 .
name =
"ogg_speex16",
303 .
name =
"ogg_speex32",
Asterisk main include file. File version handling, generic pbx functions.
int eos
Indicates whether an End of Stream condition has been detected.
#define AST_FRIENDLY_OFFSET
Offset into a frame's data buffer.
struct ast_format_def * fmt
struct ast_frame fr
frame produced by read, typically
unsigned int ast_codec_samples_count(struct ast_frame *frame)
Get the number of samples contained within a frame.
#define AST_FRAME_SET_BUFFER(fr, _base, _ofs, _datalen)
Module has failed to load, may be in an inconsistent state.
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
This structure is allocated by file.c in one chunk, together with buf_size and desc_size bytes of mem...
Data structure associated with a single frame of data.
int error(const char *format,...)
union ast_frame::@263 data
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.