Blame gst/gstclock.h

Packit Service 963350
/* GStreamer
Packit Service 963350
 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
Packit Service 963350
 *                    2000 Wim Taymans <wtay@chello.be>
Packit Service 963350
 *                    2005 Wim Taymans <wim@fluendo.com>
Packit Service 963350
 *
Packit Service 963350
 * gstclock.h: Header for clock subsystem
Packit Service 963350
 *
Packit Service 963350
 * This library is free software; you can redistribute it and/or
Packit Service 963350
 * modify it under the terms of the GNU Library General Public
Packit Service 963350
 * License as published by the Free Software Foundation; either
Packit Service 963350
 * version 2 of the License, or (at your option) any later version.
Packit Service 963350
 *
Packit Service 963350
 * This library is distributed in the hope that it will be useful,
Packit Service 963350
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 963350
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 963350
 * Library General Public License for more details.
Packit Service 963350
 *
Packit Service 963350
 * You should have received a copy of the GNU Library General Public
Packit Service 963350
 * License along with this library; if not, write to the
Packit Service 963350
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Packit Service 963350
 * Boston, MA 02110-1301, USA.
Packit Service 963350
 */
Packit Service 963350
Packit Service 963350
#ifndef __GST_CLOCK_H__
Packit Service 963350
#define __GST_CLOCK_H__
Packit Service 963350
Packit Service 963350
#include <gst/gstconfig.h>
Packit Service 963350
#include <glib.h>
Packit Service 963350
Packit Service 963350
G_BEGIN_DECLS
Packit Service 963350
Packit Service 963350
/* --- standard type macros --- */
Packit Service 963350
#define GST_TYPE_CLOCK                  (gst_clock_get_type ())
Packit Service 963350
#define GST_CLOCK(clock)                (G_TYPE_CHECK_INSTANCE_CAST ((clock), GST_TYPE_CLOCK, GstClock))
Packit Service 963350
#define GST_IS_CLOCK(clock)             (G_TYPE_CHECK_INSTANCE_TYPE ((clock), GST_TYPE_CLOCK))
Packit Service 963350
#define GST_CLOCK_CLASS(cclass)         (G_TYPE_CHECK_CLASS_CAST ((cclass), GST_TYPE_CLOCK, GstClockClass))
Packit Service 963350
#define GST_IS_CLOCK_CLASS(cclass)      (G_TYPE_CHECK_CLASS_TYPE ((cclass), GST_TYPE_CLOCK))
Packit Service 963350
#define GST_CLOCK_GET_CLASS(clock)      (G_TYPE_INSTANCE_GET_CLASS ((clock), GST_TYPE_CLOCK, GstClockClass))
Packit Service 963350
#define GST_CLOCK_CAST(clock)           ((GstClock*)(clock))
Packit Service 963350
Packit Service 963350
/**
Packit Service 963350
 * GstClockTime:
Packit Service 963350
 *
Packit Service 963350
 * A datatype to hold a time, measured in nanoseconds.
Packit Service 963350
 */
Packit Service 963350
typedef guint64 GstClockTime;
Packit Service 963350
Packit Service 963350
/**
Packit Service 963350
 * GST_TYPE_CLOCK_TIME:
Packit Service 963350
 *
Packit Service 963350
 * The #GType of a #GstClockTime.
Packit Service 963350
 */
Packit Service 963350
#define GST_TYPE_CLOCK_TIME G_TYPE_UINT64
Packit Service 963350
Packit Service 963350
/**
Packit Service 963350
 * GstClockTimeDiff:
Packit Service 963350
 *
Packit Service 963350
 * A datatype to hold a time difference, measured in nanoseconds.
Packit Service 963350
 */
Packit Service 963350
typedef gint64 GstClockTimeDiff;
Packit Service 963350
/**
Packit Service 963350
 * GstClockID:
Packit Service 963350
 *
Packit Service 963350
 * A datatype to hold the handle to an outstanding sync or async clock callback.
Packit Service 963350
 */
Packit Service 963350
typedef gpointer GstClockID;
Packit Service 963350
Packit Service 963350
/**
Packit Service 963350
 * GST_CLOCK_TIME_NONE: (value 18446744073709551615) (type GstClockTime)
Packit Service 963350
 *
Packit Service 963350
 * Constant to define an undefined clock time.
Packit Service 963350
 */
Packit Service 963350
#define GST_CLOCK_TIME_NONE             ((GstClockTime) -1)
Packit Service 963350
/**
Packit Service 963350
 * GST_CLOCK_TIME_IS_VALID:
Packit Service 963350
 * @time: clock time to validate
Packit Service 963350
 *
Packit Service 963350
 * Tests if a given #GstClockTime represents a valid defined time.
Packit Service 963350
 */
