mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-21 07:46:38 +00:00
a98aef82db
Original commit message from CVS: * check/gst/gstbin.c: (GST_START_TEST): * docs/gst/gstreamer-sections.txt: * gst/base/gstbasesink.c: (gst_base_sink_init): * gst/base/gstbasesrc.c: (gst_base_src_init), (gst_base_src_get_range), (gst_base_src_check_get_range), (gst_base_src_start), (gst_base_src_stop): * gst/base/gstbasesrc.h: * gst/elements/gstfakesrc.c: (gst_fake_src_set_property): * gst/gstbin.c: (gst_bin_add_func), (gst_bin_remove_func), (bin_element_is_sink), (reset_degree), (gst_bin_element_set_state), (bin_bus_handler): * gst/gstbin.h: * gst/gstbuffer.h: * gst/gstbus.c: (gst_bus_post), (gst_bus_set_flushing): * gst/gstbus.h: * gst/gstelement.c: (gst_element_is_locked_state), (gst_element_set_locked_state), (gst_element_commit_state), (gst_element_set_state): * gst/gstelement.h: * gst/gstindex.c: (gst_index_init): * gst/gstindex.h: * gst/gstminiobject.h: * gst/gstobject.c: (gst_object_init), (gst_object_sink), (gst_object_set_parent): * gst/gstobject.h: * gst/gstpad.c: (gst_pad_set_blocked_async), (gst_pad_is_blocked), (gst_pad_get_caps_unlocked), (gst_pad_set_caps): * gst/gstpad.h: * gst/gstpadtemplate.h: * gst/gstpipeline.c: (gst_pipeline_provide_clock_func), (gst_pipeline_use_clock), (gst_pipeline_auto_clock): * gst/gstpipeline.h: * gst/indexers/gstfileindex.c: (gst_file_index_load), (gst_file_index_commit): * testsuite/bytestream/filepadsink.c: (gst_fp_sink_init): * testsuite/pad/link.c: (gst_test_src_init), (gst_test_filter_init), (gst_test_sink_init): * testsuite/states/locked.c: (main): renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
172 lines
5.4 KiB
C
172 lines
5.4 KiB
C
/* GStreamer
|
|
* Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
|
|
*
|
|
* gstbus.h: Header for GstBus subsystem
|
|
*
|
|
* 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_BUS_H__
|
|
#define __GST_BUS_H__
|
|
|
|
typedef struct _GstBus GstBus;
|
|
typedef struct _GstBusClass GstBusClass;
|
|
|
|
#include <gst/gstmessage.h>
|
|
#include <gst/gstclock.h>
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
/* --- standard type macros --- */
|
|
#define GST_TYPE_BUS (gst_bus_get_type ())
|
|
#define GST_BUS(bus) (G_TYPE_CHECK_INSTANCE_CAST ((bus), GST_TYPE_BUS, GstBus))
|
|
#define GST_IS_BUS(bus) (G_TYPE_CHECK_INSTANCE_TYPE ((bus), GST_TYPE_BUS))
|
|
#define GST_BUS_CLASS(bclass) (G_TYPE_CHECK_CLASS_CAST ((bclass), GST_TYPE_BUS, GstBusClass))
|
|
#define GST_IS_BUS_CLASS(bclass) (G_TYPE_CHECK_CLASS_TYPE ((bclass), GST_TYPE_BUS))
|
|
#define GST_BUS_GET_CLASS(bus) (G_TYPE_INSTANCE_GET_CLASS ((bus), GST_TYPE_BUS, GstBusClass))
|
|
#define GST_BUS_CAST(bus) ((GstBus*)(bus))
|
|
|
|
/**
|
|
* GstBusFlags:
|
|
* @GST_BUS_FLUSHING: The bus is currently dropping all messages
|
|
* @GST_BUS_FLAG_LAST: offset to define more flags
|
|
*
|
|
* The standard flags that a bus may have.
|
|
*/
|
|
typedef enum {
|
|
GST_BUS_FLUSHING = (GST_OBJECT_FLAG_LAST << 0),
|
|
/* padding */
|
|
GST_BUS_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 1)
|
|
} GstBusFlags;
|
|
|
|
/**
|
|
* GstBusSyncReply:
|
|
* @GST_BUS_DROP: drop the message
|
|
* @GST_BUS_PASS: pass the message to the async queue
|
|
* @GST_BUS_ASYNC: pass message to async queue, continue if message is handled
|
|
*
|
|
* The result values for a GstBusSyncHandler.
|
|
*/
|
|
typedef enum
|
|
{
|
|
GST_BUS_DROP = 0,
|
|
GST_BUS_PASS = 1,
|
|
GST_BUS_ASYNC = 2,
|
|
} GstBusSyncReply;
|
|
|
|
/**
|
|
* GstBusSyncHandler:
|
|
* @bus: the #GstBus that sent the message
|
|
* @message: the #GstMessage
|
|
* @data: user data that has been given, when registering the handler
|
|
*
|
|
* Handler will be invoked synchronously, when a new message has been injected
|
|
* into the bus. This function is mostly used internally. Only one sync handler
|
|
* can be attached to a given bus.
|
|
*
|
|
* Returns: #GstBusSyncReply stating what to do with the message
|
|
*/
|
|
typedef GstBusSyncReply (*GstBusSyncHandler) (GstBus * bus, GstMessage * message, gpointer data);
|
|
|
|
/**
|
|
* GstBusFunc:
|
|
* @bus: the #GstBus that sent the message
|
|
* @message: the #GstMessage
|
|
* @data: user data that has been given, when registering the handler
|
|
*
|
|
* Specifies the type of function passed to #gst_bus_add_watch() or
|
|
* #gst_bus_add_watch_full(), which is called from the mainloop when a message
|
|
* is available on the bus.
|
|
*
|
|
* The message passed to the function will be unreffed after execution of this
|
|
* function so it should not be freed in the function.
|
|
*
|
|
* Returns: %FALSE if the event source should be removed.
|
|
*/
|
|
typedef gboolean (*GstBusFunc) (GstBus * bus, GstMessage * message, gpointer data);
|
|
|
|
struct _GstBus
|
|
{
|
|
GstObject object;
|
|
|
|
/*< private > */
|
|
GQueue *queue;
|
|
GMutex *queue_lock;
|
|
|
|
GstBusSyncHandler sync_handler;
|
|
gpointer sync_handler_data;
|
|
|
|
guint signal_watch_id;
|
|
guint num_signal_watchers;
|
|
|
|
/*< private > */
|
|
gpointer _gst_reserved[GST_PADDING];
|
|
};
|
|
|
|
struct _GstBusClass
|
|
{
|
|
GstObjectClass parent_class;
|
|
|
|
/* signals */
|
|
void (*message) (GstBus *bus, GstMessage *message);
|
|
void (*sync_message) (GstBus *bus, GstMessage *message);
|
|
|
|
/*< private > */
|
|
gpointer _gst_reserved[GST_PADDING];
|
|
};
|
|
|
|
GType gst_bus_get_type (void);
|
|
|
|
GstBus* gst_bus_new (void);
|
|
|
|
gboolean gst_bus_post (GstBus * bus, GstMessage * message);
|
|
|
|
gboolean gst_bus_have_pending (GstBus * bus);
|
|
GstMessage * gst_bus_peek (GstBus * bus);
|
|
GstMessage * gst_bus_pop (GstBus * bus);
|
|
void gst_bus_set_flushing (GstBus * bus, gboolean flushing);
|
|
|
|
/* synchronous dispatching */
|
|
void gst_bus_set_sync_handler (GstBus * bus, GstBusSyncHandler func,
|
|
gpointer data);
|
|
/* GSource based dispatching */
|
|
GSource * gst_bus_create_watch (GstBus * bus);
|
|
guint gst_bus_add_watch_full (GstBus * bus,
|
|
gint priority,
|
|
GstBusFunc func,
|
|
gpointer user_data,
|
|
GDestroyNotify notify);
|
|
guint gst_bus_add_watch (GstBus * bus,
|
|
GstBusFunc func,
|
|
gpointer user_data);
|
|
|
|
/* polling the bus */
|
|
GstMessage* gst_bus_poll (GstBus *bus, GstMessageType events,
|
|
GstClockTimeDiff timeout);
|
|
|
|
/* signal based dispatching helper functions. */
|
|
gboolean gst_bus_async_signal_func (GstBus *bus, GstMessage *message,
|
|
gpointer data);
|
|
GstBusSyncReply gst_bus_sync_signal_handler (GstBus *bus, GstMessage *message,
|
|
gpointer data);
|
|
|
|
/* convenience api to add/remove a gsource that emits the async signals */
|
|
void gst_bus_add_signal_watch (GstBus * bus);
|
|
void gst_bus_remove_signal_watch (GstBus * bus);
|
|
|
|
G_END_DECLS
|
|
|
|
#endif /* __GST_BUS_H__ */
|