The first wave of docs updates

Original commit message from CVS:
The first wave of docs updates
Added a little more comments about the API usage in the api docs.
Some fixes for the capsnego testsuite.
This commit is contained in:
Wim Taymans 2001-04-17 21:14:55 +00:00
parent a8ba9c4122
commit 6bd5dcffab
24 changed files with 1126 additions and 636 deletions

View file

@ -837,6 +837,7 @@ plugins/filters/passthrough/Makefile
plugins/filters/adder/Makefile plugins/filters/adder/Makefile
plugins/filters/colorspace/Makefile plugins/filters/colorspace/Makefile
plugins/filters/volenv/Makefile plugins/filters/volenv/Makefile
plugins/filters/adder/Makefile
plugins/icecast/Makefile plugins/icecast/Makefile
plugins/icecast/icecastsend/Makefile plugins/icecast/icecastsend/Makefile
plugins/effects/Makefile plugins/effects/Makefile
@ -884,6 +885,7 @@ examples/queue2/Makefile
examples/queue3/Makefile examples/queue3/Makefile
examples/queue4/Makefile examples/queue4/Makefile
examples/thread/Makefile examples/thread/Makefile
examples/mixer/Makefile
examples/launch/Makefile examples/launch/Makefile
examples/xml/Makefile examples/xml/Makefile
examples/plugins/Makefile examples/plugins/Makefile

View file

@ -27,6 +27,9 @@ cothread_get_data
gst_init gst_init
gst_main gst_main
gst_main_quit gst_main_quit
GST_VERSION_MICRO
GST_VERSION_MAJOR
GST_VERSION_MINOR
<SUBSECTION Standard> <SUBSECTION Standard>
</SECTION> </SECTION>
@ -136,9 +139,13 @@ GST_BUFFER_SIZE
GST_BUFFER_OFFSET GST_BUFFER_OFFSET
GST_BUFFER_MAXSIZE GST_BUFFER_MAXSIZE
GST_BUFFER_TIMESTAMP GST_BUFFER_TIMESTAMP
GST_BUFFER_BUFFERPOOL
GST_BUFFER_POOL_PRIVATE
GST_BUFFER_LOCK GST_BUFFER_LOCK
GST_BUFFER_TRYLOCK GST_BUFFER_TRYLOCK
GST_BUFFER_UNLOCK GST_BUFFER_UNLOCK
GstBufferFlags GstBufferFlags
GstBuffer GstBuffer
gst_buffer_new gst_buffer_new
@ -367,12 +374,11 @@ GstPadGetRegionFunction
GstPadQoSFunction GstPadQoSFunction
GstPadEOSFunction GstPadEOSFunction
GstPadNewCapsFunction GstPadNewCapsFunction
GstPadBufferPoolFunction
GstPadNegotiateReturn GstPadNegotiateReturn
GstPadNegotiateFunction GstPadNegotiateFunction
GstPadPushFunction GstPadPushFunction
GstPadPullFunction GstPadPullFunction
GstRegionType GstRegionType
@ -391,6 +397,7 @@ gst_pad_set_negotiate_function
gst_pad_set_qos_function gst_pad_set_qos_function
gst_pad_set_eos_function gst_pad_set_eos_function
gst_pad_set_newcaps_function gst_pad_set_newcaps_function
gst_pad_set_bufferpool_function
gst_pad_set_caps gst_pad_set_caps
gst_pad_get_caps gst_pad_get_caps
gst_pad_check_compatibility gst_pad_check_compatibility
@ -410,6 +417,7 @@ gst_pad_disconnect
gst_pad_push gst_pad_push
gst_pad_pull gst_pad_pull
gst_pad_pullregion gst_pad_pullregion
gst_pad_get_bufferpool
gst_pad_set_eos gst_pad_set_eos
gst_pad_handle_qos gst_pad_handle_qos
gst_pad_eos gst_pad_eos
@ -439,6 +447,7 @@ GST_RPAD_QOSFUNC
GST_RPAD_EOSFUNC GST_RPAD_EOSFUNC
GST_RPAD_NEGOTIATEFUNC GST_RPAD_NEGOTIATEFUNC
GST_RPAD_NEWCAPSFUNC GST_RPAD_NEWCAPSFUNC
GST_RPAD_BUFFERPOOLFUNC
GST_GPAD_REALPAD GST_GPAD_REALPAD
GstGhostPad GstGhostPad
@ -450,6 +459,9 @@ GST_PADTEMPLATE_CAPS
GST_PADTEMPLATE_DIRECTION GST_PADTEMPLATE_DIRECTION
GST_PADTEMPLATE_NAME_TEMPLATE GST_PADTEMPLATE_NAME_TEMPLATE
GST_PADTEMPLATE_PRESENCE GST_PADTEMPLATE_PRESENCE
GST_PADTEMPLATE_NEW
GST_PADTEMPLATE_FACTORY
GST_PADTEMPLATE_GET
gst_padtemplate_new gst_padtemplate_new
gst_padtemplate_load_thyself gst_padtemplate_load_thyself
gst_padtemplate_save_thyself gst_padtemplate_save_thyself
@ -615,6 +627,9 @@ gst_typefactory_save_thyself
GST_CAPS_LOCK GST_CAPS_LOCK
GST_CAPS_TRYLOCK GST_CAPS_TRYLOCK
GST_CAPS_UNLOCK GST_CAPS_UNLOCK
GST_CAPS_NEW
GST_CAPS_FACTORY
GST_CAPS_GET
GstCaps GstCaps
gst_caps_new gst_caps_new
gst_caps_destroy gst_caps_destroy
@ -622,6 +637,7 @@ gst_caps_ref
gst_caps_unref gst_caps_unref
gst_caps_copy gst_caps_copy
gst_caps_copy_on_write gst_caps_copy_on_write
gst_caps_chain
gst_caps_append gst_caps_append
gst_caps_prepend gst_caps_prepend
gst_caps_set_name gst_caps_set_name

View file

@ -9,7 +9,6 @@ GtkObject
GstFakeSrc GstFakeSrc
GstFakeSink GstFakeSink
GstDiskSrc GstDiskSrc
GstHttpSrc
GstFdSrc GstFdSrc
GstSineSrc GstSineSrc
GstFdSink GstFdSink

View file

@ -53,3 +53,24 @@ pipeline</ulink> and Microsoft's DirectShow for some background.
<!-- ##### MACRO GST_VERSION_MICRO ##### -->
<para>
</para>
<!-- ##### MACRO GST_VERSION_MAJOR ##### -->
<para>
</para>
<!-- ##### MACRO GST_VERSION_MINOR ##### -->
<para>
</para>

View file

