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 char *name; /*!< Name */ 00029 char *desc; /*!< Description */ 00030 char *exts; /*!< Extension(s) (separated by '|' ) */ 00031 int format; /*!< Image format */ 00032 struct ast_frame *(*read_image)(int fd, int len); /*!< Read an image from a file descriptor */ 00033 int (*identify)(int fd); /*!< Identify if this is that type of file */ 00034 int (*write_image)(int fd, struct ast_frame *frame); /*!< Returns length written */ 00035 AST_LIST_ENTRY(ast_imager) list; /*!< For linked list */ 00036 }; 00037 00038 /*! 00039 * \brief Check for image support on a channel 00040 * \param chan channel to check 00041 * Checks the channel to see if it supports the transmission of images 00042 * \return non-zero if image transmission is supported 00043 */ 00044 int ast_supports_images(struct ast_channel *chan); 00045 00046 /*! 00047 * \brief Sends an image 00048 * \param chan channel to send image on 00049 * \param filename filename of image to send (minus extension) 00050 * Sends an image on the given channel. 00051 * \retval 0 on success 00052 * \retval -1 on error 00053 */ 00054 int ast_send_image(struct ast_channel *chan, const char *filename); 00055 00056 /*! 00057 * \brief Make an image 00058 * \param filename filename of image to prepare 00059 * \param preflang preferred language to get the image...? 00060 * \param format the format of the file 00061 * Make an image from a filename ??? No estoy positivo 00062 * \retval an ast_frame on success 00063 * \retval NULL on failure 00064 */ 00065 struct ast_frame *ast_read_image(const char *filename, const char *preflang, int format); 00066 00067 /*! 00068 * \brief Register image format 00069 * \param imgdrv Populated ast_imager structure with info to register 00070 * Registers an image format 00071 * \return 0 regardless 00072 */ 00073 int ast_image_register(struct ast_imager *imgdrv); 00074 00075 /*! 00076 * \brief Unregister an image format 00077 * \param imgdrv pointer to the ast_imager structure you wish to unregister 00078 * Unregisters the image format passed in. 00079 * Returns nothing 00080 */ 00081 void ast_image_unregister(struct ast_imager *imgdrv); 00082 00083 /*! 00084 * \brief Initialize image stuff 00085 * Initializes all the various image stuff. Basically just registers the cli stuff 00086 * \return 0 all the time 00087 */ 00088 int ast_image_init(void); 00089 00090 #endif /* _ASTERISK_IMAGE_H */