gst/: Ghost pad API fixes.
authorAndy Wingo <wingo@pobox.com>
Wed, 8 Jun 2005 22:18:05 +0000 (22:18 +0000)
committerAndy Wingo <wingo@pobox.com>
Wed, 8 Jun 2005 22:18:05 +0000 (22:18 +0000)
Original commit message from CVS:
2005-06-09  Andy Wingo  <wingo@pobox.com>

* gst-libs/gst/gconf/gconf.c:
* gst/playback/test.c:
* gst/playback/gstplaybin.c (gen_video_element): Ghost pad API
fixes.

* gst/audioconvert/gstaudioconvert.c: RPAD fixes.

* ext/theora/theoraenc.c (theora_enc_chain):
* ext/theora/theoradec.c (theora_handle_data_packet): GCC4 fixes.

* ext/ogg/gstoggdemux.c (GstOggPad): Derive from GstPad, not
RealPad.

common
ext/ogg/gstoggdemux.c
ext/theora/theoradec.c
ext/theora/theoraenc.c
gst-libs/gst/gconf/gconf.c
gst/audioconvert/gstaudioconvert.c
gst/playback/gstdecodebin.c
gst/playback/gstplaybin.c
gst/playback/test.c

diff --git a/common b/common
index 67b7e6c..495d6e3 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit 67b7e6c0db99415e0440d0c576495641b53e976a
+Subproject commit 495d6e30b3e513aebbc98467707c609c49ea654d
index e28da68..3579dac 100644 (file)
@@ -89,10 +89,8 @@ typedef enum
   GST_OGG_PAD_MODE_STREAMING,   /* we are streaming buffers to the outside */
 } GstOggPadMode;
 
-//#define PARENT                GstPad
-//#define PARENTCLASS   GstPadClass
-#define PARENT         GstRealPad
-#define PARENTCLASS    GstRealPadClass
+#define PARENT                GstPad
+#define PARENTCLASS   GstPadClass
 
 /* all information needed for one ogg stream */
 struct _GstOggPad
@@ -222,8 +220,7 @@ gst_ogg_pad_get_type (void)
     };
 
     ogg_pad_type =
-        g_type_register_static (GST_TYPE_REAL_PAD, "GstOggPad", &ogg_pad_info,
-        0);
+        g_type_register_static (GST_TYPE_PAD, "GstOggPad", &ogg_pad_info, 0);
   }
   return ogg_pad_type;
 }