Packit Service 963350
#define GST_CLOCK_TIME_IS_VALID(time)   (((GstClockTime)(time)) != GST_CLOCK_TIME_NONE)
Packit Service 963350
Packit Service 963350
/**
Packit Service 963350
 * GST_CLOCK_STIME_NONE: (value -9223372036854775808) (type GstClockTimeDiff)
Packit Service 963350
 *
Packit Service 963350
 * Constant to define an undefined clock time.
Packit Service 963350
 */
Packit Service 963350
#define GST_CLOCK_STIME_NONE             ((GstClockTimeDiff)G_MININT64)
Packit Service 963350
/**
Packit Service 963350
 * GST_CLOCK_STIME_IS_VALID:
Packit Service 963350
 * @time: signed clock time to validate
Packit Service 963350
 *
Packit Service 963350
 * Tests if a given #GstClockTimeDiff of #gint64 represents a valid defined time.
Packit Service 963350
 *
Packit Service 963350
 * Since: 1.6
Packit Service 963350
 */
Packit Service 963350
#define GST_CLOCK_STIME_IS_VALID(time)   (((GstClockTimeDiff)(time)) != GST_CLOCK_STIME_NONE)
Packit Service 963350
Packit Service 963350
/**
Packit Service 963350
 * GST_SECOND: (value 1000000000) (type GstClockTimeDiff)
Packit Service 963350
 *
Packit Service 963350
 * Constant that defines one GStreamer second.
Packit Service 963350
 */
Packit Service 963350
#define GST_SECOND  ((GstClockTimeDiff)(G_USEC_PER_SEC * G_GINT64_CONSTANT (1000)))
Packit Service 963350
/**
Packit Service 963350
 * GST_MSECOND: (value 1000000) (type GstClockTimeDiff)
Packit Service 963350
 *
Packit Service 963350
 * Constant that defines one GStreamer millisecond.
Packit Service 963350
 */
Packit Service 963350
#define GST_MSECOND ((GstClockTimeDiff)(GST_SECOND / G_GINT64_CONSTANT (1000)))
Packit Service 963350
/**
Packit Service 963350
 * GST_USECOND: (value 1000) (type GstClockTimeDiff)
Packit Service 963350
 *
Packit Service 963350
 * Constant that defines one GStreamer microsecond.
Packit Service 963350
 */
Packit Service 963350
#define GST_USECOND ((GstClockTimeDiff)(GST_SECOND / G_GINT64_CONSTANT (1000000)))
Packit Service 963350
/**
Packit Service 963350
 * GST_NSECOND: (value 1) (type GstClockTimeDiff)
Packit Service 963350
 *
Packit Service 963350
 * Constant that defines one GStreamer nanosecond
Packit Service 963350
 */
Packit Service 963350
#define GST_NSECOND ((GstClockTimeDiff)(GST_SECOND / G_GINT64_CONSTANT (1000000000)))
Packit Service 963350
Packit Service 963350
Packit Service 963350
/**
Packit Service 963350
 * GST_TIME_AS_SECONDS:
Packit Service 963350
 * @time: the time
Packit Service 963350
 *
Packit Service 963350
 * Convert a #GstClockTime to seconds.
Packit Service 963350
 */
Packit Service 963350
#define GST_TIME_AS_SECONDS(time)  ((time) / GST_SECOND)
Packit Service 963350
/**
Packit Service 963350
 * GST_TIME_AS_MSECONDS:
Packit Service 963350
 * @time: the time
Packit Service 963350
 *
Packit Service 963350
 * Convert a #GstClockTime to milliseconds (1/1000 of a second).
Packit Service 963350
 */
Packit Service 963350
#define GST_TIME_AS_MSECONDS(time) ((time) / G_GINT64_CONSTANT (1000000))
Packit Service 963350
/**
Packit Service 963350
 * GST_TIME_AS_USECONDS:
Packit Service 963350
 * @time: the time
Packit Service 963350
 *
Packit Service 963350
 * Convert a #GstClockTime to microseconds (1/1000000 of a second).
Packit Service 963350
 */
Packit Service 963350
#define GST_TIME_AS_USECONDS(time) ((time) / G_GINT64_CONSTANT (1000))
Packit Service 963350
/**
Packit Service 963350
 * GST_TIME_AS_NSECONDS:
Packit Service 963350
 * @time: the time
Packit Service 963350
 *
Packit Service 963350
 * Convert a #GstClockTime to nanoseconds (1/1000000000 of a second).
Packit Service 963350
 */
