inlined two more docs factored gstpadtemplate out of gstpad
authorStefan Kost <ensonic@users.sourceforge.net>
Sun, 25 Sep 2005 11:19:22 +0000 (11:19 +0000)
committerStefan Kost <ensonic@users.sourceforge.net>
Sun, 25 Sep 2005 11:19:22 +0000 (11:19 +0000)
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* docs/gst/tmpl/.cvsignore:
* docs/gst/tmpl/gstpad.sgml:
* docs/gst/tmpl/gstpadtemplate.sgml:
* gst/Makefile.am:
* gst/gstpad.c: (gst_pad_class_init), (gst_pad_dispose),
(gst_pad_finalize), (gst_pad_set_pad_template):
* gst/gstpad.h:
* gst/gstpadtemplate.c: (gst_pad_template_get_type),
(gst_pad_template_class_init), (gst_pad_template_init),
(gst_pad_template_dispose), (name_is_valid),
(gst_static_pad_template_get), (gst_pad_template_new),
(gst_static_pad_template_get_caps), (gst_pad_template_get_caps),
(gst_pad_template_pad_created):
* gst/gstpadtemplate.h:
inlined two more docs
factored gstpadtemplate out of gstpad

ChangeLog
docs/gst/gstreamer-sections.txt
docs/gst/tmpl/.gitignore
docs/gst/tmpl/gstpad.sgml [deleted file]
docs/gst/tmpl/gstpadtemplate.sgml [deleted file]
gst/Makefile.am
gst/gstpad.c
gst/gstpad.h
gst/gstpadtemplate.c [new file with mode: 0644]
gst/gstpadtemplate.h [new file with mode: 0644]

index 79533bc..df773dd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2005-09-25  Stefan Kost  <ensonic@users.sf.net>
+
+       * docs/gst/gstreamer-sections.txt:
+       * docs/gst/tmpl/.cvsignore:
+       * docs/gst/tmpl/gstpad.sgml:
+       * docs/gst/tmpl/gstpadtemplate.sgml:
+       * gst/Makefile.am:
+       * gst/gstpad.c: (gst_pad_class_init), (gst_pad_dispose),
+       (gst_pad_finalize), (gst_pad_set_pad_template):
+       * gst/gstpad.h:
+       * gst/gstpadtemplate.c: (gst_pad_template_get_type),
+       (gst_pad_template_class_init), (gst_pad_template_init),
+       (gst_pad_template_dispose), (name_is_valid),
+       (gst_static_pad_template_get), (gst_pad_template_new),
+       (gst_static_pad_template_get_caps), (gst_pad_template_get_caps),
+       (gst_pad_template_pad_created):
+       * gst/gstpadtemplate.h:
+          inlined two more docs
+          factored gstpadtemplate out of gstpad
+
 2005-09-24  Tim-Philipp Müller  <tim at centricular dot net>
 
        * check/gst/gstbin.c: (test_children_state_change_order_flagged_sink),
index 4dd6a2e..d46c813 100644 (file)
@@ -1137,7 +1137,6 @@ GstPadDispatcherFunction
 GstPadDirection
 GstPadFlags
 GstPadLinkReturn
-GstPadPresence
 GstFlowReturn
 GstActivateMode
 
@@ -1297,7 +1296,6 @@ GST_PAD_SET_FLUSHING
 GST_PAD_TASK
 GST_PAD_UNSET_FLUSHING
 
-
 GST_PAD_ACCEPTCAPSFUNC
 GST_PAD_ACTIVATEFUNC
 GST_PAD_ACTIVATEPULLFUNC
@@ -1331,10 +1329,12 @@ GST_PAD_TEMPLATE_PRESENCE
 GST_PAD_TEMPLATE_CAPS
 GST_PAD_TEMPLATE_IS_FIXED
 GstPadTemplateFlags
+GstPadPresence
 gst_pad_template_new
 gst_static_pad_template_get
 gst_static_pad_template_get_caps
 gst_pad_template_get_caps
+
 <SUBSECTION Standard>
 GstPadTemplateClass
 GST_PAD_TEMPLATE
@@ -1344,9 +1344,11 @@ GST_IS_PAD_TEMPLATE_CLASS
 GST_STATIC_PAD_TEMPLATE
 GST_TYPE_PAD_TEMPLATE
 GST_TYPE_PAD_TEMPLATE_FLAGS
+
 <SUBSECTION Private>
 gst_pad_template_get_type
 gst_pad_template_flags_get_type
+gst_pad_template_pad_created
 </SECTION>
 
 
index acf2fa0..af468c1 100644 (file)
@@ -38,6 +38,8 @@ gstmemchunk.sgml
 gstmessage.sgml
 gstminiobject.sgml
 gstobject.sgml
+gstpad.sgml
+gstpadtemplate.sgml
 gstparse.sgml
 gstpluginfeature.sgml
 gstpushsrc.sgml
