mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 03:31:05 +00:00
A rather large patch:
Original commit message from CVS: A rather large patch: - changed the API for the padtemplates: - remove the factories (array of pointers) for the padtemplates, properties and caps. The static array was a nice idea but converting all the property values to a gpointer was not a good idea. float properties were not possible, and casting a gint to a pointer is not very portable. The new API just uses the _padtemplate_new, _caps_new and _props_new functions to create the templates. This has the added benefit that the API is now uniform for static and dynamic templates and that the code can be made cleaner. - lots of cleanups in the way the capabilities are constructed (va_list) - lots of updates for all the plugins (new API) - docs updates (new API) - removed the videoraw docs.
This commit is contained in:
parent
335080574f
commit
b38d9a945b
27 changed files with 651 additions and 954 deletions
|
@ -444,15 +444,6 @@ GST_GPAD_REALPAD
|
|||
GstGhostPad
|
||||
gst_ghost_pad_new
|
||||
|
||||
GstPadFactoryEntry
|
||||
GstPadFactory[]
|
||||
GST_PAD_FACTORY_SOMETIMES
|
||||
GST_PAD_FACTORY_ALWAYS
|
||||
GST_PAD_FACTORY_REQUEST
|
||||
GST_PAD_FACTORY_SINK
|
||||
GST_PAD_FACTORY_SRC
|
||||
GST_PAD_FACTORY_CAPS
|
||||
|
||||
GstPadPresence
|
||||
GstPadTemplate
|
||||
GST_PADTEMPLATE_CAPS
|
||||
|
@ -460,7 +451,6 @@ GST_PADTEMPLATE_DIRECTION
|
|||
GST_PADTEMPLATE_NAME_TEMPLATE
|
||||
GST_PADTEMPLATE_PRESENCE
|
||||
gst_padtemplate_new
|
||||
gst_padtemplate_create
|
||||
gst_padtemplate_load_thyself
|
||||
gst_padtemplate_save_thyself
|
||||
gst_padtemplate_get_caps
|
||||
|
@ -498,7 +488,6 @@ GST_PADTEMPLATE_CLASS
|
|||
GST_IS_PADTEMPLATE
|
||||
GST_IS_PADTEMPLATE_CLASS
|
||||
gst_padtemplate_get_type
|
||||
GST_PAD_FACTORY_CAPS_ID
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
|
@ -627,16 +616,10 @@ GST_CAPS_LOCK
|
|||
GST_CAPS_TRYLOCK
|
||||
GST_CAPS_UNLOCK
|
||||
GstCaps
|
||||
GstCapsFactory
|
||||
GstCapsFactoryEntry
|
||||
GstCapsFactory[]
|
||||
gst_caps_new
|
||||
gst_caps_new_with_props
|
||||
gst_caps_destroy
|
||||
gst_caps_ref
|
||||
gst_caps_unref
|
||||
gst_caps_register
|
||||
gst_caps_register_count
|
||||
gst_caps_copy
|
||||
gst_caps_copy_on_write
|
||||
gst_caps_append
|
||||
|
@ -668,8 +651,6 @@ GST_CAPS
|
|||
<FILE>gstprops</FILE>
|
||||
<TITLE>GstProps</TITLE>
|
||||
GstProps
|
||||
GstPropsFactoryEntry
|
||||
GstPropsFactory[]
|
||||
GST_MAKE_FOURCC
|
||||
GST_PROPS_LIST
|
||||
GST_PROPS_INT
|
||||
|
@ -679,11 +660,8 @@ GST_PROPS_BOOLEAN
|
|||
GST_PROPS_STRING
|
||||
GST_PROPS_FLOAT
|
||||
GST_PROPS_FLOAT_RANGE
|
||||
GST_PROPS_FLOAT_STRING
|
||||
GST_PROPS_FLOAT_RANGE_STRING
|
||||
gst_props_register
|
||||
gst_props_register_count
|
||||
gst_props_new
|
||||
gst_props_newv
|
||||
gst_props_merge
|
||||
gst_props_copy
|
||||
gst_props_copy_on_write
|
||||
|
@ -700,18 +678,7 @@ gst_props_save_thyself
|
|||
gst_props_load_thyself
|
||||
<SUBSECTION Standard>
|
||||
GstPropsEntry
|
||||
GstPropsListFactory[]
|
||||
GstPropsId
|
||||
GST_PROPS_END_ID
|
||||
GST_PROPS_LIST_ID
|
||||
GST_PROPS_INT_ID
|
||||
GST_PROPS_INT_RANGE_ID
|
||||
GST_PROPS_FOURCC_ID
|
||||
GST_PROPS_BOOL_ID
|
||||
GST_PROPS_STRING_ID
|
||||
GST_PROPS_LAST_ID
|
||||
GST_PROPS_FLOAT_ID
|
||||
GST_PROPS_FLOAT_RANGE_ID
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
|
|
|
@ -51,39 +51,11 @@ Unlock the caps structure
|
|||
@properties: the properties of the capability
|
||||
@next: a pointer to the next caps.
|
||||
|
||||
<!-- ##### TYPEDEF GstCapsFactory ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### TYPEDEF GstCapsFactoryEntry ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### TYPEDEF GstCapsFactory[] ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_caps_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@name:
|
||||
@mime:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_caps_new_with_props ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@name:
|
||||
@mime:
|
||||
@props:
|
||||
|
@ -114,27 +86,6 @@ Unlock the caps structure
|
|||
@caps:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_caps_register ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@factory:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_caps_register_count ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@factory:
|
||||
@counter:
|
||||
@Returns:
|
||||
<!-- # Unused Parameters # -->
|
||||
@count:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_caps_copy ##### -->
|
||||
<para>
|
||||
|
||||
|
|
|
@ -797,64 +797,6 @@ Get the real pad of this ghost pad.
|
|||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### TYPEDEF GstPadFactoryEntry ##### -->
|
||||
<para>
|
||||
Defines an entry for a padfactory.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### TYPEDEF GstPadFactory[] ##### -->
|
||||
<para>
|
||||
The padfactory.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_PAD_FACTORY_SOMETIMES ##### -->
|
||||
<para>
|
||||
Indicate that this pad will become available depending
|
||||
on the media type. Use this in the factory definition.
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_PAD_FACTORY_ALWAYS ##### -->
|
||||
<para>
|
||||
Indicate that this pad will always be available.
|
||||
Use this in the factory definition.
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_PAD_FACTORY_REQUEST ##### -->
|
||||
<para>
|
||||
Indicates that this pad will be available on request. Use
|
||||
this in the factory definition.
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_PAD_FACTORY_SINK ##### -->
|
||||
<para>
|
||||
Indicates a sinkpad for the padfactory.
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_PAD_FACTORY_SRC ##### -->
|
||||
<para>
|
||||
Indicates a srcpad for the padfactory.
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_PAD_FACTORY_CAPS ##### -->
|
||||
<para>
|
||||
Starts the declaration of a the capabilities for this padtemplate.
|
||||
</para>
|
||||
|
||||
@a...: a capability factory
|
||||
|
||||
|
||||
<!-- ##### ENUM GstPadPresence ##### -->
|
||||
<para>
|
||||
Indicates when this pad will become available.
|
||||
|
@ -912,20 +854,14 @@ Indicates when this pad will become available.
|
|||
|
||||
</para>
|
||||
|
||||
@factory:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_padtemplate_create ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@name_template:
|
||||
@direction:
|
||||
@presence:
|
||||
@caps:
|
||||
@Varargs:
|
||||
@Returns:
|
||||
<!-- # Unused Parameters # -->
|
||||
@factory:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_padtemplate_load_thyself ##### -->
|
||||
|
|
|
@ -24,18 +24,6 @@ GstCaps
|
|||
@lock:
|
||||
@properties: the properties
|
||||
|
||||
<!-- ##### TYPEDEF GstPropsFactoryEntry ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### TYPEDEF GstPropsFactory[] ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_MAKE_FOURCC ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -117,50 +105,26 @@ Create a boolean property.
|
|||
@b:
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_PROPS_FLOAT_STRING ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@a:
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_PROPS_FLOAT_RANGE_STRING ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@a:
|
||||
@b:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_props_register ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@factory:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_props_register_count ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@factory:
|
||||
@counter:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_props_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@entry:
|
||||
@firstname:
|
||||
@Varargs:
|
||||
@Returns:
|
||||
<!-- # Unused Parameters # -->
|
||||
@entry:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_props_newv ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@firstname:
|
||||
@var_args:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_props_merge ##### -->
|
||||
|
@ -235,10 +199,10 @@ Create a boolean property.
|
|||
|
||||
@props:
|
||||
@name:
|
||||
@entry:
|
||||
@Varargs:
|
||||
@Returns:
|
||||
<!-- # Unused Parameters # -->
|
||||
@entry:
|
||||
@value:
|
||||
|
||||
|
||||
|
|
|
@ -207,6 +207,12 @@ the stream.
|
|||
|
||||
@Returns:
|
||||
|
||||
<!-- ##### TYPEDEF GstCapsFactoryEntry ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_IS_DISKSRC_CLASS ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -226,6 +232,17 @@ the stream.
|
|||
</para>
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_padtemplate_create ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@name_template:
|
||||
@direction:
|
||||
@presence:
|
||||
@caps:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### MACRO GST_IS_ESDSINK_CLASS ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -610,6 +627,12 @@ Specify the current offset in the file.
|
|||
|
||||
@Returns:
|
||||
|
||||
<!-- ##### TYPEDEF GstCapsFactory[] ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_PROPS_BOOL_ID ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -899,6 +922,12 @@ The fequency.
|
|||
|
||||
@obj:
|
||||
|
||||
<!-- ##### TYPEDEF GstPropsFactory[] ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### SIGNAL GstAudioSink::handoff ##### -->
|
||||
<para>
|
||||
The buffer is sent to the sound card.
|
||||
|
@ -960,6 +989,16 @@ The buffer is sent to the sound card.
|
|||
</para>
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_caps_register_count ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@factory:
|
||||
@counter:
|
||||
@Returns:
|
||||
@count:
|
||||
|
||||
<!-- ##### MACRO GST_TYPE_HTTPSRC ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -1151,6 +1190,12 @@ Flags for the GstSrc element
|
|||
GstColorSpace
|
||||
|
||||
|
||||
<!-- ##### TYPEDEF GstPadFactoryEntry ##### -->
|
||||
<para>
|
||||
Defines an entry for a padfactory.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### ENUM GstAsyncDiskSrcFlags ##### -->
|
||||
<para>
|
||||
<informaltable pgwide=1 frame="none" role="enum">
|
||||
|
@ -1218,6 +1263,12 @@ GstColorSpace
|
|||
|
||||
@Returns:
|
||||
|
||||
<!-- ##### MACRO GST_PAD_FACTORY_SINK ##### -->
|
||||
<para>
|
||||
Indicates a sinkpad for the padfactory.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_SRC_CLASS ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -1376,6 +1427,13 @@ This macro sets the given flags.
|
|||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_PROPS_FLOAT_STRING ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@a:
|
||||
|
||||
<!-- ##### FUNCTION gst_filter_get_type ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -1444,6 +1502,12 @@ The frequency.
|
|||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_PAD_FACTORY_SRC ##### -->
|
||||
<para>
|
||||
Indicates a srcpad for the padfactory.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_IS_SINK_CLASS ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -1553,6 +1617,13 @@ The frequency.
|
|||
@name:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### MACRO GST_PAD_FACTORY_CAPS ##### -->
|
||||
<para>
|
||||
Starts the declaration of a the capabilities for this padtemplate.
|
||||
</para>
|
||||
|
||||
@a...: a capability factory
|
||||
|
||||
<!-- ##### SECTION ./tmpl/gstsrc.sgml:Title ##### -->
|
||||
GstSrc
|
||||
|
||||
|
@ -1573,6 +1644,16 @@ GstSrc
|
|||
@pad:
|
||||
@buf:
|
||||
|
||||
<!-- ##### FUNCTION gst_caps_new_with_props ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@name:
|
||||
@mime:
|
||||
@props:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### MACRO GST_TYPE_AUDIOSRC ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -1750,6 +1831,14 @@ Query whether this object has multiple input pads.
|
|||
</para>
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_props_register ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@factory:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### STRUCT GstThreadClass ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -1796,6 +1885,12 @@ Information about video buffers.
|
|||
|
||||
@klass:
|
||||
|
||||
<!-- ##### TYPEDEF GstPropsFactoryEntry ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_IS_FILTER_CLASS ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -2051,6 +2146,23 @@ The start point of a filter graph
|
|||
|
||||
@src:
|
||||
|
||||
<!-- ##### FUNCTION gst_props_register_count ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@factory:
|
||||
@counter:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### MACRO GST_PROPS_FLOAT_RANGE_STRING ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@a:
|
||||
@b:
|
||||
|
||||
<!-- ##### MACRO GST_FAKESRC_CLASS ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -2110,6 +2222,13 @@ The start point of a filter graph
|
|||
|
||||
@klass: <<<<<<< gstreamer-unused.sgml
|
||||
|
||||
<!-- ##### MACRO GST_PAD_FACTORY_REQUEST ##### -->
|
||||
<para>
|
||||
Indicates that this pad will be available on request. Use
|
||||
this in the factory definition.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_audiosink_sync_parms ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -2147,6 +2266,13 @@ This macro unsets the given state on the element.
|
|||
@pad:
|
||||
@id:
|
||||
|
||||
<!-- ##### MACRO GST_PAD_FACTORY_ALWAYS ##### -->
|
||||
<para>
|
||||
Indicate that this pad will always be available.
|
||||
Use this in the factory definition.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_pad_add_ghost_parent ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -2396,6 +2522,12 @@ Information about audio buffers.
|
|||
Take data in and spit data out
|
||||
|
||||
|
||||
<!-- ##### TYPEDEF GstPadFactory[] ##### -->
|
||||
<para>
|
||||
The padfactory.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_SRC_ASYNC ##### -->
|
||||
<para>
|
||||
This macro checks to see if the GST_SRC_ASYNC flag is set.
|
||||
|
@ -2409,6 +2541,12 @@ This macro checks to see if the GST_SRC_ASYNC flag is set.
|
|||
</para>
|
||||
|
||||
|
||||
<!-- ##### TYPEDEF GstCapsFactory ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### STRUCT GstFdSrcClass ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -2515,6 +2653,14 @@ Information about audio buffers.
|
|||
</para>
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gst_caps_register ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@factory:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### FUNCTION plugin_initialize ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -2561,6 +2707,13 @@ Specify the location of the file to read.
|
|||
GstAudioSrc
|
||||
|
||||
|
||||
<!-- ##### MACRO GST_PAD_FACTORY_SOMETIMES ##### -->
|
||||
<para>
|
||||
Indicate that this pad will become available depending
|
||||
on the media type. Use this in the factory definition.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO INFO ##### -->
|
||||
<para>
|
||||
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
<!-- ##### SECTION Title ##### -->
|
||||
videoraw
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Information about video buffers.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
Information about video buffers.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### STRUCT MetaVideoRaw ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@meta:
|
||||
@format:
|
||||
@visual:
|
||||
@width:
|
||||
@height:
|
||||
@overlay_info:
|
||||
@dga_info:
|
||||
|
||||
<!-- ##### STRUCT MetaDGA ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@base:
|
||||
@swidth:
|
||||
@sheight:
|
||||
@bytes_per_line:
|
||||
|
||||
<!-- ##### STRUCT MetaOverlay ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@wx:
|
||||
@wy:
|
||||
@overlay_element:
|
||||
@clip_count:
|
||||
@overlay_clip:
|
||||
@width:
|
||||
@height:
|
||||
@did_overlay:
|
||||
@fully_obscured:
|
||||
|
||||
<!-- ##### STRUCT OverlayClip ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@x1:
|
||||
@x2:
|
||||
@y1:
|
||||
@y2:
|
||||
|
|
@ -248,16 +248,16 @@ static gchar*
|
|||
gst_editor_props_show_func (GstPropsEntry *entry)
|
||||
{
|
||||
switch (entry->propstype) {
|
||||
case GST_PROPS_INT_ID_NUM:
|
||||
case GST_PROPS_INT_ID:
|
||||
return g_strdup_printf ("%d", entry->data.int_data);
|
||||
break;
|
||||
case GST_PROPS_INT_RANGE_ID_NUM:
|
||||
case GST_PROPS_INT_RANGE_ID:
|
||||
return g_strdup_printf ("%d-%d", entry->data.int_range_data.min, entry->data.int_range_data.max);
|
||||
break;
|
||||
case GST_PROPS_FOURCC_ID_NUM:
|
||||
case GST_PROPS_FOURCC_ID:
|
||||
return g_strdup_printf ("%4.4s", (gchar *)&entry->data.fourcc_data);
|
||||
break;
|
||||
case GST_PROPS_BOOL_ID_NUM:
|
||||
case GST_PROPS_BOOL_ID:
|
||||
return g_strdup_printf ("%s", (entry->data.bool_data ? "TRUE" : "FALSE"));
|
||||
break;
|
||||
default:
|
||||
|
@ -272,7 +272,7 @@ gst_editor_add_caps_to_tree (GstCaps *caps, GtkWidget *tree, GtkCTreeNode *padno
|
|||
if (caps) {
|
||||
GstProps *props = gst_caps_get_props (caps);
|
||||
if (props) {
|
||||
GSList *propslist = props->properties;
|
||||
GList *propslist = props->properties;
|
||||
|
||||
while (propslist) {
|
||||
gchar *data[2];
|
||||
|
@ -281,7 +281,7 @@ gst_editor_add_caps_to_tree (GstCaps *caps, GtkWidget *tree, GtkCTreeNode *padno
|
|||
data[0] = g_quark_to_string (entry->propid);
|
||||
|
||||
switch (entry->propstype) {
|
||||
case GST_PROPS_LIST_ID_NUM:
|
||||
case GST_PROPS_LIST_ID:
|
||||
{
|
||||
GList *list;
|
||||
guint count = 0;
|
||||
|
@ -303,7 +303,7 @@ gst_editor_add_caps_to_tree (GstCaps *caps, GtkWidget *tree, GtkCTreeNode *padno
|
|||
gtk_ctree_insert_node (GTK_CTREE (tree), padnode, NULL, data, 0,
|
||||
NULL, NULL, NULL, NULL, TRUE, TRUE);
|
||||
|
||||
propslist = g_slist_next (propslist);
|
||||
propslist = g_list_next (propslist);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -357,14 +357,14 @@ gst_editor_pads_create (GstEditorProperty *property, GstEditorElement *element)
|
|||
pads = gst_element_get_padtemplate_list(realelement);
|
||||
while (pads) {
|
||||
GstPadTemplate *templ = (GstPadTemplate *)pads->data;
|
||||
GList *caps = templ->caps;
|
||||
GstCaps *caps = templ->caps;
|
||||
gchar *mime;
|
||||
gchar *data[2];
|
||||
GtkCTreeNode *padnode;
|
||||
|
||||
if (caps) {
|
||||
GstType *type;
|
||||
type = gst_type_find_by_id (((GstCaps *)caps->data)->id);
|
||||
type = gst_type_find_by_id (((GstCaps *)caps)->id);
|
||||
mime = type->mime;
|
||||
}
|
||||
else {
|
||||
|
@ -377,11 +377,11 @@ gst_editor_pads_create (GstEditorProperty *property, GstEditorElement *element)
|
|||
NULL, NULL, NULL, NULL, FALSE, TRUE);
|
||||
|
||||
while (caps) {
|
||||
GstCaps *cap = (GstCaps *)caps->data;
|
||||
GstCaps *cap = (GstCaps *)caps;
|
||||
|
||||
gst_editor_add_caps_to_tree (cap, tree, padnode);
|
||||
|
||||
caps = g_list_next (caps);
|
||||
caps = (caps)->next;
|
||||
}
|
||||
|
||||
pads = g_list_next (pads);
|
||||
|
|
|
@ -57,34 +57,41 @@ enum {
|
|||
* can have. They can be quite complex, but for this example plugin
|
||||
* they are rather simple.
|
||||
*/
|
||||
static GstPadFactory sink_factory = {
|
||||
"sink", /* The name of the pad */
|
||||
GST_PAD_FACTORY_SINK, /* Direction of the pad */
|
||||
GST_PAD_FACTORY_ALWAYS, /* The pad exists for every instance */
|
||||
GST_PAD_FACTORY_CAPS( /* This factory has specific capabilities */
|
||||
"example_sink", /* The name of the caps */
|
||||
"unknown/unknown", /* The overall MIME/type */
|
||||
"foo", GST_PROPS_INT (1), /* An integer property */
|
||||
"bar", GST_PROPS_BOOLEAN (TRUE), /* A boolean */
|
||||
"baz", GST_PROPS_LIST ( /* A list of values for */
|
||||
GST_PROPS_INT (1),
|
||||
GST_PROPS_INT (3)
|
||||
)
|
||||
),
|
||||
NULL /* All factories must be NULL-terminated */
|
||||
};
|
||||
static GstPadTemplate*
|
||||
sink_factory (void)
|
||||
{
|
||||
return
|
||||
gst_padtemplate_new (
|
||||
"sink", /* The name of the pad */
|
||||
GST_PAD_SINK, /* Direction of the pad */
|
||||
GST_PAD_ALWAYS, /* The pad exists for every instance */
|
||||
gst_caps_new (
|
||||
"example_sink", /* The name of the caps */
|
||||
"unknown/unknown", /* The overall MIME/type */
|
||||
gst_props_new (
|
||||
"foo", GST_PROPS_INT (1), /* An integer property */
|
||||
"bar", GST_PROPS_BOOLEAN (TRUE), /* A boolean */
|
||||
"baz", GST_PROPS_LIST ( /* A list of values for */
|
||||
GST_PROPS_INT (1),
|
||||
GST_PROPS_INT (3)
|
||||
),
|
||||
NULL)));
|
||||
}
|
||||
|
||||
/* This factory is much simpler, and defines the source pad. */
|
||||
static GstPadFactory src_factory = {
|
||||
"src",
|
||||
GST_PAD_FACTORY_SRC,
|
||||
GST_PAD_FACTORY_ALWAYS,
|
||||
GST_PAD_FACTORY_CAPS(
|
||||
"example_src",
|
||||
"unknown/unknown"
|
||||
),
|
||||
NULL
|
||||
};
|
||||
static GstPadTemplate*
|
||||
src_factory (void)
|
||||
{
|
||||
return
|
||||
gst_padtemplate_new (
|
||||
"src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
gst_caps_new (
|
||||
"example_src",
|
||||
"unknown/unknown",
|
||||
NULL));
|
||||
}
|
||||
|
||||
|
||||
/* A number of functon prototypes are given so we can refer to them later. */
|
||||
|
@ -351,10 +358,10 @@ plugin_init (GModule *module)
|
|||
* Note that the generated padtemplates are stored in static global
|
||||
* variables, for the gst_example_init function to use later on.
|
||||
*/
|
||||
sink_template = gst_padtemplate_new (&sink_factory);
|
||||
sink_template = sink_factory ();
|
||||
gst_elementfactory_add_padtemplate (factory, sink_template);
|
||||
|
||||
src_template = gst_padtemplate_new (&src_factory);
|
||||
src_template = src_factory ();
|
||||
gst_elementfactory_add_padtemplate (factory, src_template);
|
||||
|
||||
/* The very last thing is to register the elementfactory with the plugin. */
|
||||
|
|
|
@ -45,13 +45,17 @@ enum {
|
|||
/* FILL ME */
|
||||
};
|
||||
|
||||
static GstPadFactory tee_src_factory = {
|
||||
"src%d",
|
||||
GST_PAD_FACTORY_SRC,
|
||||
GST_PAD_FACTORY_REQUEST,
|
||||
NULL, /* no caps */
|
||||
NULL,
|
||||
};
|
||||
static GstPadTemplate*
|
||||
tee_src_factory_create (void)
|
||||
{
|
||||
return
|
||||
gst_padtemplate_new (
|
||||
"src%d",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_REQUEST,
|
||||
NULL /* no caps */
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
static void gst_tee_class_init (GstTeeClass *klass);
|
||||
|
@ -197,7 +201,7 @@ gst_tee_chain (GstPad *pad, GstBuffer *buf)
|
|||
gboolean
|
||||
gst_tee_factory_init (GstElementFactory *factory)
|
||||
{
|
||||
gst_tee_src_template = gst_padtemplate_new (&tee_src_factory);
|
||||
gst_tee_src_template = tee_src_factory_create ();
|
||||
gst_elementfactory_add_padtemplate (factory, gst_tee_src_template);
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -62,13 +62,14 @@ get_type_for_mime (const gchar *mime)
|
|||
* gst_caps_new:
|
||||
* @name: the name of this capability
|
||||
* @mime: the mime type to attach to the capability
|
||||
* @props: the properties to add to this capability
|
||||
*
|
||||
* Create a new capability with the given mime type.
|
||||
* Create a new capability with the given mime typei and properties.
|
||||
*
|
||||
* Returns: a new capability
|
||||
*/
|
||||
GstCaps*
|
||||
gst_caps_new (const gchar *name, const gchar *mime)
|
||||
gst_caps_new (const gchar *name, const gchar *mime, GstProps *props)
|
||||
{
|
||||
GstCaps *caps;
|
||||
|
||||
|
@ -80,7 +81,7 @@ gst_caps_new (const gchar *name, const gchar *mime)
|
|||
|
||||
caps->name = g_strdup (name);
|
||||
caps->id = get_type_for_mime (mime);
|
||||
caps->properties = NULL;
|
||||
caps->properties = props;
|
||||
caps->next = NULL;
|
||||
caps->refcount = 1;
|
||||
caps->lock = g_mutex_new ();
|
||||
|
@ -88,78 +89,6 @@ gst_caps_new (const gchar *name, const gchar *mime)
|
|||
return caps;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_caps_new_with_props:
|
||||
* @name: the name of this capability
|
||||
* @mime: the mime type to attach to the capability
|
||||
* @props: the properties for this capability
|
||||
*
|
||||
* Create a new capability with the given mime type and the given properties.
|
||||
*
|
||||
* Returns: a new capability
|
||||
*/
|
||||
GstCaps*
|
||||
gst_caps_new_with_props (const gchar *name, const gchar *mime, GstProps *props)
|
||||
{
|
||||
GstCaps *caps;
|
||||
|
||||
caps = gst_caps_new (name, mime);
|
||||
caps->properties = props;
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_caps_register:
|
||||
* @factory: the factory to register
|
||||
*
|
||||
* Register the factory.
|
||||
*
|
||||
* Returns: the registered capability
|
||||
*/
|
||||
GstCaps*
|
||||
gst_caps_register (GstCapsFactory *factory)
|
||||
{
|
||||
guint dummy;
|
||||
|
||||
return gst_caps_register_count (factory, &dummy);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_caps_register_count:
|
||||
* @factory: the factory to register
|
||||
* @counter: count how many entries were consumed
|
||||
*
|
||||
* Register the factory.
|
||||
*
|
||||
* Returns: the registered capability
|
||||
*/
|
||||
GstCaps*
|
||||
gst_caps_register_count (GstCapsFactory *factory, guint *counter)
|
||||
{
|
||||
GstCapsFactoryEntry tag;
|
||||
gint i = 0;
|
||||
gchar *name;
|
||||
GstCaps *caps;
|
||||
|
||||
g_return_val_if_fail (factory != NULL, NULL);
|
||||
|
||||
tag = (*factory)[i++];
|
||||
g_return_val_if_fail (tag != NULL, NULL);
|
||||
|
||||
name = tag;
|
||||
|
||||
tag = (*factory)[i++];
|
||||
g_return_val_if_fail (tag != NULL, NULL);
|
||||
|
||||
caps = gst_caps_new_with_props (name, (gchar *)tag,
|
||||
gst_props_register_count (&(*factory)[i], counter));
|
||||
|
||||
*counter += 2;
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_caps_destroy:
|
||||
* @caps: the caps to destroy
|
||||
|
@ -244,7 +173,7 @@ gst_caps_copy (GstCaps *caps)
|
|||
g_return_val_if_fail (caps != NULL, NULL);
|
||||
|
||||
GST_CAPS_LOCK (caps);
|
||||
new = gst_caps_new_with_props (
|
||||
new = gst_caps_new (
|
||||
caps->name,
|
||||
(gst_type_find_by_id (caps->id))->mime,
|
||||
gst_props_copy (caps->properties));
|
||||
|
|
|
@ -36,12 +36,6 @@
|
|||
#include <gst/gstprops.h>
|
||||
|
||||
typedef struct _GstCaps GstCaps;
|
||||
typedef gpointer GstCapsFactoryEntry;
|
||||
#ifdef __cplusplus
|
||||
typedef GstCapsFactoryEntry * GstCapsFactory;
|
||||
#else // C++ was unable to compile with this
|
||||
typedef GstCapsFactoryEntry GstCapsFactory[];
|
||||
#endif
|
||||
|
||||
#define GST_CAPS(caps) \
|
||||
((GstCaps *)(caps))
|
||||
|
@ -65,10 +59,7 @@ struct _GstCaps {
|
|||
/* initialize the subsystem */
|
||||
void _gst_caps_initialize (void);
|
||||
|
||||
GstCaps* gst_caps_new (const gchar *name, const gchar *mime);
|
||||
GstCaps* gst_caps_new_with_props (const gchar *name, const gchar *mime, GstProps *props);
|
||||
GstCaps* gst_caps_register (GstCapsFactory *factory);
|
||||
GstCaps* gst_caps_register_count (GstCapsFactory *factory, guint *counter);
|
||||
GstCaps* gst_caps_new (const gchar *name, const gchar *mime, GstProps *props);
|
||||
|
||||
void gst_caps_unref (GstCaps *caps);
|
||||
void gst_caps_ref (GstCaps *caps);
|
||||
|
|
63
gst/gstpad.c
63
gst/gstpad.c
|
@ -1396,48 +1396,6 @@ gst_padtemplate_init (GstPadTemplate *templ)
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_padtemplate_new:
|
||||
* @factory: the padfactory to use
|
||||
*
|
||||
* Creates a new padtemplate from the factory.
|
||||
*
|
||||
* Returns: the new padtemplate
|
||||
*/
|
||||
GstPadTemplate*
|
||||
gst_padtemplate_new (GstPadFactory *factory)
|
||||
{
|
||||
GstPadTemplate *new;
|
||||
GstPadFactoryEntry tag;
|
||||
gint i = 0;
|
||||
guint counter = 0;
|
||||
|
||||
g_return_val_if_fail (factory != NULL, NULL);
|
||||
|
||||
new = gtk_type_new (gst_padtemplate_get_type ());
|
||||
|
||||
tag = (*factory)[i++];
|
||||
g_return_val_if_fail (tag != NULL, new);
|
||||
new->name_template = g_strdup ((gchar *)tag);
|
||||
|
||||
tag = (*factory)[i++];
|
||||
new->direction = GPOINTER_TO_UINT (tag);
|
||||
|
||||
tag = (*factory)[i++];
|
||||
new->presence = GPOINTER_TO_UINT (tag);
|
||||
|
||||
tag = (*factory)[i++];
|
||||
|
||||
while (GPOINTER_TO_INT (tag) == GST_PAD_FACTORY_CAPS_ID) {
|
||||
GST_PADTEMPLATE_CAPS (new) = gst_caps_append (GST_PADTEMPLATE_CAPS (new),
|
||||
gst_caps_register_count ((GstCapsFactory *)&(*factory)[i], &counter));
|
||||
i+=counter;
|
||||
tag = (*factory)[i++];
|
||||
}
|
||||
|
||||
return new;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_padtemplate_create:
|
||||
* @name_template: the name template
|
||||
|
@ -1450,11 +1408,13 @@ gst_padtemplate_new (GstPadFactory *factory)
|
|||
* Returns: the new padtemplate
|
||||
*/
|
||||
GstPadTemplate*
|
||||
gst_padtemplate_create (gchar *name_template,
|
||||
GstPadDirection direction, GstPadPresence presence,
|
||||
GstCaps *caps)
|
||||
gst_padtemplate_new (gchar *name_template,
|
||||
GstPadDirection direction, GstPadPresence presence,
|
||||
GstCaps *caps, ...)
|
||||
{
|
||||
GstPadTemplate *new;
|
||||
va_list var_args;
|
||||
GstCaps *thecaps = NULL;
|
||||
|
||||
g_return_val_if_fail (name_template != NULL, NULL);
|
||||
|
||||
|
@ -1463,7 +1423,16 @@ gst_padtemplate_create (gchar *name_template,
|
|||
GST_PADTEMPLATE_NAME_TEMPLATE (new) = name_template;
|
||||
GST_PADTEMPLATE_DIRECTION (new) = direction;
|
||||
GST_PADTEMPLATE_PRESENCE (new) = presence;
|
||||
GST_PADTEMPLATE_CAPS (new) = caps;
|
||||
|
||||
va_start (var_args, caps);
|
||||
|
||||
while (caps) {
|
||||
thecaps = gst_caps_append (thecaps, caps);
|
||||
caps = va_arg (var_args, GstCaps*);
|
||||
}
|
||||
va_end (var_args);
|
||||
|
||||
GST_PADTEMPLATE_CAPS (new) = thecaps;
|
||||
|
||||
return new;
|
||||
}
|
||||
|
@ -1581,7 +1550,7 @@ gst_padtemplate_load_thyself (xmlNodePtr parent)
|
|||
field = field->next;
|
||||
}
|
||||
|
||||
factory = gst_padtemplate_create (name_template, direction, presence, caps);
|
||||
factory = gst_padtemplate_new (name_template, direction, presence, caps, NULL);
|
||||
|
||||
return factory;
|
||||
}
|
||||
|
|
20
gst/gstpad.h
20
gst/gstpad.h
|
@ -253,21 +253,6 @@ struct _GstPadTemplateClass {
|
|||
};
|
||||
|
||||
|
||||
/* factory */
|
||||
typedef gpointer GstPadFactoryEntry;
|
||||
typedef GstPadFactoryEntry GstPadFactory[];
|
||||
|
||||
#define GST_PAD_FACTORY_ALWAYS GINT_TO_POINTER(GST_PAD_ALWAYS)
|
||||
#define GST_PAD_FACTORY_SOMETIMES GINT_TO_POINTER(GST_PAD_SOMETIMES)
|
||||
#define GST_PAD_FACTORY_REQUEST GINT_TO_POINTER(GST_PAD_REQUEST)
|
||||
|
||||
#define GST_PAD_FACTORY_SRC GINT_TO_POINTER(GST_PAD_SRC)
|
||||
#define GST_PAD_FACTORY_SINK GINT_TO_POINTER(GST_PAD_SINK)
|
||||
|
||||
#define GST_PAD_FACTORY_CAPS_ID 1
|
||||
#define GST_PAD_FACTORY_CAPS(a...) GINT_TO_POINTER(GST_PAD_FACTORY_CAPS_ID),##a,NULL
|
||||
|
||||
|
||||
GtkType gst_pad_get_type (void);
|
||||
GtkType gst_real_pad_get_type (void);
|
||||
GtkType gst_ghost_pad_get_type (void);
|
||||
|
@ -348,10 +333,9 @@ GstPad * gst_ghost_pad_new (gchar *name,GstPad *pad);
|
|||
/* templates and factories */
|
||||
GtkType gst_padtemplate_get_type (void);
|
||||
|
||||
GstPadTemplate* gst_padtemplate_new (GstPadFactory *factory);
|
||||
GstPadTemplate* gst_padtemplate_create (gchar *name_template,
|
||||
GstPadTemplate* gst_padtemplate_new (gchar *name_template,
|
||||
GstPadDirection direction, GstPadPresence presence,
|
||||
GstCaps *caps);
|
||||
GstCaps *caps, ...);
|
||||
|
||||
GstCaps* gst_padtemplate_get_caps (GstPadTemplate *templ);
|
||||
GstCaps* gst_padtemplate_get_caps_by_name (GstPadTemplate *templ, const gchar *name);
|
||||
|
|
|
@ -364,6 +364,8 @@ gst_plugin_load_absolute (const gchar *name)
|
|||
module = g_module_open(name,G_MODULE_BIND_LAZY);
|
||||
if (module != NULL) {
|
||||
if (g_module_symbol(module,"plugin_init",(gpointer *)&initfunc)) {
|
||||
GST_INFO (GST_CAT_PLUGIN_LOADING,"loading plugin \"%s\"...",
|
||||
name);
|
||||
if ((plugin = (initfunc)(module))) {
|
||||
GST_INFO (GST_CAT_PLUGIN_LOADING,"plugin \"%s\" loaded: %d elements, %d types",
|
||||
plugin->name,plugin->numelements,plugin->numtypes);
|
||||
|
|
468
gst/gstprops.c
468
gst/gstprops.c
|
@ -34,18 +34,6 @@ static GMutex *_gst_props_chunk_lock;
|
|||
|
||||
static gboolean gst_props_entry_check_compatibility (GstPropsEntry *entry1, GstPropsEntry *entry2);
|
||||
|
||||
static guint _arg_len[] = {
|
||||
0, // GST_PROPS_END_ID_NUM = 0,
|
||||
0, // GST_PROPS_LIST_ID_NUM,
|
||||
1, // GST_PROPS_INT_ID_NUM,
|
||||
2, // GST_PROPS_INT_RANGE_ID_NUM,
|
||||
1, // GST_PROPS_FLOAT_ID_NUM,
|
||||
2, // GST_PROPS_FLOAT_RANGE_ID_NUM,
|
||||
1, // GST_PROPS_FOURCC_ID_NUM,
|
||||
1, // GST_PROPS_BOOL_ID_NUM,
|
||||
1, // GST_PROPS_STRING_ID_NUM,
|
||||
};
|
||||
|
||||
void
|
||||
_gst_props_initialize (void)
|
||||
{
|
||||
|
@ -67,16 +55,16 @@ gst_props_debug_entry (GstPropsEntry *entry)
|
|||
case GST_PROPS_INT_ID:
|
||||
GST_DEBUG (0, "%d\n", entry->data.int_data);
|
||||
break;
|
||||
case GST_PROPS_FOURCC_ID_NUM:
|
||||
case GST_PROPS_FOURCC_ID:
|
||||
GST_DEBUG (0, "%4.4s\n", (gchar*)&entry->data.fourcc_data);
|
||||
break;
|
||||
case GST_PROPS_BOOL_ID_NUM:
|
||||
case GST_PROPS_BOOL_ID:
|
||||
GST_DEBUG (0, "%d\n", entry->data.bool_data);
|
||||
break;
|
||||
case GST_PROPS_STRING_ID_NUM:
|
||||
case GST_PROPS_STRING_ID:
|
||||
GST_DEBUG (0, "%s\n", entry->data.string_data.string);
|
||||
break;
|
||||
case GST_PROPS_INT_RANGE_ID_NUM:
|
||||
case GST_PROPS_INT_RANGE_ID:
|
||||
GST_DEBUG (0, "%d-%d\n", entry->data.int_range_data.min,
|
||||
entry->data.int_range_data.max);
|
||||
break;
|
||||
|
@ -85,67 +73,6 @@ gst_props_debug_entry (GstPropsEntry *entry)
|
|||
}
|
||||
}
|
||||
|
||||
static GstPropsEntry*
|
||||
gst_props_create_entry (GstPropsFactory factory, gint *skipped)
|
||||
{
|
||||
GstPropsFactoryEntry tag;
|
||||
GstPropsEntry *entry;
|
||||
guint i=0;
|
||||
|
||||
g_mutex_lock (_gst_props_entries_chunk_lock);
|
||||
entry = g_mem_chunk_alloc (_gst_props_entries_chunk);
|
||||
g_mutex_unlock (_gst_props_entries_chunk_lock);
|
||||
|
||||
tag = factory[i++];
|
||||
switch (GPOINTER_TO_INT (tag)) {
|
||||
case GST_PROPS_INT_ID_NUM:
|
||||
entry->propstype = GST_PROPS_INT_ID_NUM;
|
||||
entry->data.int_data = GPOINTER_TO_INT (factory[i++]);
|
||||
break;
|
||||
case GST_PROPS_INT_RANGE_ID_NUM:
|
||||
entry->propstype = GST_PROPS_INT_RANGE_ID_NUM;
|
||||
entry->data.int_range_data.min = GPOINTER_TO_INT (factory[i++]);
|
||||
entry->data.int_range_data.max = GPOINTER_TO_INT (factory[i++]);
|
||||
break;
|
||||
case GST_PROPS_FLOAT_ID_NUM:
|
||||
entry->propstype = GST_PROPS_FLOAT_ID_NUM;
|
||||
entry->data.float_data = *(gfloat*)factory[i++];
|
||||
break;
|
||||
case GST_PROPS_FLOAT_RANGE_ID_NUM:
|
||||
entry->propstype = GST_PROPS_FLOAT_RANGE_ID_NUM;
|
||||
entry->data.float_range_data.min = *(gfloat*)factory[i++];
|
||||
entry->data.float_range_data.max = *(gfloat*)factory[i++];
|
||||
break;
|
||||
case GST_PROPS_FOURCC_ID_NUM:
|
||||
entry->propstype = GST_PROPS_FOURCC_ID_NUM;
|
||||
entry->data.fourcc_data = GPOINTER_TO_INT (factory[i++]);
|
||||
break;
|
||||
case GST_PROPS_LIST_ID_NUM:
|
||||
g_warning ("gstprops: list not allowed in list\n");
|
||||
break;
|
||||
case GST_PROPS_BOOL_ID_NUM:
|
||||
entry->propstype = GST_PROPS_BOOL_ID_NUM;
|
||||
entry->data.bool_data = GPOINTER_TO_INT (factory[i++]);
|
||||
break;
|
||||
case GST_PROPS_STRING_ID_NUM:
|
||||
entry->propstype = GST_PROPS_STRING_ID_NUM;
|
||||
entry->data.string_data.string = g_strdup (factory[i++]);
|
||||
break;
|
||||
default:
|
||||
g_warning ("gstprops: unknown props id found\n");
|
||||
g_mutex_lock (_gst_props_entries_chunk_lock);
|
||||
g_mem_chunk_free (_gst_props_entries_chunk, entry);
|
||||
g_mutex_unlock (_gst_props_entries_chunk_lock);
|
||||
entry = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
*skipped = i;
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
||||
static gint
|
||||
props_compare_func (gconstpointer a,
|
||||
gconstpointer b)
|
||||
|
@ -166,184 +93,139 @@ props_find_func (gconstpointer a,
|
|||
return (entry1 - entry2->propid);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_props_register:
|
||||
* @factory: the factory to register
|
||||
*
|
||||
* Register the factory.
|
||||
*
|
||||
* Returns: the new property created from the factory
|
||||
*/
|
||||
GstProps *
|
||||
gst_props_register (GstPropsFactory factory)
|
||||
static void
|
||||
gst_props_entry_fill (GstPropsEntry *entry, va_list *var_args)
|
||||
{
|
||||
guint dummy;
|
||||
entry->propstype = va_arg (*var_args, GstPropsId);
|
||||
|
||||
return gst_props_register_count (factory, &dummy);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_props_register_count:
|
||||
* @factory: the factory to register
|
||||
* @counter: count how many fields were consumed
|
||||
*
|
||||
* Register the factory.
|
||||
*
|
||||
* Returns: the new property created from the factory
|
||||
*/
|
||||
GstProps *
|
||||
gst_props_register_count (GstPropsFactory factory, guint *counter)
|
||||
{
|
||||
GstPropsFactoryEntry tag;
|
||||
gint i = 0;
|
||||
GstProps *props = NULL;
|
||||
gint skipped;
|
||||
|
||||
g_return_val_if_fail (factory != NULL, NULL);
|
||||
|
||||
tag = factory[i++];
|
||||
|
||||
if (!tag) goto end;
|
||||
|
||||
g_mutex_lock (_gst_props_chunk_lock);
|
||||
props = g_mem_chunk_alloc (_gst_props_chunk);
|
||||
g_mutex_unlock (_gst_props_chunk_lock);
|
||||
|
||||
g_return_val_if_fail (props != NULL, NULL);
|
||||
|
||||
props->properties = NULL;
|
||||
props->refcount = 1;
|
||||
|
||||
while (tag) {
|
||||
GQuark quark;
|
||||
GstPropsEntry *entry;
|
||||
|
||||
if (tag < GST_PROPS_LAST_ID) {
|
||||
g_warning ("properties seem to be wrong\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
quark = g_quark_from_string ((gchar *)tag);
|
||||
|
||||
tag = factory[i];
|
||||
switch (GPOINTER_TO_INT (tag)) {
|
||||
case GST_PROPS_LIST_ID_NUM:
|
||||
{
|
||||
GstPropsEntry *list_entry;
|
||||
|
||||
g_mutex_lock (_gst_props_entries_chunk_lock);
|
||||
entry = g_mem_chunk_alloc (_gst_props_entries_chunk);
|
||||
g_mutex_unlock (_gst_props_entries_chunk_lock);
|
||||
|
||||
entry->propid = quark;
|
||||
entry->propstype = GST_PROPS_LIST_ID_NUM;
|
||||
entry->data.list_data.entries = NULL;
|
||||
|
||||
i++; // skip list tag
|
||||
tag = factory[i];
|
||||
while (tag) {
|
||||
list_entry = gst_props_create_entry (&factory[i], &skipped);
|
||||
list_entry->propid = quark;
|
||||
i += skipped;
|
||||
tag = factory[i];
|
||||
entry->data.list_data.entries = g_list_prepend (entry->data.list_data.entries, list_entry);
|
||||
}
|
||||
entry->data.list_data.entries = g_list_reverse (entry->data.list_data.entries);
|
||||
i++; //skip NULL (list end)
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
entry = gst_props_create_entry (&factory[i], &skipped);
|
||||
entry->propid = quark;
|
||||
i += skipped;
|
||||
break;
|
||||
}
|
||||
}
|
||||
props->properties = g_list_insert_sorted (props->properties, entry, props_compare_func);
|
||||
|
||||
tag = factory[i++];
|
||||
switch (entry->propstype) {
|
||||
case GST_PROPS_INT_ID:
|
||||
entry->data.int_data = va_arg (*var_args, gint);
|
||||
break;
|
||||
case GST_PROPS_INT_RANGE_ID:
|
||||
entry->data.int_range_data.min = va_arg (*var_args, gint);
|
||||
entry->data.int_range_data.max = va_arg (*var_args, gint);
|
||||
break;
|
||||
case GST_PROPS_FLOAT_ID:
|
||||
entry->data.float_data = va_arg (*var_args, gfloat);
|
||||
break;
|
||||
case GST_PROPS_FLOAT_RANGE_ID:
|
||||
entry->data.float_range_data.min = va_arg (*var_args, gfloat);
|
||||
entry->data.float_range_data.max = va_arg (*var_args, gfloat);
|
||||
break;
|
||||
case GST_PROPS_FOURCC_ID:
|
||||
entry->data.fourcc_data = va_arg (*var_args, gulong);
|
||||
break;
|
||||
case GST_PROPS_BOOL_ID:
|
||||
entry->data.bool_data = va_arg (*var_args, gboolean);
|
||||
break;
|
||||
case GST_PROPS_STRING_ID:
|
||||
entry->data.string_data.string = g_strdup (va_arg (*var_args, gchar*));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
end:
|
||||
*counter = i;
|
||||
|
||||
return props;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_props_new:
|
||||
* @entry: the property entries for the property
|
||||
* @...: the property entries for the property
|
||||
* @firstname: the first property name
|
||||
* @...: the property values
|
||||
*
|
||||
* Create a new property from the given key/value pairs
|
||||
*
|
||||
* Returns: the new property
|
||||
*/
|
||||
GstProps*
|
||||
gst_props_new (const gchar *firstname, ...)
|
||||
{
|
||||
GstProps *props;
|
||||
va_list var_args;
|
||||
|
||||
va_start (var_args, firstname);
|
||||
|
||||
props = gst_props_newv (firstname, var_args);
|
||||
|
||||
va_end (var_args);
|
||||
|
||||
return props;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_props_newv:
|
||||
* @firstname: the first property name
|
||||
* @var_args: the property values
|
||||
*
|
||||
* Create a new property from the list of entries.
|
||||
*
|
||||
* Returns: the new property created from the list of entries
|
||||
*/
|
||||
GstProps*
|
||||
gst_props_new (GstPropsFactoryEntry entry, ...)
|
||||
gst_props_newv (const gchar *firstname, va_list var_args)
|
||||
{
|
||||
va_list var_args;
|
||||
GstPropsFactoryEntry value;
|
||||
gint i = 0;
|
||||
gint size, skip;
|
||||
GstPropsFactoryEntry *factory;
|
||||
gboolean inlist = FALSE;
|
||||
GstProps *props;
|
||||
gboolean inlist = FALSE;
|
||||
const gchar *prop_name;
|
||||
GstPropsEntry *list_entry = NULL;
|
||||
|
||||
#define add_value(value) {\
|
||||
GST_DEBUG (0,"%d %p\n", i, value);\
|
||||
factory[i++] = value; \
|
||||
if (i >= size) { \
|
||||
size += 16; \
|
||||
factory = (GstPropsFactoryEntry *) g_realloc (factory, size*sizeof(GstPropsFactoryEntry));\
|
||||
}\
|
||||
}
|
||||
g_mutex_lock (_gst_props_chunk_lock);
|
||||
props = g_mem_chunk_alloc (_gst_props_chunk);
|
||||
g_mutex_unlock (_gst_props_chunk_lock);
|
||||
|
||||
size = 16;
|
||||
factory = (GstPropsFactoryEntry *) g_malloc (size*sizeof(GstPropsFactoryEntry));
|
||||
props->properties = NULL;
|
||||
props->refcount = 1;
|
||||
|
||||
prop_name = firstname;
|
||||
|
||||
va_start (var_args, entry);
|
||||
// property name
|
||||
value = (GstPropsFactoryEntry) entry;
|
||||
|
||||
// properties
|
||||
while (value) {
|
||||
if (!inlist) {
|
||||
// add name
|
||||
add_value (value);
|
||||
while (prop_name) {
|
||||
GstPropsEntry *entry;
|
||||
|
||||
g_mutex_lock (_gst_props_entries_chunk_lock);
|
||||
entry = g_mem_chunk_alloc (_gst_props_entries_chunk);
|
||||
g_mutex_unlock (_gst_props_entries_chunk_lock);
|
||||
|
||||
// get value
|
||||
value = va_arg (var_args, GstPropsFactoryEntry);
|
||||
}
|
||||
switch (GPOINTER_TO_INT (value)) {
|
||||
case GST_PROPS_END_ID_NUM:
|
||||
g_assert (inlist == TRUE);
|
||||
entry->propid = g_quark_from_string (prop_name);
|
||||
gst_props_entry_fill (entry, &var_args);
|
||||
|
||||
inlist = FALSE;
|
||||
skip = 0;
|
||||
switch (entry->propstype) {
|
||||
case GST_PROPS_INT_ID:
|
||||
case GST_PROPS_INT_RANGE_ID:
|
||||
case GST_PROPS_FLOAT_ID:
|
||||
case GST_PROPS_FLOAT_RANGE_ID:
|
||||
case GST_PROPS_FOURCC_ID:
|
||||
case GST_PROPS_BOOL_ID:
|
||||
case GST_PROPS_STRING_ID:
|
||||
break;
|
||||
case GST_PROPS_LIST_ID_NUM:
|
||||
{
|
||||
g_assert (inlist == FALSE);
|
||||
|
||||
skip = 0;
|
||||
case GST_PROPS_LIST_ID:
|
||||
g_return_val_if_fail (inlist == FALSE, NULL);
|
||||
inlist = TRUE;
|
||||
list_entry = entry;
|
||||
list_entry->data.list_data.entries = NULL;
|
||||
break;
|
||||
}
|
||||
case GST_PROPS_END_ID:
|
||||
g_return_val_if_fail (inlist == TRUE, NULL);
|
||||
inlist = FALSE;
|
||||
list_entry = NULL;
|
||||
prop_name = va_arg (var_args, gchar*);
|
||||
continue;
|
||||
default:
|
||||
skip = _arg_len[GPOINTER_TO_INT (value)];
|
||||
break;
|
||||
g_mutex_lock (_gst_props_entries_chunk_lock);
|
||||
g_mem_chunk_free (_gst_props_entries_chunk, entry);
|
||||
g_mutex_unlock (_gst_props_entries_chunk_lock);
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
do {
|
||||
add_value (value);
|
||||
value = va_arg (var_args, GstPropsFactoryEntry);
|
||||
}
|
||||
while (skip--);
|
||||
}
|
||||
factory[i++] = NULL;
|
||||
|
||||
props = gst_props_register (factory);
|
||||
if (inlist && (list_entry != entry)) {
|
||||
list_entry->data.list_data.entries = g_list_prepend (list_entry->data.list_data.entries, entry);
|
||||
}
|
||||
else {
|
||||
props->properties = g_list_insert_sorted (props->properties, entry, props_compare_func);
|
||||
}
|
||||
if (!inlist)
|
||||
prop_name = va_arg (var_args, gchar*);
|
||||
}
|
||||
|
||||
return props;
|
||||
}
|
||||
|
@ -352,7 +234,6 @@ gst_props_new (GstPropsFactoryEntry entry, ...)
|
|||
* gst_props_set:
|
||||
* @props: the props to modify
|
||||
* @name: the name of the entry to modify
|
||||
* @entry: The new value of the property entry
|
||||
* @...: More property entries.
|
||||
*
|
||||
* Modifies the value of the given entry in the props struct.
|
||||
|
@ -360,7 +241,7 @@ gst_props_new (GstPropsFactoryEntry entry, ...)
|
|||
* Returns: the new modified property structure.
|
||||
*/
|
||||
GstProps*
|
||||
gst_props_set (GstProps *props, const gchar *name, GstPropsFactoryEntry entry, ...)
|
||||
gst_props_set (GstProps *props, const gchar *name, ...)
|
||||
{
|
||||
GQuark quark;
|
||||
GList *lentry;
|
||||
|
@ -371,45 +252,15 @@ gst_props_set (GstProps *props, const gchar *name, GstPropsFactoryEntry entry, .
|
|||
lentry = g_list_find_custom (props->properties, GINT_TO_POINTER (quark), props_find_func);
|
||||
|
||||
if (lentry) {
|
||||
GstPropsEntry *thisentry;
|
||||
GstPropsFactoryEntry value;
|
||||
GstPropsEntry *entry;
|
||||
|
||||
thisentry = (GstPropsEntry *)lentry->data;
|
||||
entry = (GstPropsEntry *)lentry->data;
|
||||
|
||||
va_start (var_args, entry);
|
||||
// property name
|
||||
value = (GstPropsFactoryEntry) entry;
|
||||
va_start (var_args, name);
|
||||
|
||||
switch (GPOINTER_TO_INT (value)) {
|
||||
case GST_PROPS_INT_ID:
|
||||
thisentry->propstype = GST_PROPS_INT_ID_NUM;
|
||||
value = va_arg (var_args, GstPropsFactoryEntry);
|
||||
thisentry->data.int_data = GPOINTER_TO_INT (value);
|
||||
break;
|
||||
case GST_PROPS_FLOAT_ID:
|
||||
thisentry->propstype = GST_PROPS_FLOAT_ID_NUM;
|
||||
value = va_arg (var_args, GstPropsFactoryEntry);
|
||||
thisentry->data.float_data = *(gfloat*)value;
|
||||
break;
|
||||
case GST_PROPS_FOURCC_ID_NUM:
|
||||
thisentry->propstype = GST_PROPS_FOURCC_ID_NUM;
|
||||
value = va_arg (var_args, GstPropsFactoryEntry);
|
||||
thisentry->data.fourcc_data = GPOINTER_TO_INT (value);
|
||||
break;
|
||||
case GST_PROPS_BOOL_ID_NUM:
|
||||
thisentry->propstype = GST_PROPS_BOOL_ID_NUM;
|
||||
value = va_arg (var_args, GstPropsFactoryEntry);
|
||||
thisentry->data.bool_data = GPOINTER_TO_INT (value);
|
||||
break;
|
||||
case GST_PROPS_STRING_ID_NUM:
|
||||
thisentry->propstype = GST_PROPS_STRING_ID_NUM;
|
||||
value = va_arg (var_args, GstPropsFactoryEntry);
|
||||
thisentry->data.string_data.string = g_strdup (value);
|
||||
break;
|
||||
default:
|
||||
g_print("gstprops: type not allowed\n");
|
||||
break;
|
||||
}
|
||||
gst_props_entry_fill (entry, &var_args);
|
||||
|
||||
va_end (var_args);
|
||||
}
|
||||
else {
|
||||
g_print("gstprops: no property '%s' to change\n", name);
|
||||
|
@ -736,7 +587,7 @@ gst_props_entry_check_compatibility (GstPropsEntry *entry1, GstPropsEntry *entry
|
|||
GST_DEBUG (0,"compare: %s %s\n", g_quark_to_string (entry1->propid),
|
||||
g_quark_to_string (entry2->propid));
|
||||
switch (entry1->propstype) {
|
||||
case GST_PROPS_LIST_ID_NUM:
|
||||
case GST_PROPS_LIST_ID:
|
||||
{
|
||||
GList *entrylist = entry1->data.list_data.entries;
|
||||
gboolean valid = TRUE; // innocent until proven guilty
|
||||
|
@ -751,90 +602,90 @@ gst_props_entry_check_compatibility (GstPropsEntry *entry1, GstPropsEntry *entry
|
|||
|
||||
return valid;
|
||||
}
|
||||
case GST_PROPS_INT_RANGE_ID_NUM:
|
||||
case GST_PROPS_INT_RANGE_ID:
|
||||
switch (entry2->propstype) {
|
||||
// a - b <---> a - c
|
||||
case GST_PROPS_INT_RANGE_ID_NUM:
|
||||
case GST_PROPS_INT_RANGE_ID:
|
||||
return (entry2->data.int_range_data.min <= entry1->data.int_range_data.min &&
|
||||
entry2->data.int_range_data.max >= entry1->data.int_range_data.max);
|
||||
case GST_PROPS_LIST_ID_NUM:
|
||||
case GST_PROPS_LIST_ID:
|
||||
return gst_props_entry_check_list_compatibility (entry1, entry2);
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case GST_PROPS_FLOAT_RANGE_ID_NUM:
|
||||
case GST_PROPS_FLOAT_RANGE_ID:
|
||||
switch (entry2->propstype) {
|
||||
// a - b <---> a - c
|
||||
case GST_PROPS_FLOAT_RANGE_ID_NUM:
|
||||
case GST_PROPS_FLOAT_RANGE_ID:
|
||||
return (entry2->data.float_range_data.min <= entry1->data.float_range_data.min &&
|
||||
entry2->data.float_range_data.max >= entry1->data.float_range_data.max);
|
||||
case GST_PROPS_LIST_ID_NUM:
|
||||
case GST_PROPS_LIST_ID:
|
||||
return gst_props_entry_check_list_compatibility (entry1, entry2);
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case GST_PROPS_FOURCC_ID_NUM:
|
||||
case GST_PROPS_FOURCC_ID:
|
||||
switch (entry2->propstype) {
|
||||
// b <---> a
|
||||
case GST_PROPS_FOURCC_ID_NUM:
|
||||
case GST_PROPS_FOURCC_ID:
|
||||
return (entry2->data.fourcc_data == entry1->data.fourcc_data);
|
||||
// b <---> a,b,c
|
||||
case GST_PROPS_LIST_ID_NUM:
|
||||
case GST_PROPS_LIST_ID:
|
||||
return gst_props_entry_check_list_compatibility (entry1, entry2);
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case GST_PROPS_INT_ID_NUM:
|
||||
case GST_PROPS_INT_ID:
|
||||
switch (entry2->propstype) {
|
||||
// b <---> a - d
|
||||
case GST_PROPS_INT_RANGE_ID_NUM:
|
||||
case GST_PROPS_INT_RANGE_ID:
|
||||
return (entry2->data.int_range_data.min <= entry1->data.int_data &&
|
||||
entry2->data.int_range_data.max >= entry1->data.int_data);
|
||||
// b <---> a
|
||||
case GST_PROPS_INT_ID_NUM:
|
||||
case GST_PROPS_INT_ID:
|
||||
return (entry2->data.int_data == entry1->data.int_data);
|
||||
// b <---> a,b,c
|
||||
case GST_PROPS_LIST_ID_NUM:
|
||||
case GST_PROPS_LIST_ID:
|
||||
return gst_props_entry_check_list_compatibility (entry1, entry2);
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case GST_PROPS_FLOAT_ID_NUM:
|
||||
case GST_PROPS_FLOAT_ID:
|
||||
switch (entry2->propstype) {
|
||||
// b <---> a - d
|
||||
case GST_PROPS_FLOAT_RANGE_ID_NUM:
|
||||
case GST_PROPS_FLOAT_RANGE_ID:
|
||||
return (entry2->data.float_range_data.min <= entry1->data.float_data &&
|
||||
entry2->data.float_range_data.max >= entry1->data.float_data);
|
||||
// b <---> a
|
||||
case GST_PROPS_FLOAT_ID_NUM:
|
||||
case GST_PROPS_FLOAT_ID:
|
||||
return (entry2->data.float_data == entry1->data.float_data);
|
||||
// b <---> a,b,c
|
||||
case GST_PROPS_LIST_ID_NUM:
|
||||
case GST_PROPS_LIST_ID:
|
||||
return gst_props_entry_check_list_compatibility (entry1, entry2);
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case GST_PROPS_BOOL_ID_NUM:
|
||||
case GST_PROPS_BOOL_ID:
|
||||
switch (entry2->propstype) {
|
||||
// t <---> t
|
||||
case GST_PROPS_BOOL_ID_NUM:
|
||||
case GST_PROPS_BOOL_ID:
|
||||
return (entry2->data.bool_data == entry1->data.bool_data);
|
||||
case GST_PROPS_LIST_ID_NUM:
|
||||
case GST_PROPS_LIST_ID:
|
||||
return gst_props_entry_check_list_compatibility (entry1, entry2);
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
case GST_PROPS_STRING_ID_NUM:
|
||||
case GST_PROPS_STRING_ID:
|
||||
switch (entry2->propstype) {
|
||||
// t <---> t
|
||||
case GST_PROPS_STRING_ID_NUM:
|
||||
case GST_PROPS_STRING_ID:
|
||||
return (!strcmp (entry2->data.string_data.string, entry1->data.string_data.string));
|
||||
case GST_PROPS_LIST_ID_NUM:
|
||||
case GST_PROPS_LIST_ID:
|
||||
return gst_props_entry_check_list_compatibility (entry1, entry2);
|
||||
default:
|
||||
return FALSE;
|
||||
|
@ -924,14 +775,14 @@ gst_props_save_thyself_func (GstPropsEntry *entry, xmlNodePtr parent)
|
|||
gchar *str;
|
||||
|
||||
switch (entry->propstype) {
|
||||
case GST_PROPS_INT_ID_NUM:
|
||||
case GST_PROPS_INT_ID:
|
||||
subtree = xmlNewChild (parent, NULL, "int", NULL);
|
||||
xmlNewProp (subtree, "name", g_quark_to_string (entry->propid));
|
||||
str = g_strdup_printf ("%d", entry->data.int_data);
|
||||
xmlNewProp (subtree, "value", str);
|
||||
g_free(str);
|
||||
break;
|
||||
case GST_PROPS_INT_RANGE_ID_NUM:
|
||||
case GST_PROPS_INT_RANGE_ID:
|
||||
subtree = xmlNewChild (parent, NULL, "range", NULL);
|
||||
xmlNewProp (subtree, "name", g_quark_to_string (entry->propid));
|
||||
str = g_strdup_printf ("%d", entry->data.int_range_data.min);
|
||||
|
@ -941,14 +792,14 @@ gst_props_save_thyself_func (GstPropsEntry *entry, xmlNodePtr parent)
|
|||
xmlNewProp (subtree, "max", str);
|
||||
g_free(str);
|
||||
break;
|
||||
case GST_PROPS_FLOAT_ID_NUM:
|
||||
case GST_PROPS_FLOAT_ID:
|
||||
subtree = xmlNewChild (parent, NULL, "float", NULL);
|
||||
xmlNewProp (subtree, "name", g_quark_to_string (entry->propid));
|
||||
str = g_strdup_printf ("%f", entry->data.float_data);
|
||||
xmlNewProp (subtree, "value", str);
|
||||
g_free(str);
|
||||
break;
|
||||
case GST_PROPS_FLOAT_RANGE_ID_NUM:
|
||||
case GST_PROPS_FLOAT_RANGE_ID:
|
||||
subtree = xmlNewChild (parent, NULL, "floatrange", NULL);
|
||||
xmlNewProp (subtree, "name", g_quark_to_string (entry->propid));
|
||||
str = g_strdup_printf ("%f", entry->data.float_range_data.min);
|
||||
|
@ -958,7 +809,7 @@ gst_props_save_thyself_func (GstPropsEntry *entry, xmlNodePtr parent)
|
|||
xmlNewProp (subtree, "max", str);
|
||||
g_free(str);
|
||||
break;
|
||||
case GST_PROPS_FOURCC_ID_NUM:
|
||||
case GST_PROPS_FOURCC_ID:
|
||||
str = g_strdup_printf ("%4.4s", (gchar *)&entry->data.fourcc_data);
|
||||
xmlAddChild (parent, xmlNewComment (str));
|
||||
g_free(str);
|
||||
|
@ -968,12 +819,12 @@ gst_props_save_thyself_func (GstPropsEntry *entry, xmlNodePtr parent)
|
|||
xmlNewProp (subtree, "hexvalue", str);
|
||||
g_free(str);
|
||||
break;
|
||||
case GST_PROPS_BOOL_ID_NUM:
|
||||
case GST_PROPS_BOOL_ID:
|
||||
subtree = xmlNewChild (parent, NULL, "boolean", NULL);
|
||||
xmlNewProp (subtree, "name", g_quark_to_string (entry->propid));
|
||||
xmlNewProp (subtree, "value", (entry->data.bool_data ? "true" : "false"));
|
||||
break;
|
||||
case GST_PROPS_STRING_ID_NUM:
|
||||
case GST_PROPS_STRING_ID:
|
||||
subtree = xmlNewChild (parent, NULL, "string", NULL);
|
||||
xmlNewProp (subtree, "name", g_quark_to_string (entry->propid));
|
||||
xmlNewProp (subtree, "value", entry->data.string_data.string);
|
||||
|
@ -1008,7 +859,7 @@ gst_props_save_thyself (GstProps *props, xmlNodePtr parent)
|
|||
GstPropsEntry *entry = (GstPropsEntry *) proplist->data;
|
||||
|
||||
switch (entry->propstype) {
|
||||
case GST_PROPS_LIST_ID_NUM:
|
||||
case GST_PROPS_LIST_ID:
|
||||
subtree = xmlNewChild (parent, NULL, "list", NULL);
|
||||
xmlNewProp (subtree, "name", g_quark_to_string (entry->propid));
|
||||
g_list_foreach (entry->data.list_data.entries, (GFunc) gst_props_save_thyself_func, subtree);
|
||||
|
@ -1033,7 +884,7 @@ gst_props_load_thyself_func (xmlNodePtr field)
|
|||
g_mutex_unlock (_gst_props_entries_chunk_lock);
|
||||
|
||||
if (!strcmp(field->name, "int")) {
|
||||
entry->propstype = GST_PROPS_INT_ID_NUM;
|
||||
entry->propstype = GST_PROPS_INT_ID;
|
||||
prop = xmlGetProp(field, "name");
|
||||
entry->propid = g_quark_from_string (prop);
|
||||
g_free (prop);
|
||||
|
@ -1042,7 +893,7 @@ gst_props_load_thyself_func (xmlNodePtr field)
|
|||
g_free (prop);
|
||||
}
|
||||
else if (!strcmp(field->name, "range")) {
|
||||
entry->propstype = GST_PROPS_INT_RANGE_ID_NUM;
|
||||
entry->propstype = GST_PROPS_INT_RANGE_ID;
|
||||
prop = xmlGetProp(field, "name");
|
||||
entry->propid = g_quark_from_string (prop);
|
||||
g_free (prop);
|
||||
|
@ -1054,7 +905,7 @@ gst_props_load_thyself_func (xmlNodePtr field)
|
|||
g_free (prop);
|
||||
}
|
||||
else if (!strcmp(field->name, "float")) {
|
||||
entry->propstype = GST_PROPS_FLOAT_ID_NUM;
|
||||
entry->propstype = GST_PROPS_FLOAT_ID;
|
||||
prop = xmlGetProp(field, "name");
|
||||
entry->propid = g_quark_from_string (prop);
|
||||
g_free (prop);
|
||||
|
@ -1063,7 +914,7 @@ gst_props_load_thyself_func (xmlNodePtr field)
|
|||
g_free (prop);
|
||||
}
|
||||
else if (!strcmp(field->name, "floatrange")) {
|
||||
entry->propstype = GST_PROPS_FLOAT_RANGE_ID_NUM;
|
||||
entry->propstype = GST_PROPS_FLOAT_RANGE_ID;
|
||||
prop = xmlGetProp(field, "name");
|
||||
entry->propid = g_quark_from_string (prop);
|
||||
g_free (prop);
|
||||
|
@ -1075,7 +926,7 @@ gst_props_load_thyself_func (xmlNodePtr field)
|
|||
g_free (prop);
|
||||
}
|
||||
else if (!strcmp(field->name, "boolean")) {
|
||||
entry->propstype = GST_PROPS_BOOL_ID_NUM;
|
||||
entry->propstype = GST_PROPS_BOOL_ID;
|
||||
prop = xmlGetProp(field, "name");
|
||||
entry->propid = g_quark_from_string (prop);
|
||||
g_free (prop);
|
||||
|
@ -1085,7 +936,7 @@ gst_props_load_thyself_func (xmlNodePtr field)
|
|||
g_free (prop);
|
||||
}
|
||||
else if (!strcmp(field->name, "fourcc")) {
|
||||
entry->propstype = GST_PROPS_FOURCC_ID_NUM;
|
||||
entry->propstype = GST_PROPS_FOURCC_ID;
|
||||
prop = xmlGetProp(field, "name");
|
||||
entry->propid = g_quark_from_string (prop);
|
||||
g_free (prop);
|
||||
|
@ -1094,7 +945,7 @@ gst_props_load_thyself_func (xmlNodePtr field)
|
|||
g_free (prop);
|
||||
}
|
||||
else if (!strcmp(field->name, "string")) {
|
||||
entry->propstype = GST_PROPS_STRING_ID_NUM;
|
||||
entry->propstype = GST_PROPS_STRING_ID;
|
||||
prop = xmlGetProp(field, "name");
|
||||
entry->propid = g_quark_from_string (prop);
|
||||
g_free (prop);
|
||||
|
@ -1141,7 +992,7 @@ gst_props_load_thyself (xmlNodePtr parent)
|
|||
entry = g_mem_chunk_alloc (_gst_props_entries_chunk);
|
||||
g_mutex_unlock (_gst_props_entries_chunk_lock);
|
||||
|
||||
entry->propstype = GST_PROPS_LIST_ID_NUM;
|
||||
entry->propstype = GST_PROPS_LIST_ID;
|
||||
entry->data.list_data.entries = NULL;
|
||||
prop = xmlGetProp (field, "name");
|
||||
entry->propid = g_quark_from_string (prop);
|
||||
|
@ -1171,8 +1022,3 @@ gst_props_load_thyself (xmlNodePtr parent)
|
|||
|
||||
return props;
|
||||
}
|
||||
|
||||
gfloat* _gst_props_floatpointer (gfloat f)
|
||||
{
|
||||
return &f;
|
||||
}
|
||||
|
|
|
@ -36,45 +36,29 @@
|
|||
|
||||
|
||||
typedef struct _GstProps GstProps;
|
||||
typedef gpointer GstPropsFactoryEntry;
|
||||
typedef GstPropsFactoryEntry GstPropsFactory[];
|
||||
typedef GstPropsFactory *GstPropsListFactory[];
|
||||
|
||||
typedef enum {
|
||||
GST_PROPS_END_ID_NUM = 0,
|
||||
GST_PROPS_LIST_ID_NUM,
|
||||
GST_PROPS_INT_ID_NUM,
|
||||
GST_PROPS_INT_RANGE_ID_NUM,
|
||||
GST_PROPS_FLOAT_ID_NUM,
|
||||
GST_PROPS_FLOAT_RANGE_ID_NUM,
|
||||
GST_PROPS_FOURCC_ID_NUM,
|
||||
GST_PROPS_BOOL_ID_NUM,
|
||||
GST_PROPS_STRING_ID_NUM,
|
||||
GST_PROPS_LAST_ID_NUM = GST_PROPS_END_ID_NUM + 16,
|
||||
GST_PROPS_END_ID = 0,
|
||||
GST_PROPS_LIST_ID,
|
||||
GST_PROPS_INT_ID,
|
||||
GST_PROPS_INT_RANGE_ID,
|
||||
GST_PROPS_FLOAT_ID,
|
||||
GST_PROPS_FLOAT_RANGE_ID,
|
||||
GST_PROPS_FOURCC_ID,
|
||||
GST_PROPS_BOOL_ID,
|
||||
GST_PROPS_STRING_ID,
|
||||
GST_PROPS_LAST_ID = GST_PROPS_END_ID + 16,
|
||||
} GstPropsId;
|
||||
|
||||
#define GST_PROPS_END_ID GINT_TO_POINTER(GST_PROPS_END_ID_NUM)
|
||||
#define GST_PROPS_LIST_ID GINT_TO_POINTER(GST_PROPS_LIST_ID_NUM)
|
||||
#define GST_PROPS_INT_ID GINT_TO_POINTER(GST_PROPS_INT_ID_NUM)
|
||||
#define GST_PROPS_INT_RANGE_ID GINT_TO_POINTER(GST_PROPS_INT_RANGE_ID_NUM)
|
||||
#define GST_PROPS_FLOAT_ID GINT_TO_POINTER(GST_PROPS_FLOAT_ID_NUM)
|
||||
#define GST_PROPS_FLOAT_RANGE_ID GINT_TO_POINTER(GST_PROPS_FLOAT_RANGE_ID_NUM)
|
||||
#define GST_PROPS_FOURCC_ID GINT_TO_POINTER(GST_PROPS_FOURCC_ID_NUM)
|
||||
#define GST_PROPS_BOOL_ID GINT_TO_POINTER(GST_PROPS_BOOL_ID_NUM)
|
||||
#define GST_PROPS_STRING_ID GINT_TO_POINTER(GST_PROPS_STRING_ID_NUM)
|
||||
#define GST_PROPS_LAST_ID GINT_TO_POINTER(GST_PROPS_LAST_ID_NUM)
|
||||
|
||||
#define GST_MAKE_FOURCC(a,b,c,d) ((a)|(b)<<8|(c)<<16|(d)<<24)
|
||||
|
||||
#define GST_PROPS_LIST(a...) GST_PROPS_LIST_ID,##a,NULL
|
||||
#define GST_PROPS_INT(a) GST_PROPS_INT_ID,(GINT_TO_POINTER(a))
|
||||
#define GST_PROPS_INT_RANGE(a,b) GST_PROPS_INT_RANGE_ID,(GINT_TO_POINTER(a)),(GINT_TO_POINTER(b))
|
||||
#define GST_PROPS_FLOAT_STRING(a) GST_PROPS_FLOAT_ID,(a)
|
||||
#define GST_PROPS_FLOAT_RANGE_STRING(a,b) GST_PROPS_FLOAT_RANGE_ID,(a),(b)
|
||||
#define GST_PROPS_FLOAT(a) GST_PROPS_FLOAT_ID,(&(a))
|
||||
#define GST_PROPS_FLOAT_RANGE(a,b) GST_PROPS_FLOAT_RANGE_ID,(&(a)),(&(b))
|
||||
#define GST_PROPS_FOURCC(a) GST_PROPS_FOURCC_ID,(GINT_TO_POINTER(a))
|
||||
#define GST_PROPS_BOOLEAN(a) GST_PROPS_BOOL_ID,(GINT_TO_POINTER(a))
|
||||
#define GST_PROPS_INT(a) GST_PROPS_INT_ID,(a)
|
||||
#define GST_PROPS_INT_RANGE(a,b) GST_PROPS_INT_RANGE_ID,(a),(b)
|
||||
#define GST_PROPS_FLOAT(a) GST_PROPS_FLOAT_ID,(a)
|
||||
#define GST_PROPS_FLOAT_RANGE(a,b) GST_PROPS_FLOAT_RANGE_ID,(a),(b)
|
||||
#define GST_PROPS_FOURCC(a) GST_PROPS_FOURCC_ID,(a)
|
||||
#define GST_PROPS_BOOLEAN(a) GST_PROPS_BOOL_ID,(a)
|
||||
#define GST_PROPS_STRING(a) GST_PROPS_STRING_ID,(a)
|
||||
|
||||
|
||||
|
@ -88,10 +72,8 @@ struct _GstProps {
|
|||
/* initialize the subsystem */
|
||||
void _gst_props_initialize (void);
|
||||
|
||||
GstProps* gst_props_register (GstPropsFactory factory);
|
||||
GstProps* gst_props_register_count (GstPropsFactory factory, guint *counter);
|
||||
|
||||
GstProps* gst_props_new (GstPropsFactoryEntry entry, ...);
|
||||
GstProps* gst_props_new (const gchar *firstname, ...);
|
||||
GstProps* gst_props_newv (const gchar *firstname, va_list var_args);
|
||||
|
||||
void gst_props_unref (GstProps *props);
|
||||
void gst_props_ref (GstProps *props);
|
||||
|
@ -104,7 +86,7 @@ GstProps* gst_props_merge (GstProps *props, GstProps *tomerge);
|
|||
|
||||
gboolean gst_props_check_compatibility (GstProps *fromprops, GstProps *toprops);
|
||||
|
||||
GstProps* gst_props_set (GstProps *props, const gchar *name, GstPropsFactoryEntry entry, ...);
|
||||
GstProps* gst_props_set (GstProps *props, const gchar *name, ...);
|
||||
|
||||
gint gst_props_get_int (GstProps *props, const gchar *name);
|
||||
gulong gst_props_get_fourcc_int (GstProps *props, const gchar *name);
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
metaincludedir = $(includedir)/gst/meta
|
||||
metainclude_HEADERS = \
|
||||
videoraw.h.old
|
||||
spectrum.h
|
||||
|
|
|
@ -25,11 +25,14 @@ libgstmediaplay_la_SOURCES = \
|
|||
gstmediaplay_SOURCES = \
|
||||
main.c
|
||||
|
||||
libgstmediaplayincludedir = $(includedir)/gstplay
|
||||
libgstmediaplayinclude_HEADERS = \
|
||||
gstplay.h
|
||||
|
||||
noinst_HEADERS = \
|
||||
gstmediaplay.h \
|
||||
gststatusarea.h \
|
||||
callbacks.h \
|
||||
gstplay.h \
|
||||
gstplayprivate.h
|
||||
|
||||
|
||||
|
|
|
@ -423,6 +423,8 @@ gst_play_realize (GtkWidget *widget)
|
|||
|
||||
g_return_if_fail (GST_IS_PLAY (widget));
|
||||
|
||||
//g_print ("realize\n");
|
||||
|
||||
play = GST_PLAY (widget);
|
||||
priv = (GstPlayPrivate *)play->priv;
|
||||
|
||||
|
|
|
@ -45,13 +45,17 @@ enum {
|
|||
/* FILL ME */
|
||||
};
|
||||
|
||||
static GstPadFactory tee_src_factory = {
|
||||
"src%d",
|
||||
GST_PAD_FACTORY_SRC,
|
||||
GST_PAD_FACTORY_REQUEST,
|
||||
NULL, /* no caps */
|
||||
NULL,
|
||||
};
|
||||
static GstPadTemplate*
|
||||
tee_src_factory_create (void)
|
||||
{
|
||||
return
|
||||
gst_padtemplate_new (
|
||||
"src%d",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_REQUEST,
|
||||
NULL /* no caps */
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
static void gst_tee_class_init (GstTeeClass *klass);
|
||||
|
@ -197,7 +201,7 @@ gst_tee_chain (GstPad *pad, GstBuffer *buf)
|
|||
gboolean
|
||||
gst_tee_factory_init (GstElementFactory *factory)
|
||||
{
|
||||
gst_tee_src_template = gst_padtemplate_new (&tee_src_factory);
|
||||
gst_tee_src_template = tee_src_factory_create ();
|
||||
gst_elementfactory_add_padtemplate (factory, gst_tee_src_template);
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -22,7 +22,7 @@ main (int argc, char *argv[])
|
|||
g_assert (videosink != NULL);
|
||||
|
||||
testcaps = g_list_append (NULL,
|
||||
gst_caps_new_with_props ("test_caps",
|
||||
gst_caps_new ("test_caps",
|
||||
"video/mpeg",
|
||||
gst_props_new (
|
||||
"mpegversion", GST_PROPS_INT (1),
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
static GstElement*
|
||||
autoplug_caps (GstAutoplug *autoplug, gchar *mime1, gchar *mime2)
|
||||
{
|
||||
GList *caps1, *caps2;
|
||||
GstCaps *caps1, *caps2;
|
||||
|
||||
caps1 = g_list_append (NULL, gst_caps_new ("tescaps1", mime1));
|
||||
caps2 = g_list_append (NULL, gst_caps_new ("tescaps2", mime2));
|
||||
caps1 = gst_caps_new ("tescaps1", mime1, NULL);
|
||||
caps2 = gst_caps_new ("tescaps2", mime2, NULL);
|
||||
|
||||
return gst_autoplug_to_caps (autoplug, caps1, caps2, NULL);
|
||||
}
|
||||
|
@ -28,48 +28,48 @@ main (int argc, char *argv[])
|
|||
xmlSaveFile ("autoplug2_2.gst", gst_xml_write (element));
|
||||
|
||||
element = gst_autoplug_to_caps (autoplug,
|
||||
g_list_append (NULL, gst_caps_new_with_props(
|
||||
gst_caps_new(
|
||||
"testcaps3",
|
||||
"video/mpeg",
|
||||
gst_props_new (
|
||||
"mpegversion", GST_PROPS_INT (1),
|
||||
"systemstream", GST_PROPS_BOOLEAN (TRUE),
|
||||
NULL))),
|
||||
g_list_append (NULL, gst_caps_new("testcaps4","audio/raw")),
|
||||
NULL)),
|
||||
gst_caps_new("testcaps4","audio/raw", NULL),
|
||||
NULL);
|
||||
xmlSaveFile ("autoplug2_3.gst", gst_xml_write (element));
|
||||
|
||||
element = gst_autoplug_to_caps (autoplug,
|
||||
g_list_append (NULL, gst_caps_new_with_props(
|
||||
gst_caps_new(
|
||||
"testcaps5",
|
||||
"video/mpeg",
|
||||
gst_props_new (
|
||||
"mpegversion", GST_PROPS_INT (1),
|
||||
"systemstream", GST_PROPS_BOOLEAN (FALSE),
|
||||
NULL))),
|
||||
g_list_append (NULL, gst_caps_new("testcaps6", "video/raw")),
|
||||
NULL)),
|
||||
gst_caps_new("testcaps6", "video/raw", NULL),
|
||||
NULL);
|
||||
xmlSaveFile ("autoplug2_4.gst", gst_xml_write (element));
|
||||
|
||||
element = gst_autoplug_to_caps (autoplug,
|
||||
g_list_append (NULL, gst_caps_new(
|
||||
gst_caps_new(
|
||||
"testcaps7",
|
||||
"video/avi")),
|
||||
g_list_append (NULL, gst_caps_new("testcaps8", "video/raw")),
|
||||
g_list_append (NULL, gst_caps_new("testcaps9", "audio/raw")),
|
||||
"video/avi", NULL),
|
||||
gst_caps_new("testcaps8", "video/raw", NULL),
|
||||
gst_caps_new("testcaps9", "audio/raw", NULL),
|
||||
NULL);
|
||||
xmlSaveFile ("autoplug2_5.gst", gst_xml_write (element));
|
||||
|
||||
element = gst_autoplug_to_caps (autoplug,
|
||||
g_list_append (NULL, gst_caps_new_with_props(
|
||||
gst_caps_new(
|
||||
"testcaps10",
|
||||
"video/mpeg",
|
||||
gst_props_new (
|
||||
"mpegversion", GST_PROPS_INT (1),
|
||||
"systemstream", GST_PROPS_BOOLEAN (TRUE),
|
||||
NULL))),
|
||||
g_list_append (NULL, gst_caps_new("testcaps10", "video/raw")),
|
||||
g_list_append (NULL, gst_caps_new("testcaps11", "audio/raw")),
|
||||
NULL)),
|
||||
gst_caps_new("testcaps10", "video/raw", NULL),
|
||||
gst_caps_new("testcaps11", "audio/raw", NULL),
|
||||
NULL);
|
||||
xmlSaveFile ("autoplug2_6.gst", gst_xml_write (element));
|
||||
|
||||
|
|
|
@ -17,64 +17,64 @@ main (int argc, char *argv[])
|
|||
autoplug2 = gst_autoplugfactory_make ("static");
|
||||
|
||||
element = gst_autoplug_to_renderers (autoplug,
|
||||
g_list_append (NULL, gst_caps_new ("mp3caps", "audio/mp3")), sink2, NULL);
|
||||
gst_caps_new ("mp3caps", "audio/mp3", NULL), sink2, NULL);
|
||||
xmlSaveFile ("autoplug3_1.gst", gst_xml_write (element));
|
||||
|
||||
element = gst_autoplug_to_renderers (autoplug,
|
||||
g_list_append (NULL, gst_caps_new ("mpeg1caps", "video/mpeg")), sink1, NULL);
|
||||
gst_caps_new ("mpeg1caps", "video/mpeg", NULL), sink1, NULL);
|
||||
if (element) {
|
||||
xmlSaveFile ("autoplug3_2.gst", gst_xml_write (element));
|
||||
}
|
||||
|
||||
element = gst_autoplug_to_caps (autoplug2,
|
||||
g_list_append (NULL, gst_caps_new_with_props(
|
||||
gst_caps_new(
|
||||
"testcaps3",
|
||||
"video/mpeg",
|
||||
gst_props_new (
|
||||
"mpegversion", GST_PROPS_INT (1),
|
||||
"systemstream", GST_PROPS_BOOLEAN (TRUE),
|
||||
NULL))),
|
||||
g_list_append (NULL, gst_caps_new("testcaps4","audio/raw")),
|
||||
NULL)),
|
||||
gst_caps_new("testcaps4","audio/raw", NULL),
|
||||
NULL);
|
||||
if (element) {
|
||||
xmlSaveFile ("autoplug3_3.gst", gst_xml_write (element));
|
||||
}
|
||||
|
||||
element = gst_autoplug_to_caps (autoplug2,
|
||||
g_list_append (NULL, gst_caps_new_with_props(
|
||||
gst_caps_new(
|
||||
"testcaps5",
|
||||
"video/mpeg",
|
||||
gst_props_new (
|
||||
"mpegversion", GST_PROPS_INT (1),
|
||||
"systemstream", GST_PROPS_BOOLEAN (FALSE),
|
||||
NULL))),
|
||||
g_list_append (NULL, gst_caps_new("testcaps6", "video/raw")),
|
||||
NULL)),
|
||||
gst_caps_new("testcaps6", "video/raw", NULL),
|
||||
NULL);
|
||||
if (element) {
|
||||
xmlSaveFile ("autoplug3_4.gst", gst_xml_write (element));
|
||||
}
|
||||
|
||||
element = gst_autoplug_to_caps (autoplug2,
|
||||
g_list_append (NULL, gst_caps_new(
|
||||
gst_caps_new(
|
||||
"testcaps7",
|
||||
"video/avi")),
|
||||
g_list_append (NULL, gst_caps_new("testcaps8", "video/raw")),
|
||||
g_list_append (NULL, gst_caps_new("testcaps9", "audio/raw")),
|
||||
"video/avi", NULL),
|
||||
gst_caps_new("testcaps8", "video/raw", NULL),
|
||||
gst_caps_new("testcaps9", "audio/raw", NULL),
|
||||
NULL);
|
||||
if (element) {
|
||||
xmlSaveFile ("autoplug3_5.gst", gst_xml_write (element));
|
||||
}
|
||||
|
||||
element = gst_autoplug_to_caps (autoplug2,
|
||||
g_list_append (NULL, gst_caps_new_with_props(
|
||||
gst_caps_new(
|
||||
"testcaps10",
|
||||
"video/mpeg",
|
||||
gst_props_new (
|
||||
"mpegversion", GST_PROPS_INT (1),
|
||||
"systemstream", GST_PROPS_BOOLEAN (TRUE),
|
||||
NULL))),
|
||||
g_list_append (NULL, gst_caps_new("testcaps10", "video/raw")),
|
||||
g_list_append (NULL, gst_caps_new("testcaps11", "audio/raw")),
|
||||
NULL)),
|
||||
gst_caps_new("testcaps10", "video/raw", NULL),
|
||||
gst_caps_new("testcaps11", "audio/raw", NULL),
|
||||
NULL);
|
||||
if (element) {
|
||||
xmlSaveFile ("autoplug3_6.gst", gst_xml_write (element));
|
||||
|
@ -84,13 +84,13 @@ main (int argc, char *argv[])
|
|||
sink2 = gst_elementfactory_make ("osssink", "osssink");
|
||||
|
||||
element = gst_autoplug_to_renderers (autoplug,
|
||||
g_list_append (NULL, gst_caps_new_with_props(
|
||||
gst_caps_new(
|
||||
"testcaps10",
|
||||
"video/mpeg",
|
||||
gst_props_new (
|
||||
"mpegversion", GST_PROPS_INT (1),
|
||||
"systemstream", GST_PROPS_BOOLEAN (TRUE),
|
||||
NULL))),
|
||||
NULL)),
|
||||
sink1,
|
||||
sink2,
|
||||
NULL);
|
||||
|
|
159
tests/caps.c
159
tests/caps.c
|
@ -1,65 +1,119 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
static GstCapsFactory mpeg2dec_sink_caps = {
|
||||
"mpeg2dec_sink",
|
||||
"video/mpeg",
|
||||
"mpegtype", GST_PROPS_LIST (
|
||||
GST_PROPS_INT(1),
|
||||
GST_PROPS_INT(2)
|
||||
),
|
||||
NULL
|
||||
};
|
||||
static GstCaps*
|
||||
mpeg2dec_sink_caps (void)
|
||||
{
|
||||
return
|
||||
gst_caps_new (
|
||||
"mpeg2dec_sink",
|
||||
"video/mpeg",
|
||||
gst_props_new (
|
||||
"mpegtype", GST_PROPS_LIST (
|
||||
GST_PROPS_INT(1),
|
||||
GST_PROPS_INT(2)
|
||||
),
|
||||
NULL
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
static GstCapsFactory mp1parse_src_caps = {
|
||||
"mp1parse_src",
|
||||
"video/mpeg",
|
||||
"mpegtype", GST_PROPS_LIST (
|
||||
GST_PROPS_INT(1)
|
||||
),
|
||||
NULL
|
||||
};
|
||||
static GstCaps*
|
||||
mp1parse_src_caps (void)
|
||||
{
|
||||
return
|
||||
gst_caps_new (
|
||||
"mp1parse_src",
|
||||
"video/mpeg",
|
||||
gst_props_new (
|
||||
"mpegtype", GST_PROPS_LIST (
|
||||
GST_PROPS_INT(1)
|
||||
),
|
||||
NULL
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
static GstCapsFactory mpeg2dec_src_caps = {
|
||||
"mpeg2dec_src",
|
||||
"video/raw",
|
||||
"fourcc", GST_PROPS_LIST (
|
||||
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2')),
|
||||
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','2'))
|
||||
static GstCaps*
|
||||
mpeg2dec_src_caps (void)
|
||||
{
|
||||
return
|
||||
gst_caps_new (
|
||||
"mpeg2dec_src",
|
||||
"video/raw",
|
||||
gst_props_new (
|
||||
"fourcc", GST_PROPS_LIST (
|
||||
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2')),
|
||||
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','2'))
|
||||
),
|
||||
"width", GST_PROPS_INT_RANGE (16, 4096),
|
||||
"height", GST_PROPS_INT_RANGE (16, 4096),
|
||||
NULL
|
||||
};
|
||||
"width", GST_PROPS_INT_RANGE (16, 4096),
|
||||
"height", GST_PROPS_INT_RANGE (16, 4096),
|
||||
NULL
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
static GstCapsFactory raw_sink_caps = {
|
||||
"raw_sink_caps",
|
||||
"video/raw",
|
||||
"fourcc", GST_PROPS_LIST (
|
||||
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2'))
|
||||
),
|
||||
"height", GST_PROPS_INT_RANGE (16, 256),
|
||||
NULL
|
||||
};
|
||||
static GstCaps*
|
||||
raw_sink_caps (void)
|
||||
{
|
||||
return
|
||||
gst_caps_new (
|
||||
"raw_sink_caps",
|
||||
"video/raw",
|
||||
gst_props_new (
|
||||
"fourcc", GST_PROPS_LIST (
|
||||
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2'))
|
||||
),
|
||||
"height", GST_PROPS_INT_RANGE (16, 256),
|
||||
NULL
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
static GstCapsFactory raw2_sink_caps = {
|
||||
"raw2_sink_caps",
|
||||
"video/raw",
|
||||
"fourcc", GST_PROPS_LIST (
|
||||
static GstCaps*
|
||||
raw2_sink_caps (void)
|
||||
{
|
||||
return
|
||||
gst_caps_new (
|
||||
"raw2_sink_caps",
|
||||
"video/raw",
|
||||
gst_props_new (
|
||||
"fourcc", GST_PROPS_LIST (
|
||||
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2')),
|
||||
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','V'))
|
||||
),
|
||||
"height", GST_PROPS_INT_RANGE (16, 4096),
|
||||
NULL
|
||||
};
|
||||
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','2'))
|
||||
),
|
||||
"height", GST_PROPS_INT_RANGE (16, 4096),
|
||||
NULL
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
static GstCaps*
|
||||
get_testcaps (void)
|
||||
{
|
||||
return
|
||||
gst_caps_new (
|
||||
"raw2_sink_caps",
|
||||
"video/raw",
|
||||
gst_props_new (
|
||||
"fourcc", GST_PROPS_LIST (
|
||||
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2')),
|
||||
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','V'))
|
||||
),
|
||||
"height", GST_PROPS_INT_RANGE (16, 4096),
|
||||
NULL
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
static GstCaps *sinkcaps = NULL,
|
||||
*rawcaps = NULL,
|
||||
*rawcaps2 = NULL,
|
||||
*rawcaps3 = NULL,
|
||||
*mp1parsecaps = NULL;
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
gboolean testret;
|
||||
xmlDocPtr doc;
|
||||
|
@ -68,25 +122,28 @@ int main(int argc,char *argv[])
|
|||
doc = xmlNewDoc ("1.0");
|
||||
doc->xmlRootNode = xmlNewDocNode (doc, NULL, "Capabilities", NULL);
|
||||
|
||||
g_thread_init (NULL);
|
||||
_gst_type_initialize ();
|
||||
_gst_props_initialize ();
|
||||
_gst_caps_initialize ();
|
||||
|
||||
sinkcaps = gst_caps_register (&mpeg2dec_sink_caps);
|
||||
sinkcaps = mpeg2dec_sink_caps ();
|
||||
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL);
|
||||
gst_caps_save_thyself (sinkcaps, parent);
|
||||
|
||||
rawcaps = gst_caps_register (&mpeg2dec_src_caps);
|
||||
rawcaps = mpeg2dec_src_caps ();
|
||||
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities2", NULL);
|
||||
gst_caps_save_thyself (rawcaps, parent);
|
||||
|
||||
rawcaps2 = gst_caps_register (&raw_sink_caps);
|
||||
rawcaps2 = raw_sink_caps ();
|
||||
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities3", NULL);
|
||||
gst_caps_save_thyself (rawcaps2, parent);
|
||||
|
||||
mp1parsecaps = gst_caps_register (&mp1parse_src_caps);
|
||||
mp1parsecaps = mp1parse_src_caps ();
|
||||
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities4", NULL);
|
||||
gst_caps_save_thyself (mp1parsecaps, parent);
|
||||
|
||||
rawcaps3 = gst_caps_register (&raw2_sink_caps);
|
||||
rawcaps3 = raw2_sink_caps ();
|
||||
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities5", NULL);
|
||||
gst_caps_save_thyself (rawcaps3, parent);
|
||||
|
||||
|
|
|
@ -57,34 +57,41 @@ enum {
|
|||
* can have. They can be quite complex, but for this example plugin
|
||||
* they are rather simple.
|
||||
*/
|
||||
static GstPadFactory sink_factory = {
|
||||
"sink", /* The name of the pad */
|
||||
GST_PAD_FACTORY_SINK, /* Direction of the pad */
|
||||
GST_PAD_FACTORY_ALWAYS, /* The pad exists for every instance */
|
||||
GST_PAD_FACTORY_CAPS( /* This factory has specific capabilities */
|
||||
"example_sink", /* The name of the caps */
|
||||
"unknown/unknown", /* The overall MIME/type */
|
||||
"foo", GST_PROPS_INT (1), /* An integer property */
|
||||
"bar", GST_PROPS_BOOLEAN (TRUE), /* A boolean */
|
||||
"baz", GST_PROPS_LIST ( /* A list of values for */
|
||||
GST_PROPS_INT (1),
|
||||
GST_PROPS_INT (3)
|
||||
)
|
||||
),
|
||||
NULL /* All factories must be NULL-terminated */
|
||||
};
|
||||
static GstPadTemplate*
|
||||
sink_factory (void)
|
||||
{
|
||||
return
|
||||
gst_padtemplate_new (
|
||||
"sink", /* The name of the pad */
|
||||
GST_PAD_SINK, /* Direction of the pad */
|
||||
GST_PAD_ALWAYS, /* The pad exists for every instance */
|
||||
gst_caps_new (
|
||||
"example_sink", /* The name of the caps */
|
||||
"unknown/unknown", /* The overall MIME/type */
|
||||
gst_props_new (
|
||||
"foo", GST_PROPS_INT (1), /* An integer property */
|
||||
"bar", GST_PROPS_BOOLEAN (TRUE), /* A boolean */
|
||||
"baz", GST_PROPS_LIST ( /* A list of values for */
|
||||
GST_PROPS_INT (1),
|
||||
GST_PROPS_INT (3)
|
||||
),
|
||||
NULL)));
|
||||
}
|
||||
|
||||
/* This factory is much simpler, and defines the source pad. */
|
||||
static GstPadFactory src_factory = {
|
||||
"src",
|
||||
GST_PAD_FACTORY_SRC,
|
||||
GST_PAD_FACTORY_ALWAYS,
|
||||
GST_PAD_FACTORY_CAPS(
|
||||
"example_src",
|
||||
"unknown/unknown"
|
||||
),
|
||||
NULL
|
||||
};
|
||||
static GstPadTemplate*
|
||||
src_factory (void)
|
||||
{
|
||||
return
|
||||
gst_padtemplate_new (
|
||||
"src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
gst_caps_new (
|
||||
"example_src",
|
||||
"unknown/unknown",
|
||||
NULL));
|
||||
}
|
||||
|
||||
|
||||
/* A number of functon prototypes are given so we can refer to them later. */
|
||||
|
@ -351,10 +358,10 @@ plugin_init (GModule *module)
|
|||
* Note that the generated padtemplates are stored in static global
|
||||
* variables, for the gst_example_init function to use later on.
|
||||
*/
|
||||
sink_template = gst_padtemplate_new (&sink_factory);
|
||||
sink_template = sink_factory ();
|
||||
gst_elementfactory_add_padtemplate (factory, sink_template);
|
||||
|
||||
src_template = gst_padtemplate_new (&src_factory);
|
||||
src_template = src_factory ();
|
||||
gst_elementfactory_add_padtemplate (factory, src_template);
|
||||
|
||||
/* The very last thing is to register the elementfactory with the plugin. */
|
||||
|
|
|
@ -1,22 +1,24 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
static GstPropsFactory mpeg2dec_sink_props = {
|
||||
"mpegtype", GST_PROPS_LIST (
|
||||
static GstProps* mpeg2dec_sink_props_register (void) {
|
||||
return gst_props_new (
|
||||
"mpegtype", GST_PROPS_LIST (
|
||||
GST_PROPS_INT(1),
|
||||
GST_PROPS_INT(2)
|
||||
),
|
||||
NULL
|
||||
};
|
||||
NULL);
|
||||
}
|
||||
|
||||
static GstPropsFactory mpeg2dec_src_props = {
|
||||
"fourcc", GST_PROPS_LIST (
|
||||
static GstProps* mpeg2dec_src_props_register (void) {
|
||||
return gst_props_new (
|
||||
"fourcc", GST_PROPS_LIST (
|
||||
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2')),
|
||||
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','2'))
|
||||
),
|
||||
"width", GST_PROPS_INT_RANGE (16, 4096),
|
||||
"height", GST_PROPS_INT_RANGE (16, 4096),
|
||||
NULL
|
||||
};
|
||||
"width", GST_PROPS_INT_RANGE (16, 4096),
|
||||
"height", GST_PROPS_INT_RANGE (16, 4096),
|
||||
NULL);
|
||||
}
|
||||
|
||||
static GstProps *sinkprops = NULL,
|
||||
*rawprops = NULL,
|
||||
|
@ -31,13 +33,14 @@ int main(int argc,char *argv[])
|
|||
doc = xmlNewDoc ("1.0");
|
||||
doc->xmlRootNode = xmlNewDocNode (doc, NULL, "Properties", NULL);
|
||||
|
||||
_gst_type_initialize ();
|
||||
g_thread_init (NULL);
|
||||
_gst_props_initialize ();
|
||||
|
||||
sinkprops = gst_props_register (mpeg2dec_sink_props);
|
||||
sinkprops = mpeg2dec_sink_props_register ();
|
||||
parent = xmlNewChild (doc->xmlRootNode, NULL, "Props1", NULL);
|
||||
gst_props_save_thyself (sinkprops, parent);
|
||||
|
||||
rawprops = gst_props_register (mpeg2dec_src_props);
|
||||
rawprops = mpeg2dec_src_props_register ();
|
||||
parent = xmlNewChild (doc->xmlRootNode, NULL, "Props2", NULL);
|
||||
gst_props_save_thyself (rawprops, parent);
|
||||
|
||||
|
|
|
@ -15,25 +15,25 @@ void print_prop(GstPropsEntry *prop,gboolean showname,gchar *pfx) {
|
|||
printf(pfx);
|
||||
|
||||
switch (prop->propstype) {
|
||||
case GST_PROPS_INT_ID_NUM:
|
||||
case GST_PROPS_INT_ID:
|
||||
printf("Integer: %d\n",prop->data.int_data);
|
||||
break;
|
||||
case GST_PROPS_INT_RANGE_ID_NUM:
|
||||
case GST_PROPS_INT_RANGE_ID:
|
||||
printf("Integer range: %d - %d\n",prop->data.int_range_data.min,
|
||||
prop->data.int_range_data.max);
|
||||
break;
|
||||
case GST_PROPS_BOOL_ID_NUM:
|
||||
case GST_PROPS_BOOL_ID:
|
||||
printf("Boolean: %s\n",prop->data.bool_data ? "TRUE" : "FALSE");
|
||||
break;
|
||||
case GST_PROPS_STRING_ID_NUM:
|
||||
case GST_PROPS_STRING_ID:
|
||||
printf("String: %s\n",prop->data.string_data.string);
|
||||
break;
|
||||
case GST_PROPS_FOURCC_ID_NUM:
|
||||
case GST_PROPS_FOURCC_ID:
|
||||
printf("FourCC: %c%c%c%c\n",
|
||||
prop->data.fourcc_data & 0xff,prop->data.fourcc_data>>8 & 0xff,
|
||||
prop->data.fourcc_data>>16 & 0xff,prop->data.fourcc_data>>24 & 0xff);
|
||||
break;
|
||||
case GST_PROPS_LIST_ID_NUM:
|
||||
case GST_PROPS_LIST_ID:
|
||||
printf("List:\n");
|
||||
longprefix = g_strdup_printf("%s ",pfx);
|
||||
list = prop->data.list_data.entries;
|
||||
|
|
Loading…
Reference in a new issue