Packit Service 963350
#define GST_TIME_AS_NSECONDS(time) (time)
Packit Service 963350
Packit Service 963350
/**
Packit Service 963350
 * GST_CLOCK_DIFF:
Packit Service 963350
 * @s: the first time
Packit Service 963350
 * @e: the second time
Packit Service 963350
 *
Packit Service 963350
 * Calculate a difference between two clock times as a #GstClockTimeDiff.
Packit Service 963350
 * The difference is calculated as @e - @s.
Packit Service 963350
 */
Packit Service 963350
#define GST_CLOCK_DIFF(s, e)            (GstClockTimeDiff)((e) - (s))
Packit Service 963350
Packit Service 963350
/**
Packit Service 963350
 * GST_TIMEVAL_TO_TIME:
Packit Service 963350
 * @tv: the timeval to convert
Packit Service 963350
 *
Packit Service 963350
 * Convert a #GTimeVal to a #GstClockTime.
Packit Service 963350
 */
Packit Service 963350
#define GST_TIMEVAL_TO_TIME(tv)         (GstClockTime)((tv).tv_sec * GST_SECOND + (tv).tv_usec * GST_USECOND)
Packit Service 963350
Packit Service 963350
/**
Packit Service 963350
 * GST_TIME_TO_TIMEVAL:
Packit Service 963350
 * @t: The #GstClockTime to convert
Packit Service 963350
 * @tv: The target timeval
Packit Service 963350
 *
Packit Service 963350
 * Convert a #GstClockTime to a #GTimeVal
Packit Service 963350
 *
Packit Service 963350
 * > on 32-bit systems, a timeval has a range of only 2^32 - 1 seconds,
Packit Service 963350
 * > which is about 68 years.  Expect trouble if you want to schedule stuff
Packit Service 963350
 * > in your pipeline for 2038.
Packit Service 963350
 */
Packit Service 963350
#define GST_TIME_TO_TIMEVAL(t,tv)                               \
Packit Service 963350
G_STMT_START {                                                  \
Packit Service 963350
  g_assert ("Value of time " #t " is out of timeval's range" && \
Packit Service 963350
      ((t) / GST_SECOND) < G_MAXLONG);                          \
Packit Service 963350
  (tv).tv_sec  = (glong) (((GstClockTime) (t)) / GST_SECOND);   \
Packit Service 963350
  (tv).tv_usec = (glong) ((((GstClockTime) (t)) -               \
Packit Service 963350
                  ((GstClockTime) (tv).tv_sec) * GST_SECOND)    \
Packit Service 963350
                 / GST_USECOND);                                \
Packit Service 963350
} G_STMT_END
Packit Service 963350
Packit Service 963350
/**
Packit Service 963350
 * GST_TIMESPEC_TO_TIME:
Packit Service 963350
 * @ts: the timespec to convert
Packit Service 963350
 *
Packit Service 963350
 * Convert a struct timespec (see man pselect) to a #GstClockTime.
Packit Service 963350
 */
Packit Service 963350
#define GST_TIMESPEC_TO_TIME(ts)        (GstClockTime)((ts).tv_sec * GST_SECOND + (ts).tv_nsec * GST_NSECOND)
Packit Service 963350
/**
Packit Service 963350
 * GST_TIME_TO_TIMESPEC:
Packit Service 963350
 * @t: The #GstClockTime to convert
Packit Service 963350
 * @ts: The target timespec
Packit Service 963350
 *
Packit Service 963350
 * Convert a #GstClockTime to a struct timespec (see man pselect)
Packit Service 963350
 */
Packit Service 963350
#define GST_TIME_TO_TIMESPEC(t,ts)                                \
Packit Service 963350
G_STMT_START {                                                    \
Packit Service 963350
  g_assert ("Value of time " #t " is out of timespec's range" &&  \
Packit Service 963350
      ((t) / GST_SECOND) < G_MAXLONG);                            \
Packit Service 963350
  (ts).tv_sec  =  (glong) ((t) / GST_SECOND);                     \
Packit Service 963350
  (ts).tv_nsec = (glong) (((t) - (ts).tv_sec * GST_SECOND) / GST_NSECOND);        \
Packit Service 963350
} G_STMT_END
Packit Service 963350
Packit Service 963350
/* timestamp debugging macros */
Packit Service 963350
/**
Packit Service 963350
 * GST_TIME_FORMAT:
Packit Service 963350
 *
Packit Service 963350
 * A string that can be used in printf-like format strings to display a
Packit Service 963350
 * #GstClockTime value in h:m:s format.  Use GST_TIME_ARGS() to construct
Packit Service 963350
 * the matching arguments.
Packit Service 963350
 *
Packit Service 963350
 * Example:
Packit Service 963350
 * |[
Packit Service 963350
 * printf("%" GST_TIME_FORMAT "\n", GST_TIME_ARGS(ts));
Packit Service 963350
 * ]|
Packit Service 963350
 */
