tmedia_imageattr.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Copyright (C) 2012 Doubango Telecom <http://www.doubango.org>
  3. *
  4. * Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
  5. *
  6. * This file is part of Open Source Doubango Framework.
  7. *
  8. * DOUBANGO is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * DOUBANGO is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with DOUBANGO.
  20. *
  21. */
  22. /**@file tmedia_imageattr.h
  23. * @brief 'image-attr' parser as per RFC 6236
  24. *
  25. * @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
  26. *
  27. */
  28. #ifndef TINYMEDIA_imageattr_H
  29. #define TINYMEDIA_imageattr_H
  30. #include "tinymedia_config.h"
  31. #include "tmedia_common.h"
  32. TMEDIA_BEGIN_DECLS
  33. #define TMEDIA_imageattr_ARRAY_MAX_SIZE 16
  34. typedef int32_t xyvalue_t;
  35. typedef double qvalue_t;
  36. typedef double spvalue_t;
  37. typedef struct tmedia_imageattr_srange_xs {
  38. unsigned is_range:1;
  39. union {
  40. struct {
  41. spvalue_t start;
  42. spvalue_t end;
  43. } range;
  44. struct {
  45. spvalue_t values[TMEDIA_imageattr_ARRAY_MAX_SIZE + 1];
  46. tsk_size_t count;
  47. } array;
  48. };
  49. }
  50. tmedia_imageattr_srange_xt;
  51. typedef struct tmedia_imageattr_xyrange_xs {
  52. unsigned is_range:1;
  53. union {
  54. struct {
  55. xyvalue_t start;
  56. xyvalue_t step;
  57. xyvalue_t end;
  58. } range;
  59. struct {
  60. xyvalue_t values[TMEDIA_imageattr_ARRAY_MAX_SIZE + 1];
  61. tsk_size_t count;
  62. } array;
  63. };
  64. }
  65. tmedia_imageattr_xyrange_xt;
  66. typedef struct tmedia_imageattr_set_xs {
  67. tmedia_imageattr_xyrange_xt xrange;
  68. tmedia_imageattr_xyrange_xt yrange;
  69. tmedia_imageattr_srange_xt srange;
  70. struct {
  71. unsigned is_present:1;
  72. spvalue_t start;
  73. spvalue_t end;
  74. } prange;
  75. qvalue_t qvalue;
  76. }
  77. tmedia_imageattr_set_xt;
  78. typedef struct tmedia_imageattr_xs {
  79. struct {
  80. tmedia_imageattr_set_xt sets[TMEDIA_imageattr_ARRAY_MAX_SIZE + 1];
  81. tsk_size_t count;
  82. } send;
  83. struct {
  84. tmedia_imageattr_set_xt sets[TMEDIA_imageattr_ARRAY_MAX_SIZE + 1];
  85. tsk_size_t count;
  86. } recv;
  87. }
  88. tmedia_imageattr_xt;
  89. TINYMEDIA_API int tmedia_imageattr_parse(tmedia_imageattr_xt* self, const void* in_data, tsk_size_t in_size);
  90. TMEDIA_END_DECLS
  91. #endif /* TINYMEDIA_imageattr_H */