segment: remove abs_rate from segment structure
[platform/upstream/gstreamer.git] / gst / gstsegment.h
1 /* GStreamer
2  * Copyright (C) 2005 Wim Taymans <wim@fluendo.com>
3  *
4  * gstsegment.h: Header for GstSegment subsystem
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22
23 #ifndef __GST_SEGMENT_H__
24 #define __GST_SEGMENT_H__
25
26 #include <gst/gstevent.h>
27 #include <gst/gstformat.h>
28
29 G_BEGIN_DECLS
30
31 #define GST_TYPE_SEGMENT             (gst_segment_get_type())
32
33 typedef struct _GstSegment GstSegment;
34
35 /**
36  * GstSegment:
37  * @rate: the rate of the segment
38  * @format: the format of the segment values
39  * @flags: flags for this segment
40  * @start: the start of the segment
41  * @stop: the stop of the segment
42  * @time: the stream time of the segment
43  * @accum: accumulated segment
44  * @last_stop: last known stop time
45  * @duration: total duration of segment
46  * @applied_rate: the already applied rate to the segment
47  *
48  * A helper structure that holds the configured region of
49  * interest in a media file.
50  */
51 struct _GstSegment {
52   /*< public >*/
53   gdouble        rate;
54   gdouble        applied_rate;
55   GstFormat      format;
56   GstSeekFlags   flags;
57   gint64         start;
58   gint64         stop;
59   gint64         time;
60   gint64         accum;
61
62   gint64         last_stop;
63   gint64         duration;
64
65   /*< private >*/
66   gpointer _gst_reserved[GST_PADDING];
67 };
68
69 GType        gst_segment_get_type            (void);
70
71 GstSegment * gst_segment_new                 (void);
72 GstSegment * gst_segment_copy                (GstSegment *segment);
73 void         gst_segment_free                (GstSegment *segment);
74
75 void         gst_segment_init                (GstSegment *segment, GstFormat format);
76
77 void         gst_segment_set_duration        (GstSegment *segment, GstFormat format, gint64 duration);
78 void         gst_segment_set_last_stop       (GstSegment *segment, GstFormat format, gint64 position);
79
80 void         gst_segment_set_seek            (GstSegment *segment, gdouble rate,
81                                               GstFormat format, GstSeekFlags flags,
82                                               GstSeekType start_type, gint64 start,
83                                               GstSeekType stop_type, gint64 stop,
84                                               gboolean *update);
85
86 void         gst_segment_set_newsegment      (GstSegment *segment, gboolean update, gdouble rate,
87                                               GstFormat format, gint64 start, gint64 stop, gint64 time);
88 void         gst_segment_set_newsegment_full (GstSegment *segment, gboolean update, gdouble rate,
89                                               gdouble applied_rate, GstFormat format, gint64 start,
90                                               gint64 stop, gint64 time);
91
92 gint64       gst_segment_to_stream_time      (GstSegment *segment, GstFormat format, gint64 position);
93 gint64       gst_segment_to_running_time     (GstSegment *segment, GstFormat format, gint64 position);
94 gint64       gst_segment_to_position         (GstSegment *segment, GstFormat format, gint64 running_time);
95
96 gboolean     gst_segment_clip                (GstSegment *segment, GstFormat format, gint64 start,
97                                               gint64 stop, gint64 *clip_start, gint64 *clip_stop);
98
99 gboolean     gst_segment_set_running_time    (GstSegment *segment, GstFormat format, gint64 running_time);
100
101
102 G_END_DECLS
103
104 #endif /* __GST_SEGMENT_H__ */