1 | /* GStreamer |
2 | * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu> |
3 | * 2005 Wim Taymans <wim@fluendo.com> |
4 | * |
5 | * gstaudioclock.h: Clock for use by audio plugins |
6 | * |
7 | * This library is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU Library General Public |
9 | * License as published by the Free Software Foundation; either |
10 | * version 2 of the License, or (at your option) any later version. |
11 | * |
12 | * This library is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | * Library General Public License for more details. |
16 | * |
17 | * You should have received a copy of the GNU Library General Public |
18 | * License along with this library; if not, write to the |
19 | * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, |
20 | * Boston, MA 02110-1301, USA. |
21 | */ |
22 | |
23 | #ifndef __GST_AUDIO_AUDIO_H__ |
24 | #include <gst/audio/audio.h> |
25 | #endif |
26 | |
27 | #ifndef __GST_AUDIO_CLOCK_H__ |
28 | #define __GST_AUDIO_CLOCK_H__ |
29 | |
30 | #include <gst/gst.h> |
31 | #include <gst/gstsystemclock.h> |
32 | |
33 | G_BEGIN_DECLS |
34 | |
35 | #define GST_TYPE_AUDIO_CLOCK \ |
36 | (gst_audio_clock_get_type()) |
37 | #define GST_AUDIO_CLOCK(obj) \ |
38 | (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_CLOCK,GstAudioClock)) |
39 | #define GST_AUDIO_CLOCK_CLASS(klass) \ |
40 | (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_CLOCK,GstAudioClockClass)) |
41 | #define GST_IS_AUDIO_CLOCK(obj) \ |
42 | (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_CLOCK)) |
43 | #define GST_IS_AUDIO_CLOCK_CLASS(klass) \ |
44 | (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_CLOCK)) |
45 | #define GST_AUDIO_CLOCK_CAST(obj) \ |
46 | ((GstAudioClock*)(obj)) |
47 | |
48 | typedef struct _GstAudioClock GstAudioClock; |
49 | typedef struct _GstAudioClockClass GstAudioClockClass; |
50 | |
51 | /** |
52 | * GstAudioClockGetTimeFunc: |
53 | * @clock: the #GstAudioClock |
54 | * @user_data: user data |
55 | * |
56 | * This function will be called whenever the current clock time needs to be |
57 | * calculated. If this function returns #GST_CLOCK_TIME_NONE, the last reported |
58 | * time will be returned by the clock. |
59 | * |
60 | * Returns: the current time or #GST_CLOCK_TIME_NONE if the previous time should |
61 | * be used. |
62 | */ |
63 | typedef GstClockTime (*GstAudioClockGetTimeFunc) (GstClock *clock, gpointer user_data); |
64 | |
65 | /** |
66 | * GstAudioClock: |
67 | * |
68 | * Opaque #GstAudioClock. |
69 | */ |
70 | struct _GstAudioClock { |
71 | GstSystemClock clock; |
72 | |
73 | /*< protected >*/ |
74 | GstAudioClockGetTimeFunc func; |
75 | gpointer user_data; |
76 | GDestroyNotify destroy_notify; |
77 | |
78 | /*< private >*/ |
79 | GstClockTime last_time; |
80 | GstClockTimeDiff time_offset; |
81 | |
82 | gpointer _gst_reserved[GST_PADDING]; |
83 | }; |
84 | |
85 | struct _GstAudioClockClass { |
86 | GstSystemClockClass parent_class; |
87 | |
88 | /*< private >*/ |
89 | gpointer _gst_reserved[GST_PADDING]; |
90 | }; |
91 | |
92 | GST_AUDIO_API |
93 | GType gst_audio_clock_get_type (void); |
94 | |
95 | GST_AUDIO_API |
96 | GstClock* gst_audio_clock_new (const gchar *name, GstAudioClockGetTimeFunc func, |
97 | gpointer user_data, GDestroyNotify destroy_notify); |
98 | |
99 | GST_AUDIO_API |
100 | void gst_audio_clock_reset (GstAudioClock *clock, GstClockTime time); |
101 | |
102 | GST_AUDIO_API |
103 | GstClockTime gst_audio_clock_get_time (GstAudioClock * clock); |
104 | |
105 | GST_AUDIO_API |
106 | GstClockTime gst_audio_clock_adjust (GstAudioClock * clock, GstClockTime time); |
107 | |
108 | GST_AUDIO_API |
109 | void gst_audio_clock_invalidate (GstAudioClock * clock); |
110 | |
111 | G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAudioClock, gst_object_unref) |
112 | |
113 | G_END_DECLS |
114 | |
115 | #endif /* __GST_AUDIO_CLOCK_H__ */ |
116 | |