diff options
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | docs/gst/gstreamer-sections.txt | 20 | ||||
-rw-r--r-- | docs/gst/gstreamer.hierarchy | 1 | ||||
-rw-r--r-- | docs/gst/tmpl/gst.sgml | 21 | ||||
-rw-r--r-- | docs/gst/tmpl/gstautoplug.sgml | 86 | ||||
-rw-r--r-- | docs/gst/tmpl/gstbin.sgml | 4 | ||||
-rw-r--r-- | docs/gst/tmpl/gstbuffer.sgml | 17 | ||||
-rw-r--r-- | docs/gst/tmpl/gstcaps.sgml | 72 | ||||
-rw-r--r-- | docs/gst/tmpl/gstfakesink.sgml | 5 | ||||
-rw-r--r-- | docs/gst/tmpl/gsthttpsrc.sgml | 11 | ||||
-rw-r--r-- | docs/gst/tmpl/gstpad.sgml | 77 | ||||
-rw-r--r-- | docs/gst/tmpl/gstprops.sgml | 33 | ||||
-rw-r--r-- | docs/gst/tmpl/gstreamer-unused.sgml | 207 | ||||
-rw-r--r-- | gst/gstcaps.c | 4 | ||||
-rw-r--r-- | gst/gstobject.c | 9 | ||||
-rw-r--r-- | gst/gstpad.c | 11 | ||||
-rw-r--r-- | tests/old/testsuite/capsnego/capsnego.c | 136 | ||||
-rw-r--r-- | tests/old/testsuite/capsnego/converter.c | 177 | ||||
-rw-r--r-- | tests/old/testsuite/capsnego/converter2.c | 186 | ||||
-rw-r--r-- | tests/old/testsuite/capsnego/enum.c | 93 | ||||
-rw-r--r-- | testsuite/capsnego/capsnego.c | 136 | ||||
-rw-r--r-- | testsuite/capsnego/converter.c | 177 | ||||
-rw-r--r-- | testsuite/capsnego/converter2.c | 186 | ||||
-rw-r--r-- | testsuite/capsnego/enum.c | 93 |
24 files changed, 1127 insertions, 637 deletions
diff --git a/configure.in b/configure.in index 3a0a7af16..32f7d2429 100644 --- a/configure.in +++ b/configure.in @@ -837,6 +837,7 @@ plugins/filters/passthrough/Makefile plugins/filters/adder/Makefile plugins/filters/colorspace/Makefile plugins/filters/volenv/Makefile +plugins/filters/adder/Makefile plugins/icecast/Makefile plugins/icecast/icecastsend/Makefile plugins/effects/Makefile @@ -884,6 +885,7 @@ examples/queue2/Makefile examples/queue3/Makefile examples/queue4/Makefile examples/thread/Makefile +examples/mixer/Makefile examples/launch/Makefile examples/xml/Makefile examples/plugins/Makefile diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index ca9923f14..c370add9f 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -27,6 +27,9 @@ cothread_get_data gst_init gst_main gst_main_quit +GST_VERSION_MICRO +GST_VERSION_MAJOR +GST_VERSION_MINOR <SUBSECTION Standard> </SECTION> @@ -136,9 +139,13 @@ GST_BUFFER_SIZE GST_BUFFER_OFFSET GST_BUFFER_MAXSIZE GST_BUFFER_TIMESTAMP +GST_BUFFER_BUFFERPOOL +GST_BUFFER_POOL_PRIVATE GST_BUFFER_LOCK GST_BUFFER_TRYLOCK GST_BUFFER_UNLOCK + + GstBufferFlags GstBuffer gst_buffer_new @@ -367,12 +374,11 @@ GstPadGetRegionFunction GstPadQoSFunction GstPadEOSFunction GstPadNewCapsFunction - +GstPadBufferPoolFunction GstPadNegotiateReturn GstPadNegotiateFunction - GstPadPushFunction GstPadPullFunction GstRegionType @@ -391,6 +397,7 @@ gst_pad_set_negotiate_function gst_pad_set_qos_function gst_pad_set_eos_function gst_pad_set_newcaps_function +gst_pad_set_bufferpool_function gst_pad_set_caps gst_pad_get_caps gst_pad_check_compatibility @@ -410,6 +417,7 @@ gst_pad_disconnect gst_pad_push gst_pad_pull gst_pad_pullregion +gst_pad_get_bufferpool gst_pad_set_eos gst_pad_handle_qos gst_pad_eos @@ -439,6 +447,7 @@ GST_RPAD_QOSFUNC GST_RPAD_EOSFUNC GST_RPAD_NEGOTIATEFUNC GST_RPAD_NEWCAPSFUNC +GST_RPAD_BUFFERPOOLFUNC GST_GPAD_REALPAD GstGhostPad @@ -450,6 +459,9 @@ GST_PADTEMPLATE_CAPS GST_PADTEMPLATE_DIRECTION GST_PADTEMPLATE_NAME_TEMPLATE GST_PADTEMPLATE_PRESENCE +GST_PADTEMPLATE_NEW +GST_PADTEMPLATE_FACTORY +GST_PADTEMPLATE_GET gst_padtemplate_new gst_padtemplate_load_thyself gst_padtemplate_save_thyself @@ -615,6 +627,9 @@ gst_typefactory_save_thyself GST_CAPS_LOCK GST_CAPS_TRYLOCK GST_CAPS_UNLOCK +GST_CAPS_NEW +GST_CAPS_FACTORY +GST_CAPS_GET GstCaps gst_caps_new gst_caps_destroy @@ -622,6 +637,7 @@ gst_caps_ref gst_caps_unref gst_caps_copy gst_caps_copy_on_write +gst_caps_chain gst_caps_append gst_caps_prepend gst_caps_set_name diff --git a/docs/gst/gstreamer.hierarchy b/docs/gst/gstreamer.hierarchy index 3fcebbbbf..247904e9d 100644 --- a/docs/gst/gstreamer.hierarchy +++ b/docs/gst/gstreamer.hierarchy @@ -9,7 +9,6 @@ GtkObject GstFakeSrc GstFakeSink GstDiskSrc - GstHttpSrc GstFdSrc GstSineSrc GstFdSink diff --git a/docs/gst/tmpl/gst.sgml b/docs/gst/tmpl/gst.sgml index c254b7790..546b49c68 100644 --- a/docs/gst/tmpl/gst.sgml +++ b/docs/gst/tmpl/gst.sgml @@ -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> + + + diff --git a/docs/gst/tmpl/gstautoplug.sgml b/docs/gst/tmpl/gstautoplug.sgml index 528b68724..ff407eac1 100644 --- a/docs/gst/tmpl/gstautoplug.sgml +++ b/docs/gst/tmpl/gstautoplug.sgml @@ -7,12 +7,92 @@ Automatically create and connect elements <!-- ##### SECTION Long_Description ##### --> <para> 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> -<!-- ##### SECTION See_Also ##### --> <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> + +<!-- ##### SECTION See_Also ##### --> +<para> +GstStaticAutoplug, GstStaticAutoplugRender </para> <!-- ##### STRUCT GstAutoplug ##### --> @@ -24,7 +104,7 @@ connecting elements. <!-- ##### ENUM GstAutoplugFlags ##### --> <para> - +The type of the autoplugger. </para> @GST_AUTOPLUG_TO_CAPS: diff --git a/docs/gst/tmpl/gstbin.sgml b/docs/gst/tmpl/gstbin.sgml index f4840c496..4669eb4ee 100644 --- a/docs/gst/tmpl/gstbin.sgml +++ b/docs/gst/tmpl/gstbin.sgml @@ -43,10 +43,10 @@ Flags for a bin. <!-- ##### MACRO gst_bin_destroy ##### --> <para> - +Free the memory allocated by this bin </para> -@bin: +@bin: the bin to free <!-- ##### FUNCTION gst_bin_add ##### --> diff --git a/docs/gst/tmpl/gstbuffer.sgml b/docs/gst/tmpl/gstbuffer.sgml index 9e6f6a291..288a588db 100644 --- a/docs/gst/tmpl/gstbuffer.sgml +++ b/docs/gst/tmpl/gstbuffer.sgml @@ -102,6 +102,22 @@ Get the timestamp for this buffer. @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 ##### --> <para> 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: @parent: @pool: +@pool_private: <!-- ##### FUNCTION gst_buffer_new ##### --> <para> diff --git a/docs/gst/tmpl/gstcaps.sgml b/docs/gst/tmpl/gstcaps.sgml index 9f1e9f3fc..6f8a9e5a1 100644 --- a/docs/gst/tmpl/gstcaps.sgml +++ b/docs/gst/tmpl/gstcaps.sgml @@ -39,6 +39,34 @@ Unlock the caps structure @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 ##### --> <para> @@ -76,6 +104,7 @@ Unlock the caps structure </para> @caps: +@Returns: <!-- ##### FUNCTION gst_caps_unref ##### --> @@ -84,6 +113,7 @@ Unlock the caps structure </para> @caps: +@Returns: <!-- ##### FUNCTION gst_caps_copy ##### --> @@ -104,6 +134,16 @@ Unlock the caps structure @Returns: +<!-- ##### FUNCTION gst_caps_chain ##### --> +<para> + +</para> + +@caps: +@Varargs: +@Returns: + + <!-- ##### FUNCTION gst_caps_append ##### --> <para> @@ -212,21 +252,21 @@ Unlock the caps structure <!-- ##### MACRO gst_caps_set ##### --> <para> - +Set a property of a caps structure. </para> -@caps: -@name: -@args...: +@caps: the caps structure to modify +@name: the name of the property to change +@args...: the new value of the property <!-- ##### MACRO gst_caps_get_boolean ##### --> <para> - +Get the value of the named property as a boolean. </para> -@caps: -@name: +@caps: the caps to query +@name: the name of the property to get <!-- ##### FUNCTION gst_caps_get_by_name ##### --> @@ -241,29 +281,29 @@ Unlock the caps structure <!-- ##### MACRO gst_caps_get_fourcc_int ##### --> <para> - +Get the value of the named property as a fourcc. </para> -@caps: -@name: +@caps: the caps to query +@name: the name of the property to get <!-- ##### MACRO gst_caps_get_int ##### --> <para> - +Get the value of the named property as an int. </para> -@caps: -@name: +@caps: the caps to query +@name: the name of the property to get <!-- ##### MACRO gst_caps_get_string ##### --> <para> - +Get the value of the named property as a string. </para> -@caps: -@name: +@caps: the caps to query +@name: the name of the property to get <!-- ##### FUNCTION gst_caps_save_thyself ##### --> diff --git a/docs/gst/tmpl/gstfakesink.sgml b/docs/gst/tmpl/gstfakesink.sgml index 9d405d62f..091729ef4 100644 --- a/docs/gst/tmpl/gstfakesink.sgml +++ b/docs/gst/tmpl/gstfakesink.sgml @@ -28,3 +28,8 @@ with the buffer. (fakesink) </para> +<!-- ##### ARG GstFakeSink:silent ##### --> +<para> + +</para> + diff --git a/docs/gst/tmpl/gsthttpsrc.sgml b/docs/gst/tmpl/gsthttpsrc.sgml index f1c74b859..2ba4a00e8 100644 --- a/docs/gst/tmpl/gsthttpsrc.sgml +++ b/docs/gst/tmpl/gsthttpsrc.sgml @@ -14,14 +14,3 @@ Reads data from a URL. </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> - diff --git a/docs/gst/tmpl/gstpad.sgml b/docs/gst/tmpl/gstpad.sgml index bc51b8eb2..b243f14d7 100644 --- a/docs/gst/tmpl/gstpad.sgml +++ b/docs/gst/tmpl/gstpad.sgml @@ -157,11 +157,22 @@ The function that will be called in an EOS case. <!-- ##### USER_FUNCTION GstPadNewCapsFunction ##### --> <para> +The function that will be called when the caps of the pad has +changed. +</para> + +@pad: The pad that has its caps changed +@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: -@caps: +@pad: the pad with the bufferpool +@Returns: the GstBufferPool associated with this pad. <!-- ##### ENUM GstPadNegotiateReturn ##### --> @@ -180,10 +191,8 @@ The function that will be called when negotiating. @pad: The pad that is 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 -<!-- # Unused Parameters # --> -@count: A counter to keep track of the negotiation process <!-- ##### USER_FUNCTION GstPadPushFunction ##### --> @@ -349,6 +358,15 @@ Destroy the pad. @newcaps: +<!-- ##### FUNCTION gst_pad_set_bufferpool_function ##### --> +<para> + +</para> + +@pad: +@bufpool: + + <!-- ##### FUNCTION gst_pad_set_caps ##### --> <para> @@ -530,6 +548,15 @@ Destroy the pad. @size: +<!-- ##### FUNCTION gst_pad_get_bufferpool ##### --> +<para> + +</para> + +@pad: +@Returns: + + <!-- ##### FUNCTION gst_pad_set_eos ##### --> <para> @@ -657,6 +684,7 @@ Call the EOS function of the pad @pullregionfunc: @negotiatefunc: @newcapsfunc: +@bufferpoolfunc: @ghostpads: <!-- ##### MACRO GST_RPAD_DIRECTION ##### --> @@ -771,6 +799,14 @@ Get the EOS function of the real pad. @pad: +<!-- ##### MACRO GST_RPAD_BUFFERPOOLFUNC ##### --> +<para> + +</para> + +@pad: + + <!-- ##### MACRO GST_GPAD_REALPAD ##### --> <para> Get the real pad of this ghost pad. @@ -849,6 +885,37 @@ Indicates when this pad will become available. @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 ##### --> <para> diff --git a/docs/gst/tmpl/gstprops.sgml b/docs/gst/tmpl/gstprops.sgml index 2c5f0eaf1..ed99e9a33 100644 --- a/docs/gst/tmpl/gstprops.sgml +++ b/docs/gst/tmpl/gstprops.sgml @@ -26,13 +26,14 @@ GstCaps <!-- ##### MACRO GST_MAKE_FOURCC ##### --> <para> - +Create a FOURCC value that can easily be used to construct +a fourcc property. </para> -@a: -@b: -@c: -@d: +@a: first fourcc byte +@b: second fourcc byte +@c: third fourcc byte +@d: fourth fourcc byte <!-- ##### MACRO GST_PROPS_LIST ##### --> @@ -65,11 +66,7 @@ Create an integer range property. Construct a fourcc property out of four bytes. </para> -@a: first byte -<!-- # Unused Parameters # --> -@b: second byte -@c: third byte -@d: fourth byte +@a: a fourcc value usualy created with GST_FOURCC_MAKE () <!-- ##### MACRO GST_PROPS_BOOLEAN ##### --> @@ -82,27 +79,27 @@ Create a boolean property. <!-- ##### MACRO GST_PROPS_STRING ##### --> <para> - +Create a string value. </para> -@a: +@a: the string value. <!-- ##### MACRO GST_PROPS_FLOAT ##### --> <para> - +Create a floating point value. </para> -@a: +@a: the float value <!-- ##### MACRO GST_PROPS_FLOAT_RANGE ##### --> <para> - +Create a float range value. </para> -@a: -@b: +@a: lower float bounds +@b: upper float bounds <!-- ##### FUNCTION gst_props_new ##### --> @@ -113,8 +110,6 @@ Create a boolean property. @firstname: @Varargs: @Returns: -<!-- # Unused Parameters # --> -@entry: <!-- ##### FUNCTION gst_props_newv ##### --> diff --git a/docs/gst/tmpl/gstreamer-unused.sgml b/docs/gst/tmpl/gstreamer-unused.sgml index c750b5e1d..5fa58aa49 100644 --- a/docs/gst/tmpl/gstreamer-unused.sgml +++ b/docs/gst/tmpl/gstreamer-unused.sgml @@ -67,31 +67,29 @@ Query the element for the current mime type </para> -<!-- ##### FUNCTION gst_fdsink_chain ##### --> +<!-- ##### FUNCTION gst_pad_remove_ghost_parent ##### --> <para> </para> @pad: -@buf: +@parent: -<!-- ##### FUNCTION gst_pad_remove_ghost_parent ##### --> +<!-- ##### FUNCTION gst_fdsink_chain ##### --> <para> </para> @pad: -@parent: +@buf: -<!-- ##### FUNCTION gst_identity_chain ##### --> +<!-- ##### ARG GstHttpSrc:location ##### --> <para> - +Specify the location of the file. The location must be a fully qualified URL. </para> -@pad: -@buf: -<!-- ##### FUNCTION gst_audiosink_chain ##### --> +<!-- ##### FUNCTION gst_identity_chain ##### --> <para> </para> @@ -106,6 +104,14 @@ Query the element for the current mime type @Returns: +<!-- ##### FUNCTION gst_audiosink_chain ##### --> +<para> + +</para> + +@pad: +@buf: + <!-- ##### MACRO GST_PIPELINE_CLASS ##### --> <para> @@ -200,18 +206,18 @@ the stream. @gstsrc: the object which received the signal. @arg1: the object which received the signal -<!-- ##### FUNCTION gst_disksrc_get_type ##### --> +<!-- ##### TYPEDEF GstCapsFactoryEntry ##### --> <para> </para> -@Returns: -<!-- ##### TYPEDEF GstCapsFactoryEntry ##### --> +<!-- ##### FUNCTION gst_disksrc_get_type ##### --> <para> </para> +@Returns: <!-- ##### MACRO GST_IS_DISKSRC_CLASS ##### --> <para> @@ -366,16 +372,16 @@ subclass use this to start their flag enumeration @audiosink: @channels: +<!-- ##### SECTION ./tmpl/gstconnection.sgml:Short_Description ##### --> +Generic connection between elements. + + <!-- ##### STRUCT GstSinkClass ##### --> <para> </para> -<!-- ##### SECTION ./tmpl/gstconnection.sgml:Short_Description ##### --> -Generic connection between elements. - - <!-- ##### STRUCT GstFilterClass ##### --> <para> @@ -655,13 +661,13 @@ Specify the current offset in the file. @sheight: @bytes_per_line: -<!-- ##### ARG GstAudioSink:format ##### --> +<!-- ##### SECTION ./tmpl/GstElement.sgml:Long_Description ##### --> <para> </para> -<!-- ##### SECTION ./tmpl/GstElement.sgml:Long_Description ##### --> +<!-- ##### ARG GstAudioSink:format ##### --> <para> </para> @@ -695,32 +701,32 @@ Specify the current offset in the file. @name: @Returns: -<!-- ##### STRUCT GstQueueClass ##### --> +<!-- ##### STRUCT GstConnection ##### --> <para> </para> -<!-- ##### STRUCT GstConnection ##### --> +<!-- ##### STRUCT GstQueueClass ##### --> <para> </para> -<!-- ##### FUNCTION gst_type_add_sink ##### --> +<!-- ##### FUNCTION gst_fakesrc_push ##### --> <para> </para> -@id: -@sink: +@src: -<!-- ##### FUNCTION gst_fakesrc_push ##### --> +<!-- ##### FUNCTION gst_type_add_sink ##### --> <para> </para> -@src: +@id: +@sink: <!-- ##### MACRO GST_IS_IDENTITY_CLASS ##### --> <para> @@ -1135,19 +1141,19 @@ GstFilter @obj: -<!-- ##### FUNCTION gst_fdsrc_get_type ##### --> +<!-- ##### MACRO GST_IS_QUEUE_CLASS ##### --> <para> </para> -@Returns: +@obj: -<!-- ##### MACRO GST_IS_QUEUE_CLASS ##### --> +<!-- ##### FUNCTION gst_fdsrc_get_type ##### --> <para> </para> -@obj: +@Returns: <!-- ##### FUNCTION gst_pad_get_type_id ##### --> <para> @@ -1157,22 +1163,22 @@ GstFilter @pad: @Returns: -<!-- ##### STRUCT OverlayClip ##### --> +<!-- ##### FUNCTION gst_thread_iterate ##### --> <para> </para> -@x1: -@x2: -@y1: -@y2: +@thread: -<!-- ##### FUNCTION gst_thread_iterate ##### --> +<!-- ##### STRUCT OverlayClip ##### --> <para> </para> -@thread: +@x1: +@x2: +@y1: +@y2: <!-- ##### ENUM GstSrcFlags ##### --> <para> @@ -1249,19 +1255,19 @@ Defines an entry for a padfactory. @obj: -<!-- ##### MACRO GST_AUDIOSINK_CLASS ##### --> +<!-- ##### FUNCTION gst_asyncdisksrc_get_type ##### --> <para> </para> -@klass: +@Returns: -<!-- ##### FUNCTION gst_asyncdisksrc_get_type ##### --> +<!-- ##### MACRO GST_AUDIOSINK_CLASS ##### --> <para> </para> -@Returns: +@klass: <!-- ##### MACRO GST_PAD_FACTORY_SINK ##### --> <para> @@ -1298,19 +1304,19 @@ Indicates a sinkpad for the padfactory. @pad: @Returns: -<!-- ##### FUNCTION gst_esdsink_new ##### --> +<!-- ##### MACRO GST_PROPS_FOURCC_ID ##### --> <para> </para> -@name: -@Returns: -<!-- ##### MACRO GST_PROPS_FOURCC_ID ##### --> +<!-- ##### FUNCTION gst_esdsink_new ##### --> <para> </para> +@name: +@Returns: <!-- ##### FUNCTION gst_element_request_pad ##### --> <para> @@ -1421,18 +1427,18 @@ This macro sets the given flags. @flag: Flag to set, can by any number of bits in guint32. @obj: GstSrc to set flag in. -<!-- ##### MACRO DEBUG_LEAVE_STRING ##### --> +<!-- ##### MACRO GST_PROPS_FLOAT_STRING ##### --> <para> </para> +@a: -<!-- ##### MACRO GST_PROPS_FLOAT_STRING ##### --> +<!-- ##### MACRO DEBUG_LEAVE_STRING ##### --> <para> </para> -@a: <!-- ##### FUNCTION gst_filter_get_type ##### --> <para> @@ -1455,16 +1461,16 @@ This macro sets the given flags. </para> +<!-- ##### SECTION ./tmpl/gstsink.sgml:Title ##### --> +GstSink + + <!-- ##### MACRO GST_CPU_FLAG_MMX ##### --> <para> A flag indicating that MMX instructions are supported. </para> -<!-- ##### SECTION ./tmpl/gstsink.sgml:Title ##### --> -GstSink - - <!-- ##### FUNCTION gst_object_get_type ##### --> <para> @@ -1602,6 +1608,13 @@ Indicates a srcpad for the padfactory. @obj: +<!-- ##### ARG GstHttpSrc:bytesperread ##### --> +<para> +Specify how many bytes to read at a time. + +</para> + + <!-- ##### MACRO GST_THREAD ##### --> <para> @@ -1771,19 +1784,19 @@ or a video card. </para> -<!-- ##### FUNCTION gst_esdsink_get_type ##### --> +<!-- ##### MACRO GST_IS_BIN_CLASS ##### --> <para> </para> -@Returns: +@obj: -<!-- ##### MACRO GST_IS_BIN_CLASS ##### --> +<!-- ##### FUNCTION gst_esdsink_get_type ##### --> <para> </para> -@obj: +@Returns: <!-- ##### SECTION ./tmpl/GstElement.sgml:See_Also ##### --> <para> @@ -1805,19 +1818,19 @@ Query whether this object has multiple input pads. @obj: Element to query for multiple input pads. -<!-- ##### MACRO DEBUG_NOPREFIX ##### --> +<!-- ##### SECTION ./tmpl/gstfilter.sgml:See_Also ##### --> <para> </para> -@format: -@args...: -<!-- ##### SECTION ./tmpl/gstfilter.sgml:See_Also ##### --> +<!-- ##### MACRO DEBUG_NOPREFIX ##### --> <para> </para> +@format: +@args...: <!-- ##### ARG GstAudioSink:frequency ##### --> <para> @@ -2236,20 +2249,20 @@ this in the factory definition. @audiosink: -<!-- ##### MACRO GST_STATE_UNSET ##### --> +<!-- ##### MACRO GST_IS_FAKESINK ##### --> <para> -This macro unsets the given state on the element. + </para> -@obj: Element to unset state of. -@flag: State to unset, can be any number of bits in guint32. +@obj: -<!-- ##### MACRO GST_IS_FAKESINK ##### --> +<!-- ##### MACRO GST_STATE_UNSET ##### --> <para> - +This macro unsets the given state on the element. </para> -@obj: +@obj: Element to unset state of. +@flag: State to unset, can be any number of bits in guint32. <!-- ##### MACRO GST_QUEUE_CLASS ##### --> <para> @@ -2323,13 +2336,6 @@ The number of bytes per read. @obj: -<!-- ##### FUNCTION gst_sinesrc_get_type ##### --> -<para> - -</para> - -@Returns: - <!-- ##### MACRO ERROR_OBJECT ##### --> <para> @@ -2340,6 +2346,13 @@ The number of bytes per read. @format: @args...: +<!-- ##### FUNCTION gst_sinesrc_get_type ##### --> +<para> + +</para> + +@Returns: + <!-- ##### MACRO GST_IS_IDENTITY ##### --> <para> @@ -2444,14 +2457,9 @@ This macro sets the given state on the element. @obj: -<!-- ##### FUNCTION gst_src_push_region ##### --> -<para> - -</para> +<!-- ##### SECTION ./tmpl/videoraw.sgml:Short_Description ##### --> +Information about video buffers. -@src: -@offset: -@size: <!-- ##### FUNCTION gst_fdsink_get_type ##### --> <para> @@ -2460,9 +2468,14 @@ This macro sets the given state on the element. @Returns: -<!-- ##### SECTION ./tmpl/videoraw.sgml:Short_Description ##### --> -Information about video buffers. +<!-- ##### FUNCTION gst_src_push_region ##### --> +<para> +</para> + +@src: +@offset: +@size: <!-- ##### STRUCT GstPipelineClass ##### --> <para> @@ -2566,13 +2579,13 @@ A flag indicating that SSE instructions are supported. @obj: -<!-- ##### STRUCT GstDiskSrcClass ##### --> +<!-- ##### ARG GstAsyncDiskSrc:size ##### --> <para> </para> -<!-- ##### ARG GstAsyncDiskSrc:size ##### --> +<!-- ##### STRUCT GstDiskSrcClass ##### --> <para> </para> @@ -2653,19 +2666,19 @@ Information about audio buffers. </para> -<!-- ##### FUNCTION gst_caps_register ##### --> +<!-- ##### FUNCTION plugin_initialize ##### --> <para> </para> -@factory: -@Returns: -<!-- ##### FUNCTION plugin_initialize ##### --> +<!-- ##### FUNCTION gst_caps_register ##### --> <para> </para> +@factory: +@Returns: <!-- ##### ARG GstAsyncDiskSrc:location ##### --> <para> @@ -2730,20 +2743,20 @@ the offset. </para> -<!-- ##### MACRO GST_IS_ASYNCDISKSRC_CLASS ##### --> +<!-- ##### FUNCTION gst_sinesrc_new ##### --> <para> </para> -@obj: +@name: +@Returns: -<!-- ##### FUNCTION gst_sinesrc_new ##### --> +<!-- ##### MACRO GST_IS_ASYNCDISKSRC_CLASS ##### --> <para> </para> -@name: -@Returns: +@obj: <!-- ##### ARG GstAudioSrc:curoffset ##### --> <para> @@ -2793,19 +2806,19 @@ plugin @klass: -<!-- ##### MACRO GST_ASYNCDISKSRC ##### --> +<!-- ##### MACRO GST_HTTPSRC_CLASS ##### --> <para> </para> -@obj: +@klass: -<!-- ##### MACRO GST_HTTPSRC_CLASS ##### --> +<!-- ##### MACRO GST_ASYNCDISKSRC ##### --> <para> </para> -@klass: +@obj: <!-- ##### ARG GstPad:active ##### --> <para> diff --git a/gst/gstcaps.c b/gst/gstcaps.c index d2b231f84..df122b58b 100644 --- a/gst/gstcaps.c +++ b/gst/gstcaps.c @@ -120,7 +120,7 @@ gst_caps_destroy (GstCaps *caps) * Decrease the refcount of this caps structure, * 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* gst_caps_unref (GstCaps *caps) @@ -153,7 +153,7 @@ gst_caps_unref (GstCaps *caps) * * Increase the refcount of this caps structure * - * Returnns: the caps with the refcount incremented + * Returns: the caps with the refcount incremented */ GstCaps* gst_caps_ref (GstCaps *caps) diff --git a/gst/gstobject.c b/gst/gstobject.c index c26744f8e..2e7eafb88 100644 --- a/gst/gstobject.c +++ b/gst/gstobject.c @@ -336,6 +336,15 @@ gst_object_sink (GstObject *object) } #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 gst_object_save_thyself (GstObject *object, xmlNodePtr parent) { diff --git a/gst/gstpad.c b/gst/gstpad.c index 7d9786bcd..54c9a8e6e 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -452,7 +452,7 @@ gst_pad_set_newcaps_function (GstPad *pad, /** * gst_pad_set_bufferpool_function: * @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. */ @@ -916,6 +916,15 @@ gst_pad_get_peer (GstPad *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* gst_pad_get_bufferpool (GstPad *pad) { diff --git a/tests/old/testsuite/capsnego/capsnego.c b/tests/old/testsuite/capsnego/capsnego.c index 086649111..027440a93 100644 --- a/tests/old/testsuite/capsnego/capsnego.c +++ b/tests/old/testsuite/capsnego/capsnego.c @@ -4,53 +4,87 @@ GstPad *srcpad, *sinkpad; GstPad *srcpadtempl, *sinkpadtempl; -static GstPadFactory src_factory = { - "src", - GST_PAD_FACTORY_SRC, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "test_src", - "video/raw", - "height", GST_PROPS_INT_RANGE (16, 4096) - ), - NULL, -}; - -static GstPadFactory sink_factory = { - "sink", - GST_PAD_FACTORY_SINK, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "test_sink", - "video/raw", - "height", GST_PROPS_INT_RANGE (16, 8192) - ), - NULL, -}; - -static GstCapsFactory sink_caps = { - "sink_caps", - "video/raw", - "height", GST_PROPS_INT (3000), - NULL -}; - -static GstCapsFactory src_caps = { - "src_caps", - "video/raw", - "height", GST_PROPS_INT (3000), - NULL -}; +static GstPadTemplate* +src_template_factory (void) +{ + static GstPadTemplate *templ = NULL; + + if (!templ) { + templ = gst_padtemplate_new ( + "src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + gst_caps_new ( + "test_src", + "video/raw", + gst_props_new ( + "height", GST_PROPS_INT_RANGE (16, 4096), + NULL)), + NULL); + } + return templ; +} -static GstPadTemplate *srctempl, *sinktempl; -static GstCaps *srccaps, *sinkcaps; +static GstPadTemplate* +sink_template_factory (void) +{ + static GstPadTemplate *templ = NULL; + + if (!templ) { + templ = gst_padtemplate_new ( + "sink", + GST_PAD_SINK, + 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 GstCaps* +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 -negotiate_src (GstPad *pad, GstCaps **caps, gint counter) +negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data) { g_print (">"); - if (counter == 0) { + if (*data == NULL) { + *data = GINT_TO_POINTER (TRUE); *caps = NULL; return GST_PAD_NEGOTIATE_TRY; } @@ -61,10 +95,11 @@ negotiate_src (GstPad *pad, GstCaps **caps, gint counter) } static GstPadNegotiateReturn -negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) +negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data) { g_print ("<"); - if (counter == 0) { + if (*data == NULL) { + *data = GINT_TO_POINTER (TRUE); *caps = NULL; return GST_PAD_NEGOTIATE_TRY; } @@ -74,6 +109,9 @@ negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) return GST_PAD_NEGOTIATE_FAIL; } +static GstPadTemplate *srctempl, *sinktempl; +static GstCaps *srccaps, *sinkcaps; + static gboolean perform_check (void) { @@ -121,14 +159,14 @@ main (int argc, char *argv[]) srcpad = gst_pad_new ("src", GST_PAD_SRC); sinkpad = gst_pad_new ("sink", GST_PAD_SINK); - srctempl = gst_padtemplate_new (&src_factory); - sinktempl = gst_padtemplate_new (&sink_factory); + srctempl = src_template_factory (); + sinktempl = sink_template_factory (); - srcpadtempl = gst_pad_new_from_template (srctempl, "src"); - sinkpadtempl = gst_pad_new_from_template (sinktempl, "sink"); + srcpadtempl = gst_pad_new_from_template (src_template_factory (), "src"); + sinkpadtempl = gst_pad_new_from_template (sink_template_factory (), "sink"); - sinkcaps = gst_caps_register (&sink_caps); - srccaps = gst_caps_register (&src_caps); + sinkcaps = sink_caps_factory (); + srccaps = src_caps_factory (); g_print ("*** compatible caps/templates ***\n"); diff --git a/tests/old/testsuite/capsnego/converter.c b/tests/old/testsuite/capsnego/converter.c index df26338d1..83dd8d464 100644 --- a/tests/old/testsuite/capsnego/converter.c +++ b/tests/old/testsuite/capsnego/converter.c @@ -3,82 +3,112 @@ GstPad *srcpad, *sinkpad; GstPad *srcconvpad, *sinkconvpad; -GstPad *srcpadtempl, *sinkpadtempl; -GstPad *srcconvtempl, *sinkconvtempl; +GstPadTemplate *srcpadtempl, *sinkpadtempl; +GstPadTemplate *srcconvtempl, *sinkconvtempl; gint converter_in = -1, converter_out = -1; -static GstPadFactory src_factory = { - "src", - GST_PAD_FACTORY_SRC, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "test_src", - "audio/raw", - "rate", GST_PROPS_INT_RANGE (16, 20000) - ), - NULL, -}; - -static GstPadFactory src_conv_factory = { - "src", - GST_PAD_FACTORY_SRC, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "test_src", - "audio/raw", - "rate", GST_PROPS_INT_RANGE (16, 20000) - ), - NULL, -}; - -static GstPadFactory sink_conv_factory = { - "src", - GST_PAD_FACTORY_SINK, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "test_src", - "audio/raw", - "rate", GST_PROPS_INT_RANGE (16, 20000) - ), - NULL, -}; - -static GstPadFactory sink_factory = { - "sink", - GST_PAD_FACTORY_SINK, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "test_sink", - "audio/raw", - "rate", GST_PROPS_INT_RANGE (16, 20000) - ), - NULL, -}; - -static GstCapsFactory sink_caps = { - "sink_caps", - "audio/raw", - "rate", GST_PROPS_INT (6000), - NULL -}; - -static GstCapsFactory src_caps = { - "src_caps", - "audio/raw", - "rate", GST_PROPS_INT (3000), - NULL -}; +static GstPadTemplate* +src_factory (void) +{ + return + gst_padtemplate_new ( + "src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + gst_caps_new ( + "test_src", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT_RANGE (16, 20000), + NULL)), + NULL); +} + +static GstPadTemplate* +src_conv_factory (void) +{ + return + gst_padtemplate_new ( + "src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + gst_caps_new ( + "test_src", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT_RANGE (16, 20000), + NULL)), + NULL); +} + +static GstPadTemplate* +sink_conv_factory (void) +{ + return + gst_padtemplate_new ( + "src", + GST_PAD_SINK, + GST_PAD_ALWAYS, + gst_caps_new ( + "test_src", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT_RANGE (16, 20000), + NULL)), + NULL); +} + +static GstPadTemplate* +sink_factory (void) +{ + return + gst_padtemplate_new ( + "sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + gst_caps_new ( + "test_sink", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT_RANGE (16, 20000), + NULL)), + NULL); +} + +static GstCaps* +sink_caps (void) +{ + return + gst_caps_new ( + "sink_caps", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT (6000), + NULL)); +} + +static GstCaps* +src_caps (void) +{ + return + gst_caps_new ( + "src_caps", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT (3000), + NULL)); +} static GstPadTemplate *srctempl, *sinktempl; static GstCaps *srccaps, *sinkcaps; static GstPadNegotiateReturn -negotiate_src (GstPad *pad, GstCaps **caps, gint counter) +negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data) { g_print (">"); - if (counter == 0) { + if (data == NULL) { *caps = NULL; return GST_PAD_NEGOTIATE_TRY; } @@ -91,10 +121,10 @@ negotiate_src (GstPad *pad, GstCaps **caps, gint counter) } static GstPadNegotiateReturn -negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) +negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data) { g_print ("<"); - if (counter == 0) { + if (data == NULL) { *caps = NULL; return GST_PAD_NEGOTIATE_TRY; } @@ -114,21 +144,22 @@ main (int argc, char *argv[]) gst_init (&argc, &argv); - srctempl = gst_padtemplate_new (&src_factory); - sinktempl = gst_padtemplate_new (&sink_factory); + srctempl = src_factory (); + sinktempl = sink_factory (); srcpad = gst_pad_new_from_template (srctempl, "src"); sinkpad = gst_pad_new_from_template (sinktempl, "sink"); - srcconvtempl = gst_padtemplate_new (&src_conv_factory); - sinkconvtempl = gst_padtemplate_new (&sink_conv_factory); + srcconvtempl = src_conv_factory (); + sinkconvtempl = sink_conv_factory (); srcconvpad = gst_pad_new_from_template (srcconvtempl, "src"); sinkconvpad = gst_pad_new_from_template (sinkconvtempl, "sink"); gst_pad_set_negotiate_function (srcconvpad, negotiate_src); gst_pad_set_negotiate_function (sinkconvpad, negotiate_sink); - sinkcaps = gst_caps_register (&sink_caps); - srccaps = gst_caps_register (&src_caps); + sinkcaps = sink_caps (); + srccaps = src_caps (); + result = gst_pad_set_caps (srcpad, srccaps); g_print ("set caps on src: %d\n", result); g_print ("initial converter status: %d %d\n", converter_in, converter_out); diff --git a/tests/old/testsuite/capsnego/converter2.c b/tests/old/testsuite/capsnego/converter2.c index 0532c7695..8b3ebb32e 100644 --- a/tests/old/testsuite/capsnego/converter2.c +++ b/tests/old/testsuite/capsnego/converter2.c @@ -3,83 +3,113 @@ GstPad *srcpad, *sinkpad; GstPad *srcconvpad, *sinkconvpad; -GstPad *srcpadtempl, *sinkpadtempl; -GstPad *srcconvtempl, *sinkconvtempl; +GstPadTemplate *srcpadtempl, *sinkpadtempl; +GstPadTemplate *srcconvtempl, *sinkconvtempl; gint converter_in = -1, converter_out = -1; gint target_rate = 2000; -static GstPadFactory src_factory = { - "src", - GST_PAD_FACTORY_SRC, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "test_src", - "audio/raw", - "rate", GST_PROPS_INT_RANGE (16, 20000) - ), - NULL, -}; - -static GstPadFactory src_conv_factory = { - "src", - GST_PAD_FACTORY_SRC, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "test_src", - "audio/raw", - "rate", GST_PROPS_INT_RANGE (16, 20000) - ), - NULL, -}; - -static GstPadFactory sink_conv_factory = { - "src", - GST_PAD_FACTORY_SINK, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "test_src", - "audio/raw", - "rate", GST_PROPS_INT_RANGE (16, 20000) - ), - NULL, -}; - -static GstPadFactory sink_factory = { - "sink", - GST_PAD_FACTORY_SINK, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "test_sink", - "audio/raw", - "rate", GST_PROPS_INT_RANGE (16, 20000) - ), - NULL, -}; - -static GstCapsFactory sink_caps = { - "sink_caps", - "audio/raw", - "rate", GST_PROPS_INT (6000), - NULL -}; - -static GstCapsFactory src_caps = { - "src_caps", - "audio/raw", - "rate", GST_PROPS_INT (3000), - NULL -}; +static GstPadTemplate* +src_factory (void) +{ + return + gst_padtemplate_new ( + "src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + gst_caps_new ( + "test_src", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT_RANGE (16, 20000), + NULL)), + NULL); +} + +static GstPadTemplate* +src_conv_factory (void) +{ + return + gst_padtemplate_new ( + "src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + gst_caps_new ( + "test_src", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT_RANGE (16, 20000), + NULL)), + NULL); +} + +static GstPadTemplate* +sink_conv_factory (void) +{ + return + gst_padtemplate_new ( + "src", + GST_PAD_SINK, + GST_PAD_ALWAYS, + gst_caps_new ( + "test_src", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT_RANGE (16, 20000), + NULL)), + NULL); +} + +static GstPadTemplate* +sink_factory (void) +{ + return + gst_padtemplate_new ( + "sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + gst_caps_new ( + "test_sink", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT_RANGE (16, 20000), + NULL)), + NULL); +} + +static GstCaps* +sink_caps (void) +{ + return + gst_caps_new ( + "sink_caps", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT (6000), + NULL)); +} + +static GstCaps* +src_caps (void) +{ + return + gst_caps_new ( + "src_caps", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT (3000), + NULL)); +} static GstPadTemplate *srctempl, *sinktempl; static GstCaps *srccaps, *sinkcaps; static GstPadNegotiateReturn -converter_negotiate_src (GstPad *pad, GstCaps **caps, gint counter) +converter_negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data) { g_print (">"); - if (counter == 0) { + if (*data == NULL) { *caps = NULL; return GST_PAD_NEGOTIATE_TRY; } @@ -92,19 +122,19 @@ converter_negotiate_src (GstPad *pad, GstCaps **caps, gint counter) } static GstPadNegotiateReturn -converter_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) +converter_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data) { g_print ("<"); - if (counter == 0) { + if (*data == NULL) { *caps = GST_PAD_CAPS (srcconvpad); return GST_PAD_NEGOTIATE_TRY; } if (*caps) { converter_in = gst_caps_get_int (*caps, "rate"); - if (counter == 1) { + if (*data == 1) { 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; } @@ -113,11 +143,11 @@ converter_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) } static GstPadNegotiateReturn -target_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) +target_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data) { g_print ("{"); - if (counter == 0) { - *caps = gst_caps_new_with_props ( + if (*data == NULL) { + *caps = gst_caps_new ( "target_caps", "audio/raw", gst_props_new ( @@ -143,13 +173,13 @@ main (int argc, char *argv[]) gst_init (&argc, &argv); - srctempl = gst_padtemplate_new (&src_factory); - sinktempl = gst_padtemplate_new (&sink_factory); + srctempl = src_factory (); + sinktempl = sink_factory (); srcpad = gst_pad_new_from_template (srctempl, "src"); sinkpad = gst_pad_new_from_template (sinktempl, "sink"); - srcconvtempl = gst_padtemplate_new (&src_conv_factory); - sinkconvtempl = gst_padtemplate_new (&sink_conv_factory); + srcconvtempl = src_conv_factory (); + sinkconvtempl = sink_conv_factory (); srcconvpad = gst_pad_new_from_template (srcconvtempl, "csrc"); 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 (sinkpad, target_negotiate_sink); - sinkcaps = gst_caps_register (&sink_caps); - srccaps = gst_caps_register (&src_caps); + sinkcaps = sink_caps (); + srccaps = src_caps (); g_print ("-------) (-----------) (----- \n"); g_print (" ! ! converter ! ! \n"); diff --git a/tests/old/testsuite/capsnego/enum.c b/tests/old/testsuite/capsnego/enum.c index e3959309e..343e08c10 100644 --- a/tests/old/testsuite/capsnego/enum.c +++ b/tests/old/testsuite/capsnego/enum.c @@ -4,36 +4,51 @@ GstPad *srcconvpad, *sinkconvpad; GstPadTemplate *srcconvtempl, *sinkconvtempl; -static GstPadFactory src_conv_factory = { - "src", - GST_PAD_FACTORY_SRC, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "test_src", - "audio/raw", - "rate", GST_PROPS_INT_RANGE (16, 20000) - ), - NULL, -}; - -static GstPadFactory sink_conv_factory = { - "src", - GST_PAD_FACTORY_SINK, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "test_src", - "audio/raw", - "rate", GST_PROPS_INT_RANGE (16, 20000) - ), - NULL, -}; - -static GstCapsFactory src_caps = { - "src_caps", - "audio/raw", - "rate", GST_PROPS_INT (3000), - NULL -}; +static GstPadTemplate* +src_conv_factory (void) +{ + return + gst_padtemplate_new ( + "src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + gst_caps_new ( + "test_src", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT_RANGE (16, 20000), + NULL)), + NULL); +} + +static GstPadTemplate* +sink_conv_factory (void) +{ + return + gst_padtemplate_new ( + "sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + gst_caps_new ( + "test_src", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT_RANGE (16, 20000), + NULL)), + NULL); +} + +static GstCaps* +src_caps (void) +{ + return + gst_caps_new ( + "src_caps", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT (3000), + NULL)); +} static GstCaps *srccaps, *sinkcaps; @@ -41,14 +56,14 @@ static gint src_rate = 140; static gint sink_rate = 100; 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); src_rate++; - if (counter == 0 || caps == NULL) { + if (*data == NULL || caps == NULL) { g_print ("*"); - *caps = gst_caps_new_with_props ( + *caps = gst_caps_new ( "src_caps", "audio/raw", gst_props_new ( @@ -77,15 +92,15 @@ negotiate_src (GstPad *pad, GstCaps **caps, gint counter) } 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); sink_rate++; - if (counter == 0 || *caps == NULL) { + if (*data == NULL || *caps == NULL) { g_print ("*"); - *caps = gst_caps_new_with_props ( + *caps = gst_caps_new ( "sink_caps", "audio/raw", gst_props_new ( @@ -126,15 +141,15 @@ main (int argc, char *argv[]) g_mem_chunk_info(); - srcconvtempl = gst_padtemplate_new (&src_conv_factory); - sinkconvtempl = gst_padtemplate_new (&sink_conv_factory); + srcconvtempl = src_conv_factory (); + sinkconvtempl = sink_conv_factory (); srcconvpad = gst_pad_new_from_template (srcconvtempl, "src"); sinkconvpad = gst_pad_new_from_template (sinkconvtempl, "sink"); gst_pad_set_negotiate_function (srcconvpad, negotiate_src); gst_pad_set_negotiate_function (sinkconvpad, negotiate_sink); - srccaps = gst_caps_register (&src_caps); + srccaps = src_caps (); sinkcaps = gst_caps_copy (srccaps); g_print ("The wild goose chase...\n"); diff --git a/testsuite/capsnego/capsnego.c b/testsuite/capsnego/capsnego.c index 086649111..027440a93 100644 --- a/testsuite/capsnego/capsnego.c +++ b/testsuite/capsnego/capsnego.c @@ -4,53 +4,87 @@ GstPad *srcpad, *sinkpad; GstPad *srcpadtempl, *sinkpadtempl; -static GstPadFactory src_factory = { - "src", - GST_PAD_FACTORY_SRC, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "test_src", - "video/raw", - "height", GST_PROPS_INT_RANGE (16, 4096) - ), - NULL, -}; - -static GstPadFactory sink_factory = { - "sink", - GST_PAD_FACTORY_SINK, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "test_sink", - "video/raw", - "height", GST_PROPS_INT_RANGE (16, 8192) - ), - NULL, -}; - -static GstCapsFactory sink_caps = { - "sink_caps", - "video/raw", - "height", GST_PROPS_INT (3000), - NULL -}; - -static GstCapsFactory src_caps = { - "src_caps", - "video/raw", - "height", GST_PROPS_INT (3000), - NULL -}; +static GstPadTemplate* +src_template_factory (void) +{ + static GstPadTemplate *templ = NULL; + + if (!templ) { + templ = gst_padtemplate_new ( + "src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + gst_caps_new ( + "test_src", + "video/raw", + gst_props_new ( + "height", GST_PROPS_INT_RANGE (16, 4096), + NULL)), + NULL); + } + return templ; +} -static GstPadTemplate *srctempl, *sinktempl; -static GstCaps *srccaps, *sinkcaps; +static GstPadTemplate* +sink_template_factory (void) +{ + static GstPadTemplate *templ = NULL; + + if (!templ) { + templ = gst_padtemplate_new ( + "sink", + GST_PAD_SINK, + 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 GstCaps* +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 -negotiate_src (GstPad *pad, GstCaps **caps, gint counter) +negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data) { g_print (">"); - if (counter == 0) { + if (*data == NULL) { + *data = GINT_TO_POINTER (TRUE); *caps = NULL; return GST_PAD_NEGOTIATE_TRY; } @@ -61,10 +95,11 @@ negotiate_src (GstPad *pad, GstCaps **caps, gint counter) } static GstPadNegotiateReturn -negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) +negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data) { g_print ("<"); - if (counter == 0) { + if (*data == NULL) { + *data = GINT_TO_POINTER (TRUE); *caps = NULL; return GST_PAD_NEGOTIATE_TRY; } @@ -74,6 +109,9 @@ negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) return GST_PAD_NEGOTIATE_FAIL; } +static GstPadTemplate *srctempl, *sinktempl; +static GstCaps *srccaps, *sinkcaps; + static gboolean perform_check (void) { @@ -121,14 +159,14 @@ main (int argc, char *argv[]) srcpad = gst_pad_new ("src", GST_PAD_SRC); sinkpad = gst_pad_new ("sink", GST_PAD_SINK); - srctempl = gst_padtemplate_new (&src_factory); - sinktempl = gst_padtemplate_new (&sink_factory); + srctempl = src_template_factory (); + sinktempl = sink_template_factory (); - srcpadtempl = gst_pad_new_from_template (srctempl, "src"); - sinkpadtempl = gst_pad_new_from_template (sinktempl, "sink"); + srcpadtempl = gst_pad_new_from_template (src_template_factory (), "src"); + sinkpadtempl = gst_pad_new_from_template (sink_template_factory (), "sink"); - sinkcaps = gst_caps_register (&sink_caps); - srccaps = gst_caps_register (&src_caps); + sinkcaps = sink_caps_factory (); + srccaps = src_caps_factory (); g_print ("*** compatible caps/templates ***\n"); diff --git a/testsuite/capsnego/converter.c b/testsuite/capsnego/converter.c index df26338d1..83dd8d464 100644 --- a/testsuite/capsnego/converter.c +++ b/testsuite/capsnego/converter.c @@ -3,82 +3,112 @@ GstPad *srcpad, *sinkpad; GstPad *srcconvpad, *sinkconvpad; -GstPad *srcpadtempl, *sinkpadtempl; -GstPad *srcconvtempl, *sinkconvtempl; +GstPadTemplate *srcpadtempl, *sinkpadtempl; +GstPadTemplate *srcconvtempl, *sinkconvtempl; gint converter_in = -1, converter_out = -1; -static GstPadFactory src_factory = { - "src", - GST_PAD_FACTORY_SRC, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "test_src", - "audio/raw", - "rate", GST_PROPS_INT_RANGE (16, 20000) - ), - NULL, -}; - -static GstPadFactory src_conv_factory = { - "src", - GST_PAD_FACTORY_SRC, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "test_src", - "audio/raw", - "rate", GST_PROPS_INT_RANGE (16, 20000) - ), - NULL, -}; - -static GstPadFactory sink_conv_factory = { - "src", - GST_PAD_FACTORY_SINK, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "test_src", - "audio/raw", - "rate", GST_PROPS_INT_RANGE (16, 20000) - ), - NULL, -}; - -static GstPadFactory sink_factory = { - "sink", - GST_PAD_FACTORY_SINK, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "test_sink", - "audio/raw", - "rate", GST_PROPS_INT_RANGE (16, 20000) - ), - NULL, -}; - -static GstCapsFactory sink_caps = { - "sink_caps", - "audio/raw", - "rate", GST_PROPS_INT (6000), - NULL -}; - -static GstCapsFactory src_caps = { - "src_caps", - "audio/raw", - "rate", GST_PROPS_INT (3000), - NULL -}; +static GstPadTemplate* +src_factory (void) +{ + return + gst_padtemplate_new ( + "src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + gst_caps_new ( + "test_src", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT_RANGE (16, 20000), + NULL)), + NULL); +} + +static GstPadTemplate* +src_conv_factory (void) +{ + return + gst_padtemplate_new ( + "src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + gst_caps_new ( + "test_src", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT_RANGE (16, 20000), + NULL)), + NULL); +} + +static GstPadTemplate* +sink_conv_factory (void) +{ + return + gst_padtemplate_new ( + "src", + GST_PAD_SINK, + GST_PAD_ALWAYS, + gst_caps_new ( + "test_src", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT_RANGE (16, 20000), + NULL)), + NULL); +} + +static GstPadTemplate* +sink_factory (void) +{ + return + gst_padtemplate_new ( + "sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + gst_caps_new ( + "test_sink", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT_RANGE (16, 20000), + NULL)), + NULL); +} + +static GstCaps* +sink_caps (void) +{ + return + gst_caps_new ( + "sink_caps", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT (6000), + NULL)); +} + +static GstCaps* +src_caps (void) +{ + return + gst_caps_new ( + "src_caps", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT (3000), + NULL)); +} static GstPadTemplate *srctempl, *sinktempl; static GstCaps *srccaps, *sinkcaps; static GstPadNegotiateReturn -negotiate_src (GstPad *pad, GstCaps **caps, gint counter) +negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data) { g_print (">"); - if (counter == 0) { + if (data == NULL) { *caps = NULL; return GST_PAD_NEGOTIATE_TRY; } @@ -91,10 +121,10 @@ negotiate_src (GstPad *pad, GstCaps **caps, gint counter) } static GstPadNegotiateReturn -negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) +negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data) { g_print ("<"); - if (counter == 0) { + if (data == NULL) { *caps = NULL; return GST_PAD_NEGOTIATE_TRY; } @@ -114,21 +144,22 @@ main (int argc, char *argv[]) gst_init (&argc, &argv); - srctempl = gst_padtemplate_new (&src_factory); - sinktempl = gst_padtemplate_new (&sink_factory); + srctempl = src_factory (); + sinktempl = sink_factory (); srcpad = gst_pad_new_from_template (srctempl, "src"); sinkpad = gst_pad_new_from_template (sinktempl, "sink"); - srcconvtempl = gst_padtemplate_new (&src_conv_factory); - sinkconvtempl = gst_padtemplate_new (&sink_conv_factory); + srcconvtempl = src_conv_factory (); + sinkconvtempl = sink_conv_factory (); srcconvpad = gst_pad_new_from_template (srcconvtempl, "src"); sinkconvpad = gst_pad_new_from_template (sinkconvtempl, "sink"); gst_pad_set_negotiate_function (srcconvpad, negotiate_src); gst_pad_set_negotiate_function (sinkconvpad, negotiate_sink); - sinkcaps = gst_caps_register (&sink_caps); - srccaps = gst_caps_register (&src_caps); + sinkcaps = sink_caps (); + srccaps = src_caps (); + result = gst_pad_set_caps (srcpad, srccaps); g_print ("set caps on src: %d\n", result); g_print ("initial converter status: %d %d\n", converter_in, converter_out); diff --git a/testsuite/capsnego/converter2.c b/testsuite/capsnego/converter2.c index 0532c7695..8b3ebb32e 100644 --- a/testsuite/capsnego/converter2.c +++ b/testsuite/capsnego/converter2.c @@ -3,83 +3,113 @@ GstPad *srcpad, *sinkpad; GstPad *srcconvpad, *sinkconvpad; -GstPad *srcpadtempl, *sinkpadtempl; -GstPad *srcconvtempl, *sinkconvtempl; +GstPadTemplate *srcpadtempl, *sinkpadtempl; +GstPadTemplate *srcconvtempl, *sinkconvtempl; gint converter_in = -1, converter_out = -1; gint target_rate = 2000; -static GstPadFactory src_factory = { - "src", - GST_PAD_FACTORY_SRC, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "test_src", - "audio/raw", - "rate", GST_PROPS_INT_RANGE (16, 20000) - ), - NULL, -}; - -static GstPadFactory src_conv_factory = { - "src", - GST_PAD_FACTORY_SRC, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "test_src", - "audio/raw", - "rate", GST_PROPS_INT_RANGE (16, 20000) - ), - NULL, -}; - -static GstPadFactory sink_conv_factory = { - "src", - GST_PAD_FACTORY_SINK, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "test_src", - "audio/raw", - "rate", GST_PROPS_INT_RANGE (16, 20000) - ), - NULL, -}; - -static GstPadFactory sink_factory = { - "sink", - GST_PAD_FACTORY_SINK, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "test_sink", - "audio/raw", - "rate", GST_PROPS_INT_RANGE (16, 20000) - ), - NULL, -}; - -static GstCapsFactory sink_caps = { - "sink_caps", - "audio/raw", - "rate", GST_PROPS_INT (6000), - NULL -}; - -static GstCapsFactory src_caps = { - "src_caps", - "audio/raw", - "rate", GST_PROPS_INT (3000), - NULL -}; +static GstPadTemplate* +src_factory (void) +{ + return + gst_padtemplate_new ( + "src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + gst_caps_new ( + "test_src", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT_RANGE (16, 20000), + NULL)), + NULL); +} + +static GstPadTemplate* +src_conv_factory (void) +{ + return + gst_padtemplate_new ( + "src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + gst_caps_new ( + "test_src", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT_RANGE (16, 20000), + NULL)), + NULL); +} + +static GstPadTemplate* +sink_conv_factory (void) +{ + return + gst_padtemplate_new ( + "src", + GST_PAD_SINK, + GST_PAD_ALWAYS, + gst_caps_new ( + "test_src", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT_RANGE (16, 20000), + NULL)), + NULL); +} + +static GstPadTemplate* +sink_factory (void) +{ + return + gst_padtemplate_new ( + "sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + gst_caps_new ( + "test_sink", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT_RANGE (16, 20000), + NULL)), + NULL); +} + +static GstCaps* +sink_caps (void) +{ + return + gst_caps_new ( + "sink_caps", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT (6000), + NULL)); +} + +static GstCaps* +src_caps (void) +{ + return + gst_caps_new ( + "src_caps", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT (3000), + NULL)); +} static GstPadTemplate *srctempl, *sinktempl; static GstCaps *srccaps, *sinkcaps; static GstPadNegotiateReturn -converter_negotiate_src (GstPad *pad, GstCaps **caps, gint counter) +converter_negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data) { g_print (">"); - if (counter == 0) { + if (*data == NULL) { *caps = NULL; return GST_PAD_NEGOTIATE_TRY; } @@ -92,19 +122,19 @@ converter_negotiate_src (GstPad *pad, GstCaps **caps, gint counter) } static GstPadNegotiateReturn -converter_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) +converter_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data) { g_print ("<"); - if (counter == 0) { + if (*data == NULL) { *caps = GST_PAD_CAPS (srcconvpad); return GST_PAD_NEGOTIATE_TRY; } if (*caps) { converter_in = gst_caps_get_int (*caps, "rate"); - if (counter == 1) { + if (*data == 1) { 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; } @@ -113,11 +143,11 @@ converter_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) } static GstPadNegotiateReturn -target_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) +target_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data) { g_print ("{"); - if (counter == 0) { - *caps = gst_caps_new_with_props ( + if (*data == NULL) { + *caps = gst_caps_new ( "target_caps", "audio/raw", gst_props_new ( @@ -143,13 +173,13 @@ main (int argc, char *argv[]) gst_init (&argc, &argv); - srctempl = gst_padtemplate_new (&src_factory); - sinktempl = gst_padtemplate_new (&sink_factory); + srctempl = src_factory (); + sinktempl = sink_factory (); srcpad = gst_pad_new_from_template (srctempl, "src"); sinkpad = gst_pad_new_from_template (sinktempl, "sink"); - srcconvtempl = gst_padtemplate_new (&src_conv_factory); - sinkconvtempl = gst_padtemplate_new (&sink_conv_factory); + srcconvtempl = src_conv_factory (); + sinkconvtempl = sink_conv_factory (); srcconvpad = gst_pad_new_from_template (srcconvtempl, "csrc"); 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 (sinkpad, target_negotiate_sink); - sinkcaps = gst_caps_register (&sink_caps); - srccaps = gst_caps_register (&src_caps); + sinkcaps = sink_caps (); + srccaps = src_caps (); g_print ("-------) (-----------) (----- \n"); g_print (" ! ! converter ! ! \n"); diff --git a/testsuite/capsnego/enum.c b/testsuite/capsnego/enum.c index e3959309e..343e08c10 100644 --- a/testsuite/capsnego/enum.c +++ b/testsuite/capsnego/enum.c @@ -4,36 +4,51 @@ GstPad *srcconvpad, *sinkconvpad; GstPadTemplate *srcconvtempl, *sinkconvtempl; -static GstPadFactory src_conv_factory = { - "src", - GST_PAD_FACTORY_SRC, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "test_src", - "audio/raw", - "rate", GST_PROPS_INT_RANGE (16, 20000) - ), - NULL, -}; - -static GstPadFactory sink_conv_factory = { - "src", - GST_PAD_FACTORY_SINK, - GST_PAD_FACTORY_ALWAYS, - GST_PAD_FACTORY_CAPS( - "test_src", - "audio/raw", - "rate", GST_PROPS_INT_RANGE (16, 20000) - ), - NULL, -}; - -static GstCapsFactory src_caps = { - "src_caps", - "audio/raw", - "rate", GST_PROPS_INT (3000), - NULL -}; +static GstPadTemplate* +src_conv_factory (void) +{ + return + gst_padtemplate_new ( + "src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + gst_caps_new ( + "test_src", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT_RANGE (16, 20000), + NULL)), + NULL); +} + +static GstPadTemplate* +sink_conv_factory (void) +{ + return + gst_padtemplate_new ( + "sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + gst_caps_new ( + "test_src", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT_RANGE (16, 20000), + NULL)), + NULL); +} + +static GstCaps* +src_caps (void) +{ + return + gst_caps_new ( + "src_caps", + "audio/raw", + gst_props_new ( + "rate", GST_PROPS_INT (3000), + NULL)); +} static GstCaps *srccaps, *sinkcaps; @@ -41,14 +56,14 @@ static gint src_rate = 140; static gint sink_rate = 100; 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); src_rate++; - if (counter == 0 || caps == NULL) { + if (*data == NULL || caps == NULL) { g_print ("*"); - *caps = gst_caps_new_with_props ( + *caps = gst_caps_new ( "src_caps", "audio/raw", gst_props_new ( @@ -77,15 +92,15 @@ negotiate_src (GstPad *pad, GstCaps **caps, gint counter) } 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); sink_rate++; - if (counter == 0 || *caps == NULL) { + if (*data == NULL || *caps == NULL) { g_print ("*"); - *caps = gst_caps_new_with_props ( + *caps = gst_caps_new ( "sink_caps", "audio/raw", gst_props_new ( @@ -126,15 +141,15 @@ main (int argc, char *argv[]) g_mem_chunk_info(); - srcconvtempl = gst_padtemplate_new (&src_conv_factory); - sinkconvtempl = gst_padtemplate_new (&sink_conv_factory); + srcconvtempl = src_conv_factory (); + sinkconvtempl = sink_conv_factory (); srcconvpad = gst_pad_new_from_template (srcconvtempl, "src"); sinkconvpad = gst_pad_new_from_template (sinkconvtempl, "sink"); gst_pad_set_negotiate_function (srcconvpad, negotiate_src); gst_pad_set_negotiate_function (sinkconvpad, negotiate_sink); - srccaps = gst_caps_register (&src_caps); + srccaps = src_caps (); sinkcaps = gst_caps_copy (srccaps); g_print ("The wild goose chase...\n"); |