38 #if defined(ASTERISK_REGISTER_FILE)
39 ASTERISK_REGISTER_FILE()
40 #elif defined(ASTERISK_FILE_VERSION)
41 ASTERISK_FILE_VERSION(__FILE__,
"$Revision: $")
44 #include <netinet/in.h>
54 #define FRAME_ENDED 0x8000
65 if (fread(&ts, 1,
sizeof(ts), s->f) <
sizeof(ts)) {
66 ast_log(LOG_WARNING,
"Empty file!\n");
82 if ((res = fread(&len, 1,
sizeof(len), s->f)) < 1) {
90 ast_log(LOG_WARNING,
"Length %d is too long\n", len);
95 if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
97 ast_log(LOG_WARNING,
"Short read (%d of %d) (%s)!\n", res, len, strerror(errno));
106 if ((res = fread(&ts, 1,
sizeof(ts), s->f)) ==
sizeof(ts)) {
107 fs->lastts = ntohl(ts);
108 *whennext = fs->lastts * 4 / 45;
123 ast_log(LOG_WARNING,
"Asked to write non-video frame!\n");
129 if ((res = fwrite(&ts, 1,
sizeof(ts), s->f)) !=
sizeof(ts)) {
130 ast_log(LOG_WARNING,
"Bad write (%d/4): %s\n", res, strerror(errno));
134 len = htons(f->
datalen | mark);
135 if ((res = fwrite(&len, 1,
sizeof(len), s->f)) !=
sizeof(len)) {
136 ast_log(LOG_WARNING,
"Bad write (%d/2): %s\n", res, strerror(errno));
141 ast_log(LOG_WARNING,
"Bad write (%d/%d): %s\n", res, f->
datalen, strerror(errno));
148 static int vp8_seek(
struct ast_filestream *fs, off_t sample_offset,
int whence)
159 if ((fd = fileno(fs->f)) < 0) {
160 ast_log(LOG_WARNING,
"Unable to determine file descriptor for VP8 filestream %p: %s\n", fs, strerror(errno));
164 if ((cur = ftello(fs->f)) < 0) {
165 ast_log(LOG_WARNING,
"Unable to determine current position in VP8 filestream %p: %s\n", fs, strerror(errno));
170 return ftruncate(fd, cur);
175 off_t offset = ftell(fs->f);
189 .desc_size =
sizeof(
struct vp8_desc),
192 static int load_module(
void)
195 if (ast_format_def_register(&vp8_f)) {
202 static int unload_module(
void)
209 .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 internal frame 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 could not be loaded properly.
Support for logging to various files, console and syslog Configuration in file logger.conf.
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.
enum ast_frame_type frametype
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.