gstaudioclock.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. #ifndef __GST_AUDIO_AUDIO_H__
  23. #include <gst/audio/audio.h>
  24. #endif
  25. #ifndef __GST_AUDIO_CLOCK_H__
  26. #define __GST_AUDIO_CLOCK_H__
  27. #include <gst/gst.h>
  28. #include <gst/gstsystemclock.h>
  29. G_BEGIN_DECLS
  30. #define GST_TYPE_AUDIO_CLOCK \
  31. (gst_audio_clock_get_type())
  32. #define GST_AUDIO_CLOCK(obj) \
  33. (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_CLOCK,GstAudioClock))
  34. #define GST_AUDIO_CLOCK_CLASS(klass) \
  35. (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_CLOCK,GstAudioClockClass))
  36. #define GST_IS_AUDIO_CLOCK(obj) \
  37. (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_CLOCK))
  38. #define GST_IS_AUDIO_CLOCK_CLASS(klass) \
  39. (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_CLOCK))
  40. #define GST_AUDIO_CLOCK_CAST(obj) \
  41. ((GstAudioClock*)(obj))
  42. typedef struct _GstAudioClock GstAudioClock;
  43. typedef struct _GstAudioClockClass GstAudioClockClass;
  44. /**
  45. * GstAudioClockGetTimeFunc:
  46. * @clock: the #GstAudioClock
  47. * @user_data: user data
  48. *
  49. * This function will be called whenever the current clock time needs to be
  50. * calculated. If this function returns #GST_CLOCK_TIME_NONE, the last reported
  51. * time will be returned by the clock.
  52. *
  53. * Returns: the current time or #GST_CLOCK_TIME_NONE if the previous time should
  54. * be used.
  55. */
  56. typedef GstClockTime (*GstAudioClockGetTimeFunc) (GstClock *clock, gpointer user_data);
  57. /**
  58. * GstAudioClock:
  59. *
  60. * Opaque #GstAudioClock.
  61. */
  62. struct _GstAudioClock {
  63. GstSystemClock clock;
  64. /*< protected >*/
  65. GstAudioClockGetTimeFunc func;
  66. gpointer user_data;
  67. GDestroyNotify destroy_notify;
  68. /*< private >*/
  69. GstClockTime last_time;
  70. GstClockTimeDiff time_offset;
  71. gpointer _gst_reserved[GST_PADDING];
  72. };
  73. struct _GstAudioClockClass {
  74. GstSystemClockClass parent_class;
  75. /*< private >*/
  76. gpointer _gst_reserved[GST_PADDING];
  77. };
  78. GType gst_audio_clock_get_type (void);
  79. GstClock* gst_audio_clock_new (const gchar *name, GstAudioClockGetTimeFunc func,
  80. gpointer user_data, GDestroyNotify destroy_notify);
  81. void gst_audio_clock_reset (GstAudioClock *clock, GstClockTime time);
  82. GstClockTime gst_audio_clock_get_time (GstClock * clock);
  83. GstClockTime gst_audio_clock_adjust (GstClock * clock, GstClockTime time);
  84. void gst_audio_clock_invalidate (GstClock * clock);
  85. #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
  86. G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAudioClock, gst_object_unref)
  87. #endif
  88. G_END_DECLS
  89. #endif /* __GST_AUDIO_CLOCK_H__ */