index ffd7266..28bf67b 100644 (file)
@@ -838,11 +838,11 @@ theora_handle_data_packet (GstTheoraDec * dec, ogg_packet * packet,
    * offset or size is odd (see above).
    */
   {
-    guint8 *dest_y, *src_y;
-    guint8 *dest_u, *src_u;
-    guint8 *dest_v, *src_v;
+    guchar *dest_y, *src_y;
+    guchar *dest_u, *src_u;
+    guchar *dest_v, *src_v;
 
-    dest_y = (guint8 *) GST_BUFFER_DATA (out);
+    dest_y = GST_BUFFER_DATA (out);
     dest_u = dest_y + stride_y * height;
     dest_v = dest_u + stride_uv * cheight;
 
index 7c7a898..8de1ce6 100644 (file)
@@ -552,15 +552,15 @@ theora_enc_chain (GstPad * pad, GstBuffer * buffer)
       /* easy case, no cropping/conversion needed */
       pixels = GST_BUFFER_DATA (buffer);
 
-      yuv.y = (guint8 *) pixels;
+      yuv.y = pixels;
       yuv.u = yuv.y + y_size;
       yuv.v = yuv.u + y_size / 4;
     } else {
       GstBuffer *newbuf;
       gint i;
-      guint8 *dest_y, *src_y;
-      guint8 *dest_u, *src_u;
-      guint8 *dest_v, *src_v;
+      guchar *dest_y, *src_y;
+      guchar *dest_u, *src_u;
+      guchar *dest_v, *src_v;
       gint src_y_stride, src_uv_stride;
       gint dst_y_stride, dst_uv_stride;
       gint width, height;
@@ -588,11 +588,11 @@ theora_enc_chain (GstPad * pad, GstBuffer * buffer)
       if (ret != GST_FLOW_OK)
         goto no_buffer;
 
-      dest_y = yuv.y = (guint8 *) GST_BUFFER_DATA (newbuf);
+      dest_y = yuv.y = GST_BUFFER_DATA (newbuf);
       dest_u = yuv.u = yuv.y + y_size;
       dest_v = yuv.v = yuv.u + y_size / 4;
 
-      src_y = (guint8 *) GST_BUFFER_DATA (buffer);
+      src_y = GST_BUFFER_DATA (buffer);
       src_u = src_y + src_y_stride * ROUND_UP_2 (height);
       src_v = src_u + src_uv_stride * ROUND_UP_2 (height) / 2;
 
index e7d40d6..bbd327c 100644 (file)
@@ -167,10 +167,10 @@ gst_gconf_render_bin_from_description (const gchar * description)
 
   /* find pads and ghost them if necessary */
   if ((pad = gst_bin_find_unconnected_pad (GST_BIN (bin), GST_PAD_SRC))) {
-    gst_element_add_ghost_pad (bin, pad, "src");
+    gst_element_add_pad (bin, gst_ghost_pad_new ("src", pad));
   }
   if ((pad = gst_bin_find_unconnected_pad (GST_BIN (bin), GST_PAD_SINK))) {
-    gst_element_add_ghost_pad (bin, pad, "sink");
+    gst_element_add_pad (bin, gst_ghost_pad_new ("sink", pad));
   }
   return bin;
 }
index 57b079e..296c34d 100644 (file)
@@ -244,11 +244,11 @@ gst_audio_convert_chain (GstPad * pad, GstBuffer * buf)
    * - convert rate and channels
    * - convert back to output format
    */
-  if (!GST_RPAD_CAPS (this->sink)) {
+  if (!GST_PAD_CAPS (this->sink)) {
     goto not_negotiated;
-  } else if (!GST_RPAD_CAPS (this->src)) {
+  } else if (!GST_PAD_CAPS (this->src)) {
     if (!gst_audio_convert_link_src (this,
-            GST_RPAD_CAPS (this->sink), &this->sinkcaps))
+            GST_PAD_CAPS (this->sink), &this->sinkcaps))
       goto no_format;
   } else if (!this->matrix) {
     gst_audio_convert_setup_matrix (this);
@@ -409,7 +409,7 @@ gst_audio_convert_link_src (GstAudioConvert * this,
   if (gst_pad_peer_accept_caps (this->src, sinkcaps)) {
     /* great, so that will be our suggestion then */
     this->src_prefered = gst_caps_ref (sinkcaps);
-    gst_caps_replace (&GST_RPAD_CAPS (this->src), sinkcaps);
+    gst_caps_replace (&GST_PAD_CAPS (this->src), sinkcaps);
     ac_caps = *sink_ac_caps;
     if (ac_caps.pos) {
       ac_caps.pos = g_memdup (ac_caps.pos, sizeof (gint) * ac_caps.channels);
@@ -446,7 +446,7 @@ gst_audio_convert_link_src (GstAudioConvert * this,
       this->src_prefered = targetcaps;
       if (!gst_audio_convert_parse_caps (targetcaps, &ac_caps))
         return FALSE;
-      gst_caps_replace (&GST_RPAD_CAPS (this->src), targetcaps);
+      gst_caps_replace (&GST_PAD_CAPS (this->src), targetcaps);
     }
   }
   this->srccaps = ac_caps;
@@ -644,8 +644,8 @@ gst_audio_convert_change_state (GstElement * element)
     case GST_STATE_PAUSED_TO_READY:
       this->convert_internal = NULL;
       gst_audio_convert_unset_matrix (this);
-      gst_caps_replace (&GST_RPAD_CAPS (this->sink), NULL);
-      gst_caps_replace (&GST_RPAD_CAPS (this->src), NULL);
+      gst_caps_replace (&GST_PAD_CAPS (this->sink), NULL);
+      gst_caps_replace (&GST_PAD_CAPS (this->src), NULL);
       break;
     default:
       break;
@@ -726,7 +726,7 @@ gst_audio_convert_buffer_to_default_format (GstAudioConvert * this,
     ret =
         gst_audio_convert_get_buffer (buf,
         buf->size * 32 / this->sinkcaps.width);
-    gst_buffer_set_caps (ret, GST_RPAD_CAPS (this->src));
+    gst_buffer_set_caps (ret, GST_PAD_CAPS (this->src));
 
     count = ret->size / 4;
     src = buf->data + (count - 1) * (this->sinkcaps.width / 8);
@@ -794,7 +794,7 @@ gst_audio_convert_buffer_to_default_format (GstAudioConvert * this,
     /* should just give the same buffer, unless it's not writable -- float is
      * already 32 bits */
     ret = gst_audio_convert_get_buffer (buf, buf->size);
-    gst_buffer_set_caps (ret, GST_RPAD_CAPS (this->src));
+    gst_buffer_set_caps (ret, GST_PAD_CAPS (this->src));
 
     in = (gfloat *) GST_BUFFER_DATA (buf);
     out = (gint32 *) GST_BUFFER_DATA (ret);
@@ -854,7 +854,7 @@ gst_audio_convert_buffer_from_default_format (GstAudioConvert * this,
     ret =
         gst_audio_convert_get_buffer (buf,
         buf->size * this->srccaps.width / 32);
-    gst_buffer_set_caps (ret, GST_RPAD_CAPS (this->src));
+    gst_buffer_set_caps (ret, GST_PAD_CAPS (this->src));
 
     dest = ret->data;
     src = (gint32 *) buf->data;
@@ -920,7 +920,7 @@ gst_audio_convert_buffer_from_default_format (GstAudioConvert * this,
     ret =
         gst_audio_convert_get_buffer (buf,
         buf->size * this->srccaps.width / 32);
-    gst_buffer_set_caps (ret, GST_RPAD_CAPS (this->src));
+    gst_buffer_set_caps (ret, GST_PAD_CAPS (this->src));
 
     dest = (gfloat *) ret->data;
     src = (gint32 *) buf->data;
@@ -950,7 +950,7 @@ gst_audio_convert_channels (GstAudioConvert * this, GstBuffer * buf)
   /* convert */
   count = GST_BUFFER_SIZE (buf) / 4 / this->sinkcaps.channels;
   ret = gst_audio_convert_get_buffer (buf, count * 4 * this->srccaps.channels);
-  gst_buffer_set_caps (ret, GST_RPAD_CAPS (this->src));
+  gst_buffer_set_caps (ret, GST_PAD_CAPS (this->src));
   gst_audio_convert_mix (this, (gint32 *) GST_BUFFER_DATA (buf),
       (gint32 *) GST_BUFFER_DATA (ret), count);
   gst_buffer_unref (buf);
index 9e473b3..fddfb4b 100644 (file)
@@ -318,7 +318,8 @@ gst_decode_bin_init (GstDecodeBin * decode_bin)
     pad = gst_element_get_pad (decode_bin->typefind, "sink");
 
     /* ghost the sink pad to ourself */
-    gst_element_add_ghost_pad (GST_ELEMENT (decode_bin), pad, "sink");
+    gst_element_add_pad (GST_ELEMENT (decode_bin),
+        gst_ghost_pad_new ("sink", pad));
 
     gst_object_unref (GST_OBJECT_CAST (pad));
 
@@ -497,7 +498,8 @@ close_pad_link (GstElement * element, GstPad * pad, GstCaps * caps,
     decode_bin->numpads++;
 
     /* make it a ghostpad */
-    ghost = gst_element_add_ghost_pad (GST_ELEMENT (decode_bin), pad, padname);
+    ghost = gst_ghost_pad_new (padname, pad);
+    gst_element_add_pad (GST_ELEMENT (decode_bin), ghost);
 
     GST_LOG_OBJECT (element, "closed pad %s", padname);
 
@@ -746,15 +748,17 @@ remove_element_chain (GstDecodeBin * decode_bin, GstPad * pad)
     {
       GstElement *parent = gst_pad_get_parent (peer);
 
-      if (parent != GST_ELEMENT (decode_bin)) {
-        GST_DEBUG_OBJECT (decode_bin, "dead end pad %s:%s",
-            GST_DEBUG_PAD_NAME (peer));
-      } else {
-        GST_DEBUG_OBJECT (decode_bin, "recursing element %s on pad %s:%s",
-            GST_ELEMENT_NAME (elem), GST_DEBUG_PAD_NAME (pad));
-        remove_element_chain (decode_bin, peer);
+      if (parent) {
+        if (parent != GST_ELEMENT (decode_bin)) {
+          GST_DEBUG_OBJECT (decode_bin, "dead end pad %s:%s",
+              GST_DEBUG_PAD_NAME (peer));
+        } else {
+          GST_DEBUG_OBJECT (decode_bin, "recursing element %s on pad %s:%s",
+              GST_ELEMENT_NAME (elem), GST_DEBUG_PAD_NAME (pad));
+          remove_element_chain (decode_bin, peer);
+        }
+        gst_object_unref (GST_OBJECT_CAST (parent));
       }
-      gst_object_unref (GST_OBJECT_CAST (parent));
     }
     gst_object_unref (GST_OBJECT_CAST (peer));
   }
index 653366f..26edd9a 100644 (file)
@@ -407,7 +407,7 @@ gen_video_element (GstPlayBin * play_bin)
                                            gst_element_link_pads (scale, "src", */ sink, "sink");
 
   pad = gst_element_get_pad (identity, "sink");
-  gst_element_add_ghost_pad (element, pad, "sink");
+  gst_element_add_pad (element, gst_ghost_pad_new ("sink", pad));
   gst_object_unref (GST_OBJECT (pad));
 
   gst_element_set_state (element, GST_STATE_READY);
@@ -457,6 +457,8 @@ gen_text_element (GstPlayBin * play_bin)
   gst_bin_add_many (GST_BIN (element), csp, overlay, vbin, NULL);
 
   pad = gst_element_get_pad (overlay, "text_sink");
+#define gst_element_add_ghost_pad(element, pad, name) \
+    gst_element_add_pad (element, gst_ghost_pad_new (name, pad))
   gst_element_add_ghost_pad (element, pad, "text_sink");
   gst_object_unref (GST_OBJECT (pad));
 
index 6b36781..c4d3a22 100644 (file)
@@ -36,8 +36,8 @@ gen_video_element ()
   gst_bin_add (GST_BIN (element), sink);
   gst_element_link_pads (conv, "src", sink, "sink");
 
-  gst_element_add_ghost_pad (element, gst_element_get_pad (conv, "sink"),
-      "sink");
+  gst_element_add_pad (element,
+      gst_ghost_pad_new ("sink", gst_element_get_pad (conv, "sink")));
 
   return element;
 }
@@ -57,8 +57,8 @@ gen_audio_element ()
   gst_bin_add (GST_BIN (element), sink);
   gst_element_link_pads (conv, "src", sink, "sink");
 
-  gst_element_add_ghost_pad (element,
-      gst_element_get_pad (conv, "sink"), "sink");
+  gst_element_add_pad (element,
+      gst_ghost_pad_new ("sink", gst_element_get_pad (conv, "sink")));
 
   return element;
 }