diff options
author | Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> | 2011-12-15 16:40:21 +0100 |
---|---|---|
committer | Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> | 2011-12-15 16:49:41 +0100 |
commit | 50be1d5dae18209047663759e3df7874197454ac (patch) | |
tree | 4969a2fbdd6836fcf68286daceecc7614883141f | |
parent | f6b38f2c3934f9228b4416e87142c3a3cb4157eb (diff) |
flvmux: use GstCollectPads2 event callback
... in stead of local HACK.
-rw-r--r-- | gst/flv/gstflvmux.c | 26 | ||||
-rw-r--r-- | gst/flv/gstflvmux.h | 2 |
2 files changed, 10 insertions, 18 deletions
diff --git a/gst/flv/gstflvmux.c b/gst/flv/gstflvmux.c index fc4cf7606..8a2201ee4 100644 --- a/gst/flv/gstflvmux.c +++ b/gst/flv/gstflvmux.c @@ -100,6 +100,9 @@ GST_BOILERPLATE_FULL (GstFlvMux, gst_flv_mux, GstElement, GST_TYPE_ELEMENT, static void gst_flv_mux_finalize (GObject * object); static GstFlowReturn gst_flv_mux_collected (GstCollectPads2 * pads, gpointer user_data); +static gboolean +gst_flv_mux_handle_sink_event (GstCollectPads2 * pads, GstCollectData2 * data, + GstEvent * event, gpointer user_data); static gboolean gst_flv_mux_handle_src_event (GstPad * pad, GstEvent * event); static GstPad *gst_flv_mux_request_new_pad (GstElement * element, @@ -200,6 +203,9 @@ gst_flv_mux_init (GstFlvMux * mux, GstFlvMuxClass * g_class) mux->collect = gst_collect_pads2_new (); gst_collect_pads2_set_function (mux->collect, (GstCollectPads2Function) GST_DEBUG_FUNCPTR (gst_flv_mux_collected), mux); + gst_collect_pads2_set_event_function (mux->collect, + (GstCollectPads2EventFunction) + GST_DEBUG_FUNCPTR (gst_flv_mux_handle_sink_event), mux); gst_flv_mux_reset (GST_ELEMENT (mux)); } @@ -260,10 +266,10 @@ gst_flv_mux_handle_src_event (GstPad * pad, GstEvent * event) } static gboolean -gst_flv_mux_handle_sink_event (GstPad * pad, GstEvent * event) +gst_flv_mux_handle_sink_event (GstCollectPads2 * pads, GstCollectData2 * data, + GstEvent * event, gpointer user_data) { - GstFlvMux *mux = GST_FLV_MUX (gst_pad_get_parent (pad)); - gboolean ret = TRUE; + GstFlvMux *mux = GST_FLV_MUX (user_data); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_TAG:{ @@ -281,11 +287,7 @@ gst_flv_mux_handle_sink_event (GstPad * pad, GstEvent * event) } /* now GstCollectPads2 can take care of the rest, e.g. EOS */ - if (ret) - ret = mux->collect_event (pad, event); - gst_object_unref (mux); - - return ret; + return FALSE; } static gboolean @@ -542,14 +544,6 @@ gst_flv_mux_request_new_pad (GstElement * element, cpad->video_codec_data = NULL; gst_flv_mux_reset_pad (mux, cpad, video); - /* FIXME: hacked way to override/extend the event function of - * GstCollectPads2; because it sets its own event function giving the - * element no access to events. - */ - mux->collect_event = (GstPadEventFunction) GST_PAD_EVENTFUNC (pad); - gst_pad_set_event_function (pad, - GST_DEBUG_FUNCPTR (gst_flv_mux_handle_sink_event)); - gst_pad_set_setcaps_function (pad, setcapsfunc); gst_pad_set_active (pad, TRUE); gst_element_add_pad (element, pad); diff --git a/gst/flv/gstflvmux.h b/gst/flv/gstflvmux.h index ad38abe9e..b0e10ea32 100644 --- a/gst/flv/gstflvmux.h +++ b/gst/flv/gstflvmux.h @@ -68,8 +68,6 @@ typedef struct _GstFlvMux { GstCollectPads2 *collect; /* <private> */ - GstPadEventFunction collect_event; - GstFlvMuxState state; gboolean have_audio; gboolean have_video; |