@ -7,12 +7,92 @@ Automatically create and connect elements
<!-- ##### SECTION Long_Description ##### --> <!-- ##### SECTION Long_Description ##### -->
<para> <para>
GstAutoplug is an abstract class that is used for constructing and GstAutoplug is an abstract class that is used for constructing and
connecting elements. connecting elements. Two types og autopluggers exist: renderer ones and non
renderer ones. the renderer autopluggers will not have any src pads while the
non renderer ones do.
</para>
<para>
You first need to create a suitable autoplugger with gst_autoplugfactory_make().
The name of the autoplugger must be one of the registered autopluggers
(see #GstStaticAutoplug and #GstStaticAutoplugRender).
</para>
<para>
A list of all available autopluggers can be obtained with gst_autoplugfactory_get_list().
</para>
<para>
If the autoplugger supports the RENDERER API, use gst_autoplug_to_renderers() call to
create a bin that connectes the src caps to the specified rendrer elements. You can
then add the bin to a pipeline and run it.
<programlisting>
GstAutoplug *autoplug;
GstElement *element;
GstElement *sink;
/* create a static autoplugger */
autoplug = gst_autoplugfactory_make ("staticrender");
/* create an osssink */
sink = gst_elementfactory_make ("osssink", "our_sink");
/* create an element that can play audio/mp3 through osssink */
element = gst_autoplug_to_renderers (autoplug,
gst_caps_new (
"sink_audio_caps",
"audio/mp3",
NULL
),
sink,
NULL);
/* add the element to a bin and connect the sink pad */
...
</programlisting>
</para>
<para>
If the autoplugger supports the CAPS API, use gst_autoplug_to_caps() call to
connect the src caps to the destination caps. The created bin will have src pads
compatible with the provided sink caps.
<programlisting>
GstAutoplug *autoplug;
GstElement *element;
/* create a static autoplugger */
autoplug = gst_autoplugfactory_make ("static");
/* create an element that converts audio/mp3 to audio/raw */
element = gst_autoplug_to_caps (autoplug,
gst_caps_new (
"sink_audio_caps",
"audio/mp3",
NULL
),
gst_caps_new (
"src_audio_caps",
"audio/raw",
NULL
),
NULL);
/* add the element to a bin and connect the src/sink pads */
...
</programlisting>
</para>
<para>
Optionally you can get a notification when a new object is added to the created
pipeline with a gtk_signal_connect to the "new_object" signal.
</para>
<para>
Use the regular gst_object_destroy() call to destroy the autoplugger.
</para> </para>
<!-- ##### SECTION See_Also ##### --> <!-- ##### SECTION See_Also ##### -->
<para> <para>
GstStaticAutoplug, GstStaticAutoplugRender
</para> </para>
<!-- ##### STRUCT GstAutoplug ##### --> <!-- ##### STRUCT GstAutoplug ##### -->
@ -24,7 +104,7 @@ connecting elements.
<!-- ##### ENUM GstAutoplugFlags ##### --> <!-- ##### ENUM GstAutoplugFlags ##### -->
<para> <para>
The type of the autoplugger.
</para> </para>
@GST_AUTOPLUG_TO_CAPS: @GST_AUTOPLUG_TO_CAPS:

View file

@ -43,10 +43,10 @@ Flags for a bin.
<!-- ##### MACRO gst_bin_destroy ##### --> <!-- ##### MACRO gst_bin_destroy ##### -->
<para> <para>
Free the memory allocated by this bin
</para> </para>
@bin: @bin: the bin to free
<!-- ##### FUNCTION gst_bin_add ##### --> <!-- ##### FUNCTION gst_bin_add ##### -->

View file

@ -102,6 +102,22 @@ Get the timestamp for this buffer.
@buf: GstBuffer @buf: GstBuffer
<!-- ##### MACRO GST_BUFFER_BUFFERPOOL ##### -->
<para>
Get the bufferpool for this buffer.
</para>
@buf: GstBuffer
<!-- ##### MACRO GST_BUFFER_POOL_PRIVATE ##### -->
<para>
Get the bufferpool private data.
</para>
@buf: GstBuffer
<!-- ##### MACRO GST_BUFFER_LOCK ##### --> <!-- ##### MACRO GST_BUFFER_LOCK ##### -->
<para> <para>
This macro will obtain a lock on the object, making serialization This macro will obtain a lock on the object, making serialization
@ -160,6 +176,7 @@ used when data in a stream has been skipped
@metas: @metas:
@parent: @parent:
@pool: @pool:
@pool_private:
<!-- ##### FUNCTION gst_buffer_new ##### --> <!-- ##### FUNCTION gst_buffer_new ##### -->
<para> <para>

View file

@ -39,6 +39,34 @@ Unlock the caps structure
@caps: The caps structure to unlock @caps: The caps structure to unlock
<!-- ##### MACRO GST_CAPS_NEW ##### -->
<para>
A convenience macro to create a new GstCaps structure.
</para>
@name: the name of the caps structure
@type: the mime type of the caps structure
@a...: the properties of this caps stucture.
<!-- ##### MACRO GST_CAPS_FACTORY ##### -->
<para>
A convenience macro to create a GstCaps factory.
</para>
@factoryname: the name of the factory
@a...: the caps to create with this factory, usualy specified
with GST_CAPS_NEW()
<!-- ##### MACRO GST_CAPS_GET ##### -->
<para>
A convenience macro to get a GstCaps from the given capsfactory.
</para>
@fact: the factory to use.
<!-- ##### STRUCT GstCaps ##### --> <!-- ##### STRUCT GstCaps ##### -->
<para> <para>
@ -76,6 +104,7 @@ Unlock the caps structure
</para> </para>
@caps: @caps:
@Returns:
<!-- ##### FUNCTION gst_caps_unref ##### --> <!-- ##### FUNCTION gst_caps_unref ##### -->
@ -84,6 +113,7 @@ Unlock the caps structure
</para> </para>
@caps: @caps:
@Returns:
<!-- ##### FUNCTION gst_caps_copy ##### --> <!-- ##### FUNCTION gst_caps_copy ##### -->
@ -104,6 +134,16 @@ Unlock the caps structure
@Returns: @Returns:
<!-- ##### FUNCTION gst_caps_chain ##### -->
<para>
</para>
@caps:
@Varargs:
@Returns:
<!-- ##### FUNCTION gst_caps_append ##### --> <!-- ##### FUNCTION gst_caps_append ##### -->
<para> <para>
@ -212,21 +252,21 @@ Unlock the caps structure
<!-- ##### MACRO gst_caps_set ##### --> <!-- ##### MACRO gst_caps_set ##### -->
<para> <para>
Set a property of a caps structure.
</para> </para>
@caps: @caps: the caps structure to modify
@name: @name: the name of the property to change
@args...: @args...: the new value of the property
<!-- ##### MACRO gst_caps_get_boolean ##### --> <!-- ##### MACRO gst_caps_get_boolean ##### -->
<para> <para>
Get the value of the named property as a boolean.
</para> </para>
@caps: @caps: the caps to query
@name: @name: the name of the property to get
<!-- ##### FUNCTION gst_caps_get_by_name ##### --> <!-- ##### FUNCTION gst_caps_get_by_name ##### -->
@ -241,29 +281,29 @@ Unlock the caps structure
<!-- ##### MACRO gst_caps_get_fourcc_int ##### --> <!-- ##### MACRO gst_caps_get_fourcc_int ##### -->
<para> <para>
Get the value of the named property as a fourcc.
</para> </para>
@caps: @caps: the caps to query
@name: @name: the name of the property to get
<!-- ##### MACRO gst_caps_get_int ##### --> <!-- ##### MACRO gst_caps_get_int ##### -->
<para> <para>
Get the value of the named property as an int.
</para> </para>
@caps: @caps: the caps to query
@name: @name: the name of the property to get
<!-- ##### MACRO gst_caps_get_string ##### --> <!-- ##### MACRO gst_caps_get_string ##### -->
<para> <para>
Get the value of the named property as a string.
</para> </para>
@caps: @caps: the caps to query
@name: @name: the name of the property to get
<!-- ##### FUNCTION gst_caps_save_thyself ##### --> <!-- ##### FUNCTION gst_caps_save_thyself ##### -->

View file

@ -28,3 +28,8 @@ with the buffer. (fakesink)
</para> </para>
<!-- ##### ARG GstFakeSink:silent ##### -->
<para>
</para>

View file

@ -14,14 +14,3 @@ Reads data from a URL.
</para> </para>
<!-- ##### ARG GstHttpSrc:location ##### -->
<para>
Specify the location of the file. The location must be a fully qualified URL.
</para>
<!-- ##### ARG GstHttpSrc:bytesperread ##### -->
<para>
Specify how many bytes to read at a time.
</para>

View file

@ -157,11 +157,22 @@ The function that will be called in an EOS case.
<!-- ##### USER_FUNCTION GstPadNewCapsFunction ##### --> <!-- ##### USER_FUNCTION GstPadNewCapsFunction ##### -->
<para> <para>
The function that will be called when the caps of the pad has
changed.
</para> </para>
@pad: @pad: The pad that has its caps changed
@caps: @caps: the new caps of the pad
<!-- ##### USER_FUNCTION GstPadBufferPoolFunction ##### -->
<para>
The function that will be called when a bufferpool is requested
from this pad.
</para>
@pad: the pad with the bufferpool
@Returns: the GstBufferPool associated with this pad.
<!-- ##### ENUM GstPadNegotiateReturn ##### --> <!-- ##### ENUM GstPadNegotiateReturn ##### -->
@ -180,10 +191,8 @@ The function that will be called when negotiating.
@pad: The pad that is being negotiated @pad: The pad that is being negotiated
@caps: The current caps that are being negotiated @caps: The current caps that are being negotiated
@data: @data: A generic gpointer that can be used to store user_data
@Returns: The result of the negotiation process @Returns: The result of the negotiation process
<!-- # Unused Parameters # -->
@count: A counter to keep track of the negotiation process
<!-- ##### USER_FUNCTION GstPadPushFunction ##### --> <!-- ##### USER_FUNCTION GstPadPushFunction ##### -->
@ -349,6 +358,15 @@ Destroy the pad.
@newcaps: @newcaps:
<!-- ##### FUNCTION gst_pad_set_bufferpool_function ##### -->
<para>
</para>
@pad:
@bufpool:
<!-- ##### FUNCTION gst_pad_set_caps ##### --> <!-- ##### FUNCTION gst_pad_set_caps ##### -->
<para> <para>
@ -530,6 +548,15 @@ Destroy the pad.
@size: @size:
<!-- ##### FUNCTION gst_pad_get_bufferpool ##### -->
<para>
</para>
@pad:
@Returns:
<!-- ##### FUNCTION gst_pad_set_eos ##### --> <!-- ##### FUNCTION gst_pad_set_eos ##### -->
<para> <para>
@ -657,6 +684,7 @@ Call the EOS function of the pad
@pullregionfunc: @pullregionfunc:
@negotiatefunc: @negotiatefunc:
@newcapsfunc: @newcapsfunc:
@bufferpoolfunc:
@ghostpads: @ghostpads:
<!-- ##### MACRO GST_RPAD_DIRECTION ##### --> <!-- ##### MACRO GST_RPAD_DIRECTION ##### -->
@ -771,6 +799,14 @@ Get the EOS function of the real pad.
@pad: @pad:
<!-- ##### MACRO GST_RPAD_BUFFERPOOLFUNC ##### -->
<para>
</para>
@pad:
<!-- ##### MACRO GST_GPAD_REALPAD ##### --> <!-- ##### MACRO GST_GPAD_REALPAD ##### -->
<para> <para>
Get the real pad of this ghost pad. Get the real pad of this ghost pad.
@ -849,6 +885,37 @@ Indicates when this pad will become available.
@templ: @templ:
<!-- ##### MACRO GST_PADTEMPLATE_NEW ##### -->
<para>
</para>
@padname:
@dir:
@pres:
@a...:
<!-- ##### MACRO GST_PADTEMPLATE_FACTORY ##### -->
<para>
</para>
@name:
@padname:
@dir:
@pres:
@a...:
<!-- ##### MACRO GST_PADTEMPLATE_GET ##### -->
<para>
</para>
@fact:
<!-- ##### FUNCTION gst_padtemplate_new ##### --> <!-- ##### FUNCTION gst_padtemplate_new ##### -->
<para> <para>

View file

@ -26,13 +26,14 @@ GstCaps
<!-- ##### MACRO GST_MAKE_FOURCC ##### --> <!-- ##### MACRO GST_MAKE_FOURCC ##### -->
<para> <para>
Create a FOURCC value that can easily be used to construct
a fourcc property.
</para> </para>
@a: @a: first fourcc byte
@b: @b: second fourcc byte
@c: @c: third fourcc byte
@d: @d: fourth fourcc byte
<!-- ##### MACRO GST_PROPS_LIST ##### --> <!-- ##### MACRO GST_PROPS_LIST ##### -->
@ -65,11 +66,7 @@ Create an integer range property.
Construct a fourcc property out of four bytes. Construct a fourcc property out of four bytes.
</para> </para>
@a: first byte @a: a fourcc value usualy created with GST_FOURCC_MAKE ()
<!-- # Unused Parameters # -->
@b: second byte
@c: third byte
@d: fourth byte
<!-- ##### MACRO GST_PROPS_BOOLEAN ##### --> <!-- ##### MACRO GST_PROPS_BOOLEAN ##### -->
@ -82,27 +79,27 @@ Create a boolean property.
<!-- ##### MACRO GST_PROPS_STRING ##### --> <!-- ##### MACRO GST_PROPS_STRING ##### -->
<para> <para>
Create a string value.
</para> </para>
@a: @a: the string value.
<!-- ##### MACRO GST_PROPS_FLOAT ##### --> <!-- ##### MACRO GST_PROPS_FLOAT ##### -->
<para> <para>
Create a floating point value.
</para> </para>
@a: @a: the float value
<!-- ##### MACRO GST_PROPS_FLOAT_RANGE ##### --> <!-- ##### MACRO GST_PROPS_FLOAT_RANGE ##### -->
<para> <para>
Create a float range value.
</para> </para>
@a: @a: lower float bounds
@b: @b: upper float bounds
<!-- ##### FUNCTION gst_props_new ##### --> <!-- ##### FUNCTION gst_props_new ##### -->
@ -113,8 +110,6 @@ Create a boolean property.
@firstname: @firstname:
@Varargs: @Varargs:
@Returns: @Returns:
<!-- # Unused Parameters # -->
@entry:
<!-- ##### FUNCTION gst_props_newv ##### --> <!-- ##### FUNCTION gst_props_newv ##### -->

View file

@ -67,14 +67,6 @@ Query the element for the current mime type
</para> </para>
<!-- ##### FUNCTION gst_fdsink_chain ##### -->
<para>
</para>
@pad:
@buf:
<!-- ##### FUNCTION gst_pad_remove_ghost_parent ##### --> <!-- ##### FUNCTION gst_pad_remove_ghost_parent ##### -->
<para> <para>
@ -83,7 +75,7 @@ Query the element for the current mime type
@pad: @pad:
@parent: @parent:
<!-- ##### FUNCTION gst_identity_chain ##### --> <!-- ##### FUNCTION gst_fdsink_chain ##### -->
<para> <para>
</para> </para>
@ -91,7 +83,13 @@ Query the element for the current mime type
@pad: @pad:
@buf: @buf:
<!-- ##### FUNCTION gst_audiosink_chain ##### --> <!-- ##### ARG GstHttpSrc:location ##### -->
<para>
Specify the location of the file. The location must be a fully qualified URL.
</para>
<!-- ##### FUNCTION gst_identity_chain ##### -->
<para> <para>
</para> </para>
@ -106,6 +104,14 @@ Query the element for the current mime type
@Returns: @Returns:
<!-- ##### FUNCTION gst_audiosink_chain ##### -->
<para>
</para>
@pad:
@buf:
<!-- ##### MACRO GST_PIPELINE_CLASS ##### --> <!-- ##### MACRO GST_PIPELINE_CLASS ##### -->
<para> <para>
@ -200,6 +206,12 @@ the stream.
@gstsrc: the object which received the signal. @gstsrc: the object which received the signal.
@arg1: the object which received the signal @arg1: the object which received the signal
<!-- ##### TYPEDEF GstCapsFactoryEntry ##### -->
<para>
</para>
<!-- ##### FUNCTION gst_disksrc_get_type ##### --> <!-- ##### FUNCTION gst_disksrc_get_type ##### -->
<para> <para>
@ -207,12 +219,6 @@ the stream.
@Returns: @Returns:
<!-- ##### TYPEDEF GstCapsFactoryEntry ##### -->
<para>
</para>
<!-- ##### MACRO GST_IS_DISKSRC_CLASS ##### --> <!-- ##### MACRO GST_IS_DISKSRC_CLASS ##### -->
<para> <para>
@ -366,16 +372,16 @@ subclass use this to start their flag enumeration
@audiosink: @audiosink:
@channels: @channels:
<!-- ##### SECTION ./tmpl/gstconnection.sgml:Short_Description ##### -->
Generic connection between elements.
<!-- ##### STRUCT GstSinkClass ##### --> <!-- ##### STRUCT GstSinkClass ##### -->
<para> <para>
</para> </para>
<!-- ##### SECTION ./tmpl/gstconnection.sgml:Short_Description ##### -->
Generic connection between elements.
<!-- ##### STRUCT GstFilterClass ##### --> <!-- ##### STRUCT GstFilterClass ##### -->
<para> <para>
@ -655,13 +661,13 @@ Specify the current offset in the file.
@sheight: @sheight:
@bytes_per_line: @bytes_per_line:
<!-- ##### ARG GstAudioSink:format ##### --> <!-- ##### SECTION ./tmpl/GstElement.sgml:Long_Description ##### -->
<para> <para>
</para> </para>
<!-- ##### SECTION ./tmpl/GstElement.sgml:Long_Description ##### --> <!-- ##### ARG GstAudioSink:format ##### -->
<para> <para>
</para> </para>
@ -695,17 +701,24 @@ Specify the current offset in the file.
@name: @name:
@Returns: @Returns:
<!-- ##### STRUCT GstConnection ##### -->
<para>
</para>
<!-- ##### STRUCT GstQueueClass ##### --> <!-- ##### STRUCT GstQueueClass ##### -->
<para> <para>
</para> </para>
<!-- ##### STRUCT GstConnection ##### --> <!-- ##### FUNCTION gst_fakesrc_push ##### -->
<para> <para>
</para> </para>
@src:
<!-- ##### FUNCTION gst_type_add_sink ##### --> <!-- ##### FUNCTION gst_type_add_sink ##### -->
<para> <para>
@ -715,13 +728,6 @@ Specify the current offset in the file.
@id: @id:
@sink: @sink:
<!-- ##### FUNCTION gst_fakesrc_push ##### -->
<para>
</para>
@src:
<!-- ##### MACRO GST_IS_IDENTITY_CLASS ##### --> <!-- ##### MACRO GST_IS_IDENTITY_CLASS ##### -->
<para> <para>
@ -1135,13 +1141,6 @@ GstFilter
@obj: @obj:
<!-- ##### FUNCTION gst_fdsrc_get_type ##### -->
<para>
</para>
@Returns:
<!-- ##### MACRO GST_IS_QUEUE_CLASS ##### --> <!-- ##### MACRO GST_IS_QUEUE_CLASS ##### -->
<para> <para>
@ -1149,6 +1148,13 @@ GstFilter
@obj: @obj:
<!-- ##### FUNCTION gst_fdsrc_get_type ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION gst_pad_get_type_id ##### --> <!-- ##### FUNCTION gst_pad_get_type_id ##### -->
<para> <para>
@ -1157,6 +1163,13 @@ GstFilter
@pad: @pad:
@Returns: @Returns:
<!-- ##### FUNCTION gst_thread_iterate ##### -->
<para>
</para>
@thread:
<!-- ##### STRUCT OverlayClip ##### --> <!-- ##### STRUCT OverlayClip ##### -->
<para> <para>
@ -1167,13 +1180,6 @@ GstFilter
@y1: @y1:
@y2: @y2:
<!-- ##### FUNCTION gst_thread_iterate ##### -->
<para>
</para>
@thread:
<!-- ##### ENUM GstSrcFlags ##### --> <!-- ##### ENUM GstSrcFlags ##### -->
<para> <para>
Flags for the GstSrc element Flags for the GstSrc element
@ -1249,13 +1255,6 @@ Defines an entry for a padfactory.
@obj: @obj:
<!-- ##### MACRO GST_AUDIOSINK_CLASS ##### -->
<para>
</para>
@klass:
<!-- ##### FUNCTION gst_asyncdisksrc_get_type ##### --> <!-- ##### FUNCTION gst_asyncdisksrc_get_type ##### -->
<para> <para>
@ -1263,6 +1262,13 @@ Defines an entry for a padfactory.
@Returns: @Returns:
<!-- ##### MACRO GST_AUDIOSINK_CLASS ##### -->
<para>
</para>
@klass:
<!-- ##### MACRO GST_PAD_FACTORY_SINK ##### --> <!-- ##### MACRO GST_PAD_FACTORY_SINK ##### -->
<para> <para>
Indicates a sinkpad for the padfactory. Indicates a sinkpad for the padfactory.
@ -1298,6 +1304,12 @@ Indicates a sinkpad for the padfactory.
@pad: @pad:
@Returns: @Returns:
<!-- ##### MACRO GST_PROPS_FOURCC_ID ##### -->
<para>
</para>
<!-- ##### FUNCTION gst_esdsink_new ##### --> <!-- ##### FUNCTION gst_esdsink_new ##### -->
<para> <para>
@ -1306,12 +1318,6 @@ Indicates a sinkpad for the padfactory.
@name: @name:
@Returns: @Returns:
<!-- ##### MACRO GST_PROPS_FOURCC_ID ##### -->
<para>
</para>
<!-- ##### FUNCTION gst_element_request_pad ##### --> <!-- ##### FUNCTION gst_element_request_pad ##### -->
<para> <para>
@ -1421,12 +1427,6 @@ This macro sets the given flags.
@flag: Flag to set, can by any number of bits in guint32. @flag: Flag to set, can by any number of bits in guint32.
@obj: GstSrc to set flag in. @obj: GstSrc to set flag in.
<!-- ##### MACRO DEBUG_LEAVE_STRING ##### -->
<para>
</para>
<!-- ##### MACRO GST_PROPS_FLOAT_STRING ##### --> <!-- ##### MACRO GST_PROPS_FLOAT_STRING ##### -->
<para> <para>
@ -1434,6 +1434,12 @@ This macro sets the given flags.
@a: @a:
<!-- ##### MACRO DEBUG_LEAVE_STRING ##### -->
<para>
</para>
<!-- ##### FUNCTION gst_filter_get_type ##### --> <!-- ##### FUNCTION gst_filter_get_type ##### -->
<para> <para>
@ -1455,16 +1461,16 @@ This macro sets the given flags.
</para> </para>
<!-- ##### SECTION ./tmpl/gstsink.sgml:Title ##### -->
GstSink
<!-- ##### MACRO GST_CPU_FLAG_MMX ##### --> <!-- ##### MACRO GST_CPU_FLAG_MMX ##### -->
<para> <para>
A flag indicating that MMX instructions are supported. A flag indicating that MMX instructions are supported.
</para> </para>
<!-- ##### SECTION ./tmpl/gstsink.sgml:Title ##### -->
GstSink
<!-- ##### FUNCTION gst_object_get_type ##### --> <!-- ##### FUNCTION gst_object_get_type ##### -->
<para> <para>
@ -1602,6 +1608,13 @@ Indicates a srcpad for the padfactory.
@obj: @obj:
<!-- ##### ARG GstHttpSrc:bytesperread ##### -->
<para>
Specify how many bytes to read at a time.
</para>
<!-- ##### MACRO GST_THREAD ##### --> <!-- ##### MACRO GST_THREAD ##### -->
<para> <para>
@ -1771,13 +1784,6 @@ or a video card.
</para> </para>
<!-- ##### FUNCTION gst_esdsink_get_type ##### -->
<para>
</para>
@Returns:
<!-- ##### MACRO GST_IS_BIN_CLASS ##### --> <!-- ##### MACRO GST_IS_BIN_CLASS ##### -->
<para> <para>
@ -1785,6 +1791,13 @@ or a video card.
@obj: @obj:
<!-- ##### FUNCTION gst_esdsink_get_type ##### -->
<para>
</para>
@Returns:
<!-- ##### SECTION ./tmpl/GstElement.sgml:See_Also ##### --> <!-- ##### SECTION ./tmpl/GstElement.sgml:See_Also ##### -->
<para> <para>
@ -1805,6 +1818,12 @@ Query whether this object has multiple input pads.
@obj: Element to query for multiple input pads. @obj: Element to query for multiple input pads.
<!-- ##### SECTION ./tmpl/gstfilter.sgml:See_Also ##### -->
<para>
</para>
<!-- ##### MACRO DEBUG_NOPREFIX ##### --> <!-- ##### MACRO DEBUG_NOPREFIX ##### -->
<para> <para>
@ -1813,12 +1832,6 @@ Query whether this object has multiple input pads.
@format: @format:
@args...: @args...:
<!-- ##### SECTION ./tmpl/gstfilter.sgml:See_Also ##### -->
<para>
</para>
<!-- ##### ARG GstAudioSink:frequency ##### --> <!-- ##### ARG GstAudioSink:frequency ##### -->
<para> <para>
@ -2236,6 +2249,13 @@ this in the factory definition.
@audiosink: @audiosink:
<!-- ##### MACRO GST_IS_FAKESINK ##### -->
<para>
</para>
@obj:
<!-- ##### MACRO GST_STATE_UNSET ##### --> <!-- ##### MACRO GST_STATE_UNSET ##### -->
<para> <para>
This macro unsets the given state on the element. This macro unsets the given state on the element.
@ -2244,13 +2264,6 @@ This macro unsets the given state on the element.
@obj: Element to unset state of. @obj: Element to unset state of.
@flag: State to unset, can be any number of bits in guint32. @flag: State to unset, can be any number of bits in guint32.
<!-- ##### MACRO GST_IS_FAKESINK ##### -->
<para>
</para>
@obj:
<!-- ##### MACRO GST_QUEUE_CLASS ##### --> <!-- ##### MACRO GST_QUEUE_CLASS ##### -->
<para> <para>
@ -2323,13 +2336,6 @@ The number of bytes per read.
@obj: @obj:
<!-- ##### FUNCTION gst_sinesrc_get_type ##### -->
<para>
</para>
@Returns:
<!-- ##### MACRO ERROR_OBJECT ##### --> <!-- ##### MACRO ERROR_OBJECT ##### -->
<para> <para>
@ -2340,6 +2346,13 @@ The number of bytes per read.
@format: @format:
@args...: @args...:
<!-- ##### FUNCTION gst_sinesrc_get_type ##### -->
<para>
</para>
@Returns:
<!-- ##### MACRO GST_IS_IDENTITY ##### --> <!-- ##### MACRO GST_IS_IDENTITY ##### -->
<para> <para>
@ -2444,14 +2457,9 @@ This macro sets the given state on the element.
@obj: @obj:
<!-- ##### FUNCTION gst_src_push_region ##### --> <!-- ##### SECTION ./tmpl/videoraw.sgml:Short_Description ##### -->
<para> Information about video buffers.
</para>
@src:
@offset:
@size:
<!-- ##### FUNCTION gst_fdsink_get_type ##### --> <!-- ##### FUNCTION gst_fdsink_get_type ##### -->
<para> <para>
@ -2460,9 +2468,14 @@ This macro sets the given state on the element.
@Returns: @Returns:
<!-- ##### SECTION ./tmpl/videoraw.sgml:Short_Description ##### --> <!-- ##### FUNCTION gst_src_push_region ##### -->
Information about video buffers. <para>
</para>
@src:
@offset:
@size:
<!-- ##### STRUCT GstPipelineClass ##### --> <!-- ##### STRUCT GstPipelineClass ##### -->
<para> <para>
@ -2566,13 +2579,13 @@ A flag indicating that SSE instructions are supported.
@obj: @obj:
<!-- ##### STRUCT GstDiskSrcClass ##### --> <!-- ##### ARG GstAsyncDiskSrc:size ##### -->
<para> <para>
</para> </para>
<!-- ##### ARG GstAsyncDiskSrc:size ##### --> <!-- ##### STRUCT GstDiskSrcClass ##### -->
<para> <para>
</para> </para>
@ -2653,6 +2666,12 @@ Information about audio buffers.
</para> </para>
<!-- ##### FUNCTION plugin_initialize ##### -->
<para>
</para>
<!-- ##### FUNCTION gst_caps_register ##### --> <!-- ##### FUNCTION gst_caps_register ##### -->
<para> <para>
@ -2661,12 +2680,6 @@ Information about audio buffers.
@factory: @factory:
@Returns: @Returns:
<!-- ##### FUNCTION plugin_initialize ##### -->
<para>
</para>
<!-- ##### ARG GstAsyncDiskSrc:location ##### --> <!-- ##### ARG GstAsyncDiskSrc:location ##### -->
<para> <para>
Specify the location of the file to read. Specify the location of the file to read.
@ -2730,13 +2743,6 @@ the offset.
</para> </para>
<!-- ##### MACRO GST_IS_ASYNCDISKSRC_CLASS ##### -->
<para>
</para>
@obj:
<!-- ##### FUNCTION gst_sinesrc_new ##### --> <!-- ##### FUNCTION gst_sinesrc_new ##### -->
<para> <para>
@ -2745,6 +2751,13 @@ the offset.
@name: @name:
@Returns: @Returns:
<!-- ##### MACRO GST_IS_ASYNCDISKSRC_CLASS ##### -->
<para>
</para>
@obj:
<!-- ##### ARG GstAudioSrc:curoffset ##### --> <!-- ##### ARG GstAudioSrc:curoffset ##### -->
<para> <para>
Get the current number of bytes read. Get the current number of bytes read.
@ -2793,13 +2806,6 @@ plugin
@klass: @klass:
<!-- ##### MACRO GST_ASYNCDISKSRC ##### -->
<para>
</para>
@obj:
<!-- ##### MACRO GST_HTTPSRC_CLASS ##### --> <!-- ##### MACRO GST_HTTPSRC_CLASS ##### -->
<para> <para>
@ -2807,6 +2813,13 @@ plugin
@klass: @klass:
<!-- ##### MACRO GST_ASYNCDISKSRC ##### -->
<para>
</para>
@obj:
<!-- ##### ARG GstPad:active ##### --> <!-- ##### ARG GstPad:active ##### -->
<para> <para>
Indicates this pad is active Indicates this pad is active

View file

@ -120,7 +120,7 @@ gst_caps_destroy (GstCaps *caps)
* Decrease the refcount of this caps structure, * Decrease the refcount of this caps structure,
* destroying it when the refcount is 0 * destroying it when the refcount is 0
* *
* Retruns: caps or NULL if the refcount reached 0 * Returns: caps or NULL if the refcount reached 0
*/ */
GstCaps* GstCaps*
gst_caps_unref (GstCaps *caps) gst_caps_unref (GstCaps *caps)
@ -153,7 +153,7 @@ gst_caps_unref (GstCaps *caps)
* *
* Increase the refcount of this caps structure * Increase the refcount of this caps structure
* *
* Returnns: the caps with the refcount incremented * Returns: the caps with the refcount incremented
*/ */
GstCaps* GstCaps*
gst_caps_ref (GstCaps *caps) gst_caps_ref (GstCaps *caps)

View file

@ -336,6 +336,15 @@ gst_object_sink (GstObject *object)
} }
#endif /* gst_object_sink */ #endif /* gst_object_sink */
/**
* gst_object_save_thyself:
* @object: GstObject to save
* @parent: The parent XML node to save the object into
*
* Saves the given object into the parent XML node.
*
* Returns: the new xmlNodePtr with the saved object
*/
xmlNodePtr xmlNodePtr
gst_object_save_thyself (GstObject *object, xmlNodePtr parent) gst_object_save_thyself (GstObject *object, xmlNodePtr parent)
{ {

View file

@ -452,7 +452,7 @@ gst_pad_set_newcaps_function (GstPad *pad,
/** /**
* gst_pad_set_bufferpool_function: * gst_pad_set_bufferpool_function:
* @pad: the pad to set the bufferpool function for * @pad: the pad to set the bufferpool function for
* @newcaps: the bufferpool function * @bufpool: the bufferpool function
* *
* Set the given bufferpool function for the pad. * Set the given bufferpool function for the pad.
*/ */
@ -916,6 +916,15 @@ gst_pad_get_peer (GstPad *pad)
return GST_PAD(GST_PAD_PEER(pad)); return GST_PAD(GST_PAD_PEER(pad));
} }
/**
* gst_pad_get_buffer_pool:
* @pad: the pad to get the bufferpool from
*
* Gst the bufferpool of the peer pad of the given
* pad
*
* Returns: The GstBufferPool or NULL.
*/
GstBufferPool* GstBufferPool*
gst_pad_get_bufferpool (GstPad *pad) gst_pad_get_bufferpool (GstPad *pad)
{ {

View file

@ -4,53 +4,87 @@
GstPad *srcpad, *sinkpad; GstPad *srcpad, *sinkpad;
GstPad *srcpadtempl, *sinkpadtempl; GstPad *srcpadtempl, *sinkpadtempl;
static GstPadFactory src_factory = { static GstPadTemplate*
"src", src_template_factory (void)
GST_PAD_FACTORY_SRC, {
GST_PAD_FACTORY_ALWAYS, static GstPadTemplate *templ = NULL;
GST_PAD_FACTORY_CAPS(
"test_src",
"video/raw",
"height", GST_PROPS_INT_RANGE (16, 4096)
),
NULL,
};
static GstPadFactory sink_factory = { if (!templ) {
"sink", templ = gst_padtemplate_new (
GST_PAD_FACTORY_SINK, "src",
GST_PAD_FACTORY_ALWAYS, GST_PAD_SRC,
GST_PAD_FACTORY_CAPS( GST_PAD_ALWAYS,
"test_sink", gst_caps_new (
"video/raw", "test_src",
"height", GST_PROPS_INT_RANGE (16, 8192) "video/raw",
), gst_props_new (
NULL, "height", GST_PROPS_INT_RANGE (16, 4096),
}; NULL)),
NULL);
}
return templ;
}
static GstCapsFactory sink_caps = { static GstPadTemplate*
"sink_caps", sink_template_factory (void)
"video/raw", {
"height", GST_PROPS_INT (3000), static GstPadTemplate *templ = NULL;
NULL
};
static GstCapsFactory src_caps = { if (!templ) {
"src_caps", templ = gst_padtemplate_new (
"video/raw", "sink",
"height", GST_PROPS_INT (3000), GST_PAD_SINK,
NULL GST_PAD_ALWAYS,
}; gst_caps_new (
"test_sink",
"video/raw",
gst_props_new (
"height", GST_PROPS_INT_RANGE (16, 8192),
NULL)),
NULL);
}
return templ;
}
static GstPadTemplate *srctempl, *sinktempl; static GstCaps*
static GstCaps *srccaps, *sinkcaps; sink_caps_factory (void)
{
static GstCaps *caps = NULL;
if (!caps) {
caps = gst_caps_new (
"sink_caps",
"video/raw",
gst_props_new (
"height", GST_PROPS_INT (3000),
NULL));
}
return caps;
}
static GstCaps*
src_caps_factory (void)
{
static GstCaps *caps = NULL;
if (!caps) {
caps = gst_caps_new (
"src_caps",
"video/raw",
gst_props_new (
"height", GST_PROPS_INT (3000),
NULL));
}
return caps;
}
static GstPadNegotiateReturn static GstPadNegotiateReturn
negotiate_src (GstPad *pad, GstCaps **caps, gint counter) negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data)
{ {
g_print (">"); g_print (">");
if (counter == 0) { if (*data == NULL) {
*data = GINT_TO_POINTER (TRUE);
*caps = NULL; *caps = NULL;
return GST_PAD_NEGOTIATE_TRY; return GST_PAD_NEGOTIATE_TRY;
} }
@ -61,10 +95,11 @@ negotiate_src (GstPad *pad, GstCaps **caps, gint counter)
} }
static GstPadNegotiateReturn static GstPadNegotiateReturn
negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data)
{ {
g_print ("<"); g_print ("<");
if (counter == 0) { if (*data == NULL) {
*data = GINT_TO_POINTER (TRUE);
*caps = NULL; *caps = NULL;
return GST_PAD_NEGOTIATE_TRY; return GST_PAD_NEGOTIATE_TRY;
} }
@ -74,6 +109,9 @@ negotiate_sink (GstPad *pad, GstCaps **caps, gint counter)
return GST_PAD_NEGOTIATE_FAIL; return GST_PAD_NEGOTIATE_FAIL;
} }
static GstPadTemplate *srctempl, *sinktempl;
static GstCaps *srccaps, *sinkcaps;
static gboolean static gboolean
perform_check (void) perform_check (void)
{ {
@ -121,14 +159,14 @@ main (int argc, char *argv[])
srcpad = gst_pad_new ("src", GST_PAD_SRC); srcpad = gst_pad_new ("src", GST_PAD_SRC);
sinkpad = gst_pad_new ("sink", GST_PAD_SINK); sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
srctempl = gst_padtemplate_new (&src_factory); srctempl = src_template_factory ();
sinktempl = gst_padtemplate_new (&sink_factory); sinktempl = sink_template_factory ();
srcpadtempl = gst_pad_new_from_template (srctempl, "src"); srcpadtempl = gst_pad_new_from_template (src_template_factory (), "src");
sinkpadtempl = gst_pad_new_from_template (sinktempl, "sink"); sinkpadtempl = gst_pad_new_from_template (sink_template_factory (), "sink");
sinkcaps = gst_caps_register (&sink_caps); sinkcaps = sink_caps_factory ();
srccaps = gst_caps_register (&src_caps); srccaps = src_caps_factory ();
g_print ("*** compatible caps/templates ***\n"); g_print ("*** compatible caps/templates ***\n");

View file

@ -3,82 +3,112 @@
GstPad *srcpad, *sinkpad; GstPad *srcpad, *sinkpad;
GstPad *srcconvpad, *sinkconvpad; GstPad *srcconvpad, *sinkconvpad;
GstPad *srcpadtempl, *sinkpadtempl; GstPadTemplate *srcpadtempl, *sinkpadtempl;
GstPad *srcconvtempl, *sinkconvtempl; GstPadTemplate *srcconvtempl, *sinkconvtempl;
gint converter_in = -1, converter_out = -1; gint converter_in = -1, converter_out = -1;
static GstPadFactory src_factory = { static GstPadTemplate*
"src", src_factory (void)
GST_PAD_FACTORY_SRC, {
GST_PAD_FACTORY_ALWAYS, return
GST_PAD_FACTORY_CAPS( gst_padtemplate_new (
"test_src", "src",
"audio/raw", GST_PAD_SRC,
"rate", GST_PROPS_INT_RANGE (16, 20000) GST_PAD_ALWAYS,
), gst_caps_new (
NULL, "test_src",
}; "audio/raw",
gst_props_new (
"rate", GST_PROPS_INT_RANGE (16, 20000),
NULL)),
NULL);
}
static GstPadFactory src_conv_factory = { static GstPadTemplate*
"src", src_conv_factory (void)
GST_PAD_FACTORY_SRC, {
GST_PAD_FACTORY_ALWAYS, return
GST_PAD_FACTORY_CAPS( gst_padtemplate_new (
"test_src", "src",
"audio/raw", GST_PAD_SRC,
"rate", GST_PROPS_INT_RANGE (16, 20000) GST_PAD_ALWAYS,
), gst_caps_new (
NULL, "test_src",
}; "audio/raw",
gst_props_new (
"rate", GST_PROPS_INT_RANGE (16, 20000),
NULL)),
NULL);
}
static GstPadFactory sink_conv_factory = { static GstPadTemplate*
"src", sink_conv_factory (void)
GST_PAD_FACTORY_SINK, {
GST_PAD_FACTORY_ALWAYS, return
GST_PAD_FACTORY_CAPS( gst_padtemplate_new (
"test_src", "src",
"audio/raw", GST_PAD_SINK,
"rate", GST_PROPS_INT_RANGE (16, 20000) GST_PAD_ALWAYS,
), gst_caps_new (
NULL, "test_src",
}; "audio/raw",
gst_props_new (
"rate", GST_PROPS_INT_RANGE (16, 20000),
NULL)),
NULL);
}
static GstPadFactory sink_factory = { static GstPadTemplate*
"sink", sink_factory (void)
GST_PAD_FACTORY_SINK, {
GST_PAD_FACTORY_ALWAYS, return
GST_PAD_FACTORY_CAPS( gst_padtemplate_new (
"test_sink", "sink",
"audio/raw", GST_PAD_SINK,
"rate", GST_PROPS_INT_RANGE (16, 20000) GST_PAD_ALWAYS,
), gst_caps_new (
NULL, "test_sink",
}; "audio/raw",
gst_props_new (
"rate", GST_PROPS_INT_RANGE (16, 20000),
NULL)),
NULL);
}
static GstCapsFactory sink_caps = { static GstCaps*
"sink_caps", sink_caps (void)
"audio/raw", {
"rate", GST_PROPS_INT (6000), return
NULL gst_caps_new (
}; "sink_caps",
"audio/raw",
gst_props_new (
"rate", GST_PROPS_INT (6000),
NULL));
}
static GstCapsFactory src_caps = { static GstCaps*
"src_caps", src_caps (void)
"audio/raw", {
"rate", GST_PROPS_INT (3000), return
NULL gst_caps_new (
}; "src_caps",
"audio/raw",
gst_props_new (
"rate", GST_PROPS_INT (3000),
NULL));
}
static GstPadTemplate *srctempl, *sinktempl; static GstPadTemplate *srctempl, *sinktempl;
static GstCaps *srccaps, *sinkcaps; static GstCaps *srccaps, *sinkcaps;
static GstPadNegotiateReturn static GstPadNegotiateReturn
negotiate_src (GstPad *pad, GstCaps **caps, gint counter) negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data)
{ {
g_print (">"); g_print (">");
if (counter == 0) { if (data == NULL) {
*caps = NULL; *caps = NULL;
return GST_PAD_NEGOTIATE_TRY; return GST_PAD_NEGOTIATE_TRY;
} }
@ -91,10 +121,10 @@ negotiate_src (GstPad *pad, GstCaps **caps, gint counter)
} }
static GstPadNegotiateReturn static GstPadNegotiateReturn
negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data)
{ {
g_print ("<"); g_print ("<");
if (counter == 0) { if (data == NULL) {
*caps = NULL; *caps = NULL;
return GST_PAD_NEGOTIATE_TRY; return GST_PAD_NEGOTIATE_TRY;
} }
@ -114,21 +144,22 @@ main (int argc, char *argv[])
gst_init (&argc, &argv); gst_init (&argc, &argv);
srctempl = gst_padtemplate_new (&src_factory); srctempl = src_factory ();
sinktempl = gst_padtemplate_new (&sink_factory); sinktempl = sink_factory ();
srcpad = gst_pad_new_from_template (srctempl, "src"); srcpad = gst_pad_new_from_template (srctempl, "src");
sinkpad = gst_pad_new_from_template (sinktempl, "sink"); sinkpad = gst_pad_new_from_template (sinktempl, "sink");
srcconvtempl = gst_padtemplate_new (&src_conv_factory); srcconvtempl = src_conv_factory ();
sinkconvtempl = gst_padtemplate_new (&sink_conv_factory); sinkconvtempl = sink_conv_factory ();
srcconvpad = gst_pad_new_from_template (srcconvtempl, "src"); srcconvpad = gst_pad_new_from_template (srcconvtempl, "src");
sinkconvpad = gst_pad_new_from_template (sinkconvtempl, "sink"); sinkconvpad = gst_pad_new_from_template (sinkconvtempl, "sink");
gst_pad_set_negotiate_function (srcconvpad, negotiate_src); gst_pad_set_negotiate_function (srcconvpad, negotiate_src);
gst_pad_set_negotiate_function (sinkconvpad, negotiate_sink); gst_pad_set_negotiate_function (sinkconvpad, negotiate_sink);
sinkcaps = gst_caps_register (&sink_caps); sinkcaps = sink_caps ();
srccaps = gst_caps_register (&src_caps); srccaps = src_caps ();
result = gst_pad_set_caps (srcpad, srccaps); result = gst_pad_set_caps (srcpad, srccaps);
g_print ("set caps on src: %d\n", result); g_print ("set caps on src: %d\n", result);
g_print ("initial converter status: %d %d\n", converter_in, converter_out); g_print ("initial converter status: %d %d\n", converter_in, converter_out);

View file

@ -3,83 +3,113 @@
GstPad *srcpad, *sinkpad; GstPad *srcpad, *sinkpad;
GstPad *srcconvpad, *sinkconvpad; GstPad *srcconvpad, *sinkconvpad;
GstPad *srcpadtempl, *sinkpadtempl; GstPadTemplate *srcpadtempl, *sinkpadtempl;
GstPad *srcconvtempl, *sinkconvtempl; GstPadTemplate *srcconvtempl, *sinkconvtempl;
gint converter_in = -1, converter_out = -1; gint converter_in = -1, converter_out = -1;
gint target_rate = 2000; gint target_rate = 2000;
static GstPadFactory src_factory = { static GstPadTemplate*
"src", src_factory (void)
GST_PAD_FACTORY_SRC, {
GST_PAD_FACTORY_ALWAYS, return
GST_PAD_FACTORY_CAPS( gst_padtemplate_new (
"test_src", "src",
"audio/raw", GST_PAD_SRC,
"rate", GST_PROPS_INT_RANGE (16, 20000) GST_PAD_ALWAYS,
), gst_caps_new (
NULL, "test_src",
}; "audio/raw",
gst_props_new (
"rate", GST_PROPS_INT_RANGE (16, 20000),
NULL)),
NULL);
}
static GstPadFactory src_conv_factory = { static GstPadTemplate*
"src", src_conv_factory (void)
GST_PAD_FACTORY_SRC, {
GST_PAD_FACTORY_ALWAYS, return
GST_PAD_FACTORY_CAPS( gst_padtemplate_new (
"test_src", "src",
"audio/raw", GST_PAD_SRC,
"rate", GST_PROPS_INT_RANGE (16, 20000) GST_PAD_ALWAYS,
), gst_caps_new (
NULL, "test_src",
}; "audio/raw",
gst_props_new (
"rate", GST_PROPS_INT_RANGE (16, 20000),
NULL)),
NULL);
}
static GstPadFactory sink_conv_factory = { static GstPadTemplate*
"src", sink_conv_factory (void)
GST_PAD_FACTORY_SINK, {
GST_PAD_FACTORY_ALWAYS, return
GST_PAD_FACTORY_CAPS( gst_padtemplate_new (
"test_src", "src",
"audio/raw", GST_PAD_SINK,
"rate", GST_PROPS_INT_RANGE (16, 20000) GST_PAD_ALWAYS,
), gst_caps_new (
NULL, "test_src",
}; "audio/raw",
gst_props_new (
"rate", GST_PROPS_INT_RANGE (16, 20000),
NULL)),
NULL);
}
static GstPadFactory sink_factory = { static GstPadTemplate*
"sink", sink_factory (void)
GST_PAD_FACTORY_SINK, {
GST_PAD_FACTORY_ALWAYS, return
GST_PAD_FACTORY_CAPS( gst_padtemplate_new (
"test_sink", "sink",
"audio/raw", GST_PAD_SINK,
"rate", GST_PROPS_INT_RANGE (16, 20000) GST_PAD_ALWAYS,
), gst_caps_new (
NULL, "test_sink",
}; "audio/raw",
gst_props_new (
"rate", GST_PROPS_INT_RANGE (16, 20000),
NULL)),
NULL);
}
static GstCapsFactory sink_caps = { static GstCaps*
"sink_caps", sink_caps (void)
"audio/raw", {
"rate", GST_PROPS_INT (6000), return
NULL gst_caps_new (
}; "sink_caps",
"audio/raw",
gst_props_new (
"rate", GST_PROPS_INT (6000),
NULL));
}
static GstCapsFactory src_caps = { static GstCaps*
"src_caps", src_caps (void)
"audio/raw", {
"rate", GST_PROPS_INT (3000), return
NULL gst_caps_new (
}; "src_caps",
"audio/raw",
gst_props_new (
"rate", GST_PROPS_INT (3000),
NULL));
}
static GstPadTemplate *srctempl, *sinktempl; static GstPadTemplate *srctempl, *sinktempl;
static GstCaps *srccaps, *sinkcaps; static GstCaps *srccaps, *sinkcaps;
static GstPadNegotiateReturn static GstPadNegotiateReturn
converter_negotiate_src (GstPad *pad, GstCaps **caps, gint counter) converter_negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data)
{ {
g_print (">"); g_print (">");
if (counter == 0) { if (*data == NULL) {
*caps = NULL; *caps = NULL;
return GST_PAD_NEGOTIATE_TRY; return GST_PAD_NEGOTIATE_TRY;
} }
@ -92,19 +122,19 @@ converter_negotiate_src (GstPad *pad, GstCaps **caps, gint counter)
} }
static GstPadNegotiateReturn static GstPadNegotiateReturn
converter_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) converter_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data)
{ {
g_print ("<"); g_print ("<");
if (counter == 0) { if (*data == NULL) {
*caps = GST_PAD_CAPS (srcconvpad); *caps = GST_PAD_CAPS (srcconvpad);
return GST_PAD_NEGOTIATE_TRY; return GST_PAD_NEGOTIATE_TRY;
} }
if (*caps) { if (*caps) {
converter_in = gst_caps_get_int (*caps, "rate"); converter_in = gst_caps_get_int (*caps, "rate");
if (counter == 1) { if (*data == 1) {
converter_out = gst_caps_get_int (*caps, "rate"); converter_out = gst_caps_get_int (*caps, "rate");
return gst_pad_negotiate_proxy (pad, srcconvpad, caps, counter); return gst_pad_negotiate_proxy (pad, srcconvpad, caps);
} }
return GST_PAD_NEGOTIATE_AGREE; return GST_PAD_NEGOTIATE_AGREE;
} }
@ -113,11 +143,11 @@ converter_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter)
} }
static GstPadNegotiateReturn static GstPadNegotiateReturn
target_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) target_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data)
{ {
g_print ("{"); g_print ("{");
if (counter == 0) { if (*data == NULL) {
*caps = gst_caps_new_with_props ( *caps = gst_caps_new (
"target_caps", "target_caps",
"audio/raw", "audio/raw",
gst_props_new ( gst_props_new (
@ -143,13 +173,13 @@ main (int argc, char *argv[])
gst_init (&argc, &argv); gst_init (&argc, &argv);
srctempl = gst_padtemplate_new (&src_factory); srctempl = src_factory ();
sinktempl = gst_padtemplate_new (&sink_factory); sinktempl = sink_factory ();
srcpad = gst_pad_new_from_template (srctempl, "src"); srcpad = gst_pad_new_from_template (srctempl, "src");
sinkpad = gst_pad_new_from_template (sinktempl, "sink"); sinkpad = gst_pad_new_from_template (sinktempl, "sink");
srcconvtempl = gst_padtemplate_new (&src_conv_factory); srcconvtempl = src_conv_factory ();
sinkconvtempl = gst_padtemplate_new (&sink_conv_factory); sinkconvtempl = sink_conv_factory ();
srcconvpad = gst_pad_new_from_template (srcconvtempl, "csrc"); srcconvpad = gst_pad_new_from_template (srcconvtempl, "csrc");
sinkconvpad = gst_pad_new_from_template (sinkconvtempl, "csink"); sinkconvpad = gst_pad_new_from_template (sinkconvtempl, "csink");
@ -157,8 +187,8 @@ main (int argc, char *argv[])
gst_pad_set_negotiate_function (sinkconvpad, converter_negotiate_sink); gst_pad_set_negotiate_function (sinkconvpad, converter_negotiate_sink);
gst_pad_set_negotiate_function (sinkpad, target_negotiate_sink); gst_pad_set_negotiate_function (sinkpad, target_negotiate_sink);
sinkcaps = gst_caps_register (&sink_caps); sinkcaps = sink_caps ();
srccaps = gst_caps_register (&src_caps); srccaps = src_caps ();
g_print ("-------) (-----------) (----- \n"); g_print ("-------) (-----------) (----- \n");
g_print (" ! ! converter ! ! \n"); g_print (" ! ! converter ! ! \n");

View file

@ -4,36 +4,51 @@
GstPad *srcconvpad, *sinkconvpad; GstPad *srcconvpad, *sinkconvpad;
GstPadTemplate *srcconvtempl, *sinkconvtempl; GstPadTemplate *srcconvtempl, *sinkconvtempl;
static GstPadFactory src_conv_factory = { static GstPadTemplate*
"src", src_conv_factory (void)
GST_PAD_FACTORY_SRC, {
GST_PAD_FACTORY_ALWAYS, return
GST_PAD_FACTORY_CAPS( gst_padtemplate_new (
"test_src", "src",
"audio/raw", GST_PAD_SRC,
"rate", GST_PROPS_INT_RANGE (16, 20000) GST_PAD_ALWAYS,
), gst_caps_new (
NULL, "test_src",
}; "audio/raw",
gst_props_new (
"rate", GST_PROPS_INT_RANGE (16, 20000),
NULL)),
NULL);
}
static GstPadFactory sink_conv_factory = { static GstPadTemplate*
"src", sink_conv_factory (void)
GST_PAD_FACTORY_SINK, {
GST_PAD_FACTORY_ALWAYS, return
GST_PAD_FACTORY_CAPS( gst_padtemplate_new (
"test_src", "sink",
"audio/raw", GST_PAD_SINK,
"rate", GST_PROPS_INT_RANGE (16, 20000) GST_PAD_ALWAYS,
), gst_caps_new (
NULL, "test_src",
}; "audio/raw",
gst_props_new (
"rate", GST_PROPS_INT_RANGE (16, 20000),
NULL)),
NULL);
}
static GstCapsFactory src_caps = { static GstCaps*
"src_caps", src_caps (void)
"audio/raw", {
"rate", GST_PROPS_INT (3000), return
NULL gst_caps_new (
}; "src_caps",
"audio/raw",
gst_props_new (
"rate", GST_PROPS_INT (3000),
NULL));
}
static GstCaps *srccaps, *sinkcaps; static GstCaps *srccaps, *sinkcaps;
@ -41,14 +56,14 @@ static gint src_rate = 140;
static gint sink_rate = 100; static gint sink_rate = 100;
static GstPadNegotiateReturn static GstPadNegotiateReturn
negotiate_src (GstPad *pad, GstCaps **caps, gint counter) negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data)
{ {
g_print (">(%d:%d)", src_rate, (*caps)->refcount); g_print (">(%d:%d)", src_rate, (*caps)->refcount);
src_rate++; src_rate++;
if (counter == 0 || caps == NULL) { if (*data == NULL || caps == NULL) {
g_print ("*"); g_print ("*");
*caps = gst_caps_new_with_props ( *caps = gst_caps_new (
"src_caps", "src_caps",
"audio/raw", "audio/raw",
gst_props_new ( gst_props_new (
@ -77,15 +92,15 @@ negotiate_src (GstPad *pad, GstCaps **caps, gint counter)
} }
static GstPadNegotiateReturn static GstPadNegotiateReturn
negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data)
{ {
g_print ("<(%d:%d:%p)", sink_rate, (*caps)->refcount, *caps); g_print ("<(%d:%d:%p)", sink_rate, (*caps)->refcount, *caps);
sink_rate++; sink_rate++;
if (counter == 0 || *caps == NULL) { if (*data == NULL || *caps == NULL) {
g_print ("*"); g_print ("*");
*caps = gst_caps_new_with_props ( *caps = gst_caps_new (
"sink_caps", "sink_caps",
"audio/raw", "audio/raw",
gst_props_new ( gst_props_new (
@ -126,15 +141,15 @@ main (int argc, char *argv[])
g_mem_chunk_info(); g_mem_chunk_info();
srcconvtempl = gst_padtemplate_new (&src_conv_factory); srcconvtempl = src_conv_factory ();
sinkconvtempl = gst_padtemplate_new (&sink_conv_factory); sinkconvtempl = sink_conv_factory ();
srcconvpad = gst_pad_new_from_template (srcconvtempl, "src"); srcconvpad = gst_pad_new_from_template (srcconvtempl, "src");
sinkconvpad = gst_pad_new_from_template (sinkconvtempl, "sink"); sinkconvpad = gst_pad_new_from_template (sinkconvtempl, "sink");
gst_pad_set_negotiate_function (srcconvpad, negotiate_src); gst_pad_set_negotiate_function (srcconvpad, negotiate_src);
gst_pad_set_negotiate_function (sinkconvpad, negotiate_sink); gst_pad_set_negotiate_function (sinkconvpad, negotiate_sink);
srccaps = gst_caps_register (&src_caps); srccaps = src_caps ();
sinkcaps = gst_caps_copy (srccaps); sinkcaps = gst_caps_copy (srccaps);
g_print ("The wild goose chase...\n"); g_print ("The wild goose chase...\n");

View file

@ -4,53 +4,87 @@
GstPad *srcpad, *sinkpad; GstPad *srcpad, *sinkpad;
GstPad *srcpadtempl, *sinkpadtempl; GstPad *srcpadtempl, *sinkpadtempl;
static GstPadFactory src_factory = { static GstPadTemplate*
"src", src_template_factory (void)
GST_PAD_FACTORY_SRC, {
GST_PAD_FACTORY_ALWAYS, static GstPadTemplate *templ = NULL;
GST_PAD_FACTORY_CAPS(
"test_src",
"video/raw",
"height", GST_PROPS_INT_RANGE (16, 4096)
),
NULL,
};
static GstPadFactory sink_factory = { if (!templ) {
"sink", templ = gst_padtemplate_new (
GST_PAD_FACTORY_SINK, "src",
GST_PAD_FACTORY_ALWAYS, GST_PAD_SRC,
GST_PAD_FACTORY_CAPS( GST_PAD_ALWAYS,
"test_sink", gst_caps_new (
"video/raw", "test_src",
"height", GST_PROPS_INT_RANGE (16, 8192) "video/raw",
), gst_props_new (
NULL, "height", GST_PROPS_INT_RANGE (16, 4096),
}; NULL)),
NULL);
}
return templ;
}
static GstCapsFactory sink_caps = { static GstPadTemplate*
"sink_caps", sink_template_factory (void)
"video/raw", {
"height", GST_PROPS_INT (3000), static GstPadTemplate *templ = NULL;
NULL
};
static GstCapsFactory src_caps = { if (!templ) {
"src_caps", templ = gst_padtemplate_new (
"video/raw", "sink",
"height", GST_PROPS_INT (3000), GST_PAD_SINK,
NULL GST_PAD_ALWAYS,
}; gst_caps_new (
"test_sink",
"video/raw",
gst_props_new (
"height", GST_PROPS_INT_RANGE (16, 8192),
NULL)),
NULL);
}
return templ;
}
static GstPadTemplate *srctempl, *sinktempl; static GstCaps*
static GstCaps *srccaps, *sinkcaps; sink_caps_factory (void)
{
static GstCaps *caps = NULL;
if (!caps) {
caps = gst_caps_new (
"sink_caps",
"video/raw",
gst_props_new (
"height", GST_PROPS_INT (3000),
NULL));
}
return caps;
}
static GstCaps*
src_caps_factory (void)
{
static GstCaps *caps = NULL;
if (!caps) {
caps = gst_caps_new (
"src_caps",
"video/raw",
gst_props_new (
"height", GST_PROPS_INT (3000),
NULL));
}
return caps;
}
static GstPadNegotiateReturn static GstPadNegotiateReturn
negotiate_src (GstPad *pad, GstCaps **caps, gint counter) negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data)
{ {
g_print (">"); g_print (">");
if (counter == 0) { if (*data == NULL) {
*data = GINT_TO_POINTER (TRUE);
*caps = NULL; *caps = NULL;
return GST_PAD_NEGOTIATE_TRY; return GST_PAD_NEGOTIATE_TRY;
} }
@ -61,10 +95,11 @@ negotiate_src (GstPad *pad, GstCaps **caps, gint counter)
} }
static GstPadNegotiateReturn static GstPadNegotiateReturn
negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data)
{ {
g_print ("<"); g_print ("<");
if (counter == 0) { if (*data == NULL) {
*data = GINT_TO_POINTER (TRUE);
*caps = NULL; *caps = NULL;
return GST_PAD_NEGOTIATE_TRY; return GST_PAD_NEGOTIATE_TRY;
} }
@ -74,6 +109,9 @@ negotiate_sink (GstPad *pad, GstCaps **caps, gint counter)
return GST_PAD_NEGOTIATE_FAIL; return GST_PAD_NEGOTIATE_FAIL;
} }
static GstPadTemplate *srctempl, *sinktempl;
static GstCaps *srccaps, *sinkcaps;
static gboolean static gboolean
perform_check (void) perform_check (void)
{ {
@ -121,14 +159,14 @@ main (int argc, char *argv[])
srcpad = gst_pad_new ("src", GST_PAD_SRC); srcpad = gst_pad_new ("src", GST_PAD_SRC);
sinkpad = gst_pad_new ("sink", GST_PAD_SINK); sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
srctempl = gst_padtemplate_new (&src_factory); srctempl = src_template_factory ();
sinktempl = gst_padtemplate_new (&sink_factory); sinktempl = sink_template_factory ();
srcpadtempl = gst_pad_new_from_template (srctempl, "src"); srcpadtempl = gst_pad_new_from_template (src_template_factory (), "src");
sinkpadtempl = gst_pad_new_from_template (sinktempl, "sink"); sinkpadtempl = gst_pad_new_from_template (sink_template_factory (), "sink");
sinkcaps = gst_caps_register (&sink_caps); sinkcaps = sink_caps_factory ();
srccaps = gst_caps_register (&src_caps); srccaps = src_caps_factory ();
g_print ("*** compatible caps/templates ***\n"); g_print ("*** compatible caps/templates ***\n");

View file

@ -3,82 +3,112 @@
GstPad *srcpad, *sinkpad; GstPad *srcpad, *sinkpad;
GstPad *srcconvpad, *sinkconvpad; GstPad *srcconvpad, *sinkconvpad;
GstPad *srcpadtempl, *sinkpadtempl; GstPadTemplate *srcpadtempl, *sinkpadtempl;
GstPad *srcconvtempl, *sinkconvtempl; GstPadTemplate *srcconvtempl, *sinkconvtempl;
gint converter_in = -1, converter_out = -1; gint converter_in = -1, converter_out = -1;
static GstPadFactory src_factory = { static GstPadTemplate*
"src", src_factory (void)
GST_PAD_FACTORY_SRC, {
GST_PAD_FACTORY_ALWAYS, return
GST_PAD_FACTORY_CAPS( gst_padtemplate_new (
"test_src", "src",
"audio/raw", GST_PAD_SRC,
"rate", GST_PROPS_INT_RANGE (16, 20000) GST_PAD_ALWAYS,
), gst_caps_new (
NULL, "test_src",
}; "audio/raw",
gst_props_new (
"rate", GST_PROPS_INT_RANGE (16, 20000),
NULL)),
NULL);
}
static GstPadFactory src_conv_factory = { static GstPadTemplate*
"src", src_conv_factory (void)
GST_PAD_FACTORY_SRC, {
GST_PAD_FACTORY_ALWAYS, return
GST_PAD_FACTORY_CAPS( gst_padtemplate_new (
"test_src", "src",
"audio/raw", GST_PAD_SRC,
"rate", GST_PROPS_INT_RANGE (16, 20000) GST_PAD_ALWAYS,
), gst_caps_new (
NULL, "test_src",
}; "audio/raw",
gst_props_new (
"rate", GST_PROPS_INT_RANGE (16, 20000),
NULL)),
NULL);
}
static GstPadFactory sink_conv_factory = { static GstPadTemplate*
"src", sink_conv_factory (void)
GST_PAD_FACTORY_SINK, {
GST_PAD_FACTORY_ALWAYS, return
GST_PAD_FACTORY_CAPS( gst_padtemplate_new (
"test_src", "src",
"audio/raw", GST_PAD_SINK,
"rate", GST_PROPS_INT_RANGE (16, 20000) GST_PAD_ALWAYS,
), gst_caps_new (
NULL, "test_src",
}; "audio/raw",
gst_props_new (
"rate", GST_PROPS_INT_RANGE (16, 20000),
NULL)),
NULL);
}
static GstPadFactory sink_factory = { static GstPadTemplate*
"sink", sink_factory (void)
GST_PAD_FACTORY_SINK, {
GST_PAD_FACTORY_ALWAYS, return
GST_PAD_FACTORY_CAPS( gst_padtemplate_new (
"test_sink", "sink",
"audio/raw", GST_PAD_SINK,
"rate", GST_PROPS_INT_RANGE (16, 20000) GST_PAD_ALWAYS,
), gst_caps_new (
NULL, "test_sink",
}; "audio/raw",
gst_props_new (
"rate", GST_PROPS_INT_RANGE (16, 20000),
NULL)),
NULL);
}
static GstCapsFactory sink_caps = { static GstCaps*
"sink_caps", sink_caps (void)
"audio/raw", {
"rate", GST_PROPS_INT (6000), return
NULL gst_caps_new (
}; "sink_caps",
"audio/raw",
gst_props_new (
"rate", GST_PROPS_INT (6000),
NULL));
}
static GstCapsFactory src_caps = { static GstCaps*
"src_caps", src_caps (void)
"audio/raw", {
"rate", GST_PROPS_INT (3000), return
NULL gst_caps_new (
}; "src_caps",
"audio/raw",
gst_props_new (
"rate", GST_PROPS_INT (3000),
NULL));
}
static GstPadTemplate *srctempl, *sinktempl; static GstPadTemplate *srctempl, *sinktempl;
static GstCaps *srccaps, *sinkcaps; static GstCaps *srccaps, *sinkcaps;
static GstPadNegotiateReturn static GstPadNegotiateReturn
negotiate_src (GstPad *pad, GstCaps **caps, gint counter) negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data)
{ {
g_print (">"); g_print (">");
if (counter == 0) { if (data == NULL) {
*caps = NULL; *caps = NULL;
return GST_PAD_NEGOTIATE_TRY; return GST_PAD_NEGOTIATE_TRY;
} }
@ -91,10 +121,10 @@ negotiate_src (GstPad *pad, GstCaps **caps, gint counter)
} }
static GstPadNegotiateReturn static GstPadNegotiateReturn
negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data)
{ {
g_print ("<"); g_print ("<");
if (counter == 0) { if (data == NULL) {
*caps = NULL; *caps = NULL;
return GST_PAD_NEGOTIATE_TRY; return GST_PAD_NEGOTIATE_TRY;
} }
@ -114,21 +144,22 @@ main (int argc, char *argv[])
gst_init (&argc, &argv); gst_init (&argc, &argv);
srctempl = gst_padtemplate_new (&src_factory); srctempl = src_factory ();
sinktempl = gst_padtemplate_new (&sink_factory); sinktempl = sink_factory ();
srcpad = gst_pad_new_from_template (srctempl, "src"); srcpad = gst_pad_new_from_template (srctempl, "src");
sinkpad = gst_pad_new_from_template (sinktempl, "sink"); sinkpad = gst_pad_new_from_template (sinktempl, "sink");
srcconvtempl = gst_padtemplate_new (&src_conv_factory); srcconvtempl = src_conv_factory ();
sinkconvtempl = gst_padtemplate_new (&sink_conv_factory); sinkconvtempl = sink_conv_factory ();
srcconvpad = gst_pad_new_from_template (srcconvtempl, "src"); srcconvpad = gst_pad_new_from_template (srcconvtempl, "src");
sinkconvpad = gst_pad_new_from_template (sinkconvtempl, "sink"); sinkconvpad = gst_pad_new_from_template (sinkconvtempl, "sink");
gst_pad_set_negotiate_function (srcconvpad, negotiate_src); gst_pad_set_negotiate_function (srcconvpad, negotiate_src);
gst_pad_set_negotiate_function (sinkconvpad, negotiate_sink); gst_pad_set_negotiate_function (sinkconvpad, negotiate_sink);
sinkcaps = gst_caps_register (&sink_caps); sinkcaps = sink_caps ();
srccaps = gst_caps_register (&src_caps); srccaps = src_caps ();
result = gst_pad_set_caps (srcpad, srccaps); result = gst_pad_set_caps (srcpad, srccaps);
g_print ("set caps on src: %d\n", result); g_print ("set caps on src: %d\n", result);
g_print ("initial converter status: %d %d\n", converter_in, converter_out); g_print ("initial converter status: %d %d\n", converter_in, converter_out);

View file

@ -3,83 +3,113 @@
GstPad *srcpad, *sinkpad; GstPad *srcpad, *sinkpad;
GstPad *srcconvpad, *sinkconvpad; GstPad *srcconvpad, *sinkconvpad;
GstPad *srcpadtempl, *sinkpadtempl; GstPadTemplate *srcpadtempl, *sinkpadtempl;
GstPad *srcconvtempl, *sinkconvtempl; GstPadTemplate *srcconvtempl, *sinkconvtempl;
gint converter_in = -1, converter_out = -1; gint converter_in = -1, converter_out = -1;
gint target_rate = 2000; gint target_rate = 2000;
static GstPadFactory src_factory = { static GstPadTemplate*
"src", src_factory (void)
GST_PAD_FACTORY_SRC, {
GST_PAD_FACTORY_ALWAYS, return
GST_PAD_FACTORY_CAPS( gst_padtemplate_new (
"test_src", "src",
"audio/raw", GST_PAD_SRC,
"rate", GST_PROPS_INT_RANGE (16, 20000) GST_PAD_ALWAYS,
), gst_caps_new (
NULL, "test_src",
}; "audio/raw",
gst_props_new (
"rate", GST_PROPS_INT_RANGE (16, 20000),
NULL)),
NULL);
}
static GstPadFactory src_conv_factory = { static GstPadTemplate*
"src", src_conv_factory (void)
GST_PAD_FACTORY_SRC, {
GST_PAD_FACTORY_ALWAYS, return
GST_PAD_FACTORY_CAPS( gst_padtemplate_new (
"test_src", "src",
"audio/raw", GST_PAD_SRC,
"rate", GST_PROPS_INT_RANGE (16, 20000) GST_PAD_ALWAYS,
), gst_caps_new (
NULL, "test_src",
}; "audio/raw",
gst_props_new (
"rate", GST_PROPS_INT_RANGE (16, 20000),
NULL)),
NULL);
}
static GstPadFactory sink_conv_factory = { static GstPadTemplate*
"src", sink_conv_factory (void)
GST_PAD_FACTORY_SINK, {
GST_PAD_FACTORY_ALWAYS, return
GST_PAD_FACTORY_CAPS( gst_padtemplate_new (
"test_src", "src",
"audio/raw", GST_PAD_SINK,
"rate", GST_PROPS_INT_RANGE (16, 20000) GST_PAD_ALWAYS,
), gst_caps_new (
NULL, "test_src",
}; "audio/raw",
gst_props_new (
"rate", GST_PROPS_INT_RANGE (16, 20000),
NULL)),
NULL);
}
static GstPadFactory sink_factory = { static GstPadTemplate*
"sink", sink_factory (void)
GST_PAD_FACTORY_SINK, {
GST_PAD_FACTORY_ALWAYS, return
GST_PAD_FACTORY_CAPS( gst_padtemplate_new (
"test_sink", "sink",
"audio/raw", GST_PAD_SINK,
"rate", GST_PROPS_INT_RANGE (16, 20000) GST_PAD_ALWAYS,
), gst_caps_new (
NULL, "test_sink",
}; "audio/raw",
gst_props_new (
"rate", GST_PROPS_INT_RANGE (16, 20000),
NULL)),
NULL);
}
static GstCapsFactory sink_caps = { static GstCaps*
"sink_caps", sink_caps (void)
"audio/raw", {
"rate", GST_PROPS_INT (6000), return
NULL gst_caps_new (
}; "sink_caps",
"audio/raw",
gst_props_new (
"rate", GST_PROPS_INT (6000),
NULL));
}
static GstCapsFactory src_caps = { static GstCaps*
"src_caps", src_caps (void)
"audio/raw", {
"rate", GST_PROPS_INT (3000), return
NULL gst_caps_new (
}; "src_caps",
"audio/raw",
gst_props_new (
"rate", GST_PROPS_INT (3000),
NULL));
}
static GstPadTemplate *srctempl, *sinktempl; static GstPadTemplate *srctempl, *sinktempl;
static GstCaps *srccaps, *sinkcaps; static GstCaps *srccaps, *sinkcaps;
static GstPadNegotiateReturn static GstPadNegotiateReturn
converter_negotiate_src (GstPad *pad, GstCaps **caps, gint counter) converter_negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data)
{ {
g_print (">"); g_print (">");
if (counter == 0) { if (*data == NULL) {
*caps = NULL; *caps = NULL;
return GST_PAD_NEGOTIATE_TRY; return GST_PAD_NEGOTIATE_TRY;
} }
@ -92,19 +122,19 @@ converter_negotiate_src (GstPad *pad, GstCaps **caps, gint counter)
} }
static GstPadNegotiateReturn static GstPadNegotiateReturn
converter_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) converter_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data)
{ {
g_print ("<"); g_print ("<");
if (counter == 0) { if (*data == NULL) {
*caps = GST_PAD_CAPS (srcconvpad); *caps = GST_PAD_CAPS (srcconvpad);
return GST_PAD_NEGOTIATE_TRY; return GST_PAD_NEGOTIATE_TRY;
} }
if (*caps) { if (*caps) {
converter_in = gst_caps_get_int (*caps, "rate"); converter_in = gst_caps_get_int (*caps, "rate");
if (counter == 1) { if (*data == 1) {
converter_out = gst_caps_get_int (*caps, "rate"); converter_out = gst_caps_get_int (*caps, "rate");
return gst_pad_negotiate_proxy (pad, srcconvpad, caps, counter); return gst_pad_negotiate_proxy (pad, srcconvpad, caps);
} }
return GST_PAD_NEGOTIATE_AGREE; return GST_PAD_NEGOTIATE_AGREE;
} }
@ -113,11 +143,11 @@ converter_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter)
} }
static GstPadNegotiateReturn static GstPadNegotiateReturn
target_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) target_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data)
{ {
g_print ("{"); g_print ("{");
if (counter == 0) { if (*data == NULL) {
*caps = gst_caps_new_with_props ( *caps = gst_caps_new (
"target_caps", "target_caps",
"audio/raw", "audio/raw",
gst_props_new ( gst_props_new (
@ -143,13 +173,13 @@ main (int argc, char *argv[])
gst_init (&argc, &argv); gst_init (&argc, &argv);
srctempl = gst_padtemplate_new (&src_factory); srctempl = src_factory ();
sinktempl = gst_padtemplate_new (&sink_factory); sinktempl = sink_factory ();
srcpad = gst_pad_new_from_template (srctempl, "src"); srcpad = gst_pad_new_from_template (srctempl, "src");
sinkpad = gst_pad_new_from_template (sinktempl, "sink"); sinkpad = gst_pad_new_from_template (sinktempl, "sink");
srcconvtempl = gst_padtemplate_new (&src_conv_factory); srcconvtempl = src_conv_factory ();
sinkconvtempl = gst_padtemplate_new (&sink_conv_factory); sinkconvtempl = sink_conv_factory ();
srcconvpad = gst_pad_new_from_template (srcconvtempl, "csrc"); srcconvpad = gst_pad_new_from_template (srcconvtempl, "csrc");
sinkconvpad = gst_pad_new_from_template (sinkconvtempl, "csink"); sinkconvpad = gst_pad_new_from_template (sinkconvtempl, "csink");
@ -157,8 +187,8 @@ main (int argc, char *argv[])
gst_pad_set_negotiate_function (sinkconvpad, converter_negotiate_sink); gst_pad_set_negotiate_function (sinkconvpad, converter_negotiate_sink);
gst_pad_set_negotiate_function (sinkpad, target_negotiate_sink); gst_pad_set_negotiate_function (sinkpad, target_negotiate_sink);
sinkcaps = gst_caps_register (&sink_caps); sinkcaps = sink_caps ();
srccaps = gst_caps_register (&src_caps); srccaps = src_caps ();
g_print ("-------) (-----------) (----- \n"); g_print ("-------) (-----------) (----- \n");
g_print (" ! ! converter ! ! \n"); g_print (" ! ! converter ! ! \n");

View file

@ -4,36 +4,51 @@
GstPad *srcconvpad, *sinkconvpad; GstPad *srcconvpad, *sinkconvpad;
GstPadTemplate *srcconvtempl, *sinkconvtempl; GstPadTemplate *srcconvtempl, *sinkconvtempl;
static GstPadFactory src_conv_factory = { static GstPadTemplate*
"src", src_conv_factory (void)
GST_PAD_FACTORY_SRC, {
GST_PAD_FACTORY_ALWAYS, return
GST_PAD_FACTORY_CAPS( gst_padtemplate_new (
"test_src", "src",
"audio/raw", GST_PAD_SRC,
"rate", GST_PROPS_INT_RANGE (16, 20000) GST_PAD_ALWAYS,
), gst_caps_new (
NULL, "test_src",
}; "audio/raw",
gst_props_new (
"rate", GST_PROPS_INT_RANGE (16, 20000),
NULL)),
NULL);
}
static GstPadFactory sink_conv_factory = { static GstPadTemplate*
"src", sink_conv_factory (void)
GST_PAD_FACTORY_SINK, {
GST_PAD_FACTORY_ALWAYS, return
GST_PAD_FACTORY_CAPS( gst_padtemplate_new (
"test_src", "sink",
"audio/raw", GST_PAD_SINK,
"rate", GST_PROPS_INT_RANGE (16, 20000) GST_PAD_ALWAYS,
), gst_caps_new (
NULL, "test_src",
}; "audio/raw",
gst_props_new (
"rate", GST_PROPS_INT_RANGE (16, 20000),
NULL)),
NULL);
}
static GstCapsFactory src_caps = { static GstCaps*
"src_caps", src_caps (void)
"audio/raw", {
"rate", GST_PROPS_INT (3000), return
NULL gst_caps_new (
}; "src_caps",
"audio/raw",
gst_props_new (
"rate", GST_PROPS_INT (3000),
NULL));
}
static GstCaps *srccaps, *sinkcaps; static GstCaps *srccaps, *sinkcaps;
@ -41,14 +56,14 @@ static gint src_rate = 140;
static gint sink_rate = 100; static gint sink_rate = 100;
static GstPadNegotiateReturn static GstPadNegotiateReturn
negotiate_src (GstPad *pad, GstCaps **caps, gint counter) negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data)
{ {
g_print (">(%d:%d)", src_rate, (*caps)->refcount); g_print (">(%d:%d)", src_rate, (*caps)->refcount);
src_rate++; src_rate++;
if (counter == 0 || caps == NULL) { if (*data == NULL || caps == NULL) {
g_print ("*"); g_print ("*");
*caps = gst_caps_new_with_props ( *caps = gst_caps_new (
"src_caps", "src_caps",
"audio/raw", "audio/raw",
gst_props_new ( gst_props_new (
@ -77,15 +92,15 @@ negotiate_src (GstPad *pad, GstCaps **caps, gint counter)
} }
static GstPadNegotiateReturn static GstPadNegotiateReturn
negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data)
{ {
g_print ("<(%d:%d:%p)", sink_rate, (*caps)->refcount, *caps); g_print ("<(%d:%d:%p)", sink_rate, (*caps)->refcount, *caps);
sink_rate++; sink_rate++;
if (counter == 0 || *caps == NULL) { if (*data == NULL || *caps == NULL) {
g_print ("*"); g_print ("*");
*caps = gst_caps_new_with_props ( *caps = gst_caps_new (
"sink_caps", "sink_caps",
"audio/raw", "audio/raw",
gst_props_new ( gst_props_new (
@ -126,15 +141,15 @@ main (int argc, char *argv[])
g_mem_chunk_info(); g_mem_chunk_info();
srcconvtempl = gst_padtemplate_new (&src_conv_factory); srcconvtempl = src_conv_factory ();
sinkconvtempl = gst_padtemplate_new (&sink_conv_factory); sinkconvtempl = sink_conv_factory ();
srcconvpad = gst_pad_new_from_template (srcconvtempl, "src"); srcconvpad = gst_pad_new_from_template (srcconvtempl, "src");
sinkconvpad = gst_pad_new_from_template (sinkconvtempl, "sink"); sinkconvpad = gst_pad_new_from_template (sinkconvtempl, "sink");
gst_pad_set_negotiate_function (srcconvpad, negotiate_src); gst_pad_set_negotiate_function (srcconvpad, negotiate_src);
gst_pad_set_negotiate_function (sinkconvpad, negotiate_sink); gst_pad_set_negotiate_function (sinkconvpad, negotiate_sink);
srccaps = gst_caps_register (&src_caps); srccaps = src_caps ();
sinkcaps = gst_caps_copy (srccaps); sinkcaps = gst_caps_copy (srccaps);
g_print ("The wild goose chase...\n"); g_print ("The wild goose chase...\n");