asfmux: port to GstCollectPads2

This commit is contained in:
Vincent Penquerc'h 2011-12-15 12:59:57 +00:00
parent 4b9a20b38f
commit 4db6f8f7f2
3 changed files with 20 additions and 20 deletions

View file

@ -165,7 +165,7 @@ static GstStateChangeReturn gst_asf_mux_change_state (GstElement * element,
static gboolean gst_asf_mux_sink_event (GstPad * pad, GstEvent * event); static gboolean gst_asf_mux_sink_event (GstPad * pad, GstEvent * event);
static void gst_asf_mux_pad_reset (GstAsfPad * data); static void gst_asf_mux_pad_reset (GstAsfPad * data);
static GstFlowReturn gst_asf_mux_collected (GstCollectPads * collect, static GstFlowReturn gst_asf_mux_collected (GstCollectPads2 * collect,
gpointer data); gpointer data);
static GstElementClass *parent_class = NULL; static GstElementClass *parent_class = NULL;
@ -334,9 +334,9 @@ gst_asf_mux_init (GstAsfMux * asfmux)
gst_pad_use_fixed_caps (asfmux->srcpad); gst_pad_use_fixed_caps (asfmux->srcpad);
gst_element_add_pad (GST_ELEMENT (asfmux), asfmux->srcpad); gst_element_add_pad (GST_ELEMENT (asfmux), asfmux->srcpad);
asfmux->collect = gst_collect_pads_new (); asfmux->collect = gst_collect_pads2_new ();
gst_collect_pads_set_function (asfmux->collect, gst_collect_pads2_set_function (asfmux->collect,
(GstCollectPadsFunction) GST_DEBUG_FUNCPTR (gst_asf_mux_collected), (GstCollectPads2Function) GST_DEBUG_FUNCPTR (gst_asf_mux_collected),
asfmux); asfmux);
asfmux->payloads = NULL; asfmux->payloads = NULL;
@ -1850,7 +1850,7 @@ gst_asf_mux_process_buffer (GstAsfMux * asfmux, GstAsfPad * pad,
AsfPayload *payload; AsfPayload *payload;
payload = g_malloc0 (sizeof (AsfPayload)); payload = g_malloc0 (sizeof (AsfPayload));
payload->pad = (GstCollectData *) pad; payload->pad = (GstCollectData2 *) pad;
payload->data = buf; payload->data = buf;
GST_LOG_OBJECT (asfmux, GST_LOG_OBJECT (asfmux,
@ -1910,7 +1910,7 @@ gst_asf_mux_process_buffer (GstAsfMux * asfmux, GstAsfPad * pad,
} }
static GstFlowReturn static GstFlowReturn
gst_asf_mux_collected (GstCollectPads * collect, gpointer data) gst_asf_mux_collected (GstCollectPads2 * collect, gpointer data)
{ {
GstAsfMux *asfmux = GST_ASF_MUX_CAST (data); GstAsfMux *asfmux = GST_ASF_MUX_CAST (data);
GstFlowReturn ret = GST_FLOW_OK; GstFlowReturn ret = GST_FLOW_OK;
@ -1936,15 +1936,15 @@ gst_asf_mux_collected (GstCollectPads * collect, gpointer data)
walk = asfmux->collect->data; walk = asfmux->collect->data;
while (walk) { while (walk) {
GstAsfPad *pad; GstAsfPad *pad;
GstCollectData *data; GstCollectData2 *data;
GstClockTime time; GstClockTime time;
data = (GstCollectData *) walk->data; data = (GstCollectData2 *) walk->data;
pad = (GstAsfPad *) data; pad = (GstAsfPad *) data;
walk = g_slist_next (walk); walk = g_slist_next (walk);
buf = gst_collect_pads_peek (collect, data); buf = gst_collect_pads2_peek (collect, data);
if (buf == NULL) { if (buf == NULL) {
GST_LOG_OBJECT (asfmux, "Pad %s has no buffers", GST_LOG_OBJECT (asfmux, "Pad %s has no buffers",
GST_PAD_NAME (pad->collect.pad)); GST_PAD_NAME (pad->collect.pad));
@ -1979,7 +1979,7 @@ gst_asf_mux_collected (GstCollectPads * collect, gpointer data)
/* we have data */ /* we have data */
GST_LOG_OBJECT (asfmux, "selected pad %s with time %" GST_TIME_FORMAT, GST_LOG_OBJECT (asfmux, "selected pad %s with time %" GST_TIME_FORMAT,
GST_PAD_NAME (best_pad->collect.pad), GST_TIME_ARGS (best_time)); GST_PAD_NAME (best_pad->collect.pad), GST_TIME_ARGS (best_time));
buf = gst_collect_pads_pop (collect, &best_pad->collect); buf = gst_collect_pads2_pop (collect, &best_pad->collect);
ret = gst_asf_mux_process_buffer (asfmux, best_pad, buf); ret = gst_asf_mux_process_buffer (asfmux, best_pad, buf);
} else { } else {
/* no data, let's finish it up */ /* no data, let's finish it up */
@ -2278,8 +2278,8 @@ gst_asf_mux_request_new_pad (GstElement * element,
collect_size = sizeof (GstAsfVideoPad); collect_size = sizeof (GstAsfVideoPad);
} }
collect_pad = (GstAsfPad *) collect_pad = (GstAsfPad *)
gst_collect_pads_add_pad_full (asfmux->collect, newpad, collect_size, gst_collect_pads2_add_pad_full (asfmux->collect, newpad, collect_size,
(GstCollectDataDestroyNotify) (gst_asf_mux_pad_reset)); (GstCollectData2DestroyNotify) (gst_asf_mux_pad_reset), TRUE);
/* set up pad */ /* set up pad */
collect_pad->is_audio = is_audio; collect_pad->is_audio = is_audio;
@ -2293,7 +2293,7 @@ gst_asf_mux_request_new_pad (GstElement * element,
collect_pad->stream_number = asfmux->stream_number; collect_pad->stream_number = asfmux->stream_number;
/* 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 * GstCollectPads2; because it sets its own event function giving
* the element no access to events. * the element no access to events.
*/ */
asfmux->collect_event = (GstPadEventFunction) GST_PAD_EVENTFUNC (newpad); asfmux->collect_event = (GstPadEventFunction) GST_PAD_EVENTFUNC (newpad);
@ -2390,12 +2390,12 @@ gst_asf_mux_change_state (GstElement * element, GstStateChange transition)
asfmux->packet_size = asfmux->prop_packet_size; asfmux->packet_size = asfmux->prop_packet_size;
asfmux->preroll = asfmux->prop_preroll; asfmux->preroll = asfmux->prop_preroll;
asfmux->merge_stream_tags = asfmux->prop_merge_stream_tags; asfmux->merge_stream_tags = asfmux->prop_merge_stream_tags;
gst_collect_pads_start (asfmux->collect); gst_collect_pads2_start (asfmux->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 (asfmux->collect); gst_collect_pads2_stop (asfmux->collect);
asfmux->state = GST_ASF_MUX_STATE_NONE; asfmux->state = GST_ASF_MUX_STATE_NONE;
break; break;
default: default:

View file

@ -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-media.h> #include <gst/riff/riff-media.h>
#include "gstasfobjects.h" #include "gstasfobjects.h"
@ -57,7 +57,7 @@ enum _GstAsfMuxState
struct _GstAsfPad struct _GstAsfPad
{ {
GstCollectData collect; GstCollectData2 collect;
gboolean is_audio; gboolean is_audio;
guint8 stream_number; guint8 stream_number;
@ -143,7 +143,7 @@ struct _GstAsfMux
/* pads */ /* pads */
GstPad *srcpad; GstPad *srcpad;
GstCollectPads *collect; GstCollectPads2 *collect;
GstPadEventFunction collect_event; GstPadEventFunction collect_event;
}; };

View file

@ -22,7 +22,7 @@
#include <glib.h> #include <glib.h>
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/base/gstbytereader.h> #include <gst/base/gstbytereader.h>
#include <gst/base/gstcollectpads.h> #include <gst/base/gstcollectpads2.h>
#define ASF_PAYLOAD_IS_KEYFRAME(pay) ((pay->stream_number & 0x80) != 0) #define ASF_PAYLOAD_IS_KEYFRAME(pay) ((pay->stream_number & 0x80) != 0)
#define ASF_MILI_TO_100NANO(v) (v * 10000) #define ASF_MILI_TO_100NANO(v) (v * 10000)
@ -75,7 +75,7 @@ typedef struct _AsfPayload
guint32 presentation_time; guint32 presentation_time;
GstBuffer *data; GstBuffer *data;
GstCollectData *pad; GstCollectData2 *pad;
/* simple index info */ /* simple index info */
gboolean has_packet_info; gboolean has_packet_info;