inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
/* 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.
|
|
|
|
*/
|
2005-10-15 16:01:57 +00:00
|
|
|
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
/**
|
|
|
|
* 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
|
2006-02-14 18:26:19 +00:00
|
|
|
* handle. This allows for both inspection of handled types before loading the
|
|
|
|
* element plugin as well as identifying pads on elements that are not yet
|
|
|
|
* created (request or sometimes pads).
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2005-10-15 16:01:57 +00:00
|
|
|
* Pad and PadTemplates have #GstCaps attached to it to describe the media type
|
2006-02-14 18:26:19 +00:00
|
|
|
* they are capable of dealing with. gst_pad_template_get_caps() or
|
|
|
|
* GST_PAD_TEMPLATE_CAPS() are used to get the caps of a padtemplate. It's not
|
|
|
|
* possible to modify the caps of a padtemplate after creation.
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2006-02-14 18:26:19 +00:00
|
|
|
* PadTemplates have a #GstPadPresence property which identifies the lifetime
|
|
|
|
* of the pad and that can be retrieved with GST_PAD_TEMPLATE_PRESENCE(). Also
|
|
|
|
* the direction of the pad can be retrieved from the #GstPadTemplate with
|
|
|
|
* GST_PAD_TEMPLATE_DIRECTION().
|
|
|
|
*
|
|
|
|
* The GST_PAD_TEMPLATE_NAME_TEMPLATE () is important for GST_PAD_REQUEST pads
|
|
|
|
* because it has to be used as the name in the gst_element_request_pad_by_name()
|
|
|
|
* call to instantiate a pad from this template.
|
|
|
|
*
|
|
|
|
* Padtemplates can be created with gst_pad_template_new() or with
|
|
|
|
* gst_static_pad_template_get (), which creates a #GstPadTemplate from a
|
|
|
|
* #GstStaticPadTemplate that can be filled with the
|
|
|
|
* convenient GST_STATIC_PAD_TEMPLATE() macro.
|
|
|
|
*
|
|
|
|
* A padtemplate can be used to create a pad (see gst_pad_new_from_template()
|
|
|
|
* or gst_pad_new_from_static_template ()) or to add to an element class
|
|
|
|
* (see gst_element_class_add_pad_template ()).
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
* 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 (
|
2005-12-06 19:29:15 +00:00
|
|
|
* "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
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
* "audio/x-raw-int, "
|
|
|
|
* "channels = (int) [ 1, 6 ]"
|
|
|
|
* )
|
|
|
|
* )
|
|
|
|
* void
|
2005-10-15 15:30:24 +00:00
|
|
|
* my_method (void)
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
* {
|
|
|
|
* GstPad *pad;
|
2006-02-14 18:26:19 +00:00
|
|
|
* pad = gst_pad_new_from_static_template (&my_template, "sink");
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
* ...
|
|
|
|
* }
|
|
|
|
* </programlisting>
|
|
|
|
* </example>
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2005-10-15 16:01:57 +00:00
|
|
|
* The following example shows you how to add the padtemplate to an
|
Revert previous changes to the behaviour of GstPadTemplates, etc and the possiblity to call them in class_init as it ...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_get_type), (gst_bin_base_init),
(gst_bin_class_init):
* gst/gstelement.c: (gst_element_base_class_init),
(gst_element_class_add_pad_template):
* gst/gstpadtemplate.c: (gst_pad_template_init):
* gst/gstpipeline.c: (gst_pipeline_get_type),
(gst_pipeline_base_init), (gst_pipeline_class_init):
* libs/gst/base/gstbasesink.c:
* libs/gst/base/gstbasesrc.c: (gst_base_src_get_type),
(gst_base_src_base_init), (gst_base_src_class_init):
* plugins/elements/gstcapsfilter.c: (gst_capsfilter_base_init),
(gst_capsfilter_class_init):
* plugins/elements/gstfakesink.c: (gst_fake_sink_base_init),
(gst_fake_sink_class_init):
* plugins/elements/gstfakesrc.c: (gst_fake_src_base_init),
(gst_fake_src_class_init):
* plugins/elements/gstfdsink.c: (gst_fd_sink_base_init),
(gst_fd_sink_class_init):
* plugins/elements/gstfdsrc.c: (gst_fd_src_base_init),
(gst_fd_src_class_init):
* plugins/elements/gstfilesink.c: (gst_file_sink_base_init),
(gst_file_sink_class_init):
* plugins/elements/gstfilesrc.c: (gst_file_src_base_init),
(gst_file_src_class_init):
* plugins/elements/gstidentity.c: (gst_identity_base_init),
(gst_identity_class_init):
* plugins/elements/gstmultiqueue.c: (gst_multi_queue_base_init),
(gst_multi_queue_class_init):
* plugins/elements/gstqueue.c: (gst_queue_base_init),
(gst_queue_class_init):
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_class_init):
* plugins/elements/gsttypefindelement.c:
(gst_type_find_element_base_init),
(gst_type_find_element_class_init):
* tests/check/gst/gstelement.c: (gst_element_suite):
Revert previous changes to the behaviour of GstPadTemplates, etc
and the possiblity to call them in class_init as it breaks too
many elements. Reopens bug #491501.
Should be applied again for 0.11, thus added a few FIXME 0.11 at
several places.
2008-02-05 14:15:15 +00:00
|
|
|
* element class, this is usually done in the base_init of the class:
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
* <informalexample>
|
|
|
|
* <programlisting>
|
2006-02-14 18:26:19 +00:00
|
|
|
* static void
|
Revert previous changes to the behaviour of GstPadTemplates, etc and the possiblity to call them in class_init as it ...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_get_type), (gst_bin_base_init),
(gst_bin_class_init):
* gst/gstelement.c: (gst_element_base_class_init),
(gst_element_class_add_pad_template):
* gst/gstpadtemplate.c: (gst_pad_template_init):
* gst/gstpipeline.c: (gst_pipeline_get_type),
(gst_pipeline_base_init), (gst_pipeline_class_init):
* libs/gst/base/gstbasesink.c:
* libs/gst/base/gstbasesrc.c: (gst_base_src_get_type),
(gst_base_src_base_init), (gst_base_src_class_init):
* plugins/elements/gstcapsfilter.c: (gst_capsfilter_base_init),
(gst_capsfilter_class_init):
* plugins/elements/gstfakesink.c: (gst_fake_sink_base_init),
(gst_fake_sink_class_init):
* plugins/elements/gstfakesrc.c: (gst_fake_src_base_init),
(gst_fake_src_class_init):
* plugins/elements/gstfdsink.c: (gst_fd_sink_base_init),
(gst_fd_sink_class_init):
* plugins/elements/gstfdsrc.c: (gst_fd_src_base_init),
(gst_fd_src_class_init):
* plugins/elements/gstfilesink.c: (gst_file_sink_base_init),
(gst_file_sink_class_init):
* plugins/elements/gstfilesrc.c: (gst_file_src_base_init),
(gst_file_src_class_init):
* plugins/elements/gstidentity.c: (gst_identity_base_init),
(gst_identity_class_init):
* plugins/elements/gstmultiqueue.c: (gst_multi_queue_base_init),
(gst_multi_queue_class_init):
* plugins/elements/gstqueue.c: (gst_queue_base_init),
(gst_queue_class_init):
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_class_init):
* plugins/elements/gsttypefindelement.c:
(gst_type_find_element_base_init),
(gst_type_find_element_class_init):
* tests/check/gst/gstelement.c: (gst_element_suite):
Revert previous changes to the behaviour of GstPadTemplates, etc
and the possiblity to call them in class_init as it breaks too
many elements. Reopens bug #491501.
Should be applied again for 0.11, thus added a few FIXME 0.11 at
several places.
2008-02-05 14:15:15 +00:00
|
|
|
* my_element_base_init (gpointer g_class)
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
* {
|
Revert previous changes to the behaviour of GstPadTemplates, etc and the possiblity to call them in class_init as it ...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_get_type), (gst_bin_base_init),
(gst_bin_class_init):
* gst/gstelement.c: (gst_element_base_class_init),
(gst_element_class_add_pad_template):
* gst/gstpadtemplate.c: (gst_pad_template_init):
* gst/gstpipeline.c: (gst_pipeline_get_type),
(gst_pipeline_base_init), (gst_pipeline_class_init):
* libs/gst/base/gstbasesink.c:
* libs/gst/base/gstbasesrc.c: (gst_base_src_get_type),
(gst_base_src_base_init), (gst_base_src_class_init):
* plugins/elements/gstcapsfilter.c: (gst_capsfilter_base_init),
(gst_capsfilter_class_init):
* plugins/elements/gstfakesink.c: (gst_fake_sink_base_init),
(gst_fake_sink_class_init):
* plugins/elements/gstfakesrc.c: (gst_fake_src_base_init),
(gst_fake_src_class_init):
* plugins/elements/gstfdsink.c: (gst_fd_sink_base_init),
(gst_fd_sink_class_init):
* plugins/elements/gstfdsrc.c: (gst_fd_src_base_init),
(gst_fd_src_class_init):
* plugins/elements/gstfilesink.c: (gst_file_sink_base_init),
(gst_file_sink_class_init):
* plugins/elements/gstfilesrc.c: (gst_file_src_base_init),
(gst_file_src_class_init):
* plugins/elements/gstidentity.c: (gst_identity_base_init),
(gst_identity_class_init):
* plugins/elements/gstmultiqueue.c: (gst_multi_queue_base_init),
(gst_multi_queue_class_init):
* plugins/elements/gstqueue.c: (gst_queue_base_init),
(gst_queue_class_init):
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_class_init):
* plugins/elements/gsttypefindelement.c:
(gst_type_find_element_base_init),
(gst_type_find_element_class_init):
* tests/check/gst/gstelement.c: (gst_element_suite):
Revert previous changes to the behaviour of GstPadTemplates, etc
and the possiblity to call them in class_init as it breaks too
many elements. Reopens bug #491501.
Should be applied again for 0.11, thus added a few FIXME 0.11 at
several places.
2008-02-05 14:15:15 +00:00
|
|
|
* GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
|
2006-02-14 18:26:19 +00:00
|
|
|
*
|
|
|
|
* gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
* gst_static_pad_template_get (&my_template));
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
* }
|
|
|
|
* </programlisting>
|
|
|
|
* </informalexample>
|
2006-02-14 18:26:19 +00:00
|
|
|
*
|
|
|
|
* Last reviewed on 2006-02-14 (0.10.3)
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
gst/gstpadtemplate.c: Add "name-template", "direction", "presence" and "caps" properties, so that gst_pad_template_ne...
Original commit message from CVS:
* gst/gstpadtemplate.c:
(gst_pad_template_class_init), (gst_static_pad_template_get),
(gst_pad_template_new), (gst_pad_template_pad_created),
(gst_pad_template_set_property), (gst_pad_template_get_property):
Add "name-template", "direction", "presence" and "caps" properties,
so that gst_pad_template_new() is just a thin wrapper around
g_object_new(), which is better for bindings. (Fixes: #539772)
2008-08-01 10:02:49 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_NAME_TEMPLATE = 1,
|
|
|
|
PROP_DIRECTION,
|
|
|
|
PROP_PRESENCE,
|
|
|
|
PROP_CAPS
|
|
|
|
};
|
|
|
|
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
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_dispose (GObject * object);
|
gst/gstpadtemplate.c: Add "name-template", "direction", "presence" and "caps" properties, so that gst_pad_template_ne...
Original commit message from CVS:
* gst/gstpadtemplate.c:
(gst_pad_template_class_init), (gst_static_pad_template_get),
(gst_pad_template_new), (gst_pad_template_pad_created),
(gst_pad_template_set_property), (gst_pad_template_get_property):
Add "name-template", "direction", "presence" and "caps" properties,
so that gst_pad_template_new() is just a thin wrapper around
g_object_new(), which is better for bindings. (Fixes: #539772)
2008-08-01 10:02:49 +00:00
|
|
|
static void gst_pad_template_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_pad_template_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
|
2009-04-04 08:20:36 +00:00
|
|
|
G_DEFINE_TYPE (GstPadTemplate, gst_pad_template, GST_TYPE_OBJECT);
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gst_pad_template_class_init (GstPadTemplateClass * klass)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstObjectClass *gstobject_class;
|
|
|
|
|
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstobject_class = (GstObjectClass *) klass;
|
|
|
|
|
2006-04-08 20:57:31 +00:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
|
gst/gstpadtemplate.c: Add "name-template", "direction", "presence" and "caps" properties, so that gst_pad_template_ne...
Original commit message from CVS:
* gst/gstpadtemplate.c:
(gst_pad_template_class_init), (gst_static_pad_template_get),
(gst_pad_template_new), (gst_pad_template_pad_created),
(gst_pad_template_set_property), (gst_pad_template_get_property):
Add "name-template", "direction", "presence" and "caps" properties,
so that gst_pad_template_new() is just a thin wrapper around
g_object_new(), which is better for bindings. (Fixes: #539772)
2008-08-01 10:02:49 +00:00
|
|
|
gobject_class->get_property = gst_pad_template_get_property;
|
|
|
|
gobject_class->set_property = gst_pad_template_set_property;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GstPadTemplate:name-template
|
|
|
|
*
|
|
|
|
* The name template of the pad template.
|
|
|
|
*
|
|
|
|
* Since: 0.10.21
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_NAME_TEMPLATE,
|
|
|
|
g_param_spec_string ("name-template", "Name template",
|
|
|
|
"The name template of the pad template", NULL,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GstPadTemplate:direction
|
|
|
|
*
|
|
|
|
* The direction of the pad described by the pad template.
|
|
|
|
*
|
|
|
|
* Since: 0.10.21
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_DIRECTION,
|
|
|
|
g_param_spec_enum ("direction", "Direction",
|
|
|
|
"The direction of the pad described by the pad template",
|
|
|
|
GST_TYPE_PAD_DIRECTION, GST_PAD_UNKNOWN,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GstPadTemplate:presence
|
|
|
|
*
|
|
|
|
* When the pad described by the pad template will become available.
|
|
|
|
*
|
|
|
|
* Since: 0.10.21
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_PRESENCE,
|
|
|
|
g_param_spec_enum ("presence", "Presence",
|
|
|
|
"When the pad described by the pad template will become available",
|
|
|
|
GST_TYPE_PAD_PRESENCE, GST_PAD_ALWAYS,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GstPadTemplate:caps
|
|
|
|
*
|
|
|
|
* The capabilities of the pad described by the pad template.
|
|
|
|
*
|
|
|
|
* Since: 0.10.21
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_CAPS,
|
|
|
|
g_param_spec_boxed ("caps", "Caps",
|
|
|
|
"The capabilities of the pad described by the pad template",
|
|
|
|
GST_TYPE_CAPS,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
gstobject_class->path_string_separator = "*";
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-04-04 08:20:36 +00:00
|
|
|
gst_pad_template_init (GstPadTemplate * templ)
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
{
|
Revert previous changes to the behaviour of GstPadTemplates, etc and the possiblity to call them in class_init as it ...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_get_type), (gst_bin_base_init),
(gst_bin_class_init):
* gst/gstelement.c: (gst_element_base_class_init),
(gst_element_class_add_pad_template):
* gst/gstpadtemplate.c: (gst_pad_template_init):
* gst/gstpipeline.c: (gst_pipeline_get_type),
(gst_pipeline_base_init), (gst_pipeline_class_init):
* libs/gst/base/gstbasesink.c:
* libs/gst/base/gstbasesrc.c: (gst_base_src_get_type),
(gst_base_src_base_init), (gst_base_src_class_init):
* plugins/elements/gstcapsfilter.c: (gst_capsfilter_base_init),
(gst_capsfilter_class_init):
* plugins/elements/gstfakesink.c: (gst_fake_sink_base_init),
(gst_fake_sink_class_init):
* plugins/elements/gstfakesrc.c: (gst_fake_src_base_init),
(gst_fake_src_class_init):
* plugins/elements/gstfdsink.c: (gst_fd_sink_base_init),
(gst_fd_sink_class_init):
* plugins/elements/gstfdsrc.c: (gst_fd_src_base_init),
(gst_fd_src_class_init):
* plugins/elements/gstfilesink.c: (gst_file_sink_base_init),
(gst_file_sink_class_init):
* plugins/elements/gstfilesrc.c: (gst_file_src_base_init),
(gst_file_src_class_init):
* plugins/elements/gstidentity.c: (gst_identity_base_init),
(gst_identity_class_init):
* plugins/elements/gstmultiqueue.c: (gst_multi_queue_base_init),
(gst_multi_queue_class_init):
* plugins/elements/gstqueue.c: (gst_queue_base_init),
(gst_queue_class_init):
* plugins/elements/gsttee.c: (gst_tee_base_init),
(gst_tee_class_init):
* plugins/elements/gsttypefindelement.c:
(gst_type_find_element_base_init),
(gst_type_find_element_class_init):
* tests/check/gst/gstelement.c: (gst_element_suite):
Revert previous changes to the behaviour of GstPadTemplates, etc
and the possiblity to call them in class_init as it breaks too
many elements. Reopens bug #491501.
Should be applied again for 0.11, thus added a few FIXME 0.11 at
several places.
2008-02-05 14:15:15 +00:00
|
|
|
/* FIXME 0.11: Does anybody remember why this is here? If not, let's
|
|
|
|
* change it for 0.11 and let gst_element_class_add_pad_template() for
|
|
|
|
* example ref/sink the pad templates.
|
|
|
|
*/
|
2006-04-06 15:07:12 +00:00
|
|
|
/* We ensure that the pad template we're creating has a sunken reference.
|
|
|
|
* Inconsistencies in pad templates being floating or sunken has caused
|
|
|
|
* problems in the past with leaks, etc.
|
|
|
|
*
|
|
|
|
* For consistency, then, we only produce them with sunken references
|
|
|
|
* owned by the creator of the object
|
|
|
|
*/
|
|
|
|
if (GST_OBJECT_IS_FLOATING (templ)) {
|
2009-05-02 12:36:50 +00:00
|
|
|
gst_object_ref_sink (templ);
|
2006-04-06 15:07:12 +00:00
|
|
|
}
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
2009-03-11 13:11:30 +00:00
|
|
|
if (str && (*(str + 1) != 's' && *(str + 1) != 'd' && *(str + 1) != 'u')) {
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
g_warning ("invalid name template %s: conversion specification must be of"
|
2009-03-11 13:11:30 +00:00
|
|
|
" type '%%d', '%%u' or '%%s' for GST_PAD_REQUEST padtemplate", name);
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2005-12-20 11:12:53 +00:00
|
|
|
GType
|
|
|
|
gst_static_pad_template_get_type (void)
|
|
|
|
{
|
|
|
|
static GType staticpadtemplate_type = 0;
|
|
|
|
|
2006-06-12 08:55:21 +00:00
|
|
|
if (G_UNLIKELY (staticpadtemplate_type == 0)) {
|
2005-12-20 11:12:53 +00:00
|
|
|
staticpadtemplate_type =
|
|
|
|
g_pointer_type_register_static ("GstStaticPadTemplate");
|
|
|
|
}
|
|
|
|
return staticpadtemplate_type;
|
|
|
|
}
|
|
|
|
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
/**
|
|
|
|
* 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;
|
gst/gstpadtemplate.c: Add "name-template", "direction", "presence" and "caps" properties, so that gst_pad_template_ne...
Original commit message from CVS:
* gst/gstpadtemplate.c:
(gst_pad_template_class_init), (gst_static_pad_template_get),
(gst_pad_template_new), (gst_pad_template_pad_created),
(gst_pad_template_set_property), (gst_pad_template_get_property):
Add "name-template", "direction", "presence" and "caps" properties,
so that gst_pad_template_new() is just a thin wrapper around
g_object_new(), which is better for bindings. (Fixes: #539772)
2008-08-01 10:02:49 +00:00
|
|
|
GstCaps *caps;
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
|
|
|
|
if (!name_is_valid (pad_template->name_template, pad_template->presence))
|
|
|
|
return NULL;
|
|
|
|
|
gst/gstpadtemplate.c: Add "name-template", "direction", "presence" and "caps" properties, so that gst_pad_template_ne...
Original commit message from CVS:
* gst/gstpadtemplate.c:
(gst_pad_template_class_init), (gst_static_pad_template_get),
(gst_pad_template_new), (gst_pad_template_pad_created),
(gst_pad_template_set_property), (gst_pad_template_get_property):
Add "name-template", "direction", "presence" and "caps" properties,
so that gst_pad_template_new() is just a thin wrapper around
g_object_new(), which is better for bindings. (Fixes: #539772)
2008-08-01 10:02:49 +00:00
|
|
|
caps = gst_static_caps_get (&pad_template->static_caps);
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
|
gst/gstpadtemplate.c: Add "name-template", "direction", "presence" and "caps" properties, so that gst_pad_template_ne...
Original commit message from CVS:
* gst/gstpadtemplate.c:
(gst_pad_template_class_init), (gst_static_pad_template_get),
(gst_pad_template_new), (gst_pad_template_pad_created),
(gst_pad_template_set_property), (gst_pad_template_get_property):
Add "name-template", "direction", "presence" and "caps" properties,
so that gst_pad_template_new() is just a thin wrapper around
g_object_new(), which is better for bindings. (Fixes: #539772)
2008-08-01 10:02:49 +00:00
|
|
|
new = g_object_new (gst_pad_template_get_type (),
|
|
|
|
"name", pad_template->name_template,
|
|
|
|
"name-template", pad_template->name_template,
|
|
|
|
"direction", pad_template->direction,
|
|
|
|
"presence", pad_template->presence, "caps", caps, NULL);
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
|
gst/gstpadtemplate.c: Add "name-template", "direction", "presence" and "caps" properties, so that gst_pad_template_ne...
Original commit message from CVS:
* gst/gstpadtemplate.c:
(gst_pad_template_class_init), (gst_static_pad_template_get),
(gst_pad_template_new), (gst_pad_template_pad_created),
(gst_pad_template_set_property), (gst_pad_template_get_property):
Add "name-template", "direction", "presence" and "caps" properties,
so that gst_pad_template_new() is just a thin wrapper around
g_object_new(), which is better for bindings. (Fixes: #539772)
2008-08-01 10:02:49 +00:00
|
|
|
gst_caps_unref (caps);
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
|
|
|
|
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 (),
|
gst/gstpadtemplate.c: Add "name-template", "direction", "presence" and "caps" properties, so that gst_pad_template_ne...
Original commit message from CVS:
* gst/gstpadtemplate.c:
(gst_pad_template_class_init), (gst_static_pad_template_get),
(gst_pad_template_new), (gst_pad_template_pad_created),
(gst_pad_template_set_property), (gst_pad_template_get_property):
Add "name-template", "direction", "presence" and "caps" properties,
so that gst_pad_template_new() is just a thin wrapper around
g_object_new(), which is better for bindings. (Fixes: #539772)
2008-08-01 10:02:49 +00:00
|
|
|
"name", name_template, "name-template", name_template,
|
|
|
|
"direction", direction, "presence", presence, "caps", caps, NULL);
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
|
2008-08-28 12:32:19 +00:00
|
|
|
if (caps)
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
return new;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_static_pad_template_get_caps:
|
|
|
|
* @templ: a #GstStaticPadTemplate to get capabilities of.
|
|
|
|
*
|
|
|
|
* Gets the capabilities of the static pad template.
|
|
|
|
*
|
2009-04-15 11:05:16 +00:00
|
|
|
* Returns: the #GstCaps of the static pad template.
|
|
|
|
* Unref after usage. Since the core holds an additional
|
|
|
|
* ref to the returned caps, use gst_caps_make_writable()
|
|
|
|
* on the returned caps to modify it.
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
*/
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2006-04-06 15:07:12 +00:00
|
|
|
/**
|
|
|
|
* gst_pad_template_pad_created:
|
|
|
|
* @templ: a #GstPadTemplate that has been created
|
|
|
|
* @pad: the #GstPad that created it
|
|
|
|
*
|
|
|
|
* Emit the pad-created signal for this template when created by this pad.
|
|
|
|
*/
|
inlined two more docs factored gstpadtemplate out of gstpad
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
2005-09-25 11:19:22 +00:00
|
|
|
void
|
|
|
|
gst_pad_template_pad_created (GstPadTemplate * templ, GstPad * pad)
|
|
|
|
{
|
|
|
|
g_signal_emit (G_OBJECT (templ),
|
|
|
|
gst_pad_template_signals[TEMPL_PAD_CREATED], 0, pad);
|
|
|
|
}
|
gst/gstpadtemplate.c: Add "name-template", "direction", "presence" and "caps" properties, so that gst_pad_template_ne...
Original commit message from CVS:
* gst/gstpadtemplate.c:
(gst_pad_template_class_init), (gst_static_pad_template_get),
(gst_pad_template_new), (gst_pad_template_pad_created),
(gst_pad_template_set_property), (gst_pad_template_get_property):
Add "name-template", "direction", "presence" and "caps" properties,
so that gst_pad_template_new() is just a thin wrapper around
g_object_new(), which is better for bindings. (Fixes: #539772)
2008-08-01 10:02:49 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gst_pad_template_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
/* these properties are all construct-only */
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_NAME_TEMPLATE:
|
|
|
|
GST_PAD_TEMPLATE_NAME_TEMPLATE (object) = g_value_dup_string (value);
|
|
|
|
break;
|
|
|
|
case PROP_DIRECTION:
|
|
|
|
GST_PAD_TEMPLATE_DIRECTION (object) = g_value_get_enum (value);
|
|
|
|
break;
|
|
|
|
case PROP_PRESENCE:
|
|
|
|
GST_PAD_TEMPLATE_PRESENCE (object) = g_value_get_enum (value);
|
|
|
|
break;
|
|
|
|
case PROP_CAPS:
|
|
|
|
/* allow caps == NULL for backwards compatibility (ie. g_object_new()
|
|
|
|
* called without any of the new properties) (FIXME 0.11) */
|
|
|
|
if (g_value_get_boxed (value) != NULL) {
|
|
|
|
GST_PAD_TEMPLATE_CAPS (object) =
|
|
|
|
gst_caps_copy (g_value_get_boxed (value));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_pad_template_get_property (GObject * object, guint prop_id, GValue * value,
|
|
|
|
GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
/* these properties are all construct-only */
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_NAME_TEMPLATE:
|
|
|
|
g_value_set_string (value, GST_PAD_TEMPLATE_NAME_TEMPLATE (object));
|
|
|
|
break;
|
|
|
|
case PROP_DIRECTION:
|
|
|
|
g_value_set_enum (value, GST_PAD_TEMPLATE_DIRECTION (object));
|
|
|
|
break;
|
|
|
|
case PROP_PRESENCE:
|
|
|
|
g_value_set_enum (value, GST_PAD_TEMPLATE_PRESENCE (object));
|
|
|
|
break;
|
|
|
|
case PROP_CAPS:
|
|
|
|
g_value_set_boxed (value, GST_PAD_TEMPLATE_CAPS (object));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|