mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 23:06:49 +00:00
e44beb9f04
Original commit message from CVS: 2005-05-10 Andy Wingo <wingo@pobox.com> * gst/elements/gstfakesink.c (gst_fakesink_render): Er, emit with *all* the arguments. * gst/base/gstbasetransform.c (gst_base_transform_event): Grab the stream lock if it's a FLUSH_DONE; normal flushes don't get the lock (according to the docs -- if this is wrong change the docs). * gst/gstpipeline.c (gst_pipeline_change_state): Set the bus to flush messages in the NULL state. * gst/gstbus.c (gst_bus_post): If a bus is flushing, unref the message immediately and return. (gst_bus_set_flushing): New function. If a bus is flushing, it flushes out any queued messages and immediately unrefs new messages. This is so when an element goes to NULL, all of the unhandled messages coming from it can be freed, and their references to the element dropped. In other words: message source ref considered harmful :P * gst/gstbin.c (gst_bin_change_state): Unref peer element when we're finished with it. * gst/gstmessage.c (gst_message_new_state_changed):
110 lines
3.5 KiB
C
110 lines
3.5 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__
|
|
|
|
#include <gst/gsttypes.h>
|
|
#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))
|
|
|
|
typedef enum {
|
|
GST_BUS_FLUSHING = GST_OBJECT_FLAG_LAST,
|
|
|
|
GST_BUS_FLAG_LAST = GST_OBJECT_FLAG_LAST + 1
|
|
} GstBusFlags;
|
|
|
|
typedef enum
|
|
{
|
|
GST_BUS_DROP = 0, /* drop message */
|
|
GST_BUS_PASS = 1, /* pass message to async queue */
|
|
GST_BUS_ASYNC = 2, /* pass message to async queue, continue if message is handled */
|
|
} GstBusSyncReply;
|
|
|
|
typedef GstBusSyncReply (*GstBusSyncHandler) (GstBus * bus, GstMessage * message, gpointer data);
|
|
typedef gboolean (*GstBusHandler) (GstBus * bus, GstMessage * message, gpointer data);
|
|
|
|
struct _GstBus
|
|
{
|
|
GstObject object;
|
|
|
|
/*< private > */
|
|
GQueue *queue;
|
|
GMutex *queue_lock;
|
|
|
|
GstBusSyncHandler sync_handler;
|
|
gpointer sync_handler_data;
|
|
|
|
gint control_socket[2];
|
|
GIOChannel *io_channel;
|
|
|
|
/*< private > */
|
|
gpointer _gst_reserved[GST_PADDING];
|
|
};
|
|
|
|
struct _GstBusClass
|
|
{
|
|
GstObjectClass parent_class;
|
|
|
|
/*< 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);
|
|
|
|
void gst_bus_set_sync_handler (GstBus * bus, GstBusSyncHandler func,
|
|
gpointer data);
|
|
|
|
GSource * gst_bus_create_watch (GstBus * bus);
|
|
guint gst_bus_add_watch_full (GstBus * bus,
|
|
gint priority,
|
|
GstBusHandler handler,
|
|
gpointer user_data,
|
|
GDestroyNotify notify);
|
|
guint gst_bus_add_watch (GstBus * bus,
|
|
GstBusHandler handler,
|
|
gpointer user_data);
|
|
GstMessageType gst_bus_poll (GstBus *bus, GstMessageType events,
|
|
GstClockTimeDiff timeout);
|
|
|
|
|
|
G_END_DECLS
|
|
#endif /* __GST_BUS_H__ */
|