00001 /* 00002 * Asterisk -- An open source telephony toolkit. 00003 * 00004 * Copyright (C) 1999 - 2006, Digium, Inc. 00005 * 00006 * Mark Spencer <markster@digium.com> 00007 * 00008 * See http://www.asterisk.org for more information about 00009 * the Asterisk project. Please do not directly contact 00010 * any of the maintainers of this project for assistance; 00011 * the project provides a web site, mailing lists and IRC 00012 * channels for your use. 00013 * 00014 * This program is free software, distributed under the terms of 00015 * the GNU General Public License Version 2. See the LICENSE file 00016 * at the top of the source tree. 00017 */ 00018 00019 /*! \file 00020 * \brief General Asterisk channel definitions for image handling 00021 */ 00022 00023 #ifndef _ASTERISK_IMAGE_H 00024 #define _ASTERISK_IMAGE_H 00025 00026 /*! \brief structure associated with registering an image format */ 00027 struct ast_imager { 00028 /*! Name */ 00029 char *name; 00030 /*! Description */ 00031 char *desc; 00032 /*! Extension(s) (separated by '|' ) */ 00033 char *exts; 00034 /*! Image format */ 00035 int format; 00036 /*! Read an image from a file descriptor */ 00037 struct ast_frame *(*read_image)(int fd, int len); 00038 /*! Identify if this is that type of file */ 00039 int (*identify)(int fd); 00040 /*! Returns length written */ 00041 int (*write_image)(int fd, struct ast_frame *frame); 00042 /*! For linked list */ 00043 AST_LIST_ENTRY(ast_imager) list; 00044 }; 00045 00046 /*! Check for image support on a channel */ 00047 /*! 00048 * \param chan channel to check 00049 * Checks the channel to see if it supports the transmission of images 00050 * Returns non-zero if image transmission is supported 00051 */ 00052 int ast_supports_images(struct ast_channel *chan); 00053 00054 /*! Sends an image */ 00055 /*! 00056 * \param chan channel to send image on 00057 * \param filename filename of image to send (minus extension) 00058 * Sends an image on the given channel. 00059 * Returns 0 on success, -1 on error 00060 */ 00061 int ast_send_image(struct ast_channel *chan, char *filename); 00062 00063 /*! Make an image */ 00064 /*! 00065 * \param filename filename of image to prepare 00066 * \param preflang preferred language to get the image...? 00067 * \param format the format of the file 00068 * Make an image from a filename ??? No estoy positivo 00069 * Returns an ast_frame on success, NULL on failure 00070 */ 00071 struct ast_frame *ast_read_image(char *filename, const char *preflang, int format); 00072 00073 /*! Register image format */ 00074 /*! 00075 * \param imgdrv Populated ast_imager structure with info to register 00076 * Registers an image format 00077 * Returns 0 regardless 00078 */ 00079 int ast_image_register(struct ast_imager *imgdrv); 00080 00081 /*! Unregister an image format */ 00082 /*! 00083 * \param imgdrv pointer to the ast_imager structure you wish to unregister 00084 * Unregisters the image format passed in 00085 * Returns nothing 00086 */ 00087 void ast_image_unregister(struct ast_imager *imgdrv); 00088 00089 /*! Initialize image stuff */ 00090 /*! 00091 * Initializes all the various image stuff. Basically just registers the cli stuff 00092 * Returns 0 all the time 00093 */ 00094 int ast_image_init(void); 00095 00096 #endif /* _ASTERISK_IMAGE_H */