Blame libs/gst/check/gsttestclock.h

Packit a6ee4b
/* GstTestClock - A deterministic clock for GStreamer unit tests
Packit a6ee4b
 *
Packit a6ee4b
 * Copyright (C) 2008 Ole André Vadla Ravnås <ole.andre.ravnas@tandberg.com>
Packit a6ee4b
 * Copyright (C) 2012 Sebastian Rasmussen <sebastian.rasmussen@axis.com>
Packit a6ee4b
 * Copyright (C) 2012 Havard Graff <havard@pexip.com>
Packit a6ee4b
 * Copyright (C) 2013 Haakon Sporsheim <haakon@pexip.com>
Packit a6ee4b
 *
Packit a6ee4b
 * This library is free software; you can redistribute it and/or
Packit a6ee4b
 * modify it under the terms of the GNU Library General Public
Packit a6ee4b
 * License as published by the Free Software Foundation; either
Packit a6ee4b
 * version 2 of the License, or (at your option) any later version.
Packit a6ee4b
 *
Packit a6ee4b
 * This library is distributed in the hope that it will be useful,
Packit a6ee4b
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit a6ee4b
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit a6ee4b
 * Library General Public License for more details.
Packit a6ee4b
 *
Packit a6ee4b
 * You should have received a copy of the GNU Library General Public
Packit a6ee4b
 * License along with this library; if not, write to the
Packit a6ee4b
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Packit a6ee4b
 * Boston, MA 02111-1307, USA.
Packit a6ee4b
 */
Packit a6ee4b
Packit a6ee4b
#ifndef __GST_TEST_CLOCK_H__
Packit a6ee4b
#define __GST_TEST_CLOCK_H__
Packit a6ee4b
Packit a6ee4b
#include <gst/gst.h>
Packit a6ee4b
#include <gst/check/check-prelude.h>
Packit a6ee4b
Packit a6ee4b
G_BEGIN_DECLS
Packit a6ee4b
Packit a6ee4b
#define GST_TYPE_TEST_CLOCK (gst_test_clock_get_type ())
Packit a6ee4b
#define GST_TEST_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),\
Packit a6ee4b
    GST_TYPE_TEST_CLOCK, GstTestClock))
Packit a6ee4b
#define GST_IS_TEST_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
Packit a6ee4b
    GST_TYPE_TEST_CLOCK))
Packit a6ee4b
#define GST_TEST_CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),\
Packit a6ee4b
    GST_TYPE_TEST_CLOCK, GstTestClockClass))
Packit a6ee4b
#define GST_IS_TEST_CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE (\
Packit a6ee4b
    (klass), GST_TYPE_TEST_CLOCK))
Packit a6ee4b
#define GST_TEST_CLOCK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS (\
Packit a6ee4b
    (obj), GST_TYPE_TEST_CLOCK, GstTestClockClass))
Packit a6ee4b
#define GST_TEST_CLOCK_CAST(obj) ((GstTestClock*)(obj))
Packit a6ee4b
Packit a6ee4b
typedef struct _GstTestClock GstTestClock;
Packit a6ee4b
typedef struct _GstTestClockClass GstTestClockClass;
Packit a6ee4b
typedef struct _GstTestClockPrivate GstTestClockPrivate;
Packit a6ee4b
Packit a6ee4b
/**
Packit a6ee4b
 * GstTestClock:
Packit a6ee4b
 *
Packit a6ee4b
 * A #GstTestClock structure which is based on a #GstClock along with some
Packit a6ee4b
 * private data.
Packit a6ee4b
 *
Packit a6ee4b
 * Since: 1.2
Packit a6ee4b
 */
Packit a6ee4b
struct _GstTestClock
Packit a6ee4b
{
Packit a6ee4b
  GstClock parent;
Packit a6ee4b
Packit a6ee4b
  /*< private >*/
Packit a6ee4b
  GstTestClockPrivate *priv;
Packit a6ee4b
};
Packit a6ee4b
Packit a6ee4b
/**
Packit a6ee4b
 * GstTestClockClass:
Packit a6ee4b
 * @parent_class: the parent class structure
Packit a6ee4b
 *
Packit a6ee4b
 * The class of a #GstTestClock, which has no virtual methods to override.
Packit a6ee4b
 *
Packit a6ee4b
 * Since: 1.2
Packit a6ee4b
 */
