mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 17:50:36 +00:00
gst/: Ghost pad API fixes.
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.
This commit is contained in:
parent
ec4f41ed25
commit
55d437af1c
9 changed files with 49 additions and 46 deletions
2
common
2
common
|
@ -1 +1 @@
|
||||||
Subproject commit 67b7e6c0db99415e0440d0c576495641b53e976a
|
Subproject commit 495d6e30b3e513aebbc98467707c609c49ea654d
|
|
@ -89,10 +89,8 @@ typedef enum
|
||||||
GST_OGG_PAD_MODE_STREAMING, /* we are streaming buffers to the outside */
|
GST_OGG_PAD_MODE_STREAMING, /* we are streaming buffers to the outside */
|
||||||
} GstOggPadMode;
|
} GstOggPadMode;
|
||||||
|
|
||||||
//#define PARENT GstPad
|
#define PARENT GstPad
|
||||||
//#define PARENTCLASS GstPadClass
|
#define PARENTCLASS GstPadClass
|
||||||
#define PARENT GstRealPad
|
|
||||||
#define PARENTCLASS GstRealPadClass
|
|
||||||
|
|
||||||
/* all information needed for one ogg stream */
|
/* all information needed for one ogg stream */
|
||||||
struct _GstOggPad
|
struct _GstOggPad
|
||||||
|
@ -222,8 +220,7 @@ gst_ogg_pad_get_type (void)
|
||||||
};
|
};
|
||||||
|
|
||||||
ogg_pad_type =
|
ogg_pad_type =
|
||||||
g_type_register_static (GST_TYPE_REAL_PAD, "GstOggPad", &ogg_pad_info,
|
g_type_register_static (GST_TYPE_PAD, "GstOggPad", &ogg_pad_info, 0);
|
||||||
0);
|
|
||||||
}
|
}
|
||||||
return ogg_pad_type;
|
return ogg_pad_type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -838,11 +838,11 @@ theora_handle_data_packet (GstTheoraDec * dec, ogg_packet * packet,
|
||||||
* offset or size is odd (see above).
|
* offset or size is odd (see above).
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
guint8 *dest_y, *src_y;
|
guchar *dest_y, *src_y;
|
||||||
guint8 *dest_u, *src_u;
|
guchar *dest_u, *src_u;
|
||||||
guint8 *dest_v, *src_v;
|
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_u = dest_y + stride_y * height;
|
||||||
dest_v = dest_u + stride_uv * cheight;
|
dest_v = dest_u + stride_uv * cheight;
|
||||||
|
|
||||||
|
|
|
@ -552,15 +552,15 @@ theora_enc_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
/* easy case, no cropping/conversion needed */
|
/* easy case, no cropping/conversion needed */
|
||||||
pixels = GST_BUFFER_DATA (buffer);
|
pixels = GST_BUFFER_DATA (buffer);
|
||||||
|
|
||||||
yuv.y = (guint8 *) pixels;
|
yuv.y = pixels;
|
||||||
yuv.u = yuv.y + y_size;
|
yuv.u = yuv.y + y_size;
|
||||||
yuv.v = yuv.u + y_size / 4;
|
yuv.v = yuv.u + y_size / 4;
|
||||||
} else {
|
} else {
|
||||||
GstBuffer *newbuf;
|
GstBuffer *newbuf;
|
||||||
gint i;
|
gint i;
|
||||||
guint8 *dest_y, *src_y;
|
guchar *dest_y, *src_y;
|
||||||
guint8 *dest_u, *src_u;
|
guchar *dest_u, *src_u;
|
||||||
guint8 *dest_v, *src_v;
|
guchar *dest_v, *src_v;
|
||||||
gint src_y_stride, src_uv_stride;
|
gint src_y_stride, src_uv_stride;
|
||||||
gint dst_y_stride, dst_uv_stride;
|
gint dst_y_stride, dst_uv_stride;
|
||||||
gint width, height;
|
gint width, height;
|
||||||
|
@ -588,11 +588,11 @@ theora_enc_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
if (ret != GST_FLOW_OK)
|
if (ret != GST_FLOW_OK)
|
||||||
goto no_buffer;
|
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_u = yuv.u = yuv.y + y_size;
|
||||||
dest_v = yuv.v = yuv.u + y_size / 4;
|
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_u = src_y + src_y_stride * ROUND_UP_2 (height);
|
||||||
src_v = src_u + src_uv_stride * ROUND_UP_2 (height) / 2;
|
src_v = src_u + src_uv_stride * ROUND_UP_2 (height) / 2;
|
||||||
|
|
||||||
|
|
|
@ -167,10 +167,10 @@ gst_gconf_render_bin_from_description (const gchar * description)
|
||||||
|
|
||||||
/* find pads and ghost them if necessary */
|
/* find pads and ghost them if necessary */
|
||||||
if ((pad = gst_bin_find_unconnected_pad (GST_BIN (bin), GST_PAD_SRC))) {
|
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))) {
|
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;
|
return bin;
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,11 +244,11 @@ gst_audio_convert_chain (GstPad * pad, GstBuffer * buf)
|
||||||
* - convert rate and channels
|
* - convert rate and channels
|
||||||
* - convert back to output format
|
* - convert back to output format
|
||||||
*/
|
*/
|
||||||
if (!GST_RPAD_CAPS (this->sink)) {
|
if (!GST_PAD_CAPS (this->sink)) {
|
||||||
goto not_negotiated;
|
goto not_negotiated;
|
||||||
} else if (!GST_RPAD_CAPS (this->src)) {
|
} else if (!GST_PAD_CAPS (this->src)) {
|
||||||
if (!gst_audio_convert_link_src (this,
|
if (!gst_audio_convert_link_src (this,
|
||||||
GST_RPAD_CAPS (this->sink), &this->sinkcaps))
|
GST_PAD_CAPS (this->sink), &this->sinkcaps))
|
||||||
goto no_format;
|
goto no_format;
|
||||||
} else if (!this->matrix) {
|
} else if (!this->matrix) {
|
||||||
gst_audio_convert_setup_matrix (this);
|
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)) {
|
if (gst_pad_peer_accept_caps (this->src, sinkcaps)) {
|
||||||
/* great, so that will be our suggestion then */
|
/* great, so that will be our suggestion then */
|
||||||
this->src_prefered = gst_caps_ref (sinkcaps);
|
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;
|
ac_caps = *sink_ac_caps;
|
||||||
if (ac_caps.pos) {
|
if (ac_caps.pos) {
|
||||||
ac_caps.pos = g_memdup (ac_caps.pos, sizeof (gint) * ac_caps.channels);
|
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;
|
this->src_prefered = targetcaps;
|
||||||
if (!gst_audio_convert_parse_caps (targetcaps, &ac_caps))
|
if (!gst_audio_convert_parse_caps (targetcaps, &ac_caps))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
gst_caps_replace (&GST_RPAD_CAPS (this->src), targetcaps);
|
gst_caps_replace (&GST_PAD_CAPS (this->src), targetcaps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->srccaps = ac_caps;
|
this->srccaps = ac_caps;
|
||||||
|
@ -644,8 +644,8 @@ gst_audio_convert_change_state (GstElement * element)
|
||||||
case GST_STATE_PAUSED_TO_READY:
|
case GST_STATE_PAUSED_TO_READY:
|
||||||
this->convert_internal = NULL;
|
this->convert_internal = NULL;
|
||||||
gst_audio_convert_unset_matrix (this);
|
gst_audio_convert_unset_matrix (this);
|
||||||
gst_caps_replace (&GST_RPAD_CAPS (this->sink), NULL);
|
gst_caps_replace (&GST_PAD_CAPS (this->sink), NULL);
|
||||||
gst_caps_replace (&GST_RPAD_CAPS (this->src), NULL);
|
gst_caps_replace (&GST_PAD_CAPS (this->src), NULL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -726,7 +726,7 @@ gst_audio_convert_buffer_to_default_format (GstAudioConvert * this,
|
||||||
ret =
|
ret =
|
||||||
gst_audio_convert_get_buffer (buf,
|
gst_audio_convert_get_buffer (buf,
|
||||||
buf->size * 32 / this->sinkcaps.width);
|
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;
|
count = ret->size / 4;
|
||||||
src = buf->data + (count - 1) * (this->sinkcaps.width / 8);
|
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
|
/* should just give the same buffer, unless it's not writable -- float is
|
||||||
* already 32 bits */
|
* already 32 bits */
|
||||||
ret = gst_audio_convert_get_buffer (buf, buf->size);
|
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);
|
in = (gfloat *) GST_BUFFER_DATA (buf);
|
||||||
out = (gint32 *) GST_BUFFER_DATA (ret);
|
out = (gint32 *) GST_BUFFER_DATA (ret);
|
||||||
|
@ -854,7 +854,7 @@ gst_audio_convert_buffer_from_default_format (GstAudioConvert * this,
|
||||||
ret =
|
ret =
|
||||||
gst_audio_convert_get_buffer (buf,
|
gst_audio_convert_get_buffer (buf,
|
||||||
buf->size * this->srccaps.width / 32);
|
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;
|
dest = ret->data;
|
||||||
src = (gint32 *) buf->data;
|
src = (gint32 *) buf->data;
|
||||||
|
@ -920,7 +920,7 @@ gst_audio_convert_buffer_from_default_format (GstAudioConvert * this,
|
||||||
ret =
|
ret =
|
||||||
gst_audio_convert_get_buffer (buf,
|
gst_audio_convert_get_buffer (buf,
|
||||||
buf->size * this->srccaps.width / 32);
|
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;
|
dest = (gfloat *) ret->data;
|
||||||
src = (gint32 *) buf->data;
|
src = (gint32 *) buf->data;
|
||||||
|
@ -950,7 +950,7 @@ gst_audio_convert_channels (GstAudioConvert * this, GstBuffer * buf)
|
||||||
/* convert */
|
/* convert */
|
||||||
count = GST_BUFFER_SIZE (buf) / 4 / this->sinkcaps.channels;
|
count = GST_BUFFER_SIZE (buf) / 4 / this->sinkcaps.channels;
|
||||||
ret = gst_audio_convert_get_buffer (buf, count * 4 * this->srccaps.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),
|
gst_audio_convert_mix (this, (gint32 *) GST_BUFFER_DATA (buf),
|
||||||
(gint32 *) GST_BUFFER_DATA (ret), count);
|
(gint32 *) GST_BUFFER_DATA (ret), count);
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
|
|
|
@ -318,7 +318,8 @@ gst_decode_bin_init (GstDecodeBin * decode_bin)
|
||||||
pad = gst_element_get_pad (decode_bin->typefind, "sink");
|
pad = gst_element_get_pad (decode_bin->typefind, "sink");
|
||||||
|
|
||||||
/* ghost the sink pad to ourself */
|
/* 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));
|
gst_object_unref (GST_OBJECT_CAST (pad));
|
||||||
|
|
||||||
|
@ -497,7 +498,8 @@ close_pad_link (GstElement * element, GstPad * pad, GstCaps * caps,
|
||||||
decode_bin->numpads++;
|
decode_bin->numpads++;
|
||||||
|
|
||||||
/* make it a ghostpad */
|
/* 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);
|
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);
|
GstElement *parent = gst_pad_get_parent (peer);
|
||||||
|
|
||||||
if (parent != GST_ELEMENT (decode_bin)) {
|
if (parent) {
|
||||||
GST_DEBUG_OBJECT (decode_bin, "dead end pad %s:%s",
|
if (parent != GST_ELEMENT (decode_bin)) {
|
||||||
GST_DEBUG_PAD_NAME (peer));
|
GST_DEBUG_OBJECT (decode_bin, "dead end pad %s:%s",
|
||||||
} else {
|
GST_DEBUG_PAD_NAME (peer));
|
||||||
GST_DEBUG_OBJECT (decode_bin, "recursing element %s on pad %s:%s",
|
} else {
|
||||||
GST_ELEMENT_NAME (elem), GST_DEBUG_PAD_NAME (pad));
|
GST_DEBUG_OBJECT (decode_bin, "recursing element %s on pad %s:%s",
|
||||||
remove_element_chain (decode_bin, peer);
|
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));
|
gst_object_unref (GST_OBJECT_CAST (peer));
|
||||||
}
|
}
|
||||||
|
|
|
@ -407,7 +407,7 @@ gen_video_element (GstPlayBin * play_bin)
|
||||||
gst_element_link_pads (scale, "src", */ sink, "sink");
|
gst_element_link_pads (scale, "src", */ sink, "sink");
|
||||||
|
|
||||||
pad = gst_element_get_pad (identity, "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_object_unref (GST_OBJECT (pad));
|
||||||
|
|
||||||
gst_element_set_state (element, GST_STATE_READY);
|
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);
|
gst_bin_add_many (GST_BIN (element), csp, overlay, vbin, NULL);
|
||||||
|
|
||||||
pad = gst_element_get_pad (overlay, "text_sink");
|
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_element_add_ghost_pad (element, pad, "text_sink");
|
||||||
gst_object_unref (GST_OBJECT (pad));
|
gst_object_unref (GST_OBJECT (pad));
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,8 @@ gen_video_element ()
|
||||||
gst_bin_add (GST_BIN (element), sink);
|
gst_bin_add (GST_BIN (element), sink);
|
||||||
gst_element_link_pads (conv, "src", sink, "sink");
|
gst_element_link_pads (conv, "src", sink, "sink");
|
||||||
|
|
||||||
gst_element_add_ghost_pad (element, gst_element_get_pad (conv, "sink"),
|
gst_element_add_pad (element,
|
||||||
"sink");
|
gst_ghost_pad_new ("sink", gst_element_get_pad (conv, "sink")));
|
||||||
|
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
@ -57,8 +57,8 @@ gen_audio_element ()
|
||||||
gst_bin_add (GST_BIN (element), sink);
|
gst_bin_add (GST_BIN (element), sink);
|
||||||
gst_element_link_pads (conv, "src", sink, "sink");
|
gst_element_link_pads (conv, "src", sink, "sink");
|
||||||
|
|
||||||
gst_element_add_ghost_pad (element,
|
gst_element_add_pad (element,
|
||||||
gst_element_get_pad (conv, "sink"), "sink");
|
gst_ghost_pad_new ("sink", gst_element_get_pad (conv, "sink")));
|
||||||
|
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue