mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-08 13:18:52 +00:00
avimux: port to GstCollectPads2
This commit is contained in:
parent
cf344d50b1
commit
a89e2b7e48
2 changed files with 18 additions and 18 deletions
|
@ -195,7 +195,7 @@ static void gst_avi_mux_class_init (GstAviMuxClass * klass);
|
||||||
static void gst_avi_mux_init (GstAviMux * avimux);
|
static void gst_avi_mux_init (GstAviMux * avimux);
|
||||||
static void gst_avi_mux_pad_reset (GstAviPad * avipad, gboolean free);
|
static void gst_avi_mux_pad_reset (GstAviPad * avipad, gboolean free);
|
||||||
|
|
||||||
static GstFlowReturn gst_avi_mux_collect_pads (GstCollectPads * 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 (GstPad * pad, GstEvent * event);
|
||||||
static GstPad *gst_avi_mux_request_new_pad (GstElement * element,
|
static GstPad *gst_avi_mux_request_new_pad (GstElement * element,
|
||||||
|
@ -418,9 +418,9 @@ gst_avi_mux_init (GstAviMux * avimux)
|
||||||
/* property */
|
/* property */
|
||||||
avimux->enable_large_avi = DEFAULT_BIGFILE;
|
avimux->enable_large_avi = DEFAULT_BIGFILE;
|
||||||
|
|
||||||
avimux->collect = gst_collect_pads_new ();
|
avimux->collect = gst_collect_pads2_new ();
|
||||||
gst_collect_pads_set_function (avimux->collect,
|
gst_collect_pads2_set_function (avimux->collect,
|
||||||
(GstCollectPadsFunction) (GST_DEBUG_FUNCPTR (gst_avi_mux_collect_pads)),
|
(GstCollectPads2Function) (GST_DEBUG_FUNCPTR (gst_avi_mux_collect_pads)),
|
||||||
avimux);
|
avimux);
|
||||||
|
|
||||||
/* set to clean state */
|
/* set to clean state */
|
||||||
|
@ -1024,11 +1024,11 @@ gst_avi_mux_request_new_pad (GstElement * element,
|
||||||
|
|
||||||
g_free (name);
|
g_free (name);
|
||||||
|
|
||||||
avipad->collect = gst_collect_pads_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
|
/* FIXME: hacked way to override/extend the event function of
|
||||||
* GstCollectPads; because it sets its own event function giving the
|
* GstCollectPads2; because it sets its own event function giving the
|
||||||
* element no access to events */
|
* element no access to events */
|
||||||
avimux->collect_event = (GstPadEventFunction) GST_PAD_EVENTFUNC (newpad);
|
avimux->collect_event = (GstPadEventFunction) GST_PAD_EVENTFUNC (newpad);
|
||||||
gst_pad_set_event_function (newpad,
|
gst_pad_set_event_function (newpad,
|
||||||
|
@ -1085,7 +1085,7 @@ gst_avi_mux_release_pad (GstElement * element, GstPad * pad)
|
||||||
* as it also represent number of streams present */
|
* as it also represent number of streams present */
|
||||||
avipad->collect = NULL;
|
avipad->collect = NULL;
|
||||||
GST_DEBUG_OBJECT (avimux, "removed pad '%s'", GST_PAD_NAME (pad));
|
GST_DEBUG_OBJECT (avimux, "removed pad '%s'", GST_PAD_NAME (pad));
|
||||||
gst_collect_pads_remove_pad (avimux->collect, pad);
|
gst_collect_pads2_remove_pad (avimux->collect, pad);
|
||||||
gst_element_remove_pad (element, pad);
|
gst_element_remove_pad (element, pad);
|
||||||
/* if not started yet, we can remove any sign this pad ever existed */
|
/* if not started yet, we can remove any sign this pad ever existed */
|
||||||
/* in this case _start will take care of the real pad count */
|
/* in this case _start will take care of the real pad count */
|
||||||
|
@ -1882,7 +1882,7 @@ gst_avi_mux_handle_event (GstPad * pad, GstEvent * event)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now GstCollectPads 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);
|
ret = avimux->collect_event (pad, event);
|
||||||
|
|
||||||
gst_object_unref (avimux);
|
gst_object_unref (avimux);
|
||||||
|
@ -1911,7 +1911,7 @@ gst_avi_mux_do_buffer (GstAviMux * avimux, GstAviPad * avipad)
|
||||||
gulong total_size, pad_bytes = 0;
|
gulong total_size, pad_bytes = 0;
|
||||||
guint flags;
|
guint flags;
|
||||||
|
|
||||||
data = gst_collect_pads_pop (avimux->collect, avipad->collect);
|
data = gst_collect_pads2_pop (avimux->collect, avipad->collect);
|
||||||
/* arrange downstream running time */
|
/* arrange downstream running time */
|
||||||
data = gst_buffer_make_metadata_writable (data);
|
data = gst_buffer_make_metadata_writable (data);
|
||||||
GST_BUFFER_TIMESTAMP (data) =
|
GST_BUFFER_TIMESTAMP (data) =
|
||||||
|
@ -2037,7 +2037,7 @@ gst_avi_mux_do_one_buffer (GstAviMux * avimux)
|
||||||
if (!avipad->hdr.fcc_handler)
|
if (!avipad->hdr.fcc_handler)
|
||||||
goto not_negotiated;
|
goto not_negotiated;
|
||||||
|
|
||||||
buffer = gst_collect_pads_peek (avimux->collect, avipad->collect);
|
buffer = gst_collect_pads2_peek (avimux->collect, avipad->collect);
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
continue;
|
continue;
|
||||||
time = GST_BUFFER_TIMESTAMP (buffer);
|
time = GST_BUFFER_TIMESTAMP (buffer);
|
||||||
|
@ -2050,7 +2050,7 @@ gst_avi_mux_do_one_buffer (GstAviMux * avimux)
|
||||||
if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (time))) {
|
if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (time))) {
|
||||||
GST_DEBUG_OBJECT (avimux, "clipping buffer on pad %s outside segment",
|
GST_DEBUG_OBJECT (avimux, "clipping buffer on pad %s outside segment",
|
||||||
GST_PAD_NAME (avipad->collect->pad));
|
GST_PAD_NAME (avipad->collect->pad));
|
||||||
buffer = gst_collect_pads_pop (avimux->collect, avipad->collect);
|
buffer = gst_collect_pads2_pop (avimux->collect, avipad->collect);
|
||||||
gst_buffer_unref (buffer);
|
gst_buffer_unref (buffer);
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
@ -2089,7 +2089,7 @@ not_negotiated:
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_avi_mux_collect_pads (GstCollectPads * pads, GstAviMux * avimux)
|
gst_avi_mux_collect_pads (GstCollectPads2 * pads, GstAviMux * avimux)
|
||||||
{
|
{
|
||||||
GstFlowReturn res;
|
GstFlowReturn res;
|
||||||
|
|
||||||
|
@ -2148,12 +2148,12 @@ gst_avi_mux_change_state (GstElement * element, GstStateChange transition)
|
||||||
|
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||||
gst_collect_pads_start (avimux->collect);
|
gst_collect_pads2_start (avimux->collect);
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||||
gst_collect_pads_stop (avimux->collect);
|
gst_collect_pads2_stop (avimux->collect);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gst/base/gstcollectpads.h>
|
#include <gst/base/gstcollectpads2.h>
|
||||||
#include <gst/riff/riff-ids.h>
|
#include <gst/riff/riff-ids.h>
|
||||||
#include "avi-ids.h"
|
#include "avi-ids.h"
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ typedef GstFlowReturn (*GstAviPadHook) (GstAviMux * avi, GstAviPad * avipad,
|
||||||
struct _GstAviPad {
|
struct _GstAviPad {
|
||||||
/* do not extend, link to it */
|
/* do not extend, link to it */
|
||||||
/* is NULL if original sink request pad has been removed */
|
/* is NULL if original sink request pad has been removed */
|
||||||
GstCollectData *collect;
|
GstCollectData2 *collect;
|
||||||
|
|
||||||
/* type */
|
/* type */
|
||||||
gboolean is_video;
|
gboolean is_video;
|
||||||
|
@ -129,7 +129,7 @@ typedef struct _GstAviAudioPad {
|
||||||
|
|
||||||
typedef struct _GstAviCollectData {
|
typedef struct _GstAviCollectData {
|
||||||
/* extend the CollectData */
|
/* extend the CollectData */
|
||||||
GstCollectData collect;
|
GstCollectData2 collect;
|
||||||
|
|
||||||
GstAviPad *avipad;
|
GstAviPad *avipad;
|
||||||
} GstAviCollectData;
|
} GstAviCollectData;
|
||||||
|
@ -143,7 +143,7 @@ struct _GstAviMux {
|
||||||
GSList *sinkpads;
|
GSList *sinkpads;
|
||||||
/* video restricted to 1 pad */
|
/* video restricted to 1 pad */
|
||||||
guint video_pads, audio_pads;
|
guint video_pads, audio_pads;
|
||||||
GstCollectPads *collect;
|
GstCollectPads2 *collect;
|
||||||
GstPadEventFunction collect_event;
|
GstPadEventFunction collect_event;
|
||||||
|
|
||||||
/* the AVI header */
|
/* the AVI header */
|
||||||
|
|
Loading…
Reference in a new issue