diff --git a/ChangeLog b/ChangeLog index 882de5579e..bf990089e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-05-12 Ronald S. Bultje + + * gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init), + (fill_buffer), (check_queue), (queue_threshold_reached), + (queue_out_of_data): + * gst/playback/gstplaybasebin.h: + Post buffer-fullness on the bus. + 2005-05-12 Ronald S. Bultje * gst/playback/gstdecodebin.c: (gst_decode_bin_class_init), diff --git a/gst/playback/gstplaybasebin.c b/gst/playback/gstplaybasebin.c index 5c4e5749b1..f0345cc840 100644 --- a/gst/playback/gstplaybasebin.c +++ b/gst/playback/gstplaybasebin.c @@ -53,13 +53,6 @@ enum ARG_TEXT }; -/* signals */ -enum -{ - SIGNAL_BUFFERING, - LAST_SIGNAL -}; - static void gst_play_base_bin_class_init (GstPlayBaseBinClass * klass); static void gst_play_base_bin_init (GstPlayBaseBin * play_base_bin); static void gst_play_base_bin_dispose (GObject * object); @@ -81,7 +74,6 @@ static gboolean probe_triggered (GstProbe * probe, GstData ** data, static void setup_substreams (GstPlayBaseBin * play_base_bin); static GstPipelineClass *parent_class; -static guint gst_play_base_bin_signals[LAST_SIGNAL] = { 0 }; /* * GObject playbasebin wrappers. @@ -171,13 +163,6 @@ gst_play_base_bin_class_init (GstPlayBaseBinClass * klass) GST_DEBUG_CATEGORY_INIT (gst_play_base_bin_debug, "playbasebin", 0, "playbasebin"); - /* signals */ - gst_play_base_bin_signals[SIGNAL_BUFFERING] = - g_signal_new ("buffering", G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstPlayBaseBinClass, buffering), - NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); - gobject_klass->dispose = GST_DEBUG_FUNCPTR (gst_play_base_bin_dispose); gobject_klass->finalize = GST_DEBUG_FUNCPTR (gst_play_base_bin_finalize); @@ -452,6 +437,14 @@ group_is_muted (GstPlayBaseGroup * group) * Buffer/cache checking. */ +static inline void +fill_buffer (GstPlayBaseBin * play_base_bin, gint percent) +{ + gst_element_post_message (GST_ELEMENT (play_base_bin), + gst_message_new_application (gst_structure_new ("GstMessageBuffering", + "buffer-percent", G_TYPE_INT, percent, NULL))); +} + static gboolean check_queue (GstProbe * probe, GstData ** data, gpointer user_data) { @@ -464,9 +457,7 @@ check_queue (GstProbe * probe, GstData ** data, gpointer user_data) level = level * 100 / play_base_bin->queue_threshold; if (level > 100) level = 100; - - g_signal_emit (play_base_bin, - gst_play_base_bin_signals[SIGNAL_BUFFERING], 0, level); + fill_buffer (play_base_bin, level); /* continue! */ return TRUE; @@ -505,8 +496,7 @@ queue_threshold_reached (GstElement * queue, GstPlayBaseBin * play_base_bin) "Removing buffer probe %p from pad %s:%s (%p)", probe, GST_DEBUG_PAD_NAME (sinkpad), sinkpad); - g_signal_emit (play_base_bin, - gst_play_base_bin_signals[SIGNAL_BUFFERING], 0, 100); + fill_buffer (play_base_bin, 100); g_object_set_data (G_OBJECT (queue), "probe", NULL); gst_pad_remove_probe (sinkpad, probe); @@ -542,8 +532,7 @@ queue_out_of_data (GstElement * queue, GstPlayBaseBin * play_base_bin) probe, GST_DEBUG_PAD_NAME (sinkpad), sinkpad); g_object_unref (G_OBJECT (sinkpad)); - g_signal_emit (play_base_bin, - gst_play_base_bin_signals[SIGNAL_BUFFERING], 0, 0); + fill_buffer (play_base_bin, 0); } } diff --git a/gst/playback/gstplaybasebin.h b/gst/playback/gstplaybasebin.h index 6ea52232d9..32c511fcb3 100644 --- a/gst/playback/gstplaybasebin.h +++ b/gst/playback/gstplaybasebin.h @@ -94,12 +94,6 @@ struct _GstPlayBaseBinClass { /* virtual fuctions */ void (*setup_output_pads) (GstPlayBaseBin *play_base_bin, GstPlayBaseGroup *group); - - /* signals */ - /* 0: buf=empty (underrun) - will re-cache, - * 100: buf=full (overrun) - will flush head of cache (latency) */ - void (*buffering) (GstPlayBaseBin *play_base_bin, - gint percentage); }; GType gst_play_base_bin_get_type (void);