asfmux: port to GstCollectPads2
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Thu, 15 Dec 2011 12:59:57 +0000 (12:59 +0000)
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Thu, 15 Dec 2011 12:59:57 +0000 (12:59 +0000)
gst/asfmux/gstasfmux.c
gst/asfmux/gstasfmux.h
gst/asfmux/gstasfobjects.h

index 8e6af1d..44f7f16 100644 (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 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);
 
 static GstElementClass *parent_class = NULL;
@@ -334,9 +334,9 @@ gst_asf_mux_init (GstAsfMux * asfmux)
   gst_pad_use_fixed_caps (asfmux->srcpad);
   gst_element_add_pad (GST_ELEMENT (asfmux), asfmux->srcpad);
 
-  asfmux->collect = gst_collect_pads_new ();
-  gst_collect_pads_set_function (asfmux->collect,
-      (GstCollectPadsFunction) GST_DEBUG_FUNCPTR (gst_asf_mux_collected),
+  asfmux->collect = gst_collect_pads2_new ();
+  gst_collect_pads2_set_function (asfmux->collect,
+      (GstCollectPads2Function) GST_DEBUG_FUNCPTR (gst_asf_mux_collected),
       asfmux);
 
   asfmux->payloads = NULL;
@@ -1850,7 +1850,7 @@ gst_asf_mux_process_buffer (GstAsfMux * asfmux, GstAsfPad * pad,
   AsfPayload *payload;
 
   payload = g_malloc0 (sizeof (AsfPayload));
-  payload->pad = (GstCollectData *) pad;
+  payload->pad = (GstCollectData2 *) pad;
   payload->data = buf;
 
   GST_LOG_OBJECT (asfmux,
@@ -1910,7 +1910,7 @@ gst_asf_mux_process_buffer (GstAsfMux * asfmux, GstAsfPad * pad,
 }
 
 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);
   GstFlowReturn ret = GST_FLOW_OK;
@@ -1936,15 +1936,15 @@ gst_asf_mux_collected (GstCollectPads * collect, gpointer data)
   walk = asfmux->collect->data;
   while (walk) {
     GstAsfPad *pad;
-    GstCollectData *data;
+    GstCollectData2 *data;
     GstClockTime time;
 
-    data = (GstCollectData *) walk->data;
+    data = (GstCollectData2 *) walk->data;
     pad = (GstAsfPad *) data;
 
     walk = g_slist_next (walk);
 
-    buf = gst_collect_pads_peek (collect, data);
+    buf = gst_collect_pads2_peek (collect, data);
     if (buf == NULL) {
       GST_LOG_OBJECT (asfmux, "Pad %s has no buffers",
           GST_PAD_NAME (pad->collect.pad));
@@ -1979,7 +1979,7 @@ gst_asf_mux_collected (GstCollectPads * collect, gpointer data)
     /* we have data */
     GST_LOG_OBJECT (asfmux, "selected pad %s with time %" GST_TIME_FORMAT,
         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);
   } else {
     /* no data, let's finish it up */
@@ -2278,8 +2278,8 @@ gst_asf_mux_request_new_pad (GstElement * element,
     collect_size = sizeof (GstAsfVideoPad);
   }
   collect_pad = (GstAsfPad *)
-      gst_collect_pads_add_pad_full (asfmux->collect, newpad, collect_size,
-      (GstCollectDataDestroyNotify) (gst_asf_mux_pad_reset));
+      gst_collect_pads2_add_pad_full (asfmux->collect, newpad, collect_size,
+      (GstCollectData2DestroyNotify) (gst_asf_mux_pad_reset), TRUE);
 
   /* set up pad */
   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;
 
   /* 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.
    */
   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->preroll = asfmux->prop_preroll;
       asfmux->merge_stream_tags = asfmux->prop_merge_stream_tags;
-      gst_collect_pads_start (asfmux->collect);
+      gst_collect_pads2_start (asfmux->collect);
       break;
     case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
       break;
     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;
       break;
     default:
index 4036aa1..49bd92d 100644 (file)
@@ -23,7 +23,7 @@
 
 
 #include <gst/gst.h>
-#include <gst/base/gstcollectpads.h>
+#include <gst/base/gstcollectpads2.h>
 #include <gst/riff/riff-media.h>
 
 #include "gstasfobjects.h"
@@ -57,7 +57,7 @@ enum _GstAsfMuxState
 
 struct _GstAsfPad
 {
-  GstCollectData collect;
+  GstCollectData2 collect;
 
   gboolean is_audio;
   guint8 stream_number;
@@ -143,7 +143,7 @@ struct _GstAsfMux
   /* pads */
   GstPad *srcpad;
 
-  GstCollectPads *collect;
+  GstCollectPads2 *collect;
   GstPadEventFunction collect_event;
 };
 
index 2a91a4c..00546ff 100644 (file)
@@ -22,7 +22,7 @@
 #include <glib.h>
 #include <gst/gst.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_MILI_TO_100NANO(v) (v * 10000)
@@ -75,7 +75,7 @@ typedef struct _AsfPayload
   guint32 presentation_time;
   GstBuffer *data;
 
-  GstCollectData *pad;
+  GstCollectData2 *pad;
 
   /* simple index info */
   gboolean has_packet_info;