Asterisk - The Open Source Telephony Project GIT-master-2de1a68
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 <markster@digium.com>
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 */
27struct 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 */
44int 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 */
54int 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 */
65struct 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 */
73int 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 */
80void ast_image_unregister(struct ast_imager *imgdrv);
81
82/*!
83 * \brief Initialize image stuff
84 * Initializes all the various image stuff. Basically just registers the cli stuff
85 * \return 0 all the time
86 */
87int ast_image_init(void);
88
89#endif /* _ASTERISK_IMAGE_H */
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
int ast_send_image(struct ast_channel *chan, const char *filename)
Sends an image.
Definition: image.c:158
int ast_image_init(void)
Initialize image stuff Initializes all the various image stuff. Basically just registers the cli stuf...
Definition: image.c:212
void ast_image_unregister(struct ast_imager *imgdrv)
Unregister an image format.
Definition: image.c:57
int ast_supports_images(struct ast_channel *chan)
Check for image support on a channel.
Definition: image.c:67
int ast_image_register(struct ast_imager *imgdrv)
Register image format.
Definition: image.c:48
struct ast_frame * ast_read_image(const char *filename, const char *preflang, struct ast_format *format)
Make an image.
Definition: image.c:101
Main Channel structure associated with a channel.
Definition of a media format.
Definition: format.c:43
Data structure associated with a single frame of data.
structure associated with registering an image format
Definition: image.h:27
char * desc
Definition: image.h:29
char * name
Definition: image.h:28
int(* identify)(int fd)
Definition: image.h:33
int(* write_image)(int fd, struct ast_frame *frame)
Definition: image.h:34
struct ast_format * format
Definition: image.h:31
char * exts
Definition: image.h:30
AST_LIST_ENTRY(ast_imager) list