gsttestclock.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /* GstTestClock - A deterministic clock for GStreamer unit tests
  2. *
  3. * Copyright (C) 2008 Ole André Vadla Ravnås <[email protected]>
  4. * Copyright (C) 2012 Sebastian Rasmussen <[email protected]>
  5. * Copyright (C) 2012 Havard Graff <[email protected]>
  6. * Copyright (C) 2013 Haakon Sporsheim <[email protected]>
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Library General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2 of the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Library General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Library General Public
  19. * License along with this library; if not, write to the
  20. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  21. * Boston, MA 02111-1307, USA.
  22. */
  23. #ifndef __GST_TEST_CLOCK_H__
  24. #define __GST_TEST_CLOCK_H__
  25. #include <gst/gst.h>
  26. G_BEGIN_DECLS
  27. #define GST_TYPE_TEST_CLOCK (gst_test_clock_get_type ())
  28. #define GST_TEST_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),\
  29. GST_TYPE_TEST_CLOCK, GstTestClock))
  30. #define GST_IS_TEST_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
  31. GST_TYPE_TEST_CLOCK))
  32. #define GST_TEST_CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),\
  33. GST_TYPE_TEST_CLOCK, GstTestClockClass))
  34. #define GST_IS_TEST_CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE (\
  35. (klass), GST_TYPE_TEST_CLOCK))
  36. #define GST_TEST_CLOCK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS (\
  37. (obj), GST_TYPE_TEST_CLOCK, GstTestClockClass))
  38. #define GST_TEST_CLOCK_CAST(obj) ((GstTestClock*)(obj))
  39. typedef struct _GstTestClock GstTestClock;
  40. typedef struct _GstTestClockClass GstTestClockClass;
  41. typedef struct _GstTestClockPrivate GstTestClockPrivate;
  42. /**
  43. * GstTestClock:
  44. *
  45. * A #GstTestClock structure which is based on a #GstClock along with some
  46. * private data.
  47. *
  48. * Since: 1.2
  49. */
  50. struct _GstTestClock
  51. {
  52. GstClock parent;
  53. /*< private >*/
  54. GstTestClockPrivate *priv;
  55. };
  56. /**
  57. * GstTestClockClass:
  58. * @parent_class: the parent class structure
  59. *
  60. * The class of a #GstTestClock, which has no virtual methods to override.
  61. *
  62. * Since: 1.2
  63. */
  64. struct _GstTestClockClass
  65. {
  66. GstClockClass parent_class;
  67. };
  68. GType gst_test_clock_get_type (void);
  69. GstClock * gst_test_clock_new (void);
  70. GstClock * gst_test_clock_new_with_start_time (GstClockTime start_time);
  71. void gst_test_clock_set_time (GstTestClock * test_clock,
  72. GstClockTime new_time);
  73. void gst_test_clock_advance_time (GstTestClock * test_clock,
  74. GstClockTimeDiff delta);
  75. guint gst_test_clock_peek_id_count (GstTestClock * test_clock);
  76. gboolean gst_test_clock_has_id (GstTestClock * test_clock, GstClockID id);
  77. gboolean gst_test_clock_peek_next_pending_id (GstTestClock * test_clock,
  78. GstClockID * pending_id);
  79. void gst_test_clock_wait_for_next_pending_id (GstTestClock * test_clock,
  80. GstClockID * pending_id);
  81. #ifndef GST_DISABLE_DEPRECATED
  82. void gst_test_clock_wait_for_pending_id_count (GstTestClock * test_clock,
  83. guint count);
  84. #endif
  85. GstClockID gst_test_clock_process_next_clock_id (GstTestClock * test_clock);
  86. GstClockTime gst_test_clock_get_next_entry_time (GstTestClock * test_clock);
  87. void gst_test_clock_wait_for_multiple_pending_ids (GstTestClock * test_clock,
  88. guint count,
  89. GList ** pending_list);
  90. guint gst_test_clock_process_id_list (GstTestClock * test_clock,
  91. const GList * pending_list);
  92. GstClockTime gst_test_clock_id_list_get_latest_time (const GList * pending_list);
  93. G_END_DECLS
  94. #endif /* __GST_TEST_CLOCK_H__ */