Asterisk - The Open Source Telephony Project  18.5.0
image.h
Go to the documentation of this file.
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 1999 - 2006, Digium, Inc.
5  *
6  * Mark Spencer <[email protected]>
7  *
8  * See http://www.asterisk.org for more information about
9  * the Asterisk project. Please do not directly contact
10  * any of the maintainers of this project for assistance;
11  * the project provides a web site, mailing lists and IRC
12  * channels for your use.
13  *
14  * This program is free software, distributed under the terms of
15  * the GNU General Public License Version 2. See the LICENSE file
16  * at the top of the source tree.
17  */
18 
19 /*! \file
20  * \brief General Asterisk channel definitions for image handling
21  */
22 
23 #ifndef _ASTERISK_IMAGE_H
24 #define _ASTERISK_IMAGE_H
25 
26 /*! \brief structure associated with registering an image format */
27 struct ast_imager {
28  char *name; /*!< Name */
29  char *desc; /*!< Description */
30  char *exts; /*!< Extension(s) (separated by '|' ) */
31  struct ast_format *format; /*!< Image format */
32  struct ast_frame *(*read_image)(int fd, int len); /*!< Read an image from a file descriptor */
33  int (*identify)(int fd); /*!< Identify if this is that type of file */
34  int (*write_image)(int fd, struct ast_frame *frame); /*!< Returns length written */
35  AST_LIST_ENTRY(ast_imager) list; /*!< For linked list */
36 };
37 
38 /*!
39  * \brief Check for image support on a channel
40  * \param chan channel to check
41  * Checks the channel to see if it supports the transmission of images
42  * \return non-zero if image transmission is supported
43  */
44 int ast_supports_images(struct ast_channel *chan);
45 
46 /*!
47  * \brief Sends an image
48  * \param chan channel to send image on
49  * \param filename filename of image to send (minus extension)
50  * Sends an image on the given channel.
51  * \retval 0 on success
52  * \retval -1 on error
53  */
54 int ast_send_image(struct ast_channel *chan, const char *filename);
55 
56 /*!
57  * \brief Make an image
58  * \param filename filename of image to prepare
59  * \param preflang preferred language to get the image...?
60  * \param format the format of the file, NULL for any image format
61  * Make an image from a filename ??? No estoy positivo
62  * \retval an ast_frame on success
63  * \retval NULL on failure
64  */
65 struct ast_frame *ast_read_image(const char *filename, const char *preflang, struct ast_format *format);
66 
67 /*!
68  * \brief Register image format
69  * \param imgdrv Populated ast_imager structure with info to register
70  * Registers an image format
71  * \return 0 regardless
72  */
73 int ast_image_register(struct ast_imager *imgdrv);
74 
75 /*!
76  * \brief Unregister an image format
77  * \param imgdrv pointer to the ast_imager structure you wish to unregister
78  * Unregisters the image format passed in.
79  * Returns nothing
80  */
81 void ast_image_unregister(struct ast_imager *imgdrv);
82 
83 /*!
84  * \brief Initialize image stuff
85  * Initializes all the various image stuff. Basically just registers the cli stuff
86  * \return 0 all the time
87  */
88 int ast_image_init(void);
89 
90 #endif /* _ASTERISK_IMAGE_H */
structure associated with registering an image format
Definition: image.h:27
Main Channel structure associated with a channel.
int ast_image_init(void)
Initialize image stuff Initializes all the various image stuff. Basically just registers the cli stuf...
Definition: image.c:212
struct ast_frame * ast_read_image(const char *filename, const char *preflang, struct ast_format *format)
Make an image.
Definition: image.c:101
Definition of a media format.
Definition: format.c:43
int ast_image_register(struct ast_imager *imgdrv)
Register image format.
Definition: image.c:48
int ast_send_image(struct ast_channel *chan, const char *filename)
Sends an image.
Definition: image.c:158
int(* write_image)(int fd, struct ast_frame *frame)
Definition: image.h:34
int ast_supports_images(struct ast_channel *chan)
Check for image support on a channel.
Definition: image.c:67
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
AST_LIST_ENTRY(ast_imager) list
int(* identify)(int fd)
Definition: image.h:33
Data structure associated with a single frame of data.
char * desc
Definition: image.h:29
char * name
Definition: image.h:28
void ast_image_unregister(struct ast_imager *imgdrv)
Unregister an image format.
Definition: image.c:57
struct ast_format * format
Definition: image.h:31
char * exts
Definition: image.h:30