38 #define G723_MAX_SIZE 1024
47 if (fread(&delay, 1, 4, s->f) == 4)
51 if (fread(&size, 1, 2, s->f) != 2) {
58 if (size > G723_MAX_SIZE) {
59 ast_log(LOG_WARNING,
"Size %d is invalid\n", size);
69 ast_log(LOG_WARNING,
"Short read of %s data (expected %d bytes, read %zu): %s\n",
87 ast_log(LOG_WARNING,
"Short frame ignored (%d bytes long?)\n", f->
datalen);
90 if ((res = fwrite(&delay, 1, 4, s->f)) != 4) {
91 ast_log(LOG_WARNING,
"Unable to write delay: res=%d (%s)\n", res, strerror(errno));
95 if ((res = fwrite(&size, 1, 2, s->f)) != 2) {
96 ast_log(LOG_WARNING,
"Unable to write size: res=%d (%s)\n", res, strerror(errno));
100 ast_log(LOG_WARNING,
"Unable to write frame: res=%d (%s)\n", res, strerror(errno));
106 static int g723_seek(
struct ast_filestream *fs, off_t sample_offset,
int whence)
116 if ((fd = fileno(fs->f)) < 0) {
117 ast_log(AST_LOG_WARNING,
"Unable to determine file descriptor for g723 filestream %p: %s\n", fs, strerror(errno));
120 if ((cur = ftello(fs->f)) < 0) {
121 ast_log(AST_LOG_WARNING,
"Unable to determine current position in g723 filestream %p: %s\n", fs, strerror(errno));
125 return ftruncate(fd, cur);
135 .exts =
"g723|g723sf",
144 static int load_module(
void)
148 if (ast_format_def_register(&g723_1_f))
153 static int unload_module(
void)
158 AST_MODULE_INFO(
ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER,
"G.723.1 Simple Timestamp File Format",
159 .support_level = AST_MODULE_SUPPORT_CORE,
161 .unload = unload_module,
Asterisk main include file. File version handling, generic pbx functions.
struct ast_frame_subclass subclass
#define AST_FRIENDLY_OFFSET
Offset into a frame's data buffer.
struct ast_frame fr
frame produced by read, typically
#define AST_FRAME_SET_BUFFER(fr, _base, _ofs, _datalen)
union ast_frame::@224 data
Module has failed to load, may be in an inconsistent state.
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.
struct ast_format * format
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.