Packit Service 963350
#define GST_TIME_FORMAT "u:%02u:%02u.%09u"
Packit Service 963350
/**
Packit Service 963350
 * GST_TIME_ARGS:
Packit Service 963350
 * @t: a #GstClockTime
Packit Service 963350
 *
Packit Service 963350
 * Format @t for the #GST_TIME_FORMAT format string. Note: @t will be
Packit Service 963350
 * evaluated more than once.
Packit Service 963350
 */
Packit Service 963350
#define GST_TIME_ARGS(t) \
Packit Service 963350
        GST_CLOCK_TIME_IS_VALID (t) ? \
Packit Service 963350
        (guint) (((GstClockTime)(t)) / (GST_SECOND * 60 * 60)) : 99, \
Packit Service 963350
        GST_CLOCK_TIME_IS_VALID (t) ? \
Packit Service 963350
        (guint) ((((GstClockTime)(t)) / (GST_SECOND * 60)) % 60) : 99, \
Packit Service 963350
        GST_CLOCK_TIME_IS_VALID (t) ? \
Packit Service 963350
        (guint) ((((GstClockTime)(t)) / GST_SECOND) % 60) : 99, \
Packit Service 963350
        GST_CLOCK_TIME_IS_VALID (t) ? \
Packit Service 963350
        (guint) (((GstClockTime)(t)) % GST_SECOND) : 999999999
Packit Service 963350
/**
Packit Service 963350
 * GST_STIME_FORMAT:
Packit Service 963350
 *
Packit Service 963350
 * A string that can be used in printf-like format strings to display a signed
Packit Service 963350
 * #GstClockTimeDiff or #gint64 value in h:m:s format.  Use GST_TIME_ARGS() to
Packit Service 963350
 * construct the matching arguments.
Packit Service 963350
 *
Packit Service 963350
 * Example:
Packit Service 963350
 * |[
Packit Service 963350
 * printf("%" GST_STIME_FORMAT "\n", GST_STIME_ARGS(ts));
Packit Service 963350
 * ]|
Packit Service 963350
 *
Packit Service 963350
 * Since: 1.6
Packit Service 963350
 */
Packit Service 963350
#define GST_STIME_FORMAT "c%" GST_TIME_FORMAT
Packit Service 963350
/**
Packit Service 963350
 * GST_STIME_ARGS:
Packit Service 963350
 * @t: a #GstClockTimeDiff or #gint64
Packit Service 963350
 *
Packit Service 963350
 * Format @t for the #GST_STIME_FORMAT format string. Note: @t will be
Packit Service 963350
 * evaluated more than once.
Packit Service 963350
 *
Packit Service 963350
 * Since: 1.6
Packit Service 963350
 */
Packit Service 963350
#define GST_STIME_ARGS(t)						\
Packit Service 963350
  ((t) == GST_CLOCK_STIME_NONE || (t) >= 0) ? '+' : '-',		\
Packit Service 963350
    GST_CLOCK_STIME_IS_VALID (t) ?					\
Packit Service 963350
    (guint) (((GstClockTime)(ABS(t))) / (GST_SECOND * 60 * 60)) : 99,	\
Packit Service 963350
    GST_CLOCK_STIME_IS_VALID (t) ?					\
Packit Service 963350
    (guint) ((((GstClockTime)(ABS(t))) / (GST_SECOND * 60)) % 60) : 99,	\
Packit Service 963350
    GST_CLOCK_STIME_IS_VALID (t) ?					\
Packit Service 963350
    (guint) ((((GstClockTime)(ABS(t))) / GST_SECOND) % 60) : 99,	\
Packit Service 963350
    GST_CLOCK_STIME_IS_VALID (t) ?					\
Packit Service 963350
    (guint) (((GstClockTime)(ABS(t))) % GST_SECOND) : 999999999
Packit Service 963350
Packit Service 963350
typedef struct _GstClockEntry   GstClockEntry;
Packit Service 963350
typedef struct _GstClock        GstClock;
Packit Service 963350
typedef struct _GstClockClass   GstClockClass;
Packit Service 963350
typedef struct _GstClockPrivate GstClockPrivate;
Packit Service 963350
Packit Service 963350
/* --- prototype for async callbacks --- */
Packit Service 963350
/**
Packit Service 963350
 * GstClockCallback:
Packit Service 963350
 * @clock: The clock that triggered the callback
Packit Service 963350
 * @time: The time it was triggered
Packit Service 963350
 * @id: The #GstClockID that expired
Packit Service 963350
 * @user_data: user data passed in the gst_clock_id_wait_async() function
Packit Service 963350
 *
Packit Service 963350
 * The function prototype of the callback.
Packit Service 963350
 *
Packit Service 963350
 * Returns: %TRUE or %FALSE (currently unused)
Packit Service 963350
 */
