gstrtsprange.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /* GStreamer
  2. * Copyright (C) <2005,2006> Wim Taymans <[email protected]>
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Library General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Library General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Library General Public
  15. * License along with this library; if not, write to the
  16. * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  17. * Boston, MA 02110-1301, USA.
  18. */
  19. /*
  20. * Unless otherwise indicated, Source Code is licensed under MIT license.
  21. * See further explanation attached in License Statement (distributed in the file
  22. * LICENSE).
  23. *
  24. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  25. * this software and associated documentation files (the "Software"), to deal in
  26. * the Software without restriction, including without limitation the rights to
  27. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  28. * of the Software, and to permit persons to whom the Software is furnished to do
  29. * so, subject to the following conditions:
  30. *
  31. * The above copyright notice and this permission notice shall be included in all
  32. * copies or substantial portions of the Software.
  33. *
  34. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  35. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  36. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  37. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  38. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  39. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  40. * SOFTWARE.
  41. */
  42. #ifndef __GST_RTSP_RANGE_H__
  43. #define __GST_RTSP_RANGE_H__
  44. #include <glib.h>
  45. #include <gst/gst.h>
  46. #include <gst/rtsp/gstrtspdefs.h>
  47. G_BEGIN_DECLS
  48. /**
  49. * GstRTSPRangeUnit:
  50. * @GST_RTSP_RANGE_SMPTE: SMPTE timecode
  51. * @GST_RTSP_RANGE_SMPTE_30_DROP: 29.97 frames per second
  52. * @GST_RTSP_RANGE_SMPTE_25: 25 frames per second
  53. * @GST_RTSP_RANGE_NPT: Normal play time
  54. * @GST_RTSP_RANGE_CLOCK: Absolute time expressed as ISO 8601 timestamps
  55. *
  56. * Different possible time range units.
  57. */
  58. typedef enum
  59. {
  60. GST_RTSP_RANGE_SMPTE,
  61. GST_RTSP_RANGE_SMPTE_30_DROP,
  62. GST_RTSP_RANGE_SMPTE_25,
  63. GST_RTSP_RANGE_NPT,
  64. GST_RTSP_RANGE_CLOCK
  65. } GstRTSPRangeUnit;
  66. typedef struct _GstRTSPTimeRange GstRTSPTimeRange;
  67. typedef struct _GstRTSPTime GstRTSPTime;
  68. typedef struct _GstRTSPTime2 GstRTSPTime2;
  69. /**
  70. * GstRTSPTimeType:
  71. * @GST_RTSP_TIME_SECONDS: seconds
  72. * @GST_RTSP_TIME_NOW: now
  73. * @GST_RTSP_TIME_END: end
  74. * @GST_RTSP_TIME_FRAMES: frames and subframes
  75. * @GST_RTSP_TIME_UTC: UTC time
  76. *
  77. * Possible time types.
  78. */
  79. typedef enum {
  80. GST_RTSP_TIME_SECONDS,
  81. GST_RTSP_TIME_NOW,
  82. GST_RTSP_TIME_END,
  83. GST_RTSP_TIME_FRAMES,
  84. GST_RTSP_TIME_UTC
  85. } GstRTSPTimeType;
  86. /**
  87. * GstRTSPTime:
  88. * @type: the time of the time
  89. * @seconds: seconds when @type is GST_RTSP_TIME_SECONDS,
  90. * GST_RTSP_TIME_UTC and GST_RTSP_TIME_FRAMES
  91. *
  92. * A time indication.
  93. */
  94. struct _GstRTSPTime {
  95. GstRTSPTimeType type;
  96. gdouble seconds;
  97. };
  98. /**
  99. * GstRTSPTime2:
  100. * @frames: frames and subframes when type in GstRTSPTime is
  101. * GST_RTSP_TIME_FRAMES
  102. * @year: year when type is GST_RTSP_TIME_UTC
  103. * @month: month when type is GST_RTSP_TIME_UTC
  104. * @day: day when type is GST_RTSP_TIME_UTC
  105. *
  106. * Extra fields for a time indication.
  107. *
  108. * Since: 1.2
  109. */
  110. struct _GstRTSPTime2 {
  111. gdouble frames;
  112. guint year;
  113. guint month;
  114. guint day;
  115. };
  116. /**
  117. * GstRTSPTimeRange:
  118. * @unit: the time units used
  119. * @min: the minimum interval
  120. * @max: the maximum interval
  121. * @min2: extra fields in the minimum interval (Since: 1.2)
  122. * @max2: extra fields in the maximum interval (Since: 1.2)
  123. *
  124. * A time range.
  125. */
  126. struct _GstRTSPTimeRange {
  127. GstRTSPRangeUnit unit;
  128. GstRTSPTime min;
  129. GstRTSPTime max;
  130. GstRTSPTime2 min2;
  131. GstRTSPTime2 max2;
  132. };
  133. GstRTSPResult gst_rtsp_range_parse (const gchar *rangestr, GstRTSPTimeRange **range);
  134. gchar * gst_rtsp_range_to_string (const GstRTSPTimeRange *range);
  135. void gst_rtsp_range_free (GstRTSPTimeRange *range);
  136. gboolean gst_rtsp_range_get_times (const GstRTSPTimeRange *range,
  137. GstClockTime *min, GstClockTime *max);
  138. gboolean gst_rtsp_range_convert_units (GstRTSPTimeRange * range,
  139. GstRTSPRangeUnit unit);
  140. G_END_DECLS
  141. #endif /* __GST_RTSP_RANGE_H__ */