diff --git a/docs/gst/tmpl/gstpad.sgml b/docs/gst/tmpl/gstpad.sgml
deleted file mode 100644 (file)
index 857f223..0000000
+++ /dev/null
@@ -1,1338 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-GstPad
-
-<!-- ##### SECTION Short_Description ##### -->
-Object contained by elements that allows links to other elements
-
-<!-- ##### SECTION Long_Description ##### -->
-<para>
-A #GstElement is linked to other elements via "pads", which are extremely 
-light-weight generic link points. 
-After two pads are retrieved from an element with gst_element_get_pad(), 
-the pads can be link with gst_pad_link(). (For quick links,
-you can also use gst_element_link(), which will make the obvious
-link for you if it's straightforward.)
-</para>
-<para>
-Pads are typically created from a #GstPadTemplate with 
-gst_pad_new_from_template().
-</para>
-<para>
-Pads have #GstCaps attached to it to describe the media type they
-are capable of dealing with. 
-gst_pad_get_caps() and gst_pad_try_set_caps() are used to
-manipulate the caps of the pads. 
-Pads created from a pad template cannot set capabilities that are 
-incompatible with the pad template capabilities.
-</para>
-<para>
-Pads without pad templates can be created with gst_pad_new(),
-which takes a direction and a name as an argument.  If the name is NULL,
-then a guaranteed unique name will be assigned to it.
-</para>
-<para>
-gst_pad_get_parent() will retrieve the #GstElement that owns the pad.
-</para>
-<para>
-A #GstElement creating a pad will typically use the various 
-gst_pad_set_*_function() calls to register callbacks for various events 
-on the pads.
-</para>
-<para>
-GstElements will use gst_pad_push() and gst_pad_pull() to push out 
-or pull in a buffer. 
-gst_pad_select() and gst_pad_selectv() are used by plugins to wait for the
-first incoming buffer or event on any of the given set of pads.
-</para>
-<para>
-To send a #GstEvent on a pad, use gst_pad_send_event().
-</para>
-
-<para>
-Last reviewed on December 13th, 2002 (0.5.0.1)
-</para>
-
-<!-- ##### SECTION See_Also ##### -->
-<para>
-#GstPadTemplate, #GstElement, #GstEvent
-</para>
-
-<!-- ##### SECTION Stability_Level ##### -->
-
-
-<!-- ##### STRUCT GstPad ##### -->
-<para>
-
-</para>
-
-@stream_rec_lock: 
-@task: 
-@preroll_lock: 
-@preroll_cond: 
-@block_cond: 
-@block_callback: 
-@block_data: 
-@caps: 
-@getcapsfunc: 
-@setcapsfunc: 
-@acceptcapsfunc: 
-@fixatecapsfunc: 
-@activatefunc: 
-@activatepushfunc: 
-@activatepullfunc: 
-@linkfunc: 
-@unlinkfunc: 
-@peer: 
-@sched_private: 
-@chainfunc: 
-@checkgetrangefunc: 
-@getrangefunc: 
-@eventfunc: 
-@mode: 
-@querytypefunc: 
-@queryfunc: 
-@intlinkfunc: 
-@bufferallocfunc: 
-@do_buffer_signals: 
-@do_event_signals: 
-
-<!-- ##### SIGNAL GstPad::have-data ##### -->
-<para>
-
-</para>
-
-@gstpad: the object which received the signal.
-@arg1: 
-@Returns: 
-
-<!-- ##### SIGNAL GstPad::linked ##### -->
-<para>
-
-</para>
-
-@gstpad: the object which received the signal.
-@arg1: 
-
-<!-- ##### SIGNAL GstPad::request-link ##### -->
-<para>
-
-</para>
-
-@gstpad: the object which received the signal.
-
-<!-- ##### SIGNAL GstPad::unlinked ##### -->
-<para>
-
-</para>
-
-@gstpad: the object which received the signal.
-@arg1: 
-
-<!-- ##### ARG GstPad:caps ##### -->
-<para>
-
-</para>
-
-<!-- ##### ARG GstPad:direction ##### -->
-<para>
-
-</para>
-
-<!-- ##### ARG GstPad:template ##### -->
-<para>
-
-</para>
-
-<!-- ##### MACRO GST_PAD_LINK_FAILED ##### -->
-<para>
-Macro to test if the given #GstPadLinkReturn value indicates a
-failed negotiation step (REFUSED/DELAYED).
-</para>
-
-@ret: the #GstPadLinkReturn value
-
-
-<!-- ##### MACRO GST_PAD_LINK_SUCCESSFUL ##### -->
-<para>
-Macro to test if the given #GstPadLinkReturn value indicates a
-successfull negotiation step (OK/DONE).
-</para>
-
-@ret: the #GstPadLinkReturn value
-
-
-<!-- ##### USER_FUNCTION GstPadActivateFunction ##### -->
-<para>
-
-</para>
-
-@pad: 
-@Returns: 
-
-
-<!-- ##### USER_FUNCTION GstPadActivateModeFunction ##### -->
-<para>
-
-</para>
-
-@pad: 
-@active: 
-@Returns: 
-
-
-<!-- ##### USER_FUNCTION GstPadBlockCallback ##### -->
-<para>
-
-</para>
-
-@pad: 
-@blocked: 
-@user_data: 
-
-
-<!-- ##### USER_FUNCTION GstPadChainFunction ##### -->
-<para>
-A function that will be called when chaining buffers.
-</para>
-
-@pad: the #GstPad that performed the chain.
-@buffer: 
-@Returns: 
-<!-- # Unused Parameters # -->
-@data: 
-@buf: the #GstBuffer that is chained.
-
-
-<!-- ##### USER_FUNCTION GstPadEventFunction ##### -->
-<para>
-Function signature to handle an event for the pad.
-</para>
-
-@pad: the #GstPad to handle the event.
-@event: the #GstEvent to handle.
-@Returns: TRUE if the pad could handle the event.
-
-
-<!-- ##### USER_FUNCTION GstPadCheckGetRangeFunction ##### -->
-<para>
-
-</para>
-
-@pad: 
-@Returns: 
-
-
-<!-- ##### USER_FUNCTION GstPadGetRangeFunction ##### -->
-<para>
-
-</para>
-
-@pad: 
-@offset: 
-@length: 
-@buffer: 
-@Returns: 
-
-
-<!-- ##### USER_FUNCTION GstPadQueryFunction ##### -->
-<para>
-The signature of the query function.
-</para>
-
-@pad: the #GstPad to query.
-@query: 
-@Returns: TRUE if the query could be performed.
-<!-- # Unused Parameters # -->
-@type: the #GstPadQueryType.
-@format: a pointer to the target #GstFormat.
-@value: a pointer to the target value.
-
-
-<!-- ##### USER_FUNCTION GstPadIntLinkFunction ##### -->
-<para>
-The signature of the internal pad link function.
-</para>
-
-@pad: The #GstPad to query.
-@Returns: a newly allocated #GList of pads that are linked to 
-          the given pad on the inside of the parent element.  
-          The caller must call g_list_free() on it after use.
-
-
-<!-- ##### USER_FUNCTION GstPadQueryTypeFunction ##### -->
-<para>
-The signature of the query types function.
-</para>
-
-@pad: a #GstPad to query
-@Returns: an array of query types
-
-
-<!-- ##### USER_FUNCTION GstPadLinkFunction ##### -->
-<para>
-Function signature to handle a new link on the pad.
-</para>
-
-@pad: the #GstPad that is linked.
-@peer: 
-@Returns: the result of the link with the specified caps.
-<!-- # Unused Parameters # -->
-@caps: the peer's #GstCaps.
-
-
-<!-- ##### USER_FUNCTION GstPadUnlinkFunction ##### -->
-<para>
-
-</para>
-
-@pad: 
-
-
-<!-- ##### USER_FUNCTION GstPadAcceptCapsFunction ##### -->
-<para>
-
-</para>
-
-@pad: 
-@caps: 
-@Returns: 
-
-
-<!-- ##### USER_FUNCTION GstPadFixateCapsFunction ##### -->
-<para>
-
-</para>
-
-@pad: 
-@caps: 
-
-
-<!-- ##### USER_FUNCTION GstPadGetCapsFunction ##### -->
-<para>
-Returns a copy of the capabilities of the specified pad. By default this
-function will return the pad template capabilities, but can optionally
-be overridden.
-</para>
-
-@pad: the #GstPad to get the capabilities of.
-@Returns: a newly allocated copy #GstCaps of the pad.
-<!-- # Unused Parameters # -->
-@caps: the peer's #GstCaps, can be used to filter the capabilities.
-
-
-<!-- ##### USER_FUNCTION GstPadSetCapsFunction ##### -->
-<para>
-
-</para>
-
-@pad: 
-@caps: 
-@Returns: 
-
-
-<!-- ##### USER_FUNCTION GstPadBufferAllocFunction ##### -->
-<para>
-
-</para>
-
-@pad: 
-@offset: 
-@size: 
-@caps: 
-@buf: 
-@Returns: 
-
-
-<!-- ##### USER_FUNCTION GstPadDispatcherFunction ##### -->
-<para>
-A dispatcher function is called for all internally linked pads, see 
-gst_pad_dispatcher().
-</para>
-
-@pad: the #GstPad that is dispatched.
-@data: the gpointer to optional user data.
-@Returns: TRUE if the dispatching procedure has to be stopped.
-
-
-<!-- ##### ENUM GstPadDirection ##### -->
-<para>
-The direction of a pad.
-</para>
-
-@GST_PAD_UNKNOWN: direction is unknown.
-@GST_PAD_SRC: the pad is a source pad.
-@GST_PAD_SINK: the pad is a sink pad.
-
-<!-- ##### ENUM GstPadFlags ##### -->
-<para>
-
-</para>
-
-@GST_PAD_BLOCKED: 
-@GST_PAD_FLUSHING: 
-@GST_PAD_IN_GETCAPS: 
-@GST_PAD_IN_SETCAPS: 
-@GST_PAD_FLAG_LAST: 
-
-<!-- ##### ENUM GstPadLinkReturn ##### -->
-
-
-@GST_PAD_LINK_OK: 
-@GST_PAD_LINK_WRONG_HIERARCHY: 
-@GST_PAD_LINK_WAS_LINKED: 
-@GST_PAD_LINK_WRONG_DIRECTION: 
-@GST_PAD_LINK_NOFORMAT: 
-@GST_PAD_LINK_NOSCHED: 
-@GST_PAD_LINK_REFUSED: 
-
-<!-- ##### ENUM GstPadPresence ##### -->
-<para>
-Indicates when this pad will become available.
-</para>
-
-@GST_PAD_ALWAYS: the pad is always available
-@GST_PAD_SOMETIMES: the pad will become available depending on the media stream
-@GST_PAD_REQUEST: the pad is only available on request with 
-gst_element_request_pad_by_name() or gst_element_request_compatible_pad().
-
-<!-- ##### ENUM GstFlowReturn ##### -->
-<para>
-
-</para>
-
-@GST_FLOW_RESEND: 
-@GST_FLOW_OK: 
-@GST_FLOW_NOT_LINKED: 
-@GST_FLOW_WRONG_STATE: 
-@GST_FLOW_UNEXPECTED: 
-@GST_FLOW_NOT_NEGOTIATED: 
-@GST_FLOW_ERROR: 
-@GST_FLOW_NOT_SUPPORTED: 
-
-<!-- ##### ENUM GstActivateMode ##### -->
-<para>
-
-</para>
-
-@GST_ACTIVATE_NONE: 
-@GST_ACTIVATE_PUSH: 
-@GST_ACTIVATE_PULL: 
-
-<!-- ##### MACRO GST_PREROLL_BROADCAST ##### -->
-<para>
-
-</para>
-
-@pad: 
-
-
-<!-- ##### MACRO GST_PREROLL_GET_COND ##### -->
-<para>
-
-</para>
-
-@pad: 
-
-
-<!-- ##### MACRO GST_PREROLL_GET_LOCK ##### -->
-<para>
-
-</para>
-
-@pad: 
-
-
-<!-- ##### MACRO GST_PREROLL_LOCK ##### -->
-<para>
-
-</para>
-
-@pad: 
-
-
-<!-- ##### MACRO GST_PREROLL_SIGNAL ##### -->
-<para>
-
-</para>
-
-@pad: 
-
-
-<!-- ##### MACRO GST_PREROLL_TIMED_WAIT ##### -->
-<para>
-
-</para>
-
-@pad: 
-@timeval: 
-
-
-<!-- ##### MACRO GST_PREROLL_TRYLOCK ##### -->
-<para>
-
-</para>
-
-@pad: 
-
-
-<!-- ##### MACRO GST_PREROLL_UNLOCK ##### -->
-<para>
-
-</para>
-
-@pad: 
-
-
-<!-- ##### MACRO GST_PREROLL_WAIT ##### -->
-<para>
-
-</para>
-
-@pad: 
-
-
-<!-- ##### MACRO GST_STREAM_GET_LOCK ##### -->
-<para>
-
-</para>
-
-@pad: 
-
-
-<!-- ##### MACRO GST_STREAM_LOCK ##### -->
-<para>
-
-</para>
-
-@pad: 
-
-
-<!-- ##### MACRO GST_STREAM_LOCK_FULL ##### -->
-<para>
-
-</para>
-
-@pad: 
-@t: 
-
-
-<!-- ##### MACRO GST_STREAM_TRYLOCK ##### -->
-<para>
-
-</para>
-
-@pad: 
-
-
-<!-- ##### MACRO GST_STREAM_UNLOCK ##### -->
-<para>
-
-</para>
-
-@pad: 
-
-
-<!-- ##### MACRO GST_STREAM_UNLOCK_FULL ##### -->
-<para>
-
-</para>
-
-@pad: 
-
-
-<!-- ##### MACRO GST_FLOW_IS_FATAL ##### -->
-<para>
-
-</para>
-
-@ret: 
-
-
-<!-- ##### FUNCTION gst_pad_new ##### -->
-<para>
-
-</para>
-
-@name: 
-@direction: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_new_from_template ##### -->
-<para>
-
-</para>
-
-@templ: 
-@name: 
-@Returns: 
-
-
-<!-- ##### MACRO gst_pad_get_name ##### -->
-<para>
-
-</para>
-
-@pad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_get_direction ##### -->
-<para>
-
-</para>
-
-@pad: 
-@Returns: 
-
-
-<!-- ##### MACRO gst_pad_get_parent ##### -->
-<para>
-
-</para>
-
-@pad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_get_parent_element ##### -->
-<para>
-
-</para>
-
-@pad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_set_active ##### -->
-<para>
-
-</para>
-
-@pad: 
-@active: 
-@Returns: 
-<!-- # Unused Parameters # -->
-@mode: 
-
-
-<!-- ##### FUNCTION gst_pad_is_active ##### -->
-<para>
-
-</para>
-
-@pad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_set_blocked ##### -->
-<para>
-
-</para>
-
-@pad: 
-@blocked: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_set_blocked_async ##### -->
-<para>
-
-</para>
-
-@pad: 
-@blocked: 
-@callback: 
-@user_data: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_is_blocked ##### -->
-<para>
-
-</para>
-
-@pad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_set_element_private ##### -->
-<para>
-
-</para>
-
-@pad: 
-@priv: 
-
-
-<!-- ##### FUNCTION gst_pad_get_element_private ##### -->
-<para>
-
-</para>
-
-@pad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_get_pad_template ##### -->
-<para>
-
-</para>
-
-@pad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_set_bufferalloc_function ##### -->
-<para>
-
-</para>
-
-@pad: 
-@bufalloc: 
-<!-- # Unused Parameters # -->
-@bufferalloc: 
-
-
-<!-- ##### FUNCTION gst_pad_alloc_buffer ##### -->
-<para>
-
-</para>
-
-@pad: 
-@offset: 
-@size: 
-@caps: 
-@buf: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_set_chain_function ##### -->
-<para>
-
-</para>
-
-@pad: 
-@chain: 
-
-
-<!-- ##### FUNCTION gst_pad_chain ##### -->
-<para>
-
-</para>
-
-@pad: 
-@buffer: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_set_checkgetrange_function ##### -->
-<para>
-
-</para>
-
-@pad: 
-@check: 
-
-
-<!-- ##### FUNCTION gst_pad_set_getrange_function ##### -->
-<para>
-
-</para>
-
-@pad: 
-@get: 
-
-
-<!-- ##### FUNCTION gst_pad_get_range ##### -->
-<para>
-
-</para>
-
-@pad: 
-@offset: 
-@size: 
-@buffer: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_set_event_function ##### -->
-<para>
-
-</para>
-
-@pad: 
-@event: 
-
-
-<!-- ##### FUNCTION gst_pad_set_unlink_function ##### -->
-<para>
-
-</para>
-
-@pad: 
-@unlink: 
-
-
-<!-- ##### FUNCTION gst_pad_set_activate_function ##### -->
-<para>
-
-</para>
-
-@pad: 
-@activate: 
-
-
-<!-- ##### FUNCTION gst_pad_set_activatepull_function ##### -->
-<para>
-
-</para>
-
-@pad: 
-@activatepull: 
-
-
-<!-- ##### FUNCTION gst_pad_start_task ##### -->
-<para>
-
-</para>
-
-@pad: 
-@func: 
-@data: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_pause_task ##### -->
-<para>
-
-</para>
-
-@pad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_stop_task ##### -->
-<para>
-
-</para>
-
-@pad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_link ##### -->
-<para>
-
-</para>
-
-@srcpad: 
-@sinkpad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_unlink ##### -->
-<para>
-
-</para>
-
-@srcpad: 
-@sinkpad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_is_linked ##### -->
-<para>
-
-</para>
-
-@pad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_set_link_function ##### -->
-<para>
-
-</para>
-
-@pad: 
-@link: 
-
-
-<!-- ##### FUNCTION gst_pad_can_link ##### -->
-<para>
-
-</para>
-
-@srcpad: 
-@sinkpad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_accept_caps ##### -->
-<para>
-
-</para>
-
-@pad: 
-@caps: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_get_negotiated_caps ##### -->
-<para>
-
-</para>
-
-@pad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_get_caps ##### -->
-<para>
-
-</para>
-
-@pad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_set_caps ##### -->
-<para>
-
-</para>
-
-@pad: 
-@caps: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_get_pad_template_caps ##### -->
-<para>
-
-</para>
-
-@pad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_set_acceptcaps_function ##### -->
-<para>
-
-</para>
-
-@pad: 
-@acceptcaps: 
-
-
-<!-- ##### FUNCTION gst_pad_set_getcaps_function ##### -->
-<para>
-
-</para>
-
-@pad: 
-@getcaps: 
-
-
-<!-- ##### FUNCTION gst_pad_set_setcaps_function ##### -->
-<para>
-
-</para>
-
-@pad: 
-@setcaps: 
-
-
-<!-- ##### FUNCTION gst_pad_proxy_getcaps ##### -->
-<para>
-
-</para>
-
-@pad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_proxy_setcaps ##### -->
-<para>
-
-</para>
-
-@pad: 
-@caps: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_get_allowed_caps ##### -->
-<para>
-
-</para>
-
-@srcpad: 
-@Returns: 
-<!-- # Unused Parameters # -->
-@pad: 
-
-
-<!-- ##### FUNCTION gst_pad_get_fixed_caps_func ##### -->
-<para>
-
-</para>
-
-@pad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_get_peer ##### -->
-<para>
-
-</para>
-
-@pad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_peer_get_caps ##### -->
-<para>
-
-</para>
-
-@pad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_peer_accept_caps ##### -->
-<para>
-
-</para>
-
-@pad: 
-@caps: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_use_fixed_caps ##### -->
-<para>
-
-</para>
-
-@pad: 
-
-
-<!-- ##### FUNCTION gst_pad_fixate_caps ##### -->
-<para>
-
-</para>
-
-@pad: 
-@caps: 
-
-
-<!-- ##### FUNCTION gst_pad_set_fixatecaps_function ##### -->
-<para>
-
-</para>
-
-@pad: 
-@fixatecaps: 
-
-
-<!-- ##### FUNCTION gst_pad_set_activatepush_function ##### -->
-<para>
-
-</para>
-
-@pad: 
-@activatepush: 
-
-
-<!-- ##### FUNCTION gst_pad_push ##### -->
-<para>
-
-</para>
-
-@pad: 
-@buffer: 
-@Returns: 
-<!-- # Unused Parameters # -->
-@data: 
-@buf: 
-
-
-<!-- ##### FUNCTION gst_pad_push_event ##### -->
-<para>
-
-</para>
-
-@pad: 
-@event: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_check_pull_range ##### -->
-<para>
-
-</para>
-
-@pad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_pull_range ##### -->
-<para>
-
-</para>
-
-@pad: 
-@offset: 
-@size: 
-@buffer: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_activate_pull ##### -->
-<para>
-
-</para>
-
-@pad: 
-@active: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_activate_push ##### -->
-<para>
-
-</para>
-
-@pad: 
-@active: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_send_event ##### -->
-<para>
-
-</para>
-
-@pad: 
-@event: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_event_default ##### -->
-<para>
-
-</para>
-
-@pad: 
-@event: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_set_query_function ##### -->
-<para>
-
-</para>
-
-@pad: 
-@query: 
-
-
-<!-- ##### FUNCTION gst_pad_set_query_type_function ##### -->
-<para>
-
-</para>
-
-@pad: 
-@type_func: 
-
-
-<!-- ##### FUNCTION gst_pad_get_query_types ##### -->
-<para>
-
-</para>
-
-@pad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_get_query_types_default ##### -->
-<para>
-
-</para>
-
-@pad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_query ##### -->
-<para>
-
-</para>
-
-@pad: 
-@query: 
-@Returns: 
-<!-- # Unused Parameters # -->
-@type: 
-@format: 
-@value: 
-
-
-<!-- ##### FUNCTION gst_pad_query_default ##### -->
-<para>
-
-</para>
-
-@pad: 
-@query: 
-@Returns: 
-<!-- # Unused Parameters # -->
-@type: 
-@format: 
-@value: 
-
-
-<!-- ##### FUNCTION gst_pad_query_position ##### -->
-<para>
-
-</para>
-
-@pad: 
-@format: 
-@cur: 
-@end: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_query_convert ##### -->
-<para>
-
-</para>
-
-@pad: 
-@src_format: 
-@src_val: 
-@dest_format: 
-@dest_val: 
-@Returns: 
-<!-- # Unused Parameters # -->
-@dest_fmt: 
-
-
-<!-- ##### FUNCTION gst_pad_set_internal_link_function ##### -->
-<para>
-
-</para>
-
-@pad: 
-@intlink: 
-
-
-<!-- ##### FUNCTION gst_pad_get_internal_links ##### -->
-<para>
-
-</para>
-
-@pad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_get_internal_links_default ##### -->
-<para>
-
-</para>
-
-@pad: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_dispatcher ##### -->
-<para>
-
-</para>
-
-@pad: 
-@dispatch: 
-@data: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_load_and_link ##### -->
-<para>
-
-</para>
-
-@self: 
-@parent: 
-
-
-<!-- ##### FUNCTION gst_pad_add_data_probe ##### -->
-<para>
-
-</para>
-
-@pad: 
-@handler: 
-@data: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_add_buffer_probe ##### -->
-<para>
-
-</para>
-
-@pad: 
-@handler: 
-@data: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_add_event_probe ##### -->
-<para>
-
-</para>
-
-@pad: 
-@handler: 
-@data: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_remove_data_probe ##### -->
-<para>
-
-</para>
-
-@pad: 
-@handler_id: 
-<!-- # Unused Parameters # -->
-@handler: 
-@data: 
-
-
-<!-- ##### FUNCTION gst_pad_remove_buffer_probe ##### -->
-<para>
-
-</para>
-
-@pad: 
-@handler_id: 
-<!-- # Unused Parameters # -->
-@handler: 
-@data: 
-
-
-<!-- ##### FUNCTION gst_pad_remove_event_probe ##### -->
-<para>
-
-</para>
-
-@pad: 
-@handler_id: 
-<!-- # Unused Parameters # -->
-@handler: 
-@data: 
-
-
diff --git a/docs/gst/tmpl/gstpadtemplate.sgml b/docs/gst/tmpl/gstpadtemplate.sgml
deleted file mode 100644 (file)
index 117ebb6..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-GstPadTemplate
-
-<!-- ##### SECTION Short_Description ##### -->
-Describe the media type of a pad.
-
-<!-- ##### SECTION Long_Description ##### -->
-<para>
-Padtemplates describe the possible media types a pad or an elementfactory can
-handle. 
-</para>
-<para>
-Pad and PadTemplates have #GstCaps attached to it to describe the media type they
-are capable of dealing with.  gst_pad_template_get_caps() is used to get the
-caps of a padtemplate. It's not possible to modify the caps of a padtemplate after
-creation. 
-</para>
-<para>
-Padtemplates can be created with gst_pad_template_new() or with the convenient
-GST_PAD_TEMPLATE_FACTORY() macro. A padtemplate can be used to create a pad or 
-to add to an elementfactory.
-</para>
-<para>
-The following code example shows the code to create a pad from a padtemplate.
-<example>
-<title>Create a pad from a padtemplate</title>
-  <programlisting>
-  GstStaticPadTemplate my_template =
-  GST_STATIC_PAD_TEMPLATE (
-    "sink",            /* the name of the pad */
-    GST_PAD_SINK,      /* the direction of the pad */
-    GST_PAD_ALWAYS,    /* when this pad will be present */
-    GST_STATIC_CAPS (  /* the capabilities of the padtemplate */
-      "audio/x-raw-int, "
-        "channels = (int) [ 1, 6 ]"
-    )
-  )
-
-  void
-  my_method (void) 
-  {
-    GstPad *pad;
-  
-    pad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (my_template_factory), "sink");
-    ...
-  }
-  </programlisting>
-</example>
-</para>
-<para>
-The following example shows you how to add the padtemplate to an elementfactory:
-<programlisting>
-  gboolean
-  my_factory_init (GstPlugin *plugin)
-  {
-    GstElementFactory *factory;
-
-    factory = gst_element_factory_new ("my_factory", GST_TYPE_MYFACTORY, &amp;gst_myfactory_details);
-    g_return_val_if_fail (factory != NULL, FALSE);
-
-    gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (my_template_factory));
-
-    gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
-
-    return TRUE;
-  }
-
-</programlisting>
-</para>
-
-<!-- ##### SECTION See_Also ##### -->
-<para>
-#GstPad, #GstElementFactory
-</para>
-
-<!-- ##### SECTION Stability_Level ##### -->
-
-
-<!-- ##### STRUCT GstPadTemplate ##### -->
-<para>
-The padtemplate object.
-</para>
-
-
-<!-- ##### SIGNAL GstPadTemplate::pad-created ##### -->
-<para>
-This signal is fired when an element creates a pad from this 
-template.
-</para>
-
-@gstpadtemplate: the object which received the signal.
-@arg1: The pad that was created.
-
-<!-- ##### STRUCT GstStaticPadTemplate ##### -->
-<para>
-
-</para>
-
-@name_template: 
-@direction: 
-@presence: 
-@static_caps: 
-
-<!-- ##### MACRO GST_IS_PAD_FAST ##### -->
-<para>
-
-</para>
-
-@obj: 
-
-
-<!-- ##### MACRO GST_PAD_TEMPLATE_NAME_TEMPLATE ##### -->
-<para>
-Get the nametemplate of the padtemplate.
-</para>
-
-@templ: the template to query
-
-
-<!-- ##### MACRO GST_PAD_TEMPLATE_DIRECTION ##### -->
-<para>
-Get the direction of the padtemplate.
-</para>
-
-@templ: the template to query
-
-
-<!-- ##### MACRO GST_PAD_TEMPLATE_PRESENCE ##### -->
-<para>
-Get the presence of the padtemplate.
-</para>
-
-@templ: the template to query
-
-
-<!-- ##### MACRO GST_PAD_TEMPLATE_CAPS ##### -->
-<para>
-Get a handle to the padtemplate #GstCaps
-</para>
-
-@templ: the template to query
-
-
-<!-- ##### MACRO GST_PAD_TEMPLATE_IS_FIXED ##### -->
-<para>
-Check if the properties of the padtemplate are fixed
-</para>
-
-@templ: the template to query
-
-
-<!-- ##### ENUM GstPadTemplateFlags ##### -->
-<para>
-Flags for the padtemplate
-</para>
-
-@GST_PAD_TEMPLATE_FIXED: the padtemplate has no variable properties
-@GST_PAD_TEMPLATE_FLAG_LAST: first flag that can be used by subclasses.
-
-<!-- ##### FUNCTION gst_pad_template_new ##### -->
-<para>
-
-</para>
-
-@name_template: 
-@direction: 
-@presence: 
-@caps: 
-@Returns: 
-<!-- # Unused Parameters # -->
-@Varargs: 
-
-
-<!-- ##### FUNCTION gst_static_pad_template_get ##### -->
-<para>
-
-</para>
-
-@pad_template: 
-@Returns: 
-<!-- # Unused Parameters # -->
-@templ: 
-
-
-<!-- ##### FUNCTION gst_static_pad_template_get_caps ##### -->
-<para>
-
-</para>
-
-@templ: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gst_pad_template_get_caps ##### -->
-<para>
-
-</para>
-
-@templ: 
-@Returns: 
-
-
index de9037a..549bda9 100644 (file)
@@ -91,6 +91,7 @@ libgstreamer_@GST_MAJORMINOR@_la_SOURCES = \
        gstmessage.c            \
        gstminiobject.c         \
        gstpad.c                \