Packit Service 963350
typedef gboolean        (*GstClockCallback)     (GstClock *clock, GstClockTime time,
Packit Service 963350
                                                 GstClockID id, gpointer user_data);
Packit Service 963350
/**
Packit Service 963350
 * GstClockReturn:
Packit Service 963350
 * @GST_CLOCK_OK: The operation succeeded.
Packit Service 963350
 * @GST_CLOCK_EARLY: The operation was scheduled too late.
Packit Service 963350
 * @GST_CLOCK_UNSCHEDULED: The clockID was unscheduled
Packit Service 963350
 * @GST_CLOCK_BUSY: The ClockID is busy
Packit Service 963350
 * @GST_CLOCK_BADTIME: A bad time was provided to a function.
Packit Service 963350
 * @GST_CLOCK_ERROR: An error occurred
Packit Service 963350
 * @GST_CLOCK_UNSUPPORTED: Operation is not supported
Packit Service 963350
 * @GST_CLOCK_DONE: The ClockID is done waiting
Packit Service 963350
 *
Packit Service 963350
 * The return value of a clock operation.
Packit Service 963350
 */
Packit Service 963350
typedef enum
Packit Service 963350
{
Packit Service 963350
  GST_CLOCK_OK          =  0,
Packit Service 963350
  GST_CLOCK_EARLY       =  1,
Packit Service 963350
  GST_CLOCK_UNSCHEDULED =  2,
Packit Service 963350
  GST_CLOCK_BUSY        =  3,
Packit Service 963350
  GST_CLOCK_BADTIME     =  4,
Packit Service 963350
  GST_CLOCK_ERROR       =  5,
Packit Service 963350
  GST_CLOCK_UNSUPPORTED =  6,
Packit Service 963350
  GST_CLOCK_DONE        =  7
Packit Service 963350
} GstClockReturn;
Packit Service 963350
Packit Service 963350
/**
Packit Service 963350
 * GstClockEntryType:
Packit Service 963350
 * @GST_CLOCK_ENTRY_SINGLE: a single shot timeout
Packit Service 963350
 * @GST_CLOCK_ENTRY_PERIODIC: a periodic timeout request
Packit Service 963350
 *
Packit Service 963350
 * The type of the clock entry
Packit Service 963350
 */
Packit Service 963350
typedef enum {
Packit Service 963350
  GST_CLOCK_ENTRY_SINGLE,
Packit Service 963350
  GST_CLOCK_ENTRY_PERIODIC
Packit Service 963350
} GstClockEntryType;
Packit Service 963350
Packit Service 963350
/**
Packit Service 963350
 * GST_CLOCK_ENTRY:
Packit Service 963350
 * @entry: the entry to cast
Packit Service 963350
 *
Packit Service 963350
 * Cast to a clock entry
Packit Service 963350
 */
Packit Service 963350
#define GST_CLOCK_ENTRY(entry)          ((GstClockEntry *)(entry))
Packit Service 963350
/**
Packit Service 963350
 * GST_CLOCK_ENTRY_CLOCK:
Packit Service 963350
 * @entry: the entry to query
Packit Service 963350
 *
Packit Service 963350
 * Get the owner clock of the entry
Packit Service 963350
 */
Packit Service 963350
#define GST_CLOCK_ENTRY_CLOCK(entry)    ((entry)->clock)
Packit Service 963350
/**
Packit Service 963350
 * GST_CLOCK_ENTRY_TYPE:
Packit Service 963350
 * @entry: the entry to query
Packit Service 963350
 *
Packit Service 963350
 * Get the type of the clock entry
Packit Service 963350
 */
Packit Service 963350
#define GST_CLOCK_ENTRY_TYPE(entry)     ((entry)->type)
Packit Service 963350
/**
Packit Service 963350
 * GST_CLOCK_ENTRY_TIME:
Packit Service 963350
 * @entry: the entry to query
Packit Service 963350
 *
Packit Service 963350
 * Get the requested time of this entry
Packit Service 963350
 */
Packit Service 963350
#define GST_CLOCK_ENTRY_TIME(entry)     ((entry)->time)
Packit Service 963350
/**
Packit Service 963350
 * GST_CLOCK_ENTRY_INTERVAL:
Packit Service 963350
 * @entry: the entry to query
Packit Service 963350
 *
Packit Service 963350
 * Get the interval of this periodic entry
Packit Service 963350
 */
Packit Service 963350
#define GST_CLOCK_ENTRY_INTERVAL(entry) ((entry)->interval)
Packit Service 963350
/**
Packit Service 963350
 * GST_CLOCK_ENTRY_STATUS:
Packit Service 963350
 * @entry: the entry to query
Packit Service 963350
 *
Packit Service 963350
 * The status of the entry
Packit Service 963350
 */
