diff options
author | Erik Walthinsen <omega@temple-baptist.org> | 2001-04-26 01:53:20 +0000 |
---|---|---|
committer | Erik Walthinsen <omega@temple-baptist.org> | 2001-04-26 01:53:20 +0000 |
commit | 583f6660fa5920bd971aa96be3c4638b9866e2c8 (patch) | |
tree | 8b473a06bb67f8df4f296ef5d179c773196e3d33 /gst/gstpad.c | |
parent | 99aa793b1c9ba7a4c3ec98dfabfa33d75c948c29 (diff) |
Merged from HEAD to INCSCHED1 on 200104251BRANCH-INCSCHED1-200104251
Original commit message from CVS:
Merged from HEAD to INCSCHED1 on 200104251
Diffstat (limited to 'gst/gstpad.c')
-rw-r--r-- | gst/gstpad.c | 70 |
1 files changed, 65 insertions, 5 deletions
diff --git a/gst/gstpad.c b/gst/gstpad.c index 154e0e595c..abfdc39da4 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -186,6 +186,7 @@ gst_real_pad_init (GstRealPad *pad) pad->pullfunc = NULL; pad->pullregionfunc = NULL; + pad->bufferpoolfunc = NULL; pad->ghostpads = NULL; pad->caps = NULL; } @@ -460,7 +461,24 @@ gst_pad_set_newcaps_function (GstPad *pad, GST_DEBUG_PAD_NAME(pad),pad,&GST_RPAD_NEWCAPSFUNC(pad),newcaps); } +/** + * gst_pad_set_bufferpool_function: + * @pad: the pad to set the bufferpool function for + * @bufpool: the bufferpool function + * + * Set the given bufferpool function for the pad. + */ +void +gst_pad_set_bufferpool_function (GstPad *pad, + GstPadBufferPoolFunction bufpool) +{ + g_return_if_fail (pad != NULL); + g_return_if_fail (GST_IS_REAL_PAD (pad)); + GST_RPAD_BUFFERPOOLFUNC (pad) = bufpool; + GST_DEBUG (0,"bufferpoolfunc for %s:%s(@%p) at %p is set to %p\n", + GST_DEBUG_PAD_NAME (pad), pad, &GST_RPAD_BUFFERPOOLFUNC (pad), bufpool); +} static void gst_pad_push_func(GstPad *pad, GstBuffer *buf) @@ -802,22 +820,29 @@ gboolean gst_pad_set_caps (GstPad *pad, GstCaps *caps) { + GstCaps *oldcaps; + g_return_val_if_fail (pad != NULL, FALSE); g_return_val_if_fail (GST_IS_REAL_PAD (pad), FALSE); // NOTE this restriction + GST_INFO (GST_CAT_CAPS, "setting caps %p on pad %s:%s", + caps, GST_DEBUG_PAD_NAME(pad)); + if (!gst_caps_check_compatibility (caps, gst_pad_get_padtemplate_caps (pad))) { g_warning ("pad %s:%s tried to set caps incompatible with its padtemplate\n", GST_DEBUG_PAD_NAME (pad)); //return FALSE; } - if (GST_PAD_CAPS (pad)) - gst_caps_unref (GST_PAD_CAPS (pad)); + oldcaps = GST_PAD_CAPS (pad); if (caps) gst_caps_ref (caps); GST_PAD_CAPS(pad) = caps; + if (oldcaps) + gst_caps_unref (oldcaps); + return gst_pad_renegotiate (pad); } @@ -938,6 +963,40 @@ gst_pad_get_peer (GstPad *pad) return GST_PAD(GST_PAD_PEER(pad)); } +/** + * gst_pad_get_bufferpool: + * @pad: the pad to get the bufferpool from + * + * Get the bufferpool of the peer pad of the given + * pad + * + * Returns: The GstBufferPool or NULL. + */ +GstBufferPool* +gst_pad_get_bufferpool (GstPad *pad) +{ + GstRealPad *peer; + + g_return_val_if_fail (pad != NULL, NULL); + g_return_val_if_fail (GST_IS_PAD (pad), NULL); + + peer = GST_RPAD_PEER(pad); + + g_return_val_if_fail (peer != NULL, NULL); + + GST_DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad)); + + if (peer->bufferpoolfunc) { + GST_DEBUG (0,"calling bufferpoolfunc &%s (@%p) of peer pad %s:%s\n", + GST_DEBUG_FUNCPTR_NAME(peer->bufferpoolfunc),&peer->bufferpoolfunc,GST_DEBUG_PAD_NAME(((GstPad*)peer))); + return (peer->bufferpoolfunc)(((GstPad*)peer)); + } else { + GST_DEBUG (0,"no bufferpoolfunc for peer pad %s:%s at %p\n",GST_DEBUG_PAD_NAME(((GstPad*)peer)),&peer->bufferpoolfunc); + return NULL; + } +} + + // FIXME this needs to be rethought soon static void gst_real_pad_destroy (GtkObject *object) @@ -1162,11 +1221,11 @@ gst_pad_renegotiate (GstPad *pad) GST_DEBUG (GST_CAT_NEGOTIATION, "pads aggreed on caps :)\n"); /* here we have some sort of aggreement of the caps */ - GST_PAD_CAPS (currentpad) = newcaps; + GST_PAD_CAPS (currentpad) = gst_caps_ref (newcaps); if (GST_RPAD_NEWCAPSFUNC (currentpad)) GST_RPAD_NEWCAPSFUNC (currentpad) (GST_PAD (currentpad), newcaps); - GST_PAD_CAPS (otherpad) = newcaps; + GST_PAD_CAPS (otherpad) = gst_caps_ref (newcaps); if (GST_RPAD_NEWCAPSFUNC (otherpad)) GST_RPAD_NEWCAPSFUNC (otherpad) (GST_PAD (otherpad), newcaps); } @@ -1444,11 +1503,12 @@ gst_padtemplate_init (GstPadTemplate *templ) } /** - * gst_padtemplate_create: + * gst_padtemplate_new: * @name_template: the name template * @direction: the direction for the template * @presence: the presence of the pad * @caps: a list of capabilities for the template + * @...: more capabilities * * Creates a new padtemplate from the given arguments. * |