• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer
2  * Copyright (C) <2005,2006> Wim Taymans <wim@fluendo.com>
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 
43 #ifndef __GST_RTSP_RANGE_H__
44 #define __GST_RTSP_RANGE_H__
45 
46 #include <glib.h>
47 #include <gst/gst.h>
48 
49 #include <gst/rtsp/gstrtspdefs.h>
50 
51 G_BEGIN_DECLS
52 
53 /**
54  * GstRTSPRangeUnit:
55  * @GST_RTSP_RANGE_SMPTE: SMPTE timecode
56  * @GST_RTSP_RANGE_SMPTE_30_DROP: 29.97 frames per second
57  * @GST_RTSP_RANGE_SMPTE_25: 25 frames per second
58  * @GST_RTSP_RANGE_NPT: Normal play time
59  * @GST_RTSP_RANGE_CLOCK: Absolute time expressed as ISO 8601 timestamps
60  *
61  * Different possible time range units.
62  */
63 typedef enum
64 {
65   GST_RTSP_RANGE_SMPTE,
66   GST_RTSP_RANGE_SMPTE_30_DROP,
67   GST_RTSP_RANGE_SMPTE_25,
68   GST_RTSP_RANGE_NPT,
69   GST_RTSP_RANGE_CLOCK
70 } GstRTSPRangeUnit;
71 
72 typedef struct _GstRTSPTimeRange GstRTSPTimeRange;
73 typedef struct _GstRTSPTime GstRTSPTime;
74 typedef struct _GstRTSPTime2 GstRTSPTime2;
75 
76 /**
77  * GstRTSPTimeType:
78  * @GST_RTSP_TIME_SECONDS: seconds
79  * @GST_RTSP_TIME_NOW: now
80  * @GST_RTSP_TIME_END: end
81  * @GST_RTSP_TIME_FRAMES: frames and subframes
82  * @GST_RTSP_TIME_UTC: UTC time
83  *
84  * Possible time types.
85  */
86 typedef enum {
87   GST_RTSP_TIME_SECONDS,
88   GST_RTSP_TIME_NOW,
89   GST_RTSP_TIME_END,
90   GST_RTSP_TIME_FRAMES,
91   GST_RTSP_TIME_UTC
92 } GstRTSPTimeType;
93 
94 /**
95  * GstRTSPTime:
96  * @type: the time of the time
97  * @seconds: seconds when @type is GST_RTSP_TIME_SECONDS,
98  *           GST_RTSP_TIME_UTC and GST_RTSP_TIME_FRAMES
99  *
100  * A time indication.
101  */
102 struct _GstRTSPTime {
103   GstRTSPTimeType type;
104   gdouble         seconds;
105 };
106 
107 /**
108  * GstRTSPTime2:
109  * @frames: frames and subframes when type in GstRTSPTime is
110  *          GST_RTSP_TIME_FRAMES
111  * @year: year when type is GST_RTSP_TIME_UTC
112  * @month: month when type is GST_RTSP_TIME_UTC
113  * @day: day when type is GST_RTSP_TIME_UTC
114  *
115  * Extra fields for a time indication.
116  *
117  * Since: 1.2
118  */
119 struct _GstRTSPTime2 {
120   gdouble         frames;
121   guint           year;
122   guint           month;
123   guint           day;
124 };
125 
126 /**
127  * GstRTSPTimeRange:
128  * @unit: the time units used
129  * @min: the minimum interval
130  * @max: the maximum interval
131  * @min2: extra fields in the minimum interval (Since: 1.2)
132  * @max2: extra fields in the maximum interval (Since: 1.2)
133  *
134  * A time range.
135  */
136 struct _GstRTSPTimeRange {
137   GstRTSPRangeUnit unit;
138 
139   GstRTSPTime  min;
140   GstRTSPTime  max;
141   GstRTSPTime2 min2;
142   GstRTSPTime2 max2;
143 };
144 
145 GST_RTSP_API
146 GstRTSPResult   gst_rtsp_range_parse        (const gchar *rangestr, GstRTSPTimeRange **range);
147 
148 GST_RTSP_API
149 gchar *         gst_rtsp_range_to_string    (const GstRTSPTimeRange *range);
150 
151 GST_RTSP_API
152 void            gst_rtsp_range_free         (GstRTSPTimeRange *range);
153 
154 GST_RTSP_API
155 gboolean        gst_rtsp_range_get_times     (const GstRTSPTimeRange *range,
156                                               GstClockTime *min, GstClockTime *max);
157 
158 GST_RTSP_API
159 gboolean        gst_rtsp_range_convert_units (GstRTSPTimeRange * range,
160                                               GstRTSPRangeUnit unit);
161 
162 G_END_DECLS
163 
164 #endif /* __GST_RTSP_RANGE_H__ */
165