Packit Service 963350
#define GST_CLOCK_ENTRY_STATUS(entry)   ((entry)->status)
Packit Service 963350
Packit Service 963350
/**
Packit Service 963350
 * GstClockEntry:
Packit Service 963350
 * @refcount: reference counter (read-only)
Packit Service 963350
 *
Packit Service 963350
 * All pending timeouts or periodic notifies are converted into
Packit Service 963350
 * an entry.
Packit Service 963350
 * Note that GstClockEntry should be treated as an opaque structure. It must
Packit Service 963350
 * not be extended or allocated using a custom allocator.
Packit Service 963350
 */
Packit Service 963350
struct _GstClockEntry {
Packit Service 963350
  gint                  refcount;
Packit Service 963350
  /*< protected >*/
Packit Service 963350
  GstClock              *clock;
Packit Service 963350
  GstClockEntryType      type;
Packit Service 963350
  GstClockTime           time;
Packit Service 963350
  GstClockTime           interval;
Packit Service 963350
  GstClockReturn         status;
Packit Service 963350
  GstClockCallback       func;
Packit Service 963350
  gpointer               user_data;
Packit Service 963350
  GDestroyNotify         destroy_data;
Packit Service 963350
  gboolean               unscheduled;
Packit Service 963350
  gboolean               woken_up;
Packit Service 963350
Packit Service 963350
  /*< private >*/
Packit Service 963350
  gpointer _gst_reserved[GST_PADDING];
Packit Service 963350
};
Packit Service 963350
Packit Service 963350
#include <gst/gstobject.h>
Packit Service 963350
Packit Service 963350
/**
Packit Service 963350
 * GstClockFlags:
Packit Service 963350
 * @GST_CLOCK_FLAG_CAN_DO_SINGLE_SYNC: clock can do a single sync timeout request
Packit Service 963350
 * @GST_CLOCK_FLAG_CAN_DO_SINGLE_ASYNC: clock can do a single async timeout request
Packit Service 963350
 * @GST_CLOCK_FLAG_CAN_DO_PERIODIC_SYNC: clock can do sync periodic timeout requests
Packit Service 963350
 * @GST_CLOCK_FLAG_CAN_DO_PERIODIC_ASYNC: clock can do async periodic timeout callbacks
Packit Service 963350
 * @GST_CLOCK_FLAG_CAN_SET_RESOLUTION: clock's resolution can be changed
Packit Service 963350
 * @GST_CLOCK_FLAG_CAN_SET_MASTER: clock can be slaved to a master clock
Packit Service 963350
 * @GST_CLOCK_FLAG_NEEDS_STARTUP_SYNC: clock needs to be synced before it can be used
Packit Service 963350
 *     (Since 1.6)
Packit Service 963350
 * @GST_CLOCK_FLAG_LAST: subclasses can add additional flags starting from this flag
Packit Service 963350
 *
Packit Service 963350
 * The capabilities of this clock
Packit Service 963350
 */
Packit Service 963350
typedef enum {
Packit Service 963350
  GST_CLOCK_FLAG_CAN_DO_SINGLE_SYNC     = (GST_OBJECT_FLAG_LAST << 0),
Packit Service 963350
  GST_CLOCK_FLAG_CAN_DO_SINGLE_ASYNC    = (GST_OBJECT_FLAG_LAST << 1),
Packit Service 963350
  GST_CLOCK_FLAG_CAN_DO_PERIODIC_SYNC   = (GST_OBJECT_FLAG_LAST << 2),
Packit Service 963350
  GST_CLOCK_FLAG_CAN_DO_PERIODIC_ASYNC  = (GST_OBJECT_FLAG_LAST << 3),
Packit Service 963350
  GST_CLOCK_FLAG_CAN_SET_RESOLUTION     = (GST_OBJECT_FLAG_LAST << 4),
Packit Service 963350
  GST_CLOCK_FLAG_CAN_SET_MASTER         = (GST_OBJECT_FLAG_LAST << 5),
Packit Service 963350
  GST_CLOCK_FLAG_NEEDS_STARTUP_SYNC     = (GST_OBJECT_FLAG_LAST << 6),
Packit Service 963350
  /* padding */
Packit Service 963350
  GST_CLOCK_FLAG_LAST                   = (GST_OBJECT_FLAG_LAST << 8)
Packit Service 963350
} GstClockFlags;
Packit Service 963350
Packit Service 963350
/**
Packit Service 963350
 * GST_CLOCK_FLAGS:
Packit Service 963350
 * @clock: the clock to query
Packit Service 963350
 *
Packit Service 963350
 * Gets the #GstClockFlags clock flags.
Packit Service 963350
 */