+        gstpadtemplate.c       \
        gstpipeline.c           \
        gstplugin.c             \
        gstpluginfeature.c      \
@@ -168,6 +169,7 @@ gst_headers =                       \
        gstmessage.h            \
        gstminiobject.h         \
        gstpad.h                \
+       gstpadtemplate.h        \
        gstpipeline.h           \
        gstplugin.h             \
        gstpluginfeature.h      \
index 6fe5151..9f5263b 100644 (file)
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  */
+/**
+ * SECTION:gstpad
+ * @short_description: Object contained by elements that allows links to other elements
+ * @see_also: #GstPadTemplate, #GstElement, #GstEvent
+ *
+ * A #GstElement is linked to other elements via "pads", which are extremely 
+ * light-weight generic link points. 
+ * After two pads are retrieved from an element with gst_element_get_pad(), 
+ * the pads can be link with gst_pad_link(). (For quick links,
+ * you can also use gst_element_link(), which will make the obvious
+ * link for you if it's straightforward.)
+ *
+ * Pads are typically created from a #GstPadTemplate with 
+ * gst_pad_new_from_template().
+ *
+ * Pads have #GstCaps attached to it to describe the media type they are capable
+ * of dealing with. 
+ * gst_pad_get_caps() and gst_pad_try_set_caps() are used to manipulate the caps
+ * of the pads. 
+ * Pads created from a pad template cannot set capabilities that are 
+ * incompatible with the pad template capabilities.
+ *
+ * Pads without pad templates can be created with gst_pad_new(),
+ * which takes a direction and a name as an argument.  If the name is NULL,
+ * then a guaranteed unique name will be assigned to it.
+ *
+ * gst_pad_get_parent() will retrieve the #GstElement that owns the pad.
+ *
+ * A #GstElement creating a pad will typically use the various 
+ * gst_pad_set_*_function() calls to register callbacks for various events 
+ * on the pads.
+ *
+ * GstElements will use gst_pad_push() and gst_pad_pull() to push out 
+ * or pull in a buffer.
+ * gst_pad_select() and gst_pad_selectv() are used by plugins to wait for the
+ * first incoming buffer or event on any of the given set of pads.
+ *
+ * To send a #GstEvent on a pad, use gst_pad_send_event().
+ *
+ * Last reviewed on December 13th, 2002 (0.5.0.1)
+ */
 
 #include "gst_private.h"
 
 #include "gstpad.h"
