48 #define BUF_SIZE 32768
50 #define FRAME_ENDED 0x8000
61 if (fread(&ts, 1,
sizeof(ts), s->f) !=
sizeof(ts)) {
62 ast_log(LOG_WARNING,
"Empty file!\n");
77 if ((res = fread(&len, 1,
sizeof(len), s->f)) !=
sizeof(len))
83 ast_log(LOG_WARNING,
"Length %d is too long\n", len);
89 ast_log(LOG_WARNING,
"Short read of %s data (expected %d bytes, read %zu): %s\n",
98 if ((res = fread(&ts, 1,
sizeof(ts), s->f)) ==
sizeof(ts)) {
99 fs->lastts = ntohl(ts);
100 *whennext = fs->lastts * 4/45;
114 if ((res = fwrite(&ts, 1,
sizeof(ts), fs->f)) !=
sizeof(ts)) {
115 ast_log(LOG_WARNING,
"Bad write (%d/4): %s\n", res, strerror(errno));
118 len = htons(f->
datalen | mark);
119 if ((res = fwrite(&len, 1,
sizeof(len), fs->f)) !=
sizeof(len)) {
120 ast_log(LOG_WARNING,
"Bad write (%d/2): %s\n", res, strerror(errno));
124 ast_log(LOG_WARNING,
"Bad write (%d/%d): %s\n", res, f->
datalen, strerror(errno));
130 static int h263_seek(
struct ast_filestream *fs, off_t sample_offset,
int whence)
141 if ((fd = fileno(fs->f)) < 0) {
142 ast_log(AST_LOG_WARNING,
"Unable to determine file descriptor for h263 filestream %p: %s\n", fs, strerror(errno));
145 if ((cur = ftello(fs->f)) < 0) {
146 ast_log(AST_LOG_WARNING,
"Unable to determine current position in h263 filestream %p: %s\n", fs, strerror(errno));
150 return ftruncate(fd, cur);
155 off_t offset = ftello(fs->f);
172 static int load_module(
void)
175 if (ast_format_def_register(&h263_f))
180 static int unload_module(
void)
186 .support_level = AST_MODULE_SUPPORT_CORE,
188 .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.
Asterisk architecture endianess compatibility definitions.
struct ast_frame fr
frame produced by read, typically
#define AST_FRAME_SET_BUFFER(fr, _base, _ofs, _datalen)
union ast_frame::@224 data
unsigned int frame_ending
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.