Packit Service 963350
#define GST_CLOCK_FLAGS(clock)  GST_OBJECT_FLAGS(clock)
Packit Service 963350
Packit Service 963350
/**
Packit Service 963350
 * GstClock:
Packit Service 963350
 *
Packit Service 963350
 * #GstClock base structure. The values of this structure are
Packit Service 963350
 * protected for subclasses, use the methods to use the #GstClock.
Packit Service 963350
 */
Packit Service 963350
struct _GstClock {
Packit Service 963350
  GstObject      object;
Packit Service 963350
Packit Service 963350
  /*< private >*/
Packit Service 963350
  GstClockPrivate *priv;
Packit Service 963350
Packit Service 963350
  gpointer _gst_reserved[GST_PADDING];
Packit Service 963350
};
Packit Service 963350
Packit Service 963350
/**
Packit Service 963350
 * GstClockClass:
Packit Service 963350
 * @parent_class: the parent class structure
Packit Service 963350
 * @change_resolution: change the resolution of the clock. Not all values might
Packit Service 963350
 *                     be acceptable. The new resolution should be returned.
Packit Service 963350
 * @get_resolution: get the resolution of the clock.
Packit Service 963350
 * @get_internal_time: get the internal unadjusted time of the clock.
Packit Service 963350
 *        implement @wait_jitter instead.
Packit Service 963350
 * @wait: perform a blocking wait on the given #GstClockEntry and return
Packit Service 963350
 *               the jitter.
Packit Service 963350
 * @wait_async: perform an asynchronous wait for the given #GstClockEntry.
Packit Service 963350
 * @unschedule: unblock a blocking or async wait operation.
Packit Service 963350
 *
Packit Service 963350
 * GStreamer clock class. Override the vmethods to implement the clock
Packit Service 963350
 * functionality.
Packit Service 963350
 */
Packit Service 963350
struct _GstClockClass {
Packit Service 963350
  GstObjectClass        parent_class;
Packit Service 963350
Packit Service 963350
  /*< public >*/
Packit Service 963350
  /* vtable */
Packit Service 963350
  GstClockTime          (*change_resolution)    (GstClock *clock,
Packit Service 963350
                                                 GstClockTime old_resolution,
Packit Service 963350
                                                 GstClockTime new_resolution);
Packit Service 963350
  GstClockTime          (*get_resolution)       (GstClock *clock);
Packit Service 963350
Packit Service 963350
  GstClockTime          (*get_internal_time)    (GstClock *clock);
Packit Service 963350
Packit Service 963350
  /* waiting on an ID */
Packit Service 963350
  GstClockReturn        (*wait)                 (GstClock *clock, GstClockEntry *entry,
Packit Service 963350
                                                 GstClockTimeDiff *jitter);
Packit Service 963350
  GstClockReturn        (*wait_async)           (GstClock *clock, GstClockEntry *entry);
Packit Service 963350
  void                  (*unschedule)           (GstClock *clock, GstClockEntry *entry);
Packit Service 963350
Packit Service 963350
  /*< private >*/
Packit Service 963350
  gpointer _gst_reserved[GST_PADDING];
Packit Service 963350
};
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
GType                   gst_clock_get_type              (void);
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
GstClockTime            gst_clock_set_resolution        (GstClock *clock,
Packit Service 963350
                                                         GstClockTime resolution);
Packit Service 963350
GST_API
Packit Service 963350
GstClockTime            gst_clock_get_resolution        (GstClock *clock);
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
GstClockTime            gst_clock_get_time              (GstClock *clock);
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
void                    gst_clock_set_calibration       (GstClock *clock, GstClockTime internal,
Packit Service 963350
                                                         GstClockTime external,
Packit Service 963350
                                                         GstClockTime rate_num,
Packit Service 963350
                                                         GstClockTime rate_denom);
Packit Service 963350
GST_API
Packit Service 963350
void                    gst_clock_get_calibration       (GstClock *clock, GstClockTime *internal,
Packit Service 963350
                                                         GstClockTime *external,
Packit Service 963350
                                                         GstClockTime *rate_num,
Packit Service 963350
                                                         GstClockTime *rate_denom);
Packit Service 963350
Packit Service 963350
/* master/slave clocks */
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
gboolean                gst_clock_set_master            (GstClock *clock, GstClock *master);
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
GstClock*               gst_clock_get_master            (GstClock *clock);
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
void                    gst_clock_set_timeout           (GstClock *clock,
Packit Service 963350
                                                         GstClockTime timeout);
