subtitleoverlay: Use new, public ghostpad functions
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 6 May 2011 15:01:53 +0000 (17:01 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Sat, 14 May 2011 09:42:32 +0000 (11:42 +0200)
gst/playback/gstsubtitleoverlay.c
gst/playback/gstsubtitleoverlay.h

index 98fe15d..0ec7ee5 100644 (file)
@@ -1589,7 +1589,7 @@ gst_subtitle_overlay_src_proxy_chain (GstPad * proxypad, GstBuffer * buffer)
     return GST_FLOW_ERROR;
   }
 
-  ret = self->src_proxy_chain (proxypad, buffer);
+  ret = gst_proxy_pad_chain_default (proxypad, buffer);
 
   if (IS_VIDEO_CHAIN_IGNORE_ERROR (ret)) {
     GST_ERROR_OBJECT (self, "Downstream chain error: %s",
@@ -1626,7 +1626,7 @@ gst_subtitle_overlay_src_proxy_event (GstPad * proxypad, GstEvent * event)
     event = NULL;
     ret = TRUE;
   } else {
-    ret = self->src_proxy_event (proxypad, event);
+    ret = gst_proxy_pad_event_default (proxypad, event);
     event = NULL;
   }
 
@@ -1664,7 +1664,7 @@ gst_subtitle_overlay_video_sink_setcaps (GstPad * pad, GstCaps * caps)
   }
   GST_SUBTITLE_OVERLAY_UNLOCK (self);
 
-  ret = self->video_sink_setcaps (pad, caps);
+  ret = gst_ghost_pad_setcaps_default (pad, caps);
 
 out:
   gst_object_unref (self);
@@ -1684,7 +1684,7 @@ gst_subtitle_overlay_video_sink_event (GstPad * pad, GstEvent * event)
     self->fps_n = self->fps_d = 0;
   }
 
