image.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. /*! \file
  19. * \brief General Asterisk channel definitions for image handling
  20. */
  21. #ifndef _ASTERISK_IMAGE_H
  22. #define _ASTERISK_IMAGE_H
  23. /*! \brief structure associated with registering an image format */
  24. struct ast_imager {
  25. char *name; /*!< Name */
  26. char *desc; /*!< Description */
  27. char *exts; /*!< Extension(s) (separated by '|' ) */
  28. struct ast_format *format; /*!< Image format */
  29. struct ast_frame *(*read_image)(int fd, int len); /*!< Read an image from a file descriptor */
  30. int (*identify)(int fd); /*!< Identify if this is that type of file */
  31. int (*write_image)(int fd, struct ast_frame *frame); /*!< Returns length written */
  32. AST_LIST_ENTRY(ast_imager) list; /*!< For linked list */
  33. };
  34. /*!
  35. * \brief Check for image support on a channel
  36. * \param chan channel to check
  37. * Checks the channel to see if it supports the transmission of images
  38. * \return non-zero if image transmission is supported
  39. */
  40. int ast_supports_images(struct ast_channel *chan);
  41. /*!
  42. * \brief Sends an image
  43. * \param chan channel to send image on
  44. * \param filename filename of image to send (minus extension)
  45. * Sends an image on the given channel.
  46. * \retval 0 on success
  47. * \retval -1 on error
  48. */
  49. int ast_send_image(struct ast_channel *chan, const char *filename);
  50. /*!
  51. * \brief Make an image
  52. * \param filename filename of image to prepare
  53. * \param preflang preferred language to get the image...?
  54. * \param format the format of the file, NULL for any image format
  55. * Make an image from a filename ??? No estoy positivo
  56. * \retval an ast_frame on success
  57. * \retval NULL on failure
  58. */
  59. struct ast_frame *ast_read_image(const char *filename, const char *preflang, struct ast_format *format);
  60. /*!
  61. * \brief Register image format
  62. * \param imgdrv Populated ast_imager structure with info to register
  63. * Registers an image format
  64. * \return 0 regardless
  65. */
  66. int ast_image_register(struct ast_imager *imgdrv);
  67. /*!
  68. * \brief Unregister an image format
  69. * \param imgdrv pointer to the ast_imager structure you wish to unregister
  70. * Unregisters the image format passed in.
  71. * Returns nothing
  72. */
  73. void ast_image_unregister(struct ast_imager *imgdrv);
  74. /*!
  75. * \brief Initialize image stuff
  76. * Initializes all the various image stuff. Basically just registers the cli stuff
  77. * \return 0 all the time
  78. */
  79. int ast_image_init(void);
  80. #endif /* _ASTERISK_IMAGE_H */