+#include "gstpadtemplate.h"
 #include "gstenumtypes.h"
 #include "gstmarshal.h"
 #include "gstutils.h"
@@ -44,16 +86,6 @@ GST_DEBUG_CATEGORY_STATIC (debug_dataflow);
 }G_STMT_END
 #define GST_CAT_DEFAULT GST_CAT_PADS
 
-enum
-{
-  TEMPL_PAD_CREATED,
-  /* FILL ME */
-  TEMPL_LAST_SIGNAL
-};
-
-static GstObject *padtemplate_parent_class = NULL;
-static guint gst_pad_template_signals[TEMPL_LAST_SIGNAL] = { 0 };
-
 /* Pad signals and args */
 enum
 {
@@ -62,7 +94,7 @@ enum
   PAD_REQUEST_LINK,
   PAD_HAVE_DATA,
   /* FILL ME */
-  PAD_LAST_SIGNAL
+  LAST_SIGNAL
 };
 
 enum
@@ -93,8 +125,8 @@ static gboolean gst_pad_activate_default (GstPad * pad);
 static xmlNodePtr gst_pad_save_thyself (GstObject * object, xmlNodePtr parent);
 #endif
 
-static GstObjectClass *pad_parent_class = NULL;
-static guint gst_pad_signals[PAD_LAST_SIGNAL] = { 0 };
+static GstObjectClass *parent_class = NULL;
+static guint gst_pad_signals[LAST_SIGNAL] = { 0 };
 
 static GQuark buffer_quark;
 static GQuark event_quark;