-  ret = self->video_sink_event (pad, gst_event_ref (event));
+  ret = gst_proxy_pad_event_default (pad, gst_event_ref (event));
 
   if (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT) {
     gboolean update;
@@ -1722,7 +1722,7 @@ static GstFlowReturn
 gst_subtitle_overlay_video_sink_chain (GstPad * pad, GstBuffer * buffer)
 {
   GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY (GST_PAD_PARENT (pad));
-  GstFlowReturn ret = self->video_sink_chain (pad, buffer);
+  GstFlowReturn ret = gst_proxy_pad_chain_default (pad, buffer);
 
   if (G_UNLIKELY (self->downstream_chain_error) || self->passthrough_identity) {
     return ret;
@@ -1755,7 +1755,7 @@ gst_subtitle_overlay_subtitle_sink_chain (GstPad * pad, GstBuffer * buffer)
     gst_buffer_unref (buffer);
     return GST_FLOW_OK;
   } else {
-    GstFlowReturn ret = self->subtitle_sink_chain (pad, buffer);
+    GstFlowReturn ret = gst_proxy_pad_chain_default (pad, buffer);
 
     if (IS_SUBTITLE_CHAIN_IGNORE_ERROR (ret)) {
       GST_DEBUG_OBJECT (self, "Subtitle chain error: %s",
@@ -1826,7 +1826,7 @@ gst_subtitle_overlay_subtitle_sink_setcaps (GstPad * pad, GstCaps * caps)
 
   if (target && gst_pad_accept_caps (target, caps)) {
     GST_DEBUG_OBJECT (pad, "Target accepts caps");
-    ret = self->subtitle_sink_setcaps (pad, caps);
+    ret = gst_ghost_pad_setcaps_default (pad, caps);
     GST_SUBTITLE_OVERLAY_UNLOCK (self);
     goto out;
   }
@@ -1887,7 +1887,7 @@ gst_subtitle_overlay_subtitle_sink_link (GstPad * pad, GstPad * peer)
     gst_caps_unref (caps);
   }
 
-  ret = self->subtitle_sink_link (pad, peer);
+  ret = gst_ghost_pad_link_default (pad, peer);
 
   gst_object_unref (self);
   return ret;
@@ -1906,7 +1906,7 @@ gst_subtitle_overlay_subtitle_sink_unlink (GstPad * pad)
   GST_DEBUG_OBJECT (pad, "Pad unlinking");
   gst_caps_replace (&self->subcaps, NULL);
 
-  self->subtitle_sink_unlink (pad);
+  gst_ghost_pad_unlink_default (pad);
 
   GST_SUBTITLE_OVERLAY_LOCK (self);
   self->subtitle_error = FALSE;
@@ -1993,7 +1993,7 @@ gst_subtitle_overlay_subtitle_sink_event (GstPad * pad, GstEvent * event)
       break;
   }
 
-  ret = self->subtitle_sink_event (pad, gst_event_ref (event));
+  ret = gst_proxy_pad_event_default (pad, gst_event_ref (event));
 
   if (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT) {
     gboolean update;
@@ -2031,7 +2031,6 @@ gst_subtitle_overlay_init (GstSubtitleOverlay * self,
     GstSubtitleOverlayClass * klass)
 {
   GstPadTemplate *templ;
-  GstIterator *it;
   GstPad *proxypad = NULL;
 
   self->lock = g_mutex_new ();
@@ -2039,67 +2038,44 @@ gst_subtitle_overlay_init (GstSubtitleOverlay * self,
 
   templ = gst_static_pad_template_get (&srctemplate);
   self->srcpad = gst_ghost_pad_new_no_target_from_template ("src", templ);
-  it = gst_pad_iterate_internal_links (self->srcpad);
-  if (G_UNLIKELY (!it
-          || gst_iterator_next (it, (gpointer) & proxypad) != GST_ITERATOR_OK
-          || proxypad == NULL)) {
-    GST_ERROR_OBJECT (self, "Failed to get proxypad of srcpad");
-  } else {
-    self->src_proxy_event = GST_PAD_EVENTFUNC (proxypad);
-    gst_pad_set_event_function (proxypad,
-        GST_DEBUG_FUNCPTR (gst_subtitle_overlay_src_proxy_event));
-    self->src_proxy_chain = GST_PAD_CHAINFUNC (proxypad);
-    gst_pad_set_chain_function (proxypad,
-        GST_DEBUG_FUNCPTR (gst_subtitle_overlay_src_proxy_chain));
-    gst_object_unref (proxypad);
-  }
-  if (it)
-    gst_iterator_free (it);
+
+  proxypad =
+      GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD (self->srcpad)));
+  gst_pad_set_event_function (proxypad,
+      GST_DEBUG_FUNCPTR (gst_subtitle_overlay_src_proxy_event));
+  gst_pad_set_chain_function (proxypad,
+      GST_DEBUG_FUNCPTR (gst_subtitle_overlay_src_proxy_chain));
+  gst_object_unref (proxypad);
 
   gst_element_add_pad (GST_ELEMENT_CAST (self), self->srcpad);
 
   templ = gst_static_pad_template_get (&video_sinktemplate);
   self->video_sinkpad =
       gst_ghost_pad_new_no_target_from_template ("video_sink", templ);
-  self->video_sink_event = GST_PAD_EVENTFUNC (self->video_sinkpad);
   gst_pad_set_event_function (self->video_sinkpad,
       GST_DEBUG_FUNCPTR (gst_subtitle_overlay_video_sink_event));
-  self->video_sink_setcaps = GST_PAD_SETCAPSFUNC (self->video_sinkpad);
   gst_pad_set_setcaps_function (self->video_sinkpad,
       GST_DEBUG_FUNCPTR (gst_subtitle_overlay_video_sink_setcaps));
-  self->video_sink_chain = GST_PAD_CHAINFUNC (self->video_sinkpad);
   gst_pad_set_chain_function (self->video_sinkpad,
       GST_DEBUG_FUNCPTR (gst_subtitle_overlay_video_sink_chain));
 
-  proxypad = NULL;
-  it = gst_pad_iterate_internal_links (self->video_sinkpad);
-  if (G_UNLIKELY (!it
-          || gst_iterator_next (it, (gpointer) & proxypad) != GST_ITERATOR_OK
-          || proxypad == NULL)) {
-    GST_ERROR_OBJECT (self,
-        "Failed to get internally linked pad from video sinkpad");
-  }
-  if (it)
-    gst_iterator_free (it);
+  proxypad =
+      GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
+          (self->video_sinkpad)));
   self->video_block_pad = proxypad;
   gst_element_add_pad (GST_ELEMENT_CAST (self), self->video_sinkpad);
 
   templ = gst_static_pad_template_get (&subtitle_sinktemplate);
   self->subtitle_sinkpad =
       gst_ghost_pad_new_no_target_from_template ("subtitle_sink", templ);
-  self->subtitle_sink_link = GST_PAD_LINKFUNC (self->subtitle_sinkpad);
   gst_pad_set_link_function (self->subtitle_sinkpad,
       GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_link));
-  self->subtitle_sink_unlink = GST_PAD_UNLINKFUNC (self->subtitle_sinkpad);
   gst_pad_set_unlink_function (self->subtitle_sinkpad,
       GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_unlink));
