format_compatibility.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Asterisk -- An open source telephony toolkit.
  3. *
  4. * Copyright (C) 2014, Digium, Inc.
  5. *
  6. * Joshua Colp <jcolp@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 Media Format Bitfield Compatibility API
  21. *
  22. * \author Joshua Colp <jcolp@digium.com>
  23. */
  24. #ifndef _IAX2_FORMAT_COMPATIBILITY_H_
  25. #define _IAX2_FORMAT_COMPATIBILITY_H_
  26. struct ast_format;
  27. struct ast_format_cap;
  28. /*!
  29. * \brief Convert a format capabilities structure to a bitfield
  30. *
  31. * \param cap Capabilities structure containing formats
  32. *
  33. * \retval non-zero success
  34. * \retval zero no formats present or no formats supported
  35. */
  36. uint64_t iax2_format_compatibility_cap2bitfield(const struct ast_format_cap *cap);
  37. /*!
  38. * \brief Convert a bitfield to a format capabilities structure
  39. *
  40. * \param bitfield The bitfield for the media formats
  41. * \param cap Capabilities structure to place formats into
  42. *
  43. * \retval 0 on success.
  44. * \retval -1 on error.
  45. *
  46. * \note If failure occurs the capabilities structure may contain a partial set of formats
  47. */
  48. int iax2_format_compatibility_bitfield2cap(uint64_t bitfield, struct ast_format_cap *cap);
  49. /*!
  50. * \brief Pick the best format from the given bitfield formats.
  51. *
  52. * \param formats The bitfield for the media formats
  53. *
  54. * \retval non-zero Best format out of the given formats.
  55. * \retval zero No formats present or no formats considered best.
  56. */
  57. uint64_t iax2_format_compatibility_best(uint64_t formats);
  58. #endif /* _IAX2_FORMAT_COMPATIBILITY_H */