@@ -152,7 +184,7 @@ gst_pad_class_init (GstPadClass * klass)
   gobject_class = (GObjectClass *) klass;
   gstobject_class = (GstObjectClass *) klass;
 
-  pad_parent_class = g_type_class_ref (GST_TYPE_OBJECT);
+  parent_class = g_type_class_ref (GST_TYPE_OBJECT);
 
   gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_pad_dispose);
   gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_pad_finalize);
@@ -295,7 +327,7 @@ gst_pad_dispose (GObject * object)
     gst_element_remove_pad (GST_ELEMENT (GST_OBJECT_PARENT (pad)), pad);
   }
 
-  G_OBJECT_CLASS (pad_parent_class)->dispose (object);
+  G_OBJECT_CLASS (parent_class)->dispose (object);
 }
 
 static void
@@ -327,7 +359,7 @@ gst_pad_finalize (GObject * object)
     pad->block_cond = NULL;
   }
 
-  G_OBJECT_CLASS (pad_parent_class)->finalize (object);
+  G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
 static void
@@ -1628,11 +1660,8 @@ gst_pad_set_pad_template (GstPad * pad, GstPadTemplate * templ)
   gst_object_replace ((GstObject **) & pad->padtemplate, (GstObject *) templ);
   GST_UNLOCK (pad);
 
-  if (templ) {
-    gst_object_sink (GST_OBJECT (templ));
-    g_signal_emit (G_OBJECT (templ),
-        gst_pad_template_signals[TEMPL_PAD_CREATED], 0, pad);
-  }
+  if (templ)
+    gst_pad_template_pad_created (templ, pad);
 }
 
 /**
@@ -3487,220 +3516,6 @@ dropping:
   }
 }
 
-/************************************************************************
- *
- * templates
- *
- */
-static void gst_pad_template_class_init (GstPadTemplateClass * klass);
-static void gst_pad_template_init (GstPadTemplate * templ);
-static void gst_pad_template_dispose (GObject * object);
-
-GType
-gst_pad_template_get_type (void)
-{
-  static GType padtemplate_type = 0;
-
-  if (!padtemplate_type) {
-    static const GTypeInfo padtemplate_info = {
-      sizeof (GstPadTemplateClass), NULL, NULL,
-      (GClassInitFunc) gst_pad_template_class_init, NULL, NULL,
-      sizeof (GstPadTemplate),
-      0,
-      (GInstanceInitFunc) gst_pad_template_init, NULL
-    };
-
-    padtemplate_type =
-        g_type_register_static (GST_TYPE_OBJECT, "GstPadTemplate",
-        &padtemplate_info, 0);
-  }
-  return padtemplate_type;
-}
-
-static void
-gst_pad_template_class_init (GstPadTemplateClass * klass)
-{
-  GObjectClass *gobject_class;
-  GstObjectClass *gstobject_class;
-
-  gobject_class = (GObjectClass *) klass;
-  gstobject_class = (GstObjectClass *) klass;
-
-  padtemplate_parent_class = g_type_class_ref (GST_TYPE_OBJECT);
-
-  gst_pad_template_signals[TEMPL_PAD_CREATED] =
-      g_signal_new ("pad-created", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
-      G_STRUCT_OFFSET (GstPadTemplateClass, pad_created),
-      NULL, NULL, gst_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_PAD);
-
-  gobject_class->dispose = gst_pad_template_dispose;
-
-  gstobject_class->path_string_separator = "*";
-}
-
-static void
-gst_pad_template_init (GstPadTemplate * templ)
-{
-}
-
-static void
-gst_pad_template_dispose (GObject * object)
-{
-  GstPadTemplate *templ = GST_PAD_TEMPLATE (object);
-
-  g_free (GST_PAD_TEMPLATE_NAME_TEMPLATE (templ));
-  if (GST_PAD_TEMPLATE_CAPS (templ)) {
-    gst_caps_unref (GST_PAD_TEMPLATE_CAPS (templ));
-  }
-
-  G_OBJECT_CLASS (padtemplate_parent_class)->dispose (object);
-}
-
-/* ALWAYS padtemplates cannot have conversion specifications (like src_%d),
- * since it doesn't make sense.
- * SOMETIMES padtemplates can do whatever they want, they are provided by the
- * element.
- * REQUEST padtemplates can be reverse-parsed (the user asks for 'sink1', the
- * 'sink%d' template is automatically selected), so we need to restrict their
- * naming.
- */
-static gboolean
-name_is_valid (const gchar * name, GstPadPresence presence)
-{
-  const gchar *str;
-
-  if (presence == GST_PAD_ALWAYS) {
-    if (strchr (name, '%')) {
-      g_warning ("invalid name template %s: conversion specifications are not"
-          " allowed for GST_PAD_ALWAYS padtemplates", name);
-      return FALSE;
-    }
-  } else if (presence == GST_PAD_REQUEST) {
-    if ((str = strchr (name, '%')) && strchr (str + 1, '%')) {
-      g_warning ("invalid name template %s: only one conversion specification"
-          " allowed in GST_PAD_REQUEST padtemplate", name);
-      return FALSE;
-    }
-    if (str && (*(str + 1) != 's' && *(str + 1) != 'd')) {
-      g_warning ("invalid name template %s: conversion specification must be of"
-          " type '%%d' or '%%s' for GST_PAD_REQUEST padtemplate", name);
-      return FALSE;
-    }
-    if (str && (*(str + 2) != '\0')) {
-      g_warning ("invalid name template %s: conversion specification must"
-          " appear at the end of the GST_PAD_REQUEST padtemplate name", name);
-      return FALSE;
-    }
-  }
-
-  return TRUE;
-}
-
-/**
- * gst_static_pad_template_get:
- * @pad_template: the static pad template
- *
- * Converts a #GstStaticPadTemplate into a #GstPadTemplate.
- *
- * Returns: a new #GstPadTemplate.
- */
-GstPadTemplate *
-gst_static_pad_template_get (GstStaticPadTemplate * pad_template)
-{
-  GstPadTemplate *new;
-
-  if (!name_is_valid (pad_template->name_template, pad_template->presence))
-    return NULL;
-
-  new = g_object_new (gst_pad_template_get_type (),
-      "name", pad_template->name_template, NULL);
-
-  GST_PAD_TEMPLATE_NAME_TEMPLATE (new) = g_strdup (pad_template->name_template);
-  GST_PAD_TEMPLATE_DIRECTION (new) = pad_template->direction;
-  GST_PAD_TEMPLATE_PRESENCE (new) = pad_template->presence;
-
-  GST_PAD_TEMPLATE_CAPS (new) =
-      gst_caps_copy (gst_static_caps_get (&pad_template->static_caps));
-
-  return new;
-}
-
-/**
- * gst_pad_template_new:
- * @name_template: the name template.
- * @direction: the #GstPadDirection of the template.
- * @presence: the #GstPadPresence of the pad.
- * @caps: a #GstCaps set for the template. The caps are taken ownership of.
- *
- * Creates a new pad template with a name according to the given template
- * and with the given arguments. This functions takes ownership of the provided
- * caps, so be sure to not use them afterwards.
- *
- * Returns: a new #GstPadTemplate.
- */
-GstPadTemplate *
-gst_pad_template_new (const gchar * name_template,
-    GstPadDirection direction, GstPadPresence presence, GstCaps * caps)
-{
-  GstPadTemplate *new;
-
-  g_return_val_if_fail (name_template != NULL, NULL);
-  g_return_val_if_fail (caps != NULL, NULL);
-  g_return_val_if_fail (direction == GST_PAD_SRC
-      || direction == GST_PAD_SINK, NULL);
-  g_return_val_if_fail (presence == GST_PAD_ALWAYS
-      || presence == GST_PAD_SOMETIMES || presence == GST_PAD_REQUEST, NULL);
-
-  if (!name_is_valid (name_template, presence)) {
-    gst_caps_unref (caps);
-    return NULL;
-  }
-
-  new = g_object_new (gst_pad_template_get_type (),
-      "name", name_template, NULL);
-
-  GST_PAD_TEMPLATE_NAME_TEMPLATE (new) = g_strdup (name_template);
-  GST_PAD_TEMPLATE_DIRECTION (new) = direction;
-  GST_PAD_TEMPLATE_PRESENCE (new) = presence;
-  GST_PAD_TEMPLATE_CAPS (new) = caps;
-
-  return new;
-}
-
-/**
- * gst_static_pad_template_get_caps:
- * @templ: a #GstStaticPadTemplate to get capabilities of.
- *
- * Gets the capabilities of the static pad template.
- *
- * Returns: the #GstCaps of the static pad template. If you need to keep a 
- * reference to the caps, take a ref (see gst_caps_ref ()).
- */
-GstCaps *
-gst_static_pad_template_get_caps (GstStaticPadTemplate * templ)
-{
-  g_return_val_if_fail (templ, NULL);
-
-  return (GstCaps *) gst_static_caps_get (&templ->static_caps);
-}
-
-/**
- * gst_pad_template_get_caps:
- * @templ: a #GstPadTemplate to get capabilities of.
- *
- * Gets the capabilities of the pad template.
- *
- * Returns: the #GstCaps of the pad template. If you need to keep a reference to
- * the caps, take a ref (see gst_caps_ref ()).
- */
-GstCaps *
-gst_pad_template_get_caps (GstPadTemplate * templ)
-{
-  g_return_val_if_fail (GST_IS_PAD_TEMPLATE (templ), NULL);
-
-  return GST_PAD_TEMPLATE_CAPS (templ);
-}
-
 /**
  * gst_pad_set_element_private:
  * @pad: the #GstPad to set the private data of.
index aa87e05..06ea19a 100644 (file)
@@ -52,10 +52,6 @@ GST_EXPORT GType _gst_pad_type;
 typedef struct _GstPad GstPad;
 typedef struct _GstPadClass GstPadClass;
 
-typedef struct _GstPadTemplate GstPadTemplate;
-typedef struct _GstPadTemplateClass GstPadTemplateClass;
-typedef struct _GstStaticPadTemplate GstStaticPadTemplate;
-
 /**
  * GstPadLinkReturn:
  * @GST_PAD_LINK_OK            : link succeeded
@@ -76,7 +72,22 @@ typedef enum {
   GST_PAD_LINK_REFUSED          = -6,
 } GstPadLinkReturn;
 
+/**
+ * GST_PAD_LINK_FAILED:
+ * @ret: the #GstPadLinkReturn value
+ *
+ * Macro to test if the given #GstPadLinkReturn value indicates a failed
+ * negotiation step (REFUSED/DELAYED).
+ */
 #define GST_PAD_LINK_FAILED(ret) ((ret) < GST_PAD_LINK_OK)
