43 #define FRAME_ENDED 0x8000
53 if (fread(&ts, 1,
sizeof(ts), s->f) !=
sizeof(ts)) {
54 ast_log(LOG_WARNING,
"Empty file!\n");
69 if ((res = fread(&len, 1,
sizeof(len), s->f)) !=
sizeof(len))
75 ast_log(LOG_WARNING,
"Length %d is too long\n", len);
81 ast_log(LOG_WARNING,
"Short read of %s data (expected %d bytes, read %zu): %s\n",
90 if ((res = fread(&ts, 1,
sizeof(ts), s->f)) ==
sizeof(ts)) {
91 fs->lastts = ntohl(ts);
92 *whennext = fs->lastts * 4/45;
107 if ((res = fwrite(&ts, 1,
sizeof(ts), s->f)) !=
sizeof(ts)) {
108 ast_log(LOG_WARNING,
"Bad write (%d/4): %s\n", res, strerror(errno));
111 len = htons(f->
datalen | mark);
112 if ((res = fwrite(&len, 1,
sizeof(len), s->f)) !=
sizeof(len)) {
113 ast_log(LOG_WARNING,
"Bad write (%d/2): %s\n", res, strerror(errno));
117 ast_log(LOG_WARNING,
"Bad write (%d/%d): %s\n", res, f->
datalen, strerror(errno));
123 static int h264_seek(
struct ast_filestream *fs, off_t sample_offset,
int whence)
134 if ((fd = fileno(fs->f)) < 0) {
135 ast_log(AST_LOG_WARNING,
"Unable to determine file descriptor for h264 filestream %p: %s\n", fs, strerror(errno));
138 if ((cur = ftello(fs->f)) < 0) {
139 ast_log(AST_LOG_WARNING,
"Unable to determine current position in h264 filestream %p: %s\n", fs, strerror(errno));
143 return ftruncate(fd, cur);
148 off_t offset = ftell(fs->f);
165 static int load_module(
void)
168 if (ast_format_def_register(&h264_f))
173 static int unload_module(
void)
179 .support_level = AST_MODULE_SUPPORT_CORE,
181 .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.