This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Data Structures | |
struct | ast_imager |
structure associated with registering an image format More... | |
Functions | |
int | ast_image_init (void) |
int | ast_image_register (struct ast_imager *imgdrv) |
void | ast_image_unregister (struct ast_imager *imgdrv) |
ast_frame * | ast_read_image (char *filename, char *preflang, int format) |
int | ast_send_image (struct ast_channel *chan, char *filename) |
int | ast_supports_images (struct ast_channel *chan) |
Definition in file image.h.
|
Initializes all the various image stuff. Basically just registers the cli stuff Returns 0 all the time Definition at line 214 of file image.c. References ast_cli_register(), and show_images. 00215 { 00216 ast_cli_register(&show_images); 00217 return 0; 00218 }
|
|
Definition at line 51 of file image.c. References ast_mutex_lock(), ast_mutex_unlock(), ast_verbose(), ast_imager::desc, list, ast_imager::name, ast_imager::next, option_verbose, and VERBOSE_PREFIX_2. Referenced by load_module(). 00052 { 00053 if (option_verbose > 1) 00054 ast_verbose(VERBOSE_PREFIX_2 "Registered format '%s' (%s)\n", img->name, img->desc); 00055 ast_mutex_lock(&listlock); 00056 img->next = list; 00057 list = img; 00058 ast_mutex_unlock(&listlock); 00059 return 0; 00060 }
|
|
Definition at line 62 of file image.c. References ast_mutex_lock(), ast_mutex_unlock(), ast_verbose(), ast_imager::desc, list, ast_imager::name, ast_imager::next, option_verbose, and VERBOSE_PREFIX_2. Referenced by unload_module(). 00063 { 00064 struct ast_imager *i, *prev = NULL; 00065 ast_mutex_lock(&listlock); 00066 i = list; 00067 while(i) { 00068 if (i == img) { 00069 if (prev) 00070 prev->next = i->next; 00071 else 00072 list = i->next; 00073 break; 00074 } 00075 prev = i; 00076 i = i->next; 00077 } 00078 ast_mutex_unlock(&listlock); 00079 if (i && (option_verbose > 1)) 00080 ast_verbose(VERBOSE_PREFIX_2 "Unregistered format '%s' (%s)\n", img->name, img->desc); 00081 }
|
|
Definition at line 117 of file image.c. References ast_log(), ast_mutex_lock(), ast_imager::exts, file_exists(), ast_imager::format, ast_imager::identify, list, LOG_WARNING, make_filename(), ast_imager::name, ast_imager::next, ast_imager::read_image, and strsep(). Referenced by ast_send_image(). 00118 { 00119 struct ast_imager *i; 00120 char buf[256]; 00121 char tmp[80]; 00122 char *e; 00123 struct ast_imager *found = NULL; 00124 int fd; 00125 int len=0; 00126 struct ast_frame *f = NULL; 00127 #if 0 /* We need to have some sort of read-only lock */ 00128 ast_mutex_lock(&listlock); 00129 #endif 00130 i = list; 00131 while(!found && i) { 00132 if (i->format & format) { 00133 char *stringp=NULL; 00134 strncpy(tmp, i->exts, sizeof(tmp)-1); 00135 stringp=tmp; 00136 e = strsep(&stringp, "|"); 00137 while(e) { 00138 make_filename(buf, sizeof(buf), filename, preflang, e); 00139 if ((len = file_exists(buf))) { 00140 found = i; 00141 break; 00142 } 00143 make_filename(buf, sizeof(buf), filename, NULL, e); 00144 if ((len = file_exists(buf))) { 00145 found = i; 00146 break; 00147 } 00148 e = strsep(&stringp, "|"); 00149 } 00150 } 00151 i = i->next; 00152 } 00153 if (found) { 00154 fd = open(buf, O_RDONLY); 00155 if (fd > -1) { 00156 if (!found->identify || found->identify(fd)) { 00157 /* Reset file pointer */ 00158 lseek(fd, 0, SEEK_SET); 00159 f = found->read_image(fd,len); 00160 } else 00161 ast_log(LOG_WARNING, "%s does not appear to be a %s file\n", buf, found->name); 00162 close(fd); 00163 } else 00164 ast_log(LOG_WARNING, "Unable to open '%s': %s\n", buf, strerror(errno)); 00165 } else 00166 ast_log(LOG_WARNING, "Image file '%s' not found\n", filename); 00167 #if 0 00168 ast_mutex_unlock(&listlock); 00169 #endif 00170 return f; 00171 }
|
|
Definition at line 174 of file image.c. References ast_frfree(), ast_read_image(), ast_channel::language, ast_channel_tech::send_image, and ast_channel::tech. Referenced by handle_sendimage(), and sendimage_exec(). 00175 { 00176 struct ast_frame *f; 00177 int res = -1; 00178 if (chan->tech->send_image) { 00179 f = ast_read_image(filename, chan->language, -1); 00180 if (f) { 00181 res = chan->tech->send_image(chan, f); 00182 ast_frfree(f); 00183 } 00184 } 00185 return res; 00186 }
|
|
Definition at line 83 of file image.c. References ast_channel_tech::send_image, and ast_channel::tech. Referenced by sendimage_exec(). 00084 { 00085 if (!chan || !chan->tech) 00086 return 0; 00087 if (!chan->tech->send_image) 00088 return 0; 00089 return 1; 00090 }
|