|
Packit Service |
963350 |
/* GStreamer
|
|
Packit Service |
963350 |
* Copyright (C) 2017 Matthew Waters <matthew@centricular.com>
|
|
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_PROMISE_H__
|
|
Packit Service |
963350 |
#define __GST_PROMISE_H__
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
#include <gst/gst.h>
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
G_BEGIN_DECLS
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
GST_API
|
|
Packit Service |
963350 |
GType gst_promise_get_type(void);
|
|
Packit Service |
963350 |
#define GST_TYPE_PROMISE (gst_promise_get_type())
|
|
Packit Service |
963350 |
#define GST_PROMISE(obj) ((GstPromise *) obj)
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
typedef struct _GstPromise GstPromise;
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
/**
|
|
Packit Service |
963350 |
* GstPromiseResult:
|
|
Packit Service |
963350 |
* @GST_PROMISE_RESULT_PENDING: Initial state. Waiting for transition to any
|
|
Packit Service |
963350 |
* other state.
|
|
Packit Service |
963350 |
* @GST_PROMISE_RESULT_INTERRUPTED: Interrupted by the consumer as it doesn't
|
|
Packit Service |
963350 |
* want the value anymore.
|
|
Packit Service |
963350 |
* @GST_PROMISE_RESULT_REPLIED: A producer marked a reply
|
|
Packit Service |
963350 |
* @GST_PROMISE_RESULT_EXPIRED: The promise expired (the carrying object
|
|
Packit Service |
963350 |
* lost all refs) and the promise will never be fulfilled.
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* The result of a #GstPromise
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* Since: 1.14
|
|
Packit Service |
963350 |
*/
|
|
Packit Service |
963350 |
typedef enum
|
|
Packit Service |
963350 |
{
|
|
Packit Service |
963350 |
GST_PROMISE_RESULT_PENDING,
|
|
Packit Service |
963350 |
GST_PROMISE_RESULT_INTERRUPTED,
|
|
Packit Service |
963350 |
GST_PROMISE_RESULT_REPLIED,
|
|
Packit Service |
963350 |
GST_PROMISE_RESULT_EXPIRED,
|
|
Packit Service |
963350 |
} GstPromiseResult;
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
/**
|
|
Packit Service |
963350 |
* GstPromiseChangeFunc:
|
|
Packit Service |
963350 |
* @promise: a #GstPromise
|
|
Packit Service |
963350 |
* @user_data: (closure): user data
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* Since: 1.14
|
|
Packit Service |
963350 |
*/
|
|
Packit Service |
963350 |
typedef void (*GstPromiseChangeFunc) (GstPromise * promise, gpointer user_data);
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
/**
|
|
Packit Service |
963350 |
* GstPromise:
|
|
Packit Service |
963350 |
* @parent: parent #GstMiniObject
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* Since: 1.14
|
|
Packit Service |
963350 |
*/
|
|
Packit Service |
963350 |
struct _GstPromise
|
|
Packit Service |
963350 |
{
|
|
Packit Service |
963350 |
GstMiniObject parent;
|
|
Packit Service |
963350 |
};
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
GST_API
|
|
Packit Service |
963350 |
GstPromise * gst_promise_new (void);
|
|
Packit Service |
963350 |
GST_API
|
|
Packit Service |
963350 |
GstPromise * gst_promise_new_with_change_func (GstPromiseChangeFunc func,
|
|
Packit Service |
963350 |
gpointer user_data,
|
|
Packit Service |
963350 |
GDestroyNotify notify);
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
GST_API
|
|
Packit Service |
963350 |
GstPromiseResult gst_promise_wait (GstPromise * promise);
|
|
Packit Service |
963350 |
GST_API
|
|
Packit Service |
963350 |
void gst_promise_reply (GstPromise * promise,
|
|
Packit Service |
963350 |
GstStructure * s);
|
|
Packit Service |
963350 |
GST_API
|
|
Packit Service |
963350 |
void gst_promise_interrupt (GstPromise * promise);
|
|
Packit Service |
963350 |
GST_API
|
|
Packit Service |
963350 |
void gst_promise_expire (GstPromise * promise);
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
GST_API
|
|
Packit Service |
963350 |
const GstStructure * gst_promise_get_reply (GstPromise * promise);
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
/**
|
|
Packit Service |
963350 |
* gst_promise_ref:
|
|
Packit Service |
963350 |
* @promise: a #GstPromise.
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* Increases the refcount of the given @promise by one.
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* Returns: (transfer full): @promise
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* Since: 1.14
|
|
Packit Service |
963350 |
*/
|
|
Packit Service |
963350 |
static inline GstPromise *
|
|
Packit Service |
963350 |
gst_promise_ref (GstPromise * promise)
|
|
Packit Service |
963350 |
{
|
|
Packit Service |
963350 |
return (GstPromise *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (promise));
|
|
Packit Service |
963350 |
}
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
/**
|
|
Packit Service |
963350 |
* gst_promise_unref:
|
|
Packit Service |
963350 |
* @promise: (transfer full): a #GstPromise.
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* Decreases the refcount of the promise. If the refcount reaches 0, the
|
|
Packit Service |
963350 |
* promise will be freed.
|
|
Packit Service |
963350 |
*
|
|
Packit Service |
963350 |
* Since: 1.14
|
|
Packit Service |
963350 |
*/
|
|
Packit Service |
963350 |
static inline void
|
|
Packit Service |
963350 |
gst_promise_unref (GstPromise * promise)
|
|
Packit Service |
963350 |
{
|
|
Packit Service |
963350 |
gst_mini_object_unref (GST_MINI_OBJECT_CAST (promise));
|
|
Packit Service |
963350 |
}
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
G_END_DECLS
|
|
Packit Service |
963350 |
|
|
Packit Service |
963350 |
#endif /* __GST_PROMISE_H__ */
|