-  self->subtitle_sink_event = GST_PAD_EVENTFUNC (self->subtitle_sinkpad);
   gst_pad_set_event_function (self->subtitle_sinkpad,
       GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_event));
-  self->subtitle_sink_setcaps = GST_PAD_SETCAPSFUNC (self->subtitle_sinkpad);
   gst_pad_set_setcaps_function (self->subtitle_sinkpad,
       GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_setcaps));
-  self->subtitle_sink_chain = GST_PAD_CHAINFUNC (self->subtitle_sinkpad);
   gst_pad_set_chain_function (self->subtitle_sinkpad,
       GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_chain));
   gst_pad_set_getcaps_function (self->subtitle_sinkpad,
@@ -2108,16 +2084,9 @@ gst_subtitle_overlay_init (GstSubtitleOverlay * self,
       GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_acceptcaps));
   gst_pad_set_bufferalloc_function (self->subtitle_sinkpad, NULL);
 
-  proxypad = NULL;
-  it = gst_pad_iterate_internal_links (self->subtitle_sinkpad);
-  if (G_UNLIKELY (!it
-          || gst_iterator_next (it, (gpointer) & proxypad) != GST_ITERATOR_OK
-          || proxypad == NULL)) {
-    GST_ERROR_OBJECT (self,
-        "Failed to get internally linked pad from subtitle sinkpad");
-  }
-  if (it)
-    gst_iterator_free (it);
+  proxypad =
+      GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
+          (self->subtitle_sinkpad)));
   self->subtitle_block_pad = proxypad;
 
   gst_element_add_pad (GST_ELEMENT_CAST (self), self->subtitle_sinkpad);
index eee5c78..a6e0d39 100644 (file)
@@ -68,26 +68,16 @@ struct _GstSubtitleOverlay
   gboolean do_async;
 
   GstPad *srcpad;
-  GstPadEventFunction src_proxy_event;
-  GstPadChainFunction src_proxy_chain;
   gboolean downstream_chain_error;
 
   GstPad *video_sinkpad;
   GstPad *video_block_pad;
-  GstPadSetCapsFunction video_sink_setcaps;
-  GstPadEventFunction video_sink_event;
-  GstPadChainFunction video_sink_chain;
   gboolean video_sink_blocked;
   GstSegment video_segment;
   gint fps_n, fps_d;
 
   GstPad *subtitle_sinkpad;
   GstPad *subtitle_block_pad;
-  GstPadLinkFunction subtitle_sink_link;
-  GstPadUnlinkFunction subtitle_sink_unlink;
-  GstPadEventFunction subtitle_sink_event;
-  GstPadChainFunction subtitle_sink_chain;
-  GstPadSetCapsFunction subtitle_sink_setcaps;
   gboolean subtitle_sink_blocked;
   GstSegment subtitle_segment;
   gboolean subtitle_flush;