+
+/**
+ * GST_PAD_LINK_SUCCESSFUL:
+ * @ret: the #GstPadLinkReturn value
+ *
+ * Macro to test if the given #GstPadLinkReturn value indicates a successfull
+ * negotiation step (OK/DONE).
+ */
 #define GST_PAD_LINK_SUCCESSFUL(ret) ((ret) >= GST_PAD_LINK_OK)
 
 typedef enum {
@@ -106,38 +117,136 @@ typedef enum {
 typedef gboolean               (*GstPadActivateFunction)       (GstPad *pad);
 typedef gboolean               (*GstPadActivateModeFunction)   (GstPad *pad, gboolean active);
 
+
 /* data passing */
+/**
+ * GstPadChainFunction:
+ * @pad: the #GstPad that performed the chain.
+ * @buffer: the #GstBuffer that is chained.
+ * 
+ * A function that will be called when chaining buffers.
+ *
+ * 
+ */
 typedef GstFlowReturn          (*GstPadChainFunction)          (GstPad *pad, GstBuffer *buffer);
 typedef GstFlowReturn          (*GstPadGetRangeFunction)       (GstPad *pad, guint64 offset,
                                                                 guint length, GstBuffer **buffer);
+
+/**
+ * GstPadEventFunction:
+ * @pad: the #GstPad to handle the event.
+ * @event: the #GstEvent to handle.
+ *
+ * Function signature to handle an event for the pad.
+ *
+ * Returns: TRUE if the pad could handle the event.
+ */
 typedef gboolean               (*GstPadEventFunction)          (GstPad *pad, GstEvent *event);
 
+
 /* deprecate me, check range should use seeking query */
 typedef gboolean               (*GstPadCheckGetRangeFunction)  (GstPad *pad);
 
+
 /* internal links */
+/**
+ * GstPadIntLinkFunction:
+ * @pad: The #GstPad to query.
+ *
+ * The signature of the internal pad link function.
+ *
+ * Returns: a newly allocated #GList of pads that are linked to the given pad on
+ *  the inside of the parent element.
+ *  The caller must call g_list_free() on it after use.
+ *
+ */
 typedef GList*                 (*GstPadIntLinkFunction)        (GstPad *pad);
 
+
 /* generic query function */
+/**
+ * GstPadQueryTypeFunction:
+ * @pad: a #GstPad to query
+ *
+ * The signature of the query types function.
+ *
+ * Returns: an array of query types
+ */
 typedef const GstQueryType*    (*GstPadQueryTypeFunction)      (GstPad *pad);
+
+/**
+ * GstPadQueryFunction:
+ * @pad: the #GstPad to query.
+ * @query: the #GstQuery object to execute
+ *
+ * The signature of the query function.
+ * 
+ * Returns: TRUE if the query could be performed.
+ */
 typedef gboolean               (*GstPadQueryFunction)          (GstPad *pad, GstQuery *query);
 
+
 /* linking */
+/**
+ * GstPadLinkFunction
+ * @pad: the #GstPad that is linked.
+ * @peer: the peer #GstPad of the link
+ *
+ * Function signature to handle a new link on the pad.
+ *
+ * Returns: the result of the link with the specified peer.
+ */
 typedef GstPadLinkReturn       (*GstPadLinkFunction)           (GstPad *pad, GstPad *peer);
+/**
+ * GstPadUnlinkFunction
+ * @pad: the #GstPad that is linked.
+ *
+ * Function signature to handle a unlinking the pad prom its peer.
+ */
 typedef void                   (*GstPadUnlinkFunction)         (GstPad *pad);
 
+
 /* caps nego */
+/**
+ * GstPadGetCapsFunction:
+ * @pad: the #GstPad to get the capabilities of.
+ *
+ * Returns a copy of the capabilities of the specified pad. By default this
+ * function will return the pad template capabilities, but can optionally
+ * be overridden.
+ *
+ * Returns: a newly allocated copy #GstCaps of the pad.
+ */
 typedef GstCaps*               (*GstPadGetCapsFunction)        (GstPad *pad);
 typedef gboolean               (*GstPadSetCapsFunction)        (GstPad *pad, GstCaps *caps);
 typedef gboolean               (*GstPadAcceptCapsFunction)     (GstPad *pad, GstCaps *caps);
 typedef void                   (*GstPadFixateCapsFunction)     (GstPad *pad, GstCaps *caps);
 typedef GstFlowReturn          (*GstPadBufferAllocFunction)    (GstPad *pad, guint64 offset, guint size,
                                                                 GstCaps *caps, GstBuffer **buf);
+
 /* misc */
+/**
+ * GstPadDispatcherFunction:
+ * @pad: the #GstPad that is dispatched.
+ * @data: the gpointer to optional user data.
+ *
+ * A dispatcher function is called for all internally linked pads, see 
+ * gst_pad_dispatcher().
+ *
+ * Returns: TRUE if the dispatching procedure has to be stopped.
+ */
 typedef gboolean               (*GstPadDispatcherFunction)     (GstPad *pad, gpointer data);
 
 typedef void                   (*GstPadBlockCallback)          (GstPad *pad, gboolean blocked, gpointer user_data);
 
+/**
+ * GstPadDirection:
+ * @GST_PAD_UNKNOWN: direction is unknown.
+ * @GST_PAD_SRC: the pad is a source pad.
+ * @GST_PAD_SINK: the pad is a sink pad.
+ *
+ * The direction of a pad.
+ */
 typedef enum {
   GST_PAD_UNKNOWN,
   GST_PAD_SRC,
@@ -153,6 +262,9 @@ typedef enum {
   GST_PAD_FLAG_LAST            = GST_OBJECT_FLAG_LAST + 8
 } GstPadFlags;
 
+/* FIXME: this awful circular dependency need to be resolved properly (see padtemplate.h) */
+typedef struct _GstPadTemplate GstPadTemplate;
+
 struct _GstPad {
   GstObject                    object;
 
@@ -306,67 +418,8 @@ struct _GstPadClass {
 #define GST_PAD_BLOCK_WAIT(pad)         (g_cond_wait(GST_PAD_BLOCK_GET_COND (pad), GST_GET_LOCK (pad)))
 #define GST_PAD_BLOCK_SIGNAL(pad)       (g_cond_signal(GST_PAD_BLOCK_GET_COND (pad)))
 
-/***** PadTemplate *****/
-#define GST_TYPE_PAD_TEMPLATE          (gst_pad_template_get_type ())
-#define GST_PAD_TEMPLATE(obj)          (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PAD_TEMPLATE,GstPadTemplate))
-#define GST_PAD_TEMPLATE_CLASS(klass)  (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PAD_TEMPLATE,GstPadTemplateClass))
-#define GST_IS_PAD_TEMPLATE(obj)       (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PAD_TEMPLATE))
-#define GST_IS_PAD_TEMPLATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PAD_TEMPLATE))
-
-typedef enum {
-  GST_PAD_ALWAYS,
-  GST_PAD_SOMETIMES,
-  GST_PAD_REQUEST
-} GstPadPresence;
-
-#define GST_PAD_TEMPLATE_NAME_TEMPLATE(templ)  (((GstPadTemplate *)(templ))->name_template)
-#define GST_PAD_TEMPLATE_DIRECTION(templ)      (((GstPadTemplate *)(templ))->direction)
-#define GST_PAD_TEMPLATE_PRESENCE(templ)       (((GstPadTemplate *)(templ))->presence)
-#define GST_PAD_TEMPLATE_CAPS(templ)           (((GstPadTemplate *)(templ))->caps)
-
-typedef enum {
-  GST_PAD_TEMPLATE_FIXED       = GST_OBJECT_FLAG_LAST,
-
-  GST_PAD_TEMPLATE_FLAG_LAST   = GST_OBJECT_FLAG_LAST + 4
-} GstPadTemplateFlags;
-
-#define GST_PAD_TEMPLATE_IS_FIXED(templ)       (GST_FLAG_IS_SET(templ, GST_PAD_TEMPLATE_FIXED))
-
-struct _GstPadTemplate {
-  GstObject       object;
-
-  gchar           *name_template;
-  GstPadDirection  direction;
-  GstPadPresence   presence;
-  GstCaps        *caps;
-
-  gpointer _gst_reserved[GST_PADDING];
-};
-
-struct _GstPadTemplateClass {
-  GstObjectClass   parent_class;
-
-  /* signal callbacks */
-  void (*pad_created)  (GstPadTemplate *templ, GstPad *pad);
-
-  gpointer _gst_reserved[GST_PADDING];
-};
-
-struct _GstStaticPadTemplate {
-  gchar           *name_template;
-  GstPadDirection  direction;
-  GstPadPresence   presence;
-  GstStaticCaps   static_caps;
-};
-
-#define GST_STATIC_PAD_TEMPLATE(padname, dir, pres, caps) \
-  { \
-  /* name_template */    padname, \
-  /* direction */        dir, \
-  /* presence */         pres, \
-  /* caps */             caps \
-  }
-
+/* FIXME: this awful circular dependency need to be resolved properly (see padtemplate.h) */
+#include <gst/gstpadtemplate.h>
 
 GType                  gst_pad_get_type                        (void);
 
@@ -482,19 +535,6 @@ gboolean           gst_pad_dispatcher                      (GstPad *pad, GstPadDispatcherFunction dispatch,
 void                   gst_pad_load_and_link                   (xmlNodePtr self, GstObject *parent);
 #endif
 
-
-/* templates and factories */
-GType                  gst_pad_template_get_type               (void);
-
-GstPadTemplate*                gst_pad_template_new                    (const gchar *name_template,
-                                                                GstPadDirection direction, GstPadPresence presence,
-                                                                GstCaps *caps);
-
-GstPadTemplate *       gst_static_pad_template_get             (GstStaticPadTemplate *pad_template);
-GstCaps*               gst_static_pad_template_get_caps        (GstStaticPadTemplate *templ);
-GstCaps*               gst_pad_template_get_caps               (GstPadTemplate *templ);
-
-
 G_END_DECLS
 
 #endif /* __GST_PAD_H__ */
diff --git a/gst/gstpadtemplate.c b/gst/gstpadtemplate.c
new file mode 100644 (file)
index 0000000..bb4bba0
--- /dev/null
@@ -0,0 +1,331 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ *                    2000 Wim Taymans <wtay@chello.be>
+ *
+ * gstpadtemplate.c: Templates for pad creation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+/**
+ * SECTION:gstpadtemplate
+ * @short_description: Describe the media type of a pad.
+ * @see_also: #GstPad, #GstElementFactory
+ *
+ * Padtemplates describe the possible media types a pad or an elementfactory can
+ * handle. 
+ * 
+ * Pad and PadTemplates have #GstCaps attached to it to describe the media type they
+ * are capable of dealing with. gst_pad_template_get_caps() is used to get the
+ * caps of a padtemplate. It's not possible to modify the caps of a padtemplate after
+ * creation. 
+ * 
+ * Padtemplates can be created with gst_pad_template_new() or with the convenient
+ * GST_PAD_TEMPLATE_FACTORY() macro. A padtemplate can be used to create a pad or 
+ * to add to an elementfactory.
+ * 
+ * The following code example shows the code to create a pad from a padtemplate.
+ * <example>
+ * <title>Create a pad from a padtemplate</title>
+ *   <programlisting>
+ *   GstStaticPadTemplate my_template =
+ *   GST_STATIC_PAD_TEMPLATE (
+ *     "sink",         // the name of the pad
+ *     GST_PAD_SINK,   // the direction of the pad
+ *     GST_PAD_ALWAYS,         // when this pad will be present
+ *     GST_STATIC_CAPS (       // the capabilities of the padtemplate
+ *       "audio/x-raw-int, "
+ *         "channels = (int) [ 1, 6 ]"
+ *     )
+ *   )
+ *   
+ *   void
+ *   my_method (void) 
+ *   {
+ *     GstPad *pad;
+ *     
+ *     pad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (my_template_factory), "sink");
+ *     ...
+ *   }
+ *   </programlisting>
+ * </example>
+ * 
+ * The following example shows you how to add the padtemplate to an elementfactory:
+ * <informalexample>
+ *   <programlisting>
+ *   gboolean
+ *   my_factory_init (GstPlugin *plugin)
+ *   {
+ *     GstElementFactory *factory;
+ *     
+ *     factory = gst_element_factory_new ("my_factory", GST_TYPE_MYFACTORY, &amp;gst_myfactory_details);
+ *     g_return_val_if_fail (factory != NULL, FALSE);
+ *     
+ *     gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (my_template_factory));
+ *     
+ *     gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
+ *     
+ *     return TRUE;
+ *   }
+ *   </programlisting>
+ * </informalexample>
+ */
+
+#include "gst_private.h"
+
+#include "gstpad.h"
+#include "gstpadtemplate.h"
+#include "gstenumtypes.h"
+#include "gstmarshal.h"
+#include "gstutils.h"
+#include "gstinfo.h"
+#include "gsterror.h"
+#include "gstvalue.h"
+
+#define GST_CAT_DEFAULT GST_CAT_PADS
+
+enum
+{
+  TEMPL_PAD_CREATED,
+  /* FILL ME */
+  LAST_SIGNAL
+};
+
+static GstObject *parent_class = NULL;
+static guint gst_pad_template_signals[LAST_SIGNAL] = { 0 };
+
+static void gst_pad_template_class_init (GstPadTemplateClass * klass);
+static void gst_pad_template_init (GstPadTemplate * templ);
+static void gst_pad_template_dispose (GObject * object);
+
+GType
+gst_pad_template_get_type (void)
+{
+  static GType padtemplate_type = 0;
+
+  if (!padtemplate_type) {
+    static const GTypeInfo padtemplate_info = {
+      sizeof (GstPadTemplateClass), NULL, NULL,
+      (GClassInitFunc) gst_pad_template_class_init, NULL, NULL,
+      sizeof (GstPadTemplate),
+      0,
+      (GInstanceInitFunc) gst_pad_template_init, NULL
+    };
+
+    padtemplate_type =
+        g_type_register_static (GST_TYPE_OBJECT, "GstPadTemplate",
+        &padtemplate_info, 0);
+  }
+  return padtemplate_type;
+}
+
+static void
+gst_pad_template_class_init (GstPadTemplateClass * klass)
+{
+  GObjectClass *gobject_class;
+  GstObjectClass *gstobject_class;
+
+  gobject_class = (GObjectClass *) klass;
+  gstobject_class = (GstObjectClass *) klass;
+
+  parent_class = g_type_class_ref (GST_TYPE_OBJECT);
+
+  /**
+   * GstPadTemplate::pad-created:
+   * @pad_template: the object which received the signal.
+   * @pad: the pad that was created.
+   *
+   * This signal is fired when an element creates a pad from this template.
+   */
+  gst_pad_template_signals[TEMPL_PAD_CREATED] =
+      g_signal_new ("pad-created", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
+      G_STRUCT_OFFSET (GstPadTemplateClass, pad_created),
+      NULL, NULL, gst_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_PAD);
+
+  gobject_class->dispose = gst_pad_template_dispose;
+
+  gstobject_class->path_string_separator = "*";
+}
+
+static void
+gst_pad_template_init (GstPadTemplate * templ)
+{
+}
+
+static void
+gst_pad_template_dispose (GObject * object)
+{
+  GstPadTemplate *templ = GST_PAD_TEMPLATE (object);
+
+  g_free (GST_PAD_TEMPLATE_NAME_TEMPLATE (templ));
+  if (GST_PAD_TEMPLATE_CAPS (templ)) {
+    gst_caps_unref (GST_PAD_TEMPLATE_CAPS (templ));
+  }
+
+  G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+/* ALWAYS padtemplates cannot have conversion specifications (like src_%d),
+ * since it doesn't make sense.
+ * SOMETIMES padtemplates can do whatever they want, they are provided by the
+ * element.
+ * REQUEST padtemplates can be reverse-parsed (the user asks for 'sink1', the
+ * 'sink%d' template is automatically selected), so we need to restrict their
+ * naming.
+ */
+static gboolean
+name_is_valid (const gchar * name, GstPadPresence presence)
+{
+  const gchar *str;
+
+  if (presence == GST_PAD_ALWAYS) {
+    if (strchr (name, '%')) {
+      g_warning ("invalid name template %s: conversion specifications are not"
+          " allowed for GST_PAD_ALWAYS padtemplates", name);
+      return FALSE;
+    }
+  } else if (presence == GST_PAD_REQUEST) {
+    if ((str = strchr (name, '%')) && strchr (str + 1, '%')) {
+      g_warning ("invalid name template %s: only one conversion specification"
+          " allowed in GST_PAD_REQUEST padtemplate", name);
+      return FALSE;
+    }
+    if (str && (*(str + 1) != 's' && *(str + 1) != 'd')) {
+      g_warning ("invalid name template %s: conversion specification must be of"
+          " type '%%d' or '%%s' for GST_PAD_REQUEST padtemplate", name);
+      return FALSE;
+    }
+    if (str && (*(str + 2) != '\0')) {
+      g_warning ("invalid name template %s: conversion specification must"
+          " appear at the end of the GST_PAD_REQUEST padtemplate name", name);
+      return FALSE;
+    }
+  }
+
+  return TRUE;
+}
+
+/**
+ * gst_static_pad_template_get:
+ * @pad_template: the static pad template
+ *
+ * Converts a #GstStaticPadTemplate into a #GstPadTemplate.
+ *
+ * Returns: a new #GstPadTemplate.
+ */
+GstPadTemplate *
+gst_static_pad_template_get (GstStaticPadTemplate * pad_template)
+{
+  GstPadTemplate *new;
+
+  if (!name_is_valid (pad_template->name_template, pad_template->presence))
+    return NULL;
+
+  new = g_object_new (gst_pad_template_get_type (),
+      "name", pad_template->name_template, NULL);
+
+  GST_PAD_TEMPLATE_NAME_TEMPLATE (new) = g_strdup (pad_template->name_template);
+  GST_PAD_TEMPLATE_DIRECTION (new) = pad_template->direction;
+  GST_PAD_TEMPLATE_PRESENCE (new) = pad_template->presence;
+
+  GST_PAD_TEMPLATE_CAPS (new) =
+      gst_caps_copy (gst_static_caps_get (&pad_template->static_caps));
+
+  return new;
+}
+
+/**
+ * gst_pad_template_new:
+ * @name_template: the name template.
+ * @direction: the #GstPadDirection of the template.
+ * @presence: the #GstPadPresence of the pad.
+ * @caps: a #GstCaps set for the template. The caps are taken ownership of.
+ *
+ * Creates a new pad template with a name according to the given template
+ * and with the given arguments. This functions takes ownership of the provided
+ * caps, so be sure to not use them afterwards.
+ *
+ * Returns: a new #GstPadTemplate.
+ */
+GstPadTemplate *
+gst_pad_template_new (const gchar * name_template,
+    GstPadDirection direction, GstPadPresence presence, GstCaps * caps)
+{
+  GstPadTemplate *new;
+
+  g_return_val_if_fail (name_template != NULL, NULL);
+  g_return_val_if_fail (caps != NULL, NULL);
+  g_return_val_if_fail (direction == GST_PAD_SRC
+      || direction == GST_PAD_SINK, NULL);
+  g_return_val_if_fail (presence == GST_PAD_ALWAYS
+      || presence == GST_PAD_SOMETIMES || presence == GST_PAD_REQUEST, NULL);
+
+  if (!name_is_valid (name_template, presence)) {
+    gst_caps_unref (caps);
+    return NULL;
+  }
+
+  new = g_object_new (gst_pad_template_get_type (),
+      "name", name_template, NULL);
+
+  GST_PAD_TEMPLATE_NAME_TEMPLATE (new) = g_strdup (name_template);
+  GST_PAD_TEMPLATE_DIRECTION (new) = direction;
+  GST_PAD_TEMPLATE_PRESENCE (new) = presence;
+  GST_PAD_TEMPLATE_CAPS (new) = caps;
+
+  return new;
+}
+
+/**
+ * gst_static_pad_template_get_caps:
+ * @templ: a #GstStaticPadTemplate to get capabilities of.
+ *
+ * Gets the capabilities of the static pad template.
+ *
+ * Returns: the #GstCaps of the static pad template. If you need to keep a 
+ * reference to the caps, take a ref (see gst_caps_ref ()).
+ */
+GstCaps *
+gst_static_pad_template_get_caps (GstStaticPadTemplate * templ)
+{
+  g_return_val_if_fail (templ, NULL);
+
+  return (GstCaps *) gst_static_caps_get (&templ->static_caps);
+}
+
+/**
+ * gst_pad_template_get_caps:
+ * @templ: a #GstPadTemplate to get capabilities of.
+ *
+ * Gets the capabilities of the pad template.
+ *
+ * Returns: the #GstCaps of the pad template. If you need to keep a reference to
+ * the caps, take a ref (see gst_caps_ref ()).
+ */
+GstCaps *
+gst_pad_template_get_caps (GstPadTemplate * templ)
+{
+  g_return_val_if_fail (GST_IS_PAD_TEMPLATE (templ), NULL);
+
+  return GST_PAD_TEMPLATE_CAPS (templ);
+}
+
+void
+gst_pad_template_pad_created (GstPadTemplate * templ, GstPad * pad)
+{
+  gst_object_sink (GST_OBJECT (templ));
+  g_signal_emit (G_OBJECT (templ),
+      gst_pad_template_signals[TEMPL_PAD_CREATED], 0, pad);
+}
diff --git a/gst/gstpadtemplate.h b/gst/gstpadtemplate.h
new file mode 100644 (file)
index 0000000..f17e838
--- /dev/null
@@ -0,0 +1,174 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ *                    2000 Wim Taymans <wim.taymans@chello.be>
+ *
+ * gstpadtemplate.h: Header for GstPadTemplate object
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __GST_PAD_TEMPLATE_H__
+#define __GST_PAD_TEMPLATE_H__
+
+#include <gst/gstconfig.h>
+
+#include <gst/gstobject.h>
+#include <gst/gstbuffer.h>
+#include <gst/gstcaps.h>
+#include <gst/gstevent.h>
+#include <gst/gstquery.h>
+#include <gst/gstqueryutils.h>
+#include <gst/gsttask.h>
+
+G_BEGIN_DECLS
+
+/* FIXME: this awful circular dependency need to be resolved properly (see pad.h) */
+//typedef struct _GstPadTemplate GstPadTemplate;
+typedef struct _GstPadTemplateClass GstPadTemplateClass;
+typedef struct _GstStaticPadTemplate GstStaticPadTemplate;
+
+#define GST_TYPE_PAD_TEMPLATE          (gst_pad_template_get_type ())
+#define GST_PAD_TEMPLATE(obj)          (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PAD_TEMPLATE,GstPadTemplate))
+#define GST_PAD_TEMPLATE_CLASS(klass)  (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PAD_TEMPLATE,GstPadTemplateClass))
+#define GST_IS_PAD_TEMPLATE(obj)       (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PAD_TEMPLATE))
+#define GST_IS_PAD_TEMPLATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PAD_TEMPLATE))
+
+/**
+ * GstPadPresence:
+ * @GST_PAD_ALWAYS: the pad is always available
+ * @GST_PAD_SOMETIMES: the pad will become available depending on the media stream
+ * @GST_PAD_REQUEST: the pad is only available on request with 
+ *  gst_element_request_pad_by_name() or gst_element_request_compatible_pad().
+ *
+ * Indicates when this pad will become available.
+ */
+typedef enum {
+  GST_PAD_ALWAYS,
+  GST_PAD_SOMETIMES,
+  GST_PAD_REQUEST
+} GstPadPresence;
+
+/**
+ * GST_PAD_TEMPLATE_NAME_TEMPLATE:
+ * @templ: the template to query
+ *
+ * Get the nametemplate of the padtemplate.
+ */
+#define GST_PAD_TEMPLATE_NAME_TEMPLATE(templ)  (((GstPadTemplate *)(templ))->name_template)
+
+/**
+ * GST_PAD_TEMPLATE_DIRECTION:
+ * @templ: the template to query
+ *
+ * Get the direction of the padtemplate.
+ */
+#define GST_PAD_TEMPLATE_DIRECTION(templ)      (((GstPadTemplate *)(templ))->direction)
+
+/**
+ * GST_PAD_TEMPLATE_PRESENCE:
+ * @templ: the template to query
+ *
+ * Get the presence of the padtemplate.
+ */
+#define GST_PAD_TEMPLATE_PRESENCE(templ)       (((GstPadTemplate *)(templ))->presence)
+
+/**
+ * GST_PAD_TEMPLATE_CAPS:
+ * @templ: the template to query
+ *
+ * Get a handle to the padtemplate #GstCaps
+ */
+#define GST_PAD_TEMPLATE_CAPS(templ)           (((GstPadTemplate *)(templ))->caps)
+
+/**
+ * GstPadTemplateFlags:
+ * @GST_PAD_TEMPLATE_FIXED: the padtemplate has no variable properties
+ * @GST_PAD_TEMPLATE_FLAG_LAST: first flag that can be used by subclasses.
+ *
+ * Flags for the padtemplate
+ */
+typedef enum {
+  GST_PAD_TEMPLATE_FIXED       = GST_OBJECT_FLAG_LAST,
+
+  GST_PAD_TEMPLATE_FLAG_LAST   = GST_OBJECT_FLAG_LAST + 4
+} GstPadTemplateFlags;
+
+/**
+ * GST_PAD_TEMPLATE_IS_FIXED:
+ * @templ: the template to query
+ *
+ * Check if the properties of the padtemplate are fixed
+ */
+#define GST_PAD_TEMPLATE_IS_FIXED(templ)       (GST_FLAG_IS_SET(templ, GST_PAD_TEMPLATE_FIXED))
+
+/**
+ * GstPadTemplate:
+ *
+ * The padtemplate object.
+ */
+struct _GstPadTemplate {
+  GstObject       object;
+
+  gchar           *name_template;
+  GstPadDirection  direction;
+  GstPadPresence   presence;
+  GstCaps        *caps;
+
+  gpointer _gst_reserved[GST_PADDING];
+};
+
+struct _GstPadTemplateClass {
+  GstObjectClass   parent_class;
+
+  /* signal callbacks */
+  void (*pad_created)  (GstPadTemplate *templ, GstPad *pad);
+
+  gpointer _gst_reserved[GST_PADDING];
+};
+
+struct _GstStaticPadTemplate {
+  gchar           *name_template;
+  GstPadDirection  direction;
+  GstPadPresence   presence;
+  GstStaticCaps   static_caps;
+};
+
+#define GST_STATIC_PAD_TEMPLATE(padname, dir, pres, caps) \
+{ \
+  /* name_template */    padname, \
+  /* direction */        dir, \
+  /* presence */         pres, \
+  /* caps */             caps \
+}
+
+/* templates and factories */
+GType                  gst_pad_template_get_type               (void);
+
+GstPadTemplate*                gst_pad_template_new                    (const gchar *name_template,
+                                                                GstPadDirection direction, GstPadPresence presence,
+                                                                GstCaps *caps);
+
+GstPadTemplate *       gst_static_pad_template_get             (GstStaticPadTemplate *pad_template);
+GstCaps*               gst_static_pad_template_get_caps        (GstStaticPadTemplate *templ);
+GstCaps*               gst_pad_template_get_caps               (GstPadTemplate *templ);
+
+void                    gst_pad_template_pad_created            (GstPadTemplate * templ, GstPad * pad);
+
+G_END_DECLS
+
+#endif /* __GST_PAD_TEMPLATE_H__ */
+