Packit a6ee4b
struct _GstTestClockClass
Packit a6ee4b
{
Packit a6ee4b
  GstClockClass parent_class;
Packit a6ee4b
};
Packit a6ee4b
Packit a6ee4b
GST_CHECK_API
Packit a6ee4b
GType         gst_test_clock_get_type (void);
Packit a6ee4b
Packit a6ee4b
GST_CHECK_API
Packit a6ee4b
GstClock *    gst_test_clock_new (void);
Packit a6ee4b
Packit a6ee4b
GST_CHECK_API
Packit a6ee4b
GstClock *    gst_test_clock_new_with_start_time (GstClockTime start_time);
Packit a6ee4b
Packit a6ee4b
GST_CHECK_API
Packit a6ee4b
void          gst_test_clock_set_time (GstTestClock * test_clock,
Packit a6ee4b
                                      GstClockTime   new_time);
Packit a6ee4b
Packit a6ee4b
GST_CHECK_API
Packit a6ee4b
void          gst_test_clock_advance_time (GstTestClock *   test_clock,
Packit a6ee4b
                                          GstClockTimeDiff delta);
Packit a6ee4b
Packit a6ee4b
GST_CHECK_API
Packit a6ee4b
guint         gst_test_clock_peek_id_count (GstTestClock * test_clock);
Packit a6ee4b
Packit a6ee4b
GST_CHECK_API
Packit a6ee4b
gboolean      gst_test_clock_has_id (GstTestClock * test_clock, GstClockID id);
Packit a6ee4b
Packit a6ee4b
GST_CHECK_API
Packit a6ee4b
gboolean      gst_test_clock_peek_next_pending_id (GstTestClock * test_clock,
Packit a6ee4b
                                                   GstClockID   * pending_id);
Packit a6ee4b
Packit a6ee4b
GST_CHECK_API
Packit a6ee4b
void          gst_test_clock_wait_for_next_pending_id (GstTestClock * test_clock,
Packit a6ee4b
                                                       GstClockID   * pending_id);
Packit a6ee4b
Packit a6ee4b
GST_CHECK_DEPRECATED_FOR(gst_test_clock_wait_for_multiple_pending_ids)
Packit a6ee4b
void          gst_test_clock_wait_for_pending_id_count (GstTestClock * test_clock,
Packit a6ee4b
                                                        guint          count);
Packit a6ee4b
Packit a6ee4b
GST_CHECK_API
Packit a6ee4b
GstClockID    gst_test_clock_process_next_clock_id (GstTestClock * test_clock);
Packit a6ee4b
Packit a6ee4b
GST_CHECK_API
Packit a6ee4b
GstClockTime  gst_test_clock_get_next_entry_time   (GstTestClock * test_clock);
Packit a6ee4b
Packit a6ee4b
GST_CHECK_API
Packit a6ee4b
void          gst_test_clock_wait_for_multiple_pending_ids (GstTestClock * test_clock,
Packit a6ee4b
                                                            guint          count,
Packit a6ee4b
                                                            GList       ** pending_list);
Packit a6ee4b
Packit a6ee4b
GST_CHECK_API
Packit a6ee4b
gboolean      gst_test_clock_timed_wait_for_multiple_pending_ids (GstTestClock * test_clock,
Packit a6ee4b
                                                                  guint          count,
Packit a6ee4b
                                                                  guint          timeout_ms,
Packit a6ee4b
                                                                  GList       ** pending_list);
Packit a6ee4b
Packit a6ee4b
GST_CHECK_API
Packit a6ee4b
guint         gst_test_clock_process_id_list (GstTestClock * test_clock,
Packit a6ee4b
                                              const GList  * pending_list);
Packit a6ee4b
Packit a6ee4b
GST_CHECK_API
Packit a6ee4b
GstClockTime  gst_test_clock_id_list_get_latest_time (const GList * pending_list);
Packit a6ee4b
Packit a6ee4b
GST_CHECK_API
Packit a6ee4b
gboolean      gst_test_clock_crank (GstTestClock * test_clock);
Packit a6ee4b
Packit a6ee4b
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
Packit a6ee4b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstTestClock, gst_object_unref)
Packit a6ee4b
#endif
Packit a6ee4b
Packit a6ee4b
G_END_DECLS
Packit a6ee4b
Packit a6ee4b
#endif /* __GST_TEST_CLOCK_H__ */