Reworked the capsnegotiation function audiosink now uses capsnego to set its paramete...
authorWim Taymans <wim.taymans@gmail.com>
Sun, 18 Mar 2001 02:42:30 +0000 (02:42 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Sun, 18 Mar 2001 02:42:30 +0000 (02:42 +0000)
Original commit message from CVS:
Reworked the capsnegotiation function
audiosink now uses capsnego to set its parameters
mpg123/ac3dec use capsnego instead of metadata
Added the beginnings of a testsuite for capsnego.

28 files changed:
configure.in
docs/plugins/tmpl/gstreamer-plugins-unused.sgml
docs/random/wtay/capsnego-cases
examples/helloworld/helloworld.c
examples/queue/queue.c
examples/xml/runxml.c
gst/elements/gstaudiosink.c
gst/gstcaps.c
gst/gstcaps.h
gst/gstpad.c
gst/gstpad.h
gst/gstprops.c
gst/gstprops.h
gst/gstqueue.c
plugins/elements/gstaudiosink.c
plugins/elements/gstqueue.c
tests/old/examples/helloworld/helloworld.c
tests/old/examples/queue/queue.c
tests/old/examples/xml/runxml.c
tests/old/testsuite/capsnego/.gitignore [new file with mode: 0644]
tests/old/testsuite/capsnego/Makefile.am [new file with mode: 0644]
tests/old/testsuite/capsnego/capsnego.c [new file with mode: 0644]
tests/old/testsuite/capsnego/converter.c [new file with mode: 0644]
tests/props.c
testsuite/capsnego/.gitignore [new file with mode: 0644]
testsuite/capsnego/Makefile.am [new file with mode: 0644]
testsuite/capsnego/capsnego.c [new file with mode: 0644]
testsuite/capsnego/converter.c [new file with mode: 0644]

index fd8ecd7..4bd1f4c 100644 (file)
@@ -791,6 +791,7 @@ tests/Makefile
 tests/sched/Makefile
 tests/eos/Makefile
 testsuite/Makefile
+testsuite/capsnego/Makefile
 tests/nego/Makefile
 examples/Makefile
 examples/autoplug/Makefile
index 73c7ee0..abaae70 100644 (file)
@@ -232,12 +232,6 @@ decoders
 @buf: 
 @rgb: 
 
-<!-- ##### SECTION ./tmpl/jdw.sgml:See_Also ##### -->
-<para>
-
-</para>
-
-
 <!-- ##### STRUCT Mpeg1Meta ##### -->
 <para>
 
@@ -264,6 +258,12 @@ decoders
 @ES_rate: 
 @trick_mode_control: 
 
+<!-- ##### SECTION ./tmpl/jdw.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
 <!-- ##### MACRO LITTLE_SHORT16 ##### -->
 <para>
 
@@ -456,16 +456,16 @@ globals
 </para>
 
 
+<!-- ##### SECTION ./tmpl/uncouple.sgml:Title ##### -->
+uncouple
+
+
 <!-- ##### MACRO GST_PARSEAVI_REGULAR ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### SECTION ./tmpl/uncouple.sgml:Title ##### -->
-uncouple
-
-
 <!-- ##### SECTION ./tmpl/system.sgml:Long_Description ##### -->
 <para>
 
@@ -893,13 +893,13 @@ imdct
 </para>
 
 
-<!-- ##### MACRO MAX_FLIP_BUFFERS ##### -->
+<!-- ##### SECTION ./tmpl/RTjpeg.sgml:See_Also ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### SECTION ./tmpl/RTjpeg.sgml:See_Also ##### -->
+<!-- ##### MACRO MAX_FLIP_BUFFERS ##### -->
 <para>
 
 </para>
@@ -911,20 +911,20 @@ imdct
 </para>
 
 
-<!-- ##### FUNCTION rb_end_write ##### -->
+<!-- ##### FUNCTION EncodeAC ##### -->
 <para>
 
 </para>
 
+@vid_stream: 
+@index: 
+@matrix: 
 
-<!-- ##### FUNCTION EncodeAC ##### -->
+<!-- ##### FUNCTION rb_end_write ##### -->
 <para>
 
 </para>
 
-@vid_stream: 
-@index: 
-@matrix: 
 
 <!-- ##### FUNCTION ReferenceIDct ##### -->
 <para>
@@ -940,13 +940,13 @@ imdct
 </para>
 
 
-<!-- ##### MACRO NEW_DATA ##### -->
+<!-- ##### ARG GstMpeg2play:frames_per_second ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### ARG GstMpeg2play:frames_per_second ##### -->
+<!-- ##### MACRO NEW_DATA ##### -->
 <para>
 
 </para>
@@ -958,19 +958,19 @@ imdct
 </para>
 
 
-<!-- ##### MACRO SC_NONE ##### -->
+<!-- ##### FUNCTION gst_vumeter_new ##### -->
 <para>
 
 </para>
 
+@name: 
+@Returns: 
 
-<!-- ##### FUNCTION gst_vumeter_new ##### -->
+<!-- ##### MACRO SC_NONE ##### -->
 <para>
 
 </para>
 
-@name: 
-@Returns: 
 
 <!-- ##### FUNCTION mpeg2enc_new_encoder ##### -->
 <para>
@@ -985,14 +985,9 @@ imdct
 </para>
 
 
-<!-- ##### FUNCTION mpg123_get_songlen ##### -->
-<para>
-
-</para>
+<!-- ##### SECTION ./tmpl/acconfig.sgml:Title ##### -->
+acconfig
 
-@fr: 
-@no: 
-@Returns: 
 
 <!-- ##### MACRO sputv ##### -->
 <para>
@@ -1000,9 +995,14 @@ imdct
 </para>
 
 
-<!-- ##### SECTION ./tmpl/acconfig.sgml:Title ##### -->
-acconfig
+<!-- ##### FUNCTION mpg123_get_songlen ##### -->
+<para>
+
+</para>
 
+@fr: 
+@no: 
+@Returns: 
 
 <!-- ##### ARG System_Encode:video ##### -->
 <para>
@@ -1022,13 +1022,13 @@ acconfig
 </para>
 
 
-<!-- ##### SECTION ./tmpl/mpg123.sgml:Long_Description ##### -->
+<!-- ##### SECTION ./tmpl/system.sgml:See_Also ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### SECTION ./tmpl/system.sgml:See_Also ##### -->
+<!-- ##### SECTION ./tmpl/mpg123.sgml:Long_Description ##### -->
 <para>
 
 </para>
@@ -1040,13 +1040,13 @@ acconfig
 </para>
 
 
-<!-- ##### MACRO MACRO_BLOCK_ESCAPE ##### -->
+<!-- ##### SECTION ./tmpl/globals.sgml:Long_Description ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### SECTION ./tmpl/globals.sgml:Long_Description ##### -->
+<!-- ##### MACRO MACRO_BLOCK_ESCAPE ##### -->
 <para>
 
 </para>
@@ -1728,7 +1728,7 @@ system
 </para>
 
 
-<!-- ##### FUNCTION ac3dec_imdct_init ##### -->
+<!-- ##### ARG GstV4lSrc:mode ##### -->
 <para>
 
 </para>
@@ -1740,7 +1740,7 @@ system
 </para>
 
 
-<!-- ##### ARG GstV4lSrc:mode ##### -->
+<!-- ##### FUNCTION ac3dec_imdct_init ##### -->
 <para>
 
 </para>
@@ -1787,14 +1787,14 @@ system
 debug
 
 
-<!-- ##### TYPEDEF motion_vectors_entry ##### -->
-<para>
+<!-- ##### SECTION ./tmpl/prototypes.sgml:Short_Description ##### -->
 
-</para>
 
 
-<!-- ##### SECTION ./tmpl/prototypes.sgml:Short_Description ##### -->
+<!-- ##### TYPEDEF motion_vectors_entry ##### -->
+<para>
 
+</para>
 
 
 <!-- ##### STRUCT GstRiffChunk ##### -->
@@ -1819,6 +1819,10 @@ debug
 
 @obj: 
 
+<!-- ##### SECTION ./tmpl/htable.sgml:Title ##### -->
+htable
+
+
 <!-- ##### FUNCTION putbits_new_empty_buffer ##### -->
 <para>
 
@@ -1827,23 +1831,19 @@ debug
 @pb: 
 @len: 
 
-<!-- ##### SECTION ./tmpl/htable.sgml:Title ##### -->
-htable
-
-
-<!-- ##### FUNCTION RTjpeg_decompress8 ##### -->
+<!-- ##### MACRO ERROR_MARKER_STRUCTURE ##### -->
 <para>
 
 </para>
 
-@sp: 
-@bp: 
 
-<!-- ##### MACRO ERROR_MARKER_STRUCTURE ##### -->
+<!-- ##### FUNCTION RTjpeg_decompress8 ##### -->
 <para>
 
 </para>
 
+@sp: 
+@bp: 
 
 <!-- ##### FUNCTION JP0HDecimateMem ##### -->
 <para>
@@ -1852,35 +1852,35 @@ htable
 
 @Returns: 
 
-<!-- ##### MACRO ISO_END_CODE ##### -->
+<!-- ##### MACRO MB_FORWARD ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### MACRO MB_FORWARD ##### -->
+<!-- ##### MACRO ISO_END_CODE ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### FUNCTION ReadVSHeader ##### -->
+<!-- ##### SECTION ./tmpl/acconfig.sgml:Long_Description ##### -->
 <para>
 
 </para>
 
-@vid_stream: 
-@Returns: 
 
 <!-- ##### SECTION ./tmpl/bitstream.sgml:Short_Description ##### -->
 
 
 
-<!-- ##### SECTION ./tmpl/acconfig.sgml:Long_Description ##### -->
+<!-- ##### FUNCTION ReadVSHeader ##### -->
 <para>
 
 </para>
 
+@vid_stream: 
+@Returns: 
 
 <!-- ##### MACRO SYNA_SIZE ##### -->
 <para>
@@ -1894,13 +1894,13 @@ htable
 </para>
 
 
-<!-- ##### MACRO GRAB_ATTR_VOLUME ##### -->
+<!-- ##### MACRO SBLIMIT ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### MACRO SBLIMIT ##### -->
+<!-- ##### MACRO GRAB_ATTR_VOLUME ##### -->
 <para>
 
 </para>
@@ -1922,10 +1922,6 @@ htable
 @hi: 
 @str: 
 
-<!-- ##### SECTION ./tmpl/musicin.sgml:Title ##### -->
-musicin
-
-
 <!-- ##### FUNCTION BruteMotionEstimation ##### -->
 <para>
 
@@ -1935,6 +1931,10 @@ musicin
 @pmem: 
 @fmem: 
 
+<!-- ##### SECTION ./tmpl/musicin.sgml:Title ##### -->
+musicin
+
+
 <!-- ##### MACRO PICTURE_LAYER ##### -->
 <para>
 
@@ -1948,28 +1948,28 @@ musicin
 
 @Returns: 
 
-<!-- ##### MACRO MakeStructure ##### -->
+<!-- ##### MACRO DecodeCBP ##### -->
 <para>
 
 </para>
 
-@named_st: 
+@gb: 
+@coded_bp: 
 
-<!-- ##### MACRO DecodeCBP ##### -->
+<!-- ##### MACRO MakeStructure ##### -->
 <para>
 
 </para>
 
-@gb: 
-@coded_bp: 
+@named_st: 
 
-<!-- ##### MACRO L_SQUANT ##### -->
+<!-- ##### TYPEDEF D10[10] ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### TYPEDEF D10[10] ##### -->
+<!-- ##### MACRO L_SQUANT ##### -->
 <para>
 
 </para>
@@ -1983,20 +1983,26 @@ musicin
 @gstvideosink: the object which received the signal.
 @arg1: 
 
+<!-- ##### FUNCTION putbits_new_buffer ##### -->
+<para>
+
+</para>
+
+@pb: 
+@buffer: 
+@len: 
+
 <!-- ##### MACRO SLICE_MIN_START_CODE ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### FUNCTION putbits_new_buffer ##### -->
+<!-- ##### TYPEDEF BLOCK ##### -->
 <para>
 
 </para>
 
-@pb: 
-@buffer: 
-@len: 
 
 <!-- ##### FUNCTION HPFastBME ##### -->
 <para>
@@ -2013,18 +2019,13 @@ musicin
 @ox: 
 @oy: 
 
-<!-- ##### TYPEDEF BLOCK ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### MACRO GTK_OVERLAY_IMAGE_MEM ##### -->
+<!-- ##### FUNCTION parse_auxdata ##### -->
 <para>
 
 </para>
 
-@obj: 
+@syncinfo: 
+@gb: 
 
 <!-- ##### FUNCTION Decode ##### -->
 <para>
@@ -2035,13 +2036,12 @@ musicin
 @huff: 
 @Returns: 
 
-<!-- ##### FUNCTION parse_auxdata ##### -->
+<!-- ##### MACRO GTK_OVERLAY_IMAGE_MEM ##### -->
 <para>
 
 </para>
 
-@syncinfo: 
-@gb: 
+@obj: 
 
 <!-- ##### MACRO FADE_HEAT ##### -->
 <para>
@@ -2065,13 +2065,13 @@ musicin
 
 
 
-<!-- ##### MACRO WHEREAMI ##### -->
+<!-- ##### ARG Mpeg2Parse:mux_rate ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### ARG Mpeg2Parse:mux_rate ##### -->
+<!-- ##### MACRO WHEREAMI ##### -->
 <para>
 
 </para>
@@ -2141,16 +2141,16 @@ mantissa
 </para>
 
 
-<!-- ##### SECTION ./tmpl/video.sgml:Title ##### -->
-video
-
-
 <!-- ##### SECTION ./tmpl/proto.sgml:Long_Description ##### -->
 <para>
 
 </para>
 
 
+<!-- ##### SECTION ./tmpl/video.sgml:Title ##### -->
+video
+
+
 <!-- ##### FUNCTION TransposeMatrix ##### -->
 <para>
 
@@ -2189,30 +2189,32 @@ video
 </para>
 
 
-<!-- ##### MACRO FUTURE_LOCK ##### -->
-<para>
+<!-- ##### SECTION ./tmpl/gtkoverlayimage.sgml:Short_Description ##### -->
 
-</para>
 
 
-<!-- ##### TYPEDEF DCTELEM ##### -->
+<!-- ##### MACRO SLICE_LAYER ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### MACRO SLICE_LAYER ##### -->
+<!-- ##### TYPEDEF DCTELEM ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### SECTION ./tmpl/gtkoverlayimage.sgml:Short_Description ##### -->
+<!-- ##### MACRO FUTURE_LOCK ##### -->
+<para>
 
+</para>
 
 
-<!-- ##### SECTION ./tmpl/gstriff.sgml:Short_Description ##### -->
+<!-- ##### MACRO P_DCINTRA ##### -->
+<para>
 
+</para>
 
 
 <!-- ##### FUNCTION crc_init ##### -->
@@ -2221,10 +2223,8 @@ video
 </para>
 
 
-<!-- ##### MACRO P_DCINTRA ##### -->
-<para>
+<!-- ##### SECTION ./tmpl/gstriff.sgml:Short_Description ##### -->
 
-</para>
 
 
 <!-- ##### FUNCTION gst_v4lsrc_push ##### -->
@@ -3396,14 +3396,14 @@ marker
 </para>
 
 
-<!-- ##### FUNCTION MakeFGroup ##### -->
+<!-- ##### FUNCTION MakeImage ##### -->
 <para>
 
 </para>
 
 @vid_stream: 
 
-<!-- ##### FUNCTION MakeImage ##### -->
+<!-- ##### FUNCTION MakeFGroup ##### -->
 <para>
 
 </para>
@@ -3416,22 +3416,22 @@ marker
 </para>
 
 
-<!-- ##### FUNCTION SaveMem ##### -->
+<!-- ##### FUNCTION gst_riff_get_chunk ##### -->
 <para>
 
 </para>
 
-@filename
-@mem
+@riff
+@fourcc
 @Returns: 
 
-<!-- ##### FUNCTION gst_riff_get_chunk ##### -->
+<!-- ##### FUNCTION SaveMem ##### -->
 <para>
 
 </para>
 
-@riff
-@fourcc
+@filename
+@mem
 @Returns: 
 
 <!-- ##### MACRO L_BUFFERSIZE ##### -->
@@ -3452,20 +3452,20 @@ marker
 </para>
 
 
-<!-- ##### MACRO NOISY ##### -->
+<!-- ##### FUNCTION bitstream_get ##### -->
 <para>
 
 </para>
 
+@bs: 
+@num_bits: 
+@Returns: 
 
-<!-- ##### FUNCTION bitstream_get ##### -->
+<!-- ##### MACRO NOISY ##### -->
 <para>
 
 </para>
 
-@bs: 
-@num_bits: 
-@Returns: 
 
 <!-- ##### MACRO MINIMUM ##### -->
 <para>
@@ -3503,12 +3503,6 @@ marker
 </para>
 
 
-<!-- ##### MACRO PACK_START_CODE ##### -->
-<para>
-
-</para>
-
-
 <!-- ##### FUNCTION gst_mpegaudio_chain ##### -->
 <para>
 
@@ -3517,14 +3511,16 @@ marker
 @pad: 
 @buf: 
 
-<!-- ##### TYPEDEF DFFT2[FFT_SIZE/2] ##### -->
+<!-- ##### MACRO PACK_START_CODE ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### SECTION ./tmpl/buffer.sgml:Short_Description ##### -->
+<!-- ##### TYPEDEF DFFT2[FFT_SIZE/2] ##### -->
+<para>
 
+</para>
 
 
 <!-- ##### MACRO SYS_HEADER_LENGTH ##### -->
@@ -3533,6 +3529,10 @@ marker
 </para>
 
 
+<!-- ##### SECTION ./tmpl/buffer.sgml:Short_Description ##### -->
+
+
+
 <!-- ##### FUNCTION RTjpeg_compressYUV420 ##### -->
 <para>
 
@@ -3542,20 +3542,20 @@ marker
 @bp: 
 @Returns: 
 
-<!-- ##### FUNCTION RTjpeg_compressYUV422 ##### -->
+<!-- ##### MACRO DFLT_SFQ ##### -->
 <para>
 
 </para>
 
-@sp: 
-@bp: 
-@Returns: 
 
-<!-- ##### MACRO DFLT_SFQ ##### -->
+<!-- ##### FUNCTION RTjpeg_compressYUV422 ##### -->
 <para>
 
 </para>
 
+@sp: 
+@bp: 
+@Returns: 
 
 <!-- ##### TYPEDEF JSBS[3][SCALE_BLOCK][SBLIMIT] ##### -->
 <para>
@@ -3586,13 +3586,13 @@ marker
 @searchForward: 
 @Returns: 
 
-<!-- ##### MACRO MEM ##### -->
+<!-- ##### TYPEDEF IFFT[FFT_SIZE] ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### TYPEDEF IFFT[FFT_SIZE] ##### -->
+<!-- ##### MACRO MEM ##### -->
 <para>
 
 </para>
@@ -3610,16 +3610,16 @@ marker
 </para>
 
 
-<!-- ##### SECTION ./tmpl/tables.sgml:Title ##### -->
-tables
-
-
 <!-- ##### MACRO START_BLOCK ##### -->
 <para>
 
 </para>
 
 
+<!-- ##### SECTION ./tmpl/tables.sgml:Title ##### -->
+tables
+
+
 <!-- ##### ARG GstV4lSrc:volume ##### -->
 <para>
 
@@ -3632,16 +3632,16 @@ tables
 </para>
 
 
-<!-- ##### SECTION ./tmpl/output.sgml:Title ##### -->
-output
-
-
 <!-- ##### MACRO P_FORBIDDEN ##### -->
 <para>
 
 </para>
 
 
+<!-- ##### SECTION ./tmpl/output.sgml:Title ##### -->
+output
+
+
 <!-- ##### FUNCTION audio_decode ##### -->
 <para>
 
@@ -3651,14 +3651,6 @@ output
 @pcm: 
 @Returns: 
 
-<!-- ##### FUNCTION gst_riff_get_nextlikely ##### -->
-<para>
-
-</para>
-
-@riff: 
-@Returns: 
-
 <!-- ##### FUNCTION mpg123_synth_1to1 ##### -->
 <para>
 
@@ -3671,6 +3663,14 @@ output
 @pnt: 
 @Returns: 
 
+<!-- ##### FUNCTION gst_riff_get_nextlikely ##### -->
+<para>
+
+</para>
+
+@riff: 
+@Returns: 
+
 <!-- ##### FUNCTION II_CRC_calc ##### -->
 <para>
 
@@ -3704,19 +3704,19 @@ GtkOverlayImage
 </para>
 
 
-<!-- ##### FUNCTION PrintEhuff ##### -->
+<!-- ##### FUNCTION MakeFStore ##### -->
 <para>
 
 </para>
 
-@huff
+@vid_stream
 
-<!-- ##### FUNCTION MakeFStore ##### -->
+<!-- ##### FUNCTION PrintEhuff ##### -->
 <para>
 
 </para>
 
-@vid_stream
+@huff
 
 <!-- ##### MACRO MB_PATTERN ##### -->
 <para>
@@ -3732,13 +3732,13 @@ GtkOverlayImage
 @name: 
 @Returns: 
 
-<!-- ##### SECTION ./tmpl/config.sgml:See_Also ##### -->
+<!-- ##### MACRO P_INTERPOLATED ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### MACRO P_INTERPOLATED ##### -->
+<!-- ##### SECTION ./tmpl/config.sgml:See_Also ##### -->
 <para>
 
 </para>
@@ -3790,13 +3790,13 @@ GtkOverlayImage
 </para>
 
 
-<!-- ##### MACRO FILETYPE_ENCODE ##### -->
+<!-- ##### MACRO SEQUENCE_HEADER_CODE ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### MACRO SEQUENCE_HEADER_CODE ##### -->
+<!-- ##### MACRO FILETYPE_ENCODE ##### -->
 <para>
 
 </para>
@@ -3846,13 +3846,13 @@ csize
 @Varargs: 
 @Returns: 
 
-<!-- ##### MACRO MAC_WINDOW_SIZE ##### -->
+<!-- ##### SECTION ./tmpl/crc.sgml:Long_Description ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### SECTION ./tmpl/crc.sgml:Long_Description ##### -->
+<!-- ##### MACRO MAC_WINDOW_SIZE ##### -->
 <para>
 
 </para>
@@ -3872,27 +3872,21 @@ csize
 @pad: 
 @buf: 
 
-<!-- ##### SECTION ./tmpl/config.sgml:Short_Description ##### -->
-
-
-
 <!-- ##### ARG VCDSrc:track ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### SECTION ./tmpl/musicin.sgml:See_Also ##### -->
-<para>
+<!-- ##### SECTION ./tmpl/config.sgml:Short_Description ##### -->
 
-</para>
 
 
 <!-- ##### SECTION ./tmpl/stats.sgml:Title ##### -->
 stats
 
 
-<!-- ##### SECTION ./tmpl/mpeg2dec.sgml:Long_Description ##### -->
+<!-- ##### SECTION ./tmpl/musicin.sgml:See_Also ##### -->
 <para>
 
 </para>
@@ -3904,6 +3898,12 @@ stats
 </para>
 
 
+<!-- ##### SECTION ./tmpl/mpeg2dec.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
 <!-- ##### FUNCTION MakeFileNames ##### -->
 <para>
 
@@ -3943,13 +3943,13 @@ stats
 
 @vid_stream: 
 
-<!-- ##### SECTION ./tmpl/csize.sgml:Long_Description ##### -->
+<!-- ##### ARG GstVideoSink:frames_displayed ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### ARG GstVideoSink:frames_displayed ##### -->
+<!-- ##### SECTION ./tmpl/csize.sgml:Long_Description ##### -->
 <para>
 
 </para>
@@ -3968,6 +3968,14 @@ stats
 </para>
 
 
+<!-- ##### FUNCTION ChenIDct ##### -->
+<para>
+
+</para>
+
+@x: 
+@y: 
+
 <!-- ##### FUNCTION LoadMem ##### -->
 <para>
 
@@ -3979,14 +3987,6 @@ stats
 @omem: 
 @Returns: 
 
-<!-- ##### FUNCTION ChenIDct ##### -->
-<para>
-
-</para>
-
-@x: 
-@y: 
-
 <!-- ##### MACRO MPEGLAYER1 ##### -->
 <para>
 
@@ -4011,13 +4011,13 @@ stats
 </para>
 
 
-<!-- ##### MACRO WRITE_MODE ##### -->
+<!-- ##### MACRO ERROR_HUFFMAN_READ ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### MACRO ERROR_HUFFMAN_READ ##### -->
+<!-- ##### MACRO WRITE_MODE ##### -->
 <para>
 
 </para>
@@ -4043,13 +4043,13 @@ stats
 </para>
 
 
-<!-- ##### MACRO sgetc ##### -->
+<!-- ##### SECTION ./tmpl/stats.sgml:Long_Description ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### SECTION ./tmpl/stats.sgml:Long_Description ##### -->
+<!-- ##### MACRO sgetc ##### -->
 <para>
 
 </para>
@@ -4078,13 +4078,13 @@ size
 </para>
 
 
-<!-- ##### MACRO MC_FIELD ##### -->
+<!-- ##### ARG GstVideoSink:xv_enabled ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### ARG GstVideoSink:xv_enabled ##### -->
+<!-- ##### MACRO MC_FIELD ##### -->
 <para>
 
 </para>
@@ -4143,25 +4143,19 @@ size
 </para>
 
 
-<!-- ##### MACRO ERROR_INIT_FILE ##### -->
-<para>
-
-</para>
-
-
 <!-- ##### MACRO GST_PARSEAVI_MAX_VIDEO_PADS ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### MACRO SEQSCAL_ID ##### -->
+<!-- ##### MACRO ERROR_INIT_FILE ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### MACRO SYNA_BITS ##### -->
+<!-- ##### MACRO SEQSCAL_ID ##### -->
 <para>
 
 </para>
@@ -4175,13 +4169,11 @@ size
 @Param1: 
 @Param2: 
 
-<!-- ##### FUNCTION gst_spindentity_chain ##### -->
+<!-- ##### MACRO SYNA_BITS ##### -->
 <para>
 
 </para>
 
-@pad: 
-@buf: 
 
 <!-- ##### FUNCTION MakeFrame ##### -->
 <para>
@@ -4190,6 +4182,14 @@ size
 
 @vid_stream: 
 
+<!-- ##### FUNCTION gst_spindentity_chain ##### -->
+<para>
+
+</para>
+
+@pad: 
+@buf: 
+
 <!-- ##### SECTION ./tmpl/itype.sgml:Long_Description ##### -->
 <para>
 
@@ -4208,6 +4208,10 @@ size
 </para>
 
 
+<!-- ##### SECTION ./tmpl/putbits.sgml:Title ##### -->
+putbits
+
+
 <!-- ##### FUNCTION gst_volume_new ##### -->
 <para>
 
@@ -4216,10 +4220,6 @@ size
 @name: 
 @Returns: 
 
-<!-- ##### SECTION ./tmpl/putbits.sgml:Title ##### -->
-putbits
-
-
 <!-- ##### SECTION ./tmpl/downmix.sgml:See_Also ##### -->
 <para>
 
@@ -4250,8 +4250,10 @@ itype
 </para>
 
 
-<!-- ##### SECTION ./tmpl/decode.sgml:Title ##### -->
-decode
+<!-- ##### SECTION ./tmpl/globals.sgml:See_Also ##### -->
+<para>
+
+</para>
 
 
 <!-- ##### FUNCTION MakeFS ##### -->
@@ -4262,19 +4264,17 @@ decode
 @vid_stream: 
 @flag: 
 
-<!-- ##### SECTION ./tmpl/globals.sgml:See_Also ##### -->
-<para>
-
-</para>
+<!-- ##### SECTION ./tmpl/decode.sgml:Title ##### -->
+decode
 
 
-<!-- ##### MACRO L_BD ##### -->
+<!-- ##### MACRO GRAB_ATTR_CONTRAST ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### MACRO GRAB_ATTR_CONTRAST ##### -->
+<!-- ##### MACRO L_BD ##### -->
 <para>
 
 </para>
@@ -6727,11 +6727,12 @@ l2tables
 @Param1: 
 @Returns: 
 
-<!-- ##### TYPEDEF SAMPLEINT ##### -->
+<!-- ##### MACRO MPEG1MUX_BUFFER_FIRST_TIMECODE ##### -->
 <para>
 
 </para>
 
+@mb: 
 
 <!-- ##### SECTION ./tmpl/grab.sgml:Long_Description ##### -->
 <para>
@@ -6739,12 +6740,11 @@ l2tables
 </para>
 
 
-<!-- ##### MACRO MPEG1MUX_BUFFER_FIRST_TIMECODE ##### -->
+<!-- ##### TYPEDEF SAMPLEINT ##### -->
 <para>
 
 </para>
 
-@mb: 
 
 <!-- ##### SECTION ./tmpl/vlc.sgml:Long_Description ##### -->
 <para>
@@ -6752,19 +6752,19 @@ l2tables
 </para>
 
 
-<!-- ##### SECTION ./tmpl/main.sgml:See_Also ##### -->
+<!-- ##### FUNCTION gst_mpeg1encoder_chain ##### -->
 <para>
 
 </para>
 
+@pad: 
+@buf: 
 
-<!-- ##### FUNCTION gst_mpeg1encoder_chain ##### -->
+<!-- ##### SECTION ./tmpl/main.sgml:See_Also ##### -->
 <para>
 
 </para>
 
-@pad: 
-@buf: 
 
 <!-- ##### MACRO GST_PARSEWAV_CHUNK_FMT ##### -->
 <para>
@@ -6772,13 +6772,13 @@ l2tables
 </para>
 
 
-<!-- ##### MACRO VIDEO_LUT2 ##### -->
+<!-- ##### MACRO MC_16X8 ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### MACRO MC_16X8 ##### -->
+<!-- ##### MACRO VIDEO_LUT2 ##### -->
 <para>
 
 </para>
@@ -6790,18 +6790,18 @@ l2tables
 </para>
 
 
-<!-- ##### SECTION ./tmpl/putbits.sgml:Long_Description ##### -->
+<!-- ##### FUNCTION BoundIntegerMatrix ##### -->
 <para>
 
 </para>
 
+@matrix: 
 
-<!-- ##### FUNCTION BoundIntegerMatrix ##### -->
+<!-- ##### SECTION ./tmpl/putbits.sgml:Long_Description ##### -->
 <para>
 
 </para>
 
-@matrix: 
 
 <!-- ##### TYPEDEF vFunc() ##### -->
 <para>
@@ -6827,13 +6827,13 @@ l2tables
 </para>
 
 
-<!-- ##### FUNCTION set_mac_file_attr ##### -->
+<!-- ##### MACRO BLOCKHEIGHT ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### MACRO BLOCKHEIGHT ##### -->
+<!-- ##### FUNCTION set_mac_file_attr ##### -->
 <para>
 
 </para>
@@ -6843,13 +6843,13 @@ l2tables
 
 
 
-<!-- ##### MACRO ASM_X86_OLD ##### -->
+<!-- ##### MACRO LEVEL_MASK ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### MACRO LEVEL_MASK ##### -->
+<!-- ##### MACRO ASM_X86_OLD ##### -->
 <para>
 
 </para>
@@ -6902,13 +6902,13 @@ grab
 
 @table: 
 
-<!-- ##### MACRO GRAB_ATTR_MODE ##### -->
+<!-- ##### SECTION ./tmpl/encoder.sgml:Long_Description ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### SECTION ./tmpl/encoder.sgml:Long_Description ##### -->
+<!-- ##### MACRO GRAB_ATTR_MODE ##### -->
 <para>
 
 </para>
@@ -6930,13 +6930,13 @@ grab
 
 @pb: 
 
-<!-- ##### SECTION ./tmpl/parse.sgml:Long_Description ##### -->
+<!-- ##### MACRO PAST_LOCK ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### MACRO PAST_LOCK ##### -->
+<!-- ##### SECTION ./tmpl/parse.sgml:Long_Description ##### -->
 <para>
 
 </para>
@@ -6983,29 +6983,23 @@ grab
 </para>
 
 
-<!-- ##### FUNCTION gtk_xvimage_new ##### -->
+<!-- ##### SECTION ./tmpl/mantissa.sgml:See_Also ##### -->
 <para>
 
 </para>
 
-@val: 
-@Returns: 
 
 <!-- ##### SECTION ./tmpl/decoders.sgml:Short_Description ##### -->
 
 
 
-<!-- ##### SECTION ./tmpl/mantissa.sgml:See_Also ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### MACRO ERROR_PREMATURE_EOF ##### -->
+<!-- ##### FUNCTION gtk_xvimage_new ##### -->
 <para>
 
 </para>
 
+@val: 
+@Returns: 
 
 <!-- ##### SECTION ./tmpl/grab.sgml:See_Also ##### -->
 <para>
@@ -7013,7 +7007,7 @@ grab
 </para>
 
 
-<!-- ##### MACRO LEVEL_SHIFT ##### -->
+<!-- ##### MACRO ERROR_PREMATURE_EOF ##### -->
 <para>
 
 </para>
@@ -7026,13 +7020,13 @@ grab
 
 @Returns: 
 
-<!-- ##### MACRO ERROR_MEMORY ##### -->
+<!-- ##### MACRO LEVEL_SHIFT ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### SECTION ./tmpl/mem.sgml:See_Also ##### -->
+<!-- ##### MACRO ERROR_MEMORY ##### -->
 <para>
 
 </para>
@@ -7046,19 +7040,19 @@ grab
 @name: 
 @Returns: 
 
-<!-- ##### MACRO WINBITS ##### -->
+<!-- ##### SECTION ./tmpl/mem.sgml:See_Also ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### TYPEDEF mb_addr_inc_entry ##### -->
+<!-- ##### MACRO WINBITS ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### MACRO SKIP_TO_START_CODE ##### -->
+<!-- ##### TYPEDEF mb_addr_inc_entry ##### -->
 <para>
 
 </para>
@@ -7071,13 +7065,13 @@ grab
 
 @Returns: 
 
-<!-- ##### MACRO MPG_LAYER_1 ##### -->
+<!-- ##### MACRO SKIP_TO_START_CODE ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### MACRO MPG_LAYER_2 ##### -->
+<!-- ##### MACRO MPG_LAYER_1 ##### -->
 <para>
 
 </para>
@@ -7089,11 +7083,19 @@ grab
 </para>
 
 
-<!-- ##### MACRO MPG_LAYER_3 ##### -->
+<!-- ##### MACRO MPG_LAYER_2 ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION gst_videosink_chain ##### -->
 <para>
 
 </para>
 
+@pad: 
+@buf: 
 
 <!-- ##### MACRO UDSC ##### -->
 <para>
@@ -7101,13 +7103,11 @@ grab
 </para>
 
 
-<!-- ##### FUNCTION gst_videosink_chain ##### -->
+<!-- ##### MACRO MPG_LAYER_3 ##### -->
 <para>
 
 </para>
 
-@pad: 
-@buf: 
 
 <!-- ##### MACRO gst_cobin_destroy ##### -->
 <para>
@@ -7124,18 +7124,22 @@ grab
 @name: 
 @Returns: 
 
-<!-- ##### SECTION ./tmpl/param.sgml:See_Also ##### -->
+<!-- ##### MACRO COEFFSUM_SCALE ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### MACRO COEFFSUM_SCALE ##### -->
+<!-- ##### SECTION ./tmpl/param.sgml:See_Also ##### -->
 <para>
 
 </para>
 
 
+<!-- ##### SECTION ./tmpl/ring_buffer.sgml:Short_Description ##### -->
+
+
+
 <!-- ##### FUNCTION ReadBlock ##### -->
 <para>
 
@@ -7144,27 +7148,26 @@ grab
 @vid_stream: 
 @store: 
 
-<!-- ##### SECTION ./tmpl/ring_buffer.sgml:Short_Description ##### -->
-
-
-
-<!-- ##### ARG VCDSrc:location ##### -->
+<!-- ##### MACRO MACROBLOCK_QUANT ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### MACRO MACROBLOCK_QUANT ##### -->
+<!-- ##### ARG VCDSrc:location ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### SECTION ./tmpl/video.sgml:Long_Description ##### -->
+<!-- ##### FUNCTION mpg123_decode_header ##### -->
 <para>
 
 </para>
 
+@fr: 
+@header: 
+@Returns: 
 
 <!-- ##### MACRO DFLT_EMP ##### -->
 <para>
@@ -7172,14 +7175,11 @@ grab
 </para>
 
 
-<!-- ##### FUNCTION mpg123_decode_header ##### -->
+<!-- ##### SECTION ./tmpl/video.sgml:Long_Description ##### -->
 <para>
 
 </para>
 
-@fr: 
-@header: 
-@Returns: 
 
 <!-- ##### MACRO T_Y_U_V ##### -->
 <para>
@@ -7199,7 +7199,7 @@ grab
 </para>
 
 
-<!-- ##### MACRO SC_DP ##### -->
+<!-- ##### MACRO L_BDBD ##### -->
 <para>
 
 </para>
@@ -7211,7 +7211,7 @@ grab
 </para>
 
 
-<!-- ##### MACRO L_BDBD ##### -->
+<!-- ##### MACRO SC_DP ##### -->
 <para>
 
 </para>
@@ -7225,19 +7225,19 @@ grab
 @name: 
 @Returns: 
 
-<!-- ##### FUNCTION RTjpeg_yuvrgb8 ##### -->
+<!-- ##### MACRO IC_ONE_EIGHTH ##### -->
 <para>
 
 </para>
 
-@buf: 
-@rgb: 
 
-<!-- ##### MACRO IC_ONE_EIGHTH ##### -->
+<!-- ##### FUNCTION RTjpeg_yuvrgb8 ##### -->
 <para>
 
 </para>
 
+@buf: 
+@rgb: 
 
 <!-- ##### MACRO IUBOUND ##### -->
 <para>
@@ -7258,6 +7258,12 @@ grab
 RTjpeg
 
 
+<!-- ##### SECTION ./tmpl/htable.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
 <!-- ##### FUNCTION new_ext ##### -->
 <para>
 
@@ -7267,7 +7273,7 @@ RTjpeg
 @extname: 
 @Returns: 
 
-<!-- ##### SECTION ./tmpl/htable.sgml:See_Also ##### -->
+<!-- ##### MACRO VIDEO_RGB16_BE ##### -->
 <para>
 
 </para>
@@ -7281,12 +7287,6 @@ RTjpeg
 @fourcc: 
 @Returns: 
 
-<!-- ##### MACRO VIDEO_RGB16_BE ##### -->
-<para>
-
-</para>
-
-
 <!-- ##### FUNCTION gst_jpegdec_new ##### -->
 <para>
 
@@ -7362,6 +7362,14 @@ RTjpeg
 </para>
 
 
+<!-- ##### FUNCTION gst_stereo_chain ##### -->
+<para>
+
+</para>
+
+@pad: 
+@buf: 
+
 <!-- ##### FUNCTION putbits_init ##### -->
 <para>
 
@@ -7369,43 +7377,43 @@ RTjpeg
 
 @pb: 
 
-<!-- ##### FUNCTION gst_stereo_chain ##### -->
+<!-- ##### FUNCTION mwseek ##### -->
 <para>
 
 </para>
 
-@pad
-@buf
+@vid_stream
+@distance
 
-<!-- ##### MACRO GST_PARSEAVI_MOVI ##### -->
+<!-- ##### SECTION ./tmpl/prototypes.sgml:See_Also ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### SECTION ./tmpl/prototypes.sgml:See_Also ##### -->
+<!-- ##### MACRO GST_PARSEAVI_MOVI ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### FUNCTION mwseek ##### -->
+<!-- ##### ARG GstWinEnc:avi_header ##### -->
 <para>
 
 </para>
 
-@vid_stream: 
-@distance: 
 
 <!-- ##### SECTION ./tmpl/core.sgml:Title ##### -->
 core
 
 
-<!-- ##### ARG GstWinEnc:avi_header ##### -->
+<!-- ##### FUNCTION double_to_extended ##### -->
 <para>
 
 </para>
 
+@Param1: 
+@Param2: 
 
 <!-- ##### FUNCTION dct64 ##### -->
 <para>
@@ -7417,14 +7425,6 @@ core
 @out1: 
 @samples: 
 
-<!-- ##### FUNCTION double_to_extended ##### -->
-<para>
-
-</para>
-
-@Param1: 
-@Param2: 
-
 <!-- ##### SECTION ./tmpl/vlc.sgml:Title ##### -->
 vlc
 
@@ -7452,7 +7452,7 @@ vlc
 </para>
 
 
-<!-- ##### SECTION ./tmpl/ac3.sgml:See_Also ##### -->
+<!-- ##### MACRO LITTLE_ENDIAN ##### -->
 <para>
 
 </para>
@@ -7462,7 +7462,7 @@ vlc
 
 
 
-<!-- ##### MACRO LITTLE_ENDIAN ##### -->
+<!-- ##### SECTION ./tmpl/ac3.sgml:See_Also ##### -->
 <para>
 
 </para>
@@ -7474,7 +7474,7 @@ vlc
 </para>
 
 
-<!-- ##### SECTION ./tmpl/exponent.sgml:Long_Description ##### -->
+<!-- ##### MACRO SKIPPED_PICTURE ##### -->
 <para>
 
 </para>
@@ -7486,7 +7486,7 @@ vlc
 </para>
 
 
-<!-- ##### MACRO SKIPPED_PICTURE ##### -->
+<!-- ##### SECTION ./tmpl/exponent.sgml:Long_Description ##### -->
 <para>
 
 </para>
@@ -7519,18 +7519,18 @@ vlc
 @name: 
 @Returns: 
 
-<!-- ##### MACRO PICTURE_CODING_EXTENSION_ID ##### -->
+<!-- ##### FUNCTION gst_cobin_iterate ##### -->
 <para>
 
 </para>
 
+@cobin: 
 
-<!-- ##### FUNCTION gst_cobin_iterate ##### -->
+<!-- ##### MACRO PICTURE_CODING_EXTENSION_ID ##### -->
 <para>
 
 </para>
 
-@cobin: 
 
 <!-- ##### MACRO NUM_MASK ##### -->
 <para>
@@ -7538,8 +7538,10 @@ vlc
 </para>
 
 
-<!-- ##### SECTION ./tmpl/qtables.sgml:Title ##### -->
-qtables
+<!-- ##### SECTION ./tmpl/ac3.sgml:Long_Description ##### -->
+<para>
+
+</para>
 
 
 <!-- ##### FUNCTION gtk_overlay_image_new ##### -->
@@ -7549,10 +7551,8 @@ qtables
 
 @Returns: 
 
-<!-- ##### SECTION ./tmpl/ac3.sgml:Long_Description ##### -->
-<para>
-
-</para>
+<!-- ##### SECTION ./tmpl/qtables.sgml:Title ##### -->
+qtables
 
 
 <!-- ##### MACRO RUN_MASK ##### -->
@@ -7561,20 +7561,20 @@ qtables
 </para>
 
 
-<!-- ##### FUNCTION initme ##### -->
+<!-- ##### MACRO BIG_ENDIAN_ARCHITECTURE ##### -->
 <para>
 
 </para>
 
-@vid_stream: 
 
-<!-- ##### MACRO BIG_ENDIAN_ARCHITECTURE ##### -->
+<!-- ##### FUNCTION initme ##### -->
 <para>
 
 </para>
 
+@vid_stream: 
 
-<!-- ##### MACRO DCTSATURATE ##### -->
+<!-- ##### MACRO HUFFMAN_ESCAPE ##### -->
 <para>
 
 </para>
@@ -7586,7 +7586,7 @@ qtables
 </para>
 
 
-<!-- ##### MACRO HUFFMAN_ESCAPE ##### -->
+<!-- ##### MACRO DCTSATURATE ##### -->
 <para>
 
 </para>
@@ -7596,13 +7596,13 @@ qtables
 
 
 
-<!-- ##### MACRO GRAB_ATTR_BRIGHT ##### -->
+<!-- ##### SECTION ./tmpl/debug.sgml:See_Also ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### SECTION ./tmpl/debug.sgml:See_Also ##### -->
+<!-- ##### MACRO GRAB_ATTR_BRIGHT ##### -->
 <para>
 
 </para>
@@ -7621,13 +7621,13 @@ qtables
 
 @vid_stream: 
 
-<!-- ##### SECTION ./tmpl/gdkxvimage.sgml:See_Also ##### -->
+<!-- ##### MACRO L_DVAR ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### MACRO L_DVAR ##### -->
+<!-- ##### SECTION ./tmpl/gdkxvimage.sgml:See_Also ##### -->
 <para>
 
 </para>
@@ -7637,19 +7637,19 @@ qtables
 mpeg2dec
 
 
-<!-- ##### SECTION ./tmpl/dct.sgml:See_Also ##### -->
+<!-- ##### FUNCTION gst_xing_chain ##### -->
 <para>
 
 </para>
 
+@pad: 
+@buf: 
 
-<!-- ##### FUNCTION gst_xing_chain ##### -->
+<!-- ##### SECTION ./tmpl/dct.sgml:See_Also ##### -->
 <para>
 
 </para>
 
-@pad: 
-@buf: 
 
 <!-- ##### TYPEDEF ID[4] ##### -->
 <para>
@@ -7694,13 +7694,13 @@ mpeg2dec
 </para>
 
 
-<!-- ##### SECTION ./tmpl/ctables.sgml:See_Also ##### -->
+<!-- ##### SECTION ./tmpl/imdct.sgml:Long_Description ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### SECTION ./tmpl/imdct.sgml:Long_Description ##### -->
+<!-- ##### SECTION ./tmpl/ctables.sgml:See_Also ##### -->
 <para>
 
 </para>
@@ -7736,13 +7736,13 @@ mpeg2dec
 
 @Param1: 
 
-<!-- ##### MACRO FRAME ##### -->
+<!-- ##### MACRO MPG_MD_STEREO ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### MACRO MPG_MD_STEREO ##### -->
+<!-- ##### MACRO FRAME ##### -->
 <para>
 
 </para>
@@ -7776,7 +7776,7 @@ mpeg2dec
 </para>
 
 
-<!-- ##### MACRO EXSC_LENGTH ##### -->
+<!-- ##### ARG GstVideoSink:height ##### -->
 <para>
 
 </para>
@@ -7786,19 +7786,19 @@ mpeg2dec
 util
 
 
-<!-- ##### ARG GstVideoSink:height ##### -->
+<!-- ##### MACRO EXSC_LENGTH ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### TYPEDEF dct_dc_size_entry ##### -->
+<!-- ##### MACRO UMASK ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### MACRO UMASK ##### -->
+<!-- ##### TYPEDEF dct_dc_size_entry ##### -->
 <para>
 
 </para>
@@ -7825,6 +7825,10 @@ util
 </para>
 
 
+<!-- ##### SECTION ./tmpl/getvlc.sgml:Short_Description ##### -->
+
+
+
 <!-- ##### STRUCT Mpeg1Stream ##### -->
 <para>
 
@@ -7834,12 +7838,10 @@ util
 @STD_buffer_bound_scale: 
 @STD_buffer_size_bound: 
 
-<!-- ##### SECTION ./tmpl/getvlc.sgml:Short_Description ##### -->
-
-
-
-<!-- ##### SECTION ./tmpl/rematrix.sgml:Short_Description ##### -->
+<!-- ##### MACRO MB_INTRA ##### -->
+<para>
 
+</para>
 
 
 <!-- ##### MACRO HAN_SIZE ##### -->
@@ -7848,10 +7850,8 @@ util
 </para>
 
 
-<!-- ##### MACRO MB_INTRA ##### -->
-<para>
+<!-- ##### SECTION ./tmpl/rematrix.sgml:Short_Description ##### -->
 
-</para>
 
 
 <!-- ##### MACRO LAST_SCR_BYTE_IN_PACK ##### -->
@@ -7917,32 +7917,32 @@ util
 
 
 
-<!-- ##### FUNCTION aiff_seek_to_sound_data ##### -->
+<!-- ##### SECTION ./tmpl/L3.sgml:See_Also ##### -->
 <para>
 
 </para>
 
-@Param1: 
-@Returns: 
 
-<!-- ##### SECTION ./tmpl/L3.sgml:See_Also ##### -->
+<!-- ##### FUNCTION aiff_seek_to_sound_data ##### -->
 <para>
 
 </para>
 
+@Param1: 
+@Returns: 
 
-<!-- ##### FUNCTION cvt_to_wave_test ##### -->
+<!-- ##### MACRO SKIP_PICTURE ##### -->
 <para>
 
 </para>
 
-@Returns: 
 
-<!-- ##### MACRO SKIP_PICTURE ##### -->
+<!-- ##### FUNCTION cvt_to_wave_test ##### -->
 <para>
 
 </para>
 
+@Returns: 
 
 <!-- ##### FUNCTION gst_mpeg1encoder_new ##### -->
 <para>
@@ -7966,6 +7966,14 @@ util
 </para>
 
 
+<!-- ##### FUNCTION ChenDct ##### -->
+<para>
+
+</para>
+
+@x: 
+@y: 
+
 <!-- ##### FUNCTION mpeg2play_new_buffer ##### -->
 <para>
 
@@ -7977,14 +7985,6 @@ util
 @first: 
 @Returns: 
 
-<!-- ##### FUNCTION ChenDct ##### -->
-<para>
-
-</para>
-
-@x: 
-@y: 
-
 <!-- ##### MACRO B_TYPE ##### -->
 <para>
 
@@ -8012,13 +8012,13 @@ util
 </para>
 
 
-<!-- ##### MACRO IN_PICTURE_PARSE ##### -->
+<!-- ##### MACRO SEQ_START_CODE ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### MACRO SEQ_START_CODE ##### -->
+<!-- ##### MACRO IN_PICTURE_PARSE ##### -->
 <para>
 
 </para>
@@ -8030,18 +8030,18 @@ util
 </para>
 
 
-<!-- ##### MACRO SKIP_JUNK ##### -->
+<!-- ##### MACRO GTK_OVERLAY_IMAGE_BYTE_ORDER ##### -->
 <para>
 
 </para>
 
+@obj: 
 
-<!-- ##### MACRO GTK_OVERLAY_IMAGE_BYTE_ORDER ##### -->
+<!-- ##### MACRO SKIP_JUNK ##### -->
 <para>
 
 </para>
 
-@obj: 
 
 <!-- ##### TYPEDEF INT16 ##### -->
 <para>
@@ -8089,31 +8089,25 @@ util
 </para>
 
 
-<!-- ##### SECTION ./tmpl/htable.sgml:Short_Description ##### -->
-
-
-
 <!-- ##### SECTION ./tmpl/jdw.sgml:Short_Description ##### -->
 
 
 
-<!-- ##### MACRO STREAMS_AUDIO ##### -->
-<para>
+<!-- ##### SECTION ./tmpl/htable.sgml:Short_Description ##### -->
 
-</para>
 
 
 <!-- ##### SECTION ./tmpl/dga.sgml:Title ##### -->
 dga
 
 
-<!-- ##### SECTION ./tmpl/encoder.sgml:See_Also ##### -->
+<!-- ##### MACRO STREAMS_AUDIO ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### SECTION ./tmpl/putbits.sgml:See_Also ##### -->
+<!-- ##### SECTION ./tmpl/encoder.sgml:See_Also ##### -->
 <para>
 
 </para>
@@ -8125,7 +8119,7 @@ dga
 </para>
 
 
-<!-- ##### MACRO MV_FRAME ##### -->
+<!-- ##### SECTION ./tmpl/putbits.sgml:See_Also ##### -->
 <para>
 
 </para>
@@ -8137,6 +8131,12 @@ dga
 </para>
 
 
+<!-- ##### MACRO MV_FRAME ##### -->
+<para>
+
+</para>
+
+
 <!-- ##### MACRO BLOCKSIZE ##### -->
 <para>
 
@@ -8149,20 +8149,20 @@ dga
 </para>
 
 
-<!-- ##### FUNCTION aiff_read_headers ##### -->
+<!-- ##### MACRO ESCAPE ##### -->
 <para>
 
 </para>
 
-@Param1: 
-@Param2: 
-@Returns: 
 
-<!-- ##### MACRO ESCAPE ##### -->
+<!-- ##### FUNCTION aiff_read_headers ##### -->
 <para>
 
 </para>
 
+@Param1: 
+@Param2: 
+@Returns: 
 
 <!-- ##### ARG GstV4lSrc:hue ##### -->
 <para>
@@ -8211,13 +8211,13 @@ dga
 
 @info: 
 
-<!-- ##### SECTION ./tmpl/gtkoverlayimage.sgml:Long_Description ##### -->
+<!-- ##### ARG GstVuMeter:volume ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### ARG GstVuMeter:volume ##### -->
+<!-- ##### SECTION ./tmpl/gtkoverlayimage.sgml:Long_Description ##### -->
 <para>
 
 </para>
@@ -8229,13 +8229,13 @@ dga
 </para>
 
 
-<!-- ##### MACRO TALK ##### -->
+<!-- ##### MACRO PICTURE_SPATIAL_SCALABLE_EXTENSION_ID ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### MACRO PICTURE_SPATIAL_SCALABLE_EXTENSION_ID ##### -->
+<!-- ##### MACRO TALK ##### -->
 <para>
 
 </para>
@@ -8247,6 +8247,12 @@ dga
 </para>
 
 
+<!-- ##### TYPEDEF INT32 ##### -->
+<para>
+
+</para>
+
+
 <!-- ##### STRUCT Mpeg1MuxBuffer ##### -->
 <para>
 
@@ -8263,12 +8269,6 @@ dga
 @new_frame: 
 @next_frame_time: 
 
-<!-- ##### TYPEDEF INT32 ##### -->
-<para>
-
-</para>
-
-
 <!-- ##### FUNCTION gst_jpeg_chain ##### -->
 <para>
 
@@ -8277,13 +8277,13 @@ dga
 @pad: 
 @buf: 
 
-<!-- ##### SECTION ./tmpl/bit_allocate.sgml:Long_Description ##### -->
+<!-- ##### TYPEDEF D640[640] ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### TYPEDEF D640[640] ##### -->
+<!-- ##### SECTION ./tmpl/bit_allocate.sgml:Long_Description ##### -->
 <para>
 
 </para>
@@ -8297,20 +8297,20 @@ dga
 @image: 
 @val: 
 
-<!-- ##### FUNCTION SubCompensate ##### -->
+<!-- ##### MACRO DELTA_BIT_NONE ##### -->
 <para>
 
 </para>
 
-@vid_stream: 
-@matrix: 
-@XIob: 
 
-<!-- ##### MACRO DELTA_BIT_NONE ##### -->
+<!-- ##### FUNCTION SubCompensate ##### -->
 <para>
 
 </para>
 
+@vid_stream: 
+@matrix: 
+@XIob: 
 
 <!-- ##### SECTION ./tmpl/qtables.sgml:See_Also ##### -->
 <para>
@@ -8318,11 +8318,13 @@ dga
 </para>
 
 
-<!-- ##### FUNCTION mpg123_init_conv16to8_table ##### -->
+<!-- ##### FUNCTION rematrix ##### -->
 <para>
 
 </para>
 
+@audblk: 
+@coeffs: 
 
 <!-- ##### FUNCTION gst_aviencoder_make_video_header ##### -->
 <para>
@@ -8336,13 +8338,11 @@ dga
 @bit_cnt: 
 @Returns: 
 
-<!-- ##### FUNCTION rematrix ##### -->
+<!-- ##### FUNCTION mpg123_init_conv16to8_table ##### -->
 <para>
 
 </para>
 
-@audblk: 
-@coeffs: 
 
 <!-- ##### FUNCTION crc_validate ##### -->
 <para>
@@ -8369,21 +8369,21 @@ dga
 </para>
 
 
-<!-- ##### FUNCTION gst_mpg123_new ##### -->
+<!-- ##### FUNCTION gst_synaesthesia_chain ##### -->
 <para>
 
 </para>
 
-@name
-@Returns
+@pad
+@buf
 
-<!-- ##### FUNCTION gst_synaesthesia_chain ##### -->
+<!-- ##### FUNCTION gst_mpg123_new ##### -->
 <para>
 
 </para>
 
-@pad
-@buf
+@name
+@Returns
 
 <!-- ##### ARG System_Encode:audio ##### -->
 <para>
index b38a8cf..18410f3 100644 (file)
@@ -296,3 +296,51 @@ pad has caps
 
 
 =====================================
+
+  srccaps = GST_PAD_CAPS (srcpad);
+  srctempl = FALSE;
+
+  do {
+
+    //no caps, get one
+    if (!srccaps) 
+    {
+      if (srcpad->negotiatefunc && !srctempl) 
+      {
+        srccaps = srcpad->negotiatefunc (srpad, srcaps, counter);
+        srctempl = FALSE;
+      }
+      else 
+      {
+        srccaps = gst_pad_get_caps (srcpad);    
+       srctempl = TRUE;
+      }
+    }
+
+    /* check against other pad */
+    
+    // the other pad doesn't want to negotiate
+    if (!sinkpad->negotiatefunc) 
+    {
+      sinkcaps = gst_pad_get_caps (sinkpad);
+
+      if (!sinkcaps)
+        break;
+
+      if (gst_caps_check_compatibility (srccaps, sinkcaps)) 
+      {
+        // cool
+        break;
+      }
+    }
+    else {
+      switch pads;      
+    }
+
+  } while (counter < 100);
+
+
+
+
+
+
index eff130d..3d7c7d8 100644 (file)
@@ -51,8 +51,6 @@ int main(int argc,char *argv[])
   gst_pad_connect(gst_element_get_pad(decoder,"src"),
                   gst_element_get_pad(audiosink,"sink"));
 
-  /* make it ready */
-  gst_element_set_state(bin, GST_STATE_READY);
   /* start playing */
   gst_element_set_state(bin, GST_STATE_PLAYING);
 
index 146c689..e2caf58 100644 (file)
@@ -1,16 +1,6 @@
 #include <stdlib.h>
 #include <gst/gst.h>
 
-gboolean playing;
-
-/* eos will be called when the src element has an end of stream */
-void eos(GstElement *element, gpointer data) 
-{
-  g_print("have eos, quitting\n");
-
-  playing = FALSE;
-}
-
 int main(int argc,char *argv[]) 
 {
   GstElement *disksrc, *audiosink, *parse, *decode, *queue;
@@ -36,8 +26,6 @@ int main(int argc,char *argv[])
   disksrc = gst_elementfactory_make("disksrc", "disk_source");
   g_assert(disksrc != NULL);
   gtk_object_set(GTK_OBJECT(disksrc),"location", argv[1],NULL);
-  gtk_signal_connect(GTK_OBJECT(disksrc),"eos",
-                     GTK_SIGNAL_FUNC(eos), thread);
 
   parse = gst_elementfactory_make("mp3parse", "parse");
   decode = gst_elementfactory_make("mpg123", "decode");
@@ -69,16 +57,10 @@ int main(int argc,char *argv[])
   gst_pad_connect(gst_element_get_pad(queue,"src"),
                   gst_element_get_pad(audiosink,"sink"));
 
-  /* make it ready */
-  gst_element_set_state(GST_ELEMENT(bin), GST_STATE_READY);
   /* start playing */
   gst_element_set_state(GST_ELEMENT(bin), GST_STATE_PLAYING);
 
-  playing = TRUE;
-
-  while (playing) {
-    gst_bin_iterate(GST_BIN(bin));
-  }
+  while (gst_bin_iterate(GST_BIN(bin)));
 
   gst_element_set_state(GST_ELEMENT(bin), GST_STATE_NULL);
 
index 5594ec8..400e825 100644 (file)
@@ -35,8 +35,6 @@ int main(int argc,char *argv[])
 
   xml = gst_xml_new ();
 
-  //g_print ("%p\n", xml);
-
   gtk_signal_connect (GTK_OBJECT (xml), "object_loaded", xml_loaded, xml);
 
   ret = gst_xml_parse_file(xml, "xmlTest.gst", NULL);
@@ -47,8 +45,6 @@ int main(int argc,char *argv[])
 
   gst_element_set_state(bin, GST_STATE_PLAYING);
 
-  playing = TRUE;
-
   while (gst_bin_iterate(GST_BIN(bin)));
 
   gst_element_set_state(bin, GST_STATE_NULL);
index 5499e3a..41a2b6c 100644 (file)
@@ -49,7 +49,9 @@ static void                   gst_audiosink_init              (GstAudioSink *audiosink);
 
 static gboolean                gst_audiosink_open_audio        (GstAudioSink *sink);
 static void                    gst_audiosink_close_audio       (GstAudioSink *sink);
+static void                    gst_audiosink_sync_parms        (GstAudioSink *audiosink);
 static GstElementStateReturn   gst_audiosink_change_state      (GstElement *element);
+static GstPadNegotiateReturn   gst_audiosink_negotiate         (GstPad *pad, GstCaps **caps, gint counter);
 
 static void                    gst_audiosink_set_arg           (GtkObject *object, GtkArg *arg, guint id);
 static void                    gst_audiosink_get_arg           (GtkObject *object, GtkArg *arg, guint id);
@@ -188,6 +190,7 @@ gst_audiosink_init (GstAudioSink *audiosink)
 {
   audiosink->sinkpad = gst_pad_new_from_template (gst_audiosink_sink_template, "sink");
   gst_element_add_pad (GST_ELEMENT (audiosink), audiosink->sinkpad);
+  gst_pad_set_negotiate_function (audiosink->sinkpad, gst_audiosink_negotiate);
 
   gst_pad_set_chain_function (audiosink->sinkpad, gst_audiosink_chain);
 
@@ -202,6 +205,41 @@ gst_audiosink_init (GstAudioSink *audiosink)
   GST_FLAG_SET (audiosink, GST_ELEMENT_THREAD_SUGGESTED);
 }
 
+static GstPadNegotiateReturn 
+gst_audiosink_negotiate (GstPad *pad, GstCaps **caps, gint counter) 
+{
+  GstAudioSink *audiosink;
+
+  g_return_val_if_fail (pad != NULL, GST_PAD_NEGOTIATE_FAIL);
+  g_return_val_if_fail (GST_IS_PAD (pad), GST_PAD_NEGOTIATE_FAIL);
+
+  audiosink = GST_AUDIOSINK (gst_pad_get_parent (pad));
+
+  g_print ("audiosink: negotiate\n");
+  // we decide
+  if (counter == 0) {
+    *caps = NULL;
+    return GST_PAD_NEGOTIATE_TRY;
+  }
+  // have we got caps?
+  else if (*caps) {
+    if (audiosink->fd == -1) return GST_PAD_NEGOTIATE_FAIL;
+
+    audiosink->format = gst_caps_get_int (*caps, "format");
+    audiosink->channels = gst_caps_get_int (*caps, "channels");
+    audiosink->frequency = gst_caps_get_int (*caps, "rate");
+
+    gst_audiosink_sync_parms (audiosink);
+
+    // FIXME check if the qound card was really set to these caps,
+    // else send out another caps..
+
+    return GST_PAD_NEGOTIATE_AGREE;
+  }
+  
+  return GST_PAD_NEGOTIATE_FAIL;
+}
+
 static void 
 gst_audiosink_sync_parms (GstAudioSink *audiosink) 
 {
@@ -222,7 +260,7 @@ gst_audiosink_sync_parms (GstAudioSink *audiosink)
 
   ioctl (audiosink->fd, SNDCTL_DSP_GETOSPACE, &ospace);
 
-  g_print("audiosink: setting sound card to %dKHz %d bit %s (%d bytes buffer, %d fragment)\n",
+  g_print("audiosink: setting sound card to %dHz %d bit %s (%d bytes buffer, %d fragment)\n",
           audiosink->frequency, audiosink->format,
           (audiosink->channels == 2) ? "stereo" : "mono", ospace.bytes, frag);
 
@@ -232,7 +270,6 @@ static void
 gst_audiosink_chain (GstPad *pad, GstBuffer *buf) 
 {
   GstAudioSink *audiosink;
-  MetaAudioRaw *meta;
   gboolean in_flush;
   audio_buf_info ospace;
 
@@ -252,22 +289,6 @@ gst_audiosink_chain (GstPad *pad, GstBuffer *buf)
     ioctl (audiosink->fd, SNDCTL_DSP_RESET, 0);
   }
 
-
-  meta = (MetaAudioRaw *)gst_buffer_get_first_meta (buf);
-  if (meta != NULL) {
-    if ((meta->format != audiosink->format) ||
-        (meta->channels != audiosink->channels) ||
-        (meta->frequency != audiosink->frequency)) 
-    {
-      audiosink->format    = meta->format;
-      audiosink->channels  = meta->channels;
-      audiosink->frequency = meta->frequency;
-      gst_audiosink_sync_parms (audiosink);
-      g_print("audiosink: sound device set to format %d, %d channels, %dHz\n",
-              audiosink->format, audiosink->channels, audiosink->frequency);
-    }
-  }
-
   gtk_signal_emit (GTK_OBJECT (audiosink), gst_audiosink_signals[SIGNAL_HANDOFF],
                   audiosink);
 
@@ -368,10 +389,6 @@ gst_audiosink_open_audio (GstAudioSink *sink)
   /* if we have it, set the default parameters and go have fun */
   if (sink->fd >= 0) {
     /* set card state */
-    sink->format = AFMT_S16_LE;
-    sink->channels = 2; /* stereo */
-    sink->frequency = 44100;
-    gst_audiosink_sync_parms (sink);
     ioctl(sink->fd, SNDCTL_DSP_GETCAPS, &sink->caps);
 
     g_print("audiosink: Capabilities\n");
index fa61f4f..4e6b8f3 100644 (file)
@@ -399,10 +399,21 @@ gst_caps_check_compatibility_func (GstCaps *fromcaps, GstCaps *tocaps)
 gboolean
 gst_caps_check_compatibility (GstCaps *fromcaps, GstCaps *tocaps)
 {
-  if (fromcaps == NULL ||
-      tocaps == NULL) {
-    GST_DEBUG (0,"gstcaps: no caps\n");
-    return TRUE;
+  if (fromcaps == NULL) {
+    if (tocaps == NULL) {
+      GST_DEBUG (0,"gstcaps: no caps\n");
+      return TRUE;
+    }
+    else {
+      GST_DEBUG (0,"gstcaps: no src but destination caps\n");
+      return FALSE;
+    }
+  }
+  else {
+    if (tocaps == NULL) {
+      GST_DEBUG (0,"gstcaps: src caps and no dest caps\n");
+      return TRUE;
+    }
   }
 
   while (fromcaps) {
index 8bb6256..626a51a 100644 (file)
@@ -73,6 +73,12 @@ void         gst_caps_set_type_id                    (GstCaps *caps, guint16 type_id);
 GstCaps*       gst_caps_set_props                      (GstCaps *caps, GstProps *props);
 GstProps*      gst_caps_get_props                      (GstCaps *caps);
 
+#define                gst_caps_set(caps, name, args...)       gst_props_set ((caps)->properties, name, args)
+
+#define                gst_caps_get_int(caps, name)            gst_props_get_int ((caps)->properties, name)
+#define                gst_caps_get_fourcc_int(caps, name)     gst_props_get_fourcc_int ((caps)->properties, name)
+#define                gst_caps_get_boolean(caps, name)        gst_props_get_boolean ((caps)->properties, name)
+
 GstCaps*       gst_caps_get_by_name                    (GstCaps *caps, const gchar *name);
 
 GstCaps*       gst_caps_append                         (GstCaps *caps, GstCaps *capstoadd); 
index 0066d4c..5021e51 100644 (file)
@@ -260,7 +260,7 @@ gst_pad_new_from_template (GstPadTemplate *templ,
 
   pad = gst_pad_new (name, templ->direction);
   GST_PAD_PADTEMPLATE(pad) = templ;
-  GST_PAD_CAPS (pad) = GST_PADTEMPLATE_CAPS (templ);
+  //GST_PAD_CAPS (pad) = GST_PADTEMPLATE_CAPS (templ);
 
   return pad;
 }
@@ -572,9 +572,11 @@ gst_pad_connect (GstPad *srcpad,
   if (GST_PAD_CAPS (srcpad)) {
     negotiated = gst_pad_renegotiate (srcpad);
   }
-  else {
+  else if (GST_PAD_CAPS (sinkpad)) {
     negotiated = gst_pad_renegotiate (sinkpad);
   }
+  else 
+    negotiated = TRUE;
 
   if (!negotiated) {
     gst_pad_disconnect (GST_PAD (realsrc), GST_PAD (realsink));
@@ -728,16 +730,16 @@ gst_pad_get_ghost_pad_list (GstPad *pad)
  *
  * Set the capabilities of this pad.
  */
-void
+gboolean
 gst_pad_set_caps (GstPad *pad,
                   GstCaps *caps)
 {
-  g_return_if_fail (pad != NULL);
-  g_return_if_fail (GST_IS_REAL_PAD (pad));            // NOTE this restriction
+  g_return_val_if_fail (pad != NULL, FALSE);
+  g_return_val_if_fail (GST_IS_REAL_PAD (pad), FALSE);         // NOTE this restriction
 
   GST_PAD_CAPS(pad) = caps;
 
-  gst_pad_renegotiate (pad);
+  return gst_pad_renegotiate (pad);
 }
 
 /**
@@ -754,9 +756,27 @@ gst_pad_get_caps (GstPad *pad)
   g_return_val_if_fail (pad != NULL, NULL);
   g_return_val_if_fail (GST_IS_PAD (pad), NULL);
 
-  return GST_PAD_CAPS(pad);
+  if (GST_PAD_CAPS (pad))
+    return GST_PAD_CAPS (pad);
+  else if (GST_PAD_PADTEMPLATE (pad))
+    return GST_PADTEMPLATE_CAPS (GST_PAD_PADTEMPLATE (pad));
+
+  return NULL;
 }
 
+GstCaps*
+gst_pad_get_padtemplate_caps (GstPad *pad)
+{
+  g_return_val_if_fail (pad != NULL, NULL);
+  g_return_val_if_fail (GST_IS_PAD (pad), NULL);
+
+  if (GST_PAD_PADTEMPLATE (pad))
+    return GST_PADTEMPLATE_CAPS (GST_PAD_PADTEMPLATE (pad));
+
+  return NULL;
+}
+
+
 /**
  * gst_pad_get_caps_by_name:
  * @pad: the pad to get the capabilities from
@@ -914,8 +934,8 @@ gst_pad_renegotiate (GstPad *pad)
   gint counter = 0;
   GstCaps *newcaps = NULL;
   GstRealPad *peerpad, *currentpad, *otherpad;
-  GstCaps *currentcaps;
   GstPadDirection currentdirection;
+  GstPadNegotiateReturn result;
   
   g_return_val_if_fail (pad != NULL, FALSE);
 
@@ -935,84 +955,56 @@ gst_pad_renegotiate (GstPad *pad)
             GST_DEBUG_PAD_NAME(pad), GST_DEBUG_PAD_NAME(peerpad));
 
   newcaps = GST_PAD_CAPS (pad);
+  g_assert (newcaps != NULL);
+
+  currentdirection = GST_PAD_DIRECTION (currentpad);
 
   do {
-    currentcaps = newcaps;
-    currentdirection = GST_PAD_DIRECTION (currentpad);
+    gboolean matchtempl;
 
-    /* this pad wants to negotiate */
-    if (currentpad->negotiatefunc) {
+    matchtempl = gst_caps_check_compatibility (newcaps, gst_pad_get_padtemplate_caps (GST_PAD (otherpad)));
 
-      GST_DEBUG (GST_CAT_ELEMENT_PADS, "calling negotiate function on pad %s:%s, count=%d\n",
-                 GST_DEBUG_PAD_NAME(currentpad), counter);
-      newcaps = (currentpad->negotiatefunc) (GST_PAD (currentpad), currentcaps, counter);
+    if (matchtempl) {
+      if (otherpad->negotiatefunc) {
+        GstRealPad *temp;
 
-      if (newcaps == NULL && currentcaps != NULL) {
-        GST_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s has refused, negotiation failed :(, count=%d\n",
-                   GST_DEBUG_PAD_NAME(currentpad), counter);
-       return FALSE;
+        temp = currentpad;
+        currentpad = otherpad;
+        otherpad = temp;
+      }
+      else if (gst_caps_check_compatibility (newcaps, GST_PAD_CAPS (otherpad))) {
+        break;
       }
-      if (newcaps == currentcaps) {
-        GST_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s aggreed with caps, count=%d\n",
-                   GST_DEBUG_PAD_NAME(currentpad), counter);
-       break;
+      else {
+       newcaps = GST_PAD_CAPS (otherpad);
       }
     }
-    /* this pad doesn't want to negotiate, take its caps and that will be it then */
     else {
-      GST_DEBUG (GST_CAT_ELEMENT_PADS, "getting caps from pad %s:%s, count=%d\n",
-                 GST_DEBUG_PAD_NAME(currentpad), counter);
-      newcaps = GST_PAD_CAPS (currentpad);
+      newcaps = GST_PAD_CAPS (otherpad);
     }
-    /* we have a caps structure now */
-
-    /* check if the other pad wants to negotiate */
-    if (!otherpad->negotiatefunc) {
-      GstCaps *srccaps = newcaps;
-      GstCaps *targetcaps = otherpad->caps;
-      /* the pad doesn't want to negotiate, so we check if the caps
-       * we got from the current pad are compatible */
-      GST_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s doesn't want to negotiate, count=%d\n",
-                 GST_DEBUG_PAD_NAME(otherpad), counter);
-       
-      // the other pad has no caps, all is ok
-      if (!targetcaps) 
-        break;
-
-      // make sure we check src to sink
-      if (currentdirection == GST_PAD_SINK) {
-        GstCaps *temp;
 
-        GST_DEBUG (GST_CAT_ELEMENT_PADS, "swapping pad caps for comparison, count=%d\n",
-                   counter);
-        temp = srccaps;
-        srccaps = targetcaps;
-       targetcaps = temp;
-      }
+    counter++;
 
-      if (gst_caps_check_compatibility (srccaps, targetcaps)) {
-        GST_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s has compatible caps, count=%d\n",
-                   GST_DEBUG_PAD_NAME(otherpad), counter);
-        /* we're lucky */
-        break;
+    if (currentpad->negotiatefunc) {
+      result = currentpad->negotiatefunc (GST_PAD (currentpad), &newcaps, counter);
+
+      switch (result) {
+        case GST_PAD_NEGOTIATE_FAIL:
+          return FALSE;
+        case GST_PAD_NEGOTIATE_AGREE:
+          goto succeed;
+        case GST_PAD_NEGOTIATE_TRY:
+          break;
       }
-      /* else, we let the current pad select another caps */
     }
-    /* if the other pad wants to negotiate, setup the pointers */
     else {
-      GstRealPad *temp;
-
-      GST_DEBUG (GST_CAT_ELEMENT_PADS, "switching pads for next phase\n");
-
-      temp = currentpad;
-      currentpad = otherpad;
-      otherpad = temp;
+      return FALSE;
     }
+      
+  } while (counter < 100);
 
-    counter++;
-
-  } while (counter < 100); // FIXME
-
+succeed:
+  
   GST_DEBUG (GST_CAT_ELEMENT_PADS, "pads aggreed on caps :)\n");
 
   /* here we have some sort of aggreement of the caps */
@@ -1022,61 +1014,27 @@ gst_pad_renegotiate (GstPad *pad)
   return TRUE;
 }
 
-GstCaps*
-gst_pad_negotiate_proxy (GstPad *pad, GstCaps *caps, gint counter)
+GstPadNegotiateReturn
+gst_pad_negotiate_proxy (GstPad *pad, GstCaps **caps, gint counter)
 {
   GstRealPad *peer;
-  GstCaps *newcaps = caps;
 
-  g_return_val_if_fail (pad != NULL, NULL);
+  g_return_val_if_fail (pad != NULL, GST_PAD_NEGOTIATE_FAIL);
 
   GST_DEBUG (GST_CAT_ELEMENT_PADS, "pad (%s:%s) proxied\n", GST_DEBUG_PAD_NAME (pad));
 
   peer = GST_RPAD_PEER (pad);
 
-  GST_PAD_CAPS (pad) = caps;
+  //GST_PAD_CAPS (pad) = caps;
 
   if (peer) {
     if (peer->negotiatefunc) {
       GST_DEBUG (GST_CAT_ELEMENT_PADS, "calling negotiate on peer (%s:%s)\n", GST_DEBUG_PAD_NAME (peer));
-      newcaps = peer->negotiatefunc (pad, caps, counter);
-    }
-    else {
-      GstCaps *srccaps = newcaps;
-      GstCaps *targetcaps = peer->caps;
-       
-      if (targetcaps) {
-        if (GST_PAD_DIRECTION (pad) == GST_PAD_SINK) {
-         GstCaps *temp;
-
-           GST_DEBUG (GST_CAT_ELEMENT_PADS, "swapping pad caps for comparison, count=%d\n",
-                      counter);
-          temp = srccaps;
-          srccaps = targetcaps;
-          targetcaps = temp;
-        }
-
-        if (gst_caps_check_compatibility (srccaps, targetcaps)) {
-          GST_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s has compatible caps\n",
-                     GST_DEBUG_PAD_NAME(peer));
-        }
-        else {
-          GST_DEBUG (GST_CAT_ELEMENT_PADS, "target caps but they didn't match %p %p\n", srccaps, targetcaps);
-         return NULL;
-        }
-      }
+      return peer->negotiatefunc (peer, caps, counter);
     }
   }
-  else {
-    GST_DEBUG (GST_CAT_ELEMENT_PADS, "no peer\n");
-  }
-
-  if (caps == newcaps) {
-    GST_PAD_CAPS (pad) = newcaps;
-    if (peer) GST_PAD_CAPS (peer) = newcaps;
-  }
 
-  return newcaps;
+  return GST_PAD_NEGOTIATE_AGREE;
 }
 
 /**
index a392719..f11cc89 100644 (file)
@@ -79,6 +79,12 @@ typedef enum {
   GST_REGION_TIME_LEN,
 } GstRegionType;
 
+typedef enum { 
+  GST_PAD_NEGOTIATE_FAIL,
+  GST_PAD_NEGOTIATE_AGREE,
+  GST_PAD_NEGOTIATE_TRY,
+} GstPadNegotiateReturn;
+
 
 /* this defines the functions used to chain buffers
  * pad is the sink pad (so the same chain function can be used for N pads)
@@ -92,7 +98,7 @@ typedef void (*GstPadPushFunction) (GstPad *pad, GstBuffer *buf);
 typedef GstBuffer *(*GstPadPullFunction) (GstPad *pad);
 typedef GstBuffer *(*GstPadPullRegionFunction) (GstPad *pad, GstRegionType type, guint64 offset, guint64 len);
 typedef gboolean (*GstPadEOSFunction) (GstPad *pad);
-typedef GstCaps* (*GstPadNegotiateFunction) (GstPad *pad, GstCaps *caps, gint count);
+typedef GstPadNegotiateReturn (*GstPadNegotiateFunction) (GstPad *pad, GstCaps **caps, gint count);
 
 typedef enum {
   GST_PAD_UNKNOWN,
@@ -276,8 +282,9 @@ void                        gst_pad_set_qos_function        (GstPad *pad, GstPadQoSFunction qos);
 void                   gst_pad_set_eos_function        (GstPad *pad, GstPadEOSFunction eos);
 void                   gst_pad_set_negotiate_function  (GstPad *pad, GstPadNegotiateFunction nego);
 
-void                   gst_pad_set_caps                (GstPad *pad, GstCaps *caps);
+gboolean               gst_pad_set_caps                (GstPad *pad, GstCaps *caps);
 GstCaps*               gst_pad_get_caps                (GstPad *pad);
+GstCaps*               gst_pad_get_padtemplate_caps    (GstPad *pad);
 gboolean               gst_pad_check_compatibility     (GstPad *srcpad, GstPad *sinkpad);
 
 void                   gst_pad_set_element_private     (GstPad *pad, gpointer priv);
@@ -302,7 +309,7 @@ gboolean            gst_pad_connect                 (GstPad *srcpad, GstPad *sinkpad);
 void                   gst_pad_disconnect              (GstPad *srcpad, GstPad *sinkpad);
 
 gboolean               gst_pad_renegotiate             (GstPad *pad);
-GstCaps*               gst_pad_negotiate_proxy         (GstPad *pad, GstCaps* caps, gint count);
+GstPadNegotiateReturn  gst_pad_negotiate_proxy         (GstPad *pad, GstCaps **caps, gint count);
 
 #if 1
 void                   gst_pad_push                    (GstPad *pad, GstBuffer *buf);
index d3ca3cf..e0e6429 100644 (file)
@@ -89,7 +89,7 @@ gst_props_create_entry (GstPropsFactory factory, gint *skipped)
 
 static gint 
 props_compare_func (gconstpointer a,
-                  gconstpointer b) 
+                   gconstpointer b) 
 {
   GstPropsEntry *entry1 = (GstPropsEntry *)a;
   GstPropsEntry *entry2 = (GstPropsEntry *)b;
@@ -97,6 +97,16 @@ props_compare_func (gconstpointer a,
   return (entry1->propid - entry2->propid);
 }
 
+static gint 
+props_find_func (gconstpointer a,
+                gconstpointer b) 
+{
+  GstPropsEntry *entry2 = (GstPropsEntry *)a;
+  GQuark entry1 = (GQuark) GPOINTER_TO_INT (b);
+
+  return (entry1 - entry2->propid);
+}
+
 /**
  * gst_props_register:
  * @factory: the factory to register
@@ -272,6 +282,118 @@ gst_props_new (GstPropsFactoryEntry entry, ...)
   return props;
 }
 
+GstProps*
+gst_props_set (GstProps *props, const gchar *name, GstPropsFactoryEntry entry, ...)
+{
+  GQuark quark;
+  GList *lentry;
+  va_list var_args;
+  
+  quark = g_quark_from_string (name);
+
+  lentry = g_list_find_custom (props->properties, GINT_TO_POINTER (quark), props_find_func);
+
+  if (lentry) {
+    GstPropsEntry *thisentry;
+    GstPropsFactoryEntry value;
+
+    thisentry = (GstPropsEntry *)lentry->data;
+
+    va_start (var_args, entry);
+    // property name
+    value = (GstPropsFactoryEntry) entry;
+
+    switch (GPOINTER_TO_INT (value)) {
+      case GST_PROPS_INT_ID:
+        thisentry->propstype = GST_PROPS_INT_ID_NUM;
+        value = va_arg (var_args, GstPropsFactoryEntry);
+        thisentry->data.int_data = GPOINTER_TO_INT (value);
+       break;
+      case GST_PROPS_FOURCC_ID_NUM:
+        thisentry->propstype = GST_PROPS_FOURCC_ID_NUM;
+        value = va_arg (var_args, GstPropsFactoryEntry);
+        thisentry->data.fourcc_data = GPOINTER_TO_INT (value);
+        break;
+      case GST_PROPS_BOOL_ID_NUM:
+        thisentry->propstype = GST_PROPS_BOOL_ID_NUM;
+        value = va_arg (var_args, GstPropsFactoryEntry);
+        thisentry->data.bool_data = GPOINTER_TO_INT (value);
+        break;
+      default:
+        g_print("gstprops: type not allowed\n");
+       break;
+    }
+  }
+  else {
+    g_print("gstprops: no property '%s' to change\n", name);
+  }
+
+  return props;
+}
+
+gint
+gst_props_get_int (GstProps *props, const gchar *name)
+{
+  GList *lentry;
+  GQuark quark;
+  
+  quark = g_quark_from_string (name);
+
+  lentry = g_list_find_custom (props->properties, GINT_TO_POINTER (quark), props_find_func);
+
+  if (lentry) {
+    GstPropsEntry *thisentry;
+
+    thisentry = (GstPropsEntry *)lentry->data;
+
+    return thisentry->data.int_data;
+  }
+  
+  return 0;
+}
+
+gulong
+gst_props_get_fourcc_int (GstProps *props, const gchar *name)
+{
+  GList *lentry;
+  GQuark quark;
+  
+  quark = g_quark_from_string (name);
+
+  lentry = g_list_find_custom (props->properties, GINT_TO_POINTER (quark), props_find_func);
+
+  if (lentry) {
+    GstPropsEntry *thisentry;
+
+    thisentry = (GstPropsEntry *)lentry->data;
+
+    return thisentry->data.fourcc_data;
+  }
+  
+  return 0;
+}
+
+gboolean
+gst_props_get_boolean (GstProps *props, const gchar *name)
+{
+  GList *lentry;
+  GQuark quark;
+  
+  quark = g_quark_from_string (name);
+
+  lentry = g_list_find_custom (props->properties, GINT_TO_POINTER (quark), props_find_func);
+
+  if (lentry) {
+    GstPropsEntry *thisentry;
+
+    thisentry = (GstPropsEntry *)lentry->data;
+
+    return thisentry->data.bool_data;
+  }
+  
+  return 0;
+}
+
 /**
  * gst_props_merge:
  * @props: the property to merge into
index fe12355..aae07a3 100644 (file)
@@ -50,20 +50,20 @@ typedef enum {
    GST_PROPS_LAST_ID_NUM = GST_PROPS_END_ID_NUM + 16,
 } GstPropsId;
 
-#define GST_PROPS_END_ID GINT_TO_POINTER(GST_PROPS_END_ID_NUM)
-#define GST_PROPS_LIST_ID GINT_TO_POINTER(GST_PROPS_LIST_ID_NUM)
-#define GST_PROPS_INT_ID GINT_TO_POINTER(GST_PROPS_INT_ID_NUM)
-#define GST_PROPS_INT_RANGE_ID GINT_TO_POINTER(GST_PROPS_INT_RANGE_ID_NUM)
-#define GST_PROPS_FOURCC_ID GINT_TO_POINTER(GST_PROPS_FOURCC_ID_NUM)
-#define GST_PROPS_BOOL_ID GINT_TO_POINTER(GST_PROPS_BOOL_ID_NUM)
-#define GST_PROPS_LAST_ID GINT_TO_POINTER(GST_PROPS_LAST_ID_NUM)
-
-#define GST_PROPS_LIST(a...) GST_PROPS_LIST_ID,##a,NULL
-#define GST_PROPS_INT(a) GST_PROPS_INT_ID,(GINT_TO_POINTER(a))
-#define GST_PROPS_INT_RANGE(a,b) GST_PROPS_INT_RANGE_ID,(GINT_TO_POINTER(a)),(GINT_TO_POINTER(b))
-#define GST_PROPS_FOURCC(a,b,c,d) GST_PROPS_FOURCC_ID,(GINT_TO_POINTER((a)|(b)<<8|(c)<<16|(d)<<24))
-#define GST_PROPS_FOURCC_INT(a) GST_PROPS_FOURCC_ID,(GINT_TO_POINTER(a))
-#define GST_PROPS_BOOLEAN(a) GST_PROPS_BOOL_ID,(GINT_TO_POINTER(a))
+#define GST_PROPS_END_ID       GINT_TO_POINTER(GST_PROPS_END_ID_NUM)
+#define GST_PROPS_LIST_ID      GINT_TO_POINTER(GST_PROPS_LIST_ID_NUM)
+#define GST_PROPS_INT_ID       GINT_TO_POINTER(GST_PROPS_INT_ID_NUM)
+#define GST_PROPS_INT_RANGE_ID         GINT_TO_POINTER(GST_PROPS_INT_RANGE_ID_NUM)
+#define GST_PROPS_FOURCC_ID    GINT_TO_POINTER(GST_PROPS_FOURCC_ID_NUM)
+#define GST_PROPS_BOOL_ID      GINT_TO_POINTER(GST_PROPS_BOOL_ID_NUM)
+#define GST_PROPS_LAST_ID      GINT_TO_POINTER(GST_PROPS_LAST_ID_NUM)
+
+#define GST_PROPS_LIST(a...)           GST_PROPS_LIST_ID,##a,NULL
+#define GST_PROPS_INT(a)               GST_PROPS_INT_ID,(GINT_TO_POINTER(a))
+#define GST_PROPS_INT_RANGE(a,b)       GST_PROPS_INT_RANGE_ID,(GINT_TO_POINTER(a)),(GINT_TO_POINTER(b))
+#define GST_PROPS_FOURCC(a,b,c,d)      GST_PROPS_FOURCC_ID,(GINT_TO_POINTER((a)|(b)<<8|(c)<<16|(d)<<24))
+#define GST_PROPS_FOURCC_INT(a)        GST_PROPS_FOURCC_ID,(GINT_TO_POINTER(a))
+#define GST_PROPS_BOOLEAN(a)           GST_PROPS_BOOL_ID,(GINT_TO_POINTER(a))
 
 
 struct _GstProps {
@@ -82,6 +82,12 @@ GstProps*    gst_props_merge                 (GstProps *props, GstProps *tomerge);
 
 gboolean       gst_props_check_compatibility   (GstProps *fromprops, GstProps *toprops);
 
+GstProps*      gst_props_set                   (GstProps *props, const gchar *name, GstPropsFactoryEntry value, ...);
+
+gint           gst_props_get_int               (GstProps *props, const gchar *name);
+gulong         gst_props_get_fourcc_int        (GstProps *props, const gchar *name);
+gboolean       gst_props_get_boolean           (GstProps *props, const gchar *name);
+
 xmlNodePtr     gst_props_save_thyself          (GstProps *props, xmlNodePtr parent);
 GstProps*      gst_props_load_thyself          (xmlNodePtr parent);
 
index 3f2eea8..b9521b0 100644 (file)
@@ -66,8 +66,8 @@ static void                   gst_queue_set_arg       (GtkObject *object, GtkArg *arg, guint id);
 static void                    gst_queue_get_arg       (GtkObject *object, GtkArg *arg, guint id);
 
 static gboolean                        gst_queue_handle_eos    (GstPad *pad);
-static GstCaps*                gst_queue_handle_negotiate_src (GstPad *pad, GstCaps *caps, gint count);
-static GstCaps*                gst_queue_handle_negotiate_sink (GstPad *pad, GstCaps *caps, gint count);
+static GstPadNegotiateReturn   gst_queue_handle_negotiate_src (GstPad *pad, GstCaps **caps, gint count);
+static GstPadNegotiateReturn   gst_queue_handle_negotiate_sink (GstPad *pad, GstCaps **caps, gint count);
 static void                    gst_queue_chain         (GstPad *pad, GstBuffer *buf);
 static GstBuffer *             gst_queue_get           (GstPad *pad);
 
@@ -152,8 +152,8 @@ gst_queue_init (GstQueue *queue)
   queue->fullcond = g_cond_new ();
 }
 
-static GstCaps*
-gst_queue_handle_negotiate_src (GstPad *pad, GstCaps *caps, gint count)
+static GstPadNegotiateReturn
+gst_queue_handle_negotiate_src (GstPad *pad, GstCaps **caps, gint count)
 {
   GstQueue *queue;
 
@@ -162,8 +162,8 @@ gst_queue_handle_negotiate_src (GstPad *pad, GstCaps *caps, gint count)
   return gst_pad_negotiate_proxy (queue->sinkpad, caps, count);
 }
 
-static GstCaps*
-gst_queue_handle_negotiate_sink (GstPad *pad, GstCaps *caps, gint count)
+static GstPadNegotiateReturn
+gst_queue_handle_negotiate_sink (GstPad *pad, GstCaps **caps, gint count)
 {
   GstQueue *queue;
 
index 5499e3a..41a2b6c 100644 (file)
@@ -49,7 +49,9 @@ static void                   gst_audiosink_init              (GstAudioSink *audiosink);
 
 static gboolean                gst_audiosink_open_audio        (GstAudioSink *sink);
 static void                    gst_audiosink_close_audio       (GstAudioSink *sink);
+static void                    gst_audiosink_sync_parms        (GstAudioSink *audiosink);
 static GstElementStateReturn   gst_audiosink_change_state      (GstElement *element);
+static GstPadNegotiateReturn   gst_audiosink_negotiate         (GstPad *pad, GstCaps **caps, gint counter);
 
 static void                    gst_audiosink_set_arg           (GtkObject *object, GtkArg *arg, guint id);
 static void                    gst_audiosink_get_arg           (GtkObject *object, GtkArg *arg, guint id);
@@ -188,6 +190,7 @@ gst_audiosink_init (GstAudioSink *audiosink)
 {
   audiosink->sinkpad = gst_pad_new_from_template (gst_audiosink_sink_template, "sink");
   gst_element_add_pad (GST_ELEMENT (audiosink), audiosink->sinkpad);
+  gst_pad_set_negotiate_function (audiosink->sinkpad, gst_audiosink_negotiate);
 
   gst_pad_set_chain_function (audiosink->sinkpad, gst_audiosink_chain);
 
@@ -202,6 +205,41 @@ gst_audiosink_init (GstAudioSink *audiosink)
   GST_FLAG_SET (audiosink, GST_ELEMENT_THREAD_SUGGESTED);
 }
 
+static GstPadNegotiateReturn 
+gst_audiosink_negotiate (GstPad *pad, GstCaps **caps, gint counter) 
+{
+  GstAudioSink *audiosink;
+
+  g_return_val_if_fail (pad != NULL, GST_PAD_NEGOTIATE_FAIL);
+  g_return_val_if_fail (GST_IS_PAD (pad), GST_PAD_NEGOTIATE_FAIL);
+
+  audiosink = GST_AUDIOSINK (gst_pad_get_parent (pad));
+
+  g_print ("audiosink: negotiate\n");
+  // we decide
+  if (counter == 0) {
+    *caps = NULL;
+    return GST_PAD_NEGOTIATE_TRY;
+  }
+  // have we got caps?
+  else if (*caps) {
+    if (audiosink->fd == -1) return GST_PAD_NEGOTIATE_FAIL;
+
+    audiosink->format = gst_caps_get_int (*caps, "format");
+    audiosink->channels = gst_caps_get_int (*caps, "channels");
+    audiosink->frequency = gst_caps_get_int (*caps, "rate");
+
+    gst_audiosink_sync_parms (audiosink);
+
+    // FIXME check if the qound card was really set to these caps,
+    // else send out another caps..
+
+    return GST_PAD_NEGOTIATE_AGREE;
+  }
+  
+  return GST_PAD_NEGOTIATE_FAIL;
+}
+
 static void 
 gst_audiosink_sync_parms (GstAudioSink *audiosink) 
 {
@@ -222,7 +260,7 @@ gst_audiosink_sync_parms (GstAudioSink *audiosink)
 
   ioctl (audiosink->fd, SNDCTL_DSP_GETOSPACE, &ospace);
 
-  g_print("audiosink: setting sound card to %dKHz %d bit %s (%d bytes buffer, %d fragment)\n",
+  g_print("audiosink: setting sound card to %dHz %d bit %s (%d bytes buffer, %d fragment)\n",
           audiosink->frequency, audiosink->format,
           (audiosink->channels == 2) ? "stereo" : "mono", ospace.bytes, frag);
 
@@ -232,7 +270,6 @@ static void
 gst_audiosink_chain (GstPad *pad, GstBuffer *buf) 
 {
   GstAudioSink *audiosink;
-  MetaAudioRaw *meta;
   gboolean in_flush;
   audio_buf_info ospace;
 
@@ -252,22 +289,6 @@ gst_audiosink_chain (GstPad *pad, GstBuffer *buf)
     ioctl (audiosink->fd, SNDCTL_DSP_RESET, 0);
   }
 
-
-  meta = (MetaAudioRaw *)gst_buffer_get_first_meta (buf);
-  if (meta != NULL) {
-    if ((meta->format != audiosink->format) ||
-        (meta->channels != audiosink->channels) ||
-        (meta->frequency != audiosink->frequency)) 
-    {
-      audiosink->format    = meta->format;
-      audiosink->channels  = meta->channels;
-      audiosink->frequency = meta->frequency;
-      gst_audiosink_sync_parms (audiosink);
-      g_print("audiosink: sound device set to format %d, %d channels, %dHz\n",
-              audiosink->format, audiosink->channels, audiosink->frequency);
-    }
-  }
-
   gtk_signal_emit (GTK_OBJECT (audiosink), gst_audiosink_signals[SIGNAL_HANDOFF],
                   audiosink);
 
@@ -368,10 +389,6 @@ gst_audiosink_open_audio (GstAudioSink *sink)
   /* if we have it, set the default parameters and go have fun */
   if (sink->fd >= 0) {
     /* set card state */
-    sink->format = AFMT_S16_LE;
-    sink->channels = 2; /* stereo */
-    sink->frequency = 44100;
-    gst_audiosink_sync_parms (sink);
     ioctl(sink->fd, SNDCTL_DSP_GETCAPS, &sink->caps);
 
     g_print("audiosink: Capabilities\n");
index 3f2eea8..b9521b0 100644 (file)
@@ -66,8 +66,8 @@ static void                   gst_queue_set_arg       (GtkObject *object, GtkArg *arg, guint id);
 static void                    gst_queue_get_arg       (GtkObject *object, GtkArg *arg, guint id);
 
 static gboolean                        gst_queue_handle_eos    (GstPad *pad);
-static GstCaps*                gst_queue_handle_negotiate_src (GstPad *pad, GstCaps *caps, gint count);
-static GstCaps*                gst_queue_handle_negotiate_sink (GstPad *pad, GstCaps *caps, gint count);
+static GstPadNegotiateReturn   gst_queue_handle_negotiate_src (GstPad *pad, GstCaps **caps, gint count);
+static GstPadNegotiateReturn   gst_queue_handle_negotiate_sink (GstPad *pad, GstCaps **caps, gint count);
 static void                    gst_queue_chain         (GstPad *pad, GstBuffer *buf);
 static GstBuffer *             gst_queue_get           (GstPad *pad);
 
@@ -152,8 +152,8 @@ gst_queue_init (GstQueue *queue)
   queue->fullcond = g_cond_new ();
 }
 
-static GstCaps*
-gst_queue_handle_negotiate_src (GstPad *pad, GstCaps *caps, gint count)
+static GstPadNegotiateReturn
+gst_queue_handle_negotiate_src (GstPad *pad, GstCaps **caps, gint count)
 {
   GstQueue *queue;
 
@@ -162,8 +162,8 @@ gst_queue_handle_negotiate_src (GstPad *pad, GstCaps *caps, gint count)
   return gst_pad_negotiate_proxy (queue->sinkpad, caps, count);
 }
 
-static GstCaps*
-gst_queue_handle_negotiate_sink (GstPad *pad, GstCaps *caps, gint count)
+static GstPadNegotiateReturn
+gst_queue_handle_negotiate_sink (GstPad *pad, GstCaps **caps, gint count)
 {
   GstQueue *queue;
 
index eff130d..3d7c7d8 100644 (file)
@@ -51,8 +51,6 @@ int main(int argc,char *argv[])
   gst_pad_connect(gst_element_get_pad(decoder,"src"),
                   gst_element_get_pad(audiosink,"sink"));
 
-  /* make it ready */
-  gst_element_set_state(bin, GST_STATE_READY);
   /* start playing */
   gst_element_set_state(bin, GST_STATE_PLAYING);
 
index 146c689..e2caf58 100644 (file)
@@ -1,16 +1,6 @@
 #include <stdlib.h>
 #include <gst/gst.h>
 
-gboolean playing;
-
-/* eos will be called when the src element has an end of stream */
-void eos(GstElement *element, gpointer data) 
-{
-  g_print("have eos, quitting\n");
-
-  playing = FALSE;
-}
-
 int main(int argc,char *argv[]) 
 {
   GstElement *disksrc, *audiosink, *parse, *decode, *queue;
@@ -36,8 +26,6 @@ int main(int argc,char *argv[])
   disksrc = gst_elementfactory_make("disksrc", "disk_source");
   g_assert(disksrc != NULL);
   gtk_object_set(GTK_OBJECT(disksrc),"location", argv[1],NULL);
-  gtk_signal_connect(GTK_OBJECT(disksrc),"eos",
-                     GTK_SIGNAL_FUNC(eos), thread);
 
   parse = gst_elementfactory_make("mp3parse", "parse");
   decode = gst_elementfactory_make("mpg123", "decode");
@@ -69,16 +57,10 @@ int main(int argc,char *argv[])
   gst_pad_connect(gst_element_get_pad(queue,"src"),
                   gst_element_get_pad(audiosink,"sink"));
 
-  /* make it ready */
-  gst_element_set_state(GST_ELEMENT(bin), GST_STATE_READY);
   /* start playing */
   gst_element_set_state(GST_ELEMENT(bin), GST_STATE_PLAYING);
 
-  playing = TRUE;
-
-  while (playing) {
-    gst_bin_iterate(GST_BIN(bin));
-  }
+  while (gst_bin_iterate(GST_BIN(bin)));
 
   gst_element_set_state(GST_ELEMENT(bin), GST_STATE_NULL);
 
index 5594ec8..400e825 100644 (file)
@@ -35,8 +35,6 @@ int main(int argc,char *argv[])
 
   xml = gst_xml_new ();
 
-  //g_print ("%p\n", xml);
-
   gtk_signal_connect (GTK_OBJECT (xml), "object_loaded", xml_loaded, xml);
 
   ret = gst_xml_parse_file(xml, "xmlTest.gst", NULL);
@@ -47,8 +45,6 @@ int main(int argc,char *argv[])
 
   gst_element_set_state(bin, GST_STATE_PLAYING);
 
-  playing = TRUE;
-
   while (gst_bin_iterate(GST_BIN(bin)));
 
   gst_element_set_state(bin, GST_STATE_NULL);
diff --git a/tests/old/testsuite/capsnego/.gitignore b/tests/old/testsuite/capsnego/.gitignore
new file mode 100644 (file)
index 0000000..848066a
--- /dev/null
@@ -0,0 +1,9 @@
+Makefile
+Makefile.in
+*.o
+*.lo
+*.la
+.deps
+.libs
+capsnego
+converter
diff --git a/tests/old/testsuite/capsnego/Makefile.am b/tests/old/testsuite/capsnego/Makefile.am
new file mode 100644 (file)
index 0000000..624ec50
--- /dev/null
@@ -0,0 +1,11 @@
+SUBDIRS =
+
+testprogs = capsnego converter
+
+TESTS = $(testprogs)
+
+check_PROGRAMS = $(testprogs)
+
+# we have nothing but apps here, we can do this safely
+LIBS += $(GST_LIBS)
+CFLAGS += $(GST_CFLAGS)
diff --git a/tests/old/testsuite/capsnego/capsnego.c b/tests/old/testsuite/capsnego/capsnego.c
new file mode 100644 (file)
index 0000000..0866491
--- /dev/null
@@ -0,0 +1,143 @@
+
+#include <gst/gst.h>
+
+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 *srctempl, *sinktempl;
+static GstCaps *srccaps, *sinkcaps;
+
+static GstPadNegotiateReturn
+negotiate_src (GstPad *pad, GstCaps **caps, gint counter)
+{
+  g_print (">");
+
+  if (counter == 0) {
+    *caps = NULL;
+    return GST_PAD_NEGOTIATE_TRY;
+  }
+  if (*caps)
+    return GST_PAD_NEGOTIATE_AGREE;
+
+  return GST_PAD_NEGOTIATE_FAIL;
+}
+
+static GstPadNegotiateReturn
+negotiate_sink (GstPad *pad, GstCaps **caps, gint counter)
+{
+  g_print ("<");
+  if (counter == 0) {
+    *caps = NULL;
+    return GST_PAD_NEGOTIATE_TRY;
+  }
+  if (*caps)
+    return GST_PAD_NEGOTIATE_AGREE;
+
+  return GST_PAD_NEGOTIATE_FAIL;
+}
+
+static gboolean
+perform_check  (void)
+{
+  gboolean result, overall = TRUE;
+
+  gint i, j;
+
+  g_print ("ABC: A=pad caps, B=pad template, C=negotiate function\n");
+
+  for (j=0; j<8; j++) {
+    GstPad *srctest, *sinktest;
+
+    for (i=0; i<8; i++) {
+
+      (j & 0x2 ? (sinktest = sinkpadtempl) : (sinktest = sinkpad));
+      (j & 0x4 ? (gst_pad_set_caps (sinktest, sinkcaps)) : (gst_pad_set_caps (sinktest, NULL)));
+      (j & 0x1 ? (gst_pad_set_negotiate_function (sinktest, negotiate_sink)) :
+                gst_pad_set_negotiate_function (sinktest, NULL));
+      (i & 0x2 ? (srctest = srcpadtempl) : (srctest = srcpad));
+      (i & 0x4 ? (gst_pad_set_caps (srctest, srccaps)) : (gst_pad_set_caps (srctest, NULL)));
+      (i & 0x1 ? (gst_pad_set_negotiate_function (srctest, negotiate_src)) :
+                gst_pad_set_negotiate_function (srctest, NULL));
+
+
+      g_print ("%d%d%d -> %d%d%d ..", (i&4)>>2, (i&2)>>1, i&1, (j&4)>>2, (j&2)>>1, j&1);
+      result = gst_pad_connect (srctest, sinktest);
+
+      g_print (".. %s\n", (result? "ok":"fail"));
+      if (result) gst_pad_disconnect (srctest, sinktest);
+
+      overall &= result;
+    }
+  }
+  return overall;
+}
+
+int 
+main (int argc, char *argv[])
+{
+  gboolean overall = TRUE;
+  
+  gst_init (&argc, &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);
+
+  srcpadtempl = gst_pad_new_from_template (srctempl, "src");
+  sinkpadtempl = gst_pad_new_from_template (sinktempl, "sink");
+
+  sinkcaps  = gst_caps_register (&sink_caps);
+  srccaps  = gst_caps_register (&src_caps);
+
+  g_print ("*** compatible caps/templates ***\n");
+
+  overall &= perform_check ();
+
+  gst_caps_set (srccaps, "height", GST_PROPS_INT (9000));
+
+  g_print ("*** incompatible caps ***\n");
+  overall &= perform_check ();
+
+  exit (!overall);
+}
diff --git a/tests/old/testsuite/capsnego/converter.c b/tests/old/testsuite/capsnego/converter.c
new file mode 100644 (file)
index 0000000..df26338
--- /dev/null
@@ -0,0 +1,168 @@
+
+#include <gst/gst.h>
+
+GstPad *srcpad, *sinkpad;
+GstPad *srcconvpad, *sinkconvpad;
+GstPad *srcpadtempl, *sinkpadtempl;
+GstPad *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 *srctempl, *sinktempl;
+static GstCaps *srccaps, *sinkcaps;
+
+static GstPadNegotiateReturn
+negotiate_src (GstPad *pad, GstCaps **caps, gint counter)
+{
+  g_print (">");
+
+  if (counter == 0) {
+    *caps = NULL;
+    return GST_PAD_NEGOTIATE_TRY;
+  }
+  if (*caps) {
+    converter_out = gst_caps_get_int (*caps, "rate");
+    return GST_PAD_NEGOTIATE_AGREE;
+  }
+
+  return GST_PAD_NEGOTIATE_FAIL;
+}
+
+static GstPadNegotiateReturn
+negotiate_sink (GstPad *pad, GstCaps **caps, gint counter)
+{
+  g_print ("<");
+  if (counter == 0) {
+    *caps = NULL;
+    return GST_PAD_NEGOTIATE_TRY;
+  }
+  if (*caps) {
+    converter_in = gst_caps_get_int (*caps, "rate");
+    return GST_PAD_NEGOTIATE_AGREE;
+  }
+
+  return GST_PAD_NEGOTIATE_FAIL;
+}
+
+int 
+main (int argc, char *argv[])
+{
+  gboolean overall = TRUE;
+  gboolean result;
+  
+  gst_init (&argc, &argv);
+
+  srctempl = gst_padtemplate_new (&src_factory);
+  sinktempl = gst_padtemplate_new (&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);
+  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);
+  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);
+
+  result = gst_pad_connect (srcpad, sinkconvpad);
+  g_print ("pad connect 1: %d\n", result);
+  overall &= (result == TRUE);
+  result = gst_pad_connect (srcconvpad, sinkpad);
+  g_print ("pad connect 2: %d\n", result);
+  overall &= (result == TRUE);
+
+  g_print ("after connect, converter status: %d %d\n", converter_in, converter_out);
+
+  result = gst_pad_set_caps (srcpad, srccaps);
+  g_print ("src pad set caps %d, converter status: %d %d\n", result, converter_in, converter_out);
+
+  result = gst_pad_set_caps (sinkpad, sinkcaps);
+  g_print ("sink pad set caps %d, converter status: %d %d\n", result, converter_in, converter_out);
+
+  gst_caps_set (srccaps, "rate", GST_PROPS_INT (4000));
+  result = gst_pad_renegotiate (srcpad);
+  g_print ("sink pad renegotiate caps %d, converter status: %d %d\n", result, converter_in, converter_out);
+
+  gst_caps_set (srccaps, "rate", GST_PROPS_INT (40000));
+  result = gst_pad_set_caps (srcpad, srccaps);
+  g_print ("sink pad set caps %d, converter status: %d %d\n", result, converter_in, converter_out);
+
+  gst_caps_set (sinkcaps, "rate", GST_PROPS_INT (40000));
+  result = gst_pad_set_caps (sinkpad, sinkcaps);
+  g_print ("sink pad set caps %d, converter status: %d %d\n", result, converter_in, converter_out);
+
+  gst_caps_set (sinkcaps, "rate", GST_PROPS_INT (9000));
+  result = gst_pad_set_caps (sinkpad, sinkcaps);
+  g_print ("sink pad set caps %d, converter status: %d %d\n", result, converter_in, converter_out);
+
+  exit (!overall);
+}
index 9203b13..a0f66bd 100644 (file)
@@ -60,6 +60,15 @@ int main(int argc,char *argv[])
   parent = xmlNewChild (doc->xmlRootNode, NULL, "Props3", NULL);
   gst_props_save_thyself (testprops, parent);
 
+  sinkprops = gst_props_set (sinkprops, "mpegtype", GST_PROPS_INT (1));
+  sinkprops = gst_props_set (sinkprops, "foobar", GST_PROPS_FOURCC_INT (0x56565656));
+
+  g_print ("%08lx\n", gst_props_get_fourcc_int (sinkprops, "foobar"));
+  g_print ("%d\n", gst_props_get_int (sinkprops, "mpegtype"));
+
+  parent = xmlNewChild (doc->xmlRootNode, NULL, "Props4", NULL);
+  gst_props_save_thyself (sinkprops, parent);
+  
   xmlDocDump(stdout, doc);
 
   return 0;
diff --git a/testsuite/capsnego/.gitignore b/testsuite/capsnego/.gitignore
new file mode 100644 (file)
index 0000000..848066a
--- /dev/null
@@ -0,0 +1,9 @@
+Makefile
+Makefile.in
+*.o
+*.lo
+*.la
+.deps
+.libs
+capsnego
+converter
diff --git a/testsuite/capsnego/Makefile.am b/testsuite/capsnego/Makefile.am
new file mode 100644 (file)
index 0000000..624ec50
--- /dev/null
@@ -0,0 +1,11 @@
+SUBDIRS =
+
+testprogs = capsnego converter
+
+TESTS = $(testprogs)
+
+check_PROGRAMS = $(testprogs)
+
+# we have nothing but apps here, we can do this safely
+LIBS += $(GST_LIBS)
+CFLAGS += $(GST_CFLAGS)
diff --git a/testsuite/capsnego/capsnego.c b/testsuite/capsnego/capsnego.c
new file mode 100644 (file)
index 0000000..0866491
--- /dev/null
@@ -0,0 +1,143 @@
+
+#include <gst/gst.h>
+
+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 *srctempl, *sinktempl;
+static GstCaps *srccaps, *sinkcaps;
+
+static GstPadNegotiateReturn
+negotiate_src (GstPad *pad, GstCaps **caps, gint counter)
+{
+  g_print (">");
+
+  if (counter == 0) {
+    *caps = NULL;
+    return GST_PAD_NEGOTIATE_TRY;
+  }
+  if (*caps)
+    return GST_PAD_NEGOTIATE_AGREE;
+
+  return GST_PAD_NEGOTIATE_FAIL;
+}
+
+static GstPadNegotiateReturn
+negotiate_sink (GstPad *pad, GstCaps **caps, gint counter)
+{
+  g_print ("<");
+  if (counter == 0) {
+    *caps = NULL;
+    return GST_PAD_NEGOTIATE_TRY;
+  }
+  if (*caps)
+    return GST_PAD_NEGOTIATE_AGREE;
+
+  return GST_PAD_NEGOTIATE_FAIL;
+}
+
+static gboolean
+perform_check  (void)
+{
+  gboolean result, overall = TRUE;
+
+  gint i, j;
+
+  g_print ("ABC: A=pad caps, B=pad template, C=negotiate function\n");
+
+  for (j=0; j<8; j++) {
+    GstPad *srctest, *sinktest;
+
+    for (i=0; i<8; i++) {
+
+      (j & 0x2 ? (sinktest = sinkpadtempl) : (sinktest = sinkpad));
+      (j & 0x4 ? (gst_pad_set_caps (sinktest, sinkcaps)) : (gst_pad_set_caps (sinktest, NULL)));
+      (j & 0x1 ? (gst_pad_set_negotiate_function (sinktest, negotiate_sink)) :
+                gst_pad_set_negotiate_function (sinktest, NULL));
+      (i & 0x2 ? (srctest = srcpadtempl) : (srctest = srcpad));
+      (i & 0x4 ? (gst_pad_set_caps (srctest, srccaps)) : (gst_pad_set_caps (srctest, NULL)));
+      (i & 0x1 ? (gst_pad_set_negotiate_function (srctest, negotiate_src)) :
+                gst_pad_set_negotiate_function (srctest, NULL));
+
+
+      g_print ("%d%d%d -> %d%d%d ..", (i&4)>>2, (i&2)>>1, i&1, (j&4)>>2, (j&2)>>1, j&1);
+      result = gst_pad_connect (srctest, sinktest);
+
+      g_print (".. %s\n", (result? "ok":"fail"));
+      if (result) gst_pad_disconnect (srctest, sinktest);
+
+      overall &= result;
+    }
+  }
+  return overall;
+}
+
+int 
+main (int argc, char *argv[])
+{
+  gboolean overall = TRUE;
+  
+  gst_init (&argc, &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);
+
+  srcpadtempl = gst_pad_new_from_template (srctempl, "src");
+  sinkpadtempl = gst_pad_new_from_template (sinktempl, "sink");
+
+  sinkcaps  = gst_caps_register (&sink_caps);
+  srccaps  = gst_caps_register (&src_caps);
+
+  g_print ("*** compatible caps/templates ***\n");
+
+  overall &= perform_check ();
+
+  gst_caps_set (srccaps, "height", GST_PROPS_INT (9000));
+
+  g_print ("*** incompatible caps ***\n");
+  overall &= perform_check ();
+
+  exit (!overall);
+}
diff --git a/testsuite/capsnego/converter.c b/testsuite/capsnego/converter.c
new file mode 100644 (file)
index 0000000..df26338
--- /dev/null
@@ -0,0 +1,168 @@
+
+#include <gst/gst.h>
+
+GstPad *srcpad, *sinkpad;
+GstPad *srcconvpad, *sinkconvpad;
+GstPad *srcpadtempl, *sinkpadtempl;
+GstPad *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 *srctempl, *sinktempl;
+static GstCaps *srccaps, *sinkcaps;
+
+static GstPadNegotiateReturn
+negotiate_src (GstPad *pad, GstCaps **caps, gint counter)
+{
+  g_print (">");
+
+  if (counter == 0) {
+    *caps = NULL;
+    return GST_PAD_NEGOTIATE_TRY;
+  }
+  if (*caps) {
+    converter_out = gst_caps_get_int (*caps, "rate");
+    return GST_PAD_NEGOTIATE_AGREE;
+  }
+
+  return GST_PAD_NEGOTIATE_FAIL;
+}
+
+static GstPadNegotiateReturn
+negotiate_sink (GstPad *pad, GstCaps **caps, gint counter)
+{
+  g_print ("<");
+  if (counter == 0) {
+    *caps = NULL;
+    return GST_PAD_NEGOTIATE_TRY;
+  }
+  if (*caps) {
+    converter_in = gst_caps_get_int (*caps, "rate");
+    return GST_PAD_NEGOTIATE_AGREE;
+  }
+
+  return GST_PAD_NEGOTIATE_FAIL;
+}
+
+int 
+main (int argc, char *argv[])
+{
+  gboolean overall = TRUE;
+  gboolean result;
+  
+  gst_init (&argc, &argv);
+
+  srctempl = gst_padtemplate_new (&src_factory);
+  sinktempl = gst_padtemplate_new (&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);
+  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);
+  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);
+
+  result = gst_pad_connect (srcpad, sinkconvpad);
+  g_print ("pad connect 1: %d\n", result);
+  overall &= (result == TRUE);
+  result = gst_pad_connect (srcconvpad, sinkpad);
+  g_print ("pad connect 2: %d\n", result);
+  overall &= (result == TRUE);
+
+  g_print ("after connect, converter status: %d %d\n", converter_in, converter_out);
+
+  result = gst_pad_set_caps (srcpad, srccaps);
+  g_print ("src pad set caps %d, converter status: %d %d\n", result, converter_in, converter_out);
+
+  result = gst_pad_set_caps (sinkpad, sinkcaps);
+  g_print ("sink pad set caps %d, converter status: %d %d\n", result, converter_in, converter_out);
+
+  gst_caps_set (srccaps, "rate", GST_PROPS_INT (4000));
+  result = gst_pad_renegotiate (srcpad);
+  g_print ("sink pad renegotiate caps %d, converter status: %d %d\n", result, converter_in, converter_out);
+
+  gst_caps_set (srccaps, "rate", GST_PROPS_INT (40000));
+  result = gst_pad_set_caps (srcpad, srccaps);
+  g_print ("sink pad set caps %d, converter status: %d %d\n", result, converter_in, converter_out);
+
+  gst_caps_set (sinkcaps, "rate", GST_PROPS_INT (40000));
+  result = gst_pad_set_caps (sinkpad, sinkcaps);
+  g_print ("sink pad set caps %d, converter status: %d %d\n", result, converter_in, converter_out);
+
+  gst_caps_set (sinkcaps, "rate", GST_PROPS_INT (9000));
+  result = gst_pad_set_caps (sinkpad, sinkcaps);
+  g_print ("sink pad set caps %d, converter status: %d %d\n", result, converter_in, converter_out);
+
+  exit (!overall);
+}