Packit Service 963350
GST_API
Packit Service 963350
GstClockTime            gst_clock_get_timeout           (GstClock *clock);
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
gboolean                gst_clock_add_observation       (GstClock *clock, GstClockTime slave,
Packit Service 963350
                                                         GstClockTime master, gdouble *r_squared);
Packit Service 963350
GST_API
Packit Service 963350
gboolean                gst_clock_add_observation_unapplied (GstClock *clock, GstClockTime slave,
Packit Service 963350
                                                         GstClockTime master, gdouble *r_squared,
Packit Service 963350
                                                         GstClockTime *internal,
Packit Service 963350
                                                         GstClockTime *external,
Packit Service 963350
                                                         GstClockTime *rate_num,
Packit Service 963350
                                                         GstClockTime *rate_denom);
Packit Service 963350
Packit Service 963350
/* getting and adjusting internal/external time */
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
GstClockTime            gst_clock_get_internal_time     (GstClock *clock);
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
GstClockTime            gst_clock_adjust_unlocked       (GstClock *clock, GstClockTime internal);
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
GstClockTime            gst_clock_adjust_with_calibration (GstClock *clock,
Packit Service 963350
                                                         GstClockTime internal_target,
Packit Service 963350
                                                         GstClockTime cinternal,
Packit Service 963350
                                                         GstClockTime cexternal,
Packit Service 963350
                                                         GstClockTime cnum,
Packit Service 963350
                                                         GstClockTime cdenom);
Packit Service 963350
GST_API
Packit Service 963350
GstClockTime            gst_clock_unadjust_with_calibration (GstClock *clock,
Packit Service 963350
                                                         GstClockTime external_target,
Packit Service 963350
                                                         GstClockTime cinternal,
Packit Service 963350
                                                         GstClockTime cexternal,
Packit Service 963350
                                                         GstClockTime cnum,
Packit Service 963350
                                                         GstClockTime cdenom);
Packit Service 963350
GST_API
Packit Service 963350
GstClockTime            gst_clock_unadjust_unlocked     (GstClock * clock, GstClockTime external);
Packit Service 963350
Packit Service 963350
/* waiting for, signalling and checking for synchronization */
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
gboolean                gst_clock_wait_for_sync         (GstClock * clock, GstClockTime timeout);
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
gboolean                gst_clock_is_synced             (GstClock * clock);
Packit Service 963350
Packit Service 963350
/* to be used by subclasses only */
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
void                    gst_clock_set_synced            (GstClock * clock, gboolean synced);
Packit Service 963350
Packit Service 963350
/* creating IDs that can be used to get notifications */
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
GstClockID              gst_clock_new_single_shot_id    (GstClock *clock,
Packit Service 963350
                                                         GstClockTime time);
Packit Service 963350
GST_API
Packit Service 963350
GstClockID              gst_clock_new_periodic_id       (GstClock *clock,
Packit Service 963350
                                                         GstClockTime start_time,
Packit Service 963350
                                                         GstClockTime interval);
Packit Service 963350
Packit Service 963350
/* reference counting */
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
GstClockID              gst_clock_id_ref                (GstClockID id);
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
void                    gst_clock_id_unref              (GstClockID id);
Packit Service 963350
Packit Service 963350
/* operations on IDs */
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
gint                    gst_clock_id_compare_func       (gconstpointer id1, gconstpointer id2);
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
GstClockTime            gst_clock_id_get_time           (GstClockID id);
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
GstClockReturn          gst_clock_id_wait               (GstClockID id,
Packit Service 963350
                                                         GstClockTimeDiff *jitter);
Packit Service 963350
GST_API
Packit Service 963350
GstClockReturn          gst_clock_id_wait_async         (GstClockID id,
Packit Service 963350
                                                         GstClockCallback func,
Packit Service 963350
                                                         gpointer user_data,
Packit Service 963350
                                                         GDestroyNotify destroy_data);
Packit Service 963350
GST_API
Packit Service 963350
void                    gst_clock_id_unschedule         (GstClockID id);
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
gboolean                gst_clock_single_shot_id_reinit (GstClock * clock,
Packit Service 963350
                                                         GstClockID id,
Packit Service 963350
                                                         GstClockTime time);
Packit Service 963350
GST_API
Packit Service 963350
gboolean                gst_clock_periodic_id_reinit    (GstClock * clock,
Packit Service 963350
                                                         GstClockID id,
Packit Service 963350
                                                         GstClockTime start_time,
Packit Service 963350
                                                         GstClockTime interval);
Packit Service 963350
Packit Service 963350
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
Packit Service 963350
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstClock, gst_object_unref)
Packit Service 963350
#endif
Packit Service 963350
Packit Service 963350
G_END_DECLS
Packit Service 963350
Packit Service 963350
#endif /* __GST_CLOCK_H__ */