Blame gst/gstpromise.h

Packit f546b1
/* GStreamer
Packit f546b1
 * Copyright (C) 2017 Matthew Waters <matthew@centricular.com>
Packit f546b1
 *
Packit f546b1
 * This library is free software; you can redistribute it and/or
Packit f546b1
 * modify it under the terms of the GNU Library General Public
Packit f546b1
 * License as published by the Free Software Foundation; either
Packit f546b1
 * version 2 of the License, or (at your option) any later version.
Packit f546b1
 *
Packit f546b1
 * This library is distributed in the hope that it will be useful,
Packit f546b1
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit f546b1
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit f546b1
 * Library General Public License for more details.
Packit f546b1
 *
Packit f546b1
 * You should have received a copy of the GNU Library General Public
Packit f546b1
 * License along with this library; if not, write to the
Packit f546b1
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Packit f546b1
 * Boston, MA 02110-1301, USA.
Packit f546b1
 */
Packit f546b1
Packit f546b1
#ifndef __GST_PROMISE_H__
Packit f546b1
#define __GST_PROMISE_H__
Packit f546b1
Packit f546b1
#include <gst/gst.h>
Packit f546b1
Packit f546b1
G_BEGIN_DECLS
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
GType gst_promise_get_type(void);
Packit f546b1
#define GST_TYPE_PROMISE            (gst_promise_get_type())
Packit f546b1
#define GST_PROMISE(obj)            ((GstPromise *) obj)
Packit f546b1
Packit f546b1
typedef struct _GstPromise GstPromise;
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * GstPromiseResult:
Packit f546b1
 * @GST_PROMISE_RESULT_PENDING: Initial state. Waiting for transition to any
Packit f546b1
 * 	other state.
Packit f546b1
 * @GST_PROMISE_RESULT_INTERRUPTED: Interrupted by the consumer as it doesn't
Packit f546b1
 * 	want the value anymore.
Packit f546b1
 * @GST_PROMISE_RESULT_REPLIED: A producer marked a reply
Packit f546b1
 * @GST_PROMISE_RESULT_EXPIRED: The promise expired (the carrying object
Packit f546b1
 * 	lost all refs) and the promise will never be fulfilled.
Packit f546b1
 *
Packit f546b1
 * The result of a #GstPromise
Packit f546b1
 *
Packit f546b1
 * Since: 1.14
Packit f546b1
 */
Packit f546b1
typedef enum
Packit f546b1
{
Packit f546b1
  GST_PROMISE_RESULT_PENDING,
Packit f546b1
  GST_PROMISE_RESULT_INTERRUPTED,
Packit f546b1
  GST_PROMISE_RESULT_REPLIED,
Packit f546b1
  GST_PROMISE_RESULT_EXPIRED,
Packit f546b1
} GstPromiseResult;
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * GstPromiseChangeFunc:
Packit f546b1
 * @promise: a #GstPromise
Packit f546b1
 * @user_data: (closure): user data
Packit f546b1
 *
Packit f546b1
 * Since: 1.14
Packit f546b1
 */
Packit f546b1
typedef void (*GstPromiseChangeFunc) (GstPromise * promise, gpointer user_data);
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * GstPromise:
Packit f546b1
 * @parent: parent #GstMiniObject
Packit f546b1
 *
Packit f546b1
 * Since: 1.14
Packit f546b1
 */
Packit f546b1
struct _GstPromise
Packit f546b1
{
Packit f546b1
  GstMiniObject         parent;
Packit f546b1
};
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
GstPromise *            gst_promise_new                     (void);
Packit f546b1
GST_API
Packit f546b1
GstPromise *            gst_promise_new_with_change_func    (GstPromiseChangeFunc func,
Packit f546b1
                                                             gpointer user_data,
Packit f546b1
                                                             GDestroyNotify notify);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
GstPromiseResult        gst_promise_wait                    (GstPromise * promise);
Packit f546b1
GST_API
Packit f546b1
void                    gst_promise_reply                   (GstPromise * promise,
Packit f546b1
                                                             GstStructure * s);
Packit f546b1
GST_API
Packit f546b1
void                    gst_promise_interrupt               (GstPromise * promise);
Packit f546b1
GST_API
Packit f546b1
void                    gst_promise_expire                  (GstPromise * promise);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
const GstStructure *    gst_promise_get_reply               (GstPromise * promise);
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * gst_promise_ref:
Packit f546b1
 * @promise: a #GstPromise.
Packit f546b1
 *
Packit f546b1
 * Increases the refcount of the given @promise by one.
Packit f546b1
 *
Packit f546b1
 * Returns: (transfer full): @promise
Packit f546b1
 *
Packit f546b1
 * Since: 1.14
Packit f546b1
 */
Packit f546b1
static inline GstPromise *
Packit f546b1
gst_promise_ref (GstPromise * promise)
Packit f546b1
{
Packit f546b1
  return (GstPromise *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (promise));
Packit f546b1
}
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * gst_promise_unref:
Packit f546b1
 * @promise: (transfer full): a #GstPromise.
Packit f546b1
 *
Packit f546b1
 * Decreases the refcount of the promise. If the refcount reaches 0, the
Packit f546b1
 * promise will be freed.
Packit f546b1
 *
Packit f546b1
 * Since: 1.14
Packit f546b1
 */
Packit f546b1
static inline void
Packit f546b1
gst_promise_unref (GstPromise * promise)
Packit f546b1
{
Packit f546b1
  gst_mini_object_unref (GST_MINI_OBJECT_CAST (promise));
Packit f546b1
}
Packit f546b1
Packit f546b1
G_END_DECLS
Packit f546b1
Packit f546b1
#endif /* __GST_PROMISE_H__ */