mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-08 13:18:52 +00:00
avimux: use GstCollectPads2 event callback
... in stead of local HACK.
This commit is contained in:
parent
7480b4407e
commit
97391f1402
2 changed files with 9 additions and 17 deletions
|
@ -197,7 +197,8 @@ static void gst_avi_mux_pad_reset (GstAviPad * avipad, gboolean free);
|
||||||
|
|
||||||
static GstFlowReturn gst_avi_mux_collect_pads (GstCollectPads2 * pads,
|
static GstFlowReturn gst_avi_mux_collect_pads (GstCollectPads2 * pads,
|
||||||
GstAviMux * avimux);
|
GstAviMux * avimux);
|
||||||
static gboolean gst_avi_mux_handle_event (GstPad * pad, GstEvent * event);
|
static gboolean gst_avi_mux_handle_event (GstCollectPads2 * pad,
|
||||||
|
GstCollectData2 * data, GstEvent * event, gpointer user_data);
|
||||||
static GstPad *gst_avi_mux_request_new_pad (GstElement * element,
|
static GstPad *gst_avi_mux_request_new_pad (GstElement * element,
|
||||||
GstPadTemplate * templ, const gchar * name);
|
GstPadTemplate * templ, const gchar * name);
|
||||||
static void gst_avi_mux_release_pad (GstElement * element, GstPad * pad);
|
static void gst_avi_mux_release_pad (GstElement * element, GstPad * pad);
|
||||||
|
@ -422,6 +423,9 @@ gst_avi_mux_init (GstAviMux * avimux)
|
||||||
gst_collect_pads2_set_function (avimux->collect,
|
gst_collect_pads2_set_function (avimux->collect,
|
||||||
(GstCollectPads2Function) (GST_DEBUG_FUNCPTR (gst_avi_mux_collect_pads)),
|
(GstCollectPads2Function) (GST_DEBUG_FUNCPTR (gst_avi_mux_collect_pads)),
|
||||||
avimux);
|
avimux);
|
||||||
|
gst_collect_pads2_set_event_function (avimux->collect,
|
||||||
|
(GstCollectPads2EventFunction) (GST_DEBUG_FUNCPTR
|
||||||
|
(gst_avi_mux_handle_event)), avimux);
|
||||||
|
|
||||||
/* set to clean state */
|
/* set to clean state */
|
||||||
gst_avi_mux_reset (avimux);
|
gst_avi_mux_reset (avimux);
|
||||||
|
@ -1027,13 +1031,6 @@ gst_avi_mux_request_new_pad (GstElement * element,
|
||||||
avipad->collect = gst_collect_pads2_add_pad (avimux->collect,
|
avipad->collect = gst_collect_pads2_add_pad (avimux->collect,
|
||||||
newpad, sizeof (GstAviCollectData));
|
newpad, sizeof (GstAviCollectData));
|
||||||
((GstAviCollectData *) (avipad->collect))->avipad = avipad;
|
((GstAviCollectData *) (avipad->collect))->avipad = avipad;
|
||||||
/* 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 */
|
|
||||||
avimux->collect_event = (GstPadEventFunction) GST_PAD_EVENTFUNC (newpad);
|
|
||||||
gst_pad_set_event_function (newpad,
|
|
||||||
GST_DEBUG_FUNCPTR (gst_avi_mux_handle_event));
|
|
||||||
|
|
||||||
if (!gst_element_add_pad (element, newpad))
|
if (!gst_element_add_pad (element, newpad))
|
||||||
goto pad_add_failed;
|
goto pad_add_failed;
|
||||||
|
|
||||||
|
@ -1861,12 +1858,12 @@ gst_avi_mux_restart_file (GstAviMux * avimux)
|
||||||
|
|
||||||
/* handle events (search) */
|
/* handle events (search) */
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_avi_mux_handle_event (GstPad * pad, GstEvent * event)
|
gst_avi_mux_handle_event (GstCollectPads2 * pads, GstCollectData2 * data,
|
||||||
|
GstEvent * event, gpointer user_data)
|
||||||
{
|
{
|
||||||
GstAviMux *avimux;
|
GstAviMux *avimux;
|
||||||
gboolean ret;
|
|
||||||
|
|
||||||
avimux = GST_AVI_MUX (gst_pad_get_parent (pad));
|
avimux = GST_AVI_MUX (user_data);
|
||||||
|
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
case GST_EVENT_TAG:{
|
case GST_EVENT_TAG:{
|
||||||
|
@ -1883,11 +1880,7 @@ gst_avi_mux_handle_event (GstPad * pad, GstEvent * event)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now GstCollectPads2 can take care of the rest, e.g. EOS */
|
/* now GstCollectPads2 can take care of the rest, e.g. EOS */
|
||||||
ret = avimux->collect_event (pad, event);
|
return FALSE;
|
||||||
|
|
||||||
gst_object_unref (avimux);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* send extra 'padding' data */
|
/* send extra 'padding' data */
|
||||||
|
|
|
@ -144,7 +144,6 @@ struct _GstAviMux {
|
||||||
/* video restricted to 1 pad */
|
/* video restricted to 1 pad */
|
||||||
guint video_pads, audio_pads;
|
guint video_pads, audio_pads;
|
||||||
GstCollectPads2 *collect;
|
GstCollectPads2 *collect;
|
||||||
GstPadEventFunction collect_event;
|
|
||||||
|
|
||||||
/* the AVI header */
|
/* the AVI header */
|
||||||
/* still some single stream video data in mux struct */
|
/* still some single stream video data in mux struct */
|
||||||
|
|
Loading…
Reference in a new issue