gstreamer/gst/gstiterator.h
Wim Taymans 15b0278251 gst/: More MT safety fixes following the desing doc.
Original commit message from CVS:
* gst/gst_private.h:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_set_index),
(gst_bin_set_clock), (gst_bin_get_clock),
(gst_bin_iterate_elements), (gst_bin_get_by_name),
(gst_bin_get_by_name_recurse_up), (gst_bin_get_by_interface),
(gst_bin_get_all_by_interface):
* gst/gstbin.h:
* gst/gstelement.c: (gst_element_add_pad),
(gst_element_remove_pad), (gst_element_request_pad),
(gst_element_post_message), (gst_element_error_full),
(gst_element_is_locked_state), (gst_element_set_locked_state),
(gst_element_create_task):
* gst/gstelement.h:
* gst/gstinfo.h:
* gst/gstiterator.h:
* gst/gstobject.c: (gst_object_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_finalize), (gst_object_dispatch_properties_changed),
(gst_object_set_name), (gst_object_get_name),
(gst_object_set_parent), (gst_object_get_parent),
(gst_object_unparent), (gst_object_check_uniqueness),
(gst_object_save_thyself), (gst_object_restore_thyself),
(gst_object_real_restore_thyself), (gst_object_set_property),
(gst_object_get_property), (gst_object_get_path_string):
* gst/gstobject.h:
* gst/gstpad.c: (gst_pad_get_direction), (gst_pad_unlink),
(gst_pad_is_linked), (gst_pad_link_filtered),
(gst_pad_relink_filtered), (gst_pad_get_peer), (gst_pad_push),
(gst_pad_pull), (gst_pad_pull_range):
* gst/gstpad.h:
More MT safety fixes following the desing doc.
2004-12-09 21:08:13 +00:00

82 lines
2.7 KiB
C

/* GStreamer
* Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
*
* gstiterator.h: Header for GstIterator
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_ITERATOR_H__
#define __GST_ITERATOR_H__
#include <glib.h>
G_BEGIN_DECLS
typedef enum {
GST_ITERATOR_DONE = 0,
GST_ITERATOR_OK = 1,
GST_ITERATOR_RESYNC = 2,
GST_ITERATOR_ERROR = 3,
} GstIteratorResult;
typedef struct _GstIterator GstIterator;
typedef GstIteratorResult (*GstIteratorNextFunction) (GstIterator *it, gpointer *result);
typedef void (*GstIteratorResyncFunction) (GstIterator *it);
typedef void (*GstIteratorFreeFunction) (GstIterator *it);
#define GST_ITERATOR(it) ((GstIterator*)(it))
#define GST_ITERATOR_LOCK(it) (GST_ITERATOR(it)->lock)
#define GST_ITERATOR_COOKIE(it) (GST_ITERATOR(it)->cookie)
#define GST_ITERATOR_ORIG_COOKIE(it) (GST_ITERATOR(it)->master_cookie)
struct _GstIterator {
GstIteratorNextFunction next;
GstIteratorResyncFunction resync;
GstIteratorFreeFunction free;
GMutex *lock;
guint32 cookie; /* cookie of the iterator */
guint32 *master_cookie; /* pointer to guint32 holding the cookie when this
iterator was created */
};
GstIterator* gst_iterator_new (guint size,
GMutex *lock,
guint32 *master_cookie,
GstIteratorNextFunction next,
GstIteratorResyncFunction resync,
GstIteratorFreeFunction free);
GstIterator* gst_iterator_new_list (GMutex *lock,
guint32 *master_cookie,
GList *list);
GstIteratorResult gst_iterator_next (GstIterator *it, gpointer *result);
void gst_iterator_resync (GstIterator *it);
void gst_iterator_free (GstIterator *it);
void gst_iterator_foreach (GstIterator *it, GFunc function,
gpointer user_data);
gpointer gst_iterator_find_custom (GstIterator *it, gpointer user_data,
GCompareFunc func);
GstIterator* gst_iterator_filter (GstIterator *it, gpointer user_data,
GCompareFunc func);
G_END_DECLS
#endif /* __GST_ITERATOR_H__ */